diff options
author | Alexandre Rames <alexandre.rames@linaro.org> | 2016-08-24 15:02:40 +0000 |
---|---|---|
committer | Linaro Android Code Review <android-review@review.linaro.org> | 2016-08-24 15:02:40 +0000 |
commit | c28daf00c67266097e21f0ef52e3a2da7640b281 (patch) | |
tree | 536541b33dfbe3a6ef3242678ea6c75e4ed1f904 | |
parent | 39550fd268cdc8883a7bd993fd4538e150cf2d3c (diff) | |
parent | bf24c506d240d22c804fad5822886b730a59a398 (diff) | |
download | art-testing-c28daf00c67266097e21f0ef52e3a2da7640b281.tar.gz |
Merge "Implement an equivalent to os.path.join() for device paths."
-rwxr-xr-x | tools/benchmarks/run.py | 4 | ||||
-rwxr-xr-x | tools/compilation_statistics/run.py | 14 | ||||
-rw-r--r-- | tools/utils.py | 15 |
3 files changed, 21 insertions, 12 deletions
diff --git a/tools/benchmarks/run.py b/tools/benchmarks/run.py index 7105a32..a5bf08a 100755 --- a/tools/benchmarks/run.py +++ b/tools/benchmarks/run.py @@ -71,7 +71,7 @@ def DeleteAppInDalvikCache(target_copy_path, target): # We delete the entire dalvik-cache in the test path. # Delete any cached version of the benchmark app. # With the current defaults, the pattern is "data@local@tmp@java-benchs.apk*" - utils_adb.shell('rm -rf ' + os.path.join(target_copy_path, 'dalvik-cache'), target) + utils_adb.shell('rm -rf ' + utils.TargetPathJoin(target_copy_path, 'dalvik-cache'), target) def BuildBenchmarks(build_for_target): # Call the build script. @@ -234,7 +234,7 @@ def GetBenchmarkResults(args): apk = os.path.join(utils.dir_build, 'bench.apk') apk_name = os.path.basename(apk) utils_adb.push(apk, args.target_copy_path, args.target) - remote_apk = os.path.join(args.target_copy_path, apk_name) + remote_apk = utils.TargetPathJoin(args.target_copy_path, apk_name) if args.norun: sys.exit(0) diff --git a/tools/compilation_statistics/run.py b/tools/compilation_statistics/run.py index 153f461..b032717 100755 --- a/tools/compilation_statistics/run.py +++ b/tools/compilation_statistics/run.py @@ -77,14 +77,14 @@ def GetStats(apk, work_dir, boot_oat_file): path, env, runtime_param = utils.GetAndroidRootConfiguration(android_root, isa.endswith('64')) - dex2oat = os.path.join(path, 'dex2oat') + dex2oat = utils.TargetPathJoin(path, 'dex2oat') if boot_oat_file: - oat = "%s/boot.%s.oat" % (target_copy_path, isa) - art = "%s/boot.%s.art" % (target_copy_path, isa) + oat = utils.TargetPathJoin(target_copy_path, 'boot.' + isa + '.oat') + art = utils.TargetPathJoin(target_copy_path, 'boot.' + isa + '.art') # Check if dump file exists. - dump_oat_file_location = "/data/local/tmp/boot.oat.%s.txt" % (isa) + dump_oat_file_location = utils.TargetPathJoin(target_copy_path, 'boot.oat.' + isa + '.txt') dump_exists_command = "if [ -f %s ] ; then echo found; fi; exit 0" \ % (dump_oat_file_location) # Since we are interested in whether the dump file exists or not, we can't simply execute @@ -131,7 +131,7 @@ def GetStats(apk, for param in runtime_param: runtime_arguments += '--runtime-arg ' + param + ' ' - apk_path = os.path.join(target_copy_path, apk) + apk_path = utils.TargetPathJoin(target_copy_path, apk) oat = apk_path + '.' + isa + '.oat' dex2oat_options = utils.GetDex2oatOptions(compiler_mode) # Only the output of the first command is necessary; execute in a subshell @@ -224,10 +224,10 @@ def GetCompilationStatisticsResults(args): if len(boot_oat_files) != len(isa_list): utils.Error("Number of architectures different from number of boot.oat files. " \ "The list of boot.oat files is here:\n\n %s\n\nMake sure there are " \ - "no stale boot.oat files in /data/local/tmp or some other directory. " \ + "no stale boot.oat files in %s or some other directory. " \ "Another possibility is that you didn't build Android with " \ "`WITH_DEXPREOPT=false`. Do a `lunch` and then `WITH_DEXPREOPT=false " \ - "make -j$(nproc)`." % boot_oat_files) + "make -j$(nproc)`." % (boot_oat_files, args.target_copy_path)) # Order both lists. Now, as long as both oat files have the same parent dir, order # should match. isa_list.sort() diff --git a/tools/utils.py b/tools/utils.py index ff6f7c6..77d5965 100644 --- a/tools/utils.py +++ b/tools/utils.py @@ -221,9 +221,9 @@ def GetAndroidRootConfiguration(android_root, is_64bit): runtime_parameters = [] if android_root: - path = android_root + '/bin/' + path = TargetPathJoin(android_root, 'bin') environment = 'ANDROID_ROOT=' + android_root - library_path = ' LD_LIBRARY_PATH=' + android_root + '/lib' + library_path = ' LD_LIBRARY_PATH=' + TargetPathJoin(android_root, 'lib') if is_64bit: environment += library_path + '64' @@ -232,7 +232,8 @@ def GetAndroidRootConfiguration(android_root, is_64bit): # Note ART will expand this to -Ximage:/data/art-test/${arch}/core.art. runtime_parameters = ['-Ximage:/data/art-test/core.art'] - runtime_parameters += ['-Xbootclasspath:' + android_root + '/framework/core-libart.jar'] + runtime_parameters += ['-Xbootclasspath:' + \ + TargetPathJoin(android_root, 'framework/core-libart.jar')] return path, environment, runtime_parameters @@ -429,3 +430,11 @@ def HaveSameKeys(data_1, data_2): elif type(data_1) == type(data_2): return True return False + +def TargetPathJoin(path, *paths): + path = os.path.join(path, *paths) + + if os.sep != '/': + path = path.replace(os.sep, '/') + + return path |