aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexandre Rames <alexandre.rames@linaro.org>2015-10-05 10:22:18 +0100
committerAlexandre Rames <alexandre.rames@linaro.org>2015-10-12 12:01:12 +0100
commitc95f35c33ed628036a04bd457dee1a0872c692cb (patch)
tree754c891a094c706b77e02988246a977db20ef28a
parent3fec7b5869d05bb06d9cc06ae21ba7929418227a (diff)
Fix execution of `build.sh` and `run.py` non-root paths.
Change-Id: I36a5899c2883965bc99195507e6903eb71ece3b9
-rwxr-xr-xbuild.sh3
-rwxr-xr-xrun.py2
-rwxr-xr-xtest/test.py7
3 files changed, 10 insertions, 2 deletions
diff --git a/build.sh b/build.sh
index 3eb5c5c..34cfc72 100755
--- a/build.sh
+++ b/build.sh
@@ -113,8 +113,9 @@ set +f
# the benchmark framework to indicate what benchmark classes are available.
# Remove the `.java` extension.
JAVA_BENCHMARK_CLASSES=${JAVA_BENCHMARK_FILES//.java/}
-# Remove the leading `./` and `benchmarks`.
+# Remove the leading full or relative path.
JAVA_BENCHMARK_CLASSES=${JAVA_BENCHMARK_CLASSES//.\//}
+JAVA_BENCHMARK_CLASSES=${JAVA_BENCHMARK_CLASSES//$DIR_ROOT\//}
# Trim trailing whitespaces.
JAVA_BENCHMARK_CLASSES=${JAVA_BENCHMARK_CLASSES/%[[:space:]]/}
read -a array <<< $JAVA_BENCHMARK_CLASSES
diff --git a/run.py b/run.py
index a87090b..e224d69 100755
--- a/run.py
+++ b/run.py
@@ -132,7 +132,7 @@ def DeleteAppInDalvikCache(remote_copy_path):
def BuildBenchmarks(build_for_target):
# Call the build script, with warnings treated as errors.
- command = ['./build.sh', '-w']
+ command = [os.path.join(utils.dir_root, 'build.sh'), '-w']
if build_for_target:
command += ['-t']
VerbosePrint(' '.join(command))
diff --git a/test/test.py b/test/test.py
index 8582df0..e574669 100755
--- a/test/test.py
+++ b/test/test.py
@@ -56,9 +56,16 @@ def TestCommand(command, _cwd=None):
def TestBenchmarksOnHost():
rc = 0
+ # Test standard usage of the top-level scripts.
rc |= TestCommand(["./build.sh", "-w"], _cwd=utils.dir_root)
rc |= TestCommand(["./run.py"], _cwd=utils.dir_root)
rc |= TestCommand(["./run.py", "--dont-auto-calibrate"], _cwd=utils.dir_root)
+ # Test executing from a different path than the root.
+ non_root_path = os.path.join(utils.dir_root, "test", "foo", "bar")
+ rc |= TestCommand(["mkdir", "-p", non_root_path])
+ rc |= TestCommand([os.path.join(utils.dir_root, "build.sh"), "-w"], _cwd=non_root_path)
+ rc |= TestCommand([os.path.join(utils.dir_root, "run.py")], _cwd=non_root_path)
+ rc |= TestCommand(["rm", "-rf", non_root_path])
# TODO: Abstract the app name.
rc |= TestCommand(["java", "org.linaro.bench.RunBench", "Intrinsics.NumberOfLeadingZerosIntegerRandom"], _cwd=utils.dir_build_java_classes)
rc |= TestCommand(["java", "org.linaro.bench.RunBench", "BubbleSort"], _cwd=utils.dir_build_java_classes)