aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--docs/markdown/Contributing.md14
-rwxr-xr-xrun_project_tests.py29
-rw-r--r--test cases/d/4 library versions/test.json26
-rw-r--r--test cases/d/7 multilib/test.json16
4 files changed, 61 insertions, 24 deletions
diff --git a/docs/markdown/Contributing.md b/docs/markdown/Contributing.md
index 65460d9..4d52ce1 100644
--- a/docs/markdown/Contributing.md
+++ b/docs/markdown/Contributing.md
@@ -190,7 +190,7 @@ Exanple `test.json`:
"installed": [
{ "type": "exe", "file": "usr/bin/testexe" },
{ "type": "pdb", "file": "usr/bin/testexe" },
- { "type": "shared_lib", "file": "usr/lib/z" },
+ { "type": "shared_lib", "file": "usr/lib/z", "version": "1.2.3" },
],
"matrix": {
"options": {
@@ -246,6 +246,18 @@ current platform. The following values are currently supported:
Except for the `file` and `expr` types, all paths should be provided *without* a suffix.
+The `shared_lib` and `pdb` types takes an optional additional parameter, `version`, this is us a string in `X.Y.Z` format that will be applied to the library. Each version to be tested must have a single version. The harness will apply this correctly per platform:
+
+```json
+{
+ "type": "shared_lib", "file": "usr/lib/lib",
+ "type": "shared_lib", "file": "usr/lib/lib", "version": "1",
+ "type": "shared_lib", "file": "usr/lib/lib", "version": "1.2.3.",
+}
+```
+
+This will be applied appropraitly per platform. On windows this expects `lib.dll` and `lib-1.dll`. on MacOS it expects `liblib.dylib` and `liblib.1.dylib`. On other Unices it expects `liblib.so`, `liblib.so.1`, and `liblib.so.1.2.3`.
+
If the `platform` key is present, the installed file entry is only considered if
the platform matches. The following values for `platform` are currently supported:
diff --git a/run_project_tests.py b/run_project_tests.py
index d63dd38..160fbf3 100755
--- a/run_project_tests.py
+++ b/run_project_tests.py
@@ -95,6 +95,13 @@ class InstalledFile:
self.typ = raw['type']
self.platform = raw.get('platform', None)
+ version = raw.get('version', '') # type: str
+ if version:
+ self.version = version.split('.') # type: T.List[str]
+ else:
+ # split on '' will return [''], we want an empty list though
+ self.version = []
+
def get_path(self, compiler: str, env: environment.Environment) -> T.Optional[Path]:
p = Path(self.path)
canonical_compiler = compiler
@@ -116,17 +123,35 @@ class InstalledFile:
return p
elif self.typ == 'shared_lib':
if env.machines.host.is_windows() or env.machines.host.is_cygwin():
+ # Windows only has foo.dll and foo-X.dll
+ if len(self.version) > 1:
+ return None
+ if self.version:
+ p = p.with_name('{}-{}'.format(p.name, self.version[0]))
return p.with_suffix('.dll')
p = p.with_name('lib{}'.format(p.name))
if env.machines.host.is_darwin():
- return p.with_suffix('.dylib')
+ # MacOS only has libfoo.dylib and libfoo.X.dylib
+ if len(self.version) > 1:
+ return None
+
+ # pathlib.Path.with_suffix replaces, not appends
+ suffix = '.dylib'
+ if self.version:
+ suffix = '.{}{}'.format(self.version[0], suffix)
else:
- return p.with_suffix('.so')
+ # pathlib.Path.with_suffix replaces, not appends
+ suffix = '.so'
+ if self.version:
+ suffix = '{}.{}'.format(suffix, '.'.join(self.version))
+ return p.with_suffix(suffix)
elif self.typ == 'exe':
if env.machines.host.is_windows() or env.machines.host.is_cygwin():
return p.with_suffix('.exe')
elif self.typ == 'pdb':
+ if self.version:
+ p = p.with_name('{}-{}'.format(p.name, self.version[0]))
return p.with_suffix('.pdb') if canonical_compiler == 'msvc' else None
elif self.typ == 'implib' or self.typ == 'implibempty':
if env.machines.host.is_windows() and canonical_compiler == 'msvc':
diff --git a/test cases/d/4 library versions/test.json b/test cases/d/4 library versions/test.json
index 2a3433e..942122b 100644
--- a/test cases/d/4 library versions/test.json
+++ b/test cases/d/4 library versions/test.json
@@ -1,18 +1,18 @@
{
"installed": [
- {"type": "file", "platform": "gcc", "file": "usr/lib/libsome.so"},
- {"type": "file", "platform": "gcc", "file": "usr/lib/libsome.so.0"},
- {"type": "file", "platform": "gcc", "file": "usr/lib/libsome.so.1.2.3"},
- {"type": "file", "platform": "gcc", "file": "usr/lib/libnoversion.so"},
- {"type": "file", "platform": "gcc", "file": "usr/lib/libonlyversion.so"},
- {"type": "file", "platform": "gcc", "file": "usr/lib/libonlyversion.so.1"},
- {"type": "file", "platform": "gcc", "file": "usr/lib/libonlyversion.so.1.4.5"},
- {"type": "file", "platform": "gcc", "file": "usr/lib/libonlysoversion.so"},
- {"type": "file", "platform": "gcc", "file": "usr/lib/libonlysoversion.so.5"},
- {"type": "file", "platform": "msvc", "file": "usr/bin/noversion.dll"},
- {"type": "file", "platform": "msvc", "file": "usr/bin/onlysoversion-5.dll"},
- {"type": "file", "platform": "msvc", "file": "usr/bin/onlyversion-1.dll"},
- {"type": "file", "platform": "msvc", "file": "usr/bin/some-0.dll"},
+ {"type": "shared_lib", "platform": "gcc", "file": "usr/lib/some"},
+ {"type": "shared_lib", "platform": "gcc", "file": "usr/lib/some", "version": "0"},
+ {"type": "shared_lib", "platform": "gcc", "file": "usr/lib/some", "version": "1.2.3"},
+ {"type": "shared_lib", "platform": "gcc", "file": "usr/lib/noversion"},
+ {"type": "shared_lib", "platform": "gcc", "file": "usr/lib/onlyversion"},
+ {"type": "shared_lib", "platform": "gcc", "file": "usr/lib/onlyversion", "version": "1"},
+ {"type": "shared_lib", "platform": "gcc", "file": "usr/lib/onlyversion", "version": "1.4.5"},
+ {"type": "shared_lib", "platform": "gcc", "file": "usr/lib/onlysoversion"},
+ {"type": "shared_lib", "platform": "gcc", "file": "usr/lib/onlysoversion", "version": "5"},
+ {"type": "shared_lib", "platform": "msvc", "file": "usr/bin/noversion"},
+ {"type": "shared_lib", "platform": "msvc", "file": "usr/bin/onlysoversion", "version": "5"},
+ {"type": "shared_lib", "platform": "msvc", "file": "usr/bin/onlyversion", "version": "1"},
+ {"type": "shared_lib", "platform": "msvc", "file": "usr/bin/some", "version": "0"},
{"type": "file", "platform": "msvc", "file": "usr/lib/noversion.lib"},
{"type": "file", "platform": "msvc", "file": "usr/lib/onlysoversion.lib"},
{"type": "file", "platform": "msvc", "file": "usr/lib/onlyversion.lib"},
diff --git a/test cases/d/7 multilib/test.json b/test cases/d/7 multilib/test.json
index 408c4f2..2d51338 100644
--- a/test cases/d/7 multilib/test.json
+++ b/test cases/d/7 multilib/test.json
@@ -1,14 +1,14 @@
{
"installed": [
{"type": "exe", "file": "usr/bin/app_d"},
- {"type": "file", "platform": "gcc", "file": "usr/lib/libsay1.so"},
- {"type": "file", "platform": "gcc", "file": "usr/lib/libsay1.so.0"},
- {"type": "file", "platform": "gcc", "file": "usr/lib/libsay1.so.1.2.3"},
- {"type": "file", "platform": "gcc", "file": "usr/lib/libsay2.so"},
- {"type": "file", "platform": "gcc", "file": "usr/lib/libsay2.so.1"},
- {"type": "file", "platform": "gcc", "file": "usr/lib/libsay2.so.1.2.4"},
- {"type": "file", "platform": "msvc", "file": "usr/bin/say1-0.dll"},
- {"type": "file", "platform": "msvc", "file": "usr/bin/say2-1.dll"},
+ {"type": "shared_lib", "platform": "gcc", "file": "usr/lib/say1"},
+ {"type": "shared_lib", "platform": "gcc", "file": "usr/lib/say1", "version": "0"},
+ {"type": "shared_lib", "platform": "gcc", "file": "usr/lib/say1", "version": "1.2.3"},
+ {"type": "shared_lib", "platform": "gcc", "file": "usr/lib/say2"},
+ {"type": "shared_lib", "platform": "gcc", "file": "usr/lib/say2", "version": "1"},
+ {"type": "shared_lib", "platform": "gcc", "file": "usr/lib/say2", "version": "1.2.4"},
+ {"type": "shared_lib", "platform": "msvc", "file": "usr/bin/say1", "version": "0"},
+ {"type": "shared_lib", "platform": "msvc", "file": "usr/bin/say2", "version": "1"},
{"type": "file", "platform": "msvc", "file": "usr/lib/say1.lib"},
{"type": "file", "platform": "msvc", "file": "usr/lib/say2.lib"}
]