diff options
author | Nirbheek Chauhan <nirbheek@centricular.com> | 2017-01-26 18:37:34 +0530 |
---|---|---|
committer | Nirbheek Chauhan <nirbheek@centricular.com> | 2017-01-28 01:05:19 +0530 |
commit | 4677f37366b2b57053e065d9bb188191dddfa5e9 (patch) | |
tree | 320575107fcc812053cbd55f9e5f6c390075bf9a /test cases | |
parent | 01547e8c613dfcdef6e38802b384df4eddaf062c (diff) | |
download | meson-4677f37366b2b57053e065d9bb188191dddfa5e9.zip meson-4677f37366b2b57053e065d9bb188191dddfa5e9.tar.gz meson-4677f37366b2b57053e065d9bb188191dddfa5e9.tar.bz2 |
tests: Move build-by-default unit test to common tests
Also add a test() that can be run on all platforms.
Currently unit tests are only run on Linux, so this was only testing the
Ninja backend. This change reveals that build-by-default was broken with
the Visual Studio backend.
Diffstat (limited to 'test cases')
-rw-r--r-- | test cases/common/137 build by default/foo.c (renamed from test cases/unit/5 build by default/foo.c) | 0 | ||||
-rw-r--r-- | test cases/common/137 build by default/meson.build | 24 | ||||
-rw-r--r-- | test cases/common/137 build by default/mygen.py (renamed from test cases/unit/5 build by default/mygen.py) | 0 | ||||
-rw-r--r-- | test cases/common/137 build by default/source.txt (renamed from test cases/unit/5 build by default/source.txt) | 0 | ||||
-rw-r--r-- | test cases/unit/5 build by default/meson.build | 13 |
5 files changed, 24 insertions, 13 deletions
diff --git a/test cases/unit/5 build by default/foo.c b/test cases/common/137 build by default/foo.c index ca97916..ca97916 100644 --- a/test cases/unit/5 build by default/foo.c +++ b/test cases/common/137 build by default/foo.c diff --git a/test cases/common/137 build by default/meson.build b/test cases/common/137 build by default/meson.build new file mode 100644 index 0000000..6569548 --- /dev/null +++ b/test cases/common/137 build by default/meson.build @@ -0,0 +1,24 @@ +project('build on all', 'c') + +py3_mod = import('python3') +py3 = py3_mod.find_python() + +executable('fooprog', 'foo.c', build_by_default : false) +comp = files('mygen.py') +mytarget = custom_target('gendat', + output : 'generated.dat', + input : 'source.txt', + command : [py3] + comp + ['@INPUT@', '@OUTPUT@'], + build_by_default : true, +) + +ct_output = join_paths(meson.build_root(), 'generated.dat') +exe_output = join_paths(meson.build_root(), 'fooprog') +if host_machine.system() == 'windows' + exe_output += '.exe' +endif + +ct_exists_exe_nexists = 'import os.path, sys; sys.exit(not os.path.exists(sys.argv[1]) and os.path.exists(sys.argv[2]))' + +test('check-build-by-default', py3, + args : ['-c', ct_exists_exe_nexists, ct_output, exe_output]) diff --git a/test cases/unit/5 build by default/mygen.py b/test cases/common/137 build by default/mygen.py index 5a74153..5a74153 100644 --- a/test cases/unit/5 build by default/mygen.py +++ b/test cases/common/137 build by default/mygen.py diff --git a/test cases/unit/5 build by default/source.txt b/test cases/common/137 build by default/source.txt index 3573f4b..3573f4b 100644 --- a/test cases/unit/5 build by default/source.txt +++ b/test cases/common/137 build by default/source.txt diff --git a/test cases/unit/5 build by default/meson.build b/test cases/unit/5 build by default/meson.build deleted file mode 100644 index 67c5cc2..0000000 --- a/test cases/unit/5 build by default/meson.build +++ /dev/null @@ -1,13 +0,0 @@ -project('build on all', 'c') - -py3_mod = import('python3') -py3 = py3_mod.find_python() - -executable('fooprog', 'foo.c', build_by_default : false) -comp = files('mygen.py') -mytarget = custom_target('gendat', - output : 'generated.dat', - input : 'source.txt', - command : [py3] + comp + ['@INPUT@', '@OUTPUT@'], - build_by_default : true, -) |