diff options
-rwxr-xr-x | run_project_tests.py | 11 |
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) |