aboutsummaryrefslogtreecommitdiff
path: root/binary_search_tool
diff options
context:
space:
mode:
authorCassidy Burden <cburden@google.com>2016-08-02 09:45:17 -0700
committerchrome-bot <chrome-bot@chromium.org>2016-08-03 13:30:22 -0700
commit2a141a72ae3f5d420f892cbc7a81fc40db076022 (patch)
tree20c32bc3f0d18ccc8aedd5da36eb5c11f474e196 /binary_search_tool
parent2e307b303ac37c3e971086f23da2df25fef2c1b4 (diff)
downloadtoolchain-utils-2a141a72ae3f5d420f892cbc7a81fc40db076022.tar.gz
binary search tool: Use full obj path with compiler wrapper
In order to support the NDK, use absolute paths for object files. TEST=Run full Android bisection Change-Id: I588230fa5cd521cd7c7d48b87e8bab3e3b09b1aa Reviewed-on: https://chrome-internal-review.googlesource.com/272756 Commit-Ready: Cassidy Burden <cburden@google.com> Tested-by: Cassidy Burden <cburden@google.com> Reviewed-by: Caroline Tice <cmtice@google.com>
Diffstat (limited to 'binary_search_tool')
-rwxr-xr-xbinary_search_tool/android/switch_to_bad.sh2
-rwxr-xr-xbinary_search_tool/android/switch_to_good.sh2
-rw-r--r--binary_search_tool/bisect_driver.py36
3 files changed, 21 insertions, 19 deletions
diff --git a/binary_search_tool/android/switch_to_bad.sh b/binary_search_tool/android/switch_to_bad.sh
index 7bb55dbf..f746b628 100755
--- a/binary_search_tool/android/switch_to_bad.sh
+++ b/binary_search_tool/android/switch_to_bad.sh
@@ -18,7 +18,7 @@ source android/common.sh
OBJ_LIST_FILE=$1
# Symlink from BAD obj to working tree.
-SWITCH_CMD="ln -f ${BISECT_BAD_BUILD}/{} ${BISECT_WORK_BUILD}/{}; touch ${BISECT_WORK_BUILD}/{};"
+SWITCH_CMD="ln -f ${BISECT_BAD_BUILD}/{} {}; touch {};"
overall_status=0
diff --git a/binary_search_tool/android/switch_to_good.sh b/binary_search_tool/android/switch_to_good.sh
index 485ece73..1c046c3f 100755
--- a/binary_search_tool/android/switch_to_good.sh
+++ b/binary_search_tool/android/switch_to_good.sh
@@ -17,7 +17,7 @@ source android/common.sh
OBJ_LIST_FILE=$1
# Symlink from GOOD obj to working tree.
-SWITCH_CMD="ln -f ${BISECT_GOOD_BUILD}/{} ${BISECT_WORK_BUILD}/{}; touch ${BISECT_WORK_BUILD}/{};"
+SWITCH_CMD="ln -f ${BISECT_GOOD_BUILD}/{} {}; touch {};"
overall_status=0
diff --git a/binary_search_tool/bisect_driver.py b/binary_search_tool/bisect_driver.py
index 1f7babd9..2fa6760a 100644
--- a/binary_search_tool/bisect_driver.py
+++ b/binary_search_tool/bisect_driver.py
@@ -133,7 +133,7 @@ def get_obj_path(execargs):
# TODO: need to handle -r compilations
return '', ''
- return obj_path, os.path.join(os.getcwd(), obj_path)
+ return obj_path, os.path.abspath(obj_path)
def get_dep_path(execargs):
@@ -150,7 +150,7 @@ def get_dep_path(execargs):
return '', ''
dep_path = execargs[i + 1]
- return dep_path, os.path.join(os.getcwd(), dep_path)
+ return dep_path, os.path.abspath(dep_path)
def in_object_list(obj_name, list_filename):
@@ -175,15 +175,16 @@ def generate_side_effects(execargs, bisect_dir):
# TODO(cburden): Cache .dwo files
# Cache dependency files
- dep_path, _ = get_dep_path(execargs)
+ dep_path, full_dep_path = get_dep_path(execargs)
if not dep_path:
return
- bisect_path = os.path.join(bisect_dir, DEP_CACHE, dep_path)
+ # os.path.join fails with absolute paths, use + instead
+ bisect_path = os.path.join(bisect_dir, DEP_CACHE) + full_dep_path
bisect_path_dir = os.path.dirname(bisect_path)
makedirs(bisect_path_dir)
pop_log = os.path.join(bisect_dir, DEP_CACHE, '_POPULATE_LOG')
- log_to_file(pop_log, execargs, link_from=dep_path, link_to=bisect_path)
+ log_to_file(pop_log, execargs, dep_path, bisect_path)
try:
if os.path.exists(dep_path):
@@ -215,11 +216,12 @@ def bisect_populate(execargs, bisect_dir, population_name):
pop_log = os.path.join(population_dir, '_POPULATE_LOG')
log_to_file(pop_log, execargs)
- obj_path, _ = get_obj_path(execargs)
+ obj_path, full_obj_path = get_obj_path(execargs)
if not obj_path:
return
- bisect_path = os.path.join(population_dir, obj_path)
+ # os.path.join fails with absolute paths, use + instead
+ bisect_path = population_dir + full_obj_path
bisect_path_dir = os.path.dirname(bisect_path)
makedirs(bisect_path_dir)
@@ -234,7 +236,7 @@ def bisect_populate(execargs, bisect_dir, population_name):
raise
with lock_file(os.path.join(population_dir, '_LIST'), 'a') as object_list:
- object_list.write('%s\n' % obj_path)
+ object_list.write('%s\n' % full_obj_path)
# Cache the side effects generated by good compiler
if population_name == GOOD_CACHE:
@@ -242,7 +244,7 @@ def bisect_populate(execargs, bisect_dir, population_name):
def bisect_triage(execargs, bisect_dir):
- obj_path, _ = get_obj_path(execargs)
+ obj_path, full_obj_path = get_obj_path(execargs)
obj_list = os.path.join(bisect_dir, LIST_FILE)
# If the output isn't an object file just call compiler
@@ -251,10 +253,10 @@ def bisect_triage(execargs, bisect_dir):
# If this isn't a bisected object just call compiler
# This shouldn't happen!
- if not in_object_list(obj_path, obj_list):
+ if not in_object_list(full_obj_path, obj_list):
if CONTINUE_ON_MISSING:
log_file = os.path.join(bisect_dir, '_MISSING_CACHED_OBJ_LOG')
- log_to_file(log_file, execargs, link_from='? compiler', link_to=obj_path)
+ log_to_file(log_file, execargs, '? compiler', full_obj_path)
return exec_and_return(execargs)
else:
raise Error(('%s is missing from cache! To ignore export '
@@ -267,7 +269,7 @@ def bisect_triage(execargs, bisect_dir):
# If dependency is generated from this call, link it from dependency cache
dep_path, full_dep_path = get_dep_path(execargs)
if dep_path:
- cached_dep_path = os.path.join(bisect_dir, DEP_CACHE, dep_path)
+ cached_dep_path = os.path.join(bisect_dir, DEP_CACHE) + dep_path
if os.path.exists(cached_dep_path):
if os.path.exists(full_dep_path):
os.remove(full_dep_path)
@@ -279,16 +281,16 @@ def bisect_triage(execargs, bisect_dir):
# If generated object file happened to be pruned/cleaned by Make then link it
# over from cache again.
if not os.path.exists(obj_path):
- cache = BAD_CACHE if in_bad_set(obj_path) else GOOD_CACHE
- cached_obj_path = os.path.join(bisect_dir, cache, obj_path)
+ cache = BAD_CACHE if in_bad_set(full_obj_path) else GOOD_CACHE
+ cached_obj_path = os.path.join(bisect_dir, cache) + full_obj_path
if os.path.exists(cached_obj_path):
- os.link(cached_obj_path, obj_path)
+ os.link(cached_obj_path, full_obj_path)
else:
- raise Error('%s does not exist in %s cache' % (obj_path, cache))
+ raise Error('%s does not exist in %s cache' % (full_obj_path, cache))
# This is just used for debugging and stats gathering
log_file = os.path.join(bisect_dir, '_MISSING_OBJ_LOG')
- log_to_file(log_file, execargs, link_from=cached_obj_path, link_to=obj_path)
+ log_to_file(log_file, execargs, cached_obj_path, full_obj_path)
def bisect_driver(bisect_stage, bisect_dir, execargs):