project_tests: Add a "shared_lib" type

This allows fixing tests that produce .dylib's on macOS and .so's on elf
Unices.
pull/6356/head
Dylan Baker 5 years ago
parent f404c679cf
commit 2cdc6892f4
  1. 18
      docs/markdown/Contributing.md
  2. 9
      run_project_tests.py
  3. 4
      test cases/d/3 shared library/test.json
  4. 4
      test cases/d/5 mixed/test.json

@ -190,6 +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" },
], ],
"matrix": { "matrix": {
"options": { "options": {
@ -233,14 +234,15 @@ actually installed file.
The `type` entry specifies how the `file` path should be interpreted based on the The `type` entry specifies how the `file` path should be interpreted based on the
current platform. The following values are currently supported: current platform. The following values are currently supported:
| `type` | Description | | `type` | Description |
| :-----------: | -------------------------------------------------------------------------------- | | :-----------: | ------------------------------------------------------------------------------------------------------- |
| `file` | No postprocessing, just use the provided path | | `file` | No postprocessing, just use the provided path |
| `exe` | For executables. On Windows the `.exe` suffix is added to the path in `file` | | `exe` | For executables. On Windows the `.exe` suffix is added to the path in `file` |
| `pdb` | For Windows PDB files. PDB entries are ignored on non Windows platforms | | `shared_lib` | For shared libraries, always written as `name`. The appropriate suffix and prefix are added by platform |
| `implib` | For Windows import libraries. These entries are ignored on non Windows platforms | | `pdb` | For Windows PDB files. PDB entries are ignored on non Windows platforms |
| `implibempty` | Like `implib`, but no symbols are exported in the library | | `implib` | For Windows import libraries. These entries are ignored on non Windows platforms |
| `expr` | `file` is an expression. This type should be avoided and removed if possible | | `implibempty` | Like `implib`, but no symbols are exported in the library |
| `expr` | `file` is an expression. This type should be avoided and removed if possible |
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.

@ -114,6 +114,15 @@ class InstalledFile:
# Handle the different types # Handle the different types
if self.typ == 'file': if self.typ == 'file':
return p return p
elif self.typ == 'shared_lib':
if env.machines.host.is_windows() or env.machines.host.is_cygwin():
return p.with_suffix('.dll')
p = p.with_name('lib{}'.format(p.name))
if env.machines.host.is_darwin():
return p.with_suffix('.dylib')
else:
return p.with_suffix('.so')
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')

@ -1,9 +1,9 @@
{ {
"installed": [ "installed": [
{"type": "exe", "file": "usr/bin/app_d"}, {"type": "exe", "file": "usr/bin/app_d"},
{"type": "file", "platform": "msvc", "file": "usr/bin/stuff.dll"}, {"type": "shared_lib", "platform": "msvc", "file": "usr/bin/stuff"},
{"type": "shared_lib", "platform": "gcc", "file": "usr/lib/stuff"},
{"type": "file", "platform": "msvc", "file": "usr/lib/stuff.lib"}, {"type": "file", "platform": "msvc", "file": "usr/lib/stuff.lib"},
{"type": "file", "platform": "gcc", "file": "usr/lib/libstuff.so"},
{"type": "file", "file": "usr/lib/pkgconfig/test.pc"} {"type": "file", "file": "usr/lib/pkgconfig/test.pc"}
] ]
} }

@ -3,8 +3,8 @@
{"type": "exe", "file": "usr/bin/appdc_d"}, {"type": "exe", "file": "usr/bin/appdc_d"},
{"type": "exe", "file": "usr/bin/appdc_s"}, {"type": "exe", "file": "usr/bin/appdc_s"},
{"type": "file", "file": "usr/lib/libstuff.a"}, {"type": "file", "file": "usr/lib/libstuff.a"},
{"type": "file", "platform": "gcc", "file": "usr/lib/libstuff.so"}, {"type": "shared_lib", "platform": "gcc", "file": "usr/lib/stuff"},
{"type": "file", "platform": "msvc", "file": "usr/bin/stuff.dll"}, {"type": "shared_lib", "platform": "msvc", "file": "usr/bin/stuff"},
{"type": "pdb", "file": "usr/bin/stuff"}, {"type": "pdb", "file": "usr/bin/stuff"},
{"type": "file", "platform": "msvc", "file": "usr/lib/stuff.lib"} {"type": "file", "platform": "msvc", "file": "usr/lib/stuff.lib"}
] ]

Loading…
Cancel
Save