diff --git a/run_tests.py b/run_tests.py index 93f964003..475eaaed8 100755 --- a/run_tests.py +++ b/run_tests.py @@ -30,6 +30,27 @@ if True: # Currently we have only one backend. test_commands = [ninja_command, 'test'] install_commands = [ninja_command, 'install'] +def validate_install(srcdir, installdir): + info_file = os.path.join(srcdir, 'installed_files.txt') + expected = {} + found = {} + if os.path.exists(info_file): + for line in open(info_file): + expected[line.strip()] = True + for root, dirs, files in os.walk(installdir): + for fname in files: + found_name = os.path.join(root, fname)[len(installdir)+1:] + found[found_name] = True + print(found) + expected = set(expected) + found = set(found) + missing = expected - found + for fname in missing: + raise RuntimeError('Expected file %s missing.' % fname) + extra = found - expected + for fname in extra: + raise RuntimeError('Found extra file %s.' % fname) + def run_test(testdir, should_succeed=True): shutil.rmtree(test_build_dir) shutil.rmtree(install_dir) @@ -57,6 +78,7 @@ def run_test(testdir, should_succeed=True): pi.wait() if pi.returncode != 0: raise RuntimeError('Running install failed.') + validate_install(testdir, install_dir) def gather_tests(testdir): tests = [t.replace('\\', '/').split('/', 2)[2] for t in glob(os.path.join(testdir, '*'))] diff --git a/test cases/common/6 linkshared/installed_files.txt b/test cases/common/6 linkshared/installed_files.txt new file mode 100644 index 000000000..cabfd814b --- /dev/null +++ b/test cases/common/6 linkshared/installed_files.txt @@ -0,0 +1,2 @@ +bin/prog +lib/libmylib.so