project_tests: Add "version" to "shared_lib" and "pdb" types
This allows the harness to apply the version correctly, putting it in the right place, dropping the right amount of numbers, etc. pdb taking a version allows it to be more easily copied from the shared_lib type.
This commit is contained in:
parent
ef1c6cdd54
commit
5ccda6878d
|
@ -190,7 +190,7 @@ Exanple `test.json`:
|
||||||
"installed": [
|
"installed": [
|
||||||
{ "type": "exe", "file": "usr/bin/testexe" },
|
{ "type": "exe", "file": "usr/bin/testexe" },
|
||||||
{ "type": "pdb", "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": {
|
"matrix": {
|
||||||
"options": {
|
"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.
|
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
|
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:
|
the platform matches. The following values for `platform` are currently supported:
|
||||||
|
|
||||||
|
|
|
@ -95,6 +95,13 @@ class InstalledFile:
|
||||||
self.typ = raw['type']
|
self.typ = raw['type']
|
||||||
self.platform = raw.get('platform', None)
|
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]:
|
def get_path(self, compiler: str, env: environment.Environment) -> T.Optional[Path]:
|
||||||
p = Path(self.path)
|
p = Path(self.path)
|
||||||
canonical_compiler = compiler
|
canonical_compiler = compiler
|
||||||
|
@ -116,17 +123,35 @@ class InstalledFile:
|
||||||
return p
|
return p
|
||||||
elif self.typ == 'shared_lib':
|
elif self.typ == 'shared_lib':
|
||||||
if env.machines.host.is_windows() or env.machines.host.is_cygwin():
|
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')
|
return p.with_suffix('.dll')
|
||||||
|
|
||||||
p = p.with_name('lib{}'.format(p.name))
|
p = p.with_name('lib{}'.format(p.name))
|
||||||
if env.machines.host.is_darwin():
|
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:
|
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':
|
elif self.typ == 'exe':
|
||||||
if env.machines.host.is_windows() or env.machines.host.is_cygwin():
|
if env.machines.host.is_windows() or env.machines.host.is_cygwin():
|
||||||
return p.with_suffix('.exe')
|
return p.with_suffix('.exe')
|
||||||
elif self.typ == 'pdb':
|
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
|
return p.with_suffix('.pdb') if canonical_compiler == 'msvc' else None
|
||||||
elif self.typ == 'implib' or self.typ == 'implibempty':
|
elif self.typ == 'implib' or self.typ == 'implibempty':
|
||||||
if env.machines.host.is_windows() and canonical_compiler == 'msvc':
|
if env.machines.host.is_windows() and canonical_compiler == 'msvc':
|
||||||
|
|
|
@ -1,18 +1,18 @@
|
||||||
{
|
{
|
||||||
"installed": [
|
"installed": [
|
||||||
{"type": "file", "platform": "gcc", "file": "usr/lib/libsome.so"},
|
{"type": "shared_lib", "platform": "gcc", "file": "usr/lib/some"},
|
||||||
{"type": "file", "platform": "gcc", "file": "usr/lib/libsome.so.0"},
|
{"type": "shared_lib", "platform": "gcc", "file": "usr/lib/some", "version": "0"},
|
||||||
{"type": "file", "platform": "gcc", "file": "usr/lib/libsome.so.1.2.3"},
|
{"type": "shared_lib", "platform": "gcc", "file": "usr/lib/some", "version": "1.2.3"},
|
||||||
{"type": "file", "platform": "gcc", "file": "usr/lib/libnoversion.so"},
|
{"type": "shared_lib", "platform": "gcc", "file": "usr/lib/noversion"},
|
||||||
{"type": "file", "platform": "gcc", "file": "usr/lib/libonlyversion.so"},
|
{"type": "shared_lib", "platform": "gcc", "file": "usr/lib/onlyversion"},
|
||||||
{"type": "file", "platform": "gcc", "file": "usr/lib/libonlyversion.so.1"},
|
{"type": "shared_lib", "platform": "gcc", "file": "usr/lib/onlyversion", "version": "1"},
|
||||||
{"type": "file", "platform": "gcc", "file": "usr/lib/libonlyversion.so.1.4.5"},
|
{"type": "shared_lib", "platform": "gcc", "file": "usr/lib/onlyversion", "version": "1.4.5"},
|
||||||
{"type": "file", "platform": "gcc", "file": "usr/lib/libonlysoversion.so"},
|
{"type": "shared_lib", "platform": "gcc", "file": "usr/lib/onlysoversion"},
|
||||||
{"type": "file", "platform": "gcc", "file": "usr/lib/libonlysoversion.so.5"},
|
{"type": "shared_lib", "platform": "gcc", "file": "usr/lib/onlysoversion", "version": "5"},
|
||||||
{"type": "file", "platform": "msvc", "file": "usr/bin/noversion.dll"},
|
{"type": "shared_lib", "platform": "msvc", "file": "usr/bin/noversion"},
|
||||||
{"type": "file", "platform": "msvc", "file": "usr/bin/onlysoversion-5.dll"},
|
{"type": "shared_lib", "platform": "msvc", "file": "usr/bin/onlysoversion", "version": "5"},
|
||||||
{"type": "file", "platform": "msvc", "file": "usr/bin/onlyversion-1.dll"},
|
{"type": "shared_lib", "platform": "msvc", "file": "usr/bin/onlyversion", "version": "1"},
|
||||||
{"type": "file", "platform": "msvc", "file": "usr/bin/some-0.dll"},
|
{"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/noversion.lib"},
|
||||||
{"type": "file", "platform": "msvc", "file": "usr/lib/onlysoversion.lib"},
|
{"type": "file", "platform": "msvc", "file": "usr/lib/onlysoversion.lib"},
|
||||||
{"type": "file", "platform": "msvc", "file": "usr/lib/onlyversion.lib"},
|
{"type": "file", "platform": "msvc", "file": "usr/lib/onlyversion.lib"},
|
||||||
|
|
|
@ -1,14 +1,14 @@
|
||||||
{
|
{
|
||||||
"installed": [
|
"installed": [
|
||||||
{"type": "exe", "file": "usr/bin/app_d"},
|
{"type": "exe", "file": "usr/bin/app_d"},
|
||||||
{"type": "file", "platform": "gcc", "file": "usr/lib/libsay1.so"},
|
{"type": "shared_lib", "platform": "gcc", "file": "usr/lib/say1"},
|
||||||
{"type": "file", "platform": "gcc", "file": "usr/lib/libsay1.so.0"},
|
{"type": "shared_lib", "platform": "gcc", "file": "usr/lib/say1", "version": "0"},
|
||||||
{"type": "file", "platform": "gcc", "file": "usr/lib/libsay1.so.1.2.3"},
|
{"type": "shared_lib", "platform": "gcc", "file": "usr/lib/say1", "version": "1.2.3"},
|
||||||
{"type": "file", "platform": "gcc", "file": "usr/lib/libsay2.so"},
|
{"type": "shared_lib", "platform": "gcc", "file": "usr/lib/say2"},
|
||||||
{"type": "file", "platform": "gcc", "file": "usr/lib/libsay2.so.1"},
|
{"type": "shared_lib", "platform": "gcc", "file": "usr/lib/say2", "version": "1"},
|
||||||
{"type": "file", "platform": "gcc", "file": "usr/lib/libsay2.so.1.2.4"},
|
{"type": "shared_lib", "platform": "gcc", "file": "usr/lib/say2", "version": "1.2.4"},
|
||||||
{"type": "file", "platform": "msvc", "file": "usr/bin/say1-0.dll"},
|
{"type": "shared_lib", "platform": "msvc", "file": "usr/bin/say1", "version": "0"},
|
||||||
{"type": "file", "platform": "msvc", "file": "usr/bin/say2-1.dll"},
|
{"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/say1.lib"},
|
||||||
{"type": "file", "platform": "msvc", "file": "usr/lib/say2.lib"}
|
{"type": "file", "platform": "msvc", "file": "usr/lib/say2.lib"}
|
||||||
]
|
]
|
||||||
|
|
Loading…
Reference in New Issue