aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJussi Pakkanen <jpakkane@gmail.com>2017-12-17 18:30:20 -0500
committerJussi Pakkanen <jpakkane@gmail.com>2017-12-18 19:44:01 +0200
commitb1c25ccde0ef1d3838cb6c1d1f92ba1ccebdbff1 (patch)
tree25b0a127e5282c114d08f2700fef53719a7df125
parentd232a80e90a9bd4e7c677c695a9c230ac1ec8361 (diff)
downloadmeson-b1c25ccde0ef1d3838cb6c1d1f92ba1ccebdbff1.zip
meson-b1c25ccde0ef1d3838cb6c1d1f92ba1ccebdbff1.tar.gz
meson-b1c25ccde0ef1d3838cb6c1d1f92ba1ccebdbff1.tar.bz2
Use deterministic builddir so CCache works across invocations.
-rwxr-xr-xrun_project_tests.py11
1 files changed, 10 insertions, 1 deletions
diff --git a/run_project_tests.py b/run_project_tests.py
index b94a976..323f9a3 100755
--- a/run_project_tests.py
+++ b/run_project_tests.py
@@ -312,10 +312,19 @@ def parse_test_args(testdir):
pass
return args
+# Build directory name must be the same so CCache works over
+# consecutive invocations.
+def create_deterministic_builddir(src_dir):
+ import hashlib
+ rel_dirname = 'b ' + hashlib.sha256(src_dir.encode(errors='ignore')).hexdigest()[0:10]
+ os.mkdir(rel_dirname)
+ abs_pathname = os.path.join(os.getcwd(), rel_dirname)
+ return abs_pathname
+
def run_test(skipped, testdir, extra_args, compiler, backend, flags, commands, should_fail):
if skipped:
return None
- with AutoDeletedDir(tempfile.mkdtemp(prefix='b ', dir='.')) as build_dir:
+ with AutoDeletedDir(create_deterministic_builddir(testdir)) as build_dir:
with AutoDeletedDir(tempfile.mkdtemp(prefix='i ', dir=os.getcwd())) as install_dir:
try:
return _run_test(testdir, build_dir, install_dir, extra_args, compiler, backend, flags, commands, should_fail)