aboutsummaryrefslogtreecommitdiff
path: root/run_tests.py
diff options
context:
space:
mode:
authorNirbheek Chauhan <nirbheek@centricular.com>2016-07-01 14:43:51 +0530
committerNirbheek Chauhan <nirbheek@centricular.com>2016-07-01 20:50:47 +0530
commit45c8557dc67b7e8af8cef1aeb8b662dc9a6a4286 (patch)
tree5ae1944a3187b082258017982d2a84f7c1b431c3 /run_tests.py
parent598997bdb59efa9fe9e72c02d33a350bb8c397bb (diff)
downloadmeson-45c8557dc67b7e8af8cef1aeb8b662dc9a6a4286.zip
meson-45c8557dc67b7e8af8cef1aeb8b662dc9a6a4286.tar.gz
meson-45c8557dc67b7e8af8cef1aeb8b662dc9a6a4286.tar.bz2
Fix tests for the new library/executable naming scheme
Also add new tests for the platform-specific and compiler-specific versioning scheme. A rough summary is: 1. A bug in how run_tests.py:validate_install checked for files has been fixed. Earlier it wasn't checking the install directory properly. 2. Shared libraries are no longer installed in common tests, and the library name/path testing is now done in platform-specific tests. 3. Executables are now always called something?exe in the installed_files.txt file, and the suffix automatically corrected depending on the platform. 4. If a test installs a file called 'no-installed-files', the installed files for that test are not validated. This is required to implement compiler-specific tests for library names/paths such as MSVC vs MinGW 5. The platform-specific file renaming in run_tests.py has been mostly removed since it is broken for shared libraries and isn't needed for static libraries. 6. run_tests.py now reports all missing and extra files. The logic for finding these has been reworked.
Diffstat (limited to 'run_tests.py')
-rwxr-xr-xrun_tests.py66
1 files changed, 36 insertions, 30 deletions
diff --git a/run_tests.py b/run_tests.py
index 6f51a19..1130bad 100755
--- a/run_tests.py
+++ b/run_tests.py
@@ -124,44 +124,50 @@ def setup_commands(backend):
test_commands = [ninja_command, 'test', 'benchmark']
install_commands = [ninja_command, 'install']
-def platform_fix_filename(fname):
- if mesonlib.is_osx():
- if fname.endswith('.so'):
- return fname[:-2] + 'dylib'
- return fname.replace('.so.', '.dylib.')
- elif mesonlib.is_windows():
- if fname.endswith('.so'):
- (p, f) = os.path.split(fname)
- f = f[3:-2] + 'dll'
- return os.path.join(p, f)
- if fname.endswith('.a'):
- return fname[:-1] + 'lib'
+def get_relative_files_list_from_dir(fromdir):
+ paths = []
+ for (root, _, files) in os.walk(fromdir):
+ reldir = os.path.relpath(root, start=fromdir)
+ for f in files:
+ path = os.path.join(reldir, f).replace('\\', '/')
+ if path.startswith('./'):
+ path = path[2:]
+ paths.append(path)
+ return paths
+
+def platform_fix_exe_name(fname):
+ if not fname.endswith('?exe'):
+ return fname
+ fname = fname[:-4]
+ if mesonlib.is_windows():
+ return fname + '.exe'
return fname
def validate_install(srcdir, installdir):
- if mesonlib.is_windows():
- # Don't really know how Windows installs should work
- # so skip.
- return ''
info_file = os.path.join(srcdir, 'installed_files.txt')
expected = {}
found = {}
+ ret_msg = ''
+ # Test expects to not install any files
+ if os.path.exists(os.path.join(installdir, 'usr', 'no-installed-files')):
+ return ''
+ # Generate list of expected files
if os.path.exists(info_file):
for line in open(info_file):
- expected[platform_fix_filename(line.strip())] = True
- for root, _, files in os.walk(installdir):
- for fname in files:
- found_name = os.path.join(root, fname)[len(installdir)+1:]
- found[found_name] = True
- expected = set(expected)
- found = set(found)
- missing = expected - found
- for fname in missing:
- return 'Expected file %s missing.' % fname
- extra = found - expected
- for fname in extra:
- return 'Found extra file %s.' % fname
- return ''
+ expected[platform_fix_exe_name(line.strip())] = False
+ # Check if expected files were found
+ for fname in expected:
+ if os.path.exists(os.path.join(installdir, fname)):
+ expected[fname] = True
+ for (fname, found) in expected.items():
+ if not found:
+ ret_msg += 'Expected file {0} missing.\n'.format(fname)
+ # Check if there are any unexpected files
+ found = get_relative_files_list_from_dir(installdir)
+ for fname in found:
+ if fname not in expected:
+ ret_msg += 'Extra file {0} found.\n'.format(fname)
+ return ret_msg
def log_text_file(logfile, testdir, stdo, stde):
global stop, executor, futures