From 978b96a8b02935d40e3a2c57cd033dbedd8980e9 Mon Sep 17 00:00:00 2001 From: Zhizhou Yang Date: Fri, 21 Jul 2017 10:30:41 -0700 Subject: Modify the method to patch synthmark The old way to patch synthmark kept a .mk file which will cause build failing. Have put the .mk file patch into a diff file so that Android building system will not see a .mk file here. BUG=None TEST=Checkbuild succeeded with this patched to external/toolchain-utils on Android side. Change-Id: I704aa02d9ca91098727786f053aeb26e989bd481 Reviewed-on: https://chromium-review.googlesource.com/581869 Commit-Ready: Zhizhou Yang Tested-by: Zhizhou Yang Reviewed-by: George Burgess --- android_bench_suite/apply_patches.py | 17 ++++++++++------- android_bench_suite/devrel/Android.mk | 16 ---------------- android_bench_suite/discard_patches.py | 2 -- android_bench_suite/synthmark.diff | 22 ++++++++++++++++++++++ 4 files changed, 32 insertions(+), 25 deletions(-) delete mode 100644 android_bench_suite/devrel/Android.mk create mode 100644 android_bench_suite/synthmark.diff diff --git a/android_bench_suite/apply_patches.py b/android_bench_suite/apply_patches.py index 05849468..fbe1a8d2 100755 --- a/android_bench_suite/apply_patches.py +++ b/android_bench_suite/apply_patches.py @@ -76,15 +76,18 @@ def try_patch_synthmark(): # applied in the future. try: subprocess.check_call([ - 'bash', '-c', 'cd devrel && ' - 'repo init -u sso://devrel/manifest &&' + 'bash', '-c', 'mkdir devrel && ' + 'cd devrel && ' + 'repo init -u sso://devrel/manifest && ' 'repo sync tools/synthmark' ]) - subprocess.check_call(['cp', '-rf', synthmark_dir, config.android_home]) - subprocess.check_call([ - 'cp', 'devrel/Android.mk', - os.path.join(config.android_home, 'synthmark') - ]) + synthmark_patch = os.path.join( + os.path.dirname(os.path.realpath(__file__)), 'synthmark.diff') + subprocess.check_call(['git', '-C', synthmark_dir, + 'apply', synthmark_patch]) + + subprocess.check_call(['mv', '-f', synthmark_dir, config.android_home]) + subprocess.check_call(['rm', '-rf', 'devrel']) print('Synthmark patched successfully!') except subprocess.CalledProcessError: print('Synthmark patch not applied, error or already patched.') diff --git a/android_bench_suite/devrel/Android.mk b/android_bench_suite/devrel/Android.mk deleted file mode 100644 index 39708578..00000000 --- a/android_bench_suite/devrel/Android.mk +++ /dev/null @@ -1,16 +0,0 @@ -# Copyright 2017 The Chromium OS Authors. All rights reserved. -# Use of this source code is governed by a BSD-style license that can be -# found in the LICENSE file. - -LOCAL_PATH := $(call my-dir) - -include $(CLEAR_VARS) -LOCAL_MODULE_TAGS := tests -LOCAL_C_INCLUDES := $(LOCAL_PATH)/source -LOCAL_SRC_FILES:= apps/synthmark.cpp -LOCAL_CFLAGS += -g -std=c++11 -Ofast -LOCAL_CFLAGS += $(CFLAGS_FOR_BENCH_SUITE) -LOCAL_LDFLAGS += $(LDFLAGS_FOR_BENCH_SUITE) -#LOCAL_SHARED_LIBRARIES := libcutils libutils -LOCAL_MODULE := synthmark -include $(BUILD_EXECUTABLE) diff --git a/android_bench_suite/discard_patches.py b/android_bench_suite/discard_patches.py index 39d75720..7a4b0b56 100755 --- a/android_bench_suite/discard_patches.py +++ b/android_bench_suite/discard_patches.py @@ -44,8 +44,6 @@ def dispatch_synthmark(): subprocess.check_call( ['rm', '-rf', os.path.join(config.android_home, synthmark_dir)]) - subprocess.check_call(['rm', '-rf', 'devrel/tools']) - subprocess.check_call(['rm', '-rf', 'devrel/.repo']) print('Synthmark patch removed successfully!') except subprocess.CalledProcessError: print('Synthmark is not removed. Error occurred.') diff --git a/android_bench_suite/synthmark.diff b/android_bench_suite/synthmark.diff new file mode 100644 index 00000000..db87cb94 --- /dev/null +++ b/android_bench_suite/synthmark.diff @@ -0,0 +1,22 @@ +diff --git a/Android.mk b/Android.mk +index e1d89db..3970857 100644 +--- a/Android.mk ++++ b/Android.mk +@@ -1 +1,16 @@ +-# This file is intentionally empty, to prevent a platform build from descending further ++# Copyright 2017 The Chromium OS Authors. All rights reserved. ++# Use of this source code is governed by a BSD-style license that can be ++# found in the LICENSE file. ++ ++LOCAL_PATH := $(call my-dir) ++ ++include $(CLEAR_VARS) ++LOCAL_MODULE_TAGS := tests ++LOCAL_C_INCLUDES := $(LOCAL_PATH)/source ++LOCAL_SRC_FILES:= apps/synthmark.cpp ++LOCAL_CFLAGS += -g -std=c++11 -Ofast ++LOCAL_CFLAGS += $(CFLAGS_FOR_BENCH_SUITE) ++LOCAL_LDFLAGS += $(LDFLAGS_FOR_BENCH_SUITE) ++#LOCAL_SHARED_LIBRARIES := libcutils libutils ++LOCAL_MODULE := synthmark ++include $(BUILD_EXECUTABLE) -- cgit v1.2.3