From f39600647d9fe95c91c80b0cc7e7a8c28524e778 Mon Sep 17 00:00:00 2001 From: Jussi Pakkanen Date: Sat, 3 Aug 2019 01:37:46 +0300 Subject: Condense test directory names. --- run_project_tests.py | 2 +- run_unittests.py | 136 ++++++++++---------- .../cmake/FindSomethingLikePython.cmake | 24 ---- test cases/cmake/10 cmake_module_path/meson.build | 17 --- test cases/cmake/10 generator expressions/main.cpp | 10 -- .../cmake/10 generator expressions/meson.build | 12 -- .../subprojects/cmMod/CMakeLists.txt | 22 ---- .../subprojects/cmMod/include/cmMod.hpp | 31 ----- test cases/cmake/10 header only/main.cpp | 10 ++ test cases/cmake/10 header only/meson.build | 12 ++ .../subprojects/cmMod/CMakeLists.txt | 11 ++ .../subprojects/cmMod/include/cmMod.hpp | 19 +++ .../cmake/FindSomethingLikePython.cmake | 24 ++++ test cases/cmake/11 cmake_module_path/meson.build | 17 +++ test cases/cmake/12 generator expressions/main.cpp | 10 ++ .../cmake/12 generator expressions/meson.build | 12 ++ .../subprojects/cmMod/CMakeLists.txt | 22 ++++ .../subprojects/cmMod/include/cmMod.hpp | 31 +++++ test cases/cmake/9 header only/main.cpp | 10 -- test cases/cmake/9 header only/meson.build | 12 -- .../9 header only/subprojects/cmMod/CMakeLists.txt | 11 -- .../subprojects/cmMod/include/cmMod.hpp | 19 --- test cases/common/100 manygen/depuser.c | 8 -- test cases/common/100 manygen/meson.build | 14 -- test cases/common/100 manygen/subdir/funcinfo.def | 1 - test cases/common/100 manygen/subdir/manygen.py | 83 ------------ test cases/common/100 manygen/subdir/meson.build | 26 ---- test cases/common/100 stringdef/meson.build | 3 + test cases/common/100 stringdef/stringdef.c | 10 ++ .../common/101 find program path/meson.build | 22 ++++ test cases/common/101 find program path/program.py | 3 + test cases/common/101 stringdef/meson.build | 3 - test cases/common/101 stringdef/stringdef.c | 10 -- .../common/102 find program path/meson.build | 22 ---- test cases/common/102 find program path/program.py | 3 - .../common/102 subproject subdir/meson.build | 6 + test cases/common/102 subproject subdir/prog.c | 5 + .../subprojects/sub/lib/meson.build | 2 + .../subprojects/sub/lib/sub.c | 5 + .../subprojects/sub/lib/sub.h | 6 + .../subprojects/sub/meson.build | 2 + test cases/common/103 postconf/meson.build | 5 + test cases/common/103 postconf/postconf.py | 16 +++ test cases/common/103 postconf/prog.c | 5 + test cases/common/103 postconf/raw.dat | 1 + .../common/103 subproject subdir/meson.build | 6 - test cases/common/103 subproject subdir/prog.c | 5 - .../subprojects/sub/lib/meson.build | 2 - .../subprojects/sub/lib/sub.c | 5 - .../subprojects/sub/lib/sub.h | 6 - .../subprojects/sub/meson.build | 2 - .../common/104 postconf with args/meson.build | 5 + .../common/104 postconf with args/postconf.py | 18 +++ test cases/common/104 postconf with args/prog.c | 5 + test cases/common/104 postconf with args/raw.dat | 1 + test cases/common/104 postconf/meson.build | 5 - test cases/common/104 postconf/postconf.py | 16 --- test cases/common/104 postconf/prog.c | 5 - test cases/common/104 postconf/raw.dat | 1 - .../common/105 postconf with args/meson.build | 5 - .../common/105 postconf with args/postconf.py | 18 --- test cases/common/105 postconf with args/prog.c | 5 - test cases/common/105 postconf with args/raw.dat | 1 - .../common/105 testframework options/meson.build | 5 + .../105 testframework options/meson_options.txt | 3 + .../common/105 testframework options/test_args.txt | 4 + test cases/common/106 extract same name/lib.c | 3 + test cases/common/106 extract same name/main.c | 6 + .../common/106 extract same name/meson.build | 7 + test cases/common/106 extract same name/src/lib.c | 3 + .../common/106 testframework options/meson.build | 5 - .../106 testframework options/meson_options.txt | 3 - .../common/106 testframework options/test_args.txt | 4 - test cases/common/107 extract same name/lib.c | 3 - test cases/common/107 extract same name/main.c | 6 - .../common/107 extract same name/meson.build | 7 - test cases/common/107 extract same name/src/lib.c | 3 - .../common/107 has header symbol/meson.build | 36 ++++++ test cases/common/108 has arg/meson.build | 60 +++++++++ .../common/108 has header symbol/meson.build | 36 ------ test cases/common/109 generatorcustom/catter.py | 14 ++ test cases/common/109 generatorcustom/gen.py | 13 ++ test cases/common/109 generatorcustom/main.c | 7 + test cases/common/109 generatorcustom/meson.build | 18 +++ test cases/common/109 generatorcustom/res1.txt | 1 + test cases/common/109 generatorcustom/res2.txt | 1 + test cases/common/109 has arg/meson.build | 60 --------- test cases/common/110 generatorcustom/catter.py | 14 -- test cases/common/110 generatorcustom/gen.py | 13 -- test cases/common/110 generatorcustom/main.c | 7 - test cases/common/110 generatorcustom/meson.build | 18 --- test cases/common/110 generatorcustom/res1.txt | 1 - test cases/common/110 generatorcustom/res2.txt | 1 - .../110 multiple dir configure file/meson.build | 11 ++ .../110 multiple dir configure file/subdir/foo.txt | 0 .../subdir/meson.build | 11 ++ .../subdir/someinput.in | 0 .../111 multiple dir configure file/meson.build | 11 -- .../111 multiple dir configure file/subdir/foo.txt | 0 .../subdir/meson.build | 11 -- .../subdir/someinput.in | 0 .../111 spaces backslash/asm output/meson.build | 2 + .../111 spaces backslash/comparer-end-notstring.c | 20 +++ .../common/111 spaces backslash/comparer-end.c | 16 +++ test cases/common/111 spaces backslash/comparer.c | 16 +++ .../common/111 spaces backslash/include/comparer.h | 4 + test cases/common/111 spaces backslash/meson.build | 28 ++++ .../112 spaces backslash/asm output/meson.build | 2 - .../112 spaces backslash/comparer-end-notstring.c | 20 --- .../common/112 spaces backslash/comparer-end.c | 16 --- test cases/common/112 spaces backslash/comparer.c | 16 --- .../common/112 spaces backslash/include/comparer.h | 4 - test cases/common/112 spaces backslash/meson.build | 28 ---- test cases/common/112 ternary/meson.build | 12 ++ .../113 custom target capture/data_source.txt | 1 + .../113 custom target capture/installed_files.txt | 1 + .../common/113 custom target capture/meson.build | 24 ++++ .../113 custom target capture/my_compiler.py | 14 ++ test cases/common/113 ternary/meson.build | 12 -- test cases/common/114 allgenerate/converter.py | 8 ++ test cases/common/114 allgenerate/foobar.cpp.in | 6 + test cases/common/114 allgenerate/meson.build | 20 +++ .../114 custom target capture/data_source.txt | 1 - .../114 custom target capture/installed_files.txt | 1 - .../common/114 custom target capture/meson.build | 24 ---- .../114 custom target capture/my_compiler.py | 14 -- test cases/common/115 allgenerate/converter.py | 8 -- test cases/common/115 allgenerate/foobar.cpp.in | 6 - test cases/common/115 allgenerate/meson.build | 20 --- test cases/common/115 pathjoin/meson.build | 24 ++++ test cases/common/116 pathjoin/meson.build | 24 ---- .../common/116 subdir subproject/meson.build | 2 + .../common/116 subdir subproject/prog/meson.build | 5 + .../common/116 subdir subproject/prog/prog.c | 5 + .../subprojects/sub/meson.build | 3 + .../116 subdir subproject/subprojects/sub/sub.c | 5 + .../116 subdir subproject/subprojects/sub/sub.h | 6 + .../meson.build | 20 +++ .../common/117 subdir subproject/meson.build | 2 - .../common/117 subdir subproject/prog/meson.build | 5 - .../common/117 subdir subproject/prog/prog.c | 5 - .../subprojects/sub/meson.build | 3 - .../117 subdir subproject/subprojects/sub/sub.c | 5 - .../117 subdir subproject/subprojects/sub/sub.h | 6 - .../meson.build | 20 --- test cases/common/118 skip/meson.build | 4 + test cases/common/119 skip/meson.build | 4 - .../common/119 subproject project arguments/exe.c | 27 ++++ .../119 subproject project arguments/exe.cpp | 28 ++++ .../119 subproject project arguments/meson.build | 17 +++ .../subprojects/subexe/meson.build | 13 ++ .../subprojects/subexe/subexe.c | 27 ++++ .../common/120 subproject project arguments/exe.c | 27 ---- .../120 subproject project arguments/exe.cpp | 28 ---- .../120 subproject project arguments/meson.build | 17 --- .../subprojects/subexe/meson.build | 13 -- .../subprojects/subexe/subexe.c | 27 ---- test cases/common/120 test skip/meson.build | 4 + test cases/common/120 test skip/test_skip.c | 3 + .../common/121 shared module/installed_files.txt | 3 + test cases/common/121 shared module/meson.build | 22 ++++ test cases/common/121 shared module/module.c | 96 ++++++++++++++ test cases/common/121 shared module/nosyms.c | 4 + test cases/common/121 shared module/prog.c | 102 +++++++++++++++ test cases/common/121 shared module/runtime.c | 19 +++ test cases/common/121 test skip/meson.build | 4 - test cases/common/121 test skip/test_skip.c | 3 - test cases/common/122 llvm ir and assembly/main.c | 14 ++ .../common/122 llvm ir and assembly/main.cpp | 16 +++ .../common/122 llvm ir and assembly/meson.build | 63 +++++++++ .../common/122 llvm ir and assembly/square-arm.S | 12 ++ .../common/122 llvm ir and assembly/square-x86.S | 36 ++++++ .../122 llvm ir and assembly/square-x86_64.S | 37 ++++++ .../common/122 llvm ir and assembly/square.ll | 4 + .../122 llvm ir and assembly/symbol-underscore.h | 5 + .../common/122 shared module/installed_files.txt | 3 - test cases/common/122 shared module/meson.build | 22 ---- test cases/common/122 shared module/module.c | 96 -------------- test cases/common/122 shared module/nosyms.c | 4 - test cases/common/122 shared module/prog.c | 102 --------------- test cases/common/122 shared module/runtime.c | 19 --- test cases/common/123 cpp and asm/meson.build | 28 ++++ test cases/common/123 cpp and asm/retval-arm.S | 11 ++ test cases/common/123 cpp and asm/retval-x86.S | 11 ++ test cases/common/123 cpp and asm/retval-x86_64.S | 11 ++ .../common/123 cpp and asm/symbol-underscore.h | 5 + test cases/common/123 cpp and asm/trivial.cc | 16 +++ test cases/common/123 llvm ir and assembly/main.c | 14 -- .../common/123 llvm ir and assembly/main.cpp | 16 --- .../common/123 llvm ir and assembly/meson.build | 63 --------- .../common/123 llvm ir and assembly/square-arm.S | 12 -- .../common/123 llvm ir and assembly/square-x86.S | 36 ------ .../123 llvm ir and assembly/square-x86_64.S | 37 ------ .../common/123 llvm ir and assembly/square.ll | 4 - .../123 llvm ir and assembly/symbol-underscore.h | 5 - test cases/common/124 cpp and asm/meson.build | 28 ---- test cases/common/124 cpp and asm/retval-arm.S | 11 -- test cases/common/124 cpp and asm/retval-x86.S | 11 -- test cases/common/124 cpp and asm/retval-x86_64.S | 11 -- .../common/124 cpp and asm/symbol-underscore.h | 5 - test cases/common/124 cpp and asm/trivial.cc | 16 --- .../124 extract all shared library/extractor.h | 6 + .../common/124 extract all shared library/four.c | 5 + .../124 extract all shared library/func1234.def | 5 + .../124 extract all shared library/meson.build | 10 ++ .../common/124 extract all shared library/one.c | 5 + .../common/124 extract all shared library/prog.c | 10 ++ .../common/124 extract all shared library/three.c | 5 + .../common/124 extract all shared library/two.c | 5 + .../125 extract all shared library/extractor.h | 6 - .../common/125 extract all shared library/four.c | 5 - .../125 extract all shared library/func1234.def | 5 - .../125 extract all shared library/meson.build | 10 -- .../common/125 extract all shared library/one.c | 5 - .../common/125 extract all shared library/prog.c | 10 -- .../common/125 extract all shared library/three.c | 5 - .../common/125 extract all shared library/two.c | 5 - .../125 object only target/installed_files.txt | 2 + .../common/125 object only target/meson.build | 45 +++++++ .../common/125 object only target/obj_generator.py | 18 +++ test cases/common/125 object only target/prog.c | 7 + test cases/common/125 object only target/source.c | 3 + test cases/common/125 object only target/source2.c | 3 + .../common/125 object only target/source2.def | 2 + test cases/common/125 object only target/source3.c | 3 + .../common/126 no buildincdir/include/header.h | 3 + test cases/common/126 no buildincdir/meson.build | 14 ++ test cases/common/126 no buildincdir/prog.c | 5 + .../126 object only target/installed_files.txt | 2 - .../common/126 object only target/meson.build | 45 ------- .../common/126 object only target/obj_generator.py | 18 --- test cases/common/126 object only target/prog.c | 7 - test cases/common/126 object only target/source.c | 3 - test cases/common/126 object only target/source2.c | 3 - .../common/126 object only target/source2.def | 2 - test cases/common/126 object only target/source3.c | 3 - .../127 custom target directory install/docgen.py | 12 ++ .../installed_files.txt | 3 + .../meson.build | 9 ++ .../common/127 no buildincdir/include/header.h | 3 - test cases/common/127 no buildincdir/meson.build | 14 -- test cases/common/127 no buildincdir/prog.c | 5 - .../128 custom target directory install/docgen.py | 12 -- .../installed_files.txt | 3 - .../meson.build | 9 -- .../common/128 dependency file generation/main .c | 3 + .../128 dependency file generation/meson.build | 14 ++ .../inc/confdata.in | 1 + .../inc/meson.build | 6 + .../129 configure file in generator/meson.build | 4 + .../129 configure file in generator/src/gen.py | 13 ++ .../129 configure file in generator/src/main.c | 17 +++ .../src/meson.build | 7 + .../129 configure file in generator/src/source | 1 + .../common/129 dependency file generation/main .c | 3 - .../129 dependency file generation/meson.build | 14 -- .../inc/confdata.in | 1 - .../inc/meson.build | 6 - .../130 configure file in generator/meson.build | 4 - .../130 configure file in generator/src/gen.py | 13 -- .../130 configure file in generator/src/main.c | 17 --- .../src/meson.build | 7 - .../130 configure file in generator/src/source | 1 - .../common/130 generated llvm ir/copyfile.py | 6 + test cases/common/130 generated llvm ir/main.c | 14 ++ .../common/130 generated llvm ir/meson.build | 24 ++++ .../common/130 generated llvm ir/square.ll.in | 4 + .../common/131 generated assembly/copyfile.py | 6 + test cases/common/131 generated assembly/main.c | 17 +++ .../common/131 generated assembly/meson.build | 39 ++++++ .../common/131 generated assembly/square-arm.S.in | 13 ++ .../common/131 generated assembly/square-x86.S.in | 34 +++++ .../131 generated assembly/square-x86_64.S.in | 38 ++++++ .../131 generated assembly/symbol-underscore.h | 5 + .../common/131 generated llvm ir/copyfile.py | 6 - test cases/common/131 generated llvm ir/main.c | 14 -- .../common/131 generated llvm ir/meson.build | 24 ---- .../common/131 generated llvm ir/square.ll.in | 4 - .../132 build by default targets in tests/main.c | 3 + .../meson.build | 23 ++++ .../write_file.py | 6 + .../common/132 generated assembly/copyfile.py | 6 - test cases/common/132 generated assembly/main.c | 17 --- .../common/132 generated assembly/meson.build | 39 ------ .../common/132 generated assembly/square-arm.S.in | 13 -- .../common/132 generated assembly/square-x86.S.in | 34 ----- .../132 generated assembly/square-x86_64.S.in | 38 ------ .../132 generated assembly/symbol-underscore.h | 5 - .../133 build by default targets in tests/main.c | 3 - .../meson.build | 23 ---- .../write_file.py | 6 - .../common/133 build by default/checkexists.py | 10 ++ test cases/common/133 build by default/foo.c | 6 + test cases/common/133 build by default/meson.build | 45 +++++++ test cases/common/133 build by default/mygen.py | 8 ++ test cases/common/133 build by default/source.txt | 1 + .../common/134 build by default/checkexists.py | 10 -- test cases/common/134 build by default/foo.c | 6 - test cases/common/134 build by default/meson.build | 45 ------- test cases/common/134 build by default/mygen.py | 8 -- test cases/common/134 build by default/source.txt | 1 - .../common/134 include order/ctsub/copyfile.py | 6 + .../common/134 include order/ctsub/emptyfile.c | 0 test cases/common/134 include order/ctsub/main.h | 1 + .../common/134 include order/ctsub/meson.build | 9 ++ test cases/common/134 include order/inc1/hdr.h | 1 + test cases/common/134 include order/inc2/hdr.h | 1 + test cases/common/134 include order/meson.build | 36 ++++++ test cases/common/134 include order/ordertest.c | 11 ++ test cases/common/134 include order/sub1/main.h | 1 + .../common/134 include order/sub1/meson.build | 4 + test cases/common/134 include order/sub1/some.c | 6 + test cases/common/134 include order/sub1/some.h | 10 ++ test cases/common/134 include order/sub2/main.h | 1 + .../common/134 include order/sub2/meson.build | 2 + test cases/common/134 include order/sub3/main.h | 1 + .../common/134 include order/sub3/meson.build | 1 + test cases/common/134 include order/sub4/main.c | 8 ++ test cases/common/134 include order/sub4/main.h | 3 + .../common/134 include order/sub4/meson.build | 6 + .../common/135 include order/ctsub/copyfile.py | 6 - .../common/135 include order/ctsub/emptyfile.c | 0 test cases/common/135 include order/ctsub/main.h | 1 - .../common/135 include order/ctsub/meson.build | 9 -- test cases/common/135 include order/inc1/hdr.h | 1 - test cases/common/135 include order/inc2/hdr.h | 1 - test cases/common/135 include order/meson.build | 36 ------ test cases/common/135 include order/ordertest.c | 11 -- test cases/common/135 include order/sub1/main.h | 1 - .../common/135 include order/sub1/meson.build | 4 - test cases/common/135 include order/sub1/some.c | 6 - test cases/common/135 include order/sub1/some.h | 10 -- test cases/common/135 include order/sub2/main.h | 1 - .../common/135 include order/sub2/meson.build | 2 - test cases/common/135 include order/sub3/main.h | 1 - .../common/135 include order/sub3/meson.build | 1 - test cases/common/135 include order/sub4/main.c | 8 -- test cases/common/135 include order/sub4/main.h | 3 - .../common/135 include order/sub4/meson.build | 6 - test cases/common/135 override options/four.c | 9 ++ test cases/common/135 override options/meson.build | 6 + test cases/common/135 override options/one.c | 3 + test cases/common/135 override options/three.c | 7 + test cases/common/135 override options/two.c | 6 + test cases/common/136 get define/concat.h | 24 ++++ test cases/common/136 get define/meson.build | 101 +++++++++++++++ test cases/common/136 get define/meson_options.txt | 1 + test cases/common/136 override options/four.c | 9 -- test cases/common/136 override options/meson.build | 6 - test cases/common/136 override options/one.c | 3 - test cases/common/136 override options/three.c | 7 - test cases/common/136 override options/two.c | 6 - test cases/common/137 c cpp and asm/main.c | 8 ++ test cases/common/137 c cpp and asm/main.cpp | 11 ++ test cases/common/137 c cpp and asm/meson.build | 23 ++++ test cases/common/137 c cpp and asm/retval-arm.S | 11 ++ test cases/common/137 c cpp and asm/retval-x86.S | 12 ++ .../common/137 c cpp and asm/retval-x86_64.S | 11 ++ test cases/common/137 c cpp and asm/somelib.c | 3 + .../common/137 c cpp and asm/symbol-underscore.h | 5 + test cases/common/137 get define/concat.h | 24 ---- test cases/common/137 get define/meson.build | 101 --------------- test cases/common/137 get define/meson_options.txt | 1 - test cases/common/138 c cpp and asm/main.c | 8 -- test cases/common/138 c cpp and asm/main.cpp | 11 -- test cases/common/138 c cpp and asm/meson.build | 23 ---- test cases/common/138 c cpp and asm/retval-arm.S | 11 -- test cases/common/138 c cpp and asm/retval-x86.S | 12 -- .../common/138 c cpp and asm/retval-x86_64.S | 11 -- test cases/common/138 c cpp and asm/somelib.c | 3 - .../common/138 c cpp and asm/symbol-underscore.h | 5 - test cases/common/138 compute int/config.h.in | 4 + test cases/common/138 compute int/foobar.h | 6 + test cases/common/138 compute int/meson.build | 43 +++++++ test cases/common/138 compute int/prog.c.in | 25 ++++ test cases/common/139 compute int/config.h.in | 4 - test cases/common/139 compute int/foobar.h | 6 - test cases/common/139 compute int/meson.build | 43 ------- test cases/common/139 compute int/prog.c.in | 25 ---- .../139 custom target object output/meson.build | 16 +++ .../obj_generator.py | 18 +++ .../objdir/meson.build | 5 + .../objdir/source.c | 3 + .../progdir/meson.build | 1 + .../139 custom target object output/progdir/prog.c | 5 + .../140 custom target object output/meson.build | 16 --- .../obj_generator.py | 18 --- .../objdir/meson.build | 5 - .../objdir/source.c | 3 - .../progdir/meson.build | 1 - .../140 custom target object output/progdir/prog.c | 5 - test cases/common/140 empty build file/meson.build | 2 + .../common/140 empty build file/subdir/meson.build | 0 test cases/common/141 empty build file/meson.build | 2 - .../common/141 empty build file/subdir/meson.build | 0 .../common/141 whole archive/exe/meson.build | 1 + .../common/141 whole archive/exe2/meson.build | 1 + .../common/141 whole archive/exe3/meson.build | 1 + .../common/141 whole archive/exe4/meson.build | 1 + test cases/common/141 whole archive/func1.c | 7 + test cases/common/141 whole archive/func2.c | 7 + test cases/common/141 whole archive/meson.build | 50 +++++++ test cases/common/141 whole archive/mylib.h | 21 +++ test cases/common/141 whole archive/prog.c | 5 + .../sh_func2_dep_func1/meson.build | 4 + .../sh_func2_linked_func1/meson.build | 3 + .../sh_func2_transdep_func1/meson.build | 6 + .../sh_only_link_whole/meson.build | 1 + .../common/141 whole archive/st_func1/meson.build | 1 + .../common/141 whole archive/st_func2/meson.build | 1 + test cases/common/142 C and CPP link/dummy.c | 0 test cases/common/142 C and CPP link/foo.c | 19 +++ test cases/common/142 C and CPP link/foo.cpp | 34 +++++ test cases/common/142 C and CPP link/foo.h | 16 +++ test cases/common/142 C and CPP link/foo.hpp | 24 ++++ test cases/common/142 C and CPP link/foobar.c | 27 ++++ test cases/common/142 C and CPP link/foobar.h | 16 +++ test cases/common/142 C and CPP link/meson.build | 123 ++++++++++++++++++ test cases/common/142 C and CPP link/sub.c | 19 +++ test cases/common/142 C and CPP link/sub.h | 16 +++ .../common/142 whole archive/exe/meson.build | 1 - .../common/142 whole archive/exe2/meson.build | 1 - .../common/142 whole archive/exe3/meson.build | 1 - .../common/142 whole archive/exe4/meson.build | 1 - test cases/common/142 whole archive/func1.c | 7 - test cases/common/142 whole archive/func2.c | 7 - test cases/common/142 whole archive/meson.build | 50 ------- test cases/common/142 whole archive/mylib.h | 21 --- test cases/common/142 whole archive/prog.c | 5 - .../sh_func2_dep_func1/meson.build | 4 - .../sh_func2_linked_func1/meson.build | 3 - .../sh_func2_transdep_func1/meson.build | 6 - .../sh_only_link_whole/meson.build | 1 - .../common/142 whole archive/st_func1/meson.build | 1 - .../common/142 whole archive/st_func2/meson.build | 1 - test cases/common/143 C and CPP link/dummy.c | 0 test cases/common/143 C and CPP link/foo.c | 19 --- test cases/common/143 C and CPP link/foo.cpp | 34 ----- test cases/common/143 C and CPP link/foo.h | 16 --- test cases/common/143 C and CPP link/foo.hpp | 24 ---- test cases/common/143 C and CPP link/foobar.c | 27 ---- test cases/common/143 C and CPP link/foobar.h | 16 --- test cases/common/143 C and CPP link/meson.build | 123 ------------------ test cases/common/143 C and CPP link/sub.c | 19 --- test cases/common/143 C and CPP link/sub.h | 16 --- .../143 mesonintrospect from scripts/check_env.py | 28 ++++ .../check_introspection.py | 18 +++ .../143 mesonintrospect from scripts/meson.build | 14 ++ .../generator.py | 14 ++ .../installed_files.txt | 6 + .../144 custom target multiple outputs/meson.build | 28 ++++ .../144 mesonintrospect from scripts/check_env.py | 28 ---- .../check_introspection.py | 18 --- .../144 mesonintrospect from scripts/meson.build | 14 -- .../generator.py | 14 -- .../installed_files.txt | 6 - .../145 custom target multiple outputs/meson.build | 28 ---- .../common/145 special characters/check_quoting.py | 28 ++++ .../145 special characters/installed_files.txt | 2 + .../common/145 special characters/meson.build | 37 ++++++ test cases/common/146 nested links/meson.build | 8 ++ test cases/common/146 nested links/xephyr.c | 3 + .../common/146 special characters/check_quoting.py | 28 ---- .../146 special characters/installed_files.txt | 2 - .../common/146 special characters/meson.build | 37 ------ test cases/common/147 list of file sources/foo | 1 + test cases/common/147 list of file sources/gen.py | 7 + .../common/147 list of file sources/meson.build | 12 ++ test cases/common/147 nested links/meson.build | 8 -- test cases/common/147 nested links/xephyr.c | 3 - .../common/148 link depends custom target/foo.c | 15 +++ .../148 link depends custom target/make_file.py | 5 + .../148 link depends custom target/meson.build | 19 +++ test cases/common/148 list of file sources/foo | 1 - test cases/common/148 list of file sources/gen.py | 7 - .../common/148 list of file sources/meson.build | 12 -- .../common/149 link depends custom target/foo.c | 15 --- .../149 link depends custom target/make_file.py | 5 - .../149 link depends custom target/meson.build | 19 --- .../149 recursive linking/3rdorderdeps/lib.c.in | 8 ++ .../149 recursive linking/3rdorderdeps/main.c.in | 16 +++ .../149 recursive linking/3rdorderdeps/meson.build | 49 +++++++ .../common/149 recursive linking/circular/lib1.c | 6 + .../common/149 recursive linking/circular/lib2.c | 6 + .../common/149 recursive linking/circular/lib3.c | 6 + .../common/149 recursive linking/circular/main.c | 28 ++++ .../149 recursive linking/circular/meson.build | 5 + .../common/149 recursive linking/circular/prop1.c | 3 + .../common/149 recursive linking/circular/prop2.c | 3 + .../common/149 recursive linking/circular/prop3.c | 3 + .../149 recursive linking/edge-cases/libsto.c | 8 ++ .../149 recursive linking/edge-cases/meson.build | 9 ++ .../149 recursive linking/edge-cases/shstmain.c | 16 +++ .../149 recursive linking/edge-cases/stobuilt.c | 7 + .../149 recursive linking/edge-cases/stomain.c | 16 +++ test cases/common/149 recursive linking/lib.h | 17 +++ test cases/common/149 recursive linking/main.c | 46 +++++++ .../common/149 recursive linking/meson.build | 29 +++++ .../common/149 recursive linking/shnodep/lib.c | 6 + .../149 recursive linking/shnodep/meson.build | 1 + .../common/149 recursive linking/shshdep/lib.c | 8 ++ .../149 recursive linking/shshdep/meson.build | 1 + .../common/149 recursive linking/shstdep/lib.c | 8 ++ .../149 recursive linking/shstdep/meson.build | 1 + .../common/149 recursive linking/stnodep/lib.c | 6 + .../149 recursive linking/stnodep/meson.build | 2 + .../common/149 recursive linking/stshdep/lib.c | 8 ++ .../149 recursive linking/stshdep/meson.build | 2 + .../common/149 recursive linking/ststdep/lib.c | 8 ++ .../149 recursive linking/ststdep/meson.build | 2 + test cases/common/150 library at root/lib.c | 6 + test cases/common/150 library at root/main/main.c | 5 + .../common/150 library at root/main/meson.build | 2 + test cases/common/150 library at root/meson.build | 3 + .../150 recursive linking/3rdorderdeps/lib.c.in | 8 -- .../150 recursive linking/3rdorderdeps/main.c.in | 16 --- .../150 recursive linking/3rdorderdeps/meson.build | 49 ------- .../common/150 recursive linking/circular/lib1.c | 6 - .../common/150 recursive linking/circular/lib2.c | 6 - .../common/150 recursive linking/circular/lib3.c | 6 - .../common/150 recursive linking/circular/main.c | 28 ---- .../150 recursive linking/circular/meson.build | 5 - .../common/150 recursive linking/circular/prop1.c | 3 - .../common/150 recursive linking/circular/prop2.c | 3 - .../common/150 recursive linking/circular/prop3.c | 3 - .../150 recursive linking/edge-cases/libsto.c | 8 -- .../150 recursive linking/edge-cases/meson.build | 9 -- .../150 recursive linking/edge-cases/shstmain.c | 16 --- .../150 recursive linking/edge-cases/stobuilt.c | 7 - .../150 recursive linking/edge-cases/stomain.c | 16 --- test cases/common/150 recursive linking/lib.h | 17 --- test cases/common/150 recursive linking/main.c | 46 ------- .../common/150 recursive linking/meson.build | 29 ----- .../common/150 recursive linking/shnodep/lib.c | 6 - .../150 recursive linking/shnodep/meson.build | 1 - .../common/150 recursive linking/shshdep/lib.c | 8 -- .../150 recursive linking/shshdep/meson.build | 1 - .../common/150 recursive linking/shstdep/lib.c | 8 -- .../150 recursive linking/shstdep/meson.build | 1 - .../common/150 recursive linking/stnodep/lib.c | 6 - .../150 recursive linking/stnodep/meson.build | 2 - .../common/150 recursive linking/stshdep/lib.c | 8 -- .../150 recursive linking/stshdep/meson.build | 2 - .../common/150 recursive linking/ststdep/lib.c | 8 -- .../150 recursive linking/ststdep/meson.build | 2 - test cases/common/151 library at root/lib.c | 6 - test cases/common/151 library at root/main/main.c | 5 - .../common/151 library at root/main/meson.build | 2 - test cases/common/151 library at root/meson.build | 3 - test cases/common/151 simd/fallback.c | 8 ++ test cases/common/151 simd/include/simdheader.h | 3 + test cases/common/151 simd/meson.build | 44 +++++++ test cases/common/151 simd/simd_avx.c | 49 +++++++ test cases/common/151 simd/simd_avx2.c | 42 ++++++ test cases/common/151 simd/simd_mmx.c | 67 ++++++++++ test cases/common/151 simd/simd_neon.c | 20 +++ test cases/common/151 simd/simd_sse.c | 29 +++++ test cases/common/151 simd/simd_sse2.c | 37 ++++++ test cases/common/151 simd/simd_sse3.c | 38 ++++++ test cases/common/151 simd/simd_sse41.c | 40 ++++++ test cases/common/151 simd/simd_sse42.c | 43 +++++++ test cases/common/151 simd/simd_ssse3.c | 48 +++++++ test cases/common/151 simd/simdchecker.c | 143 +++++++++++++++++++++ test cases/common/151 simd/simdfuncs.h | 75 +++++++++++ .../meson.build | 15 +++ .../module.c | 16 +++ .../prog.c | 60 +++++++++ test cases/common/152 simd/fallback.c | 8 -- test cases/common/152 simd/include/simdheader.h | 3 - test cases/common/152 simd/meson.build | 44 ------- test cases/common/152 simd/simd_avx.c | 49 ------- test cases/common/152 simd/simd_avx2.c | 42 ------ test cases/common/152 simd/simd_mmx.c | 67 ---------- test cases/common/152 simd/simd_neon.c | 20 --- test cases/common/152 simd/simd_sse.c | 29 ----- test cases/common/152 simd/simd_sse2.c | 37 ------ test cases/common/152 simd/simd_sse3.c | 38 ------ test cases/common/152 simd/simd_sse41.c | 40 ------ test cases/common/152 simd/simd_sse42.c | 43 ------- test cases/common/152 simd/simd_ssse3.c | 48 ------- test cases/common/152 simd/simdchecker.c | 143 --------------------- test cases/common/152 simd/simdfuncs.h | 75 ----------- test cases/common/153 dotinclude/dotproc.c | 10 ++ test cases/common/153 dotinclude/meson.build | 5 + test cases/common/153 dotinclude/stdio.h | 6 + .../meson.build | 15 --- .../module.c | 16 --- .../prog.c | 60 --------- test cases/common/154 dotinclude/dotproc.c | 10 -- test cases/common/154 dotinclude/meson.build | 5 - test cases/common/154 dotinclude/stdio.h | 6 - .../common/154 reserved targets/all/meson.build | 1 + .../154 reserved targets/benchmark/meson.build | 1 + .../154 reserved targets/clean-ctlist/meson.build | 1 + .../154 reserved targets/clean-gcda/meson.build | 1 + .../154 reserved targets/clean-gcno/meson.build | 1 + .../common/154 reserved targets/clean/meson.build | 1 + .../154 reserved targets/coverage-html/meson.build | 1 + .../154 reserved targets/coverage-text/meson.build | 1 + .../154 reserved targets/coverage-xml/meson.build | 1 + .../154 reserved targets/coverage/meson.build | 1 + .../common/154 reserved targets/dist/meson.build | 1 + .../154 reserved targets/distcheck/meson.build | 1 + .../154 reserved targets/install/meson.build | 1 + test cases/common/154 reserved targets/meson.build | 34 +++++ .../common/154 reserved targets/phony/meson.build | 1 + .../154 reserved targets/reconfigure/meson.build | 1 + .../154 reserved targets/runtarget/meson.build | 2 + .../154 reserved targets/scan-build/meson.build | 1 + test cases/common/154 reserved targets/test.c | 3 + .../common/154 reserved targets/test/meson.build | 1 + .../154 reserved targets/uninstall/meson.build | 1 + .../common/155 duplicate source names/dir1/file.c | 16 +++ .../155 duplicate source names/dir1/meson.build | 1 + .../155 duplicate source names/dir2/dir1/file.c | 1 + .../common/155 duplicate source names/dir2/file.c | 1 + .../155 duplicate source names/dir2/meson.build | 1 + .../155 duplicate source names/dir3/dir1/file.c | 1 + .../common/155 duplicate source names/dir3/file.c | 1 + .../155 duplicate source names/dir3/meson.build | 1 + .../common/155 duplicate source names/meson.build | 7 + .../common/155 reserved targets/all/meson.build | 1 - .../155 reserved targets/benchmark/meson.build | 1 - .../155 reserved targets/clean-ctlist/meson.build | 1 - .../155 reserved targets/clean-gcda/meson.build | 1 - .../155 reserved targets/clean-gcno/meson.build | 1 - .../common/155 reserved targets/clean/meson.build | 1 - .../155 reserved targets/coverage-html/meson.build | 1 - .../155 reserved targets/coverage-text/meson.build | 1 - .../155 reserved targets/coverage-xml/meson.build | 1 - .../155 reserved targets/coverage/meson.build | 1 - .../common/155 reserved targets/dist/meson.build | 1 - .../155 reserved targets/distcheck/meson.build | 1 - .../155 reserved targets/install/meson.build | 1 - test cases/common/155 reserved targets/meson.build | 34 ----- .../common/155 reserved targets/phony/meson.build | 1 - .../155 reserved targets/reconfigure/meson.build | 1 - .../155 reserved targets/runtarget/meson.build | 2 - .../155 reserved targets/scan-build/meson.build | 1 - test cases/common/155 reserved targets/test.c | 3 - .../common/155 reserved targets/test/meson.build | 1 - .../155 reserved targets/uninstall/meson.build | 1 - .../common/156 duplicate source names/dir1/file.c | 16 --- .../156 duplicate source names/dir1/meson.build | 1 - .../156 duplicate source names/dir2/dir1/file.c | 1 - .../common/156 duplicate source names/dir2/file.c | 1 - .../156 duplicate source names/dir2/meson.build | 1 - .../156 duplicate source names/dir3/dir1/file.c | 1 - .../common/156 duplicate source names/dir3/file.c | 1 - .../156 duplicate source names/dir3/meson.build | 1 - .../common/156 duplicate source names/meson.build | 7 - .../common/156 index customtarget/check_args.py | 18 +++ .../common/156 index customtarget/gen_sources.py | 49 +++++++ test cases/common/156 index customtarget/lib.c | 20 +++ .../common/156 index customtarget/meson.build | 39 ++++++ .../common/156 index customtarget/subdir/foo.c | 22 ++++ .../156 index customtarget/subdir/meson.build | 19 +++ .../common/157 index customtarget/check_args.py | 18 --- .../common/157 index customtarget/gen_sources.py | 49 ------- test cases/common/157 index customtarget/lib.c | 20 --- .../common/157 index customtarget/meson.build | 39 ------ .../common/157 index customtarget/subdir/foo.c | 22 ---- .../157 index customtarget/subdir/meson.build | 19 --- .../157 wrap file should not failed/meson.build | 10 ++ .../src/meson.build | 2 + .../src/subprojects/foo/prog2.c | 7 + .../src/subprojects/prog.c | 7 + .../subprojects/foo.wrap | 11 ++ .../subprojects/packagecache/foo-1.0-patch.tar.xz | Bin 0 -> 232 bytes .../subprojects/packagecache/foo-1.0.tar.xz | Bin 0 -> 180 bytes .../subprojects/packagecache/zlib-1.2.8-8-wrap.zip | 1 + .../subprojects/packagecache/zlib-1.2.8.tar.gz | 1 + .../subprojects/zlib-1.2.8/foo.c | 3 + .../subprojects/zlib-1.2.8/meson.build | 2 + .../subprojects/zlib.wrap | 10 ++ .../common/158 includedir subproj/meson.build | 9 ++ test cases/common/158 includedir subproj/prog.c | 4 + .../subprojects/inctest/include/incfile.h | 2 + .../subprojects/inctest/meson.build | 13 ++ .../158 wrap file should not failed/meson.build | 10 -- .../src/meson.build | 2 - .../src/subprojects/foo/prog2.c | 7 - .../src/subprojects/prog.c | 7 - .../subprojects/foo.wrap | 11 -- .../subprojects/packagecache/foo-1.0-patch.tar.xz | Bin 232 -> 0 bytes .../subprojects/packagecache/foo-1.0.tar.xz | Bin 180 -> 0 bytes .../subprojects/packagecache/zlib-1.2.8-8-wrap.zip | 1 - .../subprojects/packagecache/zlib-1.2.8.tar.gz | 1 - .../subprojects/zlib-1.2.8/foo.c | 3 - .../subprojects/zlib-1.2.8/meson.build | 2 - .../subprojects/zlib.wrap | 10 -- .../common/159 includedir subproj/meson.build | 9 -- test cases/common/159 includedir subproj/prog.c | 4 - .../subprojects/inctest/include/incfile.h | 2 - .../subprojects/inctest/meson.build | 13 -- .../common/159 subproject dir name collision/a.c | 13 ++ .../custom_subproject_dir/B/b.c | 20 +++ .../custom_subproject_dir/B/meson.build | 4 + .../custom_subproject_dir/C/c.c | 14 ++ .../custom_subproject_dir/C/meson.build | 2 + .../159 subproject dir name collision/meson.build | 12 ++ .../other_subdir/custom_subproject_dir/other.c | 19 +++ .../other_subdir/meson.build | 1 + .../common/160 config tool variable/meson.build | 31 +++++ .../common/160 subproject dir name collision/a.c | 13 -- .../custom_subproject_dir/B/b.c | 20 --- .../custom_subproject_dir/B/meson.build | 4 - .../custom_subproject_dir/C/c.c | 14 -- .../custom_subproject_dir/C/meson.build | 2 - .../160 subproject dir name collision/meson.build | 12 -- .../other_subdir/custom_subproject_dir/other.c | 19 --- .../other_subdir/meson.build | 1 - .../common/161 config tool variable/meson.build | 31 ----- .../copyfile.py | 6 + .../meson.build | 7 + .../subdir/dep.dat | 1 + .../subdir/foo.c.in | 6 + .../subdir/meson.build | 6 + .../copyfile.py | 6 - .../meson.build | 7 - .../subdir/dep.dat | 1 - .../subdir/foo.c.in | 6 - .../subdir/meson.build | 6 - .../162 external program shebang parsing/input.txt | 1 + .../162 external program shebang parsing/main.c | 72 +++++++++++ .../meson.build | 21 +++ .../script.int.in | 2 + test cases/common/163 disabler/meson.build | 43 +++++++ .../163 external program shebang parsing/input.txt | 1 - .../163 external program shebang parsing/main.c | 72 ----------- .../meson.build | 21 --- .../script.int.in | 2 - test cases/common/164 array option/meson.build | 17 +++ .../common/164 array option/meson_options.txt | 19 +++ test cases/common/164 disabler/meson.build | 43 ------- test cases/common/165 array option/meson.build | 17 --- .../common/165 array option/meson_options.txt | 19 --- .../checkcopy.py | 9 ++ .../foo.c.in | 6 + .../meson.build | 17 +++ .../checkcopy.py | 9 -- .../foo.c.in | 6 - .../meson.build | 17 --- .../common/166 not-found dependency/meson.build | 14 ++ .../166 not-found dependency/sub/meson.build | 1 + .../subprojects/trivial/meson.build | 3 + .../subprojects/trivial/trivial.c | 3 + .../common/166 not-found dependency/testlib.c | 0 .../common/167 not-found dependency/meson.build | 14 -- .../167 not-found dependency/sub/meson.build | 1 - .../subprojects/trivial/meson.build | 3 - .../subprojects/trivial/trivial.c | 3 - .../common/167 not-found dependency/testlib.c | 0 test cases/common/167 subdir if_found/meson.build | 11 ++ .../common/167 subdir if_found/subdir/meson.build | 1 + .../meson.build | 1 + test cases/common/168 subdir if_found/meson.build | 11 -- .../common/168 subdir if_found/subdir/meson.build | 1 - .../meson.build | 1 - .../common/169 dependency factory/meson.build | 51 ++++++++ .../common/170 dependency factory/meson.build | 51 -------- test cases/common/170 get project license/bar.c | 6 + .../common/170 get project license/meson.build | 8 ++ test cases/common/171 get project license/bar.c | 6 - .../common/171 get project license/meson.build | 8 -- test cases/common/171 yield/meson.build | 7 + test cases/common/171 yield/meson_options.txt | 3 + .../common/171 yield/subprojects/sub/meson.build | 5 + .../171 yield/subprojects/sub/meson_options.txt | 3 + .../contrib/subprojects/alpha/a.c | 15 +++ .../contrib/subprojects/alpha/meson.build | 4 + .../alpha/var/subprojects/wrap_files_might_be_here | 1 + .../contrib/subprojects/beta/b.c | 14 ++ .../contrib/subprojects/beta/meson.build | 4 + .../meson.build | 11 ++ .../172 subproject nested subproject dirs/prog.c | 5 + test cases/common/172 yield/meson.build | 7 - test cases/common/172 yield/meson_options.txt | 3 - .../common/172 yield/subprojects/sub/meson.build | 5 - .../172 yield/subprojects/sub/meson_options.txt | 3 - test cases/common/173 preserve gendir/base.inp | 1 + .../173 preserve gendir/com/mesonbuild/subbie.inp | 1 + test cases/common/173 preserve gendir/genprog.py | 46 +++++++ test cases/common/173 preserve gendir/meson.build | 13 ++ test cases/common/173 preserve gendir/testprog.c | 6 + .../contrib/subprojects/alpha/a.c | 15 --- .../contrib/subprojects/alpha/meson.build | 4 - .../alpha/var/subprojects/wrap_files_might_be_here | 1 - .../contrib/subprojects/beta/b.c | 14 -- .../contrib/subprojects/beta/meson.build | 4 - .../meson.build | 11 -- .../173 subproject nested subproject dirs/prog.c | 5 - test cases/common/174 preserve gendir/base.inp | 1 - .../174 preserve gendir/com/mesonbuild/subbie.inp | 1 - test cases/common/174 preserve gendir/genprog.py | 46 ------- test cases/common/174 preserve gendir/meson.build | 13 -- test cases/common/174 preserve gendir/testprog.c | 6 - test cases/common/174 source in dep/bar.cpp | 5 + test cases/common/174 source in dep/foo.c | 3 + .../common/174 source in dep/generated/funname | 1 + .../174 source in dep/generated/genheader.py | 17 +++ .../common/174 source in dep/generated/main.c | 5 + .../common/174 source in dep/generated/meson.build | 12 ++ test cases/common/174 source in dep/meson.build | 8 ++ .../common/175 generator link whole/export.h | 18 +++ .../common/175 generator link whole/generator.py | 30 +++++ test cases/common/175 generator link whole/main.c | 11 ++ .../common/175 generator link whole/meson.build | 65 ++++++++++ .../meson_test_function.tmpl | 0 .../pull_meson_test_function.c | 6 + test cases/common/175 source in dep/bar.cpp | 5 - test cases/common/175 source in dep/foo.c | 3 - .../common/175 source in dep/generated/funname | 1 - .../175 source in dep/generated/genheader.py | 17 --- .../common/175 source in dep/generated/main.c | 5 - .../common/175 source in dep/generated/meson.build | 12 -- test cases/common/175 source in dep/meson.build | 8 -- .../common/176 generator link whole/export.h | 18 --- .../common/176 generator link whole/generator.py | 30 ----- test cases/common/176 generator link whole/main.c | 11 -- .../common/176 generator link whole/meson.build | 65 ---------- .../meson_test_function.tmpl | 0 .../pull_meson_test_function.c | 6 - test cases/common/176 initial c_args/meson.build | 7 + test cases/common/176 initial c_args/test_args.txt | 4 + .../foo.c | 1 + .../main.c | 16 +++ .../meson.build | 11 ++ .../subprojects/subproj/foo.c | 1 + .../subprojects/subproj/meson.build | 3 + test cases/common/177 initial c_args/meson.build | 7 - test cases/common/177 initial c_args/test_args.txt | 4 - test cases/common/178 as-needed/config.h | 14 ++ test cases/common/178 as-needed/libA.cpp | 7 + test cases/common/178 as-needed/libA.h | 5 + test cases/common/178 as-needed/libB.cpp | 19 +++ test cases/common/178 as-needed/main.cpp | 7 + test cases/common/178 as-needed/meson.build | 13 ++ .../foo.c | 1 - .../main.c | 16 --- .../meson.build | 11 -- .../subprojects/subproj/foo.c | 1 - .../subprojects/subproj/meson.build | 3 - test cases/common/179 as-needed/config.h | 14 -- test cases/common/179 as-needed/libA.cpp | 7 - test cases/common/179 as-needed/libA.h | 5 - test cases/common/179 as-needed/libB.cpp | 19 --- test cases/common/179 as-needed/main.cpp | 7 - test cases/common/179 as-needed/meson.build | 13 -- .../common/179 ndebug if-release enabled/main.c | 15 +++ .../179 ndebug if-release enabled/meson.build | 7 + .../common/180 ndebug if-release disabled/main.c | 7 + .../180 ndebug if-release disabled/meson.build | 7 + .../common/180 ndebug if-release enabled/main.c | 15 --- .../180 ndebug if-release enabled/meson.build | 7 - .../common/181 ndebug if-release disabled/main.c | 7 - .../181 ndebug if-release disabled/meson.build | 7 - .../common/181 subproject version/meson.build | 10 ++ .../subprojects/a/meson.build | 5 + test cases/common/182 subdir_done/meson.build | 12 ++ .../common/182 subproject version/meson.build | 10 -- .../subprojects/a/meson.build | 5 - test cases/common/183 bothlibraries/libfile.c | 7 + test cases/common/183 bothlibraries/main.c | 8 ++ test cases/common/183 bothlibraries/meson.build | 25 ++++ test cases/common/183 bothlibraries/mylib.h | 13 ++ test cases/common/183 subdir_done/meson.build | 12 -- test cases/common/184 bothlibraries/libfile.c | 7 - test cases/common/184 bothlibraries/main.c | 8 -- test cases/common/184 bothlibraries/meson.build | 25 ---- test cases/common/184 bothlibraries/mylib.h | 13 -- test cases/common/184 escape and unicode/file.c.in | 5 + test cases/common/184 escape and unicode/file.py | 10 ++ test cases/common/184 escape and unicode/find.py | 9 ++ test cases/common/184 escape and unicode/fun.c | 3 + test cases/common/184 escape and unicode/main.c | 12 ++ .../common/184 escape and unicode/meson.build | 38 ++++++ test cases/common/185 escape and unicode/file.c.in | 5 - test cases/common/185 escape and unicode/file.py | 10 -- test cases/common/185 escape and unicode/find.py | 9 -- test cases/common/185 escape and unicode/fun.c | 3 - test cases/common/185 escape and unicode/main.c | 12 -- .../common/185 escape and unicode/meson.build | 38 ------ test cases/common/185 has link arg/meson.build | 44 +++++++ test cases/common/186 has link arg/meson.build | 44 ------- .../common/186 same target name flat layout/foo.c | 1 + .../common/186 same target name flat layout/main.c | 16 +++ .../186 same target name flat layout/meson.build | 11 ++ .../186 same target name flat layout/subdir/foo.c | 1 + .../subdir/meson.build | 1 + test cases/common/187 find override/meson.build | 12 ++ .../common/187 find override/otherdir/main.c | 5 + .../common/187 find override/otherdir/main2.c | 5 + .../common/187 find override/otherdir/meson.build | 26 ++++ .../common/187 find override/otherdir/source.desc | 1 + .../common/187 find override/otherdir/source2.desc | 1 + .../common/187 find override/subdir/converter.py | 15 +++ .../187 find override/subdir/gencodegen.py.in | 15 +++ .../common/187 find override/subdir/meson.build | 14 ++ .../common/187 same target name flat layout/foo.c | 1 - .../common/187 same target name flat layout/main.c | 16 --- .../187 same target name flat layout/meson.build | 11 -- .../187 same target name flat layout/subdir/foo.c | 1 - .../subdir/meson.build | 1 - test cases/common/188 find override/meson.build | 12 -- .../common/188 find override/otherdir/main.c | 5 - .../common/188 find override/otherdir/main2.c | 5 - .../common/188 find override/otherdir/meson.build | 26 ---- .../common/188 find override/otherdir/source.desc | 1 - .../common/188 find override/otherdir/source2.desc | 1 - .../common/188 find override/subdir/converter.py | 15 --- .../188 find override/subdir/gencodegen.py.in | 15 --- .../common/188 find override/subdir/meson.build | 14 -- .../declare_dependency/headers/foo.c | 16 +++ .../declare_dependency/headers/foo.h | 16 +++ .../declare_dependency/main.c | 25 ++++ .../declare_dependency/meson.build | 32 +++++ .../declare_dependency/other.c | 20 +++ .../common/188 partial dependency/meson.build | 17 +++ test cases/common/189 openmp/main.c | 16 +++ test cases/common/189 openmp/main.cpp | 16 +++ test cases/common/189 openmp/main.f90 | 9 ++ test cases/common/189 openmp/meson.build | 58 +++++++++ .../declare_dependency/headers/foo.c | 16 --- .../declare_dependency/headers/foo.h | 16 --- .../declare_dependency/main.c | 25 ---- .../declare_dependency/meson.build | 32 ----- .../declare_dependency/other.c | 20 --- .../common/189 partial dependency/meson.build | 17 --- test cases/common/190 openmp/main.c | 16 --- test cases/common/190 openmp/main.cpp | 16 --- test cases/common/190 openmp/main.f90 | 9 -- test cases/common/190 openmp/meson.build | 58 --------- test cases/common/190 same target name/file.c | 3 + test cases/common/190 same target name/meson.build | 4 + test cases/common/190 same target name/sub/file2.c | 3 + .../common/190 same target name/sub/meson.build | 1 + test cases/common/191 same target name/file.c | 3 - test cases/common/191 same target name/meson.build | 4 - test cases/common/191 same target name/sub/file2.c | 3 - .../common/191 same target name/sub/meson.build | 1 - test cases/common/191 test depends/gen.py | 13 ++ test cases/common/191 test depends/main.c | 1 + test cases/common/191 test depends/meson.build | 26 ++++ test cases/common/191 test depends/test.py | 20 +++ test cases/common/192 args flattening/meson.build | 29 +++++ test cases/common/192 test depends/gen.py | 13 -- test cases/common/192 test depends/main.c | 1 - test cases/common/192 test depends/meson.build | 26 ---- test cases/common/192 test depends/test.py | 20 --- test cases/common/193 args flattening/meson.build | 29 ----- test cases/common/193 dict/meson.build | 35 +++++ test cases/common/193 dict/prog.c | 8 ++ test cases/common/194 check header/meson.build | 48 +++++++ test cases/common/194 check header/ouagadougou.h | 1 + test cases/common/194 dict/meson.build | 35 ----- test cases/common/194 dict/prog.c | 8 -- test cases/common/195 check header/meson.build | 48 ------- test cases/common/195 check header/ouagadougou.h | 1 - test cases/common/195 install_mode/config.h.in | 5 + test cases/common/195 install_mode/data_source.txt | 1 + test cases/common/195 install_mode/foo.1 | 1 + .../common/195 install_mode/installed_files.txt | 10 ++ test cases/common/195 install_mode/meson.build | 59 +++++++++ test cases/common/195 install_mode/rootdir.h | 3 + test cases/common/195 install_mode/runscript.sh | 3 + test cases/common/195 install_mode/stat.c | 1 + test cases/common/195 install_mode/sub1/second.dat | 1 + test cases/common/195 install_mode/sub2/stub | 0 test cases/common/195 install_mode/trivial.c | 6 + test cases/common/196 install_mode/config.h.in | 5 - test cases/common/196 install_mode/data_source.txt | 1 - test cases/common/196 install_mode/foo.1 | 1 - .../common/196 install_mode/installed_files.txt | 10 -- test cases/common/196 install_mode/meson.build | 59 --------- test cases/common/196 install_mode/rootdir.h | 3 - test cases/common/196 install_mode/runscript.sh | 3 - test cases/common/196 install_mode/stat.c | 1 - test cases/common/196 install_mode/sub1/second.dat | 1 - test cases/common/196 install_mode/sub2/stub | 0 test cases/common/196 install_mode/trivial.c | 6 - .../196 subproject array version/meson.build | 3 + .../subprojects/foo/meson.build | 1 + test cases/common/197 feature option/meson.build | 47 +++++++ .../common/197 feature option/meson_options.txt | 3 + .../197 subproject array version/meson.build | 3 - .../subprojects/foo/meson.build | 1 - .../common/198 feature option disabled/meson.build | 23 ++++ .../198 feature option disabled/meson_options.txt | 3 + test cases/common/198 feature option/meson.build | 47 ------- .../common/198 feature option/meson_options.txt | 3 - .../common/199 feature option disabled/meson.build | 23 ---- .../199 feature option disabled/meson_options.txt | 3 - test cases/common/199 static threads/lib1.c | 13 ++ test cases/common/199 static threads/lib2.c | 5 + test cases/common/199 static threads/meson.build | 13 ++ test cases/common/199 static threads/prog.c | 6 + .../com/mesonbuild/genprog.py | 46 +++++++ .../com/mesonbuild/meson.build | 10 ++ .../com/mesonbuild/subbie.inp | 1 + .../com/mesonbuild/testprog.c | 5 + .../common/200 generator in subdir/meson.build | 3 + test cases/common/200 static threads/lib1.c | 13 -- test cases/common/200 static threads/lib2.c | 5 - test cases/common/200 static threads/meson.build | 13 -- test cases/common/200 static threads/prog.c | 6 - .../com/mesonbuild/genprog.py | 46 ------- .../com/mesonbuild/meson.build | 10 -- .../com/mesonbuild/subbie.inp | 1 - .../com/mesonbuild/testprog.c | 5 - .../common/201 generator in subdir/meson.build | 3 - .../common/201 override with exe/main2.input | 0 .../common/201 override with exe/meson.build | 15 +++ .../201 override with exe/subprojects/sub/foobar.c | 12 ++ .../subprojects/sub/meson.build | 3 + .../common/202 override with exe/main2.input | 0 .../common/202 override with exe/meson.build | 15 --- .../202 override with exe/subprojects/sub/foobar.c | 12 -- .../subprojects/sub/meson.build | 3 - .../202 subproject with features/meson.build | 17 +++ .../202 subproject with features/meson_options.txt | 3 + .../common/202 subproject with features/nothing.c | 4 + .../auto_sub_with_missing_dep/meson.build | 3 + .../subprojects/disabled_sub/lib/meson.build | 3 + .../subprojects/disabled_sub/lib/sub.c | 5 + .../subprojects/disabled_sub/lib/sub.h | 6 + .../subprojects/disabled_sub/meson.build | 3 + .../subprojects/sub/lib/meson.build | 2 + .../subprojects/sub/lib/sub.c | 5 + .../subprojects/sub/lib/sub.h | 6 + .../subprojects/sub/meson.build | 3 + .../common/203 function attributes/meson.build | 107 +++++++++++++++ .../203 subproject with features/meson.build | 17 --- .../203 subproject with features/meson_options.txt | 3 - .../common/203 subproject with features/nothing.c | 4 - .../auto_sub_with_missing_dep/meson.build | 3 - .../subprojects/disabled_sub/lib/meson.build | 3 - .../subprojects/disabled_sub/lib/sub.c | 5 - .../subprojects/disabled_sub/lib/sub.h | 6 - .../subprojects/disabled_sub/meson.build | 3 - .../subprojects/sub/lib/meson.build | 2 - .../subprojects/sub/lib/sub.c | 5 - .../subprojects/sub/lib/sub.h | 6 - .../subprojects/sub/meson.build | 3 - .../common/204 broken subproject/meson.build | 2 + .../subprojects/broken/broken.c | 1 + .../subprojects/broken/meson.build | 4 + .../common/204 function attributes/meson.build | 107 --------------- test cases/common/205 argument syntax/meson.build | 19 +++ .../common/205 broken subproject/meson.build | 2 - .../subprojects/broken/broken.c | 1 - .../subprojects/broken/meson.build | 4 - test cases/common/206 argument syntax/meson.build | 19 --- .../installed_files.txt | 15 +++ .../206 install name_prefix name_suffix/libfile.c | 14 ++ .../meson.build | 10 ++ .../installed_files.txt | 15 --- .../207 install name_prefix name_suffix/libfile.c | 14 -- .../meson.build | 10 -- test cases/common/207 kwarg entry/inc/prog.h | 3 + .../common/207 kwarg entry/installed_files.txt | 2 + test cases/common/207 kwarg entry/meson.build | 7 + test cases/common/207 kwarg entry/prog.c | 7 + .../208 custom target build by default/docgen.py | 12 ++ .../installed_files.txt | 0 .../208 custom target build by default/meson.build | 10 ++ test cases/common/208 kwarg entry/inc/prog.h | 3 - .../common/208 kwarg entry/installed_files.txt | 2 - test cases/common/208 kwarg entry/meson.build | 7 - test cases/common/208 kwarg entry/prog.c | 7 - .../209 custom target build by default/docgen.py | 12 -- .../installed_files.txt | 0 .../209 custom target build by default/meson.build | 10 -- .../common/209 find_library and headers/foo.h | 1 + .../209 find_library and headers/meson.build | 23 ++++ .../common/210 find_library and headers/foo.h | 1 - .../210 find_library and headers/meson.build | 23 ---- .../common/210 line continuation/meson.build | 17 +++ .../211 cmake module/cmake_project/CMakeLists.txt | 4 + .../common/211 cmake module/installed_files.txt | 2 + test cases/common/211 cmake module/meson.build | 31 +++++ .../common/211 cmake module/projectConfig.cmake.in | 4 + .../common/211 line continuation/meson.build | 17 --- .../212 cmake module/cmake_project/CMakeLists.txt | 4 - .../common/212 cmake module/installed_files.txt | 2 - test cases/common/212 cmake module/meson.build | 31 ----- .../common/212 cmake module/projectConfig.cmake.in | 4 - .../installed_files.txt | 2 + .../common/212 native file path override/main.cpp | 5 + .../212 native file path override/meson.build | 7 + .../212 native file path override/nativefile.ini | 2 + .../installed_files.txt | 2 - .../common/213 native file path override/main.cpp | 5 - .../213 native file path override/meson.build | 7 - .../213 native file path override/nativefile.ini | 2 - test cases/common/213 tap tests/meson.build | 10 ++ test cases/common/213 tap tests/tester.c | 10 ++ test cases/common/214 tap tests/meson.build | 10 -- test cases/common/214 tap tests/tester.c | 10 -- test cases/common/214 warning level 0/main.cpp | 12 ++ test cases/common/214 warning level 0/meson.build | 3 + test cases/common/215 link custom/custom_stlib.py | 73 +++++++++++ test cases/common/215 link custom/meson.build | 57 ++++++++ test cases/common/215 link custom/prog.c | 6 + test cases/common/215 warning level 0/main.cpp | 12 -- test cases/common/215 warning level 0/meson.build | 3 - test cases/common/216 link custom/custom_stlib.py | 73 ----------- test cases/common/216 link custom/meson.build | 57 -------- test cases/common/216 link custom/prog.c | 6 - .../generate_conflicting_stlibs.py | 90 +++++++++++++ .../meson.build | 37 ++++++ .../216 link custom_i single from multiple/prog.c | 5 + .../generate_stlibs.py | 92 +++++++++++++ .../meson.build | 37 ++++++ .../prog.c | 8 ++ .../generate_conflicting_stlibs.py | 90 ------------- .../meson.build | 37 ------ .../217 link custom_i single from multiple/prog.c | 5 - .../218 dependency get_variable method/meson.build | 52 ++++++++ .../generate_stlibs.py | 92 ------------- .../meson.build | 37 ------ .../prog.c | 8 -- .../219 dependency get_variable method/meson.build | 52 -------- .../common/219 source set configuration_data/a.c | 8 ++ .../common/219 source set configuration_data/all.h | 7 + .../common/219 source set configuration_data/f.c | 5 + .../common/219 source set configuration_data/g.c | 6 + .../219 source set configuration_data/meson.build | 54 ++++++++ .../219 source set configuration_data/nope.c | 3 + .../219 source set configuration_data/subdir/b.c | 13 ++ .../subdir/meson.build | 1 + .../common/220 source set configuration_data/a.c | 8 -- .../common/220 source set configuration_data/all.h | 7 - .../common/220 source set configuration_data/f.c | 5 - .../common/220 source set configuration_data/g.c | 6 - .../220 source set configuration_data/meson.build | 54 -------- .../220 source set configuration_data/nope.c | 3 - .../220 source set configuration_data/subdir/b.c | 13 -- .../subdir/meson.build | 1 - test cases/common/220 source set dictionary/a.c | 8 ++ test cases/common/220 source set dictionary/all.h | 7 + test cases/common/220 source set dictionary/f.c | 5 + test cases/common/220 source set dictionary/g.c | 6 + .../common/220 source set dictionary/meson.build | 56 ++++++++ test cases/common/220 source set dictionary/nope.c | 3 + .../common/220 source set dictionary/subdir/b.c | 13 ++ .../220 source set dictionary/subdir/meson.build | 1 + test cases/common/221 source set custom target/a.c | 7 + .../common/221 source set custom target/all.h | 2 + .../common/221 source set custom target/cp.py | 5 + test cases/common/221 source set custom target/f.c | 5 + test cases/common/221 source set custom target/g.c | 5 + .../221 source set custom target/meson.build | 28 ++++ test cases/common/221 source set dictionary/a.c | 8 -- test cases/common/221 source set dictionary/all.h | 7 - test cases/common/221 source set dictionary/f.c | 5 - test cases/common/221 source set dictionary/g.c | 6 - .../common/221 source set dictionary/meson.build | 56 -------- test cases/common/221 source set dictionary/nope.c | 3 - .../common/221 source set dictionary/subdir/b.c | 13 -- .../221 source set dictionary/subdir/meson.build | 1 - test cases/common/222 source set custom target/a.c | 7 - .../common/222 source set custom target/all.h | 2 - .../common/222 source set custom target/cp.py | 5 - test cases/common/222 source set custom target/f.c | 5 - test cases/common/222 source set custom target/g.c | 5 - .../222 source set custom target/meson.build | 28 ---- .../boards/arm/aarch64.cc | 8 ++ .../boards/arm/arm.cc | 10 ++ .../boards/arm/arm.h | 12 ++ .../boards/arm/arm32.cc | 8 ++ .../boards/arm/versatilepb.cc | 16 +++ .../boards/arm/virt.cc | 16 +++ .../boards/arm/xlnx_zcu102.cc | 16 +++ .../boards/meson.build | 7 + .../boards/x86/pc.cc | 26 ++++ .../222 source set realistic example/common.h | 41 ++++++ .../config/aarch64 | 5 + .../222 source set realistic example/config/arm | 3 + .../222 source set realistic example/config/x86 | 4 + .../devices/meson.build | 3 + .../devices/virtio-mmio.cc | 16 +++ .../devices/virtio-pci.cc | 16 +++ .../devices/virtio.cc | 6 + .../devices/virtio.h | 10 ++ .../222 source set realistic example/main.cc | 32 +++++ .../222 source set realistic example/meson.build | 50 +++++++ .../222 source set realistic example/not-found.cc | 8 ++ .../222 source set realistic example/was-found.cc | 7 + .../222 source set realistic example/zlib.cc | 13 ++ .../boards/arm/aarch64.cc | 8 -- .../boards/arm/arm.cc | 10 -- .../boards/arm/arm.h | 12 -- .../boards/arm/arm32.cc | 8 -- .../boards/arm/versatilepb.cc | 16 --- .../boards/arm/virt.cc | 16 --- .../boards/arm/xlnx_zcu102.cc | 16 --- .../boards/meson.build | 7 - .../boards/x86/pc.cc | 26 ---- .../223 source set realistic example/common.h | 41 ------ .../config/aarch64 | 5 - .../223 source set realistic example/config/arm | 3 - .../223 source set realistic example/config/x86 | 4 - .../devices/meson.build | 3 - .../devices/virtio-mmio.cc | 16 --- .../devices/virtio-pci.cc | 16 --- .../devices/virtio.cc | 6 - .../devices/virtio.h | 10 -- .../223 source set realistic example/main.cc | 32 ----- .../223 source set realistic example/meson.build | 50 ------- .../223 source set realistic example/not-found.cc | 8 -- .../223 source set realistic example/was-found.cc | 7 - .../223 source set realistic example/zlib.cc | 13 -- test cases/common/28 find program/meson.build | 29 +++++ .../28 find program/print-version-with-prefix.py | 8 ++ test cases/common/28 find program/print-version.py | 8 ++ test cases/common/28 find program/source.in | 3 + test cases/common/29 find program/meson.build | 29 ----- .../29 find program/print-version-with-prefix.py | 8 -- test cases/common/29 find program/print-version.py | 8 -- test cases/common/29 find program/source.in | 3 - test cases/common/29 multiline string/meson.build | 35 +++++ test cases/common/30 multiline string/meson.build | 35 ----- test cases/common/30 try compile/invalid.c | 2 + test cases/common/30 try compile/meson.build | 27 ++++ test cases/common/30 try compile/valid.c | 2 + test cases/common/31 compiler id/meson.build | 7 + test cases/common/31 try compile/invalid.c | 2 - test cases/common/31 try compile/meson.build | 27 ---- test cases/common/31 try compile/valid.c | 2 - test cases/common/32 compiler id/meson.build | 7 - test cases/common/32 sizeof/config.h.in | 2 + test cases/common/32 sizeof/meson.build | 33 +++++ test cases/common/32 sizeof/prog.c.in | 15 +++ test cases/common/33 define10/config.h.in | 2 + test cases/common/33 define10/meson.build | 12 ++ test cases/common/33 define10/prog.c | 13 ++ test cases/common/33 sizeof/config.h.in | 2 - test cases/common/33 sizeof/meson.build | 33 ----- test cases/common/33 sizeof/prog.c.in | 15 --- test cases/common/34 define10/config.h.in | 2 - test cases/common/34 define10/meson.build | 12 -- test cases/common/34 define10/prog.c | 13 -- test cases/common/34 has header/meson.build | 54 ++++++++ test cases/common/34 has header/ouagadougou.h | 1 + test cases/common/35 has header/meson.build | 54 -------- test cases/common/35 has header/ouagadougou.h | 1 - test cases/common/35 run program/get-version.py | 3 + test cases/common/35 run program/meson.build | 79 ++++++++++++ test cases/common/35 run program/scripts/hello.bat | 2 + test cases/common/35 run program/scripts/hello.sh | 3 + test cases/common/36 run program/get-version.py | 3 - test cases/common/36 run program/meson.build | 79 ------------ test cases/common/36 run program/scripts/hello.bat | 2 - test cases/common/36 run program/scripts/hello.sh | 3 - test cases/common/36 tryrun/error.c | 3 + test cases/common/36 tryrun/meson.build | 78 +++++++++++ test cases/common/36 tryrun/no_compile.c | 1 + test cases/common/36 tryrun/ok.c | 6 + test cases/common/37 logic ops/meson.build | 95 ++++++++++++++ test cases/common/37 tryrun/error.c | 3 - test cases/common/37 tryrun/meson.build | 78 ----------- test cases/common/37 tryrun/no_compile.c | 1 - test cases/common/37 tryrun/ok.c | 6 - test cases/common/38 logic ops/meson.build | 95 -------------- test cases/common/38 string operations/meson.build | 103 +++++++++++++++ test cases/common/39 has function/meson.build | 91 +++++++++++++ test cases/common/39 string operations/meson.build | 103 --------------- test cases/common/40 has function/meson.build | 91 ------------- test cases/common/40 has member/meson.build | 21 +++ test cases/common/41 alignment/meson.build | 31 +++++ test cases/common/41 has member/meson.build | 21 --- test cases/common/42 alignment/meson.build | 31 ----- .../common/42 library chain/installed_files.txt | 2 + test cases/common/42 library chain/main.c | 5 + test cases/common/42 library chain/meson.build | 5 + test cases/common/42 library chain/subdir/lib1.c | 17 +++ .../common/42 library chain/subdir/meson.build | 4 + .../common/42 library chain/subdir/subdir2/lib2.c | 14 ++ .../42 library chain/subdir/subdir2/meson.build | 1 + .../common/42 library chain/subdir/subdir3/lib3.c | 14 ++ .../42 library chain/subdir/subdir3/meson.build | 1 + .../common/43 library chain/installed_files.txt | 2 - test cases/common/43 library chain/main.c | 5 - test cases/common/43 library chain/meson.build | 5 - test cases/common/43 library chain/subdir/lib1.c | 17 --- .../common/43 library chain/subdir/meson.build | 4 - .../common/43 library chain/subdir/subdir2/lib2.c | 14 -- .../43 library chain/subdir/subdir2/meson.build | 1 - .../common/43 library chain/subdir/subdir3/lib3.c | 14 -- .../43 library chain/subdir/subdir3/meson.build | 1 - test cases/common/43 options/meson.build | 33 +++++ test cases/common/43 options/meson_options.txt | 6 + test cases/common/44 options/meson.build | 33 ----- test cases/common/44 options/meson_options.txt | 6 - test cases/common/44 test args/cmd_args.c | 18 +++ test cases/common/44 test args/copyfile.py | 6 + test cases/common/44 test args/env2vars.c | 23 ++++ test cases/common/44 test args/envvars.c | 23 ++++ test cases/common/44 test args/meson.build | 35 +++++ test cases/common/44 test args/tester.c | 34 +++++ test cases/common/44 test args/tester.py | 7 + test cases/common/44 test args/testfile.txt | 1 + .../common/45 subproject/installed_files.txt | 3 + test cases/common/45 subproject/meson.build | 28 ++++ .../subprojects/sublib/include/subdefs.h | 21 +++ .../45 subproject/subprojects/sublib/meson.build | 19 +++ .../45 subproject/subprojects/sublib/simpletest.c | 5 + .../45 subproject/subprojects/sublib/sublib.c | 5 + test cases/common/45 subproject/user.c | 16 +++ test cases/common/45 test args/cmd_args.c | 18 --- test cases/common/45 test args/copyfile.py | 6 - test cases/common/45 test args/env2vars.c | 23 ---- test cases/common/45 test args/envvars.c | 23 ---- test cases/common/45 test args/meson.build | 35 ----- test cases/common/45 test args/tester.c | 34 ----- test cases/common/45 test args/tester.py | 7 - test cases/common/45 test args/testfile.txt | 1 - .../common/46 subproject options/meson.build | 7 + .../common/46 subproject options/meson_options.txt | 1 + .../subprojects/subproject/meson.build | 5 + .../subprojects/subproject/meson_options.txt | 1 + .../common/46 subproject/installed_files.txt | 3 - test cases/common/46 subproject/meson.build | 28 ---- .../subprojects/sublib/include/subdefs.h | 21 --- .../46 subproject/subprojects/sublib/meson.build | 19 --- .../46 subproject/subprojects/sublib/simpletest.c | 5 - .../46 subproject/subprojects/sublib/sublib.c | 5 - test cases/common/46 subproject/user.c | 16 --- .../common/47 pkgconfig-gen/dependencies/custom.c | 3 + .../common/47 pkgconfig-gen/dependencies/exposed.c | 3 + .../47 pkgconfig-gen/dependencies/internal.c | 3 + .../47 pkgconfig-gen/dependencies/meson.build | 51 ++++++++ .../common/47 pkgconfig-gen/installed_files.txt | 4 + test cases/common/47 pkgconfig-gen/meson.build | 54 ++++++++ test cases/common/47 pkgconfig-gen/simple.c | 5 + test cases/common/47 pkgconfig-gen/simple.h | 6 + .../common/47 subproject options/meson.build | 7 - .../common/47 subproject options/meson_options.txt | 1 - .../subprojects/subproject/meson.build | 5 - .../subprojects/subproject/meson_options.txt | 1 - .../common/48 custom install dirs/datafile.cat | 1 + .../48 custom install dirs/installed_files.txt | 12 ++ .../common/48 custom install dirs/meson.build | 11 ++ test cases/common/48 custom install dirs/prog.1 | 1 + test cases/common/48 custom install dirs/prog.c | 3 + test cases/common/48 custom install dirs/sample.h | 6 + .../48 custom install dirs/subdir/datafile.dog | 1 + .../common/48 pkgconfig-gen/dependencies/custom.c | 3 - .../common/48 pkgconfig-gen/dependencies/exposed.c | 3 - .../48 pkgconfig-gen/dependencies/internal.c | 3 - .../48 pkgconfig-gen/dependencies/meson.build | 51 -------- .../common/48 pkgconfig-gen/installed_files.txt | 4 - test cases/common/48 pkgconfig-gen/meson.build | 54 -------- test cases/common/48 pkgconfig-gen/simple.c | 5 - test cases/common/48 pkgconfig-gen/simple.h | 6 - .../common/49 custom install dirs/datafile.cat | 1 - .../49 custom install dirs/installed_files.txt | 12 -- .../common/49 custom install dirs/meson.build | 11 -- test cases/common/49 custom install dirs/prog.1 | 1 - test cases/common/49 custom install dirs/prog.c | 3 - test cases/common/49 custom install dirs/sample.h | 6 - .../49 custom install dirs/subdir/datafile.dog | 1 - .../common/49 subproject subproject/meson.build | 11 ++ test cases/common/49 subproject subproject/prog.c | 5 + .../49 subproject subproject/subprojects/a/a.c | 15 +++ .../subprojects/a/meson.build | 4 + .../49 subproject subproject/subprojects/b/b.c | 14 ++ .../subprojects/b/meson.build | 3 + .../subprojects/c/meson.build | 3 + test cases/common/50 same file name/d1/file.c | 1 + test cases/common/50 same file name/d2/file.c | 1 + test cases/common/50 same file name/meson.build | 3 + test cases/common/50 same file name/prog.c | 6 + .../common/50 subproject subproject/meson.build | 11 -- test cases/common/50 subproject subproject/prog.c | 5 - .../50 subproject subproject/subprojects/a/a.c | 15 --- .../subprojects/a/meson.build | 4 - .../50 subproject subproject/subprojects/b/b.c | 14 -- .../subprojects/b/meson.build | 3 - .../subprojects/c/meson.build | 3 - test cases/common/51 file grabber/a.c | 1 + test cases/common/51 file grabber/b.c | 1 + test cases/common/51 file grabber/c.c | 1 + test cases/common/51 file grabber/grabber.bat | 5 + test cases/common/51 file grabber/grabber.sh | 5 + test cases/common/51 file grabber/grabber2.bat | 5 + test cases/common/51 file grabber/meson.build | 35 +++++ test cases/common/51 file grabber/prog.c | 7 + .../common/51 file grabber/subdir/meson.build | 5 + test cases/common/51 file grabber/subdir/suba.c | 1 + test cases/common/51 file grabber/subdir/subb.c | 1 + test cases/common/51 file grabber/subdir/subc.c | 1 + test cases/common/51 file grabber/subdir/subprog.c | 7 + test cases/common/51 same file name/d1/file.c | 1 - test cases/common/51 same file name/d2/file.c | 1 - test cases/common/51 same file name/meson.build | 3 - test cases/common/51 same file name/prog.c | 6 - test cases/common/52 custom target/data_source.txt | 1 + test cases/common/52 custom target/depfile/dep.py | 15 +++ .../common/52 custom target/depfile/meson.build | 7 + .../common/52 custom target/installed_files.txt | 1 + test cases/common/52 custom target/meson.build | 22 ++++ test cases/common/52 custom target/my_compiler.py | 21 +++ test cases/common/52 file grabber/a.c | 1 - test cases/common/52 file grabber/b.c | 1 - test cases/common/52 file grabber/c.c | 1 - test cases/common/52 file grabber/grabber.bat | 5 - test cases/common/52 file grabber/grabber.sh | 5 - test cases/common/52 file grabber/grabber2.bat | 5 - test cases/common/52 file grabber/meson.build | 35 ----- test cases/common/52 file grabber/prog.c | 7 - .../common/52 file grabber/subdir/meson.build | 5 - test cases/common/52 file grabber/subdir/suba.c | 1 - test cases/common/52 file grabber/subdir/subb.c | 1 - test cases/common/52 file grabber/subdir/subc.c | 1 - test cases/common/52 file grabber/subdir/subprog.c | 7 - .../common/53 custom target chain/data_source.txt | 1 + .../53 custom target chain/installed_files.txt | 2 + .../common/53 custom target chain/meson.build | 34 +++++ .../common/53 custom target chain/my_compiler.py | 15 +++ .../common/53 custom target chain/my_compiler2.py | 15 +++ .../53 custom target chain/usetarget/meson.build | 8 ++ .../53 custom target chain/usetarget/myexe.c | 6 + .../53 custom target chain/usetarget/subcomp.py | 7 + test cases/common/53 custom target/data_source.txt | 1 - test cases/common/53 custom target/depfile/dep.py | 15 --- .../common/53 custom target/depfile/meson.build | 7 - .../common/53 custom target/installed_files.txt | 1 - test cases/common/53 custom target/meson.build | 22 ---- test cases/common/53 custom target/my_compiler.py | 21 --- .../common/54 custom target chain/data_source.txt | 1 - .../54 custom target chain/installed_files.txt | 2 - .../common/54 custom target chain/meson.build | 34 ----- .../common/54 custom target chain/my_compiler.py | 15 --- .../common/54 custom target chain/my_compiler2.py | 15 --- .../54 custom target chain/usetarget/meson.build | 8 -- .../54 custom target chain/usetarget/myexe.c | 6 - .../54 custom target chain/usetarget/subcomp.py | 7 - test cases/common/54 run target/check_exists.py | 7 + test cases/common/54 run target/configure.in | 3 + test cases/common/54 run target/converter.py | 6 + test cases/common/54 run target/fakeburner.py | 16 +++ test cases/common/54 run target/helloprinter.c | 11 ++ test cases/common/54 run target/meson.build | 59 +++++++++ test cases/common/54 run target/scripts/script.sh | 5 + test cases/common/55 object generator/meson.build | 34 +++++ .../common/55 object generator/obj_generator.py | 18 +++ test cases/common/55 object generator/prog.c | 7 + test cases/common/55 object generator/source.c | 3 + test cases/common/55 object generator/source2.c | 3 + test cases/common/55 object generator/source3.c | 3 + test cases/common/55 run target/check_exists.py | 7 - test cases/common/55 run target/configure.in | 3 - test cases/common/55 run target/converter.py | 6 - test cases/common/55 run target/fakeburner.py | 16 --- test cases/common/55 run target/helloprinter.c | 11 -- test cases/common/55 run target/meson.build | 59 --------- test cases/common/55 run target/scripts/script.sh | 5 - .../common/56 install script/installed_files.txt | 5 + test cases/common/56 install script/meson.build | 7 + test cases/common/56 install script/myinstall.py | 12 ++ .../common/56 install script/no-installed-files | 0 test cases/common/56 install script/prog.c | 6 + .../common/56 install script/src/meson.build | 1 + .../common/56 install script/src/myinstall.py | 12 ++ test cases/common/56 object generator/meson.build | 34 ----- .../common/56 object generator/obj_generator.py | 18 --- test cases/common/56 object generator/prog.c | 7 - test cases/common/56 object generator/source.c | 3 - test cases/common/56 object generator/source2.c | 3 - test cases/common/56 object generator/source3.c | 3 - .../57 custom target source output/generator.py | 16 +++ .../common/57 custom target source output/main.c | 5 + .../57 custom target source output/meson.build | 9 ++ .../common/57 install script/installed_files.txt | 5 - test cases/common/57 install script/meson.build | 7 - test cases/common/57 install script/myinstall.py | 12 -- .../common/57 install script/no-installed-files | 0 test cases/common/57 install script/prog.c | 6 - .../common/57 install script/src/meson.build | 1 - .../common/57 install script/src/myinstall.py | 12 -- .../58 custom target source output/generator.py | 16 --- .../common/58 custom target source output/main.c | 5 - .../58 custom target source output/meson.build | 9 -- test cases/common/58 exe static shared/meson.build | 15 +++ test cases/common/58 exe static shared/prog.c | 10 ++ test cases/common/58 exe static shared/shlib2.c | 8 ++ test cases/common/58 exe static shared/stat.c | 7 + test cases/common/58 exe static shared/stat2.c | 3 + .../common/58 exe static shared/subdir/exports.h | 12 ++ .../common/58 exe static shared/subdir/meson.build | 1 + .../common/58 exe static shared/subdir/shlib.c | 5 + test cases/common/59 array methods/meson.build | 46 +++++++ test cases/common/59 exe static shared/meson.build | 15 --- test cases/common/59 exe static shared/prog.c | 10 -- test cases/common/59 exe static shared/shlib2.c | 8 -- test cases/common/59 exe static shared/stat.c | 7 - test cases/common/59 exe static shared/stat2.c | 3 - .../common/59 exe static shared/subdir/exports.h | 12 -- .../common/59 exe static shared/subdir/meson.build | 1 - .../common/59 exe static shared/subdir/shlib.c | 5 - test cases/common/60 array methods/meson.build | 46 ------- .../common/60 custom header generator/input.def | 1 + .../60 custom header generator/makeheader.py | 12 ++ .../common/60 custom header generator/meson.build | 21 +++ .../common/60 custom header generator/prog.c | 5 + .../common/60 custom header generator/somefile.txt | 0 .../common/61 custom header generator/input.def | 1 - .../61 custom header generator/makeheader.py | 12 -- .../common/61 custom header generator/meson.build | 21 --- .../common/61 custom header generator/prog.c | 5 - .../common/61 custom header generator/somefile.txt | 0 test cases/common/61 multiple generators/data2.dat | 1 + test cases/common/61 multiple generators/main.cpp | 6 + .../common/61 multiple generators/meson.build | 13 ++ test cases/common/61 multiple generators/mygen.py | 22 ++++ .../common/61 multiple generators/subdir/data.dat | 1 + .../61 multiple generators/subdir/meson.build | 4 + .../common/62 install subdir/installed_files.txt | 12 ++ test cases/common/62 install subdir/meson.build | 18 +++ .../nested_elided/sub/dircheck/nineth.dat | 1 + .../62 install subdir/nested_elided/sub/eighth.dat | 1 + .../common/62 install subdir/sub/sub1/third.dat | 1 + .../common/62 install subdir/sub1/second.dat | 1 + .../sub2/dircheck/excluded-three.dat | 0 .../62 install subdir/sub2/excluded-three.dat | 0 .../common/62 install subdir/sub2/excluded/two.dat | 0 test cases/common/62 install subdir/sub2/one.dat | 0 .../sub_elided/dircheck/fifth.dat | 1 + .../common/62 install subdir/sub_elided/fourth.dat | 1 + .../common/62 install subdir/subdir/meson.build | 5 + .../common/62 install subdir/subdir/sub1/data1.dat | 1 + .../62 install subdir/subdir/sub1/sub2/data2.dat | 1 + .../subdir/sub_elided/dircheck/seventh.dat | 1 + .../62 install subdir/subdir/sub_elided/sixth.dat | 1 + test cases/common/62 multiple generators/data2.dat | 1 - test cases/common/62 multiple generators/main.cpp | 6 - .../common/62 multiple generators/meson.build | 13 -- test cases/common/62 multiple generators/mygen.py | 22 ---- .../common/62 multiple generators/subdir/data.dat | 1 - .../62 multiple generators/subdir/meson.build | 4 - test cases/common/63 foreach/installed_files.txt | 6 + test cases/common/63 foreach/meson.build | 33 +++++ test cases/common/63 foreach/prog1.c | 6 + test cases/common/63 foreach/prog2.c | 6 + test cases/common/63 foreach/prog3.c | 6 + .../common/63 install subdir/installed_files.txt | 12 -- test cases/common/63 install subdir/meson.build | 18 --- .../nested_elided/sub/dircheck/nineth.dat | 1 - .../63 install subdir/nested_elided/sub/eighth.dat | 1 - .../common/63 install subdir/sub/sub1/third.dat | 1 - .../common/63 install subdir/sub1/second.dat | 1 - .../sub2/dircheck/excluded-three.dat | 0 .../63 install subdir/sub2/excluded-three.dat | 0 .../common/63 install subdir/sub2/excluded/two.dat | 0 test cases/common/63 install subdir/sub2/one.dat | 0 .../sub_elided/dircheck/fifth.dat | 1 - .../common/63 install subdir/sub_elided/fourth.dat | 1 - .../common/63 install subdir/subdir/meson.build | 5 - .../common/63 install subdir/subdir/sub1/data1.dat | 1 - .../63 install subdir/subdir/sub1/sub2/data2.dat | 1 - .../subdir/sub_elided/dircheck/seventh.dat | 1 - .../63 install subdir/subdir/sub_elided/sixth.dat | 1 - test cases/common/64 foreach/installed_files.txt | 6 - test cases/common/64 foreach/meson.build | 33 ----- test cases/common/64 foreach/prog1.c | 6 - test cases/common/64 foreach/prog2.c | 6 - test cases/common/64 foreach/prog3.c | 6 - test cases/common/64 number arithmetic/meson.build | 76 +++++++++++ test cases/common/65 number arithmetic/meson.build | 76 ----------- test cases/common/65 string arithmetic/meson.build | 16 +++ test cases/common/66 array arithmetic/meson.build | 15 +++ test cases/common/66 string arithmetic/meson.build | 16 --- test cases/common/67 arithmetic bidmas/meson.build | 15 +++ test cases/common/67 array arithmetic/meson.build | 15 --- test cases/common/68 arithmetic bidmas/meson.build | 15 --- test cases/common/68 build always/main.c | 7 + test cases/common/68 build always/meson.build | 14 ++ test cases/common/68 build always/version.c.in | 3 + test cases/common/68 build always/version.h | 3 + test cases/common/68 build always/version_gen.py | 29 +++++ test cases/common/69 build always/main.c | 7 - test cases/common/69 build always/meson.build | 14 -- test cases/common/69 build always/version.c.in | 3 - test cases/common/69 build always/version.h | 3 - test cases/common/69 build always/version_gen.py | 29 ----- test cases/common/69 vcstag/meson.build | 18 +++ test cases/common/69 vcstag/tagprog.c | 9 ++ test cases/common/69 vcstag/vcstag.c.in | 2 + test cases/common/70 modules/meson.build | 4 + test cases/common/70 vcstag/meson.build | 18 --- test cases/common/70 vcstag/tagprog.c | 9 -- test cases/common/70 vcstag/vcstag.c.in | 2 - test cases/common/71 modules/meson.build | 4 - test cases/common/71 should fail/failing.c | 3 + test cases/common/71 should fail/meson.build | 4 + .../inc/confdata.in | 1 + .../inc/meson.build | 6 + .../72 configure file in custom target/meson.build | 4 + .../src/meson.build | 20 +++ .../src/mycompiler.py | 9 ++ test cases/common/72 should fail/failing.c | 3 - test cases/common/72 should fail/meson.build | 4 - .../inc/confdata.in | 1 - .../inc/meson.build | 6 - .../73 configure file in custom target/meson.build | 4 - .../src/meson.build | 20 --- .../src/mycompiler.py | 9 -- .../common/73 external test program/meson.build | 3 + .../common/73 external test program/mytest.py | 11 ++ test cases/common/74 ctarget dependency/gen1.py | 12 ++ test cases/common/74 ctarget dependency/gen2.py | 10 ++ test cases/common/74 ctarget dependency/input.dat | 1 + .../common/74 ctarget dependency/meson.build | 20 +++ .../common/74 external test program/meson.build | 3 - .../common/74 external test program/mytest.py | 11 -- test cases/common/75 ctarget dependency/gen1.py | 12 -- test cases/common/75 ctarget dependency/gen2.py | 10 -- test cases/common/75 ctarget dependency/input.dat | 1 - .../common/75 ctarget dependency/meson.build | 20 --- test cases/common/75 shared subproject/a.c | 13 ++ test cases/common/75 shared subproject/meson.build | 10 ++ .../common/75 shared subproject/subprojects/B/b.c | 21 +++ .../75 shared subproject/subprojects/B/meson.build | 4 + .../common/75 shared subproject/subprojects/C/c.c | 14 ++ .../75 shared subproject/subprojects/C/meson.build | 2 + test cases/common/76 shared subproject 2/a.c | 13 ++ .../common/76 shared subproject 2/meson.build | 13 ++ .../76 shared subproject 2/subprojects/B/b.c | 20 +++ .../subprojects/B/meson.build | 4 + .../76 shared subproject 2/subprojects/C/c.c | 14 ++ .../subprojects/C/meson.build | 2 + test cases/common/76 shared subproject/a.c | 13 -- test cases/common/76 shared subproject/meson.build | 10 -- .../common/76 shared subproject/subprojects/B/b.c | 21 --- .../76 shared subproject/subprojects/B/meson.build | 4 - .../common/76 shared subproject/subprojects/C/c.c | 14 -- .../76 shared subproject/subprojects/C/meson.build | 2 - test cases/common/77 file object/lib.c | 3 + test cases/common/77 file object/meson.build | 9 ++ test cases/common/77 file object/prog.c | 13 ++ test cases/common/77 file object/subdir1/lib.c | 3 + .../common/77 file object/subdir1/meson.build | 7 + test cases/common/77 file object/subdir1/prog.c | 13 ++ test cases/common/77 file object/subdir2/lib.c | 3 + .../common/77 file object/subdir2/meson.build | 7 + test cases/common/77 file object/subdir2/prog.c | 13 ++ test cases/common/77 shared subproject 2/a.c | 13 -- .../common/77 shared subproject 2/meson.build | 13 -- .../77 shared subproject 2/subprojects/B/b.c | 20 --- .../subprojects/B/meson.build | 4 - .../77 shared subproject 2/subprojects/C/c.c | 14 -- .../subprojects/C/meson.build | 2 - test cases/common/78 custom subproject dir/a.c | 13 ++ .../custom_subproject_dir/B/b.c | 20 +++ .../custom_subproject_dir/B/meson.build | 4 + .../custom_subproject_dir/C/c.c | 14 ++ .../custom_subproject_dir/C/meson.build | 2 + .../common/78 custom subproject dir/meson.build | 10 ++ test cases/common/78 file object/lib.c | 3 - test cases/common/78 file object/meson.build | 9 -- test cases/common/78 file object/prog.c | 13 -- test cases/common/78 file object/subdir1/lib.c | 3 - .../common/78 file object/subdir1/meson.build | 7 - test cases/common/78 file object/subdir1/prog.c | 13 -- test cases/common/78 file object/subdir2/lib.c | 3 - .../common/78 file object/subdir2/meson.build | 7 - test cases/common/78 file object/subdir2/prog.c | 13 -- test cases/common/79 custom subproject dir/a.c | 13 -- .../custom_subproject_dir/B/b.c | 20 --- .../custom_subproject_dir/B/meson.build | 4 - .../custom_subproject_dir/C/c.c | 14 -- .../custom_subproject_dir/C/meson.build | 2 - .../common/79 custom subproject dir/meson.build | 10 -- test cases/common/79 has type/meson.build | 13 ++ .../80 extract from nested subdir/meson.build | 8 ++ .../src/first/lib_first.c | 3 + .../src/first/meson.build | 1 + .../80 extract from nested subdir/src/meson.build | 1 + .../tst/first/exe_first.c | 5 + .../tst/first/meson.build | 4 + .../80 extract from nested subdir/tst/meson.build | 1 + test cases/common/80 has type/meson.build | 13 -- .../81 extract from nested subdir/meson.build | 8 -- .../src/first/lib_first.c | 3 - .../src/first/meson.build | 1 - .../81 extract from nested subdir/src/meson.build | 1 - .../tst/first/exe_first.c | 5 - .../tst/first/meson.build | 4 - .../81 extract from nested subdir/tst/meson.build | 1 - .../common/81 internal dependency/meson.build | 4 + .../81 internal dependency/proj1/include/proj1.h | 5 + .../81 internal dependency/proj1/meson.build | 11 ++ .../common/81 internal dependency/proj1/proj1f1.c | 6 + .../common/81 internal dependency/proj1/proj1f2.c | 6 + .../common/81 internal dependency/proj1/proj1f3.c | 6 + .../common/81 internal dependency/src/main.c | 10 ++ .../common/81 internal dependency/src/meson.build | 2 + .../common/82 internal dependency/meson.build | 4 - .../82 internal dependency/proj1/include/proj1.h | 5 - .../82 internal dependency/proj1/meson.build | 11 -- .../common/82 internal dependency/proj1/proj1f1.c | 6 - .../common/82 internal dependency/proj1/proj1f2.c | 6 - .../common/82 internal dependency/proj1/proj1f3.c | 6 - .../common/82 internal dependency/src/main.c | 10 -- .../common/82 internal dependency/src/meson.build | 2 - test cases/common/82 same basename/exe1.c | 5 + test cases/common/82 same basename/exe2.c | 5 + test cases/common/82 same basename/lib.c | 23 ++++ test cases/common/82 same basename/meson.build | 14 ++ .../common/82 same basename/sharedsub/meson.build | 1 + .../common/82 same basename/staticsub/meson.build | 3 + test cases/common/83 declare dep/entity/entity.h | 4 + test cases/common/83 declare dep/entity/entity1.c | 9 ++ test cases/common/83 declare dep/entity/entity2.c | 5 + .../common/83 declare dep/entity/meson.build | 10 ++ test cases/common/83 declare dep/main.c | 18 +++ test cases/common/83 declare dep/meson.build | 24 ++++ test cases/common/83 same basename/exe1.c | 5 - test cases/common/83 same basename/exe2.c | 5 - test cases/common/83 same basename/lib.c | 23 ---- test cases/common/83 same basename/meson.build | 14 -- .../common/83 same basename/sharedsub/meson.build | 1 - .../common/83 same basename/staticsub/meson.build | 3 - test cases/common/84 declare dep/entity/entity.h | 4 - test cases/common/84 declare dep/entity/entity1.c | 9 -- test cases/common/84 declare dep/entity/entity2.c | 5 - .../common/84 declare dep/entity/meson.build | 10 -- test cases/common/84 declare dep/main.c | 18 --- test cases/common/84 declare dep/meson.build | 24 ---- test cases/common/84 extract all/extractor.h | 6 + test cases/common/84 extract all/four.c | 5 + test cases/common/84 extract all/meson.build | 13 ++ test cases/common/84 extract all/one.c | 5 + test cases/common/84 extract all/prog.c | 10 ++ test cases/common/84 extract all/three.c | 5 + test cases/common/84 extract all/two.c | 5 + test cases/common/85 add language/meson.build | 8 ++ test cases/common/85 add language/prog.c | 6 + test cases/common/85 add language/prog.cc | 6 + test cases/common/85 extract all/extractor.h | 6 - test cases/common/85 extract all/four.c | 5 - test cases/common/85 extract all/meson.build | 13 -- test cases/common/85 extract all/one.c | 5 - test cases/common/85 extract all/prog.c | 10 -- test cases/common/85 extract all/three.c | 5 - test cases/common/85 extract all/two.c | 5 - test cases/common/86 add language/meson.build | 8 -- test cases/common/86 add language/prog.c | 6 - test cases/common/86 add language/prog.cc | 6 - .../86 identical target name in subproject/bar.c | 6 + .../meson.build | 7 + .../subprojects/foo/bar.c | 6 + .../subprojects/foo/meson.build | 5 + .../87 identical target name in subproject/bar.c | 6 - .../meson.build | 7 - .../subprojects/foo/bar.c | 6 - .../subprojects/foo/meson.build | 5 - test cases/common/87 plusassign/meson.build | 70 ++++++++++ test cases/common/88 plusassign/meson.build | 70 ---------- test cases/common/88 skip subdir/meson.build | 3 + .../common/88 skip subdir/subdir1/meson.build | 1 + .../88 skip subdir/subdir1/subdir2/meson.build | 1 + test cases/common/89 private include/meson.build | 4 + .../common/89 private include/stlib/compiler.py | 32 +++++ .../common/89 private include/stlib/foo1.def | 0 .../common/89 private include/stlib/foo2.def | 0 .../common/89 private include/stlib/meson.build | 12 ++ .../common/89 private include/user/libuser.c | 6 + .../common/89 private include/user/meson.build | 5 + test cases/common/89 skip subdir/meson.build | 3 - .../common/89 skip subdir/subdir1/meson.build | 1 - .../89 skip subdir/subdir1/subdir2/meson.build | 1 - test cases/common/90 default options/meson.build | 30 +++++ test cases/common/90 private include/meson.build | 4 - .../common/90 private include/stlib/compiler.py | 32 ----- .../common/90 private include/stlib/foo1.def | 0 .../common/90 private include/stlib/foo2.def | 0 .../common/90 private include/stlib/meson.build | 12 -- .../common/90 private include/user/libuser.c | 6 - .../common/90 private include/user/meson.build | 5 - test cases/common/91 default options/meson.build | 30 ----- test cases/common/91 dep fallback/gensrc.py | 6 + test cases/common/91 dep fallback/meson.build | 25 ++++ .../91 dep fallback/subprojects/boblib/bob.c | 8 ++ .../91 dep fallback/subprojects/boblib/bob.h | 6 + .../91 dep fallback/subprojects/boblib/genbob.py | 6 + .../91 dep fallback/subprojects/boblib/meson.build | 16 +++ .../subprojects/dummylib/meson.build | 4 + test cases/common/91 dep fallback/tester.c | 14 ++ test cases/common/92 default library/ef.cpp | 8 ++ test cases/common/92 default library/ef.h | 22 ++++ test cases/common/92 default library/eftest.cpp | 14 ++ test cases/common/92 default library/meson.build | 10 ++ test cases/common/92 dep fallback/gensrc.py | 6 - test cases/common/92 dep fallback/meson.build | 25 ---- .../92 dep fallback/subprojects/boblib/bob.c | 8 -- .../92 dep fallback/subprojects/boblib/bob.h | 6 - .../92 dep fallback/subprojects/boblib/genbob.py | 6 - .../92 dep fallback/subprojects/boblib/meson.build | 16 --- .../subprojects/dummylib/meson.build | 4 - test cases/common/92 dep fallback/tester.c | 14 -- test cases/common/93 default library/ef.cpp | 8 -- test cases/common/93 default library/ef.h | 22 ---- test cases/common/93 default library/eftest.cpp | 14 -- test cases/common/93 default library/meson.build | 10 -- test cases/common/93 selfbuilt custom/data.dat | 1 + test cases/common/93 selfbuilt custom/mainprog.cpp | 5 + test cases/common/93 selfbuilt custom/meson.build | 16 +++ test cases/common/93 selfbuilt custom/tool.cpp | 34 +++++ test cases/common/94 gen extra/meson.build | 40 ++++++ test cases/common/94 gen extra/name.dat | 1 + test cases/common/94 gen extra/name.l | 3 + test cases/common/94 gen extra/plain.c | 5 + test cases/common/94 gen extra/srcgen.py | 27 ++++ test cases/common/94 gen extra/srcgen2.py | 32 +++++ test cases/common/94 gen extra/srcgen3.py | 15 +++ test cases/common/94 gen extra/upper.c | 5 + test cases/common/94 selfbuilt custom/data.dat | 1 - test cases/common/94 selfbuilt custom/mainprog.cpp | 5 - test cases/common/94 selfbuilt custom/meson.build | 16 --- test cases/common/94 selfbuilt custom/tool.cpp | 34 ----- test cases/common/95 benchmark/delayer.c | 20 +++ test cases/common/95 benchmark/meson.build | 4 + test cases/common/95 gen extra/meson.build | 40 ------ test cases/common/95 gen extra/name.dat | 1 - test cases/common/95 gen extra/name.l | 3 - test cases/common/95 gen extra/plain.c | 5 - test cases/common/95 gen extra/srcgen.py | 27 ---- test cases/common/95 gen extra/srcgen2.py | 32 ----- test cases/common/95 gen extra/srcgen3.py | 15 --- test cases/common/95 gen extra/upper.c | 5 - test cases/common/96 benchmark/delayer.c | 20 --- test cases/common/96 benchmark/meson.build | 4 - test cases/common/96 test workdir/meson.build | 8 ++ test cases/common/96 test workdir/opener.c | 12 ++ .../common/96 test workdir/subdir/checker.py | 5 + .../common/96 test workdir/subdir/meson.build | 4 + test cases/common/97 suites/exe1.c | 6 + test cases/common/97 suites/exe2.c | 6 + test cases/common/97 suites/meson.build | 9 ++ .../common/97 suites/subprojects/sub/meson.build | 7 + test cases/common/97 suites/subprojects/sub/sub1.c | 6 + test cases/common/97 suites/subprojects/sub/sub2.c | 6 + test cases/common/97 test workdir/meson.build | 8 -- test cases/common/97 test workdir/opener.c | 12 -- .../common/97 test workdir/subdir/checker.py | 5 - .../common/97 test workdir/subdir/meson.build | 4 - test cases/common/98 suites/exe1.c | 6 - test cases/common/98 suites/exe2.c | 6 - test cases/common/98 suites/meson.build | 9 -- .../common/98 suites/subprojects/sub/meson.build | 7 - test cases/common/98 suites/subprojects/sub/sub1.c | 6 - test cases/common/98 suites/subprojects/sub/sub2.c | 6 - test cases/common/98 threads/meson.build | 16 +++ test cases/common/98 threads/threadprog.c | 40 ++++++ test cases/common/98 threads/threadprog.cpp | 43 +++++++ test cases/common/99 manygen/depuser.c | 8 ++ test cases/common/99 manygen/meson.build | 14 ++ test cases/common/99 manygen/subdir/funcinfo.def | 1 + test cases/common/99 manygen/subdir/manygen.py | 83 ++++++++++++ test cases/common/99 manygen/subdir/meson.build | 26 ++++ test cases/common/99 threads/meson.build | 16 --- test cases/common/99 threads/threadprog.c | 40 ------ test cases/common/99 threads/threadprog.cpp | 43 ------- .../failing/89 subproj not-found dep/meson.build | 2 + .../subprojects/somesubproj/meson.build | 3 + test cases/failing/90 invalid configure file/input | 0 .../failing/90 invalid configure file/meson.build | 9 ++ .../failing/90 subproj not-found dep/meson.build | 2 - .../subprojects/somesubproj/meson.build | 3 - test cases/failing/91 invalid configure file/input | 0 .../failing/91 invalid configure file/meson.build | 9 -- test cases/failing/91 kwarg dupe/meson.build | 6 + test cases/failing/91 kwarg dupe/prog.c | 6 + test cases/failing/92 kwarg dupe/meson.build | 6 - test cases/failing/92 kwarg dupe/prog.c | 6 - test cases/failing/92 missing pch file/meson.build | 3 + test cases/failing/92 missing pch file/prog.c | 3 + test cases/failing/93 missing pch file/meson.build | 3 - test cases/failing/93 missing pch file/prog.c | 3 - .../93 pch source different folder/include/pch.h | 0 .../93 pch source different folder/meson.build | 5 + .../failing/93 pch source different folder/prog.c | 1 + .../93 pch source different folder/src/pch.c | 0 .../94 pch source different folder/include/pch.h | 0 .../94 pch source different folder/meson.build | 5 - .../failing/94 pch source different folder/prog.c | 1 - .../94 pch source different folder/src/pch.c | 0 test cases/failing/94 vala without c/meson.build | 2 + .../failing/95 unknown config tool/meson.build | 2 + test cases/failing/95 vala without c/meson.build | 2 - .../96 custom target install data/Info.plist.cpp | 1 + .../96 custom target install data/meson.build | 11 ++ .../96 custom target install data/preproc.py | 13 ++ .../failing/96 unknown config tool/meson.build | 2 - .../97 custom target install data/Info.plist.cpp | 1 - .../97 custom target install data/meson.build | 11 -- .../97 custom target install data/preproc.py | 13 -- test cases/unit/50 std remains/meson.build | 2 - test cases/unit/50 std remains/prog.c | 1 - test cases/unit/51 ldflagdedup/bob.c | 5 - test cases/unit/51 ldflagdedup/meson.build | 12 -- test cases/unit/51 ldflagdedup/prog.c | 7 - test cases/unit/51 std remains/meson.build | 2 + test cases/unit/51 std remains/prog.c | 1 + test cases/unit/52 ldflagdedup/bob.c | 5 + test cases/unit/52 ldflagdedup/meson.build | 12 ++ test cases/unit/52 ldflagdedup/prog.c | 7 + .../52 pkgconfig static link order/meson.build | 11 -- test cases/unit/53 clang-format/.clang-format | 5 - test cases/unit/53 clang-format/header_expected_h | 3 - test cases/unit/53 clang-format/header_orig_h | 9 -- test cases/unit/53 clang-format/meson.build | 4 - test cases/unit/53 clang-format/prog_expected_c | 6 - test cases/unit/53 clang-format/prog_orig_c | 21 --- .../53 pkgconfig static link order/meson.build | 11 ++ test cases/unit/54 clang-format/.clang-format | 5 + test cases/unit/54 clang-format/header_expected_h | 3 + test cases/unit/54 clang-format/header_orig_h | 9 ++ test cases/unit/54 clang-format/meson.build | 4 + test cases/unit/54 clang-format/prog_expected_c | 6 + test cases/unit/54 clang-format/prog_orig_c | 21 +++ .../subprojects/projectBad/meson.build | 9 -- .../subprojects/projectBad/meson_options.txt | 1 - test cases/unit/55 dedup compiler libs/app/app.c | 13 -- .../unit/55 dedup compiler libs/app/meson.build | 2 - test cases/unit/55 dedup compiler libs/liba/liba.c | 18 --- test cases/unit/55 dedup compiler libs/liba/liba.h | 8 -- .../unit/55 dedup compiler libs/liba/meson.build | 8 -- test cases/unit/55 dedup compiler libs/libb/libb.c | 7 - test cases/unit/55 dedup compiler libs/libb/libb.h | 6 - .../unit/55 dedup compiler libs/libb/meson.build | 6 - test cases/unit/55 dedup compiler libs/meson.build | 7 - .../subprojects/projectBad/meson.build | 9 ++ .../subprojects/projectBad/meson_options.txt | 1 + test cases/unit/55 introspection/meson.build | 46 ------- test cases/unit/55 introspection/meson_options.txt | 2 - .../unit/55 introspection/sharedlib/meson.build | 2 - .../unit/55 introspection/sharedlib/shared.cpp | 9 -- .../unit/55 introspection/sharedlib/shared.hpp | 10 -- .../unit/55 introspection/staticlib/meson.build | 2 - .../unit/55 introspection/staticlib/static.c | 5 - .../unit/55 introspection/staticlib/static.h | 3 - test cases/unit/55 introspection/t1.cpp | 13 -- test cases/unit/55 introspection/t2.cpp | 8 -- test cases/unit/55 introspection/t3.cpp | 16 --- .../build_extra_path/totally_made_up_dep.pc | 7 - .../host_extra_path/totally_made_up_dep.pc | 7 - .../unit/55 pkg_config_path option/meson.build | 7 - test cases/unit/56 dedup compiler libs/app/app.c | 13 ++ .../unit/56 dedup compiler libs/app/meson.build | 2 + test cases/unit/56 dedup compiler libs/liba/liba.c | 18 +++ test cases/unit/56 dedup compiler libs/liba/liba.h | 8 ++ .../unit/56 dedup compiler libs/liba/meson.build | 8 ++ test cases/unit/56 dedup compiler libs/libb/libb.c | 7 + test cases/unit/56 dedup compiler libs/libb/libb.h | 6 + .../unit/56 dedup compiler libs/libb/meson.build | 6 + test cases/unit/56 dedup compiler libs/meson.build | 7 + .../unit/56 introspect buildoptions/c_compiler.py | 3 - test cases/unit/56 introspect buildoptions/main.c | 6 - .../unit/56 introspect buildoptions/meson.build | 16 --- .../56 introspect buildoptions/meson_options.txt | 2 - .../subprojects/evilFile.txt | 0 .../subprojects/projectA/meson.build | 3 - .../subprojects/projectA/meson_options.txt | 1 - .../subprojects/projectBad/meson.build | 9 -- .../subprojects/projectBad/meson_options.txt | 1 - test cases/unit/57 introspection/meson.build | 46 +++++++ test cases/unit/57 introspection/meson_options.txt | 2 + .../unit/57 introspection/sharedlib/meson.build | 2 + .../unit/57 introspection/sharedlib/shared.cpp | 9 ++ .../unit/57 introspection/sharedlib/shared.hpp | 10 ++ .../unit/57 introspection/staticlib/meson.build | 2 + .../unit/57 introspection/staticlib/static.c | 5 + .../unit/57 introspection/staticlib/static.h | 3 + test cases/unit/57 introspection/t1.cpp | 13 ++ test cases/unit/57 introspection/t2.cpp | 8 ++ test cases/unit/57 introspection/t3.cpp | 16 +++ test cases/unit/57 native file override/crossfile | 16 --- test cases/unit/57 native file override/crossfile2 | 4 - .../unit/57 native file override/meson.build | 10 -- .../unit/57 native file override/meson_options.txt | 13 -- test cases/unit/57 native file override/nativefile | 16 --- test cases/unit/58 identity cross/build_wrapper.py | 5 - test cases/unit/58 identity cross/host_wrapper.py | 5 - test cases/unit/58 identity cross/meson.build | 15 --- test cases/unit/58 identity cross/stuff.h | 27 ---- .../build_extra_path/totally_made_up_dep.pc | 7 + .../host_extra_path/totally_made_up_dep.pc | 7 + .../unit/58 pkg_config_path option/meson.build | 7 + .../pkgconfig/librelativepath.pc | 9 -- .../unit/59 introspect buildoptions/c_compiler.py | 3 + test cases/unit/59 introspect buildoptions/main.c | 6 + .../unit/59 introspect buildoptions/meson.build | 16 +++ .../59 introspect buildoptions/meson_options.txt | 2 + .../subprojects/evilFile.txt | 0 .../subprojects/projectA/meson.build | 3 + .../subprojects/projectA/meson_options.txt | 1 + .../subprojects/projectBad/meson.build | 9 ++ .../subprojects/projectBad/meson_options.txt | 1 + .../unit/59 test env doesn't stack/meson.build | 12 -- .../unit/59 test env doesn't stack/script.py | 9 -- test cases/unit/60 cmake_prefix_path/meson.build | 4 - .../lib/cmake/mesontest/mesontest-config.cmake | 4 - test cases/unit/60 native file override/crossfile | 16 +++ test cases/unit/60 native file override/crossfile2 | 4 + .../unit/60 native file override/meson.build | 10 ++ .../unit/60 native file override/meson_options.txt | 13 ++ test cases/unit/60 native file override/nativefile | 16 +++ test cases/unit/61 cmake parser/meson.build | 19 --- .../lib/cmake/mesontest/mesontest-config.cmake | 63 --------- test cases/unit/61 identity cross/build_wrapper.py | 5 + test cases/unit/61 identity cross/host_wrapper.py | 5 + test cases/unit/61 identity cross/meson.build | 15 +++ test cases/unit/61 identity cross/stuff.h | 27 ++++ test cases/unit/62 alias target/main.c | 3 - test cases/unit/62 alias target/meson.build | 15 --- .../pkgconfig/librelativepath.pc | 9 ++ .../unit/63 test env does not stack/meson.build | 12 ++ .../unit/63 test env does not stack/script.py | 9 ++ test cases/unit/64 cmake_prefix_path/meson.build | 4 + .../lib/cmake/mesontest/mesontest-config.cmake | 4 + test cases/unit/65 cmake parser/meson.build | 19 +++ .../lib/cmake/mesontest/mesontest-config.cmake | 63 +++++++++ test cases/unit/66 alias target/main.c | 3 + test cases/unit/66 alias target/meson.build | 15 +++ 2028 files changed, 12485 insertions(+), 12485 deletions(-) delete mode 100644 test cases/cmake/10 cmake_module_path/cmake/FindSomethingLikePython.cmake delete mode 100644 test cases/cmake/10 cmake_module_path/meson.build delete mode 100644 test cases/cmake/10 generator expressions/main.cpp delete mode 100644 test cases/cmake/10 generator expressions/meson.build delete mode 100644 test cases/cmake/10 generator expressions/subprojects/cmMod/CMakeLists.txt delete mode 100644 test cases/cmake/10 generator expressions/subprojects/cmMod/include/cmMod.hpp create mode 100644 test cases/cmake/10 header only/main.cpp create mode 100644 test cases/cmake/10 header only/meson.build create mode 100644 test cases/cmake/10 header only/subprojects/cmMod/CMakeLists.txt create mode 100644 test cases/cmake/10 header only/subprojects/cmMod/include/cmMod.hpp create mode 100644 test cases/cmake/11 cmake_module_path/cmake/FindSomethingLikePython.cmake create mode 100644 test cases/cmake/11 cmake_module_path/meson.build create mode 100644 test cases/cmake/12 generator expressions/main.cpp create mode 100644 test cases/cmake/12 generator expressions/meson.build create mode 100644 test cases/cmake/12 generator expressions/subprojects/cmMod/CMakeLists.txt create mode 100644 test cases/cmake/12 generator expressions/subprojects/cmMod/include/cmMod.hpp delete mode 100644 test cases/cmake/9 header only/main.cpp delete mode 100644 test cases/cmake/9 header only/meson.build delete mode 100644 test cases/cmake/9 header only/subprojects/cmMod/CMakeLists.txt delete mode 100644 test cases/cmake/9 header only/subprojects/cmMod/include/cmMod.hpp delete mode 100644 test cases/common/100 manygen/depuser.c delete mode 100644 test cases/common/100 manygen/meson.build delete mode 100644 test cases/common/100 manygen/subdir/funcinfo.def delete mode 100755 test cases/common/100 manygen/subdir/manygen.py delete mode 100644 test cases/common/100 manygen/subdir/meson.build create mode 100644 test cases/common/100 stringdef/meson.build create mode 100644 test cases/common/100 stringdef/stringdef.c create mode 100644 test cases/common/101 find program path/meson.build create mode 100755 test cases/common/101 find program path/program.py delete mode 100644 test cases/common/101 stringdef/meson.build delete mode 100644 test cases/common/101 stringdef/stringdef.c delete mode 100644 test cases/common/102 find program path/meson.build delete mode 100755 test cases/common/102 find program path/program.py create mode 100644 test cases/common/102 subproject subdir/meson.build create mode 100644 test cases/common/102 subproject subdir/prog.c create mode 100644 test cases/common/102 subproject subdir/subprojects/sub/lib/meson.build create mode 100644 test cases/common/102 subproject subdir/subprojects/sub/lib/sub.c create mode 100644 test cases/common/102 subproject subdir/subprojects/sub/lib/sub.h create mode 100644 test cases/common/102 subproject subdir/subprojects/sub/meson.build create mode 100644 test cases/common/103 postconf/meson.build create mode 100644 test cases/common/103 postconf/postconf.py create mode 100644 test cases/common/103 postconf/prog.c create mode 100644 test cases/common/103 postconf/raw.dat delete mode 100644 test cases/common/103 subproject subdir/meson.build delete mode 100644 test cases/common/103 subproject subdir/prog.c delete mode 100644 test cases/common/103 subproject subdir/subprojects/sub/lib/meson.build delete mode 100644 test cases/common/103 subproject subdir/subprojects/sub/lib/sub.c delete mode 100644 test cases/common/103 subproject subdir/subprojects/sub/lib/sub.h delete mode 100644 test cases/common/103 subproject subdir/subprojects/sub/meson.build create mode 100644 test cases/common/104 postconf with args/meson.build create mode 100644 test cases/common/104 postconf with args/postconf.py create mode 100644 test cases/common/104 postconf with args/prog.c create mode 100644 test cases/common/104 postconf with args/raw.dat delete mode 100644 test cases/common/104 postconf/meson.build delete mode 100644 test cases/common/104 postconf/postconf.py delete mode 100644 test cases/common/104 postconf/prog.c delete mode 100644 test cases/common/104 postconf/raw.dat delete mode 100644 test cases/common/105 postconf with args/meson.build delete mode 100644 test cases/common/105 postconf with args/postconf.py delete mode 100644 test cases/common/105 postconf with args/prog.c delete mode 100644 test cases/common/105 postconf with args/raw.dat create mode 100644 test cases/common/105 testframework options/meson.build create mode 100644 test cases/common/105 testframework options/meson_options.txt create mode 100644 test cases/common/105 testframework options/test_args.txt create mode 100644 test cases/common/106 extract same name/lib.c create mode 100644 test cases/common/106 extract same name/main.c create mode 100644 test cases/common/106 extract same name/meson.build create mode 100644 test cases/common/106 extract same name/src/lib.c delete mode 100644 test cases/common/106 testframework options/meson.build delete mode 100644 test cases/common/106 testframework options/meson_options.txt delete mode 100644 test cases/common/106 testframework options/test_args.txt delete mode 100644 test cases/common/107 extract same name/lib.c delete mode 100644 test cases/common/107 extract same name/main.c delete mode 100644 test cases/common/107 extract same name/meson.build delete mode 100644 test cases/common/107 extract same name/src/lib.c create mode 100644 test cases/common/107 has header symbol/meson.build create mode 100644 test cases/common/108 has arg/meson.build delete mode 100644 test cases/common/108 has header symbol/meson.build create mode 100755 test cases/common/109 generatorcustom/catter.py create mode 100755 test cases/common/109 generatorcustom/gen.py create mode 100644 test cases/common/109 generatorcustom/main.c create mode 100644 test cases/common/109 generatorcustom/meson.build create mode 100644 test cases/common/109 generatorcustom/res1.txt create mode 100644 test cases/common/109 generatorcustom/res2.txt delete mode 100644 test cases/common/109 has arg/meson.build delete mode 100755 test cases/common/110 generatorcustom/catter.py delete mode 100755 test cases/common/110 generatorcustom/gen.py delete mode 100644 test cases/common/110 generatorcustom/main.c delete mode 100644 test cases/common/110 generatorcustom/meson.build delete mode 100644 test cases/common/110 generatorcustom/res1.txt delete mode 100644 test cases/common/110 generatorcustom/res2.txt create mode 100644 test cases/common/110 multiple dir configure file/meson.build create mode 100644 test cases/common/110 multiple dir configure file/subdir/foo.txt create mode 100644 test cases/common/110 multiple dir configure file/subdir/meson.build create mode 100644 test cases/common/110 multiple dir configure file/subdir/someinput.in delete mode 100644 test cases/common/111 multiple dir configure file/meson.build delete mode 100644 test cases/common/111 multiple dir configure file/subdir/foo.txt delete mode 100644 test cases/common/111 multiple dir configure file/subdir/meson.build delete mode 100644 test cases/common/111 multiple dir configure file/subdir/someinput.in create mode 100644 test cases/common/111 spaces backslash/asm output/meson.build create mode 100644 test cases/common/111 spaces backslash/comparer-end-notstring.c create mode 100644 test cases/common/111 spaces backslash/comparer-end.c create mode 100644 test cases/common/111 spaces backslash/comparer.c create mode 100644 test cases/common/111 spaces backslash/include/comparer.h create mode 100644 test cases/common/111 spaces backslash/meson.build delete mode 100644 test cases/common/112 spaces backslash/asm output/meson.build delete mode 100644 test cases/common/112 spaces backslash/comparer-end-notstring.c delete mode 100644 test cases/common/112 spaces backslash/comparer-end.c delete mode 100644 test cases/common/112 spaces backslash/comparer.c delete mode 100644 test cases/common/112 spaces backslash/include/comparer.h delete mode 100644 test cases/common/112 spaces backslash/meson.build create mode 100644 test cases/common/112 ternary/meson.build create mode 100644 test cases/common/113 custom target capture/data_source.txt create mode 100644 test cases/common/113 custom target capture/installed_files.txt create mode 100644 test cases/common/113 custom target capture/meson.build create mode 100755 test cases/common/113 custom target capture/my_compiler.py delete mode 100644 test cases/common/113 ternary/meson.build create mode 100755 test cases/common/114 allgenerate/converter.py create mode 100644 test cases/common/114 allgenerate/foobar.cpp.in create mode 100644 test cases/common/114 allgenerate/meson.build delete mode 100644 test cases/common/114 custom target capture/data_source.txt delete mode 100644 test cases/common/114 custom target capture/installed_files.txt delete mode 100644 test cases/common/114 custom target capture/meson.build delete mode 100755 test cases/common/114 custom target capture/my_compiler.py delete mode 100755 test cases/common/115 allgenerate/converter.py delete mode 100644 test cases/common/115 allgenerate/foobar.cpp.in delete mode 100644 test cases/common/115 allgenerate/meson.build create mode 100644 test cases/common/115 pathjoin/meson.build delete mode 100644 test cases/common/116 pathjoin/meson.build create mode 100644 test cases/common/116 subdir subproject/meson.build create mode 100644 test cases/common/116 subdir subproject/prog/meson.build create mode 100644 test cases/common/116 subdir subproject/prog/prog.c create mode 100644 test cases/common/116 subdir subproject/subprojects/sub/meson.build create mode 100644 test cases/common/116 subdir subproject/subprojects/sub/sub.c create mode 100644 test cases/common/116 subdir subproject/subprojects/sub/sub.h create mode 100644 test cases/common/117 interpreter copy mutable var on assignment/meson.build delete mode 100644 test cases/common/117 subdir subproject/meson.build delete mode 100644 test cases/common/117 subdir subproject/prog/meson.build delete mode 100644 test cases/common/117 subdir subproject/prog/prog.c delete mode 100644 test cases/common/117 subdir subproject/subprojects/sub/meson.build delete mode 100644 test cases/common/117 subdir subproject/subprojects/sub/sub.c delete mode 100644 test cases/common/117 subdir subproject/subprojects/sub/sub.h delete mode 100644 test cases/common/118 interpreter copy mutable var on assignment/meson.build create mode 100644 test cases/common/118 skip/meson.build delete mode 100644 test cases/common/119 skip/meson.build create mode 100644 test cases/common/119 subproject project arguments/exe.c create mode 100644 test cases/common/119 subproject project arguments/exe.cpp create mode 100644 test cases/common/119 subproject project arguments/meson.build create mode 100644 test cases/common/119 subproject project arguments/subprojects/subexe/meson.build create mode 100644 test cases/common/119 subproject project arguments/subprojects/subexe/subexe.c delete mode 100644 test cases/common/120 subproject project arguments/exe.c delete mode 100644 test cases/common/120 subproject project arguments/exe.cpp delete mode 100644 test cases/common/120 subproject project arguments/meson.build delete mode 100644 test cases/common/120 subproject project arguments/subprojects/subexe/meson.build delete mode 100644 test cases/common/120 subproject project arguments/subprojects/subexe/subexe.c create mode 100644 test cases/common/120 test skip/meson.build create mode 100644 test cases/common/120 test skip/test_skip.c create mode 100644 test cases/common/121 shared module/installed_files.txt create mode 100644 test cases/common/121 shared module/meson.build create mode 100644 test cases/common/121 shared module/module.c create mode 100644 test cases/common/121 shared module/nosyms.c create mode 100644 test cases/common/121 shared module/prog.c create mode 100644 test cases/common/121 shared module/runtime.c delete mode 100644 test cases/common/121 test skip/meson.build delete mode 100644 test cases/common/121 test skip/test_skip.c create mode 100644 test cases/common/122 llvm ir and assembly/main.c create mode 100644 test cases/common/122 llvm ir and assembly/main.cpp create mode 100644 test cases/common/122 llvm ir and assembly/meson.build create mode 100644 test cases/common/122 llvm ir and assembly/square-arm.S create mode 100644 test cases/common/122 llvm ir and assembly/square-x86.S create mode 100644 test cases/common/122 llvm ir and assembly/square-x86_64.S create mode 100644 test cases/common/122 llvm ir and assembly/square.ll create mode 100644 test cases/common/122 llvm ir and assembly/symbol-underscore.h delete mode 100644 test cases/common/122 shared module/installed_files.txt delete mode 100644 test cases/common/122 shared module/meson.build delete mode 100644 test cases/common/122 shared module/module.c delete mode 100644 test cases/common/122 shared module/nosyms.c delete mode 100644 test cases/common/122 shared module/prog.c delete mode 100644 test cases/common/122 shared module/runtime.c create mode 100644 test cases/common/123 cpp and asm/meson.build create mode 100644 test cases/common/123 cpp and asm/retval-arm.S create mode 100644 test cases/common/123 cpp and asm/retval-x86.S create mode 100644 test cases/common/123 cpp and asm/retval-x86_64.S create mode 100644 test cases/common/123 cpp and asm/symbol-underscore.h create mode 100644 test cases/common/123 cpp and asm/trivial.cc delete mode 100644 test cases/common/123 llvm ir and assembly/main.c delete mode 100644 test cases/common/123 llvm ir and assembly/main.cpp delete mode 100644 test cases/common/123 llvm ir and assembly/meson.build delete mode 100644 test cases/common/123 llvm ir and assembly/square-arm.S delete mode 100644 test cases/common/123 llvm ir and assembly/square-x86.S delete mode 100644 test cases/common/123 llvm ir and assembly/square-x86_64.S delete mode 100644 test cases/common/123 llvm ir and assembly/square.ll delete mode 100644 test cases/common/123 llvm ir and assembly/symbol-underscore.h delete mode 100644 test cases/common/124 cpp and asm/meson.build delete mode 100644 test cases/common/124 cpp and asm/retval-arm.S delete mode 100644 test cases/common/124 cpp and asm/retval-x86.S delete mode 100644 test cases/common/124 cpp and asm/retval-x86_64.S delete mode 100644 test cases/common/124 cpp and asm/symbol-underscore.h delete mode 100644 test cases/common/124 cpp and asm/trivial.cc create mode 100644 test cases/common/124 extract all shared library/extractor.h create mode 100644 test cases/common/124 extract all shared library/four.c create mode 100644 test cases/common/124 extract all shared library/func1234.def create mode 100644 test cases/common/124 extract all shared library/meson.build create mode 100644 test cases/common/124 extract all shared library/one.c create mode 100644 test cases/common/124 extract all shared library/prog.c create mode 100644 test cases/common/124 extract all shared library/three.c create mode 100644 test cases/common/124 extract all shared library/two.c delete mode 100644 test cases/common/125 extract all shared library/extractor.h delete mode 100644 test cases/common/125 extract all shared library/four.c delete mode 100644 test cases/common/125 extract all shared library/func1234.def delete mode 100644 test cases/common/125 extract all shared library/meson.build delete mode 100644 test cases/common/125 extract all shared library/one.c delete mode 100644 test cases/common/125 extract all shared library/prog.c delete mode 100644 test cases/common/125 extract all shared library/three.c delete mode 100644 test cases/common/125 extract all shared library/two.c create mode 100644 test cases/common/125 object only target/installed_files.txt create mode 100644 test cases/common/125 object only target/meson.build create mode 100755 test cases/common/125 object only target/obj_generator.py create mode 100644 test cases/common/125 object only target/prog.c create mode 100644 test cases/common/125 object only target/source.c create mode 100644 test cases/common/125 object only target/source2.c create mode 100644 test cases/common/125 object only target/source2.def create mode 100644 test cases/common/125 object only target/source3.c create mode 100644 test cases/common/126 no buildincdir/include/header.h create mode 100644 test cases/common/126 no buildincdir/meson.build create mode 100644 test cases/common/126 no buildincdir/prog.c delete mode 100644 test cases/common/126 object only target/installed_files.txt delete mode 100644 test cases/common/126 object only target/meson.build delete mode 100755 test cases/common/126 object only target/obj_generator.py delete mode 100644 test cases/common/126 object only target/prog.c delete mode 100644 test cases/common/126 object only target/source.c delete mode 100644 test cases/common/126 object only target/source2.c delete mode 100644 test cases/common/126 object only target/source2.def delete mode 100644 test cases/common/126 object only target/source3.c create mode 100644 test cases/common/127 custom target directory install/docgen.py create mode 100644 test cases/common/127 custom target directory install/installed_files.txt create mode 100644 test cases/common/127 custom target directory install/meson.build delete mode 100644 test cases/common/127 no buildincdir/include/header.h delete mode 100644 test cases/common/127 no buildincdir/meson.build delete mode 100644 test cases/common/127 no buildincdir/prog.c delete mode 100644 test cases/common/128 custom target directory install/docgen.py delete mode 100644 test cases/common/128 custom target directory install/installed_files.txt delete mode 100644 test cases/common/128 custom target directory install/meson.build create mode 100644 test cases/common/128 dependency file generation/main .c create mode 100644 test cases/common/128 dependency file generation/meson.build create mode 100644 test cases/common/129 configure file in generator/inc/confdata.in create mode 100644 test cases/common/129 configure file in generator/inc/meson.build create mode 100644 test cases/common/129 configure file in generator/meson.build create mode 100755 test cases/common/129 configure file in generator/src/gen.py create mode 100644 test cases/common/129 configure file in generator/src/main.c create mode 100644 test cases/common/129 configure file in generator/src/meson.build create mode 100644 test cases/common/129 configure file in generator/src/source delete mode 100644 test cases/common/129 dependency file generation/main .c delete mode 100644 test cases/common/129 dependency file generation/meson.build delete mode 100644 test cases/common/130 configure file in generator/inc/confdata.in delete mode 100644 test cases/common/130 configure file in generator/inc/meson.build delete mode 100644 test cases/common/130 configure file in generator/meson.build delete mode 100755 test cases/common/130 configure file in generator/src/gen.py delete mode 100644 test cases/common/130 configure file in generator/src/main.c delete mode 100644 test cases/common/130 configure file in generator/src/meson.build delete mode 100644 test cases/common/130 configure file in generator/src/source create mode 100644 test cases/common/130 generated llvm ir/copyfile.py create mode 100644 test cases/common/130 generated llvm ir/main.c create mode 100644 test cases/common/130 generated llvm ir/meson.build create mode 100644 test cases/common/130 generated llvm ir/square.ll.in create mode 100644 test cases/common/131 generated assembly/copyfile.py create mode 100644 test cases/common/131 generated assembly/main.c create mode 100644 test cases/common/131 generated assembly/meson.build create mode 100644 test cases/common/131 generated assembly/square-arm.S.in create mode 100644 test cases/common/131 generated assembly/square-x86.S.in create mode 100644 test cases/common/131 generated assembly/square-x86_64.S.in create mode 100644 test cases/common/131 generated assembly/symbol-underscore.h delete mode 100644 test cases/common/131 generated llvm ir/copyfile.py delete mode 100644 test cases/common/131 generated llvm ir/main.c delete mode 100644 test cases/common/131 generated llvm ir/meson.build delete mode 100644 test cases/common/131 generated llvm ir/square.ll.in create mode 100644 test cases/common/132 build by default targets in tests/main.c create mode 100644 test cases/common/132 build by default targets in tests/meson.build create mode 100644 test cases/common/132 build by default targets in tests/write_file.py delete mode 100644 test cases/common/132 generated assembly/copyfile.py delete mode 100644 test cases/common/132 generated assembly/main.c delete mode 100644 test cases/common/132 generated assembly/meson.build delete mode 100644 test cases/common/132 generated assembly/square-arm.S.in delete mode 100644 test cases/common/132 generated assembly/square-x86.S.in delete mode 100644 test cases/common/132 generated assembly/square-x86_64.S.in delete mode 100644 test cases/common/132 generated assembly/symbol-underscore.h delete mode 100644 test cases/common/133 build by default targets in tests/main.c delete mode 100644 test cases/common/133 build by default targets in tests/meson.build delete mode 100644 test cases/common/133 build by default targets in tests/write_file.py create mode 100644 test cases/common/133 build by default/checkexists.py create mode 100644 test cases/common/133 build by default/foo.c create mode 100644 test cases/common/133 build by default/meson.build create mode 100644 test cases/common/133 build by default/mygen.py create mode 100644 test cases/common/133 build by default/source.txt delete mode 100644 test cases/common/134 build by default/checkexists.py delete mode 100644 test cases/common/134 build by default/foo.c delete mode 100644 test cases/common/134 build by default/meson.build delete mode 100644 test cases/common/134 build by default/mygen.py delete mode 100644 test cases/common/134 build by default/source.txt create mode 100644 test cases/common/134 include order/ctsub/copyfile.py create mode 100644 test cases/common/134 include order/ctsub/emptyfile.c create mode 100644 test cases/common/134 include order/ctsub/main.h create mode 100644 test cases/common/134 include order/ctsub/meson.build create mode 100644 test cases/common/134 include order/inc1/hdr.h create mode 100644 test cases/common/134 include order/inc2/hdr.h create mode 100644 test cases/common/134 include order/meson.build create mode 100644 test cases/common/134 include order/ordertest.c create mode 100644 test cases/common/134 include order/sub1/main.h create mode 100644 test cases/common/134 include order/sub1/meson.build create mode 100644 test cases/common/134 include order/sub1/some.c create mode 100644 test cases/common/134 include order/sub1/some.h create mode 100644 test cases/common/134 include order/sub2/main.h create mode 100644 test cases/common/134 include order/sub2/meson.build create mode 100644 test cases/common/134 include order/sub3/main.h create mode 100644 test cases/common/134 include order/sub3/meson.build create mode 100644 test cases/common/134 include order/sub4/main.c create mode 100644 test cases/common/134 include order/sub4/main.h create mode 100644 test cases/common/134 include order/sub4/meson.build delete mode 100644 test cases/common/135 include order/ctsub/copyfile.py delete mode 100644 test cases/common/135 include order/ctsub/emptyfile.c delete mode 100644 test cases/common/135 include order/ctsub/main.h delete mode 100644 test cases/common/135 include order/ctsub/meson.build delete mode 100644 test cases/common/135 include order/inc1/hdr.h delete mode 100644 test cases/common/135 include order/inc2/hdr.h delete mode 100644 test cases/common/135 include order/meson.build delete mode 100644 test cases/common/135 include order/ordertest.c delete mode 100644 test cases/common/135 include order/sub1/main.h delete mode 100644 test cases/common/135 include order/sub1/meson.build delete mode 100644 test cases/common/135 include order/sub1/some.c delete mode 100644 test cases/common/135 include order/sub1/some.h delete mode 100644 test cases/common/135 include order/sub2/main.h delete mode 100644 test cases/common/135 include order/sub2/meson.build delete mode 100644 test cases/common/135 include order/sub3/main.h delete mode 100644 test cases/common/135 include order/sub3/meson.build delete mode 100644 test cases/common/135 include order/sub4/main.c delete mode 100644 test cases/common/135 include order/sub4/main.h delete mode 100644 test cases/common/135 include order/sub4/meson.build create mode 100644 test cases/common/135 override options/four.c create mode 100644 test cases/common/135 override options/meson.build create mode 100644 test cases/common/135 override options/one.c create mode 100644 test cases/common/135 override options/three.c create mode 100644 test cases/common/135 override options/two.c create mode 100644 test cases/common/136 get define/concat.h create mode 100644 test cases/common/136 get define/meson.build create mode 100644 test cases/common/136 get define/meson_options.txt delete mode 100644 test cases/common/136 override options/four.c delete mode 100644 test cases/common/136 override options/meson.build delete mode 100644 test cases/common/136 override options/one.c delete mode 100644 test cases/common/136 override options/three.c delete mode 100644 test cases/common/136 override options/two.c create mode 100644 test cases/common/137 c cpp and asm/main.c create mode 100644 test cases/common/137 c cpp and asm/main.cpp create mode 100644 test cases/common/137 c cpp and asm/meson.build create mode 100644 test cases/common/137 c cpp and asm/retval-arm.S create mode 100644 test cases/common/137 c cpp and asm/retval-x86.S create mode 100644 test cases/common/137 c cpp and asm/retval-x86_64.S create mode 100644 test cases/common/137 c cpp and asm/somelib.c create mode 100644 test cases/common/137 c cpp and asm/symbol-underscore.h delete mode 100644 test cases/common/137 get define/concat.h delete mode 100644 test cases/common/137 get define/meson.build delete mode 100644 test cases/common/137 get define/meson_options.txt delete mode 100644 test cases/common/138 c cpp and asm/main.c delete mode 100644 test cases/common/138 c cpp and asm/main.cpp delete mode 100644 test cases/common/138 c cpp and asm/meson.build delete mode 100644 test cases/common/138 c cpp and asm/retval-arm.S delete mode 100644 test cases/common/138 c cpp and asm/retval-x86.S delete mode 100644 test cases/common/138 c cpp and asm/retval-x86_64.S delete mode 100644 test cases/common/138 c cpp and asm/somelib.c delete mode 100644 test cases/common/138 c cpp and asm/symbol-underscore.h create mode 100644 test cases/common/138 compute int/config.h.in create mode 100644 test cases/common/138 compute int/foobar.h create mode 100644 test cases/common/138 compute int/meson.build create mode 100644 test cases/common/138 compute int/prog.c.in delete mode 100644 test cases/common/139 compute int/config.h.in delete mode 100644 test cases/common/139 compute int/foobar.h delete mode 100644 test cases/common/139 compute int/meson.build delete mode 100644 test cases/common/139 compute int/prog.c.in create mode 100644 test cases/common/139 custom target object output/meson.build create mode 100644 test cases/common/139 custom target object output/obj_generator.py create mode 100644 test cases/common/139 custom target object output/objdir/meson.build create mode 100644 test cases/common/139 custom target object output/objdir/source.c create mode 100644 test cases/common/139 custom target object output/progdir/meson.build create mode 100644 test cases/common/139 custom target object output/progdir/prog.c delete mode 100644 test cases/common/140 custom target object output/meson.build delete mode 100644 test cases/common/140 custom target object output/obj_generator.py delete mode 100644 test cases/common/140 custom target object output/objdir/meson.build delete mode 100644 test cases/common/140 custom target object output/objdir/source.c delete mode 100644 test cases/common/140 custom target object output/progdir/meson.build delete mode 100644 test cases/common/140 custom target object output/progdir/prog.c create mode 100644 test cases/common/140 empty build file/meson.build create mode 100644 test cases/common/140 empty build file/subdir/meson.build delete mode 100644 test cases/common/141 empty build file/meson.build delete mode 100644 test cases/common/141 empty build file/subdir/meson.build create mode 100644 test cases/common/141 whole archive/exe/meson.build create mode 100644 test cases/common/141 whole archive/exe2/meson.build create mode 100644 test cases/common/141 whole archive/exe3/meson.build create mode 100644 test cases/common/141 whole archive/exe4/meson.build create mode 100644 test cases/common/141 whole archive/func1.c create mode 100644 test cases/common/141 whole archive/func2.c create mode 100644 test cases/common/141 whole archive/meson.build create mode 100644 test cases/common/141 whole archive/mylib.h create mode 100644 test cases/common/141 whole archive/prog.c create mode 100644 test cases/common/141 whole archive/sh_func2_dep_func1/meson.build create mode 100644 test cases/common/141 whole archive/sh_func2_linked_func1/meson.build create mode 100644 test cases/common/141 whole archive/sh_func2_transdep_func1/meson.build create mode 100644 test cases/common/141 whole archive/sh_only_link_whole/meson.build create mode 100644 test cases/common/141 whole archive/st_func1/meson.build create mode 100644 test cases/common/141 whole archive/st_func2/meson.build create mode 100644 test cases/common/142 C and CPP link/dummy.c create mode 100644 test cases/common/142 C and CPP link/foo.c create mode 100644 test cases/common/142 C and CPP link/foo.cpp create mode 100644 test cases/common/142 C and CPP link/foo.h create mode 100644 test cases/common/142 C and CPP link/foo.hpp create mode 100644 test cases/common/142 C and CPP link/foobar.c create mode 100644 test cases/common/142 C and CPP link/foobar.h create mode 100644 test cases/common/142 C and CPP link/meson.build create mode 100644 test cases/common/142 C and CPP link/sub.c create mode 100644 test cases/common/142 C and CPP link/sub.h delete mode 100644 test cases/common/142 whole archive/exe/meson.build delete mode 100644 test cases/common/142 whole archive/exe2/meson.build delete mode 100644 test cases/common/142 whole archive/exe3/meson.build delete mode 100644 test cases/common/142 whole archive/exe4/meson.build delete mode 100644 test cases/common/142 whole archive/func1.c delete mode 100644 test cases/common/142 whole archive/func2.c delete mode 100644 test cases/common/142 whole archive/meson.build delete mode 100644 test cases/common/142 whole archive/mylib.h delete mode 100644 test cases/common/142 whole archive/prog.c delete mode 100644 test cases/common/142 whole archive/sh_func2_dep_func1/meson.build delete mode 100644 test cases/common/142 whole archive/sh_func2_linked_func1/meson.build delete mode 100644 test cases/common/142 whole archive/sh_func2_transdep_func1/meson.build delete mode 100644 test cases/common/142 whole archive/sh_only_link_whole/meson.build delete mode 100644 test cases/common/142 whole archive/st_func1/meson.build delete mode 100644 test cases/common/142 whole archive/st_func2/meson.build delete mode 100644 test cases/common/143 C and CPP link/dummy.c delete mode 100644 test cases/common/143 C and CPP link/foo.c delete mode 100644 test cases/common/143 C and CPP link/foo.cpp delete mode 100644 test cases/common/143 C and CPP link/foo.h delete mode 100644 test cases/common/143 C and CPP link/foo.hpp delete mode 100644 test cases/common/143 C and CPP link/foobar.c delete mode 100644 test cases/common/143 C and CPP link/foobar.h delete mode 100644 test cases/common/143 C and CPP link/meson.build delete mode 100644 test cases/common/143 C and CPP link/sub.c delete mode 100644 test cases/common/143 C and CPP link/sub.h create mode 100644 test cases/common/143 mesonintrospect from scripts/check_env.py create mode 100644 test cases/common/143 mesonintrospect from scripts/check_introspection.py create mode 100644 test cases/common/143 mesonintrospect from scripts/meson.build create mode 100755 test cases/common/144 custom target multiple outputs/generator.py create mode 100644 test cases/common/144 custom target multiple outputs/installed_files.txt create mode 100644 test cases/common/144 custom target multiple outputs/meson.build delete mode 100644 test cases/common/144 mesonintrospect from scripts/check_env.py delete mode 100644 test cases/common/144 mesonintrospect from scripts/check_introspection.py delete mode 100644 test cases/common/144 mesonintrospect from scripts/meson.build delete mode 100755 test cases/common/145 custom target multiple outputs/generator.py delete mode 100644 test cases/common/145 custom target multiple outputs/installed_files.txt delete mode 100644 test cases/common/145 custom target multiple outputs/meson.build create mode 100644 test cases/common/145 special characters/check_quoting.py create mode 100644 test cases/common/145 special characters/installed_files.txt create mode 100644 test cases/common/145 special characters/meson.build create mode 100644 test cases/common/146 nested links/meson.build create mode 100644 test cases/common/146 nested links/xephyr.c delete mode 100644 test cases/common/146 special characters/check_quoting.py delete mode 100644 test cases/common/146 special characters/installed_files.txt delete mode 100644 test cases/common/146 special characters/meson.build create mode 100644 test cases/common/147 list of file sources/foo create mode 100644 test cases/common/147 list of file sources/gen.py create mode 100644 test cases/common/147 list of file sources/meson.build delete mode 100644 test cases/common/147 nested links/meson.build delete mode 100644 test cases/common/147 nested links/xephyr.c create mode 100644 test cases/common/148 link depends custom target/foo.c create mode 100755 test cases/common/148 link depends custom target/make_file.py create mode 100644 test cases/common/148 link depends custom target/meson.build delete mode 100644 test cases/common/148 list of file sources/foo delete mode 100644 test cases/common/148 list of file sources/gen.py delete mode 100644 test cases/common/148 list of file sources/meson.build delete mode 100644 test cases/common/149 link depends custom target/foo.c delete mode 100755 test cases/common/149 link depends custom target/make_file.py delete mode 100644 test cases/common/149 link depends custom target/meson.build create mode 100644 test cases/common/149 recursive linking/3rdorderdeps/lib.c.in create mode 100644 test cases/common/149 recursive linking/3rdorderdeps/main.c.in create mode 100644 test cases/common/149 recursive linking/3rdorderdeps/meson.build create mode 100644 test cases/common/149 recursive linking/circular/lib1.c create mode 100644 test cases/common/149 recursive linking/circular/lib2.c create mode 100644 test cases/common/149 recursive linking/circular/lib3.c create mode 100644 test cases/common/149 recursive linking/circular/main.c create mode 100644 test cases/common/149 recursive linking/circular/meson.build create mode 100644 test cases/common/149 recursive linking/circular/prop1.c create mode 100644 test cases/common/149 recursive linking/circular/prop2.c create mode 100644 test cases/common/149 recursive linking/circular/prop3.c create mode 100644 test cases/common/149 recursive linking/edge-cases/libsto.c create mode 100644 test cases/common/149 recursive linking/edge-cases/meson.build create mode 100644 test cases/common/149 recursive linking/edge-cases/shstmain.c create mode 100644 test cases/common/149 recursive linking/edge-cases/stobuilt.c create mode 100644 test cases/common/149 recursive linking/edge-cases/stomain.c create mode 100644 test cases/common/149 recursive linking/lib.h create mode 100644 test cases/common/149 recursive linking/main.c create mode 100644 test cases/common/149 recursive linking/meson.build create mode 100644 test cases/common/149 recursive linking/shnodep/lib.c create mode 100644 test cases/common/149 recursive linking/shnodep/meson.build create mode 100644 test cases/common/149 recursive linking/shshdep/lib.c create mode 100644 test cases/common/149 recursive linking/shshdep/meson.build create mode 100644 test cases/common/149 recursive linking/shstdep/lib.c create mode 100644 test cases/common/149 recursive linking/shstdep/meson.build create mode 100644 test cases/common/149 recursive linking/stnodep/lib.c create mode 100644 test cases/common/149 recursive linking/stnodep/meson.build create mode 100644 test cases/common/149 recursive linking/stshdep/lib.c create mode 100644 test cases/common/149 recursive linking/stshdep/meson.build create mode 100644 test cases/common/149 recursive linking/ststdep/lib.c create mode 100644 test cases/common/149 recursive linking/ststdep/meson.build create mode 100644 test cases/common/150 library at root/lib.c create mode 100644 test cases/common/150 library at root/main/main.c create mode 100644 test cases/common/150 library at root/main/meson.build create mode 100644 test cases/common/150 library at root/meson.build delete mode 100644 test cases/common/150 recursive linking/3rdorderdeps/lib.c.in delete mode 100644 test cases/common/150 recursive linking/3rdorderdeps/main.c.in delete mode 100644 test cases/common/150 recursive linking/3rdorderdeps/meson.build delete mode 100644 test cases/common/150 recursive linking/circular/lib1.c delete mode 100644 test cases/common/150 recursive linking/circular/lib2.c delete mode 100644 test cases/common/150 recursive linking/circular/lib3.c delete mode 100644 test cases/common/150 recursive linking/circular/main.c delete mode 100644 test cases/common/150 recursive linking/circular/meson.build delete mode 100644 test cases/common/150 recursive linking/circular/prop1.c delete mode 100644 test cases/common/150 recursive linking/circular/prop2.c delete mode 100644 test cases/common/150 recursive linking/circular/prop3.c delete mode 100644 test cases/common/150 recursive linking/edge-cases/libsto.c delete mode 100644 test cases/common/150 recursive linking/edge-cases/meson.build delete mode 100644 test cases/common/150 recursive linking/edge-cases/shstmain.c delete mode 100644 test cases/common/150 recursive linking/edge-cases/stobuilt.c delete mode 100644 test cases/common/150 recursive linking/edge-cases/stomain.c delete mode 100644 test cases/common/150 recursive linking/lib.h delete mode 100644 test cases/common/150 recursive linking/main.c delete mode 100644 test cases/common/150 recursive linking/meson.build delete mode 100644 test cases/common/150 recursive linking/shnodep/lib.c delete mode 100644 test cases/common/150 recursive linking/shnodep/meson.build delete mode 100644 test cases/common/150 recursive linking/shshdep/lib.c delete mode 100644 test cases/common/150 recursive linking/shshdep/meson.build delete mode 100644 test cases/common/150 recursive linking/shstdep/lib.c delete mode 100644 test cases/common/150 recursive linking/shstdep/meson.build delete mode 100644 test cases/common/150 recursive linking/stnodep/lib.c delete mode 100644 test cases/common/150 recursive linking/stnodep/meson.build delete mode 100644 test cases/common/150 recursive linking/stshdep/lib.c delete mode 100644 test cases/common/150 recursive linking/stshdep/meson.build delete mode 100644 test cases/common/150 recursive linking/ststdep/lib.c delete mode 100644 test cases/common/150 recursive linking/ststdep/meson.build delete mode 100644 test cases/common/151 library at root/lib.c delete mode 100644 test cases/common/151 library at root/main/main.c delete mode 100644 test cases/common/151 library at root/main/meson.build delete mode 100644 test cases/common/151 library at root/meson.build create mode 100644 test cases/common/151 simd/fallback.c create mode 100644 test cases/common/151 simd/include/simdheader.h create mode 100644 test cases/common/151 simd/meson.build create mode 100644 test cases/common/151 simd/simd_avx.c create mode 100644 test cases/common/151 simd/simd_avx2.c create mode 100644 test cases/common/151 simd/simd_mmx.c create mode 100644 test cases/common/151 simd/simd_neon.c create mode 100644 test cases/common/151 simd/simd_sse.c create mode 100644 test cases/common/151 simd/simd_sse2.c create mode 100644 test cases/common/151 simd/simd_sse3.c create mode 100644 test cases/common/151 simd/simd_sse41.c create mode 100644 test cases/common/151 simd/simd_sse42.c create mode 100644 test cases/common/151 simd/simd_ssse3.c create mode 100644 test cases/common/151 simd/simdchecker.c create mode 100644 test cases/common/151 simd/simdfuncs.h create mode 100644 test cases/common/152 shared module resolving symbol in executable/meson.build create mode 100644 test cases/common/152 shared module resolving symbol in executable/module.c create mode 100644 test cases/common/152 shared module resolving symbol in executable/prog.c delete mode 100644 test cases/common/152 simd/fallback.c delete mode 100644 test cases/common/152 simd/include/simdheader.h delete mode 100644 test cases/common/152 simd/meson.build delete mode 100644 test cases/common/152 simd/simd_avx.c delete mode 100644 test cases/common/152 simd/simd_avx2.c delete mode 100644 test cases/common/152 simd/simd_mmx.c delete mode 100644 test cases/common/152 simd/simd_neon.c delete mode 100644 test cases/common/152 simd/simd_sse.c delete mode 100644 test cases/common/152 simd/simd_sse2.c delete mode 100644 test cases/common/152 simd/simd_sse3.c delete mode 100644 test cases/common/152 simd/simd_sse41.c delete mode 100644 test cases/common/152 simd/simd_sse42.c delete mode 100644 test cases/common/152 simd/simd_ssse3.c delete mode 100644 test cases/common/152 simd/simdchecker.c delete mode 100644 test cases/common/152 simd/simdfuncs.h create mode 100644 test cases/common/153 dotinclude/dotproc.c create mode 100644 test cases/common/153 dotinclude/meson.build create mode 100644 test cases/common/153 dotinclude/stdio.h delete mode 100644 test cases/common/153 shared module resolving symbol in executable/meson.build delete mode 100644 test cases/common/153 shared module resolving symbol in executable/module.c delete mode 100644 test cases/common/153 shared module resolving symbol in executable/prog.c delete mode 100644 test cases/common/154 dotinclude/dotproc.c delete mode 100644 test cases/common/154 dotinclude/meson.build delete mode 100644 test cases/common/154 dotinclude/stdio.h create mode 100644 test cases/common/154 reserved targets/all/meson.build create mode 100644 test cases/common/154 reserved targets/benchmark/meson.build create mode 100644 test cases/common/154 reserved targets/clean-ctlist/meson.build create mode 100644 test cases/common/154 reserved targets/clean-gcda/meson.build create mode 100644 test cases/common/154 reserved targets/clean-gcno/meson.build create mode 100644 test cases/common/154 reserved targets/clean/meson.build create mode 100644 test cases/common/154 reserved targets/coverage-html/meson.build create mode 100644 test cases/common/154 reserved targets/coverage-text/meson.build create mode 100644 test cases/common/154 reserved targets/coverage-xml/meson.build create mode 100644 test cases/common/154 reserved targets/coverage/meson.build create mode 100644 test cases/common/154 reserved targets/dist/meson.build create mode 100644 test cases/common/154 reserved targets/distcheck/meson.build create mode 100644 test cases/common/154 reserved targets/install/meson.build create mode 100644 test cases/common/154 reserved targets/meson.build create mode 100644 test cases/common/154 reserved targets/phony/meson.build create mode 100644 test cases/common/154 reserved targets/reconfigure/meson.build create mode 100644 test cases/common/154 reserved targets/runtarget/meson.build create mode 100644 test cases/common/154 reserved targets/scan-build/meson.build create mode 100644 test cases/common/154 reserved targets/test.c create mode 100644 test cases/common/154 reserved targets/test/meson.build create mode 100644 test cases/common/154 reserved targets/uninstall/meson.build create mode 100644 test cases/common/155 duplicate source names/dir1/file.c create mode 100644 test cases/common/155 duplicate source names/dir1/meson.build create mode 100644 test cases/common/155 duplicate source names/dir2/dir1/file.c create mode 100644 test cases/common/155 duplicate source names/dir2/file.c create mode 100644 test cases/common/155 duplicate source names/dir2/meson.build create mode 100644 test cases/common/155 duplicate source names/dir3/dir1/file.c create mode 100644 test cases/common/155 duplicate source names/dir3/file.c create mode 100644 test cases/common/155 duplicate source names/dir3/meson.build create mode 100644 test cases/common/155 duplicate source names/meson.build delete mode 100644 test cases/common/155 reserved targets/all/meson.build delete mode 100644 test cases/common/155 reserved targets/benchmark/meson.build delete mode 100644 test cases/common/155 reserved targets/clean-ctlist/meson.build delete mode 100644 test cases/common/155 reserved targets/clean-gcda/meson.build delete mode 100644 test cases/common/155 reserved targets/clean-gcno/meson.build delete mode 100644 test cases/common/155 reserved targets/clean/meson.build delete mode 100644 test cases/common/155 reserved targets/coverage-html/meson.build delete mode 100644 test cases/common/155 reserved targets/coverage-text/meson.build delete mode 100644 test cases/common/155 reserved targets/coverage-xml/meson.build delete mode 100644 test cases/common/155 reserved targets/coverage/meson.build delete mode 100644 test cases/common/155 reserved targets/dist/meson.build delete mode 100644 test cases/common/155 reserved targets/distcheck/meson.build delete mode 100644 test cases/common/155 reserved targets/install/meson.build delete mode 100644 test cases/common/155 reserved targets/meson.build delete mode 100644 test cases/common/155 reserved targets/phony/meson.build delete mode 100644 test cases/common/155 reserved targets/reconfigure/meson.build delete mode 100644 test cases/common/155 reserved targets/runtarget/meson.build delete mode 100644 test cases/common/155 reserved targets/scan-build/meson.build delete mode 100644 test cases/common/155 reserved targets/test.c delete mode 100644 test cases/common/155 reserved targets/test/meson.build delete mode 100644 test cases/common/155 reserved targets/uninstall/meson.build delete mode 100644 test cases/common/156 duplicate source names/dir1/file.c delete mode 100644 test cases/common/156 duplicate source names/dir1/meson.build delete mode 100644 test cases/common/156 duplicate source names/dir2/dir1/file.c delete mode 100644 test cases/common/156 duplicate source names/dir2/file.c delete mode 100644 test cases/common/156 duplicate source names/dir2/meson.build delete mode 100644 test cases/common/156 duplicate source names/dir3/dir1/file.c delete mode 100644 test cases/common/156 duplicate source names/dir3/file.c delete mode 100644 test cases/common/156 duplicate source names/dir3/meson.build delete mode 100644 test cases/common/156 duplicate source names/meson.build create mode 100644 test cases/common/156 index customtarget/check_args.py create mode 100644 test cases/common/156 index customtarget/gen_sources.py create mode 100644 test cases/common/156 index customtarget/lib.c create mode 100644 test cases/common/156 index customtarget/meson.build create mode 100644 test cases/common/156 index customtarget/subdir/foo.c create mode 100644 test cases/common/156 index customtarget/subdir/meson.build delete mode 100644 test cases/common/157 index customtarget/check_args.py delete mode 100644 test cases/common/157 index customtarget/gen_sources.py delete mode 100644 test cases/common/157 index customtarget/lib.c delete mode 100644 test cases/common/157 index customtarget/meson.build delete mode 100644 test cases/common/157 index customtarget/subdir/foo.c delete mode 100644 test cases/common/157 index customtarget/subdir/meson.build create mode 100644 test cases/common/157 wrap file should not failed/meson.build create mode 100644 test cases/common/157 wrap file should not failed/src/meson.build create mode 100644 test cases/common/157 wrap file should not failed/src/subprojects/foo/prog2.c create mode 100644 test cases/common/157 wrap file should not failed/src/subprojects/prog.c create mode 100644 test cases/common/157 wrap file should not failed/subprojects/foo.wrap create mode 100644 test cases/common/157 wrap file should not failed/subprojects/packagecache/foo-1.0-patch.tar.xz create mode 100644 test cases/common/157 wrap file should not failed/subprojects/packagecache/foo-1.0.tar.xz create mode 100644 test cases/common/157 wrap file should not failed/subprojects/packagecache/zlib-1.2.8-8-wrap.zip create mode 100644 test cases/common/157 wrap file should not failed/subprojects/packagecache/zlib-1.2.8.tar.gz create mode 100644 test cases/common/157 wrap file should not failed/subprojects/zlib-1.2.8/foo.c create mode 100644 test cases/common/157 wrap file should not failed/subprojects/zlib-1.2.8/meson.build create mode 100644 test cases/common/157 wrap file should not failed/subprojects/zlib.wrap create mode 100644 test cases/common/158 includedir subproj/meson.build create mode 100644 test cases/common/158 includedir subproj/prog.c create mode 100644 test cases/common/158 includedir subproj/subprojects/inctest/include/incfile.h create mode 100644 test cases/common/158 includedir subproj/subprojects/inctest/meson.build delete mode 100644 test cases/common/158 wrap file should not failed/meson.build delete mode 100644 test cases/common/158 wrap file should not failed/src/meson.build delete mode 100644 test cases/common/158 wrap file should not failed/src/subprojects/foo/prog2.c delete mode 100644 test cases/common/158 wrap file should not failed/src/subprojects/prog.c delete mode 100644 test cases/common/158 wrap file should not failed/subprojects/foo.wrap delete mode 100644 test cases/common/158 wrap file should not failed/subprojects/packagecache/foo-1.0-patch.tar.xz delete mode 100644 test cases/common/158 wrap file should not failed/subprojects/packagecache/foo-1.0.tar.xz delete mode 100644 test cases/common/158 wrap file should not failed/subprojects/packagecache/zlib-1.2.8-8-wrap.zip delete mode 100644 test cases/common/158 wrap file should not failed/subprojects/packagecache/zlib-1.2.8.tar.gz delete mode 100644 test cases/common/158 wrap file should not failed/subprojects/zlib-1.2.8/foo.c delete mode 100644 test cases/common/158 wrap file should not failed/subprojects/zlib-1.2.8/meson.build delete mode 100644 test cases/common/158 wrap file should not failed/subprojects/zlib.wrap delete mode 100644 test cases/common/159 includedir subproj/meson.build delete mode 100644 test cases/common/159 includedir subproj/prog.c delete mode 100644 test cases/common/159 includedir subproj/subprojects/inctest/include/incfile.h delete mode 100644 test cases/common/159 includedir subproj/subprojects/inctest/meson.build create mode 100644 test cases/common/159 subproject dir name collision/a.c create mode 100644 test cases/common/159 subproject dir name collision/custom_subproject_dir/B/b.c create mode 100644 test cases/common/159 subproject dir name collision/custom_subproject_dir/B/meson.build create mode 100644 test cases/common/159 subproject dir name collision/custom_subproject_dir/C/c.c create mode 100644 test cases/common/159 subproject dir name collision/custom_subproject_dir/C/meson.build create mode 100644 test cases/common/159 subproject dir name collision/meson.build create mode 100644 test cases/common/159 subproject dir name collision/other_subdir/custom_subproject_dir/other.c create mode 100644 test cases/common/159 subproject dir name collision/other_subdir/meson.build create mode 100644 test cases/common/160 config tool variable/meson.build delete mode 100644 test cases/common/160 subproject dir name collision/a.c delete mode 100644 test cases/common/160 subproject dir name collision/custom_subproject_dir/B/b.c delete mode 100644 test cases/common/160 subproject dir name collision/custom_subproject_dir/B/meson.build delete mode 100644 test cases/common/160 subproject dir name collision/custom_subproject_dir/C/c.c delete mode 100644 test cases/common/160 subproject dir name collision/custom_subproject_dir/C/meson.build delete mode 100644 test cases/common/160 subproject dir name collision/meson.build delete mode 100644 test cases/common/160 subproject dir name collision/other_subdir/custom_subproject_dir/other.c delete mode 100644 test cases/common/160 subproject dir name collision/other_subdir/meson.build delete mode 100644 test cases/common/161 config tool variable/meson.build create mode 100644 test cases/common/161 custom target subdir depend files/copyfile.py create mode 100644 test cases/common/161 custom target subdir depend files/meson.build create mode 100644 test cases/common/161 custom target subdir depend files/subdir/dep.dat create mode 100644 test cases/common/161 custom target subdir depend files/subdir/foo.c.in create mode 100644 test cases/common/161 custom target subdir depend files/subdir/meson.build delete mode 100644 test cases/common/162 custom target subdir depend files/copyfile.py delete mode 100644 test cases/common/162 custom target subdir depend files/meson.build delete mode 100644 test cases/common/162 custom target subdir depend files/subdir/dep.dat delete mode 100644 test cases/common/162 custom target subdir depend files/subdir/foo.c.in delete mode 100644 test cases/common/162 custom target subdir depend files/subdir/meson.build create mode 100644 test cases/common/162 external program shebang parsing/input.txt create mode 100644 test cases/common/162 external program shebang parsing/main.c create mode 100644 test cases/common/162 external program shebang parsing/meson.build create mode 100644 test cases/common/162 external program shebang parsing/script.int.in create mode 100644 test cases/common/163 disabler/meson.build delete mode 100644 test cases/common/163 external program shebang parsing/input.txt delete mode 100644 test cases/common/163 external program shebang parsing/main.c delete mode 100644 test cases/common/163 external program shebang parsing/meson.build delete mode 100644 test cases/common/163 external program shebang parsing/script.int.in create mode 100644 test cases/common/164 array option/meson.build create mode 100644 test cases/common/164 array option/meson_options.txt delete mode 100644 test cases/common/164 disabler/meson.build delete mode 100644 test cases/common/165 array option/meson.build delete mode 100644 test cases/common/165 array option/meson_options.txt create mode 100644 test cases/common/165 custom target template substitution/checkcopy.py create mode 100644 test cases/common/165 custom target template substitution/foo.c.in create mode 100644 test cases/common/165 custom target template substitution/meson.build delete mode 100644 test cases/common/166 custom target template substitution/checkcopy.py delete mode 100644 test cases/common/166 custom target template substitution/foo.c.in delete mode 100644 test cases/common/166 custom target template substitution/meson.build create mode 100644 test cases/common/166 not-found dependency/meson.build create mode 100644 test cases/common/166 not-found dependency/sub/meson.build create mode 100644 test cases/common/166 not-found dependency/subprojects/trivial/meson.build create mode 100644 test cases/common/166 not-found dependency/subprojects/trivial/trivial.c create mode 100644 test cases/common/166 not-found dependency/testlib.c delete mode 100644 test cases/common/167 not-found dependency/meson.build delete mode 100644 test cases/common/167 not-found dependency/sub/meson.build delete mode 100644 test cases/common/167 not-found dependency/subprojects/trivial/meson.build delete mode 100644 test cases/common/167 not-found dependency/subprojects/trivial/trivial.c delete mode 100644 test cases/common/167 not-found dependency/testlib.c create mode 100644 test cases/common/167 subdir if_found/meson.build create mode 100644 test cases/common/167 subdir if_found/subdir/meson.build create mode 100644 test cases/common/168 default options prefix dependent defaults/meson.build delete mode 100644 test cases/common/168 subdir if_found/meson.build delete mode 100644 test cases/common/168 subdir if_found/subdir/meson.build delete mode 100644 test cases/common/169 default options prefix dependent defaults/meson.build create mode 100644 test cases/common/169 dependency factory/meson.build delete mode 100644 test cases/common/170 dependency factory/meson.build create mode 100644 test cases/common/170 get project license/bar.c create mode 100644 test cases/common/170 get project license/meson.build delete mode 100644 test cases/common/171 get project license/bar.c delete mode 100644 test cases/common/171 get project license/meson.build create mode 100644 test cases/common/171 yield/meson.build create mode 100644 test cases/common/171 yield/meson_options.txt create mode 100644 test cases/common/171 yield/subprojects/sub/meson.build create mode 100644 test cases/common/171 yield/subprojects/sub/meson_options.txt create mode 100644 test cases/common/172 subproject nested subproject dirs/contrib/subprojects/alpha/a.c create mode 100644 test cases/common/172 subproject nested subproject dirs/contrib/subprojects/alpha/meson.build create mode 100644 test cases/common/172 subproject nested subproject dirs/contrib/subprojects/alpha/var/subprojects/wrap_files_might_be_here create mode 100644 test cases/common/172 subproject nested subproject dirs/contrib/subprojects/beta/b.c create mode 100644 test cases/common/172 subproject nested subproject dirs/contrib/subprojects/beta/meson.build create mode 100644 test cases/common/172 subproject nested subproject dirs/meson.build create mode 100644 test cases/common/172 subproject nested subproject dirs/prog.c delete mode 100644 test cases/common/172 yield/meson.build delete mode 100644 test cases/common/172 yield/meson_options.txt delete mode 100644 test cases/common/172 yield/subprojects/sub/meson.build delete mode 100644 test cases/common/172 yield/subprojects/sub/meson_options.txt create mode 100644 test cases/common/173 preserve gendir/base.inp create mode 100644 test cases/common/173 preserve gendir/com/mesonbuild/subbie.inp create mode 100755 test cases/common/173 preserve gendir/genprog.py create mode 100644 test cases/common/173 preserve gendir/meson.build create mode 100644 test cases/common/173 preserve gendir/testprog.c delete mode 100644 test cases/common/173 subproject nested subproject dirs/contrib/subprojects/alpha/a.c delete mode 100644 test cases/common/173 subproject nested subproject dirs/contrib/subprojects/alpha/meson.build delete mode 100644 test cases/common/173 subproject nested subproject dirs/contrib/subprojects/alpha/var/subprojects/wrap_files_might_be_here delete mode 100644 test cases/common/173 subproject nested subproject dirs/contrib/subprojects/beta/b.c delete mode 100644 test cases/common/173 subproject nested subproject dirs/contrib/subprojects/beta/meson.build delete mode 100644 test cases/common/173 subproject nested subproject dirs/meson.build delete mode 100644 test cases/common/173 subproject nested subproject dirs/prog.c delete mode 100644 test cases/common/174 preserve gendir/base.inp delete mode 100644 test cases/common/174 preserve gendir/com/mesonbuild/subbie.inp delete mode 100755 test cases/common/174 preserve gendir/genprog.py delete mode 100644 test cases/common/174 preserve gendir/meson.build delete mode 100644 test cases/common/174 preserve gendir/testprog.c create mode 100644 test cases/common/174 source in dep/bar.cpp create mode 100644 test cases/common/174 source in dep/foo.c create mode 100644 test cases/common/174 source in dep/generated/funname create mode 100755 test cases/common/174 source in dep/generated/genheader.py create mode 100644 test cases/common/174 source in dep/generated/main.c create mode 100644 test cases/common/174 source in dep/generated/meson.build create mode 100644 test cases/common/174 source in dep/meson.build create mode 100644 test cases/common/175 generator link whole/export.h create mode 100755 test cases/common/175 generator link whole/generator.py create mode 100644 test cases/common/175 generator link whole/main.c create mode 100644 test cases/common/175 generator link whole/meson.build create mode 100644 test cases/common/175 generator link whole/meson_test_function.tmpl create mode 100644 test cases/common/175 generator link whole/pull_meson_test_function.c delete mode 100644 test cases/common/175 source in dep/bar.cpp delete mode 100644 test cases/common/175 source in dep/foo.c delete mode 100644 test cases/common/175 source in dep/generated/funname delete mode 100755 test cases/common/175 source in dep/generated/genheader.py delete mode 100644 test cases/common/175 source in dep/generated/main.c delete mode 100644 test cases/common/175 source in dep/generated/meson.build delete mode 100644 test cases/common/175 source in dep/meson.build delete mode 100644 test cases/common/176 generator link whole/export.h delete mode 100755 test cases/common/176 generator link whole/generator.py delete mode 100644 test cases/common/176 generator link whole/main.c delete mode 100644 test cases/common/176 generator link whole/meson.build delete mode 100644 test cases/common/176 generator link whole/meson_test_function.tmpl delete mode 100644 test cases/common/176 generator link whole/pull_meson_test_function.c create mode 100644 test cases/common/176 initial c_args/meson.build create mode 100644 test cases/common/176 initial c_args/test_args.txt create mode 100644 test cases/common/177 identical target name in subproject flat layout/foo.c create mode 100644 test cases/common/177 identical target name in subproject flat layout/main.c create mode 100644 test cases/common/177 identical target name in subproject flat layout/meson.build create mode 100644 test cases/common/177 identical target name in subproject flat layout/subprojects/subproj/foo.c create mode 100644 test cases/common/177 identical target name in subproject flat layout/subprojects/subproj/meson.build delete mode 100644 test cases/common/177 initial c_args/meson.build delete mode 100644 test cases/common/177 initial c_args/test_args.txt create mode 100644 test cases/common/178 as-needed/config.h create mode 100644 test cases/common/178 as-needed/libA.cpp create mode 100644 test cases/common/178 as-needed/libA.h create mode 100644 test cases/common/178 as-needed/libB.cpp create mode 100644 test cases/common/178 as-needed/main.cpp create mode 100644 test cases/common/178 as-needed/meson.build delete mode 100644 test cases/common/178 identical target name in subproject flat layout/foo.c delete mode 100644 test cases/common/178 identical target name in subproject flat layout/main.c delete mode 100644 test cases/common/178 identical target name in subproject flat layout/meson.build delete mode 100644 test cases/common/178 identical target name in subproject flat layout/subprojects/subproj/foo.c delete mode 100644 test cases/common/178 identical target name in subproject flat layout/subprojects/subproj/meson.build delete mode 100644 test cases/common/179 as-needed/config.h delete mode 100644 test cases/common/179 as-needed/libA.cpp delete mode 100644 test cases/common/179 as-needed/libA.h delete mode 100644 test cases/common/179 as-needed/libB.cpp delete mode 100644 test cases/common/179 as-needed/main.cpp delete mode 100644 test cases/common/179 as-needed/meson.build create mode 100644 test cases/common/179 ndebug if-release enabled/main.c create mode 100644 test cases/common/179 ndebug if-release enabled/meson.build create mode 100644 test cases/common/180 ndebug if-release disabled/main.c create mode 100644 test cases/common/180 ndebug if-release disabled/meson.build delete mode 100644 test cases/common/180 ndebug if-release enabled/main.c delete mode 100644 test cases/common/180 ndebug if-release enabled/meson.build delete mode 100644 test cases/common/181 ndebug if-release disabled/main.c delete mode 100644 test cases/common/181 ndebug if-release disabled/meson.build create mode 100644 test cases/common/181 subproject version/meson.build create mode 100644 test cases/common/181 subproject version/subprojects/a/meson.build create mode 100644 test cases/common/182 subdir_done/meson.build delete mode 100644 test cases/common/182 subproject version/meson.build delete mode 100644 test cases/common/182 subproject version/subprojects/a/meson.build create mode 100644 test cases/common/183 bothlibraries/libfile.c create mode 100644 test cases/common/183 bothlibraries/main.c create mode 100644 test cases/common/183 bothlibraries/meson.build create mode 100644 test cases/common/183 bothlibraries/mylib.h delete mode 100644 test cases/common/183 subdir_done/meson.build delete mode 100644 test cases/common/184 bothlibraries/libfile.c delete mode 100644 test cases/common/184 bothlibraries/main.c delete mode 100644 test cases/common/184 bothlibraries/meson.build delete mode 100644 test cases/common/184 bothlibraries/mylib.h create mode 100644 test cases/common/184 escape and unicode/file.c.in create mode 100644 test cases/common/184 escape and unicode/file.py create mode 100644 test cases/common/184 escape and unicode/find.py create mode 100644 test cases/common/184 escape and unicode/fun.c create mode 100644 test cases/common/184 escape and unicode/main.c create mode 100644 test cases/common/184 escape and unicode/meson.build delete mode 100644 test cases/common/185 escape and unicode/file.c.in delete mode 100644 test cases/common/185 escape and unicode/file.py delete mode 100644 test cases/common/185 escape and unicode/find.py delete mode 100644 test cases/common/185 escape and unicode/fun.c delete mode 100644 test cases/common/185 escape and unicode/main.c delete mode 100644 test cases/common/185 escape and unicode/meson.build create mode 100644 test cases/common/185 has link arg/meson.build delete mode 100644 test cases/common/186 has link arg/meson.build create mode 100644 test cases/common/186 same target name flat layout/foo.c create mode 100644 test cases/common/186 same target name flat layout/main.c create mode 100644 test cases/common/186 same target name flat layout/meson.build create mode 100644 test cases/common/186 same target name flat layout/subdir/foo.c create mode 100644 test cases/common/186 same target name flat layout/subdir/meson.build create mode 100644 test cases/common/187 find override/meson.build create mode 100644 test cases/common/187 find override/otherdir/main.c create mode 100644 test cases/common/187 find override/otherdir/main2.c create mode 100644 test cases/common/187 find override/otherdir/meson.build create mode 100644 test cases/common/187 find override/otherdir/source.desc create mode 100644 test cases/common/187 find override/otherdir/source2.desc create mode 100755 test cases/common/187 find override/subdir/converter.py create mode 100755 test cases/common/187 find override/subdir/gencodegen.py.in create mode 100644 test cases/common/187 find override/subdir/meson.build delete mode 100644 test cases/common/187 same target name flat layout/foo.c delete mode 100644 test cases/common/187 same target name flat layout/main.c delete mode 100644 test cases/common/187 same target name flat layout/meson.build delete mode 100644 test cases/common/187 same target name flat layout/subdir/foo.c delete mode 100644 test cases/common/187 same target name flat layout/subdir/meson.build delete mode 100644 test cases/common/188 find override/meson.build delete mode 100644 test cases/common/188 find override/otherdir/main.c delete mode 100644 test cases/common/188 find override/otherdir/main2.c delete mode 100644 test cases/common/188 find override/otherdir/meson.build delete mode 100644 test cases/common/188 find override/otherdir/source.desc delete mode 100644 test cases/common/188 find override/otherdir/source2.desc delete mode 100755 test cases/common/188 find override/subdir/converter.py delete mode 100755 test cases/common/188 find override/subdir/gencodegen.py.in delete mode 100644 test cases/common/188 find override/subdir/meson.build create mode 100644 test cases/common/188 partial dependency/declare_dependency/headers/foo.c create mode 100644 test cases/common/188 partial dependency/declare_dependency/headers/foo.h create mode 100644 test cases/common/188 partial dependency/declare_dependency/main.c create mode 100644 test cases/common/188 partial dependency/declare_dependency/meson.build create mode 100644 test cases/common/188 partial dependency/declare_dependency/other.c create mode 100644 test cases/common/188 partial dependency/meson.build create mode 100644 test cases/common/189 openmp/main.c create mode 100644 test cases/common/189 openmp/main.cpp create mode 100644 test cases/common/189 openmp/main.f90 create mode 100644 test cases/common/189 openmp/meson.build delete mode 100644 test cases/common/189 partial dependency/declare_dependency/headers/foo.c delete mode 100644 test cases/common/189 partial dependency/declare_dependency/headers/foo.h delete mode 100644 test cases/common/189 partial dependency/declare_dependency/main.c delete mode 100644 test cases/common/189 partial dependency/declare_dependency/meson.build delete mode 100644 test cases/common/189 partial dependency/declare_dependency/other.c delete mode 100644 test cases/common/189 partial dependency/meson.build delete mode 100644 test cases/common/190 openmp/main.c delete mode 100644 test cases/common/190 openmp/main.cpp delete mode 100644 test cases/common/190 openmp/main.f90 delete mode 100644 test cases/common/190 openmp/meson.build create mode 100644 test cases/common/190 same target name/file.c create mode 100644 test cases/common/190 same target name/meson.build create mode 100644 test cases/common/190 same target name/sub/file2.c create mode 100644 test cases/common/190 same target name/sub/meson.build delete mode 100644 test cases/common/191 same target name/file.c delete mode 100644 test cases/common/191 same target name/meson.build delete mode 100644 test cases/common/191 same target name/sub/file2.c delete mode 100644 test cases/common/191 same target name/sub/meson.build create mode 100755 test cases/common/191 test depends/gen.py create mode 100644 test cases/common/191 test depends/main.c create mode 100644 test cases/common/191 test depends/meson.build create mode 100755 test cases/common/191 test depends/test.py create mode 100644 test cases/common/192 args flattening/meson.build delete mode 100755 test cases/common/192 test depends/gen.py delete mode 100644 test cases/common/192 test depends/main.c delete mode 100644 test cases/common/192 test depends/meson.build delete mode 100755 test cases/common/192 test depends/test.py delete mode 100644 test cases/common/193 args flattening/meson.build create mode 100644 test cases/common/193 dict/meson.build create mode 100644 test cases/common/193 dict/prog.c create mode 100644 test cases/common/194 check header/meson.build create mode 100644 test cases/common/194 check header/ouagadougou.h delete mode 100644 test cases/common/194 dict/meson.build delete mode 100644 test cases/common/194 dict/prog.c delete mode 100644 test cases/common/195 check header/meson.build delete mode 100644 test cases/common/195 check header/ouagadougou.h create mode 100644 test cases/common/195 install_mode/config.h.in create mode 100644 test cases/common/195 install_mode/data_source.txt create mode 100644 test cases/common/195 install_mode/foo.1 create mode 100644 test cases/common/195 install_mode/installed_files.txt create mode 100644 test cases/common/195 install_mode/meson.build create mode 100644 test cases/common/195 install_mode/rootdir.h create mode 100644 test cases/common/195 install_mode/runscript.sh create mode 100644 test cases/common/195 install_mode/stat.c create mode 100644 test cases/common/195 install_mode/sub1/second.dat create mode 100644 test cases/common/195 install_mode/sub2/stub create mode 100644 test cases/common/195 install_mode/trivial.c delete mode 100644 test cases/common/196 install_mode/config.h.in delete mode 100644 test cases/common/196 install_mode/data_source.txt delete mode 100644 test cases/common/196 install_mode/foo.1 delete mode 100644 test cases/common/196 install_mode/installed_files.txt delete mode 100644 test cases/common/196 install_mode/meson.build delete mode 100644 test cases/common/196 install_mode/rootdir.h delete mode 100644 test cases/common/196 install_mode/runscript.sh delete mode 100644 test cases/common/196 install_mode/stat.c delete mode 100644 test cases/common/196 install_mode/sub1/second.dat delete mode 100644 test cases/common/196 install_mode/sub2/stub delete mode 100644 test cases/common/196 install_mode/trivial.c create mode 100644 test cases/common/196 subproject array version/meson.build create mode 100644 test cases/common/196 subproject array version/subprojects/foo/meson.build create mode 100644 test cases/common/197 feature option/meson.build create mode 100644 test cases/common/197 feature option/meson_options.txt delete mode 100644 test cases/common/197 subproject array version/meson.build delete mode 100644 test cases/common/197 subproject array version/subprojects/foo/meson.build create mode 100644 test cases/common/198 feature option disabled/meson.build create mode 100644 test cases/common/198 feature option disabled/meson_options.txt delete mode 100644 test cases/common/198 feature option/meson.build delete mode 100644 test cases/common/198 feature option/meson_options.txt delete mode 100644 test cases/common/199 feature option disabled/meson.build delete mode 100644 test cases/common/199 feature option disabled/meson_options.txt create mode 100644 test cases/common/199 static threads/lib1.c create mode 100644 test cases/common/199 static threads/lib2.c create mode 100644 test cases/common/199 static threads/meson.build create mode 100644 test cases/common/199 static threads/prog.c create mode 100644 test cases/common/200 generator in subdir/com/mesonbuild/genprog.py create mode 100644 test cases/common/200 generator in subdir/com/mesonbuild/meson.build create mode 100644 test cases/common/200 generator in subdir/com/mesonbuild/subbie.inp create mode 100644 test cases/common/200 generator in subdir/com/mesonbuild/testprog.c create mode 100644 test cases/common/200 generator in subdir/meson.build delete mode 100644 test cases/common/200 static threads/lib1.c delete mode 100644 test cases/common/200 static threads/lib2.c delete mode 100644 test cases/common/200 static threads/meson.build delete mode 100644 test cases/common/200 static threads/prog.c delete mode 100644 test cases/common/201 generator in subdir/com/mesonbuild/genprog.py delete mode 100644 test cases/common/201 generator in subdir/com/mesonbuild/meson.build delete mode 100644 test cases/common/201 generator in subdir/com/mesonbuild/subbie.inp delete mode 100644 test cases/common/201 generator in subdir/com/mesonbuild/testprog.c delete mode 100644 test cases/common/201 generator in subdir/meson.build create mode 100644 test cases/common/201 override with exe/main2.input create mode 100644 test cases/common/201 override with exe/meson.build create mode 100644 test cases/common/201 override with exe/subprojects/sub/foobar.c create mode 100644 test cases/common/201 override with exe/subprojects/sub/meson.build delete mode 100644 test cases/common/202 override with exe/main2.input delete mode 100644 test cases/common/202 override with exe/meson.build delete mode 100644 test cases/common/202 override with exe/subprojects/sub/foobar.c delete mode 100644 test cases/common/202 override with exe/subprojects/sub/meson.build create mode 100644 test cases/common/202 subproject with features/meson.build create mode 100644 test cases/common/202 subproject with features/meson_options.txt create mode 100644 test cases/common/202 subproject with features/nothing.c create mode 100644 test cases/common/202 subproject with features/subprojects/auto_sub_with_missing_dep/meson.build create mode 100644 test cases/common/202 subproject with features/subprojects/disabled_sub/lib/meson.build create mode 100644 test cases/common/202 subproject with features/subprojects/disabled_sub/lib/sub.c create mode 100644 test cases/common/202 subproject with features/subprojects/disabled_sub/lib/sub.h create mode 100644 test cases/common/202 subproject with features/subprojects/disabled_sub/meson.build create mode 100644 test cases/common/202 subproject with features/subprojects/sub/lib/meson.build create mode 100644 test cases/common/202 subproject with features/subprojects/sub/lib/sub.c create mode 100644 test cases/common/202 subproject with features/subprojects/sub/lib/sub.h create mode 100644 test cases/common/202 subproject with features/subprojects/sub/meson.build create mode 100644 test cases/common/203 function attributes/meson.build delete mode 100644 test cases/common/203 subproject with features/meson.build delete mode 100644 test cases/common/203 subproject with features/meson_options.txt delete mode 100644 test cases/common/203 subproject with features/nothing.c delete mode 100644 test cases/common/203 subproject with features/subprojects/auto_sub_with_missing_dep/meson.build delete mode 100644 test cases/common/203 subproject with features/subprojects/disabled_sub/lib/meson.build delete mode 100644 test cases/common/203 subproject with features/subprojects/disabled_sub/lib/sub.c delete mode 100644 test cases/common/203 subproject with features/subprojects/disabled_sub/lib/sub.h delete mode 100644 test cases/common/203 subproject with features/subprojects/disabled_sub/meson.build delete mode 100644 test cases/common/203 subproject with features/subprojects/sub/lib/meson.build delete mode 100644 test cases/common/203 subproject with features/subprojects/sub/lib/sub.c delete mode 100644 test cases/common/203 subproject with features/subprojects/sub/lib/sub.h delete mode 100644 test cases/common/203 subproject with features/subprojects/sub/meson.build create mode 100644 test cases/common/204 broken subproject/meson.build create mode 100644 test cases/common/204 broken subproject/subprojects/broken/broken.c create mode 100644 test cases/common/204 broken subproject/subprojects/broken/meson.build delete mode 100644 test cases/common/204 function attributes/meson.build create mode 100644 test cases/common/205 argument syntax/meson.build delete mode 100644 test cases/common/205 broken subproject/meson.build delete mode 100644 test cases/common/205 broken subproject/subprojects/broken/broken.c delete mode 100644 test cases/common/205 broken subproject/subprojects/broken/meson.build delete mode 100644 test cases/common/206 argument syntax/meson.build create mode 100644 test cases/common/206 install name_prefix name_suffix/installed_files.txt create mode 100644 test cases/common/206 install name_prefix name_suffix/libfile.c create mode 100644 test cases/common/206 install name_prefix name_suffix/meson.build delete mode 100644 test cases/common/207 install name_prefix name_suffix/installed_files.txt delete mode 100644 test cases/common/207 install name_prefix name_suffix/libfile.c delete mode 100644 test cases/common/207 install name_prefix name_suffix/meson.build create mode 100644 test cases/common/207 kwarg entry/inc/prog.h create mode 100644 test cases/common/207 kwarg entry/installed_files.txt create mode 100644 test cases/common/207 kwarg entry/meson.build create mode 100644 test cases/common/207 kwarg entry/prog.c create mode 100644 test cases/common/208 custom target build by default/docgen.py create mode 100644 test cases/common/208 custom target build by default/installed_files.txt create mode 100644 test cases/common/208 custom target build by default/meson.build delete mode 100644 test cases/common/208 kwarg entry/inc/prog.h delete mode 100644 test cases/common/208 kwarg entry/installed_files.txt delete mode 100644 test cases/common/208 kwarg entry/meson.build delete mode 100644 test cases/common/208 kwarg entry/prog.c delete mode 100644 test cases/common/209 custom target build by default/docgen.py delete mode 100644 test cases/common/209 custom target build by default/installed_files.txt delete mode 100644 test cases/common/209 custom target build by default/meson.build create mode 100644 test cases/common/209 find_library and headers/foo.h create mode 100644 test cases/common/209 find_library and headers/meson.build delete mode 100644 test cases/common/210 find_library and headers/foo.h delete mode 100644 test cases/common/210 find_library and headers/meson.build create mode 100644 test cases/common/210 line continuation/meson.build create mode 100644 test cases/common/211 cmake module/cmake_project/CMakeLists.txt create mode 100644 test cases/common/211 cmake module/installed_files.txt create mode 100644 test cases/common/211 cmake module/meson.build create mode 100644 test cases/common/211 cmake module/projectConfig.cmake.in delete mode 100644 test cases/common/211 line continuation/meson.build delete mode 100644 test cases/common/212 cmake module/cmake_project/CMakeLists.txt delete mode 100644 test cases/common/212 cmake module/installed_files.txt delete mode 100644 test cases/common/212 cmake module/meson.build delete mode 100644 test cases/common/212 cmake module/projectConfig.cmake.in create mode 100644 test cases/common/212 native file path override/installed_files.txt create mode 100644 test cases/common/212 native file path override/main.cpp create mode 100644 test cases/common/212 native file path override/meson.build create mode 100644 test cases/common/212 native file path override/nativefile.ini delete mode 100644 test cases/common/213 native file path override/installed_files.txt delete mode 100644 test cases/common/213 native file path override/main.cpp delete mode 100644 test cases/common/213 native file path override/meson.build delete mode 100644 test cases/common/213 native file path override/nativefile.ini create mode 100644 test cases/common/213 tap tests/meson.build create mode 100644 test cases/common/213 tap tests/tester.c delete mode 100644 test cases/common/214 tap tests/meson.build delete mode 100644 test cases/common/214 tap tests/tester.c create mode 100644 test cases/common/214 warning level 0/main.cpp create mode 100644 test cases/common/214 warning level 0/meson.build create mode 100755 test cases/common/215 link custom/custom_stlib.py create mode 100644 test cases/common/215 link custom/meson.build create mode 100644 test cases/common/215 link custom/prog.c delete mode 100644 test cases/common/215 warning level 0/main.cpp delete mode 100644 test cases/common/215 warning level 0/meson.build delete mode 100755 test cases/common/216 link custom/custom_stlib.py delete mode 100644 test cases/common/216 link custom/meson.build delete mode 100644 test cases/common/216 link custom/prog.c create mode 100644 test cases/common/216 link custom_i single from multiple/generate_conflicting_stlibs.py create mode 100644 test cases/common/216 link custom_i single from multiple/meson.build create mode 100644 test cases/common/216 link custom_i single from multiple/prog.c create mode 100644 test cases/common/217 link custom_i multiple from multiple/generate_stlibs.py create mode 100644 test cases/common/217 link custom_i multiple from multiple/meson.build create mode 100644 test cases/common/217 link custom_i multiple from multiple/prog.c delete mode 100644 test cases/common/217 link custom_i single from multiple/generate_conflicting_stlibs.py delete mode 100644 test cases/common/217 link custom_i single from multiple/meson.build delete mode 100644 test cases/common/217 link custom_i single from multiple/prog.c create mode 100644 test cases/common/218 dependency get_variable method/meson.build delete mode 100644 test cases/common/218 link custom_i multiple from multiple/generate_stlibs.py delete mode 100644 test cases/common/218 link custom_i multiple from multiple/meson.build delete mode 100644 test cases/common/218 link custom_i multiple from multiple/prog.c delete mode 100644 test cases/common/219 dependency get_variable method/meson.build create mode 100644 test cases/common/219 source set configuration_data/a.c create mode 100644 test cases/common/219 source set configuration_data/all.h create mode 100644 test cases/common/219 source set configuration_data/f.c create mode 100644 test cases/common/219 source set configuration_data/g.c create mode 100644 test cases/common/219 source set configuration_data/meson.build create mode 100644 test cases/common/219 source set configuration_data/nope.c create mode 100644 test cases/common/219 source set configuration_data/subdir/b.c create mode 100644 test cases/common/219 source set configuration_data/subdir/meson.build delete mode 100644 test cases/common/220 source set configuration_data/a.c delete mode 100644 test cases/common/220 source set configuration_data/all.h delete mode 100644 test cases/common/220 source set configuration_data/f.c delete mode 100644 test cases/common/220 source set configuration_data/g.c delete mode 100644 test cases/common/220 source set configuration_data/meson.build delete mode 100644 test cases/common/220 source set configuration_data/nope.c delete mode 100644 test cases/common/220 source set configuration_data/subdir/b.c delete mode 100644 test cases/common/220 source set configuration_data/subdir/meson.build create mode 100644 test cases/common/220 source set dictionary/a.c create mode 100644 test cases/common/220 source set dictionary/all.h create mode 100644 test cases/common/220 source set dictionary/f.c create mode 100644 test cases/common/220 source set dictionary/g.c create mode 100644 test cases/common/220 source set dictionary/meson.build create mode 100644 test cases/common/220 source set dictionary/nope.c create mode 100644 test cases/common/220 source set dictionary/subdir/b.c create mode 100644 test cases/common/220 source set dictionary/subdir/meson.build create mode 100644 test cases/common/221 source set custom target/a.c create mode 100644 test cases/common/221 source set custom target/all.h create mode 100644 test cases/common/221 source set custom target/cp.py create mode 100644 test cases/common/221 source set custom target/f.c create mode 100644 test cases/common/221 source set custom target/g.c create mode 100644 test cases/common/221 source set custom target/meson.build delete mode 100644 test cases/common/221 source set dictionary/a.c delete mode 100644 test cases/common/221 source set dictionary/all.h delete mode 100644 test cases/common/221 source set dictionary/f.c delete mode 100644 test cases/common/221 source set dictionary/g.c delete mode 100644 test cases/common/221 source set dictionary/meson.build delete mode 100644 test cases/common/221 source set dictionary/nope.c delete mode 100644 test cases/common/221 source set dictionary/subdir/b.c delete mode 100644 test cases/common/221 source set dictionary/subdir/meson.build delete mode 100644 test cases/common/222 source set custom target/a.c delete mode 100644 test cases/common/222 source set custom target/all.h delete mode 100644 test cases/common/222 source set custom target/cp.py delete mode 100644 test cases/common/222 source set custom target/f.c delete mode 100644 test cases/common/222 source set custom target/g.c delete mode 100644 test cases/common/222 source set custom target/meson.build create mode 100644 test cases/common/222 source set realistic example/boards/arm/aarch64.cc create mode 100644 test cases/common/222 source set realistic example/boards/arm/arm.cc create mode 100644 test cases/common/222 source set realistic example/boards/arm/arm.h create mode 100644 test cases/common/222 source set realistic example/boards/arm/arm32.cc create mode 100644 test cases/common/222 source set realistic example/boards/arm/versatilepb.cc create mode 100644 test cases/common/222 source set realistic example/boards/arm/virt.cc create mode 100644 test cases/common/222 source set realistic example/boards/arm/xlnx_zcu102.cc create mode 100644 test cases/common/222 source set realistic example/boards/meson.build create mode 100644 test cases/common/222 source set realistic example/boards/x86/pc.cc create mode 100644 test cases/common/222 source set realistic example/common.h create mode 100644 test cases/common/222 source set realistic example/config/aarch64 create mode 100644 test cases/common/222 source set realistic example/config/arm create mode 100644 test cases/common/222 source set realistic example/config/x86 create mode 100644 test cases/common/222 source set realistic example/devices/meson.build create mode 100644 test cases/common/222 source set realistic example/devices/virtio-mmio.cc create mode 100644 test cases/common/222 source set realistic example/devices/virtio-pci.cc create mode 100644 test cases/common/222 source set realistic example/devices/virtio.cc create mode 100644 test cases/common/222 source set realistic example/devices/virtio.h create mode 100644 test cases/common/222 source set realistic example/main.cc create mode 100644 test cases/common/222 source set realistic example/meson.build create mode 100644 test cases/common/222 source set realistic example/not-found.cc create mode 100644 test cases/common/222 source set realistic example/was-found.cc create mode 100644 test cases/common/222 source set realistic example/zlib.cc delete mode 100644 test cases/common/223 source set realistic example/boards/arm/aarch64.cc delete mode 100644 test cases/common/223 source set realistic example/boards/arm/arm.cc delete mode 100644 test cases/common/223 source set realistic example/boards/arm/arm.h delete mode 100644 test cases/common/223 source set realistic example/boards/arm/arm32.cc delete mode 100644 test cases/common/223 source set realistic example/boards/arm/versatilepb.cc delete mode 100644 test cases/common/223 source set realistic example/boards/arm/virt.cc delete mode 100644 test cases/common/223 source set realistic example/boards/arm/xlnx_zcu102.cc delete mode 100644 test cases/common/223 source set realistic example/boards/meson.build delete mode 100644 test cases/common/223 source set realistic example/boards/x86/pc.cc delete mode 100644 test cases/common/223 source set realistic example/common.h delete mode 100644 test cases/common/223 source set realistic example/config/aarch64 delete mode 100644 test cases/common/223 source set realistic example/config/arm delete mode 100644 test cases/common/223 source set realistic example/config/x86 delete mode 100644 test cases/common/223 source set realistic example/devices/meson.build delete mode 100644 test cases/common/223 source set realistic example/devices/virtio-mmio.cc delete mode 100644 test cases/common/223 source set realistic example/devices/virtio-pci.cc delete mode 100644 test cases/common/223 source set realistic example/devices/virtio.cc delete mode 100644 test cases/common/223 source set realistic example/devices/virtio.h delete mode 100644 test cases/common/223 source set realistic example/main.cc delete mode 100644 test cases/common/223 source set realistic example/meson.build delete mode 100644 test cases/common/223 source set realistic example/not-found.cc delete mode 100644 test cases/common/223 source set realistic example/was-found.cc delete mode 100644 test cases/common/223 source set realistic example/zlib.cc create mode 100644 test cases/common/28 find program/meson.build create mode 100644 test cases/common/28 find program/print-version-with-prefix.py create mode 100644 test cases/common/28 find program/print-version.py create mode 100644 test cases/common/28 find program/source.in delete mode 100644 test cases/common/29 find program/meson.build delete mode 100644 test cases/common/29 find program/print-version-with-prefix.py delete mode 100644 test cases/common/29 find program/print-version.py delete mode 100644 test cases/common/29 find program/source.in create mode 100644 test cases/common/29 multiline string/meson.build delete mode 100644 test cases/common/30 multiline string/meson.build create mode 100644 test cases/common/30 try compile/invalid.c create mode 100644 test cases/common/30 try compile/meson.build create mode 100644 test cases/common/30 try compile/valid.c create mode 100644 test cases/common/31 compiler id/meson.build delete mode 100644 test cases/common/31 try compile/invalid.c delete mode 100644 test cases/common/31 try compile/meson.build delete mode 100644 test cases/common/31 try compile/valid.c delete mode 100644 test cases/common/32 compiler id/meson.build create mode 100644 test cases/common/32 sizeof/config.h.in create mode 100644 test cases/common/32 sizeof/meson.build create mode 100644 test cases/common/32 sizeof/prog.c.in create mode 100644 test cases/common/33 define10/config.h.in create mode 100644 test cases/common/33 define10/meson.build create mode 100644 test cases/common/33 define10/prog.c delete mode 100644 test cases/common/33 sizeof/config.h.in delete mode 100644 test cases/common/33 sizeof/meson.build delete mode 100644 test cases/common/33 sizeof/prog.c.in delete mode 100644 test cases/common/34 define10/config.h.in delete mode 100644 test cases/common/34 define10/meson.build delete mode 100644 test cases/common/34 define10/prog.c create mode 100644 test cases/common/34 has header/meson.build create mode 100644 test cases/common/34 has header/ouagadougou.h delete mode 100644 test cases/common/35 has header/meson.build delete mode 100644 test cases/common/35 has header/ouagadougou.h create mode 100644 test cases/common/35 run program/get-version.py create mode 100644 test cases/common/35 run program/meson.build create mode 100644 test cases/common/35 run program/scripts/hello.bat create mode 100755 test cases/common/35 run program/scripts/hello.sh delete mode 100644 test cases/common/36 run program/get-version.py delete mode 100644 test cases/common/36 run program/meson.build delete mode 100644 test cases/common/36 run program/scripts/hello.bat delete mode 100755 test cases/common/36 run program/scripts/hello.sh create mode 100644 test cases/common/36 tryrun/error.c create mode 100644 test cases/common/36 tryrun/meson.build create mode 100644 test cases/common/36 tryrun/no_compile.c create mode 100644 test cases/common/36 tryrun/ok.c create mode 100644 test cases/common/37 logic ops/meson.build delete mode 100644 test cases/common/37 tryrun/error.c delete mode 100644 test cases/common/37 tryrun/meson.build delete mode 100644 test cases/common/37 tryrun/no_compile.c delete mode 100644 test cases/common/37 tryrun/ok.c delete mode 100644 test cases/common/38 logic ops/meson.build create mode 100644 test cases/common/38 string operations/meson.build create mode 100644 test cases/common/39 has function/meson.build delete mode 100644 test cases/common/39 string operations/meson.build delete mode 100644 test cases/common/40 has function/meson.build create mode 100644 test cases/common/40 has member/meson.build create mode 100644 test cases/common/41 alignment/meson.build delete mode 100644 test cases/common/41 has member/meson.build delete mode 100644 test cases/common/42 alignment/meson.build create mode 100644 test cases/common/42 library chain/installed_files.txt create mode 100644 test cases/common/42 library chain/main.c create mode 100644 test cases/common/42 library chain/meson.build create mode 100644 test cases/common/42 library chain/subdir/lib1.c create mode 100644 test cases/common/42 library chain/subdir/meson.build create mode 100644 test cases/common/42 library chain/subdir/subdir2/lib2.c create mode 100644 test cases/common/42 library chain/subdir/subdir2/meson.build create mode 100644 test cases/common/42 library chain/subdir/subdir3/lib3.c create mode 100644 test cases/common/42 library chain/subdir/subdir3/meson.build delete mode 100644 test cases/common/43 library chain/installed_files.txt delete mode 100644 test cases/common/43 library chain/main.c delete mode 100644 test cases/common/43 library chain/meson.build delete mode 100644 test cases/common/43 library chain/subdir/lib1.c delete mode 100644 test cases/common/43 library chain/subdir/meson.build delete mode 100644 test cases/common/43 library chain/subdir/subdir2/lib2.c delete mode 100644 test cases/common/43 library chain/subdir/subdir2/meson.build delete mode 100644 test cases/common/43 library chain/subdir/subdir3/lib3.c delete mode 100644 test cases/common/43 library chain/subdir/subdir3/meson.build create mode 100644 test cases/common/43 options/meson.build create mode 100644 test cases/common/43 options/meson_options.txt delete mode 100644 test cases/common/44 options/meson.build delete mode 100644 test cases/common/44 options/meson_options.txt create mode 100644 test cases/common/44 test args/cmd_args.c create mode 100644 test cases/common/44 test args/copyfile.py create mode 100644 test cases/common/44 test args/env2vars.c create mode 100644 test cases/common/44 test args/envvars.c create mode 100644 test cases/common/44 test args/meson.build create mode 100644 test cases/common/44 test args/tester.c create mode 100755 test cases/common/44 test args/tester.py create mode 100644 test cases/common/44 test args/testfile.txt create mode 100644 test cases/common/45 subproject/installed_files.txt create mode 100644 test cases/common/45 subproject/meson.build create mode 100644 test cases/common/45 subproject/subprojects/sublib/include/subdefs.h create mode 100644 test cases/common/45 subproject/subprojects/sublib/meson.build create mode 100644 test cases/common/45 subproject/subprojects/sublib/simpletest.c create mode 100644 test cases/common/45 subproject/subprojects/sublib/sublib.c create mode 100644 test cases/common/45 subproject/user.c delete mode 100644 test cases/common/45 test args/cmd_args.c delete mode 100644 test cases/common/45 test args/copyfile.py delete mode 100644 test cases/common/45 test args/env2vars.c delete mode 100644 test cases/common/45 test args/envvars.c delete mode 100644 test cases/common/45 test args/meson.build delete mode 100644 test cases/common/45 test args/tester.c delete mode 100755 test cases/common/45 test args/tester.py delete mode 100644 test cases/common/45 test args/testfile.txt create mode 100644 test cases/common/46 subproject options/meson.build create mode 100644 test cases/common/46 subproject options/meson_options.txt create mode 100644 test cases/common/46 subproject options/subprojects/subproject/meson.build create mode 100644 test cases/common/46 subproject options/subprojects/subproject/meson_options.txt delete mode 100644 test cases/common/46 subproject/installed_files.txt delete mode 100644 test cases/common/46 subproject/meson.build delete mode 100644 test cases/common/46 subproject/subprojects/sublib/include/subdefs.h delete mode 100644 test cases/common/46 subproject/subprojects/sublib/meson.build delete mode 100644 test cases/common/46 subproject/subprojects/sublib/simpletest.c delete mode 100644 test cases/common/46 subproject/subprojects/sublib/sublib.c delete mode 100644 test cases/common/46 subproject/user.c create mode 100644 test cases/common/47 pkgconfig-gen/dependencies/custom.c create mode 100644 test cases/common/47 pkgconfig-gen/dependencies/exposed.c create mode 100644 test cases/common/47 pkgconfig-gen/dependencies/internal.c create mode 100644 test cases/common/47 pkgconfig-gen/dependencies/meson.build create mode 100644 test cases/common/47 pkgconfig-gen/installed_files.txt create mode 100644 test cases/common/47 pkgconfig-gen/meson.build create mode 100644 test cases/common/47 pkgconfig-gen/simple.c create mode 100644 test cases/common/47 pkgconfig-gen/simple.h delete mode 100644 test cases/common/47 subproject options/meson.build delete mode 100644 test cases/common/47 subproject options/meson_options.txt delete mode 100644 test cases/common/47 subproject options/subprojects/subproject/meson.build delete mode 100644 test cases/common/47 subproject options/subprojects/subproject/meson_options.txt create mode 100644 test cases/common/48 custom install dirs/datafile.cat create mode 100644 test cases/common/48 custom install dirs/installed_files.txt create mode 100644 test cases/common/48 custom install dirs/meson.build create mode 100644 test cases/common/48 custom install dirs/prog.1 create mode 100644 test cases/common/48 custom install dirs/prog.c create mode 100644 test cases/common/48 custom install dirs/sample.h create mode 100644 test cases/common/48 custom install dirs/subdir/datafile.dog delete mode 100644 test cases/common/48 pkgconfig-gen/dependencies/custom.c delete mode 100644 test cases/common/48 pkgconfig-gen/dependencies/exposed.c delete mode 100644 test cases/common/48 pkgconfig-gen/dependencies/internal.c delete mode 100644 test cases/common/48 pkgconfig-gen/dependencies/meson.build delete mode 100644 test cases/common/48 pkgconfig-gen/installed_files.txt delete mode 100644 test cases/common/48 pkgconfig-gen/meson.build delete mode 100644 test cases/common/48 pkgconfig-gen/simple.c delete mode 100644 test cases/common/48 pkgconfig-gen/simple.h delete mode 100644 test cases/common/49 custom install dirs/datafile.cat delete mode 100644 test cases/common/49 custom install dirs/installed_files.txt delete mode 100644 test cases/common/49 custom install dirs/meson.build delete mode 100644 test cases/common/49 custom install dirs/prog.1 delete mode 100644 test cases/common/49 custom install dirs/prog.c delete mode 100644 test cases/common/49 custom install dirs/sample.h delete mode 100644 test cases/common/49 custom install dirs/subdir/datafile.dog create mode 100644 test cases/common/49 subproject subproject/meson.build create mode 100644 test cases/common/49 subproject subproject/prog.c create mode 100644 test cases/common/49 subproject subproject/subprojects/a/a.c create mode 100644 test cases/common/49 subproject subproject/subprojects/a/meson.build create mode 100644 test cases/common/49 subproject subproject/subprojects/b/b.c create mode 100644 test cases/common/49 subproject subproject/subprojects/b/meson.build create mode 100644 test cases/common/49 subproject subproject/subprojects/c/meson.build create mode 100644 test cases/common/50 same file name/d1/file.c create mode 100644 test cases/common/50 same file name/d2/file.c create mode 100644 test cases/common/50 same file name/meson.build create mode 100644 test cases/common/50 same file name/prog.c delete mode 100644 test cases/common/50 subproject subproject/meson.build delete mode 100644 test cases/common/50 subproject subproject/prog.c delete mode 100644 test cases/common/50 subproject subproject/subprojects/a/a.c delete mode 100644 test cases/common/50 subproject subproject/subprojects/a/meson.build delete mode 100644 test cases/common/50 subproject subproject/subprojects/b/b.c delete mode 100644 test cases/common/50 subproject subproject/subprojects/b/meson.build delete mode 100644 test cases/common/50 subproject subproject/subprojects/c/meson.build create mode 100644 test cases/common/51 file grabber/a.c create mode 100644 test cases/common/51 file grabber/b.c create mode 100644 test cases/common/51 file grabber/c.c create mode 100644 test cases/common/51 file grabber/grabber.bat create mode 100755 test cases/common/51 file grabber/grabber.sh create mode 100644 test cases/common/51 file grabber/grabber2.bat create mode 100644 test cases/common/51 file grabber/meson.build create mode 100644 test cases/common/51 file grabber/prog.c create mode 100644 test cases/common/51 file grabber/subdir/meson.build create mode 100644 test cases/common/51 file grabber/subdir/suba.c create mode 100644 test cases/common/51 file grabber/subdir/subb.c create mode 100644 test cases/common/51 file grabber/subdir/subc.c create mode 100644 test cases/common/51 file grabber/subdir/subprog.c delete mode 100644 test cases/common/51 same file name/d1/file.c delete mode 100644 test cases/common/51 same file name/d2/file.c delete mode 100644 test cases/common/51 same file name/meson.build delete mode 100644 test cases/common/51 same file name/prog.c create mode 100644 test cases/common/52 custom target/data_source.txt create mode 100755 test cases/common/52 custom target/depfile/dep.py create mode 100644 test cases/common/52 custom target/depfile/meson.build create mode 100644 test cases/common/52 custom target/installed_files.txt create mode 100644 test cases/common/52 custom target/meson.build create mode 100755 test cases/common/52 custom target/my_compiler.py delete mode 100644 test cases/common/52 file grabber/a.c delete mode 100644 test cases/common/52 file grabber/b.c delete mode 100644 test cases/common/52 file grabber/c.c delete mode 100644 test cases/common/52 file grabber/grabber.bat delete mode 100755 test cases/common/52 file grabber/grabber.sh delete mode 100644 test cases/common/52 file grabber/grabber2.bat delete mode 100644 test cases/common/52 file grabber/meson.build delete mode 100644 test cases/common/52 file grabber/prog.c delete mode 100644 test cases/common/52 file grabber/subdir/meson.build delete mode 100644 test cases/common/52 file grabber/subdir/suba.c delete mode 100644 test cases/common/52 file grabber/subdir/subb.c delete mode 100644 test cases/common/52 file grabber/subdir/subc.c delete mode 100644 test cases/common/52 file grabber/subdir/subprog.c create mode 100644 test cases/common/53 custom target chain/data_source.txt create mode 100644 test cases/common/53 custom target chain/installed_files.txt create mode 100644 test cases/common/53 custom target chain/meson.build create mode 100755 test cases/common/53 custom target chain/my_compiler.py create mode 100755 test cases/common/53 custom target chain/my_compiler2.py create mode 100644 test cases/common/53 custom target chain/usetarget/meson.build create mode 100644 test cases/common/53 custom target chain/usetarget/myexe.c create mode 100755 test cases/common/53 custom target chain/usetarget/subcomp.py delete mode 100644 test cases/common/53 custom target/data_source.txt delete mode 100755 test cases/common/53 custom target/depfile/dep.py delete mode 100644 test cases/common/53 custom target/depfile/meson.build delete mode 100644 test cases/common/53 custom target/installed_files.txt delete mode 100644 test cases/common/53 custom target/meson.build delete mode 100755 test cases/common/53 custom target/my_compiler.py delete mode 100644 test cases/common/54 custom target chain/data_source.txt delete mode 100644 test cases/common/54 custom target chain/installed_files.txt delete mode 100644 test cases/common/54 custom target chain/meson.build delete mode 100755 test cases/common/54 custom target chain/my_compiler.py delete mode 100755 test cases/common/54 custom target chain/my_compiler2.py delete mode 100644 test cases/common/54 custom target chain/usetarget/meson.build delete mode 100644 test cases/common/54 custom target chain/usetarget/myexe.c delete mode 100755 test cases/common/54 custom target chain/usetarget/subcomp.py create mode 100755 test cases/common/54 run target/check_exists.py create mode 100755 test cases/common/54 run target/configure.in create mode 100644 test cases/common/54 run target/converter.py create mode 100755 test cases/common/54 run target/fakeburner.py create mode 100644 test cases/common/54 run target/helloprinter.c create mode 100644 test cases/common/54 run target/meson.build create mode 100755 test cases/common/54 run target/scripts/script.sh create mode 100644 test cases/common/55 object generator/meson.build create mode 100755 test cases/common/55 object generator/obj_generator.py create mode 100644 test cases/common/55 object generator/prog.c create mode 100644 test cases/common/55 object generator/source.c create mode 100644 test cases/common/55 object generator/source2.c create mode 100644 test cases/common/55 object generator/source3.c delete mode 100755 test cases/common/55 run target/check_exists.py delete mode 100755 test cases/common/55 run target/configure.in delete mode 100644 test cases/common/55 run target/converter.py delete mode 100755 test cases/common/55 run target/fakeburner.py delete mode 100644 test cases/common/55 run target/helloprinter.c delete mode 100644 test cases/common/55 run target/meson.build delete mode 100755 test cases/common/55 run target/scripts/script.sh create mode 100644 test cases/common/56 install script/installed_files.txt create mode 100644 test cases/common/56 install script/meson.build create mode 100644 test cases/common/56 install script/myinstall.py create mode 100644 test cases/common/56 install script/no-installed-files create mode 100644 test cases/common/56 install script/prog.c create mode 100644 test cases/common/56 install script/src/meson.build create mode 100644 test cases/common/56 install script/src/myinstall.py delete mode 100644 test cases/common/56 object generator/meson.build delete mode 100755 test cases/common/56 object generator/obj_generator.py delete mode 100644 test cases/common/56 object generator/prog.c delete mode 100644 test cases/common/56 object generator/source.c delete mode 100644 test cases/common/56 object generator/source2.c delete mode 100644 test cases/common/56 object generator/source3.c create mode 100755 test cases/common/57 custom target source output/generator.py create mode 100644 test cases/common/57 custom target source output/main.c create mode 100644 test cases/common/57 custom target source output/meson.build delete mode 100644 test cases/common/57 install script/installed_files.txt delete mode 100644 test cases/common/57 install script/meson.build delete mode 100644 test cases/common/57 install script/myinstall.py delete mode 100644 test cases/common/57 install script/no-installed-files delete mode 100644 test cases/common/57 install script/prog.c delete mode 100644 test cases/common/57 install script/src/meson.build delete mode 100644 test cases/common/57 install script/src/myinstall.py delete mode 100755 test cases/common/58 custom target source output/generator.py delete mode 100644 test cases/common/58 custom target source output/main.c delete mode 100644 test cases/common/58 custom target source output/meson.build create mode 100644 test cases/common/58 exe static shared/meson.build create mode 100644 test cases/common/58 exe static shared/prog.c create mode 100644 test cases/common/58 exe static shared/shlib2.c create mode 100644 test cases/common/58 exe static shared/stat.c create mode 100644 test cases/common/58 exe static shared/stat2.c create mode 100644 test cases/common/58 exe static shared/subdir/exports.h create mode 100644 test cases/common/58 exe static shared/subdir/meson.build create mode 100644 test cases/common/58 exe static shared/subdir/shlib.c create mode 100644 test cases/common/59 array methods/meson.build delete mode 100644 test cases/common/59 exe static shared/meson.build delete mode 100644 test cases/common/59 exe static shared/prog.c delete mode 100644 test cases/common/59 exe static shared/shlib2.c delete mode 100644 test cases/common/59 exe static shared/stat.c delete mode 100644 test cases/common/59 exe static shared/stat2.c delete mode 100644 test cases/common/59 exe static shared/subdir/exports.h delete mode 100644 test cases/common/59 exe static shared/subdir/meson.build delete mode 100644 test cases/common/59 exe static shared/subdir/shlib.c delete mode 100644 test cases/common/60 array methods/meson.build create mode 100644 test cases/common/60 custom header generator/input.def create mode 100644 test cases/common/60 custom header generator/makeheader.py create mode 100644 test cases/common/60 custom header generator/meson.build create mode 100644 test cases/common/60 custom header generator/prog.c create mode 100644 test cases/common/60 custom header generator/somefile.txt delete mode 100644 test cases/common/61 custom header generator/input.def delete mode 100644 test cases/common/61 custom header generator/makeheader.py delete mode 100644 test cases/common/61 custom header generator/meson.build delete mode 100644 test cases/common/61 custom header generator/prog.c delete mode 100644 test cases/common/61 custom header generator/somefile.txt create mode 100644 test cases/common/61 multiple generators/data2.dat create mode 100644 test cases/common/61 multiple generators/main.cpp create mode 100644 test cases/common/61 multiple generators/meson.build create mode 100755 test cases/common/61 multiple generators/mygen.py create mode 100644 test cases/common/61 multiple generators/subdir/data.dat create mode 100644 test cases/common/61 multiple generators/subdir/meson.build create mode 100644 test cases/common/62 install subdir/installed_files.txt create mode 100644 test cases/common/62 install subdir/meson.build create mode 100644 test cases/common/62 install subdir/nested_elided/sub/dircheck/nineth.dat create mode 100644 test cases/common/62 install subdir/nested_elided/sub/eighth.dat create mode 100644 test cases/common/62 install subdir/sub/sub1/third.dat create mode 100644 test cases/common/62 install subdir/sub1/second.dat create mode 100644 test cases/common/62 install subdir/sub2/dircheck/excluded-three.dat create mode 100644 test cases/common/62 install subdir/sub2/excluded-three.dat create mode 100644 test cases/common/62 install subdir/sub2/excluded/two.dat create mode 100644 test cases/common/62 install subdir/sub2/one.dat create mode 100644 test cases/common/62 install subdir/sub_elided/dircheck/fifth.dat create mode 100644 test cases/common/62 install subdir/sub_elided/fourth.dat create mode 100644 test cases/common/62 install subdir/subdir/meson.build create mode 100644 test cases/common/62 install subdir/subdir/sub1/data1.dat create mode 100644 test cases/common/62 install subdir/subdir/sub1/sub2/data2.dat create mode 100644 test cases/common/62 install subdir/subdir/sub_elided/dircheck/seventh.dat create mode 100644 test cases/common/62 install subdir/subdir/sub_elided/sixth.dat delete mode 100644 test cases/common/62 multiple generators/data2.dat delete mode 100644 test cases/common/62 multiple generators/main.cpp delete mode 100644 test cases/common/62 multiple generators/meson.build delete mode 100755 test cases/common/62 multiple generators/mygen.py delete mode 100644 test cases/common/62 multiple generators/subdir/data.dat delete mode 100644 test cases/common/62 multiple generators/subdir/meson.build create mode 100644 test cases/common/63 foreach/installed_files.txt create mode 100644 test cases/common/63 foreach/meson.build create mode 100644 test cases/common/63 foreach/prog1.c create mode 100644 test cases/common/63 foreach/prog2.c create mode 100644 test cases/common/63 foreach/prog3.c delete mode 100644 test cases/common/63 install subdir/installed_files.txt delete mode 100644 test cases/common/63 install subdir/meson.build delete mode 100644 test cases/common/63 install subdir/nested_elided/sub/dircheck/nineth.dat delete mode 100644 test cases/common/63 install subdir/nested_elided/sub/eighth.dat delete mode 100644 test cases/common/63 install subdir/sub/sub1/third.dat delete mode 100644 test cases/common/63 install subdir/sub1/second.dat delete mode 100644 test cases/common/63 install subdir/sub2/dircheck/excluded-three.dat delete mode 100644 test cases/common/63 install subdir/sub2/excluded-three.dat delete mode 100644 test cases/common/63 install subdir/sub2/excluded/two.dat delete mode 100644 test cases/common/63 install subdir/sub2/one.dat delete mode 100644 test cases/common/63 install subdir/sub_elided/dircheck/fifth.dat delete mode 100644 test cases/common/63 install subdir/sub_elided/fourth.dat delete mode 100644 test cases/common/63 install subdir/subdir/meson.build delete mode 100644 test cases/common/63 install subdir/subdir/sub1/data1.dat delete mode 100644 test cases/common/63 install subdir/subdir/sub1/sub2/data2.dat delete mode 100644 test cases/common/63 install subdir/subdir/sub_elided/dircheck/seventh.dat delete mode 100644 test cases/common/63 install subdir/subdir/sub_elided/sixth.dat delete mode 100644 test cases/common/64 foreach/installed_files.txt delete mode 100644 test cases/common/64 foreach/meson.build delete mode 100644 test cases/common/64 foreach/prog1.c delete mode 100644 test cases/common/64 foreach/prog2.c delete mode 100644 test cases/common/64 foreach/prog3.c create mode 100644 test cases/common/64 number arithmetic/meson.build delete mode 100644 test cases/common/65 number arithmetic/meson.build create mode 100644 test cases/common/65 string arithmetic/meson.build create mode 100644 test cases/common/66 array arithmetic/meson.build delete mode 100644 test cases/common/66 string arithmetic/meson.build create mode 100644 test cases/common/67 arithmetic bidmas/meson.build delete mode 100644 test cases/common/67 array arithmetic/meson.build delete mode 100644 test cases/common/68 arithmetic bidmas/meson.build create mode 100644 test cases/common/68 build always/main.c create mode 100644 test cases/common/68 build always/meson.build create mode 100644 test cases/common/68 build always/version.c.in create mode 100644 test cases/common/68 build always/version.h create mode 100755 test cases/common/68 build always/version_gen.py delete mode 100644 test cases/common/69 build always/main.c delete mode 100644 test cases/common/69 build always/meson.build delete mode 100644 test cases/common/69 build always/version.c.in delete mode 100644 test cases/common/69 build always/version.h delete mode 100755 test cases/common/69 build always/version_gen.py create mode 100644 test cases/common/69 vcstag/meson.build create mode 100644 test cases/common/69 vcstag/tagprog.c create mode 100644 test cases/common/69 vcstag/vcstag.c.in create mode 100644 test cases/common/70 modules/meson.build delete mode 100644 test cases/common/70 vcstag/meson.build delete mode 100644 test cases/common/70 vcstag/tagprog.c delete mode 100644 test cases/common/70 vcstag/vcstag.c.in delete mode 100644 test cases/common/71 modules/meson.build create mode 100644 test cases/common/71 should fail/failing.c create mode 100644 test cases/common/71 should fail/meson.build create mode 100644 test cases/common/72 configure file in custom target/inc/confdata.in create mode 100644 test cases/common/72 configure file in custom target/inc/meson.build create mode 100644 test cases/common/72 configure file in custom target/meson.build create mode 100644 test cases/common/72 configure file in custom target/src/meson.build create mode 100644 test cases/common/72 configure file in custom target/src/mycompiler.py delete mode 100644 test cases/common/72 should fail/failing.c delete mode 100644 test cases/common/72 should fail/meson.build delete mode 100644 test cases/common/73 configure file in custom target/inc/confdata.in delete mode 100644 test cases/common/73 configure file in custom target/inc/meson.build delete mode 100644 test cases/common/73 configure file in custom target/meson.build delete mode 100644 test cases/common/73 configure file in custom target/src/meson.build delete mode 100644 test cases/common/73 configure file in custom target/src/mycompiler.py create mode 100644 test cases/common/73 external test program/meson.build create mode 100755 test cases/common/73 external test program/mytest.py create mode 100755 test cases/common/74 ctarget dependency/gen1.py create mode 100755 test cases/common/74 ctarget dependency/gen2.py create mode 100644 test cases/common/74 ctarget dependency/input.dat create mode 100644 test cases/common/74 ctarget dependency/meson.build delete mode 100644 test cases/common/74 external test program/meson.build delete mode 100755 test cases/common/74 external test program/mytest.py delete mode 100755 test cases/common/75 ctarget dependency/gen1.py delete mode 100755 test cases/common/75 ctarget dependency/gen2.py delete mode 100644 test cases/common/75 ctarget dependency/input.dat delete mode 100644 test cases/common/75 ctarget dependency/meson.build create mode 100644 test cases/common/75 shared subproject/a.c create mode 100644 test cases/common/75 shared subproject/meson.build create mode 100644 test cases/common/75 shared subproject/subprojects/B/b.c create mode 100644 test cases/common/75 shared subproject/subprojects/B/meson.build create mode 100644 test cases/common/75 shared subproject/subprojects/C/c.c create mode 100644 test cases/common/75 shared subproject/subprojects/C/meson.build create mode 100644 test cases/common/76 shared subproject 2/a.c create mode 100644 test cases/common/76 shared subproject 2/meson.build create mode 100644 test cases/common/76 shared subproject 2/subprojects/B/b.c create mode 100644 test cases/common/76 shared subproject 2/subprojects/B/meson.build create mode 100644 test cases/common/76 shared subproject 2/subprojects/C/c.c create mode 100644 test cases/common/76 shared subproject 2/subprojects/C/meson.build delete mode 100644 test cases/common/76 shared subproject/a.c delete mode 100644 test cases/common/76 shared subproject/meson.build delete mode 100644 test cases/common/76 shared subproject/subprojects/B/b.c delete mode 100644 test cases/common/76 shared subproject/subprojects/B/meson.build delete mode 100644 test cases/common/76 shared subproject/subprojects/C/c.c delete mode 100644 test cases/common/76 shared subproject/subprojects/C/meson.build create mode 100644 test cases/common/77 file object/lib.c create mode 100644 test cases/common/77 file object/meson.build create mode 100644 test cases/common/77 file object/prog.c create mode 100644 test cases/common/77 file object/subdir1/lib.c create mode 100644 test cases/common/77 file object/subdir1/meson.build create mode 100644 test cases/common/77 file object/subdir1/prog.c create mode 100644 test cases/common/77 file object/subdir2/lib.c create mode 100644 test cases/common/77 file object/subdir2/meson.build create mode 100644 test cases/common/77 file object/subdir2/prog.c delete mode 100644 test cases/common/77 shared subproject 2/a.c delete mode 100644 test cases/common/77 shared subproject 2/meson.build delete mode 100644 test cases/common/77 shared subproject 2/subprojects/B/b.c delete mode 100644 test cases/common/77 shared subproject 2/subprojects/B/meson.build delete mode 100644 test cases/common/77 shared subproject 2/subprojects/C/c.c delete mode 100644 test cases/common/77 shared subproject 2/subprojects/C/meson.build create mode 100644 test cases/common/78 custom subproject dir/a.c create mode 100644 test cases/common/78 custom subproject dir/custom_subproject_dir/B/b.c create mode 100644 test cases/common/78 custom subproject dir/custom_subproject_dir/B/meson.build create mode 100644 test cases/common/78 custom subproject dir/custom_subproject_dir/C/c.c create mode 100644 test cases/common/78 custom subproject dir/custom_subproject_dir/C/meson.build create mode 100644 test cases/common/78 custom subproject dir/meson.build delete mode 100644 test cases/common/78 file object/lib.c delete mode 100644 test cases/common/78 file object/meson.build delete mode 100644 test cases/common/78 file object/prog.c delete mode 100644 test cases/common/78 file object/subdir1/lib.c delete mode 100644 test cases/common/78 file object/subdir1/meson.build delete mode 100644 test cases/common/78 file object/subdir1/prog.c delete mode 100644 test cases/common/78 file object/subdir2/lib.c delete mode 100644 test cases/common/78 file object/subdir2/meson.build delete mode 100644 test cases/common/78 file object/subdir2/prog.c delete mode 100644 test cases/common/79 custom subproject dir/a.c delete mode 100644 test cases/common/79 custom subproject dir/custom_subproject_dir/B/b.c delete mode 100644 test cases/common/79 custom subproject dir/custom_subproject_dir/B/meson.build delete mode 100644 test cases/common/79 custom subproject dir/custom_subproject_dir/C/c.c delete mode 100644 test cases/common/79 custom subproject dir/custom_subproject_dir/C/meson.build delete mode 100644 test cases/common/79 custom subproject dir/meson.build create mode 100644 test cases/common/79 has type/meson.build create mode 100644 test cases/common/80 extract from nested subdir/meson.build create mode 100644 test cases/common/80 extract from nested subdir/src/first/lib_first.c create mode 100644 test cases/common/80 extract from nested subdir/src/first/meson.build create mode 100644 test cases/common/80 extract from nested subdir/src/meson.build create mode 100644 test cases/common/80 extract from nested subdir/tst/first/exe_first.c create mode 100644 test cases/common/80 extract from nested subdir/tst/first/meson.build create mode 100644 test cases/common/80 extract from nested subdir/tst/meson.build delete mode 100644 test cases/common/80 has type/meson.build delete mode 100644 test cases/common/81 extract from nested subdir/meson.build delete mode 100644 test cases/common/81 extract from nested subdir/src/first/lib_first.c delete mode 100644 test cases/common/81 extract from nested subdir/src/first/meson.build delete mode 100644 test cases/common/81 extract from nested subdir/src/meson.build delete mode 100644 test cases/common/81 extract from nested subdir/tst/first/exe_first.c delete mode 100644 test cases/common/81 extract from nested subdir/tst/first/meson.build delete mode 100644 test cases/common/81 extract from nested subdir/tst/meson.build create mode 100644 test cases/common/81 internal dependency/meson.build create mode 100644 test cases/common/81 internal dependency/proj1/include/proj1.h create mode 100644 test cases/common/81 internal dependency/proj1/meson.build create mode 100644 test cases/common/81 internal dependency/proj1/proj1f1.c create mode 100644 test cases/common/81 internal dependency/proj1/proj1f2.c create mode 100644 test cases/common/81 internal dependency/proj1/proj1f3.c create mode 100644 test cases/common/81 internal dependency/src/main.c create mode 100644 test cases/common/81 internal dependency/src/meson.build delete mode 100644 test cases/common/82 internal dependency/meson.build delete mode 100644 test cases/common/82 internal dependency/proj1/include/proj1.h delete mode 100644 test cases/common/82 internal dependency/proj1/meson.build delete mode 100644 test cases/common/82 internal dependency/proj1/proj1f1.c delete mode 100644 test cases/common/82 internal dependency/proj1/proj1f2.c delete mode 100644 test cases/common/82 internal dependency/proj1/proj1f3.c delete mode 100644 test cases/common/82 internal dependency/src/main.c delete mode 100644 test cases/common/82 internal dependency/src/meson.build create mode 100644 test cases/common/82 same basename/exe1.c create mode 100644 test cases/common/82 same basename/exe2.c create mode 100644 test cases/common/82 same basename/lib.c create mode 100644 test cases/common/82 same basename/meson.build create mode 100644 test cases/common/82 same basename/sharedsub/meson.build create mode 100644 test cases/common/82 same basename/staticsub/meson.build create mode 100644 test cases/common/83 declare dep/entity/entity.h create mode 100644 test cases/common/83 declare dep/entity/entity1.c create mode 100644 test cases/common/83 declare dep/entity/entity2.c create mode 100644 test cases/common/83 declare dep/entity/meson.build create mode 100644 test cases/common/83 declare dep/main.c create mode 100644 test cases/common/83 declare dep/meson.build delete mode 100644 test cases/common/83 same basename/exe1.c delete mode 100644 test cases/common/83 same basename/exe2.c delete mode 100644 test cases/common/83 same basename/lib.c delete mode 100644 test cases/common/83 same basename/meson.build delete mode 100644 test cases/common/83 same basename/sharedsub/meson.build delete mode 100644 test cases/common/83 same basename/staticsub/meson.build delete mode 100644 test cases/common/84 declare dep/entity/entity.h delete mode 100644 test cases/common/84 declare dep/entity/entity1.c delete mode 100644 test cases/common/84 declare dep/entity/entity2.c delete mode 100644 test cases/common/84 declare dep/entity/meson.build delete mode 100644 test cases/common/84 declare dep/main.c delete mode 100644 test cases/common/84 declare dep/meson.build create mode 100644 test cases/common/84 extract all/extractor.h create mode 100644 test cases/common/84 extract all/four.c create mode 100644 test cases/common/84 extract all/meson.build create mode 100644 test cases/common/84 extract all/one.c create mode 100644 test cases/common/84 extract all/prog.c create mode 100644 test cases/common/84 extract all/three.c create mode 100644 test cases/common/84 extract all/two.c create mode 100644 test cases/common/85 add language/meson.build create mode 100644 test cases/common/85 add language/prog.c create mode 100644 test cases/common/85 add language/prog.cc delete mode 100644 test cases/common/85 extract all/extractor.h delete mode 100644 test cases/common/85 extract all/four.c delete mode 100644 test cases/common/85 extract all/meson.build delete mode 100644 test cases/common/85 extract all/one.c delete mode 100644 test cases/common/85 extract all/prog.c delete mode 100644 test cases/common/85 extract all/three.c delete mode 100644 test cases/common/85 extract all/two.c delete mode 100644 test cases/common/86 add language/meson.build delete mode 100644 test cases/common/86 add language/prog.c delete mode 100644 test cases/common/86 add language/prog.cc create mode 100644 test cases/common/86 identical target name in subproject/bar.c create mode 100644 test cases/common/86 identical target name in subproject/meson.build create mode 100644 test cases/common/86 identical target name in subproject/subprojects/foo/bar.c create mode 100644 test cases/common/86 identical target name in subproject/subprojects/foo/meson.build delete mode 100644 test cases/common/87 identical target name in subproject/bar.c delete mode 100644 test cases/common/87 identical target name in subproject/meson.build delete mode 100644 test cases/common/87 identical target name in subproject/subprojects/foo/bar.c delete mode 100644 test cases/common/87 identical target name in subproject/subprojects/foo/meson.build create mode 100644 test cases/common/87 plusassign/meson.build delete mode 100644 test cases/common/88 plusassign/meson.build create mode 100644 test cases/common/88 skip subdir/meson.build create mode 100644 test cases/common/88 skip subdir/subdir1/meson.build create mode 100644 test cases/common/88 skip subdir/subdir1/subdir2/meson.build create mode 100644 test cases/common/89 private include/meson.build create mode 100755 test cases/common/89 private include/stlib/compiler.py create mode 100644 test cases/common/89 private include/stlib/foo1.def create mode 100644 test cases/common/89 private include/stlib/foo2.def create mode 100644 test cases/common/89 private include/stlib/meson.build create mode 100644 test cases/common/89 private include/user/libuser.c create mode 100644 test cases/common/89 private include/user/meson.build delete mode 100644 test cases/common/89 skip subdir/meson.build delete mode 100644 test cases/common/89 skip subdir/subdir1/meson.build delete mode 100644 test cases/common/89 skip subdir/subdir1/subdir2/meson.build create mode 100644 test cases/common/90 default options/meson.build delete mode 100644 test cases/common/90 private include/meson.build delete mode 100755 test cases/common/90 private include/stlib/compiler.py delete mode 100644 test cases/common/90 private include/stlib/foo1.def delete mode 100644 test cases/common/90 private include/stlib/foo2.def delete mode 100644 test cases/common/90 private include/stlib/meson.build delete mode 100644 test cases/common/90 private include/user/libuser.c delete mode 100644 test cases/common/90 private include/user/meson.build delete mode 100644 test cases/common/91 default options/meson.build create mode 100644 test cases/common/91 dep fallback/gensrc.py create mode 100644 test cases/common/91 dep fallback/meson.build create mode 100644 test cases/common/91 dep fallback/subprojects/boblib/bob.c create mode 100644 test cases/common/91 dep fallback/subprojects/boblib/bob.h create mode 100644 test cases/common/91 dep fallback/subprojects/boblib/genbob.py create mode 100644 test cases/common/91 dep fallback/subprojects/boblib/meson.build create mode 100644 test cases/common/91 dep fallback/subprojects/dummylib/meson.build create mode 100644 test cases/common/91 dep fallback/tester.c create mode 100644 test cases/common/92 default library/ef.cpp create mode 100644 test cases/common/92 default library/ef.h create mode 100644 test cases/common/92 default library/eftest.cpp create mode 100644 test cases/common/92 default library/meson.build delete mode 100644 test cases/common/92 dep fallback/gensrc.py delete mode 100644 test cases/common/92 dep fallback/meson.build delete mode 100644 test cases/common/92 dep fallback/subprojects/boblib/bob.c delete mode 100644 test cases/common/92 dep fallback/subprojects/boblib/bob.h delete mode 100644 test cases/common/92 dep fallback/subprojects/boblib/genbob.py delete mode 100644 test cases/common/92 dep fallback/subprojects/boblib/meson.build delete mode 100644 test cases/common/92 dep fallback/subprojects/dummylib/meson.build delete mode 100644 test cases/common/92 dep fallback/tester.c delete mode 100644 test cases/common/93 default library/ef.cpp delete mode 100644 test cases/common/93 default library/ef.h delete mode 100644 test cases/common/93 default library/eftest.cpp delete mode 100644 test cases/common/93 default library/meson.build create mode 100644 test cases/common/93 selfbuilt custom/data.dat create mode 100644 test cases/common/93 selfbuilt custom/mainprog.cpp create mode 100644 test cases/common/93 selfbuilt custom/meson.build create mode 100644 test cases/common/93 selfbuilt custom/tool.cpp create mode 100644 test cases/common/94 gen extra/meson.build create mode 100644 test cases/common/94 gen extra/name.dat create mode 100644 test cases/common/94 gen extra/name.l create mode 100644 test cases/common/94 gen extra/plain.c create mode 100755 test cases/common/94 gen extra/srcgen.py create mode 100644 test cases/common/94 gen extra/srcgen2.py create mode 100644 test cases/common/94 gen extra/srcgen3.py create mode 100644 test cases/common/94 gen extra/upper.c delete mode 100644 test cases/common/94 selfbuilt custom/data.dat delete mode 100644 test cases/common/94 selfbuilt custom/mainprog.cpp delete mode 100644 test cases/common/94 selfbuilt custom/meson.build delete mode 100644 test cases/common/94 selfbuilt custom/tool.cpp create mode 100644 test cases/common/95 benchmark/delayer.c create mode 100644 test cases/common/95 benchmark/meson.build delete mode 100644 test cases/common/95 gen extra/meson.build delete mode 100644 test cases/common/95 gen extra/name.dat delete mode 100644 test cases/common/95 gen extra/name.l delete mode 100644 test cases/common/95 gen extra/plain.c delete mode 100755 test cases/common/95 gen extra/srcgen.py delete mode 100644 test cases/common/95 gen extra/srcgen2.py delete mode 100644 test cases/common/95 gen extra/srcgen3.py delete mode 100644 test cases/common/95 gen extra/upper.c delete mode 100644 test cases/common/96 benchmark/delayer.c delete mode 100644 test cases/common/96 benchmark/meson.build create mode 100644 test cases/common/96 test workdir/meson.build create mode 100644 test cases/common/96 test workdir/opener.c create mode 100755 test cases/common/96 test workdir/subdir/checker.py create mode 100644 test cases/common/96 test workdir/subdir/meson.build create mode 100644 test cases/common/97 suites/exe1.c create mode 100644 test cases/common/97 suites/exe2.c create mode 100644 test cases/common/97 suites/meson.build create mode 100644 test cases/common/97 suites/subprojects/sub/meson.build create mode 100644 test cases/common/97 suites/subprojects/sub/sub1.c create mode 100644 test cases/common/97 suites/subprojects/sub/sub2.c delete mode 100644 test cases/common/97 test workdir/meson.build delete mode 100644 test cases/common/97 test workdir/opener.c delete mode 100755 test cases/common/97 test workdir/subdir/checker.py delete mode 100644 test cases/common/97 test workdir/subdir/meson.build delete mode 100644 test cases/common/98 suites/exe1.c delete mode 100644 test cases/common/98 suites/exe2.c delete mode 100644 test cases/common/98 suites/meson.build delete mode 100644 test cases/common/98 suites/subprojects/sub/meson.build delete mode 100644 test cases/common/98 suites/subprojects/sub/sub1.c delete mode 100644 test cases/common/98 suites/subprojects/sub/sub2.c create mode 100644 test cases/common/98 threads/meson.build create mode 100644 test cases/common/98 threads/threadprog.c create mode 100644 test cases/common/98 threads/threadprog.cpp create mode 100644 test cases/common/99 manygen/depuser.c create mode 100644 test cases/common/99 manygen/meson.build create mode 100644 test cases/common/99 manygen/subdir/funcinfo.def create mode 100755 test cases/common/99 manygen/subdir/manygen.py create mode 100644 test cases/common/99 manygen/subdir/meson.build delete mode 100644 test cases/common/99 threads/meson.build delete mode 100644 test cases/common/99 threads/threadprog.c delete mode 100644 test cases/common/99 threads/threadprog.cpp create mode 100644 test cases/failing/89 subproj not-found dep/meson.build create mode 100644 test cases/failing/89 subproj not-found dep/subprojects/somesubproj/meson.build create mode 100644 test cases/failing/90 invalid configure file/input create mode 100644 test cases/failing/90 invalid configure file/meson.build delete mode 100644 test cases/failing/90 subproj not-found dep/meson.build delete mode 100644 test cases/failing/90 subproj not-found dep/subprojects/somesubproj/meson.build delete mode 100644 test cases/failing/91 invalid configure file/input delete mode 100644 test cases/failing/91 invalid configure file/meson.build create mode 100644 test cases/failing/91 kwarg dupe/meson.build create mode 100644 test cases/failing/91 kwarg dupe/prog.c delete mode 100644 test cases/failing/92 kwarg dupe/meson.build delete mode 100644 test cases/failing/92 kwarg dupe/prog.c create mode 100644 test cases/failing/92 missing pch file/meson.build create mode 100644 test cases/failing/92 missing pch file/prog.c delete mode 100644 test cases/failing/93 missing pch file/meson.build delete mode 100644 test cases/failing/93 missing pch file/prog.c create mode 100644 test cases/failing/93 pch source different folder/include/pch.h create mode 100644 test cases/failing/93 pch source different folder/meson.build create mode 100644 test cases/failing/93 pch source different folder/prog.c create mode 100644 test cases/failing/93 pch source different folder/src/pch.c delete mode 100644 test cases/failing/94 pch source different folder/include/pch.h delete mode 100644 test cases/failing/94 pch source different folder/meson.build delete mode 100644 test cases/failing/94 pch source different folder/prog.c delete mode 100644 test cases/failing/94 pch source different folder/src/pch.c create mode 100644 test cases/failing/94 vala without c/meson.build create mode 100644 test cases/failing/95 unknown config tool/meson.build delete mode 100644 test cases/failing/95 vala without c/meson.build create mode 100644 test cases/failing/96 custom target install data/Info.plist.cpp create mode 100644 test cases/failing/96 custom target install data/meson.build create mode 100644 test cases/failing/96 custom target install data/preproc.py delete mode 100644 test cases/failing/96 unknown config tool/meson.build delete mode 100644 test cases/failing/97 custom target install data/Info.plist.cpp delete mode 100644 test cases/failing/97 custom target install data/meson.build delete mode 100644 test cases/failing/97 custom target install data/preproc.py delete mode 100644 test cases/unit/50 std remains/meson.build delete mode 100644 test cases/unit/50 std remains/prog.c delete mode 100644 test cases/unit/51 ldflagdedup/bob.c delete mode 100644 test cases/unit/51 ldflagdedup/meson.build delete mode 100644 test cases/unit/51 ldflagdedup/prog.c create mode 100644 test cases/unit/51 std remains/meson.build create mode 100644 test cases/unit/51 std remains/prog.c create mode 100644 test cases/unit/52 ldflagdedup/bob.c create mode 100644 test cases/unit/52 ldflagdedup/meson.build create mode 100644 test cases/unit/52 ldflagdedup/prog.c delete mode 100644 test cases/unit/52 pkgconfig static link order/meson.build delete mode 100644 test cases/unit/53 clang-format/.clang-format delete mode 100644 test cases/unit/53 clang-format/header_expected_h delete mode 100644 test cases/unit/53 clang-format/header_orig_h delete mode 100644 test cases/unit/53 clang-format/meson.build delete mode 100644 test cases/unit/53 clang-format/prog_expected_c delete mode 100644 test cases/unit/53 clang-format/prog_orig_c create mode 100644 test cases/unit/53 pkgconfig static link order/meson.build create mode 100644 test cases/unit/54 clang-format/.clang-format create mode 100644 test cases/unit/54 clang-format/header_expected_h create mode 100644 test cases/unit/54 clang-format/header_orig_h create mode 100644 test cases/unit/54 clang-format/meson.build create mode 100644 test cases/unit/54 clang-format/prog_expected_c create mode 100644 test cases/unit/54 clang-format/prog_orig_c delete mode 100644 test cases/unit/54 introspect buildoptions/subprojects/projectBad/meson.build delete mode 100644 test cases/unit/54 introspect buildoptions/subprojects/projectBad/meson_options.txt delete mode 100644 test cases/unit/55 dedup compiler libs/app/app.c delete mode 100644 test cases/unit/55 dedup compiler libs/app/meson.build delete mode 100644 test cases/unit/55 dedup compiler libs/liba/liba.c delete mode 100644 test cases/unit/55 dedup compiler libs/liba/liba.h delete mode 100644 test cases/unit/55 dedup compiler libs/liba/meson.build delete mode 100644 test cases/unit/55 dedup compiler libs/libb/libb.c delete mode 100644 test cases/unit/55 dedup compiler libs/libb/libb.h delete mode 100644 test cases/unit/55 dedup compiler libs/libb/meson.build delete mode 100644 test cases/unit/55 dedup compiler libs/meson.build create mode 100644 test cases/unit/55 introspect buildoptions/subprojects/projectBad/meson.build create mode 100644 test cases/unit/55 introspect buildoptions/subprojects/projectBad/meson_options.txt delete mode 100644 test cases/unit/55 introspection/meson.build delete mode 100644 test cases/unit/55 introspection/meson_options.txt delete mode 100644 test cases/unit/55 introspection/sharedlib/meson.build delete mode 100644 test cases/unit/55 introspection/sharedlib/shared.cpp delete mode 100644 test cases/unit/55 introspection/sharedlib/shared.hpp delete mode 100644 test cases/unit/55 introspection/staticlib/meson.build delete mode 100644 test cases/unit/55 introspection/staticlib/static.c delete mode 100644 test cases/unit/55 introspection/staticlib/static.h delete mode 100644 test cases/unit/55 introspection/t1.cpp delete mode 100644 test cases/unit/55 introspection/t2.cpp delete mode 100644 test cases/unit/55 introspection/t3.cpp delete mode 100644 test cases/unit/55 pkg_config_path option/build_extra_path/totally_made_up_dep.pc delete mode 100644 test cases/unit/55 pkg_config_path option/host_extra_path/totally_made_up_dep.pc delete mode 100644 test cases/unit/55 pkg_config_path option/meson.build create mode 100644 test cases/unit/56 dedup compiler libs/app/app.c create mode 100644 test cases/unit/56 dedup compiler libs/app/meson.build create mode 100644 test cases/unit/56 dedup compiler libs/liba/liba.c create mode 100644 test cases/unit/56 dedup compiler libs/liba/liba.h create mode 100644 test cases/unit/56 dedup compiler libs/liba/meson.build create mode 100644 test cases/unit/56 dedup compiler libs/libb/libb.c create mode 100644 test cases/unit/56 dedup compiler libs/libb/libb.h create mode 100644 test cases/unit/56 dedup compiler libs/libb/meson.build create mode 100644 test cases/unit/56 dedup compiler libs/meson.build delete mode 100644 test cases/unit/56 introspect buildoptions/c_compiler.py delete mode 100644 test cases/unit/56 introspect buildoptions/main.c delete mode 100644 test cases/unit/56 introspect buildoptions/meson.build delete mode 100644 test cases/unit/56 introspect buildoptions/meson_options.txt delete mode 100644 test cases/unit/56 introspect buildoptions/subprojects/evilFile.txt delete mode 100644 test cases/unit/56 introspect buildoptions/subprojects/projectA/meson.build delete mode 100644 test cases/unit/56 introspect buildoptions/subprojects/projectA/meson_options.txt delete mode 100644 test cases/unit/56 introspect buildoptions/subprojects/projectBad/meson.build delete mode 100644 test cases/unit/56 introspect buildoptions/subprojects/projectBad/meson_options.txt create mode 100644 test cases/unit/57 introspection/meson.build create mode 100644 test cases/unit/57 introspection/meson_options.txt create mode 100644 test cases/unit/57 introspection/sharedlib/meson.build create mode 100644 test cases/unit/57 introspection/sharedlib/shared.cpp create mode 100644 test cases/unit/57 introspection/sharedlib/shared.hpp create mode 100644 test cases/unit/57 introspection/staticlib/meson.build create mode 100644 test cases/unit/57 introspection/staticlib/static.c create mode 100644 test cases/unit/57 introspection/staticlib/static.h create mode 100644 test cases/unit/57 introspection/t1.cpp create mode 100644 test cases/unit/57 introspection/t2.cpp create mode 100644 test cases/unit/57 introspection/t3.cpp delete mode 100644 test cases/unit/57 native file override/crossfile delete mode 100644 test cases/unit/57 native file override/crossfile2 delete mode 100644 test cases/unit/57 native file override/meson.build delete mode 100644 test cases/unit/57 native file override/meson_options.txt delete mode 100644 test cases/unit/57 native file override/nativefile delete mode 100755 test cases/unit/58 identity cross/build_wrapper.py delete mode 100755 test cases/unit/58 identity cross/host_wrapper.py delete mode 100644 test cases/unit/58 identity cross/meson.build delete mode 100644 test cases/unit/58 identity cross/stuff.h create mode 100644 test cases/unit/58 pkg_config_path option/build_extra_path/totally_made_up_dep.pc create mode 100644 test cases/unit/58 pkg_config_path option/host_extra_path/totally_made_up_dep.pc create mode 100644 test cases/unit/58 pkg_config_path option/meson.build delete mode 100644 test cases/unit/58 pkgconfig relative paths/pkgconfig/librelativepath.pc create mode 100644 test cases/unit/59 introspect buildoptions/c_compiler.py create mode 100644 test cases/unit/59 introspect buildoptions/main.c create mode 100644 test cases/unit/59 introspect buildoptions/meson.build create mode 100644 test cases/unit/59 introspect buildoptions/meson_options.txt create mode 100644 test cases/unit/59 introspect buildoptions/subprojects/evilFile.txt create mode 100644 test cases/unit/59 introspect buildoptions/subprojects/projectA/meson.build create mode 100644 test cases/unit/59 introspect buildoptions/subprojects/projectA/meson_options.txt create mode 100644 test cases/unit/59 introspect buildoptions/subprojects/projectBad/meson.build create mode 100644 test cases/unit/59 introspect buildoptions/subprojects/projectBad/meson_options.txt delete mode 100644 test cases/unit/59 test env doesn't stack/meson.build delete mode 100755 test cases/unit/59 test env doesn't stack/script.py delete mode 100644 test cases/unit/60 cmake_prefix_path/meson.build delete mode 100644 test cases/unit/60 cmake_prefix_path/prefix/lib/cmake/mesontest/mesontest-config.cmake create mode 100644 test cases/unit/60 native file override/crossfile create mode 100644 test cases/unit/60 native file override/crossfile2 create mode 100644 test cases/unit/60 native file override/meson.build create mode 100644 test cases/unit/60 native file override/meson_options.txt create mode 100644 test cases/unit/60 native file override/nativefile delete mode 100644 test cases/unit/61 cmake parser/meson.build delete mode 100644 test cases/unit/61 cmake parser/prefix/lib/cmake/mesontest/mesontest-config.cmake create mode 100755 test cases/unit/61 identity cross/build_wrapper.py create mode 100755 test cases/unit/61 identity cross/host_wrapper.py create mode 100644 test cases/unit/61 identity cross/meson.build create mode 100644 test cases/unit/61 identity cross/stuff.h delete mode 100644 test cases/unit/62 alias target/main.c delete mode 100644 test cases/unit/62 alias target/meson.build create mode 100644 test cases/unit/62 pkgconfig relative paths/pkgconfig/librelativepath.pc create mode 100644 test cases/unit/63 test env does not stack/meson.build create mode 100755 test cases/unit/63 test env does not stack/script.py create mode 100644 test cases/unit/64 cmake_prefix_path/meson.build create mode 100644 test cases/unit/64 cmake_prefix_path/prefix/lib/cmake/mesontest/mesontest-config.cmake create mode 100644 test cases/unit/65 cmake parser/meson.build create mode 100644 test cases/unit/65 cmake parser/prefix/lib/cmake/mesontest/mesontest-config.cmake create mode 100644 test cases/unit/66 alias target/main.c create mode 100644 test cases/unit/66 alias target/meson.build diff --git a/run_project_tests.py b/run_project_tests.py index a161525..88d6a57 100755 --- a/run_project_tests.py +++ b/run_project_tests.py @@ -334,7 +334,7 @@ def pass_libdir_to_test(dirname): return False if '38 libdir must be inside prefix' in dirname: return False - if '196 install_mode' in dirname: + if '195 install_mode' in dirname: return False return True diff --git a/run_unittests.py b/run_unittests.py index 0bd2c02..0116827 100755 --- a/run_unittests.py +++ b/run_unittests.py @@ -1540,7 +1540,7 @@ class AllPlatformTests(BasePlatformTests): Can't be an ordinary test because we pass --prefix to meson there. https://github.com/mesonbuild/meson/issues/1349 ''' - testdir = os.path.join(self.common_test_dir, '91 default options') + testdir = os.path.join(self.common_test_dir, '90 default options') self.init(testdir, default_args=False) opts = self.introspect('--buildoptions') for opt in opts: @@ -1570,7 +1570,7 @@ class AllPlatformTests(BasePlatformTests): https://github.com/mesonbuild/meson/issues/1341 https://github.com/mesonbuild/meson/issues/1345 ''' - testdir = os.path.join(self.common_test_dir, '91 default options') + testdir = os.path.join(self.common_test_dir, '90 default options') prefix = '/someabs' libdir = 'libdir' extra_args = ['--prefix=' + prefix, @@ -1652,7 +1652,7 @@ class AllPlatformTests(BasePlatformTests): dependent defaults for other options, and that those defaults can be overridden in default_options or by the command line. ''' - testdir = os.path.join(self.common_test_dir, '169 default options prefix dependent defaults') + testdir = os.path.join(self.common_test_dir, '168 default options prefix dependent defaults') expected = { '': {'prefix': '/usr', @@ -1755,7 +1755,7 @@ class AllPlatformTests(BasePlatformTests): Test that run_targets are run from the correct directory https://github.com/mesonbuild/meson/issues/957 ''' - testdir = os.path.join(self.common_test_dir, '55 run target') + testdir = os.path.join(self.common_test_dir, '54 run target') self.init(testdir) self.run_target('check_exists') @@ -1779,7 +1779,7 @@ class AllPlatformTests(BasePlatformTests): Test that the Meson introspection API also contains subdir install information https://github.com/mesonbuild/meson/issues/5556 ''' - testdir = os.path.join(self.common_test_dir, '63 install subdir') + testdir = os.path.join(self.common_test_dir, '62 install subdir') self.init(testdir) intro = self.introspect('--installed') expected = { @@ -1812,7 +1812,7 @@ class AllPlatformTests(BasePlatformTests): ''' if self.backend is not Backend.ninja: raise unittest.SkipTest('{!r} backend can\'t install files'.format(self.backend.name)) - testdir = os.path.join(self.common_test_dir, '145 custom target multiple outputs') + testdir = os.path.join(self.common_test_dir, '144 custom target multiple outputs') self.init(testdir) intro = self.introspect('--targets') if intro[0]['type'] == 'executable': @@ -1842,7 +1842,7 @@ class AllPlatformTests(BasePlatformTests): ''' Test that env ops prepend/append do not stack, and that this usage issues a warning ''' - testdir = os.path.join(self.unit_test_dir, '59 test env doesn\'t stack') + testdir = os.path.join(self.unit_test_dir, '63 test env does not stack') out = self.init(testdir) self.assertRegex(out, r'WARNING: Overriding.*TEST_VAR_APPEND') self.assertRegex(out, r'WARNING: Overriding.*TEST_VAR_PREPEND') @@ -1992,7 +1992,7 @@ class AllPlatformTests(BasePlatformTests): self.assertFailedTestCount(2, self.mtest_command + ['--no-suite', 'subprjfail:fail', '--no-suite', 'subprjmix:fail']) def test_build_by_default(self): - testdir = os.path.join(self.common_test_dir, '134 build by default') + testdir = os.path.join(self.common_test_dir, '133 build by default') self.init(testdir) self.build() genfile1 = os.path.join(self.builddir, 'generated1.dat') @@ -2009,7 +2009,7 @@ class AllPlatformTests(BasePlatformTests): self.assertPathExists(exe2) def test_internal_include_order(self): - testdir = os.path.join(self.common_test_dir, '135 include order') + testdir = os.path.join(self.common_test_dir, '134 include order') self.init(testdir) execmd = fxecmd = None for cmd in self.get_compdb(): @@ -2187,7 +2187,7 @@ class AllPlatformTests(BasePlatformTests): self.assertEqual(cc.is_64, wcc.is_64) def test_always_prefer_c_compiler_for_asm(self): - testdir = os.path.join(self.common_test_dir, '138 c cpp and asm') + testdir = os.path.join(self.common_test_dir, '137 c cpp and asm') # Skip if building with MSVC env = get_fake_env(testdir, self.builddir, self.prefix) if env.detect_c_compiler(MachineChoice.HOST).get_id() == 'msvc': @@ -2257,7 +2257,7 @@ class AllPlatformTests(BasePlatformTests): Test that preprocessor compiler checks read CPPFLAGS and also CFLAGS but not LDFLAGS. ''' - testdir = os.path.join(self.common_test_dir, '137 get define') + testdir = os.path.join(self.common_test_dir, '136 get define') define = 'MESON_TEST_DEFINE_VALUE' # NOTE: this list can't have \n, ' or " # \n is never substituted by the GNU pre-processor via a -D define @@ -2272,7 +2272,7 @@ class AllPlatformTests(BasePlatformTests): self.init(testdir, extra_args=['-D{}={}'.format(define, value)], override_envvars=env) def test_custom_target_exe_data_deterministic(self): - testdir = os.path.join(self.common_test_dir, '114 custom target capture') + testdir = os.path.join(self.common_test_dir, '113 custom target capture') self.init(testdir) meson_exe_dat1 = glob(os.path.join(self.privatedir, 'meson_exe*.dat')) self.wipe() @@ -2301,7 +2301,7 @@ class AllPlatformTests(BasePlatformTests): ExternalProgram, and any File objects on the command-line cause a rebuild. ''' - testdir = os.path.join(self.common_test_dir, '61 custom header generator') + testdir = os.path.join(self.common_test_dir, '60 custom header generator') self.init(testdir) self.build() # Immediately rebuilding should not do anything @@ -2316,7 +2316,7 @@ class AllPlatformTests(BasePlatformTests): Test that changes to generator programs in the source tree cause a rebuild. ''' - testdir = os.path.join(self.common_test_dir, '95 gen extra') + testdir = os.path.join(self.common_test_dir, '94 gen extra') self.init(testdir) self.build() # Immediately rebuilding should not do anything @@ -2434,7 +2434,7 @@ int main(int argc, char **argv) { ''' if is_windows() or is_cygwin(): raise unittest.SkipTest('Windows PE/COFF binaries do not use RPATH') - testdir = os.path.join(self.common_test_dir, '43 library chain') + testdir = os.path.join(self.common_test_dir, '42 library chain') self.init(testdir) self.build() for each in ('prog', 'subdir/liblib1.so', ): @@ -2470,10 +2470,10 @@ int main(int argc, char **argv) { def test_all_forbidden_targets_tested(self): ''' - Test that all forbidden targets are tested in the '155 reserved targets' + Test that all forbidden targets are tested in the '154 reserved targets' test. Needs to be a unit test because it accesses Meson internals. ''' - testdir = os.path.join(self.common_test_dir, '155 reserved targets') + testdir = os.path.join(self.common_test_dir, '154 reserved targets') targets = mesonbuild.coredata.forbidden_target_names # We don't actually define a target with this name targets.pop('build.ninja') @@ -2646,7 +2646,7 @@ int main(int argc, char **argv) { @skipIfNoPkgconfig def test_pkgconfig_gen_escaping(self): - testdir = os.path.join(self.common_test_dir, '48 pkgconfig-gen') + testdir = os.path.join(self.common_test_dir, '47 pkgconfig-gen') prefix = '/usr/with spaces' libdir = 'lib' self.init(testdir, extra_args=['--prefix=' + prefix, @@ -2749,7 +2749,7 @@ int main(int argc, char **argv) { self.assertTrue(found, "Array option not found in introspect data.") def test_free_stringarray_setting(self): - testdir = os.path.join(self.common_test_dir, '44 options') + testdir = os.path.join(self.common_test_dir, '43 options') self.init(testdir) self.opt_has('free_array_opt', []) self.setconf('-Dfree_array_opt=foo,bar', will_build=False) @@ -2910,7 +2910,7 @@ int main(int argc, char **argv) { Test that identical targets in different subprojects do not collide if layout is flat. ''' - testdir = os.path.join(self.common_test_dir, '178 identical target name in subproject flat layout') + testdir = os.path.join(self.common_test_dir, '177 identical target name in subproject flat layout') self.init(testdir, extra_args=['--layout=flat']) self.build() @@ -2919,7 +2919,7 @@ int main(int argc, char **argv) { Test that identical targets in different subdirs do not collide if layout is flat. ''' - testdir = os.path.join(self.common_test_dir, '187 same target name flat layout') + testdir = os.path.join(self.common_test_dir, '186 same target name flat layout') self.init(testdir, extra_args=['--layout=flat']) self.build() @@ -3181,7 +3181,7 @@ recommended as it is not supported on some platforms''') pass def test_warning_level_0(self): - testdir = os.path.join(self.common_test_dir, '215 warning level 0') + testdir = os.path.join(self.common_test_dir, '214 warning level 0') # Verify default values when passing no args self.init(testdir) @@ -3368,7 +3368,7 @@ recommended as it is not supported on some platforms''') self.run_tests() def test_wipe_from_builddir(self): - testdir = os.path.join(self.common_test_dir, '162 custom target subdir depend files') + testdir = os.path.join(self.common_test_dir, '161 custom target subdir depend files') self.init(testdir) self.__reconfigure() @@ -3403,21 +3403,21 @@ recommended as it is not supported on some platforms''') self.assertEqual('81d46d1@@target2-id@other', target_id) def test_introspect_projectinfo_without_configured_build(self): - testfile = os.path.join(self.common_test_dir, '36 run program', 'meson.build') + testfile = os.path.join(self.common_test_dir, '35 run program', 'meson.build') res = self.introspect_directory(testfile, '--projectinfo') self.assertEqual(set(res['buildsystem_files']), set(['meson.build'])) self.assertEqual(res['version'], 'undefined') self.assertEqual(res['descriptive_name'], 'run command') self.assertEqual(res['subprojects'], []) - testfile = os.path.join(self.common_test_dir, '44 options', 'meson.build') + testfile = os.path.join(self.common_test_dir, '43 options', 'meson.build') res = self.introspect_directory(testfile, '--projectinfo') self.assertEqual(set(res['buildsystem_files']), set(['meson_options.txt', 'meson.build'])) self.assertEqual(res['version'], 'undefined') self.assertEqual(res['descriptive_name'], 'options') self.assertEqual(res['subprojects'], []) - testfile = os.path.join(self.common_test_dir, '47 subproject options', 'meson.build') + testfile = os.path.join(self.common_test_dir, '46 subproject options', 'meson.build') res = self.introspect_directory(testfile, '--projectinfo') self.assertEqual(set(res['buildsystem_files']), set(['meson_options.txt', 'meson.build'])) self.assertEqual(res['version'], 'undefined') @@ -3430,7 +3430,7 @@ recommended as it is not supported on some platforms''') self.assertEqual(res['subprojects'][0]['descriptive_name'], 'subproject') def test_introspect_projectinfo_subprojects(self): - testdir = os.path.join(self.common_test_dir, '103 subproject subdir') + testdir = os.path.join(self.common_test_dir, '102 subproject subdir') self.init(testdir) res = self.introspect('--projectinfo') expected = { @@ -3448,7 +3448,7 @@ recommended as it is not supported on some platforms''') self.assertDictEqual(res, expected) def test_introspection_target_subproject(self): - testdir = os.path.join(self.common_test_dir, '46 subproject') + testdir = os.path.join(self.common_test_dir, '45 subproject') self.init(testdir) res = self.introspect('--targets') @@ -3463,14 +3463,14 @@ recommended as it is not supported on some platforms''') self.assertEqual(entry['subproject'], expected[name]) def test_introspect_projectinfo_subproject_dir(self): - testdir = os.path.join(self.common_test_dir, '79 custom subproject dir') + testdir = os.path.join(self.common_test_dir, '78 custom subproject dir') self.init(testdir) res = self.introspect('--projectinfo') self.assertEqual(res['subproject_dir'], 'custom_subproject_dir') def test_introspect_projectinfo_subproject_dir_from_source(self): - testfile = os.path.join(self.common_test_dir, '79 custom subproject dir', 'meson.build') + testfile = os.path.join(self.common_test_dir, '78 custom subproject dir', 'meson.build') res = self.introspect_directory(testfile, '--projectinfo') self.assertEqual(res['subproject_dir'], 'custom_subproject_dir') @@ -3479,7 +3479,7 @@ recommended as it is not supported on some platforms''') def test_clang_format(self): if self.backend is not Backend.ninja: raise unittest.SkipTest('Clang-format is for now only supported on Ninja, not {}'.format(self.backend.name)) - testdir = os.path.join(self.unit_test_dir, '53 clang-format') + testdir = os.path.join(self.unit_test_dir, '54 clang-format') testfile = os.path.join(testdir, 'prog.c') badfile = os.path.join(testdir, 'prog_orig_c') goodfile = os.path.join(testdir, 'prog_expected_c') @@ -3504,7 +3504,7 @@ recommended as it is not supported on some platforms''') os.unlink(testheader) def test_introspect_buildoptions_without_configured_build(self): - testdir = os.path.join(self.unit_test_dir, '56 introspect buildoptions') + testdir = os.path.join(self.unit_test_dir, '59 introspect buildoptions') testfile = os.path.join(testdir, 'meson.build') res_nb = self.introspect_directory(testfile, ['--buildoptions'] + self.meson_args) self.init(testdir, default_args=False) @@ -3513,7 +3513,7 @@ recommended as it is not supported on some platforms''') self.assertListEqual(res_nb, res_wb) def test_introspect_json_dump(self): - testdir = os.path.join(self.unit_test_dir, '55 introspection') + testdir = os.path.join(self.unit_test_dir, '57 introspection') self.init(testdir) infodir = os.path.join(self.builddir, 'meson-info') self.assertPathExists(infodir) @@ -3663,7 +3663,7 @@ recommended as it is not supported on some platforms''') self.assertDictEqual(targets_to_find, {}) def test_introspect_file_dump_equals_all(self): - testdir = os.path.join(self.unit_test_dir, '55 introspection') + testdir = os.path.join(self.unit_test_dir, '57 introspection') self.init(testdir) res_all = self.introspect('--all') res_file = {} @@ -3690,7 +3690,7 @@ recommended as it is not supported on some platforms''') self.assertEqual(res_all, res_file) def test_introspect_meson_info(self): - testdir = os.path.join(self.unit_test_dir, '55 introspection') + testdir = os.path.join(self.unit_test_dir, '57 introspection') introfile = os.path.join(self.builddir, 'meson-info', 'meson-info.json') self.init(testdir) self.assertPathExists(introfile) @@ -3704,7 +3704,7 @@ recommended as it is not supported on some platforms''') self.assertEqual(res1['build_files_updated'], True) def test_introspect_config_update(self): - testdir = os.path.join(self.unit_test_dir, '55 introspection') + testdir = os.path.join(self.unit_test_dir, '57 introspection') introfile = os.path.join(self.builddir, 'meson-info', 'intro-buildoptions.json') self.init(testdir) self.assertPathExists(introfile) @@ -3730,7 +3730,7 @@ recommended as it is not supported on some platforms''') self.assertListEqual(res1, res2) def test_introspect_targets_from_source(self): - testdir = os.path.join(self.unit_test_dir, '55 introspection') + testdir = os.path.join(self.unit_test_dir, '57 introspection') testfile = os.path.join(testdir, 'meson.build') introfile = os.path.join(self.builddir, 'meson-info', 'intro-targets.json') self.init(testdir) @@ -3761,7 +3761,7 @@ recommended as it is not supported on some platforms''') self.assertListEqual(res_nb, res_wb) def test_introspect_dependencies_from_source(self): - testdir = os.path.join(self.unit_test_dir, '55 introspection') + testdir = os.path.join(self.unit_test_dir, '57 introspection') testfile = os.path.join(testdir, 'meson.build') res_nb = self.introspect_directory(testfile, ['--scan-dependencies'] + self.meson_args) expected = [ @@ -3807,19 +3807,19 @@ recommended as it is not supported on some platforms''') @skip_if_no_cmake def test_cmake_prefix_path(self): - testdir = os.path.join(self.unit_test_dir, '60 cmake_prefix_path') + testdir = os.path.join(self.unit_test_dir, '64 cmake_prefix_path') self.init(testdir, extra_args=['-Dcmake_prefix_path=' + os.path.join(testdir, 'prefix')]) @skip_if_no_cmake def test_cmake_parser(self): - testdir = os.path.join(self.unit_test_dir, '61 cmake parser') + testdir = os.path.join(self.unit_test_dir, '65 cmake parser') self.init(testdir, extra_args=['-Dcmake_prefix_path=' + os.path.join(testdir, 'prefix')]) def test_alias_target(self): if self.backend is Backend.vs: # FIXME: This unit test is broken with vs backend, needs investigation raise unittest.SkipTest('Skipping alias_target test with {} backend'.format(self.backend.name)) - testdir = os.path.join(self.unit_test_dir, '62 alias target') + testdir = os.path.join(self.unit_test_dir, '66 alias target') self.init(testdir) self.build() self.assertPathDoesNotExist(os.path.join(self.builddir, 'prog' + exe_suffix)) @@ -4287,7 +4287,7 @@ class DarwinTests(BasePlatformTests): ''' Same as above, just for shared_module() ''' - testdir = os.path.join(self.common_test_dir, '153 shared module resolving symbol in executable') + testdir = os.path.join(self.common_test_dir, '152 shared module resolving symbol in executable') # Ensure that it builds even with bitcode enabled self.init(testdir, extra_args='-Db_bitcode=true') self.build() @@ -4393,7 +4393,7 @@ class LinuxlikeTests(BasePlatformTests): need to run pkg-config outside of a Meson build file. https://github.com/mesonbuild/meson/issues/889 ''' - testdir = os.path.join(self.common_test_dir, '48 pkgconfig-gen') + testdir = os.path.join(self.common_test_dir, '47 pkgconfig-gen') self.init(testdir) env = get_fake_env(testdir, self.builddir, self.prefix) kwargs = {'required': True, 'silent': True} @@ -4409,12 +4409,12 @@ class LinuxlikeTests(BasePlatformTests): ''' Test that generated pkg-config files correctly handle dependencies ''' - testdir = os.path.join(self.common_test_dir, '48 pkgconfig-gen') + testdir = os.path.join(self.common_test_dir, '47 pkgconfig-gen') self.init(testdir) privatedir1 = self.privatedir self.new_builddir() - testdir = os.path.join(self.common_test_dir, '48 pkgconfig-gen', 'dependencies') + testdir = os.path.join(self.common_test_dir, '47 pkgconfig-gen', 'dependencies') self.init(testdir, override_envvars={'PKG_CONFIG_LIBDIR': privatedir1}) privatedir2 = self.privatedir @@ -4611,7 +4611,7 @@ class LinuxlikeTests(BasePlatformTests): Test that compiler check flags override all other flags. This can't be an ordinary test case because it needs the environment to be set. ''' - testdir = os.path.join(self.common_test_dir, '40 has function') + testdir = os.path.join(self.common_test_dir, '39 has function') env = get_fake_env(testdir, self.builddir, self.prefix) cpp = env.detect_cpp_compiler(MachineChoice.HOST) Oflag = '-O3' @@ -4628,7 +4628,7 @@ class LinuxlikeTests(BasePlatformTests): if cmd[0] == 'ccache': cmd = cmd[1:] # Verify that -I flags from the `args` kwarg are first - # This is set in the '40 has function' test case + # This is set in the '39 has function' test case self.assertEqual(cmd[1], '-I/tmp') # Verify that -O3 set via the environment is overridden by -O0 Oargs = [arg for arg in cmd if arg.startswith('-O')] @@ -4716,7 +4716,7 @@ class LinuxlikeTests(BasePlatformTests): self._test_stds_impl(testdir, cpp, 'cpp') def test_unity_subproj(self): - testdir = os.path.join(self.common_test_dir, '46 subproject') + testdir = os.path.join(self.common_test_dir, '45 subproject') self.init(testdir, extra_args='--unity=subprojects') simpletest_id = Target.construct_id_from_path('subprojects/sublib', 'simpletest', '@exe') self.assertPathExists(os.path.join(self.builddir, 'subprojects/sublib', simpletest_id, 'simpletest-unity.c')) @@ -4765,7 +4765,7 @@ class LinuxlikeTests(BasePlatformTests): self.wipe() # Test directory modes - testdir = os.path.join(self.common_test_dir, '63 install subdir') + testdir = os.path.join(self.common_test_dir, '62 install subdir') self.init(testdir) self.install() @@ -4782,7 +4782,7 @@ class LinuxlikeTests(BasePlatformTests): ''' Test that files are installed with correct permissions using install_mode. ''' - testdir = os.path.join(self.common_test_dir, '196 install_mode') + testdir = os.path.join(self.common_test_dir, '195 install_mode') self.init(testdir) self.build() self.install() @@ -5146,7 +5146,7 @@ endian = 'little' @skipIfNoPkgconfig def test_pkgconfig_relative_paths(self): - testdir = os.path.join(self.unit_test_dir, '58 pkgconfig relative paths') + testdir = os.path.join(self.unit_test_dir, '62 pkgconfig relative paths') pkg_dir = os.path.join(testdir, 'pkgconfig') self.assertTrue(os.path.exists(os.path.join(pkg_dir, 'librelativepath.pc'))) @@ -5211,7 +5211,7 @@ endian = 'little' ''' Test that libraries are listed before their dependencies. ''' - testdir = os.path.join(self.unit_test_dir, '52 pkgconfig static link order') + testdir = os.path.join(self.unit_test_dir, '53 pkgconfig static link order') self.init(testdir) myenv = os.environ.copy() myenv['PKG_CONFIG_PATH'] = self.privatedir @@ -5255,7 +5255,7 @@ endian = 'little' ''' Test that we produce the correct dependencies when a program is overridden with an executable. ''' - testdir = os.path.join(self.common_test_dir, '202 override with exe') + testdir = os.path.join(self.common_test_dir, '201 override with exe') self.init(testdir) with open(os.path.join(self.builddir, 'build.ninja')) as bfile: for line in bfile: @@ -5345,17 +5345,17 @@ endian = 'little' os.chdir(curdir) def test_install_subdir_symlinks(self): - self.install_subdir_invalid_symlinks('63 install subdir', os.path.join('sub', 'sub1')) + self.install_subdir_invalid_symlinks('62 install subdir', os.path.join('sub', 'sub1')) def test_install_subdir_symlinks_with_default_umask(self): - self.install_subdir_invalid_symlinks('196 install_mode', 'sub2') + self.install_subdir_invalid_symlinks('195 install_mode', 'sub2') def test_install_subdir_symlinks_with_default_umask_and_mode(self): - self.install_subdir_invalid_symlinks('196 install_mode', 'sub1') + self.install_subdir_invalid_symlinks('195 install_mode', 'sub1') @skipIfNoPkgconfigDep('gmodule-2.0') def test_ldflag_dedup(self): - testdir = os.path.join(self.unit_test_dir, '51 ldflagdedup') + testdir = os.path.join(self.unit_test_dir, '52 ldflagdedup') if is_cygwin() or is_osx(): raise unittest.SkipTest('Not applicable on Cygwin or OSX.') self.init(testdir) @@ -5368,7 +5368,7 @@ endian = 'little' self.assertEqual(max_count, 1, 'Export dynamic incorrectly deduplicated.') def test_compiler_libs_static_dedup(self): - testdir = os.path.join(self.unit_test_dir, '55 dedup compiler libs') + testdir = os.path.join(self.unit_test_dir, '56 dedup compiler libs') self.init(testdir) build_ninja = os.path.join(self.builddir, 'build.ninja') with open(build_ninja, 'r', encoding='utf-8') as f: @@ -5382,7 +5382,7 @@ endian = 'little' @skipIfNoPkgconfig def test_pkg_config_option(self): - testdir = os.path.join(self.unit_test_dir, '55 pkg_config_path option') + testdir = os.path.join(self.unit_test_dir, '58 pkg_config_path option') self.init(testdir, extra_args=[ '-Dbuild.pkg_config_path=' + os.path.join(testdir, 'build_extra_path'), '-Dpkg_config_path=' + os.path.join(testdir, 'host_extra_path'), @@ -5390,14 +5390,14 @@ endian = 'little' def test_std_remains(self): # C_std defined in project options must be in effect also when native compiling. - testdir = os.path.join(self.unit_test_dir, '50 std remains') + testdir = os.path.join(self.unit_test_dir, '51 std remains') self.init(testdir) compdb = self.get_compdb() self.assertRegex(compdb[0]['command'], '-std=c99') self.build() def test_identity_cross(self): - testdir = os.path.join(self.unit_test_dir, '58 identity cross') + testdir = os.path.join(self.unit_test_dir, '61 identity cross') crossfile = tempfile.NamedTemporaryFile(mode='w') env = {'CC': '"' + os.path.join(testdir, 'build_wrapper.py') + '"'} crossfile.write('''[binaries] @@ -5461,7 +5461,7 @@ class LinuxCrossArmTests(BasePlatformTests): def test_std_remains(self): # C_std defined in project options must be in effect also when cross compiling. - testdir = os.path.join(self.unit_test_dir, '50 std remains') + testdir = os.path.join(self.unit_test_dir, '51 std remains') self.init(testdir) compdb = self.get_compdb() self.assertRegex(compdb[0]['command'], '-std=c99') @@ -5519,7 +5519,7 @@ class LinuxCrossMingwTests(BasePlatformTests): @skipIfNoPkgconfig def test_cross_pkg_config_option(self): - testdir = os.path.join(self.unit_test_dir, '55 pkg_config_path option') + testdir = os.path.join(self.unit_test_dir, '58 pkg_config_path option') self.init(testdir, extra_args=[ '-Dbuild.pkg_config_path=' + os.path.join(testdir, 'build_extra_path'), '-Dpkg_config_path=' + os.path.join(testdir, 'host_extra_path'), @@ -6216,12 +6216,12 @@ class NativeFileTests(BasePlatformTests): self.assertEqual(compiler.version, '1.2345') def test_native_file_dirs(self): - testcase = os.path.join(self.unit_test_dir, '57 native file override') + testcase = os.path.join(self.unit_test_dir, '60 native file override') self.init(testcase, default_args=False, extra_args=['--native-file', os.path.join(testcase, 'nativefile')]) def test_native_file_dirs_overriden(self): - testcase = os.path.join(self.unit_test_dir, '57 native file override') + testcase = os.path.join(self.unit_test_dir, '60 native file override') self.init(testcase, default_args=False, extra_args=['--native-file', os.path.join(testcase, 'nativefile'), '-Ddef_libdir=liblib', '-Dlibdir=liblib']) @@ -6251,7 +6251,7 @@ class CrossFileTests(BasePlatformTests): """ def test_cross_file_dirs(self): - testcase = os.path.join(self.unit_test_dir, '57 native file override') + testcase = os.path.join(self.unit_test_dir, '60 native file override') self.init(testcase, default_args=False, extra_args=['--native-file', os.path.join(testcase, 'nativefile'), '--cross-file', os.path.join(testcase, 'crossfile'), @@ -6269,7 +6269,7 @@ class CrossFileTests(BasePlatformTests): '-Ddef_sysconfdir=sysconfbar']) def test_cross_file_dirs_overriden(self): - testcase = os.path.join(self.unit_test_dir, '57 native file override') + testcase = os.path.join(self.unit_test_dir, '60 native file override') self.init(testcase, default_args=False, extra_args=['--native-file', os.path.join(testcase, 'nativefile'), '--cross-file', os.path.join(testcase, 'crossfile'), @@ -6288,7 +6288,7 @@ class CrossFileTests(BasePlatformTests): def test_cross_file_dirs_chain(self): # crossfile2 overrides crossfile overrides nativefile - testcase = os.path.join(self.unit_test_dir, '57 native file override') + testcase = os.path.join(self.unit_test_dir, '60 native file override') self.init(testcase, default_args=False, extra_args=['--native-file', os.path.join(testcase, 'nativefile'), '--cross-file', os.path.join(testcase, 'crossfile'), diff --git a/test cases/cmake/10 cmake_module_path/cmake/FindSomethingLikePython.cmake b/test cases/cmake/10 cmake_module_path/cmake/FindSomethingLikePython.cmake deleted file mode 100644 index 4a189bf..0000000 --- a/test cases/cmake/10 cmake_module_path/cmake/FindSomethingLikePython.cmake +++ /dev/null @@ -1,24 +0,0 @@ -cmake_policy(VERSION 3.7) - -if(CMAKE_VERSION VERSION_GREATER_EQUAL 3.12) - find_package(Python COMPONENTS Interpreter) -else() - find_package(PythonInterp) -endif() - -if(Python_FOUND OR PYTHONINTERP_FOUND) - set(SomethingLikePython_FOUND ON) - set(SomethingLikePython_EXECUTABLE ${Python_EXECUTABLE}) - - if(NOT DEFINED Python_VERSION) - set(Python_VERSION ${Python_VERSION_STRING}) - endif() - if(NOT TARGET Python::Interpreter) - add_executable(Python::Interpreter IMPORTED) - set_target_properties(Python::Interpreter PROPERTIES - IMPORTED_LOCATION ${Python_EXECUTABLE} - VERSION ${Python_VERSION}) - endif() -else() - set(SomethingLikePython_FOUND OFF) -endif() diff --git a/test cases/cmake/10 cmake_module_path/meson.build b/test cases/cmake/10 cmake_module_path/meson.build deleted file mode 100644 index 2259268..0000000 --- a/test cases/cmake/10 cmake_module_path/meson.build +++ /dev/null @@ -1,17 +0,0 @@ -# We use Python3 as it's the only thing guaranteed to be available on any platform Meson can run on (unlike Zlib in linuxlike/13 cmake dependency). - -project('user CMake find_package module using cmake_module_path', - meson_version: '>= 0.50.0') - -if not find_program('cmake', required: false).found() - error('MESON_SKIP_TEST cmake binary not available.') -endif - -# NOTE: can't request Python3 via dependency('Python3', method: 'cmake') -# Meson intercepts and wants "method: auto" - -# Try to find a dependency with a custom CMake module - -dependency('SomethingLikePython', required : true, method : 'cmake', cmake_module_path : 'cmake', modules: 'Python::Interpreter') - -dependency('SomethingLikePython', method : 'cmake', cmake_module_path : ['doesNotExist', 'cmake'], modules: 'Python::Interpreter') diff --git a/test cases/cmake/10 generator expressions/main.cpp b/test cases/cmake/10 generator expressions/main.cpp deleted file mode 100644 index 315c0f7..0000000 --- a/test cases/cmake/10 generator expressions/main.cpp +++ /dev/null @@ -1,10 +0,0 @@ -#include -#include - -using namespace std; - -int main() { - cmModClass obj("Hello"); - cout << obj.getStr() << endl; - return 0; -} diff --git a/test cases/cmake/10 generator expressions/meson.build b/test cases/cmake/10 generator expressions/meson.build deleted file mode 100644 index ca08a3f..0000000 --- a/test cases/cmake/10 generator expressions/meson.build +++ /dev/null @@ -1,12 +0,0 @@ -project('cmakeSubTest', ['c', 'cpp']) - -cm = import('cmake') - -sub_pro = cm.subproject('cmMod') -sub_dep = sub_pro.dependency('cmModLib') - -assert(sub_pro.target_list() == ['cmModLib'], 'There should be exactly one target') -assert(sub_pro.target_type('cmModLib') == 'header_only', 'Target type should be header_only') - -exe1 = executable('main', ['main.cpp'], dependencies: [sub_dep]) -test('test1', exe1) diff --git a/test cases/cmake/10 generator expressions/subprojects/cmMod/CMakeLists.txt b/test cases/cmake/10 generator expressions/subprojects/cmMod/CMakeLists.txt deleted file mode 100644 index dc4f9e4..0000000 --- a/test cases/cmake/10 generator expressions/subprojects/cmMod/CMakeLists.txt +++ /dev/null @@ -1,22 +0,0 @@ -cmake_minimum_required(VERSION 3.5) - -project(cmMod) -set (CMAKE_CXX_STANDARD 14) - -include(GNUInstallDirs) - -add_library(cmModLib INTERFACE) - -target_compile_options(cmModLib - INTERFACE $<$,$>:-DCMAKE_FLAG_ERROR_A> # Check discard = false - INTERFACE "-DCMAKE_FLAG_REQUIRED_A" - INTERFACE $<$>,$>>:-DCMAKE_FLAG_REQUIRED_B> - INTERFACE $<$:-DCMAKE_FLAG_REQUIRED_C> -) - -target_include_directories(cmModLib INTERFACE - $ - $ -) - -target_compile_definitions(cmModLib INTERFACE -DCMAKE_COMPILER_DEFINE_STR="compDef") diff --git a/test cases/cmake/10 generator expressions/subprojects/cmMod/include/cmMod.hpp b/test cases/cmake/10 generator expressions/subprojects/cmMod/include/cmMod.hpp deleted file mode 100644 index 1f00107..0000000 --- a/test cases/cmake/10 generator expressions/subprojects/cmMod/include/cmMod.hpp +++ /dev/null @@ -1,31 +0,0 @@ -#pragma once - -#include - -#ifndef CMAKE_FLAG_REQUIRED_A -#error "The flag CMAKE_FLAG_REQUIRED_A was not set" -#endif - -#ifndef CMAKE_FLAG_REQUIRED_B -#error "The flag CMAKE_FLAG_REQUIRED_B was not set" -#endif - -#ifndef CMAKE_FLAG_REQUIRED_C -#error "The flag CMAKE_FLAG_REQUIRED_C was not set" -#endif - -#ifdef CMAKE_FLAG_ERROR_A -#error "The flag CMAKE_FLAG_ERROR_A was set" -#endif - -class cmModClass { - private: - std::string str; - public: - cmModClass(std::string foo) { - str = foo + " World "; - str += CMAKE_COMPILER_DEFINE_STR; - } - - inline std::string getStr() const { return str; } -}; diff --git a/test cases/cmake/10 header only/main.cpp b/test cases/cmake/10 header only/main.cpp new file mode 100644 index 0000000..315c0f7 --- /dev/null +++ b/test cases/cmake/10 header only/main.cpp @@ -0,0 +1,10 @@ +#include +#include + +using namespace std; + +int main() { + cmModClass obj("Hello"); + cout << obj.getStr() << endl; + return 0; +} diff --git a/test cases/cmake/10 header only/meson.build b/test cases/cmake/10 header only/meson.build new file mode 100644 index 0000000..ca08a3f --- /dev/null +++ b/test cases/cmake/10 header only/meson.build @@ -0,0 +1,12 @@ +project('cmakeSubTest', ['c', 'cpp']) + +cm = import('cmake') + +sub_pro = cm.subproject('cmMod') +sub_dep = sub_pro.dependency('cmModLib') + +assert(sub_pro.target_list() == ['cmModLib'], 'There should be exactly one target') +assert(sub_pro.target_type('cmModLib') == 'header_only', 'Target type should be header_only') + +exe1 = executable('main', ['main.cpp'], dependencies: [sub_dep]) +test('test1', exe1) diff --git a/test cases/cmake/10 header only/subprojects/cmMod/CMakeLists.txt b/test cases/cmake/10 header only/subprojects/cmMod/CMakeLists.txt new file mode 100644 index 0000000..f5d9a47 --- /dev/null +++ b/test cases/cmake/10 header only/subprojects/cmMod/CMakeLists.txt @@ -0,0 +1,11 @@ +cmake_minimum_required(VERSION 3.5) + +project(cmMod) +set (CMAKE_CXX_STANDARD 14) + +add_definitions("-DDO_NOTHING_JUST_A_FLAG=1") + +add_library(cmModLib INTERFACE) +set_target_properties(cmModLib PROPERTIES INTERFACE_COMPILE_OPTIONS "-DCMAKE_FLAG_MUST_BE_PRESENT") +target_include_directories(cmModLib INTERFACE "${CMAKE_CURRENT_SOURCE_DIR}" "${CMAKE_CURRENT_SOURCE_DIR}/include") +target_compile_definitions(cmModLib INTERFACE -DCMAKE_COMPILER_DEFINE_STR="compDef") diff --git a/test cases/cmake/10 header only/subprojects/cmMod/include/cmMod.hpp b/test cases/cmake/10 header only/subprojects/cmMod/include/cmMod.hpp new file mode 100644 index 0000000..7ea72f7 --- /dev/null +++ b/test cases/cmake/10 header only/subprojects/cmMod/include/cmMod.hpp @@ -0,0 +1,19 @@ +#pragma once + +#include + +#ifndef CMAKE_FLAG_MUST_BE_PRESENT +#error "The flag CMAKE_FLAG_MUST_BE_PRESENT was not set" +#endif + +class cmModClass { + private: + std::string str; + public: + cmModClass(std::string foo) { + str = foo + " World "; + str += CMAKE_COMPILER_DEFINE_STR; + } + + inline std::string getStr() const { return str; } +}; diff --git a/test cases/cmake/11 cmake_module_path/cmake/FindSomethingLikePython.cmake b/test cases/cmake/11 cmake_module_path/cmake/FindSomethingLikePython.cmake new file mode 100644 index 0000000..4a189bf --- /dev/null +++ b/test cases/cmake/11 cmake_module_path/cmake/FindSomethingLikePython.cmake @@ -0,0 +1,24 @@ +cmake_policy(VERSION 3.7) + +if(CMAKE_VERSION VERSION_GREATER_EQUAL 3.12) + find_package(Python COMPONENTS Interpreter) +else() + find_package(PythonInterp) +endif() + +if(Python_FOUND OR PYTHONINTERP_FOUND) + set(SomethingLikePython_FOUND ON) + set(SomethingLikePython_EXECUTABLE ${Python_EXECUTABLE}) + + if(NOT DEFINED Python_VERSION) + set(Python_VERSION ${Python_VERSION_STRING}) + endif() + if(NOT TARGET Python::Interpreter) + add_executable(Python::Interpreter IMPORTED) + set_target_properties(Python::Interpreter PROPERTIES + IMPORTED_LOCATION ${Python_EXECUTABLE} + VERSION ${Python_VERSION}) + endif() +else() + set(SomethingLikePython_FOUND OFF) +endif() diff --git a/test cases/cmake/11 cmake_module_path/meson.build b/test cases/cmake/11 cmake_module_path/meson.build new file mode 100644 index 0000000..2259268 --- /dev/null +++ b/test cases/cmake/11 cmake_module_path/meson.build @@ -0,0 +1,17 @@ +# We use Python3 as it's the only thing guaranteed to be available on any platform Meson can run on (unlike Zlib in linuxlike/13 cmake dependency). + +project('user CMake find_package module using cmake_module_path', + meson_version: '>= 0.50.0') + +if not find_program('cmake', required: false).found() + error('MESON_SKIP_TEST cmake binary not available.') +endif + +# NOTE: can't request Python3 via dependency('Python3', method: 'cmake') +# Meson intercepts and wants "method: auto" + +# Try to find a dependency with a custom CMake module + +dependency('SomethingLikePython', required : true, method : 'cmake', cmake_module_path : 'cmake', modules: 'Python::Interpreter') + +dependency('SomethingLikePython', method : 'cmake', cmake_module_path : ['doesNotExist', 'cmake'], modules: 'Python::Interpreter') diff --git a/test cases/cmake/12 generator expressions/main.cpp b/test cases/cmake/12 generator expressions/main.cpp new file mode 100644 index 0000000..315c0f7 --- /dev/null +++ b/test cases/cmake/12 generator expressions/main.cpp @@ -0,0 +1,10 @@ +#include +#include + +using namespace std; + +int main() { + cmModClass obj("Hello"); + cout << obj.getStr() << endl; + return 0; +} diff --git a/test cases/cmake/12 generator expressions/meson.build b/test cases/cmake/12 generator expressions/meson.build new file mode 100644 index 0000000..ca08a3f --- /dev/null +++ b/test cases/cmake/12 generator expressions/meson.build @@ -0,0 +1,12 @@ +project('cmakeSubTest', ['c', 'cpp']) + +cm = import('cmake') + +sub_pro = cm.subproject('cmMod') +sub_dep = sub_pro.dependency('cmModLib') + +assert(sub_pro.target_list() == ['cmModLib'], 'There should be exactly one target') +assert(sub_pro.target_type('cmModLib') == 'header_only', 'Target type should be header_only') + +exe1 = executable('main', ['main.cpp'], dependencies: [sub_dep]) +test('test1', exe1) diff --git a/test cases/cmake/12 generator expressions/subprojects/cmMod/CMakeLists.txt b/test cases/cmake/12 generator expressions/subprojects/cmMod/CMakeLists.txt new file mode 100644 index 0000000..dc4f9e4 --- /dev/null +++ b/test cases/cmake/12 generator expressions/subprojects/cmMod/CMakeLists.txt @@ -0,0 +1,22 @@ +cmake_minimum_required(VERSION 3.5) + +project(cmMod) +set (CMAKE_CXX_STANDARD 14) + +include(GNUInstallDirs) + +add_library(cmModLib INTERFACE) + +target_compile_options(cmModLib + INTERFACE $<$,$>:-DCMAKE_FLAG_ERROR_A> # Check discard = false + INTERFACE "-DCMAKE_FLAG_REQUIRED_A" + INTERFACE $<$>,$>>:-DCMAKE_FLAG_REQUIRED_B> + INTERFACE $<$:-DCMAKE_FLAG_REQUIRED_C> +) + +target_include_directories(cmModLib INTERFACE + $ + $ +) + +target_compile_definitions(cmModLib INTERFACE -DCMAKE_COMPILER_DEFINE_STR="compDef") diff --git a/test cases/cmake/12 generator expressions/subprojects/cmMod/include/cmMod.hpp b/test cases/cmake/12 generator expressions/subprojects/cmMod/include/cmMod.hpp new file mode 100644 index 0000000..1f00107 --- /dev/null +++ b/test cases/cmake/12 generator expressions/subprojects/cmMod/include/cmMod.hpp @@ -0,0 +1,31 @@ +#pragma once + +#include + +#ifndef CMAKE_FLAG_REQUIRED_A +#error "The flag CMAKE_FLAG_REQUIRED_A was not set" +#endif + +#ifndef CMAKE_FLAG_REQUIRED_B +#error "The flag CMAKE_FLAG_REQUIRED_B was not set" +#endif + +#ifndef CMAKE_FLAG_REQUIRED_C +#error "The flag CMAKE_FLAG_REQUIRED_C was not set" +#endif + +#ifdef CMAKE_FLAG_ERROR_A +#error "The flag CMAKE_FLAG_ERROR_A was set" +#endif + +class cmModClass { + private: + std::string str; + public: + cmModClass(std::string foo) { + str = foo + " World "; + str += CMAKE_COMPILER_DEFINE_STR; + } + + inline std::string getStr() const { return str; } +}; diff --git a/test cases/cmake/9 header only/main.cpp b/test cases/cmake/9 header only/main.cpp deleted file mode 100644 index 315c0f7..0000000 --- a/test cases/cmake/9 header only/main.cpp +++ /dev/null @@ -1,10 +0,0 @@ -#include -#include - -using namespace std; - -int main() { - cmModClass obj("Hello"); - cout << obj.getStr() << endl; - return 0; -} diff --git a/test cases/cmake/9 header only/meson.build b/test cases/cmake/9 header only/meson.build deleted file mode 100644 index ca08a3f..0000000 --- a/test cases/cmake/9 header only/meson.build +++ /dev/null @@ -1,12 +0,0 @@ -project('cmakeSubTest', ['c', 'cpp']) - -cm = import('cmake') - -sub_pro = cm.subproject('cmMod') -sub_dep = sub_pro.dependency('cmModLib') - -assert(sub_pro.target_list() == ['cmModLib'], 'There should be exactly one target') -assert(sub_pro.target_type('cmModLib') == 'header_only', 'Target type should be header_only') - -exe1 = executable('main', ['main.cpp'], dependencies: [sub_dep]) -test('test1', exe1) diff --git a/test cases/cmake/9 header only/subprojects/cmMod/CMakeLists.txt b/test cases/cmake/9 header only/subprojects/cmMod/CMakeLists.txt deleted file mode 100644 index f5d9a47..0000000 --- a/test cases/cmake/9 header only/subprojects/cmMod/CMakeLists.txt +++ /dev/null @@ -1,11 +0,0 @@ -cmake_minimum_required(VERSION 3.5) - -project(cmMod) -set (CMAKE_CXX_STANDARD 14) - -add_definitions("-DDO_NOTHING_JUST_A_FLAG=1") - -add_library(cmModLib INTERFACE) -set_target_properties(cmModLib PROPERTIES INTERFACE_COMPILE_OPTIONS "-DCMAKE_FLAG_MUST_BE_PRESENT") -target_include_directories(cmModLib INTERFACE "${CMAKE_CURRENT_SOURCE_DIR}" "${CMAKE_CURRENT_SOURCE_DIR}/include") -target_compile_definitions(cmModLib INTERFACE -DCMAKE_COMPILER_DEFINE_STR="compDef") diff --git a/test cases/cmake/9 header only/subprojects/cmMod/include/cmMod.hpp b/test cases/cmake/9 header only/subprojects/cmMod/include/cmMod.hpp deleted file mode 100644 index 7ea72f7..0000000 --- a/test cases/cmake/9 header only/subprojects/cmMod/include/cmMod.hpp +++ /dev/null @@ -1,19 +0,0 @@ -#pragma once - -#include - -#ifndef CMAKE_FLAG_MUST_BE_PRESENT -#error "The flag CMAKE_FLAG_MUST_BE_PRESENT was not set" -#endif - -class cmModClass { - private: - std::string str; - public: - cmModClass(std::string foo) { - str = foo + " World "; - str += CMAKE_COMPILER_DEFINE_STR; - } - - inline std::string getStr() const { return str; } -}; diff --git a/test cases/common/100 manygen/depuser.c b/test cases/common/100 manygen/depuser.c deleted file mode 100644 index 1a825e0..0000000 --- a/test cases/common/100 manygen/depuser.c +++ /dev/null @@ -1,8 +0,0 @@ -#include"gen_func.h" - -int main(int argc, char **argv) { - unsigned int i = (unsigned int) gen_func_in_lib(); - unsigned int j = (unsigned int) gen_func_in_obj(); - unsigned int k = (unsigned int) gen_func_in_src(); - return (int)(i + j + k); -} diff --git a/test cases/common/100 manygen/meson.build b/test cases/common/100 manygen/meson.build deleted file mode 100644 index e70a55a..0000000 --- a/test cases/common/100 manygen/meson.build +++ /dev/null @@ -1,14 +0,0 @@ -project('manygen', 'c') - -if meson.is_cross_build() - # FIXME error out with skip message once cross test runner - # recognizes it. - message('Not running this test during cross build.') -else - subdir('subdir') - - exe = executable('depuser', 'depuser.c', - generated) - - test('depuser test', exe) -endif diff --git a/test cases/common/100 manygen/subdir/funcinfo.def b/test cases/common/100 manygen/subdir/funcinfo.def deleted file mode 100644 index b074186..0000000 --- a/test cases/common/100 manygen/subdir/funcinfo.def +++ /dev/null @@ -1 +0,0 @@ -gen_func diff --git a/test cases/common/100 manygen/subdir/manygen.py b/test cases/common/100 manygen/subdir/manygen.py deleted file mode 100755 index 0fbc2ec..0000000 --- a/test cases/common/100 manygen/subdir/manygen.py +++ /dev/null @@ -1,83 +0,0 @@ -#!/usr/bin/env python - -from __future__ import print_function - -# Generates a static library, object file, source -# file and a header file. - -import sys, os -import subprocess - -with open(sys.argv[1]) as f: - funcname = f.readline().strip() -outdir = sys.argv[2] -buildtype_args = sys.argv[3] -compiler_type = sys.argv[4] -compiler = sys.argv[5:] - -if not os.path.isdir(outdir): - print('Outdir does not exist.') - sys.exit(1) - -if compiler_type == 'msvc': - libsuffix = '.lib' - is_vs = True - if any(['clang-cl' in c for c in compiler]): - linker = 'llvm-lib' - else: - linker = 'lib' -else: - libsuffix = '.a' - is_vs = False - linker = 'ar' - -objsuffix = '.o' - -outo = os.path.join(outdir, funcname + objsuffix) -outa = os.path.join(outdir, funcname + libsuffix) -outh = os.path.join(outdir, funcname + '.h') -outc = os.path.join(outdir, funcname + '.c') - -tmpc = 'diibadaaba.c' -tmpo = 'diibadaaba' + objsuffix - -with open(outc, 'w') as f: - f.write('''#include"%s.h" -int %s_in_src() { - return 0; -} -''' % (funcname, funcname)) - -with open(outh, 'w') as f: - f.write('''#pragma once -int %s_in_lib(); -int %s_in_obj(); -int %s_in_src(); -''' % (funcname, funcname, funcname)) - -with open(tmpc, 'w') as f: - f.write('''int %s_in_obj() { - return 0; -} -''' % funcname) - -if is_vs: - subprocess.check_call(compiler + ['/nologo', '/c', buildtype_args, '/Fo' + outo, tmpc]) -else: - subprocess.check_call(compiler + ['-c', '-o', outo, tmpc]) - -with open(tmpc, 'w') as f: - f.write('''int %s_in_lib() { - return 0; -} -''' % funcname) - -if is_vs: - subprocess.check_call(compiler + ['/nologo', '/c', '/Fo' + tmpo, tmpc]) - subprocess.check_call([linker, '/NOLOGO', '/OUT:' + outa, tmpo]) -else: - subprocess.check_call(compiler + ['-c', '-o', tmpo, tmpc]) - subprocess.check_call([linker, 'csr', outa, tmpo]) - -os.unlink(tmpo) -os.unlink(tmpc) diff --git a/test cases/common/100 manygen/subdir/meson.build b/test cases/common/100 manygen/subdir/meson.build deleted file mode 100644 index 56f60e6..0000000 --- a/test cases/common/100 manygen/subdir/meson.build +++ /dev/null @@ -1,26 +0,0 @@ -gen = files('manygen.py') -py3_bin = import('python3').find_python() - -buildtype = get_option('buildtype') -buildtype_args = '-Dfooxxx' # a useless compiler argument -cc = meson.get_compiler('c') -if cc.get_argument_syntax() == 'msvc' - # We need our manually generated code to use the same CRT as the executable. - # Taken from compilers.py since build files do not have access to this. - if buildtype == 'debug' - buildtype_args = '/MDd' - elif buildtype == 'debugoptimized' - buildtype_args = '/MDd' - elif buildtype == 'release' - buildtype_args = '/MD' - endif - outfiles = ['gen_func.lib', 'gen_func.c', 'gen_func.h', 'gen_func.o'] -else - outfiles = ['gen_func.a', 'gen_func.c', 'gen_func.h', 'gen_func.o'] -endif - -generated = custom_target('manygen', - output : outfiles, - input : ['funcinfo.def'], - command : [py3_bin, gen[0], '@INPUT@', '@OUTDIR@', buildtype_args, cc.get_argument_syntax(), cc.cmd_array()], -) diff --git a/test cases/common/100 stringdef/meson.build b/test cases/common/100 stringdef/meson.build new file mode 100644 index 0000000..3f9170e --- /dev/null +++ b/test cases/common/100 stringdef/meson.build @@ -0,0 +1,3 @@ +project('stringdef', 'c') + +test('stringdef', executable('stringdef', 'stringdef.c', c_args : '-DFOO="bar"')) diff --git a/test cases/common/100 stringdef/stringdef.c b/test cases/common/100 stringdef/stringdef.c new file mode 100644 index 0000000..69ea656 --- /dev/null +++ b/test cases/common/100 stringdef/stringdef.c @@ -0,0 +1,10 @@ +#include +#include + +int main(int argc, char **argv) { + if(strcmp(FOO, "bar")) { + printf("FOO is misquoted: %s\n", FOO); + return 1; + } + return 0; +} diff --git a/test cases/common/101 find program path/meson.build b/test cases/common/101 find program path/meson.build new file mode 100644 index 0000000..0a81249 --- /dev/null +++ b/test cases/common/101 find program path/meson.build @@ -0,0 +1,22 @@ +project('find program', 'c') + +python = import('python3').find_python() + +# Source file via string +prog = find_program('program.py') +# Source file via files() +progf = files('program.py') +# Built file +py = configure_file(input : 'program.py', + output : 'builtprogram.py', + configuration : configuration_data()) + +foreach f : [prog, progf, py, find_program(py), find_program(progf)] + ret = run_command(python, f) + assert(ret.returncode() == 0, 'can\'t manually run @0@'.format(prog.path())) + assert(ret.stdout().strip() == 'Found', 'wrong output from manually-run @0@'.format(prog.path())) + + ret = run_command(f) + assert(ret.returncode() == 0, 'can\'t run @0@'.format(prog.path())) + assert(ret.stdout().strip() == 'Found', 'wrong output from @0@'.format(prog.path())) +endforeach diff --git a/test cases/common/101 find program path/program.py b/test cases/common/101 find program path/program.py new file mode 100755 index 0000000..2ebc564 --- /dev/null +++ b/test cases/common/101 find program path/program.py @@ -0,0 +1,3 @@ +#!/usr/bin/env python3 + +print("Found") diff --git a/test cases/common/101 stringdef/meson.build b/test cases/common/101 stringdef/meson.build deleted file mode 100644 index 3f9170e..0000000 --- a/test cases/common/101 stringdef/meson.build +++ /dev/null @@ -1,3 +0,0 @@ -project('stringdef', 'c') - -test('stringdef', executable('stringdef', 'stringdef.c', c_args : '-DFOO="bar"')) diff --git a/test cases/common/101 stringdef/stringdef.c b/test cases/common/101 stringdef/stringdef.c deleted file mode 100644 index 69ea656..0000000 --- a/test cases/common/101 stringdef/stringdef.c +++ /dev/null @@ -1,10 +0,0 @@ -#include -#include - -int main(int argc, char **argv) { - if(strcmp(FOO, "bar")) { - printf("FOO is misquoted: %s\n", FOO); - return 1; - } - return 0; -} diff --git a/test cases/common/102 find program path/meson.build b/test cases/common/102 find program path/meson.build deleted file mode 100644 index 0a81249..0000000 --- a/test cases/common/102 find program path/meson.build +++ /dev/null @@ -1,22 +0,0 @@ -project('find program', 'c') - -python = import('python3').find_python() - -# Source file via string -prog = find_program('program.py') -# Source file via files() -progf = files('program.py') -# Built file -py = configure_file(input : 'program.py', - output : 'builtprogram.py', - configuration : configuration_data()) - -foreach f : [prog, progf, py, find_program(py), find_program(progf)] - ret = run_command(python, f) - assert(ret.returncode() == 0, 'can\'t manually run @0@'.format(prog.path())) - assert(ret.stdout().strip() == 'Found', 'wrong output from manually-run @0@'.format(prog.path())) - - ret = run_command(f) - assert(ret.returncode() == 0, 'can\'t run @0@'.format(prog.path())) - assert(ret.stdout().strip() == 'Found', 'wrong output from @0@'.format(prog.path())) -endforeach diff --git a/test cases/common/102 find program path/program.py b/test cases/common/102 find program path/program.py deleted file mode 100755 index 2ebc564..0000000 --- a/test cases/common/102 find program path/program.py +++ /dev/null @@ -1,3 +0,0 @@ -#!/usr/bin/env python3 - -print("Found") diff --git a/test cases/common/102 subproject subdir/meson.build b/test cases/common/102 subproject subdir/meson.build new file mode 100644 index 0000000..ec9fad1 --- /dev/null +++ b/test cases/common/102 subproject subdir/meson.build @@ -0,0 +1,6 @@ +project('proj', 'c') +subproject('sub') +libSub = dependency('sub', fallback: ['sub', 'libSub']) + +exe = executable('prog', 'prog.c', dependencies: libSub) +test('subproject subdir', exe) diff --git a/test cases/common/102 subproject subdir/prog.c b/test cases/common/102 subproject subdir/prog.c new file mode 100644 index 0000000..cf6f425 --- /dev/null +++ b/test cases/common/102 subproject subdir/prog.c @@ -0,0 +1,5 @@ +#include + +int main() { + return sub(); +} diff --git a/test cases/common/102 subproject subdir/subprojects/sub/lib/meson.build b/test cases/common/102 subproject subdir/subprojects/sub/lib/meson.build new file mode 100644 index 0000000..731d22b --- /dev/null +++ b/test cases/common/102 subproject subdir/subprojects/sub/lib/meson.build @@ -0,0 +1,2 @@ +lib = static_library('sub', 'sub.c') +libSub = declare_dependency(include_directories: include_directories('.'), link_with: lib) diff --git a/test cases/common/102 subproject subdir/subprojects/sub/lib/sub.c b/test cases/common/102 subproject subdir/subprojects/sub/lib/sub.c new file mode 100644 index 0000000..068a5b8 --- /dev/null +++ b/test cases/common/102 subproject subdir/subprojects/sub/lib/sub.c @@ -0,0 +1,5 @@ +#include "sub.h" + +int sub() { + return 0; +} diff --git a/test cases/common/102 subproject subdir/subprojects/sub/lib/sub.h b/test cases/common/102 subproject subdir/subprojects/sub/lib/sub.h new file mode 100644 index 0000000..f1ab0e1 --- /dev/null +++ b/test cases/common/102 subproject subdir/subprojects/sub/lib/sub.h @@ -0,0 +1,6 @@ +#ifndef SUB_H +#define SUB_H + +int sub(); + +#endif diff --git a/test cases/common/102 subproject subdir/subprojects/sub/meson.build b/test cases/common/102 subproject subdir/subprojects/sub/meson.build new file mode 100644 index 0000000..bf69c25 --- /dev/null +++ b/test cases/common/102 subproject subdir/subprojects/sub/meson.build @@ -0,0 +1,2 @@ +project('sub', 'c') +subdir('lib') diff --git a/test cases/common/103 postconf/meson.build b/test cases/common/103 postconf/meson.build new file mode 100644 index 0000000..12b3c5b --- /dev/null +++ b/test cases/common/103 postconf/meson.build @@ -0,0 +1,5 @@ +project('postconf script', 'c') + +meson.add_postconf_script('postconf.py') + +test('post', executable('prog', 'prog.c')) diff --git a/test cases/common/103 postconf/postconf.py b/test cases/common/103 postconf/postconf.py new file mode 100644 index 0000000..950c706 --- /dev/null +++ b/test cases/common/103 postconf/postconf.py @@ -0,0 +1,16 @@ +#!/usr/bin/env python3 + +import os + +template = '''#pragma once + +#define THE_NUMBER {} +''' + +input_file = os.path.join(os.environ['MESON_SOURCE_ROOT'], 'raw.dat') +output_file = os.path.join(os.environ['MESON_BUILD_ROOT'], 'generated.h') + +with open(input_file) as f: + data = f.readline().strip() +with open(output_file, 'w') as f: + f.write(template.format(data)) diff --git a/test cases/common/103 postconf/prog.c b/test cases/common/103 postconf/prog.c new file mode 100644 index 0000000..1e5d4cb --- /dev/null +++ b/test cases/common/103 postconf/prog.c @@ -0,0 +1,5 @@ +#include"generated.h" + +int main(int argc, char **argv) { + return THE_NUMBER != 9; +} diff --git a/test cases/common/103 postconf/raw.dat b/test cases/common/103 postconf/raw.dat new file mode 100644 index 0000000..ec63514 --- /dev/null +++ b/test cases/common/103 postconf/raw.dat @@ -0,0 +1 @@ +9 diff --git a/test cases/common/103 subproject subdir/meson.build b/test cases/common/103 subproject subdir/meson.build deleted file mode 100644 index ec9fad1..0000000 --- a/test cases/common/103 subproject subdir/meson.build +++ /dev/null @@ -1,6 +0,0 @@ -project('proj', 'c') -subproject('sub') -libSub = dependency('sub', fallback: ['sub', 'libSub']) - -exe = executable('prog', 'prog.c', dependencies: libSub) -test('subproject subdir', exe) diff --git a/test cases/common/103 subproject subdir/prog.c b/test cases/common/103 subproject subdir/prog.c deleted file mode 100644 index cf6f425..0000000 --- a/test cases/common/103 subproject subdir/prog.c +++ /dev/null @@ -1,5 +0,0 @@ -#include - -int main() { - return sub(); -} diff --git a/test cases/common/103 subproject subdir/subprojects/sub/lib/meson.build b/test cases/common/103 subproject subdir/subprojects/sub/lib/meson.build deleted file mode 100644 index 731d22b..0000000 --- a/test cases/common/103 subproject subdir/subprojects/sub/lib/meson.build +++ /dev/null @@ -1,2 +0,0 @@ -lib = static_library('sub', 'sub.c') -libSub = declare_dependency(include_directories: include_directories('.'), link_with: lib) diff --git a/test cases/common/103 subproject subdir/subprojects/sub/lib/sub.c b/test cases/common/103 subproject subdir/subprojects/sub/lib/sub.c deleted file mode 100644 index 068a5b8..0000000 --- a/test cases/common/103 subproject subdir/subprojects/sub/lib/sub.c +++ /dev/null @@ -1,5 +0,0 @@ -#include "sub.h" - -int sub() { - return 0; -} diff --git a/test cases/common/103 subproject subdir/subprojects/sub/lib/sub.h b/test cases/common/103 subproject subdir/subprojects/sub/lib/sub.h deleted file mode 100644 index f1ab0e1..0000000 --- a/test cases/common/103 subproject subdir/subprojects/sub/lib/sub.h +++ /dev/null @@ -1,6 +0,0 @@ -#ifndef SUB_H -#define SUB_H - -int sub(); - -#endif diff --git a/test cases/common/103 subproject subdir/subprojects/sub/meson.build b/test cases/common/103 subproject subdir/subprojects/sub/meson.build deleted file mode 100644 index bf69c25..0000000 --- a/test cases/common/103 subproject subdir/subprojects/sub/meson.build +++ /dev/null @@ -1,2 +0,0 @@ -project('sub', 'c') -subdir('lib') diff --git a/test cases/common/104 postconf with args/meson.build b/test cases/common/104 postconf with args/meson.build new file mode 100644 index 0000000..8510c5b --- /dev/null +++ b/test cases/common/104 postconf with args/meson.build @@ -0,0 +1,5 @@ +project('postconf script', 'c') + +meson.add_postconf_script('postconf.py', '5', '33') + +test('post', executable('prog', 'prog.c')) diff --git a/test cases/common/104 postconf with args/postconf.py b/test cases/common/104 postconf with args/postconf.py new file mode 100644 index 0000000..cef7f79 --- /dev/null +++ b/test cases/common/104 postconf with args/postconf.py @@ -0,0 +1,18 @@ +#!/usr/bin/env python3 + +import sys, os + +template = '''#pragma once + +#define THE_NUMBER {} +#define THE_ARG1 {} +#define THE_ARG2 {} +''' + +input_file = os.path.join(os.environ['MESON_SOURCE_ROOT'], 'raw.dat') +output_file = os.path.join(os.environ['MESON_BUILD_ROOT'], 'generated.h') + +with open(input_file) as f: + data = f.readline().strip() +with open(output_file, 'w') as f: + f.write(template.format(data, sys.argv[1], sys.argv[2])) diff --git a/test cases/common/104 postconf with args/prog.c b/test cases/common/104 postconf with args/prog.c new file mode 100644 index 0000000..0e63a8c --- /dev/null +++ b/test cases/common/104 postconf with args/prog.c @@ -0,0 +1,5 @@ +#include"generated.h" + +int main(int argc, char **argv) { + return THE_NUMBER != 9 || THE_ARG1 != 5 || THE_ARG2 != 33; +} diff --git a/test cases/common/104 postconf with args/raw.dat b/test cases/common/104 postconf with args/raw.dat new file mode 100644 index 0000000..ec63514 --- /dev/null +++ b/test cases/common/104 postconf with args/raw.dat @@ -0,0 +1 @@ +9 diff --git a/test cases/common/104 postconf/meson.build b/test cases/common/104 postconf/meson.build deleted file mode 100644 index 12b3c5b..0000000 --- a/test cases/common/104 postconf/meson.build +++ /dev/null @@ -1,5 +0,0 @@ -project('postconf script', 'c') - -meson.add_postconf_script('postconf.py') - -test('post', executable('prog', 'prog.c')) diff --git a/test cases/common/104 postconf/postconf.py b/test cases/common/104 postconf/postconf.py deleted file mode 100644 index 950c706..0000000 --- a/test cases/common/104 postconf/postconf.py +++ /dev/null @@ -1,16 +0,0 @@ -#!/usr/bin/env python3 - -import os - -template = '''#pragma once - -#define THE_NUMBER {} -''' - -input_file = os.path.join(os.environ['MESON_SOURCE_ROOT'], 'raw.dat') -output_file = os.path.join(os.environ['MESON_BUILD_ROOT'], 'generated.h') - -with open(input_file) as f: - data = f.readline().strip() -with open(output_file, 'w') as f: - f.write(template.format(data)) diff --git a/test cases/common/104 postconf/prog.c b/test cases/common/104 postconf/prog.c deleted file mode 100644 index 1e5d4cb..0000000 --- a/test cases/common/104 postconf/prog.c +++ /dev/null @@ -1,5 +0,0 @@ -#include"generated.h" - -int main(int argc, char **argv) { - return THE_NUMBER != 9; -} diff --git a/test cases/common/104 postconf/raw.dat b/test cases/common/104 postconf/raw.dat deleted file mode 100644 index ec63514..0000000 --- a/test cases/common/104 postconf/raw.dat +++ /dev/null @@ -1 +0,0 @@ -9 diff --git a/test cases/common/105 postconf with args/meson.build b/test cases/common/105 postconf with args/meson.build deleted file mode 100644 index 8510c5b..0000000 --- a/test cases/common/105 postconf with args/meson.build +++ /dev/null @@ -1,5 +0,0 @@ -project('postconf script', 'c') - -meson.add_postconf_script('postconf.py', '5', '33') - -test('post', executable('prog', 'prog.c')) diff --git a/test cases/common/105 postconf with args/postconf.py b/test cases/common/105 postconf with args/postconf.py deleted file mode 100644 index cef7f79..0000000 --- a/test cases/common/105 postconf with args/postconf.py +++ /dev/null @@ -1,18 +0,0 @@ -#!/usr/bin/env python3 - -import sys, os - -template = '''#pragma once - -#define THE_NUMBER {} -#define THE_ARG1 {} -#define THE_ARG2 {} -''' - -input_file = os.path.join(os.environ['MESON_SOURCE_ROOT'], 'raw.dat') -output_file = os.path.join(os.environ['MESON_BUILD_ROOT'], 'generated.h') - -with open(input_file) as f: - data = f.readline().strip() -with open(output_file, 'w') as f: - f.write(template.format(data, sys.argv[1], sys.argv[2])) diff --git a/test cases/common/105 postconf with args/prog.c b/test cases/common/105 postconf with args/prog.c deleted file mode 100644 index 0e63a8c..0000000 --- a/test cases/common/105 postconf with args/prog.c +++ /dev/null @@ -1,5 +0,0 @@ -#include"generated.h" - -int main(int argc, char **argv) { - return THE_NUMBER != 9 || THE_ARG1 != 5 || THE_ARG2 != 33; -} diff --git a/test cases/common/105 postconf with args/raw.dat b/test cases/common/105 postconf with args/raw.dat deleted file mode 100644 index ec63514..0000000 --- a/test cases/common/105 postconf with args/raw.dat +++ /dev/null @@ -1 +0,0 @@ -9 diff --git a/test cases/common/105 testframework options/meson.build b/test cases/common/105 testframework options/meson.build new file mode 100644 index 0000000..2773730 --- /dev/null +++ b/test cases/common/105 testframework options/meson.build @@ -0,0 +1,5 @@ +project('options', 'c') + +assert(get_option('testoption') == 'A string with spaces', 'Incorrect value for testoption option.') +assert(get_option('other_one') == true, 'Incorrect value for other_one option.') +assert(get_option('combo_opt') == 'one', 'Incorrect value for combo_opt option.') diff --git a/test cases/common/105 testframework options/meson_options.txt b/test cases/common/105 testframework options/meson_options.txt new file mode 100644 index 0000000..653dd75 --- /dev/null +++ b/test cases/common/105 testframework options/meson_options.txt @@ -0,0 +1,3 @@ +option('testoption', type : 'string', value : 'optval', description : 'An option to do something') +option('other_one', type : 'boolean', value : false) +option('combo_opt', type : 'combo', choices : ['one', 'two', 'combo'], value : 'combo') diff --git a/test cases/common/105 testframework options/test_args.txt b/test cases/common/105 testframework options/test_args.txt new file mode 100644 index 0000000..a667e3a --- /dev/null +++ b/test cases/common/105 testframework options/test_args.txt @@ -0,0 +1,4 @@ +# This file is not read by meson itself, but by the test framework. +# It is not possible to pass arguments to meson from a file. +['--werror', '-D', 'testoption=A string with spaces', '-D', 'other_one=true', \ + '-D', 'combo_opt=one'] diff --git a/test cases/common/106 extract same name/lib.c b/test cases/common/106 extract same name/lib.c new file mode 100644 index 0000000..6bdeda7 --- /dev/null +++ b/test cases/common/106 extract same name/lib.c @@ -0,0 +1,3 @@ +int func1() { + return 23; +} diff --git a/test cases/common/106 extract same name/main.c b/test cases/common/106 extract same name/main.c new file mode 100644 index 0000000..dc57dd5 --- /dev/null +++ b/test cases/common/106 extract same name/main.c @@ -0,0 +1,6 @@ +int func1(); +int func2(); + +int main(int argc, char **argv) { + return !(func1() == 23 && func2() == 42); +} diff --git a/test cases/common/106 extract same name/meson.build b/test cases/common/106 extract same name/meson.build new file mode 100644 index 0000000..0bfbb4d --- /dev/null +++ b/test cases/common/106 extract same name/meson.build @@ -0,0 +1,7 @@ +project('object extraction', 'c') + +lib = shared_library('somelib', ['lib.c', 'src/lib.c']) +# Also tests that the object list is flattened properly +obj = lib.extract_objects(['lib.c', ['src/lib.c']]) +exe = executable('main', 'main.c', objects: obj) +test('extraction', exe) diff --git a/test cases/common/106 extract same name/src/lib.c b/test cases/common/106 extract same name/src/lib.c new file mode 100644 index 0000000..68e6ab9 --- /dev/null +++ b/test cases/common/106 extract same name/src/lib.c @@ -0,0 +1,3 @@ +int func2() { + return 42; +} diff --git a/test cases/common/106 testframework options/meson.build b/test cases/common/106 testframework options/meson.build deleted file mode 100644 index 2773730..0000000 --- a/test cases/common/106 testframework options/meson.build +++ /dev/null @@ -1,5 +0,0 @@ -project('options', 'c') - -assert(get_option('testoption') == 'A string with spaces', 'Incorrect value for testoption option.') -assert(get_option('other_one') == true, 'Incorrect value for other_one option.') -assert(get_option('combo_opt') == 'one', 'Incorrect value for combo_opt option.') diff --git a/test cases/common/106 testframework options/meson_options.txt b/test cases/common/106 testframework options/meson_options.txt deleted file mode 100644 index 653dd75..0000000 --- a/test cases/common/106 testframework options/meson_options.txt +++ /dev/null @@ -1,3 +0,0 @@ -option('testoption', type : 'string', value : 'optval', description : 'An option to do something') -option('other_one', type : 'boolean', value : false) -option('combo_opt', type : 'combo', choices : ['one', 'two', 'combo'], value : 'combo') diff --git a/test cases/common/106 testframework options/test_args.txt b/test cases/common/106 testframework options/test_args.txt deleted file mode 100644 index a667e3a..0000000 --- a/test cases/common/106 testframework options/test_args.txt +++ /dev/null @@ -1,4 +0,0 @@ -# This file is not read by meson itself, but by the test framework. -# It is not possible to pass arguments to meson from a file. -['--werror', '-D', 'testoption=A string with spaces', '-D', 'other_one=true', \ - '-D', 'combo_opt=one'] diff --git a/test cases/common/107 extract same name/lib.c b/test cases/common/107 extract same name/lib.c deleted file mode 100644 index 6bdeda7..0000000 --- a/test cases/common/107 extract same name/lib.c +++ /dev/null @@ -1,3 +0,0 @@ -int func1() { - return 23; -} diff --git a/test cases/common/107 extract same name/main.c b/test cases/common/107 extract same name/main.c deleted file mode 100644 index dc57dd5..0000000 --- a/test cases/common/107 extract same name/main.c +++ /dev/null @@ -1,6 +0,0 @@ -int func1(); -int func2(); - -int main(int argc, char **argv) { - return !(func1() == 23 && func2() == 42); -} diff --git a/test cases/common/107 extract same name/meson.build b/test cases/common/107 extract same name/meson.build deleted file mode 100644 index 0bfbb4d..0000000 --- a/test cases/common/107 extract same name/meson.build +++ /dev/null @@ -1,7 +0,0 @@ -project('object extraction', 'c') - -lib = shared_library('somelib', ['lib.c', 'src/lib.c']) -# Also tests that the object list is flattened properly -obj = lib.extract_objects(['lib.c', ['src/lib.c']]) -exe = executable('main', 'main.c', objects: obj) -test('extraction', exe) diff --git a/test cases/common/107 extract same name/src/lib.c b/test cases/common/107 extract same name/src/lib.c deleted file mode 100644 index 68e6ab9..0000000 --- a/test cases/common/107 extract same name/src/lib.c +++ /dev/null @@ -1,3 +0,0 @@ -int func2() { - return 42; -} diff --git a/test cases/common/107 has header symbol/meson.build b/test cases/common/107 has header symbol/meson.build new file mode 100644 index 0000000..54cedce --- /dev/null +++ b/test cases/common/107 has header symbol/meson.build @@ -0,0 +1,36 @@ +project('has header symbol', 'c', 'cpp') + +cc = meson.get_compiler('c') +cpp = meson.get_compiler('cpp') + +foreach comp : [cc, cpp] + assert (comp.has_header_symbol('stdio.h', 'int'), 'base types should always be available') + assert (comp.has_header_symbol('stdio.h', 'printf'), 'printf function not found') + assert (comp.has_header_symbol('stdio.h', 'FILE'), 'FILE structure not found') + assert (comp.has_header_symbol('limits.h', 'INT_MAX'), 'INT_MAX define not found') + assert (not comp.has_header_symbol('limits.h', 'guint64'), 'guint64 is not defined in limits.h') + assert (not comp.has_header_symbol('stdlib.h', 'FILE'), 'FILE structure is defined in stdio.h, not stdlib.h') + assert (not comp.has_header_symbol('stdlol.h', 'printf'), 'stdlol.h shouldn\'t exist') + assert (not comp.has_header_symbol('stdlol.h', 'int'), 'shouldn\'t be able to find "int" with invalid header') +endforeach + +# This is available on Glibc, Solaris & the BSD's, so just test for _GNU_SOURCE +# on Linux +if cc.has_function('ppoll') and host_machine.system() == 'linux' + assert (not cc.has_header_symbol('poll.h', 'ppoll'), 'ppoll should not be accessible without _GNU_SOURCE') + assert (cc.has_header_symbol('poll.h', 'ppoll', prefix : '#define _GNU_SOURCE'), 'ppoll should be accessible with _GNU_SOURCE') +endif + +assert (cpp.has_header_symbol('iostream', 'std::iostream'), 'iostream not found in iostream.h') +assert (cpp.has_header_symbol('vector', 'std::vector'), 'vector not found in vector.h') +assert (not cpp.has_header_symbol('limits.h', 'std::iostream'), 'iostream should not be defined in limits.h') + +# Cross compilation and boost do not mix. +if not meson.is_cross_build() + boost = dependency('boost', required : false) + if boost.found() + assert (cpp.has_header_symbol('boost/math/quaternion.hpp', 'boost::math::quaternion', dependencies : boost), 'quaternion not found') + else + assert (not cpp.has_header_symbol('boost/math/quaternion.hpp', 'boost::math::quaternion', dependencies : boost), 'quaternion found?!') + endif +endif diff --git a/test cases/common/108 has arg/meson.build b/test cases/common/108 has arg/meson.build new file mode 100644 index 0000000..ba07311 --- /dev/null +++ b/test cases/common/108 has arg/meson.build @@ -0,0 +1,60 @@ +project('has arg', 'c', 'cpp') + +cc = meson.get_compiler('c') +cpp = meson.get_compiler('cpp') + +if cc.get_id() == 'msvc' + is_arg = '/O2' + useless = '/DFOO' +else + is_arg = '-O2' + useless = '-DFOO' +endif + +isnt_arg = '-fiambroken' + +assert(cc.has_argument(is_arg), 'Arg that should have worked does not work.') +assert(not cc.has_argument(isnt_arg), 'Arg that should be broken is not.') + +assert(cpp.has_argument(is_arg), 'Arg that should have worked does not work.') +assert(not cpp.has_argument(isnt_arg), 'Arg that should be broken is not.') + +assert(cc.get_supported_arguments([is_arg, isnt_arg, useless]) == [is_arg, useless], 'Arg filtering returned different result.') +assert(cpp.get_supported_arguments([is_arg, isnt_arg, useless]) == [is_arg, useless], 'Arg filtering returned different result.') + +# Have useless at the end to ensure that the search goes from front to back. +l1 = cc.first_supported_argument([isnt_arg, is_arg, isnt_arg, useless]) +l2 = cc.first_supported_argument(isnt_arg, isnt_arg, isnt_arg) + +assert(l1.length() == 1, 'First supported returned wrong result.') +assert(l1.get(0) == is_arg, 'First supported returned wrong argument.') +assert(l2.length() == 0, 'First supported did not return empty array.') + +l1 = cpp.first_supported_argument([isnt_arg, is_arg, isnt_arg, useless]) +l2 = cpp.first_supported_argument(isnt_arg, isnt_arg, isnt_arg) + +assert(l1.length() == 1, 'First supported returned wrong result.') +assert(l1.get(0) == is_arg, 'First supported returned wrong argument.') +assert(l2.length() == 0, 'First supported did not return empty array.') + +if cc.get_id() == 'gcc' + pre_arg = '-Wformat' + # NOTE: We have special handling for -Wno-foo args because gcc silently + # ignores unknown -Wno-foo args unless you pass -Werror, so for this test, we + # pass it as two separate arguments. + anti_pre_arg = ['-W', 'no-format'] + arg = '-Werror=format-security' + assert(not cc.has_multi_arguments([anti_pre_arg, arg]), 'Arg that should be broken is not.') + assert(cc.has_multi_arguments(pre_arg), 'Arg that should have worked does not work.') + assert(cc.has_multi_arguments([pre_arg, arg]), 'Arg that should have worked does not work.') + # Test that gcc correctly errors out on unknown -Wno flags + assert(not cc.has_argument('-Wno-lol-meson-test-flags'), 'should error out on unknown -Wno args') + assert(not cc.has_multi_arguments(['-Wno-pragmas', '-Wno-lol-meson-test-flags']), 'should error out even if some -Wno args are valid') +endif + +if cc.get_id() == 'clang' and cc.version().version_compare('<=4.0.0') + # 4.0.0 does not support -fpeel-loops. Newer versions may. + # Please adjust above version number as new versions of clang are released. + notyet_arg = '-fpeel-loops' + assert(not cc.has_argument(notyet_arg), 'Arg that should be broken (unless clang added support recently) is not.') +endif diff --git a/test cases/common/108 has header symbol/meson.build b/test cases/common/108 has header symbol/meson.build deleted file mode 100644 index 54cedce..0000000 --- a/test cases/common/108 has header symbol/meson.build +++ /dev/null @@ -1,36 +0,0 @@ -project('has header symbol', 'c', 'cpp') - -cc = meson.get_compiler('c') -cpp = meson.get_compiler('cpp') - -foreach comp : [cc, cpp] - assert (comp.has_header_symbol('stdio.h', 'int'), 'base types should always be available') - assert (comp.has_header_symbol('stdio.h', 'printf'), 'printf function not found') - assert (comp.has_header_symbol('stdio.h', 'FILE'), 'FILE structure not found') - assert (comp.has_header_symbol('limits.h', 'INT_MAX'), 'INT_MAX define not found') - assert (not comp.has_header_symbol('limits.h', 'guint64'), 'guint64 is not defined in limits.h') - assert (not comp.has_header_symbol('stdlib.h', 'FILE'), 'FILE structure is defined in stdio.h, not stdlib.h') - assert (not comp.has_header_symbol('stdlol.h', 'printf'), 'stdlol.h shouldn\'t exist') - assert (not comp.has_header_symbol('stdlol.h', 'int'), 'shouldn\'t be able to find "int" with invalid header') -endforeach - -# This is available on Glibc, Solaris & the BSD's, so just test for _GNU_SOURCE -# on Linux -if cc.has_function('ppoll') and host_machine.system() == 'linux' - assert (not cc.has_header_symbol('poll.h', 'ppoll'), 'ppoll should not be accessible without _GNU_SOURCE') - assert (cc.has_header_symbol('poll.h', 'ppoll', prefix : '#define _GNU_SOURCE'), 'ppoll should be accessible with _GNU_SOURCE') -endif - -assert (cpp.has_header_symbol('iostream', 'std::iostream'), 'iostream not found in iostream.h') -assert (cpp.has_header_symbol('vector', 'std::vector'), 'vector not found in vector.h') -assert (not cpp.has_header_symbol('limits.h', 'std::iostream'), 'iostream should not be defined in limits.h') - -# Cross compilation and boost do not mix. -if not meson.is_cross_build() - boost = dependency('boost', required : false) - if boost.found() - assert (cpp.has_header_symbol('boost/math/quaternion.hpp', 'boost::math::quaternion', dependencies : boost), 'quaternion not found') - else - assert (not cpp.has_header_symbol('boost/math/quaternion.hpp', 'boost::math::quaternion', dependencies : boost), 'quaternion found?!') - endif -endif diff --git a/test cases/common/109 generatorcustom/catter.py b/test cases/common/109 generatorcustom/catter.py new file mode 100755 index 0000000..198fa98 --- /dev/null +++ b/test cases/common/109 generatorcustom/catter.py @@ -0,0 +1,14 @@ +#!/usr/bin/env python3 + +import sys + +output = sys.argv[-1] +inputs = sys.argv[1:-1] + +with open(output, 'w') as ofile: + ofile.write('#pragma once\n') + for i in inputs: + with open(i, 'r') as ifile: + content = ifile.read() + ofile.write(content) + ofile.write('\n') diff --git a/test cases/common/109 generatorcustom/gen.py b/test cases/common/109 generatorcustom/gen.py new file mode 100755 index 0000000..c1e34ed --- /dev/null +++ b/test cases/common/109 generatorcustom/gen.py @@ -0,0 +1,13 @@ +#!/usr/bin/env python3 + +import sys + +ifile = sys.argv[1] +ofile = sys.argv[2] + +with open(ifile, 'r') as f: + resname = f.readline().strip() + +templ = 'const char %s[] = "%s";\n' +with open(ofile, 'w') as f: + f.write(templ % (resname, resname)) diff --git a/test cases/common/109 generatorcustom/main.c b/test cases/common/109 generatorcustom/main.c new file mode 100644 index 0000000..04abcf6 --- /dev/null +++ b/test cases/common/109 generatorcustom/main.c @@ -0,0 +1,7 @@ +#include + +#include"alltogether.h" + +int main(int argc, char **argv) { + return 0; +} diff --git a/test cases/common/109 generatorcustom/meson.build b/test cases/common/109 generatorcustom/meson.build new file mode 100644 index 0000000..17d27e5 --- /dev/null +++ b/test cases/common/109 generatorcustom/meson.build @@ -0,0 +1,18 @@ +project('generatorcustom', 'c') + +creator = find_program('gen.py') +catter = find_program('catter.py') + +gen = generator(creator, + output: '@BASENAME@.h', + arguments : ['@INPUT@', '@OUTPUT@']) + +hs = gen.process('res1.txt', 'res2.txt') + +allinone = custom_target('alltogether', + input : hs, + output : 'alltogether.h', + command : [catter, '@INPUT@', '@OUTPUT@']) + +executable('proggie', 'main.c', allinone) + diff --git a/test cases/common/109 generatorcustom/res1.txt b/test cases/common/109 generatorcustom/res1.txt new file mode 100644 index 0000000..6487c56 --- /dev/null +++ b/test cases/common/109 generatorcustom/res1.txt @@ -0,0 +1 @@ +res1 diff --git a/test cases/common/109 generatorcustom/res2.txt b/test cases/common/109 generatorcustom/res2.txt new file mode 100644 index 0000000..0a8879d --- /dev/null +++ b/test cases/common/109 generatorcustom/res2.txt @@ -0,0 +1 @@ +res2 diff --git a/test cases/common/109 has arg/meson.build b/test cases/common/109 has arg/meson.build deleted file mode 100644 index ba07311..0000000 --- a/test cases/common/109 has arg/meson.build +++ /dev/null @@ -1,60 +0,0 @@ -project('has arg', 'c', 'cpp') - -cc = meson.get_compiler('c') -cpp = meson.get_compiler('cpp') - -if cc.get_id() == 'msvc' - is_arg = '/O2' - useless = '/DFOO' -else - is_arg = '-O2' - useless = '-DFOO' -endif - -isnt_arg = '-fiambroken' - -assert(cc.has_argument(is_arg), 'Arg that should have worked does not work.') -assert(not cc.has_argument(isnt_arg), 'Arg that should be broken is not.') - -assert(cpp.has_argument(is_arg), 'Arg that should have worked does not work.') -assert(not cpp.has_argument(isnt_arg), 'Arg that should be broken is not.') - -assert(cc.get_supported_arguments([is_arg, isnt_arg, useless]) == [is_arg, useless], 'Arg filtering returned different result.') -assert(cpp.get_supported_arguments([is_arg, isnt_arg, useless]) == [is_arg, useless], 'Arg filtering returned different result.') - -# Have useless at the end to ensure that the search goes from front to back. -l1 = cc.first_supported_argument([isnt_arg, is_arg, isnt_arg, useless]) -l2 = cc.first_supported_argument(isnt_arg, isnt_arg, isnt_arg) - -assert(l1.length() == 1, 'First supported returned wrong result.') -assert(l1.get(0) == is_arg, 'First supported returned wrong argument.') -assert(l2.length() == 0, 'First supported did not return empty array.') - -l1 = cpp.first_supported_argument([isnt_arg, is_arg, isnt_arg, useless]) -l2 = cpp.first_supported_argument(isnt_arg, isnt_arg, isnt_arg) - -assert(l1.length() == 1, 'First supported returned wrong result.') -assert(l1.get(0) == is_arg, 'First supported returned wrong argument.') -assert(l2.length() == 0, 'First supported did not return empty array.') - -if cc.get_id() == 'gcc' - pre_arg = '-Wformat' - # NOTE: We have special handling for -Wno-foo args because gcc silently - # ignores unknown -Wno-foo args unless you pass -Werror, so for this test, we - # pass it as two separate arguments. - anti_pre_arg = ['-W', 'no-format'] - arg = '-Werror=format-security' - assert(not cc.has_multi_arguments([anti_pre_arg, arg]), 'Arg that should be broken is not.') - assert(cc.has_multi_arguments(pre_arg), 'Arg that should have worked does not work.') - assert(cc.has_multi_arguments([pre_arg, arg]), 'Arg that should have worked does not work.') - # Test that gcc correctly errors out on unknown -Wno flags - assert(not cc.has_argument('-Wno-lol-meson-test-flags'), 'should error out on unknown -Wno args') - assert(not cc.has_multi_arguments(['-Wno-pragmas', '-Wno-lol-meson-test-flags']), 'should error out even if some -Wno args are valid') -endif - -if cc.get_id() == 'clang' and cc.version().version_compare('<=4.0.0') - # 4.0.0 does not support -fpeel-loops. Newer versions may. - # Please adjust above version number as new versions of clang are released. - notyet_arg = '-fpeel-loops' - assert(not cc.has_argument(notyet_arg), 'Arg that should be broken (unless clang added support recently) is not.') -endif diff --git a/test cases/common/110 generatorcustom/catter.py b/test cases/common/110 generatorcustom/catter.py deleted file mode 100755 index 198fa98..0000000 --- a/test cases/common/110 generatorcustom/catter.py +++ /dev/null @@ -1,14 +0,0 @@ -#!/usr/bin/env python3 - -import sys - -output = sys.argv[-1] -inputs = sys.argv[1:-1] - -with open(output, 'w') as ofile: - ofile.write('#pragma once\n') - for i in inputs: - with open(i, 'r') as ifile: - content = ifile.read() - ofile.write(content) - ofile.write('\n') diff --git a/test cases/common/110 generatorcustom/gen.py b/test cases/common/110 generatorcustom/gen.py deleted file mode 100755 index c1e34ed..0000000 --- a/test cases/common/110 generatorcustom/gen.py +++ /dev/null @@ -1,13 +0,0 @@ -#!/usr/bin/env python3 - -import sys - -ifile = sys.argv[1] -ofile = sys.argv[2] - -with open(ifile, 'r') as f: - resname = f.readline().strip() - -templ = 'const char %s[] = "%s";\n' -with open(ofile, 'w') as f: - f.write(templ % (resname, resname)) diff --git a/test cases/common/110 generatorcustom/main.c b/test cases/common/110 generatorcustom/main.c deleted file mode 100644 index 04abcf6..0000000 --- a/test cases/common/110 generatorcustom/main.c +++ /dev/null @@ -1,7 +0,0 @@ -#include - -#include"alltogether.h" - -int main(int argc, char **argv) { - return 0; -} diff --git a/test cases/common/110 generatorcustom/meson.build b/test cases/common/110 generatorcustom/meson.build deleted file mode 100644 index 17d27e5..0000000 --- a/test cases/common/110 generatorcustom/meson.build +++ /dev/null @@ -1,18 +0,0 @@ -project('generatorcustom', 'c') - -creator = find_program('gen.py') -catter = find_program('catter.py') - -gen = generator(creator, - output: '@BASENAME@.h', - arguments : ['@INPUT@', '@OUTPUT@']) - -hs = gen.process('res1.txt', 'res2.txt') - -allinone = custom_target('alltogether', - input : hs, - output : 'alltogether.h', - command : [catter, '@INPUT@', '@OUTPUT@']) - -executable('proggie', 'main.c', allinone) - diff --git a/test cases/common/110 generatorcustom/res1.txt b/test cases/common/110 generatorcustom/res1.txt deleted file mode 100644 index 6487c56..0000000 --- a/test cases/common/110 generatorcustom/res1.txt +++ /dev/null @@ -1 +0,0 @@ -res1 diff --git a/test cases/common/110 generatorcustom/res2.txt b/test cases/common/110 generatorcustom/res2.txt deleted file mode 100644 index 0a8879d..0000000 --- a/test cases/common/110 generatorcustom/res2.txt +++ /dev/null @@ -1 +0,0 @@ -res2 diff --git a/test cases/common/110 multiple dir configure file/meson.build b/test cases/common/110 multiple dir configure file/meson.build new file mode 100644 index 0000000..a4615fa --- /dev/null +++ b/test cases/common/110 multiple dir configure file/meson.build @@ -0,0 +1,11 @@ +project('multiple dir configure file', 'c') + +subdir('subdir') + +configure_file(input : 'subdir/someinput.in', + output : 'outputhere', + copy: true) + +configure_file(input : cfile1, + output : '@BASENAME@', + copy: true) diff --git a/test cases/common/110 multiple dir configure file/subdir/foo.txt b/test cases/common/110 multiple dir configure file/subdir/foo.txt new file mode 100644 index 0000000..e69de29 diff --git a/test cases/common/110 multiple dir configure file/subdir/meson.build b/test cases/common/110 multiple dir configure file/subdir/meson.build new file mode 100644 index 0000000..503df96 --- /dev/null +++ b/test cases/common/110 multiple dir configure file/subdir/meson.build @@ -0,0 +1,11 @@ +configure_file(input : 'someinput.in', + output : 'outputsubdir', + install : false, + copy: true) + +py3 = import('python3').find_python() + +cfile1 = configure_file(input : 'foo.txt', + output : 'foo.h.in', + capture : true, + command : [py3, '-c', 'print("#mesondefine FOO_BAR")']) diff --git a/test cases/common/110 multiple dir configure file/subdir/someinput.in b/test cases/common/110 multiple dir configure file/subdir/someinput.in new file mode 100644 index 0000000..e69de29 diff --git a/test cases/common/111 multiple dir configure file/meson.build b/test cases/common/111 multiple dir configure file/meson.build deleted file mode 100644 index a4615fa..0000000 --- a/test cases/common/111 multiple dir configure file/meson.build +++ /dev/null @@ -1,11 +0,0 @@ -project('multiple dir configure file', 'c') - -subdir('subdir') - -configure_file(input : 'subdir/someinput.in', - output : 'outputhere', - copy: true) - -configure_file(input : cfile1, - output : '@BASENAME@', - copy: true) diff --git a/test cases/common/111 multiple dir configure file/subdir/foo.txt b/test cases/common/111 multiple dir configure file/subdir/foo.txt deleted file mode 100644 index e69de29..0000000 diff --git a/test cases/common/111 multiple dir configure file/subdir/meson.build b/test cases/common/111 multiple dir configure file/subdir/meson.build deleted file mode 100644 index 503df96..0000000 --- a/test cases/common/111 multiple dir configure file/subdir/meson.build +++ /dev/null @@ -1,11 +0,0 @@ -configure_file(input : 'someinput.in', - output : 'outputsubdir', - install : false, - copy: true) - -py3 = import('python3').find_python() - -cfile1 = configure_file(input : 'foo.txt', - output : 'foo.h.in', - capture : true, - command : [py3, '-c', 'print("#mesondefine FOO_BAR")']) diff --git a/test cases/common/111 multiple dir configure file/subdir/someinput.in b/test cases/common/111 multiple dir configure file/subdir/someinput.in deleted file mode 100644 index e69de29..0000000 diff --git a/test cases/common/111 spaces backslash/asm output/meson.build b/test cases/common/111 spaces backslash/asm output/meson.build new file mode 100644 index 0000000..b5f13f5 --- /dev/null +++ b/test cases/common/111 spaces backslash/asm output/meson.build @@ -0,0 +1,2 @@ +configure_file(output : 'blank.txt', configuration : configuration_data()) + diff --git a/test cases/common/111 spaces backslash/comparer-end-notstring.c b/test cases/common/111 spaces backslash/comparer-end-notstring.c new file mode 100644 index 0000000..65bf8bc --- /dev/null +++ b/test cases/common/111 spaces backslash/comparer-end-notstring.c @@ -0,0 +1,20 @@ +#include "comparer.h" + +#ifndef COMPARER_INCLUDED +#error "comparer.h not included" +#endif + +/* This converts foo\\\\bar\\\\ to "foo\\bar\\" (string literal) */ +#define Q(x) #x +#define QUOTE(x) Q(x) + +#define COMPARE_WITH "foo\\bar\\" /* This is the literal `foo\bar\` */ + +int main(int argc, char **argv) { + if(strcmp(QUOTE(DEF_WITH_BACKSLASH), COMPARE_WITH)) { + printf("Arg string is quoted incorrectly: %s instead of %s\n", + QUOTE(DEF_WITH_BACKSLASH), COMPARE_WITH); + return 1; + } + return 0; +} diff --git a/test cases/common/111 spaces backslash/comparer-end.c b/test cases/common/111 spaces backslash/comparer-end.c new file mode 100644 index 0000000..fef25a5 --- /dev/null +++ b/test cases/common/111 spaces backslash/comparer-end.c @@ -0,0 +1,16 @@ +#include "comparer.h" + +#ifndef COMPARER_INCLUDED +#error "comparer.h not included" +#endif + +#define COMPARE_WITH "foo\\bar\\" /* This is `foo\bar\` */ + +int main (int argc, char **argv) { + if (strcmp (DEF_WITH_BACKSLASH, COMPARE_WITH)) { + printf ("Arg string is quoted incorrectly: %s vs %s\n", + DEF_WITH_BACKSLASH, COMPARE_WITH); + return 1; + } + return 0; +} diff --git a/test cases/common/111 spaces backslash/comparer.c b/test cases/common/111 spaces backslash/comparer.c new file mode 100644 index 0000000..937cb47 --- /dev/null +++ b/test cases/common/111 spaces backslash/comparer.c @@ -0,0 +1,16 @@ +#include "comparer.h" + +#ifndef COMPARER_INCLUDED +#error "comparer.h not included" +#endif + +#define COMPARE_WITH "foo\\bar" /* This is the literal `foo\bar` */ + +int main (int argc, char **argv) { + if (strcmp (DEF_WITH_BACKSLASH, COMPARE_WITH)) { + printf ("Arg string is quoted incorrectly: %s instead of %s\n", + DEF_WITH_BACKSLASH, COMPARE_WITH); + return 1; + } + return 0; +} diff --git a/test cases/common/111 spaces backslash/include/comparer.h b/test cases/common/111 spaces backslash/include/comparer.h new file mode 100644 index 0000000..624d96c --- /dev/null +++ b/test cases/common/111 spaces backslash/include/comparer.h @@ -0,0 +1,4 @@ +#include +#include + +#define COMPARER_INCLUDED diff --git a/test cases/common/111 spaces backslash/meson.build b/test cases/common/111 spaces backslash/meson.build new file mode 100644 index 0000000..d590494 --- /dev/null +++ b/test cases/common/111 spaces backslash/meson.build @@ -0,0 +1,28 @@ +project('comparer', 'c') + +# Added manually as a c_arg to test handling of include paths with backslashes +# and spaces. This is especially useful on Windows in vcxproj files since it +# stores include directories in a separate element that has its own +# context-specific escaping/quoting. +include_dir = meson.current_source_dir() + '/include' +default_c_args = ['-I' + include_dir] + +if meson.get_compiler('c').get_argument_syntax() == 'msvc' + default_c_args += ['/Faasm output\\'] + # Hack to create the 'asm output' directory in the builddir + subdir('asm output') +endif + +# Path can contain \. Here we're sending `"foo\bar"`. +test('backslash quoting', + executable('comparer', 'comparer.c', + c_args : default_c_args + ['-DDEF_WITH_BACKSLASH="foo\\bar"'])) +# Path can end in \ without any special quoting. Here we send `"foo\bar\"`. +test('backslash end quoting', + executable('comparer-end', 'comparer-end.c', + c_args : default_c_args + ['-DDEF_WITH_BACKSLASH="foo\\bar\\"'])) +# Path can (really) end in \ if we're not passing a string literal without any +# special quoting. Here we're sending `foo\bar\`. +test('backslash end quoting when not a string literal', + executable('comparer-end-notstring', 'comparer-end-notstring.c', + c_args : default_c_args + ['-DDEF_WITH_BACKSLASH=foo\\bar\\'])) diff --git a/test cases/common/112 spaces backslash/asm output/meson.build b/test cases/common/112 spaces backslash/asm output/meson.build deleted file mode 100644 index b5f13f5..0000000 --- a/test cases/common/112 spaces backslash/asm output/meson.build +++ /dev/null @@ -1,2 +0,0 @@ -configure_file(output : 'blank.txt', configuration : configuration_data()) - diff --git a/test cases/common/112 spaces backslash/comparer-end-notstring.c b/test cases/common/112 spaces backslash/comparer-end-notstring.c deleted file mode 100644 index 65bf8bc..0000000 --- a/test cases/common/112 spaces backslash/comparer-end-notstring.c +++ /dev/null @@ -1,20 +0,0 @@ -#include "comparer.h" - -#ifndef COMPARER_INCLUDED -#error "comparer.h not included" -#endif - -/* This converts foo\\\\bar\\\\ to "foo\\bar\\" (string literal) */ -#define Q(x) #x -#define QUOTE(x) Q(x) - -#define COMPARE_WITH "foo\\bar\\" /* This is the literal `foo\bar\` */ - -int main(int argc, char **argv) { - if(strcmp(QUOTE(DEF_WITH_BACKSLASH), COMPARE_WITH)) { - printf("Arg string is quoted incorrectly: %s instead of %s\n", - QUOTE(DEF_WITH_BACKSLASH), COMPARE_WITH); - return 1; - } - return 0; -} diff --git a/test cases/common/112 spaces backslash/comparer-end.c b/test cases/common/112 spaces backslash/comparer-end.c deleted file mode 100644 index fef25a5..0000000 --- a/test cases/common/112 spaces backslash/comparer-end.c +++ /dev/null @@ -1,16 +0,0 @@ -#include "comparer.h" - -#ifndef COMPARER_INCLUDED -#error "comparer.h not included" -#endif - -#define COMPARE_WITH "foo\\bar\\" /* This is `foo\bar\` */ - -int main (int argc, char **argv) { - if (strcmp (DEF_WITH_BACKSLASH, COMPARE_WITH)) { - printf ("Arg string is quoted incorrectly: %s vs %s\n", - DEF_WITH_BACKSLASH, COMPARE_WITH); - return 1; - } - return 0; -} diff --git a/test cases/common/112 spaces backslash/comparer.c b/test cases/common/112 spaces backslash/comparer.c deleted file mode 100644 index 937cb47..0000000 --- a/test cases/common/112 spaces backslash/comparer.c +++ /dev/null @@ -1,16 +0,0 @@ -#include "comparer.h" - -#ifndef COMPARER_INCLUDED -#error "comparer.h not included" -#endif - -#define COMPARE_WITH "foo\\bar" /* This is the literal `foo\bar` */ - -int main (int argc, char **argv) { - if (strcmp (DEF_WITH_BACKSLASH, COMPARE_WITH)) { - printf ("Arg string is quoted incorrectly: %s instead of %s\n", - DEF_WITH_BACKSLASH, COMPARE_WITH); - return 1; - } - return 0; -} diff --git a/test cases/common/112 spaces backslash/include/comparer.h b/test cases/common/112 spaces backslash/include/comparer.h deleted file mode 100644 index 624d96c..0000000 --- a/test cases/common/112 spaces backslash/include/comparer.h +++ /dev/null @@ -1,4 +0,0 @@ -#include -#include - -#define COMPARER_INCLUDED diff --git a/test cases/common/112 spaces backslash/meson.build b/test cases/common/112 spaces backslash/meson.build deleted file mode 100644 index d590494..0000000 --- a/test cases/common/112 spaces backslash/meson.build +++ /dev/null @@ -1,28 +0,0 @@ -project('comparer', 'c') - -# Added manually as a c_arg to test handling of include paths with backslashes -# and spaces. This is especially useful on Windows in vcxproj files since it -# stores include directories in a separate element that has its own -# context-specific escaping/quoting. -include_dir = meson.current_source_dir() + '/include' -default_c_args = ['-I' + include_dir] - -if meson.get_compiler('c').get_argument_syntax() == 'msvc' - default_c_args += ['/Faasm output\\'] - # Hack to create the 'asm output' directory in the builddir - subdir('asm output') -endif - -# Path can contain \. Here we're sending `"foo\bar"`. -test('backslash quoting', - executable('comparer', 'comparer.c', - c_args : default_c_args + ['-DDEF_WITH_BACKSLASH="foo\\bar"'])) -# Path can end in \ without any special quoting. Here we send `"foo\bar\"`. -test('backslash end quoting', - executable('comparer-end', 'comparer-end.c', - c_args : default_c_args + ['-DDEF_WITH_BACKSLASH="foo\\bar\\"'])) -# Path can (really) end in \ if we're not passing a string literal without any -# special quoting. Here we're sending `foo\bar\`. -test('backslash end quoting when not a string literal', - executable('comparer-end-notstring', 'comparer-end-notstring.c', - c_args : default_c_args + ['-DDEF_WITH_BACKSLASH=foo\\bar\\'])) diff --git a/test cases/common/112 ternary/meson.build b/test cases/common/112 ternary/meson.build new file mode 100644 index 0000000..7539d56 --- /dev/null +++ b/test cases/common/112 ternary/meson.build @@ -0,0 +1,12 @@ +project('ternary operator', 'c') + +x = true +one = true ? 1 : error('False branch should not be evaluated') +two = false ? error('True branch should not be evaluated.') : 2 +three = '@0@'.format(x ? 'yes' : 'no') +four = [x ? '0' : '1'] + +assert(one == 1, 'Return value from ternary true is wrong.') +assert(two == 2, 'Return value from ternary false is wrong.') +assert(three == 'yes', 'Return value for ternary inside method call is wrong.') +assert(four == ['0'], 'Return value for ternary inside of list is wrong.') diff --git a/test cases/common/113 custom target capture/data_source.txt b/test cases/common/113 custom target capture/data_source.txt new file mode 100644 index 0000000..0c23cc0 --- /dev/null +++ b/test cases/common/113 custom target capture/data_source.txt @@ -0,0 +1 @@ +This is a text only input file. diff --git a/test cases/common/113 custom target capture/installed_files.txt b/test cases/common/113 custom target capture/installed_files.txt new file mode 100644 index 0000000..d90a6b0 --- /dev/null +++ b/test cases/common/113 custom target capture/installed_files.txt @@ -0,0 +1 @@ +usr/subdir/data.dat diff --git a/test cases/common/113 custom target capture/meson.build b/test cases/common/113 custom target capture/meson.build new file mode 100644 index 0000000..58a69ca --- /dev/null +++ b/test cases/common/113 custom target capture/meson.build @@ -0,0 +1,24 @@ +project('custom target', 'c') + +python3 = import('python3').find_python() + +# Note that this will not add a dependency to the compiler executable. +# Code will not be rebuilt if it changes. +comp = '@0@/@1@'.format(meson.current_source_dir(), 'my_compiler.py') + +mytarget = custom_target('bindat', + output : 'data.dat', + input : 'data_source.txt', + capture : true, + command : [python3, comp, '@INPUT@'], + install : true, + install_dir : 'subdir' +) + +ct_output_exists = '''import os, sys +if not os.path.exists(sys.argv[1]): + print("could not find {!r} in {!r}".format(sys.argv[1], os.getcwd())) + sys.exit(1) +''' + +test('capture-wrote', python3, args : ['-c', ct_output_exists, mytarget]) diff --git a/test cases/common/113 custom target capture/my_compiler.py b/test cases/common/113 custom target capture/my_compiler.py new file mode 100755 index 0000000..b60722a --- /dev/null +++ b/test cases/common/113 custom target capture/my_compiler.py @@ -0,0 +1,14 @@ +#!/usr/bin/env python3 + +import sys + +if __name__ == '__main__': + if len(sys.argv) != 2: + print(sys.argv[0], 'input_file') + sys.exit(1) + with open(sys.argv[1]) as f: + ifile = f.read() + if ifile != 'This is a text only input file.\n': + print('Malformed input') + sys.exit(1) + print('This is a binary output file.') diff --git a/test cases/common/113 ternary/meson.build b/test cases/common/113 ternary/meson.build deleted file mode 100644 index 7539d56..0000000 --- a/test cases/common/113 ternary/meson.build +++ /dev/null @@ -1,12 +0,0 @@ -project('ternary operator', 'c') - -x = true -one = true ? 1 : error('False branch should not be evaluated') -two = false ? error('True branch should not be evaluated.') : 2 -three = '@0@'.format(x ? 'yes' : 'no') -four = [x ? '0' : '1'] - -assert(one == 1, 'Return value from ternary true is wrong.') -assert(two == 2, 'Return value from ternary false is wrong.') -assert(three == 'yes', 'Return value for ternary inside method call is wrong.') -assert(four == ['0'], 'Return value for ternary inside of list is wrong.') diff --git a/test cases/common/114 allgenerate/converter.py b/test cases/common/114 allgenerate/converter.py new file mode 100755 index 0000000..f8e2ca0 --- /dev/null +++ b/test cases/common/114 allgenerate/converter.py @@ -0,0 +1,8 @@ +#!/usr/bin/env python3 + +import sys + +ifile = sys.argv[1] +ofile = sys.argv[2] + +open(ofile, 'w').write(open(ifile).read()) diff --git a/test cases/common/114 allgenerate/foobar.cpp.in b/test cases/common/114 allgenerate/foobar.cpp.in new file mode 100644 index 0000000..c64f3b5 --- /dev/null +++ b/test cases/common/114 allgenerate/foobar.cpp.in @@ -0,0 +1,6 @@ +#include + +int main(int argc, char **argv) { + printf("I am a program.\n"); + return 0; +} diff --git a/test cases/common/114 allgenerate/meson.build b/test cases/common/114 allgenerate/meson.build new file mode 100644 index 0000000..049e849 --- /dev/null +++ b/test cases/common/114 allgenerate/meson.build @@ -0,0 +1,20 @@ +# Must have two languages here to exercise linker language +# selection bug +project('all sources generated', 'c', 'cpp') + +comp = find_program('converter.py') + +g = generator(comp, + output : '@BASENAME@', + arguments : ['@INPUT@', '@OUTPUT@']) + +c = g.process('foobar.cpp.in') + +prog = executable('genexe', c) + +c2 = custom_target('c2gen', + output : '@BASENAME@', + input : 'foobar.cpp.in', + command : [comp, '@INPUT@', '@OUTPUT@']) + +prog2 = executable('genexe2', c2) diff --git a/test cases/common/114 custom target capture/data_source.txt b/test cases/common/114 custom target capture/data_source.txt deleted file mode 100644 index 0c23cc0..0000000 --- a/test cases/common/114 custom target capture/data_source.txt +++ /dev/null @@ -1 +0,0 @@ -This is a text only input file. diff --git a/test cases/common/114 custom target capture/installed_files.txt b/test cases/common/114 custom target capture/installed_files.txt deleted file mode 100644 index d90a6b0..0000000 --- a/test cases/common/114 custom target capture/installed_files.txt +++ /dev/null @@ -1 +0,0 @@ -usr/subdir/data.dat diff --git a/test cases/common/114 custom target capture/meson.build b/test cases/common/114 custom target capture/meson.build deleted file mode 100644 index 58a69ca..0000000 --- a/test cases/common/114 custom target capture/meson.build +++ /dev/null @@ -1,24 +0,0 @@ -project('custom target', 'c') - -python3 = import('python3').find_python() - -# Note that this will not add a dependency to the compiler executable. -# Code will not be rebuilt if it changes. -comp = '@0@/@1@'.format(meson.current_source_dir(), 'my_compiler.py') - -mytarget = custom_target('bindat', - output : 'data.dat', - input : 'data_source.txt', - capture : true, - command : [python3, comp, '@INPUT@'], - install : true, - install_dir : 'subdir' -) - -ct_output_exists = '''import os, sys -if not os.path.exists(sys.argv[1]): - print("could not find {!r} in {!r}".format(sys.argv[1], os.getcwd())) - sys.exit(1) -''' - -test('capture-wrote', python3, args : ['-c', ct_output_exists, mytarget]) diff --git a/test cases/common/114 custom target capture/my_compiler.py b/test cases/common/114 custom target capture/my_compiler.py deleted file mode 100755 index b60722a..0000000 --- a/test cases/common/114 custom target capture/my_compiler.py +++ /dev/null @@ -1,14 +0,0 @@ -#!/usr/bin/env python3 - -import sys - -if __name__ == '__main__': - if len(sys.argv) != 2: - print(sys.argv[0], 'input_file') - sys.exit(1) - with open(sys.argv[1]) as f: - ifile = f.read() - if ifile != 'This is a text only input file.\n': - print('Malformed input') - sys.exit(1) - print('This is a binary output file.') diff --git a/test cases/common/115 allgenerate/converter.py b/test cases/common/115 allgenerate/converter.py deleted file mode 100755 index f8e2ca0..0000000 --- a/test cases/common/115 allgenerate/converter.py +++ /dev/null @@ -1,8 +0,0 @@ -#!/usr/bin/env python3 - -import sys - -ifile = sys.argv[1] -ofile = sys.argv[2] - -open(ofile, 'w').write(open(ifile).read()) diff --git a/test cases/common/115 allgenerate/foobar.cpp.in b/test cases/common/115 allgenerate/foobar.cpp.in deleted file mode 100644 index c64f3b5..0000000 --- a/test cases/common/115 allgenerate/foobar.cpp.in +++ /dev/null @@ -1,6 +0,0 @@ -#include - -int main(int argc, char **argv) { - printf("I am a program.\n"); - return 0; -} diff --git a/test cases/common/115 allgenerate/meson.build b/test cases/common/115 allgenerate/meson.build deleted file mode 100644 index 049e849..0000000 --- a/test cases/common/115 allgenerate/meson.build +++ /dev/null @@ -1,20 +0,0 @@ -# Must have two languages here to exercise linker language -# selection bug -project('all sources generated', 'c', 'cpp') - -comp = find_program('converter.py') - -g = generator(comp, - output : '@BASENAME@', - arguments : ['@INPUT@', '@OUTPUT@']) - -c = g.process('foobar.cpp.in') - -prog = executable('genexe', c) - -c2 = custom_target('c2gen', - output : '@BASENAME@', - input : 'foobar.cpp.in', - command : [comp, '@INPUT@', '@OUTPUT@']) - -prog2 = executable('genexe2', c2) diff --git a/test cases/common/115 pathjoin/meson.build b/test cases/common/115 pathjoin/meson.build new file mode 100644 index 0000000..d3957dd --- /dev/null +++ b/test cases/common/115 pathjoin/meson.build @@ -0,0 +1,24 @@ +project('pathjoin', 'c') + +# Test string-args form since that is the canonical way +assert(join_paths('foo') == 'foo', 'Single argument join is broken') +assert(join_paths('foo', 'bar') == 'foo/bar', 'Path joining is broken') +assert(join_paths('foo', 'bar', 'baz') == 'foo/bar/baz', 'Path joining is broken') +assert(join_paths('/foo', 'bar') == '/foo/bar', 'Path joining is broken') +assert(join_paths('foo', '/bar') == '/bar', 'Absolute path joining is broken') +assert(join_paths('/foo', '/bar') == '/bar', 'Absolute path joining is broken') + +# Test array form since people are using that too +assert(join_paths(['foo']) == 'foo', 'Single argument join is broken') +assert(join_paths(['foo', 'bar']) == 'foo/bar', 'Path joining is broken') +assert(join_paths(['foo', 'bar', 'baz']) == 'foo/bar/baz', 'Path joining is broken') +assert(join_paths(['/foo', 'bar']) == '/foo/bar', 'Path joining is broken') +assert(join_paths(['foo', '/bar']) == '/bar', 'Absolute path joining is broken') +assert(join_paths(['/foo', '/bar']) == '/bar', 'Absolute path joining is broken') + +# Division operator should do the same as join_paths +assert('foo' / 'bar' == 'foo/bar', 'Path division is broken') +assert('foo' /'bar' /'baz' == 'foo/bar/baz', 'Path division is broken') +assert('/foo' / 'bar' == '/foo/bar', 'Path division is broken') +assert('foo' / '/bar' == '/bar', 'Absolute path division is broken') +assert('/foo' / '/bar' == '/bar', 'Absolute path division is broken') diff --git a/test cases/common/116 pathjoin/meson.build b/test cases/common/116 pathjoin/meson.build deleted file mode 100644 index d3957dd..0000000 --- a/test cases/common/116 pathjoin/meson.build +++ /dev/null @@ -1,24 +0,0 @@ -project('pathjoin', 'c') - -# Test string-args form since that is the canonical way -assert(join_paths('foo') == 'foo', 'Single argument join is broken') -assert(join_paths('foo', 'bar') == 'foo/bar', 'Path joining is broken') -assert(join_paths('foo', 'bar', 'baz') == 'foo/bar/baz', 'Path joining is broken') -assert(join_paths('/foo', 'bar') == '/foo/bar', 'Path joining is broken') -assert(join_paths('foo', '/bar') == '/bar', 'Absolute path joining is broken') -assert(join_paths('/foo', '/bar') == '/bar', 'Absolute path joining is broken') - -# Test array form since people are using that too -assert(join_paths(['foo']) == 'foo', 'Single argument join is broken') -assert(join_paths(['foo', 'bar']) == 'foo/bar', 'Path joining is broken') -assert(join_paths(['foo', 'bar', 'baz']) == 'foo/bar/baz', 'Path joining is broken') -assert(join_paths(['/foo', 'bar']) == '/foo/bar', 'Path joining is broken') -assert(join_paths(['foo', '/bar']) == '/bar', 'Absolute path joining is broken') -assert(join_paths(['/foo', '/bar']) == '/bar', 'Absolute path joining is broken') - -# Division operator should do the same as join_paths -assert('foo' / 'bar' == 'foo/bar', 'Path division is broken') -assert('foo' /'bar' /'baz' == 'foo/bar/baz', 'Path division is broken') -assert('/foo' / 'bar' == '/foo/bar', 'Path division is broken') -assert('foo' / '/bar' == '/bar', 'Absolute path division is broken') -assert('/foo' / '/bar' == '/bar', 'Absolute path division is broken') diff --git a/test cases/common/116 subdir subproject/meson.build b/test cases/common/116 subdir subproject/meson.build new file mode 100644 index 0000000..54ecfe0 --- /dev/null +++ b/test cases/common/116 subdir subproject/meson.build @@ -0,0 +1,2 @@ +project('proj', 'c') +subdir('prog') diff --git a/test cases/common/116 subdir subproject/prog/meson.build b/test cases/common/116 subdir subproject/prog/meson.build new file mode 100644 index 0000000..360b5f5 --- /dev/null +++ b/test cases/common/116 subdir subproject/prog/meson.build @@ -0,0 +1,5 @@ +subproject('sub') +libSub = dependency('sub', fallback: ['sub', 'libSub']) + +exe = executable('prog', 'prog.c', dependencies: libSub) +test('subdir subproject', exe) diff --git a/test cases/common/116 subdir subproject/prog/prog.c b/test cases/common/116 subdir subproject/prog/prog.c new file mode 100644 index 0000000..cf6f425 --- /dev/null +++ b/test cases/common/116 subdir subproject/prog/prog.c @@ -0,0 +1,5 @@ +#include + +int main() { + return sub(); +} diff --git a/test cases/common/116 subdir subproject/subprojects/sub/meson.build b/test cases/common/116 subdir subproject/subprojects/sub/meson.build new file mode 100644 index 0000000..94e9eec --- /dev/null +++ b/test cases/common/116 subdir subproject/subprojects/sub/meson.build @@ -0,0 +1,3 @@ +project('sub', 'c') +lib = static_library('sub', 'sub.c') +libSub = declare_dependency(include_directories: include_directories('.'), link_with: lib) diff --git a/test cases/common/116 subdir subproject/subprojects/sub/sub.c b/test cases/common/116 subdir subproject/subprojects/sub/sub.c new file mode 100644 index 0000000..068a5b8 --- /dev/null +++ b/test cases/common/116 subdir subproject/subprojects/sub/sub.c @@ -0,0 +1,5 @@ +#include "sub.h" + +int sub() { + return 0; +} diff --git a/test cases/common/116 subdir subproject/subprojects/sub/sub.h b/test cases/common/116 subdir subproject/subprojects/sub/sub.h new file mode 100644 index 0000000..f1ab0e1 --- /dev/null +++ b/test cases/common/116 subdir subproject/subprojects/sub/sub.h @@ -0,0 +1,6 @@ +#ifndef SUB_H +#define SUB_H + +int sub(); + +#endif diff --git a/test cases/common/117 interpreter copy mutable var on assignment/meson.build b/test cases/common/117 interpreter copy mutable var on assignment/meson.build new file mode 100644 index 0000000..8b15357 --- /dev/null +++ b/test cases/common/117 interpreter copy mutable var on assignment/meson.build @@ -0,0 +1,20 @@ +project('foo', 'c') + +a = configuration_data() +a.set('HELLO', 1) + +b = a + +assert(a.has('HELLO'), 'Original config data should be set on a') +assert(b.has('HELLO'), 'Original config data should be set on copy') + +configure_file(output : 'b.h', configuration : b) + +# This should still work, as we didn't use the original above but a copy! +a.set('WORLD', 1) + +assert(a.has('WORLD'), 'New config data should have been set') +assert(not b.has('WORLD'), 'New config data set should not affect var copied earlier') + +configure_file(output : 'a.h', configuration : a) + diff --git a/test cases/common/117 subdir subproject/meson.build b/test cases/common/117 subdir subproject/meson.build deleted file mode 100644 index 54ecfe0..0000000 --- a/test cases/common/117 subdir subproject/meson.build +++ /dev/null @@ -1,2 +0,0 @@ -project('proj', 'c') -subdir('prog') diff --git a/test cases/common/117 subdir subproject/prog/meson.build b/test cases/common/117 subdir subproject/prog/meson.build deleted file mode 100644 index 360b5f5..0000000 --- a/test cases/common/117 subdir subproject/prog/meson.build +++ /dev/null @@ -1,5 +0,0 @@ -subproject('sub') -libSub = dependency('sub', fallback: ['sub', 'libSub']) - -exe = executable('prog', 'prog.c', dependencies: libSub) -test('subdir subproject', exe) diff --git a/test cases/common/117 subdir subproject/prog/prog.c b/test cases/common/117 subdir subproject/prog/prog.c deleted file mode 100644 index cf6f425..0000000 --- a/test cases/common/117 subdir subproject/prog/prog.c +++ /dev/null @@ -1,5 +0,0 @@ -#include - -int main() { - return sub(); -} diff --git a/test cases/common/117 subdir subproject/subprojects/sub/meson.build b/test cases/common/117 subdir subproject/subprojects/sub/meson.build deleted file mode 100644 index 94e9eec..0000000 --- a/test cases/common/117 subdir subproject/subprojects/sub/meson.build +++ /dev/null @@ -1,3 +0,0 @@ -project('sub', 'c') -lib = static_library('sub', 'sub.c') -libSub = declare_dependency(include_directories: include_directories('.'), link_with: lib) diff --git a/test cases/common/117 subdir subproject/subprojects/sub/sub.c b/test cases/common/117 subdir subproject/subprojects/sub/sub.c deleted file mode 100644 index 068a5b8..0000000 --- a/test cases/common/117 subdir subproject/subprojects/sub/sub.c +++ /dev/null @@ -1,5 +0,0 @@ -#include "sub.h" - -int sub() { - return 0; -} diff --git a/test cases/common/117 subdir subproject/subprojects/sub/sub.h b/test cases/common/117 subdir subproject/subprojects/sub/sub.h deleted file mode 100644 index f1ab0e1..0000000 --- a/test cases/common/117 subdir subproject/subprojects/sub/sub.h +++ /dev/null @@ -1,6 +0,0 @@ -#ifndef SUB_H -#define SUB_H - -int sub(); - -#endif diff --git a/test cases/common/118 interpreter copy mutable var on assignment/meson.build b/test cases/common/118 interpreter copy mutable var on assignment/meson.build deleted file mode 100644 index 8b15357..0000000 --- a/test cases/common/118 interpreter copy mutable var on assignment/meson.build +++ /dev/null @@ -1,20 +0,0 @@ -project('foo', 'c') - -a = configuration_data() -a.set('HELLO', 1) - -b = a - -assert(a.has('HELLO'), 'Original config data should be set on a') -assert(b.has('HELLO'), 'Original config data should be set on copy') - -configure_file(output : 'b.h', configuration : b) - -# This should still work, as we didn't use the original above but a copy! -a.set('WORLD', 1) - -assert(a.has('WORLD'), 'New config data should have been set') -assert(not b.has('WORLD'), 'New config data set should not affect var copied earlier') - -configure_file(output : 'a.h', configuration : a) - diff --git a/test cases/common/118 skip/meson.build b/test cases/common/118 skip/meson.build new file mode 100644 index 0000000..1adedb6 --- /dev/null +++ b/test cases/common/118 skip/meson.build @@ -0,0 +1,4 @@ +project('skip', 'c') + +error('MESON_SKIP_TEST this test is always skipped.') + diff --git a/test cases/common/119 skip/meson.build b/test cases/common/119 skip/meson.build deleted file mode 100644 index 1adedb6..0000000 --- a/test cases/common/119 skip/meson.build +++ /dev/null @@ -1,4 +0,0 @@ -project('skip', 'c') - -error('MESON_SKIP_TEST this test is always skipped.') - diff --git a/test cases/common/119 subproject project arguments/exe.c b/test cases/common/119 subproject project arguments/exe.c new file mode 100644 index 0000000..d6440f0 --- /dev/null +++ b/test cases/common/119 subproject project arguments/exe.c @@ -0,0 +1,27 @@ +#ifndef PROJECT_OPTION +#error +#endif + +#ifndef PROJECT_OPTION_1 +#error +#endif + +#ifndef GLOBAL_ARGUMENT +#error +#endif + +#ifdef SUBPROJECT_OPTION +#error +#endif + +#ifdef OPTION_CPP +#error +#endif + +#ifndef PROJECT_OPTION_C_CPP +#error +#endif + +int main(int argc, char **argv) { + return 0; +} diff --git a/test cases/common/119 subproject project arguments/exe.cpp b/test cases/common/119 subproject project arguments/exe.cpp new file mode 100644 index 0000000..8471c6f --- /dev/null +++ b/test cases/common/119 subproject project arguments/exe.cpp @@ -0,0 +1,28 @@ +#ifdef PROJECT_OPTION +#error +#endif + +#ifdef PROJECT_OPTION_1 +#error +#endif + +#ifdef GLOBAL_ARGUMENT +#error +#endif + +#ifdef SUBPROJECT_OPTION +#error +#endif + +#ifndef PROJECT_OPTION_CPP +#error +#endif + +#ifndef PROJECT_OPTION_C_CPP +#error +#endif + +int main(int argc, char **argv) { + return 0; +} + diff --git a/test cases/common/119 subproject project arguments/meson.build b/test cases/common/119 subproject project arguments/meson.build new file mode 100644 index 0000000..90d4c05 --- /dev/null +++ b/test cases/common/119 subproject project arguments/meson.build @@ -0,0 +1,17 @@ +project('project options tester', 'c', 'cpp', + version : '2.3.4', + license : 'mylicense') + +add_global_arguments('-DGLOBAL_ARGUMENT', language: 'c') +add_project_arguments('-DPROJECT_OPTION', language: 'c') +add_project_arguments('-DPROJECT_OPTION_CPP', language: 'cpp') +add_project_arguments('-DPROJECT_OPTION_C_CPP', language: ['c', 'cpp']) + +sub = subproject('subexe', version : '1.0.0') + +add_project_arguments('-DPROJECT_OPTION_1', language: 'c') + +e = executable('exe', 'exe.c') +e = executable('execpp', 'exe.cpp') +test('exetest', e) +test('execpptest', e) diff --git a/test cases/common/119 subproject project arguments/subprojects/subexe/meson.build b/test cases/common/119 subproject project arguments/subprojects/subexe/meson.build new file mode 100644 index 0000000..ef141dc --- /dev/null +++ b/test cases/common/119 subproject project arguments/subprojects/subexe/meson.build @@ -0,0 +1,13 @@ +project('subproject', 'c', + version : '1.0.0', + license : ['sublicense1', 'sublicense2']) + +if not meson.is_subproject() + error('Claimed to be master project even though we are a subproject.') +endif + +assert(meson.project_name() == 'subproject', 'Incorrect subproject name') + +add_project_arguments('-DSUBPROJECT_OPTION', language: 'c') +e = executable('subexe', 'subexe.c') +test('subexetest', e) diff --git a/test cases/common/119 subproject project arguments/subprojects/subexe/subexe.c b/test cases/common/119 subproject project arguments/subprojects/subexe/subexe.c new file mode 100644 index 0000000..f748afc --- /dev/null +++ b/test cases/common/119 subproject project arguments/subprojects/subexe/subexe.c @@ -0,0 +1,27 @@ +#ifdef PROJECT_OPTION +#error +#endif + +#ifdef PROJECT_OPTION_1 +#error +#endif + +#ifdef PROJECT_OPTION_C_CPP +#error +#endif + +#ifndef GLOBAL_ARGUMENT +#error +#endif + +#ifndef SUBPROJECT_OPTION +#error +#endif + +#ifdef OPTION_CPP +#error +#endif + +int main(int argc, char **argv) { + return 0; +} diff --git a/test cases/common/120 subproject project arguments/exe.c b/test cases/common/120 subproject project arguments/exe.c deleted file mode 100644 index d6440f0..0000000 --- a/test cases/common/120 subproject project arguments/exe.c +++ /dev/null @@ -1,27 +0,0 @@ -#ifndef PROJECT_OPTION -#error -#endif - -#ifndef PROJECT_OPTION_1 -#error -#endif - -#ifndef GLOBAL_ARGUMENT -#error -#endif - -#ifdef SUBPROJECT_OPTION -#error -#endif - -#ifdef OPTION_CPP -#error -#endif - -#ifndef PROJECT_OPTION_C_CPP -#error -#endif - -int main(int argc, char **argv) { - return 0; -} diff --git a/test cases/common/120 subproject project arguments/exe.cpp b/test cases/common/120 subproject project arguments/exe.cpp deleted file mode 100644 index 8471c6f..0000000 --- a/test cases/common/120 subproject project arguments/exe.cpp +++ /dev/null @@ -1,28 +0,0 @@ -#ifdef PROJECT_OPTION -#error -#endif - -#ifdef PROJECT_OPTION_1 -#error -#endif - -#ifdef GLOBAL_ARGUMENT -#error -#endif - -#ifdef SUBPROJECT_OPTION -#error -#endif - -#ifndef PROJECT_OPTION_CPP -#error -#endif - -#ifndef PROJECT_OPTION_C_CPP -#error -#endif - -int main(int argc, char **argv) { - return 0; -} - diff --git a/test cases/common/120 subproject project arguments/meson.build b/test cases/common/120 subproject project arguments/meson.build deleted file mode 100644 index 90d4c05..0000000 --- a/test cases/common/120 subproject project arguments/meson.build +++ /dev/null @@ -1,17 +0,0 @@ -project('project options tester', 'c', 'cpp', - version : '2.3.4', - license : 'mylicense') - -add_global_arguments('-DGLOBAL_ARGUMENT', language: 'c') -add_project_arguments('-DPROJECT_OPTION', language: 'c') -add_project_arguments('-DPROJECT_OPTION_CPP', language: 'cpp') -add_project_arguments('-DPROJECT_OPTION_C_CPP', language: ['c', 'cpp']) - -sub = subproject('subexe', version : '1.0.0') - -add_project_arguments('-DPROJECT_OPTION_1', language: 'c') - -e = executable('exe', 'exe.c') -e = executable('execpp', 'exe.cpp') -test('exetest', e) -test('execpptest', e) diff --git a/test cases/common/120 subproject project arguments/subprojects/subexe/meson.build b/test cases/common/120 subproject project arguments/subprojects/subexe/meson.build deleted file mode 100644 index ef141dc..0000000 --- a/test cases/common/120 subproject project arguments/subprojects/subexe/meson.build +++ /dev/null @@ -1,13 +0,0 @@ -project('subproject', 'c', - version : '1.0.0', - license : ['sublicense1', 'sublicense2']) - -if not meson.is_subproject() - error('Claimed to be master project even though we are a subproject.') -endif - -assert(meson.project_name() == 'subproject', 'Incorrect subproject name') - -add_project_arguments('-DSUBPROJECT_OPTION', language: 'c') -e = executable('subexe', 'subexe.c') -test('subexetest', e) diff --git a/test cases/common/120 subproject project arguments/subprojects/subexe/subexe.c b/test cases/common/120 subproject project arguments/subprojects/subexe/subexe.c deleted file mode 100644 index f748afc..0000000 --- a/test cases/common/120 subproject project arguments/subprojects/subexe/subexe.c +++ /dev/null @@ -1,27 +0,0 @@ -#ifdef PROJECT_OPTION -#error -#endif - -#ifdef PROJECT_OPTION_1 -#error -#endif - -#ifdef PROJECT_OPTION_C_CPP -#error -#endif - -#ifndef GLOBAL_ARGUMENT -#error -#endif - -#ifndef SUBPROJECT_OPTION -#error -#endif - -#ifdef OPTION_CPP -#error -#endif - -int main(int argc, char **argv) { - return 0; -} diff --git a/test cases/common/120 test skip/meson.build b/test cases/common/120 test skip/meson.build new file mode 100644 index 0000000..568527f --- /dev/null +++ b/test cases/common/120 test skip/meson.build @@ -0,0 +1,4 @@ +project('test skip', 'c') + +exe_test_skip = executable('test_skip', 'test_skip.c') +test('test_skip', exe_test_skip) diff --git a/test cases/common/120 test skip/test_skip.c b/test cases/common/120 test skip/test_skip.c new file mode 100644 index 0000000..db26681 --- /dev/null +++ b/test cases/common/120 test skip/test_skip.c @@ -0,0 +1,3 @@ +int main(int argc, char *argv[]) { + return 77; +} diff --git a/test cases/common/121 shared module/installed_files.txt b/test cases/common/121 shared module/installed_files.txt new file mode 100644 index 0000000..d46527c --- /dev/null +++ b/test cases/common/121 shared module/installed_files.txt @@ -0,0 +1,3 @@ +usr/lib/modules/libnosyms?so +usr/lib/modules/libnosyms?implibempty +?msvc:usr/lib/modules/nosyms.pdb diff --git a/test cases/common/121 shared module/meson.build b/test cases/common/121 shared module/meson.build new file mode 100644 index 0000000..5d7fed9 --- /dev/null +++ b/test cases/common/121 shared module/meson.build @@ -0,0 +1,22 @@ +project('shared module', 'c') + +dl = meson.get_compiler('c').find_library('dl', required : false) +l = shared_library('runtime', 'runtime.c') +# Do NOT link the module with the runtime library. This +# is a common approach for plugins that are only used +# with dlopen. Any symbols are resolved dynamically +# at runtime. This requires extra help on Windows, so +# should be avoided unless really necessary. +m = shared_module('mymodule', 'module.c') +e = executable('prog', 'prog.c', + link_with : l, export_dynamic : true, dependencies : dl) +test('import test', e, args : m) + +# Same as above, but module created with build_target() +m2 = build_target('mymodule2', 'module.c', target_type: 'shared_module') +test('import test 2', e, args : m2) + +# Shared module that does not export any symbols +shared_module('nosyms', 'nosyms.c', + install : true, + install_dir : join_paths(get_option('libdir'), 'modules')) diff --git a/test cases/common/121 shared module/module.c b/test cases/common/121 shared module/module.c new file mode 100644 index 0000000..9c8774d --- /dev/null +++ b/test cases/common/121 shared module/module.c @@ -0,0 +1,96 @@ +#if defined _WIN32 || defined __CYGWIN__ + #define DLL_PUBLIC __declspec(dllexport) +#else + #if defined __GNUC__ + #define DLL_PUBLIC __attribute__ ((visibility("default"))) + #else + #pragma message ("Compiler does not support symbol visibility.") + #define DLL_PUBLIC + #endif +#endif + +#if defined(_WIN32) || defined(__CYGWIN__) + +#include + +typedef int (*fptr) (void); + +#ifdef __CYGWIN__ + +#include + +fptr find_any_f (const char *name) { + return (fptr) dlsym(RTLD_DEFAULT, name); +} +#else /* _WIN32 */ + +#include +#include + +static wchar_t* +win32_get_last_error (void) +{ + wchar_t *msg = NULL; + + FormatMessageW (FORMAT_MESSAGE_ALLOCATE_BUFFER + | FORMAT_MESSAGE_IGNORE_INSERTS + | FORMAT_MESSAGE_FROM_SYSTEM, + NULL, GetLastError (), 0, + (LPWSTR) &msg, 0, NULL); + return msg; +} + +/* Unlike Linux and OS X, when a library is loaded, all the symbols aren't + * loaded into a single namespace. You must fetch the symbol by iterating over + * all loaded modules. Code for finding the function from any of the loaded + * modules is taken from gmodule.c in glib */ +fptr find_any_f (const char *name) { + fptr f; + HANDLE snapshot; + MODULEENTRY32 me32; + + snapshot = CreateToolhelp32Snapshot (TH32CS_SNAPMODULE, 0); + if (snapshot == (HANDLE) -1) { + wchar_t *msg = win32_get_last_error (); + printf("Could not get snapshot: %S\n", msg); + return 0; + } + + me32.dwSize = sizeof (me32); + + f = NULL; + if (Module32First (snapshot, &me32)) { + do { + if ((f = (fptr) GetProcAddress (me32.hModule, name)) != NULL) + break; + } while (Module32Next (snapshot, &me32)); + } + + CloseHandle (snapshot); + return f; +} +#endif + +int DLL_PUBLIC func() { + fptr f; + + f = find_any_f ("func_from_language_runtime"); + if (f != NULL) + return f(); + printf ("Could not find function\n"); + return 1; +} + +#else +/* + * Shared modules often have references to symbols that are not defined + * at link time, but which will be provided from deps of the executable that + * dlopens it. We need to make sure that this works, i.e. that we do + * not pass -Wl,--no-undefined when linking modules. + */ +int func_from_language_runtime(); + +int DLL_PUBLIC func(void) { + return func_from_language_runtime(); +} +#endif diff --git a/test cases/common/121 shared module/nosyms.c b/test cases/common/121 shared module/nosyms.c new file mode 100644 index 0000000..3432b1c --- /dev/null +++ b/test cases/common/121 shared module/nosyms.c @@ -0,0 +1,4 @@ +static int +func_not_exported (void) { + return 99; +} diff --git a/test cases/common/121 shared module/prog.c b/test cases/common/121 shared module/prog.c new file mode 100644 index 0000000..8b56d93 --- /dev/null +++ b/test cases/common/121 shared module/prog.c @@ -0,0 +1,102 @@ + +#include + +int func_from_language_runtime(void); +typedef int (*fptr) (void); + +#ifdef _WIN32 + +#include + +static wchar_t* +win32_get_last_error (void) +{ + wchar_t *msg = NULL; + + FormatMessageW (FORMAT_MESSAGE_ALLOCATE_BUFFER + | FORMAT_MESSAGE_IGNORE_INSERTS + | FORMAT_MESSAGE_FROM_SYSTEM, + NULL, GetLastError (), 0, + (LPWSTR) &msg, 0, NULL); + return msg; +} + +int +main (int argc, char **argv) +{ + HINSTANCE handle; + fptr importedfunc; + int expected, actual; + int ret = 1; + + handle = LoadLibraryA (argv[1]); + if (!handle) { + wchar_t *msg = win32_get_last_error (); + printf ("Could not open %s: %S\n", argv[1], msg); + goto nohandle; + } + + importedfunc = (fptr) GetProcAddress (handle, "func"); + if (importedfunc == NULL) { + wchar_t *msg = win32_get_last_error (); + printf ("Could not find 'func': %S\n", msg); + goto out; + } + + actual = importedfunc (); + expected = func_from_language_runtime (); + if (actual != expected) { + printf ("Got %i instead of %i\n", actual, expected); + goto out; + } + + ret = 0; +out: + FreeLibrary (handle); +nohandle: + return ret; +} + +#else + +#include +#include + +int main(int argc, char **argv) { + void *dl; + fptr importedfunc; + int expected, actual; + char *error; + int ret = 1; + + dlerror(); + dl = dlopen(argv[1], RTLD_LAZY); + error = dlerror(); + if(error) { + printf("Could not open %s: %s\n", argv[1], error); + goto nodl; + } + + importedfunc = (fptr) dlsym(dl, "func"); + if (importedfunc == NULL) { + printf ("Could not find 'func'\n"); + goto out; + } + + assert(importedfunc != func_from_language_runtime); + + actual = (*importedfunc)(); + expected = func_from_language_runtime (); + if (actual != expected) { + printf ("Got %i instead of %i\n", actual, expected); + goto out; + } + + ret = 0; +out: + dlclose(dl); +nodl: + return ret; +} + +#endif diff --git a/test cases/common/121 shared module/runtime.c b/test cases/common/121 shared module/runtime.c new file mode 100644 index 0000000..03bde86 --- /dev/null +++ b/test cases/common/121 shared module/runtime.c @@ -0,0 +1,19 @@ +#if defined _WIN32 || defined __CYGWIN__ + #define DLL_PUBLIC __declspec(dllexport) +#else + #if defined __GNUC__ + #define DLL_PUBLIC __attribute__ ((visibility("default"))) + #else + #pragma message ("Compiler does not support symbol visibility.") + #define DLL_PUBLIC + #endif +#endif + +/* + * This file pretends to be a language runtime that supports extension + * modules. + */ + +int DLL_PUBLIC func_from_language_runtime(void) { + return 86; +} diff --git a/test cases/common/121 test skip/meson.build b/test cases/common/121 test skip/meson.build deleted file mode 100644 index 568527f..0000000 --- a/test cases/common/121 test skip/meson.build +++ /dev/null @@ -1,4 +0,0 @@ -project('test skip', 'c') - -exe_test_skip = executable('test_skip', 'test_skip.c') -test('test_skip', exe_test_skip) diff --git a/test cases/common/121 test skip/test_skip.c b/test cases/common/121 test skip/test_skip.c deleted file mode 100644 index db26681..0000000 --- a/test cases/common/121 test skip/test_skip.c +++ /dev/null @@ -1,3 +0,0 @@ -int main(int argc, char *argv[]) { - return 77; -} diff --git a/test cases/common/122 llvm ir and assembly/main.c b/test cases/common/122 llvm ir and assembly/main.c new file mode 100644 index 0000000..97fe723 --- /dev/null +++ b/test cases/common/122 llvm ir and assembly/main.c @@ -0,0 +1,14 @@ +#include + +unsigned square_unsigned (unsigned a); + +int +main (int argc, char * argv[]) +{ + unsigned int ret = square_unsigned (2); + if (ret != 4) { + printf("Got %u instead of 4\n", ret); + return 1; + } + return 0; +} diff --git a/test cases/common/122 llvm ir and assembly/main.cpp b/test cases/common/122 llvm ir and assembly/main.cpp new file mode 100644 index 0000000..f2c7de3 --- /dev/null +++ b/test cases/common/122 llvm ir and assembly/main.cpp @@ -0,0 +1,16 @@ +#include + +extern "C" { + unsigned square_unsigned (unsigned a); +} + +int +main (int argc, char * argv[]) +{ + unsigned int ret = square_unsigned (2); + if (ret != 4) { + printf("Got %u instead of 4\n", ret); + return 1; + } + return 0; +} diff --git a/test cases/common/122 llvm ir and assembly/meson.build b/test cases/common/122 llvm ir and assembly/meson.build new file mode 100644 index 0000000..3cc7d5e --- /dev/null +++ b/test cases/common/122 llvm ir and assembly/meson.build @@ -0,0 +1,63 @@ +project('llvm-ir', 'c', 'cpp') + +cpu = host_machine.cpu_family() +supported_cpus = ['arm', 'x86', 'x86_64'] + +foreach lang : ['c', 'cpp'] + cc = meson.get_compiler(lang) + cc_id = cc.get_id() + ## Build a trivial executable with mixed LLVM IR source + if cc_id == 'clang' + e = executable('square_ir_' + lang, 'square.ll', 'main.' + lang) + test('test IR square' + lang, e) + endif + ## Build a trivial executable with mixed assembly source + # This also helps test whether cc.symbols_have_underscore_prefix() is working + # properly. This is done by assembling some assembly into an object that will + # provide the unsigned_squared() symbol to main.c/cpp. This requires the + # C symbol mangling to be known in advance. + if cc.symbols_have_underscore_prefix() + uscore_args = ['-DMESON_TEST__UNDERSCORE_SYMBOL'] + message('underscore is prefixed') + else + uscore_args = [] + message('underscore is NOT prefixed') + endif + square_base = 'square-' + cpu + square_impl = square_base + '.S' + # MSVC cannot directly compile assembly files, so we pass it through the + # cl.exe pre-processor first and then assemble it with the ml.exe assembler. + # Then we can link it into the executable. + if cc.get_argument_syntax() == 'msvc' + cl = cc.cmd_array() + if cpu == 'x86' + ml = find_program('ml', required: false) + elif cpu == 'x86_64' + ml = find_program('ml64', required: false) + else + error('Unsupported cpu family: "' + cpu + '"') + endif + if not ml.found() + error('MESON_SKIP_TEST: ML (masm) not found') + endif + # Preprocess file (ml doesn't support pre-processing) + # Force the intput to be C (/Tc) because ICL otherwise assumes it's an object (.obj) file + preproc_name = lang + square_base + '.i' + square_preproc = custom_target(lang + square_impl + 'preproc', + input : square_impl, + output : preproc_name, + command : [cl, '/nologo', '/EP', '/P', '/Fi' + preproc_name, '/Tc', '@INPUT@'] + uscore_args) + # Use assembled object file instead of the original .S assembly source + square_impl = custom_target(lang + square_impl, + input : square_preproc, + output : lang + square_base + '.obj', + command : [ml, '/nologo', '/safeseh', '/Fo', '@OUTPUT@', '/c', '@INPUT@']) + endif + if supported_cpus.contains(cpu) + e = executable('square_asm_' + lang, square_impl, 'main.' + lang, + c_args : uscore_args, cpp_args : uscore_args) + test('test ASM square' + lang, e) + elif cc_id != 'clang' + error('MESON_SKIP_TEST: Unsupported cpu: "' + cpu + '", and LLVM not found') + endif +endforeach diff --git a/test cases/common/122 llvm ir and assembly/square-arm.S b/test cases/common/122 llvm ir and assembly/square-arm.S new file mode 100644 index 0000000..4dd4467 --- /dev/null +++ b/test cases/common/122 llvm ir and assembly/square-arm.S @@ -0,0 +1,12 @@ +#include "symbol-underscore.h" + +.text +.globl SYMBOL_NAME(square_unsigned) +# ifdef __linux__ +.type square_unsigned, %function +#endif + +SYMBOL_NAME(square_unsigned): + mul r1, r0, r0 + mov r0, r1 + mov pc, lr diff --git a/test cases/common/122 llvm ir and assembly/square-x86.S b/test cases/common/122 llvm ir and assembly/square-x86.S new file mode 100644 index 0000000..18284c1 --- /dev/null +++ b/test cases/common/122 llvm ir and assembly/square-x86.S @@ -0,0 +1,36 @@ +#include "symbol-underscore.h" + +/* This sadly doesn't test the symbol underscore stuff. I can't figure out how + * to not use an automatic stdcall mechanism and do everything manually. */ +#ifdef _MSC_VER + +.386 +.MODEL FLAT, C + +PUBLIC square_unsigned +_TEXT SEGMENT + +square_unsigned PROC var1:DWORD + mov eax, var1 + imul eax, eax + ret + +square_unsigned ENDP + +_TEXT ENDS +END + +#else + +.text +.globl SYMBOL_NAME(square_unsigned) +# ifdef __linux__ +.type square_unsigned, %function +#endif + +SYMBOL_NAME(square_unsigned): + movl 4(%esp), %eax + imull %eax, %eax + retl + +#endif diff --git a/test cases/common/122 llvm ir and assembly/square-x86_64.S b/test cases/common/122 llvm ir and assembly/square-x86_64.S new file mode 100644 index 0000000..5678d00 --- /dev/null +++ b/test cases/common/122 llvm ir and assembly/square-x86_64.S @@ -0,0 +1,37 @@ +#include "symbol-underscore.h" + +#ifdef _MSC_VER /* MSVC on Windows */ + +PUBLIC SYMBOL_NAME(square_unsigned) +_TEXT SEGMENT + +SYMBOL_NAME(square_unsigned) PROC + mov eax, ecx + imul eax, eax + ret +SYMBOL_NAME(square_unsigned) ENDP + +_TEXT ENDS +END + +#else + +.text +.globl SYMBOL_NAME(square_unsigned) +# ifdef __linux__ +.type square_unsigned, %function +#endif + +# if defined(_WIN32) || defined(__CYGWIN__) /* msabi */ +SYMBOL_NAME(square_unsigned): + imull %ecx, %ecx + movl %ecx, %eax + retq +# else /* sysvabi */ +SYMBOL_NAME(square_unsigned): + imull %edi, %edi + movl %edi, %eax + retq +# endif + +#endif diff --git a/test cases/common/122 llvm ir and assembly/square.ll b/test cases/common/122 llvm ir and assembly/square.ll new file mode 100644 index 0000000..7c321aa --- /dev/null +++ b/test cases/common/122 llvm ir and assembly/square.ll @@ -0,0 +1,4 @@ +define i32 @square_unsigned(i32 %a) { + %1 = mul i32 %a, %a + ret i32 %1 +} diff --git a/test cases/common/122 llvm ir and assembly/symbol-underscore.h b/test cases/common/122 llvm ir and assembly/symbol-underscore.h new file mode 100644 index 0000000..d0f3ef9 --- /dev/null +++ b/test cases/common/122 llvm ir and assembly/symbol-underscore.h @@ -0,0 +1,5 @@ +#if defined(MESON_TEST__UNDERSCORE_SYMBOL) +# define SYMBOL_NAME(name) _##name +#else +# define SYMBOL_NAME(name) name +#endif diff --git a/test cases/common/122 shared module/installed_files.txt b/test cases/common/122 shared module/installed_files.txt deleted file mode 100644 index d46527c..0000000 --- a/test cases/common/122 shared module/installed_files.txt +++ /dev/null @@ -1,3 +0,0 @@ -usr/lib/modules/libnosyms?so -usr/lib/modules/libnosyms?implibempty -?msvc:usr/lib/modules/nosyms.pdb diff --git a/test cases/common/122 shared module/meson.build b/test cases/common/122 shared module/meson.build deleted file mode 100644 index 5d7fed9..0000000 --- a/test cases/common/122 shared module/meson.build +++ /dev/null @@ -1,22 +0,0 @@ -project('shared module', 'c') - -dl = meson.get_compiler('c').find_library('dl', required : false) -l = shared_library('runtime', 'runtime.c') -# Do NOT link the module with the runtime library. This -# is a common approach for plugins that are only used -# with dlopen. Any symbols are resolved dynamically -# at runtime. This requires extra help on Windows, so -# should be avoided unless really necessary. -m = shared_module('mymodule', 'module.c') -e = executable('prog', 'prog.c', - link_with : l, export_dynamic : true, dependencies : dl) -test('import test', e, args : m) - -# Same as above, but module created with build_target() -m2 = build_target('mymodule2', 'module.c', target_type: 'shared_module') -test('import test 2', e, args : m2) - -# Shared module that does not export any symbols -shared_module('nosyms', 'nosyms.c', - install : true, - install_dir : join_paths(get_option('libdir'), 'modules')) diff --git a/test cases/common/122 shared module/module.c b/test cases/common/122 shared module/module.c deleted file mode 100644 index 9c8774d..0000000 --- a/test cases/common/122 shared module/module.c +++ /dev/null @@ -1,96 +0,0 @@ -#if defined _WIN32 || defined __CYGWIN__ - #define DLL_PUBLIC __declspec(dllexport) -#else - #if defined __GNUC__ - #define DLL_PUBLIC __attribute__ ((visibility("default"))) - #else - #pragma message ("Compiler does not support symbol visibility.") - #define DLL_PUBLIC - #endif -#endif - -#if defined(_WIN32) || defined(__CYGWIN__) - -#include - -typedef int (*fptr) (void); - -#ifdef __CYGWIN__ - -#include - -fptr find_any_f (const char *name) { - return (fptr) dlsym(RTLD_DEFAULT, name); -} -#else /* _WIN32 */ - -#include -#include - -static wchar_t* -win32_get_last_error (void) -{ - wchar_t *msg = NULL; - - FormatMessageW (FORMAT_MESSAGE_ALLOCATE_BUFFER - | FORMAT_MESSAGE_IGNORE_INSERTS - | FORMAT_MESSAGE_FROM_SYSTEM, - NULL, GetLastError (), 0, - (LPWSTR) &msg, 0, NULL); - return msg; -} - -/* Unlike Linux and OS X, when a library is loaded, all the symbols aren't - * loaded into a single namespace. You must fetch the symbol by iterating over - * all loaded modules. Code for finding the function from any of the loaded - * modules is taken from gmodule.c in glib */ -fptr find_any_f (const char *name) { - fptr f; - HANDLE snapshot; - MODULEENTRY32 me32; - - snapshot = CreateToolhelp32Snapshot (TH32CS_SNAPMODULE, 0); - if (snapshot == (HANDLE) -1) { - wchar_t *msg = win32_get_last_error (); - printf("Could not get snapshot: %S\n", msg); - return 0; - } - - me32.dwSize = sizeof (me32); - - f = NULL; - if (Module32First (snapshot, &me32)) { - do { - if ((f = (fptr) GetProcAddress (me32.hModule, name)) != NULL) - break; - } while (Module32Next (snapshot, &me32)); - } - - CloseHandle (snapshot); - return f; -} -#endif - -int DLL_PUBLIC func() { - fptr f; - - f = find_any_f ("func_from_language_runtime"); - if (f != NULL) - return f(); - printf ("Could not find function\n"); - return 1; -} - -#else -/* - * Shared modules often have references to symbols that are not defined - * at link time, but which will be provided from deps of the executable that - * dlopens it. We need to make sure that this works, i.e. that we do - * not pass -Wl,--no-undefined when linking modules. - */ -int func_from_language_runtime(); - -int DLL_PUBLIC func(void) { - return func_from_language_runtime(); -} -#endif diff --git a/test cases/common/122 shared module/nosyms.c b/test cases/common/122 shared module/nosyms.c deleted file mode 100644 index 3432b1c..0000000 --- a/test cases/common/122 shared module/nosyms.c +++ /dev/null @@ -1,4 +0,0 @@ -static int -func_not_exported (void) { - return 99; -} diff --git a/test cases/common/122 shared module/prog.c b/test cases/common/122 shared module/prog.c deleted file mode 100644 index 8b56d93..0000000 --- a/test cases/common/122 shared module/prog.c +++ /dev/null @@ -1,102 +0,0 @@ - -#include - -int func_from_language_runtime(void); -typedef int (*fptr) (void); - -#ifdef _WIN32 - -#include - -static wchar_t* -win32_get_last_error (void) -{ - wchar_t *msg = NULL; - - FormatMessageW (FORMAT_MESSAGE_ALLOCATE_BUFFER - | FORMAT_MESSAGE_IGNORE_INSERTS - | FORMAT_MESSAGE_FROM_SYSTEM, - NULL, GetLastError (), 0, - (LPWSTR) &msg, 0, NULL); - return msg; -} - -int -main (int argc, char **argv) -{ - HINSTANCE handle; - fptr importedfunc; - int expected, actual; - int ret = 1; - - handle = LoadLibraryA (argv[1]); - if (!handle) { - wchar_t *msg = win32_get_last_error (); - printf ("Could not open %s: %S\n", argv[1], msg); - goto nohandle; - } - - importedfunc = (fptr) GetProcAddress (handle, "func"); - if (importedfunc == NULL) { - wchar_t *msg = win32_get_last_error (); - printf ("Could not find 'func': %S\n", msg); - goto out; - } - - actual = importedfunc (); - expected = func_from_language_runtime (); - if (actual != expected) { - printf ("Got %i instead of %i\n", actual, expected); - goto out; - } - - ret = 0; -out: - FreeLibrary (handle); -nohandle: - return ret; -} - -#else - -#include -#include - -int main(int argc, char **argv) { - void *dl; - fptr importedfunc; - int expected, actual; - char *error; - int ret = 1; - - dlerror(); - dl = dlopen(argv[1], RTLD_LAZY); - error = dlerror(); - if(error) { - printf("Could not open %s: %s\n", argv[1], error); - goto nodl; - } - - importedfunc = (fptr) dlsym(dl, "func"); - if (importedfunc == NULL) { - printf ("Could not find 'func'\n"); - goto out; - } - - assert(importedfunc != func_from_language_runtime); - - actual = (*importedfunc)(); - expected = func_from_language_runtime (); - if (actual != expected) { - printf ("Got %i instead of %i\n", actual, expected); - goto out; - } - - ret = 0; -out: - dlclose(dl); -nodl: - return ret; -} - -#endif diff --git a/test cases/common/122 shared module/runtime.c b/test cases/common/122 shared module/runtime.c deleted file mode 100644 index 03bde86..0000000 --- a/test cases/common/122 shared module/runtime.c +++ /dev/null @@ -1,19 +0,0 @@ -#if defined _WIN32 || defined __CYGWIN__ - #define DLL_PUBLIC __declspec(dllexport) -#else - #if defined __GNUC__ - #define DLL_PUBLIC __attribute__ ((visibility("default"))) - #else - #pragma message ("Compiler does not support symbol visibility.") - #define DLL_PUBLIC - #endif -#endif - -/* - * This file pretends to be a language runtime that supports extension - * modules. - */ - -int DLL_PUBLIC func_from_language_runtime(void) { - return 86; -} diff --git a/test cases/common/123 cpp and asm/meson.build b/test cases/common/123 cpp and asm/meson.build new file mode 100644 index 0000000..cf064d0 --- /dev/null +++ b/test cases/common/123 cpp and asm/meson.build @@ -0,0 +1,28 @@ +project('c++ and assembly test', 'cpp') + +cpp = meson.get_compiler('cpp') +cpu = host_machine.cpu_family() + +supported_cpus = ['arm', 'x86', 'x86_64'] + +if not supported_cpus.contains(cpu) + error('MESON_SKIP_TEST unsupported cpu:' + cpu) +endif + +if cpp.symbols_have_underscore_prefix() + add_project_arguments('-DMESON_TEST__UNDERSCORE_SYMBOL', language : 'cpp') +endif + +sources = ['trivial.cc'] +# If the compiler cannot compile assembly, don't use it +if not ['msvc', 'clang-cl', 'intel-cl'].contains(meson.get_compiler('cpp').get_id()) + sources += ['retval-' + cpu + '.S'] + cpp_args = ['-DUSE_ASM'] + message('Using ASM') +else + cpp_args = ['-DNO_USE_ASM'] +endif + +exe = executable('trivialprog', sources, + cpp_args : cpp_args) +test('runtest', exe) diff --git a/test cases/common/123 cpp and asm/retval-arm.S b/test cases/common/123 cpp and asm/retval-arm.S new file mode 100644 index 0000000..a892362 --- /dev/null +++ b/test cases/common/123 cpp and asm/retval-arm.S @@ -0,0 +1,11 @@ +#include "symbol-underscore.h" + +.text +.globl SYMBOL_NAME(get_retval) +# ifdef __linux__ +.type get_retval, %function +#endif + +SYMBOL_NAME(get_retval): + mov r0, #0 + mov pc, lr diff --git a/test cases/common/123 cpp and asm/retval-x86.S b/test cases/common/123 cpp and asm/retval-x86.S new file mode 100644 index 0000000..f9e8190 --- /dev/null +++ b/test cases/common/123 cpp and asm/retval-x86.S @@ -0,0 +1,11 @@ +#include "symbol-underscore.h" + +.text +.globl SYMBOL_NAME(get_retval) +# ifdef __linux__ +.type get_retval, %function +#endif + +SYMBOL_NAME(get_retval): + xorl %eax, %eax + retl diff --git a/test cases/common/123 cpp and asm/retval-x86_64.S b/test cases/common/123 cpp and asm/retval-x86_64.S new file mode 100644 index 0000000..1a5f3eb --- /dev/null +++ b/test cases/common/123 cpp and asm/retval-x86_64.S @@ -0,0 +1,11 @@ +#include "symbol-underscore.h" + +.text +.globl SYMBOL_NAME(get_retval) +# ifdef __linux__ +.type get_retval, %function +#endif + +SYMBOL_NAME(get_retval): + xorl %eax, %eax + retq diff --git a/test cases/common/123 cpp and asm/symbol-underscore.h b/test cases/common/123 cpp and asm/symbol-underscore.h new file mode 100644 index 0000000..d0f3ef9 --- /dev/null +++ b/test cases/common/123 cpp and asm/symbol-underscore.h @@ -0,0 +1,5 @@ +#if defined(MESON_TEST__UNDERSCORE_SYMBOL) +# define SYMBOL_NAME(name) _##name +#else +# define SYMBOL_NAME(name) name +#endif diff --git a/test cases/common/123 cpp and asm/trivial.cc b/test cases/common/123 cpp and asm/trivial.cc new file mode 100644 index 0000000..d2928c0 --- /dev/null +++ b/test cases/common/123 cpp and asm/trivial.cc @@ -0,0 +1,16 @@ +#include + +extern "C" { + int get_retval(void); +} + +int main(int argc, char **argv) { + std::cout << "C++ seems to be working." << std::endl; +#if defined(USE_ASM) + return get_retval(); +#elif defined(NO_USE_ASM) + return 0; +#else + #error "Forgot to pass asm define" +#endif +} diff --git a/test cases/common/123 llvm ir and assembly/main.c b/test cases/common/123 llvm ir and assembly/main.c deleted file mode 100644 index 97fe723..0000000 --- a/test cases/common/123 llvm ir and assembly/main.c +++ /dev/null @@ -1,14 +0,0 @@ -#include - -unsigned square_unsigned (unsigned a); - -int -main (int argc, char * argv[]) -{ - unsigned int ret = square_unsigned (2); - if (ret != 4) { - printf("Got %u instead of 4\n", ret); - return 1; - } - return 0; -} diff --git a/test cases/common/123 llvm ir and assembly/main.cpp b/test cases/common/123 llvm ir and assembly/main.cpp deleted file mode 100644 index f2c7de3..0000000 --- a/test cases/common/123 llvm ir and assembly/main.cpp +++ /dev/null @@ -1,16 +0,0 @@ -#include - -extern "C" { - unsigned square_unsigned (unsigned a); -} - -int -main (int argc, char * argv[]) -{ - unsigned int ret = square_unsigned (2); - if (ret != 4) { - printf("Got %u instead of 4\n", ret); - return 1; - } - return 0; -} diff --git a/test cases/common/123 llvm ir and assembly/meson.build b/test cases/common/123 llvm ir and assembly/meson.build deleted file mode 100644 index 3cc7d5e..0000000 --- a/test cases/common/123 llvm ir and assembly/meson.build +++ /dev/null @@ -1,63 +0,0 @@ -project('llvm-ir', 'c', 'cpp') - -cpu = host_machine.cpu_family() -supported_cpus = ['arm', 'x86', 'x86_64'] - -foreach lang : ['c', 'cpp'] - cc = meson.get_compiler(lang) - cc_id = cc.get_id() - ## Build a trivial executable with mixed LLVM IR source - if cc_id == 'clang' - e = executable('square_ir_' + lang, 'square.ll', 'main.' + lang) - test('test IR square' + lang, e) - endif - ## Build a trivial executable with mixed assembly source - # This also helps test whether cc.symbols_have_underscore_prefix() is working - # properly. This is done by assembling some assembly into an object that will - # provide the unsigned_squared() symbol to main.c/cpp. This requires the - # C symbol mangling to be known in advance. - if cc.symbols_have_underscore_prefix() - uscore_args = ['-DMESON_TEST__UNDERSCORE_SYMBOL'] - message('underscore is prefixed') - else - uscore_args = [] - message('underscore is NOT prefixed') - endif - square_base = 'square-' + cpu - square_impl = square_base + '.S' - # MSVC cannot directly compile assembly files, so we pass it through the - # cl.exe pre-processor first and then assemble it with the ml.exe assembler. - # Then we can link it into the executable. - if cc.get_argument_syntax() == 'msvc' - cl = cc.cmd_array() - if cpu == 'x86' - ml = find_program('ml', required: false) - elif cpu == 'x86_64' - ml = find_program('ml64', required: false) - else - error('Unsupported cpu family: "' + cpu + '"') - endif - if not ml.found() - error('MESON_SKIP_TEST: ML (masm) not found') - endif - # Preprocess file (ml doesn't support pre-processing) - # Force the intput to be C (/Tc) because ICL otherwise assumes it's an object (.obj) file - preproc_name = lang + square_base + '.i' - square_preproc = custom_target(lang + square_impl + 'preproc', - input : square_impl, - output : preproc_name, - command : [cl, '/nologo', '/EP', '/P', '/Fi' + preproc_name, '/Tc', '@INPUT@'] + uscore_args) - # Use assembled object file instead of the original .S assembly source - square_impl = custom_target(lang + square_impl, - input : square_preproc, - output : lang + square_base + '.obj', - command : [ml, '/nologo', '/safeseh', '/Fo', '@OUTPUT@', '/c', '@INPUT@']) - endif - if supported_cpus.contains(cpu) - e = executable('square_asm_' + lang, square_impl, 'main.' + lang, - c_args : uscore_args, cpp_args : uscore_args) - test('test ASM square' + lang, e) - elif cc_id != 'clang' - error('MESON_SKIP_TEST: Unsupported cpu: "' + cpu + '", and LLVM not found') - endif -endforeach diff --git a/test cases/common/123 llvm ir and assembly/square-arm.S b/test cases/common/123 llvm ir and assembly/square-arm.S deleted file mode 100644 index 4dd4467..0000000 --- a/test cases/common/123 llvm ir and assembly/square-arm.S +++ /dev/null @@ -1,12 +0,0 @@ -#include "symbol-underscore.h" - -.text -.globl SYMBOL_NAME(square_unsigned) -# ifdef __linux__ -.type square_unsigned, %function -#endif - -SYMBOL_NAME(square_unsigned): - mul r1, r0, r0 - mov r0, r1 - mov pc, lr diff --git a/test cases/common/123 llvm ir and assembly/square-x86.S b/test cases/common/123 llvm ir and assembly/square-x86.S deleted file mode 100644 index 18284c1..0000000 --- a/test cases/common/123 llvm ir and assembly/square-x86.S +++ /dev/null @@ -1,36 +0,0 @@ -#include "symbol-underscore.h" - -/* This sadly doesn't test the symbol underscore stuff. I can't figure out how - * to not use an automatic stdcall mechanism and do everything manually. */ -#ifdef _MSC_VER - -.386 -.MODEL FLAT, C - -PUBLIC square_unsigned -_TEXT SEGMENT - -square_unsigned PROC var1:DWORD - mov eax, var1 - imul eax, eax - ret - -square_unsigned ENDP - -_TEXT ENDS -END - -#else - -.text -.globl SYMBOL_NAME(square_unsigned) -# ifdef __linux__ -.type square_unsigned, %function -#endif - -SYMBOL_NAME(square_unsigned): - movl 4(%esp), %eax - imull %eax, %eax - retl - -#endif diff --git a/test cases/common/123 llvm ir and assembly/square-x86_64.S b/test cases/common/123 llvm ir and assembly/square-x86_64.S deleted file mode 100644 index 5678d00..0000000 --- a/test cases/common/123 llvm ir and assembly/square-x86_64.S +++ /dev/null @@ -1,37 +0,0 @@ -#include "symbol-underscore.h" - -#ifdef _MSC_VER /* MSVC on Windows */ - -PUBLIC SYMBOL_NAME(square_unsigned) -_TEXT SEGMENT - -SYMBOL_NAME(square_unsigned) PROC - mov eax, ecx - imul eax, eax - ret -SYMBOL_NAME(square_unsigned) ENDP - -_TEXT ENDS -END - -#else - -.text -.globl SYMBOL_NAME(square_unsigned) -# ifdef __linux__ -.type square_unsigned, %function -#endif - -# if defined(_WIN32) || defined(__CYGWIN__) /* msabi */ -SYMBOL_NAME(square_unsigned): - imull %ecx, %ecx - movl %ecx, %eax - retq -# else /* sysvabi */ -SYMBOL_NAME(square_unsigned): - imull %edi, %edi - movl %edi, %eax - retq -# endif - -#endif diff --git a/test cases/common/123 llvm ir and assembly/square.ll b/test cases/common/123 llvm ir and assembly/square.ll deleted file mode 100644 index 7c321aa..0000000 --- a/test cases/common/123 llvm ir and assembly/square.ll +++ /dev/null @@ -1,4 +0,0 @@ -define i32 @square_unsigned(i32 %a) { - %1 = mul i32 %a, %a - ret i32 %1 -} diff --git a/test cases/common/123 llvm ir and assembly/symbol-underscore.h b/test cases/common/123 llvm ir and assembly/symbol-underscore.h deleted file mode 100644 index d0f3ef9..0000000 --- a/test cases/common/123 llvm ir and assembly/symbol-underscore.h +++ /dev/null @@ -1,5 +0,0 @@ -#if defined(MESON_TEST__UNDERSCORE_SYMBOL) -# define SYMBOL_NAME(name) _##name -#else -# define SYMBOL_NAME(name) name -#endif diff --git a/test cases/common/124 cpp and asm/meson.build b/test cases/common/124 cpp and asm/meson.build deleted file mode 100644 index cf064d0..0000000 --- a/test cases/common/124 cpp and asm/meson.build +++ /dev/null @@ -1,28 +0,0 @@ -project('c++ and assembly test', 'cpp') - -cpp = meson.get_compiler('cpp') -cpu = host_machine.cpu_family() - -supported_cpus = ['arm', 'x86', 'x86_64'] - -if not supported_cpus.contains(cpu) - error('MESON_SKIP_TEST unsupported cpu:' + cpu) -endif - -if cpp.symbols_have_underscore_prefix() - add_project_arguments('-DMESON_TEST__UNDERSCORE_SYMBOL', language : 'cpp') -endif - -sources = ['trivial.cc'] -# If the compiler cannot compile assembly, don't use it -if not ['msvc', 'clang-cl', 'intel-cl'].contains(meson.get_compiler('cpp').get_id()) - sources += ['retval-' + cpu + '.S'] - cpp_args = ['-DUSE_ASM'] - message('Using ASM') -else - cpp_args = ['-DNO_USE_ASM'] -endif - -exe = executable('trivialprog', sources, - cpp_args : cpp_args) -test('runtest', exe) diff --git a/test cases/common/124 cpp and asm/retval-arm.S b/test cases/common/124 cpp and asm/retval-arm.S deleted file mode 100644 index a892362..0000000 --- a/test cases/common/124 cpp and asm/retval-arm.S +++ /dev/null @@ -1,11 +0,0 @@ -#include "symbol-underscore.h" - -.text -.globl SYMBOL_NAME(get_retval) -# ifdef __linux__ -.type get_retval, %function -#endif - -SYMBOL_NAME(get_retval): - mov r0, #0 - mov pc, lr diff --git a/test cases/common/124 cpp and asm/retval-x86.S b/test cases/common/124 cpp and asm/retval-x86.S deleted file mode 100644 index f9e8190..0000000 --- a/test cases/common/124 cpp and asm/retval-x86.S +++ /dev/null @@ -1,11 +0,0 @@ -#include "symbol-underscore.h" - -.text -.globl SYMBOL_NAME(get_retval) -# ifdef __linux__ -.type get_retval, %function -#endif - -SYMBOL_NAME(get_retval): - xorl %eax, %eax - retl diff --git a/test cases/common/124 cpp and asm/retval-x86_64.S b/test cases/common/124 cpp and asm/retval-x86_64.S deleted file mode 100644 index 1a5f3eb..0000000 --- a/test cases/common/124 cpp and asm/retval-x86_64.S +++ /dev/null @@ -1,11 +0,0 @@ -#include "symbol-underscore.h" - -.text -.globl SYMBOL_NAME(get_retval) -# ifdef __linux__ -.type get_retval, %function -#endif - -SYMBOL_NAME(get_retval): - xorl %eax, %eax - retq diff --git a/test cases/common/124 cpp and asm/symbol-underscore.h b/test cases/common/124 cpp and asm/symbol-underscore.h deleted file mode 100644 index d0f3ef9..0000000 --- a/test cases/common/124 cpp and asm/symbol-underscore.h +++ /dev/null @@ -1,5 +0,0 @@ -#if defined(MESON_TEST__UNDERSCORE_SYMBOL) -# define SYMBOL_NAME(name) _##name -#else -# define SYMBOL_NAME(name) name -#endif diff --git a/test cases/common/124 cpp and asm/trivial.cc b/test cases/common/124 cpp and asm/trivial.cc deleted file mode 100644 index d2928c0..0000000 --- a/test cases/common/124 cpp and asm/trivial.cc +++ /dev/null @@ -1,16 +0,0 @@ -#include - -extern "C" { - int get_retval(void); -} - -int main(int argc, char **argv) { - std::cout << "C++ seems to be working." << std::endl; -#if defined(USE_ASM) - return get_retval(); -#elif defined(NO_USE_ASM) - return 0; -#else - #error "Forgot to pass asm define" -#endif -} diff --git a/test cases/common/124 extract all shared library/extractor.h b/test cases/common/124 extract all shared library/extractor.h new file mode 100644 index 0000000..d0917a1 --- /dev/null +++ b/test cases/common/124 extract all shared library/extractor.h @@ -0,0 +1,6 @@ +#pragma once + +int func1(); +int func2(); +int func3(); +int func4(); diff --git a/test cases/common/124 extract all shared library/four.c b/test cases/common/124 extract all shared library/four.c new file mode 100644 index 0000000..5ca6696 --- /dev/null +++ b/test cases/common/124 extract all shared library/four.c @@ -0,0 +1,5 @@ +#include"extractor.h" + +int func4() { + return 4; +} diff --git a/test cases/common/124 extract all shared library/func1234.def b/test cases/common/124 extract all shared library/func1234.def new file mode 100644 index 0000000..d62c08d --- /dev/null +++ b/test cases/common/124 extract all shared library/func1234.def @@ -0,0 +1,5 @@ +EXPORTS + func1 + func2 + func3 + func4 diff --git a/test cases/common/124 extract all shared library/meson.build b/test cases/common/124 extract all shared library/meson.build new file mode 100644 index 0000000..7c24fde --- /dev/null +++ b/test cases/common/124 extract all shared library/meson.build @@ -0,0 +1,10 @@ +project('extract all', 'c', 'cpp') + +a = static_library('a', 'one.c', 'two.c') +b = static_library('b', 'three.c', 'four.c') +c = shared_library('c', + objects : [a.extract_all_objects(), b.extract_all_objects()], + vs_module_defs : 'func1234.def') + +e = executable('proggie', 'prog.c', link_with : c) +test('extall', e) diff --git a/test cases/common/124 extract all shared library/one.c b/test cases/common/124 extract all shared library/one.c new file mode 100644 index 0000000..cfb0157 --- /dev/null +++ b/test cases/common/124 extract all shared library/one.c @@ -0,0 +1,5 @@ +#include"extractor.h" + +int func1() { + return 1; +} diff --git a/test cases/common/124 extract all shared library/prog.c b/test cases/common/124 extract all shared library/prog.c new file mode 100644 index 0000000..57a4c64 --- /dev/null +++ b/test cases/common/124 extract all shared library/prog.c @@ -0,0 +1,10 @@ +#include"extractor.h" +#include + +int main(int argc, char **argv) { + if((1+2+3+4) != (func1() + func2() + func3() + func4())) { + printf("Arithmetic is fail.\n"); + return 1; + } + return 0; +} diff --git a/test cases/common/124 extract all shared library/three.c b/test cases/common/124 extract all shared library/three.c new file mode 100644 index 0000000..c410046 --- /dev/null +++ b/test cases/common/124 extract all shared library/three.c @@ -0,0 +1,5 @@ +#include"extractor.h" + +int func3() { + return 3; +} diff --git a/test cases/common/124 extract all shared library/two.c b/test cases/common/124 extract all shared library/two.c new file mode 100644 index 0000000..3ece512 --- /dev/null +++ b/test cases/common/124 extract all shared library/two.c @@ -0,0 +1,5 @@ +#include"extractor.h" + +int func2() { + return 2; +} diff --git a/test cases/common/125 extract all shared library/extractor.h b/test cases/common/125 extract all shared library/extractor.h deleted file mode 100644 index d0917a1..0000000 --- a/test cases/common/125 extract all shared library/extractor.h +++ /dev/null @@ -1,6 +0,0 @@ -#pragma once - -int func1(); -int func2(); -int func3(); -int func4(); diff --git a/test cases/common/125 extract all shared library/four.c b/test cases/common/125 extract all shared library/four.c deleted file mode 100644 index 5ca6696..0000000 --- a/test cases/common/125 extract all shared library/four.c +++ /dev/null @@ -1,5 +0,0 @@ -#include"extractor.h" - -int func4() { - return 4; -} diff --git a/test cases/common/125 extract all shared library/func1234.def b/test cases/common/125 extract all shared library/func1234.def deleted file mode 100644 index d62c08d..0000000 --- a/test cases/common/125 extract all shared library/func1234.def +++ /dev/null @@ -1,5 +0,0 @@ -EXPORTS - func1 - func2 - func3 - func4 diff --git a/test cases/common/125 extract all shared library/meson.build b/test cases/common/125 extract all shared library/meson.build deleted file mode 100644 index 7c24fde..0000000 --- a/test cases/common/125 extract all shared library/meson.build +++ /dev/null @@ -1,10 +0,0 @@ -project('extract all', 'c', 'cpp') - -a = static_library('a', 'one.c', 'two.c') -b = static_library('b', 'three.c', 'four.c') -c = shared_library('c', - objects : [a.extract_all_objects(), b.extract_all_objects()], - vs_module_defs : 'func1234.def') - -e = executable('proggie', 'prog.c', link_with : c) -test('extall', e) diff --git a/test cases/common/125 extract all shared library/one.c b/test cases/common/125 extract all shared library/one.c deleted file mode 100644 index cfb0157..0000000 --- a/test cases/common/125 extract all shared library/one.c +++ /dev/null @@ -1,5 +0,0 @@ -#include"extractor.h" - -int func1() { - return 1; -} diff --git a/test cases/common/125 extract all shared library/prog.c b/test cases/common/125 extract all shared library/prog.c deleted file mode 100644 index 57a4c64..0000000 --- a/test cases/common/125 extract all shared library/prog.c +++ /dev/null @@ -1,10 +0,0 @@ -#include"extractor.h" -#include - -int main(int argc, char **argv) { - if((1+2+3+4) != (func1() + func2() + func3() + func4())) { - printf("Arithmetic is fail.\n"); - return 1; - } - return 0; -} diff --git a/test cases/common/125 extract all shared library/three.c b/test cases/common/125 extract all shared library/three.c deleted file mode 100644 index c410046..0000000 --- a/test cases/common/125 extract all shared library/three.c +++ /dev/null @@ -1,5 +0,0 @@ -#include"extractor.h" - -int func3() { - return 3; -} diff --git a/test cases/common/125 extract all shared library/two.c b/test cases/common/125 extract all shared library/two.c deleted file mode 100644 index 3ece512..0000000 --- a/test cases/common/125 extract all shared library/two.c +++ /dev/null @@ -1,5 +0,0 @@ -#include"extractor.h" - -int func2() { - return 2; -} diff --git a/test cases/common/125 object only target/installed_files.txt b/test cases/common/125 object only target/installed_files.txt new file mode 100644 index 0000000..5e796b0 --- /dev/null +++ b/test cases/common/125 object only target/installed_files.txt @@ -0,0 +1,2 @@ +usr/bin/prog?exe +?msvc:usr/bin/prog.pdb diff --git a/test cases/common/125 object only target/meson.build b/test cases/common/125 object only target/meson.build new file mode 100644 index 0000000..d83a658 --- /dev/null +++ b/test cases/common/125 object only target/meson.build @@ -0,0 +1,45 @@ +project('object generator', 'c') + +# FIXME: Note that this will not add a dependency to the compiler executable. +# Code will not be rebuilt if it changes. +comp = find_program('obj_generator.py') + +if host_machine.system() == 'windows' + ext = '.obj' +else + ext = '.o' +endif + +cc = meson.get_compiler('c').cmd_array().get(-1) + +# Generate an object file with configure_file to mimic prebuilt objects +# provided by the source tree +source1 = configure_file(input : 'source.c', + output : 'source' + ext, + command : [comp, cc, files('source.c'), + join_paths(meson.current_build_dir(), 'source' + ext)]) + +obj = static_library('obj', objects : source1) + +# Generate an object file manually. +gen = generator(comp, + output : '@BASENAME@' + ext, + arguments : [cc, '@INPUT@', '@OUTPUT@']) + +generated = gen.process(['source2.c']) + +shr = shared_library('shr', generated, + vs_module_defs : 'source2.def') + +# Generate an object file with indexed OUTPUT replacement. +gen2 = generator(comp, + output : '@BASENAME@' + ext, + arguments : [cc, '@INPUT@', '@OUTPUT0@']) +generated2 = gen2.process(['source3.c']) + +stc = static_library('stc', generated2) + +e = executable('prog', 'prog.c', link_with : [obj, shr, stc], + install : true) + +test('objgen', e) diff --git a/test cases/common/125 object only target/obj_generator.py b/test cases/common/125 object only target/obj_generator.py new file mode 100755 index 0000000..a33872a --- /dev/null +++ b/test cases/common/125 object only target/obj_generator.py @@ -0,0 +1,18 @@ +#!/usr/bin/env python3 + +# Mimic a binary that generates an object file (e.g. windres). + +import sys, subprocess + +if __name__ == '__main__': + if len(sys.argv) != 4: + print(sys.argv[0], 'compiler input_file output_file') + sys.exit(1) + compiler = sys.argv[1] + ifile = sys.argv[2] + ofile = sys.argv[3] + if compiler.endswith('cl'): + cmd = [compiler, '/nologo', '/MDd', '/Fo' + ofile, '/c', ifile] + else: + cmd = [compiler, '-c', ifile, '-o', ofile] + sys.exit(subprocess.call(cmd)) diff --git a/test cases/common/125 object only target/prog.c b/test cases/common/125 object only target/prog.c new file mode 100644 index 0000000..60459d6 --- /dev/null +++ b/test cases/common/125 object only target/prog.c @@ -0,0 +1,7 @@ +int func1_in_obj(); +int func2_in_obj(); +int func3_in_obj(); + +int main(int argc, char **argv) { + return func1_in_obj() + func2_in_obj() + func3_in_obj(); +} diff --git a/test cases/common/125 object only target/source.c b/test cases/common/125 object only target/source.c new file mode 100644 index 0000000..7779b33 --- /dev/null +++ b/test cases/common/125 object only target/source.c @@ -0,0 +1,3 @@ +int func1_in_obj() { + return 0; +} diff --git a/test cases/common/125 object only target/source2.c b/test cases/common/125 object only target/source2.c new file mode 100644 index 0000000..29aad40 --- /dev/null +++ b/test cases/common/125 object only target/source2.c @@ -0,0 +1,3 @@ +int func2_in_obj() { + return 0; +} diff --git a/test cases/common/125 object only target/source2.def b/test cases/common/125 object only target/source2.def new file mode 100644 index 0000000..a993ab8 --- /dev/null +++ b/test cases/common/125 object only target/source2.def @@ -0,0 +1,2 @@ +EXPORTS + func2_in_obj diff --git a/test cases/common/125 object only target/source3.c b/test cases/common/125 object only target/source3.c new file mode 100644 index 0000000..1580f1e --- /dev/null +++ b/test cases/common/125 object only target/source3.c @@ -0,0 +1,3 @@ +int func3_in_obj() { + return 0; +} diff --git a/test cases/common/126 no buildincdir/include/header.h b/test cases/common/126 no buildincdir/include/header.h new file mode 100644 index 0000000..add1850 --- /dev/null +++ b/test cases/common/126 no buildincdir/include/header.h @@ -0,0 +1,3 @@ +#pragma once + +int foobar(); diff --git a/test cases/common/126 no buildincdir/meson.build b/test cases/common/126 no buildincdir/meson.build new file mode 100644 index 0000000..53f1a7f --- /dev/null +++ b/test cases/common/126 no buildincdir/meson.build @@ -0,0 +1,14 @@ +project('nobuilddir', 'c', + default_options : ['werror=true', 'buildtype=plain']) + +cc = meson.get_compiler('c') + +incwarg = '-Wmissing-include-dirs' + +if cc.has_argument(incwarg) + executable('prog', 'prog.c', + c_args : incwarg, + include_directories : include_directories('include')) +else + error('MESON_SKIP_TEST compiler does not support bad inc dir argument.') +endif diff --git a/test cases/common/126 no buildincdir/prog.c b/test cases/common/126 no buildincdir/prog.c new file mode 100644 index 0000000..800f0d6 --- /dev/null +++ b/test cases/common/126 no buildincdir/prog.c @@ -0,0 +1,5 @@ +#include"header.h" + +int main(int argc, char **argv) { + return 0; +} diff --git a/test cases/common/126 object only target/installed_files.txt b/test cases/common/126 object only target/installed_files.txt deleted file mode 100644 index 5e796b0..0000000 --- a/test cases/common/126 object only target/installed_files.txt +++ /dev/null @@ -1,2 +0,0 @@ -usr/bin/prog?exe -?msvc:usr/bin/prog.pdb diff --git a/test cases/common/126 object only target/meson.build b/test cases/common/126 object only target/meson.build deleted file mode 100644 index d83a658..0000000 --- a/test cases/common/126 object only target/meson.build +++ /dev/null @@ -1,45 +0,0 @@ -project('object generator', 'c') - -# FIXME: Note that this will not add a dependency to the compiler executable. -# Code will not be rebuilt if it changes. -comp = find_program('obj_generator.py') - -if host_machine.system() == 'windows' - ext = '.obj' -else - ext = '.o' -endif - -cc = meson.get_compiler('c').cmd_array().get(-1) - -# Generate an object file with configure_file to mimic prebuilt objects -# provided by the source tree -source1 = configure_file(input : 'source.c', - output : 'source' + ext, - command : [comp, cc, files('source.c'), - join_paths(meson.current_build_dir(), 'source' + ext)]) - -obj = static_library('obj', objects : source1) - -# Generate an object file manually. -gen = generator(comp, - output : '@BASENAME@' + ext, - arguments : [cc, '@INPUT@', '@OUTPUT@']) - -generated = gen.process(['source2.c']) - -shr = shared_library('shr', generated, - vs_module_defs : 'source2.def') - -# Generate an object file with indexed OUTPUT replacement. -gen2 = generator(comp, - output : '@BASENAME@' + ext, - arguments : [cc, '@INPUT@', '@OUTPUT0@']) -generated2 = gen2.process(['source3.c']) - -stc = static_library('stc', generated2) - -e = executable('prog', 'prog.c', link_with : [obj, shr, stc], - install : true) - -test('objgen', e) diff --git a/test cases/common/126 object only target/obj_generator.py b/test cases/common/126 object only target/obj_generator.py deleted file mode 100755 index a33872a..0000000 --- a/test cases/common/126 object only target/obj_generator.py +++ /dev/null @@ -1,18 +0,0 @@ -#!/usr/bin/env python3 - -# Mimic a binary that generates an object file (e.g. windres). - -import sys, subprocess - -if __name__ == '__main__': - if len(sys.argv) != 4: - print(sys.argv[0], 'compiler input_file output_file') - sys.exit(1) - compiler = sys.argv[1] - ifile = sys.argv[2] - ofile = sys.argv[3] - if compiler.endswith('cl'): - cmd = [compiler, '/nologo', '/MDd', '/Fo' + ofile, '/c', ifile] - else: - cmd = [compiler, '-c', ifile, '-o', ofile] - sys.exit(subprocess.call(cmd)) diff --git a/test cases/common/126 object only target/prog.c b/test cases/common/126 object only target/prog.c deleted file mode 100644 index 60459d6..0000000 --- a/test cases/common/126 object only target/prog.c +++ /dev/null @@ -1,7 +0,0 @@ -int func1_in_obj(); -int func2_in_obj(); -int func3_in_obj(); - -int main(int argc, char **argv) { - return func1_in_obj() + func2_in_obj() + func3_in_obj(); -} diff --git a/test cases/common/126 object only target/source.c b/test cases/common/126 object only target/source.c deleted file mode 100644 index 7779b33..0000000 --- a/test cases/common/126 object only target/source.c +++ /dev/null @@ -1,3 +0,0 @@ -int func1_in_obj() { - return 0; -} diff --git a/test cases/common/126 object only target/source2.c b/test cases/common/126 object only target/source2.c deleted file mode 100644 index 29aad40..0000000 --- a/test cases/common/126 object only target/source2.c +++ /dev/null @@ -1,3 +0,0 @@ -int func2_in_obj() { - return 0; -} diff --git a/test cases/common/126 object only target/source2.def b/test cases/common/126 object only target/source2.def deleted file mode 100644 index a993ab8..0000000 --- a/test cases/common/126 object only target/source2.def +++ /dev/null @@ -1,2 +0,0 @@ -EXPORTS - func2_in_obj diff --git a/test cases/common/126 object only target/source3.c b/test cases/common/126 object only target/source3.c deleted file mode 100644 index 1580f1e..0000000 --- a/test cases/common/126 object only target/source3.c +++ /dev/null @@ -1,3 +0,0 @@ -int func3_in_obj() { - return 0; -} diff --git a/test cases/common/127 custom target directory install/docgen.py b/test cases/common/127 custom target directory install/docgen.py new file mode 100644 index 0000000..245f370 --- /dev/null +++ b/test cases/common/127 custom target directory install/docgen.py @@ -0,0 +1,12 @@ +#!/usr/bin/env python3 + +import os +import sys + +out = sys.argv[1] + +os.mkdir(out) + +for name in ('a', 'b', 'c'): + with open(os.path.join(out, name + '.html'), 'w') as f: + f.write(name) diff --git a/test cases/common/127 custom target directory install/installed_files.txt b/test cases/common/127 custom target directory install/installed_files.txt new file mode 100644 index 0000000..bcf20e0 --- /dev/null +++ b/test cases/common/127 custom target directory install/installed_files.txt @@ -0,0 +1,3 @@ +usr/share/doc/testpkgname/html/a.html +usr/share/doc/testpkgname/html/b.html +usr/share/doc/testpkgname/html/c.html diff --git a/test cases/common/127 custom target directory install/meson.build b/test cases/common/127 custom target directory install/meson.build new file mode 100644 index 0000000..ada9ae1 --- /dev/null +++ b/test cases/common/127 custom target directory install/meson.build @@ -0,0 +1,9 @@ +project('custom-target-dir-install', 'c') + +docgen = find_program('docgen.py') + +custom_target('docgen', + output : 'html', + command : [docgen, '@OUTPUT@'], + install : true, + install_dir : join_paths(get_option('datadir'), 'doc/testpkgname')) diff --git a/test cases/common/127 no buildincdir/include/header.h b/test cases/common/127 no buildincdir/include/header.h deleted file mode 100644 index add1850..0000000 --- a/test cases/common/127 no buildincdir/include/header.h +++ /dev/null @@ -1,3 +0,0 @@ -#pragma once - -int foobar(); diff --git a/test cases/common/127 no buildincdir/meson.build b/test cases/common/127 no buildincdir/meson.build deleted file mode 100644 index 53f1a7f..0000000 --- a/test cases/common/127 no buildincdir/meson.build +++ /dev/null @@ -1,14 +0,0 @@ -project('nobuilddir', 'c', - default_options : ['werror=true', 'buildtype=plain']) - -cc = meson.get_compiler('c') - -incwarg = '-Wmissing-include-dirs' - -if cc.has_argument(incwarg) - executable('prog', 'prog.c', - c_args : incwarg, - include_directories : include_directories('include')) -else - error('MESON_SKIP_TEST compiler does not support bad inc dir argument.') -endif diff --git a/test cases/common/127 no buildincdir/prog.c b/test cases/common/127 no buildincdir/prog.c deleted file mode 100644 index 800f0d6..0000000 --- a/test cases/common/127 no buildincdir/prog.c +++ /dev/null @@ -1,5 +0,0 @@ -#include"header.h" - -int main(int argc, char **argv) { - return 0; -} diff --git a/test cases/common/128 custom target directory install/docgen.py b/test cases/common/128 custom target directory install/docgen.py deleted file mode 100644 index 245f370..0000000 --- a/test cases/common/128 custom target directory install/docgen.py +++ /dev/null @@ -1,12 +0,0 @@ -#!/usr/bin/env python3 - -import os -import sys - -out = sys.argv[1] - -os.mkdir(out) - -for name in ('a', 'b', 'c'): - with open(os.path.join(out, name + '.html'), 'w') as f: - f.write(name) diff --git a/test cases/common/128 custom target directory install/installed_files.txt b/test cases/common/128 custom target directory install/installed_files.txt deleted file mode 100644 index bcf20e0..0000000 --- a/test cases/common/128 custom target directory install/installed_files.txt +++ /dev/null @@ -1,3 +0,0 @@ -usr/share/doc/testpkgname/html/a.html -usr/share/doc/testpkgname/html/b.html -usr/share/doc/testpkgname/html/c.html diff --git a/test cases/common/128 custom target directory install/meson.build b/test cases/common/128 custom target directory install/meson.build deleted file mode 100644 index ada9ae1..0000000 --- a/test cases/common/128 custom target directory install/meson.build +++ /dev/null @@ -1,9 +0,0 @@ -project('custom-target-dir-install', 'c') - -docgen = find_program('docgen.py') - -custom_target('docgen', - output : 'html', - command : [docgen, '@OUTPUT@'], - install : true, - install_dir : join_paths(get_option('datadir'), 'doc/testpkgname')) diff --git a/test cases/common/128 dependency file generation/main .c b/test cases/common/128 dependency file generation/main .c new file mode 100644 index 0000000..0fb4389 --- /dev/null +++ b/test cases/common/128 dependency file generation/main .c @@ -0,0 +1,3 @@ +int main(int argc, char *argv[]) { + return 0; +} diff --git a/test cases/common/128 dependency file generation/meson.build b/test cases/common/128 dependency file generation/meson.build new file mode 100644 index 0000000..b5ee47b --- /dev/null +++ b/test cases/common/128 dependency file generation/meson.build @@ -0,0 +1,14 @@ +project('dep file gen', 'c') + +cc_id = meson.get_compiler('c').get_id() +cc_ver = meson.get_compiler('c').version() + +if cc_id == 'intel' or (cc_id == 'lcc' and cc_ver.version_compare('<=1.23.08')) + # ICC and LCC <= 1.23.08 do not escape spaces in paths in the dependency file, so Ninja + # (correctly) thinks that the rule has multiple outputs and errors out: + # 'depfile has multiple output paths' + error('MESON_SKIP_TEST: Skipping test because your compiler is known to generate broken dependency files') +endif + +e = executable('main file', 'main .c') +test('test it', e) diff --git a/test cases/common/129 configure file in generator/inc/confdata.in b/test cases/common/129 configure file in generator/inc/confdata.in new file mode 100644 index 0000000..e44cdea --- /dev/null +++ b/test cases/common/129 configure file in generator/inc/confdata.in @@ -0,0 +1 @@ +@VALUE@ diff --git a/test cases/common/129 configure file in generator/inc/meson.build b/test cases/common/129 configure file in generator/inc/meson.build new file mode 100644 index 0000000..05d2dcb --- /dev/null +++ b/test cases/common/129 configure file in generator/inc/meson.build @@ -0,0 +1,6 @@ +cdata = configuration_data() +cdata.set('VALUE', '42') + +cfile = configure_file(input : 'confdata.in', +output : 'confdata', +configuration : cdata) diff --git a/test cases/common/129 configure file in generator/meson.build b/test cases/common/129 configure file in generator/meson.build new file mode 100644 index 0000000..e1c26b6 --- /dev/null +++ b/test cases/common/129 configure file in generator/meson.build @@ -0,0 +1,4 @@ +project('conf file in generator', 'c') + +subdir('inc') +subdir('src') diff --git a/test cases/common/129 configure file in generator/src/gen.py b/test cases/common/129 configure file in generator/src/gen.py new file mode 100755 index 0000000..99b7cdd --- /dev/null +++ b/test cases/common/129 configure file in generator/src/gen.py @@ -0,0 +1,13 @@ +#!/usr/bin/env python3 + +import sys + +ifile = sys.argv[1] +ofile = sys.argv[2] + +with open(ifile, 'r') as f: + resval = f.readline().strip() + +templ = '#define RESULT (%s)\n' +with open(ofile, 'w') as f: + f.write(templ % (resval, )) diff --git a/test cases/common/129 configure file in generator/src/main.c b/test cases/common/129 configure file in generator/src/main.c new file mode 100644 index 0000000..54f4f57 --- /dev/null +++ b/test cases/common/129 configure file in generator/src/main.c @@ -0,0 +1,17 @@ +#include + +#include"confdata.h" +#if RESULT != 42 +#error Configuration RESULT is not defined correctly +#endif + +#undef RESULT + +#include"source.h" +#if RESULT != 23 +#error Source RESULT is not defined correctly +#endif + +int main(int argc, char **argv) { + return 0; +} diff --git a/test cases/common/129 configure file in generator/src/meson.build b/test cases/common/129 configure file in generator/src/meson.build new file mode 100644 index 0000000..2fb804e --- /dev/null +++ b/test cases/common/129 configure file in generator/src/meson.build @@ -0,0 +1,7 @@ +compiler = find_program('gen.py') +gen = generator(compiler, + output: '@BASENAME@.h', + arguments : ['@INPUT@', '@OUTPUT@']) +hs = gen.process(cfile, files('source')) + +executable('proggie', 'main.c', hs) diff --git a/test cases/common/129 configure file in generator/src/source b/test cases/common/129 configure file in generator/src/source new file mode 100644 index 0000000..4099407 --- /dev/null +++ b/test cases/common/129 configure file in generator/src/source @@ -0,0 +1 @@ +23 diff --git a/test cases/common/129 dependency file generation/main .c b/test cases/common/129 dependency file generation/main .c deleted file mode 100644 index 0fb4389..0000000 --- a/test cases/common/129 dependency file generation/main .c +++ /dev/null @@ -1,3 +0,0 @@ -int main(int argc, char *argv[]) { - return 0; -} diff --git a/test cases/common/129 dependency file generation/meson.build b/test cases/common/129 dependency file generation/meson.build deleted file mode 100644 index b5ee47b..0000000 --- a/test cases/common/129 dependency file generation/meson.build +++ /dev/null @@ -1,14 +0,0 @@ -project('dep file gen', 'c') - -cc_id = meson.get_compiler('c').get_id() -cc_ver = meson.get_compiler('c').version() - -if cc_id == 'intel' or (cc_id == 'lcc' and cc_ver.version_compare('<=1.23.08')) - # ICC and LCC <= 1.23.08 do not escape spaces in paths in the dependency file, so Ninja - # (correctly) thinks that the rule has multiple outputs and errors out: - # 'depfile has multiple output paths' - error('MESON_SKIP_TEST: Skipping test because your compiler is known to generate broken dependency files') -endif - -e = executable('main file', 'main .c') -test('test it', e) diff --git a/test cases/common/130 configure file in generator/inc/confdata.in b/test cases/common/130 configure file in generator/inc/confdata.in deleted file mode 100644 index e44cdea..0000000 --- a/test cases/common/130 configure file in generator/inc/confdata.in +++ /dev/null @@ -1 +0,0 @@ -@VALUE@ diff --git a/test cases/common/130 configure file in generator/inc/meson.build b/test cases/common/130 configure file in generator/inc/meson.build deleted file mode 100644 index 05d2dcb..0000000 --- a/test cases/common/130 configure file in generator/inc/meson.build +++ /dev/null @@ -1,6 +0,0 @@ -cdata = configuration_data() -cdata.set('VALUE', '42') - -cfile = configure_file(input : 'confdata.in', -output : 'confdata', -configuration : cdata) diff --git a/test cases/common/130 configure file in generator/meson.build b/test cases/common/130 configure file in generator/meson.build deleted file mode 100644 index e1c26b6..0000000 --- a/test cases/common/130 configure file in generator/meson.build +++ /dev/null @@ -1,4 +0,0 @@ -project('conf file in generator', 'c') - -subdir('inc') -subdir('src') diff --git a/test cases/common/130 configure file in generator/src/gen.py b/test cases/common/130 configure file in generator/src/gen.py deleted file mode 100755 index 99b7cdd..0000000 --- a/test cases/common/130 configure file in generator/src/gen.py +++ /dev/null @@ -1,13 +0,0 @@ -#!/usr/bin/env python3 - -import sys - -ifile = sys.argv[1] -ofile = sys.argv[2] - -with open(ifile, 'r') as f: - resval = f.readline().strip() - -templ = '#define RESULT (%s)\n' -with open(ofile, 'w') as f: - f.write(templ % (resval, )) diff --git a/test cases/common/130 configure file in generator/src/main.c b/test cases/common/130 configure file in generator/src/main.c deleted file mode 100644 index 54f4f57..0000000 --- a/test cases/common/130 configure file in generator/src/main.c +++ /dev/null @@ -1,17 +0,0 @@ -#include - -#include"confdata.h" -#if RESULT != 42 -#error Configuration RESULT is not defined correctly -#endif - -#undef RESULT - -#include"source.h" -#if RESULT != 23 -#error Source RESULT is not defined correctly -#endif - -int main(int argc, char **argv) { - return 0; -} diff --git a/test cases/common/130 configure file in generator/src/meson.build b/test cases/common/130 configure file in generator/src/meson.build deleted file mode 100644 index 2fb804e..0000000 --- a/test cases/common/130 configure file in generator/src/meson.build +++ /dev/null @@ -1,7 +0,0 @@ -compiler = find_program('gen.py') -gen = generator(compiler, - output: '@BASENAME@.h', - arguments : ['@INPUT@', '@OUTPUT@']) -hs = gen.process(cfile, files('source')) - -executable('proggie', 'main.c', hs) diff --git a/test cases/common/130 configure file in generator/src/source b/test cases/common/130 configure file in generator/src/source deleted file mode 100644 index 4099407..0000000 --- a/test cases/common/130 configure file in generator/src/source +++ /dev/null @@ -1 +0,0 @@ -23 diff --git a/test cases/common/130 generated llvm ir/copyfile.py b/test cases/common/130 generated llvm ir/copyfile.py new file mode 100644 index 0000000..ff42ac3 --- /dev/null +++ b/test cases/common/130 generated llvm ir/copyfile.py @@ -0,0 +1,6 @@ +#!/usr/bin/env python3 + +import sys +import shutil + +shutil.copyfile(sys.argv[1], sys.argv[2]) diff --git a/test cases/common/130 generated llvm ir/main.c b/test cases/common/130 generated llvm ir/main.c new file mode 100644 index 0000000..97fe723 --- /dev/null +++ b/test cases/common/130 generated llvm ir/main.c @@ -0,0 +1,14 @@ +#include + +unsigned square_unsigned (unsigned a); + +int +main (int argc, char * argv[]) +{ + unsigned int ret = square_unsigned (2); + if (ret != 4) { + printf("Got %u instead of 4\n", ret); + return 1; + } + return 0; +} diff --git a/test cases/common/130 generated llvm ir/meson.build b/test cases/common/130 generated llvm ir/meson.build new file mode 100644 index 0000000..111cdc0 --- /dev/null +++ b/test cases/common/130 generated llvm ir/meson.build @@ -0,0 +1,24 @@ +project('generated llvm ir', 'c') + +if meson.get_compiler('c').get_id() != 'clang' + error('MESON_SKIP_TEST: LLVM IR files can only be built with clang') +endif + +copy = find_program('copyfile.py') + +copygen = generator(copy, + arguments : ['@INPUT@', '@OUTPUT@'], + output : '@BASENAME@') + +l = shared_library('square-gen', copygen.process('square.ll.in')) + +test('square-gen-test', executable('square-gen-test', 'main.c', link_with : l)) + +copyct = custom_target('square', + input : 'square.ll.in', + output : 'square.ll', + command : [copy, '@INPUT@', '@OUTPUT@']) + +l = shared_library('square-ct', copyct) + +test('square-ct-test', executable('square-ct-test', 'main.c', link_with : l)) diff --git a/test cases/common/130 generated llvm ir/square.ll.in b/test cases/common/130 generated llvm ir/square.ll.in new file mode 100644 index 0000000..7c321aa --- /dev/null +++ b/test cases/common/130 generated llvm ir/square.ll.in @@ -0,0 +1,4 @@ +define i32 @square_unsigned(i32 %a) { + %1 = mul i32 %a, %a + ret i32 %1 +} diff --git a/test cases/common/131 generated assembly/copyfile.py b/test cases/common/131 generated assembly/copyfile.py new file mode 100644 index 0000000..ff42ac3 --- /dev/null +++ b/test cases/common/131 generated assembly/copyfile.py @@ -0,0 +1,6 @@ +#!/usr/bin/env python3 + +import sys +import shutil + +shutil.copyfile(sys.argv[1], sys.argv[2]) diff --git a/test cases/common/131 generated assembly/main.c b/test cases/common/131 generated assembly/main.c new file mode 100644 index 0000000..b669cba --- /dev/null +++ b/test cases/common/131 generated assembly/main.c @@ -0,0 +1,17 @@ +#include + +#if defined(_WIN32) || defined(__CYGWIN__) + __declspec(dllimport) +#endif +unsigned square_unsigned (unsigned a); + +int +main (int argc, char * argv[]) +{ + unsigned int ret = square_unsigned (2); + if (ret != 4) { + printf("Got %u instead of 4\n", ret); + return 1; + } + return 0; +} diff --git a/test cases/common/131 generated assembly/meson.build b/test cases/common/131 generated assembly/meson.build new file mode 100644 index 0000000..2837747 --- /dev/null +++ b/test cases/common/131 generated assembly/meson.build @@ -0,0 +1,39 @@ +project('generated assembly', 'c') + +cc = meson.get_compiler('c') + +if ['msvc', 'clang-cl', 'intel-cl'].contains(cc.get_id()) + error('MESON_SKIP_TEST: assembly files cannot be compiled directly by the compiler') +endif + +cpu = host_machine.cpu_family() +supported_cpus = ['arm', 'x86', 'x86_64'] + +if not supported_cpus.contains(cpu) + error('MESON_SKIP_TEST: unsupported cpu family: ' + cpu) +endif + +if cc.symbols_have_underscore_prefix() + add_project_arguments('-DMESON_TEST__UNDERSCORE_SYMBOL', language : 'c') +endif + +copy = find_program('copyfile.py') +output = 'square-@0@.S'.format(cpu) +input = output + '.in' + +copygen = generator(copy, + arguments : ['@INPUT@', '@OUTPUT@'], + output : '@BASENAME@') + +l = shared_library('square-gen', copygen.process(input)) + +test('square-gen-test', executable('square-gen-test', 'main.c', link_with : l)) + +copyct = custom_target('square', + input : input, + output : output, + command : [copy, '@INPUT@', '@OUTPUT@']) + +l = shared_library('square-ct', copyct) + +test('square-ct-test', executable('square-ct-test', 'main.c', link_with : l)) diff --git a/test cases/common/131 generated assembly/square-arm.S.in b/test cases/common/131 generated assembly/square-arm.S.in new file mode 100644 index 0000000..d2fb7ac --- /dev/null +++ b/test cases/common/131 generated assembly/square-arm.S.in @@ -0,0 +1,13 @@ +#include "symbol-underscore.h" + +.text +.globl SYMBOL_NAME(square_unsigned) +/* Only supported with GAS */ +# if defined(__linux__) || defined(__DragonFly__) || defined(__FreeBSD__) || defined(__NetBSD__) +.type square_unsigned,%function +#endif + +SYMBOL_NAME(square_unsigned): + mul r1, r0, r0 + mov r0, r1 + mov pc, lr diff --git a/test cases/common/131 generated assembly/square-x86.S.in b/test cases/common/131 generated assembly/square-x86.S.in new file mode 100644 index 0000000..ee77b81 --- /dev/null +++ b/test cases/common/131 generated assembly/square-x86.S.in @@ -0,0 +1,34 @@ +#include "symbol-underscore.h" + +#ifdef _MSC_VER + +.386 +.MODEL FLAT, C + +PUBLIC square_unsigned +_TEXT SEGMENT + +square_unsigned PROC var1:DWORD + mov eax, var1 + imul eax, eax + ret +square_unsigned ENDP + +_TEXT ENDS +END + +#else + +.text +.globl SYMBOL_NAME(square_unsigned) +/* Only supported with GAS */ +# if defined(__linux__) || defined(__DragonFly__) || defined(__FreeBSD__) || defined(__NetBSD__) +.type square_unsigned,@function +# endif + +SYMBOL_NAME(square_unsigned): + movl 4(%esp), %eax + imull %eax, %eax + retl + +#endif diff --git a/test cases/common/131 generated assembly/square-x86_64.S.in b/test cases/common/131 generated assembly/square-x86_64.S.in new file mode 100644 index 0000000..856af13 --- /dev/null +++ b/test cases/common/131 generated assembly/square-x86_64.S.in @@ -0,0 +1,38 @@ +#include "symbol-underscore.h" + +#ifdef _MSC_VER /* MSVC on Windows */ + +PUBLIC SYMBOL_NAME(square_unsigned) +_TEXT SEGMENT + +SYMBOL_NAME(square_unsigned) PROC + mov eax, ecx + imul eax, eax + ret +SYMBOL_NAME(square_unsigned) ENDP + +_TEXT ENDS +END + +#else + +.text +.globl SYMBOL_NAME(square_unsigned) +/* Only supported with GAS */ +# if defined(__linux__) || defined(__DragonFly__) || defined(__FreeBSD__) || defined(__NetBSD__) +.type square_unsigned,@function +# endif + +# if defined(_WIN32) || defined(__CYGWIN__) /* msabi */ +SYMBOL_NAME(square_unsigned): + imull %ecx, %ecx + movl %ecx, %eax + retq +# else /* sysvabi */ +SYMBOL_NAME(square_unsigned): + imull %edi, %edi + movl %edi, %eax + retq +# endif + +#endif diff --git a/test cases/common/131 generated assembly/symbol-underscore.h b/test cases/common/131 generated assembly/symbol-underscore.h new file mode 100644 index 0000000..d0f3ef9 --- /dev/null +++ b/test cases/common/131 generated assembly/symbol-underscore.h @@ -0,0 +1,5 @@ +#if defined(MESON_TEST__UNDERSCORE_SYMBOL) +# define SYMBOL_NAME(name) _##name +#else +# define SYMBOL_NAME(name) name +#endif diff --git a/test cases/common/131 generated llvm ir/copyfile.py b/test cases/common/131 generated llvm ir/copyfile.py deleted file mode 100644 index ff42ac3..0000000 --- a/test cases/common/131 generated llvm ir/copyfile.py +++ /dev/null @@ -1,6 +0,0 @@ -#!/usr/bin/env python3 - -import sys -import shutil - -shutil.copyfile(sys.argv[1], sys.argv[2]) diff --git a/test cases/common/131 generated llvm ir/main.c b/test cases/common/131 generated llvm ir/main.c deleted file mode 100644 index 97fe723..0000000 --- a/test cases/common/131 generated llvm ir/main.c +++ /dev/null @@ -1,14 +0,0 @@ -#include - -unsigned square_unsigned (unsigned a); - -int -main (int argc, char * argv[]) -{ - unsigned int ret = square_unsigned (2); - if (ret != 4) { - printf("Got %u instead of 4\n", ret); - return 1; - } - return 0; -} diff --git a/test cases/common/131 generated llvm ir/meson.build b/test cases/common/131 generated llvm ir/meson.build deleted file mode 100644 index 111cdc0..0000000 --- a/test cases/common/131 generated llvm ir/meson.build +++ /dev/null @@ -1,24 +0,0 @@ -project('generated llvm ir', 'c') - -if meson.get_compiler('c').get_id() != 'clang' - error('MESON_SKIP_TEST: LLVM IR files can only be built with clang') -endif - -copy = find_program('copyfile.py') - -copygen = generator(copy, - arguments : ['@INPUT@', '@OUTPUT@'], - output : '@BASENAME@') - -l = shared_library('square-gen', copygen.process('square.ll.in')) - -test('square-gen-test', executable('square-gen-test', 'main.c', link_with : l)) - -copyct = custom_target('square', - input : 'square.ll.in', - output : 'square.ll', - command : [copy, '@INPUT@', '@OUTPUT@']) - -l = shared_library('square-ct', copyct) - -test('square-ct-test', executable('square-ct-test', 'main.c', link_with : l)) diff --git a/test cases/common/131 generated llvm ir/square.ll.in b/test cases/common/131 generated llvm ir/square.ll.in deleted file mode 100644 index 7c321aa..0000000 --- a/test cases/common/131 generated llvm ir/square.ll.in +++ /dev/null @@ -1,4 +0,0 @@ -define i32 @square_unsigned(i32 %a) { - %1 = mul i32 %a, %a - ret i32 %1 -} diff --git a/test cases/common/132 build by default targets in tests/main.c b/test cases/common/132 build by default targets in tests/main.c new file mode 100644 index 0000000..63a62a1 --- /dev/null +++ b/test cases/common/132 build by default targets in tests/main.c @@ -0,0 +1,3 @@ +int main (int argc, char *argv[]) { + return 0; +} diff --git a/test cases/common/132 build by default targets in tests/meson.build b/test cases/common/132 build by default targets in tests/meson.build new file mode 100644 index 0000000..5cc5055 --- /dev/null +++ b/test cases/common/132 build by default targets in tests/meson.build @@ -0,0 +1,23 @@ +project('unit-test', 'c', version : '1.0') + +write_file = find_program('write_file.py') + +# A test that consumes and verifies the output generated by a custom target. +# Should work even if target is not built by default. Makes sure that foo.out +# is actually created before the test command that uses foo_out is run. +foo_out = custom_target('foo.out', + output : 'foo.out', + command : [write_file, '@OUTPUT@']) + +# Also verify that a build_by_default : false BuildTarget added to a test is +# built before the test is run. +exe_out = executable('out', 'main.c', build_by_default : false) + +py_file_exists = '''import os, sys +if not os.path.exists(sys.argv[1]) or not os.path.exists(sys.argv[2]): + print("could not find {!r} or {!r} in {!r}" + "".format(sys.argv[1], sys.argv[2], os.getcwd())) + sys.exit(1)''' + +python = import('python3').find_python() +test('output-check', python, args : ['-c', py_file_exists, foo_out, exe_out]) diff --git a/test cases/common/132 build by default targets in tests/write_file.py b/test cases/common/132 build by default targets in tests/write_file.py new file mode 100644 index 0000000..ff9c224 --- /dev/null +++ b/test cases/common/132 build by default targets in tests/write_file.py @@ -0,0 +1,6 @@ +#!/usr/bin/env python3 + +import sys + +with open(sys.argv[1], 'w') as f: + f.write('Test') diff --git a/test cases/common/132 generated assembly/copyfile.py b/test cases/common/132 generated assembly/copyfile.py deleted file mode 100644 index ff42ac3..0000000 --- a/test cases/common/132 generated assembly/copyfile.py +++ /dev/null @@ -1,6 +0,0 @@ -#!/usr/bin/env python3 - -import sys -import shutil - -shutil.copyfile(sys.argv[1], sys.argv[2]) diff --git a/test cases/common/132 generated assembly/main.c b/test cases/common/132 generated assembly/main.c deleted file mode 100644 index b669cba..0000000 --- a/test cases/common/132 generated assembly/main.c +++ /dev/null @@ -1,17 +0,0 @@ -#include - -#if defined(_WIN32) || defined(__CYGWIN__) - __declspec(dllimport) -#endif -unsigned square_unsigned (unsigned a); - -int -main (int argc, char * argv[]) -{ - unsigned int ret = square_unsigned (2); - if (ret != 4) { - printf("Got %u instead of 4\n", ret); - return 1; - } - return 0; -} diff --git a/test cases/common/132 generated assembly/meson.build b/test cases/common/132 generated assembly/meson.build deleted file mode 100644 index 2837747..0000000 --- a/test cases/common/132 generated assembly/meson.build +++ /dev/null @@ -1,39 +0,0 @@ -project('generated assembly', 'c') - -cc = meson.get_compiler('c') - -if ['msvc', 'clang-cl', 'intel-cl'].contains(cc.get_id()) - error('MESON_SKIP_TEST: assembly files cannot be compiled directly by the compiler') -endif - -cpu = host_machine.cpu_family() -supported_cpus = ['arm', 'x86', 'x86_64'] - -if not supported_cpus.contains(cpu) - error('MESON_SKIP_TEST: unsupported cpu family: ' + cpu) -endif - -if cc.symbols_have_underscore_prefix() - add_project_arguments('-DMESON_TEST__UNDERSCORE_SYMBOL', language : 'c') -endif - -copy = find_program('copyfile.py') -output = 'square-@0@.S'.format(cpu) -input = output + '.in' - -copygen = generator(copy, - arguments : ['@INPUT@', '@OUTPUT@'], - output : '@BASENAME@') - -l = shared_library('square-gen', copygen.process(input)) - -test('square-gen-test', executable('square-gen-test', 'main.c', link_with : l)) - -copyct = custom_target('square', - input : input, - output : output, - command : [copy, '@INPUT@', '@OUTPUT@']) - -l = shared_library('square-ct', copyct) - -test('square-ct-test', executable('square-ct-test', 'main.c', link_with : l)) diff --git a/test cases/common/132 generated assembly/square-arm.S.in b/test cases/common/132 generated assembly/square-arm.S.in deleted file mode 100644 index d2fb7ac..0000000 --- a/test cases/common/132 generated assembly/square-arm.S.in +++ /dev/null @@ -1,13 +0,0 @@ -#include "symbol-underscore.h" - -.text -.globl SYMBOL_NAME(square_unsigned) -/* Only supported with GAS */ -# if defined(__linux__) || defined(__DragonFly__) || defined(__FreeBSD__) || defined(__NetBSD__) -.type square_unsigned,%function -#endif - -SYMBOL_NAME(square_unsigned): - mul r1, r0, r0 - mov r0, r1 - mov pc, lr diff --git a/test cases/common/132 generated assembly/square-x86.S.in b/test cases/common/132 generated assembly/square-x86.S.in deleted file mode 100644 index ee77b81..0000000 --- a/test cases/common/132 generated assembly/square-x86.S.in +++ /dev/null @@ -1,34 +0,0 @@ -#include "symbol-underscore.h" - -#ifdef _MSC_VER - -.386 -.MODEL FLAT, C - -PUBLIC square_unsigned -_TEXT SEGMENT - -square_unsigned PROC var1:DWORD - mov eax, var1 - imul eax, eax - ret -square_unsigned ENDP - -_TEXT ENDS -END - -#else - -.text -.globl SYMBOL_NAME(square_unsigned) -/* Only supported with GAS */ -# if defined(__linux__) || defined(__DragonFly__) || defined(__FreeBSD__) || defined(__NetBSD__) -.type square_unsigned,@function -# endif - -SYMBOL_NAME(square_unsigned): - movl 4(%esp), %eax - imull %eax, %eax - retl - -#endif diff --git a/test cases/common/132 generated assembly/square-x86_64.S.in b/test cases/common/132 generated assembly/square-x86_64.S.in deleted file mode 100644 index 856af13..0000000 --- a/test cases/common/132 generated assembly/square-x86_64.S.in +++ /dev/null @@ -1,38 +0,0 @@ -#include "symbol-underscore.h" - -#ifdef _MSC_VER /* MSVC on Windows */ - -PUBLIC SYMBOL_NAME(square_unsigned) -_TEXT SEGMENT - -SYMBOL_NAME(square_unsigned) PROC - mov eax, ecx - imul eax, eax - ret -SYMBOL_NAME(square_unsigned) ENDP - -_TEXT ENDS -END - -#else - -.text -.globl SYMBOL_NAME(square_unsigned) -/* Only supported with GAS */ -# if defined(__linux__) || defined(__DragonFly__) || defined(__FreeBSD__) || defined(__NetBSD__) -.type square_unsigned,@function -# endif - -# if defined(_WIN32) || defined(__CYGWIN__) /* msabi */ -SYMBOL_NAME(square_unsigned): - imull %ecx, %ecx - movl %ecx, %eax - retq -# else /* sysvabi */ -SYMBOL_NAME(square_unsigned): - imull %edi, %edi - movl %edi, %eax - retq -# endif - -#endif diff --git a/test cases/common/132 generated assembly/symbol-underscore.h b/test cases/common/132 generated assembly/symbol-underscore.h deleted file mode 100644 index d0f3ef9..0000000 --- a/test cases/common/132 generated assembly/symbol-underscore.h +++ /dev/null @@ -1,5 +0,0 @@ -#if defined(MESON_TEST__UNDERSCORE_SYMBOL) -# define SYMBOL_NAME(name) _##name -#else -# define SYMBOL_NAME(name) name -#endif diff --git a/test cases/common/133 build by default targets in tests/main.c b/test cases/common/133 build by default targets in tests/main.c deleted file mode 100644 index 63a62a1..0000000 --- a/test cases/common/133 build by default targets in tests/main.c +++ /dev/null @@ -1,3 +0,0 @@ -int main (int argc, char *argv[]) { - return 0; -} diff --git a/test cases/common/133 build by default targets in tests/meson.build b/test cases/common/133 build by default targets in tests/meson.build deleted file mode 100644 index 5cc5055..0000000 --- a/test cases/common/133 build by default targets in tests/meson.build +++ /dev/null @@ -1,23 +0,0 @@ -project('unit-test', 'c', version : '1.0') - -write_file = find_program('write_file.py') - -# A test that consumes and verifies the output generated by a custom target. -# Should work even if target is not built by default. Makes sure that foo.out -# is actually created before the test command that uses foo_out is run. -foo_out = custom_target('foo.out', - output : 'foo.out', - command : [write_file, '@OUTPUT@']) - -# Also verify that a build_by_default : false BuildTarget added to a test is -# built before the test is run. -exe_out = executable('out', 'main.c', build_by_default : false) - -py_file_exists = '''import os, sys -if not os.path.exists(sys.argv[1]) or not os.path.exists(sys.argv[2]): - print("could not find {!r} or {!r} in {!r}" - "".format(sys.argv[1], sys.argv[2], os.getcwd())) - sys.exit(1)''' - -python = import('python3').find_python() -test('output-check', python, args : ['-c', py_file_exists, foo_out, exe_out]) diff --git a/test cases/common/133 build by default targets in tests/write_file.py b/test cases/common/133 build by default targets in tests/write_file.py deleted file mode 100644 index ff9c224..0000000 --- a/test cases/common/133 build by default targets in tests/write_file.py +++ /dev/null @@ -1,6 +0,0 @@ -#!/usr/bin/env python3 - -import sys - -with open(sys.argv[1], 'w') as f: - f.write('Test') diff --git a/test cases/common/133 build by default/checkexists.py b/test cases/common/133 build by default/checkexists.py new file mode 100644 index 0000000..6664f72 --- /dev/null +++ b/test cases/common/133 build by default/checkexists.py @@ -0,0 +1,10 @@ +#!/usr/bin/env python3 + +import os.path, sys + +invert = False +for path in sys.argv[1:]: + if path == '--not': + invert = True + elif not os.path.exists(path) ^ invert: + sys.exit(1) diff --git a/test cases/common/133 build by default/foo.c b/test cases/common/133 build by default/foo.c new file mode 100644 index 0000000..ca97916 --- /dev/null +++ b/test cases/common/133 build by default/foo.c @@ -0,0 +1,6 @@ +#include + +int main(int argc, char **argv) { + printf("Existentialism.\n"); + return 0; +} diff --git a/test cases/common/133 build by default/meson.build b/test cases/common/133 build by default/meson.build new file mode 100644 index 0000000..b28b634 --- /dev/null +++ b/test cases/common/133 build by default/meson.build @@ -0,0 +1,45 @@ +project('build on all', 'c') + +py3_mod = import('python3') +py3 = py3_mod.find_python() + +executable('fooprog', 'foo.c', + build_by_default : false, +) + +executable('barprog', 'foo.c', + build_by_default : false, + build_always : true, +) + +comp = files('mygen.py') +checkexists = files('checkexists.py') + +mytarget = custom_target('gendat1', + output : 'generated1.dat', + input : 'source.txt', + command : [py3] + comp + ['@INPUT@', '@OUTPUT@'], + build_by_default : true, +) + +mytarget = custom_target('gendat2', + output : 'generated2.dat', + input : 'source.txt', + command : [py3] + comp + ['@INPUT@', '@OUTPUT@'], + build_by_default : true, + build_always : false, +) + +ct1_output = join_paths(meson.build_root(), 'generated1.dat') +ct2_output = join_paths(meson.build_root(), 'generated2.dat') +exe1_output = join_paths(meson.build_root(), 'fooprog') +exe2_output = join_paths(meson.build_root(), 'barprog') + +if host_machine.system() == 'windows' + exe1_output += '.exe' + exe2_output += '.exe' +endif + +test('check-build-by-default', py3, + args : [checkexists, + ct1_output, ct2_output, '--not', exe1_output, exe2_output]) diff --git a/test cases/common/133 build by default/mygen.py b/test cases/common/133 build by default/mygen.py new file mode 100644 index 0000000..5a74153 --- /dev/null +++ b/test cases/common/133 build by default/mygen.py @@ -0,0 +1,8 @@ +#!/usr/bin/env python3 + +import sys + +ifile = open(sys.argv[1]) +ofile = open(sys.argv[2], 'w') + +ofile.write(ifile.read()) diff --git a/test cases/common/133 build by default/source.txt b/test cases/common/133 build by default/source.txt new file mode 100644 index 0000000..3573f4b --- /dev/null +++ b/test cases/common/133 build by default/source.txt @@ -0,0 +1 @@ +I am a bunch of text. diff --git a/test cases/common/134 build by default/checkexists.py b/test cases/common/134 build by default/checkexists.py deleted file mode 100644 index 6664f72..0000000 --- a/test cases/common/134 build by default/checkexists.py +++ /dev/null @@ -1,10 +0,0 @@ -#!/usr/bin/env python3 - -import os.path, sys - -invert = False -for path in sys.argv[1:]: - if path == '--not': - invert = True - elif not os.path.exists(path) ^ invert: - sys.exit(1) diff --git a/test cases/common/134 build by default/foo.c b/test cases/common/134 build by default/foo.c deleted file mode 100644 index ca97916..0000000 --- a/test cases/common/134 build by default/foo.c +++ /dev/null @@ -1,6 +0,0 @@ -#include - -int main(int argc, char **argv) { - printf("Existentialism.\n"); - return 0; -} diff --git a/test cases/common/134 build by default/meson.build b/test cases/common/134 build by default/meson.build deleted file mode 100644 index b28b634..0000000 --- a/test cases/common/134 build by default/meson.build +++ /dev/null @@ -1,45 +0,0 @@ -project('build on all', 'c') - -py3_mod = import('python3') -py3 = py3_mod.find_python() - -executable('fooprog', 'foo.c', - build_by_default : false, -) - -executable('barprog', 'foo.c', - build_by_default : false, - build_always : true, -) - -comp = files('mygen.py') -checkexists = files('checkexists.py') - -mytarget = custom_target('gendat1', - output : 'generated1.dat', - input : 'source.txt', - command : [py3] + comp + ['@INPUT@', '@OUTPUT@'], - build_by_default : true, -) - -mytarget = custom_target('gendat2', - output : 'generated2.dat', - input : 'source.txt', - command : [py3] + comp + ['@INPUT@', '@OUTPUT@'], - build_by_default : true, - build_always : false, -) - -ct1_output = join_paths(meson.build_root(), 'generated1.dat') -ct2_output = join_paths(meson.build_root(), 'generated2.dat') -exe1_output = join_paths(meson.build_root(), 'fooprog') -exe2_output = join_paths(meson.build_root(), 'barprog') - -if host_machine.system() == 'windows' - exe1_output += '.exe' - exe2_output += '.exe' -endif - -test('check-build-by-default', py3, - args : [checkexists, - ct1_output, ct2_output, '--not', exe1_output, exe2_output]) diff --git a/test cases/common/134 build by default/mygen.py b/test cases/common/134 build by default/mygen.py deleted file mode 100644 index 5a74153..0000000 --- a/test cases/common/134 build by default/mygen.py +++ /dev/null @@ -1,8 +0,0 @@ -#!/usr/bin/env python3 - -import sys - -ifile = open(sys.argv[1]) -ofile = open(sys.argv[2], 'w') - -ofile.write(ifile.read()) diff --git a/test cases/common/134 build by default/source.txt b/test cases/common/134 build by default/source.txt deleted file mode 100644 index 3573f4b..0000000 --- a/test cases/common/134 build by default/source.txt +++ /dev/null @@ -1 +0,0 @@ -I am a bunch of text. diff --git a/test cases/common/134 include order/ctsub/copyfile.py b/test cases/common/134 include order/ctsub/copyfile.py new file mode 100644 index 0000000..ff42ac3 --- /dev/null +++ b/test cases/common/134 include order/ctsub/copyfile.py @@ -0,0 +1,6 @@ +#!/usr/bin/env python3 + +import sys +import shutil + +shutil.copyfile(sys.argv[1], sys.argv[2]) diff --git a/test cases/common/134 include order/ctsub/emptyfile.c b/test cases/common/134 include order/ctsub/emptyfile.c new file mode 100644 index 0000000..e69de29 diff --git a/test cases/common/134 include order/ctsub/main.h b/test cases/common/134 include order/ctsub/main.h new file mode 100644 index 0000000..9d9acf3 --- /dev/null +++ b/test cases/common/134 include order/ctsub/main.h @@ -0,0 +1 @@ +#error "ctsub/main.h included" diff --git a/test cases/common/134 include order/ctsub/meson.build b/test cases/common/134 include order/ctsub/meson.build new file mode 100644 index 0000000..a242e07 --- /dev/null +++ b/test cases/common/134 include order/ctsub/meson.build @@ -0,0 +1,9 @@ +# https://github.com/mesonbuild/meson/pull/2291 +copy = find_program('copyfile.py') +configure_file(input : 'main.h', + output : 'main.h', + command : [copy, '@INPUT@', '@OUTPUT@']) +ctfile = custom_target('emptyfile', + input : 'emptyfile.c', + output : 'emptyfile.c', + command : [copy, '@INPUT@', '@OUTPUT@']) diff --git a/test cases/common/134 include order/inc1/hdr.h b/test cases/common/134 include order/inc1/hdr.h new file mode 100644 index 0000000..9d755a8 --- /dev/null +++ b/test cases/common/134 include order/inc1/hdr.h @@ -0,0 +1 @@ +#define SOME_DEFINE 42 diff --git a/test cases/common/134 include order/inc2/hdr.h b/test cases/common/134 include order/inc2/hdr.h new file mode 100644 index 0000000..2ebcaca --- /dev/null +++ b/test cases/common/134 include order/inc2/hdr.h @@ -0,0 +1 @@ +#undef SOME_DEFINE diff --git a/test cases/common/134 include order/meson.build b/test cases/common/134 include order/meson.build new file mode 100644 index 0000000..9f275b8 --- /dev/null +++ b/test cases/common/134 include order/meson.build @@ -0,0 +1,36 @@ +project('include order', 'c') + +# Test that the order of priority of include paths (from first to last) is: +# +# 1. Target's current build directory +# 2. Target's current source directory +# 3. Include paths added with the `c_args:` kwarg +# 4. Include paths added with the `include_directories`: kwarg +# Within this, the build dir takes precedence over the source dir +# 5. Include paths added via `include_directories:` of internal deps +# Within this, the build dir takes precedence over the source dir + +# Custom target dir with a built header +subdir('ctsub') +# Defines an internal dep +subdir('sub1') +# Defines a per-target include path +subdir('sub2') +# Directory for `c_args:` include path +subdir('sub3') +# The directory where the target resides +subdir('sub4') + +# Test that the order in which internal dependencies are specified is +# preserved. This is needed especially when subprojects get involved and +# multiple build-root config.h files exist, and we must be sure that the +# correct one is found: https://github.com/mesonbuild/meson/issues/1495 +f = executable('somefxe', 'sub4/main.c', + dependencies : [correctinc, dep, wronginc]) + +test('eh', e) +test('oh', f) + +# Test that the order in include_directories() is maintained +incs = include_directories('inc1', 'inc2') +executable('ordertest', 'ordertest.c', include_directories: incs) diff --git a/test cases/common/134 include order/ordertest.c b/test cases/common/134 include order/ordertest.c new file mode 100644 index 0000000..0d9173f --- /dev/null +++ b/test cases/common/134 include order/ordertest.c @@ -0,0 +1,11 @@ +#include "hdr.h" + +#if !defined(SOME_DEFINE) || SOME_DEFINE != 42 +#error "Should have picked up hdr.h from inc1/hdr.h" +#endif + +int +main (int c, char ** argv) +{ + return 0; +} diff --git a/test cases/common/134 include order/sub1/main.h b/test cases/common/134 include order/sub1/main.h new file mode 100644 index 0000000..acf4a35 --- /dev/null +++ b/test cases/common/134 include order/sub1/main.h @@ -0,0 +1 @@ +#error "sub1/main.h included" diff --git a/test cases/common/134 include order/sub1/meson.build b/test cases/common/134 include order/sub1/meson.build new file mode 100644 index 0000000..9672945 --- /dev/null +++ b/test cases/common/134 include order/sub1/meson.build @@ -0,0 +1,4 @@ +i = include_directories('.') +l = shared_library('somelib', 'some.c') +dep = declare_dependency(link_with : l, + include_directories : i) diff --git a/test cases/common/134 include order/sub1/some.c b/test cases/common/134 include order/sub1/some.c new file mode 100644 index 0000000..1ab0db4 --- /dev/null +++ b/test cases/common/134 include order/sub1/some.c @@ -0,0 +1,6 @@ +#if defined _WIN32 || defined __CYGWIN__ + __declspec(dllexport) +#endif +int somefunc(void) { + return 1984; +} diff --git a/test cases/common/134 include order/sub1/some.h b/test cases/common/134 include order/sub1/some.h new file mode 100644 index 0000000..6479492 --- /dev/null +++ b/test cases/common/134 include order/sub1/some.h @@ -0,0 +1,10 @@ +#pragma once + +#if defined _WIN32 || defined __CYGWIN__ + #define DLL_PUBLIC __declspec(dllimport) +#else + #define DLL_PUBLIC +#endif + +DLL_PUBLIC +int somefunc(void); diff --git a/test cases/common/134 include order/sub2/main.h b/test cases/common/134 include order/sub2/main.h new file mode 100644 index 0000000..b9c0da9 --- /dev/null +++ b/test cases/common/134 include order/sub2/main.h @@ -0,0 +1 @@ +#error "sub2/main.h included" diff --git a/test cases/common/134 include order/sub2/meson.build b/test cases/common/134 include order/sub2/meson.build new file mode 100644 index 0000000..b1e6190 --- /dev/null +++ b/test cases/common/134 include order/sub2/meson.build @@ -0,0 +1,2 @@ +j = include_directories('.') +wronginc = declare_dependency(include_directories : j) diff --git a/test cases/common/134 include order/sub3/main.h b/test cases/common/134 include order/sub3/main.h new file mode 100644 index 0000000..1ab7231 --- /dev/null +++ b/test cases/common/134 include order/sub3/main.h @@ -0,0 +1 @@ +#error "sub3/main.h included" diff --git a/test cases/common/134 include order/sub3/meson.build b/test cases/common/134 include order/sub3/meson.build new file mode 100644 index 0000000..0bd3906 --- /dev/null +++ b/test cases/common/134 include order/sub3/meson.build @@ -0,0 +1 @@ +sub3 = meson.current_source_dir() diff --git a/test cases/common/134 include order/sub4/main.c b/test cases/common/134 include order/sub4/main.c new file mode 100644 index 0000000..0b25eed --- /dev/null +++ b/test cases/common/134 include order/sub4/main.c @@ -0,0 +1,8 @@ +/* Use the <> include notation to force searching in include directories */ +#include + +int main(int argc, char *argv[]) { + if (somefunc() == 1984) + return 0; + return 1; +} diff --git a/test cases/common/134 include order/sub4/main.h b/test cases/common/134 include order/sub4/main.h new file mode 100644 index 0000000..194d7fe --- /dev/null +++ b/test cases/common/134 include order/sub4/main.h @@ -0,0 +1,3 @@ +#pragma once + +#include "some.h" diff --git a/test cases/common/134 include order/sub4/meson.build b/test cases/common/134 include order/sub4/meson.build new file mode 100644 index 0000000..c01edaa --- /dev/null +++ b/test cases/common/134 include order/sub4/meson.build @@ -0,0 +1,6 @@ +e = executable('someexe', 'main.c', ctfile, + c_args : ['-I' + sub3], + include_directories : j, + dependencies : dep) + +correctinc = declare_dependency(include_directories : include_directories('.')) diff --git a/test cases/common/135 include order/ctsub/copyfile.py b/test cases/common/135 include order/ctsub/copyfile.py deleted file mode 100644 index ff42ac3..0000000 --- a/test cases/common/135 include order/ctsub/copyfile.py +++ /dev/null @@ -1,6 +0,0 @@ -#!/usr/bin/env python3 - -import sys -import shutil - -shutil.copyfile(sys.argv[1], sys.argv[2]) diff --git a/test cases/common/135 include order/ctsub/emptyfile.c b/test cases/common/135 include order/ctsub/emptyfile.c deleted file mode 100644 index e69de29..0000000 diff --git a/test cases/common/135 include order/ctsub/main.h b/test cases/common/135 include order/ctsub/main.h deleted file mode 100644 index 9d9acf3..0000000 --- a/test cases/common/135 include order/ctsub/main.h +++ /dev/null @@ -1 +0,0 @@ -#error "ctsub/main.h included" diff --git a/test cases/common/135 include order/ctsub/meson.build b/test cases/common/135 include order/ctsub/meson.build deleted file mode 100644 index a242e07..0000000 --- a/test cases/common/135 include order/ctsub/meson.build +++ /dev/null @@ -1,9 +0,0 @@ -# https://github.com/mesonbuild/meson/pull/2291 -copy = find_program('copyfile.py') -configure_file(input : 'main.h', - output : 'main.h', - command : [copy, '@INPUT@', '@OUTPUT@']) -ctfile = custom_target('emptyfile', - input : 'emptyfile.c', - output : 'emptyfile.c', - command : [copy, '@INPUT@', '@OUTPUT@']) diff --git a/test cases/common/135 include order/inc1/hdr.h b/test cases/common/135 include order/inc1/hdr.h deleted file mode 100644 index 9d755a8..0000000 --- a/test cases/common/135 include order/inc1/hdr.h +++ /dev/null @@ -1 +0,0 @@ -#define SOME_DEFINE 42 diff --git a/test cases/common/135 include order/inc2/hdr.h b/test cases/common/135 include order/inc2/hdr.h deleted file mode 100644 index 2ebcaca..0000000 --- a/test cases/common/135 include order/inc2/hdr.h +++ /dev/null @@ -1 +0,0 @@ -#undef SOME_DEFINE diff --git a/test cases/common/135 include order/meson.build b/test cases/common/135 include order/meson.build deleted file mode 100644 index 9f275b8..0000000 --- a/test cases/common/135 include order/meson.build +++ /dev/null @@ -1,36 +0,0 @@ -project('include order', 'c') - -# Test that the order of priority of include paths (from first to last) is: -# -# 1. Target's current build directory -# 2. Target's current source directory -# 3. Include paths added with the `c_args:` kwarg -# 4. Include paths added with the `include_directories`: kwarg -# Within this, the build dir takes precedence over the source dir -# 5. Include paths added via `include_directories:` of internal deps -# Within this, the build dir takes precedence over the source dir - -# Custom target dir with a built header -subdir('ctsub') -# Defines an internal dep -subdir('sub1') -# Defines a per-target include path -subdir('sub2') -# Directory for `c_args:` include path -subdir('sub3') -# The directory where the target resides -subdir('sub4') - -# Test that the order in which internal dependencies are specified is -# preserved. This is needed especially when subprojects get involved and -# multiple build-root config.h files exist, and we must be sure that the -# correct one is found: https://github.com/mesonbuild/meson/issues/1495 -f = executable('somefxe', 'sub4/main.c', - dependencies : [correctinc, dep, wronginc]) - -test('eh', e) -test('oh', f) - -# Test that the order in include_directories() is maintained -incs = include_directories('inc1', 'inc2') -executable('ordertest', 'ordertest.c', include_directories: incs) diff --git a/test cases/common/135 include order/ordertest.c b/test cases/common/135 include order/ordertest.c deleted file mode 100644 index 0d9173f..0000000 --- a/test cases/common/135 include order/ordertest.c +++ /dev/null @@ -1,11 +0,0 @@ -#include "hdr.h" - -#if !defined(SOME_DEFINE) || SOME_DEFINE != 42 -#error "Should have picked up hdr.h from inc1/hdr.h" -#endif - -int -main (int c, char ** argv) -{ - return 0; -} diff --git a/test cases/common/135 include order/sub1/main.h b/test cases/common/135 include order/sub1/main.h deleted file mode 100644 index acf4a35..0000000 --- a/test cases/common/135 include order/sub1/main.h +++ /dev/null @@ -1 +0,0 @@ -#error "sub1/main.h included" diff --git a/test cases/common/135 include order/sub1/meson.build b/test cases/common/135 include order/sub1/meson.build deleted file mode 100644 index 9672945..0000000 --- a/test cases/common/135 include order/sub1/meson.build +++ /dev/null @@ -1,4 +0,0 @@ -i = include_directories('.') -l = shared_library('somelib', 'some.c') -dep = declare_dependency(link_with : l, - include_directories : i) diff --git a/test cases/common/135 include order/sub1/some.c b/test cases/common/135 include order/sub1/some.c deleted file mode 100644 index 1ab0db4..0000000 --- a/test cases/common/135 include order/sub1/some.c +++ /dev/null @@ -1,6 +0,0 @@ -#if defined _WIN32 || defined __CYGWIN__ - __declspec(dllexport) -#endif -int somefunc(void) { - return 1984; -} diff --git a/test cases/common/135 include order/sub1/some.h b/test cases/common/135 include order/sub1/some.h deleted file mode 100644 index 6479492..0000000 --- a/test cases/common/135 include order/sub1/some.h +++ /dev/null @@ -1,10 +0,0 @@ -#pragma once - -#if defined _WIN32 || defined __CYGWIN__ - #define DLL_PUBLIC __declspec(dllimport) -#else - #define DLL_PUBLIC -#endif - -DLL_PUBLIC -int somefunc(void); diff --git a/test cases/common/135 include order/sub2/main.h b/test cases/common/135 include order/sub2/main.h deleted file mode 100644 index b9c0da9..0000000 --- a/test cases/common/135 include order/sub2/main.h +++ /dev/null @@ -1 +0,0 @@ -#error "sub2/main.h included" diff --git a/test cases/common/135 include order/sub2/meson.build b/test cases/common/135 include order/sub2/meson.build deleted file mode 100644 index b1e6190..0000000 --- a/test cases/common/135 include order/sub2/meson.build +++ /dev/null @@ -1,2 +0,0 @@ -j = include_directories('.') -wronginc = declare_dependency(include_directories : j) diff --git a/test cases/common/135 include order/sub3/main.h b/test cases/common/135 include order/sub3/main.h deleted file mode 100644 index 1ab7231..0000000 --- a/test cases/common/135 include order/sub3/main.h +++ /dev/null @@ -1 +0,0 @@ -#error "sub3/main.h included" diff --git a/test cases/common/135 include order/sub3/meson.build b/test cases/common/135 include order/sub3/meson.build deleted file mode 100644 index 0bd3906..0000000 --- a/test cases/common/135 include order/sub3/meson.build +++ /dev/null @@ -1 +0,0 @@ -sub3 = meson.current_source_dir() diff --git a/test cases/common/135 include order/sub4/main.c b/test cases/common/135 include order/sub4/main.c deleted file mode 100644 index 0b25eed..0000000 --- a/test cases/common/135 include order/sub4/main.c +++ /dev/null @@ -1,8 +0,0 @@ -/* Use the <> include notation to force searching in include directories */ -#include - -int main(int argc, char *argv[]) { - if (somefunc() == 1984) - return 0; - return 1; -} diff --git a/test cases/common/135 include order/sub4/main.h b/test cases/common/135 include order/sub4/main.h deleted file mode 100644 index 194d7fe..0000000 --- a/test cases/common/135 include order/sub4/main.h +++ /dev/null @@ -1,3 +0,0 @@ -#pragma once - -#include "some.h" diff --git a/test cases/common/135 include order/sub4/meson.build b/test cases/common/135 include order/sub4/meson.build deleted file mode 100644 index c01edaa..0000000 --- a/test cases/common/135 include order/sub4/meson.build +++ /dev/null @@ -1,6 +0,0 @@ -e = executable('someexe', 'main.c', ctfile, - c_args : ['-I' + sub3], - include_directories : j, - dependencies : dep) - -correctinc = declare_dependency(include_directories : include_directories('.')) diff --git a/test cases/common/135 override options/four.c b/test cases/common/135 override options/four.c new file mode 100644 index 0000000..54f8491 --- /dev/null +++ b/test cases/common/135 override options/four.c @@ -0,0 +1,9 @@ +int func(); + +static int duplicate_func() { + return -4; +} + +int main(int argc, char **argv) { + return duplicate_func() + func(); +} diff --git a/test cases/common/135 override options/meson.build b/test cases/common/135 override options/meson.build new file mode 100644 index 0000000..4dd8d79 --- /dev/null +++ b/test cases/common/135 override options/meson.build @@ -0,0 +1,6 @@ +project('option override', 'c', + default_options : 'unity=on') + +executable('mustunity', 'one.c', 'two.c') +executable('notunity', 'three.c', 'four.c', + override_options : ['unity=off']) diff --git a/test cases/common/135 override options/one.c b/test cases/common/135 override options/one.c new file mode 100644 index 0000000..14fe9d6 --- /dev/null +++ b/test cases/common/135 override options/one.c @@ -0,0 +1,3 @@ +static int hidden_func() { + return 0; +} diff --git a/test cases/common/135 override options/three.c b/test cases/common/135 override options/three.c new file mode 100644 index 0000000..305a575 --- /dev/null +++ b/test cases/common/135 override options/three.c @@ -0,0 +1,7 @@ +static int duplicate_func() { + return 4; +} + +int func() { + return duplicate_func(); +} diff --git a/test cases/common/135 override options/two.c b/test cases/common/135 override options/two.c new file mode 100644 index 0000000..04b1d3f --- /dev/null +++ b/test cases/common/135 override options/two.c @@ -0,0 +1,6 @@ +/* + * Requires a Unity build. Otherwise hidden_func is not specified. + */ +int main(int argc, char **argv) { + return hidden_func(); +} diff --git a/test cases/common/136 get define/concat.h b/test cases/common/136 get define/concat.h new file mode 100644 index 0000000..6eb3e5e --- /dev/null +++ b/test cases/common/136 get define/concat.h @@ -0,0 +1,24 @@ +#define __STRINGIFY(x) #x +#define TEST_STRINGIFY(x) __STRINGIFY(x) + +#define TEST_VERSION_MAJOR 6 +#define TEST_VERSION_MINOR 0 +#define TEST_VERSION_BUGFIX 0 + +#define TEST_VERSION_STR \ + TEST_STRINGIFY(TEST_VERSION_MAJOR) \ + "." TEST_STRINGIFY(TEST_VERSION_MINOR) "." TEST_STRINGIFY( \ + TEST_VERSION_BUGFIX) + +#define TEST_CONCAT_1 \ + "ab" \ + "cd" \ + "ef" \ + "" +#define TEST_CONCAT_2 1 +#define TEST_CONCAT_3 1 2 3 +#define TEST_CONCAT_4 "ab" 1 "cd" +#define TEST_CONCAT_5 \ + "ab\"" \ + "cd" +#define TEST_CONCAT_6 "ab\" \"cd" diff --git a/test cases/common/136 get define/meson.build b/test cases/common/136 get define/meson.build new file mode 100644 index 0000000..c3364b9 --- /dev/null +++ b/test cases/common/136 get define/meson.build @@ -0,0 +1,101 @@ +project('get define', 'c', 'cpp') + +host_system = host_machine.system() + +foreach lang : ['c', 'cpp'] + cc = meson.get_compiler(lang) + if host_system == 'linux' + d = cc.get_define('__linux__') + assert(d == '1', '__linux__ value is @0@ instead of 1'.format(d)) + elif host_system == 'darwin' + d = cc.get_define('__APPLE__') + assert(d == '1', '__APPLE__ value is @0@ instead of 1'.format(d)) + elif host_system == 'windows' + d = cc.get_define('_WIN32') + assert(d == '1', '_WIN32 value is @0@ instead of 1'.format(d)) + elif host_system == 'cygwin' + d = cc.get_define('__CYGWIN__') + assert(d == '1', '__CYGWIN__ value is @0@ instead of 1'.format(d)) + elif host_system == 'haiku' + d = cc.get_define('__HAIKU__') + assert(d == '1', '__HAIKU__ value is @0@ instead of 1'.format(d)) + elif host_system == 'freebsd' + # the __FreeBSD__ define will be equal to the major version of the release + # (ex, in FreeBSD 11.x, __FreeBSD__ == 11). To make the test robust when + # being run on various versions of FreeBSD, just test that the define is + # set. + d = cc.get_define('__FreeBSD__') + assert(d != '', '__FreeBSD__ value is unset') + elif host_system == 'dragonfly' + d = cc.get_define('__DragonFly__') + assert(d == '1', '__DragonFly__ value is @0@ instead of 1'.format(d)) + elif host_system == 'netbsd' + d = cc.get_define('__NetBSD__') + assert(d == '1', '__NetBSD__ value is @0@ instead of 1'.format(d)) + elif host_system == 'openbsd' + d = cc.get_define('__OpenBSD__') + assert(d == '1', '__OpenBSD__ value is @0@ instead of 1'.format(d)) + elif host_system == 'gnu' + d = cc.get_define('__GNU__') + assert(d == '1', '__GNU__ value is @0@ instead of 1'.format(d)) + else + error('Please report a bug and help us improve support for this platform') + endif + + if cc.find_library('z', required : false).found() + # When a C file containing #include is pre-processed and foo.h is + # found in the compiler's default search path, GCC inserts an extra comment + # between the delimiter and the define which causes a parsing error. + # https://github.com/mesonbuild/meson/issues/1726 + if host_machine.system() == 'netbsd' or host_machine.system() == 'openbsd' + # NetBSD and OpenBSD's zlib don't have a ZLIB_VER_MAJOR, but they do have + # a ZLIB_VERSION (which is a string), so check the first non-quote + # character of that. + ver = cc.get_define('ZLIB_VERSION', prefix : '#include ')[1] + assert(ver == '1', 'ZLIB_VERSION (major) value is "@0@" instead of "1"'.format(ver)) + else + ver = cc.get_define('ZLIB_VER_MAJOR', prefix : '#include ') + assert(ver == '1', 'ZLIB_VER_MAJOR value is "@0@" instead of "1"'.format(ver)) + endif + endif + + # Check that an undefined value is empty. + have = cc.get_define('MESON_FAIL_VALUE') + assert(have == '', 'MESON_FAIL_VALUE value is "@0@" instead of ""'.format(have)) + + # This is used in the test_preprocessor_checks_CPPFLAGS() unit test. + have = cc.get_define('MESON_TEST_DEFINE_VALUE') + expect = get_option('MESON_TEST_DEFINE_VALUE') + assert(have == expect, 'MESON_TEST_DEFINE_VALUE value is "@0@" instead of "@1@"'.format(have, expect)) + + run_1665_test = false + if meson.is_cross_build() + lang_arg = meson.get_cross_property(lang + '_args', '') + if lang_arg == '-DMESON_TEST_ISSUE_1665=1' + run_1665_test = true + endif + endif + + if run_1665_test + have = cc.get_define('MESON_TEST_ISSUE_1665') + assert(have == '1', 'MESON_TEST_ISSUE_1665 value is "@0@" instead of "1"'.format(have)) + endif + + have = cc.get_define('TEST_VERSION_STR', + prefix : '#include ', include_directories: include_directories('.')) + assert(have == '"6.0.0"', 'TEST_VERSION_STR value is "@0@" instead of ""6.0.0""'.format(have)) + + concat_examples = { + 'TEST_CONCAT_1': '"abcdef"', + 'TEST_CONCAT_2': '1', + 'TEST_CONCAT_3': '1 2 3', + 'TEST_CONCAT_4': '"ab" 1 "cd"', + 'TEST_CONCAT_5': '"ab\"cd"', + 'TEST_CONCAT_6': '"ab\" \"cd"', + } + foreach def,expected : concat_examples + have = cc.get_define(def, + prefix : '#include ', include_directories: include_directories('.')) + assert(have == expected, '@0@ value is "@1@" instead of "@2@"'.format(def, have, expected)) + endforeach +endforeach diff --git a/test cases/common/136 get define/meson_options.txt b/test cases/common/136 get define/meson_options.txt new file mode 100644 index 0000000..7d34a2e --- /dev/null +++ b/test cases/common/136 get define/meson_options.txt @@ -0,0 +1 @@ +option('MESON_TEST_DEFINE_VALUE', type : 'string', value : '') diff --git a/test cases/common/136 override options/four.c b/test cases/common/136 override options/four.c deleted file mode 100644 index 54f8491..0000000 --- a/test cases/common/136 override options/four.c +++ /dev/null @@ -1,9 +0,0 @@ -int func(); - -static int duplicate_func() { - return -4; -} - -int main(int argc, char **argv) { - return duplicate_func() + func(); -} diff --git a/test cases/common/136 override options/meson.build b/test cases/common/136 override options/meson.build deleted file mode 100644 index 4dd8d79..0000000 --- a/test cases/common/136 override options/meson.build +++ /dev/null @@ -1,6 +0,0 @@ -project('option override', 'c', - default_options : 'unity=on') - -executable('mustunity', 'one.c', 'two.c') -executable('notunity', 'three.c', 'four.c', - override_options : ['unity=off']) diff --git a/test cases/common/136 override options/one.c b/test cases/common/136 override options/one.c deleted file mode 100644 index 14fe9d6..0000000 --- a/test cases/common/136 override options/one.c +++ /dev/null @@ -1,3 +0,0 @@ -static int hidden_func() { - return 0; -} diff --git a/test cases/common/136 override options/three.c b/test cases/common/136 override options/three.c deleted file mode 100644 index 305a575..0000000 --- a/test cases/common/136 override options/three.c +++ /dev/null @@ -1,7 +0,0 @@ -static int duplicate_func() { - return 4; -} - -int func() { - return duplicate_func(); -} diff --git a/test cases/common/136 override options/two.c b/test cases/common/136 override options/two.c deleted file mode 100644 index 04b1d3f..0000000 --- a/test cases/common/136 override options/two.c +++ /dev/null @@ -1,6 +0,0 @@ -/* - * Requires a Unity build. Otherwise hidden_func is not specified. - */ -int main(int argc, char **argv) { - return hidden_func(); -} diff --git a/test cases/common/137 c cpp and asm/main.c b/test cases/common/137 c cpp and asm/main.c new file mode 100644 index 0000000..8976723 --- /dev/null +++ b/test cases/common/137 c cpp and asm/main.c @@ -0,0 +1,8 @@ +#include + +int get_retval(void); + +int main(int argc, char **argv) { + printf("C seems to be working.\n"); + return get_retval(); +} diff --git a/test cases/common/137 c cpp and asm/main.cpp b/test cases/common/137 c cpp and asm/main.cpp new file mode 100644 index 0000000..c089870 --- /dev/null +++ b/test cases/common/137 c cpp and asm/main.cpp @@ -0,0 +1,11 @@ +#include + +extern "C" { + int get_retval(void); + int get_cval(void); +} + +int main(int argc, char **argv) { + std::cout << "C++ seems to be working." << std::endl; + return get_retval(); +} diff --git a/test cases/common/137 c cpp and asm/meson.build b/test cases/common/137 c cpp and asm/meson.build new file mode 100644 index 0000000..ca820e2 --- /dev/null +++ b/test cases/common/137 c cpp and asm/meson.build @@ -0,0 +1,23 @@ +project('c cpp and asm', 'c', 'cpp') + +cpu = host_machine.cpu_family() +cc = meson.get_compiler('c') + +supported_cpus = ['arm', 'x86', 'x86_64'] + +if not supported_cpus.contains(cpu) + error('MESON_SKIP_TEST unsupported cpu:' + cpu) +endif + +if meson.get_compiler('c').get_argument_syntax() == 'msvc' + error('MESON_SKIP_TEST MSVC can\'t compile assembly') +endif + +if cc.symbols_have_underscore_prefix() + add_project_arguments('-DMESON_TEST__UNDERSCORE_SYMBOL', language: 'c') +endif + +test('test-c-asm', executable('c-asm', ['main.c', 'retval-' + cpu + '.S'])) +test('test-cpp-asm', executable('cpp-asm', ['main.cpp', 'retval-' + cpu + '.S'])) +test('test-c-cpp-asm', executable('c-cpp-asm', ['somelib.c', 'main.cpp', 'retval-' + cpu + '.S'])) +test('test-cpp-c-asm', executable('cpp-c-asm', ['main.cpp', 'somelib.c', 'retval-' + cpu + '.S'])) diff --git a/test cases/common/137 c cpp and asm/retval-arm.S b/test cases/common/137 c cpp and asm/retval-arm.S new file mode 100644 index 0000000..a892362 --- /dev/null +++ b/test cases/common/137 c cpp and asm/retval-arm.S @@ -0,0 +1,11 @@ +#include "symbol-underscore.h" + +.text +.globl SYMBOL_NAME(get_retval) +# ifdef __linux__ +.type get_retval, %function +#endif + +SYMBOL_NAME(get_retval): + mov r0, #0 + mov pc, lr diff --git a/test cases/common/137 c cpp and asm/retval-x86.S b/test cases/common/137 c cpp and asm/retval-x86.S new file mode 100644 index 0000000..3cb0237 --- /dev/null +++ b/test cases/common/137 c cpp and asm/retval-x86.S @@ -0,0 +1,12 @@ +#include "symbol-underscore.h" + +.text +.globl SYMBOL_NAME(get_retval) +/* Only supported on Linux with GAS */ +# ifdef __linux__ +.type get_retval, %function +#endif + +SYMBOL_NAME(get_retval): + xorl %eax, %eax + retl diff --git a/test cases/common/137 c cpp and asm/retval-x86_64.S b/test cases/common/137 c cpp and asm/retval-x86_64.S new file mode 100644 index 0000000..1a5f3eb --- /dev/null +++ b/test cases/common/137 c cpp and asm/retval-x86_64.S @@ -0,0 +1,11 @@ +#include "symbol-underscore.h" + +.text +.globl SYMBOL_NAME(get_retval) +# ifdef __linux__ +.type get_retval, %function +#endif + +SYMBOL_NAME(get_retval): + xorl %eax, %eax + retq diff --git a/test cases/common/137 c cpp and asm/somelib.c b/test cases/common/137 c cpp and asm/somelib.c new file mode 100644 index 0000000..e585b8e --- /dev/null +++ b/test cases/common/137 c cpp and asm/somelib.c @@ -0,0 +1,3 @@ +int get_cval (void) { + return 0; +} diff --git a/test cases/common/137 c cpp and asm/symbol-underscore.h b/test cases/common/137 c cpp and asm/symbol-underscore.h new file mode 100644 index 0000000..d0f3ef9 --- /dev/null +++ b/test cases/common/137 c cpp and asm/symbol-underscore.h @@ -0,0 +1,5 @@ +#if defined(MESON_TEST__UNDERSCORE_SYMBOL) +# define SYMBOL_NAME(name) _##name +#else +# define SYMBOL_NAME(name) name +#endif diff --git a/test cases/common/137 get define/concat.h b/test cases/common/137 get define/concat.h deleted file mode 100644 index 6eb3e5e..0000000 --- a/test cases/common/137 get define/concat.h +++ /dev/null @@ -1,24 +0,0 @@ -#define __STRINGIFY(x) #x -#define TEST_STRINGIFY(x) __STRINGIFY(x) - -#define TEST_VERSION_MAJOR 6 -#define TEST_VERSION_MINOR 0 -#define TEST_VERSION_BUGFIX 0 - -#define TEST_VERSION_STR \ - TEST_STRINGIFY(TEST_VERSION_MAJOR) \ - "." TEST_STRINGIFY(TEST_VERSION_MINOR) "." TEST_STRINGIFY( \ - TEST_VERSION_BUGFIX) - -#define TEST_CONCAT_1 \ - "ab" \ - "cd" \ - "ef" \ - "" -#define TEST_CONCAT_2 1 -#define TEST_CONCAT_3 1 2 3 -#define TEST_CONCAT_4 "ab" 1 "cd" -#define TEST_CONCAT_5 \ - "ab\"" \ - "cd" -#define TEST_CONCAT_6 "ab\" \"cd" diff --git a/test cases/common/137 get define/meson.build b/test cases/common/137 get define/meson.build deleted file mode 100644 index c3364b9..0000000 --- a/test cases/common/137 get define/meson.build +++ /dev/null @@ -1,101 +0,0 @@ -project('get define', 'c', 'cpp') - -host_system = host_machine.system() - -foreach lang : ['c', 'cpp'] - cc = meson.get_compiler(lang) - if host_system == 'linux' - d = cc.get_define('__linux__') - assert(d == '1', '__linux__ value is @0@ instead of 1'.format(d)) - elif host_system == 'darwin' - d = cc.get_define('__APPLE__') - assert(d == '1', '__APPLE__ value is @0@ instead of 1'.format(d)) - elif host_system == 'windows' - d = cc.get_define('_WIN32') - assert(d == '1', '_WIN32 value is @0@ instead of 1'.format(d)) - elif host_system == 'cygwin' - d = cc.get_define('__CYGWIN__') - assert(d == '1', '__CYGWIN__ value is @0@ instead of 1'.format(d)) - elif host_system == 'haiku' - d = cc.get_define('__HAIKU__') - assert(d == '1', '__HAIKU__ value is @0@ instead of 1'.format(d)) - elif host_system == 'freebsd' - # the __FreeBSD__ define will be equal to the major version of the release - # (ex, in FreeBSD 11.x, __FreeBSD__ == 11). To make the test robust when - # being run on various versions of FreeBSD, just test that the define is - # set. - d = cc.get_define('__FreeBSD__') - assert(d != '', '__FreeBSD__ value is unset') - elif host_system == 'dragonfly' - d = cc.get_define('__DragonFly__') - assert(d == '1', '__DragonFly__ value is @0@ instead of 1'.format(d)) - elif host_system == 'netbsd' - d = cc.get_define('__NetBSD__') - assert(d == '1', '__NetBSD__ value is @0@ instead of 1'.format(d)) - elif host_system == 'openbsd' - d = cc.get_define('__OpenBSD__') - assert(d == '1', '__OpenBSD__ value is @0@ instead of 1'.format(d)) - elif host_system == 'gnu' - d = cc.get_define('__GNU__') - assert(d == '1', '__GNU__ value is @0@ instead of 1'.format(d)) - else - error('Please report a bug and help us improve support for this platform') - endif - - if cc.find_library('z', required : false).found() - # When a C file containing #include is pre-processed and foo.h is - # found in the compiler's default search path, GCC inserts an extra comment - # between the delimiter and the define which causes a parsing error. - # https://github.com/mesonbuild/meson/issues/1726 - if host_machine.system() == 'netbsd' or host_machine.system() == 'openbsd' - # NetBSD and OpenBSD's zlib don't have a ZLIB_VER_MAJOR, but they do have - # a ZLIB_VERSION (which is a string), so check the first non-quote - # character of that. - ver = cc.get_define('ZLIB_VERSION', prefix : '#include ')[1] - assert(ver == '1', 'ZLIB_VERSION (major) value is "@0@" instead of "1"'.format(ver)) - else - ver = cc.get_define('ZLIB_VER_MAJOR', prefix : '#include ') - assert(ver == '1', 'ZLIB_VER_MAJOR value is "@0@" instead of "1"'.format(ver)) - endif - endif - - # Check that an undefined value is empty. - have = cc.get_define('MESON_FAIL_VALUE') - assert(have == '', 'MESON_FAIL_VALUE value is "@0@" instead of ""'.format(have)) - - # This is used in the test_preprocessor_checks_CPPFLAGS() unit test. - have = cc.get_define('MESON_TEST_DEFINE_VALUE') - expect = get_option('MESON_TEST_DEFINE_VALUE') - assert(have == expect, 'MESON_TEST_DEFINE_VALUE value is "@0@" instead of "@1@"'.format(have, expect)) - - run_1665_test = false - if meson.is_cross_build() - lang_arg = meson.get_cross_property(lang + '_args', '') - if lang_arg == '-DMESON_TEST_ISSUE_1665=1' - run_1665_test = true - endif - endif - - if run_1665_test - have = cc.get_define('MESON_TEST_ISSUE_1665') - assert(have == '1', 'MESON_TEST_ISSUE_1665 value is "@0@" instead of "1"'.format(have)) - endif - - have = cc.get_define('TEST_VERSION_STR', - prefix : '#include ', include_directories: include_directories('.')) - assert(have == '"6.0.0"', 'TEST_VERSION_STR value is "@0@" instead of ""6.0.0""'.format(have)) - - concat_examples = { - 'TEST_CONCAT_1': '"abcdef"', - 'TEST_CONCAT_2': '1', - 'TEST_CONCAT_3': '1 2 3', - 'TEST_CONCAT_4': '"ab" 1 "cd"', - 'TEST_CONCAT_5': '"ab\"cd"', - 'TEST_CONCAT_6': '"ab\" \"cd"', - } - foreach def,expected : concat_examples - have = cc.get_define(def, - prefix : '#include ', include_directories: include_directories('.')) - assert(have == expected, '@0@ value is "@1@" instead of "@2@"'.format(def, have, expected)) - endforeach -endforeach diff --git a/test cases/common/137 get define/meson_options.txt b/test cases/common/137 get define/meson_options.txt deleted file mode 100644 index 7d34a2e..0000000 --- a/test cases/common/137 get define/meson_options.txt +++ /dev/null @@ -1 +0,0 @@ -option('MESON_TEST_DEFINE_VALUE', type : 'string', value : '') diff --git a/test cases/common/138 c cpp and asm/main.c b/test cases/common/138 c cpp and asm/main.c deleted file mode 100644 index 8976723..0000000 --- a/test cases/common/138 c cpp and asm/main.c +++ /dev/null @@ -1,8 +0,0 @@ -#include - -int get_retval(void); - -int main(int argc, char **argv) { - printf("C seems to be working.\n"); - return get_retval(); -} diff --git a/test cases/common/138 c cpp and asm/main.cpp b/test cases/common/138 c cpp and asm/main.cpp deleted file mode 100644 index c089870..0000000 --- a/test cases/common/138 c cpp and asm/main.cpp +++ /dev/null @@ -1,11 +0,0 @@ -#include - -extern "C" { - int get_retval(void); - int get_cval(void); -} - -int main(int argc, char **argv) { - std::cout << "C++ seems to be working." << std::endl; - return get_retval(); -} diff --git a/test cases/common/138 c cpp and asm/meson.build b/test cases/common/138 c cpp and asm/meson.build deleted file mode 100644 index ca820e2..0000000 --- a/test cases/common/138 c cpp and asm/meson.build +++ /dev/null @@ -1,23 +0,0 @@ -project('c cpp and asm', 'c', 'cpp') - -cpu = host_machine.cpu_family() -cc = meson.get_compiler('c') - -supported_cpus = ['arm', 'x86', 'x86_64'] - -if not supported_cpus.contains(cpu) - error('MESON_SKIP_TEST unsupported cpu:' + cpu) -endif - -if meson.get_compiler('c').get_argument_syntax() == 'msvc' - error('MESON_SKIP_TEST MSVC can\'t compile assembly') -endif - -if cc.symbols_have_underscore_prefix() - add_project_arguments('-DMESON_TEST__UNDERSCORE_SYMBOL', language: 'c') -endif - -test('test-c-asm', executable('c-asm', ['main.c', 'retval-' + cpu + '.S'])) -test('test-cpp-asm', executable('cpp-asm', ['main.cpp', 'retval-' + cpu + '.S'])) -test('test-c-cpp-asm', executable('c-cpp-asm', ['somelib.c', 'main.cpp', 'retval-' + cpu + '.S'])) -test('test-cpp-c-asm', executable('cpp-c-asm', ['main.cpp', 'somelib.c', 'retval-' + cpu + '.S'])) diff --git a/test cases/common/138 c cpp and asm/retval-arm.S b/test cases/common/138 c cpp and asm/retval-arm.S deleted file mode 100644 index a892362..0000000 --- a/test cases/common/138 c cpp and asm/retval-arm.S +++ /dev/null @@ -1,11 +0,0 @@ -#include "symbol-underscore.h" - -.text -.globl SYMBOL_NAME(get_retval) -# ifdef __linux__ -.type get_retval, %function -#endif - -SYMBOL_NAME(get_retval): - mov r0, #0 - mov pc, lr diff --git a/test cases/common/138 c cpp and asm/retval-x86.S b/test cases/common/138 c cpp and asm/retval-x86.S deleted file mode 100644 index 3cb0237..0000000 --- a/test cases/common/138 c cpp and asm/retval-x86.S +++ /dev/null @@ -1,12 +0,0 @@ -#include "symbol-underscore.h" - -.text -.globl SYMBOL_NAME(get_retval) -/* Only supported on Linux with GAS */ -# ifdef __linux__ -.type get_retval, %function -#endif - -SYMBOL_NAME(get_retval): - xorl %eax, %eax - retl diff --git a/test cases/common/138 c cpp and asm/retval-x86_64.S b/test cases/common/138 c cpp and asm/retval-x86_64.S deleted file mode 100644 index 1a5f3eb..0000000 --- a/test cases/common/138 c cpp and asm/retval-x86_64.S +++ /dev/null @@ -1,11 +0,0 @@ -#include "symbol-underscore.h" - -.text -.globl SYMBOL_NAME(get_retval) -# ifdef __linux__ -.type get_retval, %function -#endif - -SYMBOL_NAME(get_retval): - xorl %eax, %eax - retq diff --git a/test cases/common/138 c cpp and asm/somelib.c b/test cases/common/138 c cpp and asm/somelib.c deleted file mode 100644 index e585b8e..0000000 --- a/test cases/common/138 c cpp and asm/somelib.c +++ /dev/null @@ -1,3 +0,0 @@ -int get_cval (void) { - return 0; -} diff --git a/test cases/common/138 c cpp and asm/symbol-underscore.h b/test cases/common/138 c cpp and asm/symbol-underscore.h deleted file mode 100644 index d0f3ef9..0000000 --- a/test cases/common/138 c cpp and asm/symbol-underscore.h +++ /dev/null @@ -1,5 +0,0 @@ -#if defined(MESON_TEST__UNDERSCORE_SYMBOL) -# define SYMBOL_NAME(name) _##name -#else -# define SYMBOL_NAME(name) name -#endif diff --git a/test cases/common/138 compute int/config.h.in b/test cases/common/138 compute int/config.h.in new file mode 100644 index 0000000..0de63ab --- /dev/null +++ b/test cases/common/138 compute int/config.h.in @@ -0,0 +1,4 @@ +#define INTSIZE @INTSIZE@ +#define FOOBAR_IN_CONFIG_H @FOOBAR@ +#define MAXINT @MAXINT@ +#define MININT @MININT@ diff --git a/test cases/common/138 compute int/foobar.h b/test cases/common/138 compute int/foobar.h new file mode 100644 index 0000000..fd3cb5e --- /dev/null +++ b/test cases/common/138 compute int/foobar.h @@ -0,0 +1,6 @@ +#ifndef __FOOBAR_H__ +#define __FOOBAR_H__ + +#define FOOBAR_IN_FOOBAR_H 10 + +#endif /*__FOOBAR_H__*/ diff --git a/test cases/common/138 compute int/meson.build b/test cases/common/138 compute int/meson.build new file mode 100644 index 0000000..22bd266 --- /dev/null +++ b/test cases/common/138 compute int/meson.build @@ -0,0 +1,43 @@ +project('compute int', 'c', 'cpp') + +inc = include_directories('.') + +# Test with C +cc = meson.get_compiler('c') + +intsize = cc.compute_int('sizeof(int)', low : 1, high : 16, guess : 4) +foobar = cc.compute_int('FOOBAR_IN_FOOBAR_H', prefix : '#include "foobar.h"', include_directories : inc) +maxint = cc.compute_int('INT_MAX', prefix: '#include ') +minint = cc.compute_int('INT_MIN', prefix: '#include ') + +cd = configuration_data() +cd.set('INTSIZE', intsize) +cd.set('FOOBAR', foobar) +cd.set('CONFIG', 'config.h') +cd.set('MAXINT', maxint) +cd.set('MININT', minint) +configure_file(input : 'config.h.in', output : 'config.h', configuration : cd) +s = configure_file(input : 'prog.c.in', output : 'prog.c', configuration : cd) + +e = executable('prog', s) +test('compute int test', e) + +# Test with C++ +cpp = meson.get_compiler('cpp') + +intsize = cpp.compute_int('sizeof(int)') +foobar = cpp.compute_int('FOOBAR_IN_FOOBAR_H', prefix : '#include "foobar.h"', include_directories : inc) +maxint = cpp.compute_int('INT_MAX', prefix: '#include ') +minint = cpp.compute_int('INT_MIN', prefix: '#include ') + +cdpp = configuration_data() +cdpp.set('INTSIZE', intsize) +cdpp.set('FOOBAR', foobar) +cdpp.set('CONFIG', 'config.hpp') +cdpp.set('MAXINT', maxint) +cdpp.set('MININT', minint) +configure_file(input : 'config.h.in', output : 'config.hpp', configuration : cdpp) +spp = configure_file(input : 'prog.c.in', output : 'prog.cc', configuration : cdpp) + +epp = executable('progpp', spp) +test('compute int test c++', epp) diff --git a/test cases/common/138 compute int/prog.c.in b/test cases/common/138 compute int/prog.c.in new file mode 100644 index 0000000..ff1ad55 --- /dev/null +++ b/test cases/common/138 compute int/prog.c.in @@ -0,0 +1,25 @@ +#include "@CONFIG@" +#include +#include +#include +#include "foobar.h" + +int main(int argc, char **argv) { + if(INTSIZE != sizeof(int)) { + fprintf(stderr, "Mismatch: computed int size %d, actual size %d.\n", INTSIZE, (int)sizeof(int)); + return 1; + } + if(FOOBAR_IN_CONFIG_H != FOOBAR_IN_FOOBAR_H) { + fprintf(stderr, "Mismatch: computed int %d, should be %d.\n", FOOBAR_IN_CONFIG_H, FOOBAR_IN_FOOBAR_H); + return 1; + } + if(MAXINT != INT_MAX) { + fprintf(stderr, "Mismatch: computed max int %d, should be %d.\n", MAXINT, INT_MAX); + return 1; + } + if(MININT != INT_MIN) { + fprintf(stderr, "Mismatch: computed min int %d, should be %d.\n", MININT, INT_MIN); + return 1; + } + return 0; +} diff --git a/test cases/common/139 compute int/config.h.in b/test cases/common/139 compute int/config.h.in deleted file mode 100644 index 0de63ab..0000000 --- a/test cases/common/139 compute int/config.h.in +++ /dev/null @@ -1,4 +0,0 @@ -#define INTSIZE @INTSIZE@ -#define FOOBAR_IN_CONFIG_H @FOOBAR@ -#define MAXINT @MAXINT@ -#define MININT @MININT@ diff --git a/test cases/common/139 compute int/foobar.h b/test cases/common/139 compute int/foobar.h deleted file mode 100644 index fd3cb5e..0000000 --- a/test cases/common/139 compute int/foobar.h +++ /dev/null @@ -1,6 +0,0 @@ -#ifndef __FOOBAR_H__ -#define __FOOBAR_H__ - -#define FOOBAR_IN_FOOBAR_H 10 - -#endif /*__FOOBAR_H__*/ diff --git a/test cases/common/139 compute int/meson.build b/test cases/common/139 compute int/meson.build deleted file mode 100644 index 22bd266..0000000 --- a/test cases/common/139 compute int/meson.build +++ /dev/null @@ -1,43 +0,0 @@ -project('compute int', 'c', 'cpp') - -inc = include_directories('.') - -# Test with C -cc = meson.get_compiler('c') - -intsize = cc.compute_int('sizeof(int)', low : 1, high : 16, guess : 4) -foobar = cc.compute_int('FOOBAR_IN_FOOBAR_H', prefix : '#include "foobar.h"', include_directories : inc) -maxint = cc.compute_int('INT_MAX', prefix: '#include ') -minint = cc.compute_int('INT_MIN', prefix: '#include ') - -cd = configuration_data() -cd.set('INTSIZE', intsize) -cd.set('FOOBAR', foobar) -cd.set('CONFIG', 'config.h') -cd.set('MAXINT', maxint) -cd.set('MININT', minint) -configure_file(input : 'config.h.in', output : 'config.h', configuration : cd) -s = configure_file(input : 'prog.c.in', output : 'prog.c', configuration : cd) - -e = executable('prog', s) -test('compute int test', e) - -# Test with C++ -cpp = meson.get_compiler('cpp') - -intsize = cpp.compute_int('sizeof(int)') -foobar = cpp.compute_int('FOOBAR_IN_FOOBAR_H', prefix : '#include "foobar.h"', include_directories : inc) -maxint = cpp.compute_int('INT_MAX', prefix: '#include ') -minint = cpp.compute_int('INT_MIN', prefix: '#include ') - -cdpp = configuration_data() -cdpp.set('INTSIZE', intsize) -cdpp.set('FOOBAR', foobar) -cdpp.set('CONFIG', 'config.hpp') -cdpp.set('MAXINT', maxint) -cdpp.set('MININT', minint) -configure_file(input : 'config.h.in', output : 'config.hpp', configuration : cdpp) -spp = configure_file(input : 'prog.c.in', output : 'prog.cc', configuration : cdpp) - -epp = executable('progpp', spp) -test('compute int test c++', epp) diff --git a/test cases/common/139 compute int/prog.c.in b/test cases/common/139 compute int/prog.c.in deleted file mode 100644 index ff1ad55..0000000 --- a/test cases/common/139 compute int/prog.c.in +++ /dev/null @@ -1,25 +0,0 @@ -#include "@CONFIG@" -#include -#include -#include -#include "foobar.h" - -int main(int argc, char **argv) { - if(INTSIZE != sizeof(int)) { - fprintf(stderr, "Mismatch: computed int size %d, actual size %d.\n", INTSIZE, (int)sizeof(int)); - return 1; - } - if(FOOBAR_IN_CONFIG_H != FOOBAR_IN_FOOBAR_H) { - fprintf(stderr, "Mismatch: computed int %d, should be %d.\n", FOOBAR_IN_CONFIG_H, FOOBAR_IN_FOOBAR_H); - return 1; - } - if(MAXINT != INT_MAX) { - fprintf(stderr, "Mismatch: computed max int %d, should be %d.\n", MAXINT, INT_MAX); - return 1; - } - if(MININT != INT_MIN) { - fprintf(stderr, "Mismatch: computed min int %d, should be %d.\n", MININT, INT_MIN); - return 1; - } - return 0; -} diff --git a/test cases/common/139 custom target object output/meson.build b/test cases/common/139 custom target object output/meson.build new file mode 100644 index 0000000..ede165b --- /dev/null +++ b/test cases/common/139 custom target object output/meson.build @@ -0,0 +1,16 @@ +project('custom target object output', 'c') + +comp = find_program('obj_generator.py') + +if host_machine.system() == 'windows' + outputname = '@BASENAME@.obj' +else + outputname = '@BASENAME@.o' +endif + +cc = meson.get_compiler('c').cmd_array().get(-1) + +subdir('objdir') +subdir('progdir') + +test('objgen', e) diff --git a/test cases/common/139 custom target object output/obj_generator.py b/test cases/common/139 custom target object output/obj_generator.py new file mode 100644 index 0000000..a33872a --- /dev/null +++ b/test cases/common/139 custom target object output/obj_generator.py @@ -0,0 +1,18 @@ +#!/usr/bin/env python3 + +# Mimic a binary that generates an object file (e.g. windres). + +import sys, subprocess + +if __name__ == '__main__': + if len(sys.argv) != 4: + print(sys.argv[0], 'compiler input_file output_file') + sys.exit(1) + compiler = sys.argv[1] + ifile = sys.argv[2] + ofile = sys.argv[3] + if compiler.endswith('cl'): + cmd = [compiler, '/nologo', '/MDd', '/Fo' + ofile, '/c', ifile] + else: + cmd = [compiler, '-c', ifile, '-o', ofile] + sys.exit(subprocess.call(cmd)) diff --git a/test cases/common/139 custom target object output/objdir/meson.build b/test cases/common/139 custom target object output/objdir/meson.build new file mode 100644 index 0000000..0d7f6c2 --- /dev/null +++ b/test cases/common/139 custom target object output/objdir/meson.build @@ -0,0 +1,5 @@ +# Generate an object file manually. +object = custom_target('object', + input : 'source.c', + output : outputname, + command : [comp, cc, '@INPUT@', '@OUTPUT@']) diff --git a/test cases/common/139 custom target object output/objdir/source.c b/test cases/common/139 custom target object output/objdir/source.c new file mode 100644 index 0000000..7779b33 --- /dev/null +++ b/test cases/common/139 custom target object output/objdir/source.c @@ -0,0 +1,3 @@ +int func1_in_obj() { + return 0; +} diff --git a/test cases/common/139 custom target object output/progdir/meson.build b/test cases/common/139 custom target object output/progdir/meson.build new file mode 100644 index 0000000..4216c24 --- /dev/null +++ b/test cases/common/139 custom target object output/progdir/meson.build @@ -0,0 +1 @@ +e = executable('prog', 'prog.c', object) diff --git a/test cases/common/139 custom target object output/progdir/prog.c b/test cases/common/139 custom target object output/progdir/prog.c new file mode 100644 index 0000000..c1ece33 --- /dev/null +++ b/test cases/common/139 custom target object output/progdir/prog.c @@ -0,0 +1,5 @@ +int func1_in_obj(); + +int main(int argc, char **argv) { + return func1_in_obj(); +} diff --git a/test cases/common/140 custom target object output/meson.build b/test cases/common/140 custom target object output/meson.build deleted file mode 100644 index ede165b..0000000 --- a/test cases/common/140 custom target object output/meson.build +++ /dev/null @@ -1,16 +0,0 @@ -project('custom target object output', 'c') - -comp = find_program('obj_generator.py') - -if host_machine.system() == 'windows' - outputname = '@BASENAME@.obj' -else - outputname = '@BASENAME@.o' -endif - -cc = meson.get_compiler('c').cmd_array().get(-1) - -subdir('objdir') -subdir('progdir') - -test('objgen', e) diff --git a/test cases/common/140 custom target object output/obj_generator.py b/test cases/common/140 custom target object output/obj_generator.py deleted file mode 100644 index a33872a..0000000 --- a/test cases/common/140 custom target object output/obj_generator.py +++ /dev/null @@ -1,18 +0,0 @@ -#!/usr/bin/env python3 - -# Mimic a binary that generates an object file (e.g. windres). - -import sys, subprocess - -if __name__ == '__main__': - if len(sys.argv) != 4: - print(sys.argv[0], 'compiler input_file output_file') - sys.exit(1) - compiler = sys.argv[1] - ifile = sys.argv[2] - ofile = sys.argv[3] - if compiler.endswith('cl'): - cmd = [compiler, '/nologo', '/MDd', '/Fo' + ofile, '/c', ifile] - else: - cmd = [compiler, '-c', ifile, '-o', ofile] - sys.exit(subprocess.call(cmd)) diff --git a/test cases/common/140 custom target object output/objdir/meson.build b/test cases/common/140 custom target object output/objdir/meson.build deleted file mode 100644 index 0d7f6c2..0000000 --- a/test cases/common/140 custom target object output/objdir/meson.build +++ /dev/null @@ -1,5 +0,0 @@ -# Generate an object file manually. -object = custom_target('object', - input : 'source.c', - output : outputname, - command : [comp, cc, '@INPUT@', '@OUTPUT@']) diff --git a/test cases/common/140 custom target object output/objdir/source.c b/test cases/common/140 custom target object output/objdir/source.c deleted file mode 100644 index 7779b33..0000000 --- a/test cases/common/140 custom target object output/objdir/source.c +++ /dev/null @@ -1,3 +0,0 @@ -int func1_in_obj() { - return 0; -} diff --git a/test cases/common/140 custom target object output/progdir/meson.build b/test cases/common/140 custom target object output/progdir/meson.build deleted file mode 100644 index 4216c24..0000000 --- a/test cases/common/140 custom target object output/progdir/meson.build +++ /dev/null @@ -1 +0,0 @@ -e = executable('prog', 'prog.c', object) diff --git a/test cases/common/140 custom target object output/progdir/prog.c b/test cases/common/140 custom target object output/progdir/prog.c deleted file mode 100644 index c1ece33..0000000 --- a/test cases/common/140 custom target object output/progdir/prog.c +++ /dev/null @@ -1,5 +0,0 @@ -int func1_in_obj(); - -int main(int argc, char **argv) { - return func1_in_obj(); -} diff --git a/test cases/common/140 empty build file/meson.build b/test cases/common/140 empty build file/meson.build new file mode 100644 index 0000000..73d0397 --- /dev/null +++ b/test cases/common/140 empty build file/meson.build @@ -0,0 +1,2 @@ +project('subdir with empty meson.build test', 'c') +subdir('subdir') diff --git a/test cases/common/140 empty build file/subdir/meson.build b/test cases/common/140 empty build file/subdir/meson.build new file mode 100644 index 0000000..e69de29 diff --git a/test cases/common/141 empty build file/meson.build b/test cases/common/141 empty build file/meson.build deleted file mode 100644 index 73d0397..0000000 --- a/test cases/common/141 empty build file/meson.build +++ /dev/null @@ -1,2 +0,0 @@ -project('subdir with empty meson.build test', 'c') -subdir('subdir') diff --git a/test cases/common/141 empty build file/subdir/meson.build b/test cases/common/141 empty build file/subdir/meson.build deleted file mode 100644 index e69de29..0000000 diff --git a/test cases/common/141 whole archive/exe/meson.build b/test cases/common/141 whole archive/exe/meson.build new file mode 100644 index 0000000..91d298d --- /dev/null +++ b/test cases/common/141 whole archive/exe/meson.build @@ -0,0 +1 @@ +exe = executable('prog', '../prog.c', link_with : sh_func2_linked_func1) diff --git a/test cases/common/141 whole archive/exe2/meson.build b/test cases/common/141 whole archive/exe2/meson.build new file mode 100644 index 0000000..9184864 --- /dev/null +++ b/test cases/common/141 whole archive/exe2/meson.build @@ -0,0 +1 @@ +exe2 = executable('prog2', '../prog.c', link_with : sh_only_link_whole) diff --git a/test cases/common/141 whole archive/exe3/meson.build b/test cases/common/141 whole archive/exe3/meson.build new file mode 100644 index 0000000..82cf57e --- /dev/null +++ b/test cases/common/141 whole archive/exe3/meson.build @@ -0,0 +1 @@ +exe3 = executable('prog3', '../prog.c', link_with : sh_func2_dep_func1) diff --git a/test cases/common/141 whole archive/exe4/meson.build b/test cases/common/141 whole archive/exe4/meson.build new file mode 100644 index 0000000..0781250 --- /dev/null +++ b/test cases/common/141 whole archive/exe4/meson.build @@ -0,0 +1 @@ +exe4 = executable('prog4', '../prog.c', link_with : sh_func2_transdep_func1) diff --git a/test cases/common/141 whole archive/func1.c b/test cases/common/141 whole archive/func1.c new file mode 100644 index 0000000..b2690a0 --- /dev/null +++ b/test cases/common/141 whole archive/func1.c @@ -0,0 +1,7 @@ +#define BUILDING_DLL + +#include + +int func1() { + return 42; +} diff --git a/test cases/common/141 whole archive/func2.c b/test cases/common/141 whole archive/func2.c new file mode 100644 index 0000000..9e287a4 --- /dev/null +++ b/test cases/common/141 whole archive/func2.c @@ -0,0 +1,7 @@ +#define BUILDING_DLL + +#include + +int func2() { + return 42; +} diff --git a/test cases/common/141 whole archive/meson.build b/test cases/common/141 whole archive/meson.build new file mode 100644 index 0000000..012df33 --- /dev/null +++ b/test cases/common/141 whole archive/meson.build @@ -0,0 +1,50 @@ +project('whole archive', 'c') + +add_project_arguments('-I' + meson.source_root(), language : 'c') + +cc = meson.get_compiler('c') + +if cc.get_id() == 'msvc' + if cc.version().version_compare('<19') + error('MESON_SKIP_TEST link_whole only works on VS2015 or newer.') + endif +endif + +# Test 1: link_whole keeps all symbols +# Make static func1 +subdir('st_func1') +# Make shared func2 linking whole func1 archive +subdir('sh_func2_linked_func1') +# Link exe with shared library only +subdir('exe') +# Test that both func1 and func2 are accessible from shared library +test('prog', exe) + +# Test 2: link_whole can be used instead of source list, see #2180 +# Make static func2 +subdir('st_func2') +# Link both func1 and func2 into same shared library +# which does not have any sources other than 2 static libraries +subdir('sh_only_link_whole') +# Link exe2 with shared library only +subdir('exe2') +# Test that both func1 and func2 are accessible from shared library +test('prog2', exe2) + +# Test 3: link_whole can be used in declare_dependency() +func1_dep = declare_dependency(link_whole : [st_func1]) +# Use dependency to link func1 into shared library +subdir('sh_func2_dep_func1') +# Link exe3 with shared library +subdir('exe3') +# Test that both func1 and func2 are accessible from shared library +test('prog3', exe3) + +# Test 4: link_whole can be used in transitive declare_dependency() +func1_trans_dep = declare_dependency(dependencies : func1_dep) +# Use transitive dependency to link func1 into shared library +subdir('sh_func2_transdep_func1') +# Link exe4 with shared library +subdir('exe4') +# Test that both func1 and func2 are accessible from shared library +test('prog4', exe4) diff --git a/test cases/common/141 whole archive/mylib.h b/test cases/common/141 whole archive/mylib.h new file mode 100644 index 0000000..813cc67 --- /dev/null +++ b/test cases/common/141 whole archive/mylib.h @@ -0,0 +1,21 @@ +#pragma once + +/* Both funcs here for simplicity. */ + +#if defined _WIN32 || defined __CYGWIN__ +#if defined BUILDING_DLL + #define DLL_PUBLIC __declspec(dllexport) +#else + #define DLL_PUBLIC __declspec(dllimport) +#endif +#else + #if defined __GNUC__ + #define DLL_PUBLIC __attribute__ ((visibility("default"))) + #else + #pragma message ("Compiler does not support symbol visibility.") + #define DLL_PUBLIC + #endif +#endif + +int DLL_PUBLIC func1(); +int DLL_PUBLIC func2(); diff --git a/test cases/common/141 whole archive/prog.c b/test cases/common/141 whole archive/prog.c new file mode 100644 index 0000000..9111ad4 --- /dev/null +++ b/test cases/common/141 whole archive/prog.c @@ -0,0 +1,5 @@ +#include + +int main(int argc, char **argv) { + return func1() - func2(); +} diff --git a/test cases/common/141 whole archive/sh_func2_dep_func1/meson.build b/test cases/common/141 whole archive/sh_func2_dep_func1/meson.build new file mode 100644 index 0000000..92baca6 --- /dev/null +++ b/test cases/common/141 whole archive/sh_func2_dep_func1/meson.build @@ -0,0 +1,4 @@ +# Same as sh_func2_linked_func1, # func2.c does not depend on func1(), +# so without link_whole compiler would throw func1() away. +# This is the same version of the test with a dependency object instead. +sh_func2_dep_func1 = shared_library('sh_func2_dep_func1', '../func2.c', dependencies : func1_dep) diff --git a/test cases/common/141 whole archive/sh_func2_linked_func1/meson.build b/test cases/common/141 whole archive/sh_func2_linked_func1/meson.build new file mode 100644 index 0000000..2858f65 --- /dev/null +++ b/test cases/common/141 whole archive/sh_func2_linked_func1/meson.build @@ -0,0 +1,3 @@ +# Nothing in func2.c uses func1, so the linker would throw it +# away and thus linking the exe would fail. +sh_func2_linked_func1 = shared_library('sh_func2_linked_func1', '../func2.c', link_whole : st_func1) diff --git a/test cases/common/141 whole archive/sh_func2_transdep_func1/meson.build b/test cases/common/141 whole archive/sh_func2_transdep_func1/meson.build new file mode 100644 index 0000000..0703077 --- /dev/null +++ b/test cases/common/141 whole archive/sh_func2_transdep_func1/meson.build @@ -0,0 +1,6 @@ +# Same as sh_func2_dep_func1 but dependency is transitive. +# func2.c does not have any reference to func1() so without link_whole compiler +# should throw func1() out. +sh_func2_transdep_func1 = shared_library( + 'sh_func2_transdep_func1', '../func2.c', + dependencies : func1_trans_dep) diff --git a/test cases/common/141 whole archive/sh_only_link_whole/meson.build b/test cases/common/141 whole archive/sh_only_link_whole/meson.build new file mode 100644 index 0000000..64baabd --- /dev/null +++ b/test cases/common/141 whole archive/sh_only_link_whole/meson.build @@ -0,0 +1 @@ +sh_only_link_whole = shared_library('sh_only_link_whole', link_whole : [st_func1, st_func2]) diff --git a/test cases/common/141 whole archive/st_func1/meson.build b/test cases/common/141 whole archive/st_func1/meson.build new file mode 100644 index 0000000..c84d781 --- /dev/null +++ b/test cases/common/141 whole archive/st_func1/meson.build @@ -0,0 +1 @@ +st_func1 = static_library('st_func1', '../func1.c') diff --git a/test cases/common/141 whole archive/st_func2/meson.build b/test cases/common/141 whole archive/st_func2/meson.build new file mode 100644 index 0000000..2732f96 --- /dev/null +++ b/test cases/common/141 whole archive/st_func2/meson.build @@ -0,0 +1 @@ +st_func2 = static_library('st_func2', '../func2.c') diff --git a/test cases/common/142 C and CPP link/dummy.c b/test cases/common/142 C and CPP link/dummy.c new file mode 100644 index 0000000..e69de29 diff --git a/test cases/common/142 C and CPP link/foo.c b/test cases/common/142 C and CPP link/foo.c new file mode 100644 index 0000000..77c7e39 --- /dev/null +++ b/test cases/common/142 C and CPP link/foo.c @@ -0,0 +1,19 @@ +/* Copyright © 2017 Dylan Baker + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +#include "foo.h" + +int forty_two(void) { + return 42; +} diff --git a/test cases/common/142 C and CPP link/foo.cpp b/test cases/common/142 C and CPP link/foo.cpp new file mode 100644 index 0000000..9db7fb2 --- /dev/null +++ b/test cases/common/142 C and CPP link/foo.cpp @@ -0,0 +1,34 @@ +/* Copyright © 2017 Dylan Baker + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +#include + +const int cnums[] = {0, 61}; + +/* Provided by foobar.c */ +extern "C" int get_number_index (void); + +template +std::vector makeVector(const T (&data)[N]) +{ + return std::vector(data, data+N); +} + +namespace { + std::vector numbers = makeVector(cnums); +} + +extern "C" int six_one(void) { + return numbers[get_number_index ()]; +} diff --git a/test cases/common/142 C and CPP link/foo.h b/test cases/common/142 C and CPP link/foo.h new file mode 100644 index 0000000..1ed8ce9 --- /dev/null +++ b/test cases/common/142 C and CPP link/foo.h @@ -0,0 +1,16 @@ +/* Copyright © 2017 Dylan Baker + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +int forty_two(void); diff --git a/test cases/common/142 C and CPP link/foo.hpp b/test cases/common/142 C and CPP link/foo.hpp new file mode 100644 index 0000000..e47f01d --- /dev/null +++ b/test cases/common/142 C and CPP link/foo.hpp @@ -0,0 +1,24 @@ +/* Copyright © 2017 Dylan Baker + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifdef __cplusplus +extern "C" { +#endif + +int six_one(void); + +#ifdef __cplusplus +} +#endif diff --git a/test cases/common/142 C and CPP link/foobar.c b/test cases/common/142 C and CPP link/foobar.c new file mode 100644 index 0000000..27928bf --- /dev/null +++ b/test cases/common/142 C and CPP link/foobar.c @@ -0,0 +1,27 @@ +/* Copyright © 2017 Dylan Baker + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "foo.h" +#include "foo.hpp" +#include "foobar.h" + +int get_number_index (void) { + return 1; +} + +void mynumbers(int nums[]) { + nums[0] = forty_two(); + nums[1] = six_one(); +} diff --git a/test cases/common/142 C and CPP link/foobar.h b/test cases/common/142 C and CPP link/foobar.h new file mode 100644 index 0000000..6dcb096 --- /dev/null +++ b/test cases/common/142 C and CPP link/foobar.h @@ -0,0 +1,16 @@ +/* Copyright © 2017 Dylan Baker + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +void mynumbers(int nums[]); diff --git a/test cases/common/142 C and CPP link/meson.build b/test cases/common/142 C and CPP link/meson.build new file mode 100644 index 0000000..a93a981 --- /dev/null +++ b/test cases/common/142 C and CPP link/meson.build @@ -0,0 +1,123 @@ +# Copyright © 2017 Dylan Baker +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +project('C and C++ static link test', ['c', 'cpp']) + +# Verify that adding link arguments works. +add_global_link_arguments('', language : 'c') +add_project_link_arguments('', language : 'c') + +libc = static_library('cfoo', ['foo.c', 'foo.h']) + +# Test that linking C libs to external static C++ libs uses the C++ linker +# Since we can't depend on the test system to provide this, we create one +# ourselves at configure time and then 'find' it with cxx.find_library(). +cxx = meson.get_compiler('cpp') + +if cxx.get_argument_syntax() == 'msvc' + if cxx.get_id() == 'msvc' + static_linker = find_program('lib') + elif cxx.get_id() == 'clang-cl' + static_linker = find_program('llvm-lib') + elif cxx.get_id() == 'intel-cl' + static_linker = find_program('xilib') + else + error('unable to determine static linker to use with this compiler') + endif + compile_cmd = ['/c', '@INPUT@', '/Fo@OUTPUT@'] + stlib_cmd = [static_linker, '/OUT:@OUTPUT@', '@INPUT@'] +else + picflag = [] + if not ['darwin', 'windows'].contains(host_machine.system()) + picflag = ['-fPIC'] + endif + compile_cmd = ['-c', picflag, '@INPUT@', '-o', '@OUTPUT@'] + stlib_cmd = ['ar', 'csr', '@OUTPUT@', '@INPUT@'] +endif + +foo_cpp_o = configure_file( + input : 'foo.cpp', + output : 'foo.cpp.o', + command : cxx.cmd_array() + compile_cmd) + +configure_file( + input : foo_cpp_o, + output : 'libstcppext.a', + command : stlib_cmd) + +libstcppext = cxx.find_library('stcppext', dirs : meson.current_build_dir()) +lib_type_name = libstcppext.type_name() +assert(lib_type_name == 'library', 'type name is ' + lib_type_name) + +libfooext = shared_library( + 'fooext', + ['foobar.c', 'foobar.h'], + link_with : libc, + dependencies : libstcppext, +) + +# Test that linking C libs to internal static C++ libs uses the C++ linker +libcpp = static_library('cppfoo', ['foo.cpp', 'foo.hpp']) + +libfoo = shared_library( + 'foo', + ['foobar.c', 'foobar.h'], + link_with : [libc, libcpp], +) + +# Test that link_whole is also honored +# +# VS2010 lacks the /WHOLEARCHIVE option that later versions of MSVC support, so +# don't run this tests on that backend. +if not (cxx.get_id() == 'msvc' and cxx.version().version_compare('<19')) + libfoowhole = shared_library( + 'foowhole', + ['foobar.c', 'foobar.h'], + link_whole : [libc, libcpp], + ) +endif + +# Test sublinking (linking C and C++, then linking that to C) +libfoo_static = static_library( + 'foo_static', + ['foobar.c', 'foobar.h'], + link_with : [libc, libcpp], +) + +libsub = shared_library( + 'sub', + ['sub.c', 'sub.h'], + link_with : libfoo_static, +) + +if not (cxx.get_id() == 'msvc' and cxx.version().version_compare('<19')) + libsubwhole = shared_library( + 'subwhole', + ['sub.c', 'sub.h'], + link_whole : libfoo_static, + ) +endif + +# Test that it really is recursive +libsub_static = static_library( + 'sub_static', + ['sub.c', 'sub.h'], + link_with : libfoo_static, +) + +libsubsub = shared_library( + 'subsub', + ['dummy.c'], + link_with : libsub_static, +) diff --git a/test cases/common/142 C and CPP link/sub.c b/test cases/common/142 C and CPP link/sub.c new file mode 100644 index 0000000..7c078f8 --- /dev/null +++ b/test cases/common/142 C and CPP link/sub.c @@ -0,0 +1,19 @@ +/* Copyright © 2017 Dylan Baker + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +#include "sub.h" + +float a_half(void) { + return .5; +} diff --git a/test cases/common/142 C and CPP link/sub.h b/test cases/common/142 C and CPP link/sub.h new file mode 100644 index 0000000..5b02e17 --- /dev/null +++ b/test cases/common/142 C and CPP link/sub.h @@ -0,0 +1,16 @@ +/* Copyright © 2017 Dylan Baker + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +float a_half(void); diff --git a/test cases/common/142 whole archive/exe/meson.build b/test cases/common/142 whole archive/exe/meson.build deleted file mode 100644 index 91d298d..0000000 --- a/test cases/common/142 whole archive/exe/meson.build +++ /dev/null @@ -1 +0,0 @@ -exe = executable('prog', '../prog.c', link_with : sh_func2_linked_func1) diff --git a/test cases/common/142 whole archive/exe2/meson.build b/test cases/common/142 whole archive/exe2/meson.build deleted file mode 100644 index 9184864..0000000 --- a/test cases/common/142 whole archive/exe2/meson.build +++ /dev/null @@ -1 +0,0 @@ -exe2 = executable('prog2', '../prog.c', link_with : sh_only_link_whole) diff --git a/test cases/common/142 whole archive/exe3/meson.build b/test cases/common/142 whole archive/exe3/meson.build deleted file mode 100644 index 82cf57e..0000000 --- a/test cases/common/142 whole archive/exe3/meson.build +++ /dev/null @@ -1 +0,0 @@ -exe3 = executable('prog3', '../prog.c', link_with : sh_func2_dep_func1) diff --git a/test cases/common/142 whole archive/exe4/meson.build b/test cases/common/142 whole archive/exe4/meson.build deleted file mode 100644 index 0781250..0000000 --- a/test cases/common/142 whole archive/exe4/meson.build +++ /dev/null @@ -1 +0,0 @@ -exe4 = executable('prog4', '../prog.c', link_with : sh_func2_transdep_func1) diff --git a/test cases/common/142 whole archive/func1.c b/test cases/common/142 whole archive/func1.c deleted file mode 100644 index b2690a0..0000000 --- a/test cases/common/142 whole archive/func1.c +++ /dev/null @@ -1,7 +0,0 @@ -#define BUILDING_DLL - -#include - -int func1() { - return 42; -} diff --git a/test cases/common/142 whole archive/func2.c b/test cases/common/142 whole archive/func2.c deleted file mode 100644 index 9e287a4..0000000 --- a/test cases/common/142 whole archive/func2.c +++ /dev/null @@ -1,7 +0,0 @@ -#define BUILDING_DLL - -#include - -int func2() { - return 42; -} diff --git a/test cases/common/142 whole archive/meson.build b/test cases/common/142 whole archive/meson.build deleted file mode 100644 index 012df33..0000000 --- a/test cases/common/142 whole archive/meson.build +++ /dev/null @@ -1,50 +0,0 @@ -project('whole archive', 'c') - -add_project_arguments('-I' + meson.source_root(), language : 'c') - -cc = meson.get_compiler('c') - -if cc.get_id() == 'msvc' - if cc.version().version_compare('<19') - error('MESON_SKIP_TEST link_whole only works on VS2015 or newer.') - endif -endif - -# Test 1: link_whole keeps all symbols -# Make static func1 -subdir('st_func1') -# Make shared func2 linking whole func1 archive -subdir('sh_func2_linked_func1') -# Link exe with shared library only -subdir('exe') -# Test that both func1 and func2 are accessible from shared library -test('prog', exe) - -# Test 2: link_whole can be used instead of source list, see #2180 -# Make static func2 -subdir('st_func2') -# Link both func1 and func2 into same shared library -# which does not have any sources other than 2 static libraries -subdir('sh_only_link_whole') -# Link exe2 with shared library only -subdir('exe2') -# Test that both func1 and func2 are accessible from shared library -test('prog2', exe2) - -# Test 3: link_whole can be used in declare_dependency() -func1_dep = declare_dependency(link_whole : [st_func1]) -# Use dependency to link func1 into shared library -subdir('sh_func2_dep_func1') -# Link exe3 with shared library -subdir('exe3') -# Test that both func1 and func2 are accessible from shared library -test('prog3', exe3) - -# Test 4: link_whole can be used in transitive declare_dependency() -func1_trans_dep = declare_dependency(dependencies : func1_dep) -# Use transitive dependency to link func1 into shared library -subdir('sh_func2_transdep_func1') -# Link exe4 with shared library -subdir('exe4') -# Test that both func1 and func2 are accessible from shared library -test('prog4', exe4) diff --git a/test cases/common/142 whole archive/mylib.h b/test cases/common/142 whole archive/mylib.h deleted file mode 100644 index 813cc67..0000000 --- a/test cases/common/142 whole archive/mylib.h +++ /dev/null @@ -1,21 +0,0 @@ -#pragma once - -/* Both funcs here for simplicity. */ - -#if defined _WIN32 || defined __CYGWIN__ -#if defined BUILDING_DLL - #define DLL_PUBLIC __declspec(dllexport) -#else - #define DLL_PUBLIC __declspec(dllimport) -#endif -#else - #if defined __GNUC__ - #define DLL_PUBLIC __attribute__ ((visibility("default"))) - #else - #pragma message ("Compiler does not support symbol visibility.") - #define DLL_PUBLIC - #endif -#endif - -int DLL_PUBLIC func1(); -int DLL_PUBLIC func2(); diff --git a/test cases/common/142 whole archive/prog.c b/test cases/common/142 whole archive/prog.c deleted file mode 100644 index 9111ad4..0000000 --- a/test cases/common/142 whole archive/prog.c +++ /dev/null @@ -1,5 +0,0 @@ -#include - -int main(int argc, char **argv) { - return func1() - func2(); -} diff --git a/test cases/common/142 whole archive/sh_func2_dep_func1/meson.build b/test cases/common/142 whole archive/sh_func2_dep_func1/meson.build deleted file mode 100644 index 92baca6..0000000 --- a/test cases/common/142 whole archive/sh_func2_dep_func1/meson.build +++ /dev/null @@ -1,4 +0,0 @@ -# Same as sh_func2_linked_func1, # func2.c does not depend on func1(), -# so without link_whole compiler would throw func1() away. -# This is the same version of the test with a dependency object instead. -sh_func2_dep_func1 = shared_library('sh_func2_dep_func1', '../func2.c', dependencies : func1_dep) diff --git a/test cases/common/142 whole archive/sh_func2_linked_func1/meson.build b/test cases/common/142 whole archive/sh_func2_linked_func1/meson.build deleted file mode 100644 index 2858f65..0000000 --- a/test cases/common/142 whole archive/sh_func2_linked_func1/meson.build +++ /dev/null @@ -1,3 +0,0 @@ -# Nothing in func2.c uses func1, so the linker would throw it -# away and thus linking the exe would fail. -sh_func2_linked_func1 = shared_library('sh_func2_linked_func1', '../func2.c', link_whole : st_func1) diff --git a/test cases/common/142 whole archive/sh_func2_transdep_func1/meson.build b/test cases/common/142 whole archive/sh_func2_transdep_func1/meson.build deleted file mode 100644 index 0703077..0000000 --- a/test cases/common/142 whole archive/sh_func2_transdep_func1/meson.build +++ /dev/null @@ -1,6 +0,0 @@ -# Same as sh_func2_dep_func1 but dependency is transitive. -# func2.c does not have any reference to func1() so without link_whole compiler -# should throw func1() out. -sh_func2_transdep_func1 = shared_library( - 'sh_func2_transdep_func1', '../func2.c', - dependencies : func1_trans_dep) diff --git a/test cases/common/142 whole archive/sh_only_link_whole/meson.build b/test cases/common/142 whole archive/sh_only_link_whole/meson.build deleted file mode 100644 index 64baabd..0000000 --- a/test cases/common/142 whole archive/sh_only_link_whole/meson.build +++ /dev/null @@ -1 +0,0 @@ -sh_only_link_whole = shared_library('sh_only_link_whole', link_whole : [st_func1, st_func2]) diff --git a/test cases/common/142 whole archive/st_func1/meson.build b/test cases/common/142 whole archive/st_func1/meson.build deleted file mode 100644 index c84d781..0000000 --- a/test cases/common/142 whole archive/st_func1/meson.build +++ /dev/null @@ -1 +0,0 @@ -st_func1 = static_library('st_func1', '../func1.c') diff --git a/test cases/common/142 whole archive/st_func2/meson.build b/test cases/common/142 whole archive/st_func2/meson.build deleted file mode 100644 index 2732f96..0000000 --- a/test cases/common/142 whole archive/st_func2/meson.build +++ /dev/null @@ -1 +0,0 @@ -st_func2 = static_library('st_func2', '../func2.c') diff --git a/test cases/common/143 C and CPP link/dummy.c b/test cases/common/143 C and CPP link/dummy.c deleted file mode 100644 index e69de29..0000000 diff --git a/test cases/common/143 C and CPP link/foo.c b/test cases/common/143 C and CPP link/foo.c deleted file mode 100644 index 77c7e39..0000000 --- a/test cases/common/143 C and CPP link/foo.c +++ /dev/null @@ -1,19 +0,0 @@ -/* Copyright © 2017 Dylan Baker - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -#include "foo.h" - -int forty_two(void) { - return 42; -} diff --git a/test cases/common/143 C and CPP link/foo.cpp b/test cases/common/143 C and CPP link/foo.cpp deleted file mode 100644 index 9db7fb2..0000000 --- a/test cases/common/143 C and CPP link/foo.cpp +++ /dev/null @@ -1,34 +0,0 @@ -/* Copyright © 2017 Dylan Baker - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -#include - -const int cnums[] = {0, 61}; - -/* Provided by foobar.c */ -extern "C" int get_number_index (void); - -template -std::vector makeVector(const T (&data)[N]) -{ - return std::vector(data, data+N); -} - -namespace { - std::vector numbers = makeVector(cnums); -} - -extern "C" int six_one(void) { - return numbers[get_number_index ()]; -} diff --git a/test cases/common/143 C and CPP link/foo.h b/test cases/common/143 C and CPP link/foo.h deleted file mode 100644 index 1ed8ce9..0000000 --- a/test cases/common/143 C and CPP link/foo.h +++ /dev/null @@ -1,16 +0,0 @@ -/* Copyright © 2017 Dylan Baker - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -int forty_two(void); diff --git a/test cases/common/143 C and CPP link/foo.hpp b/test cases/common/143 C and CPP link/foo.hpp deleted file mode 100644 index e47f01d..0000000 --- a/test cases/common/143 C and CPP link/foo.hpp +++ /dev/null @@ -1,24 +0,0 @@ -/* Copyright © 2017 Dylan Baker - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#ifdef __cplusplus -extern "C" { -#endif - -int six_one(void); - -#ifdef __cplusplus -} -#endif diff --git a/test cases/common/143 C and CPP link/foobar.c b/test cases/common/143 C and CPP link/foobar.c deleted file mode 100644 index 27928bf..0000000 --- a/test cases/common/143 C and CPP link/foobar.c +++ /dev/null @@ -1,27 +0,0 @@ -/* Copyright © 2017 Dylan Baker - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#include "foo.h" -#include "foo.hpp" -#include "foobar.h" - -int get_number_index (void) { - return 1; -} - -void mynumbers(int nums[]) { - nums[0] = forty_two(); - nums[1] = six_one(); -} diff --git a/test cases/common/143 C and CPP link/foobar.h b/test cases/common/143 C and CPP link/foobar.h deleted file mode 100644 index 6dcb096..0000000 --- a/test cases/common/143 C and CPP link/foobar.h +++ /dev/null @@ -1,16 +0,0 @@ -/* Copyright © 2017 Dylan Baker - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -void mynumbers(int nums[]); diff --git a/test cases/common/143 C and CPP link/meson.build b/test cases/common/143 C and CPP link/meson.build deleted file mode 100644 index a93a981..0000000 --- a/test cases/common/143 C and CPP link/meson.build +++ /dev/null @@ -1,123 +0,0 @@ -# Copyright © 2017 Dylan Baker -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -project('C and C++ static link test', ['c', 'cpp']) - -# Verify that adding link arguments works. -add_global_link_arguments('', language : 'c') -add_project_link_arguments('', language : 'c') - -libc = static_library('cfoo', ['foo.c', 'foo.h']) - -# Test that linking C libs to external static C++ libs uses the C++ linker -# Since we can't depend on the test system to provide this, we create one -# ourselves at configure time and then 'find' it with cxx.find_library(). -cxx = meson.get_compiler('cpp') - -if cxx.get_argument_syntax() == 'msvc' - if cxx.get_id() == 'msvc' - static_linker = find_program('lib') - elif cxx.get_id() == 'clang-cl' - static_linker = find_program('llvm-lib') - elif cxx.get_id() == 'intel-cl' - static_linker = find_program('xilib') - else - error('unable to determine static linker to use with this compiler') - endif - compile_cmd = ['/c', '@INPUT@', '/Fo@OUTPUT@'] - stlib_cmd = [static_linker, '/OUT:@OUTPUT@', '@INPUT@'] -else - picflag = [] - if not ['darwin', 'windows'].contains(host_machine.system()) - picflag = ['-fPIC'] - endif - compile_cmd = ['-c', picflag, '@INPUT@', '-o', '@OUTPUT@'] - stlib_cmd = ['ar', 'csr', '@OUTPUT@', '@INPUT@'] -endif - -foo_cpp_o = configure_file( - input : 'foo.cpp', - output : 'foo.cpp.o', - command : cxx.cmd_array() + compile_cmd) - -configure_file( - input : foo_cpp_o, - output : 'libstcppext.a', - command : stlib_cmd) - -libstcppext = cxx.find_library('stcppext', dirs : meson.current_build_dir()) -lib_type_name = libstcppext.type_name() -assert(lib_type_name == 'library', 'type name is ' + lib_type_name) - -libfooext = shared_library( - 'fooext', - ['foobar.c', 'foobar.h'], - link_with : libc, - dependencies : libstcppext, -) - -# Test that linking C libs to internal static C++ libs uses the C++ linker -libcpp = static_library('cppfoo', ['foo.cpp', 'foo.hpp']) - -libfoo = shared_library( - 'foo', - ['foobar.c', 'foobar.h'], - link_with : [libc, libcpp], -) - -# Test that link_whole is also honored -# -# VS2010 lacks the /WHOLEARCHIVE option that later versions of MSVC support, so -# don't run this tests on that backend. -if not (cxx.get_id() == 'msvc' and cxx.version().version_compare('<19')) - libfoowhole = shared_library( - 'foowhole', - ['foobar.c', 'foobar.h'], - link_whole : [libc, libcpp], - ) -endif - -# Test sublinking (linking C and C++, then linking that to C) -libfoo_static = static_library( - 'foo_static', - ['foobar.c', 'foobar.h'], - link_with : [libc, libcpp], -) - -libsub = shared_library( - 'sub', - ['sub.c', 'sub.h'], - link_with : libfoo_static, -) - -if not (cxx.get_id() == 'msvc' and cxx.version().version_compare('<19')) - libsubwhole = shared_library( - 'subwhole', - ['sub.c', 'sub.h'], - link_whole : libfoo_static, - ) -endif - -# Test that it really is recursive -libsub_static = static_library( - 'sub_static', - ['sub.c', 'sub.h'], - link_with : libfoo_static, -) - -libsubsub = shared_library( - 'subsub', - ['dummy.c'], - link_with : libsub_static, -) diff --git a/test cases/common/143 C and CPP link/sub.c b/test cases/common/143 C and CPP link/sub.c deleted file mode 100644 index 7c078f8..0000000 --- a/test cases/common/143 C and CPP link/sub.c +++ /dev/null @@ -1,19 +0,0 @@ -/* Copyright © 2017 Dylan Baker - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -#include "sub.h" - -float a_half(void) { - return .5; -} diff --git a/test cases/common/143 C and CPP link/sub.h b/test cases/common/143 C and CPP link/sub.h deleted file mode 100644 index 5b02e17..0000000 --- a/test cases/common/143 C and CPP link/sub.h +++ /dev/null @@ -1,16 +0,0 @@ -/* Copyright © 2017 Dylan Baker - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -float a_half(void); diff --git a/test cases/common/143 mesonintrospect from scripts/check_env.py b/test cases/common/143 mesonintrospect from scripts/check_env.py new file mode 100644 index 0000000..2d46d88 --- /dev/null +++ b/test cases/common/143 mesonintrospect from scripts/check_env.py @@ -0,0 +1,28 @@ +#!/usr/bin/env python3 + +import os +import sys +import shlex + +do_print = False + +if len(sys.argv) > 1: + do_print = bool(sys.argv[1]) + +if 'MESONINTROSPECT' not in os.environ: + raise RuntimeError('MESONINTROSPECT not found') + +mesonintrospect = os.environ['MESONINTROSPECT'] + +introspect_arr = shlex.split(mesonintrospect) + +# print(mesonintrospect) +# print(introspect_arr) + +some_executable = introspect_arr[0] + +if not os.path.isfile(some_executable): + raise RuntimeError('{!r} does not exist'.format(mesonintrospect)) + +if do_print: + print(some_executable, end='') diff --git a/test cases/common/143 mesonintrospect from scripts/check_introspection.py b/test cases/common/143 mesonintrospect from scripts/check_introspection.py new file mode 100644 index 0000000..851a415 --- /dev/null +++ b/test cases/common/143 mesonintrospect from scripts/check_introspection.py @@ -0,0 +1,18 @@ +#!/usr/bin/env python3 + +import os +import shlex +import subprocess + + +if 'MESONINTROSPECT' not in os.environ: + raise RuntimeError('MESONINTROSPECT not found') +if 'MESON_BUILD_ROOT' not in os.environ: + raise RuntimeError('MESON_BUILD_ROOT not found') + +mesonintrospect = os.environ['MESONINTROSPECT'] +introspect_arr = shlex.split(mesonintrospect) + +buildroot = os.environ['MESON_BUILD_ROOT'] + +subprocess.check_output([*introspect_arr, '--all', buildroot]) diff --git a/test cases/common/143 mesonintrospect from scripts/meson.build b/test cases/common/143 mesonintrospect from scripts/meson.build new file mode 100644 index 0000000..1117672 --- /dev/null +++ b/test cases/common/143 mesonintrospect from scripts/meson.build @@ -0,0 +1,14 @@ +project('mesonintrospect from scripts', 'c') + +python = import('python3').find_python() + +ret = run_command(python, ['check_env.py', '1']) +if ret.returncode() == 0 + find_program(ret.stdout()) +else + message(ret.stdout()) + message(ret.stderr()) +endif + +meson.add_postconf_script('check_introspection.py') +meson.add_install_script('check_env.py') diff --git a/test cases/common/144 custom target multiple outputs/generator.py b/test cases/common/144 custom target multiple outputs/generator.py new file mode 100755 index 0000000..39dbd11 --- /dev/null +++ b/test cases/common/144 custom target multiple outputs/generator.py @@ -0,0 +1,14 @@ +#!/usr/bin/env python3 + +import sys, os + +if len(sys.argv) != 3: + print(sys.argv[0], '', '') + +name = sys.argv[1] +odir = sys.argv[2] + +with open(os.path.join(odir, name + '.h'), 'w') as f: + f.write('int func();\n') +with open(os.path.join(odir, name + '.sh'), 'w') as f: + f.write('#!/bin/bash') diff --git a/test cases/common/144 custom target multiple outputs/installed_files.txt b/test cases/common/144 custom target multiple outputs/installed_files.txt new file mode 100644 index 0000000..21e1249 --- /dev/null +++ b/test cases/common/144 custom target multiple outputs/installed_files.txt @@ -0,0 +1,6 @@ +usr/include/diff.h +usr/include/first.h +usr/bin/diff.sh +usr/bin/second.sh +opt/same.h +opt/same.sh diff --git a/test cases/common/144 custom target multiple outputs/meson.build b/test cases/common/144 custom target multiple outputs/meson.build new file mode 100644 index 0000000..6412864 --- /dev/null +++ b/test cases/common/144 custom target multiple outputs/meson.build @@ -0,0 +1,28 @@ +project('multiple outputs install', 'c') + +gen = find_program('generator.py') + +custom_target('different-install-dirs', + output : ['diff.h', 'diff.sh'], + command : [gen, 'diff', '@OUTDIR@'], + install : true, + install_dir : [join_paths(get_option('prefix'), get_option('includedir')), + join_paths(get_option('prefix'), get_option('bindir'))]) + +custom_target('same-install-dir', + output : ['same.h', 'same.sh'], + command : [gen, 'same', '@OUTDIR@'], + install : true, + install_dir : '/opt') + +custom_target('only-install-first', + output : ['first.h', 'first.sh'], + command : [gen, 'first', '@OUTDIR@'], + install : true, + install_dir : [join_paths(get_option('prefix'), get_option('includedir')), false]) + +custom_target('only-install-second', + output : ['second.h', 'second.sh'], + command : [gen, 'second', '@OUTDIR@'], + install : true, + install_dir : [false, join_paths(get_option('prefix'), get_option('bindir'))]) diff --git a/test cases/common/144 mesonintrospect from scripts/check_env.py b/test cases/common/144 mesonintrospect from scripts/check_env.py deleted file mode 100644 index 2d46d88..0000000 --- a/test cases/common/144 mesonintrospect from scripts/check_env.py +++ /dev/null @@ -1,28 +0,0 @@ -#!/usr/bin/env python3 - -import os -import sys -import shlex - -do_print = False - -if len(sys.argv) > 1: - do_print = bool(sys.argv[1]) - -if 'MESONINTROSPECT' not in os.environ: - raise RuntimeError('MESONINTROSPECT not found') - -mesonintrospect = os.environ['MESONINTROSPECT'] - -introspect_arr = shlex.split(mesonintrospect) - -# print(mesonintrospect) -# print(introspect_arr) - -some_executable = introspect_arr[0] - -if not os.path.isfile(some_executable): - raise RuntimeError('{!r} does not exist'.format(mesonintrospect)) - -if do_print: - print(some_executable, end='') diff --git a/test cases/common/144 mesonintrospect from scripts/check_introspection.py b/test cases/common/144 mesonintrospect from scripts/check_introspection.py deleted file mode 100644 index 851a415..0000000 --- a/test cases/common/144 mesonintrospect from scripts/check_introspection.py +++ /dev/null @@ -1,18 +0,0 @@ -#!/usr/bin/env python3 - -import os -import shlex -import subprocess - - -if 'MESONINTROSPECT' not in os.environ: - raise RuntimeError('MESONINTROSPECT not found') -if 'MESON_BUILD_ROOT' not in os.environ: - raise RuntimeError('MESON_BUILD_ROOT not found') - -mesonintrospect = os.environ['MESONINTROSPECT'] -introspect_arr = shlex.split(mesonintrospect) - -buildroot = os.environ['MESON_BUILD_ROOT'] - -subprocess.check_output([*introspect_arr, '--all', buildroot]) diff --git a/test cases/common/144 mesonintrospect from scripts/meson.build b/test cases/common/144 mesonintrospect from scripts/meson.build deleted file mode 100644 index 1117672..0000000 --- a/test cases/common/144 mesonintrospect from scripts/meson.build +++ /dev/null @@ -1,14 +0,0 @@ -project('mesonintrospect from scripts', 'c') - -python = import('python3').find_python() - -ret = run_command(python, ['check_env.py', '1']) -if ret.returncode() == 0 - find_program(ret.stdout()) -else - message(ret.stdout()) - message(ret.stderr()) -endif - -meson.add_postconf_script('check_introspection.py') -meson.add_install_script('check_env.py') diff --git a/test cases/common/145 custom target multiple outputs/generator.py b/test cases/common/145 custom target multiple outputs/generator.py deleted file mode 100755 index 39dbd11..0000000 --- a/test cases/common/145 custom target multiple outputs/generator.py +++ /dev/null @@ -1,14 +0,0 @@ -#!/usr/bin/env python3 - -import sys, os - -if len(sys.argv) != 3: - print(sys.argv[0], '', '') - -name = sys.argv[1] -odir = sys.argv[2] - -with open(os.path.join(odir, name + '.h'), 'w') as f: - f.write('int func();\n') -with open(os.path.join(odir, name + '.sh'), 'w') as f: - f.write('#!/bin/bash') diff --git a/test cases/common/145 custom target multiple outputs/installed_files.txt b/test cases/common/145 custom target multiple outputs/installed_files.txt deleted file mode 100644 index 21e1249..0000000 --- a/test cases/common/145 custom target multiple outputs/installed_files.txt +++ /dev/null @@ -1,6 +0,0 @@ -usr/include/diff.h -usr/include/first.h -usr/bin/diff.sh -usr/bin/second.sh -opt/same.h -opt/same.sh diff --git a/test cases/common/145 custom target multiple outputs/meson.build b/test cases/common/145 custom target multiple outputs/meson.build deleted file mode 100644 index 6412864..0000000 --- a/test cases/common/145 custom target multiple outputs/meson.build +++ /dev/null @@ -1,28 +0,0 @@ -project('multiple outputs install', 'c') - -gen = find_program('generator.py') - -custom_target('different-install-dirs', - output : ['diff.h', 'diff.sh'], - command : [gen, 'diff', '@OUTDIR@'], - install : true, - install_dir : [join_paths(get_option('prefix'), get_option('includedir')), - join_paths(get_option('prefix'), get_option('bindir'))]) - -custom_target('same-install-dir', - output : ['same.h', 'same.sh'], - command : [gen, 'same', '@OUTDIR@'], - install : true, - install_dir : '/opt') - -custom_target('only-install-first', - output : ['first.h', 'first.sh'], - command : [gen, 'first', '@OUTDIR@'], - install : true, - install_dir : [join_paths(get_option('prefix'), get_option('includedir')), false]) - -custom_target('only-install-second', - output : ['second.h', 'second.sh'], - command : [gen, 'second', '@OUTDIR@'], - install : true, - install_dir : [false, join_paths(get_option('prefix'), get_option('bindir'))]) diff --git a/test cases/common/145 special characters/check_quoting.py b/test cases/common/145 special characters/check_quoting.py new file mode 100644 index 0000000..d6e50ea --- /dev/null +++ b/test cases/common/145 special characters/check_quoting.py @@ -0,0 +1,28 @@ +#!/usr/bin/env python3 + +import sys + +expected = { + 'newline': '\n', + 'dollar': '$', + 'colon': ':', + 'space': ' ', + 'multi1': ' ::$$ ::$$', + 'multi2': ' ::$$\n\n \n\n::$$', +} + +output = None + +for arg in sys.argv[1:]: + try: + name, value = arg.split('=', 1) + except ValueError: + output = arg + continue + + if expected[name] != value: + raise RuntimeError('{!r} is {!r} but should be {!r}'.format(name, value, expected[name])) + +if output is not None: + with open(output, 'w') as f: + f.write('Success!') diff --git a/test cases/common/145 special characters/installed_files.txt b/test cases/common/145 special characters/installed_files.txt new file mode 100644 index 0000000..f677881 --- /dev/null +++ b/test cases/common/145 special characters/installed_files.txt @@ -0,0 +1,2 @@ +usr/share/result +usr/share/result2 diff --git a/test cases/common/145 special characters/meson.build b/test cases/common/145 special characters/meson.build new file mode 100644 index 0000000..ecba650 --- /dev/null +++ b/test cases/common/145 special characters/meson.build @@ -0,0 +1,37 @@ +project('ninja special characters' ,'c') + +python = import('python3').find_python() + +# Without newlines, this should appear directly in build.ninja. +gen = custom_target('gen', + command : [ + python, + files('check_quoting.py'), + 'dollar=$', + 'colon=:', + 'space= ', + '''multi1= ::$$ ::$$''', + '@OUTPUT@'], + output : 'result', + install : true, + install_dir : get_option('datadir')) + +# With newlines, this should go through the exe wrapper. +gen2 = custom_target('gen2', + command : [ + python, + files('check_quoting.py'), + '''newline= +''', + 'dollar=$', + 'colon=:', + 'space= ', + '''multi2= ::$$ + + + +::$$''', + '@OUTPUT@'], + output : 'result2', + install : true, + install_dir : get_option('datadir')) diff --git a/test cases/common/146 nested links/meson.build b/test cases/common/146 nested links/meson.build new file mode 100644 index 0000000..0821b03 --- /dev/null +++ b/test cases/common/146 nested links/meson.build @@ -0,0 +1,8 @@ +project('test', 'c') + +libxserver_dri3 = [] +libxserver = [ libxserver_dri3 ] + +executable('Xephyr', 'xephyr.c', link_with: [ libxserver ]) + +executable('Zephyr', 'xephyr.c', link_args: [[], []]) diff --git a/test cases/common/146 nested links/xephyr.c b/test cases/common/146 nested links/xephyr.c new file mode 100644 index 0000000..33c14ce --- /dev/null +++ b/test cases/common/146 nested links/xephyr.c @@ -0,0 +1,3 @@ +int main() { + return 0; +} diff --git a/test cases/common/146 special characters/check_quoting.py b/test cases/common/146 special characters/check_quoting.py deleted file mode 100644 index d6e50ea..0000000 --- a/test cases/common/146 special characters/check_quoting.py +++ /dev/null @@ -1,28 +0,0 @@ -#!/usr/bin/env python3 - -import sys - -expected = { - 'newline': '\n', - 'dollar': '$', - 'colon': ':', - 'space': ' ', - 'multi1': ' ::$$ ::$$', - 'multi2': ' ::$$\n\n \n\n::$$', -} - -output = None - -for arg in sys.argv[1:]: - try: - name, value = arg.split('=', 1) - except ValueError: - output = arg - continue - - if expected[name] != value: - raise RuntimeError('{!r} is {!r} but should be {!r}'.format(name, value, expected[name])) - -if output is not None: - with open(output, 'w') as f: - f.write('Success!') diff --git a/test cases/common/146 special characters/installed_files.txt b/test cases/common/146 special characters/installed_files.txt deleted file mode 100644 index f677881..0000000 --- a/test cases/common/146 special characters/installed_files.txt +++ /dev/null @@ -1,2 +0,0 @@ -usr/share/result -usr/share/result2 diff --git a/test cases/common/146 special characters/meson.build b/test cases/common/146 special characters/meson.build deleted file mode 100644 index ecba650..0000000 --- a/test cases/common/146 special characters/meson.build +++ /dev/null @@ -1,37 +0,0 @@ -project('ninja special characters' ,'c') - -python = import('python3').find_python() - -# Without newlines, this should appear directly in build.ninja. -gen = custom_target('gen', - command : [ - python, - files('check_quoting.py'), - 'dollar=$', - 'colon=:', - 'space= ', - '''multi1= ::$$ ::$$''', - '@OUTPUT@'], - output : 'result', - install : true, - install_dir : get_option('datadir')) - -# With newlines, this should go through the exe wrapper. -gen2 = custom_target('gen2', - command : [ - python, - files('check_quoting.py'), - '''newline= -''', - 'dollar=$', - 'colon=:', - 'space= ', - '''multi2= ::$$ - - - -::$$''', - '@OUTPUT@'], - output : 'result2', - install : true, - install_dir : get_option('datadir')) diff --git a/test cases/common/147 list of file sources/foo b/test cases/common/147 list of file sources/foo new file mode 100644 index 0000000..7b57bd2 --- /dev/null +++ b/test cases/common/147 list of file sources/foo @@ -0,0 +1 @@ +some text diff --git a/test cases/common/147 list of file sources/gen.py b/test cases/common/147 list of file sources/gen.py new file mode 100644 index 0000000..2337d3d --- /dev/null +++ b/test cases/common/147 list of file sources/gen.py @@ -0,0 +1,7 @@ +import shutil +import sys + +if __name__ == '__main__': + if len(sys.argv) != 3: + raise Exception('Requires exactly 2 args') + shutil.copy2(sys.argv[1], sys.argv[2]) diff --git a/test cases/common/147 list of file sources/meson.build b/test cases/common/147 list of file sources/meson.build new file mode 100644 index 0000000..819509d --- /dev/null +++ b/test cases/common/147 list of file sources/meson.build @@ -0,0 +1,12 @@ +project('test', 'c') + +mod_py = import('python3') +python = mod_py.find_python() + +test_target = custom_target( + 'test_target', + input : [files('gen.py'), files('foo')], + output : 'bar', + command : [python, '@INPUT0@', '@INPUT1@', '@OUTPUT@'], + build_by_default : true, +) diff --git a/test cases/common/147 nested links/meson.build b/test cases/common/147 nested links/meson.build deleted file mode 100644 index 0821b03..0000000 --- a/test cases/common/147 nested links/meson.build +++ /dev/null @@ -1,8 +0,0 @@ -project('test', 'c') - -libxserver_dri3 = [] -libxserver = [ libxserver_dri3 ] - -executable('Xephyr', 'xephyr.c', link_with: [ libxserver ]) - -executable('Zephyr', 'xephyr.c', link_args: [[], []]) diff --git a/test cases/common/147 nested links/xephyr.c b/test cases/common/147 nested links/xephyr.c deleted file mode 100644 index 33c14ce..0000000 --- a/test cases/common/147 nested links/xephyr.c +++ /dev/null @@ -1,3 +0,0 @@ -int main() { - return 0; -} diff --git a/test cases/common/148 link depends custom target/foo.c b/test cases/common/148 link depends custom target/foo.c new file mode 100644 index 0000000..8700a9e --- /dev/null +++ b/test cases/common/148 link depends custom target/foo.c @@ -0,0 +1,15 @@ +#include + +int main() { + const char *fn = DEPFILE; + FILE *f = fopen(fn, "r"); + if (!f) { + printf("could not open %s", fn); + return 1; + } + else { + printf("successfully opened %s", fn); + } + + return 0; +} diff --git a/test cases/common/148 link depends custom target/make_file.py b/test cases/common/148 link depends custom target/make_file.py new file mode 100755 index 0000000..ceb6e19 --- /dev/null +++ b/test cases/common/148 link depends custom target/make_file.py @@ -0,0 +1,5 @@ +#!/usr/bin/env python3 +import sys + +with open(sys.argv[1], 'w') as f: + print('# this file does nothing', file=f) diff --git a/test cases/common/148 link depends custom target/meson.build b/test cases/common/148 link depends custom target/meson.build new file mode 100644 index 0000000..ee7a865 --- /dev/null +++ b/test cases/common/148 link depends custom target/meson.build @@ -0,0 +1,19 @@ +project('link_depends_custom_target', 'c') + +if meson.backend().startswith('vs') + # FIXME: Broken on the VS backends + error('MESON_SKIP_TEST see https://github.com/mesonbuild/meson/issues/1799') +endif + +cmd = find_program('make_file.py') + +dep_file = custom_target('gen_dep', + command: [cmd, '@OUTPUT@'], + output: 'dep_file') + +exe = executable('foo', 'foo.c', + link_depends: dep_file, + c_args: ['-DDEPFILE="' + dep_file.full_path()+ '"']) + +# check that dep_file exists, which means that link_depends target ran +test('runtest', exe) diff --git a/test cases/common/148 list of file sources/foo b/test cases/common/148 list of file sources/foo deleted file mode 100644 index 7b57bd2..0000000 --- a/test cases/common/148 list of file sources/foo +++ /dev/null @@ -1 +0,0 @@ -some text diff --git a/test cases/common/148 list of file sources/gen.py b/test cases/common/148 list of file sources/gen.py deleted file mode 100644 index 2337d3d..0000000 --- a/test cases/common/148 list of file sources/gen.py +++ /dev/null @@ -1,7 +0,0 @@ -import shutil -import sys - -if __name__ == '__main__': - if len(sys.argv) != 3: - raise Exception('Requires exactly 2 args') - shutil.copy2(sys.argv[1], sys.argv[2]) diff --git a/test cases/common/148 list of file sources/meson.build b/test cases/common/148 list of file sources/meson.build deleted file mode 100644 index 819509d..0000000 --- a/test cases/common/148 list of file sources/meson.build +++ /dev/null @@ -1,12 +0,0 @@ -project('test', 'c') - -mod_py = import('python3') -python = mod_py.find_python() - -test_target = custom_target( - 'test_target', - input : [files('gen.py'), files('foo')], - output : 'bar', - command : [python, '@INPUT0@', '@INPUT1@', '@OUTPUT@'], - build_by_default : true, -) diff --git a/test cases/common/149 link depends custom target/foo.c b/test cases/common/149 link depends custom target/foo.c deleted file mode 100644 index 8700a9e..0000000 --- a/test cases/common/149 link depends custom target/foo.c +++ /dev/null @@ -1,15 +0,0 @@ -#include - -int main() { - const char *fn = DEPFILE; - FILE *f = fopen(fn, "r"); - if (!f) { - printf("could not open %s", fn); - return 1; - } - else { - printf("successfully opened %s", fn); - } - - return 0; -} diff --git a/test cases/common/149 link depends custom target/make_file.py b/test cases/common/149 link depends custom target/make_file.py deleted file mode 100755 index ceb6e19..0000000 --- a/test cases/common/149 link depends custom target/make_file.py +++ /dev/null @@ -1,5 +0,0 @@ -#!/usr/bin/env python3 -import sys - -with open(sys.argv[1], 'w') as f: - print('# this file does nothing', file=f) diff --git a/test cases/common/149 link depends custom target/meson.build b/test cases/common/149 link depends custom target/meson.build deleted file mode 100644 index ee7a865..0000000 --- a/test cases/common/149 link depends custom target/meson.build +++ /dev/null @@ -1,19 +0,0 @@ -project('link_depends_custom_target', 'c') - -if meson.backend().startswith('vs') - # FIXME: Broken on the VS backends - error('MESON_SKIP_TEST see https://github.com/mesonbuild/meson/issues/1799') -endif - -cmd = find_program('make_file.py') - -dep_file = custom_target('gen_dep', - command: [cmd, '@OUTPUT@'], - output: 'dep_file') - -exe = executable('foo', 'foo.c', - link_depends: dep_file, - c_args: ['-DDEPFILE="' + dep_file.full_path()+ '"']) - -# check that dep_file exists, which means that link_depends target ran -test('runtest', exe) diff --git a/test cases/common/149 recursive linking/3rdorderdeps/lib.c.in b/test cases/common/149 recursive linking/3rdorderdeps/lib.c.in new file mode 100644 index 0000000..461f859 --- /dev/null +++ b/test cases/common/149 recursive linking/3rdorderdeps/lib.c.in @@ -0,0 +1,8 @@ +#include "../lib.h" + +int get_@DEPENDENCY@dep_value (void); + +SYMBOL_EXPORT +int get_@LIBTYPE@@DEPENDENCY@dep_value (void) { + return get_@DEPENDENCY@dep_value (); +} diff --git a/test cases/common/149 recursive linking/3rdorderdeps/main.c.in b/test cases/common/149 recursive linking/3rdorderdeps/main.c.in new file mode 100644 index 0000000..8155f35 --- /dev/null +++ b/test cases/common/149 recursive linking/3rdorderdeps/main.c.in @@ -0,0 +1,16 @@ +#include + +#include "../lib.h" + +SYMBOL_IMPORT int get_@LIBTYPE@@DEPENDENCY@dep_value (void); + +int main(int argc, char *argv[]) { + int val; + + val = get_@LIBTYPE@@DEPENDENCY@dep_value (); + if (val != @VALUE@) { + printf("@LIBTYPE@@DEPENDENCY@ was %i instead of @VALUE@\n", val); + return -1; + } + return 0; +} diff --git a/test cases/common/149 recursive linking/3rdorderdeps/meson.build b/test cases/common/149 recursive linking/3rdorderdeps/meson.build new file mode 100644 index 0000000..d4ef745 --- /dev/null +++ b/test cases/common/149 recursive linking/3rdorderdeps/meson.build @@ -0,0 +1,49 @@ +dep3_libs = [] + +# Permutate all combinations of shared and static libraries up to three levels +# executable -> shared -> static -> shared (etc) +foreach dep2 : ['sh', 'st'] + foreach dep1 : ['sh', 'st'] + foreach libtype : ['sh', 'st'] + name = libtype + dep1 + dep2 + if dep2 == 'sh' + libret = 1 + elif dep2 == 'st' + libret = 2 + else + error('Unknown dep2 "@0@"'.format(dep2)) + endif + + if libtype == 'sh' + target = 'shared_library' + build_args = [] + elif libtype == 'st' + target = 'static_library' + build_args = ['-DMESON_STATIC_BUILD'] + else + error('Unknown libtype "@0@"'.format(libtype)) + endif + + cdata = configuration_data() + cdata.set('DEPENDENCY', dep1 + dep2) + cdata.set('LIBTYPE', libtype) + cdata.set('VALUE', libret) + + lib_c = configure_file(input : 'lib.c.in', + output : name + '-lib.c', + configuration : cdata) + dep = get_variable(dep1 + dep2 + 'dep') + dep3_lib = build_target(name, lib_c, link_with : dep, + target_type : target, + c_args : build_args) + dep3_libs += [dep3_lib] + + main_c = configure_file(input : 'main.c.in', + output : name + '-main.c', + configuration : cdata) + dep3_bin = executable(name, main_c, link_with : dep3_lib, + c_args : build_args) + test(name + 'test', dep3_bin) + endforeach + endforeach +endforeach diff --git a/test cases/common/149 recursive linking/circular/lib1.c b/test cases/common/149 recursive linking/circular/lib1.c new file mode 100644 index 0000000..38889cf --- /dev/null +++ b/test cases/common/149 recursive linking/circular/lib1.c @@ -0,0 +1,6 @@ +int get_st2_prop (void); +int get_st3_prop (void); + +int get_st1_value (void) { + return get_st2_prop () + get_st3_prop (); +} diff --git a/test cases/common/149 recursive linking/circular/lib2.c b/test cases/common/149 recursive linking/circular/lib2.c new file mode 100644 index 0000000..31cd37c --- /dev/null +++ b/test cases/common/149 recursive linking/circular/lib2.c @@ -0,0 +1,6 @@ +int get_st1_prop (void); +int get_st3_prop (void); + +int get_st2_value (void) { + return get_st1_prop () + get_st3_prop (); +} diff --git a/test cases/common/149 recursive linking/circular/lib3.c b/test cases/common/149 recursive linking/circular/lib3.c new file mode 100644 index 0000000..67d473a --- /dev/null +++ b/test cases/common/149 recursive linking/circular/lib3.c @@ -0,0 +1,6 @@ +int get_st1_prop (void); +int get_st2_prop (void); + +int get_st3_value (void) { + return get_st1_prop () + get_st2_prop (); +} diff --git a/test cases/common/149 recursive linking/circular/main.c b/test cases/common/149 recursive linking/circular/main.c new file mode 100644 index 0000000..5f797a5 --- /dev/null +++ b/test cases/common/149 recursive linking/circular/main.c @@ -0,0 +1,28 @@ +#include + +#include "../lib.h" + +int get_st1_value (void); +int get_st2_value (void); +int get_st3_value (void); + +int main(int argc, char *argv[]) { + int val; + + val = get_st1_value (); + if (val != 5) { + printf("st1 value was %i instead of 5\n", val); + return -1; + } + val = get_st2_value (); + if (val != 4) { + printf("st2 value was %i instead of 4\n", val); + return -2; + } + val = get_st3_value (); + if (val != 3) { + printf("st3 value was %i instead of 3\n", val); + return -3; + } + return 0; +} diff --git a/test cases/common/149 recursive linking/circular/meson.build b/test cases/common/149 recursive linking/circular/meson.build new file mode 100644 index 0000000..b7a70a8 --- /dev/null +++ b/test cases/common/149 recursive linking/circular/meson.build @@ -0,0 +1,5 @@ +st1 = static_library('st1', 'lib1.c', 'prop1.c') +st2 = static_library('st2', 'lib2.c', 'prop2.c') +st3 = static_library('st3', 'lib3.c', 'prop3.c') + +test('circular', executable('circular', 'main.c', link_with : [st1, st2, st3])) diff --git a/test cases/common/149 recursive linking/circular/prop1.c b/test cases/common/149 recursive linking/circular/prop1.c new file mode 100644 index 0000000..4e571f5 --- /dev/null +++ b/test cases/common/149 recursive linking/circular/prop1.c @@ -0,0 +1,3 @@ +int get_st1_prop (void) { + return 1; +} diff --git a/test cases/common/149 recursive linking/circular/prop2.c b/test cases/common/149 recursive linking/circular/prop2.c new file mode 100644 index 0000000..ceabba0 --- /dev/null +++ b/test cases/common/149 recursive linking/circular/prop2.c @@ -0,0 +1,3 @@ +int get_st2_prop (void) { + return 2; +} diff --git a/test cases/common/149 recursive linking/circular/prop3.c b/test cases/common/149 recursive linking/circular/prop3.c new file mode 100644 index 0000000..246206c --- /dev/null +++ b/test cases/common/149 recursive linking/circular/prop3.c @@ -0,0 +1,3 @@ +int get_st3_prop (void) { + return 3; +} diff --git a/test cases/common/149 recursive linking/edge-cases/libsto.c b/test cases/common/149 recursive linking/edge-cases/libsto.c new file mode 100644 index 0000000..93f46a8 --- /dev/null +++ b/test cases/common/149 recursive linking/edge-cases/libsto.c @@ -0,0 +1,8 @@ +#include "../lib.h" + +int get_builto_value (void); + +SYMBOL_EXPORT +int get_stodep_value (void) { + return get_builto_value (); +} diff --git a/test cases/common/149 recursive linking/edge-cases/meson.build b/test cases/common/149 recursive linking/edge-cases/meson.build new file mode 100644 index 0000000..6a46266 --- /dev/null +++ b/test cases/common/149 recursive linking/edge-cases/meson.build @@ -0,0 +1,9 @@ +# Test https://github.com/mesonbuild/meson/issues/2096 +# Note that removing 'shnodep' from link_with: makes the error go away because +# then it is added after the static library is added to the link command. +test('shared-static', executable('shstexe', 'shstmain.c', link_with : [shnodep, stshdep])) + +# Static library that needs a symbol defined in an object file. This already +# works, but good to add a test case early. +stodep = static_library('stodep', 'libsto.c') +test('stodep', executable('stodep', 'stomain.c', 'stobuilt.c', link_with : stodep)) diff --git a/test cases/common/149 recursive linking/edge-cases/shstmain.c b/test cases/common/149 recursive linking/edge-cases/shstmain.c new file mode 100644 index 0000000..b44c55f --- /dev/null +++ b/test cases/common/149 recursive linking/edge-cases/shstmain.c @@ -0,0 +1,16 @@ +#include + +#include "../lib.h" + +int get_stshdep_value (void); + +int main(int argc, char *argv[]) { + int val; + + val = get_stshdep_value (); + if (val != 1) { + printf("st1 value was %i instead of 1\n", val); + return -1; + } + return 0; +} diff --git a/test cases/common/149 recursive linking/edge-cases/stobuilt.c b/test cases/common/149 recursive linking/edge-cases/stobuilt.c new file mode 100644 index 0000000..9cc15bc --- /dev/null +++ b/test cases/common/149 recursive linking/edge-cases/stobuilt.c @@ -0,0 +1,7 @@ +#include "../lib.h" + + +SYMBOL_EXPORT +int get_builto_value (void) { + return 1; +} diff --git a/test cases/common/149 recursive linking/edge-cases/stomain.c b/test cases/common/149 recursive linking/edge-cases/stomain.c new file mode 100644 index 0000000..90208a7 --- /dev/null +++ b/test cases/common/149 recursive linking/edge-cases/stomain.c @@ -0,0 +1,16 @@ +#include + +#include "../lib.h" + +int get_stodep_value (void); + +int main(int argc, char *argv[]) { + int val; + + val = get_stodep_value (); + if (val != 1) { + printf("st1 value was %i instead of 1\n", val); + return -1; + } + return 0; +} diff --git a/test cases/common/149 recursive linking/lib.h b/test cases/common/149 recursive linking/lib.h new file mode 100644 index 0000000..b54bf36 --- /dev/null +++ b/test cases/common/149 recursive linking/lib.h @@ -0,0 +1,17 @@ +#if defined _WIN32 + #ifdef MESON_STATIC_BUILD + #define SYMBOL_EXPORT + #define SYMBOL_IMPORT + #else + #define SYMBOL_IMPORT __declspec(dllimport) + #define SYMBOL_EXPORT __declspec(dllexport) + #endif +#else + #define SYMBOL_IMPORT + #if defined __GNUC__ + #define SYMBOL_EXPORT __attribute__ ((visibility("default"))) + #else + #pragma message ("Compiler does not support symbol visibility.") + #define SYMBOL_EXPORT + #endif +#endif diff --git a/test cases/common/149 recursive linking/main.c b/test cases/common/149 recursive linking/main.c new file mode 100644 index 0000000..0851611 --- /dev/null +++ b/test cases/common/149 recursive linking/main.c @@ -0,0 +1,46 @@ +#include + +#include "lib.h" + +int get_stnodep_value (void); +int get_stshdep_value (void); +int get_ststdep_value (void); +SYMBOL_IMPORT int get_shnodep_value (void); +SYMBOL_IMPORT int get_shshdep_value (void); +SYMBOL_IMPORT int get_shstdep_value (void); + +int main(int argc, char *argv[]) { + int val; + + val = get_shnodep_value (); + if (val != 1) { + printf("shnodep was %i instead of 1\n", val); + return -1; + } + val = get_stnodep_value (); + if (val != 2) { + printf("stnodep was %i instead of 2\n", val); + return -2; + } + val = get_shshdep_value (); + if (val != 1) { + printf("shshdep was %i instead of 1\n", val); + return -3; + } + val = get_shstdep_value (); + if (val != 2) { + printf("shstdep was %i instead of 2\n", val); + return -4; + } + val = get_stshdep_value (); + if (val != 1) { + printf("shstdep was %i instead of 1\n", val); + return -5; + } + val = get_ststdep_value (); + if (val != 2) { + printf("ststdep was %i instead of 2\n", val); + return -6; + } + return 0; +} diff --git a/test cases/common/149 recursive linking/meson.build b/test cases/common/149 recursive linking/meson.build new file mode 100644 index 0000000..2ca7151 --- /dev/null +++ b/test cases/common/149 recursive linking/meson.build @@ -0,0 +1,29 @@ +project('recursive dependencies', 'c') + +# Test that you can link a shared executable to: +# - A shared library with no other deps +subdir('shnodep') +# - A static library with no other deps +subdir('stnodep') +# - A shared library with a shared library dep +subdir('shshdep') +# - A shared library with a static library dep +subdir('shstdep') +# - A static library with a shared library dep +subdir('stshdep') +# - A static library with a static library dep +subdir('ststdep') + +test('alldeps', + executable('alldeps', 'main.c', + link_with : [shshdep, shstdep, ststdep, stshdep])) + +# More combinations of static and shared libraries +subdir('3rdorderdeps') + +# Circular dependencies between static libraries +# This requires the use of --start/end-group with GNU ld +subdir('circular') + +# Various edge cases that have been reported +subdir('edge-cases') diff --git a/test cases/common/149 recursive linking/shnodep/lib.c b/test cases/common/149 recursive linking/shnodep/lib.c new file mode 100644 index 0000000..a3b7993 --- /dev/null +++ b/test cases/common/149 recursive linking/shnodep/lib.c @@ -0,0 +1,6 @@ +#include "../lib.h" + +SYMBOL_EXPORT +int get_shnodep_value (void) { + return 1; +} diff --git a/test cases/common/149 recursive linking/shnodep/meson.build b/test cases/common/149 recursive linking/shnodep/meson.build new file mode 100644 index 0000000..66cfd9b --- /dev/null +++ b/test cases/common/149 recursive linking/shnodep/meson.build @@ -0,0 +1 @@ +shnodep = shared_library('shnodep', 'lib.c', version: '0.0.0') diff --git a/test cases/common/149 recursive linking/shshdep/lib.c b/test cases/common/149 recursive linking/shshdep/lib.c new file mode 100644 index 0000000..715d120 --- /dev/null +++ b/test cases/common/149 recursive linking/shshdep/lib.c @@ -0,0 +1,8 @@ +#include "../lib.h" + +int get_shnodep_value (void); + +SYMBOL_EXPORT +int get_shshdep_value (void) { + return get_shnodep_value (); +} diff --git a/test cases/common/149 recursive linking/shshdep/meson.build b/test cases/common/149 recursive linking/shshdep/meson.build new file mode 100644 index 0000000..020b481 --- /dev/null +++ b/test cases/common/149 recursive linking/shshdep/meson.build @@ -0,0 +1 @@ +shshdep = shared_library('shshdep', 'lib.c', link_with : shnodep) diff --git a/test cases/common/149 recursive linking/shstdep/lib.c b/test cases/common/149 recursive linking/shstdep/lib.c new file mode 100644 index 0000000..5da8d0b --- /dev/null +++ b/test cases/common/149 recursive linking/shstdep/lib.c @@ -0,0 +1,8 @@ +#include "../lib.h" + +int get_stnodep_value (void); + +SYMBOL_EXPORT +int get_shstdep_value (void) { + return get_stnodep_value (); +} diff --git a/test cases/common/149 recursive linking/shstdep/meson.build b/test cases/common/149 recursive linking/shstdep/meson.build new file mode 100644 index 0000000..008f9f8 --- /dev/null +++ b/test cases/common/149 recursive linking/shstdep/meson.build @@ -0,0 +1 @@ +shstdep = shared_library('shstdep', 'lib.c', link_with : stnodep) diff --git a/test cases/common/149 recursive linking/stnodep/lib.c b/test cases/common/149 recursive linking/stnodep/lib.c new file mode 100644 index 0000000..4bc50be --- /dev/null +++ b/test cases/common/149 recursive linking/stnodep/lib.c @@ -0,0 +1,6 @@ +#include "../lib.h" + +SYMBOL_EXPORT +int get_stnodep_value (void) { + return 2; +} diff --git a/test cases/common/149 recursive linking/stnodep/meson.build b/test cases/common/149 recursive linking/stnodep/meson.build new file mode 100644 index 0000000..77f7129 --- /dev/null +++ b/test cases/common/149 recursive linking/stnodep/meson.build @@ -0,0 +1,2 @@ +stnodep = static_library('stnodep', 'lib.c', + c_args : '-DMESON_STATIC_BUILD') diff --git a/test cases/common/149 recursive linking/stshdep/lib.c b/test cases/common/149 recursive linking/stshdep/lib.c new file mode 100644 index 0000000..3cfa12b --- /dev/null +++ b/test cases/common/149 recursive linking/stshdep/lib.c @@ -0,0 +1,8 @@ +#include "../lib.h" + +int get_shnodep_value (void); + +SYMBOL_EXPORT +int get_stshdep_value (void) { + return get_shnodep_value (); +} diff --git a/test cases/common/149 recursive linking/stshdep/meson.build b/test cases/common/149 recursive linking/stshdep/meson.build new file mode 100644 index 0000000..0967c1c --- /dev/null +++ b/test cases/common/149 recursive linking/stshdep/meson.build @@ -0,0 +1,2 @@ +stshdep = static_library('stshdep', 'lib.c', link_with : shnodep, + c_args : '-DMESON_STATIC_BUILD') diff --git a/test cases/common/149 recursive linking/ststdep/lib.c b/test cases/common/149 recursive linking/ststdep/lib.c new file mode 100644 index 0000000..fca8706 --- /dev/null +++ b/test cases/common/149 recursive linking/ststdep/lib.c @@ -0,0 +1,8 @@ +#include "../lib.h" + +int get_stnodep_value (void); + +SYMBOL_EXPORT +int get_ststdep_value (void) { + return get_stnodep_value (); +} diff --git a/test cases/common/149 recursive linking/ststdep/meson.build b/test cases/common/149 recursive linking/ststdep/meson.build new file mode 100644 index 0000000..3602442 --- /dev/null +++ b/test cases/common/149 recursive linking/ststdep/meson.build @@ -0,0 +1,2 @@ +ststdep = static_library('ststdep', 'lib.c', link_with : stnodep, + c_args : '-DMESON_STATIC_BUILD') diff --git a/test cases/common/150 library at root/lib.c b/test cases/common/150 library at root/lib.c new file mode 100644 index 0000000..a5b3dc3 --- /dev/null +++ b/test cases/common/150 library at root/lib.c @@ -0,0 +1,6 @@ +#if defined _WIN32 || defined __CYGWIN__ +__declspec(dllexport) +#endif +int fn(void) { + return -1; +} diff --git a/test cases/common/150 library at root/main/main.c b/test cases/common/150 library at root/main/main.c new file mode 100644 index 0000000..c4e1b4e --- /dev/null +++ b/test cases/common/150 library at root/main/main.c @@ -0,0 +1,5 @@ +extern int fn(void); + +int main() { + return 1 + fn(); +} diff --git a/test cases/common/150 library at root/main/meson.build b/test cases/common/150 library at root/main/meson.build new file mode 100644 index 0000000..557378a --- /dev/null +++ b/test cases/common/150 library at root/main/meson.build @@ -0,0 +1,2 @@ +exe = executable('main', 'main.c', link_with : lib) +test('stuff works', exe) diff --git a/test cases/common/150 library at root/meson.build b/test cases/common/150 library at root/meson.build new file mode 100644 index 0000000..bfdd869 --- /dev/null +++ b/test cases/common/150 library at root/meson.build @@ -0,0 +1,3 @@ +project('lib@root', 'c') +lib = shared_library('lib', 'lib.c') +subdir('main') diff --git a/test cases/common/150 recursive linking/3rdorderdeps/lib.c.in b/test cases/common/150 recursive linking/3rdorderdeps/lib.c.in deleted file mode 100644 index 461f859..0000000 --- a/test cases/common/150 recursive linking/3rdorderdeps/lib.c.in +++ /dev/null @@ -1,8 +0,0 @@ -#include "../lib.h" - -int get_@DEPENDENCY@dep_value (void); - -SYMBOL_EXPORT -int get_@LIBTYPE@@DEPENDENCY@dep_value (void) { - return get_@DEPENDENCY@dep_value (); -} diff --git a/test cases/common/150 recursive linking/3rdorderdeps/main.c.in b/test cases/common/150 recursive linking/3rdorderdeps/main.c.in deleted file mode 100644 index 8155f35..0000000 --- a/test cases/common/150 recursive linking/3rdorderdeps/main.c.in +++ /dev/null @@ -1,16 +0,0 @@ -#include - -#include "../lib.h" - -SYMBOL_IMPORT int get_@LIBTYPE@@DEPENDENCY@dep_value (void); - -int main(int argc, char *argv[]) { - int val; - - val = get_@LIBTYPE@@DEPENDENCY@dep_value (); - if (val != @VALUE@) { - printf("@LIBTYPE@@DEPENDENCY@ was %i instead of @VALUE@\n", val); - return -1; - } - return 0; -} diff --git a/test cases/common/150 recursive linking/3rdorderdeps/meson.build b/test cases/common/150 recursive linking/3rdorderdeps/meson.build deleted file mode 100644 index d4ef745..0000000 --- a/test cases/common/150 recursive linking/3rdorderdeps/meson.build +++ /dev/null @@ -1,49 +0,0 @@ -dep3_libs = [] - -# Permutate all combinations of shared and static libraries up to three levels -# executable -> shared -> static -> shared (etc) -foreach dep2 : ['sh', 'st'] - foreach dep1 : ['sh', 'st'] - foreach libtype : ['sh', 'st'] - name = libtype + dep1 + dep2 - if dep2 == 'sh' - libret = 1 - elif dep2 == 'st' - libret = 2 - else - error('Unknown dep2 "@0@"'.format(dep2)) - endif - - if libtype == 'sh' - target = 'shared_library' - build_args = [] - elif libtype == 'st' - target = 'static_library' - build_args = ['-DMESON_STATIC_BUILD'] - else - error('Unknown libtype "@0@"'.format(libtype)) - endif - - cdata = configuration_data() - cdata.set('DEPENDENCY', dep1 + dep2) - cdata.set('LIBTYPE', libtype) - cdata.set('VALUE', libret) - - lib_c = configure_file(input : 'lib.c.in', - output : name + '-lib.c', - configuration : cdata) - dep = get_variable(dep1 + dep2 + 'dep') - dep3_lib = build_target(name, lib_c, link_with : dep, - target_type : target, - c_args : build_args) - dep3_libs += [dep3_lib] - - main_c = configure_file(input : 'main.c.in', - output : name + '-main.c', - configuration : cdata) - dep3_bin = executable(name, main_c, link_with : dep3_lib, - c_args : build_args) - test(name + 'test', dep3_bin) - endforeach - endforeach -endforeach diff --git a/test cases/common/150 recursive linking/circular/lib1.c b/test cases/common/150 recursive linking/circular/lib1.c deleted file mode 100644 index 38889cf..0000000 --- a/test cases/common/150 recursive linking/circular/lib1.c +++ /dev/null @@ -1,6 +0,0 @@ -int get_st2_prop (void); -int get_st3_prop (void); - -int get_st1_value (void) { - return get_st2_prop () + get_st3_prop (); -} diff --git a/test cases/common/150 recursive linking/circular/lib2.c b/test cases/common/150 recursive linking/circular/lib2.c deleted file mode 100644 index 31cd37c..0000000 --- a/test cases/common/150 recursive linking/circular/lib2.c +++ /dev/null @@ -1,6 +0,0 @@ -int get_st1_prop (void); -int get_st3_prop (void); - -int get_st2_value (void) { - return get_st1_prop () + get_st3_prop (); -} diff --git a/test cases/common/150 recursive linking/circular/lib3.c b/test cases/common/150 recursive linking/circular/lib3.c deleted file mode 100644 index 67d473a..0000000 --- a/test cases/common/150 recursive linking/circular/lib3.c +++ /dev/null @@ -1,6 +0,0 @@ -int get_st1_prop (void); -int get_st2_prop (void); - -int get_st3_value (void) { - return get_st1_prop () + get_st2_prop (); -} diff --git a/test cases/common/150 recursive linking/circular/main.c b/test cases/common/150 recursive linking/circular/main.c deleted file mode 100644 index 5f797a5..0000000 --- a/test cases/common/150 recursive linking/circular/main.c +++ /dev/null @@ -1,28 +0,0 @@ -#include - -#include "../lib.h" - -int get_st1_value (void); -int get_st2_value (void); -int get_st3_value (void); - -int main(int argc, char *argv[]) { - int val; - - val = get_st1_value (); - if (val != 5) { - printf("st1 value was %i instead of 5\n", val); - return -1; - } - val = get_st2_value (); - if (val != 4) { - printf("st2 value was %i instead of 4\n", val); - return -2; - } - val = get_st3_value (); - if (val != 3) { - printf("st3 value was %i instead of 3\n", val); - return -3; - } - return 0; -} diff --git a/test cases/common/150 recursive linking/circular/meson.build b/test cases/common/150 recursive linking/circular/meson.build deleted file mode 100644 index b7a70a8..0000000 --- a/test cases/common/150 recursive linking/circular/meson.build +++ /dev/null @@ -1,5 +0,0 @@ -st1 = static_library('st1', 'lib1.c', 'prop1.c') -st2 = static_library('st2', 'lib2.c', 'prop2.c') -st3 = static_library('st3', 'lib3.c', 'prop3.c') - -test('circular', executable('circular', 'main.c', link_with : [st1, st2, st3])) diff --git a/test cases/common/150 recursive linking/circular/prop1.c b/test cases/common/150 recursive linking/circular/prop1.c deleted file mode 100644 index 4e571f5..0000000 --- a/test cases/common/150 recursive linking/circular/prop1.c +++ /dev/null @@ -1,3 +0,0 @@ -int get_st1_prop (void) { - return 1; -} diff --git a/test cases/common/150 recursive linking/circular/prop2.c b/test cases/common/150 recursive linking/circular/prop2.c deleted file mode 100644 index ceabba0..0000000 --- a/test cases/common/150 recursive linking/circular/prop2.c +++ /dev/null @@ -1,3 +0,0 @@ -int get_st2_prop (void) { - return 2; -} diff --git a/test cases/common/150 recursive linking/circular/prop3.c b/test cases/common/150 recursive linking/circular/prop3.c deleted file mode 100644 index 246206c..0000000 --- a/test cases/common/150 recursive linking/circular/prop3.c +++ /dev/null @@ -1,3 +0,0 @@ -int get_st3_prop (void) { - return 3; -} diff --git a/test cases/common/150 recursive linking/edge-cases/libsto.c b/test cases/common/150 recursive linking/edge-cases/libsto.c deleted file mode 100644 index 93f46a8..0000000 --- a/test cases/common/150 recursive linking/edge-cases/libsto.c +++ /dev/null @@ -1,8 +0,0 @@ -#include "../lib.h" - -int get_builto_value (void); - -SYMBOL_EXPORT -int get_stodep_value (void) { - return get_builto_value (); -} diff --git a/test cases/common/150 recursive linking/edge-cases/meson.build b/test cases/common/150 recursive linking/edge-cases/meson.build deleted file mode 100644 index 6a46266..0000000 --- a/test cases/common/150 recursive linking/edge-cases/meson.build +++ /dev/null @@ -1,9 +0,0 @@ -# Test https://github.com/mesonbuild/meson/issues/2096 -# Note that removing 'shnodep' from link_with: makes the error go away because -# then it is added after the static library is added to the link command. -test('shared-static', executable('shstexe', 'shstmain.c', link_with : [shnodep, stshdep])) - -# Static library that needs a symbol defined in an object file. This already -# works, but good to add a test case early. -stodep = static_library('stodep', 'libsto.c') -test('stodep', executable('stodep', 'stomain.c', 'stobuilt.c', link_with : stodep)) diff --git a/test cases/common/150 recursive linking/edge-cases/shstmain.c b/test cases/common/150 recursive linking/edge-cases/shstmain.c deleted file mode 100644 index b44c55f..0000000 --- a/test cases/common/150 recursive linking/edge-cases/shstmain.c +++ /dev/null @@ -1,16 +0,0 @@ -#include - -#include "../lib.h" - -int get_stshdep_value (void); - -int main(int argc, char *argv[]) { - int val; - - val = get_stshdep_value (); - if (val != 1) { - printf("st1 value was %i instead of 1\n", val); - return -1; - } - return 0; -} diff --git a/test cases/common/150 recursive linking/edge-cases/stobuilt.c b/test cases/common/150 recursive linking/edge-cases/stobuilt.c deleted file mode 100644 index 9cc15bc..0000000 --- a/test cases/common/150 recursive linking/edge-cases/stobuilt.c +++ /dev/null @@ -1,7 +0,0 @@ -#include "../lib.h" - - -SYMBOL_EXPORT -int get_builto_value (void) { - return 1; -} diff --git a/test cases/common/150 recursive linking/edge-cases/stomain.c b/test cases/common/150 recursive linking/edge-cases/stomain.c deleted file mode 100644 index 90208a7..0000000 --- a/test cases/common/150 recursive linking/edge-cases/stomain.c +++ /dev/null @@ -1,16 +0,0 @@ -#include - -#include "../lib.h" - -int get_stodep_value (void); - -int main(int argc, char *argv[]) { - int val; - - val = get_stodep_value (); - if (val != 1) { - printf("st1 value was %i instead of 1\n", val); - return -1; - } - return 0; -} diff --git a/test cases/common/150 recursive linking/lib.h b/test cases/common/150 recursive linking/lib.h deleted file mode 100644 index b54bf36..0000000 --- a/test cases/common/150 recursive linking/lib.h +++ /dev/null @@ -1,17 +0,0 @@ -#if defined _WIN32 - #ifdef MESON_STATIC_BUILD - #define SYMBOL_EXPORT - #define SYMBOL_IMPORT - #else - #define SYMBOL_IMPORT __declspec(dllimport) - #define SYMBOL_EXPORT __declspec(dllexport) - #endif -#else - #define SYMBOL_IMPORT - #if defined __GNUC__ - #define SYMBOL_EXPORT __attribute__ ((visibility("default"))) - #else - #pragma message ("Compiler does not support symbol visibility.") - #define SYMBOL_EXPORT - #endif -#endif diff --git a/test cases/common/150 recursive linking/main.c b/test cases/common/150 recursive linking/main.c deleted file mode 100644 index 0851611..0000000 --- a/test cases/common/150 recursive linking/main.c +++ /dev/null @@ -1,46 +0,0 @@ -#include - -#include "lib.h" - -int get_stnodep_value (void); -int get_stshdep_value (void); -int get_ststdep_value (void); -SYMBOL_IMPORT int get_shnodep_value (void); -SYMBOL_IMPORT int get_shshdep_value (void); -SYMBOL_IMPORT int get_shstdep_value (void); - -int main(int argc, char *argv[]) { - int val; - - val = get_shnodep_value (); - if (val != 1) { - printf("shnodep was %i instead of 1\n", val); - return -1; - } - val = get_stnodep_value (); - if (val != 2) { - printf("stnodep was %i instead of 2\n", val); - return -2; - } - val = get_shshdep_value (); - if (val != 1) { - printf("shshdep was %i instead of 1\n", val); - return -3; - } - val = get_shstdep_value (); - if (val != 2) { - printf("shstdep was %i instead of 2\n", val); - return -4; - } - val = get_stshdep_value (); - if (val != 1) { - printf("shstdep was %i instead of 1\n", val); - return -5; - } - val = get_ststdep_value (); - if (val != 2) { - printf("ststdep was %i instead of 2\n", val); - return -6; - } - return 0; -} diff --git a/test cases/common/150 recursive linking/meson.build b/test cases/common/150 recursive linking/meson.build deleted file mode 100644 index 2ca7151..0000000 --- a/test cases/common/150 recursive linking/meson.build +++ /dev/null @@ -1,29 +0,0 @@ -project('recursive dependencies', 'c') - -# Test that you can link a shared executable to: -# - A shared library with no other deps -subdir('shnodep') -# - A static library with no other deps -subdir('stnodep') -# - A shared library with a shared library dep -subdir('shshdep') -# - A shared library with a static library dep -subdir('shstdep') -# - A static library with a shared library dep -subdir('stshdep') -# - A static library with a static library dep -subdir('ststdep') - -test('alldeps', - executable('alldeps', 'main.c', - link_with : [shshdep, shstdep, ststdep, stshdep])) - -# More combinations of static and shared libraries -subdir('3rdorderdeps') - -# Circular dependencies between static libraries -# This requires the use of --start/end-group with GNU ld -subdir('circular') - -# Various edge cases that have been reported -subdir('edge-cases') diff --git a/test cases/common/150 recursive linking/shnodep/lib.c b/test cases/common/150 recursive linking/shnodep/lib.c deleted file mode 100644 index a3b7993..0000000 --- a/test cases/common/150 recursive linking/shnodep/lib.c +++ /dev/null @@ -1,6 +0,0 @@ -#include "../lib.h" - -SYMBOL_EXPORT -int get_shnodep_value (void) { - return 1; -} diff --git a/test cases/common/150 recursive linking/shnodep/meson.build b/test cases/common/150 recursive linking/shnodep/meson.build deleted file mode 100644 index 66cfd9b..0000000 --- a/test cases/common/150 recursive linking/shnodep/meson.build +++ /dev/null @@ -1 +0,0 @@ -shnodep = shared_library('shnodep', 'lib.c', version: '0.0.0') diff --git a/test cases/common/150 recursive linking/shshdep/lib.c b/test cases/common/150 recursive linking/shshdep/lib.c deleted file mode 100644 index 715d120..0000000 --- a/test cases/common/150 recursive linking/shshdep/lib.c +++ /dev/null @@ -1,8 +0,0 @@ -#include "../lib.h" - -int get_shnodep_value (void); - -SYMBOL_EXPORT -int get_shshdep_value (void) { - return get_shnodep_value (); -} diff --git a/test cases/common/150 recursive linking/shshdep/meson.build b/test cases/common/150 recursive linking/shshdep/meson.build deleted file mode 100644 index 020b481..0000000 --- a/test cases/common/150 recursive linking/shshdep/meson.build +++ /dev/null @@ -1 +0,0 @@ -shshdep = shared_library('shshdep', 'lib.c', link_with : shnodep) diff --git a/test cases/common/150 recursive linking/shstdep/lib.c b/test cases/common/150 recursive linking/shstdep/lib.c deleted file mode 100644 index 5da8d0b..0000000 --- a/test cases/common/150 recursive linking/shstdep/lib.c +++ /dev/null @@ -1,8 +0,0 @@ -#include "../lib.h" - -int get_stnodep_value (void); - -SYMBOL_EXPORT -int get_shstdep_value (void) { - return get_stnodep_value (); -} diff --git a/test cases/common/150 recursive linking/shstdep/meson.build b/test cases/common/150 recursive linking/shstdep/meson.build deleted file mode 100644 index 008f9f8..0000000 --- a/test cases/common/150 recursive linking/shstdep/meson.build +++ /dev/null @@ -1 +0,0 @@ -shstdep = shared_library('shstdep', 'lib.c', link_with : stnodep) diff --git a/test cases/common/150 recursive linking/stnodep/lib.c b/test cases/common/150 recursive linking/stnodep/lib.c deleted file mode 100644 index 4bc50be..0000000 --- a/test cases/common/150 recursive linking/stnodep/lib.c +++ /dev/null @@ -1,6 +0,0 @@ -#include "../lib.h" - -SYMBOL_EXPORT -int get_stnodep_value (void) { - return 2; -} diff --git a/test cases/common/150 recursive linking/stnodep/meson.build b/test cases/common/150 recursive linking/stnodep/meson.build deleted file mode 100644 index 77f7129..0000000 --- a/test cases/common/150 recursive linking/stnodep/meson.build +++ /dev/null @@ -1,2 +0,0 @@ -stnodep = static_library('stnodep', 'lib.c', - c_args : '-DMESON_STATIC_BUILD') diff --git a/test cases/common/150 recursive linking/stshdep/lib.c b/test cases/common/150 recursive linking/stshdep/lib.c deleted file mode 100644 index 3cfa12b..0000000 --- a/test cases/common/150 recursive linking/stshdep/lib.c +++ /dev/null @@ -1,8 +0,0 @@ -#include "../lib.h" - -int get_shnodep_value (void); - -SYMBOL_EXPORT -int get_stshdep_value (void) { - return get_shnodep_value (); -} diff --git a/test cases/common/150 recursive linking/stshdep/meson.build b/test cases/common/150 recursive linking/stshdep/meson.build deleted file mode 100644 index 0967c1c..0000000 --- a/test cases/common/150 recursive linking/stshdep/meson.build +++ /dev/null @@ -1,2 +0,0 @@ -stshdep = static_library('stshdep', 'lib.c', link_with : shnodep, - c_args : '-DMESON_STATIC_BUILD') diff --git a/test cases/common/150 recursive linking/ststdep/lib.c b/test cases/common/150 recursive linking/ststdep/lib.c deleted file mode 100644 index fca8706..0000000 --- a/test cases/common/150 recursive linking/ststdep/lib.c +++ /dev/null @@ -1,8 +0,0 @@ -#include "../lib.h" - -int get_stnodep_value (void); - -SYMBOL_EXPORT -int get_ststdep_value (void) { - return get_stnodep_value (); -} diff --git a/test cases/common/150 recursive linking/ststdep/meson.build b/test cases/common/150 recursive linking/ststdep/meson.build deleted file mode 100644 index 3602442..0000000 --- a/test cases/common/150 recursive linking/ststdep/meson.build +++ /dev/null @@ -1,2 +0,0 @@ -ststdep = static_library('ststdep', 'lib.c', link_with : stnodep, - c_args : '-DMESON_STATIC_BUILD') diff --git a/test cases/common/151 library at root/lib.c b/test cases/common/151 library at root/lib.c deleted file mode 100644 index a5b3dc3..0000000 --- a/test cases/common/151 library at root/lib.c +++ /dev/null @@ -1,6 +0,0 @@ -#if defined _WIN32 || defined __CYGWIN__ -__declspec(dllexport) -#endif -int fn(void) { - return -1; -} diff --git a/test cases/common/151 library at root/main/main.c b/test cases/common/151 library at root/main/main.c deleted file mode 100644 index c4e1b4e..0000000 --- a/test cases/common/151 library at root/main/main.c +++ /dev/null @@ -1,5 +0,0 @@ -extern int fn(void); - -int main() { - return 1 + fn(); -} diff --git a/test cases/common/151 library at root/main/meson.build b/test cases/common/151 library at root/main/meson.build deleted file mode 100644 index 557378a..0000000 --- a/test cases/common/151 library at root/main/meson.build +++ /dev/null @@ -1,2 +0,0 @@ -exe = executable('main', 'main.c', link_with : lib) -test('stuff works', exe) diff --git a/test cases/common/151 library at root/meson.build b/test cases/common/151 library at root/meson.build deleted file mode 100644 index bfdd869..0000000 --- a/test cases/common/151 library at root/meson.build +++ /dev/null @@ -1,3 +0,0 @@ -project('lib@root', 'c') -lib = shared_library('lib', 'lib.c') -subdir('main') diff --git a/test cases/common/151 simd/fallback.c b/test cases/common/151 simd/fallback.c new file mode 100644 index 0000000..ab435f4 --- /dev/null +++ b/test cases/common/151 simd/fallback.c @@ -0,0 +1,8 @@ +#include + +void increment_fallback(float arr[4]) { + int i; + for(i=0; i<4; i++) { + arr[i]++; + } +} diff --git a/test cases/common/151 simd/include/simdheader.h b/test cases/common/151 simd/include/simdheader.h new file mode 100644 index 0000000..6515e41 --- /dev/null +++ b/test cases/common/151 simd/include/simdheader.h @@ -0,0 +1,3 @@ +#pragma once + +#define I_CAN_HAZ_SIMD diff --git a/test cases/common/151 simd/meson.build b/test cases/common/151 simd/meson.build new file mode 100644 index 0000000..2628a12 --- /dev/null +++ b/test cases/common/151 simd/meson.build @@ -0,0 +1,44 @@ +project('simd', 'c') + +simd = import('unstable-simd') + +cc = meson.get_compiler('c') + +cdata = configuration_data() + +if not meson.is_cross_build() and host_machine.cpu_family() == 'arm' and cc.get_id() == 'clang' + message('Adding -march=armv7 because assuming that this build happens on Raspbian.') + message('Its Clang seems to be misconfigured and does not support NEON by default.') + add_project_arguments('-march=armv7', language : 'c') +endif + +if cc.get_id() == 'msvc' and cc.version().version_compare('<17') + error('MESON_SKIP_TEST VS2010 produces broken binaries on x86.') +endif + +# FIXME add [a, b] = function() +rval = simd.check('mysimds', + mmx : 'simd_mmx.c', + sse : 'simd_sse.c', + sse2 : 'simd_sse2.c', + sse3 : 'simd_sse3.c', + ssse3 : 'simd_ssse3.c', + sse41 : 'simd_sse41.c', + sse42 : 'simd_sse42.c', + avx : 'simd_avx.c', + avx2 : 'simd_avx2.c', + neon : 'simd_neon.c', + compiler : cc, + include_directories : include_directories('include')) + +simdlibs = rval[0] +cdata.merge_from(rval[1]) + +configure_file(output : 'simdconfig.h', + configuration : cdata) + +p = executable('simdtest', 'simdchecker.c', 'fallback.c', + link_with : simdlibs) + +test('simdtest', p) + diff --git a/test cases/common/151 simd/simd_avx.c b/test cases/common/151 simd/simd_avx.c new file mode 100644 index 0000000..1c84dae --- /dev/null +++ b/test cases/common/151 simd/simd_avx.c @@ -0,0 +1,49 @@ +#include + +#ifndef I_CAN_HAZ_SIMD +#error The correct internal header was not used +#endif + +#include +#include +#include + +#ifdef _MSC_VER +#include +int avx_available() { + return 1; +} +#else +#include +#include + +#ifdef __APPLE__ +/* + * Apple ships a broken __builtin_cpu_supports and + * some machines in the CI farm seem to be too + * old to have AVX so just always return 0 here. + */ +int avx_available() { return 0; } +#else + +int avx_available() { + return __builtin_cpu_supports("avx"); +} +#endif +#endif + +void increment_avx(float arr[4]) { + double darr[4]; + darr[0] = arr[0]; + darr[1] = arr[1]; + darr[2] = arr[2]; + darr[3] = arr[3]; + __m256d val = _mm256_loadu_pd(darr); + __m256d one = _mm256_set1_pd(1.0); + __m256d result = _mm256_add_pd(val, one); + _mm256_storeu_pd(darr, result); + arr[0] = (float)darr[0]; + arr[1] = (float)darr[1]; + arr[2] = (float)darr[2]; + arr[3] = (float)darr[3]; +} diff --git a/test cases/common/151 simd/simd_avx2.c b/test cases/common/151 simd/simd_avx2.c new file mode 100644 index 0000000..15297eb --- /dev/null +++ b/test cases/common/151 simd/simd_avx2.c @@ -0,0 +1,42 @@ +#include +#include +#include + +/* + * FIXME add proper runtime detection for VS. + */ + +#ifdef _MSC_VER +#include +int avx2_available() { + return 0; +} +#else +#include +#include + +#if defined(__APPLE__) +int avx2_available() { return 0; } +#else +int avx2_available() { + return __builtin_cpu_supports("avx2"); +} +#endif +#endif + +void increment_avx2(float arr[4]) { + double darr[4]; + darr[0] = arr[0]; + darr[1] = arr[1]; + darr[2] = arr[2]; + darr[3] = arr[3]; + __m256d val = _mm256_loadu_pd(darr); + __m256d one = _mm256_set1_pd(1.0); + __m256d result = _mm256_add_pd(val, one); + _mm256_storeu_pd(darr, result); + one = _mm256_permute4x64_pd(one, 66); /* A no-op, just here to use AVX2. */ + arr[0] = (float)darr[0]; + arr[1] = (float)darr[1]; + arr[2] = (float)darr[2]; + arr[3] = (float)darr[3]; +} diff --git a/test cases/common/151 simd/simd_mmx.c b/test cases/common/151 simd/simd_mmx.c new file mode 100644 index 0000000..528ed3c --- /dev/null +++ b/test cases/common/151 simd/simd_mmx.c @@ -0,0 +1,67 @@ +#include +#include + +#include + +#ifdef _MSC_VER +#include +int mmx_available() { + return 1; +} +/* Contrary to MSDN documentation, MMX intrinsics + * just plain don't work. + */ +void increment_mmx(float arr[4]) { + arr[0]++; + arr[1]++; + arr[2]++; + arr[3]++; +} +#elif defined(__MINGW32__) +int mmx_available() { + return 1; +} +/* MinGW does not seem to ship with MMX or it is broken. + */ +void increment_mmx(float arr[4]) { + arr[0]++; + arr[1]++; + arr[2]++; + arr[3]++; +} +#else +#include +#include + +#if defined(__APPLE__) +int mmx_available() { return 1; } +#else +int mmx_available() { + return __builtin_cpu_supports("mmx"); +} +#endif +void increment_mmx(float arr[4]) { + /* Super ugly but we know that values in arr are always small + * enough to fit in int16; + */ + int i; + __m64 packed = _mm_set_pi16(arr[3], arr[2], arr[1], arr[0]); + __m64 incr = _mm_set1_pi16(1); + __m64 result = _mm_add_pi16(packed, incr); + /* Should be + * int64_t unpacker = _m_to_int64(result); + * but it does not exist on 32 bit platforms for some reason. + */ + int64_t unpacker = (int64_t)(result); + _mm_empty(); + for(i=0; i<4; i++) { + /* This fails on GCC 8 when optimizations are enabled. + * Disable it. Patches welcome to fix this. + arr[i] = (float)(unpacker & ((1<<16)-1)); + unpacker >>= 16; + */ + arr[i] += 1.0f; + } +} + +#endif diff --git a/test cases/common/151 simd/simd_neon.c b/test cases/common/151 simd/simd_neon.c new file mode 100644 index 0000000..2082099 --- /dev/null +++ b/test cases/common/151 simd/simd_neon.c @@ -0,0 +1,20 @@ +#include +#include + +#include +#include + +int neon_available() { + return 1; /* Incorrect, but I don't know how to check this properly. */ +} + +void increment_neon(float arr[4]) { + float32x2_t a1, a2, one; + a1 = vld1_f32(arr); + a2 = vld1_f32(&arr[2]); + one = vdup_n_f32(1.0); + a1 = vadd_f32(a1, one); + a2 = vadd_f32(a2, one); + vst1_f32(arr, a1); + vst1_f32(&arr[2], a2); +} diff --git a/test cases/common/151 simd/simd_sse.c b/test cases/common/151 simd/simd_sse.c new file mode 100644 index 0000000..3c9fe62 --- /dev/null +++ b/test cases/common/151 simd/simd_sse.c @@ -0,0 +1,29 @@ +#include +#include + +#ifdef _MSC_VER +#include +int sse_available() { + return 1; +} +#else + +#include +#include +#include + +#if defined(__APPLE__) +int sse_available() { return 1; } +#else +int sse_available() { + return __builtin_cpu_supports("sse"); +} +#endif +#endif + +void increment_sse(float arr[4]) { + __m128 val = _mm_load_ps(arr); + __m128 one = _mm_set_ps1(1.0); + __m128 result = _mm_add_ps(val, one); + _mm_storeu_ps(arr, result); +} diff --git a/test cases/common/151 simd/simd_sse2.c b/test cases/common/151 simd/simd_sse2.c new file mode 100644 index 0000000..271022e --- /dev/null +++ b/test cases/common/151 simd/simd_sse2.c @@ -0,0 +1,37 @@ +#include +#include +#include + +#ifdef _MSC_VER +int sse2_available() { + return 1; +} + +#else +#include +#include + +#if defined(__APPLE__) +int sse2_available() { return 1; } +#else +int sse2_available() { + return __builtin_cpu_supports("sse2"); +} +#endif +#endif + +void increment_sse2(float arr[4]) { + ALIGN_16 double darr[4]; + __m128d val1 = _mm_set_pd(arr[0], arr[1]); + __m128d val2 = _mm_set_pd(arr[2], arr[3]); + __m128d one = _mm_set_pd(1.0, 1.0); + __m128d result = _mm_add_pd(val1, one); + _mm_store_pd(darr, result); + result = _mm_add_pd(val2, one); + _mm_store_pd(&darr[2], result); + arr[0] = (float)darr[1]; + arr[1] = (float)darr[0]; + arr[2] = (float)darr[3]; + arr[3] = (float)darr[2]; +} + diff --git a/test cases/common/151 simd/simd_sse3.c b/test cases/common/151 simd/simd_sse3.c new file mode 100644 index 0000000..89c2f8b --- /dev/null +++ b/test cases/common/151 simd/simd_sse3.c @@ -0,0 +1,38 @@ +#include +#include + +#ifdef _MSC_VER +#include +int sse3_available() { + return 1; +} +#else + +#include +#include +#include + +#if defined(__APPLE__) +int sse3_available() { return 1; } +#else +int sse3_available() { + return __builtin_cpu_supports("sse3"); +} +#endif +#endif + +void increment_sse3(float arr[4]) { + ALIGN_16 double darr[4]; + __m128d val1 = _mm_set_pd(arr[0], arr[1]); + __m128d val2 = _mm_set_pd(arr[2], arr[3]); + __m128d one = _mm_set_pd(1.0, 1.0); + __m128d result = _mm_add_pd(val1, one); + _mm_store_pd(darr, result); + result = _mm_add_pd(val2, one); + _mm_store_pd(&darr[2], result); + result = _mm_hadd_pd(val1, val2); /* This does nothing. Only here so we use an SSE3 instruction. */ + arr[0] = (float)darr[1]; + arr[1] = (float)darr[0]; + arr[2] = (float)darr[3]; + arr[3] = (float)darr[2]; +} diff --git a/test cases/common/151 simd/simd_sse41.c b/test cases/common/151 simd/simd_sse41.c new file mode 100644 index 0000000..859fb43 --- /dev/null +++ b/test cases/common/151 simd/simd_sse41.c @@ -0,0 +1,40 @@ +#include +#include + +#include + +#ifdef _MSC_VER +#include + +int sse41_available() { + return 1; +} + +#else +#include +#include + +#if defined(__APPLE__) +int sse41_available() { return 1; } +#else +int sse41_available() { + return __builtin_cpu_supports("sse4.1"); +} +#endif +#endif + +void increment_sse41(float arr[4]) { + ALIGN_16 double darr[4]; + __m128d val1 = _mm_set_pd(arr[0], arr[1]); + __m128d val2 = _mm_set_pd(arr[2], arr[3]); + __m128d one = _mm_set_pd(1.0, 1.0); + __m128d result = _mm_add_pd(val1, one); + result = _mm_ceil_pd(result); /* A no-op, only here to use a SSE4.1 intrinsic. */ + _mm_store_pd(darr, result); + result = _mm_add_pd(val2, one); + _mm_store_pd(&darr[2], result); + arr[0] = (float)darr[1]; + arr[1] = (float)darr[0]; + arr[2] = (float)darr[3]; + arr[3] = (float)darr[2]; +} diff --git a/test cases/common/151 simd/simd_sse42.c b/test cases/common/151 simd/simd_sse42.c new file mode 100644 index 0000000..edd6e5b --- /dev/null +++ b/test cases/common/151 simd/simd_sse42.c @@ -0,0 +1,43 @@ +#include +#include +#include + +#ifdef _MSC_VER +#include + +int sse42_available() { + return 1; +} + +#else + +#include +#include + +#ifdef __APPLE__ +int sse42_available() { + return 1; +} +#else +int sse42_available() { + return __builtin_cpu_supports("sse4.2"); +} +#endif + +#endif + +void increment_sse42(float arr[4]) { + ALIGN_16 double darr[4]; + __m128d val1 = _mm_set_pd(arr[0], arr[1]); + __m128d val2 = _mm_set_pd(arr[2], arr[3]); + __m128d one = _mm_set_pd(1.0, 1.0); + __m128d result = _mm_add_pd(val1, one); + _mm_store_pd(darr, result); + result = _mm_add_pd(val2, one); + _mm_store_pd(&darr[2], result); + _mm_crc32_u32(42, 99); /* A no-op, only here to use an SSE4.2 instruction. */ + arr[0] = (float)darr[1]; + arr[1] = (float)darr[0]; + arr[2] = (float)darr[3]; + arr[3] = (float)darr[2]; +} diff --git a/test cases/common/151 simd/simd_ssse3.c b/test cases/common/151 simd/simd_ssse3.c new file mode 100644 index 0000000..0156f77 --- /dev/null +++ b/test cases/common/151 simd/simd_ssse3.c @@ -0,0 +1,48 @@ +#include +#include + +#include +#include + +#ifdef _MSC_VER +#include + +int ssse3_available() { + return 1; +} + +#else + +#include +#include + +int ssse3_available() { +#ifdef __APPLE__ + return 1; +#elif defined(__clang__) + /* https://github.com/numpy/numpy/issues/8130 */ + return __builtin_cpu_supports("sse4.1"); +#else + return __builtin_cpu_supports("ssse3"); +#endif +} + +#endif + +void increment_ssse3(float arr[4]) { + ALIGN_16 double darr[4]; + __m128d val1 = _mm_set_pd(arr[0], arr[1]); + __m128d val2 = _mm_set_pd(arr[2], arr[3]); + __m128d one = _mm_set_pd(1.0, 1.0); + __m128d result = _mm_add_pd(val1, one); + __m128i tmp1, tmp2; + tmp1 = tmp2 = _mm_set1_epi16(0); + _mm_store_pd(darr, result); + result = _mm_add_pd(val2, one); + _mm_store_pd(&darr[2], result); + tmp1 = _mm_hadd_epi32(tmp1, tmp2); /* This does nothing. Only here so we use an SSSE3 instruction. */ + arr[0] = (float)darr[1]; + arr[1] = (float)darr[0]; + arr[2] = (float)darr[3]; + arr[3] = (float)darr[2]; +} diff --git a/test cases/common/151 simd/simdchecker.c b/test cases/common/151 simd/simdchecker.c new file mode 100644 index 0000000..cd6fe4f --- /dev/null +++ b/test cases/common/151 simd/simdchecker.c @@ -0,0 +1,143 @@ +#include +#include +#include + +typedef void (*simd_func)(float*); + +int check_simd_implementation(float *four, + const float *four_initial, + const char *simd_type, + const float *expected, + simd_func fptr, + const int blocksize) { + int rv = 0; + memcpy(four, four_initial, blocksize*sizeof(float)); + printf("Using %s.\n", simd_type); + fptr(four); + for(int i=0; i + +#ifdef _MSC_VER +#define ALIGN_16 __declspec(align(16)) +#else +#include +#define ALIGN_16 alignas(16) +#endif + + +/* Yes, I do know that arr[4] decays into a pointer + * as a function argument. Don't do this in real code + * but for this test it is ok. + */ + +void increment_fallback(float arr[4]); + +#if HAVE_MMX +int mmx_available(); +void increment_mmx(float arr[4]); +#endif + +#if HAVE_SSE +int sse_available(); +void increment_sse(float arr[4]); +#endif + +#if HAVE_SSE2 +int sse2_available(); +void increment_sse2(float arr[4]); +#endif + +#if HAVE_SSE3 +int sse3_available(); +void increment_sse3(float arr[4]); +#endif + +#if HAVE_SSSE3 +int ssse3_available(); +void increment_ssse3(float arr[4]); +#endif + +#if HAVE_SSE41 +int sse41_available(); +void increment_sse41(float arr[4]); +#endif + +#if HAVE_SSE42 +int sse42_available(); +void increment_sse42(float arr[4]); +#endif + +#if HAVE_AVX +int avx_available(); +void increment_avx(float arr[4]); +#endif + +#if HAVE_AVX2 +int avx2_available(); +void increment_avx2(float arr[4]); +#endif + +#if HAVE_NEON +int neon_available(); +void increment_neon(float arr[4]); +#endif + +#if HAVE_ALTIVEC +int altivec_available(); +void increment_altivec(float arr[4]); +#endif + +/* And so on. */ diff --git a/test cases/common/152 shared module resolving symbol in executable/meson.build b/test cases/common/152 shared module resolving symbol in executable/meson.build new file mode 100644 index 0000000..282a4d2 --- /dev/null +++ b/test cases/common/152 shared module resolving symbol in executable/meson.build @@ -0,0 +1,15 @@ +project('shared module resolving symbol in executable', 'c') + +# The shared module contains a reference to the symbol 'func_from_executable', +# which is always provided by the executable which loads it. This symbol can be +# resolved at run-time by an ELF loader. But when building PE/COFF objects, all +# symbols must be resolved at link-time, so an implib is generated for the +# executable, and the shared module linked with it. +# +# See testcase 125 for an example of the more complex portability gymnastics +# required if we do not know (at link-time) what provides the symbol. + +dl = meson.get_compiler('c').find_library('dl', required: false) +e = executable('prog', 'prog.c', dependencies: dl, export_dynamic: true) +m = shared_module('module', 'module.c', link_with: e) +test('test', e, args: m.full_path()) diff --git a/test cases/common/152 shared module resolving symbol in executable/module.c b/test cases/common/152 shared module resolving symbol in executable/module.c new file mode 100644 index 0000000..64374d5 --- /dev/null +++ b/test cases/common/152 shared module resolving symbol in executable/module.c @@ -0,0 +1,16 @@ +#if defined _WIN32 || defined __CYGWIN__ + #define DLL_PUBLIC __declspec(dllexport) +#else + #if defined __GNUC__ + #define DLL_PUBLIC __attribute__ ((visibility("default"))) + #else + #pragma message ("Compiler does not support symbol visibility.") + #define DLL_PUBLIC + #endif +#endif + +extern int func_from_executable(void); + +int DLL_PUBLIC func(void) { + return func_from_executable(); +} diff --git a/test cases/common/152 shared module resolving symbol in executable/prog.c b/test cases/common/152 shared module resolving symbol in executable/prog.c new file mode 100644 index 0000000..746c192 --- /dev/null +++ b/test cases/common/152 shared module resolving symbol in executable/prog.c @@ -0,0 +1,60 @@ +#include +#include +#ifdef _WIN32 +#include +#else +#include +#endif + +#if defined _WIN32 || defined __CYGWIN__ + #define DLL_PUBLIC __declspec(dllexport) +#else + #if defined __GNUC__ + #define DLL_PUBLIC __attribute__ ((visibility("default"))) + #else + #pragma message ("Compiler does not support symbol visibility.") + #define DLL_PUBLIC + #endif +#endif + +typedef int (*fptr) (void); + +int DLL_PUBLIC +func_from_executable(void) +{ + return 42; +} + +int +main (int argc, char **argv) +{ + int expected, actual; + fptr importedfunc; + +#ifdef _WIN32 + HMODULE h = LoadLibraryA(argv[1]); +#else + void *h = dlopen(argv[1], RTLD_NOW); +#endif + assert(h != NULL); + +#ifdef _WIN32 + importedfunc = (fptr) GetProcAddress (h, "func"); +#else + importedfunc = (fptr) dlsym(h, "func"); +#endif + assert(importedfunc != NULL); + assert(importedfunc != func_from_executable); + + actual = (*importedfunc)(); + expected = func_from_executable(); + assert(actual == expected); + +#ifdef _WIN32 + FreeLibrary(h); +#else + dlclose(h); +#endif + + return 0; +} diff --git a/test cases/common/152 simd/fallback.c b/test cases/common/152 simd/fallback.c deleted file mode 100644 index ab435f4..0000000 --- a/test cases/common/152 simd/fallback.c +++ /dev/null @@ -1,8 +0,0 @@ -#include - -void increment_fallback(float arr[4]) { - int i; - for(i=0; i<4; i++) { - arr[i]++; - } -} diff --git a/test cases/common/152 simd/include/simdheader.h b/test cases/common/152 simd/include/simdheader.h deleted file mode 100644 index 6515e41..0000000 --- a/test cases/common/152 simd/include/simdheader.h +++ /dev/null @@ -1,3 +0,0 @@ -#pragma once - -#define I_CAN_HAZ_SIMD diff --git a/test cases/common/152 simd/meson.build b/test cases/common/152 simd/meson.build deleted file mode 100644 index 2628a12..0000000 --- a/test cases/common/152 simd/meson.build +++ /dev/null @@ -1,44 +0,0 @@ -project('simd', 'c') - -simd = import('unstable-simd') - -cc = meson.get_compiler('c') - -cdata = configuration_data() - -if not meson.is_cross_build() and host_machine.cpu_family() == 'arm' and cc.get_id() == 'clang' - message('Adding -march=armv7 because assuming that this build happens on Raspbian.') - message('Its Clang seems to be misconfigured and does not support NEON by default.') - add_project_arguments('-march=armv7', language : 'c') -endif - -if cc.get_id() == 'msvc' and cc.version().version_compare('<17') - error('MESON_SKIP_TEST VS2010 produces broken binaries on x86.') -endif - -# FIXME add [a, b] = function() -rval = simd.check('mysimds', - mmx : 'simd_mmx.c', - sse : 'simd_sse.c', - sse2 : 'simd_sse2.c', - sse3 : 'simd_sse3.c', - ssse3 : 'simd_ssse3.c', - sse41 : 'simd_sse41.c', - sse42 : 'simd_sse42.c', - avx : 'simd_avx.c', - avx2 : 'simd_avx2.c', - neon : 'simd_neon.c', - compiler : cc, - include_directories : include_directories('include')) - -simdlibs = rval[0] -cdata.merge_from(rval[1]) - -configure_file(output : 'simdconfig.h', - configuration : cdata) - -p = executable('simdtest', 'simdchecker.c', 'fallback.c', - link_with : simdlibs) - -test('simdtest', p) - diff --git a/test cases/common/152 simd/simd_avx.c b/test cases/common/152 simd/simd_avx.c deleted file mode 100644 index 1c84dae..0000000 --- a/test cases/common/152 simd/simd_avx.c +++ /dev/null @@ -1,49 +0,0 @@ -#include - -#ifndef I_CAN_HAZ_SIMD -#error The correct internal header was not used -#endif - -#include -#include -#include - -#ifdef _MSC_VER -#include -int avx_available() { - return 1; -} -#else -#include -#include - -#ifdef __APPLE__ -/* - * Apple ships a broken __builtin_cpu_supports and - * some machines in the CI farm seem to be too - * old to have AVX so just always return 0 here. - */ -int avx_available() { return 0; } -#else - -int avx_available() { - return __builtin_cpu_supports("avx"); -} -#endif -#endif - -void increment_avx(float arr[4]) { - double darr[4]; - darr[0] = arr[0]; - darr[1] = arr[1]; - darr[2] = arr[2]; - darr[3] = arr[3]; - __m256d val = _mm256_loadu_pd(darr); - __m256d one = _mm256_set1_pd(1.0); - __m256d result = _mm256_add_pd(val, one); - _mm256_storeu_pd(darr, result); - arr[0] = (float)darr[0]; - arr[1] = (float)darr[1]; - arr[2] = (float)darr[2]; - arr[3] = (float)darr[3]; -} diff --git a/test cases/common/152 simd/simd_avx2.c b/test cases/common/152 simd/simd_avx2.c deleted file mode 100644 index 15297eb..0000000 --- a/test cases/common/152 simd/simd_avx2.c +++ /dev/null @@ -1,42 +0,0 @@ -#include -#include -#include - -/* - * FIXME add proper runtime detection for VS. - */ - -#ifdef _MSC_VER -#include -int avx2_available() { - return 0; -} -#else -#include -#include - -#if defined(__APPLE__) -int avx2_available() { return 0; } -#else -int avx2_available() { - return __builtin_cpu_supports("avx2"); -} -#endif -#endif - -void increment_avx2(float arr[4]) { - double darr[4]; - darr[0] = arr[0]; - darr[1] = arr[1]; - darr[2] = arr[2]; - darr[3] = arr[3]; - __m256d val = _mm256_loadu_pd(darr); - __m256d one = _mm256_set1_pd(1.0); - __m256d result = _mm256_add_pd(val, one); - _mm256_storeu_pd(darr, result); - one = _mm256_permute4x64_pd(one, 66); /* A no-op, just here to use AVX2. */ - arr[0] = (float)darr[0]; - arr[1] = (float)darr[1]; - arr[2] = (float)darr[2]; - arr[3] = (float)darr[3]; -} diff --git a/test cases/common/152 simd/simd_mmx.c b/test cases/common/152 simd/simd_mmx.c deleted file mode 100644 index 528ed3c..0000000 --- a/test cases/common/152 simd/simd_mmx.c +++ /dev/null @@ -1,67 +0,0 @@ -#include -#include - -#include - -#ifdef _MSC_VER -#include -int mmx_available() { - return 1; -} -/* Contrary to MSDN documentation, MMX intrinsics - * just plain don't work. - */ -void increment_mmx(float arr[4]) { - arr[0]++; - arr[1]++; - arr[2]++; - arr[3]++; -} -#elif defined(__MINGW32__) -int mmx_available() { - return 1; -} -/* MinGW does not seem to ship with MMX or it is broken. - */ -void increment_mmx(float arr[4]) { - arr[0]++; - arr[1]++; - arr[2]++; - arr[3]++; -} -#else -#include -#include - -#if defined(__APPLE__) -int mmx_available() { return 1; } -#else -int mmx_available() { - return __builtin_cpu_supports("mmx"); -} -#endif -void increment_mmx(float arr[4]) { - /* Super ugly but we know that values in arr are always small - * enough to fit in int16; - */ - int i; - __m64 packed = _mm_set_pi16(arr[3], arr[2], arr[1], arr[0]); - __m64 incr = _mm_set1_pi16(1); - __m64 result = _mm_add_pi16(packed, incr); - /* Should be - * int64_t unpacker = _m_to_int64(result); - * but it does not exist on 32 bit platforms for some reason. - */ - int64_t unpacker = (int64_t)(result); - _mm_empty(); - for(i=0; i<4; i++) { - /* This fails on GCC 8 when optimizations are enabled. - * Disable it. Patches welcome to fix this. - arr[i] = (float)(unpacker & ((1<<16)-1)); - unpacker >>= 16; - */ - arr[i] += 1.0f; - } -} - -#endif diff --git a/test cases/common/152 simd/simd_neon.c b/test cases/common/152 simd/simd_neon.c deleted file mode 100644 index 2082099..0000000 --- a/test cases/common/152 simd/simd_neon.c +++ /dev/null @@ -1,20 +0,0 @@ -#include -#include - -#include -#include - -int neon_available() { - return 1; /* Incorrect, but I don't know how to check this properly. */ -} - -void increment_neon(float arr[4]) { - float32x2_t a1, a2, one; - a1 = vld1_f32(arr); - a2 = vld1_f32(&arr[2]); - one = vdup_n_f32(1.0); - a1 = vadd_f32(a1, one); - a2 = vadd_f32(a2, one); - vst1_f32(arr, a1); - vst1_f32(&arr[2], a2); -} diff --git a/test cases/common/152 simd/simd_sse.c b/test cases/common/152 simd/simd_sse.c deleted file mode 100644 index 3c9fe62..0000000 --- a/test cases/common/152 simd/simd_sse.c +++ /dev/null @@ -1,29 +0,0 @@ -#include -#include - -#ifdef _MSC_VER -#include -int sse_available() { - return 1; -} -#else - -#include -#include -#include - -#if defined(__APPLE__) -int sse_available() { return 1; } -#else -int sse_available() { - return __builtin_cpu_supports("sse"); -} -#endif -#endif - -void increment_sse(float arr[4]) { - __m128 val = _mm_load_ps(arr); - __m128 one = _mm_set_ps1(1.0); - __m128 result = _mm_add_ps(val, one); - _mm_storeu_ps(arr, result); -} diff --git a/test cases/common/152 simd/simd_sse2.c b/test cases/common/152 simd/simd_sse2.c deleted file mode 100644 index 271022e..0000000 --- a/test cases/common/152 simd/simd_sse2.c +++ /dev/null @@ -1,37 +0,0 @@ -#include -#include -#include - -#ifdef _MSC_VER -int sse2_available() { - return 1; -} - -#else -#include -#include - -#if defined(__APPLE__) -int sse2_available() { return 1; } -#else -int sse2_available() { - return __builtin_cpu_supports("sse2"); -} -#endif -#endif - -void increment_sse2(float arr[4]) { - ALIGN_16 double darr[4]; - __m128d val1 = _mm_set_pd(arr[0], arr[1]); - __m128d val2 = _mm_set_pd(arr[2], arr[3]); - __m128d one = _mm_set_pd(1.0, 1.0); - __m128d result = _mm_add_pd(val1, one); - _mm_store_pd(darr, result); - result = _mm_add_pd(val2, one); - _mm_store_pd(&darr[2], result); - arr[0] = (float)darr[1]; - arr[1] = (float)darr[0]; - arr[2] = (float)darr[3]; - arr[3] = (float)darr[2]; -} - diff --git a/test cases/common/152 simd/simd_sse3.c b/test cases/common/152 simd/simd_sse3.c deleted file mode 100644 index 89c2f8b..0000000 --- a/test cases/common/152 simd/simd_sse3.c +++ /dev/null @@ -1,38 +0,0 @@ -#include -#include - -#ifdef _MSC_VER -#include -int sse3_available() { - return 1; -} -#else - -#include -#include -#include - -#if defined(__APPLE__) -int sse3_available() { return 1; } -#else -int sse3_available() { - return __builtin_cpu_supports("sse3"); -} -#endif -#endif - -void increment_sse3(float arr[4]) { - ALIGN_16 double darr[4]; - __m128d val1 = _mm_set_pd(arr[0], arr[1]); - __m128d val2 = _mm_set_pd(arr[2], arr[3]); - __m128d one = _mm_set_pd(1.0, 1.0); - __m128d result = _mm_add_pd(val1, one); - _mm_store_pd(darr, result); - result = _mm_add_pd(val2, one); - _mm_store_pd(&darr[2], result); - result = _mm_hadd_pd(val1, val2); /* This does nothing. Only here so we use an SSE3 instruction. */ - arr[0] = (float)darr[1]; - arr[1] = (float)darr[0]; - arr[2] = (float)darr[3]; - arr[3] = (float)darr[2]; -} diff --git a/test cases/common/152 simd/simd_sse41.c b/test cases/common/152 simd/simd_sse41.c deleted file mode 100644 index 859fb43..0000000 --- a/test cases/common/152 simd/simd_sse41.c +++ /dev/null @@ -1,40 +0,0 @@ -#include -#include - -#include - -#ifdef _MSC_VER -#include - -int sse41_available() { - return 1; -} - -#else -#include -#include - -#if defined(__APPLE__) -int sse41_available() { return 1; } -#else -int sse41_available() { - return __builtin_cpu_supports("sse4.1"); -} -#endif -#endif - -void increment_sse41(float arr[4]) { - ALIGN_16 double darr[4]; - __m128d val1 = _mm_set_pd(arr[0], arr[1]); - __m128d val2 = _mm_set_pd(arr[2], arr[3]); - __m128d one = _mm_set_pd(1.0, 1.0); - __m128d result = _mm_add_pd(val1, one); - result = _mm_ceil_pd(result); /* A no-op, only here to use a SSE4.1 intrinsic. */ - _mm_store_pd(darr, result); - result = _mm_add_pd(val2, one); - _mm_store_pd(&darr[2], result); - arr[0] = (float)darr[1]; - arr[1] = (float)darr[0]; - arr[2] = (float)darr[3]; - arr[3] = (float)darr[2]; -} diff --git a/test cases/common/152 simd/simd_sse42.c b/test cases/common/152 simd/simd_sse42.c deleted file mode 100644 index edd6e5b..0000000 --- a/test cases/common/152 simd/simd_sse42.c +++ /dev/null @@ -1,43 +0,0 @@ -#include -#include -#include - -#ifdef _MSC_VER -#include - -int sse42_available() { - return 1; -} - -#else - -#include -#include - -#ifdef __APPLE__ -int sse42_available() { - return 1; -} -#else -int sse42_available() { - return __builtin_cpu_supports("sse4.2"); -} -#endif - -#endif - -void increment_sse42(float arr[4]) { - ALIGN_16 double darr[4]; - __m128d val1 = _mm_set_pd(arr[0], arr[1]); - __m128d val2 = _mm_set_pd(arr[2], arr[3]); - __m128d one = _mm_set_pd(1.0, 1.0); - __m128d result = _mm_add_pd(val1, one); - _mm_store_pd(darr, result); - result = _mm_add_pd(val2, one); - _mm_store_pd(&darr[2], result); - _mm_crc32_u32(42, 99); /* A no-op, only here to use an SSE4.2 instruction. */ - arr[0] = (float)darr[1]; - arr[1] = (float)darr[0]; - arr[2] = (float)darr[3]; - arr[3] = (float)darr[2]; -} diff --git a/test cases/common/152 simd/simd_ssse3.c b/test cases/common/152 simd/simd_ssse3.c deleted file mode 100644 index 0156f77..0000000 --- a/test cases/common/152 simd/simd_ssse3.c +++ /dev/null @@ -1,48 +0,0 @@ -#include -#include - -#include -#include - -#ifdef _MSC_VER -#include - -int ssse3_available() { - return 1; -} - -#else - -#include -#include - -int ssse3_available() { -#ifdef __APPLE__ - return 1; -#elif defined(__clang__) - /* https://github.com/numpy/numpy/issues/8130 */ - return __builtin_cpu_supports("sse4.1"); -#else - return __builtin_cpu_supports("ssse3"); -#endif -} - -#endif - -void increment_ssse3(float arr[4]) { - ALIGN_16 double darr[4]; - __m128d val1 = _mm_set_pd(arr[0], arr[1]); - __m128d val2 = _mm_set_pd(arr[2], arr[3]); - __m128d one = _mm_set_pd(1.0, 1.0); - __m128d result = _mm_add_pd(val1, one); - __m128i tmp1, tmp2; - tmp1 = tmp2 = _mm_set1_epi16(0); - _mm_store_pd(darr, result); - result = _mm_add_pd(val2, one); - _mm_store_pd(&darr[2], result); - tmp1 = _mm_hadd_epi32(tmp1, tmp2); /* This does nothing. Only here so we use an SSSE3 instruction. */ - arr[0] = (float)darr[1]; - arr[1] = (float)darr[0]; - arr[2] = (float)darr[3]; - arr[3] = (float)darr[2]; -} diff --git a/test cases/common/152 simd/simdchecker.c b/test cases/common/152 simd/simdchecker.c deleted file mode 100644 index cd6fe4f..0000000 --- a/test cases/common/152 simd/simdchecker.c +++ /dev/null @@ -1,143 +0,0 @@ -#include -#include -#include - -typedef void (*simd_func)(float*); - -int check_simd_implementation(float *four, - const float *four_initial, - const char *simd_type, - const float *expected, - simd_func fptr, - const int blocksize) { - int rv = 0; - memcpy(four, four_initial, blocksize*sizeof(float)); - printf("Using %s.\n", simd_type); - fptr(four); - for(int i=0; i - -#ifdef _MSC_VER -#define ALIGN_16 __declspec(align(16)) -#else -#include -#define ALIGN_16 alignas(16) -#endif - - -/* Yes, I do know that arr[4] decays into a pointer - * as a function argument. Don't do this in real code - * but for this test it is ok. - */ - -void increment_fallback(float arr[4]); - -#if HAVE_MMX -int mmx_available(); -void increment_mmx(float arr[4]); -#endif - -#if HAVE_SSE -int sse_available(); -void increment_sse(float arr[4]); -#endif - -#if HAVE_SSE2 -int sse2_available(); -void increment_sse2(float arr[4]); -#endif - -#if HAVE_SSE3 -int sse3_available(); -void increment_sse3(float arr[4]); -#endif - -#if HAVE_SSSE3 -int ssse3_available(); -void increment_ssse3(float arr[4]); -#endif - -#if HAVE_SSE41 -int sse41_available(); -void increment_sse41(float arr[4]); -#endif - -#if HAVE_SSE42 -int sse42_available(); -void increment_sse42(float arr[4]); -#endif - -#if HAVE_AVX -int avx_available(); -void increment_avx(float arr[4]); -#endif - -#if HAVE_AVX2 -int avx2_available(); -void increment_avx2(float arr[4]); -#endif - -#if HAVE_NEON -int neon_available(); -void increment_neon(float arr[4]); -#endif - -#if HAVE_ALTIVEC -int altivec_available(); -void increment_altivec(float arr[4]); -#endif - -/* And so on. */ diff --git a/test cases/common/153 dotinclude/dotproc.c b/test cases/common/153 dotinclude/dotproc.c new file mode 100644 index 0000000..5e65f7b --- /dev/null +++ b/test cases/common/153 dotinclude/dotproc.c @@ -0,0 +1,10 @@ +#include"stdio.h" + +#ifndef WRAPPER_INCLUDED +#error The wrapper stdio.h was not included. +#endif + +int main(int argc, char **argv) { + printf("Eventually I got printed.\n"); + return 0; +} diff --git a/test cases/common/153 dotinclude/meson.build b/test cases/common/153 dotinclude/meson.build new file mode 100644 index 0000000..e0c2cd7 --- /dev/null +++ b/test cases/common/153 dotinclude/meson.build @@ -0,0 +1,5 @@ +project('dotinclude', 'c') + +executable('dotproc', 'dotproc.c', + implicit_include_directories : false) + diff --git a/test cases/common/153 dotinclude/stdio.h b/test cases/common/153 dotinclude/stdio.h new file mode 100644 index 0000000..b6bd09f --- /dev/null +++ b/test cases/common/153 dotinclude/stdio.h @@ -0,0 +1,6 @@ +// There is no #pragma once because we _want_ to cause an eternal loop +// if this wrapper invokes itself. + +#define WRAPPER_INCLUDED + +#include diff --git a/test cases/common/153 shared module resolving symbol in executable/meson.build b/test cases/common/153 shared module resolving symbol in executable/meson.build deleted file mode 100644 index 282a4d2..0000000 --- a/test cases/common/153 shared module resolving symbol in executable/meson.build +++ /dev/null @@ -1,15 +0,0 @@ -project('shared module resolving symbol in executable', 'c') - -# The shared module contains a reference to the symbol 'func_from_executable', -# which is always provided by the executable which loads it. This symbol can be -# resolved at run-time by an ELF loader. But when building PE/COFF objects, all -# symbols must be resolved at link-time, so an implib is generated for the -# executable, and the shared module linked with it. -# -# See testcase 125 for an example of the more complex portability gymnastics -# required if we do not know (at link-time) what provides the symbol. - -dl = meson.get_compiler('c').find_library('dl', required: false) -e = executable('prog', 'prog.c', dependencies: dl, export_dynamic: true) -m = shared_module('module', 'module.c', link_with: e) -test('test', e, args: m.full_path()) diff --git a/test cases/common/153 shared module resolving symbol in executable/module.c b/test cases/common/153 shared module resolving symbol in executable/module.c deleted file mode 100644 index 64374d5..0000000 --- a/test cases/common/153 shared module resolving symbol in executable/module.c +++ /dev/null @@ -1,16 +0,0 @@ -#if defined _WIN32 || defined __CYGWIN__ - #define DLL_PUBLIC __declspec(dllexport) -#else - #if defined __GNUC__ - #define DLL_PUBLIC __attribute__ ((visibility("default"))) - #else - #pragma message ("Compiler does not support symbol visibility.") - #define DLL_PUBLIC - #endif -#endif - -extern int func_from_executable(void); - -int DLL_PUBLIC func(void) { - return func_from_executable(); -} diff --git a/test cases/common/153 shared module resolving symbol in executable/prog.c b/test cases/common/153 shared module resolving symbol in executable/prog.c deleted file mode 100644 index 746c192..0000000 --- a/test cases/common/153 shared module resolving symbol in executable/prog.c +++ /dev/null @@ -1,60 +0,0 @@ -#include -#include -#ifdef _WIN32 -#include -#else -#include -#endif - -#if defined _WIN32 || defined __CYGWIN__ - #define DLL_PUBLIC __declspec(dllexport) -#else - #if defined __GNUC__ - #define DLL_PUBLIC __attribute__ ((visibility("default"))) - #else - #pragma message ("Compiler does not support symbol visibility.") - #define DLL_PUBLIC - #endif -#endif - -typedef int (*fptr) (void); - -int DLL_PUBLIC -func_from_executable(void) -{ - return 42; -} - -int -main (int argc, char **argv) -{ - int expected, actual; - fptr importedfunc; - -#ifdef _WIN32 - HMODULE h = LoadLibraryA(argv[1]); -#else - void *h = dlopen(argv[1], RTLD_NOW); -#endif - assert(h != NULL); - -#ifdef _WIN32 - importedfunc = (fptr) GetProcAddress (h, "func"); -#else - importedfunc = (fptr) dlsym(h, "func"); -#endif - assert(importedfunc != NULL); - assert(importedfunc != func_from_executable); - - actual = (*importedfunc)(); - expected = func_from_executable(); - assert(actual == expected); - -#ifdef _WIN32 - FreeLibrary(h); -#else - dlclose(h); -#endif - - return 0; -} diff --git a/test cases/common/154 dotinclude/dotproc.c b/test cases/common/154 dotinclude/dotproc.c deleted file mode 100644 index 5e65f7b..0000000 --- a/test cases/common/154 dotinclude/dotproc.c +++ /dev/null @@ -1,10 +0,0 @@ -#include"stdio.h" - -#ifndef WRAPPER_INCLUDED -#error The wrapper stdio.h was not included. -#endif - -int main(int argc, char **argv) { - printf("Eventually I got printed.\n"); - return 0; -} diff --git a/test cases/common/154 dotinclude/meson.build b/test cases/common/154 dotinclude/meson.build deleted file mode 100644 index e0c2cd7..0000000 --- a/test cases/common/154 dotinclude/meson.build +++ /dev/null @@ -1,5 +0,0 @@ -project('dotinclude', 'c') - -executable('dotproc', 'dotproc.c', - implicit_include_directories : false) - diff --git a/test cases/common/154 dotinclude/stdio.h b/test cases/common/154 dotinclude/stdio.h deleted file mode 100644 index b6bd09f..0000000 --- a/test cases/common/154 dotinclude/stdio.h +++ /dev/null @@ -1,6 +0,0 @@ -// There is no #pragma once because we _want_ to cause an eternal loop -// if this wrapper invokes itself. - -#define WRAPPER_INCLUDED - -#include diff --git a/test cases/common/154 reserved targets/all/meson.build b/test cases/common/154 reserved targets/all/meson.build new file mode 100644 index 0000000..adee882 --- /dev/null +++ b/test cases/common/154 reserved targets/all/meson.build @@ -0,0 +1 @@ +executable('test-all', '../test.c') diff --git a/test cases/common/154 reserved targets/benchmark/meson.build b/test cases/common/154 reserved targets/benchmark/meson.build new file mode 100644 index 0000000..242cc23 --- /dev/null +++ b/test cases/common/154 reserved targets/benchmark/meson.build @@ -0,0 +1 @@ +executable('test-benchmark', '../test.c') diff --git a/test cases/common/154 reserved targets/clean-ctlist/meson.build b/test cases/common/154 reserved targets/clean-ctlist/meson.build new file mode 100644 index 0000000..75eb207 --- /dev/null +++ b/test cases/common/154 reserved targets/clean-ctlist/meson.build @@ -0,0 +1 @@ +executable('test-clean-ctlist', '../test.c') diff --git a/test cases/common/154 reserved targets/clean-gcda/meson.build b/test cases/common/154 reserved targets/clean-gcda/meson.build new file mode 100644 index 0000000..488a527 --- /dev/null +++ b/test cases/common/154 reserved targets/clean-gcda/meson.build @@ -0,0 +1 @@ +executable('test-clean-gcda', '../test.c') diff --git a/test cases/common/154 reserved targets/clean-gcno/meson.build b/test cases/common/154 reserved targets/clean-gcno/meson.build new file mode 100644 index 0000000..eec789a --- /dev/null +++ b/test cases/common/154 reserved targets/clean-gcno/meson.build @@ -0,0 +1 @@ +executable('test-clean-gcno', '../test.c') diff --git a/test cases/common/154 reserved targets/clean/meson.build b/test cases/common/154 reserved targets/clean/meson.build new file mode 100644 index 0000000..4e27b6c --- /dev/null +++ b/test cases/common/154 reserved targets/clean/meson.build @@ -0,0 +1 @@ +executable('test-clean', '../test.c') diff --git a/test cases/common/154 reserved targets/coverage-html/meson.build b/test cases/common/154 reserved targets/coverage-html/meson.build new file mode 100644 index 0000000..10a4cc8 --- /dev/null +++ b/test cases/common/154 reserved targets/coverage-html/meson.build @@ -0,0 +1 @@ +executable('test-coverage-html', '../test.c') diff --git a/test cases/common/154 reserved targets/coverage-text/meson.build b/test cases/common/154 reserved targets/coverage-text/meson.build new file mode 100644 index 0000000..21dcae5 --- /dev/null +++ b/test cases/common/154 reserved targets/coverage-text/meson.build @@ -0,0 +1 @@ +executable('test-coverage-text', '../test.c') diff --git a/test cases/common/154 reserved targets/coverage-xml/meson.build b/test cases/common/154 reserved targets/coverage-xml/meson.build new file mode 100644 index 0000000..44d7bfb --- /dev/null +++ b/test cases/common/154 reserved targets/coverage-xml/meson.build @@ -0,0 +1 @@ +executable('test-coverage-xml', '../test.c') diff --git a/test cases/common/154 reserved targets/coverage/meson.build b/test cases/common/154 reserved targets/coverage/meson.build new file mode 100644 index 0000000..b401055 --- /dev/null +++ b/test cases/common/154 reserved targets/coverage/meson.build @@ -0,0 +1 @@ +executable('test-coverage', '../test.c') diff --git a/test cases/common/154 reserved targets/dist/meson.build b/test cases/common/154 reserved targets/dist/meson.build new file mode 100644 index 0000000..951bbb4 --- /dev/null +++ b/test cases/common/154 reserved targets/dist/meson.build @@ -0,0 +1 @@ +executable('test-dist', '../test.c') diff --git a/test cases/common/154 reserved targets/distcheck/meson.build b/test cases/common/154 reserved targets/distcheck/meson.build new file mode 100644 index 0000000..12b9328 --- /dev/null +++ b/test cases/common/154 reserved targets/distcheck/meson.build @@ -0,0 +1 @@ +executable('test-distcheck', '../test.c') diff --git a/test cases/common/154 reserved targets/install/meson.build b/test cases/common/154 reserved targets/install/meson.build new file mode 100644 index 0000000..4839901 --- /dev/null +++ b/test cases/common/154 reserved targets/install/meson.build @@ -0,0 +1 @@ +executable('test-install', '../test.c') diff --git a/test cases/common/154 reserved targets/meson.build b/test cases/common/154 reserved targets/meson.build new file mode 100644 index 0000000..24fd937 --- /dev/null +++ b/test cases/common/154 reserved targets/meson.build @@ -0,0 +1,34 @@ +project('reserved target names', 'c') + # FIXME: Setting this causes it to leak to all other tests + #default_options : ['b_coverage=true'] + +subdir('all') +subdir('benchmark') +subdir('clean') +subdir('clean-ctlist') +subdir('clean-gcda') +subdir('clean-gcno') +subdir('coverage') +subdir('coverage-html') +subdir('coverage-text') +subdir('coverage-xml') +subdir('dist') +subdir('distcheck') +subdir('install') +# We don't have a 'PHONY' directory because Windows and OSX +# choke horribly when there are two entries with the same +# name but different case. +subdir('phony') +subdir('reconfigure') +subdir('scan-build') +subdir('test') +subdir('uninstall') + +subdir('runtarget') + +py3 = import('python3').find_python() + +custom_target('ctlist-test', output : 'out.txt', + command : [py3, '-c', 'print("")'], + capture : true, + build_by_default : true) diff --git a/test cases/common/154 reserved targets/phony/meson.build b/test cases/common/154 reserved targets/phony/meson.build new file mode 100644 index 0000000..6710fc1 --- /dev/null +++ b/test cases/common/154 reserved targets/phony/meson.build @@ -0,0 +1 @@ +executable('test-phony', '../test.c') diff --git a/test cases/common/154 reserved targets/reconfigure/meson.build b/test cases/common/154 reserved targets/reconfigure/meson.build new file mode 100644 index 0000000..c3ea3da --- /dev/null +++ b/test cases/common/154 reserved targets/reconfigure/meson.build @@ -0,0 +1 @@ +executable('test-reconfigure', '../test.c') diff --git a/test cases/common/154 reserved targets/runtarget/meson.build b/test cases/common/154 reserved targets/runtarget/meson.build new file mode 100644 index 0000000..52c371b --- /dev/null +++ b/test cases/common/154 reserved targets/runtarget/meson.build @@ -0,0 +1,2 @@ +configure_file(output : 'config.h', configuration: configuration_data()) +run_target('runtarget', command : ['echo']) diff --git a/test cases/common/154 reserved targets/scan-build/meson.build b/test cases/common/154 reserved targets/scan-build/meson.build new file mode 100644 index 0000000..1002053 --- /dev/null +++ b/test cases/common/154 reserved targets/scan-build/meson.build @@ -0,0 +1 @@ +executable('test-scan-build', '../test.c') diff --git a/test cases/common/154 reserved targets/test.c b/test cases/common/154 reserved targets/test.c new file mode 100644 index 0000000..0fb4389 --- /dev/null +++ b/test cases/common/154 reserved targets/test.c @@ -0,0 +1,3 @@ +int main(int argc, char *argv[]) { + return 0; +} diff --git a/test cases/common/154 reserved targets/test/meson.build b/test cases/common/154 reserved targets/test/meson.build new file mode 100644 index 0000000..4ab123c --- /dev/null +++ b/test cases/common/154 reserved targets/test/meson.build @@ -0,0 +1 @@ +executable('test-test', '../test.c') diff --git a/test cases/common/154 reserved targets/uninstall/meson.build b/test cases/common/154 reserved targets/uninstall/meson.build new file mode 100644 index 0000000..21c6ca6 --- /dev/null +++ b/test cases/common/154 reserved targets/uninstall/meson.build @@ -0,0 +1 @@ +executable('test-uninstall', '../test.c') diff --git a/test cases/common/155 duplicate source names/dir1/file.c b/test cases/common/155 duplicate source names/dir1/file.c new file mode 100644 index 0000000..094e187 --- /dev/null +++ b/test cases/common/155 duplicate source names/dir1/file.c @@ -0,0 +1,16 @@ +extern int dir2; +extern int dir2_dir1; +extern int dir3; +extern int dir3_dir1; + +int main() { + if (dir2 != 20) + return 1; + if (dir2_dir1 != 21) + return 1; + if (dir3 != 30) + return 1; + if (dir3_dir1 != 31) + return 1; + return 0; +} diff --git a/test cases/common/155 duplicate source names/dir1/meson.build b/test cases/common/155 duplicate source names/dir1/meson.build new file mode 100644 index 0000000..00bc85d --- /dev/null +++ b/test cases/common/155 duplicate source names/dir1/meson.build @@ -0,0 +1 @@ +sources += files('file.c') diff --git a/test cases/common/155 duplicate source names/dir2/dir1/file.c b/test cases/common/155 duplicate source names/dir2/dir1/file.c new file mode 100644 index 0000000..5aac8e5 --- /dev/null +++ b/test cases/common/155 duplicate source names/dir2/dir1/file.c @@ -0,0 +1 @@ +int dir2_dir1 = 21; diff --git a/test cases/common/155 duplicate source names/dir2/file.c b/test cases/common/155 duplicate source names/dir2/file.c new file mode 100644 index 0000000..6cf8d66 --- /dev/null +++ b/test cases/common/155 duplicate source names/dir2/file.c @@ -0,0 +1 @@ +int dir2 = 20; diff --git a/test cases/common/155 duplicate source names/dir2/meson.build b/test cases/common/155 duplicate source names/dir2/meson.build new file mode 100644 index 0000000..f116a02 --- /dev/null +++ b/test cases/common/155 duplicate source names/dir2/meson.build @@ -0,0 +1 @@ +sources += files('file.c', 'dir1/file.c') diff --git a/test cases/common/155 duplicate source names/dir3/dir1/file.c b/test cases/common/155 duplicate source names/dir3/dir1/file.c new file mode 100644 index 0000000..04667c2 --- /dev/null +++ b/test cases/common/155 duplicate source names/dir3/dir1/file.c @@ -0,0 +1 @@ +int dir3_dir1 = 31; diff --git a/test cases/common/155 duplicate source names/dir3/file.c b/test cases/common/155 duplicate source names/dir3/file.c new file mode 100644 index 0000000..d16d0a8 --- /dev/null +++ b/test cases/common/155 duplicate source names/dir3/file.c @@ -0,0 +1 @@ +int dir3 = 30; diff --git a/test cases/common/155 duplicate source names/dir3/meson.build b/test cases/common/155 duplicate source names/dir3/meson.build new file mode 100644 index 0000000..70ddbf2 --- /dev/null +++ b/test cases/common/155 duplicate source names/dir3/meson.build @@ -0,0 +1 @@ +lib = static_library('lib', 'file.c', 'dir1/file.c') diff --git a/test cases/common/155 duplicate source names/meson.build b/test cases/common/155 duplicate source names/meson.build new file mode 100644 index 0000000..cac5194 --- /dev/null +++ b/test cases/common/155 duplicate source names/meson.build @@ -0,0 +1,7 @@ +project('proj', 'c') + +sources = [] +subdir('dir1') +subdir('dir2') +subdir('dir3') +executable('a.out', sources : sources, objects : lib.extract_all_objects()) diff --git a/test cases/common/155 reserved targets/all/meson.build b/test cases/common/155 reserved targets/all/meson.build deleted file mode 100644 index adee882..0000000 --- a/test cases/common/155 reserved targets/all/meson.build +++ /dev/null @@ -1 +0,0 @@ -executable('test-all', '../test.c') diff --git a/test cases/common/155 reserved targets/benchmark/meson.build b/test cases/common/155 reserved targets/benchmark/meson.build deleted file mode 100644 index 242cc23..0000000 --- a/test cases/common/155 reserved targets/benchmark/meson.build +++ /dev/null @@ -1 +0,0 @@ -executable('test-benchmark', '../test.c') diff --git a/test cases/common/155 reserved targets/clean-ctlist/meson.build b/test cases/common/155 reserved targets/clean-ctlist/meson.build deleted file mode 100644 index 75eb207..0000000 --- a/test cases/common/155 reserved targets/clean-ctlist/meson.build +++ /dev/null @@ -1 +0,0 @@ -executable('test-clean-ctlist', '../test.c') diff --git a/test cases/common/155 reserved targets/clean-gcda/meson.build b/test cases/common/155 reserved targets/clean-gcda/meson.build deleted file mode 100644 index 488a527..0000000 --- a/test cases/common/155 reserved targets/clean-gcda/meson.build +++ /dev/null @@ -1 +0,0 @@ -executable('test-clean-gcda', '../test.c') diff --git a/test cases/common/155 reserved targets/clean-gcno/meson.build b/test cases/common/155 reserved targets/clean-gcno/meson.build deleted file mode 100644 index eec789a..0000000 --- a/test cases/common/155 reserved targets/clean-gcno/meson.build +++ /dev/null @@ -1 +0,0 @@ -executable('test-clean-gcno', '../test.c') diff --git a/test cases/common/155 reserved targets/clean/meson.build b/test cases/common/155 reserved targets/clean/meson.build deleted file mode 100644 index 4e27b6c..0000000 --- a/test cases/common/155 reserved targets/clean/meson.build +++ /dev/null @@ -1 +0,0 @@ -executable('test-clean', '../test.c') diff --git a/test cases/common/155 reserved targets/coverage-html/meson.build b/test cases/common/155 reserved targets/coverage-html/meson.build deleted file mode 100644 index 10a4cc8..0000000 --- a/test cases/common/155 reserved targets/coverage-html/meson.build +++ /dev/null @@ -1 +0,0 @@ -executable('test-coverage-html', '../test.c') diff --git a/test cases/common/155 reserved targets/coverage-text/meson.build b/test cases/common/155 reserved targets/coverage-text/meson.build deleted file mode 100644 index 21dcae5..0000000 --- a/test cases/common/155 reserved targets/coverage-text/meson.build +++ /dev/null @@ -1 +0,0 @@ -executable('test-coverage-text', '../test.c') diff --git a/test cases/common/155 reserved targets/coverage-xml/meson.build b/test cases/common/155 reserved targets/coverage-xml/meson.build deleted file mode 100644 index 44d7bfb..0000000 --- a/test cases/common/155 reserved targets/coverage-xml/meson.build +++ /dev/null @@ -1 +0,0 @@ -executable('test-coverage-xml', '../test.c') diff --git a/test cases/common/155 reserved targets/coverage/meson.build b/test cases/common/155 reserved targets/coverage/meson.build deleted file mode 100644 index b401055..0000000 --- a/test cases/common/155 reserved targets/coverage/meson.build +++ /dev/null @@ -1 +0,0 @@ -executable('test-coverage', '../test.c') diff --git a/test cases/common/155 reserved targets/dist/meson.build b/test cases/common/155 reserved targets/dist/meson.build deleted file mode 100644 index 951bbb4..0000000 --- a/test cases/common/155 reserved targets/dist/meson.build +++ /dev/null @@ -1 +0,0 @@ -executable('test-dist', '../test.c') diff --git a/test cases/common/155 reserved targets/distcheck/meson.build b/test cases/common/155 reserved targets/distcheck/meson.build deleted file mode 100644 index 12b9328..0000000 --- a/test cases/common/155 reserved targets/distcheck/meson.build +++ /dev/null @@ -1 +0,0 @@ -executable('test-distcheck', '../test.c') diff --git a/test cases/common/155 reserved targets/install/meson.build b/test cases/common/155 reserved targets/install/meson.build deleted file mode 100644 index 4839901..0000000 --- a/test cases/common/155 reserved targets/install/meson.build +++ /dev/null @@ -1 +0,0 @@ -executable('test-install', '../test.c') diff --git a/test cases/common/155 reserved targets/meson.build b/test cases/common/155 reserved targets/meson.build deleted file mode 100644 index 24fd937..0000000 --- a/test cases/common/155 reserved targets/meson.build +++ /dev/null @@ -1,34 +0,0 @@ -project('reserved target names', 'c') - # FIXME: Setting this causes it to leak to all other tests - #default_options : ['b_coverage=true'] - -subdir('all') -subdir('benchmark') -subdir('clean') -subdir('clean-ctlist') -subdir('clean-gcda') -subdir('clean-gcno') -subdir('coverage') -subdir('coverage-html') -subdir('coverage-text') -subdir('coverage-xml') -subdir('dist') -subdir('distcheck') -subdir('install') -# We don't have a 'PHONY' directory because Windows and OSX -# choke horribly when there are two entries with the same -# name but different case. -subdir('phony') -subdir('reconfigure') -subdir('scan-build') -subdir('test') -subdir('uninstall') - -subdir('runtarget') - -py3 = import('python3').find_python() - -custom_target('ctlist-test', output : 'out.txt', - command : [py3, '-c', 'print("")'], - capture : true, - build_by_default : true) diff --git a/test cases/common/155 reserved targets/phony/meson.build b/test cases/common/155 reserved targets/phony/meson.build deleted file mode 100644 index 6710fc1..0000000 --- a/test cases/common/155 reserved targets/phony/meson.build +++ /dev/null @@ -1 +0,0 @@ -executable('test-phony', '../test.c') diff --git a/test cases/common/155 reserved targets/reconfigure/meson.build b/test cases/common/155 reserved targets/reconfigure/meson.build deleted file mode 100644 index c3ea3da..0000000 --- a/test cases/common/155 reserved targets/reconfigure/meson.build +++ /dev/null @@ -1 +0,0 @@ -executable('test-reconfigure', '../test.c') diff --git a/test cases/common/155 reserved targets/runtarget/meson.build b/test cases/common/155 reserved targets/runtarget/meson.build deleted file mode 100644 index 52c371b..0000000 --- a/test cases/common/155 reserved targets/runtarget/meson.build +++ /dev/null @@ -1,2 +0,0 @@ -configure_file(output : 'config.h', configuration: configuration_data()) -run_target('runtarget', command : ['echo']) diff --git a/test cases/common/155 reserved targets/scan-build/meson.build b/test cases/common/155 reserved targets/scan-build/meson.build deleted file mode 100644 index 1002053..0000000 --- a/test cases/common/155 reserved targets/scan-build/meson.build +++ /dev/null @@ -1 +0,0 @@ -executable('test-scan-build', '../test.c') diff --git a/test cases/common/155 reserved targets/test.c b/test cases/common/155 reserved targets/test.c deleted file mode 100644 index 0fb4389..0000000 --- a/test cases/common/155 reserved targets/test.c +++ /dev/null @@ -1,3 +0,0 @@ -int main(int argc, char *argv[]) { - return 0; -} diff --git a/test cases/common/155 reserved targets/test/meson.build b/test cases/common/155 reserved targets/test/meson.build deleted file mode 100644 index 4ab123c..0000000 --- a/test cases/common/155 reserved targets/test/meson.build +++ /dev/null @@ -1 +0,0 @@ -executable('test-test', '../test.c') diff --git a/test cases/common/155 reserved targets/uninstall/meson.build b/test cases/common/155 reserved targets/uninstall/meson.build deleted file mode 100644 index 21c6ca6..0000000 --- a/test cases/common/155 reserved targets/uninstall/meson.build +++ /dev/null @@ -1 +0,0 @@ -executable('test-uninstall', '../test.c') diff --git a/test cases/common/156 duplicate source names/dir1/file.c b/test cases/common/156 duplicate source names/dir1/file.c deleted file mode 100644 index 094e187..0000000 --- a/test cases/common/156 duplicate source names/dir1/file.c +++ /dev/null @@ -1,16 +0,0 @@ -extern int dir2; -extern int dir2_dir1; -extern int dir3; -extern int dir3_dir1; - -int main() { - if (dir2 != 20) - return 1; - if (dir2_dir1 != 21) - return 1; - if (dir3 != 30) - return 1; - if (dir3_dir1 != 31) - return 1; - return 0; -} diff --git a/test cases/common/156 duplicate source names/dir1/meson.build b/test cases/common/156 duplicate source names/dir1/meson.build deleted file mode 100644 index 00bc85d..0000000 --- a/test cases/common/156 duplicate source names/dir1/meson.build +++ /dev/null @@ -1 +0,0 @@ -sources += files('file.c') diff --git a/test cases/common/156 duplicate source names/dir2/dir1/file.c b/test cases/common/156 duplicate source names/dir2/dir1/file.c deleted file mode 100644 index 5aac8e5..0000000 --- a/test cases/common/156 duplicate source names/dir2/dir1/file.c +++ /dev/null @@ -1 +0,0 @@ -int dir2_dir1 = 21; diff --git a/test cases/common/156 duplicate source names/dir2/file.c b/test cases/common/156 duplicate source names/dir2/file.c deleted file mode 100644 index 6cf8d66..0000000 --- a/test cases/common/156 duplicate source names/dir2/file.c +++ /dev/null @@ -1 +0,0 @@ -int dir2 = 20; diff --git a/test cases/common/156 duplicate source names/dir2/meson.build b/test cases/common/156 duplicate source names/dir2/meson.build deleted file mode 100644 index f116a02..0000000 --- a/test cases/common/156 duplicate source names/dir2/meson.build +++ /dev/null @@ -1 +0,0 @@ -sources += files('file.c', 'dir1/file.c') diff --git a/test cases/common/156 duplicate source names/dir3/dir1/file.c b/test cases/common/156 duplicate source names/dir3/dir1/file.c deleted file mode 100644 index 04667c2..0000000 --- a/test cases/common/156 duplicate source names/dir3/dir1/file.c +++ /dev/null @@ -1 +0,0 @@ -int dir3_dir1 = 31; diff --git a/test cases/common/156 duplicate source names/dir3/file.c b/test cases/common/156 duplicate source names/dir3/file.c deleted file mode 100644 index d16d0a8..0000000 --- a/test cases/common/156 duplicate source names/dir3/file.c +++ /dev/null @@ -1 +0,0 @@ -int dir3 = 30; diff --git a/test cases/common/156 duplicate source names/dir3/meson.build b/test cases/common/156 duplicate source names/dir3/meson.build deleted file mode 100644 index 70ddbf2..0000000 --- a/test cases/common/156 duplicate source names/dir3/meson.build +++ /dev/null @@ -1 +0,0 @@ -lib = static_library('lib', 'file.c', 'dir1/file.c') diff --git a/test cases/common/156 duplicate source names/meson.build b/test cases/common/156 duplicate source names/meson.build deleted file mode 100644 index cac5194..0000000 --- a/test cases/common/156 duplicate source names/meson.build +++ /dev/null @@ -1,7 +0,0 @@ -project('proj', 'c') - -sources = [] -subdir('dir1') -subdir('dir2') -subdir('dir3') -executable('a.out', sources : sources, objects : lib.extract_all_objects()) diff --git a/test cases/common/156 index customtarget/check_args.py b/test cases/common/156 index customtarget/check_args.py new file mode 100644 index 0000000..8663a6f --- /dev/null +++ b/test cases/common/156 index customtarget/check_args.py @@ -0,0 +1,18 @@ +#!python3 + +import sys +from pathlib import Path + +def main(): + if len(sys.argv) != 2: + print(sys.argv) + return 1 + if sys.argv[1] != 'gen.c': + print(sys.argv) + return 2 + Path('foo').touch() + + return 0 + +if __name__ == '__main__': + sys.exit(main()) diff --git a/test cases/common/156 index customtarget/gen_sources.py b/test cases/common/156 index customtarget/gen_sources.py new file mode 100644 index 0000000..0bdb529 --- /dev/null +++ b/test cases/common/156 index customtarget/gen_sources.py @@ -0,0 +1,49 @@ +# Copyright © 2017 Intel Corporation +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import argparse +import textwrap + +HEADER = textwrap.dedent('''\ + void stringify(int foo, char * buffer); + ''') + +CODE = textwrap.dedent('''\ + #include + + #ifndef WORKS + # error "This shouldn't have been included" + #endif + + void stringify(int foo, char * buffer) { + sprintf(buffer, "%i", foo); + } + ''') + + +def main(): + parser = argparse.ArgumentParser() + parser.add_argument('--header') + parser.add_argument('--code') + args = parser.parse_args() + + with open(args.header, 'w') as f: + f.write(HEADER) + + with open(args.code, 'w') as f: + f.write(CODE) + + +if __name__ == '__main__': + main() diff --git a/test cases/common/156 index customtarget/lib.c b/test cases/common/156 index customtarget/lib.c new file mode 100644 index 0000000..17117d5 --- /dev/null +++ b/test cases/common/156 index customtarget/lib.c @@ -0,0 +1,20 @@ +/* Copyright © 2017 Intel Corporation + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "gen.h" + +void func(char * buffer) { + stringify(1, buffer); +} diff --git a/test cases/common/156 index customtarget/meson.build b/test cases/common/156 index customtarget/meson.build new file mode 100644 index 0000000..27d28b5 --- /dev/null +++ b/test cases/common/156 index customtarget/meson.build @@ -0,0 +1,39 @@ +# Copyright © 2017 Intel Corporation +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +project('custom_target_index', 'c', default_options : 'c_std=c89') + +py_mod = import('python3') +prog_python = py_mod.find_python() + +gen = custom_target( + 'gen.[ch]', + input : 'gen_sources.py', + output : ['gen.c', 'gen.h'], + command : [prog_python, '@INPUT@', '--header', '@OUTPUT1@', '--code', '@OUTPUT0@'], +) + +lib = static_library( + 'libfoo', + ['lib.c', gen[1]], +) + +custom_target( + 'foo', + input: gen[0], + output: 'foo', + command: [find_program('check_args.py'), '@INPUT@'], +) + +subdir('subdir') diff --git a/test cases/common/156 index customtarget/subdir/foo.c b/test cases/common/156 index customtarget/subdir/foo.c new file mode 100644 index 0000000..c620a11 --- /dev/null +++ b/test cases/common/156 index customtarget/subdir/foo.c @@ -0,0 +1,22 @@ +/* Copyright © 2017 Intel Corporation + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "gen.h" + +int main(void) { + char buf[50]; + stringify(10, buf); + return 0; +} diff --git a/test cases/common/156 index customtarget/subdir/meson.build b/test cases/common/156 index customtarget/subdir/meson.build new file mode 100644 index 0000000..47bcd32 --- /dev/null +++ b/test cases/common/156 index customtarget/subdir/meson.build @@ -0,0 +1,19 @@ +# Copyright © 2017 Intel Corporation +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +foo = executable( + 'foo', + ['foo.c', gen[0], gen[1]], + c_args : '-DWORKS', +) diff --git a/test cases/common/157 index customtarget/check_args.py b/test cases/common/157 index customtarget/check_args.py deleted file mode 100644 index 8663a6f..0000000 --- a/test cases/common/157 index customtarget/check_args.py +++ /dev/null @@ -1,18 +0,0 @@ -#!python3 - -import sys -from pathlib import Path - -def main(): - if len(sys.argv) != 2: - print(sys.argv) - return 1 - if sys.argv[1] != 'gen.c': - print(sys.argv) - return 2 - Path('foo').touch() - - return 0 - -if __name__ == '__main__': - sys.exit(main()) diff --git a/test cases/common/157 index customtarget/gen_sources.py b/test cases/common/157 index customtarget/gen_sources.py deleted file mode 100644 index 0bdb529..0000000 --- a/test cases/common/157 index customtarget/gen_sources.py +++ /dev/null @@ -1,49 +0,0 @@ -# Copyright © 2017 Intel Corporation -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -import argparse -import textwrap - -HEADER = textwrap.dedent('''\ - void stringify(int foo, char * buffer); - ''') - -CODE = textwrap.dedent('''\ - #include - - #ifndef WORKS - # error "This shouldn't have been included" - #endif - - void stringify(int foo, char * buffer) { - sprintf(buffer, "%i", foo); - } - ''') - - -def main(): - parser = argparse.ArgumentParser() - parser.add_argument('--header') - parser.add_argument('--code') - args = parser.parse_args() - - with open(args.header, 'w') as f: - f.write(HEADER) - - with open(args.code, 'w') as f: - f.write(CODE) - - -if __name__ == '__main__': - main() diff --git a/test cases/common/157 index customtarget/lib.c b/test cases/common/157 index customtarget/lib.c deleted file mode 100644 index 17117d5..0000000 --- a/test cases/common/157 index customtarget/lib.c +++ /dev/null @@ -1,20 +0,0 @@ -/* Copyright © 2017 Intel Corporation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#include "gen.h" - -void func(char * buffer) { - stringify(1, buffer); -} diff --git a/test cases/common/157 index customtarget/meson.build b/test cases/common/157 index customtarget/meson.build deleted file mode 100644 index 27d28b5..0000000 --- a/test cases/common/157 index customtarget/meson.build +++ /dev/null @@ -1,39 +0,0 @@ -# Copyright © 2017 Intel Corporation -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -project('custom_target_index', 'c', default_options : 'c_std=c89') - -py_mod = import('python3') -prog_python = py_mod.find_python() - -gen = custom_target( - 'gen.[ch]', - input : 'gen_sources.py', - output : ['gen.c', 'gen.h'], - command : [prog_python, '@INPUT@', '--header', '@OUTPUT1@', '--code', '@OUTPUT0@'], -) - -lib = static_library( - 'libfoo', - ['lib.c', gen[1]], -) - -custom_target( - 'foo', - input: gen[0], - output: 'foo', - command: [find_program('check_args.py'), '@INPUT@'], -) - -subdir('subdir') diff --git a/test cases/common/157 index customtarget/subdir/foo.c b/test cases/common/157 index customtarget/subdir/foo.c deleted file mode 100644 index c620a11..0000000 --- a/test cases/common/157 index customtarget/subdir/foo.c +++ /dev/null @@ -1,22 +0,0 @@ -/* Copyright © 2017 Intel Corporation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#include "gen.h" - -int main(void) { - char buf[50]; - stringify(10, buf); - return 0; -} diff --git a/test cases/common/157 index customtarget/subdir/meson.build b/test cases/common/157 index customtarget/subdir/meson.build deleted file mode 100644 index 47bcd32..0000000 --- a/test cases/common/157 index customtarget/subdir/meson.build +++ /dev/null @@ -1,19 +0,0 @@ -# Copyright © 2017 Intel Corporation -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -foo = executable( - 'foo', - ['foo.c', gen[0], gen[1]], - c_args : '-DWORKS', -) diff --git a/test cases/common/157 wrap file should not failed/meson.build b/test cases/common/157 wrap file should not failed/meson.build new file mode 100644 index 0000000..f4ec2a8 --- /dev/null +++ b/test cases/common/157 wrap file should not failed/meson.build @@ -0,0 +1,10 @@ +project('mainproj', 'c', + default_options : ['wrap_mode=nodownload'], +) + +subproject('zlib') +subproject('foo') + +executable('grabprog', files('src/subprojects/prog.c')) +executable('grabprog2', files('src/subprojects/foo/prog2.c')) +subdir('src') diff --git a/test cases/common/157 wrap file should not failed/src/meson.build b/test cases/common/157 wrap file should not failed/src/meson.build new file mode 100644 index 0000000..69f666d --- /dev/null +++ b/test cases/common/157 wrap file should not failed/src/meson.build @@ -0,0 +1,2 @@ +executable('grabprog3', files('subprojects/prog.c')) +executable('grabprog4', files('subprojects/foo/prog2.c')) diff --git a/test cases/common/157 wrap file should not failed/src/subprojects/foo/prog2.c b/test cases/common/157 wrap file should not failed/src/subprojects/foo/prog2.c new file mode 100644 index 0000000..56f61a8 --- /dev/null +++ b/test cases/common/157 wrap file should not failed/src/subprojects/foo/prog2.c @@ -0,0 +1,7 @@ +#include + +int main(int argc, char **argv) { + printf("Do not have a file layout like this in your own projects.\n"); + printf("This is only to test that this works.\n"); + return 0; +} diff --git a/test cases/common/157 wrap file should not failed/src/subprojects/prog.c b/test cases/common/157 wrap file should not failed/src/subprojects/prog.c new file mode 100644 index 0000000..56f61a8 --- /dev/null +++ b/test cases/common/157 wrap file should not failed/src/subprojects/prog.c @@ -0,0 +1,7 @@ +#include + +int main(int argc, char **argv) { + printf("Do not have a file layout like this in your own projects.\n"); + printf("This is only to test that this works.\n"); + return 0; +} diff --git a/test cases/common/157 wrap file should not failed/subprojects/foo.wrap b/test cases/common/157 wrap file should not failed/subprojects/foo.wrap new file mode 100644 index 0000000..90d6d40 --- /dev/null +++ b/test cases/common/157 wrap file should not failed/subprojects/foo.wrap @@ -0,0 +1,11 @@ +[wrap-file] +directory = foo-1.0 + +source_url = http://something.invalid +source_filename = foo-1.0.tar.xz +source_hash = ae5fc03185654f76b459db16ca25809703f8821aeb39a433902244bb479c4b79 +lead_directory_missing = true + +patch_url = https://something.invalid/patch +patch_filename = foo-1.0-patch.tar.xz +patch_hash = 8f2e286a4b190228d4e0c25ddc91195449cfb5e5c52006355838964b244037da diff --git a/test cases/common/157 wrap file should not failed/subprojects/packagecache/foo-1.0-patch.tar.xz b/test cases/common/157 wrap file should not failed/subprojects/packagecache/foo-1.0-patch.tar.xz new file mode 100644 index 0000000..26d2927 Binary files /dev/null and b/test cases/common/157 wrap file should not failed/subprojects/packagecache/foo-1.0-patch.tar.xz differ diff --git a/test cases/common/157 wrap file should not failed/subprojects/packagecache/foo-1.0.tar.xz b/test cases/common/157 wrap file should not failed/subprojects/packagecache/foo-1.0.tar.xz new file mode 100644 index 0000000..2647ef9 Binary files /dev/null and b/test cases/common/157 wrap file should not failed/subprojects/packagecache/foo-1.0.tar.xz differ diff --git a/test cases/common/157 wrap file should not failed/subprojects/packagecache/zlib-1.2.8-8-wrap.zip b/test cases/common/157 wrap file should not failed/subprojects/packagecache/zlib-1.2.8-8-wrap.zip new file mode 100644 index 0000000..421376d --- /dev/null +++ b/test cases/common/157 wrap file should not failed/subprojects/packagecache/zlib-1.2.8-8-wrap.zip @@ -0,0 +1 @@ +dummy diff --git a/test cases/common/157 wrap file should not failed/subprojects/packagecache/zlib-1.2.8.tar.gz b/test cases/common/157 wrap file should not failed/subprojects/packagecache/zlib-1.2.8.tar.gz new file mode 100644 index 0000000..421376d --- /dev/null +++ b/test cases/common/157 wrap file should not failed/subprojects/packagecache/zlib-1.2.8.tar.gz @@ -0,0 +1 @@ +dummy diff --git a/test cases/common/157 wrap file should not failed/subprojects/zlib-1.2.8/foo.c b/test cases/common/157 wrap file should not failed/subprojects/zlib-1.2.8/foo.c new file mode 100644 index 0000000..019f2ba --- /dev/null +++ b/test cases/common/157 wrap file should not failed/subprojects/zlib-1.2.8/foo.c @@ -0,0 +1,3 @@ +int dummy_func() { + return 42; +} diff --git a/test cases/common/157 wrap file should not failed/subprojects/zlib-1.2.8/meson.build b/test cases/common/157 wrap file should not failed/subprojects/zlib-1.2.8/meson.build new file mode 100644 index 0000000..8d8008e --- /dev/null +++ b/test cases/common/157 wrap file should not failed/subprojects/zlib-1.2.8/meson.build @@ -0,0 +1,2 @@ +project('shared lib', 'c') +shared_library('foo', 'foo.c') diff --git a/test cases/common/157 wrap file should not failed/subprojects/zlib.wrap b/test cases/common/157 wrap file should not failed/subprojects/zlib.wrap new file mode 100644 index 0000000..6d5896f --- /dev/null +++ b/test cases/common/157 wrap file should not failed/subprojects/zlib.wrap @@ -0,0 +1,10 @@ +[wrap-file] +directory = zlib-1.2.8 + +source_url = http://zlib.net/fossils/zlib-1.2.8.tar.gz +source_filename = zlib-1.2.8.tar.gz +source_hash = 36658cb768a54c1d4dec43c3116c27ed893e88b02ecfcb44f2166f9c0b7f2a0d + +patch_url = https://wrapdb.mesonbuild.com/v1/projects/zlib/1.2.8/8/get_zip +patch_filename = zlib-1.2.8-8-wrap.zip +patch_hash = 17c52a0e0c59ce926d3959005d5cd8178c6c7e2c9a4a1304279a8320c955ac60 diff --git a/test cases/common/158 includedir subproj/meson.build b/test cases/common/158 includedir subproj/meson.build new file mode 100644 index 0000000..b3de5af --- /dev/null +++ b/test cases/common/158 includedir subproj/meson.build @@ -0,0 +1,9 @@ +project('include dir in subproj test', 'c') + + +subproject('inctest') + + +exe = executable('prog', 'prog.c') + +test('dummy', exe) diff --git a/test cases/common/158 includedir subproj/prog.c b/test cases/common/158 includedir subproj/prog.c new file mode 100644 index 0000000..772681e --- /dev/null +++ b/test cases/common/158 includedir subproj/prog.c @@ -0,0 +1,4 @@ + +int main(int argc, char **argv) { + return 0; +} diff --git a/test cases/common/158 includedir subproj/subprojects/inctest/include/incfile.h b/test cases/common/158 includedir subproj/subprojects/inctest/include/incfile.h new file mode 100644 index 0000000..ec740da --- /dev/null +++ b/test cases/common/158 includedir subproj/subprojects/inctest/include/incfile.h @@ -0,0 +1,2 @@ + +/* file which is used in the subproject */ diff --git a/test cases/common/158 includedir subproj/subprojects/inctest/meson.build b/test cases/common/158 includedir subproj/subprojects/inctest/meson.build new file mode 100644 index 0000000..74aabcb --- /dev/null +++ b/test cases/common/158 includedir subproj/subprojects/inctest/meson.build @@ -0,0 +1,13 @@ + +project('subproj with includedir', 'c') + + + +compile_check = ''' +#include "incfile.h" +''' + +if not meson.get_compiler('c').compiles(compile_check, name : 'include in subproj', + include_directories: include_directories('include')) + error('failed') +endif diff --git a/test cases/common/158 wrap file should not failed/meson.build b/test cases/common/158 wrap file should not failed/meson.build deleted file mode 100644 index f4ec2a8..0000000 --- a/test cases/common/158 wrap file should not failed/meson.build +++ /dev/null @@ -1,10 +0,0 @@ -project('mainproj', 'c', - default_options : ['wrap_mode=nodownload'], -) - -subproject('zlib') -subproject('foo') - -executable('grabprog', files('src/subprojects/prog.c')) -executable('grabprog2', files('src/subprojects/foo/prog2.c')) -subdir('src') diff --git a/test cases/common/158 wrap file should not failed/src/meson.build b/test cases/common/158 wrap file should not failed/src/meson.build deleted file mode 100644 index 69f666d..0000000 --- a/test cases/common/158 wrap file should not failed/src/meson.build +++ /dev/null @@ -1,2 +0,0 @@ -executable('grabprog3', files('subprojects/prog.c')) -executable('grabprog4', files('subprojects/foo/prog2.c')) diff --git a/test cases/common/158 wrap file should not failed/src/subprojects/foo/prog2.c b/test cases/common/158 wrap file should not failed/src/subprojects/foo/prog2.c deleted file mode 100644 index 56f61a8..0000000 --- a/test cases/common/158 wrap file should not failed/src/subprojects/foo/prog2.c +++ /dev/null @@ -1,7 +0,0 @@ -#include - -int main(int argc, char **argv) { - printf("Do not have a file layout like this in your own projects.\n"); - printf("This is only to test that this works.\n"); - return 0; -} diff --git a/test cases/common/158 wrap file should not failed/src/subprojects/prog.c b/test cases/common/158 wrap file should not failed/src/subprojects/prog.c deleted file mode 100644 index 56f61a8..0000000 --- a/test cases/common/158 wrap file should not failed/src/subprojects/prog.c +++ /dev/null @@ -1,7 +0,0 @@ -#include - -int main(int argc, char **argv) { - printf("Do not have a file layout like this in your own projects.\n"); - printf("This is only to test that this works.\n"); - return 0; -} diff --git a/test cases/common/158 wrap file should not failed/subprojects/foo.wrap b/test cases/common/158 wrap file should not failed/subprojects/foo.wrap deleted file mode 100644 index 90d6d40..0000000 --- a/test cases/common/158 wrap file should not failed/subprojects/foo.wrap +++ /dev/null @@ -1,11 +0,0 @@ -[wrap-file] -directory = foo-1.0 - -source_url = http://something.invalid -source_filename = foo-1.0.tar.xz -source_hash = ae5fc03185654f76b459db16ca25809703f8821aeb39a433902244bb479c4b79 -lead_directory_missing = true - -patch_url = https://something.invalid/patch -patch_filename = foo-1.0-patch.tar.xz -patch_hash = 8f2e286a4b190228d4e0c25ddc91195449cfb5e5c52006355838964b244037da diff --git a/test cases/common/158 wrap file should not failed/subprojects/packagecache/foo-1.0-patch.tar.xz b/test cases/common/158 wrap file should not failed/subprojects/packagecache/foo-1.0-patch.tar.xz deleted file mode 100644 index 26d2927..0000000 Binary files a/test cases/common/158 wrap file should not failed/subprojects/packagecache/foo-1.0-patch.tar.xz and /dev/null differ diff --git a/test cases/common/158 wrap file should not failed/subprojects/packagecache/foo-1.0.tar.xz b/test cases/common/158 wrap file should not failed/subprojects/packagecache/foo-1.0.tar.xz deleted file mode 100644 index 2647ef9..0000000 Binary files a/test cases/common/158 wrap file should not failed/subprojects/packagecache/foo-1.0.tar.xz and /dev/null differ diff --git a/test cases/common/158 wrap file should not failed/subprojects/packagecache/zlib-1.2.8-8-wrap.zip b/test cases/common/158 wrap file should not failed/subprojects/packagecache/zlib-1.2.8-8-wrap.zip deleted file mode 100644 index 421376d..0000000 --- a/test cases/common/158 wrap file should not failed/subprojects/packagecache/zlib-1.2.8-8-wrap.zip +++ /dev/null @@ -1 +0,0 @@ -dummy diff --git a/test cases/common/158 wrap file should not failed/subprojects/packagecache/zlib-1.2.8.tar.gz b/test cases/common/158 wrap file should not failed/subprojects/packagecache/zlib-1.2.8.tar.gz deleted file mode 100644 index 421376d..0000000 --- a/test cases/common/158 wrap file should not failed/subprojects/packagecache/zlib-1.2.8.tar.gz +++ /dev/null @@ -1 +0,0 @@ -dummy diff --git a/test cases/common/158 wrap file should not failed/subprojects/zlib-1.2.8/foo.c b/test cases/common/158 wrap file should not failed/subprojects/zlib-1.2.8/foo.c deleted file mode 100644 index 019f2ba..0000000 --- a/test cases/common/158 wrap file should not failed/subprojects/zlib-1.2.8/foo.c +++ /dev/null @@ -1,3 +0,0 @@ -int dummy_func() { - return 42; -} diff --git a/test cases/common/158 wrap file should not failed/subprojects/zlib-1.2.8/meson.build b/test cases/common/158 wrap file should not failed/subprojects/zlib-1.2.8/meson.build deleted file mode 100644 index 8d8008e..0000000 --- a/test cases/common/158 wrap file should not failed/subprojects/zlib-1.2.8/meson.build +++ /dev/null @@ -1,2 +0,0 @@ -project('shared lib', 'c') -shared_library('foo', 'foo.c') diff --git a/test cases/common/158 wrap file should not failed/subprojects/zlib.wrap b/test cases/common/158 wrap file should not failed/subprojects/zlib.wrap deleted file mode 100644 index 6d5896f..0000000 --- a/test cases/common/158 wrap file should not failed/subprojects/zlib.wrap +++ /dev/null @@ -1,10 +0,0 @@ -[wrap-file] -directory = zlib-1.2.8 - -source_url = http://zlib.net/fossils/zlib-1.2.8.tar.gz -source_filename = zlib-1.2.8.tar.gz -source_hash = 36658cb768a54c1d4dec43c3116c27ed893e88b02ecfcb44f2166f9c0b7f2a0d - -patch_url = https://wrapdb.mesonbuild.com/v1/projects/zlib/1.2.8/8/get_zip -patch_filename = zlib-1.2.8-8-wrap.zip -patch_hash = 17c52a0e0c59ce926d3959005d5cd8178c6c7e2c9a4a1304279a8320c955ac60 diff --git a/test cases/common/159 includedir subproj/meson.build b/test cases/common/159 includedir subproj/meson.build deleted file mode 100644 index b3de5af..0000000 --- a/test cases/common/159 includedir subproj/meson.build +++ /dev/null @@ -1,9 +0,0 @@ -project('include dir in subproj test', 'c') - - -subproject('inctest') - - -exe = executable('prog', 'prog.c') - -test('dummy', exe) diff --git a/test cases/common/159 includedir subproj/prog.c b/test cases/common/159 includedir subproj/prog.c deleted file mode 100644 index 772681e..0000000 --- a/test cases/common/159 includedir subproj/prog.c +++ /dev/null @@ -1,4 +0,0 @@ - -int main(int argc, char **argv) { - return 0; -} diff --git a/test cases/common/159 includedir subproj/subprojects/inctest/include/incfile.h b/test cases/common/159 includedir subproj/subprojects/inctest/include/incfile.h deleted file mode 100644 index ec740da..0000000 --- a/test cases/common/159 includedir subproj/subprojects/inctest/include/incfile.h +++ /dev/null @@ -1,2 +0,0 @@ - -/* file which is used in the subproject */ diff --git a/test cases/common/159 includedir subproj/subprojects/inctest/meson.build b/test cases/common/159 includedir subproj/subprojects/inctest/meson.build deleted file mode 100644 index 74aabcb..0000000 --- a/test cases/common/159 includedir subproj/subprojects/inctest/meson.build +++ /dev/null @@ -1,13 +0,0 @@ - -project('subproj with includedir', 'c') - - - -compile_check = ''' -#include "incfile.h" -''' - -if not meson.get_compiler('c').compiles(compile_check, name : 'include in subproj', - include_directories: include_directories('include')) - error('failed') -endif diff --git a/test cases/common/159 subproject dir name collision/a.c b/test cases/common/159 subproject dir name collision/a.c new file mode 100644 index 0000000..6ed96fa --- /dev/null +++ b/test cases/common/159 subproject dir name collision/a.c @@ -0,0 +1,13 @@ +#include +char func_b(); +char func_c(); + +int main(int argc, char **argv) { + if(func_b() != 'b') { + return 1; + } + if(func_c() != 'c') { + return 2; + } + return 0; +} diff --git a/test cases/common/159 subproject dir name collision/custom_subproject_dir/B/b.c b/test cases/common/159 subproject dir name collision/custom_subproject_dir/B/b.c new file mode 100644 index 0000000..4c94ee9 --- /dev/null +++ b/test cases/common/159 subproject dir name collision/custom_subproject_dir/B/b.c @@ -0,0 +1,20 @@ +#include +char func_c(); + +#if defined _WIN32 || defined __CYGWIN__ +#define DLL_PUBLIC __declspec(dllexport) +#else + #if defined __GNUC__ + #define DLL_PUBLIC __attribute__ ((visibility("default"))) + #else + #pragma message ("Compiler does not support symbol visibility.") + #define DLL_PUBLIC + #endif +#endif + +char DLL_PUBLIC func_b() { + if(func_c() != 'c') { + exit(3); + } + return 'b'; +} diff --git a/test cases/common/159 subproject dir name collision/custom_subproject_dir/B/meson.build b/test cases/common/159 subproject dir name collision/custom_subproject_dir/B/meson.build new file mode 100644 index 0000000..280c60c --- /dev/null +++ b/test cases/common/159 subproject dir name collision/custom_subproject_dir/B/meson.build @@ -0,0 +1,4 @@ +project('B', 'c') +C = subproject('C') +c = C.get_variable('c') +b = shared_library('b', 'b.c', link_with : c) diff --git a/test cases/common/159 subproject dir name collision/custom_subproject_dir/C/c.c b/test cases/common/159 subproject dir name collision/custom_subproject_dir/C/c.c new file mode 100644 index 0000000..eebfb9f --- /dev/null +++ b/test cases/common/159 subproject dir name collision/custom_subproject_dir/C/c.c @@ -0,0 +1,14 @@ +#if defined _WIN32 || defined __CYGWIN__ +#define DLL_PUBLIC __declspec(dllexport) +#else + #if defined __GNUC__ + #define DLL_PUBLIC __attribute__ ((visibility("default"))) + #else + #pragma message ("Compiler does not support symbol visibility.") + #define DLL_PUBLIC + #endif +#endif + +char DLL_PUBLIC func_c() { + return 'c'; +} diff --git a/test cases/common/159 subproject dir name collision/custom_subproject_dir/C/meson.build b/test cases/common/159 subproject dir name collision/custom_subproject_dir/C/meson.build new file mode 100644 index 0000000..abf0b1e --- /dev/null +++ b/test cases/common/159 subproject dir name collision/custom_subproject_dir/C/meson.build @@ -0,0 +1,2 @@ +project('C', 'c') +c = shared_library('c', 'c.c') diff --git a/test cases/common/159 subproject dir name collision/meson.build b/test cases/common/159 subproject dir name collision/meson.build new file mode 100644 index 0000000..5531217 --- /dev/null +++ b/test cases/common/159 subproject dir name collision/meson.build @@ -0,0 +1,12 @@ +project('A', 'c', subproject_dir:'custom_subproject_dir') + +B = subproject('B') +b = B.get_variable('b') + +C = subproject('C') +c = C.get_variable('c') + +subdir('other_subdir') + +a = executable('a', 'a.c', link_with : [b, c]) +test('a test', a) diff --git a/test cases/common/159 subproject dir name collision/other_subdir/custom_subproject_dir/other.c b/test cases/common/159 subproject dir name collision/other_subdir/custom_subproject_dir/other.c new file mode 100644 index 0000000..0c27f84 --- /dev/null +++ b/test cases/common/159 subproject dir name collision/other_subdir/custom_subproject_dir/other.c @@ -0,0 +1,19 @@ +#include + +#if defined _WIN32 || defined __CYGWIN__ +#define DLL_PUBLIC __declspec(dllexport) +#else + #if defined __GNUC__ + #define DLL_PUBLIC __attribute__ ((visibility("default"))) + #else + #pragma message ("Compiler does not support symbol visibility.") + #define DLL_PUBLIC + #endif +#endif + +char DLL_PUBLIC func_b() { + if('c' != 'c') { + exit(3); + } + return 'b'; +} diff --git a/test cases/common/159 subproject dir name collision/other_subdir/meson.build b/test cases/common/159 subproject dir name collision/other_subdir/meson.build new file mode 100644 index 0000000..90cb67a --- /dev/null +++ b/test cases/common/159 subproject dir name collision/other_subdir/meson.build @@ -0,0 +1 @@ +other = shared_library('other', 'custom_subproject_dir/other.c') diff --git a/test cases/common/160 config tool variable/meson.build b/test cases/common/160 config tool variable/meson.build new file mode 100644 index 0000000..9584117 --- /dev/null +++ b/test cases/common/160 config tool variable/meson.build @@ -0,0 +1,31 @@ +# Copyright © 2017 Intel Corporation +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +project('config tool variable', 'cpp') + + +dep_llvm = dependency('llvm', method : 'config-tool', required : false) +if not dep_llvm.found() + error('MESON_SKIP_TEST LLVM not installed.') +endif + +includedir = dep_llvm.get_configtool_variable('includedir') +includedir = join_paths(includedir, 'llvm') +if host_machine.system() == 'windows' + cmd = run_command(['dir', includedir]) +else + cmd = run_command(['ls', includedir]) +endif + +assert(cmd.returncode() == 0, 'did not run successfully') diff --git a/test cases/common/160 subproject dir name collision/a.c b/test cases/common/160 subproject dir name collision/a.c deleted file mode 100644 index 6ed96fa..0000000 --- a/test cases/common/160 subproject dir name collision/a.c +++ /dev/null @@ -1,13 +0,0 @@ -#include -char func_b(); -char func_c(); - -int main(int argc, char **argv) { - if(func_b() != 'b') { - return 1; - } - if(func_c() != 'c') { - return 2; - } - return 0; -} diff --git a/test cases/common/160 subproject dir name collision/custom_subproject_dir/B/b.c b/test cases/common/160 subproject dir name collision/custom_subproject_dir/B/b.c deleted file mode 100644 index 4c94ee9..0000000 --- a/test cases/common/160 subproject dir name collision/custom_subproject_dir/B/b.c +++ /dev/null @@ -1,20 +0,0 @@ -#include -char func_c(); - -#if defined _WIN32 || defined __CYGWIN__ -#define DLL_PUBLIC __declspec(dllexport) -#else - #if defined __GNUC__ - #define DLL_PUBLIC __attribute__ ((visibility("default"))) - #else - #pragma message ("Compiler does not support symbol visibility.") - #define DLL_PUBLIC - #endif -#endif - -char DLL_PUBLIC func_b() { - if(func_c() != 'c') { - exit(3); - } - return 'b'; -} diff --git a/test cases/common/160 subproject dir name collision/custom_subproject_dir/B/meson.build b/test cases/common/160 subproject dir name collision/custom_subproject_dir/B/meson.build deleted file mode 100644 index 280c60c..0000000 --- a/test cases/common/160 subproject dir name collision/custom_subproject_dir/B/meson.build +++ /dev/null @@ -1,4 +0,0 @@ -project('B', 'c') -C = subproject('C') -c = C.get_variable('c') -b = shared_library('b', 'b.c', link_with : c) diff --git a/test cases/common/160 subproject dir name collision/custom_subproject_dir/C/c.c b/test cases/common/160 subproject dir name collision/custom_subproject_dir/C/c.c deleted file mode 100644 index eebfb9f..0000000 --- a/test cases/common/160 subproject dir name collision/custom_subproject_dir/C/c.c +++ /dev/null @@ -1,14 +0,0 @@ -#if defined _WIN32 || defined __CYGWIN__ -#define DLL_PUBLIC __declspec(dllexport) -#else - #if defined __GNUC__ - #define DLL_PUBLIC __attribute__ ((visibility("default"))) - #else - #pragma message ("Compiler does not support symbol visibility.") - #define DLL_PUBLIC - #endif -#endif - -char DLL_PUBLIC func_c() { - return 'c'; -} diff --git a/test cases/common/160 subproject dir name collision/custom_subproject_dir/C/meson.build b/test cases/common/160 subproject dir name collision/custom_subproject_dir/C/meson.build deleted file mode 100644 index abf0b1e..0000000 --- a/test cases/common/160 subproject dir name collision/custom_subproject_dir/C/meson.build +++ /dev/null @@ -1,2 +0,0 @@ -project('C', 'c') -c = shared_library('c', 'c.c') diff --git a/test cases/common/160 subproject dir name collision/meson.build b/test cases/common/160 subproject dir name collision/meson.build deleted file mode 100644 index 5531217..0000000 --- a/test cases/common/160 subproject dir name collision/meson.build +++ /dev/null @@ -1,12 +0,0 @@ -project('A', 'c', subproject_dir:'custom_subproject_dir') - -B = subproject('B') -b = B.get_variable('b') - -C = subproject('C') -c = C.get_variable('c') - -subdir('other_subdir') - -a = executable('a', 'a.c', link_with : [b, c]) -test('a test', a) diff --git a/test cases/common/160 subproject dir name collision/other_subdir/custom_subproject_dir/other.c b/test cases/common/160 subproject dir name collision/other_subdir/custom_subproject_dir/other.c deleted file mode 100644 index 0c27f84..0000000 --- a/test cases/common/160 subproject dir name collision/other_subdir/custom_subproject_dir/other.c +++ /dev/null @@ -1,19 +0,0 @@ -#include - -#if defined _WIN32 || defined __CYGWIN__ -#define DLL_PUBLIC __declspec(dllexport) -#else - #if defined __GNUC__ - #define DLL_PUBLIC __attribute__ ((visibility("default"))) - #else - #pragma message ("Compiler does not support symbol visibility.") - #define DLL_PUBLIC - #endif -#endif - -char DLL_PUBLIC func_b() { - if('c' != 'c') { - exit(3); - } - return 'b'; -} diff --git a/test cases/common/160 subproject dir name collision/other_subdir/meson.build b/test cases/common/160 subproject dir name collision/other_subdir/meson.build deleted file mode 100644 index 90cb67a..0000000 --- a/test cases/common/160 subproject dir name collision/other_subdir/meson.build +++ /dev/null @@ -1 +0,0 @@ -other = shared_library('other', 'custom_subproject_dir/other.c') diff --git a/test cases/common/161 config tool variable/meson.build b/test cases/common/161 config tool variable/meson.build deleted file mode 100644 index 9584117..0000000 --- a/test cases/common/161 config tool variable/meson.build +++ /dev/null @@ -1,31 +0,0 @@ -# Copyright © 2017 Intel Corporation -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -project('config tool variable', 'cpp') - - -dep_llvm = dependency('llvm', method : 'config-tool', required : false) -if not dep_llvm.found() - error('MESON_SKIP_TEST LLVM not installed.') -endif - -includedir = dep_llvm.get_configtool_variable('includedir') -includedir = join_paths(includedir, 'llvm') -if host_machine.system() == 'windows' - cmd = run_command(['dir', includedir]) -else - cmd = run_command(['ls', includedir]) -endif - -assert(cmd.returncode() == 0, 'did not run successfully') diff --git a/test cases/common/161 custom target subdir depend files/copyfile.py b/test cases/common/161 custom target subdir depend files/copyfile.py new file mode 100644 index 0000000..ff42ac3 --- /dev/null +++ b/test cases/common/161 custom target subdir depend files/copyfile.py @@ -0,0 +1,6 @@ +#!/usr/bin/env python3 + +import sys +import shutil + +shutil.copyfile(sys.argv[1], sys.argv[2]) diff --git a/test cases/common/161 custom target subdir depend files/meson.build b/test cases/common/161 custom target subdir depend files/meson.build new file mode 100644 index 0000000..44f5c71 --- /dev/null +++ b/test cases/common/161 custom target subdir depend files/meson.build @@ -0,0 +1,7 @@ +project('custom target subdir depend files', 'c') + +copy = find_program('copyfile.py') + +subdir('subdir') + +executable('foo', foo_src) diff --git a/test cases/common/161 custom target subdir depend files/subdir/dep.dat b/test cases/common/161 custom target subdir depend files/subdir/dep.dat new file mode 100644 index 0000000..5daee49 --- /dev/null +++ b/test cases/common/161 custom target subdir depend files/subdir/dep.dat @@ -0,0 +1 @@ +You can depend on this file. \ No newline at end of file diff --git a/test cases/common/161 custom target subdir depend files/subdir/foo.c.in b/test cases/common/161 custom target subdir depend files/subdir/foo.c.in new file mode 100644 index 0000000..d53846f --- /dev/null +++ b/test cases/common/161 custom target subdir depend files/subdir/foo.c.in @@ -0,0 +1,6 @@ +#include + +int main() { + printf("foo is working.\n"); + return 0; +} diff --git a/test cases/common/161 custom target subdir depend files/subdir/meson.build b/test cases/common/161 custom target subdir depend files/subdir/meson.build new file mode 100644 index 0000000..f9d31c4 --- /dev/null +++ b/test cases/common/161 custom target subdir depend files/subdir/meson.build @@ -0,0 +1,6 @@ +foo_src = custom_target('foo_src', + depend_files : 'dep.dat', + input : 'foo.c.in', + output : 'foo.c', + command : [copy, '@INPUT@', '@OUTPUT@'] +) diff --git a/test cases/common/162 custom target subdir depend files/copyfile.py b/test cases/common/162 custom target subdir depend files/copyfile.py deleted file mode 100644 index ff42ac3..0000000 --- a/test cases/common/162 custom target subdir depend files/copyfile.py +++ /dev/null @@ -1,6 +0,0 @@ -#!/usr/bin/env python3 - -import sys -import shutil - -shutil.copyfile(sys.argv[1], sys.argv[2]) diff --git a/test cases/common/162 custom target subdir depend files/meson.build b/test cases/common/162 custom target subdir depend files/meson.build deleted file mode 100644 index 44f5c71..0000000 --- a/test cases/common/162 custom target subdir depend files/meson.build +++ /dev/null @@ -1,7 +0,0 @@ -project('custom target subdir depend files', 'c') - -copy = find_program('copyfile.py') - -subdir('subdir') - -executable('foo', foo_src) diff --git a/test cases/common/162 custom target subdir depend files/subdir/dep.dat b/test cases/common/162 custom target subdir depend files/subdir/dep.dat deleted file mode 100644 index 5daee49..0000000 --- a/test cases/common/162 custom target subdir depend files/subdir/dep.dat +++ /dev/null @@ -1 +0,0 @@ -You can depend on this file. \ No newline at end of file diff --git a/test cases/common/162 custom target subdir depend files/subdir/foo.c.in b/test cases/common/162 custom target subdir depend files/subdir/foo.c.in deleted file mode 100644 index d53846f..0000000 --- a/test cases/common/162 custom target subdir depend files/subdir/foo.c.in +++ /dev/null @@ -1,6 +0,0 @@ -#include - -int main() { - printf("foo is working.\n"); - return 0; -} diff --git a/test cases/common/162 custom target subdir depend files/subdir/meson.build b/test cases/common/162 custom target subdir depend files/subdir/meson.build deleted file mode 100644 index f9d31c4..0000000 --- a/test cases/common/162 custom target subdir depend files/subdir/meson.build +++ /dev/null @@ -1,6 +0,0 @@ -foo_src = custom_target('foo_src', - depend_files : 'dep.dat', - input : 'foo.c.in', - output : 'foo.c', - command : [copy, '@INPUT@', '@OUTPUT@'] -) diff --git a/test cases/common/162 external program shebang parsing/input.txt b/test cases/common/162 external program shebang parsing/input.txt new file mode 100644 index 0000000..40e30d4 --- /dev/null +++ b/test cases/common/162 external program shebang parsing/input.txt @@ -0,0 +1 @@ +some stuff here diff --git a/test cases/common/162 external program shebang parsing/main.c b/test cases/common/162 external program shebang parsing/main.c new file mode 100644 index 0000000..a90206b --- /dev/null +++ b/test cases/common/162 external program shebang parsing/main.c @@ -0,0 +1,72 @@ +#include +#include +#include +#include +#include +#include + +#ifdef _WIN32 + #include + #include +#else + #include +#endif + +/* Who cares about stack sizes in test programs anyway */ +#define LINE_LENGTH 4096 + +static int +intrp_copyfile (char * src, char * dest) +{ +#ifdef _WIN32 + if (!CopyFile (src, dest, FALSE)) + return 1; + return 0; +#else + return execlp ("cp", "copyfile", src, dest, NULL); +#endif +} + +static void +parser_get_line (FILE * f, char line[LINE_LENGTH]) +{ + if (!fgets (line, LINE_LENGTH, f)) + fprintf (stderr, "%s\n", strerror (errno)); +} + +int +main (int argc, char * argv[]) +{ + FILE *f = NULL; + char line[LINE_LENGTH]; + + if (argc != 4) { + fprintf (stderr, "Invalid number of arguments: %i\n", argc); + goto err; + } + + if ((f = fopen (argv[1], "r")) == NULL) { + fprintf (stderr, "%s\n", strerror (errno)); + goto err; + } + + parser_get_line (f, line); + + if (!line || line[0] != '#' || line[1] != '!') { + fprintf (stderr, "Invalid script\n"); + goto err; + } + + parser_get_line (f, line); + + if (!line || strncmp (line, "copy", 4) != 0) { + fprintf (stderr, "Syntax error: %s\n", line); + goto err; + } + + return intrp_copyfile (argv[2], argv[3]); + +err: + fclose (f); + return 1; +} diff --git a/test cases/common/162 external program shebang parsing/meson.build b/test cases/common/162 external program shebang parsing/meson.build new file mode 100644 index 0000000..c1cc5af --- /dev/null +++ b/test cases/common/162 external program shebang parsing/meson.build @@ -0,0 +1,21 @@ +project('shebang parsing', 'c') + +interpreter = executable('aninterp', 'main.c', native : true) + +cdata = configuration_data() +cdata.set('INTRP', interpreter.full_path()) + +f = configure_file(input : 'script.int.in', + output : 'script.int', + configuration : cdata) + +# Test that parsing a shebang with spaces works properly. See `man execve`, +# specifically the section on "Interpreter scripts" and the one under "NOTES". +script = find_program(f) + +custom_target('interpthis', + input : 'input.txt', + output : 'output.txt', + depends : interpreter, + command : [script, '@INPUT@', '@OUTPUT@'], + build_by_default : true) diff --git a/test cases/common/162 external program shebang parsing/script.int.in b/test cases/common/162 external program shebang parsing/script.int.in new file mode 100644 index 0000000..77ff909 --- /dev/null +++ b/test cases/common/162 external program shebang parsing/script.int.in @@ -0,0 +1,2 @@ +#!/usr/bin/env @INTRP@ +copy diff --git a/test cases/common/163 disabler/meson.build b/test cases/common/163 disabler/meson.build new file mode 100644 index 0000000..9437ace --- /dev/null +++ b/test cases/common/163 disabler/meson.build @@ -0,0 +1,43 @@ +project('dolphin option', 'c') + +d = disabler() + +d2 = dependency(d) +d3 = (d == d2) +d4 = d + 0 +d5 = d2 or true + +assert(d, 'Disabler did not cause this to be skipped.') +assert(d2, 'Function laundered disabler did not cause this to be skipped.') +assert(d3, 'Disabler comparison should yield disabler and thus this would not be called.') +assert(d4, 'Disabler addition should yield disabler and thus this would not be called.') +assert(d5, 'Disabler logic op should yield disabler and thus this would not be called.') + +number = 0 + +if d + number = 1 +else + number = 2 +endif + +assert(number == 0, 'Plain if handled incorrectly, value should be 0 but is @0@'.format(number)) + +if d.found() + number = 1 +else + number = 2 +endif + +assert(number == 2, 'If found handled incorrectly, value should be 2 but is @0@'.format(number)) + +dep = dependency('notfounddep', required : false, disabler : true) +app = executable('myapp', 'notfound.c', dependencies : [dep]) +app = executable('myapp', 'notfound.c', dependencies : [[dep]]) + +cc = meson.get_compiler('c') +dep = cc.find_library('notfounddep', required : false, disabler : true) +app = executable('myapp', 'notfound.c', dependencies : [dep]) + +dep = find_program('donotfindme', required : false, disabler : true) +app = executable('myapp', 'notfound.c', dependencies : [dep]) diff --git a/test cases/common/163 external program shebang parsing/input.txt b/test cases/common/163 external program shebang parsing/input.txt deleted file mode 100644 index 40e30d4..0000000 --- a/test cases/common/163 external program shebang parsing/input.txt +++ /dev/null @@ -1 +0,0 @@ -some stuff here diff --git a/test cases/common/163 external program shebang parsing/main.c b/test cases/common/163 external program shebang parsing/main.c deleted file mode 100644 index a90206b..0000000 --- a/test cases/common/163 external program shebang parsing/main.c +++ /dev/null @@ -1,72 +0,0 @@ -#include -#include -#include -#include -#include -#include - -#ifdef _WIN32 - #include - #include -#else - #include -#endif - -/* Who cares about stack sizes in test programs anyway */ -#define LINE_LENGTH 4096 - -static int -intrp_copyfile (char * src, char * dest) -{ -#ifdef _WIN32 - if (!CopyFile (src, dest, FALSE)) - return 1; - return 0; -#else - return execlp ("cp", "copyfile", src, dest, NULL); -#endif -} - -static void -parser_get_line (FILE * f, char line[LINE_LENGTH]) -{ - if (!fgets (line, LINE_LENGTH, f)) - fprintf (stderr, "%s\n", strerror (errno)); -} - -int -main (int argc, char * argv[]) -{ - FILE *f = NULL; - char line[LINE_LENGTH]; - - if (argc != 4) { - fprintf (stderr, "Invalid number of arguments: %i\n", argc); - goto err; - } - - if ((f = fopen (argv[1], "r")) == NULL) { - fprintf (stderr, "%s\n", strerror (errno)); - goto err; - } - - parser_get_line (f, line); - - if (!line || line[0] != '#' || line[1] != '!') { - fprintf (stderr, "Invalid script\n"); - goto err; - } - - parser_get_line (f, line); - - if (!line || strncmp (line, "copy", 4) != 0) { - fprintf (stderr, "Syntax error: %s\n", line); - goto err; - } - - return intrp_copyfile (argv[2], argv[3]); - -err: - fclose (f); - return 1; -} diff --git a/test cases/common/163 external program shebang parsing/meson.build b/test cases/common/163 external program shebang parsing/meson.build deleted file mode 100644 index c1cc5af..0000000 --- a/test cases/common/163 external program shebang parsing/meson.build +++ /dev/null @@ -1,21 +0,0 @@ -project('shebang parsing', 'c') - -interpreter = executable('aninterp', 'main.c', native : true) - -cdata = configuration_data() -cdata.set('INTRP', interpreter.full_path()) - -f = configure_file(input : 'script.int.in', - output : 'script.int', - configuration : cdata) - -# Test that parsing a shebang with spaces works properly. See `man execve`, -# specifically the section on "Interpreter scripts" and the one under "NOTES". -script = find_program(f) - -custom_target('interpthis', - input : 'input.txt', - output : 'output.txt', - depends : interpreter, - command : [script, '@INPUT@', '@OUTPUT@'], - build_by_default : true) diff --git a/test cases/common/163 external program shebang parsing/script.int.in b/test cases/common/163 external program shebang parsing/script.int.in deleted file mode 100644 index 77ff909..0000000 --- a/test cases/common/163 external program shebang parsing/script.int.in +++ /dev/null @@ -1,2 +0,0 @@ -#!/usr/bin/env @INTRP@ -copy diff --git a/test cases/common/164 array option/meson.build b/test cases/common/164 array option/meson.build new file mode 100644 index 0000000..034b9a5 --- /dev/null +++ b/test cases/common/164 array option/meson.build @@ -0,0 +1,17 @@ +# Copyright © 2017 Intel Corporation +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +project('array default options') + +assert(get_option('array') == ['foo', 'bar'], 'Default value for array is not equal to choices') diff --git a/test cases/common/164 array option/meson_options.txt b/test cases/common/164 array option/meson_options.txt new file mode 100644 index 0000000..7ed0ac1 --- /dev/null +++ b/test cases/common/164 array option/meson_options.txt @@ -0,0 +1,19 @@ +# Copyright © 2017 Intel Corporation +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +option( + 'array', + type : 'array', + choices : ['foo', 'bar'], +) diff --git a/test cases/common/164 disabler/meson.build b/test cases/common/164 disabler/meson.build deleted file mode 100644 index 9437ace..0000000 --- a/test cases/common/164 disabler/meson.build +++ /dev/null @@ -1,43 +0,0 @@ -project('dolphin option', 'c') - -d = disabler() - -d2 = dependency(d) -d3 = (d == d2) -d4 = d + 0 -d5 = d2 or true - -assert(d, 'Disabler did not cause this to be skipped.') -assert(d2, 'Function laundered disabler did not cause this to be skipped.') -assert(d3, 'Disabler comparison should yield disabler and thus this would not be called.') -assert(d4, 'Disabler addition should yield disabler and thus this would not be called.') -assert(d5, 'Disabler logic op should yield disabler and thus this would not be called.') - -number = 0 - -if d - number = 1 -else - number = 2 -endif - -assert(number == 0, 'Plain if handled incorrectly, value should be 0 but is @0@'.format(number)) - -if d.found() - number = 1 -else - number = 2 -endif - -assert(number == 2, 'If found handled incorrectly, value should be 2 but is @0@'.format(number)) - -dep = dependency('notfounddep', required : false, disabler : true) -app = executable('myapp', 'notfound.c', dependencies : [dep]) -app = executable('myapp', 'notfound.c', dependencies : [[dep]]) - -cc = meson.get_compiler('c') -dep = cc.find_library('notfounddep', required : false, disabler : true) -app = executable('myapp', 'notfound.c', dependencies : [dep]) - -dep = find_program('donotfindme', required : false, disabler : true) -app = executable('myapp', 'notfound.c', dependencies : [dep]) diff --git a/test cases/common/165 array option/meson.build b/test cases/common/165 array option/meson.build deleted file mode 100644 index 034b9a5..0000000 --- a/test cases/common/165 array option/meson.build +++ /dev/null @@ -1,17 +0,0 @@ -# Copyright © 2017 Intel Corporation -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -project('array default options') - -assert(get_option('array') == ['foo', 'bar'], 'Default value for array is not equal to choices') diff --git a/test cases/common/165 array option/meson_options.txt b/test cases/common/165 array option/meson_options.txt deleted file mode 100644 index 7ed0ac1..0000000 --- a/test cases/common/165 array option/meson_options.txt +++ /dev/null @@ -1,19 +0,0 @@ -# Copyright © 2017 Intel Corporation -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -option( - 'array', - type : 'array', - choices : ['foo', 'bar'], -) diff --git a/test cases/common/165 custom target template substitution/checkcopy.py b/test cases/common/165 custom target template substitution/checkcopy.py new file mode 100644 index 0000000..ab9f436 --- /dev/null +++ b/test cases/common/165 custom target template substitution/checkcopy.py @@ -0,0 +1,9 @@ +#!/usr/bin/env python3 + +import sys +import shutil + +if '@INPUT1@' in sys.argv[1]: + shutil.copyfile(sys.argv[2], sys.argv[3]) +else: + sys.exit('String @INPUT1@ not found in "{}"'.format(sys.argv[1])) diff --git a/test cases/common/165 custom target template substitution/foo.c.in b/test cases/common/165 custom target template substitution/foo.c.in new file mode 100644 index 0000000..d53846f --- /dev/null +++ b/test cases/common/165 custom target template substitution/foo.c.in @@ -0,0 +1,6 @@ +#include + +int main() { + printf("foo is working.\n"); + return 0; +} diff --git a/test cases/common/165 custom target template substitution/meson.build b/test cases/common/165 custom target template substitution/meson.build new file mode 100644 index 0000000..737408e --- /dev/null +++ b/test cases/common/165 custom target template substitution/meson.build @@ -0,0 +1,17 @@ +project('custom target template substitution', 'c') + +check = find_program('checkcopy.py') + +config = configuration_data() + +config_file = configure_file(configuration : config, output : 'x@IN') + +# Check that substitution does not find @FOO@ and then misses @INPUT0@. +# Check the resulting x@INPUT1@ is not replaced. +foo = custom_target('runcheck', + input : [config_file, 'foo.c.in'], + output : 'foo.c', + command : [check, '-D@FOO@INPUT0@PUT1@', '@INPUT1@', '@OUTPUT@'] +) + +executable('foo', foo) diff --git a/test cases/common/166 custom target template substitution/checkcopy.py b/test cases/common/166 custom target template substitution/checkcopy.py deleted file mode 100644 index ab9f436..0000000 --- a/test cases/common/166 custom target template substitution/checkcopy.py +++ /dev/null @@ -1,9 +0,0 @@ -#!/usr/bin/env python3 - -import sys -import shutil - -if '@INPUT1@' in sys.argv[1]: - shutil.copyfile(sys.argv[2], sys.argv[3]) -else: - sys.exit('String @INPUT1@ not found in "{}"'.format(sys.argv[1])) diff --git a/test cases/common/166 custom target template substitution/foo.c.in b/test cases/common/166 custom target template substitution/foo.c.in deleted file mode 100644 index d53846f..0000000 --- a/test cases/common/166 custom target template substitution/foo.c.in +++ /dev/null @@ -1,6 +0,0 @@ -#include - -int main() { - printf("foo is working.\n"); - return 0; -} diff --git a/test cases/common/166 custom target template substitution/meson.build b/test cases/common/166 custom target template substitution/meson.build deleted file mode 100644 index 737408e..0000000 --- a/test cases/common/166 custom target template substitution/meson.build +++ /dev/null @@ -1,17 +0,0 @@ -project('custom target template substitution', 'c') - -check = find_program('checkcopy.py') - -config = configuration_data() - -config_file = configure_file(configuration : config, output : 'x@IN') - -# Check that substitution does not find @FOO@ and then misses @INPUT0@. -# Check the resulting x@INPUT1@ is not replaced. -foo = custom_target('runcheck', - input : [config_file, 'foo.c.in'], - output : 'foo.c', - command : [check, '-D@FOO@INPUT0@PUT1@', '@INPUT1@', '@OUTPUT@'] -) - -executable('foo', foo) diff --git a/test cases/common/166 not-found dependency/meson.build b/test cases/common/166 not-found dependency/meson.build new file mode 100644 index 0000000..02072b6 --- /dev/null +++ b/test cases/common/166 not-found dependency/meson.build @@ -0,0 +1,14 @@ +project('dep-test', 'c') + +dep = dependency('', required:false) +if dep.found() + error('not-found dependency was found') +endif + +assert(dep.type_name() == 'not-found', 'dependency should be of type "not-found" not ' + dep.type_name()) + +library('testlib', 'testlib.c', dependencies: [dep]) +subdir('sub', if_found: dep) + +subdep = dependency('', fallback: ['trivial', 'trivial_dep']) +missing = dependency('', fallback: ['missing', 'missing_dep'], required: false) diff --git a/test cases/common/166 not-found dependency/sub/meson.build b/test cases/common/166 not-found dependency/sub/meson.build new file mode 100644 index 0000000..2a33cae --- /dev/null +++ b/test cases/common/166 not-found dependency/sub/meson.build @@ -0,0 +1 @@ +error('should be disabled by subdir(if_found:)') diff --git a/test cases/common/166 not-found dependency/subprojects/trivial/meson.build b/test cases/common/166 not-found dependency/subprojects/trivial/meson.build new file mode 100644 index 0000000..8769c70 --- /dev/null +++ b/test cases/common/166 not-found dependency/subprojects/trivial/meson.build @@ -0,0 +1,3 @@ +project('trivial subproject', 'c') +trivial_lib = static_library('trivial', 'trivial.c', install: false) +trivial_dep = declare_dependency(link_with: trivial_lib) diff --git a/test cases/common/166 not-found dependency/subprojects/trivial/trivial.c b/test cases/common/166 not-found dependency/subprojects/trivial/trivial.c new file mode 100644 index 0000000..35b21e0 --- /dev/null +++ b/test cases/common/166 not-found dependency/subprojects/trivial/trivial.c @@ -0,0 +1,3 @@ +int subfunc() { + return 42; +} diff --git a/test cases/common/166 not-found dependency/testlib.c b/test cases/common/166 not-found dependency/testlib.c new file mode 100644 index 0000000..e69de29 diff --git a/test cases/common/167 not-found dependency/meson.build b/test cases/common/167 not-found dependency/meson.build deleted file mode 100644 index 02072b6..0000000 --- a/test cases/common/167 not-found dependency/meson.build +++ /dev/null @@ -1,14 +0,0 @@ -project('dep-test', 'c') - -dep = dependency('', required:false) -if dep.found() - error('not-found dependency was found') -endif - -assert(dep.type_name() == 'not-found', 'dependency should be of type "not-found" not ' + dep.type_name()) - -library('testlib', 'testlib.c', dependencies: [dep]) -subdir('sub', if_found: dep) - -subdep = dependency('', fallback: ['trivial', 'trivial_dep']) -missing = dependency('', fallback: ['missing', 'missing_dep'], required: false) diff --git a/test cases/common/167 not-found dependency/sub/meson.build b/test cases/common/167 not-found dependency/sub/meson.build deleted file mode 100644 index 2a33cae..0000000 --- a/test cases/common/167 not-found dependency/sub/meson.build +++ /dev/null @@ -1 +0,0 @@ -error('should be disabled by subdir(if_found:)') diff --git a/test cases/common/167 not-found dependency/subprojects/trivial/meson.build b/test cases/common/167 not-found dependency/subprojects/trivial/meson.build deleted file mode 100644 index 8769c70..0000000 --- a/test cases/common/167 not-found dependency/subprojects/trivial/meson.build +++ /dev/null @@ -1,3 +0,0 @@ -project('trivial subproject', 'c') -trivial_lib = static_library('trivial', 'trivial.c', install: false) -trivial_dep = declare_dependency(link_with: trivial_lib) diff --git a/test cases/common/167 not-found dependency/subprojects/trivial/trivial.c b/test cases/common/167 not-found dependency/subprojects/trivial/trivial.c deleted file mode 100644 index 35b21e0..0000000 --- a/test cases/common/167 not-found dependency/subprojects/trivial/trivial.c +++ /dev/null @@ -1,3 +0,0 @@ -int subfunc() { - return 42; -} diff --git a/test cases/common/167 not-found dependency/testlib.c b/test cases/common/167 not-found dependency/testlib.c deleted file mode 100644 index e69de29..0000000 diff --git a/test cases/common/167 subdir if_found/meson.build b/test cases/common/167 subdir if_found/meson.build new file mode 100644 index 0000000..2c640cf --- /dev/null +++ b/test cases/common/167 subdir if_found/meson.build @@ -0,0 +1,11 @@ +project('subdir if found', 'c') + +found_dep = declare_dependency() +not_found_dep = dependency('nonexisting', required : false) + +subdir('nonexisting_dir', if_found : not_found_dep) + +variable = 3 + +subdir('subdir', if_found : found_dep) +assert(variable == 5, 'Subdir was not properly entered.') diff --git a/test cases/common/167 subdir if_found/subdir/meson.build b/test cases/common/167 subdir if_found/subdir/meson.build new file mode 100644 index 0000000..1030e25 --- /dev/null +++ b/test cases/common/167 subdir if_found/subdir/meson.build @@ -0,0 +1 @@ +variable = 5 diff --git a/test cases/common/168 default options prefix dependent defaults/meson.build b/test cases/common/168 default options prefix dependent defaults/meson.build new file mode 100644 index 0000000..9ca4ec5 --- /dev/null +++ b/test cases/common/168 default options prefix dependent defaults/meson.build @@ -0,0 +1 @@ +project('default options prefix dependent defaults ', 'c', default_options : ['sharedstatedir=/sharedstate', 'prefix=/usr']) diff --git a/test cases/common/168 subdir if_found/meson.build b/test cases/common/168 subdir if_found/meson.build deleted file mode 100644 index 2c640cf..0000000 --- a/test cases/common/168 subdir if_found/meson.build +++ /dev/null @@ -1,11 +0,0 @@ -project('subdir if found', 'c') - -found_dep = declare_dependency() -not_found_dep = dependency('nonexisting', required : false) - -subdir('nonexisting_dir', if_found : not_found_dep) - -variable = 3 - -subdir('subdir', if_found : found_dep) -assert(variable == 5, 'Subdir was not properly entered.') diff --git a/test cases/common/168 subdir if_found/subdir/meson.build b/test cases/common/168 subdir if_found/subdir/meson.build deleted file mode 100644 index 1030e25..0000000 --- a/test cases/common/168 subdir if_found/subdir/meson.build +++ /dev/null @@ -1 +0,0 @@ -variable = 5 diff --git a/test cases/common/169 default options prefix dependent defaults/meson.build b/test cases/common/169 default options prefix dependent defaults/meson.build deleted file mode 100644 index 9ca4ec5..0000000 --- a/test cases/common/169 default options prefix dependent defaults/meson.build +++ /dev/null @@ -1 +0,0 @@ -project('default options prefix dependent defaults ', 'c', default_options : ['sharedstatedir=/sharedstate', 'prefix=/usr']) diff --git a/test cases/common/169 dependency factory/meson.build b/test cases/common/169 dependency factory/meson.build new file mode 100644 index 0000000..2de0f0e --- /dev/null +++ b/test cases/common/169 dependency factory/meson.build @@ -0,0 +1,51 @@ +project('dependency factory', 'c', meson_version : '>=0.40') + +dep = dependency('gl', method: 'pkg-config', required: false) +if dep.found() and dep.type_name() == 'pkgconfig' + dep.get_pkgconfig_variable('prefix') +endif + +dep = dependency('SDL2', method: 'pkg-config', required: false) +if dep.found() and dep.type_name() == 'pkgconfig' + dep.get_pkgconfig_variable('prefix') +endif + +dep = dependency('SDL2', method: 'config-tool', required: false) +if dep.found() and dep.type_name() == 'configtool' + dep.get_configtool_variable('prefix') +endif + +dep = dependency('Vulkan', method: 'pkg-config', required: false) +if dep.found() and dep.type_name() == 'pkgconfig' + dep.get_pkgconfig_variable('prefix') +endif + +dep = dependency('pcap', method: 'pkg-config', required: false) +if dep.found() and dep.type_name() == 'pkgconfig' + dep.get_pkgconfig_variable('prefix') +endif + +dep = dependency('pcap', method: 'config-tool', required: false) +if dep.found() and dep.type_name() == 'configtool' + dep.get_configtool_variable('prefix') +endif + +dep = dependency('cups', method: 'pkg-config', required: false) +if dep.found() and dep.type_name() == 'pkgconfig' + dep.get_pkgconfig_variable('prefix') +endif + +dep = dependency('cups', method: 'config-tool', required: false) +if dep.found() and dep.type_name() == 'configtool' + dep.get_configtool_variable('prefix') +endif + +dep = dependency('libwmf', method: 'pkg-config', required: false) +if dep.found() and dep.type_name() == 'pkgconfig' + dep.get_pkgconfig_variable('prefix') +endif + +dep = dependency('libwmf', method: 'config-tool', required: false) +if dep.found() and dep.type_name() == 'configtool' + dep.get_configtool_variable('prefix') +endif diff --git a/test cases/common/170 dependency factory/meson.build b/test cases/common/170 dependency factory/meson.build deleted file mode 100644 index 2de0f0e..0000000 --- a/test cases/common/170 dependency factory/meson.build +++ /dev/null @@ -1,51 +0,0 @@ -project('dependency factory', 'c', meson_version : '>=0.40') - -dep = dependency('gl', method: 'pkg-config', required: false) -if dep.found() and dep.type_name() == 'pkgconfig' - dep.get_pkgconfig_variable('prefix') -endif - -dep = dependency('SDL2', method: 'pkg-config', required: false) -if dep.found() and dep.type_name() == 'pkgconfig' - dep.get_pkgconfig_variable('prefix') -endif - -dep = dependency('SDL2', method: 'config-tool', required: false) -if dep.found() and dep.type_name() == 'configtool' - dep.get_configtool_variable('prefix') -endif - -dep = dependency('Vulkan', method: 'pkg-config', required: false) -if dep.found() and dep.type_name() == 'pkgconfig' - dep.get_pkgconfig_variable('prefix') -endif - -dep = dependency('pcap', method: 'pkg-config', required: false) -if dep.found() and dep.type_name() == 'pkgconfig' - dep.get_pkgconfig_variable('prefix') -endif - -dep = dependency('pcap', method: 'config-tool', required: false) -if dep.found() and dep.type_name() == 'configtool' - dep.get_configtool_variable('prefix') -endif - -dep = dependency('cups', method: 'pkg-config', required: false) -if dep.found() and dep.type_name() == 'pkgconfig' - dep.get_pkgconfig_variable('prefix') -endif - -dep = dependency('cups', method: 'config-tool', required: false) -if dep.found() and dep.type_name() == 'configtool' - dep.get_configtool_variable('prefix') -endif - -dep = dependency('libwmf', method: 'pkg-config', required: false) -if dep.found() and dep.type_name() == 'pkgconfig' - dep.get_pkgconfig_variable('prefix') -endif - -dep = dependency('libwmf', method: 'config-tool', required: false) -if dep.found() and dep.type_name() == 'configtool' - dep.get_configtool_variable('prefix') -endif diff --git a/test cases/common/170 get project license/bar.c b/test cases/common/170 get project license/bar.c new file mode 100644 index 0000000..864869b --- /dev/null +++ b/test cases/common/170 get project license/bar.c @@ -0,0 +1,6 @@ +#include + +int main(int argc, char **argv) { + printf("I'm a main project bar.\n"); + return 0; +} diff --git a/test cases/common/170 get project license/meson.build b/test cases/common/170 get project license/meson.build new file mode 100644 index 0000000..37303e3 --- /dev/null +++ b/test cases/common/170 get project license/meson.build @@ -0,0 +1,8 @@ +project('bar', 'c', license: 'Apache') + +executable('bar', 'bar.c') + +license = meson.project_license()[0] +if license != 'Apache' + error('The license should be Apache, but it is: ' + license) +endif diff --git a/test cases/common/171 get project license/bar.c b/test cases/common/171 get project license/bar.c deleted file mode 100644 index 864869b..0000000 --- a/test cases/common/171 get project license/bar.c +++ /dev/null @@ -1,6 +0,0 @@ -#include - -int main(int argc, char **argv) { - printf("I'm a main project bar.\n"); - return 0; -} diff --git a/test cases/common/171 get project license/meson.build b/test cases/common/171 get project license/meson.build deleted file mode 100644 index 37303e3..0000000 --- a/test cases/common/171 get project license/meson.build +++ /dev/null @@ -1,8 +0,0 @@ -project('bar', 'c', license: 'Apache') - -executable('bar', 'bar.c') - -license = meson.project_license()[0] -if license != 'Apache' - error('The license should be Apache, but it is: ' + license) -endif diff --git a/test cases/common/171 yield/meson.build b/test cases/common/171 yield/meson.build new file mode 100644 index 0000000..9b11569 --- /dev/null +++ b/test cases/common/171 yield/meson.build @@ -0,0 +1,7 @@ +project('yield_options', 'c') + +subproject('sub') + +assert(get_option('unshared_option') == 'one', 'Unshared option has wrong value in superproject.') +assert(get_option('shared_option') == 'two', 'Shared option has wrong value in superproject..') +assert(get_option('wrongtype_option') == 'three', 'Wrongtype option has wrong value in superproject..') diff --git a/test cases/common/171 yield/meson_options.txt b/test cases/common/171 yield/meson_options.txt new file mode 100644 index 0000000..9f58fbb --- /dev/null +++ b/test cases/common/171 yield/meson_options.txt @@ -0,0 +1,3 @@ +option('unshared_option', type : 'string', value : 'one') +option('shared_option', type : 'string', value : 'two') +option('wrongtype_option', type : 'string', value : 'three') diff --git a/test cases/common/171 yield/subprojects/sub/meson.build b/test cases/common/171 yield/subprojects/sub/meson.build new file mode 100644 index 0000000..832c13c --- /dev/null +++ b/test cases/common/171 yield/subprojects/sub/meson.build @@ -0,0 +1,5 @@ +project('subbie', 'c') + +assert(get_option('unshared_option') == 'three', 'Unshared option has wrong value in subproject.') +assert(get_option('shared_option') == 'two', 'Shared option has wrong value in subproject.') +assert(get_option('wrongtype_option') == true, 'Wrongtype option has wrong value in subproject.') diff --git a/test cases/common/171 yield/subprojects/sub/meson_options.txt b/test cases/common/171 yield/subprojects/sub/meson_options.txt new file mode 100644 index 0000000..101122e --- /dev/null +++ b/test cases/common/171 yield/subprojects/sub/meson_options.txt @@ -0,0 +1,3 @@ +option('unshared_option', type : 'string', value : 'three', yield : false) +option('shared_option', type : 'string', value : 'four', yield : true) +option('wrongtype_option', type : 'boolean', value : true, yield : true) diff --git a/test cases/common/172 subproject nested subproject dirs/contrib/subprojects/alpha/a.c b/test cases/common/172 subproject nested subproject dirs/contrib/subprojects/alpha/a.c new file mode 100644 index 0000000..7ac3e5e --- /dev/null +++ b/test cases/common/172 subproject nested subproject dirs/contrib/subprojects/alpha/a.c @@ -0,0 +1,15 @@ +int func2(); + +#if defined _WIN32 || defined __CYGWIN__ + #define DLL_PUBLIC __declspec(dllexport) +#else + #if defined __GNUC__ + #define DLL_PUBLIC __attribute__ ((visibility("default"))) + #else + #pragma message ("Compiler does not support symbol visibility.") + #define DLL_PUBLIC + #endif +#endif + +int DLL_PUBLIC func() { return func2(); } + diff --git a/test cases/common/172 subproject nested subproject dirs/contrib/subprojects/alpha/meson.build b/test cases/common/172 subproject nested subproject dirs/contrib/subprojects/alpha/meson.build new file mode 100644 index 0000000..12f6564 --- /dev/null +++ b/test cases/common/172 subproject nested subproject dirs/contrib/subprojects/alpha/meson.build @@ -0,0 +1,4 @@ +project('alpha project', 'c', subproject_dir: 'var/subprojects') + +b = subproject('beta') +l = shared_library('a', 'a.c', link_with : b.get_variable('lb')) diff --git a/test cases/common/172 subproject nested subproject dirs/contrib/subprojects/alpha/var/subprojects/wrap_files_might_be_here b/test cases/common/172 subproject nested subproject dirs/contrib/subprojects/alpha/var/subprojects/wrap_files_might_be_here new file mode 100644 index 0000000..8d1c8b6 --- /dev/null +++ b/test cases/common/172 subproject nested subproject dirs/contrib/subprojects/alpha/var/subprojects/wrap_files_might_be_here @@ -0,0 +1 @@ + diff --git a/test cases/common/172 subproject nested subproject dirs/contrib/subprojects/beta/b.c b/test cases/common/172 subproject nested subproject dirs/contrib/subprojects/beta/b.c new file mode 100644 index 0000000..a95651b --- /dev/null +++ b/test cases/common/172 subproject nested subproject dirs/contrib/subprojects/beta/b.c @@ -0,0 +1,14 @@ +#if defined _WIN32 || defined __CYGWIN__ + #define DLL_PUBLIC __declspec(dllexport) +#else + #if defined __GNUC__ + #define DLL_PUBLIC __attribute__ ((visibility("default"))) + #else + #pragma message ("Compiler does not support symbol visibility.") + #define DLL_PUBLIC + #endif +#endif + +int DLL_PUBLIC func2() { + return 42; +} diff --git a/test cases/common/172 subproject nested subproject dirs/contrib/subprojects/beta/meson.build b/test cases/common/172 subproject nested subproject dirs/contrib/subprojects/beta/meson.build new file mode 100644 index 0000000..1720d3e --- /dev/null +++ b/test cases/common/172 subproject nested subproject dirs/contrib/subprojects/beta/meson.build @@ -0,0 +1,4 @@ +project('beta project', 'c') + +lb = shared_library('b', 'b.c') +notfound = dependency('', required : false) diff --git a/test cases/common/172 subproject nested subproject dirs/meson.build b/test cases/common/172 subproject nested subproject dirs/meson.build new file mode 100644 index 0000000..875eed3 --- /dev/null +++ b/test cases/common/172 subproject nested subproject dirs/meson.build @@ -0,0 +1,11 @@ +project('gamma project', 'c', subproject_dir: 'contrib/subprojects') + +a = subproject('alpha') +lib = a.get_variable('l') + +# Ensure that the dependency version is not checked for a not-found dependency +notfound = dependency('', version : '>=1.0', required : false, + fallback : ['beta', 'notfound']) + +exe = executable('prog', 'prog.c', link_with : lib) +test('basic', exe) diff --git a/test cases/common/172 subproject nested subproject dirs/prog.c b/test cases/common/172 subproject nested subproject dirs/prog.c new file mode 100644 index 0000000..394f139 --- /dev/null +++ b/test cases/common/172 subproject nested subproject dirs/prog.c @@ -0,0 +1,5 @@ +int func(); + +int main(int argc, char **argv) { + return func() == 42 ? 0 : 1; +} diff --git a/test cases/common/172 yield/meson.build b/test cases/common/172 yield/meson.build deleted file mode 100644 index 9b11569..0000000 --- a/test cases/common/172 yield/meson.build +++ /dev/null @@ -1,7 +0,0 @@ -project('yield_options', 'c') - -subproject('sub') - -assert(get_option('unshared_option') == 'one', 'Unshared option has wrong value in superproject.') -assert(get_option('shared_option') == 'two', 'Shared option has wrong value in superproject..') -assert(get_option('wrongtype_option') == 'three', 'Wrongtype option has wrong value in superproject..') diff --git a/test cases/common/172 yield/meson_options.txt b/test cases/common/172 yield/meson_options.txt deleted file mode 100644 index 9f58fbb..0000000 --- a/test cases/common/172 yield/meson_options.txt +++ /dev/null @@ -1,3 +0,0 @@ -option('unshared_option', type : 'string', value : 'one') -option('shared_option', type : 'string', value : 'two') -option('wrongtype_option', type : 'string', value : 'three') diff --git a/test cases/common/172 yield/subprojects/sub/meson.build b/test cases/common/172 yield/subprojects/sub/meson.build deleted file mode 100644 index 832c13c..0000000 --- a/test cases/common/172 yield/subprojects/sub/meson.build +++ /dev/null @@ -1,5 +0,0 @@ -project('subbie', 'c') - -assert(get_option('unshared_option') == 'three', 'Unshared option has wrong value in subproject.') -assert(get_option('shared_option') == 'two', 'Shared option has wrong value in subproject.') -assert(get_option('wrongtype_option') == true, 'Wrongtype option has wrong value in subproject.') diff --git a/test cases/common/172 yield/subprojects/sub/meson_options.txt b/test cases/common/172 yield/subprojects/sub/meson_options.txt deleted file mode 100644 index 101122e..0000000 --- a/test cases/common/172 yield/subprojects/sub/meson_options.txt +++ /dev/null @@ -1,3 +0,0 @@ -option('unshared_option', type : 'string', value : 'three', yield : false) -option('shared_option', type : 'string', value : 'four', yield : true) -option('wrongtype_option', type : 'boolean', value : true, yield : true) diff --git a/test cases/common/173 preserve gendir/base.inp b/test cases/common/173 preserve gendir/base.inp new file mode 100644 index 0000000..df967b9 --- /dev/null +++ b/test cases/common/173 preserve gendir/base.inp @@ -0,0 +1 @@ +base diff --git a/test cases/common/173 preserve gendir/com/mesonbuild/subbie.inp b/test cases/common/173 preserve gendir/com/mesonbuild/subbie.inp new file mode 100644 index 0000000..df0f4e9 --- /dev/null +++ b/test cases/common/173 preserve gendir/com/mesonbuild/subbie.inp @@ -0,0 +1 @@ +subbie diff --git a/test cases/common/173 preserve gendir/genprog.py b/test cases/common/173 preserve gendir/genprog.py new file mode 100755 index 0000000..1e10998 --- /dev/null +++ b/test cases/common/173 preserve gendir/genprog.py @@ -0,0 +1,46 @@ +#!/usr/bin/env python3 + +import os, sys, argparse + +h_templ = '''#pragma once + +int %s(); +''' + +c_templ = '''#include"%s.h" + +int %s() { + return 0; +} +''' + +parser = argparse.ArgumentParser() +parser.add_argument('--searchdir', required=True) +parser.add_argument('--outdir', required=True) +parser.add_argument('ifiles', nargs='+') + +options = parser.parse_args() + +searchdir = options.searchdir +outdir = options.outdir +ifiles = options.ifiles + +rel_ofiles = [] + +for ifile in ifiles: + if not ifile.startswith(options.searchdir): + sys.exit('Input file %s does not start with search dir %s.' % (ifile, searchdir)) + rel_ofile = ifile[len(searchdir):] + if rel_ofile[0] == '/' or rel_ofile[0] == '\\': + rel_ofile = rel_ofile[1:] + rel_ofiles.append(os.path.splitext(rel_ofile)[0]) + +ofile_bases = [os.path.join(outdir, i) for i in rel_ofiles] + +for i, ifile_name in enumerate(ifiles): + proto_name = open(ifile_name).readline().strip() + h_out = ofile_bases[i] + '.h' + c_out = ofile_bases[i] + '.c' + os.makedirs(os.path.split(ofile_bases[i])[0], exist_ok=True) + open(h_out, 'w').write(h_templ % (proto_name)) + open(c_out, 'w').write(c_templ % (proto_name, proto_name)) diff --git a/test cases/common/173 preserve gendir/meson.build b/test cases/common/173 preserve gendir/meson.build new file mode 100644 index 0000000..ce219f0 --- /dev/null +++ b/test cases/common/173 preserve gendir/meson.build @@ -0,0 +1,13 @@ +project('preserve subdir', 'c') + +gprog = find_program('genprog.py') + +gen = generator(gprog, \ + output : ['@BASENAME@.c', '@BASENAME@.h'], + arguments : ['--searchdir=@CURRENT_SOURCE_DIR@', '--outdir=@BUILD_DIR@', '@INPUT@']) + +generated = gen.process('base.inp', 'com/mesonbuild/subbie.inp', + preserve_path_from : meson.current_source_dir()) + +e = executable('testprog', 'testprog.c', generated) +test('testprog', e) diff --git a/test cases/common/173 preserve gendir/testprog.c b/test cases/common/173 preserve gendir/testprog.c new file mode 100644 index 0000000..46b4602 --- /dev/null +++ b/test cases/common/173 preserve gendir/testprog.c @@ -0,0 +1,6 @@ +#include"base.h" +#include"com/mesonbuild/subbie.h" + +int main(int argc, char **argv) { + return base() + subbie(); +} diff --git a/test cases/common/173 subproject nested subproject dirs/contrib/subprojects/alpha/a.c b/test cases/common/173 subproject nested subproject dirs/contrib/subprojects/alpha/a.c deleted file mode 100644 index 7ac3e5e..0000000 --- a/test cases/common/173 subproject nested subproject dirs/contrib/subprojects/alpha/a.c +++ /dev/null @@ -1,15 +0,0 @@ -int func2(); - -#if defined _WIN32 || defined __CYGWIN__ - #define DLL_PUBLIC __declspec(dllexport) -#else - #if defined __GNUC__ - #define DLL_PUBLIC __attribute__ ((visibility("default"))) - #else - #pragma message ("Compiler does not support symbol visibility.") - #define DLL_PUBLIC - #endif -#endif - -int DLL_PUBLIC func() { return func2(); } - diff --git a/test cases/common/173 subproject nested subproject dirs/contrib/subprojects/alpha/meson.build b/test cases/common/173 subproject nested subproject dirs/contrib/subprojects/alpha/meson.build deleted file mode 100644 index 12f6564..0000000 --- a/test cases/common/173 subproject nested subproject dirs/contrib/subprojects/alpha/meson.build +++ /dev/null @@ -1,4 +0,0 @@ -project('alpha project', 'c', subproject_dir: 'var/subprojects') - -b = subproject('beta') -l = shared_library('a', 'a.c', link_with : b.get_variable('lb')) diff --git a/test cases/common/173 subproject nested subproject dirs/contrib/subprojects/alpha/var/subprojects/wrap_files_might_be_here b/test cases/common/173 subproject nested subproject dirs/contrib/subprojects/alpha/var/subprojects/wrap_files_might_be_here deleted file mode 100644 index 8d1c8b6..0000000 --- a/test cases/common/173 subproject nested subproject dirs/contrib/subprojects/alpha/var/subprojects/wrap_files_might_be_here +++ /dev/null @@ -1 +0,0 @@ - diff --git a/test cases/common/173 subproject nested subproject dirs/contrib/subprojects/beta/b.c b/test cases/common/173 subproject nested subproject dirs/contrib/subprojects/beta/b.c deleted file mode 100644 index a95651b..0000000 --- a/test cases/common/173 subproject nested subproject dirs/contrib/subprojects/beta/b.c +++ /dev/null @@ -1,14 +0,0 @@ -#if defined _WIN32 || defined __CYGWIN__ - #define DLL_PUBLIC __declspec(dllexport) -#else - #if defined __GNUC__ - #define DLL_PUBLIC __attribute__ ((visibility("default"))) - #else - #pragma message ("Compiler does not support symbol visibility.") - #define DLL_PUBLIC - #endif -#endif - -int DLL_PUBLIC func2() { - return 42; -} diff --git a/test cases/common/173 subproject nested subproject dirs/contrib/subprojects/beta/meson.build b/test cases/common/173 subproject nested subproject dirs/contrib/subprojects/beta/meson.build deleted file mode 100644 index 1720d3e..0000000 --- a/test cases/common/173 subproject nested subproject dirs/contrib/subprojects/beta/meson.build +++ /dev/null @@ -1,4 +0,0 @@ -project('beta project', 'c') - -lb = shared_library('b', 'b.c') -notfound = dependency('', required : false) diff --git a/test cases/common/173 subproject nested subproject dirs/meson.build b/test cases/common/173 subproject nested subproject dirs/meson.build deleted file mode 100644 index 875eed3..0000000 --- a/test cases/common/173 subproject nested subproject dirs/meson.build +++ /dev/null @@ -1,11 +0,0 @@ -project('gamma project', 'c', subproject_dir: 'contrib/subprojects') - -a = subproject('alpha') -lib = a.get_variable('l') - -# Ensure that the dependency version is not checked for a not-found dependency -notfound = dependency('', version : '>=1.0', required : false, - fallback : ['beta', 'notfound']) - -exe = executable('prog', 'prog.c', link_with : lib) -test('basic', exe) diff --git a/test cases/common/173 subproject nested subproject dirs/prog.c b/test cases/common/173 subproject nested subproject dirs/prog.c deleted file mode 100644 index 394f139..0000000 --- a/test cases/common/173 subproject nested subproject dirs/prog.c +++ /dev/null @@ -1,5 +0,0 @@ -int func(); - -int main(int argc, char **argv) { - return func() == 42 ? 0 : 1; -} diff --git a/test cases/common/174 preserve gendir/base.inp b/test cases/common/174 preserve gendir/base.inp deleted file mode 100644 index df967b9..0000000 --- a/test cases/common/174 preserve gendir/base.inp +++ /dev/null @@ -1 +0,0 @@ -base diff --git a/test cases/common/174 preserve gendir/com/mesonbuild/subbie.inp b/test cases/common/174 preserve gendir/com/mesonbuild/subbie.inp deleted file mode 100644 index df0f4e9..0000000 --- a/test cases/common/174 preserve gendir/com/mesonbuild/subbie.inp +++ /dev/null @@ -1 +0,0 @@ -subbie diff --git a/test cases/common/174 preserve gendir/genprog.py b/test cases/common/174 preserve gendir/genprog.py deleted file mode 100755 index 1e10998..0000000 --- a/test cases/common/174 preserve gendir/genprog.py +++ /dev/null @@ -1,46 +0,0 @@ -#!/usr/bin/env python3 - -import os, sys, argparse - -h_templ = '''#pragma once - -int %s(); -''' - -c_templ = '''#include"%s.h" - -int %s() { - return 0; -} -''' - -parser = argparse.ArgumentParser() -parser.add_argument('--searchdir', required=True) -parser.add_argument('--outdir', required=True) -parser.add_argument('ifiles', nargs='+') - -options = parser.parse_args() - -searchdir = options.searchdir -outdir = options.outdir -ifiles = options.ifiles - -rel_ofiles = [] - -for ifile in ifiles: - if not ifile.startswith(options.searchdir): - sys.exit('Input file %s does not start with search dir %s.' % (ifile, searchdir)) - rel_ofile = ifile[len(searchdir):] - if rel_ofile[0] == '/' or rel_ofile[0] == '\\': - rel_ofile = rel_ofile[1:] - rel_ofiles.append(os.path.splitext(rel_ofile)[0]) - -ofile_bases = [os.path.join(outdir, i) for i in rel_ofiles] - -for i, ifile_name in enumerate(ifiles): - proto_name = open(ifile_name).readline().strip() - h_out = ofile_bases[i] + '.h' - c_out = ofile_bases[i] + '.c' - os.makedirs(os.path.split(ofile_bases[i])[0], exist_ok=True) - open(h_out, 'w').write(h_templ % (proto_name)) - open(c_out, 'w').write(c_templ % (proto_name, proto_name)) diff --git a/test cases/common/174 preserve gendir/meson.build b/test cases/common/174 preserve gendir/meson.build deleted file mode 100644 index ce219f0..0000000 --- a/test cases/common/174 preserve gendir/meson.build +++ /dev/null @@ -1,13 +0,0 @@ -project('preserve subdir', 'c') - -gprog = find_program('genprog.py') - -gen = generator(gprog, \ - output : ['@BASENAME@.c', '@BASENAME@.h'], - arguments : ['--searchdir=@CURRENT_SOURCE_DIR@', '--outdir=@BUILD_DIR@', '@INPUT@']) - -generated = gen.process('base.inp', 'com/mesonbuild/subbie.inp', - preserve_path_from : meson.current_source_dir()) - -e = executable('testprog', 'testprog.c', generated) -test('testprog', e) diff --git a/test cases/common/174 preserve gendir/testprog.c b/test cases/common/174 preserve gendir/testprog.c deleted file mode 100644 index 46b4602..0000000 --- a/test cases/common/174 preserve gendir/testprog.c +++ /dev/null @@ -1,6 +0,0 @@ -#include"base.h" -#include"com/mesonbuild/subbie.h" - -int main(int argc, char **argv) { - return base() + subbie(); -} diff --git a/test cases/common/174 source in dep/bar.cpp b/test cases/common/174 source in dep/bar.cpp new file mode 100644 index 0000000..bda8cb6 --- /dev/null +++ b/test cases/common/174 source in dep/bar.cpp @@ -0,0 +1,5 @@ +extern "C" int foo(); + +int main(int, char**) { + return foo() != 42; +} diff --git a/test cases/common/174 source in dep/foo.c b/test cases/common/174 source in dep/foo.c new file mode 100644 index 0000000..1ecfa8c --- /dev/null +++ b/test cases/common/174 source in dep/foo.c @@ -0,0 +1,3 @@ +int foo() { + return 42; +} diff --git a/test cases/common/174 source in dep/generated/funname b/test cases/common/174 source in dep/generated/funname new file mode 100644 index 0000000..79f3c86 --- /dev/null +++ b/test cases/common/174 source in dep/generated/funname @@ -0,0 +1 @@ +my_wonderful_function diff --git a/test cases/common/174 source in dep/generated/genheader.py b/test cases/common/174 source in dep/generated/genheader.py new file mode 100755 index 0000000..eafc075 --- /dev/null +++ b/test cases/common/174 source in dep/generated/genheader.py @@ -0,0 +1,17 @@ +#!/usr/bin/env python3 + +import sys + +ifile = sys.argv[1] +ofile = sys.argv[2] + +templ = '''#pragma once + +int %s() { + return 42; +} +''' + +funname = open(ifile).readline().strip() + +open(ofile, 'w').write(templ % funname) diff --git a/test cases/common/174 source in dep/generated/main.c b/test cases/common/174 source in dep/generated/main.c new file mode 100644 index 0000000..07e7c93 --- /dev/null +++ b/test cases/common/174 source in dep/generated/main.c @@ -0,0 +1,5 @@ +#include"funheader.h" + +int main(int argc, char **argv) { + return my_wonderful_function() != 42; +} diff --git a/test cases/common/174 source in dep/generated/meson.build b/test cases/common/174 source in dep/generated/meson.build new file mode 100644 index 0000000..2862709 --- /dev/null +++ b/test cases/common/174 source in dep/generated/meson.build @@ -0,0 +1,12 @@ +fp = find_program('genheader.py') + +genh = custom_target('genh', + input : 'funname', + output : 'funheader.h', + command : [fp, '@INPUT@', '@OUTPUT@']) + +dep = declare_dependency(sources : [genh]) + +e = executable('genuser', 'main.c', + dependencies : dep) +test('genuser', e) diff --git a/test cases/common/174 source in dep/meson.build b/test cases/common/174 source in dep/meson.build new file mode 100644 index 0000000..7111ba1 --- /dev/null +++ b/test cases/common/174 source in dep/meson.build @@ -0,0 +1,8 @@ +project('foo', 'c', 'cpp') + +dep = declare_dependency(sources : 'foo.c') + +executable('bar', 'bar.cpp', + dependencies : dep) + +subdir('generated') diff --git a/test cases/common/175 generator link whole/export.h b/test cases/common/175 generator link whole/export.h new file mode 100644 index 0000000..f4f6f45 --- /dev/null +++ b/test cases/common/175 generator link whole/export.h @@ -0,0 +1,18 @@ +#pragma once + +#if defined BUILDING_EMBEDDED + #define DLL_PUBLIC +#elif defined _WIN32 || defined __CYGWIN__ + #if defined BUILDING_DLL + #define DLL_PUBLIC __declspec(dllexport) + #else + #define DLL_PUBLIC __declspec(dllimport) + #endif +#else + #if defined __GNUC__ + #define DLL_PUBLIC __attribute__ ((visibility("default"))) + #else + #pragma message ("Compiler does not support symbol visibility.") + #define DLL_PUBLIC + #endif +#endif diff --git a/test cases/common/175 generator link whole/generator.py b/test cases/common/175 generator link whole/generator.py new file mode 100755 index 0000000..0076b74 --- /dev/null +++ b/test cases/common/175 generator link whole/generator.py @@ -0,0 +1,30 @@ +#!/usr/bin/env python3 + +import os +import os.path +import sys + + +def main(): + name = os.path.splitext(os.path.basename(sys.argv[1]))[0] + out = sys.argv[2] + hname = os.path.join(out, name + '.h') + cname = os.path.join(out, name + '.c') + print(os.getcwd(), hname) + with open(hname, 'w') as hfile: + hfile.write(''' +#pragma once +#include "export.h" +int DLL_PUBLIC {name}(); +'''.format(name=name)) + with open(cname, 'w') as cfile: + cfile.write(''' +#include "{name}.h" +int {name}() {{ + return {size}; +}} +'''.format(name=name, size=len(name))) + + +if __name__ == '__main__': + main() diff --git a/test cases/common/175 generator link whole/main.c b/test cases/common/175 generator link whole/main.c new file mode 100644 index 0000000..acf8717 --- /dev/null +++ b/test cases/common/175 generator link whole/main.c @@ -0,0 +1,11 @@ +#include "meson_test_function.h" + +#include + +int main() { + if (meson_test_function() != 19) { + printf("Bad meson_test_function()\n"); + return 1; + } + return 0; +} diff --git a/test cases/common/175 generator link whole/meson.build b/test cases/common/175 generator link whole/meson.build new file mode 100644 index 0000000..30ae9c6 --- /dev/null +++ b/test cases/common/175 generator link whole/meson.build @@ -0,0 +1,65 @@ +project('generator link_whole', 'c') + +cc = meson.get_compiler('c') +if cc.get_id() == 'msvc' + if cc.version().version_compare('<19') + error('MESON_SKIP_TEST link_whole only works on VS2015 or newer.') + endif +endif + +# This just generates foo.h and foo.c with int foo() defined. +gen_py = find_program('generator.py') +gen = generator(gen_py, + output: ['@BASENAME@.h', '@BASENAME@.c'], + arguments : ['@INPUT@', '@BUILD_DIR@']) + +# Test 1: link directly into executable +srcs = gen.process('meson_test_function.tmpl') +exe = executable('exe1', [srcs, 'main.c'], c_args : '-DBUILDING_EMBEDDED') +test('test1', exe) + +# Test 2: link into shared library and access from executable +srcs = gen.process('meson_test_function.tmpl') +shlib2 = shared_library('shlib2', [srcs], c_args : '-DBUILDING_DLL') +exe = executable('exe2', 'main.c', + link_with : shlib2, + include_directories : shlib2.private_dir_include(), +) +test('test2', exe) + +# Test 3: link into static library and access from executable +srcs = gen.process('meson_test_function.tmpl') +stlib3 = static_library('stlib3', [srcs], c_args : '-DBUILDING_EMBEDDED') +exe = executable('exe3', 'main.c', + c_args : '-DBUILDING_EMBEDDED', + link_with : stlib3, + include_directories : stlib3.private_dir_include(), +) +test('test3', exe) + +# Test 4: link into static library, link into shared +# and access from executable. To make sure static_library +# is not dropped use pull_meson_test_function helper. +srcs = gen.process('meson_test_function.tmpl') +stlib4 = static_library('stlib4', [srcs], c_args : '-DBUILDING_DLL') +shlib4 = shared_library('shlib4', 'pull_meson_test_function.c', + c_args : '-DBUILDING_DLL', + link_with : stlib4, + include_directories : stlib4.private_dir_include(), +) +exe = executable('exe4', 'main.c', + link_with : shlib4, + include_directories : stlib4.private_dir_include(), +) +test('test4', exe) + +# Test 5: link into static library, link_whole into shared +# and access from executable +srcs = gen.process('meson_test_function.tmpl') +stlib5 = static_library('stlib5', [srcs], c_args : '-DBUILDING_DLL') +shlib5 = shared_library('shlib5', link_whole : stlib5) +exe = executable('exe5', 'main.c', + link_with : shlib5, + include_directories : stlib5.private_dir_include(), +) +test('test5', exe) diff --git a/test cases/common/175 generator link whole/meson_test_function.tmpl b/test cases/common/175 generator link whole/meson_test_function.tmpl new file mode 100644 index 0000000..e69de29 diff --git a/test cases/common/175 generator link whole/pull_meson_test_function.c b/test cases/common/175 generator link whole/pull_meson_test_function.c new file mode 100644 index 0000000..c54dda6 --- /dev/null +++ b/test cases/common/175 generator link whole/pull_meson_test_function.c @@ -0,0 +1,6 @@ +#include "export.h" +#include "meson_test_function.h" + +int DLL_PUBLIC function_puller() { + return meson_test_function(); +} diff --git a/test cases/common/175 source in dep/bar.cpp b/test cases/common/175 source in dep/bar.cpp deleted file mode 100644 index bda8cb6..0000000 --- a/test cases/common/175 source in dep/bar.cpp +++ /dev/null @@ -1,5 +0,0 @@ -extern "C" int foo(); - -int main(int, char**) { - return foo() != 42; -} diff --git a/test cases/common/175 source in dep/foo.c b/test cases/common/175 source in dep/foo.c deleted file mode 100644 index 1ecfa8c..0000000 --- a/test cases/common/175 source in dep/foo.c +++ /dev/null @@ -1,3 +0,0 @@ -int foo() { - return 42; -} diff --git a/test cases/common/175 source in dep/generated/funname b/test cases/common/175 source in dep/generated/funname deleted file mode 100644 index 79f3c86..0000000 --- a/test cases/common/175 source in dep/generated/funname +++ /dev/null @@ -1 +0,0 @@ -my_wonderful_function diff --git a/test cases/common/175 source in dep/generated/genheader.py b/test cases/common/175 source in dep/generated/genheader.py deleted file mode 100755 index eafc075..0000000 --- a/test cases/common/175 source in dep/generated/genheader.py +++ /dev/null @@ -1,17 +0,0 @@ -#!/usr/bin/env python3 - -import sys - -ifile = sys.argv[1] -ofile = sys.argv[2] - -templ = '''#pragma once - -int %s() { - return 42; -} -''' - -funname = open(ifile).readline().strip() - -open(ofile, 'w').write(templ % funname) diff --git a/test cases/common/175 source in dep/generated/main.c b/test cases/common/175 source in dep/generated/main.c deleted file mode 100644 index 07e7c93..0000000 --- a/test cases/common/175 source in dep/generated/main.c +++ /dev/null @@ -1,5 +0,0 @@ -#include"funheader.h" - -int main(int argc, char **argv) { - return my_wonderful_function() != 42; -} diff --git a/test cases/common/175 source in dep/generated/meson.build b/test cases/common/175 source in dep/generated/meson.build deleted file mode 100644 index 2862709..0000000 --- a/test cases/common/175 source in dep/generated/meson.build +++ /dev/null @@ -1,12 +0,0 @@ -fp = find_program('genheader.py') - -genh = custom_target('genh', - input : 'funname', - output : 'funheader.h', - command : [fp, '@INPUT@', '@OUTPUT@']) - -dep = declare_dependency(sources : [genh]) - -e = executable('genuser', 'main.c', - dependencies : dep) -test('genuser', e) diff --git a/test cases/common/175 source in dep/meson.build b/test cases/common/175 source in dep/meson.build deleted file mode 100644 index 7111ba1..0000000 --- a/test cases/common/175 source in dep/meson.build +++ /dev/null @@ -1,8 +0,0 @@ -project('foo', 'c', 'cpp') - -dep = declare_dependency(sources : 'foo.c') - -executable('bar', 'bar.cpp', - dependencies : dep) - -subdir('generated') diff --git a/test cases/common/176 generator link whole/export.h b/test cases/common/176 generator link whole/export.h deleted file mode 100644 index f4f6f45..0000000 --- a/test cases/common/176 generator link whole/export.h +++ /dev/null @@ -1,18 +0,0 @@ -#pragma once - -#if defined BUILDING_EMBEDDED - #define DLL_PUBLIC -#elif defined _WIN32 || defined __CYGWIN__ - #if defined BUILDING_DLL - #define DLL_PUBLIC __declspec(dllexport) - #else - #define DLL_PUBLIC __declspec(dllimport) - #endif -#else - #if defined __GNUC__ - #define DLL_PUBLIC __attribute__ ((visibility("default"))) - #else - #pragma message ("Compiler does not support symbol visibility.") - #define DLL_PUBLIC - #endif -#endif diff --git a/test cases/common/176 generator link whole/generator.py b/test cases/common/176 generator link whole/generator.py deleted file mode 100755 index 0076b74..0000000 --- a/test cases/common/176 generator link whole/generator.py +++ /dev/null @@ -1,30 +0,0 @@ -#!/usr/bin/env python3 - -import os -import os.path -import sys - - -def main(): - name = os.path.splitext(os.path.basename(sys.argv[1]))[0] - out = sys.argv[2] - hname = os.path.join(out, name + '.h') - cname = os.path.join(out, name + '.c') - print(os.getcwd(), hname) - with open(hname, 'w') as hfile: - hfile.write(''' -#pragma once -#include "export.h" -int DLL_PUBLIC {name}(); -'''.format(name=name)) - with open(cname, 'w') as cfile: - cfile.write(''' -#include "{name}.h" -int {name}() {{ - return {size}; -}} -'''.format(name=name, size=len(name))) - - -if __name__ == '__main__': - main() diff --git a/test cases/common/176 generator link whole/main.c b/test cases/common/176 generator link whole/main.c deleted file mode 100644 index acf8717..0000000 --- a/test cases/common/176 generator link whole/main.c +++ /dev/null @@ -1,11 +0,0 @@ -#include "meson_test_function.h" - -#include - -int main() { - if (meson_test_function() != 19) { - printf("Bad meson_test_function()\n"); - return 1; - } - return 0; -} diff --git a/test cases/common/176 generator link whole/meson.build b/test cases/common/176 generator link whole/meson.build deleted file mode 100644 index 30ae9c6..0000000 --- a/test cases/common/176 generator link whole/meson.build +++ /dev/null @@ -1,65 +0,0 @@ -project('generator link_whole', 'c') - -cc = meson.get_compiler('c') -if cc.get_id() == 'msvc' - if cc.version().version_compare('<19') - error('MESON_SKIP_TEST link_whole only works on VS2015 or newer.') - endif -endif - -# This just generates foo.h and foo.c with int foo() defined. -gen_py = find_program('generator.py') -gen = generator(gen_py, - output: ['@BASENAME@.h', '@BASENAME@.c'], - arguments : ['@INPUT@', '@BUILD_DIR@']) - -# Test 1: link directly into executable -srcs = gen.process('meson_test_function.tmpl') -exe = executable('exe1', [srcs, 'main.c'], c_args : '-DBUILDING_EMBEDDED') -test('test1', exe) - -# Test 2: link into shared library and access from executable -srcs = gen.process('meson_test_function.tmpl') -shlib2 = shared_library('shlib2', [srcs], c_args : '-DBUILDING_DLL') -exe = executable('exe2', 'main.c', - link_with : shlib2, - include_directories : shlib2.private_dir_include(), -) -test('test2', exe) - -# Test 3: link into static library and access from executable -srcs = gen.process('meson_test_function.tmpl') -stlib3 = static_library('stlib3', [srcs], c_args : '-DBUILDING_EMBEDDED') -exe = executable('exe3', 'main.c', - c_args : '-DBUILDING_EMBEDDED', - link_with : stlib3, - include_directories : stlib3.private_dir_include(), -) -test('test3', exe) - -# Test 4: link into static library, link into shared -# and access from executable. To make sure static_library -# is not dropped use pull_meson_test_function helper. -srcs = gen.process('meson_test_function.tmpl') -stlib4 = static_library('stlib4', [srcs], c_args : '-DBUILDING_DLL') -shlib4 = shared_library('shlib4', 'pull_meson_test_function.c', - c_args : '-DBUILDING_DLL', - link_with : stlib4, - include_directories : stlib4.private_dir_include(), -) -exe = executable('exe4', 'main.c', - link_with : shlib4, - include_directories : stlib4.private_dir_include(), -) -test('test4', exe) - -# Test 5: link into static library, link_whole into shared -# and access from executable -srcs = gen.process('meson_test_function.tmpl') -stlib5 = static_library('stlib5', [srcs], c_args : '-DBUILDING_DLL') -shlib5 = shared_library('shlib5', link_whole : stlib5) -exe = executable('exe5', 'main.c', - link_with : shlib5, - include_directories : stlib5.private_dir_include(), -) -test('test5', exe) diff --git a/test cases/common/176 generator link whole/meson_test_function.tmpl b/test cases/common/176 generator link whole/meson_test_function.tmpl deleted file mode 100644 index e69de29..0000000 diff --git a/test cases/common/176 generator link whole/pull_meson_test_function.c b/test cases/common/176 generator link whole/pull_meson_test_function.c deleted file mode 100644 index c54dda6..0000000 --- a/test cases/common/176 generator link whole/pull_meson_test_function.c +++ /dev/null @@ -1,6 +0,0 @@ -#include "export.h" -#include "meson_test_function.h" - -int DLL_PUBLIC function_puller() { - return meson_test_function(); -} diff --git a/test cases/common/176 initial c_args/meson.build b/test cases/common/176 initial c_args/meson.build new file mode 100644 index 0000000..638f8c2 --- /dev/null +++ b/test cases/common/176 initial c_args/meson.build @@ -0,0 +1,7 @@ +project('options', 'c') + +# Test passing c_args and c_link_args options from the command line. +assert(get_option('c_args') == ['-funroll-loops'], + 'Incorrect value for c_args option.') +assert(get_option('c_link_args') == ['-Dtest_harmless_but_useless_link_arg'], + 'Incorrect value for c_link_args option.') diff --git a/test cases/common/176 initial c_args/test_args.txt b/test cases/common/176 initial c_args/test_args.txt new file mode 100644 index 0000000..166e481 --- /dev/null +++ b/test cases/common/176 initial c_args/test_args.txt @@ -0,0 +1,4 @@ +# This file is not read by meson itself, but by the test framework. +# It is not possible to pass arguments to meson from a file. +['-Dc_args=-march=native', '-Dc_args=-funroll-loops', + '-Dc_link_args=-Dtest_harmless_but_useless_link_arg'] diff --git a/test cases/common/177 identical target name in subproject flat layout/foo.c b/test cases/common/177 identical target name in subproject flat layout/foo.c new file mode 100644 index 0000000..ed42789 --- /dev/null +++ b/test cases/common/177 identical target name in subproject flat layout/foo.c @@ -0,0 +1 @@ +int meson_test_main_foo(void) { return 10; } diff --git a/test cases/common/177 identical target name in subproject flat layout/main.c b/test cases/common/177 identical target name in subproject flat layout/main.c new file mode 100644 index 0000000..6f02aeb --- /dev/null +++ b/test cases/common/177 identical target name in subproject flat layout/main.c @@ -0,0 +1,16 @@ +#include + +int meson_test_main_foo(void); +int meson_test_subproj_foo(void); + +int main(void) { + if (meson_test_main_foo() != 10) { + printf("Failed meson_test_main_foo\n"); + return 1; + } + if (meson_test_subproj_foo() != 20) { + printf("Failed meson_test_subproj_foo\n"); + return 1; + } + return 0; +} diff --git a/test cases/common/177 identical target name in subproject flat layout/meson.build b/test cases/common/177 identical target name in subproject flat layout/meson.build new file mode 100644 index 0000000..d859fda --- /dev/null +++ b/test cases/common/177 identical target name in subproject flat layout/meson.build @@ -0,0 +1,11 @@ +project('subproject targets', 'c') + +# Idea behind this test is to create targets with identical name +# but different output files. We can do this by choosing different +# name_prefix of libraries. Target id does not depend on name_prefix. + +main_foo = static_library('foo', 'foo.c', name_prefix : 'main') +subproj_foo = subproject('subproj').get_variable('foo') + +exe = executable('prog', 'main.c', link_with : [main_foo, subproj_foo]) +test('main test', exe) diff --git a/test cases/common/177 identical target name in subproject flat layout/subprojects/subproj/foo.c b/test cases/common/177 identical target name in subproject flat layout/subprojects/subproj/foo.c new file mode 100644 index 0000000..f334292 --- /dev/null +++ b/test cases/common/177 identical target name in subproject flat layout/subprojects/subproj/foo.c @@ -0,0 +1 @@ +int meson_test_subproj_foo(void) { return 20; } diff --git a/test cases/common/177 identical target name in subproject flat layout/subprojects/subproj/meson.build b/test cases/common/177 identical target name in subproject flat layout/subprojects/subproj/meson.build new file mode 100644 index 0000000..c927194 --- /dev/null +++ b/test cases/common/177 identical target name in subproject flat layout/subprojects/subproj/meson.build @@ -0,0 +1,3 @@ +project('subproj', 'c') + +foo = static_library('foo', 'foo.c', name_prefix : 'subproj') diff --git a/test cases/common/177 initial c_args/meson.build b/test cases/common/177 initial c_args/meson.build deleted file mode 100644 index 638f8c2..0000000 --- a/test cases/common/177 initial c_args/meson.build +++ /dev/null @@ -1,7 +0,0 @@ -project('options', 'c') - -# Test passing c_args and c_link_args options from the command line. -assert(get_option('c_args') == ['-funroll-loops'], - 'Incorrect value for c_args option.') -assert(get_option('c_link_args') == ['-Dtest_harmless_but_useless_link_arg'], - 'Incorrect value for c_link_args option.') diff --git a/test cases/common/177 initial c_args/test_args.txt b/test cases/common/177 initial c_args/test_args.txt deleted file mode 100644 index 166e481..0000000 --- a/test cases/common/177 initial c_args/test_args.txt +++ /dev/null @@ -1,4 +0,0 @@ -# This file is not read by meson itself, but by the test framework. -# It is not possible to pass arguments to meson from a file. -['-Dc_args=-march=native', '-Dc_args=-funroll-loops', - '-Dc_link_args=-Dtest_harmless_but_useless_link_arg'] diff --git a/test cases/common/178 as-needed/config.h b/test cases/common/178 as-needed/config.h new file mode 100644 index 0000000..b8fb60f --- /dev/null +++ b/test cases/common/178 as-needed/config.h @@ -0,0 +1,14 @@ +#if defined _WIN32 || defined __CYGWIN__ + #if defined BUILDING_DLL + #define DLL_PUBLIC __declspec(dllexport) + #else + #define DLL_PUBLIC __declspec(dllimport) + #endif +#else + #if defined __GNUC__ + #define DLL_PUBLIC __attribute__ ((visibility("default"))) + #else + #pragma message ("Compiler does not support symbol visibility.") + #define DLL_PUBLIC + #endif +#endif diff --git a/test cases/common/178 as-needed/libA.cpp b/test cases/common/178 as-needed/libA.cpp new file mode 100644 index 0000000..5f45bc0 --- /dev/null +++ b/test cases/common/178 as-needed/libA.cpp @@ -0,0 +1,7 @@ +#define BUILDING_DLL + +#include "libA.h" + +namespace meson_test_as_needed { + DLL_PUBLIC bool linked = false; +} diff --git a/test cases/common/178 as-needed/libA.h b/test cases/common/178 as-needed/libA.h new file mode 100644 index 0000000..8e76d22 --- /dev/null +++ b/test cases/common/178 as-needed/libA.h @@ -0,0 +1,5 @@ +#include "config.h" + +namespace meson_test_as_needed { + DLL_PUBLIC extern bool linked; +} diff --git a/test cases/common/178 as-needed/libB.cpp b/test cases/common/178 as-needed/libB.cpp new file mode 100644 index 0000000..a872394 --- /dev/null +++ b/test cases/common/178 as-needed/libB.cpp @@ -0,0 +1,19 @@ +#include "libA.h" + +#undef DLL_PUBLIC +#define BUILDING_DLL +#include "config.h" + +namespace meson_test_as_needed { + namespace { + bool set_linked() { + linked = true; + return true; + } + bool stub = set_linked(); + } + + DLL_PUBLIC int libB_unused_func() { + return 0; + } +} diff --git a/test cases/common/178 as-needed/main.cpp b/test cases/common/178 as-needed/main.cpp new file mode 100644 index 0000000..191d15c --- /dev/null +++ b/test cases/common/178 as-needed/main.cpp @@ -0,0 +1,7 @@ +#include + +#include "libA.h" + +int main() { + return !meson_test_as_needed::linked ? EXIT_SUCCESS : EXIT_FAILURE; +} diff --git a/test cases/common/178 as-needed/meson.build b/test cases/common/178 as-needed/meson.build new file mode 100644 index 0000000..3b54aaa --- /dev/null +++ b/test cases/common/178 as-needed/meson.build @@ -0,0 +1,13 @@ +project('as-needed test', 'cpp') + +# Idea behind this test is to have -Wl,--as-needed prune +# away unneeded linkages, which would otherwise cause global +# static initialiser side-effects to set a boolean to true. + +# Credits for portable ISO C++ idea go to sarum9in + +libA = library('A', 'libA.cpp') +libB = library('B', 'libB.cpp', link_with : libA) + +main_exe = executable('C', 'main.cpp', link_with : [libA, libB]) +test('main test', main_exe) diff --git a/test cases/common/178 identical target name in subproject flat layout/foo.c b/test cases/common/178 identical target name in subproject flat layout/foo.c deleted file mode 100644 index ed42789..0000000 --- a/test cases/common/178 identical target name in subproject flat layout/foo.c +++ /dev/null @@ -1 +0,0 @@ -int meson_test_main_foo(void) { return 10; } diff --git a/test cases/common/178 identical target name in subproject flat layout/main.c b/test cases/common/178 identical target name in subproject flat layout/main.c deleted file mode 100644 index 6f02aeb..0000000 --- a/test cases/common/178 identical target name in subproject flat layout/main.c +++ /dev/null @@ -1,16 +0,0 @@ -#include - -int meson_test_main_foo(void); -int meson_test_subproj_foo(void); - -int main(void) { - if (meson_test_main_foo() != 10) { - printf("Failed meson_test_main_foo\n"); - return 1; - } - if (meson_test_subproj_foo() != 20) { - printf("Failed meson_test_subproj_foo\n"); - return 1; - } - return 0; -} diff --git a/test cases/common/178 identical target name in subproject flat layout/meson.build b/test cases/common/178 identical target name in subproject flat layout/meson.build deleted file mode 100644 index d859fda..0000000 --- a/test cases/common/178 identical target name in subproject flat layout/meson.build +++ /dev/null @@ -1,11 +0,0 @@ -project('subproject targets', 'c') - -# Idea behind this test is to create targets with identical name -# but different output files. We can do this by choosing different -# name_prefix of libraries. Target id does not depend on name_prefix. - -main_foo = static_library('foo', 'foo.c', name_prefix : 'main') -subproj_foo = subproject('subproj').get_variable('foo') - -exe = executable('prog', 'main.c', link_with : [main_foo, subproj_foo]) -test('main test', exe) diff --git a/test cases/common/178 identical target name in subproject flat layout/subprojects/subproj/foo.c b/test cases/common/178 identical target name in subproject flat layout/subprojects/subproj/foo.c deleted file mode 100644 index f334292..0000000 --- a/test cases/common/178 identical target name in subproject flat layout/subprojects/subproj/foo.c +++ /dev/null @@ -1 +0,0 @@ -int meson_test_subproj_foo(void) { return 20; } diff --git a/test cases/common/178 identical target name in subproject flat layout/subprojects/subproj/meson.build b/test cases/common/178 identical target name in subproject flat layout/subprojects/subproj/meson.build deleted file mode 100644 index c927194..0000000 --- a/test cases/common/178 identical target name in subproject flat layout/subprojects/subproj/meson.build +++ /dev/null @@ -1,3 +0,0 @@ -project('subproj', 'c') - -foo = static_library('foo', 'foo.c', name_prefix : 'subproj') diff --git a/test cases/common/179 as-needed/config.h b/test cases/common/179 as-needed/config.h deleted file mode 100644 index b8fb60f..0000000 --- a/test cases/common/179 as-needed/config.h +++ /dev/null @@ -1,14 +0,0 @@ -#if defined _WIN32 || defined __CYGWIN__ - #if defined BUILDING_DLL - #define DLL_PUBLIC __declspec(dllexport) - #else - #define DLL_PUBLIC __declspec(dllimport) - #endif -#else - #if defined __GNUC__ - #define DLL_PUBLIC __attribute__ ((visibility("default"))) - #else - #pragma message ("Compiler does not support symbol visibility.") - #define DLL_PUBLIC - #endif -#endif diff --git a/test cases/common/179 as-needed/libA.cpp b/test cases/common/179 as-needed/libA.cpp deleted file mode 100644 index 5f45bc0..0000000 --- a/test cases/common/179 as-needed/libA.cpp +++ /dev/null @@ -1,7 +0,0 @@ -#define BUILDING_DLL - -#include "libA.h" - -namespace meson_test_as_needed { - DLL_PUBLIC bool linked = false; -} diff --git a/test cases/common/179 as-needed/libA.h b/test cases/common/179 as-needed/libA.h deleted file mode 100644 index 8e76d22..0000000 --- a/test cases/common/179 as-needed/libA.h +++ /dev/null @@ -1,5 +0,0 @@ -#include "config.h" - -namespace meson_test_as_needed { - DLL_PUBLIC extern bool linked; -} diff --git a/test cases/common/179 as-needed/libB.cpp b/test cases/common/179 as-needed/libB.cpp deleted file mode 100644 index a872394..0000000 --- a/test cases/common/179 as-needed/libB.cpp +++ /dev/null @@ -1,19 +0,0 @@ -#include "libA.h" - -#undef DLL_PUBLIC -#define BUILDING_DLL -#include "config.h" - -namespace meson_test_as_needed { - namespace { - bool set_linked() { - linked = true; - return true; - } - bool stub = set_linked(); - } - - DLL_PUBLIC int libB_unused_func() { - return 0; - } -} diff --git a/test cases/common/179 as-needed/main.cpp b/test cases/common/179 as-needed/main.cpp deleted file mode 100644 index 191d15c..0000000 --- a/test cases/common/179 as-needed/main.cpp +++ /dev/null @@ -1,7 +0,0 @@ -#include - -#include "libA.h" - -int main() { - return !meson_test_as_needed::linked ? EXIT_SUCCESS : EXIT_FAILURE; -} diff --git a/test cases/common/179 as-needed/meson.build b/test cases/common/179 as-needed/meson.build deleted file mode 100644 index 3b54aaa..0000000 --- a/test cases/common/179 as-needed/meson.build +++ /dev/null @@ -1,13 +0,0 @@ -project('as-needed test', 'cpp') - -# Idea behind this test is to have -Wl,--as-needed prune -# away unneeded linkages, which would otherwise cause global -# static initialiser side-effects to set a boolean to true. - -# Credits for portable ISO C++ idea go to sarum9in - -libA = library('A', 'libA.cpp') -libB = library('B', 'libB.cpp', link_with : libA) - -main_exe = executable('C', 'main.cpp', link_with : [libA, libB]) -test('main test', main_exe) diff --git a/test cases/common/179 ndebug if-release enabled/main.c b/test cases/common/179 ndebug if-release enabled/main.c new file mode 100644 index 0000000..984ebca --- /dev/null +++ b/test cases/common/179 ndebug if-release enabled/main.c @@ -0,0 +1,15 @@ +#include +#include + +int meson_test_side_effect = EXIT_FAILURE; + +int meson_test_set_side_effect(void) { + meson_test_side_effect = EXIT_SUCCESS; + return 1; +} + +int main(void) { + // meson_test_side_effect is set only if assert is executed + assert(meson_test_set_side_effect()); + return meson_test_side_effect; +} diff --git a/test cases/common/179 ndebug if-release enabled/meson.build b/test cases/common/179 ndebug if-release enabled/meson.build new file mode 100644 index 0000000..be26375 --- /dev/null +++ b/test cases/common/179 ndebug if-release enabled/meson.build @@ -0,0 +1,7 @@ +project('ndebug enabled', 'c', + default_options : [ + 'buildtype=debugoptimized', + 'b_ndebug=if-release', + ]) + +test('exe', executable('main', 'main.c')) diff --git a/test cases/common/180 ndebug if-release disabled/main.c b/test cases/common/180 ndebug if-release disabled/main.c new file mode 100644 index 0000000..cb3ec3f --- /dev/null +++ b/test cases/common/180 ndebug if-release disabled/main.c @@ -0,0 +1,7 @@ +#include +#include + +int main(void) { + assert(0); + return EXIT_SUCCESS; +} diff --git a/test cases/common/180 ndebug if-release disabled/meson.build b/test cases/common/180 ndebug if-release disabled/meson.build new file mode 100644 index 0000000..a9a79ea --- /dev/null +++ b/test cases/common/180 ndebug if-release disabled/meson.build @@ -0,0 +1,7 @@ +project('ndebug disabled', 'c', + default_options : [ + 'buildtype=release', + 'b_ndebug=if-release', + ]) + +test('exe', executable('main', 'main.c')) diff --git a/test cases/common/180 ndebug if-release enabled/main.c b/test cases/common/180 ndebug if-release enabled/main.c deleted file mode 100644 index 984ebca..0000000 --- a/test cases/common/180 ndebug if-release enabled/main.c +++ /dev/null @@ -1,15 +0,0 @@ -#include -#include - -int meson_test_side_effect = EXIT_FAILURE; - -int meson_test_set_side_effect(void) { - meson_test_side_effect = EXIT_SUCCESS; - return 1; -} - -int main(void) { - // meson_test_side_effect is set only if assert is executed - assert(meson_test_set_side_effect()); - return meson_test_side_effect; -} diff --git a/test cases/common/180 ndebug if-release enabled/meson.build b/test cases/common/180 ndebug if-release enabled/meson.build deleted file mode 100644 index be26375..0000000 --- a/test cases/common/180 ndebug if-release enabled/meson.build +++ /dev/null @@ -1,7 +0,0 @@ -project('ndebug enabled', 'c', - default_options : [ - 'buildtype=debugoptimized', - 'b_ndebug=if-release', - ]) - -test('exe', executable('main', 'main.c')) diff --git a/test cases/common/181 ndebug if-release disabled/main.c b/test cases/common/181 ndebug if-release disabled/main.c deleted file mode 100644 index cb3ec3f..0000000 --- a/test cases/common/181 ndebug if-release disabled/main.c +++ /dev/null @@ -1,7 +0,0 @@ -#include -#include - -int main(void) { - assert(0); - return EXIT_SUCCESS; -} diff --git a/test cases/common/181 ndebug if-release disabled/meson.build b/test cases/common/181 ndebug if-release disabled/meson.build deleted file mode 100644 index a9a79ea..0000000 --- a/test cases/common/181 ndebug if-release disabled/meson.build +++ /dev/null @@ -1,7 +0,0 @@ -project('ndebug disabled', 'c', - default_options : [ - 'buildtype=release', - 'b_ndebug=if-release', - ]) - -test('exe', executable('main', 'main.c')) diff --git a/test cases/common/181 subproject version/meson.build b/test cases/common/181 subproject version/meson.build new file mode 100644 index 0000000..bd8fc03 --- /dev/null +++ b/test cases/common/181 subproject version/meson.build @@ -0,0 +1,10 @@ +project('subproject version', 'c', + version : '2.3.4', + license: 'mylicense') + +subproject('a') + +liba_dep = dependency('a', + fallback: ['a', 'liba_dep'], + version: ['>= 0.30.0', '!= 0.99.0']) + diff --git a/test cases/common/181 subproject version/subprojects/a/meson.build b/test cases/common/181 subproject version/subprojects/a/meson.build new file mode 100644 index 0000000..dae3130 --- /dev/null +++ b/test cases/common/181 subproject version/subprojects/a/meson.build @@ -0,0 +1,5 @@ +project('mysubproject', 'c', + version : '1.0.0', + license : 'sublicense') + +liba_dep = declare_dependency (version : '1.0.0') diff --git a/test cases/common/182 subdir_done/meson.build b/test cases/common/182 subdir_done/meson.build new file mode 100644 index 0000000..457e613 --- /dev/null +++ b/test cases/common/182 subdir_done/meson.build @@ -0,0 +1,12 @@ +# Should run, even though main.cpp does not exist and we call error in the last line. +# subdir_done jumps to end, so both lines are not executed. + +project('example exit', 'cpp') + +if true + subdir_done() +endif + +executable('main', 'main.cpp') +error('Unreachable') + diff --git a/test cases/common/182 subproject version/meson.build b/test cases/common/182 subproject version/meson.build deleted file mode 100644 index bd8fc03..0000000 --- a/test cases/common/182 subproject version/meson.build +++ /dev/null @@ -1,10 +0,0 @@ -project('subproject version', 'c', - version : '2.3.4', - license: 'mylicense') - -subproject('a') - -liba_dep = dependency('a', - fallback: ['a', 'liba_dep'], - version: ['>= 0.30.0', '!= 0.99.0']) - diff --git a/test cases/common/182 subproject version/subprojects/a/meson.build b/test cases/common/182 subproject version/subprojects/a/meson.build deleted file mode 100644 index dae3130..0000000 --- a/test cases/common/182 subproject version/subprojects/a/meson.build +++ /dev/null @@ -1,5 +0,0 @@ -project('mysubproject', 'c', - version : '1.0.0', - license : 'sublicense') - -liba_dep = declare_dependency (version : '1.0.0') diff --git a/test cases/common/183 bothlibraries/libfile.c b/test cases/common/183 bothlibraries/libfile.c new file mode 100644 index 0000000..085ef3b --- /dev/null +++ b/test cases/common/183 bothlibraries/libfile.c @@ -0,0 +1,7 @@ +#include "mylib.h" + +DO_EXPORT int retval = 42; + +DO_EXPORT int func() { + return retval; +} diff --git a/test cases/common/183 bothlibraries/main.c b/test cases/common/183 bothlibraries/main.c new file mode 100644 index 0000000..03a8e02 --- /dev/null +++ b/test cases/common/183 bothlibraries/main.c @@ -0,0 +1,8 @@ +#include "mylib.h" + +DO_IMPORT int func(); +DO_IMPORT int retval; + +int main(int argc, char **arg) { + return func() == retval ? 0 : 1; +} diff --git a/test cases/common/183 bothlibraries/meson.build b/test cases/common/183 bothlibraries/meson.build new file mode 100644 index 0000000..0bfba76 --- /dev/null +++ b/test cases/common/183 bothlibraries/meson.build @@ -0,0 +1,25 @@ +project('both libraries linking test', 'c') + +both_libs = both_libraries('mylib', 'libfile.c') +exe_shared = executable('prog-shared', 'main.c', link_with : both_libs.get_shared_lib()) +exe_static = executable('prog-static', 'main.c', + c_args : ['-DSTATIC_COMPILATION'], + link_with : both_libs.get_static_lib()) +exe_both = executable('prog-both', 'main.c', link_with : both_libs) + +test('runtest-shared', exe_shared) +test('runtest-static', exe_static) +test('runtest-both', exe_both) + +# Same as above, but using build_target() +both_libs2 = build_target('mylib2', 'libfile.c', target_type: 'both_libraries') +exe_shared2 = executable('prog-shared2', 'main.c', + link_with : both_libs2.get_shared_lib()) +exe_static2 = executable('prog-static2', 'main.c', + c_args : ['-DSTATIC_COMPILATION'], + link_with : both_libs2.get_static_lib()) +exe_both2 = executable('prog-both2', 'main.c', link_with : both_libs2) + +test('runtest-shared-2', exe_shared2) +test('runtest-static-2', exe_static2) +test('runtest-both-2', exe_both2) diff --git a/test cases/common/183 bothlibraries/mylib.h b/test cases/common/183 bothlibraries/mylib.h new file mode 100644 index 0000000..1038a01 --- /dev/null +++ b/test cases/common/183 bothlibraries/mylib.h @@ -0,0 +1,13 @@ +#pragma once + +#ifdef _WIN32 + #ifdef STATIC_COMPILATION + #define DO_IMPORT extern + #else + #define DO_IMPORT __declspec(dllimport) + #endif + #define DO_EXPORT __declspec(dllexport) +#else + #define DO_IMPORT extern + #define DO_EXPORT +#endif diff --git a/test cases/common/183 subdir_done/meson.build b/test cases/common/183 subdir_done/meson.build deleted file mode 100644 index 457e613..0000000 --- a/test cases/common/183 subdir_done/meson.build +++ /dev/null @@ -1,12 +0,0 @@ -# Should run, even though main.cpp does not exist and we call error in the last line. -# subdir_done jumps to end, so both lines are not executed. - -project('example exit', 'cpp') - -if true - subdir_done() -endif - -executable('main', 'main.cpp') -error('Unreachable') - diff --git a/test cases/common/184 bothlibraries/libfile.c b/test cases/common/184 bothlibraries/libfile.c deleted file mode 100644 index 085ef3b..0000000 --- a/test cases/common/184 bothlibraries/libfile.c +++ /dev/null @@ -1,7 +0,0 @@ -#include "mylib.h" - -DO_EXPORT int retval = 42; - -DO_EXPORT int func() { - return retval; -} diff --git a/test cases/common/184 bothlibraries/main.c b/test cases/common/184 bothlibraries/main.c deleted file mode 100644 index 03a8e02..0000000 --- a/test cases/common/184 bothlibraries/main.c +++ /dev/null @@ -1,8 +0,0 @@ -#include "mylib.h" - -DO_IMPORT int func(); -DO_IMPORT int retval; - -int main(int argc, char **arg) { - return func() == retval ? 0 : 1; -} diff --git a/test cases/common/184 bothlibraries/meson.build b/test cases/common/184 bothlibraries/meson.build deleted file mode 100644 index 0bfba76..0000000 --- a/test cases/common/184 bothlibraries/meson.build +++ /dev/null @@ -1,25 +0,0 @@ -project('both libraries linking test', 'c') - -both_libs = both_libraries('mylib', 'libfile.c') -exe_shared = executable('prog-shared', 'main.c', link_with : both_libs.get_shared_lib()) -exe_static = executable('prog-static', 'main.c', - c_args : ['-DSTATIC_COMPILATION'], - link_with : both_libs.get_static_lib()) -exe_both = executable('prog-both', 'main.c', link_with : both_libs) - -test('runtest-shared', exe_shared) -test('runtest-static', exe_static) -test('runtest-both', exe_both) - -# Same as above, but using build_target() -both_libs2 = build_target('mylib2', 'libfile.c', target_type: 'both_libraries') -exe_shared2 = executable('prog-shared2', 'main.c', - link_with : both_libs2.get_shared_lib()) -exe_static2 = executable('prog-static2', 'main.c', - c_args : ['-DSTATIC_COMPILATION'], - link_with : both_libs2.get_static_lib()) -exe_both2 = executable('prog-both2', 'main.c', link_with : both_libs2) - -test('runtest-shared-2', exe_shared2) -test('runtest-static-2', exe_static2) -test('runtest-both-2', exe_both2) diff --git a/test cases/common/184 bothlibraries/mylib.h b/test cases/common/184 bothlibraries/mylib.h deleted file mode 100644 index 1038a01..0000000 --- a/test cases/common/184 bothlibraries/mylib.h +++ /dev/null @@ -1,13 +0,0 @@ -#pragma once - -#ifdef _WIN32 - #ifdef STATIC_COMPILATION - #define DO_IMPORT extern - #else - #define DO_IMPORT __declspec(dllimport) - #endif - #define DO_EXPORT __declspec(dllexport) -#else - #define DO_IMPORT extern - #define DO_EXPORT -#endif diff --git a/test cases/common/184 escape and unicode/file.c.in b/test cases/common/184 escape and unicode/file.c.in new file mode 100644 index 0000000..413ed42 --- /dev/null +++ b/test cases/common/184 escape and unicode/file.c.in @@ -0,0 +1,5 @@ +#include +const char* does_it_work() { + printf("{NAME}\n"); + return "yes it does"; +} diff --git a/test cases/common/184 escape and unicode/file.py b/test cases/common/184 escape and unicode/file.py new file mode 100644 index 0000000..40fa7ca --- /dev/null +++ b/test cases/common/184 escape and unicode/file.py @@ -0,0 +1,10 @@ +#!/usr/bin/env python3 + +import sys +import os + +with open(sys.argv[1]) as fh: + content = fh.read().replace("{NAME}", sys.argv[2]) + +with open(os.path.join(sys.argv[3]), 'w', errors='replace') as fh: + fh.write(content) diff --git a/test cases/common/184 escape and unicode/find.py b/test cases/common/184 escape and unicode/find.py new file mode 100644 index 0000000..34a3eb8 --- /dev/null +++ b/test cases/common/184 escape and unicode/find.py @@ -0,0 +1,9 @@ +#!/usr/bin/env python3 + +import os +import sys + +for fh in os.listdir('.'): + if os.path.isfile(fh): + if fh.endswith('.c'): + sys.stdout.write(fh + '\0') diff --git a/test cases/common/184 escape and unicode/fun.c b/test cases/common/184 escape and unicode/fun.c new file mode 100644 index 0000000..8eeb8ea --- /dev/null +++ b/test cases/common/184 escape and unicode/fun.c @@ -0,0 +1,3 @@ +int a_fun() { + return 1; +} diff --git a/test cases/common/184 escape and unicode/main.c b/test cases/common/184 escape and unicode/main.c new file mode 100644 index 0000000..0bcde16 --- /dev/null +++ b/test cases/common/184 escape and unicode/main.c @@ -0,0 +1,12 @@ +#include + +const char* does_it_work(); + +int a_fun(); + +int main() { + if(strcmp(does_it_work(), "yes it does") != 0) { + return -a_fun(); + } + return 0; +} diff --git a/test cases/common/184 escape and unicode/meson.build b/test cases/common/184 escape and unicode/meson.build new file mode 100644 index 0000000..e4fe628 --- /dev/null +++ b/test cases/common/184 escape and unicode/meson.build @@ -0,0 +1,38 @@ +project('180 escape', 'c') + +gen = generator(find_program('file.py'), arguments:['@INPUT@', 'erd\u0151', '@OUTPUT@'], output: '@BASENAME@') + +gen_file = gen.process('file.c.in') + +find_file_list = run_command(find_program('find.py')) +assert(find_file_list.returncode() == 0, 'Didn\'t find any files.') + +# Strings should support both octal \ooo and hex \xhh encodings + +found_files_oct = [] +foreach l : find_file_list.stdout().strip('\0').split('\000') + found_files_oct += [files(l)] +endforeach + +test('first', executable('first', found_files_oct + [gen_file])) + +found_files_hex = [] +foreach l : find_file_list.stdout().strip('\x00').split('\x00') + found_files_hex += [files(l)] +endforeach + +test('second', executable('second', found_files_hex + [gen_file])) + +# Unrecognized and malformed escape sequences are literal + +malformed = [ + [ '\c', 'c' ], + [ '\Uabcdefghi', 'Uabcdefghi'], + [ '\u123 ', 'u123 '], + [ '\xqr', 'xqr'], +] + +foreach m : malformed + assert(m[0].endswith(m[1]), 'bad escape sequence had unexpected end') + assert(m[0].startswith('\\'), 'bad escape sequence had unexpected start') +endforeach diff --git a/test cases/common/185 escape and unicode/file.c.in b/test cases/common/185 escape and unicode/file.c.in deleted file mode 100644 index 413ed42..0000000 --- a/test cases/common/185 escape and unicode/file.c.in +++ /dev/null @@ -1,5 +0,0 @@ -#include -const char* does_it_work() { - printf("{NAME}\n"); - return "yes it does"; -} diff --git a/test cases/common/185 escape and unicode/file.py b/test cases/common/185 escape and unicode/file.py deleted file mode 100644 index 40fa7ca..0000000 --- a/test cases/common/185 escape and unicode/file.py +++ /dev/null @@ -1,10 +0,0 @@ -#!/usr/bin/env python3 - -import sys -import os - -with open(sys.argv[1]) as fh: - content = fh.read().replace("{NAME}", sys.argv[2]) - -with open(os.path.join(sys.argv[3]), 'w', errors='replace') as fh: - fh.write(content) diff --git a/test cases/common/185 escape and unicode/find.py b/test cases/common/185 escape and unicode/find.py deleted file mode 100644 index 34a3eb8..0000000 --- a/test cases/common/185 escape and unicode/find.py +++ /dev/null @@ -1,9 +0,0 @@ -#!/usr/bin/env python3 - -import os -import sys - -for fh in os.listdir('.'): - if os.path.isfile(fh): - if fh.endswith('.c'): - sys.stdout.write(fh + '\0') diff --git a/test cases/common/185 escape and unicode/fun.c b/test cases/common/185 escape and unicode/fun.c deleted file mode 100644 index 8eeb8ea..0000000 --- a/test cases/common/185 escape and unicode/fun.c +++ /dev/null @@ -1,3 +0,0 @@ -int a_fun() { - return 1; -} diff --git a/test cases/common/185 escape and unicode/main.c b/test cases/common/185 escape and unicode/main.c deleted file mode 100644 index 0bcde16..0000000 --- a/test cases/common/185 escape and unicode/main.c +++ /dev/null @@ -1,12 +0,0 @@ -#include - -const char* does_it_work(); - -int a_fun(); - -int main() { - if(strcmp(does_it_work(), "yes it does") != 0) { - return -a_fun(); - } - return 0; -} diff --git a/test cases/common/185 escape and unicode/meson.build b/test cases/common/185 escape and unicode/meson.build deleted file mode 100644 index e4fe628..0000000 --- a/test cases/common/185 escape and unicode/meson.build +++ /dev/null @@ -1,38 +0,0 @@ -project('180 escape', 'c') - -gen = generator(find_program('file.py'), arguments:['@INPUT@', 'erd\u0151', '@OUTPUT@'], output: '@BASENAME@') - -gen_file = gen.process('file.c.in') - -find_file_list = run_command(find_program('find.py')) -assert(find_file_list.returncode() == 0, 'Didn\'t find any files.') - -# Strings should support both octal \ooo and hex \xhh encodings - -found_files_oct = [] -foreach l : find_file_list.stdout().strip('\0').split('\000') - found_files_oct += [files(l)] -endforeach - -test('first', executable('first', found_files_oct + [gen_file])) - -found_files_hex = [] -foreach l : find_file_list.stdout().strip('\x00').split('\x00') - found_files_hex += [files(l)] -endforeach - -test('second', executable('second', found_files_hex + [gen_file])) - -# Unrecognized and malformed escape sequences are literal - -malformed = [ - [ '\c', 'c' ], - [ '\Uabcdefghi', 'Uabcdefghi'], - [ '\u123 ', 'u123 '], - [ '\xqr', 'xqr'], -] - -foreach m : malformed - assert(m[0].endswith(m[1]), 'bad escape sequence had unexpected end') - assert(m[0].startswith('\\'), 'bad escape sequence had unexpected start') -endforeach diff --git a/test cases/common/185 has link arg/meson.build b/test cases/common/185 has link arg/meson.build new file mode 100644 index 0000000..10f2218 --- /dev/null +++ b/test cases/common/185 has link arg/meson.build @@ -0,0 +1,44 @@ +project('has link arg', 'c', 'cpp') + +cc = meson.get_compiler('c') +cpp = meson.get_compiler('cpp') + +if cc.get_argument_syntax() == 'msvc' + is_arg = '/OPT:REF' + useless = '/DEBUG' + isnt_arg = '/iambroken' +else + is_arg = '-Wl,-Lfoo' + useless = '-Wl,-Lbar' + isnt_arg = '-Wl,-iambroken' +endif + +assert(cc.has_link_argument(is_arg), 'Arg that should have worked does not work.') +assert(not cc.has_link_argument(isnt_arg), 'Arg that should be broken is not.') + +assert(cpp.has_link_argument(is_arg), 'Arg that should have worked does not work.') +assert(not cpp.has_link_argument(isnt_arg), 'Arg that should be broken is not.') + +assert(cc.get_supported_link_arguments([is_arg, isnt_arg, useless]) == [is_arg, useless], 'Arg filtering returned different result.') +assert(cpp.get_supported_link_arguments([is_arg, isnt_arg, useless]) == [is_arg, useless], 'Arg filtering returned different result.') + +# Have useless at the end to ensure that the search goes from front to back. +l1 = cc.first_supported_link_argument([isnt_arg, is_arg, isnt_arg, useless]) +l2 = cc.first_supported_link_argument(isnt_arg, isnt_arg, isnt_arg) + +assert(l1.length() == 1, 'First supported returned wrong result.') +assert(l1.get(0) == is_arg, 'First supported returned wrong argument.') +assert(l2.length() == 0, 'First supported did not return empty array.') + +l1 = cpp.first_supported_link_argument([isnt_arg, is_arg, isnt_arg, useless]) +l2 = cpp.first_supported_link_argument(isnt_arg, isnt_arg, isnt_arg) + +assert(l1.length() == 1, 'First supported returned wrong result.') +assert(l1.get(0) == is_arg, 'First supported returned wrong argument.') +assert(l2.length() == 0, 'First supported did not return empty array.') + +assert(not cc.has_multi_link_arguments([isnt_arg, is_arg]), 'Arg that should be broken is not.') +assert(cc.has_multi_link_arguments(is_arg), 'Arg that should have worked does not work.') +assert(cc.has_multi_link_arguments([useless, is_arg]), 'Arg that should have worked does not work.') + +assert(not cc.has_link_argument('-Wl,-z,nodelete42'), 'Did not detect wrong -z linker argument') diff --git a/test cases/common/186 has link arg/meson.build b/test cases/common/186 has link arg/meson.build deleted file mode 100644 index 10f2218..0000000 --- a/test cases/common/186 has link arg/meson.build +++ /dev/null @@ -1,44 +0,0 @@ -project('has link arg', 'c', 'cpp') - -cc = meson.get_compiler('c') -cpp = meson.get_compiler('cpp') - -if cc.get_argument_syntax() == 'msvc' - is_arg = '/OPT:REF' - useless = '/DEBUG' - isnt_arg = '/iambroken' -else - is_arg = '-Wl,-Lfoo' - useless = '-Wl,-Lbar' - isnt_arg = '-Wl,-iambroken' -endif - -assert(cc.has_link_argument(is_arg), 'Arg that should have worked does not work.') -assert(not cc.has_link_argument(isnt_arg), 'Arg that should be broken is not.') - -assert(cpp.has_link_argument(is_arg), 'Arg that should have worked does not work.') -assert(not cpp.has_link_argument(isnt_arg), 'Arg that should be broken is not.') - -assert(cc.get_supported_link_arguments([is_arg, isnt_arg, useless]) == [is_arg, useless], 'Arg filtering returned different result.') -assert(cpp.get_supported_link_arguments([is_arg, isnt_arg, useless]) == [is_arg, useless], 'Arg filtering returned different result.') - -# Have useless at the end to ensure that the search goes from front to back. -l1 = cc.first_supported_link_argument([isnt_arg, is_arg, isnt_arg, useless]) -l2 = cc.first_supported_link_argument(isnt_arg, isnt_arg, isnt_arg) - -assert(l1.length() == 1, 'First supported returned wrong result.') -assert(l1.get(0) == is_arg, 'First supported returned wrong argument.') -assert(l2.length() == 0, 'First supported did not return empty array.') - -l1 = cpp.first_supported_link_argument([isnt_arg, is_arg, isnt_arg, useless]) -l2 = cpp.first_supported_link_argument(isnt_arg, isnt_arg, isnt_arg) - -assert(l1.length() == 1, 'First supported returned wrong result.') -assert(l1.get(0) == is_arg, 'First supported returned wrong argument.') -assert(l2.length() == 0, 'First supported did not return empty array.') - -assert(not cc.has_multi_link_arguments([isnt_arg, is_arg]), 'Arg that should be broken is not.') -assert(cc.has_multi_link_arguments(is_arg), 'Arg that should have worked does not work.') -assert(cc.has_multi_link_arguments([useless, is_arg]), 'Arg that should have worked does not work.') - -assert(not cc.has_link_argument('-Wl,-z,nodelete42'), 'Did not detect wrong -z linker argument') diff --git a/test cases/common/186 same target name flat layout/foo.c b/test cases/common/186 same target name flat layout/foo.c new file mode 100644 index 0000000..ed42789 --- /dev/null +++ b/test cases/common/186 same target name flat layout/foo.c @@ -0,0 +1 @@ +int meson_test_main_foo(void) { return 10; } diff --git a/test cases/common/186 same target name flat layout/main.c b/test cases/common/186 same target name flat layout/main.c new file mode 100644 index 0000000..6f02aeb --- /dev/null +++ b/test cases/common/186 same target name flat layout/main.c @@ -0,0 +1,16 @@ +#include + +int meson_test_main_foo(void); +int meson_test_subproj_foo(void); + +int main(void) { + if (meson_test_main_foo() != 10) { + printf("Failed meson_test_main_foo\n"); + return 1; + } + if (meson_test_subproj_foo() != 20) { + printf("Failed meson_test_subproj_foo\n"); + return 1; + } + return 0; +} diff --git a/test cases/common/186 same target name flat layout/meson.build b/test cases/common/186 same target name flat layout/meson.build new file mode 100644 index 0000000..a3c95fa --- /dev/null +++ b/test cases/common/186 same target name flat layout/meson.build @@ -0,0 +1,11 @@ +project('subdir targets', 'c') + +# Idea behind this test is to create targets with identical name +# but different output files. We can do this by choosing different +# name_prefix of libraries. Target id does not depend on name_prefix. + +main_foo = static_library('foo', 'foo.c', name_prefix : 'main') +subdir('subdir') # defines subdir_foo + +exe = executable('prog', 'main.c', link_with : [main_foo, subdir_foo]) +test('main test', exe) diff --git a/test cases/common/186 same target name flat layout/subdir/foo.c b/test cases/common/186 same target name flat layout/subdir/foo.c new file mode 100644 index 0000000..f334292 --- /dev/null +++ b/test cases/common/186 same target name flat layout/subdir/foo.c @@ -0,0 +1 @@ +int meson_test_subproj_foo(void) { return 20; } diff --git a/test cases/common/186 same target name flat layout/subdir/meson.build b/test cases/common/186 same target name flat layout/subdir/meson.build new file mode 100644 index 0000000..223a5ef --- /dev/null +++ b/test cases/common/186 same target name flat layout/subdir/meson.build @@ -0,0 +1 @@ +subdir_foo = static_library('foo', 'foo.c', name_prefix : 'subdir') diff --git a/test cases/common/187 find override/meson.build b/test cases/common/187 find override/meson.build new file mode 100644 index 0000000..3b8af80 --- /dev/null +++ b/test cases/common/187 find override/meson.build @@ -0,0 +1,12 @@ +project('find program override', 'c') + +gencodegen = find_program('gencodegen', required : false) + +assert(not gencodegen.found(), 'gencodegen is an internal program, should not be found') + +# Test the check-if-found-else-override workflow +if not gencodegen.found() + subdir('subdir') +endif + +subdir('otherdir') diff --git a/test cases/common/187 find override/otherdir/main.c b/test cases/common/187 find override/otherdir/main.c new file mode 100644 index 0000000..2cef67c --- /dev/null +++ b/test cases/common/187 find override/otherdir/main.c @@ -0,0 +1,5 @@ +int be_seeing_you(); + +int main(int argc, char **argv) { + return be_seeing_you() == 6 ? 0 : 1; +} diff --git a/test cases/common/187 find override/otherdir/main2.c b/test cases/common/187 find override/otherdir/main2.c new file mode 100644 index 0000000..6d71688 --- /dev/null +++ b/test cases/common/187 find override/otherdir/main2.c @@ -0,0 +1,5 @@ +int number_returner(); + +int main(int argc, char **argv) { + return number_returner() == 100 ? 0 : 1; +} diff --git a/test cases/common/187 find override/otherdir/meson.build b/test cases/common/187 find override/otherdir/meson.build new file mode 100644 index 0000000..dc41f5b --- /dev/null +++ b/test cases/common/187 find override/otherdir/meson.build @@ -0,0 +1,26 @@ +gen = find_program('codegen') # Should use overridden value set in "subdir". + +src = custom_target('arrival', + input : 'source.desc', + output : 'file.c', + command : [gen, '@INPUT@', '@OUTPUT@'] + ) + +e = executable('six', 'main.c', src) + +test('six', e) + +# The same again, but this time with a program that was genererated +# with configure_file. + +gen = find_program('gencodegen') + +src = custom_target('hundred', + input : 'source2.desc', + output : 'file2.c', + command : [gen, '@INPUT@', '@OUTPUT@'] + ) + +e = executable('hundred', 'main2.c', src) + +test('hundred', e) diff --git a/test cases/common/187 find override/otherdir/source.desc b/test cases/common/187 find override/otherdir/source.desc new file mode 100644 index 0000000..8b19c9c --- /dev/null +++ b/test cases/common/187 find override/otherdir/source.desc @@ -0,0 +1 @@ +be_seeing_you diff --git a/test cases/common/187 find override/otherdir/source2.desc b/test cases/common/187 find override/otherdir/source2.desc new file mode 100644 index 0000000..965f868 --- /dev/null +++ b/test cases/common/187 find override/otherdir/source2.desc @@ -0,0 +1 @@ +number_returner diff --git a/test cases/common/187 find override/subdir/converter.py b/test cases/common/187 find override/subdir/converter.py new file mode 100755 index 0000000..ee2ff85 --- /dev/null +++ b/test cases/common/187 find override/subdir/converter.py @@ -0,0 +1,15 @@ +#!/usr/bin/env python3 + +import sys +import pathlib + +[ifilename, ofilename] = sys.argv[1:3] + +ftempl = '''int %s() { + return 6; +} +''' + +d = pathlib.Path(ifilename).read_text().split('\n')[0].strip() + +pathlib.Path(ofilename).write_text(ftempl % d) diff --git a/test cases/common/187 find override/subdir/gencodegen.py.in b/test cases/common/187 find override/subdir/gencodegen.py.in new file mode 100755 index 0000000..57d9c40 --- /dev/null +++ b/test cases/common/187 find override/subdir/gencodegen.py.in @@ -0,0 +1,15 @@ +#!/usr/bin/env python3 + +import sys +import pathlib + +[ifilename, ofilename] = sys.argv[1:3] + +ftempl = '''int %s() { + return @NUMBER@; +} +''' + +d = pathlib.Path(ifilename).read_text().split('\n')[0].strip() + +pathlib.Path(ofilename).write_text(ftempl % d) diff --git a/test cases/common/187 find override/subdir/meson.build b/test cases/common/187 find override/subdir/meson.build new file mode 100644 index 0000000..e5de34d --- /dev/null +++ b/test cases/common/187 find override/subdir/meson.build @@ -0,0 +1,14 @@ +x = find_program('converter.py') + +meson.override_find_program('codegen', x) + +# Override a command with a generated script + +cdata = configuration_data() + +cdata.set('NUMBER', 100) +numprog = configure_file(input : 'gencodegen.py.in', + output : 'gencodegen.py', + configuration : cdata) + +meson.override_find_program('gencodegen', numprog) diff --git a/test cases/common/187 same target name flat layout/foo.c b/test cases/common/187 same target name flat layout/foo.c deleted file mode 100644 index ed42789..0000000 --- a/test cases/common/187 same target name flat layout/foo.c +++ /dev/null @@ -1 +0,0 @@ -int meson_test_main_foo(void) { return 10; } diff --git a/test cases/common/187 same target name flat layout/main.c b/test cases/common/187 same target name flat layout/main.c deleted file mode 100644 index 6f02aeb..0000000 --- a/test cases/common/187 same target name flat layout/main.c +++ /dev/null @@ -1,16 +0,0 @@ -#include - -int meson_test_main_foo(void); -int meson_test_subproj_foo(void); - -int main(void) { - if (meson_test_main_foo() != 10) { - printf("Failed meson_test_main_foo\n"); - return 1; - } - if (meson_test_subproj_foo() != 20) { - printf("Failed meson_test_subproj_foo\n"); - return 1; - } - return 0; -} diff --git a/test cases/common/187 same target name flat layout/meson.build b/test cases/common/187 same target name flat layout/meson.build deleted file mode 100644 index a3c95fa..0000000 --- a/test cases/common/187 same target name flat layout/meson.build +++ /dev/null @@ -1,11 +0,0 @@ -project('subdir targets', 'c') - -# Idea behind this test is to create targets with identical name -# but different output files. We can do this by choosing different -# name_prefix of libraries. Target id does not depend on name_prefix. - -main_foo = static_library('foo', 'foo.c', name_prefix : 'main') -subdir('subdir') # defines subdir_foo - -exe = executable('prog', 'main.c', link_with : [main_foo, subdir_foo]) -test('main test', exe) diff --git a/test cases/common/187 same target name flat layout/subdir/foo.c b/test cases/common/187 same target name flat layout/subdir/foo.c deleted file mode 100644 index f334292..0000000 --- a/test cases/common/187 same target name flat layout/subdir/foo.c +++ /dev/null @@ -1 +0,0 @@ -int meson_test_subproj_foo(void) { return 20; } diff --git a/test cases/common/187 same target name flat layout/subdir/meson.build b/test cases/common/187 same target name flat layout/subdir/meson.build deleted file mode 100644 index 223a5ef..0000000 --- a/test cases/common/187 same target name flat layout/subdir/meson.build +++ /dev/null @@ -1 +0,0 @@ -subdir_foo = static_library('foo', 'foo.c', name_prefix : 'subdir') diff --git a/test cases/common/188 find override/meson.build b/test cases/common/188 find override/meson.build deleted file mode 100644 index 3b8af80..0000000 --- a/test cases/common/188 find override/meson.build +++ /dev/null @@ -1,12 +0,0 @@ -project('find program override', 'c') - -gencodegen = find_program('gencodegen', required : false) - -assert(not gencodegen.found(), 'gencodegen is an internal program, should not be found') - -# Test the check-if-found-else-override workflow -if not gencodegen.found() - subdir('subdir') -endif - -subdir('otherdir') diff --git a/test cases/common/188 find override/otherdir/main.c b/test cases/common/188 find override/otherdir/main.c deleted file mode 100644 index 2cef67c..0000000 --- a/test cases/common/188 find override/otherdir/main.c +++ /dev/null @@ -1,5 +0,0 @@ -int be_seeing_you(); - -int main(int argc, char **argv) { - return be_seeing_you() == 6 ? 0 : 1; -} diff --git a/test cases/common/188 find override/otherdir/main2.c b/test cases/common/188 find override/otherdir/main2.c deleted file mode 100644 index 6d71688..0000000 --- a/test cases/common/188 find override/otherdir/main2.c +++ /dev/null @@ -1,5 +0,0 @@ -int number_returner(); - -int main(int argc, char **argv) { - return number_returner() == 100 ? 0 : 1; -} diff --git a/test cases/common/188 find override/otherdir/meson.build b/test cases/common/188 find override/otherdir/meson.build deleted file mode 100644 index dc41f5b..0000000 --- a/test cases/common/188 find override/otherdir/meson.build +++ /dev/null @@ -1,26 +0,0 @@ -gen = find_program('codegen') # Should use overridden value set in "subdir". - -src = custom_target('arrival', - input : 'source.desc', - output : 'file.c', - command : [gen, '@INPUT@', '@OUTPUT@'] - ) - -e = executable('six', 'main.c', src) - -test('six', e) - -# The same again, but this time with a program that was genererated -# with configure_file. - -gen = find_program('gencodegen') - -src = custom_target('hundred', - input : 'source2.desc', - output : 'file2.c', - command : [gen, '@INPUT@', '@OUTPUT@'] - ) - -e = executable('hundred', 'main2.c', src) - -test('hundred', e) diff --git a/test cases/common/188 find override/otherdir/source.desc b/test cases/common/188 find override/otherdir/source.desc deleted file mode 100644 index 8b19c9c..0000000 --- a/test cases/common/188 find override/otherdir/source.desc +++ /dev/null @@ -1 +0,0 @@ -be_seeing_you diff --git a/test cases/common/188 find override/otherdir/source2.desc b/test cases/common/188 find override/otherdir/source2.desc deleted file mode 100644 index 965f868..0000000 --- a/test cases/common/188 find override/otherdir/source2.desc +++ /dev/null @@ -1 +0,0 @@ -number_returner diff --git a/test cases/common/188 find override/subdir/converter.py b/test cases/common/188 find override/subdir/converter.py deleted file mode 100755 index ee2ff85..0000000 --- a/test cases/common/188 find override/subdir/converter.py +++ /dev/null @@ -1,15 +0,0 @@ -#!/usr/bin/env python3 - -import sys -import pathlib - -[ifilename, ofilename] = sys.argv[1:3] - -ftempl = '''int %s() { - return 6; -} -''' - -d = pathlib.Path(ifilename).read_text().split('\n')[0].strip() - -pathlib.Path(ofilename).write_text(ftempl % d) diff --git a/test cases/common/188 find override/subdir/gencodegen.py.in b/test cases/common/188 find override/subdir/gencodegen.py.in deleted file mode 100755 index 57d9c40..0000000 --- a/test cases/common/188 find override/subdir/gencodegen.py.in +++ /dev/null @@ -1,15 +0,0 @@ -#!/usr/bin/env python3 - -import sys -import pathlib - -[ifilename, ofilename] = sys.argv[1:3] - -ftempl = '''int %s() { - return @NUMBER@; -} -''' - -d = pathlib.Path(ifilename).read_text().split('\n')[0].strip() - -pathlib.Path(ofilename).write_text(ftempl % d) diff --git a/test cases/common/188 find override/subdir/meson.build b/test cases/common/188 find override/subdir/meson.build deleted file mode 100644 index e5de34d..0000000 --- a/test cases/common/188 find override/subdir/meson.build +++ /dev/null @@ -1,14 +0,0 @@ -x = find_program('converter.py') - -meson.override_find_program('codegen', x) - -# Override a command with a generated script - -cdata = configuration_data() - -cdata.set('NUMBER', 100) -numprog = configure_file(input : 'gencodegen.py.in', - output : 'gencodegen.py', - configuration : cdata) - -meson.override_find_program('gencodegen', numprog) diff --git a/test cases/common/188 partial dependency/declare_dependency/headers/foo.c b/test cases/common/188 partial dependency/declare_dependency/headers/foo.c new file mode 100644 index 0000000..215112c --- /dev/null +++ b/test cases/common/188 partial dependency/declare_dependency/headers/foo.c @@ -0,0 +1,16 @@ +/* Copyright © 2018 Intel Corporation + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#error "Included C sources that shouldn't be." diff --git a/test cases/common/188 partial dependency/declare_dependency/headers/foo.h b/test cases/common/188 partial dependency/declare_dependency/headers/foo.h new file mode 100644 index 0000000..28c81c9 --- /dev/null +++ b/test cases/common/188 partial dependency/declare_dependency/headers/foo.h @@ -0,0 +1,16 @@ +/* Copyright © 2018 Intel Corporation + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +int foo(void); diff --git a/test cases/common/188 partial dependency/declare_dependency/main.c b/test cases/common/188 partial dependency/declare_dependency/main.c new file mode 100644 index 0000000..e9ed032 --- /dev/null +++ b/test cases/common/188 partial dependency/declare_dependency/main.c @@ -0,0 +1,25 @@ +/* Copyright © 2018 Intel Corporation + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "foo.h" + +int main() { + int a = foo(); + if (a == 1) { + return 0; + } else { + return 1; + } +} diff --git a/test cases/common/188 partial dependency/declare_dependency/meson.build b/test cases/common/188 partial dependency/declare_dependency/meson.build new file mode 100644 index 0000000..3783f66 --- /dev/null +++ b/test cases/common/188 partial dependency/declare_dependency/meson.build @@ -0,0 +1,32 @@ +# Copyright © 2018 Intel Corporation +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +dec_sub_dep = declare_dependency( + include_directories : include_directories('headers'), +) + +dec_dep = declare_dependency( + sources : files('headers/foo.c'), + dependencies : dec_sub_dep, +) + +sub_dep = dec_dep.partial_dependency(includes : true) + +dec_exe = executable( + 'declare_dep', + files('main.c', 'other.c'), + dependencies : sub_dep, +) + +test('Declare Dependency', dec_exe) diff --git a/test cases/common/188 partial dependency/declare_dependency/other.c b/test cases/common/188 partial dependency/declare_dependency/other.c new file mode 100644 index 0000000..b1e199e --- /dev/null +++ b/test cases/common/188 partial dependency/declare_dependency/other.c @@ -0,0 +1,20 @@ +/* Copyright © 2018 Intel Corporation + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "foo.h" + +int foo(void) { + return 1; +} diff --git a/test cases/common/188 partial dependency/meson.build b/test cases/common/188 partial dependency/meson.build new file mode 100644 index 0000000..e908487 --- /dev/null +++ b/test cases/common/188 partial dependency/meson.build @@ -0,0 +1,17 @@ +# Copyright © 2018 Intel Corporation +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +project('partial dependency', ['c', 'cpp']) + +subdir('declare_dependency') diff --git a/test cases/common/189 openmp/main.c b/test cases/common/189 openmp/main.c new file mode 100644 index 0000000..cc81f48 --- /dev/null +++ b/test cases/common/189 openmp/main.c @@ -0,0 +1,16 @@ +#include +#include + +int main(void) { +#ifdef _OPENMP + if (omp_get_max_threads() == 2) { + return 0; + } else { + printf("Max threads is %d not 2.\n", omp_get_max_threads()); + return 1; + } +#else + printf("_OPENMP is not defined; is OpenMP compilation working?\n"); + return 1; +#endif +} diff --git a/test cases/common/189 openmp/main.cpp b/test cases/common/189 openmp/main.cpp new file mode 100644 index 0000000..b12be3f --- /dev/null +++ b/test cases/common/189 openmp/main.cpp @@ -0,0 +1,16 @@ +#include +#include + +int main(void) { +#ifdef _OPENMP + if (omp_get_max_threads() == 2) { + return 0; + } else { + std::cout << "Max threads is " << omp_get_max_threads() << " not 2." << std::endl; + return 1; + } +#else + printf("_OPENMP is not defined; is OpenMP compilation working?\n"); + return 1; +#endif +} diff --git a/test cases/common/189 openmp/main.f90 b/test cases/common/189 openmp/main.f90 new file mode 100644 index 0000000..d80f90f --- /dev/null +++ b/test cases/common/189 openmp/main.f90 @@ -0,0 +1,9 @@ +use, intrinsic :: iso_fortran_env, only: stderr=>error_unit +use omp_lib + +if (omp_get_max_threads() /= 2) then + write(stderr, *) 'Max Fortran threads is', omp_get_max_threads(), 'not 2.' + stop 1 +endif + +end program diff --git a/test cases/common/189 openmp/meson.build b/test cases/common/189 openmp/meson.build new file mode 100644 index 0000000..a1154c2 --- /dev/null +++ b/test cases/common/189 openmp/meson.build @@ -0,0 +1,58 @@ +project('openmp', 'c') + +cc = meson.get_compiler('c') +if cc.get_id() == 'gcc' and cc.version().version_compare('<4.2.0') + error('MESON_SKIP_TEST gcc is too old to support OpenMP.') +endif +if cc.get_id() == 'clang' and cc.version().version_compare('<3.7.0') + error('MESON_SKIP_TEST clang is too old to support OpenMP.') +endif +if cc.get_id() == 'msvc' and cc.version().version_compare('<17') + error('MESON_SKIP_TEST msvc is too old to support OpenMP.') +endif +if cc.get_id() == 'clang-cl' + error('MESON_SKIP_TEST clang-cl does not support OpenMP.') +endif +if cc.get_id() == 'clang' and host_machine.system() == 'windows' + error('MESON_SKIP_TEST Windows clang does not support OpenMP.') +endif +if host_machine.system() == 'darwin' + error('MESON_SKIP_TEST macOS does not support OpenMP.') +endif + +openmp = dependency('openmp') +env = environment() +env.set('OMP_NUM_THREADS', '2') + +exec = executable('exec', + 'main.c', + dependencies : [openmp]) +test('OpenMP C', exec, env : env) + +if not(build_machine.system() == 'windows' and cc.get_id() == 'pgi') + if add_languages('cpp', required : false) + execpp = executable('execpp', + 'main.cpp', + dependencies : [openmp]) + test('OpenMP C++', execpp, env : env) + endif +endif + +if add_languages('fortran', required : false) + # Mixing compilers (msvc/clang with gfortran) does not seem to work on Windows. + if build_machine.system() != 'windows' or cc.get_id() == 'gnu' + exef = executable('exef', + 'main.f90', + dependencies : [openmp]) + test('OpenMP Fortran', exef, env : env) + + openmp_f = dependency('openmp', language : 'fortran') + exe_f = executable('exe_f', + 'main.f90', + dependencies : [openmp_f]) + test('OpenMP Fortran-specific', exe_f, env : env) + endif +endif + +# Check we can apply a version constraint +dependency('openmp', version: '>=@0@'.format(openmp.version())) diff --git a/test cases/common/189 partial dependency/declare_dependency/headers/foo.c b/test cases/common/189 partial dependency/declare_dependency/headers/foo.c deleted file mode 100644 index 215112c..0000000 --- a/test cases/common/189 partial dependency/declare_dependency/headers/foo.c +++ /dev/null @@ -1,16 +0,0 @@ -/* Copyright © 2018 Intel Corporation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#error "Included C sources that shouldn't be." diff --git a/test cases/common/189 partial dependency/declare_dependency/headers/foo.h b/test cases/common/189 partial dependency/declare_dependency/headers/foo.h deleted file mode 100644 index 28c81c9..0000000 --- a/test cases/common/189 partial dependency/declare_dependency/headers/foo.h +++ /dev/null @@ -1,16 +0,0 @@ -/* Copyright © 2018 Intel Corporation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -int foo(void); diff --git a/test cases/common/189 partial dependency/declare_dependency/main.c b/test cases/common/189 partial dependency/declare_dependency/main.c deleted file mode 100644 index e9ed032..0000000 --- a/test cases/common/189 partial dependency/declare_dependency/main.c +++ /dev/null @@ -1,25 +0,0 @@ -/* Copyright © 2018 Intel Corporation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#include "foo.h" - -int main() { - int a = foo(); - if (a == 1) { - return 0; - } else { - return 1; - } -} diff --git a/test cases/common/189 partial dependency/declare_dependency/meson.build b/test cases/common/189 partial dependency/declare_dependency/meson.build deleted file mode 100644 index 3783f66..0000000 --- a/test cases/common/189 partial dependency/declare_dependency/meson.build +++ /dev/null @@ -1,32 +0,0 @@ -# Copyright © 2018 Intel Corporation -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -dec_sub_dep = declare_dependency( - include_directories : include_directories('headers'), -) - -dec_dep = declare_dependency( - sources : files('headers/foo.c'), - dependencies : dec_sub_dep, -) - -sub_dep = dec_dep.partial_dependency(includes : true) - -dec_exe = executable( - 'declare_dep', - files('main.c', 'other.c'), - dependencies : sub_dep, -) - -test('Declare Dependency', dec_exe) diff --git a/test cases/common/189 partial dependency/declare_dependency/other.c b/test cases/common/189 partial dependency/declare_dependency/other.c deleted file mode 100644 index b1e199e..0000000 --- a/test cases/common/189 partial dependency/declare_dependency/other.c +++ /dev/null @@ -1,20 +0,0 @@ -/* Copyright © 2018 Intel Corporation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#include "foo.h" - -int foo(void) { - return 1; -} diff --git a/test cases/common/189 partial dependency/meson.build b/test cases/common/189 partial dependency/meson.build deleted file mode 100644 index e908487..0000000 --- a/test cases/common/189 partial dependency/meson.build +++ /dev/null @@ -1,17 +0,0 @@ -# Copyright © 2018 Intel Corporation -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -project('partial dependency', ['c', 'cpp']) - -subdir('declare_dependency') diff --git a/test cases/common/190 openmp/main.c b/test cases/common/190 openmp/main.c deleted file mode 100644 index cc81f48..0000000 --- a/test cases/common/190 openmp/main.c +++ /dev/null @@ -1,16 +0,0 @@ -#include -#include - -int main(void) { -#ifdef _OPENMP - if (omp_get_max_threads() == 2) { - return 0; - } else { - printf("Max threads is %d not 2.\n", omp_get_max_threads()); - return 1; - } -#else - printf("_OPENMP is not defined; is OpenMP compilation working?\n"); - return 1; -#endif -} diff --git a/test cases/common/190 openmp/main.cpp b/test cases/common/190 openmp/main.cpp deleted file mode 100644 index b12be3f..0000000 --- a/test cases/common/190 openmp/main.cpp +++ /dev/null @@ -1,16 +0,0 @@ -#include -#include - -int main(void) { -#ifdef _OPENMP - if (omp_get_max_threads() == 2) { - return 0; - } else { - std::cout << "Max threads is " << omp_get_max_threads() << " not 2." << std::endl; - return 1; - } -#else - printf("_OPENMP is not defined; is OpenMP compilation working?\n"); - return 1; -#endif -} diff --git a/test cases/common/190 openmp/main.f90 b/test cases/common/190 openmp/main.f90 deleted file mode 100644 index d80f90f..0000000 --- a/test cases/common/190 openmp/main.f90 +++ /dev/null @@ -1,9 +0,0 @@ -use, intrinsic :: iso_fortran_env, only: stderr=>error_unit -use omp_lib - -if (omp_get_max_threads() /= 2) then - write(stderr, *) 'Max Fortran threads is', omp_get_max_threads(), 'not 2.' - stop 1 -endif - -end program diff --git a/test cases/common/190 openmp/meson.build b/test cases/common/190 openmp/meson.build deleted file mode 100644 index a1154c2..0000000 --- a/test cases/common/190 openmp/meson.build +++ /dev/null @@ -1,58 +0,0 @@ -project('openmp', 'c') - -cc = meson.get_compiler('c') -if cc.get_id() == 'gcc' and cc.version().version_compare('<4.2.0') - error('MESON_SKIP_TEST gcc is too old to support OpenMP.') -endif -if cc.get_id() == 'clang' and cc.version().version_compare('<3.7.0') - error('MESON_SKIP_TEST clang is too old to support OpenMP.') -endif -if cc.get_id() == 'msvc' and cc.version().version_compare('<17') - error('MESON_SKIP_TEST msvc is too old to support OpenMP.') -endif -if cc.get_id() == 'clang-cl' - error('MESON_SKIP_TEST clang-cl does not support OpenMP.') -endif -if cc.get_id() == 'clang' and host_machine.system() == 'windows' - error('MESON_SKIP_TEST Windows clang does not support OpenMP.') -endif -if host_machine.system() == 'darwin' - error('MESON_SKIP_TEST macOS does not support OpenMP.') -endif - -openmp = dependency('openmp') -env = environment() -env.set('OMP_NUM_THREADS', '2') - -exec = executable('exec', - 'main.c', - dependencies : [openmp]) -test('OpenMP C', exec, env : env) - -if not(build_machine.system() == 'windows' and cc.get_id() == 'pgi') - if add_languages('cpp', required : false) - execpp = executable('execpp', - 'main.cpp', - dependencies : [openmp]) - test('OpenMP C++', execpp, env : env) - endif -endif - -if add_languages('fortran', required : false) - # Mixing compilers (msvc/clang with gfortran) does not seem to work on Windows. - if build_machine.system() != 'windows' or cc.get_id() == 'gnu' - exef = executable('exef', - 'main.f90', - dependencies : [openmp]) - test('OpenMP Fortran', exef, env : env) - - openmp_f = dependency('openmp', language : 'fortran') - exe_f = executable('exe_f', - 'main.f90', - dependencies : [openmp_f]) - test('OpenMP Fortran-specific', exe_f, env : env) - endif -endif - -# Check we can apply a version constraint -dependency('openmp', version: '>=@0@'.format(openmp.version())) diff --git a/test cases/common/190 same target name/file.c b/test cases/common/190 same target name/file.c new file mode 100644 index 0000000..6f1c172 --- /dev/null +++ b/test cases/common/190 same target name/file.c @@ -0,0 +1,3 @@ +int func() { + return 0; +} diff --git a/test cases/common/190 same target name/meson.build b/test cases/common/190 same target name/meson.build new file mode 100644 index 0000000..4e585d5 --- /dev/null +++ b/test cases/common/190 same target name/meson.build @@ -0,0 +1,4 @@ +project('same name', 'c') + +static_library('foo', 'file.c') +subdir('sub') diff --git a/test cases/common/190 same target name/sub/file2.c b/test cases/common/190 same target name/sub/file2.c new file mode 100644 index 0000000..a5e453d --- /dev/null +++ b/test cases/common/190 same target name/sub/file2.c @@ -0,0 +1,3 @@ +int func() { + return 5; +} diff --git a/test cases/common/190 same target name/sub/meson.build b/test cases/common/190 same target name/sub/meson.build new file mode 100644 index 0000000..610a4a3 --- /dev/null +++ b/test cases/common/190 same target name/sub/meson.build @@ -0,0 +1 @@ +static_library('foo', 'file2.c') diff --git a/test cases/common/191 same target name/file.c b/test cases/common/191 same target name/file.c deleted file mode 100644 index 6f1c172..0000000 --- a/test cases/common/191 same target name/file.c +++ /dev/null @@ -1,3 +0,0 @@ -int func() { - return 0; -} diff --git a/test cases/common/191 same target name/meson.build b/test cases/common/191 same target name/meson.build deleted file mode 100644 index 4e585d5..0000000 --- a/test cases/common/191 same target name/meson.build +++ /dev/null @@ -1,4 +0,0 @@ -project('same name', 'c') - -static_library('foo', 'file.c') -subdir('sub') diff --git a/test cases/common/191 same target name/sub/file2.c b/test cases/common/191 same target name/sub/file2.c deleted file mode 100644 index a5e453d..0000000 --- a/test cases/common/191 same target name/sub/file2.c +++ /dev/null @@ -1,3 +0,0 @@ -int func() { - return 5; -} diff --git a/test cases/common/191 same target name/sub/meson.build b/test cases/common/191 same target name/sub/meson.build deleted file mode 100644 index 610a4a3..0000000 --- a/test cases/common/191 same target name/sub/meson.build +++ /dev/null @@ -1 +0,0 @@ -static_library('foo', 'file2.c') diff --git a/test cases/common/191 test depends/gen.py b/test cases/common/191 test depends/gen.py new file mode 100755 index 0000000..ee4ed98 --- /dev/null +++ b/test cases/common/191 test depends/gen.py @@ -0,0 +1,13 @@ +#!/usr/bin/env python3 + +import sys + + +def main(): + with open(sys.argv[1], 'w') as out: + out.write(sys.argv[2]) + out.write('\n') + + +if __name__ == '__main__': + main() diff --git a/test cases/common/191 test depends/main.c b/test cases/common/191 test depends/main.c new file mode 100644 index 0000000..78f2de1 --- /dev/null +++ b/test cases/common/191 test depends/main.c @@ -0,0 +1 @@ +int main(void) { return 0; } diff --git a/test cases/common/191 test depends/meson.build b/test cases/common/191 test depends/meson.build new file mode 100644 index 0000000..888c451 --- /dev/null +++ b/test cases/common/191 test depends/meson.build @@ -0,0 +1,26 @@ +project('test depends', 'c') + +gen = find_program('gen.py') + +custom_dep = custom_target('custom_dep', + build_by_default : false, + output : 'custom_dep.txt', + command : [gen, '@OUTPUT@', 'custom_dep'], +) + +exe_dep = executable('exe_dep', 'main.c', + build_by_default : false, +) + +test_prog = find_program('test.py') +test('string dependencies', test_prog, + args : [ + # This is declared for convenience, + # real use case might have some obscure method + # to find these dependencies, e.g. automatic plugin loading. + 'custom_dep.txt', + exe_dep.full_path(), + ], + depends : [custom_dep, exe_dep], + workdir : meson.current_build_dir(), +) diff --git a/test cases/common/191 test depends/test.py b/test cases/common/191 test depends/test.py new file mode 100755 index 0000000..5b9f65c --- /dev/null +++ b/test cases/common/191 test depends/test.py @@ -0,0 +1,20 @@ +#!/usr/bin/env python3 + +import os +import os.path +import sys + + +def main(): + print('Looking in:', os.getcwd()) + not_found = list() + for f in sys.argv[1:]: + if not os.path.exists(f): + not_found.append(f) + if not_found: + print('Not found:', ', '.join(not_found)) + sys.exit(1) + + +if __name__ == '__main__': + main() diff --git a/test cases/common/192 args flattening/meson.build b/test cases/common/192 args flattening/meson.build new file mode 100644 index 0000000..6da2e8f --- /dev/null +++ b/test cases/common/192 args flattening/meson.build @@ -0,0 +1,29 @@ +project('args flattening') + +arr = get_variable('does-not-exist', ['bar', 'baz']) + +assert(arr == ['bar', 'baz'], 'get_variable with array fallback is broken') + +set_variable('arr', ['bar', 'baz']) + +assert(arr == ['bar', 'baz'], 'set_variable(array) is broken') + +conf = configuration_data() + +conf.set('foo', ['bar', 'baz']) + +assert(conf.get('foo') == ['bar', 'baz'], 'configuration_data.set(array) is broken') + +arr = conf.get('does-not-exist', ['bar', 'baz']) + +assert(arr == ['bar', 'baz'], 'configuration_data.get with array fallback is broken') + +arr = meson.get_cross_property('does-not-exist', ['bar', 'baz']) + +assert(arr == ['bar', 'baz'], 'meson.get_cross_property with array fallback is broken') + +# Test deprecated behaviour + +conf.set(['foo', 'bar']) + +message(conf.get('foo')) diff --git a/test cases/common/192 test depends/gen.py b/test cases/common/192 test depends/gen.py deleted file mode 100755 index ee4ed98..0000000 --- a/test cases/common/192 test depends/gen.py +++ /dev/null @@ -1,13 +0,0 @@ -#!/usr/bin/env python3 - -import sys - - -def main(): - with open(sys.argv[1], 'w') as out: - out.write(sys.argv[2]) - out.write('\n') - - -if __name__ == '__main__': - main() diff --git a/test cases/common/192 test depends/main.c b/test cases/common/192 test depends/main.c deleted file mode 100644 index 78f2de1..0000000 --- a/test cases/common/192 test depends/main.c +++ /dev/null @@ -1 +0,0 @@ -int main(void) { return 0; } diff --git a/test cases/common/192 test depends/meson.build b/test cases/common/192 test depends/meson.build deleted file mode 100644 index 888c451..0000000 --- a/test cases/common/192 test depends/meson.build +++ /dev/null @@ -1,26 +0,0 @@ -project('test depends', 'c') - -gen = find_program('gen.py') - -custom_dep = custom_target('custom_dep', - build_by_default : false, - output : 'custom_dep.txt', - command : [gen, '@OUTPUT@', 'custom_dep'], -) - -exe_dep = executable('exe_dep', 'main.c', - build_by_default : false, -) - -test_prog = find_program('test.py') -test('string dependencies', test_prog, - args : [ - # This is declared for convenience, - # real use case might have some obscure method - # to find these dependencies, e.g. automatic plugin loading. - 'custom_dep.txt', - exe_dep.full_path(), - ], - depends : [custom_dep, exe_dep], - workdir : meson.current_build_dir(), -) diff --git a/test cases/common/192 test depends/test.py b/test cases/common/192 test depends/test.py deleted file mode 100755 index 5b9f65c..0000000 --- a/test cases/common/192 test depends/test.py +++ /dev/null @@ -1,20 +0,0 @@ -#!/usr/bin/env python3 - -import os -import os.path -import sys - - -def main(): - print('Looking in:', os.getcwd()) - not_found = list() - for f in sys.argv[1:]: - if not os.path.exists(f): - not_found.append(f) - if not_found: - print('Not found:', ', '.join(not_found)) - sys.exit(1) - - -if __name__ == '__main__': - main() diff --git a/test cases/common/193 args flattening/meson.build b/test cases/common/193 args flattening/meson.build deleted file mode 100644 index 6da2e8f..0000000 --- a/test cases/common/193 args flattening/meson.build +++ /dev/null @@ -1,29 +0,0 @@ -project('args flattening') - -arr = get_variable('does-not-exist', ['bar', 'baz']) - -assert(arr == ['bar', 'baz'], 'get_variable with array fallback is broken') - -set_variable('arr', ['bar', 'baz']) - -assert(arr == ['bar', 'baz'], 'set_variable(array) is broken') - -conf = configuration_data() - -conf.set('foo', ['bar', 'baz']) - -assert(conf.get('foo') == ['bar', 'baz'], 'configuration_data.set(array) is broken') - -arr = conf.get('does-not-exist', ['bar', 'baz']) - -assert(arr == ['bar', 'baz'], 'configuration_data.get with array fallback is broken') - -arr = meson.get_cross_property('does-not-exist', ['bar', 'baz']) - -assert(arr == ['bar', 'baz'], 'meson.get_cross_property with array fallback is broken') - -# Test deprecated behaviour - -conf.set(['foo', 'bar']) - -message(conf.get('foo')) diff --git a/test cases/common/193 dict/meson.build b/test cases/common/193 dict/meson.build new file mode 100644 index 0000000..41eea31 --- /dev/null +++ b/test cases/common/193 dict/meson.build @@ -0,0 +1,35 @@ +project('dict test', 'c') + +dict = {'foo' : 'bar', + 'baz' : 'foo', + 'foo bar': 'baz'} + +exe = executable('prog', sources : ['prog.c']) + +i = 0 + +foreach key, value : dict + test('dict test @0@'.format(key), exe, + args : [dict[key], value]) + i += 1 +endforeach + +assert(i == 3, 'There should be three elements in that dictionary') + +empty_dict = {} + +foreach key, value : empty_dict + assert(false, 'This dict should be empty') +endforeach + +d1 = empty_dict + {'a' : 'b'} +assert(d1 == {'a' : 'b'}, 'dict addition is not working') + +d2 = d1 + {'a' : 'b2', 'c' : 'd'} +assert(d2 == {'a' : 'b2', 'c' : 'd'}, 'dict addition is not working') +assert(d1 == {'a' : 'b'}, 'dict should be immutable') + +d3 = d2 +d3 += {'e' : 'f'} +assert(d3 == {'a' : 'b2', 'c' : 'd', 'e' : 'f'}, 'dict plusassign is not working') +assert(d2 == {'a' : 'b2', 'c' : 'd'}, 'dict should be immutable') diff --git a/test cases/common/193 dict/prog.c b/test cases/common/193 dict/prog.c new file mode 100644 index 0000000..bf0999d --- /dev/null +++ b/test cases/common/193 dict/prog.c @@ -0,0 +1,8 @@ +#include + +int main(int argc, char **argv) { + if (argc != 3) + return 1; + + return strcmp(argv[1], argv[2]); +} diff --git a/test cases/common/194 check header/meson.build b/test cases/common/194 check header/meson.build new file mode 100644 index 0000000..f2f7fa5 --- /dev/null +++ b/test cases/common/194 check header/meson.build @@ -0,0 +1,48 @@ +project('check header', 'c', 'cpp') + +host_system = host_machine.system() + +non_existant_header = 'ouagadougou.h' + +# Copy it into the builddir to ensure that it isn't found even if it's there +configure_file(input : non_existant_header, + output : non_existant_header, + copy: true) + +fallback = '' + +foreach comp : [meson.get_compiler('c'), meson.get_compiler('cpp')] + assert(comp.check_header('stdio.h', prefix : fallback), 'Stdio missing.') + + # stdio.h doesn't actually need stdlib.h, but just test that setting the + # prefix does not result in an error. + assert(comp.check_header('stdio.h', prefix : '#include ' + fallback), + 'Stdio missing.') + + # Test that check_header behaves differently than has_header. The second + # check without windows.h will fail with check_header. + # We only do this check on MSVC because MinGW often defines its own wrappers + # that pre-include windows.h + if comp.get_id() == 'msvc' + assert(comp.check_header('XInput.h', prefix : '#include ' + fallback), + 'XInput.h should not be missing on Windows') + assert(not comp.check_header('XInput.h'), 'XInput.h needs windows.h') + endif + + # Test that the following GCC bug doesn't happen: + # https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80005 + # https://github.com/mesonbuild/meson/issues/1458 + if host_system == 'linux' + assert(comp.check_header('linux/socket.h', prefix : fallback), + 'Could not find ') + if comp.has_header('intrin.h', prefix : fallback) + assert(not comp.check_header('intrin.h'), + 'intrin.h should not be usable on linux') + endif + endif + + # This header exists in the source and the builddir, but we still must not + # find it since we are looking in the system directories. + assert(not comp.check_header(non_existant_header, prefix : fallback), + 'Found non-existant header.') +endforeach diff --git a/test cases/common/194 check header/ouagadougou.h b/test cases/common/194 check header/ouagadougou.h new file mode 100644 index 0000000..2f76c49 --- /dev/null +++ b/test cases/common/194 check header/ouagadougou.h @@ -0,0 +1 @@ +#define OMG_THIS_SHOULDNT_BE_FOUND diff --git a/test cases/common/194 dict/meson.build b/test cases/common/194 dict/meson.build deleted file mode 100644 index 41eea31..0000000 --- a/test cases/common/194 dict/meson.build +++ /dev/null @@ -1,35 +0,0 @@ -project('dict test', 'c') - -dict = {'foo' : 'bar', - 'baz' : 'foo', - 'foo bar': 'baz'} - -exe = executable('prog', sources : ['prog.c']) - -i = 0 - -foreach key, value : dict - test('dict test @0@'.format(key), exe, - args : [dict[key], value]) - i += 1 -endforeach - -assert(i == 3, 'There should be three elements in that dictionary') - -empty_dict = {} - -foreach key, value : empty_dict - assert(false, 'This dict should be empty') -endforeach - -d1 = empty_dict + {'a' : 'b'} -assert(d1 == {'a' : 'b'}, 'dict addition is not working') - -d2 = d1 + {'a' : 'b2', 'c' : 'd'} -assert(d2 == {'a' : 'b2', 'c' : 'd'}, 'dict addition is not working') -assert(d1 == {'a' : 'b'}, 'dict should be immutable') - -d3 = d2 -d3 += {'e' : 'f'} -assert(d3 == {'a' : 'b2', 'c' : 'd', 'e' : 'f'}, 'dict plusassign is not working') -assert(d2 == {'a' : 'b2', 'c' : 'd'}, 'dict should be immutable') diff --git a/test cases/common/194 dict/prog.c b/test cases/common/194 dict/prog.c deleted file mode 100644 index bf0999d..0000000 --- a/test cases/common/194 dict/prog.c +++ /dev/null @@ -1,8 +0,0 @@ -#include - -int main(int argc, char **argv) { - if (argc != 3) - return 1; - - return strcmp(argv[1], argv[2]); -} diff --git a/test cases/common/195 check header/meson.build b/test cases/common/195 check header/meson.build deleted file mode 100644 index f2f7fa5..0000000 --- a/test cases/common/195 check header/meson.build +++ /dev/null @@ -1,48 +0,0 @@ -project('check header', 'c', 'cpp') - -host_system = host_machine.system() - -non_existant_header = 'ouagadougou.h' - -# Copy it into the builddir to ensure that it isn't found even if it's there -configure_file(input : non_existant_header, - output : non_existant_header, - copy: true) - -fallback = '' - -foreach comp : [meson.get_compiler('c'), meson.get_compiler('cpp')] - assert(comp.check_header('stdio.h', prefix : fallback), 'Stdio missing.') - - # stdio.h doesn't actually need stdlib.h, but just test that setting the - # prefix does not result in an error. - assert(comp.check_header('stdio.h', prefix : '#include ' + fallback), - 'Stdio missing.') - - # Test that check_header behaves differently than has_header. The second - # check without windows.h will fail with check_header. - # We only do this check on MSVC because MinGW often defines its own wrappers - # that pre-include windows.h - if comp.get_id() == 'msvc' - assert(comp.check_header('XInput.h', prefix : '#include ' + fallback), - 'XInput.h should not be missing on Windows') - assert(not comp.check_header('XInput.h'), 'XInput.h needs windows.h') - endif - - # Test that the following GCC bug doesn't happen: - # https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80005 - # https://github.com/mesonbuild/meson/issues/1458 - if host_system == 'linux' - assert(comp.check_header('linux/socket.h', prefix : fallback), - 'Could not find ') - if comp.has_header('intrin.h', prefix : fallback) - assert(not comp.check_header('intrin.h'), - 'intrin.h should not be usable on linux') - endif - endif - - # This header exists in the source and the builddir, but we still must not - # find it since we are looking in the system directories. - assert(not comp.check_header(non_existant_header, prefix : fallback), - 'Found non-existant header.') -endforeach diff --git a/test cases/common/195 check header/ouagadougou.h b/test cases/common/195 check header/ouagadougou.h deleted file mode 100644 index 2f76c49..0000000 --- a/test cases/common/195 check header/ouagadougou.h +++ /dev/null @@ -1 +0,0 @@ -#define OMG_THIS_SHOULDNT_BE_FOUND diff --git a/test cases/common/195 install_mode/config.h.in b/test cases/common/195 install_mode/config.h.in new file mode 100644 index 0000000..14a1558 --- /dev/null +++ b/test cases/common/195 install_mode/config.h.in @@ -0,0 +1,5 @@ +#define MESSAGE "@var@" +#define OTHER "@other@" "@second@" "@empty@" + +#mesondefine BE_TRUE +#mesondefine SHOULD_BE_UNDEF diff --git a/test cases/common/195 install_mode/data_source.txt b/test cases/common/195 install_mode/data_source.txt new file mode 100644 index 0000000..0c23cc0 --- /dev/null +++ b/test cases/common/195 install_mode/data_source.txt @@ -0,0 +1 @@ +This is a text only input file. diff --git a/test cases/common/195 install_mode/foo.1 b/test cases/common/195 install_mode/foo.1 new file mode 100644 index 0000000..647c097 --- /dev/null +++ b/test cases/common/195 install_mode/foo.1 @@ -0,0 +1 @@ +this is a man page of foo.1 its contents are irrelevant diff --git a/test cases/common/195 install_mode/installed_files.txt b/test cases/common/195 install_mode/installed_files.txt new file mode 100644 index 0000000..4bd2211 --- /dev/null +++ b/test cases/common/195 install_mode/installed_files.txt @@ -0,0 +1,10 @@ +usr/bin/runscript.sh +usr/bin/trivialprog?exe +?msvc:usr/bin/trivialprog.pdb +usr/include/config.h +usr/include/rootdir.h +usr/libtest/libstat.a +usr/share/man/man1/foo.1 +usr/share/sub1/second.dat +usr/share/sub2/stub +usr/subdir/data.dat diff --git a/test cases/common/195 install_mode/meson.build b/test cases/common/195 install_mode/meson.build new file mode 100644 index 0000000..cae1e91 --- /dev/null +++ b/test cases/common/195 install_mode/meson.build @@ -0,0 +1,59 @@ +project('install_mode test', 'c', + default_options : ['install_umask=027', 'libdir=libtest']) + +if build_machine.system() == 'windows' + error('MESON_SKIP_TEST: install_mode test requires a Unix-like OS') +endif + +# confirm no regressions in install_data +install_data('runscript.sh', + install_dir : get_option('bindir'), + install_mode : ['rwxr-sr-x', 'root', 0]) + +# confirm no regressions in install_subdir +install_subdir('sub1', + install_dir : 'share', + install_mode : ['rwxr-x--t', 'root']) + +install_subdir('sub2', + install_dir : 'share') + +# test install_mode in configure_file +conf = configuration_data() +conf.set('var', 'mystring') +conf.set('other', 'string 2') +conf.set('second', ' bonus') +conf.set('BE_TRUE', true) +configure_file(input : 'config.h.in', + output : 'config.h', + configuration : conf, + install_dir : 'include', + install_mode : 'rw-rwSr--') + +# test install_mode in custom_target +custom_target('bindat', + output : 'data.dat', + input : 'data_source.txt', + command : ['cp', '@INPUT@', '@OUTPUT@'], + install : true, + install_dir : 'subdir', + install_mode : 'rw-rwSr--') + +# test install_mode in install_headers +install_headers('rootdir.h', + install_mode : 'r--r--r-T') + +# test install_mode in install_man +install_man('foo.1', + install_mode : 'r--r--r-T') + +# test install_mode in executable +executable('trivialprog', + sources : 'trivial.c', + install : true, + install_mode : ['rwxr-sr-x', 'root', 'root']) + +# test install_mode in static_library +static_library('stat', 'stat.c', + install : true, + install_mode : ['rw---Sr--']) diff --git a/test cases/common/195 install_mode/rootdir.h b/test cases/common/195 install_mode/rootdir.h new file mode 100644 index 0000000..72fb132 --- /dev/null +++ b/test cases/common/195 install_mode/rootdir.h @@ -0,0 +1,3 @@ +/* This header goes to include dir root. */ + +int root_func(); diff --git a/test cases/common/195 install_mode/runscript.sh b/test cases/common/195 install_mode/runscript.sh new file mode 100644 index 0000000..8bc5ca6 --- /dev/null +++ b/test cases/common/195 install_mode/runscript.sh @@ -0,0 +1,3 @@ +#!/bin/sh + +echo "Runscript" diff --git a/test cases/common/195 install_mode/stat.c b/test cases/common/195 install_mode/stat.c new file mode 100644 index 0000000..fa76a65 --- /dev/null +++ b/test cases/common/195 install_mode/stat.c @@ -0,0 +1 @@ +int func() { return 933; } diff --git a/test cases/common/195 install_mode/sub1/second.dat b/test cases/common/195 install_mode/sub1/second.dat new file mode 100644 index 0000000..48857a8 --- /dev/null +++ b/test cases/common/195 install_mode/sub1/second.dat @@ -0,0 +1 @@ +Test that multiple install_subdirs meld their results. \ No newline at end of file diff --git a/test cases/common/195 install_mode/sub2/stub b/test cases/common/195 install_mode/sub2/stub new file mode 100644 index 0000000..e69de29 diff --git a/test cases/common/195 install_mode/trivial.c b/test cases/common/195 install_mode/trivial.c new file mode 100644 index 0000000..24ac454 --- /dev/null +++ b/test cases/common/195 install_mode/trivial.c @@ -0,0 +1,6 @@ +#include + +int main(int argc, char **argv) { + printf("Trivial test is working.\n"); + return 0; +} diff --git a/test cases/common/196 install_mode/config.h.in b/test cases/common/196 install_mode/config.h.in deleted file mode 100644 index 14a1558..0000000 --- a/test cases/common/196 install_mode/config.h.in +++ /dev/null @@ -1,5 +0,0 @@ -#define MESSAGE "@var@" -#define OTHER "@other@" "@second@" "@empty@" - -#mesondefine BE_TRUE -#mesondefine SHOULD_BE_UNDEF diff --git a/test cases/common/196 install_mode/data_source.txt b/test cases/common/196 install_mode/data_source.txt deleted file mode 100644 index 0c23cc0..0000000 --- a/test cases/common/196 install_mode/data_source.txt +++ /dev/null @@ -1 +0,0 @@ -This is a text only input file. diff --git a/test cases/common/196 install_mode/foo.1 b/test cases/common/196 install_mode/foo.1 deleted file mode 100644 index 647c097..0000000 --- a/test cases/common/196 install_mode/foo.1 +++ /dev/null @@ -1 +0,0 @@ -this is a man page of foo.1 its contents are irrelevant diff --git a/test cases/common/196 install_mode/installed_files.txt b/test cases/common/196 install_mode/installed_files.txt deleted file mode 100644 index 4bd2211..0000000 --- a/test cases/common/196 install_mode/installed_files.txt +++ /dev/null @@ -1,10 +0,0 @@ -usr/bin/runscript.sh -usr/bin/trivialprog?exe -?msvc:usr/bin/trivialprog.pdb -usr/include/config.h -usr/include/rootdir.h -usr/libtest/libstat.a -usr/share/man/man1/foo.1 -usr/share/sub1/second.dat -usr/share/sub2/stub -usr/subdir/data.dat diff --git a/test cases/common/196 install_mode/meson.build b/test cases/common/196 install_mode/meson.build deleted file mode 100644 index cae1e91..0000000 --- a/test cases/common/196 install_mode/meson.build +++ /dev/null @@ -1,59 +0,0 @@ -project('install_mode test', 'c', - default_options : ['install_umask=027', 'libdir=libtest']) - -if build_machine.system() == 'windows' - error('MESON_SKIP_TEST: install_mode test requires a Unix-like OS') -endif - -# confirm no regressions in install_data -install_data('runscript.sh', - install_dir : get_option('bindir'), - install_mode : ['rwxr-sr-x', 'root', 0]) - -# confirm no regressions in install_subdir -install_subdir('sub1', - install_dir : 'share', - install_mode : ['rwxr-x--t', 'root']) - -install_subdir('sub2', - install_dir : 'share') - -# test install_mode in configure_file -conf = configuration_data() -conf.set('var', 'mystring') -conf.set('other', 'string 2') -conf.set('second', ' bonus') -conf.set('BE_TRUE', true) -configure_file(input : 'config.h.in', - output : 'config.h', - configuration : conf, - install_dir : 'include', - install_mode : 'rw-rwSr--') - -# test install_mode in custom_target -custom_target('bindat', - output : 'data.dat', - input : 'data_source.txt', - command : ['cp', '@INPUT@', '@OUTPUT@'], - install : true, - install_dir : 'subdir', - install_mode : 'rw-rwSr--') - -# test install_mode in install_headers -install_headers('rootdir.h', - install_mode : 'r--r--r-T') - -# test install_mode in install_man -install_man('foo.1', - install_mode : 'r--r--r-T') - -# test install_mode in executable -executable('trivialprog', - sources : 'trivial.c', - install : true, - install_mode : ['rwxr-sr-x', 'root', 'root']) - -# test install_mode in static_library -static_library('stat', 'stat.c', - install : true, - install_mode : ['rw---Sr--']) diff --git a/test cases/common/196 install_mode/rootdir.h b/test cases/common/196 install_mode/rootdir.h deleted file mode 100644 index 72fb132..0000000 --- a/test cases/common/196 install_mode/rootdir.h +++ /dev/null @@ -1,3 +0,0 @@ -/* This header goes to include dir root. */ - -int root_func(); diff --git a/test cases/common/196 install_mode/runscript.sh b/test cases/common/196 install_mode/runscript.sh deleted file mode 100644 index 8bc5ca6..0000000 --- a/test cases/common/196 install_mode/runscript.sh +++ /dev/null @@ -1,3 +0,0 @@ -#!/bin/sh - -echo "Runscript" diff --git a/test cases/common/196 install_mode/stat.c b/test cases/common/196 install_mode/stat.c deleted file mode 100644 index fa76a65..0000000 --- a/test cases/common/196 install_mode/stat.c +++ /dev/null @@ -1 +0,0 @@ -int func() { return 933; } diff --git a/test cases/common/196 install_mode/sub1/second.dat b/test cases/common/196 install_mode/sub1/second.dat deleted file mode 100644 index 48857a8..0000000 --- a/test cases/common/196 install_mode/sub1/second.dat +++ /dev/null @@ -1 +0,0 @@ -Test that multiple install_subdirs meld their results. \ No newline at end of file diff --git a/test cases/common/196 install_mode/sub2/stub b/test cases/common/196 install_mode/sub2/stub deleted file mode 100644 index e69de29..0000000 diff --git a/test cases/common/196 install_mode/trivial.c b/test cases/common/196 install_mode/trivial.c deleted file mode 100644 index 24ac454..0000000 --- a/test cases/common/196 install_mode/trivial.c +++ /dev/null @@ -1,6 +0,0 @@ -#include - -int main(int argc, char **argv) { - printf("Trivial test is working.\n"); - return 0; -} diff --git a/test cases/common/196 subproject array version/meson.build b/test cases/common/196 subproject array version/meson.build new file mode 100644 index 0000000..0870bc4 --- /dev/null +++ b/test cases/common/196 subproject array version/meson.build @@ -0,0 +1,3 @@ +project('master', 'c') + +x = subproject('foo', version : ['>=1.0.0', '<2.0']) diff --git a/test cases/common/196 subproject array version/subprojects/foo/meson.build b/test cases/common/196 subproject array version/subprojects/foo/meson.build new file mode 100644 index 0000000..f4ff535 --- /dev/null +++ b/test cases/common/196 subproject array version/subprojects/foo/meson.build @@ -0,0 +1 @@ +project('foo', 'c', version : '1.0.0') diff --git a/test cases/common/197 feature option/meson.build b/test cases/common/197 feature option/meson.build new file mode 100644 index 0000000..ef3fa22 --- /dev/null +++ b/test cases/common/197 feature option/meson.build @@ -0,0 +1,47 @@ +project('feature user option', 'c') + +feature_opts = get_option('auto_features') +required_opt = get_option('required') +optional_opt = get_option('optional') +disabled_opt = get_option('disabled') + +assert(not feature_opts.enabled(), 'Should be auto option') +assert(not feature_opts.disabled(), 'Should be auto option') +assert(feature_opts.auto(), 'Should be auto option') + +assert(required_opt.enabled(), 'Should be enabled option') +assert(not required_opt.disabled(), 'Should be enabled option') +assert(not required_opt.auto(), 'Should be enabled option') + +assert(not optional_opt.enabled(), 'Should be auto option') +assert(not optional_opt.disabled(), 'Should be auto option') +assert(optional_opt.auto(), 'Should be auto option') + +assert(not disabled_opt.enabled(), 'Should be disabled option') +assert(disabled_opt.disabled(), 'Should be disabled option') +assert(not disabled_opt.auto(), 'Should be disabled option') + +dep = dependency('threads', required : required_opt) +assert(dep.found(), 'Should find required "threads" dep') + +dep = dependency('threads', required : optional_opt) +assert(dep.found(), 'Should find optional "threads" dep') + +dep = dependency('threads', required : disabled_opt) +assert(not dep.found(), 'Should not find disabled "threads" dep') + +dep = dependency('notfounddep', required : optional_opt) +assert(not dep.found(), 'Should not find optional "notfounddep" dep') + +dep = dependency('notfounddep', required : disabled_opt) +assert(not dep.found(), 'Should not find disabled "notfounddep" dep') + +cc = meson.get_compiler('c') +lib = cc.find_library('m', required : disabled_opt) +assert(not lib.found(), 'Should not find "m" library') + +cp = find_program('cp', required : disabled_opt) +assert(not cp.found(), 'Should not find "cp" program') + +found = add_languages('cpp', required : disabled_opt) +assert(not found, 'Should not find "cpp" language') diff --git a/test cases/common/197 feature option/meson_options.txt b/test cases/common/197 feature option/meson_options.txt new file mode 100644 index 0000000..063a35f --- /dev/null +++ b/test cases/common/197 feature option/meson_options.txt @@ -0,0 +1,3 @@ +option('required', type : 'feature', value : 'enabled', description : 'An required feature') +option('optional', type : 'feature', value : 'auto', description : 'An optional feature') +option('disabled', type : 'feature', value : 'disabled', description : 'A disabled feature') diff --git a/test cases/common/197 subproject array version/meson.build b/test cases/common/197 subproject array version/meson.build deleted file mode 100644 index 0870bc4..0000000 --- a/test cases/common/197 subproject array version/meson.build +++ /dev/null @@ -1,3 +0,0 @@ -project('master', 'c') - -x = subproject('foo', version : ['>=1.0.0', '<2.0']) diff --git a/test cases/common/197 subproject array version/subprojects/foo/meson.build b/test cases/common/197 subproject array version/subprojects/foo/meson.build deleted file mode 100644 index f4ff535..0000000 --- a/test cases/common/197 subproject array version/subprojects/foo/meson.build +++ /dev/null @@ -1 +0,0 @@ -project('foo', 'c', version : '1.0.0') diff --git a/test cases/common/198 feature option disabled/meson.build b/test cases/common/198 feature option disabled/meson.build new file mode 100644 index 0000000..1a83187 --- /dev/null +++ b/test cases/common/198 feature option disabled/meson.build @@ -0,0 +1,23 @@ +project('feature user option', 'c', + default_options : ['auto_features=disabled']) + +feature_opts = get_option('auto_features') +required_opt = get_option('required') +optional_opt = get_option('optional') +disabled_opt = get_option('disabled') + +assert(not feature_opts.enabled(), 'Should be disabled option') +assert(feature_opts.disabled(), 'Should be disabled option') +assert(not feature_opts.auto(), 'Should be disabled option') + +assert(required_opt.enabled(), 'Should be enabled option') +assert(not required_opt.disabled(), 'Should be enabled option') +assert(not required_opt.auto(), 'Should be enabled option') + +assert(not optional_opt.enabled(), 'Auto feature should be disabled') +assert(optional_opt.disabled(), 'Auto feature should be disabled') +assert(not optional_opt.auto(), 'Auto feature should be disabled') + +assert(not disabled_opt.enabled(), 'Should be disabled option') +assert(disabled_opt.disabled(), 'Should be disabled option') +assert(not disabled_opt.auto(), 'Should be disabled option') diff --git a/test cases/common/198 feature option disabled/meson_options.txt b/test cases/common/198 feature option disabled/meson_options.txt new file mode 100644 index 0000000..063a35f --- /dev/null +++ b/test cases/common/198 feature option disabled/meson_options.txt @@ -0,0 +1,3 @@ +option('required', type : 'feature', value : 'enabled', description : 'An required feature') +option('optional', type : 'feature', value : 'auto', description : 'An optional feature') +option('disabled', type : 'feature', value : 'disabled', description : 'A disabled feature') diff --git a/test cases/common/198 feature option/meson.build b/test cases/common/198 feature option/meson.build deleted file mode 100644 index ef3fa22..0000000 --- a/test cases/common/198 feature option/meson.build +++ /dev/null @@ -1,47 +0,0 @@ -project('feature user option', 'c') - -feature_opts = get_option('auto_features') -required_opt = get_option('required') -optional_opt = get_option('optional') -disabled_opt = get_option('disabled') - -assert(not feature_opts.enabled(), 'Should be auto option') -assert(not feature_opts.disabled(), 'Should be auto option') -assert(feature_opts.auto(), 'Should be auto option') - -assert(required_opt.enabled(), 'Should be enabled option') -assert(not required_opt.disabled(), 'Should be enabled option') -assert(not required_opt.auto(), 'Should be enabled option') - -assert(not optional_opt.enabled(), 'Should be auto option') -assert(not optional_opt.disabled(), 'Should be auto option') -assert(optional_opt.auto(), 'Should be auto option') - -assert(not disabled_opt.enabled(), 'Should be disabled option') -assert(disabled_opt.disabled(), 'Should be disabled option') -assert(not disabled_opt.auto(), 'Should be disabled option') - -dep = dependency('threads', required : required_opt) -assert(dep.found(), 'Should find required "threads" dep') - -dep = dependency('threads', required : optional_opt) -assert(dep.found(), 'Should find optional "threads" dep') - -dep = dependency('threads', required : disabled_opt) -assert(not dep.found(), 'Should not find disabled "threads" dep') - -dep = dependency('notfounddep', required : optional_opt) -assert(not dep.found(), 'Should not find optional "notfounddep" dep') - -dep = dependency('notfounddep', required : disabled_opt) -assert(not dep.found(), 'Should not find disabled "notfounddep" dep') - -cc = meson.get_compiler('c') -lib = cc.find_library('m', required : disabled_opt) -assert(not lib.found(), 'Should not find "m" library') - -cp = find_program('cp', required : disabled_opt) -assert(not cp.found(), 'Should not find "cp" program') - -found = add_languages('cpp', required : disabled_opt) -assert(not found, 'Should not find "cpp" language') diff --git a/test cases/common/198 feature option/meson_options.txt b/test cases/common/198 feature option/meson_options.txt deleted file mode 100644 index 063a35f..0000000 --- a/test cases/common/198 feature option/meson_options.txt +++ /dev/null @@ -1,3 +0,0 @@ -option('required', type : 'feature', value : 'enabled', description : 'An required feature') -option('optional', type : 'feature', value : 'auto', description : 'An optional feature') -option('disabled', type : 'feature', value : 'disabled', description : 'A disabled feature') diff --git a/test cases/common/199 feature option disabled/meson.build b/test cases/common/199 feature option disabled/meson.build deleted file mode 100644 index 1a83187..0000000 --- a/test cases/common/199 feature option disabled/meson.build +++ /dev/null @@ -1,23 +0,0 @@ -project('feature user option', 'c', - default_options : ['auto_features=disabled']) - -feature_opts = get_option('auto_features') -required_opt = get_option('required') -optional_opt = get_option('optional') -disabled_opt = get_option('disabled') - -assert(not feature_opts.enabled(), 'Should be disabled option') -assert(feature_opts.disabled(), 'Should be disabled option') -assert(not feature_opts.auto(), 'Should be disabled option') - -assert(required_opt.enabled(), 'Should be enabled option') -assert(not required_opt.disabled(), 'Should be enabled option') -assert(not required_opt.auto(), 'Should be enabled option') - -assert(not optional_opt.enabled(), 'Auto feature should be disabled') -assert(optional_opt.disabled(), 'Auto feature should be disabled') -assert(not optional_opt.auto(), 'Auto feature should be disabled') - -assert(not disabled_opt.enabled(), 'Should be disabled option') -assert(disabled_opt.disabled(), 'Should be disabled option') -assert(not disabled_opt.auto(), 'Should be disabled option') diff --git a/test cases/common/199 feature option disabled/meson_options.txt b/test cases/common/199 feature option disabled/meson_options.txt deleted file mode 100644 index 063a35f..0000000 --- a/test cases/common/199 feature option disabled/meson_options.txt +++ /dev/null @@ -1,3 +0,0 @@ -option('required', type : 'feature', value : 'enabled', description : 'An required feature') -option('optional', type : 'feature', value : 'auto', description : 'An optional feature') -option('disabled', type : 'feature', value : 'disabled', description : 'A disabled feature') diff --git a/test cases/common/199 static threads/lib1.c b/test cases/common/199 static threads/lib1.c new file mode 100644 index 0000000..1aa786c --- /dev/null +++ b/test cases/common/199 static threads/lib1.c @@ -0,0 +1,13 @@ +#if defined _WIN32 +#include +#else +#include +#endif + +void *f(void) { +#if defined _WIN32 + return CreateThread; +#else + return pthread_create; +#endif +} diff --git a/test cases/common/199 static threads/lib2.c b/test cases/common/199 static threads/lib2.c new file mode 100644 index 0000000..e988814 --- /dev/null +++ b/test cases/common/199 static threads/lib2.c @@ -0,0 +1,5 @@ +extern void *f(void); + +void *g(void) { + return f(); +} diff --git a/test cases/common/199 static threads/meson.build b/test cases/common/199 static threads/meson.build new file mode 100644 index 0000000..4279200 --- /dev/null +++ b/test cases/common/199 static threads/meson.build @@ -0,0 +1,13 @@ +project('threads', 'c') + +thread_dep = dependency('threads') + + +lib1 = static_library('lib1', 'lib1.c', + dependencies : thread_dep) + +lib2 = static_library('lib2', 'lib2.c', + link_with : lib1) + +executable('prog', 'prog.c', + link_with : lib2) diff --git a/test cases/common/199 static threads/prog.c b/test cases/common/199 static threads/prog.c new file mode 100644 index 0000000..14a7c76 --- /dev/null +++ b/test cases/common/199 static threads/prog.c @@ -0,0 +1,6 @@ +extern void *g(void); + +int main(void) { + g(); + return 0; +} diff --git a/test cases/common/200 generator in subdir/com/mesonbuild/genprog.py b/test cases/common/200 generator in subdir/com/mesonbuild/genprog.py new file mode 100644 index 0000000..1e10998 --- /dev/null +++ b/test cases/common/200 generator in subdir/com/mesonbuild/genprog.py @@ -0,0 +1,46 @@ +#!/usr/bin/env python3 + +import os, sys, argparse + +h_templ = '''#pragma once + +int %s(); +''' + +c_templ = '''#include"%s.h" + +int %s() { + return 0; +} +''' + +parser = argparse.ArgumentParser() +parser.add_argument('--searchdir', required=True) +parser.add_argument('--outdir', required=True) +parser.add_argument('ifiles', nargs='+') + +options = parser.parse_args() + +searchdir = options.searchdir +outdir = options.outdir +ifiles = options.ifiles + +rel_ofiles = [] + +for ifile in ifiles: + if not ifile.startswith(options.searchdir): + sys.exit('Input file %s does not start with search dir %s.' % (ifile, searchdir)) + rel_ofile = ifile[len(searchdir):] + if rel_ofile[0] == '/' or rel_ofile[0] == '\\': + rel_ofile = rel_ofile[1:] + rel_ofiles.append(os.path.splitext(rel_ofile)[0]) + +ofile_bases = [os.path.join(outdir, i) for i in rel_ofiles] + +for i, ifile_name in enumerate(ifiles): + proto_name = open(ifile_name).readline().strip() + h_out = ofile_bases[i] + '.h' + c_out = ofile_bases[i] + '.c' + os.makedirs(os.path.split(ofile_bases[i])[0], exist_ok=True) + open(h_out, 'w').write(h_templ % (proto_name)) + open(c_out, 'w').write(c_templ % (proto_name, proto_name)) diff --git a/test cases/common/200 generator in subdir/com/mesonbuild/meson.build b/test cases/common/200 generator in subdir/com/mesonbuild/meson.build new file mode 100644 index 0000000..4808743 --- /dev/null +++ b/test cases/common/200 generator in subdir/com/mesonbuild/meson.build @@ -0,0 +1,10 @@ +gprog = find_program('genprog.py') + +gen = generator(gprog, \ + output : ['@BASENAME@.c', '@BASENAME@.h'], + arguments : ['--searchdir=@CURRENT_SOURCE_DIR@', '--outdir=@BUILD_DIR@', '@INPUT@']) + +generated = gen.process('subbie.inp') + +e = executable('testprog', 'testprog.c', generated) +test('testprog', e) diff --git a/test cases/common/200 generator in subdir/com/mesonbuild/subbie.inp b/test cases/common/200 generator in subdir/com/mesonbuild/subbie.inp new file mode 100644 index 0000000..df0f4e9 --- /dev/null +++ b/test cases/common/200 generator in subdir/com/mesonbuild/subbie.inp @@ -0,0 +1 @@ +subbie diff --git a/test cases/common/200 generator in subdir/com/mesonbuild/testprog.c b/test cases/common/200 generator in subdir/com/mesonbuild/testprog.c new file mode 100644 index 0000000..58867ad --- /dev/null +++ b/test cases/common/200 generator in subdir/com/mesonbuild/testprog.c @@ -0,0 +1,5 @@ +#include"subbie.h" + +int main(int argc, char **argv) { + return subbie(); +} diff --git a/test cases/common/200 generator in subdir/meson.build b/test cases/common/200 generator in subdir/meson.build new file mode 100644 index 0000000..9b8eb7c --- /dev/null +++ b/test cases/common/200 generator in subdir/meson.build @@ -0,0 +1,3 @@ +project('generator in subdir', 'c') + +subdir('com/mesonbuild') diff --git a/test cases/common/200 static threads/lib1.c b/test cases/common/200 static threads/lib1.c deleted file mode 100644 index 1aa786c..0000000 --- a/test cases/common/200 static threads/lib1.c +++ /dev/null @@ -1,13 +0,0 @@ -#if defined _WIN32 -#include -#else -#include -#endif - -void *f(void) { -#if defined _WIN32 - return CreateThread; -#else - return pthread_create; -#endif -} diff --git a/test cases/common/200 static threads/lib2.c b/test cases/common/200 static threads/lib2.c deleted file mode 100644 index e988814..0000000 --- a/test cases/common/200 static threads/lib2.c +++ /dev/null @@ -1,5 +0,0 @@ -extern void *f(void); - -void *g(void) { - return f(); -} diff --git a/test cases/common/200 static threads/meson.build b/test cases/common/200 static threads/meson.build deleted file mode 100644 index 4279200..0000000 --- a/test cases/common/200 static threads/meson.build +++ /dev/null @@ -1,13 +0,0 @@ -project('threads', 'c') - -thread_dep = dependency('threads') - - -lib1 = static_library('lib1', 'lib1.c', - dependencies : thread_dep) - -lib2 = static_library('lib2', 'lib2.c', - link_with : lib1) - -executable('prog', 'prog.c', - link_with : lib2) diff --git a/test cases/common/200 static threads/prog.c b/test cases/common/200 static threads/prog.c deleted file mode 100644 index 14a7c76..0000000 --- a/test cases/common/200 static threads/prog.c +++ /dev/null @@ -1,6 +0,0 @@ -extern void *g(void); - -int main(void) { - g(); - return 0; -} diff --git a/test cases/common/201 generator in subdir/com/mesonbuild/genprog.py b/test cases/common/201 generator in subdir/com/mesonbuild/genprog.py deleted file mode 100644 index 1e10998..0000000 --- a/test cases/common/201 generator in subdir/com/mesonbuild/genprog.py +++ /dev/null @@ -1,46 +0,0 @@ -#!/usr/bin/env python3 - -import os, sys, argparse - -h_templ = '''#pragma once - -int %s(); -''' - -c_templ = '''#include"%s.h" - -int %s() { - return 0; -} -''' - -parser = argparse.ArgumentParser() -parser.add_argument('--searchdir', required=True) -parser.add_argument('--outdir', required=True) -parser.add_argument('ifiles', nargs='+') - -options = parser.parse_args() - -searchdir = options.searchdir -outdir = options.outdir -ifiles = options.ifiles - -rel_ofiles = [] - -for ifile in ifiles: - if not ifile.startswith(options.searchdir): - sys.exit('Input file %s does not start with search dir %s.' % (ifile, searchdir)) - rel_ofile = ifile[len(searchdir):] - if rel_ofile[0] == '/' or rel_ofile[0] == '\\': - rel_ofile = rel_ofile[1:] - rel_ofiles.append(os.path.splitext(rel_ofile)[0]) - -ofile_bases = [os.path.join(outdir, i) for i in rel_ofiles] - -for i, ifile_name in enumerate(ifiles): - proto_name = open(ifile_name).readline().strip() - h_out = ofile_bases[i] + '.h' - c_out = ofile_bases[i] + '.c' - os.makedirs(os.path.split(ofile_bases[i])[0], exist_ok=True) - open(h_out, 'w').write(h_templ % (proto_name)) - open(c_out, 'w').write(c_templ % (proto_name, proto_name)) diff --git a/test cases/common/201 generator in subdir/com/mesonbuild/meson.build b/test cases/common/201 generator in subdir/com/mesonbuild/meson.build deleted file mode 100644 index 4808743..0000000 --- a/test cases/common/201 generator in subdir/com/mesonbuild/meson.build +++ /dev/null @@ -1,10 +0,0 @@ -gprog = find_program('genprog.py') - -gen = generator(gprog, \ - output : ['@BASENAME@.c', '@BASENAME@.h'], - arguments : ['--searchdir=@CURRENT_SOURCE_DIR@', '--outdir=@BUILD_DIR@', '@INPUT@']) - -generated = gen.process('subbie.inp') - -e = executable('testprog', 'testprog.c', generated) -test('testprog', e) diff --git a/test cases/common/201 generator in subdir/com/mesonbuild/subbie.inp b/test cases/common/201 generator in subdir/com/mesonbuild/subbie.inp deleted file mode 100644 index df0f4e9..0000000 --- a/test cases/common/201 generator in subdir/com/mesonbuild/subbie.inp +++ /dev/null @@ -1 +0,0 @@ -subbie diff --git a/test cases/common/201 generator in subdir/com/mesonbuild/testprog.c b/test cases/common/201 generator in subdir/com/mesonbuild/testprog.c deleted file mode 100644 index 58867ad..0000000 --- a/test cases/common/201 generator in subdir/com/mesonbuild/testprog.c +++ /dev/null @@ -1,5 +0,0 @@ -#include"subbie.h" - -int main(int argc, char **argv) { - return subbie(); -} diff --git a/test cases/common/201 generator in subdir/meson.build b/test cases/common/201 generator in subdir/meson.build deleted file mode 100644 index 9b8eb7c..0000000 --- a/test cases/common/201 generator in subdir/meson.build +++ /dev/null @@ -1,3 +0,0 @@ -project('generator in subdir', 'c') - -subdir('com/mesonbuild') diff --git a/test cases/common/201 override with exe/main2.input b/test cases/common/201 override with exe/main2.input new file mode 100644 index 0000000..e69de29 diff --git a/test cases/common/201 override with exe/meson.build b/test cases/common/201 override with exe/meson.build new file mode 100644 index 0000000..81f6c02 --- /dev/null +++ b/test cases/common/201 override with exe/meson.build @@ -0,0 +1,15 @@ +project('myexe', 'c') +sub = subproject('sub') +prog = find_program('foobar') +custom1 = custom_target('custom1', + build_by_default : true, + input : [], + output : 'main1.c', + command : [prog, '@OUTPUT@']) +gen = generator(prog, + output : '@BASENAME@.c', + arguments : ['@OUTPUT@']) +custom2 = gen.process('main2.input') + +executable('e1', custom1) +executable('e2', custom2) diff --git a/test cases/common/201 override with exe/subprojects/sub/foobar.c b/test cases/common/201 override with exe/subprojects/sub/foobar.c new file mode 100644 index 0000000..030ac49 --- /dev/null +++ b/test cases/common/201 override with exe/subprojects/sub/foobar.c @@ -0,0 +1,12 @@ +#include +#include + +int main(int argc, char* argv[]) { + FILE *f = fopen(argv[1], "w"); + const char msg[] = "int main(void) {return 0;}\n"; + size_t w = fwrite(msg, 1, sizeof(msg) - 1, f); + assert(w == sizeof(msg) - 1); + int r = fclose(f); + assert(r == 0); + return 0; +} diff --git a/test cases/common/201 override with exe/subprojects/sub/meson.build b/test cases/common/201 override with exe/subprojects/sub/meson.build new file mode 100644 index 0000000..1f186da --- /dev/null +++ b/test cases/common/201 override with exe/subprojects/sub/meson.build @@ -0,0 +1,3 @@ +project('sub', 'c') +foobar = executable('foobar', 'foobar.c', native : true) +meson.override_find_program('foobar', foobar) diff --git a/test cases/common/202 override with exe/main2.input b/test cases/common/202 override with exe/main2.input deleted file mode 100644 index e69de29..0000000 diff --git a/test cases/common/202 override with exe/meson.build b/test cases/common/202 override with exe/meson.build deleted file mode 100644 index 81f6c02..0000000 --- a/test cases/common/202 override with exe/meson.build +++ /dev/null @@ -1,15 +0,0 @@ -project('myexe', 'c') -sub = subproject('sub') -prog = find_program('foobar') -custom1 = custom_target('custom1', - build_by_default : true, - input : [], - output : 'main1.c', - command : [prog, '@OUTPUT@']) -gen = generator(prog, - output : '@BASENAME@.c', - arguments : ['@OUTPUT@']) -custom2 = gen.process('main2.input') - -executable('e1', custom1) -executable('e2', custom2) diff --git a/test cases/common/202 override with exe/subprojects/sub/foobar.c b/test cases/common/202 override with exe/subprojects/sub/foobar.c deleted file mode 100644 index 030ac49..0000000 --- a/test cases/common/202 override with exe/subprojects/sub/foobar.c +++ /dev/null @@ -1,12 +0,0 @@ -#include -#include - -int main(int argc, char* argv[]) { - FILE *f = fopen(argv[1], "w"); - const char msg[] = "int main(void) {return 0;}\n"; - size_t w = fwrite(msg, 1, sizeof(msg) - 1, f); - assert(w == sizeof(msg) - 1); - int r = fclose(f); - assert(r == 0); - return 0; -} diff --git a/test cases/common/202 override with exe/subprojects/sub/meson.build b/test cases/common/202 override with exe/subprojects/sub/meson.build deleted file mode 100644 index 1f186da..0000000 --- a/test cases/common/202 override with exe/subprojects/sub/meson.build +++ /dev/null @@ -1,3 +0,0 @@ -project('sub', 'c') -foobar = executable('foobar', 'foobar.c', native : true) -meson.override_find_program('foobar', foobar) diff --git a/test cases/common/202 subproject with features/meson.build b/test cases/common/202 subproject with features/meson.build new file mode 100644 index 0000000..5bdfefb --- /dev/null +++ b/test cases/common/202 subproject with features/meson.build @@ -0,0 +1,17 @@ +project('proj', 'c') + +auto_subproj = subproject('sub', required: get_option('use-subproject')) +assert(auto_subproj.found(), 'Subproject should always be buildable and thus found') + +auto_dep = dependency('', fallback: ['sub', 'libSub'], required: true) +assert(auto_dep.found() == true, 'Subproject is required and foundable, dependency should be found.') + +disabled_subproj = subproject('disabled_sub', required: get_option('disabled-subproject')) +assert(disabled_subproj.found() == false, 'Disabled subproject should be NOT found') + +disabled_dep = dependency('', fallback: ['disabled_sub', 'libSub'], required: false) +assert(disabled_dep.found() == false, 'Subprojetc was disabled, it should never be built.') +nothing = executable('nothing', 'nothing.c', dependencies: [disabled_dep]) + +subproj_with_missing_dep = subproject('auto_sub_with_missing_dep', required: get_option('auto-sub-with-missing-dep')) +assert(subproj_with_missing_dep.found() == false, 'Subproject with required=auto and missing dependency should be NOT found') diff --git a/test cases/common/202 subproject with features/meson_options.txt b/test cases/common/202 subproject with features/meson_options.txt new file mode 100644 index 0000000..a46e5fb --- /dev/null +++ b/test cases/common/202 subproject with features/meson_options.txt @@ -0,0 +1,3 @@ +option('use-subproject', type : 'feature', value : 'auto') +option('disabled-subproject', type : 'feature', value : 'disabled') +option('auto-sub-with-missing-dep', type : 'feature', value : 'auto') diff --git a/test cases/common/202 subproject with features/nothing.c b/test cases/common/202 subproject with features/nothing.c new file mode 100644 index 0000000..77750c2 --- /dev/null +++ b/test cases/common/202 subproject with features/nothing.c @@ -0,0 +1,4 @@ +int main(int argc, char const *argv[]) +{ + return 0; +} \ No newline at end of file diff --git a/test cases/common/202 subproject with features/subprojects/auto_sub_with_missing_dep/meson.build b/test cases/common/202 subproject with features/subprojects/auto_sub_with_missing_dep/meson.build new file mode 100644 index 0000000..fa6b011 --- /dev/null +++ b/test cases/common/202 subproject with features/subprojects/auto_sub_with_missing_dep/meson.build @@ -0,0 +1,3 @@ +project('sub', 'c') + +dependency('no_way_this_exists', required: true) \ No newline at end of file diff --git a/test cases/common/202 subproject with features/subprojects/disabled_sub/lib/meson.build b/test cases/common/202 subproject with features/subprojects/disabled_sub/lib/meson.build new file mode 100644 index 0000000..933001a --- /dev/null +++ b/test cases/common/202 subproject with features/subprojects/disabled_sub/lib/meson.build @@ -0,0 +1,3 @@ +lib = static_library('sub', 'sub.c') + +libSub = declare_dependency(include_directories: include_directories('.'), link_with: lib) \ No newline at end of file diff --git a/test cases/common/202 subproject with features/subprojects/disabled_sub/lib/sub.c b/test cases/common/202 subproject with features/subprojects/disabled_sub/lib/sub.c new file mode 100644 index 0000000..068a5b8 --- /dev/null +++ b/test cases/common/202 subproject with features/subprojects/disabled_sub/lib/sub.c @@ -0,0 +1,5 @@ +#include "sub.h" + +int sub() { + return 0; +} diff --git a/test cases/common/202 subproject with features/subprojects/disabled_sub/lib/sub.h b/test cases/common/202 subproject with features/subprojects/disabled_sub/lib/sub.h new file mode 100644 index 0000000..f1ab0e1 --- /dev/null +++ b/test cases/common/202 subproject with features/subprojects/disabled_sub/lib/sub.h @@ -0,0 +1,6 @@ +#ifndef SUB_H +#define SUB_H + +int sub(); + +#endif diff --git a/test cases/common/202 subproject with features/subprojects/disabled_sub/meson.build b/test cases/common/202 subproject with features/subprojects/disabled_sub/meson.build new file mode 100644 index 0000000..65fef03 --- /dev/null +++ b/test cases/common/202 subproject with features/subprojects/disabled_sub/meson.build @@ -0,0 +1,3 @@ +project('disabled_sub', 'c') + +subdir('lib') \ No newline at end of file diff --git a/test cases/common/202 subproject with features/subprojects/sub/lib/meson.build b/test cases/common/202 subproject with features/subprojects/sub/lib/meson.build new file mode 100644 index 0000000..731d22b --- /dev/null +++ b/test cases/common/202 subproject with features/subprojects/sub/lib/meson.build @@ -0,0 +1,2 @@ +lib = static_library('sub', 'sub.c') +libSub = declare_dependency(include_directories: include_directories('.'), link_with: lib) diff --git a/test cases/common/202 subproject with features/subprojects/sub/lib/sub.c b/test cases/common/202 subproject with features/subprojects/sub/lib/sub.c new file mode 100644 index 0000000..ed78306 --- /dev/null +++ b/test cases/common/202 subproject with features/subprojects/sub/lib/sub.c @@ -0,0 +1,5 @@ +#include "sub.h" + +int sub() { + return 0; +} diff --git a/test cases/common/202 subproject with features/subprojects/sub/lib/sub.h b/test cases/common/202 subproject with features/subprojects/sub/lib/sub.h new file mode 100644 index 0000000..f1ab0e1 --- /dev/null +++ b/test cases/common/202 subproject with features/subprojects/sub/lib/sub.h @@ -0,0 +1,6 @@ +#ifndef SUB_H +#define SUB_H + +int sub(); + +#endif diff --git a/test cases/common/202 subproject with features/subprojects/sub/meson.build b/test cases/common/202 subproject with features/subprojects/sub/meson.build new file mode 100644 index 0000000..31882ac --- /dev/null +++ b/test cases/common/202 subproject with features/subprojects/sub/meson.build @@ -0,0 +1,3 @@ +project('sub', 'c') + +subdir('lib') \ No newline at end of file diff --git a/test cases/common/203 function attributes/meson.build b/test cases/common/203 function attributes/meson.build new file mode 100644 index 0000000..58ac7c8 --- /dev/null +++ b/test cases/common/203 function attributes/meson.build @@ -0,0 +1,107 @@ +# Copyright © 2017-2018 Intel Corporation +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +project('gcc func attributes', ['c', 'cpp']) + +# For msvc these will fail because msvc doesn't support __attribute__, for +# Clang and GCC, they should pass. +c = meson.get_compiler('c') +cpp = meson.get_compiler('cpp') + +expected_result = not ['msvc', 'clang-cl', 'intel-cl'].contains(c.get_id()) + +# Q: Why is ifunc not in this list or any of the below lists? +# A: It's too damn hard to figure out if you actually support it, since it +# requires both compiler and libc support, and there isn't a good way to +# figure that out except by running the code we're trying to test. +attributes = [ + 'aligned', + 'alloc_size', + 'always_inline', + 'cold', + 'const', + 'constructor', + 'constructor_priority', + 'deprecated', + 'destructor', + 'flatten', + 'format', + 'format_arg', + 'gnu_inline', + 'hot', + 'malloc', + 'noinline', + 'nonnull', + 'noreturn', + 'nothrow', + 'pure', + 'unused', + 'used', + 'warn_unused_result', + 'weak', +] + +if c.get_id() != 'intel' + # not supported by icc as of 19.0.0 + attributes += 'weakref' +endif + +# These are unsupported on darwin with apple clang 9.1.0 +if host_machine.system() != 'darwin' + attributes += 'alias' + attributes += 'visibility' +endif + +if ['gcc', 'intel'].contains(c.get_id()) + # not supported by clang as of 5.0.0 (at least up to 6.0.1) + attributes += 'artificial' + attributes += 'error' + attributes += 'externally_visible' + attributes += 'leaf' + attributes += 'noclone' + attributes += 'optimize' + attributes += 'warning' + + if c.get_id() == 'gcc' and c.version().version_compare('>= 7.0.0') + attributes += 'fallthrough' + endif +endif + + +foreach a : attributes + x = c.has_function_attribute(a) + assert(x == expected_result, '@0@: @1@'.format(c.get_id(), a)) + x = cpp.has_function_attribute(a) + assert(x == expected_result, '@0@: @1@'.format(cpp.get_id(), a)) +endforeach + +win_expect = ['windows', 'cygwin'].contains(host_machine.system()) +foreach a : ['dllexport', 'dllimport'] + assert(c.has_function_attribute(a) == win_expect, + '@0@: @1@'.format(c.get_id(), a)) + assert(cpp.has_function_attribute(a) == win_expect, + '@0@: @1@'.format(cpp.get_id(), a)) +endforeach + +message('checking get_supported_function_attributes') +if not ['msvc', 'clang-cl', 'intel-cl'].contains(c.get_id()) + multi_expected = attributes +else + multi_expected = [] +endif + +multi_check = c.get_supported_function_attributes(attributes) +assert(multi_check == multi_expected, 'get_supported_function_arguments works (C)') +multi_check = cpp.get_supported_function_attributes(attributes) +assert(multi_check == multi_expected, 'get_supported_function_arguments works (C++)') diff --git a/test cases/common/203 subproject with features/meson.build b/test cases/common/203 subproject with features/meson.build deleted file mode 100644 index 5bdfefb..0000000 --- a/test cases/common/203 subproject with features/meson.build +++ /dev/null @@ -1,17 +0,0 @@ -project('proj', 'c') - -auto_subproj = subproject('sub', required: get_option('use-subproject')) -assert(auto_subproj.found(), 'Subproject should always be buildable and thus found') - -auto_dep = dependency('', fallback: ['sub', 'libSub'], required: true) -assert(auto_dep.found() == true, 'Subproject is required and foundable, dependency should be found.') - -disabled_subproj = subproject('disabled_sub', required: get_option('disabled-subproject')) -assert(disabled_subproj.found() == false, 'Disabled subproject should be NOT found') - -disabled_dep = dependency('', fallback: ['disabled_sub', 'libSub'], required: false) -assert(disabled_dep.found() == false, 'Subprojetc was disabled, it should never be built.') -nothing = executable('nothing', 'nothing.c', dependencies: [disabled_dep]) - -subproj_with_missing_dep = subproject('auto_sub_with_missing_dep', required: get_option('auto-sub-with-missing-dep')) -assert(subproj_with_missing_dep.found() == false, 'Subproject with required=auto and missing dependency should be NOT found') diff --git a/test cases/common/203 subproject with features/meson_options.txt b/test cases/common/203 subproject with features/meson_options.txt deleted file mode 100644 index a46e5fb..0000000 --- a/test cases/common/203 subproject with features/meson_options.txt +++ /dev/null @@ -1,3 +0,0 @@ -option('use-subproject', type : 'feature', value : 'auto') -option('disabled-subproject', type : 'feature', value : 'disabled') -option('auto-sub-with-missing-dep', type : 'feature', value : 'auto') diff --git a/test cases/common/203 subproject with features/nothing.c b/test cases/common/203 subproject with features/nothing.c deleted file mode 100644 index 77750c2..0000000 --- a/test cases/common/203 subproject with features/nothing.c +++ /dev/null @@ -1,4 +0,0 @@ -int main(int argc, char const *argv[]) -{ - return 0; -} \ No newline at end of file diff --git a/test cases/common/203 subproject with features/subprojects/auto_sub_with_missing_dep/meson.build b/test cases/common/203 subproject with features/subprojects/auto_sub_with_missing_dep/meson.build deleted file mode 100644 index fa6b011..0000000 --- a/test cases/common/203 subproject with features/subprojects/auto_sub_with_missing_dep/meson.build +++ /dev/null @@ -1,3 +0,0 @@ -project('sub', 'c') - -dependency('no_way_this_exists', required: true) \ No newline at end of file diff --git a/test cases/common/203 subproject with features/subprojects/disabled_sub/lib/meson.build b/test cases/common/203 subproject with features/subprojects/disabled_sub/lib/meson.build deleted file mode 100644 index 933001a..0000000 --- a/test cases/common/203 subproject with features/subprojects/disabled_sub/lib/meson.build +++ /dev/null @@ -1,3 +0,0 @@ -lib = static_library('sub', 'sub.c') - -libSub = declare_dependency(include_directories: include_directories('.'), link_with: lib) \ No newline at end of file diff --git a/test cases/common/203 subproject with features/subprojects/disabled_sub/lib/sub.c b/test cases/common/203 subproject with features/subprojects/disabled_sub/lib/sub.c deleted file mode 100644 index 068a5b8..0000000 --- a/test cases/common/203 subproject with features/subprojects/disabled_sub/lib/sub.c +++ /dev/null @@ -1,5 +0,0 @@ -#include "sub.h" - -int sub() { - return 0; -} diff --git a/test cases/common/203 subproject with features/subprojects/disabled_sub/lib/sub.h b/test cases/common/203 subproject with features/subprojects/disabled_sub/lib/sub.h deleted file mode 100644 index f1ab0e1..0000000 --- a/test cases/common/203 subproject with features/subprojects/disabled_sub/lib/sub.h +++ /dev/null @@ -1,6 +0,0 @@ -#ifndef SUB_H -#define SUB_H - -int sub(); - -#endif diff --git a/test cases/common/203 subproject with features/subprojects/disabled_sub/meson.build b/test cases/common/203 subproject with features/subprojects/disabled_sub/meson.build deleted file mode 100644 index 65fef03..0000000 --- a/test cases/common/203 subproject with features/subprojects/disabled_sub/meson.build +++ /dev/null @@ -1,3 +0,0 @@ -project('disabled_sub', 'c') - -subdir('lib') \ No newline at end of file diff --git a/test cases/common/203 subproject with features/subprojects/sub/lib/meson.build b/test cases/common/203 subproject with features/subprojects/sub/lib/meson.build deleted file mode 100644 index 731d22b..0000000 --- a/test cases/common/203 subproject with features/subprojects/sub/lib/meson.build +++ /dev/null @@ -1,2 +0,0 @@ -lib = static_library('sub', 'sub.c') -libSub = declare_dependency(include_directories: include_directories('.'), link_with: lib) diff --git a/test cases/common/203 subproject with features/subprojects/sub/lib/sub.c b/test cases/common/203 subproject with features/subprojects/sub/lib/sub.c deleted file mode 100644 index ed78306..0000000 --- a/test cases/common/203 subproject with features/subprojects/sub/lib/sub.c +++ /dev/null @@ -1,5 +0,0 @@ -#include "sub.h" - -int sub() { - return 0; -} diff --git a/test cases/common/203 subproject with features/subprojects/sub/lib/sub.h b/test cases/common/203 subproject with features/subprojects/sub/lib/sub.h deleted file mode 100644 index f1ab0e1..0000000 --- a/test cases/common/203 subproject with features/subprojects/sub/lib/sub.h +++ /dev/null @@ -1,6 +0,0 @@ -#ifndef SUB_H -#define SUB_H - -int sub(); - -#endif diff --git a/test cases/common/203 subproject with features/subprojects/sub/meson.build b/test cases/common/203 subproject with features/subprojects/sub/meson.build deleted file mode 100644 index 31882ac..0000000 --- a/test cases/common/203 subproject with features/subprojects/sub/meson.build +++ /dev/null @@ -1,3 +0,0 @@ -project('sub', 'c') - -subdir('lib') \ No newline at end of file diff --git a/test cases/common/204 broken subproject/meson.build b/test cases/common/204 broken subproject/meson.build new file mode 100644 index 0000000..e3a6cae --- /dev/null +++ b/test cases/common/204 broken subproject/meson.build @@ -0,0 +1,2 @@ +project('test broken subproject') +subproject('broken', required : false) diff --git a/test cases/common/204 broken subproject/subprojects/broken/broken.c b/test cases/common/204 broken subproject/subprojects/broken/broken.c new file mode 100644 index 0000000..a9fc4b1 --- /dev/null +++ b/test cases/common/204 broken subproject/subprojects/broken/broken.c @@ -0,0 +1 @@ +#error This must not compile diff --git a/test cases/common/204 broken subproject/subprojects/broken/meson.build b/test cases/common/204 broken subproject/subprojects/broken/meson.build new file mode 100644 index 0000000..2d64fde --- /dev/null +++ b/test cases/common/204 broken subproject/subprojects/broken/meson.build @@ -0,0 +1,4 @@ +project('broken', 'c') + +executable('app', 'broken.c') +assert(false, 'This subproject must fail') diff --git a/test cases/common/204 function attributes/meson.build b/test cases/common/204 function attributes/meson.build deleted file mode 100644 index 58ac7c8..0000000 --- a/test cases/common/204 function attributes/meson.build +++ /dev/null @@ -1,107 +0,0 @@ -# Copyright © 2017-2018 Intel Corporation -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -project('gcc func attributes', ['c', 'cpp']) - -# For msvc these will fail because msvc doesn't support __attribute__, for -# Clang and GCC, they should pass. -c = meson.get_compiler('c') -cpp = meson.get_compiler('cpp') - -expected_result = not ['msvc', 'clang-cl', 'intel-cl'].contains(c.get_id()) - -# Q: Why is ifunc not in this list or any of the below lists? -# A: It's too damn hard to figure out if you actually support it, since it -# requires both compiler and libc support, and there isn't a good way to -# figure that out except by running the code we're trying to test. -attributes = [ - 'aligned', - 'alloc_size', - 'always_inline', - 'cold', - 'const', - 'constructor', - 'constructor_priority', - 'deprecated', - 'destructor', - 'flatten', - 'format', - 'format_arg', - 'gnu_inline', - 'hot', - 'malloc', - 'noinline', - 'nonnull', - 'noreturn', - 'nothrow', - 'pure', - 'unused', - 'used', - 'warn_unused_result', - 'weak', -] - -if c.get_id() != 'intel' - # not supported by icc as of 19.0.0 - attributes += 'weakref' -endif - -# These are unsupported on darwin with apple clang 9.1.0 -if host_machine.system() != 'darwin' - attributes += 'alias' - attributes += 'visibility' -endif - -if ['gcc', 'intel'].contains(c.get_id()) - # not supported by clang as of 5.0.0 (at least up to 6.0.1) - attributes += 'artificial' - attributes += 'error' - attributes += 'externally_visible' - attributes += 'leaf' - attributes += 'noclone' - attributes += 'optimize' - attributes += 'warning' - - if c.get_id() == 'gcc' and c.version().version_compare('>= 7.0.0') - attributes += 'fallthrough' - endif -endif - - -foreach a : attributes - x = c.has_function_attribute(a) - assert(x == expected_result, '@0@: @1@'.format(c.get_id(), a)) - x = cpp.has_function_attribute(a) - assert(x == expected_result, '@0@: @1@'.format(cpp.get_id(), a)) -endforeach - -win_expect = ['windows', 'cygwin'].contains(host_machine.system()) -foreach a : ['dllexport', 'dllimport'] - assert(c.has_function_attribute(a) == win_expect, - '@0@: @1@'.format(c.get_id(), a)) - assert(cpp.has_function_attribute(a) == win_expect, - '@0@: @1@'.format(cpp.get_id(), a)) -endforeach - -message('checking get_supported_function_attributes') -if not ['msvc', 'clang-cl', 'intel-cl'].contains(c.get_id()) - multi_expected = attributes -else - multi_expected = [] -endif - -multi_check = c.get_supported_function_attributes(attributes) -assert(multi_check == multi_expected, 'get_supported_function_arguments works (C)') -multi_check = cpp.get_supported_function_attributes(attributes) -assert(multi_check == multi_expected, 'get_supported_function_arguments works (C++)') diff --git a/test cases/common/205 argument syntax/meson.build b/test cases/common/205 argument syntax/meson.build new file mode 100644 index 0000000..b97ca74 --- /dev/null +++ b/test cases/common/205 argument syntax/meson.build @@ -0,0 +1,19 @@ +project( + 'argument syntax', + ['c'], +) + +cc = meson.get_compiler('c') + +if ['gcc', 'lcc', 'clang', 'intel'].contains(cc.get_id()) + expected = 'gcc' +elif ['msvc', 'clang-cl', 'intel-cl'].contains(cc.get_id()) + expected = 'msvc' +else + # It's possible that other compilers end up here that shouldn't + expected = 'other' +endif + +assert(cc.get_argument_syntax() == expected, + 'Wrong output for compiler @0@. expected @1@ but got @2@'.format( + cc.get_id(), expected, cc.get_argument_syntax())) diff --git a/test cases/common/205 broken subproject/meson.build b/test cases/common/205 broken subproject/meson.build deleted file mode 100644 index e3a6cae..0000000 --- a/test cases/common/205 broken subproject/meson.build +++ /dev/null @@ -1,2 +0,0 @@ -project('test broken subproject') -subproject('broken', required : false) diff --git a/test cases/common/205 broken subproject/subprojects/broken/broken.c b/test cases/common/205 broken subproject/subprojects/broken/broken.c deleted file mode 100644 index a9fc4b1..0000000 --- a/test cases/common/205 broken subproject/subprojects/broken/broken.c +++ /dev/null @@ -1 +0,0 @@ -#error This must not compile diff --git a/test cases/common/205 broken subproject/subprojects/broken/meson.build b/test cases/common/205 broken subproject/subprojects/broken/meson.build deleted file mode 100644 index 2d64fde..0000000 --- a/test cases/common/205 broken subproject/subprojects/broken/meson.build +++ /dev/null @@ -1,4 +0,0 @@ -project('broken', 'c') - -executable('app', 'broken.c') -assert(false, 'This subproject must fail') diff --git a/test cases/common/206 argument syntax/meson.build b/test cases/common/206 argument syntax/meson.build deleted file mode 100644 index b97ca74..0000000 --- a/test cases/common/206 argument syntax/meson.build +++ /dev/null @@ -1,19 +0,0 @@ -project( - 'argument syntax', - ['c'], -) - -cc = meson.get_compiler('c') - -if ['gcc', 'lcc', 'clang', 'intel'].contains(cc.get_id()) - expected = 'gcc' -elif ['msvc', 'clang-cl', 'intel-cl'].contains(cc.get_id()) - expected = 'msvc' -else - # It's possible that other compilers end up here that shouldn't - expected = 'other' -endif - -assert(cc.get_argument_syntax() == expected, - 'Wrong output for compiler @0@. expected @1@ but got @2@'.format( - cc.get_id(), expected, cc.get_argument_syntax())) diff --git a/test cases/common/206 install name_prefix name_suffix/installed_files.txt b/test cases/common/206 install name_prefix name_suffix/installed_files.txt new file mode 100644 index 0000000..240a8be --- /dev/null +++ b/test cases/common/206 install name_prefix name_suffix/installed_files.txt @@ -0,0 +1,15 @@ +?msvc:usr/bin/baz.pdb +?msvc:usr/bin/bowcorge.pdb +?msvc:usr/bin/foo.pdb +?msvc:usr/lib/baz.pdb +?msvc:usr/lib/bowcorge.pdb +?msvc:usr/lib/foo.pdb +usr/?lib/bowcorge.stern +usr/lib/?libbaz.cheese +usr/lib/bar.a +usr/lib/bowcorge?implib +usr/lib/bowgrault.stern +usr/lib/foo?implib +usr/lib/foo?so +usr/lib/libbaz?implib +usr/lib/libqux.cheese diff --git a/test cases/common/206 install name_prefix name_suffix/libfile.c b/test cases/common/206 install name_prefix name_suffix/libfile.c new file mode 100644 index 0000000..44f7667 --- /dev/null +++ b/test cases/common/206 install name_prefix name_suffix/libfile.c @@ -0,0 +1,14 @@ +#if defined _WIN32 || defined __CYGWIN__ + #define DLL_PUBLIC __declspec(dllexport) +#else + #if defined __GNUC__ + #define DLL_PUBLIC __attribute__ ((visibility("default"))) + #else + #pragma message ("Compiler does not support symbol visibility.") + #define DLL_PUBLIC + #endif +#endif + +int DLL_PUBLIC func() { + return 0; +} diff --git a/test cases/common/206 install name_prefix name_suffix/meson.build b/test cases/common/206 install name_prefix name_suffix/meson.build new file mode 100644 index 0000000..4539999 --- /dev/null +++ b/test cases/common/206 install name_prefix name_suffix/meson.build @@ -0,0 +1,10 @@ +project('library with name_prefix name_suffix test', 'c') + +shared_library('foo', 'libfile.c', name_prefix: '', install : true) +static_library('bar', 'libfile.c', name_prefix: '', install : true) + +shared_library('baz', 'libfile.c', name_suffix: 'cheese', install : true) +static_library('qux', 'libfile.c', name_suffix: 'cheese', install : true) + +shared_library('corge', 'libfile.c', name_prefix: 'bow', name_suffix: 'stern', install : true) +static_library('grault', 'libfile.c', name_prefix: 'bow', name_suffix: 'stern', install : true) diff --git a/test cases/common/207 install name_prefix name_suffix/installed_files.txt b/test cases/common/207 install name_prefix name_suffix/installed_files.txt deleted file mode 100644 index 240a8be..0000000 --- a/test cases/common/207 install name_prefix name_suffix/installed_files.txt +++ /dev/null @@ -1,15 +0,0 @@ -?msvc:usr/bin/baz.pdb -?msvc:usr/bin/bowcorge.pdb -?msvc:usr/bin/foo.pdb -?msvc:usr/lib/baz.pdb -?msvc:usr/lib/bowcorge.pdb -?msvc:usr/lib/foo.pdb -usr/?lib/bowcorge.stern -usr/lib/?libbaz.cheese -usr/lib/bar.a -usr/lib/bowcorge?implib -usr/lib/bowgrault.stern -usr/lib/foo?implib -usr/lib/foo?so -usr/lib/libbaz?implib -usr/lib/libqux.cheese diff --git a/test cases/common/207 install name_prefix name_suffix/libfile.c b/test cases/common/207 install name_prefix name_suffix/libfile.c deleted file mode 100644 index 44f7667..0000000 --- a/test cases/common/207 install name_prefix name_suffix/libfile.c +++ /dev/null @@ -1,14 +0,0 @@ -#if defined _WIN32 || defined __CYGWIN__ - #define DLL_PUBLIC __declspec(dllexport) -#else - #if defined __GNUC__ - #define DLL_PUBLIC __attribute__ ((visibility("default"))) - #else - #pragma message ("Compiler does not support symbol visibility.") - #define DLL_PUBLIC - #endif -#endif - -int DLL_PUBLIC func() { - return 0; -} diff --git a/test cases/common/207 install name_prefix name_suffix/meson.build b/test cases/common/207 install name_prefix name_suffix/meson.build deleted file mode 100644 index 4539999..0000000 --- a/test cases/common/207 install name_prefix name_suffix/meson.build +++ /dev/null @@ -1,10 +0,0 @@ -project('library with name_prefix name_suffix test', 'c') - -shared_library('foo', 'libfile.c', name_prefix: '', install : true) -static_library('bar', 'libfile.c', name_prefix: '', install : true) - -shared_library('baz', 'libfile.c', name_suffix: 'cheese', install : true) -static_library('qux', 'libfile.c', name_suffix: 'cheese', install : true) - -shared_library('corge', 'libfile.c', name_prefix: 'bow', name_suffix: 'stern', install : true) -static_library('grault', 'libfile.c', name_prefix: 'bow', name_suffix: 'stern', install : true) diff --git a/test cases/common/207 kwarg entry/inc/prog.h b/test cases/common/207 kwarg entry/inc/prog.h new file mode 100644 index 0000000..665521d --- /dev/null +++ b/test cases/common/207 kwarg entry/inc/prog.h @@ -0,0 +1,3 @@ +#pragma once + +#define MESSAGE "Hello there.\n" diff --git a/test cases/common/207 kwarg entry/installed_files.txt b/test cases/common/207 kwarg entry/installed_files.txt new file mode 100644 index 0000000..5e796b0 --- /dev/null +++ b/test cases/common/207 kwarg entry/installed_files.txt @@ -0,0 +1,2 @@ +usr/bin/prog?exe +?msvc:usr/bin/prog.pdb diff --git a/test cases/common/207 kwarg entry/meson.build b/test cases/common/207 kwarg entry/meson.build new file mode 100644 index 0000000..564ec37 --- /dev/null +++ b/test cases/common/207 kwarg entry/meson.build @@ -0,0 +1,7 @@ +project('kwarg', 'c') + +default_kwargs = {'install': true, + 'include_directories': include_directories('inc')} + +executable('prog', 'prog.c', + kwargs: default_kwargs) diff --git a/test cases/common/207 kwarg entry/prog.c b/test cases/common/207 kwarg entry/prog.c new file mode 100644 index 0000000..0c57f66 --- /dev/null +++ b/test cases/common/207 kwarg entry/prog.c @@ -0,0 +1,7 @@ +#include +#include + +int main(int argc, char **argv) { + printf(MESSAGE); + return 0; +} diff --git a/test cases/common/208 custom target build by default/docgen.py b/test cases/common/208 custom target build by default/docgen.py new file mode 100644 index 0000000..f343f21 --- /dev/null +++ b/test cases/common/208 custom target build by default/docgen.py @@ -0,0 +1,12 @@ +#!/usr/bin/env python3 + +import os +import sys + +out = sys.argv[1] + +os.mkdir(out) + +for name in ('a', 'b', 'c'): + with open(os.path.join(out, name + '.txt'), 'w') as f: + f.write(name) diff --git a/test cases/common/208 custom target build by default/installed_files.txt b/test cases/common/208 custom target build by default/installed_files.txt new file mode 100644 index 0000000..e69de29 diff --git a/test cases/common/208 custom target build by default/meson.build b/test cases/common/208 custom target build by default/meson.build new file mode 100644 index 0000000..7c81aa2 --- /dev/null +++ b/test cases/common/208 custom target build by default/meson.build @@ -0,0 +1,10 @@ +project('custom-target-dir-install', 'c') + +docgen = find_program('docgen.py') + +custom_target('docgen', + output : 'html', + command : [docgen, '@OUTPUT@'], + install : true, + build_by_default : false, + install_dir : join_paths(get_option('datadir'), 'doc/testpkgname')) diff --git a/test cases/common/208 kwarg entry/inc/prog.h b/test cases/common/208 kwarg entry/inc/prog.h deleted file mode 100644 index 665521d..0000000 --- a/test cases/common/208 kwarg entry/inc/prog.h +++ /dev/null @@ -1,3 +0,0 @@ -#pragma once - -#define MESSAGE "Hello there.\n" diff --git a/test cases/common/208 kwarg entry/installed_files.txt b/test cases/common/208 kwarg entry/installed_files.txt deleted file mode 100644 index 5e796b0..0000000 --- a/test cases/common/208 kwarg entry/installed_files.txt +++ /dev/null @@ -1,2 +0,0 @@ -usr/bin/prog?exe -?msvc:usr/bin/prog.pdb diff --git a/test cases/common/208 kwarg entry/meson.build b/test cases/common/208 kwarg entry/meson.build deleted file mode 100644 index 564ec37..0000000 --- a/test cases/common/208 kwarg entry/meson.build +++ /dev/null @@ -1,7 +0,0 @@ -project('kwarg', 'c') - -default_kwargs = {'install': true, - 'include_directories': include_directories('inc')} - -executable('prog', 'prog.c', - kwargs: default_kwargs) diff --git a/test cases/common/208 kwarg entry/prog.c b/test cases/common/208 kwarg entry/prog.c deleted file mode 100644 index 0c57f66..0000000 --- a/test cases/common/208 kwarg entry/prog.c +++ /dev/null @@ -1,7 +0,0 @@ -#include -#include - -int main(int argc, char **argv) { - printf(MESSAGE); - return 0; -} diff --git a/test cases/common/209 custom target build by default/docgen.py b/test cases/common/209 custom target build by default/docgen.py deleted file mode 100644 index f343f21..0000000 --- a/test cases/common/209 custom target build by default/docgen.py +++ /dev/null @@ -1,12 +0,0 @@ -#!/usr/bin/env python3 - -import os -import sys - -out = sys.argv[1] - -os.mkdir(out) - -for name in ('a', 'b', 'c'): - with open(os.path.join(out, name + '.txt'), 'w') as f: - f.write(name) diff --git a/test cases/common/209 custom target build by default/installed_files.txt b/test cases/common/209 custom target build by default/installed_files.txt deleted file mode 100644 index e69de29..0000000 diff --git a/test cases/common/209 custom target build by default/meson.build b/test cases/common/209 custom target build by default/meson.build deleted file mode 100644 index 7c81aa2..0000000 --- a/test cases/common/209 custom target build by default/meson.build +++ /dev/null @@ -1,10 +0,0 @@ -project('custom-target-dir-install', 'c') - -docgen = find_program('docgen.py') - -custom_target('docgen', - output : 'html', - command : [docgen, '@OUTPUT@'], - install : true, - build_by_default : false, - install_dir : join_paths(get_option('datadir'), 'doc/testpkgname')) diff --git a/test cases/common/209 find_library and headers/foo.h b/test cases/common/209 find_library and headers/foo.h new file mode 100644 index 0000000..014e06e --- /dev/null +++ b/test cases/common/209 find_library and headers/foo.h @@ -0,0 +1 @@ +#define VAL 42 diff --git a/test cases/common/209 find_library and headers/meson.build b/test cases/common/209 find_library and headers/meson.build new file mode 100644 index 0000000..bcd71f1 --- /dev/null +++ b/test cases/common/209 find_library and headers/meson.build @@ -0,0 +1,23 @@ +project('find library and headers', 'c') + +cc = meson.get_compiler('c') + +if not cc.find_library('z', required : false).found() + error('MESON_SKIP_TEST: zlib not found.') +endif + +lib = cc.find_library('z', + has_headers : 'foo.h', + required : false) +assert(not lib.found(), 'Header should be missing') + +lib = cc.find_library('z', + has_headers : 'foo.h', + header_include_directories : include_directories('.')) +assert(lib.found(), 'Header should be found') + +lib = cc.find_library('z', + has_headers : ['foo.h', 'bar.h'], + header_include_directories : include_directories('.'), + required : false) +assert(not lib.found(), 'One header should be missing') diff --git a/test cases/common/210 find_library and headers/foo.h b/test cases/common/210 find_library and headers/foo.h deleted file mode 100644 index 014e06e..0000000 --- a/test cases/common/210 find_library and headers/foo.h +++ /dev/null @@ -1 +0,0 @@ -#define VAL 42 diff --git a/test cases/common/210 find_library and headers/meson.build b/test cases/common/210 find_library and headers/meson.build deleted file mode 100644 index bcd71f1..0000000 --- a/test cases/common/210 find_library and headers/meson.build +++ /dev/null @@ -1,23 +0,0 @@ -project('find library and headers', 'c') - -cc = meson.get_compiler('c') - -if not cc.find_library('z', required : false).found() - error('MESON_SKIP_TEST: zlib not found.') -endif - -lib = cc.find_library('z', - has_headers : 'foo.h', - required : false) -assert(not lib.found(), 'Header should be missing') - -lib = cc.find_library('z', - has_headers : 'foo.h', - header_include_directories : include_directories('.')) -assert(lib.found(), 'Header should be found') - -lib = cc.find_library('z', - has_headers : ['foo.h', 'bar.h'], - header_include_directories : include_directories('.'), - required : false) -assert(not lib.found(), 'One header should be missing') diff --git a/test cases/common/210 line continuation/meson.build b/test cases/common/210 line continuation/meson.build new file mode 100644 index 0000000..16c72f9 --- /dev/null +++ b/test cases/common/210 line continuation/meson.build @@ -0,0 +1,17 @@ +project('line continuation') + +a = 1 +b = 2 + +c = a \ ++b +assert(c == 3, 'Line continuation is not working') + +d = a + \ + b +assert(d == 3, 'Line continuation is not working') + +if a == 1 and \ + b == 3 + error('Line continuation in "if" condition is not working') +endif diff --git a/test cases/common/211 cmake module/cmake_project/CMakeLists.txt b/test cases/common/211 cmake module/cmake_project/CMakeLists.txt new file mode 100644 index 0000000..cd91584 --- /dev/null +++ b/test cases/common/211 cmake module/cmake_project/CMakeLists.txt @@ -0,0 +1,4 @@ +cmake_minimum_required(VERSION 2.8) +project(cmakeMeson C) + +find_package(cmakeModule REQUIRED) \ No newline at end of file diff --git a/test cases/common/211 cmake module/installed_files.txt b/test cases/common/211 cmake module/installed_files.txt new file mode 100644 index 0000000..f8b11f0 --- /dev/null +++ b/test cases/common/211 cmake module/installed_files.txt @@ -0,0 +1,2 @@ +usr/lib/cmake/cmakeModule/cmakeModuleConfig.cmake +usr/lib/cmake/cmakeModule/cmakeModuleConfigVersion.cmake \ No newline at end of file diff --git a/test cases/common/211 cmake module/meson.build b/test cases/common/211 cmake module/meson.build new file mode 100644 index 0000000..68f9993 --- /dev/null +++ b/test cases/common/211 cmake module/meson.build @@ -0,0 +1,31 @@ +project('cmakeModule', 'c', version: '1.0.0') + +if build_machine.system() == 'cygwin' + error('MESON_SKIP_TEST CMake is broken on Cygwin.') +endif + +cmake_bin = find_program('cmake', required: false) +if not cmake_bin.found() + error('MESON_SKIP_TEST CMake not installed.') +endif + +cc = meson.get_compiler('c') +if cc.get_id() == 'clang-cl' and meson.backend() == 'ninja' and build_machine.system() == 'windows' + error('MESON_SKIP_TEST CMake installation nor operational for vs2017 clangclx64ninja') +endif + +cmake = import('cmake') + +cmake.write_basic_package_version_file(version: '0.0.1', + name: 'cmakeModule', +) + +conf = configuration_data() +conf.set('MYVAR', 'my variable value') +conf.set_quoted('MYQUOTEDVAR', 'my quoted variable value') + +cmake.configure_package_config_file( + input: 'projectConfig.cmake.in', + name: 'cmakeModule', + configuration: conf, +) diff --git a/test cases/common/211 cmake module/projectConfig.cmake.in b/test cases/common/211 cmake module/projectConfig.cmake.in new file mode 100644 index 0000000..fa3dfca --- /dev/null +++ b/test cases/common/211 cmake module/projectConfig.cmake.in @@ -0,0 +1,4 @@ +@PACKAGE_INIT@ + +set(MYVAR "@MYVAR@") +set(MYQUOTEDVAR @MYQUOTEDVAR@) diff --git a/test cases/common/211 line continuation/meson.build b/test cases/common/211 line continuation/meson.build deleted file mode 100644 index 16c72f9..0000000 --- a/test cases/common/211 line continuation/meson.build +++ /dev/null @@ -1,17 +0,0 @@ -project('line continuation') - -a = 1 -b = 2 - -c = a \ -+b -assert(c == 3, 'Line continuation is not working') - -d = a + \ - b -assert(d == 3, 'Line continuation is not working') - -if a == 1 and \ - b == 3 - error('Line continuation in "if" condition is not working') -endif diff --git a/test cases/common/212 cmake module/cmake_project/CMakeLists.txt b/test cases/common/212 cmake module/cmake_project/CMakeLists.txt deleted file mode 100644 index cd91584..0000000 --- a/test cases/common/212 cmake module/cmake_project/CMakeLists.txt +++ /dev/null @@ -1,4 +0,0 @@ -cmake_minimum_required(VERSION 2.8) -project(cmakeMeson C) - -find_package(cmakeModule REQUIRED) \ No newline at end of file diff --git a/test cases/common/212 cmake module/installed_files.txt b/test cases/common/212 cmake module/installed_files.txt deleted file mode 100644 index f8b11f0..0000000 --- a/test cases/common/212 cmake module/installed_files.txt +++ /dev/null @@ -1,2 +0,0 @@ -usr/lib/cmake/cmakeModule/cmakeModuleConfig.cmake -usr/lib/cmake/cmakeModule/cmakeModuleConfigVersion.cmake \ No newline at end of file diff --git a/test cases/common/212 cmake module/meson.build b/test cases/common/212 cmake module/meson.build deleted file mode 100644 index 68f9993..0000000 --- a/test cases/common/212 cmake module/meson.build +++ /dev/null @@ -1,31 +0,0 @@ -project('cmakeModule', 'c', version: '1.0.0') - -if build_machine.system() == 'cygwin' - error('MESON_SKIP_TEST CMake is broken on Cygwin.') -endif - -cmake_bin = find_program('cmake', required: false) -if not cmake_bin.found() - error('MESON_SKIP_TEST CMake not installed.') -endif - -cc = meson.get_compiler('c') -if cc.get_id() == 'clang-cl' and meson.backend() == 'ninja' and build_machine.system() == 'windows' - error('MESON_SKIP_TEST CMake installation nor operational for vs2017 clangclx64ninja') -endif - -cmake = import('cmake') - -cmake.write_basic_package_version_file(version: '0.0.1', - name: 'cmakeModule', -) - -conf = configuration_data() -conf.set('MYVAR', 'my variable value') -conf.set_quoted('MYQUOTEDVAR', 'my quoted variable value') - -cmake.configure_package_config_file( - input: 'projectConfig.cmake.in', - name: 'cmakeModule', - configuration: conf, -) diff --git a/test cases/common/212 cmake module/projectConfig.cmake.in b/test cases/common/212 cmake module/projectConfig.cmake.in deleted file mode 100644 index fa3dfca..0000000 --- a/test cases/common/212 cmake module/projectConfig.cmake.in +++ /dev/null @@ -1,4 +0,0 @@ -@PACKAGE_INIT@ - -set(MYVAR "@MYVAR@") -set(MYQUOTEDVAR @MYQUOTEDVAR@) diff --git a/test cases/common/212 native file path override/installed_files.txt b/test cases/common/212 native file path override/installed_files.txt new file mode 100644 index 0000000..0044d40 --- /dev/null +++ b/test cases/common/212 native file path override/installed_files.txt @@ -0,0 +1,2 @@ +usr/custom_bindir/main?exe +?msvc:usr/custom_bindir/main.pdb diff --git a/test cases/common/212 native file path override/main.cpp b/test cases/common/212 native file path override/main.cpp new file mode 100644 index 0000000..d65cab2 --- /dev/null +++ b/test cases/common/212 native file path override/main.cpp @@ -0,0 +1,5 @@ +#include + +int main() { + std::cout << "Hello world!" << std::endl; +} diff --git a/test cases/common/212 native file path override/meson.build b/test cases/common/212 native file path override/meson.build new file mode 100644 index 0000000..142ca1c --- /dev/null +++ b/test cases/common/212 native file path override/meson.build @@ -0,0 +1,7 @@ +project('native file install dir override', 'cpp') + +if meson.is_cross_build() + error('MESON_SKIP_TEST cannot test native build rules in cross build') +endif + +executable('main', 'main.cpp', install : true) diff --git a/test cases/common/212 native file path override/nativefile.ini b/test cases/common/212 native file path override/nativefile.ini new file mode 100644 index 0000000..1c295c7 --- /dev/null +++ b/test cases/common/212 native file path override/nativefile.ini @@ -0,0 +1,2 @@ +[paths] +bindir = 'custom_bindir' diff --git a/test cases/common/213 native file path override/installed_files.txt b/test cases/common/213 native file path override/installed_files.txt deleted file mode 100644 index 0044d40..0000000 --- a/test cases/common/213 native file path override/installed_files.txt +++ /dev/null @@ -1,2 +0,0 @@ -usr/custom_bindir/main?exe -?msvc:usr/custom_bindir/main.pdb diff --git a/test cases/common/213 native file path override/main.cpp b/test cases/common/213 native file path override/main.cpp deleted file mode 100644 index d65cab2..0000000 --- a/test cases/common/213 native file path override/main.cpp +++ /dev/null @@ -1,5 +0,0 @@ -#include - -int main() { - std::cout << "Hello world!" << std::endl; -} diff --git a/test cases/common/213 native file path override/meson.build b/test cases/common/213 native file path override/meson.build deleted file mode 100644 index 142ca1c..0000000 --- a/test cases/common/213 native file path override/meson.build +++ /dev/null @@ -1,7 +0,0 @@ -project('native file install dir override', 'cpp') - -if meson.is_cross_build() - error('MESON_SKIP_TEST cannot test native build rules in cross build') -endif - -executable('main', 'main.cpp', install : true) diff --git a/test cases/common/213 native file path override/nativefile.ini b/test cases/common/213 native file path override/nativefile.ini deleted file mode 100644 index 1c295c7..0000000 --- a/test cases/common/213 native file path override/nativefile.ini +++ /dev/null @@ -1,2 +0,0 @@ -[paths] -bindir = 'custom_bindir' diff --git a/test cases/common/213 tap tests/meson.build b/test cases/common/213 tap tests/meson.build new file mode 100644 index 0000000..58529a7 --- /dev/null +++ b/test cases/common/213 tap tests/meson.build @@ -0,0 +1,10 @@ +project('test features', 'c') + +tester = executable('tester', 'tester.c') +test('pass', tester, args : ['ok'], protocol: 'tap') +test('fail', tester, args : ['not ok'], should_fail: true, protocol: 'tap') +test('xfail', tester, args : ['not ok # todo'], protocol: 'tap') +test('xpass', tester, args : ['ok # todo'], should_fail: true, protocol: 'tap') +test('skip', tester, args : ['ok # skip'], protocol: 'tap') +test('skip failure', tester, args : ['not ok # skip'], should_fail: true, protocol: 'tap') +test('no tests', tester, args : ['1..0 # skip'], protocol: 'tap') diff --git a/test cases/common/213 tap tests/tester.c b/test cases/common/213 tap tests/tester.c new file mode 100644 index 0000000..ac582e7 --- /dev/null +++ b/test cases/common/213 tap tests/tester.c @@ -0,0 +1,10 @@ +#include + +int main(int argc, char **argv) { + if (argc != 2) { + fprintf(stderr, "Incorrect number of arguments, got %i\n", argc); + return 1; + } + puts(argv[1]); + return 0; +} diff --git a/test cases/common/214 tap tests/meson.build b/test cases/common/214 tap tests/meson.build deleted file mode 100644 index 58529a7..0000000 --- a/test cases/common/214 tap tests/meson.build +++ /dev/null @@ -1,10 +0,0 @@ -project('test features', 'c') - -tester = executable('tester', 'tester.c') -test('pass', tester, args : ['ok'], protocol: 'tap') -test('fail', tester, args : ['not ok'], should_fail: true, protocol: 'tap') -test('xfail', tester, args : ['not ok # todo'], protocol: 'tap') -test('xpass', tester, args : ['ok # todo'], should_fail: true, protocol: 'tap') -test('skip', tester, args : ['ok # skip'], protocol: 'tap') -test('skip failure', tester, args : ['not ok # skip'], should_fail: true, protocol: 'tap') -test('no tests', tester, args : ['1..0 # skip'], protocol: 'tap') diff --git a/test cases/common/214 tap tests/tester.c b/test cases/common/214 tap tests/tester.c deleted file mode 100644 index ac582e7..0000000 --- a/test cases/common/214 tap tests/tester.c +++ /dev/null @@ -1,10 +0,0 @@ -#include - -int main(int argc, char **argv) { - if (argc != 2) { - fprintf(stderr, "Incorrect number of arguments, got %i\n", argc); - return 1; - } - puts(argv[1]); - return 0; -} diff --git a/test cases/common/214 warning level 0/main.cpp b/test cases/common/214 warning level 0/main.cpp new file mode 100644 index 0000000..954d9ce --- /dev/null +++ b/test cases/common/214 warning level 0/main.cpp @@ -0,0 +1,12 @@ +#include + +#define PROJECT_NAME "demo" + +int main(int argc, char **argv) { + if(argc != 1) { + std::cout << argv[0] << "takes no arguments.\n"; + return 1; + } + std::cout << "This is project " << PROJECT_NAME << ".\n"; + return 0; +} diff --git a/test cases/common/214 warning level 0/meson.build b/test cases/common/214 warning level 0/meson.build new file mode 100644 index 0000000..f2bd339 --- /dev/null +++ b/test cases/common/214 warning level 0/meson.build @@ -0,0 +1,3 @@ +project('warning_level', 'cpp', default_options : ['warning_level=0']) + +exe = executable('main', 'main.cpp', install : false) diff --git a/test cases/common/215 link custom/custom_stlib.py b/test cases/common/215 link custom/custom_stlib.py new file mode 100755 index 0000000..80334ed --- /dev/null +++ b/test cases/common/215 link custom/custom_stlib.py @@ -0,0 +1,73 @@ +#!/usr/bin/env python3 + +import shutil, sys, subprocess, argparse, pathlib + +parser = argparse.ArgumentParser() + +parser.add_argument('--private-dir', required=True) +parser.add_argument('-o', required=True) +parser.add_argument('cmparr', nargs='+') + +contents = '''#include + +void flob() { + printf("Now flobbing.\\n"); +} +''' + +def generate_lib_gnulike(outfile, c_file, private_dir, compiler_array): + if shutil.which('ar'): + static_linker = 'ar' + elif shutil.which('llvm-ar'): + static_linker = 'llvm-ar' + elif shutil.which('gcc-ar'): + static_linker = 'gcc-ar' + else: + sys.exit('Could not detect a static linker.') + o_file = c_file.with_suffix('.o') + compile_cmd = compiler_array + ['-c', '-g', '-O2', '-o', str(o_file), str(c_file)] + subprocess.check_call(compile_cmd) + out_file = pathlib.Path(outfile) + if out_file.exists(): + out_file.unlink() + link_cmd = [static_linker, 'csr', outfile, str(o_file)] + subprocess.check_call(link_cmd) + return 0 + + +def generate_lib_msvc(outfile, c_file, private_dir, compiler_array): + static_linker = 'lib' + o_file = c_file.with_suffix('.obj') + compile_cmd = compiler_array + ['/MDd', + '/nologo', + '/ZI', + '/Ob0', + '/Od', + '/c', + '/Fo' + str(o_file), + str(c_file)] + subprocess.check_call(compile_cmd) + out_file = pathlib.Path(outfile) + if out_file.exists(): + out_file.unlink() + link_cmd = [static_linker, + '/nologo', + '/OUT:' + str(outfile), + str(o_file)] + subprocess.check_call(link_cmd) + return 0 + +def generate_lib(outfile, private_dir, compiler_array): + private_dir = pathlib.Path(private_dir) + if not private_dir.exists(): + private_dir.mkdir() + c_file = private_dir / 'flob.c' + c_file.write_text(contents) + for i in compiler_array: + if (i.endswith('cl') or i.endswith('cl.exe')) and 'clang-cl' not in i: + return generate_lib_msvc(outfile, c_file, private_dir, compiler_array) + return generate_lib_gnulike(outfile, c_file, private_dir, compiler_array) + +if __name__ == '__main__': + options = parser.parse_args() + sys.exit(generate_lib(options.o, options.private_dir, options.cmparr)) diff --git a/test cases/common/215 link custom/meson.build b/test cases/common/215 link custom/meson.build new file mode 100644 index 0000000..c8d3a6d --- /dev/null +++ b/test cases/common/215 link custom/meson.build @@ -0,0 +1,57 @@ +project('linkcustom', 'c') + +# This would require passing the static linker to the build script or having +# it detect it by itself. I'm too lazy to implement it now and it is not +# really needed for testing that custom targets work. It is the responsibility +# of the custom target to produce things in the correct format. +assert(not meson.is_cross_build(), + 'MESON_SKIP_TEST cross checking not implemented.') + +cc = meson.get_compiler('c') +genprog = find_program('custom_stlib.py') + +clib = custom_target('linkcustom', + output: 'libflob.a', + command: [genprog, + '-o', '@OUTPUT@', + '--private-dir', '@PRIVATE_DIR@'] + cc.cmd_array()) + +# custom_target tests + +exe = executable('prog', 'prog.c', link_with: clib) +test('linkcustom', exe) + +d = declare_dependency(link_with: clib) + +exe2 = executable('prog2', 'prog.c', dependencies: d) +test('linkcustom2', exe2) + +# Link whole tests + +exe3 = executable('prog3', 'prog.c', link_whole: clib) +test('linkwhole', exe) + +d2 = declare_dependency(link_whole: clib) + +exe4 = executable('prog4', 'prog.c', dependencies: d2) +test('linkwhole2', exe2) + +# custom_target[i] tests + +exe_i = executable('prog_i', 'prog.c', link_with: clib[0]) +test('linkcustom', exe_i) + +d_i = declare_dependency(link_with: clib[0]) + +exe2_i = executable('prog2_i', 'prog.c', dependencies: d_i) +test('linkcustom2_i', exe2_i) + +# Link whole tests + +exe3_i = executable('prog3_i', 'prog.c', link_whole: clib[0]) +test('linkwhole', exe) + +d2_i = declare_dependency(link_whole: clib[0]) + +exe4_i = executable('prog4_i', 'prog.c', dependencies: d2_i) +test('linkwhole2_i', exe2_i) diff --git a/test cases/common/215 link custom/prog.c b/test cases/common/215 link custom/prog.c new file mode 100644 index 0000000..eaede6d --- /dev/null +++ b/test cases/common/215 link custom/prog.c @@ -0,0 +1,6 @@ +void flob(); + +int main(int argc, char **argv) { + flob(); + return 0; +} diff --git a/test cases/common/215 warning level 0/main.cpp b/test cases/common/215 warning level 0/main.cpp deleted file mode 100644 index 954d9ce..0000000 --- a/test cases/common/215 warning level 0/main.cpp +++ /dev/null @@ -1,12 +0,0 @@ -#include - -#define PROJECT_NAME "demo" - -int main(int argc, char **argv) { - if(argc != 1) { - std::cout << argv[0] << "takes no arguments.\n"; - return 1; - } - std::cout << "This is project " << PROJECT_NAME << ".\n"; - return 0; -} diff --git a/test cases/common/215 warning level 0/meson.build b/test cases/common/215 warning level 0/meson.build deleted file mode 100644 index f2bd339..0000000 --- a/test cases/common/215 warning level 0/meson.build +++ /dev/null @@ -1,3 +0,0 @@ -project('warning_level', 'cpp', default_options : ['warning_level=0']) - -exe = executable('main', 'main.cpp', install : false) diff --git a/test cases/common/216 link custom/custom_stlib.py b/test cases/common/216 link custom/custom_stlib.py deleted file mode 100755 index 80334ed..0000000 --- a/test cases/common/216 link custom/custom_stlib.py +++ /dev/null @@ -1,73 +0,0 @@ -#!/usr/bin/env python3 - -import shutil, sys, subprocess, argparse, pathlib - -parser = argparse.ArgumentParser() - -parser.add_argument('--private-dir', required=True) -parser.add_argument('-o', required=True) -parser.add_argument('cmparr', nargs='+') - -contents = '''#include - -void flob() { - printf("Now flobbing.\\n"); -} -''' - -def generate_lib_gnulike(outfile, c_file, private_dir, compiler_array): - if shutil.which('ar'): - static_linker = 'ar' - elif shutil.which('llvm-ar'): - static_linker = 'llvm-ar' - elif shutil.which('gcc-ar'): - static_linker = 'gcc-ar' - else: - sys.exit('Could not detect a static linker.') - o_file = c_file.with_suffix('.o') - compile_cmd = compiler_array + ['-c', '-g', '-O2', '-o', str(o_file), str(c_file)] - subprocess.check_call(compile_cmd) - out_file = pathlib.Path(outfile) - if out_file.exists(): - out_file.unlink() - link_cmd = [static_linker, 'csr', outfile, str(o_file)] - subprocess.check_call(link_cmd) - return 0 - - -def generate_lib_msvc(outfile, c_file, private_dir, compiler_array): - static_linker = 'lib' - o_file = c_file.with_suffix('.obj') - compile_cmd = compiler_array + ['/MDd', - '/nologo', - '/ZI', - '/Ob0', - '/Od', - '/c', - '/Fo' + str(o_file), - str(c_file)] - subprocess.check_call(compile_cmd) - out_file = pathlib.Path(outfile) - if out_file.exists(): - out_file.unlink() - link_cmd = [static_linker, - '/nologo', - '/OUT:' + str(outfile), - str(o_file)] - subprocess.check_call(link_cmd) - return 0 - -def generate_lib(outfile, private_dir, compiler_array): - private_dir = pathlib.Path(private_dir) - if not private_dir.exists(): - private_dir.mkdir() - c_file = private_dir / 'flob.c' - c_file.write_text(contents) - for i in compiler_array: - if (i.endswith('cl') or i.endswith('cl.exe')) and 'clang-cl' not in i: - return generate_lib_msvc(outfile, c_file, private_dir, compiler_array) - return generate_lib_gnulike(outfile, c_file, private_dir, compiler_array) - -if __name__ == '__main__': - options = parser.parse_args() - sys.exit(generate_lib(options.o, options.private_dir, options.cmparr)) diff --git a/test cases/common/216 link custom/meson.build b/test cases/common/216 link custom/meson.build deleted file mode 100644 index c8d3a6d..0000000 --- a/test cases/common/216 link custom/meson.build +++ /dev/null @@ -1,57 +0,0 @@ -project('linkcustom', 'c') - -# This would require passing the static linker to the build script or having -# it detect it by itself. I'm too lazy to implement it now and it is not -# really needed for testing that custom targets work. It is the responsibility -# of the custom target to produce things in the correct format. -assert(not meson.is_cross_build(), - 'MESON_SKIP_TEST cross checking not implemented.') - -cc = meson.get_compiler('c') -genprog = find_program('custom_stlib.py') - -clib = custom_target('linkcustom', - output: 'libflob.a', - command: [genprog, - '-o', '@OUTPUT@', - '--private-dir', '@PRIVATE_DIR@'] + cc.cmd_array()) - -# custom_target tests - -exe = executable('prog', 'prog.c', link_with: clib) -test('linkcustom', exe) - -d = declare_dependency(link_with: clib) - -exe2 = executable('prog2', 'prog.c', dependencies: d) -test('linkcustom2', exe2) - -# Link whole tests - -exe3 = executable('prog3', 'prog.c', link_whole: clib) -test('linkwhole', exe) - -d2 = declare_dependency(link_whole: clib) - -exe4 = executable('prog4', 'prog.c', dependencies: d2) -test('linkwhole2', exe2) - -# custom_target[i] tests - -exe_i = executable('prog_i', 'prog.c', link_with: clib[0]) -test('linkcustom', exe_i) - -d_i = declare_dependency(link_with: clib[0]) - -exe2_i = executable('prog2_i', 'prog.c', dependencies: d_i) -test('linkcustom2_i', exe2_i) - -# Link whole tests - -exe3_i = executable('prog3_i', 'prog.c', link_whole: clib[0]) -test('linkwhole', exe) - -d2_i = declare_dependency(link_whole: clib[0]) - -exe4_i = executable('prog4_i', 'prog.c', dependencies: d2_i) -test('linkwhole2_i', exe2_i) diff --git a/test cases/common/216 link custom/prog.c b/test cases/common/216 link custom/prog.c deleted file mode 100644 index eaede6d..0000000 --- a/test cases/common/216 link custom/prog.c +++ /dev/null @@ -1,6 +0,0 @@ -void flob(); - -int main(int argc, char **argv) { - flob(); - return 0; -} diff --git a/test cases/common/216 link custom_i single from multiple/generate_conflicting_stlibs.py b/test cases/common/216 link custom_i single from multiple/generate_conflicting_stlibs.py new file mode 100644 index 0000000..42d6631 --- /dev/null +++ b/test cases/common/216 link custom_i single from multiple/generate_conflicting_stlibs.py @@ -0,0 +1,90 @@ +#!/usr/bin/env python3 + +import shutil, sys, subprocess, argparse, pathlib + +parser = argparse.ArgumentParser() + +parser.add_argument('--private-dir', required=True) +parser.add_argument('-o', nargs='+', required=True) +parser.add_argument('cmparr', nargs='+') + +contents = [''' +int flob() { + return 0; +} +''', ''' +int flob() { + return 1; +} +'''] + +def generate_lib_gnulike(outfile, c_file, private_dir, compiler_array): + if shutil.which('ar'): + static_linker = 'ar' + elif shutil.which('llvm-ar'): + static_linker = 'llvm-ar' + elif shutil.which('gcc-ar'): + static_linker = 'gcc-ar' + else: + sys.exit('Could not detect a static linker.') + o_file = c_file.with_suffix('.o') + compile_cmd = compiler_array + ['-c', '-g', '-O2', '-o', str(o_file), str(c_file)] + subprocess.check_call(compile_cmd) + out_file = pathlib.Path(outfile) + if out_file.exists(): + out_file.unlink() + link_cmd = [static_linker, 'csr', outfile, str(o_file)] + subprocess.check_call(link_cmd) + return 0 + + +def generate_lib_msvc(outfile, c_file, private_dir, compiler_array): + static_linker = 'lib' + o_file = c_file.with_suffix('.obj') + compile_cmd = compiler_array + ['/MDd', + '/nologo', + '/ZI', + '/Ob0', + '/Od', + '/c', + '/Fo' + str(o_file), + str(c_file)] + subprocess.check_call(compile_cmd) + out_file = pathlib.Path(outfile) + if out_file.exists(): + out_file.unlink() + link_cmd = [static_linker, + '/nologo', + '/OUT:' + str(outfile), + str(o_file)] + subprocess.check_call(link_cmd) + return 0 + +def generate_lib(outfiles, private_dir, compiler_array): + private_dir = pathlib.Path(private_dir) + if not private_dir.exists(): + private_dir.mkdir() + + for i, content in enumerate(contents): + c_file = private_dir / ('flob_' + str(i + 1) + '.c') + c_file.write_text(content) + outfile = outfiles[i] + + cl_found = False + for cl_arg in compiler_array: + if (cl_arg.endswith('cl') or cl_arg.endswith('cl.exe')) and 'clang-cl' not in cl_arg: + ret = generate_lib_msvc(outfile, c_file, private_dir, compiler_array) + if ret > 0: + return ret + else: + cl_found = True + break + if not cl_found: + ret = generate_lib_gnulike(outfile, c_file, private_dir, compiler_array) + if ret > 0: + return ret + return 0 + +if __name__ == '__main__': + options = parser.parse_args() + sys.exit(generate_lib(options.o, options.private_dir, options.cmparr)) diff --git a/test cases/common/216 link custom_i single from multiple/meson.build b/test cases/common/216 link custom_i single from multiple/meson.build new file mode 100644 index 0000000..eee1fe1 --- /dev/null +++ b/test cases/common/216 link custom_i single from multiple/meson.build @@ -0,0 +1,37 @@ +project('linkcustom', 'c') + +# This would require passing the static linker to the build script or having +# it detect it by itself. I'm too lazy to implement it now and it is not +# really needed for testing that custom targets work. It is the responsibility +# of the custom target to produce things in the correct format. +assert(not meson.is_cross_build(), + 'MESON_SKIP_TEST cross checking not implemented.') + +cc = meson.get_compiler('c') +genprog = find_program('generate_conflicting_stlibs.py') + +clib = custom_target('linkcustom', + output: ['libflob_1.a', 'libflob_2.a'], + command: [genprog, + '-o', '@OUTPUT@', + '--private-dir', '@PRIVATE_DIR@'] + cc.cmd_array()) + +clib_2 = clib[1] + +exe = executable('prog', 'prog.c', link_with: clib_2) +test('linkcustom', exe) + +d = declare_dependency(link_with: clib_2) + +exe2 = executable('prog2', 'prog.c', dependencies: d) +test('linkcustom2', exe2) + +# Link whole tests + +exe3 = executable('prog3', 'prog.c', link_whole: clib_2) +test('linkwhole', exe) + +d2 = declare_dependency(link_whole: clib_2) + +exe4 = executable('prog4', 'prog.c', dependencies: d2) +test('linkwhole2', exe2) diff --git a/test cases/common/216 link custom_i single from multiple/prog.c b/test cases/common/216 link custom_i single from multiple/prog.c new file mode 100644 index 0000000..8013034 --- /dev/null +++ b/test cases/common/216 link custom_i single from multiple/prog.c @@ -0,0 +1,5 @@ +int flob(); + +int main(int argc, char **argv) { + return (flob() == 1 ? 0 : 1); +} diff --git a/test cases/common/217 link custom_i multiple from multiple/generate_stlibs.py b/test cases/common/217 link custom_i multiple from multiple/generate_stlibs.py new file mode 100644 index 0000000..5292006 --- /dev/null +++ b/test cases/common/217 link custom_i multiple from multiple/generate_stlibs.py @@ -0,0 +1,92 @@ +#!/usr/bin/env python3 + +import shutil, sys, subprocess, argparse, pathlib + +parser = argparse.ArgumentParser() + +parser.add_argument('--private-dir', required=True) +parser.add_argument('-o', nargs='+', required=True) +parser.add_argument('cmparr', nargs='+') + +contents = ['''#include + +void flob_1() { + printf("Now flobbing #1.\\n"); +} +''', '''#include + +void flob_2() { + printf("Now flobbing #2.\\n"); +} +'''] + +def generate_lib_gnulike(outfile, c_file, private_dir, compiler_array): + if shutil.which('ar'): + static_linker = 'ar' + elif shutil.which('llvm-ar'): + static_linker = 'llvm-ar' + elif shutil.which('gcc-ar'): + static_linker = 'gcc-ar' + else: + sys.exit('Could not detect a static linker.') + o_file = c_file.with_suffix('.o') + compile_cmd = compiler_array + ['-c', '-g', '-O2', '-o', str(o_file), str(c_file)] + subprocess.check_call(compile_cmd) + out_file = pathlib.Path(outfile) + if out_file.exists(): + out_file.unlink() + link_cmd = [static_linker, 'csr', outfile, str(o_file)] + subprocess.check_call(link_cmd) + return 0 + + +def generate_lib_msvc(outfile, c_file, private_dir, compiler_array): + static_linker = 'lib' + o_file = c_file.with_suffix('.obj') + compile_cmd = compiler_array + ['/MDd', + '/nologo', + '/ZI', + '/Ob0', + '/Od', + '/c', + '/Fo' + str(o_file), + str(c_file)] + subprocess.check_call(compile_cmd) + out_file = pathlib.Path(outfile) + if out_file.exists(): + out_file.unlink() + link_cmd = [static_linker, + '/nologo', + '/OUT:' + str(outfile), + str(o_file)] + subprocess.check_call(link_cmd) + return 0 + +def generate_lib(outfiles, private_dir, compiler_array): + private_dir = pathlib.Path(private_dir) + if not private_dir.exists(): + private_dir.mkdir() + + for i, content in enumerate(contents): + c_file = private_dir / ('flob_' + str(i + 1) + '.c') + c_file.write_text(content) + outfile = outfiles[i] + + cl_found = False + for cl_arg in compiler_array: + if (cl_arg.endswith('cl') or cl_arg.endswith('cl.exe')) and 'clang-cl' not in cl_arg: + ret = generate_lib_msvc(outfile, c_file, private_dir, compiler_array) + if ret > 0: + return ret + else: + cl_found = True + break + if not cl_found: + ret = generate_lib_gnulike(outfile, c_file, private_dir, compiler_array) + if ret > 0: + return ret + return 0 + +if __name__ == '__main__': + options = parser.parse_args() + sys.exit(generate_lib(options.o, options.private_dir, options.cmparr)) diff --git a/test cases/common/217 link custom_i multiple from multiple/meson.build b/test cases/common/217 link custom_i multiple from multiple/meson.build new file mode 100644 index 0000000..e5236e5 --- /dev/null +++ b/test cases/common/217 link custom_i multiple from multiple/meson.build @@ -0,0 +1,37 @@ +project('linkcustom', 'c') + +# This would require passing the static linker to the build script or having +# it detect it by itself. I'm too lazy to implement it now and it is not +# really needed for testing that custom targets work. It is the responsibility +# of the custom target to produce things in the correct format. +assert(not meson.is_cross_build(), + 'MESON_SKIP_TEST cross checking not implemented.') + +cc = meson.get_compiler('c') +genprog = find_program('generate_stlibs.py') + +clib = custom_target('linkcustom', + output: ['libflob_1.a', 'libflob_2.a'], + command: [genprog, + '-o', '@OUTPUT@', + '--private-dir', '@PRIVATE_DIR@'] + cc.cmd_array()) + +clibs = [clib[0], clib[1]] + +exe = executable('prog', 'prog.c', link_with: clibs) +test('linkcustom', exe) + +d = declare_dependency(link_with: clibs) + +exe2 = executable('prog2', 'prog.c', dependencies: d) +test('linkcustom2', exe2) + +# Link whole tests + +exe3 = executable('prog3', 'prog.c', link_whole: clibs) +test('linkwhole', exe) + +d2 = declare_dependency(link_whole: clibs) + +exe4 = executable('prog4', 'prog.c', dependencies: d2) +test('linkwhole2', exe2) diff --git a/test cases/common/217 link custom_i multiple from multiple/prog.c b/test cases/common/217 link custom_i multiple from multiple/prog.c new file mode 100644 index 0000000..51effe6 --- /dev/null +++ b/test cases/common/217 link custom_i multiple from multiple/prog.c @@ -0,0 +1,8 @@ +void flob_1(); +void flob_2(); + +int main(int argc, char **argv) { + flob_1(); + flob_2(); + return 0; +} diff --git a/test cases/common/217 link custom_i single from multiple/generate_conflicting_stlibs.py b/test cases/common/217 link custom_i single from multiple/generate_conflicting_stlibs.py deleted file mode 100644 index 42d6631..0000000 --- a/test cases/common/217 link custom_i single from multiple/generate_conflicting_stlibs.py +++ /dev/null @@ -1,90 +0,0 @@ -#!/usr/bin/env python3 - -import shutil, sys, subprocess, argparse, pathlib - -parser = argparse.ArgumentParser() - -parser.add_argument('--private-dir', required=True) -parser.add_argument('-o', nargs='+', required=True) -parser.add_argument('cmparr', nargs='+') - -contents = [''' -int flob() { - return 0; -} -''', ''' -int flob() { - return 1; -} -'''] - -def generate_lib_gnulike(outfile, c_file, private_dir, compiler_array): - if shutil.which('ar'): - static_linker = 'ar' - elif shutil.which('llvm-ar'): - static_linker = 'llvm-ar' - elif shutil.which('gcc-ar'): - static_linker = 'gcc-ar' - else: - sys.exit('Could not detect a static linker.') - o_file = c_file.with_suffix('.o') - compile_cmd = compiler_array + ['-c', '-g', '-O2', '-o', str(o_file), str(c_file)] - subprocess.check_call(compile_cmd) - out_file = pathlib.Path(outfile) - if out_file.exists(): - out_file.unlink() - link_cmd = [static_linker, 'csr', outfile, str(o_file)] - subprocess.check_call(link_cmd) - return 0 - - -def generate_lib_msvc(outfile, c_file, private_dir, compiler_array): - static_linker = 'lib' - o_file = c_file.with_suffix('.obj') - compile_cmd = compiler_array + ['/MDd', - '/nologo', - '/ZI', - '/Ob0', - '/Od', - '/c', - '/Fo' + str(o_file), - str(c_file)] - subprocess.check_call(compile_cmd) - out_file = pathlib.Path(outfile) - if out_file.exists(): - out_file.unlink() - link_cmd = [static_linker, - '/nologo', - '/OUT:' + str(outfile), - str(o_file)] - subprocess.check_call(link_cmd) - return 0 - -def generate_lib(outfiles, private_dir, compiler_array): - private_dir = pathlib.Path(private_dir) - if not private_dir.exists(): - private_dir.mkdir() - - for i, content in enumerate(contents): - c_file = private_dir / ('flob_' + str(i + 1) + '.c') - c_file.write_text(content) - outfile = outfiles[i] - - cl_found = False - for cl_arg in compiler_array: - if (cl_arg.endswith('cl') or cl_arg.endswith('cl.exe')) and 'clang-cl' not in cl_arg: - ret = generate_lib_msvc(outfile, c_file, private_dir, compiler_array) - if ret > 0: - return ret - else: - cl_found = True - break - if not cl_found: - ret = generate_lib_gnulike(outfile, c_file, private_dir, compiler_array) - if ret > 0: - return ret - return 0 - -if __name__ == '__main__': - options = parser.parse_args() - sys.exit(generate_lib(options.o, options.private_dir, options.cmparr)) diff --git a/test cases/common/217 link custom_i single from multiple/meson.build b/test cases/common/217 link custom_i single from multiple/meson.build deleted file mode 100644 index eee1fe1..0000000 --- a/test cases/common/217 link custom_i single from multiple/meson.build +++ /dev/null @@ -1,37 +0,0 @@ -project('linkcustom', 'c') - -# This would require passing the static linker to the build script or having -# it detect it by itself. I'm too lazy to implement it now and it is not -# really needed for testing that custom targets work. It is the responsibility -# of the custom target to produce things in the correct format. -assert(not meson.is_cross_build(), - 'MESON_SKIP_TEST cross checking not implemented.') - -cc = meson.get_compiler('c') -genprog = find_program('generate_conflicting_stlibs.py') - -clib = custom_target('linkcustom', - output: ['libflob_1.a', 'libflob_2.a'], - command: [genprog, - '-o', '@OUTPUT@', - '--private-dir', '@PRIVATE_DIR@'] + cc.cmd_array()) - -clib_2 = clib[1] - -exe = executable('prog', 'prog.c', link_with: clib_2) -test('linkcustom', exe) - -d = declare_dependency(link_with: clib_2) - -exe2 = executable('prog2', 'prog.c', dependencies: d) -test('linkcustom2', exe2) - -# Link whole tests - -exe3 = executable('prog3', 'prog.c', link_whole: clib_2) -test('linkwhole', exe) - -d2 = declare_dependency(link_whole: clib_2) - -exe4 = executable('prog4', 'prog.c', dependencies: d2) -test('linkwhole2', exe2) diff --git a/test cases/common/217 link custom_i single from multiple/prog.c b/test cases/common/217 link custom_i single from multiple/prog.c deleted file mode 100644 index 8013034..0000000 --- a/test cases/common/217 link custom_i single from multiple/prog.c +++ /dev/null @@ -1,5 +0,0 @@ -int flob(); - -int main(int argc, char **argv) { - return (flob() == 1 ? 0 : 1); -} diff --git a/test cases/common/218 dependency get_variable method/meson.build b/test cases/common/218 dependency get_variable method/meson.build new file mode 100644 index 0000000..92b8704 --- /dev/null +++ b/test cases/common/218 dependency get_variable method/meson.build @@ -0,0 +1,52 @@ +project( + 'dependency get_variable', + ['c', 'cpp'], +) + +# Just some string that nothing should return +default = 'asufoiqwjtl;adjfbpiuqwoehtl;ajdfl;ghal;sdjg' + +dep = dependency('zlib', method: 'pkg-config', required : false) +if not dep.found() + warning('Skipping pkg-config tests as zlib is not avialable or is not pkg-config') +else + # Test for regular pkg-config + # We don't know what the value will be, but we know it should be the same + dep = dependency('zlib', method : 'pkg-config') + assert(dep.get_pkgconfig_variable('prefix') == dep.get_variable(pkgconfig : 'prefix'), + 'Got different values from get_pkgconfig_variable and get_variable(pkgconfig: )') + assert(dep.get_variable(pkgconfig : default, default_value : default) == default, + 'pkg-config didnt get default when we should have.') + assert(dep.get_variable(pkgconfig : 'prefix', default_value : default) != default, + 'pkg-config got default when we shouldnt have.') +endif + +dep_ct = dependency('llvm', method : 'config-tool', required : false) +if not dep_ct.found() + warning('Skipping config-tool tests as llvm is not available or llvm-config was not found.') +else + assert(dep_ct.get_configtool_variable('has-rtti') == dep_ct.get_variable(configtool : 'has-rtti'), + 'Got different values from get_configtool_variable and get_variable(configtool: )') + assert(dep_ct.get_variable(configtool : default, default_value : default) == default, + 'config-tool didnt get default when we should have.') + assert(dep_ct.get_variable(configtool : 'has-rtti', default_value : default) != default, + 'config-tool got default when we shouldnt have.') +endif + +dep_cm = dependency('llvm', method : 'cmake', required : false) +if not dep_cm.found() + warning('Skipping cmake tests as llvm is not available via the cmake finder.') +else + if dep_ct.found() + assert((dep_cm.get_variable(cmake : 'LLVM_ENABLE_RTTI') == 'ON') == (dep_ct.get_variable(configtool : 'has-rtti') == 'YES'), + 'RTTI information for cmake and config tools disagree') + endif + assert(dep_cm.get_variable(cmake : default, default_value : default) == default, + 'cmake didnt get default when we should have.') + assert(dep_cm.get_variable(cmake : 'LLVM_ENABLE_RTTI', default_value : default) != default, + 'cmake config-tool got default when we shouldnt have.') +endif + +idep = declare_dependency() +assert(idep.get_variable(pkgconfig : 'foo', cmake : 'foo', configtool : 'foo', default_value : default) == default, + 'Got something other than default from an internal dependency') diff --git a/test cases/common/218 link custom_i multiple from multiple/generate_stlibs.py b/test cases/common/218 link custom_i multiple from multiple/generate_stlibs.py deleted file mode 100644 index 5292006..0000000 --- a/test cases/common/218 link custom_i multiple from multiple/generate_stlibs.py +++ /dev/null @@ -1,92 +0,0 @@ -#!/usr/bin/env python3 - -import shutil, sys, subprocess, argparse, pathlib - -parser = argparse.ArgumentParser() - -parser.add_argument('--private-dir', required=True) -parser.add_argument('-o', nargs='+', required=True) -parser.add_argument('cmparr', nargs='+') - -contents = ['''#include - -void flob_1() { - printf("Now flobbing #1.\\n"); -} -''', '''#include - -void flob_2() { - printf("Now flobbing #2.\\n"); -} -'''] - -def generate_lib_gnulike(outfile, c_file, private_dir, compiler_array): - if shutil.which('ar'): - static_linker = 'ar' - elif shutil.which('llvm-ar'): - static_linker = 'llvm-ar' - elif shutil.which('gcc-ar'): - static_linker = 'gcc-ar' - else: - sys.exit('Could not detect a static linker.') - o_file = c_file.with_suffix('.o') - compile_cmd = compiler_array + ['-c', '-g', '-O2', '-o', str(o_file), str(c_file)] - subprocess.check_call(compile_cmd) - out_file = pathlib.Path(outfile) - if out_file.exists(): - out_file.unlink() - link_cmd = [static_linker, 'csr', outfile, str(o_file)] - subprocess.check_call(link_cmd) - return 0 - - -def generate_lib_msvc(outfile, c_file, private_dir, compiler_array): - static_linker = 'lib' - o_file = c_file.with_suffix('.obj') - compile_cmd = compiler_array + ['/MDd', - '/nologo', - '/ZI', - '/Ob0', - '/Od', - '/c', - '/Fo' + str(o_file), - str(c_file)] - subprocess.check_call(compile_cmd) - out_file = pathlib.Path(outfile) - if out_file.exists(): - out_file.unlink() - link_cmd = [static_linker, - '/nologo', - '/OUT:' + str(outfile), - str(o_file)] - subprocess.check_call(link_cmd) - return 0 - -def generate_lib(outfiles, private_dir, compiler_array): - private_dir = pathlib.Path(private_dir) - if not private_dir.exists(): - private_dir.mkdir() - - for i, content in enumerate(contents): - c_file = private_dir / ('flob_' + str(i + 1) + '.c') - c_file.write_text(content) - outfile = outfiles[i] - - cl_found = False - for cl_arg in compiler_array: - if (cl_arg.endswith('cl') or cl_arg.endswith('cl.exe')) and 'clang-cl' not in cl_arg: - ret = generate_lib_msvc(outfile, c_file, private_dir, compiler_array) - if ret > 0: - return ret - else: - cl_found = True - break - if not cl_found: - ret = generate_lib_gnulike(outfile, c_file, private_dir, compiler_array) - if ret > 0: - return ret - return 0 - -if __name__ == '__main__': - options = parser.parse_args() - sys.exit(generate_lib(options.o, options.private_dir, options.cmparr)) diff --git a/test cases/common/218 link custom_i multiple from multiple/meson.build b/test cases/common/218 link custom_i multiple from multiple/meson.build deleted file mode 100644 index e5236e5..0000000 --- a/test cases/common/218 link custom_i multiple from multiple/meson.build +++ /dev/null @@ -1,37 +0,0 @@ -project('linkcustom', 'c') - -# This would require passing the static linker to the build script or having -# it detect it by itself. I'm too lazy to implement it now and it is not -# really needed for testing that custom targets work. It is the responsibility -# of the custom target to produce things in the correct format. -assert(not meson.is_cross_build(), - 'MESON_SKIP_TEST cross checking not implemented.') - -cc = meson.get_compiler('c') -genprog = find_program('generate_stlibs.py') - -clib = custom_target('linkcustom', - output: ['libflob_1.a', 'libflob_2.a'], - command: [genprog, - '-o', '@OUTPUT@', - '--private-dir', '@PRIVATE_DIR@'] + cc.cmd_array()) - -clibs = [clib[0], clib[1]] - -exe = executable('prog', 'prog.c', link_with: clibs) -test('linkcustom', exe) - -d = declare_dependency(link_with: clibs) - -exe2 = executable('prog2', 'prog.c', dependencies: d) -test('linkcustom2', exe2) - -# Link whole tests - -exe3 = executable('prog3', 'prog.c', link_whole: clibs) -test('linkwhole', exe) - -d2 = declare_dependency(link_whole: clibs) - -exe4 = executable('prog4', 'prog.c', dependencies: d2) -test('linkwhole2', exe2) diff --git a/test cases/common/218 link custom_i multiple from multiple/prog.c b/test cases/common/218 link custom_i multiple from multiple/prog.c deleted file mode 100644 index 51effe6..0000000 --- a/test cases/common/218 link custom_i multiple from multiple/prog.c +++ /dev/null @@ -1,8 +0,0 @@ -void flob_1(); -void flob_2(); - -int main(int argc, char **argv) { - flob_1(); - flob_2(); - return 0; -} diff --git a/test cases/common/219 dependency get_variable method/meson.build b/test cases/common/219 dependency get_variable method/meson.build deleted file mode 100644 index 92b8704..0000000 --- a/test cases/common/219 dependency get_variable method/meson.build +++ /dev/null @@ -1,52 +0,0 @@ -project( - 'dependency get_variable', - ['c', 'cpp'], -) - -# Just some string that nothing should return -default = 'asufoiqwjtl;adjfbpiuqwoehtl;ajdfl;ghal;sdjg' - -dep = dependency('zlib', method: 'pkg-config', required : false) -if not dep.found() - warning('Skipping pkg-config tests as zlib is not avialable or is not pkg-config') -else - # Test for regular pkg-config - # We don't know what the value will be, but we know it should be the same - dep = dependency('zlib', method : 'pkg-config') - assert(dep.get_pkgconfig_variable('prefix') == dep.get_variable(pkgconfig : 'prefix'), - 'Got different values from get_pkgconfig_variable and get_variable(pkgconfig: )') - assert(dep.get_variable(pkgconfig : default, default_value : default) == default, - 'pkg-config didnt get default when we should have.') - assert(dep.get_variable(pkgconfig : 'prefix', default_value : default) != default, - 'pkg-config got default when we shouldnt have.') -endif - -dep_ct = dependency('llvm', method : 'config-tool', required : false) -if not dep_ct.found() - warning('Skipping config-tool tests as llvm is not available or llvm-config was not found.') -else - assert(dep_ct.get_configtool_variable('has-rtti') == dep_ct.get_variable(configtool : 'has-rtti'), - 'Got different values from get_configtool_variable and get_variable(configtool: )') - assert(dep_ct.get_variable(configtool : default, default_value : default) == default, - 'config-tool didnt get default when we should have.') - assert(dep_ct.get_variable(configtool : 'has-rtti', default_value : default) != default, - 'config-tool got default when we shouldnt have.') -endif - -dep_cm = dependency('llvm', method : 'cmake', required : false) -if not dep_cm.found() - warning('Skipping cmake tests as llvm is not available via the cmake finder.') -else - if dep_ct.found() - assert((dep_cm.get_variable(cmake : 'LLVM_ENABLE_RTTI') == 'ON') == (dep_ct.get_variable(configtool : 'has-rtti') == 'YES'), - 'RTTI information for cmake and config tools disagree') - endif - assert(dep_cm.get_variable(cmake : default, default_value : default) == default, - 'cmake didnt get default when we should have.') - assert(dep_cm.get_variable(cmake : 'LLVM_ENABLE_RTTI', default_value : default) != default, - 'cmake config-tool got default when we shouldnt have.') -endif - -idep = declare_dependency() -assert(idep.get_variable(pkgconfig : 'foo', cmake : 'foo', configtool : 'foo', default_value : default) == default, - 'Got something other than default from an internal dependency') diff --git a/test cases/common/219 source set configuration_data/a.c b/test cases/common/219 source set configuration_data/a.c new file mode 100644 index 0000000..0570dff --- /dev/null +++ b/test cases/common/219 source set configuration_data/a.c @@ -0,0 +1,8 @@ +#include +#include "all.h" + +int main(void) +{ + if (p) abort(); + f(); +} diff --git a/test cases/common/219 source set configuration_data/all.h b/test cases/common/219 source set configuration_data/all.h new file mode 100644 index 0000000..728a7f6 --- /dev/null +++ b/test cases/common/219 source set configuration_data/all.h @@ -0,0 +1,7 @@ +extern void f(void); +extern void g(void); +extern void h(void); +extern void undefined(void); + +/* No extern here to get a common symbol */ +void (*p)(void); diff --git a/test cases/common/219 source set configuration_data/f.c b/test cases/common/219 source set configuration_data/f.c new file mode 100644 index 0000000..a50ecda --- /dev/null +++ b/test cases/common/219 source set configuration_data/f.c @@ -0,0 +1,5 @@ +#include "all.h" + +void f(void) +{ +} diff --git a/test cases/common/219 source set configuration_data/g.c b/test cases/common/219 source set configuration_data/g.c new file mode 100644 index 0000000..4a6f253 --- /dev/null +++ b/test cases/common/219 source set configuration_data/g.c @@ -0,0 +1,6 @@ +#include "all.h" + +void g(void) +{ + h(); +} diff --git a/test cases/common/219 source set configuration_data/meson.build b/test cases/common/219 source set configuration_data/meson.build new file mode 100644 index 0000000..104f39d --- /dev/null +++ b/test cases/common/219 source set configuration_data/meson.build @@ -0,0 +1,54 @@ +project('a', 'c') + +good = declare_dependency(link_with: static_library('good', 'g.c')) +bad = declare_dependency(link_args: 'nonexistent.a') +not_found = dependency('invalid', required: false) + +source_set = import('sourceset') + +sources = source_set.source_set() +sources.add(when: 'YES', if_false: ['nope.c']) +sources.add(when: 'YES1', if_true: files('a.c')) +subdir('subdir') +sources.add(when: 'NO', if_true: 'nope.c', if_false: ['f.c']) +sources.add(when: 'NO', if_true: bad, if_false: ['f.c']) + +sources.add(when: 'YES2', if_true: good) + +# dependencies as conditions +sources.add(when: not_found, if_true: 'nope.c') + +# test add_all +sources2 = source_set.source_set() +sources2.add(when: 'YES1', if_true: 'nope.c') +sources.add_all(when: 'NO', if_true: sources2) + +# test duplicate items +sources.add(when: 'YES1', if_true: files('a.c')) + +conf1 = configuration_data() +conf1.set10('YES', true) +conf1.set10('YES1', true) +conf1.set10('YES2', false) +conf1.set10('NO', false) +result1 = sources.apply(conf1) + +conf2 = configuration_data() +conf2.set10('YES', true) +conf2.set10('YES1', false) +conf2.set10('YES2', true) +conf2.set10('NO', false) +result2 = sources.apply(conf2) + +# Each target will recompile the objects +executable('first', sources: result1.sources(), dependencies: result1.dependencies()) +executable('second', sources: result2.sources(), dependencies: result2.dependencies()) + +# All target will use the same object files +if meson.is_unity() + message('Skipping extraction test because this is a Unity build.') +else + all_objs = static_library('all_objs', sources.all_sources()) + executable('first_via_lib', objects: all_objs.extract_objects(result1.sources()), dependencies: result1.dependencies()) + executable('second_via_lib', objects: all_objs.extract_objects(result2.sources()), dependencies: result2.dependencies()) +endif diff --git a/test cases/common/219 source set configuration_data/nope.c b/test cases/common/219 source set configuration_data/nope.c new file mode 100644 index 0000000..0ce1d3b --- /dev/null +++ b/test cases/common/219 source set configuration_data/nope.c @@ -0,0 +1,3 @@ +#include "all.h" + +void (*p)(void) = undefined; diff --git a/test cases/common/219 source set configuration_data/subdir/b.c b/test cases/common/219 source set configuration_data/subdir/b.c new file mode 100644 index 0000000..31c3789 --- /dev/null +++ b/test cases/common/219 source set configuration_data/subdir/b.c @@ -0,0 +1,13 @@ +#include +#include "all.h" + +void h(void) +{ +} + +int main(void) +{ + if (p) abort(); + f(); + g(); +} diff --git a/test cases/common/219 source set configuration_data/subdir/meson.build b/test cases/common/219 source set configuration_data/subdir/meson.build new file mode 100644 index 0000000..b497de5 --- /dev/null +++ b/test cases/common/219 source set configuration_data/subdir/meson.build @@ -0,0 +1 @@ +sources.add(when: ['YES2', good], if_true: [ files('b.c') ]) diff --git a/test cases/common/220 source set configuration_data/a.c b/test cases/common/220 source set configuration_data/a.c deleted file mode 100644 index 0570dff..0000000 --- a/test cases/common/220 source set configuration_data/a.c +++ /dev/null @@ -1,8 +0,0 @@ -#include -#include "all.h" - -int main(void) -{ - if (p) abort(); - f(); -} diff --git a/test cases/common/220 source set configuration_data/all.h b/test cases/common/220 source set configuration_data/all.h deleted file mode 100644 index 728a7f6..0000000 --- a/test cases/common/220 source set configuration_data/all.h +++ /dev/null @@ -1,7 +0,0 @@ -extern void f(void); -extern void g(void); -extern void h(void); -extern void undefined(void); - -/* No extern here to get a common symbol */ -void (*p)(void); diff --git a/test cases/common/220 source set configuration_data/f.c b/test cases/common/220 source set configuration_data/f.c deleted file mode 100644 index a50ecda..0000000 --- a/test cases/common/220 source set configuration_data/f.c +++ /dev/null @@ -1,5 +0,0 @@ -#include "all.h" - -void f(void) -{ -} diff --git a/test cases/common/220 source set configuration_data/g.c b/test cases/common/220 source set configuration_data/g.c deleted file mode 100644 index 4a6f253..0000000 --- a/test cases/common/220 source set configuration_data/g.c +++ /dev/null @@ -1,6 +0,0 @@ -#include "all.h" - -void g(void) -{ - h(); -} diff --git a/test cases/common/220 source set configuration_data/meson.build b/test cases/common/220 source set configuration_data/meson.build deleted file mode 100644 index 104f39d..0000000 --- a/test cases/common/220 source set configuration_data/meson.build +++ /dev/null @@ -1,54 +0,0 @@ -project('a', 'c') - -good = declare_dependency(link_with: static_library('good', 'g.c')) -bad = declare_dependency(link_args: 'nonexistent.a') -not_found = dependency('invalid', required: false) - -source_set = import('sourceset') - -sources = source_set.source_set() -sources.add(when: 'YES', if_false: ['nope.c']) -sources.add(when: 'YES1', if_true: files('a.c')) -subdir('subdir') -sources.add(when: 'NO', if_true: 'nope.c', if_false: ['f.c']) -sources.add(when: 'NO', if_true: bad, if_false: ['f.c']) - -sources.add(when: 'YES2', if_true: good) - -# dependencies as conditions -sources.add(when: not_found, if_true: 'nope.c') - -# test add_all -sources2 = source_set.source_set() -sources2.add(when: 'YES1', if_true: 'nope.c') -sources.add_all(when: 'NO', if_true: sources2) - -# test duplicate items -sources.add(when: 'YES1', if_true: files('a.c')) - -conf1 = configuration_data() -conf1.set10('YES', true) -conf1.set10('YES1', true) -conf1.set10('YES2', false) -conf1.set10('NO', false) -result1 = sources.apply(conf1) - -conf2 = configuration_data() -conf2.set10('YES', true) -conf2.set10('YES1', false) -conf2.set10('YES2', true) -conf2.set10('NO', false) -result2 = sources.apply(conf2) - -# Each target will recompile the objects -executable('first', sources: result1.sources(), dependencies: result1.dependencies()) -executable('second', sources: result2.sources(), dependencies: result2.dependencies()) - -# All target will use the same object files -if meson.is_unity() - message('Skipping extraction test because this is a Unity build.') -else - all_objs = static_library('all_objs', sources.all_sources()) - executable('first_via_lib', objects: all_objs.extract_objects(result1.sources()), dependencies: result1.dependencies()) - executable('second_via_lib', objects: all_objs.extract_objects(result2.sources()), dependencies: result2.dependencies()) -endif diff --git a/test cases/common/220 source set configuration_data/nope.c b/test cases/common/220 source set configuration_data/nope.c deleted file mode 100644 index 0ce1d3b..0000000 --- a/test cases/common/220 source set configuration_data/nope.c +++ /dev/null @@ -1,3 +0,0 @@ -#include "all.h" - -void (*p)(void) = undefined; diff --git a/test cases/common/220 source set configuration_data/subdir/b.c b/test cases/common/220 source set configuration_data/subdir/b.c deleted file mode 100644 index 31c3789..0000000 --- a/test cases/common/220 source set configuration_data/subdir/b.c +++ /dev/null @@ -1,13 +0,0 @@ -#include -#include "all.h" - -void h(void) -{ -} - -int main(void) -{ - if (p) abort(); - f(); - g(); -} diff --git a/test cases/common/220 source set configuration_data/subdir/meson.build b/test cases/common/220 source set configuration_data/subdir/meson.build deleted file mode 100644 index b497de5..0000000 --- a/test cases/common/220 source set configuration_data/subdir/meson.build +++ /dev/null @@ -1 +0,0 @@ -sources.add(when: ['YES2', good], if_true: [ files('b.c') ]) diff --git a/test cases/common/220 source set dictionary/a.c b/test cases/common/220 source set dictionary/a.c new file mode 100644 index 0000000..0570dff --- /dev/null +++ b/test cases/common/220 source set dictionary/a.c @@ -0,0 +1,8 @@ +#include +#include "all.h" + +int main(void) +{ + if (p) abort(); + f(); +} diff --git a/test cases/common/220 source set dictionary/all.h b/test cases/common/220 source set dictionary/all.h new file mode 100644 index 0000000..728a7f6 --- /dev/null +++ b/test cases/common/220 source set dictionary/all.h @@ -0,0 +1,7 @@ +extern void f(void); +extern void g(void); +extern void h(void); +extern void undefined(void); + +/* No extern here to get a common symbol */ +void (*p)(void); diff --git a/test cases/common/220 source set dictionary/f.c b/test cases/common/220 source set dictionary/f.c new file mode 100644 index 0000000..a50ecda --- /dev/null +++ b/test cases/common/220 source set dictionary/f.c @@ -0,0 +1,5 @@ +#include "all.h" + +void f(void) +{ +} diff --git a/test cases/common/220 source set dictionary/g.c b/test cases/common/220 source set dictionary/g.c new file mode 100644 index 0000000..4a6f253 --- /dev/null +++ b/test cases/common/220 source set dictionary/g.c @@ -0,0 +1,6 @@ +#include "all.h" + +void g(void) +{ + h(); +} diff --git a/test cases/common/220 source set dictionary/meson.build b/test cases/common/220 source set dictionary/meson.build new file mode 100644 index 0000000..9a34507 --- /dev/null +++ b/test cases/common/220 source set dictionary/meson.build @@ -0,0 +1,56 @@ +project('a', 'c') + +good = declare_dependency(link_with: static_library('good', 'g.c')) +bad = declare_dependency(link_args: 'nonexistent.a') +not_found = dependency('invalid', required: false) + +source_set = import('sourceset') + +sources = source_set.source_set() +sources.add(when: 'YES', if_false: ['nope.c']) +sources.add(when: 'YES1', if_true: files('a.c')) +subdir('subdir') +sources.add(when: 'NO', if_true: 'nope.c', if_false: ['f.c']) +sources.add(when: 'NO', if_true: bad, if_false: ['f.c']) + +sources.add(when: 'YES2', if_true: good) + +# dependencies as conditions +sources.add(when: not_found, if_true: 'nope.c') + +# test add_all +sources2 = source_set.source_set() +sources2.add(when: 'YES1', if_true: 'nope.c') +sources.add_all(when: 'NO', if_true: sources2) + +# test duplicate items +sources.add(when: 'YES1', if_true: files('a.c')) + +conf1 = { + 'YES': true, + 'YES1': true, + 'YES2': false, + 'NO': false, +} +result1 = sources.apply(conf1) + +conf2 = { + 'YES': true, + 'YES1': false, + 'YES2': true, + 'NO': false, +} +result2 = sources.apply(conf2) + +# Each target will recompile the objects +executable('first', sources: result1.sources(), dependencies: result1.dependencies()) +executable('second', sources: result2.sources(), dependencies: result2.dependencies()) + +# All target will use the same object files +if meson.is_unity() + message('Skipping extraction test because this is a Unity build.') +else + all_objs = static_library('all_objs', sources.all_sources()) + executable('first_via_lib', objects: all_objs.extract_objects(result1.sources()), dependencies: result1.dependencies()) + executable('second_via_lib', objects: all_objs.extract_objects(result2.sources()), dependencies: result2.dependencies()) +endif diff --git a/test cases/common/220 source set dictionary/nope.c b/test cases/common/220 source set dictionary/nope.c new file mode 100644 index 0000000..0ce1d3b --- /dev/null +++ b/test cases/common/220 source set dictionary/nope.c @@ -0,0 +1,3 @@ +#include "all.h" + +void (*p)(void) = undefined; diff --git a/test cases/common/220 source set dictionary/subdir/b.c b/test cases/common/220 source set dictionary/subdir/b.c new file mode 100644 index 0000000..31c3789 --- /dev/null +++ b/test cases/common/220 source set dictionary/subdir/b.c @@ -0,0 +1,13 @@ +#include +#include "all.h" + +void h(void) +{ +} + +int main(void) +{ + if (p) abort(); + f(); + g(); +} diff --git a/test cases/common/220 source set dictionary/subdir/meson.build b/test cases/common/220 source set dictionary/subdir/meson.build new file mode 100644 index 0000000..b497de5 --- /dev/null +++ b/test cases/common/220 source set dictionary/subdir/meson.build @@ -0,0 +1 @@ +sources.add(when: ['YES2', good], if_true: [ files('b.c') ]) diff --git a/test cases/common/221 source set custom target/a.c b/test cases/common/221 source set custom target/a.c new file mode 100644 index 0000000..39a3b6b --- /dev/null +++ b/test cases/common/221 source set custom target/a.c @@ -0,0 +1,7 @@ +#include "all.h" + +int main(void) +{ + f(); + g(); +} diff --git a/test cases/common/221 source set custom target/all.h b/test cases/common/221 source set custom target/all.h new file mode 100644 index 0000000..5885e32 --- /dev/null +++ b/test cases/common/221 source set custom target/all.h @@ -0,0 +1,2 @@ +extern void f(void); +extern void g(void); diff --git a/test cases/common/221 source set custom target/cp.py b/test cases/common/221 source set custom target/cp.py new file mode 100644 index 0000000..cb09cf3 --- /dev/null +++ b/test cases/common/221 source set custom target/cp.py @@ -0,0 +1,5 @@ +#! /usr/bin/env python3 + +import sys +from shutil import copyfile +copyfile(*sys.argv[1:]) diff --git a/test cases/common/221 source set custom target/f.c b/test cases/common/221 source set custom target/f.c new file mode 100644 index 0000000..a50ecda --- /dev/null +++ b/test cases/common/221 source set custom target/f.c @@ -0,0 +1,5 @@ +#include "all.h" + +void f(void) +{ +} diff --git a/test cases/common/221 source set custom target/g.c b/test cases/common/221 source set custom target/g.c new file mode 100644 index 0000000..7098584 --- /dev/null +++ b/test cases/common/221 source set custom target/g.c @@ -0,0 +1,5 @@ +#include "all.h" + +void g(void) +{ +} diff --git a/test cases/common/221 source set custom target/meson.build b/test cases/common/221 source set custom target/meson.build new file mode 100644 index 0000000..fe6e6e1 --- /dev/null +++ b/test cases/common/221 source set custom target/meson.build @@ -0,0 +1,28 @@ +# Try using sourceset with various kinds of generated sources + +project('a', 'c') + +cp = find_program('cp.py') + +source_set = import('sourceset') +sources = source_set.source_set() + +a_c = custom_target('gen-custom-target', + input: 'a.c', output: 'out_a.c', + command: [cp, '@INPUT@', '@OUTPUT@']) +sources.add(when: 'YES', if_true: a_c) +sources.add(when: 'YES', if_true: a_c[0]) + +f_c = configure_file(input: 'f.c', output: 'out_f.c', copy: true) +sources.add(when: 'YES', if_true: f_c) +sources.add(when: 'YES', if_true: f_c) + +gen = generator(cp, output: 'out_@PLAINNAME@', arguments: ['@INPUT@', '@OUTPUT@']) +g_c = gen.process(files('g.c')) +sources.add(when: 'YES', if_true: g_c) +sources.add(when: 'YES', if_true: g_c) + +conf1 = { 'YES': true, } +result1 = sources.apply(conf1) + +executable('first', sources: result1.sources(), dependencies: result1.dependencies()) diff --git a/test cases/common/221 source set dictionary/a.c b/test cases/common/221 source set dictionary/a.c deleted file mode 100644 index 0570dff..0000000 --- a/test cases/common/221 source set dictionary/a.c +++ /dev/null @@ -1,8 +0,0 @@ -#include -#include "all.h" - -int main(void) -{ - if (p) abort(); - f(); -} diff --git a/test cases/common/221 source set dictionary/all.h b/test cases/common/221 source set dictionary/all.h deleted file mode 100644 index 728a7f6..0000000 --- a/test cases/common/221 source set dictionary/all.h +++ /dev/null @@ -1,7 +0,0 @@ -extern void f(void); -extern void g(void); -extern void h(void); -extern void undefined(void); - -/* No extern here to get a common symbol */ -void (*p)(void); diff --git a/test cases/common/221 source set dictionary/f.c b/test cases/common/221 source set dictionary/f.c deleted file mode 100644 index a50ecda..0000000 --- a/test cases/common/221 source set dictionary/f.c +++ /dev/null @@ -1,5 +0,0 @@ -#include "all.h" - -void f(void) -{ -} diff --git a/test cases/common/221 source set dictionary/g.c b/test cases/common/221 source set dictionary/g.c deleted file mode 100644 index 4a6f253..0000000 --- a/test cases/common/221 source set dictionary/g.c +++ /dev/null @@ -1,6 +0,0 @@ -#include "all.h" - -void g(void) -{ - h(); -} diff --git a/test cases/common/221 source set dictionary/meson.build b/test cases/common/221 source set dictionary/meson.build deleted file mode 100644 index 9a34507..0000000 --- a/test cases/common/221 source set dictionary/meson.build +++ /dev/null @@ -1,56 +0,0 @@ -project('a', 'c') - -good = declare_dependency(link_with: static_library('good', 'g.c')) -bad = declare_dependency(link_args: 'nonexistent.a') -not_found = dependency('invalid', required: false) - -source_set = import('sourceset') - -sources = source_set.source_set() -sources.add(when: 'YES', if_false: ['nope.c']) -sources.add(when: 'YES1', if_true: files('a.c')) -subdir('subdir') -sources.add(when: 'NO', if_true: 'nope.c', if_false: ['f.c']) -sources.add(when: 'NO', if_true: bad, if_false: ['f.c']) - -sources.add(when: 'YES2', if_true: good) - -# dependencies as conditions -sources.add(when: not_found, if_true: 'nope.c') - -# test add_all -sources2 = source_set.source_set() -sources2.add(when: 'YES1', if_true: 'nope.c') -sources.add_all(when: 'NO', if_true: sources2) - -# test duplicate items -sources.add(when: 'YES1', if_true: files('a.c')) - -conf1 = { - 'YES': true, - 'YES1': true, - 'YES2': false, - 'NO': false, -} -result1 = sources.apply(conf1) - -conf2 = { - 'YES': true, - 'YES1': false, - 'YES2': true, - 'NO': false, -} -result2 = sources.apply(conf2) - -# Each target will recompile the objects -executable('first', sources: result1.sources(), dependencies: result1.dependencies()) -executable('second', sources: result2.sources(), dependencies: result2.dependencies()) - -# All target will use the same object files -if meson.is_unity() - message('Skipping extraction test because this is a Unity build.') -else - all_objs = static_library('all_objs', sources.all_sources()) - executable('first_via_lib', objects: all_objs.extract_objects(result1.sources()), dependencies: result1.dependencies()) - executable('second_via_lib', objects: all_objs.extract_objects(result2.sources()), dependencies: result2.dependencies()) -endif diff --git a/test cases/common/221 source set dictionary/nope.c b/test cases/common/221 source set dictionary/nope.c deleted file mode 100644 index 0ce1d3b..0000000 --- a/test cases/common/221 source set dictionary/nope.c +++ /dev/null @@ -1,3 +0,0 @@ -#include "all.h" - -void (*p)(void) = undefined; diff --git a/test cases/common/221 source set dictionary/subdir/b.c b/test cases/common/221 source set dictionary/subdir/b.c deleted file mode 100644 index 31c3789..0000000 --- a/test cases/common/221 source set dictionary/subdir/b.c +++ /dev/null @@ -1,13 +0,0 @@ -#include -#include "all.h" - -void h(void) -{ -} - -int main(void) -{ - if (p) abort(); - f(); - g(); -} diff --git a/test cases/common/221 source set dictionary/subdir/meson.build b/test cases/common/221 source set dictionary/subdir/meson.build deleted file mode 100644 index b497de5..0000000 --- a/test cases/common/221 source set dictionary/subdir/meson.build +++ /dev/null @@ -1 +0,0 @@ -sources.add(when: ['YES2', good], if_true: [ files('b.c') ]) diff --git a/test cases/common/222 source set custom target/a.c b/test cases/common/222 source set custom target/a.c deleted file mode 100644 index 39a3b6b..0000000 --- a/test cases/common/222 source set custom target/a.c +++ /dev/null @@ -1,7 +0,0 @@ -#include "all.h" - -int main(void) -{ - f(); - g(); -} diff --git a/test cases/common/222 source set custom target/all.h b/test cases/common/222 source set custom target/all.h deleted file mode 100644 index 5885e32..0000000 --- a/test cases/common/222 source set custom target/all.h +++ /dev/null @@ -1,2 +0,0 @@ -extern void f(void); -extern void g(void); diff --git a/test cases/common/222 source set custom target/cp.py b/test cases/common/222 source set custom target/cp.py deleted file mode 100644 index cb09cf3..0000000 --- a/test cases/common/222 source set custom target/cp.py +++ /dev/null @@ -1,5 +0,0 @@ -#! /usr/bin/env python3 - -import sys -from shutil import copyfile -copyfile(*sys.argv[1:]) diff --git a/test cases/common/222 source set custom target/f.c b/test cases/common/222 source set custom target/f.c deleted file mode 100644 index a50ecda..0000000 --- a/test cases/common/222 source set custom target/f.c +++ /dev/null @@ -1,5 +0,0 @@ -#include "all.h" - -void f(void) -{ -} diff --git a/test cases/common/222 source set custom target/g.c b/test cases/common/222 source set custom target/g.c deleted file mode 100644 index 7098584..0000000 --- a/test cases/common/222 source set custom target/g.c +++ /dev/null @@ -1,5 +0,0 @@ -#include "all.h" - -void g(void) -{ -} diff --git a/test cases/common/222 source set custom target/meson.build b/test cases/common/222 source set custom target/meson.build deleted file mode 100644 index fe6e6e1..0000000 --- a/test cases/common/222 source set custom target/meson.build +++ /dev/null @@ -1,28 +0,0 @@ -# Try using sourceset with various kinds of generated sources - -project('a', 'c') - -cp = find_program('cp.py') - -source_set = import('sourceset') -sources = source_set.source_set() - -a_c = custom_target('gen-custom-target', - input: 'a.c', output: 'out_a.c', - command: [cp, '@INPUT@', '@OUTPUT@']) -sources.add(when: 'YES', if_true: a_c) -sources.add(when: 'YES', if_true: a_c[0]) - -f_c = configure_file(input: 'f.c', output: 'out_f.c', copy: true) -sources.add(when: 'YES', if_true: f_c) -sources.add(when: 'YES', if_true: f_c) - -gen = generator(cp, output: 'out_@PLAINNAME@', arguments: ['@INPUT@', '@OUTPUT@']) -g_c = gen.process(files('g.c')) -sources.add(when: 'YES', if_true: g_c) -sources.add(when: 'YES', if_true: g_c) - -conf1 = { 'YES': true, } -result1 = sources.apply(conf1) - -executable('first', sources: result1.sources(), dependencies: result1.dependencies()) diff --git a/test cases/common/222 source set realistic example/boards/arm/aarch64.cc b/test cases/common/222 source set realistic example/boards/arm/aarch64.cc new file mode 100644 index 0000000..386c771 --- /dev/null +++ b/test cases/common/222 source set realistic example/boards/arm/aarch64.cc @@ -0,0 +1,8 @@ +#include "common.h" +#include + +void initialize_target() +{ + std::cout << ANSI_START << "some " << THE_TARGET + << " initialization" << ANSI_END << std::endl; +} diff --git a/test cases/common/222 source set realistic example/boards/arm/arm.cc b/test cases/common/222 source set realistic example/boards/arm/arm.cc new file mode 100644 index 0000000..b463ebe --- /dev/null +++ b/test cases/common/222 source set realistic example/boards/arm/arm.cc @@ -0,0 +1,10 @@ +#include "arm.h" + +const char *ARMBoard::target() +{ + return THE_TARGET; +} + +void ARMBoard::some_arm_thing() +{ +} diff --git a/test cases/common/222 source set realistic example/boards/arm/arm.h b/test cases/common/222 source set realistic example/boards/arm/arm.h new file mode 100644 index 0000000..4dd6b69 --- /dev/null +++ b/test cases/common/222 source set realistic example/boards/arm/arm.h @@ -0,0 +1,12 @@ +#ifndef ARM_H +#define ARM_H 1 + +#include "common.h" + +struct ARMBoard: Board { + const char *target(); + void some_arm_thing(); +}; + + +#endif diff --git a/test cases/common/222 source set realistic example/boards/arm/arm32.cc b/test cases/common/222 source set realistic example/boards/arm/arm32.cc new file mode 100644 index 0000000..72a2427 --- /dev/null +++ b/test cases/common/222 source set realistic example/boards/arm/arm32.cc @@ -0,0 +1,8 @@ +#include "common.h" +#include + +void initialize_target() +{ + std::cout << ANSI_START << "a different " << THE_TARGET + << " initialization" << ANSI_END << std::endl; +} diff --git a/test cases/common/222 source set realistic example/boards/arm/versatilepb.cc b/test cases/common/222 source set realistic example/boards/arm/versatilepb.cc new file mode 100644 index 0000000..3d1a9fe --- /dev/null +++ b/test cases/common/222 source set realistic example/boards/arm/versatilepb.cc @@ -0,0 +1,16 @@ +#include +#include "common.h" +#include "arm.h" + +struct VersatilePBBoard: ARMBoard { + void say_hello(); +}; + +void VersatilePBBoard::say_hello() +{ + some_arm_thing(); + std::cout << ANSI_START << "I am the versatilepb board" + << ANSI_END << std::endl; +} + +static VersatilePBBoard versatilepb; diff --git a/test cases/common/222 source set realistic example/boards/arm/virt.cc b/test cases/common/222 source set realistic example/boards/arm/virt.cc new file mode 100644 index 0000000..6f9a1ca --- /dev/null +++ b/test cases/common/222 source set realistic example/boards/arm/virt.cc @@ -0,0 +1,16 @@ +#include +#include "common.h" +#include "arm.h" + +struct VirtBoard: ARMBoard { + void say_hello(); +}; + +void VirtBoard::say_hello() +{ + some_arm_thing(); + std::cout << ANSI_START << "I am the virt board" + << ANSI_END << std::endl; +} + +static VirtBoard virt; diff --git a/test cases/common/222 source set realistic example/boards/arm/xlnx_zcu102.cc b/test cases/common/222 source set realistic example/boards/arm/xlnx_zcu102.cc new file mode 100644 index 0000000..8921e00 --- /dev/null +++ b/test cases/common/222 source set realistic example/boards/arm/xlnx_zcu102.cc @@ -0,0 +1,16 @@ +#include +#include "common.h" +#include "arm.h" + +struct XlnxZCU102Board: ARMBoard { + void say_hello(); +}; + +void XlnxZCU102Board::say_hello() +{ + some_arm_thing(); + std::cout << ANSI_START << "I am the xlnx_zcu102 board" + << ANSI_END << std::endl; +} + +static XlnxZCU102Board xlnx_zcu102; diff --git a/test cases/common/222 source set realistic example/boards/meson.build b/test cases/common/222 source set realistic example/boards/meson.build new file mode 100644 index 0000000..41ead4c --- /dev/null +++ b/test cases/common/222 source set realistic example/boards/meson.build @@ -0,0 +1,7 @@ +specific.add(when: 'TARGET_ARM', if_true: files('arm/arm.cc', 'arm/arm32.cc')) +specific.add(when: 'TARGET_AARCH64', if_true: files('arm/arm.cc', 'arm/aarch64.cc')) +specific.add(when: 'CONFIG_VIRT', if_true: files('arm/virt.cc')) +specific.add(when: 'CONFIG_XLNX_ZCU102', if_true: files('arm/xlnx_zcu102.cc')) +specific.add(when: 'CONFIG_VERSATILEPB', if_true: files('arm/versatilepb.cc')) + +specific.add(when: 'TARGET_X86', if_true: files('x86/pc.cc')) diff --git a/test cases/common/222 source set realistic example/boards/x86/pc.cc b/test cases/common/222 source set realistic example/boards/x86/pc.cc new file mode 100644 index 0000000..04ec392 --- /dev/null +++ b/test cases/common/222 source set realistic example/boards/x86/pc.cc @@ -0,0 +1,26 @@ +#include +#include "common.h" + +struct X86Board: Board { + const char *target(); + void say_hello(); +}; + +const char *X86Board::target() +{ + return THE_TARGET; +} + +void X86Board::say_hello() +{ + std::cout << ANSI_START << "I am a 1996 PC" + << ANSI_END << std::endl; +} + +void initialize_target() +{ + std::cout << ANSI_START << "ready, set, go" + << ANSI_END << std::endl; +} + +static X86Board pc; diff --git a/test cases/common/222 source set realistic example/common.h b/test cases/common/222 source set realistic example/common.h new file mode 100644 index 0000000..6e325c7 --- /dev/null +++ b/test cases/common/222 source set realistic example/common.h @@ -0,0 +1,41 @@ +#ifndef COMMON_H +#define COMMON_H 1 + +/* + * target-specific code will print in yellow, common code will print + * in grey. + */ +#ifdef THE_TARGET +#define ANSI_START "\x1b[33;1m" +#define ANSI_END "\x1b[0m" +#else +#define ANSI_START "" +#define ANSI_END "" +#endif + +void some_random_function(); +void initialize_target(); + +struct Board { + Board *next; + Board(); + virtual ~Board(); + virtual void say_hello() = 0; + virtual const char *target() = 0; +}; + +struct Device { + Device *next; + Device(); + virtual ~Device(); + virtual void say_hello() = 0; +}; + +struct Dependency { + Dependency *next; + Dependency(); + virtual ~Dependency(); + virtual void initialize() = 0; +}; + +#endif diff --git a/test cases/common/222 source set realistic example/config/aarch64 b/test cases/common/222 source set realistic example/config/aarch64 new file mode 100644 index 0000000..55b90eb --- /dev/null +++ b/test cases/common/222 source set realistic example/config/aarch64 @@ -0,0 +1,5 @@ +TARGET_AARCH64=y +CONFIG_VIRT=y +CONFIG_XLNX_ZCU102=y +CONFIG_VIRTIO=y +CONFIG_VIRTIO_MMIO=y diff --git a/test cases/common/222 source set realistic example/config/arm b/test cases/common/222 source set realistic example/config/arm new file mode 100644 index 0000000..d3f7ac7 --- /dev/null +++ b/test cases/common/222 source set realistic example/config/arm @@ -0,0 +1,3 @@ +TARGET_ARM=y +CONFIG_VIRT=y +CONFIG_VERSATILEPB=y diff --git a/test cases/common/222 source set realistic example/config/x86 b/test cases/common/222 source set realistic example/config/x86 new file mode 100644 index 0000000..6caa3e2 --- /dev/null +++ b/test cases/common/222 source set realistic example/config/x86 @@ -0,0 +1,4 @@ +TARGET_X86=y +CONFIG_PC=y +CONFIG_VIRTIO=y +CONFIG_VIRTIO_PCI=y diff --git a/test cases/common/222 source set realistic example/devices/meson.build b/test cases/common/222 source set realistic example/devices/meson.build new file mode 100644 index 0000000..68ee68e --- /dev/null +++ b/test cases/common/222 source set realistic example/devices/meson.build @@ -0,0 +1,3 @@ +specific.add(when: 'CONFIG_VIRTIO', if_true: files('virtio.cc')) +common.add(when: 'CONFIG_VIRTIO_PCI', if_true: files('virtio-pci.cc')) +common.add(when: 'CONFIG_VIRTIO_MMIO', if_true: files('virtio-mmio.cc')) diff --git a/test cases/common/222 source set realistic example/devices/virtio-mmio.cc b/test cases/common/222 source set realistic example/devices/virtio-mmio.cc new file mode 100644 index 0000000..5dab97e --- /dev/null +++ b/test cases/common/222 source set realistic example/devices/virtio-mmio.cc @@ -0,0 +1,16 @@ +#include +#include "common.h" +#include "virtio.h" + +struct VirtioMMIODevice: VirtioDevice { + void say_hello(); +}; + +void VirtioMMIODevice::say_hello() +{ + some_virtio_thing(); + std::cout << ANSI_START << "virtio-mmio is available" + << ANSI_END << std::endl; +} + +static VirtioMMIODevice virtio_mmio; diff --git a/test cases/common/222 source set realistic example/devices/virtio-pci.cc b/test cases/common/222 source set realistic example/devices/virtio-pci.cc new file mode 100644 index 0000000..7df7a82 --- /dev/null +++ b/test cases/common/222 source set realistic example/devices/virtio-pci.cc @@ -0,0 +1,16 @@ +#include +#include "common.h" +#include "virtio.h" + +struct VirtioPCIDevice: VirtioDevice { + void say_hello(); +}; + +void VirtioPCIDevice::say_hello() +{ + some_virtio_thing(); + std::cout << ANSI_START << "virtio-pci is available" + << ANSI_END << std::endl; +} + +static VirtioPCIDevice virtio_pci; diff --git a/test cases/common/222 source set realistic example/devices/virtio.cc b/test cases/common/222 source set realistic example/devices/virtio.cc new file mode 100644 index 0000000..fc51275 --- /dev/null +++ b/test cases/common/222 source set realistic example/devices/virtio.cc @@ -0,0 +1,6 @@ +#include +#include "common.h" +#include "virtio.h" + +void VirtioDevice::some_virtio_thing() { +} diff --git a/test cases/common/222 source set realistic example/devices/virtio.h b/test cases/common/222 source set realistic example/devices/virtio.h new file mode 100644 index 0000000..a157731 --- /dev/null +++ b/test cases/common/222 source set realistic example/devices/virtio.h @@ -0,0 +1,10 @@ +#ifndef VIRTIO_H +#define VIRTIO_H 1 + +#include "common.h" + +struct VirtioDevice: Device { + void some_virtio_thing(); +}; + +#endif diff --git a/test cases/common/222 source set realistic example/main.cc b/test cases/common/222 source set realistic example/main.cc new file mode 100644 index 0000000..97afab1 --- /dev/null +++ b/test cases/common/222 source set realistic example/main.cc @@ -0,0 +1,32 @@ +#include +#include +#include "common.h" + +Board* boards; +Device* devices; +Dependency* deps; + +Board::Board() { this->next = boards; boards = this; } +Board::~Board() {} + +Device::Device() { this->next = devices; devices = this; } +Device::~Device() {} + +Dependency::Dependency() { this->next = deps; deps = this; } +Dependency::~Dependency() {} + +int main() +{ + some_random_function(); + for (auto d = deps; d; d = d->next) + d->initialize(); + + initialize_target(); + for (auto b = boards; b; b = b->next) { + std::cout << ANSI_START << b->target() << " - " << ANSI_END; + b->say_hello(); + } + + for (auto d = devices; d; d = d->next) + d->say_hello(); +} diff --git a/test cases/common/222 source set realistic example/meson.build b/test cases/common/222 source set realistic example/meson.build new file mode 100644 index 0000000..2a9475a --- /dev/null +++ b/test cases/common/222 source set realistic example/meson.build @@ -0,0 +1,50 @@ +# a sort-of realistic example that combines the sourceset and kconfig +# modules, inspired by QEMU's build system + +project('sourceset-example', 'cpp') + +cppid = meson.get_compiler('cpp').get_id() +if cppid == 'pgi' + error('MESON_SKIP_TEST: Even PGI 19.4 that claims C++17 full support, cannot handle auto x = y syntax used in this test.') +endif + +ss = import('sourceset') +kconfig = import('unstable-kconfig') + +zlib = dependency('zlib', version : '>=1.2.8', required: false) +not_found = dependency('not-found', required: false) + +common = ss.source_set() +specific = ss.source_set() + +common.add(files('main.cc')) +common.add(when: zlib, if_true: files('zlib.cc')) +common.add(when: not_found, + if_true: files('was-found.cc'), + if_false: files('not-found.cc')) + +subdir('boards') +subdir('devices') + +if meson.is_unity() + specific.add_all(common) + common = ss.source_set() +endif + +common_lib = static_library('common', common.all_sources()) + +targets = [ 'arm', 'aarch64', 'x86' ] +target_dirs = { 'arm' : 'arm', 'aarch64' : 'arm', 'x86': 'x86' } + +foreach x : targets + config = kconfig.load('config' / x) + target_specific = specific.apply(config, strict: false) + target_common = common.apply(config, strict: false) + target_deps = target_specific.dependencies() + target_common.dependencies() + executable(x, + objects: common_lib.extract_objects(target_common.sources()), + sources: target_specific.sources(), + dependencies: target_deps, + include_directories: 'boards' / target_dirs[x], + cpp_args: '-DTHE_TARGET="' + x + '"') +endforeach diff --git a/test cases/common/222 source set realistic example/not-found.cc b/test cases/common/222 source set realistic example/not-found.cc new file mode 100644 index 0000000..955a7a2 --- /dev/null +++ b/test cases/common/222 source set realistic example/not-found.cc @@ -0,0 +1,8 @@ +#include +#include "common.h" + +void some_random_function() +{ + std::cout << ANSI_START << "everything's alright" + << ANSI_END << std::endl; +} diff --git a/test cases/common/222 source set realistic example/was-found.cc b/test cases/common/222 source set realistic example/was-found.cc new file mode 100644 index 0000000..f1eaf1e --- /dev/null +++ b/test cases/common/222 source set realistic example/was-found.cc @@ -0,0 +1,7 @@ +#include + +void some_random_function() +{ + std::cout << ANSI_START << "huh?" + << ANSI_END << std::endl; +} diff --git a/test cases/common/222 source set realistic example/zlib.cc b/test cases/common/222 source set realistic example/zlib.cc new file mode 100644 index 0000000..909d744 --- /dev/null +++ b/test cases/common/222 source set realistic example/zlib.cc @@ -0,0 +1,13 @@ +#include +#include "common.h" + +struct ZLibDependency : Dependency { + void initialize(); +}; + +void ZLibDependency::initialize() { + std::cout << ANSI_START << "hello from zlib" + << ANSI_END << std::endl; +} + +ZLibDependency zlib; diff --git a/test cases/common/223 source set realistic example/boards/arm/aarch64.cc b/test cases/common/223 source set realistic example/boards/arm/aarch64.cc deleted file mode 100644 index 386c771..0000000 --- a/test cases/common/223 source set realistic example/boards/arm/aarch64.cc +++ /dev/null @@ -1,8 +0,0 @@ -#include "common.h" -#include - -void initialize_target() -{ - std::cout << ANSI_START << "some " << THE_TARGET - << " initialization" << ANSI_END << std::endl; -} diff --git a/test cases/common/223 source set realistic example/boards/arm/arm.cc b/test cases/common/223 source set realistic example/boards/arm/arm.cc deleted file mode 100644 index b463ebe..0000000 --- a/test cases/common/223 source set realistic example/boards/arm/arm.cc +++ /dev/null @@ -1,10 +0,0 @@ -#include "arm.h" - -const char *ARMBoard::target() -{ - return THE_TARGET; -} - -void ARMBoard::some_arm_thing() -{ -} diff --git a/test cases/common/223 source set realistic example/boards/arm/arm.h b/test cases/common/223 source set realistic example/boards/arm/arm.h deleted file mode 100644 index 4dd6b69..0000000 --- a/test cases/common/223 source set realistic example/boards/arm/arm.h +++ /dev/null @@ -1,12 +0,0 @@ -#ifndef ARM_H -#define ARM_H 1 - -#include "common.h" - -struct ARMBoard: Board { - const char *target(); - void some_arm_thing(); -}; - - -#endif diff --git a/test cases/common/223 source set realistic example/boards/arm/arm32.cc b/test cases/common/223 source set realistic example/boards/arm/arm32.cc deleted file mode 100644 index 72a2427..0000000 --- a/test cases/common/223 source set realistic example/boards/arm/arm32.cc +++ /dev/null @@ -1,8 +0,0 @@ -#include "common.h" -#include - -void initialize_target() -{ - std::cout << ANSI_START << "a different " << THE_TARGET - << " initialization" << ANSI_END << std::endl; -} diff --git a/test cases/common/223 source set realistic example/boards/arm/versatilepb.cc b/test cases/common/223 source set realistic example/boards/arm/versatilepb.cc deleted file mode 100644 index 3d1a9fe..0000000 --- a/test cases/common/223 source set realistic example/boards/arm/versatilepb.cc +++ /dev/null @@ -1,16 +0,0 @@ -#include -#include "common.h" -#include "arm.h" - -struct VersatilePBBoard: ARMBoard { - void say_hello(); -}; - -void VersatilePBBoard::say_hello() -{ - some_arm_thing(); - std::cout << ANSI_START << "I am the versatilepb board" - << ANSI_END << std::endl; -} - -static VersatilePBBoard versatilepb; diff --git a/test cases/common/223 source set realistic example/boards/arm/virt.cc b/test cases/common/223 source set realistic example/boards/arm/virt.cc deleted file mode 100644 index 6f9a1ca..0000000 --- a/test cases/common/223 source set realistic example/boards/arm/virt.cc +++ /dev/null @@ -1,16 +0,0 @@ -#include -#include "common.h" -#include "arm.h" - -struct VirtBoard: ARMBoard { - void say_hello(); -}; - -void VirtBoard::say_hello() -{ - some_arm_thing(); - std::cout << ANSI_START << "I am the virt board" - << ANSI_END << std::endl; -} - -static VirtBoard virt; diff --git a/test cases/common/223 source set realistic example/boards/arm/xlnx_zcu102.cc b/test cases/common/223 source set realistic example/boards/arm/xlnx_zcu102.cc deleted file mode 100644 index 8921e00..0000000 --- a/test cases/common/223 source set realistic example/boards/arm/xlnx_zcu102.cc +++ /dev/null @@ -1,16 +0,0 @@ -#include -#include "common.h" -#include "arm.h" - -struct XlnxZCU102Board: ARMBoard { - void say_hello(); -}; - -void XlnxZCU102Board::say_hello() -{ - some_arm_thing(); - std::cout << ANSI_START << "I am the xlnx_zcu102 board" - << ANSI_END << std::endl; -} - -static XlnxZCU102Board xlnx_zcu102; diff --git a/test cases/common/223 source set realistic example/boards/meson.build b/test cases/common/223 source set realistic example/boards/meson.build deleted file mode 100644 index 41ead4c..0000000 --- a/test cases/common/223 source set realistic example/boards/meson.build +++ /dev/null @@ -1,7 +0,0 @@ -specific.add(when: 'TARGET_ARM', if_true: files('arm/arm.cc', 'arm/arm32.cc')) -specific.add(when: 'TARGET_AARCH64', if_true: files('arm/arm.cc', 'arm/aarch64.cc')) -specific.add(when: 'CONFIG_VIRT', if_true: files('arm/virt.cc')) -specific.add(when: 'CONFIG_XLNX_ZCU102', if_true: files('arm/xlnx_zcu102.cc')) -specific.add(when: 'CONFIG_VERSATILEPB', if_true: files('arm/versatilepb.cc')) - -specific.add(when: 'TARGET_X86', if_true: files('x86/pc.cc')) diff --git a/test cases/common/223 source set realistic example/boards/x86/pc.cc b/test cases/common/223 source set realistic example/boards/x86/pc.cc deleted file mode 100644 index 04ec392..0000000 --- a/test cases/common/223 source set realistic example/boards/x86/pc.cc +++ /dev/null @@ -1,26 +0,0 @@ -#include -#include "common.h" - -struct X86Board: Board { - const char *target(); - void say_hello(); -}; - -const char *X86Board::target() -{ - return THE_TARGET; -} - -void X86Board::say_hello() -{ - std::cout << ANSI_START << "I am a 1996 PC" - << ANSI_END << std::endl; -} - -void initialize_target() -{ - std::cout << ANSI_START << "ready, set, go" - << ANSI_END << std::endl; -} - -static X86Board pc; diff --git a/test cases/common/223 source set realistic example/common.h b/test cases/common/223 source set realistic example/common.h deleted file mode 100644 index 6e325c7..0000000 --- a/test cases/common/223 source set realistic example/common.h +++ /dev/null @@ -1,41 +0,0 @@ -#ifndef COMMON_H -#define COMMON_H 1 - -/* - * target-specific code will print in yellow, common code will print - * in grey. - */ -#ifdef THE_TARGET -#define ANSI_START "\x1b[33;1m" -#define ANSI_END "\x1b[0m" -#else -#define ANSI_START "" -#define ANSI_END "" -#endif - -void some_random_function(); -void initialize_target(); - -struct Board { - Board *next; - Board(); - virtual ~Board(); - virtual void say_hello() = 0; - virtual const char *target() = 0; -}; - -struct Device { - Device *next; - Device(); - virtual ~Device(); - virtual void say_hello() = 0; -}; - -struct Dependency { - Dependency *next; - Dependency(); - virtual ~Dependency(); - virtual void initialize() = 0; -}; - -#endif diff --git a/test cases/common/223 source set realistic example/config/aarch64 b/test cases/common/223 source set realistic example/config/aarch64 deleted file mode 100644 index 55b90eb..0000000 --- a/test cases/common/223 source set realistic example/config/aarch64 +++ /dev/null @@ -1,5 +0,0 @@ -TARGET_AARCH64=y -CONFIG_VIRT=y -CONFIG_XLNX_ZCU102=y -CONFIG_VIRTIO=y -CONFIG_VIRTIO_MMIO=y diff --git a/test cases/common/223 source set realistic example/config/arm b/test cases/common/223 source set realistic example/config/arm deleted file mode 100644 index d3f7ac7..0000000 --- a/test cases/common/223 source set realistic example/config/arm +++ /dev/null @@ -1,3 +0,0 @@ -TARGET_ARM=y -CONFIG_VIRT=y -CONFIG_VERSATILEPB=y diff --git a/test cases/common/223 source set realistic example/config/x86 b/test cases/common/223 source set realistic example/config/x86 deleted file mode 100644 index 6caa3e2..0000000 --- a/test cases/common/223 source set realistic example/config/x86 +++ /dev/null @@ -1,4 +0,0 @@ -TARGET_X86=y -CONFIG_PC=y -CONFIG_VIRTIO=y -CONFIG_VIRTIO_PCI=y diff --git a/test cases/common/223 source set realistic example/devices/meson.build b/test cases/common/223 source set realistic example/devices/meson.build deleted file mode 100644 index 68ee68e..0000000 --- a/test cases/common/223 source set realistic example/devices/meson.build +++ /dev/null @@ -1,3 +0,0 @@ -specific.add(when: 'CONFIG_VIRTIO', if_true: files('virtio.cc')) -common.add(when: 'CONFIG_VIRTIO_PCI', if_true: files('virtio-pci.cc')) -common.add(when: 'CONFIG_VIRTIO_MMIO', if_true: files('virtio-mmio.cc')) diff --git a/test cases/common/223 source set realistic example/devices/virtio-mmio.cc b/test cases/common/223 source set realistic example/devices/virtio-mmio.cc deleted file mode 100644 index 5dab97e..0000000 --- a/test cases/common/223 source set realistic example/devices/virtio-mmio.cc +++ /dev/null @@ -1,16 +0,0 @@ -#include -#include "common.h" -#include "virtio.h" - -struct VirtioMMIODevice: VirtioDevice { - void say_hello(); -}; - -void VirtioMMIODevice::say_hello() -{ - some_virtio_thing(); - std::cout << ANSI_START << "virtio-mmio is available" - << ANSI_END << std::endl; -} - -static VirtioMMIODevice virtio_mmio; diff --git a/test cases/common/223 source set realistic example/devices/virtio-pci.cc b/test cases/common/223 source set realistic example/devices/virtio-pci.cc deleted file mode 100644 index 7df7a82..0000000 --- a/test cases/common/223 source set realistic example/devices/virtio-pci.cc +++ /dev/null @@ -1,16 +0,0 @@ -#include -#include "common.h" -#include "virtio.h" - -struct VirtioPCIDevice: VirtioDevice { - void say_hello(); -}; - -void VirtioPCIDevice::say_hello() -{ - some_virtio_thing(); - std::cout << ANSI_START << "virtio-pci is available" - << ANSI_END << std::endl; -} - -static VirtioPCIDevice virtio_pci; diff --git a/test cases/common/223 source set realistic example/devices/virtio.cc b/test cases/common/223 source set realistic example/devices/virtio.cc deleted file mode 100644 index fc51275..0000000 --- a/test cases/common/223 source set realistic example/devices/virtio.cc +++ /dev/null @@ -1,6 +0,0 @@ -#include -#include "common.h" -#include "virtio.h" - -void VirtioDevice::some_virtio_thing() { -} diff --git a/test cases/common/223 source set realistic example/devices/virtio.h b/test cases/common/223 source set realistic example/devices/virtio.h deleted file mode 100644 index a157731..0000000 --- a/test cases/common/223 source set realistic example/devices/virtio.h +++ /dev/null @@ -1,10 +0,0 @@ -#ifndef VIRTIO_H -#define VIRTIO_H 1 - -#include "common.h" - -struct VirtioDevice: Device { - void some_virtio_thing(); -}; - -#endif diff --git a/test cases/common/223 source set realistic example/main.cc b/test cases/common/223 source set realistic example/main.cc deleted file mode 100644 index 97afab1..0000000 --- a/test cases/common/223 source set realistic example/main.cc +++ /dev/null @@ -1,32 +0,0 @@ -#include -#include -#include "common.h" - -Board* boards; -Device* devices; -Dependency* deps; - -Board::Board() { this->next = boards; boards = this; } -Board::~Board() {} - -Device::Device() { this->next = devices; devices = this; } -Device::~Device() {} - -Dependency::Dependency() { this->next = deps; deps = this; } -Dependency::~Dependency() {} - -int main() -{ - some_random_function(); - for (auto d = deps; d; d = d->next) - d->initialize(); - - initialize_target(); - for (auto b = boards; b; b = b->next) { - std::cout << ANSI_START << b->target() << " - " << ANSI_END; - b->say_hello(); - } - - for (auto d = devices; d; d = d->next) - d->say_hello(); -} diff --git a/test cases/common/223 source set realistic example/meson.build b/test cases/common/223 source set realistic example/meson.build deleted file mode 100644 index 2a9475a..0000000 --- a/test cases/common/223 source set realistic example/meson.build +++ /dev/null @@ -1,50 +0,0 @@ -# a sort-of realistic example that combines the sourceset and kconfig -# modules, inspired by QEMU's build system - -project('sourceset-example', 'cpp') - -cppid = meson.get_compiler('cpp').get_id() -if cppid == 'pgi' - error('MESON_SKIP_TEST: Even PGI 19.4 that claims C++17 full support, cannot handle auto x = y syntax used in this test.') -endif - -ss = import('sourceset') -kconfig = import('unstable-kconfig') - -zlib = dependency('zlib', version : '>=1.2.8', required: false) -not_found = dependency('not-found', required: false) - -common = ss.source_set() -specific = ss.source_set() - -common.add(files('main.cc')) -common.add(when: zlib, if_true: files('zlib.cc')) -common.add(when: not_found, - if_true: files('was-found.cc'), - if_false: files('not-found.cc')) - -subdir('boards') -subdir('devices') - -if meson.is_unity() - specific.add_all(common) - common = ss.source_set() -endif - -common_lib = static_library('common', common.all_sources()) - -targets = [ 'arm', 'aarch64', 'x86' ] -target_dirs = { 'arm' : 'arm', 'aarch64' : 'arm', 'x86': 'x86' } - -foreach x : targets - config = kconfig.load('config' / x) - target_specific = specific.apply(config, strict: false) - target_common = common.apply(config, strict: false) - target_deps = target_specific.dependencies() + target_common.dependencies() - executable(x, - objects: common_lib.extract_objects(target_common.sources()), - sources: target_specific.sources(), - dependencies: target_deps, - include_directories: 'boards' / target_dirs[x], - cpp_args: '-DTHE_TARGET="' + x + '"') -endforeach diff --git a/test cases/common/223 source set realistic example/not-found.cc b/test cases/common/223 source set realistic example/not-found.cc deleted file mode 100644 index 955a7a2..0000000 --- a/test cases/common/223 source set realistic example/not-found.cc +++ /dev/null @@ -1,8 +0,0 @@ -#include -#include "common.h" - -void some_random_function() -{ - std::cout << ANSI_START << "everything's alright" - << ANSI_END << std::endl; -} diff --git a/test cases/common/223 source set realistic example/was-found.cc b/test cases/common/223 source set realistic example/was-found.cc deleted file mode 100644 index f1eaf1e..0000000 --- a/test cases/common/223 source set realistic example/was-found.cc +++ /dev/null @@ -1,7 +0,0 @@ -#include - -void some_random_function() -{ - std::cout << ANSI_START << "huh?" - << ANSI_END << std::endl; -} diff --git a/test cases/common/223 source set realistic example/zlib.cc b/test cases/common/223 source set realistic example/zlib.cc deleted file mode 100644 index 909d744..0000000 --- a/test cases/common/223 source set realistic example/zlib.cc +++ /dev/null @@ -1,13 +0,0 @@ -#include -#include "common.h" - -struct ZLibDependency : Dependency { - void initialize(); -}; - -void ZLibDependency::initialize() { - std::cout << ANSI_START << "hello from zlib" - << ANSI_END << std::endl; -} - -ZLibDependency zlib; diff --git a/test cases/common/28 find program/meson.build b/test cases/common/28 find program/meson.build new file mode 100644 index 0000000..983b7b4 --- /dev/null +++ b/test cases/common/28 find program/meson.build @@ -0,0 +1,29 @@ +project('find program', 'c') + +if build_machine.system() == 'windows' + # Things Windows does not provide: + # - an executable to copy files without prompting + # - working command line quoting + # - anything that you might actually need + # Because of these reasons we only check that + # the program can be found. + cp = find_program('xcopy') +else + cp = find_program('donotfindme', 'cp') + gen = generator(cp, \ + output : '@BASENAME@.c', \ + arguments : ['@INPUT@', '@OUTPUT@']) + + generated = gen.process('source.in') + e = executable('prog', generated) + test('external exe', e) +endif + +prog = find_program('print-version.py', version : '>=2.0', required : false) +assert(not prog.found(), 'Version should be too old') + +prog = find_program('print-version.py', version : '>=1.0') +assert(prog.found(), 'Program version should match') + +prog = find_program('print-version-with-prefix.py', version : '>=1.0') +assert(prog.found(), 'Program version should match') diff --git a/test cases/common/28 find program/print-version-with-prefix.py b/test cases/common/28 find program/print-version-with-prefix.py new file mode 100644 index 0000000..520e0ba --- /dev/null +++ b/test cases/common/28 find program/print-version-with-prefix.py @@ -0,0 +1,8 @@ +#!/usr/bin/env python3 + +import sys + +if len(sys.argv) != 2 or sys.argv[1] != '--version': + exit(1) + +print('Version: 1.0') diff --git a/test cases/common/28 find program/print-version.py b/test cases/common/28 find program/print-version.py new file mode 100644 index 0000000..4a78e5b --- /dev/null +++ b/test cases/common/28 find program/print-version.py @@ -0,0 +1,8 @@ +#!/usr/bin/env python3 + +import sys + +if len(sys.argv) != 2 or sys.argv[1] != '--version': + exit(1) + +print('1.0') diff --git a/test cases/common/28 find program/source.in b/test cases/common/28 find program/source.in new file mode 100644 index 0000000..5c2fa9b --- /dev/null +++ b/test cases/common/28 find program/source.in @@ -0,0 +1,3 @@ +int main(int argc, char **argv) { + return 0; +} diff --git a/test cases/common/29 find program/meson.build b/test cases/common/29 find program/meson.build deleted file mode 100644 index 983b7b4..0000000 --- a/test cases/common/29 find program/meson.build +++ /dev/null @@ -1,29 +0,0 @@ -project('find program', 'c') - -if build_machine.system() == 'windows' - # Things Windows does not provide: - # - an executable to copy files without prompting - # - working command line quoting - # - anything that you might actually need - # Because of these reasons we only check that - # the program can be found. - cp = find_program('xcopy') -else - cp = find_program('donotfindme', 'cp') - gen = generator(cp, \ - output : '@BASENAME@.c', \ - arguments : ['@INPUT@', '@OUTPUT@']) - - generated = gen.process('source.in') - e = executable('prog', generated) - test('external exe', e) -endif - -prog = find_program('print-version.py', version : '>=2.0', required : false) -assert(not prog.found(), 'Version should be too old') - -prog = find_program('print-version.py', version : '>=1.0') -assert(prog.found(), 'Program version should match') - -prog = find_program('print-version-with-prefix.py', version : '>=1.0') -assert(prog.found(), 'Program version should match') diff --git a/test cases/common/29 find program/print-version-with-prefix.py b/test cases/common/29 find program/print-version-with-prefix.py deleted file mode 100644 index 520e0ba..0000000 --- a/test cases/common/29 find program/print-version-with-prefix.py +++ /dev/null @@ -1,8 +0,0 @@ -#!/usr/bin/env python3 - -import sys - -if len(sys.argv) != 2 or sys.argv[1] != '--version': - exit(1) - -print('Version: 1.0') diff --git a/test cases/common/29 find program/print-version.py b/test cases/common/29 find program/print-version.py deleted file mode 100644 index 4a78e5b..0000000 --- a/test cases/common/29 find program/print-version.py +++ /dev/null @@ -1,8 +0,0 @@ -#!/usr/bin/env python3 - -import sys - -if len(sys.argv) != 2 or sys.argv[1] != '--version': - exit(1) - -print('1.0') diff --git a/test cases/common/29 find program/source.in b/test cases/common/29 find program/source.in deleted file mode 100644 index 5c2fa9b..0000000 --- a/test cases/common/29 find program/source.in +++ /dev/null @@ -1,3 +0,0 @@ -int main(int argc, char **argv) { - return 0; -} diff --git a/test cases/common/29 multiline string/meson.build b/test cases/common/29 multiline string/meson.build new file mode 100644 index 0000000..262cb15 --- /dev/null +++ b/test cases/common/29 multiline string/meson.build @@ -0,0 +1,35 @@ +project('multiline string', 'c') + +x = '''hello again''' +y = '''hello +again''' + +if x == y + error('Things are wrong.') +endif + +multieol = ''' +''' +singleeol = '\n' + +if multieol != singleeol + error('Newline quoting is broken.') +endif + +# And one more for good measure. +quote1 = ''' ' '''.strip() +quote2 = '\'' + +if quote1 != quote2 + error('Single quote quoting is broken.') +endif + +cc = meson.get_compiler('c') +prog = ''' +int main(int argc, char **argv) { + int num = 1; + printf("%d\n", num); + return 0; +}''' + +assert(cc.compiles(prog), 'multline test compile failed') diff --git a/test cases/common/30 multiline string/meson.build b/test cases/common/30 multiline string/meson.build deleted file mode 100644 index 262cb15..0000000 --- a/test cases/common/30 multiline string/meson.build +++ /dev/null @@ -1,35 +0,0 @@ -project('multiline string', 'c') - -x = '''hello again''' -y = '''hello -again''' - -if x == y - error('Things are wrong.') -endif - -multieol = ''' -''' -singleeol = '\n' - -if multieol != singleeol - error('Newline quoting is broken.') -endif - -# And one more for good measure. -quote1 = ''' ' '''.strip() -quote2 = '\'' - -if quote1 != quote2 - error('Single quote quoting is broken.') -endif - -cc = meson.get_compiler('c') -prog = ''' -int main(int argc, char **argv) { - int num = 1; - printf("%d\n", num); - return 0; -}''' - -assert(cc.compiles(prog), 'multline test compile failed') diff --git a/test cases/common/30 try compile/invalid.c b/test cases/common/30 try compile/invalid.c new file mode 100644 index 0000000..b623bf8 --- /dev/null +++ b/test cases/common/30 try compile/invalid.c @@ -0,0 +1,2 @@ +#include +void func() { printf("This won't work.\n"); } diff --git a/test cases/common/30 try compile/meson.build b/test cases/common/30 try compile/meson.build new file mode 100644 index 0000000..09ca395 --- /dev/null +++ b/test cases/common/30 try compile/meson.build @@ -0,0 +1,27 @@ +project('try compile', 'c', 'cpp') + +code = '''#include +void func() { printf("Something.\n"); } +''' + +breakcode = '''#include +void func() { printf("This won't work.\n"); } +''' + +foreach compiler : [meson.get_compiler('c'), meson.get_compiler('cpp')] + if compiler.compiles(code, name : 'should succeed') == false + error('Compiler ' + compiler.get_id() + ' is fail.') + endif + + if compiler.compiles(files('valid.c'), name : 'should succeed') == false + error('Compiler ' + compiler.get_id() + ' is fail.') + endif + + if compiler.compiles(breakcode, name : 'should fail') + error('Compiler ' + compiler.get_id() + ' returned true on broken code.') + endif + + if compiler.compiles(files('invalid.c'), name : 'should fail') + error('Compiler ' + compiler.get_id() + ' returned true on broken code.') + endif +endforeach diff --git a/test cases/common/30 try compile/valid.c b/test cases/common/30 try compile/valid.c new file mode 100644 index 0000000..3757f5a --- /dev/null +++ b/test cases/common/30 try compile/valid.c @@ -0,0 +1,2 @@ +#include +void func() { printf("Something.\n"); } diff --git a/test cases/common/31 compiler id/meson.build b/test cases/common/31 compiler id/meson.build new file mode 100644 index 0000000..2b5c445 --- /dev/null +++ b/test cases/common/31 compiler id/meson.build @@ -0,0 +1,7 @@ +project('compiler id', 'c') + +comp = meson.get_compiler('c') +str = comp.get_id() + +message('Compiler name is:') +message(str) diff --git a/test cases/common/31 try compile/invalid.c b/test cases/common/31 try compile/invalid.c deleted file mode 100644 index b623bf8..0000000 --- a/test cases/common/31 try compile/invalid.c +++ /dev/null @@ -1,2 +0,0 @@ -#include -void func() { printf("This won't work.\n"); } diff --git a/test cases/common/31 try compile/meson.build b/test cases/common/31 try compile/meson.build deleted file mode 100644 index 09ca395..0000000 --- a/test cases/common/31 try compile/meson.build +++ /dev/null @@ -1,27 +0,0 @@ -project('try compile', 'c', 'cpp') - -code = '''#include -void func() { printf("Something.\n"); } -''' - -breakcode = '''#include -void func() { printf("This won't work.\n"); } -''' - -foreach compiler : [meson.get_compiler('c'), meson.get_compiler('cpp')] - if compiler.compiles(code, name : 'should succeed') == false - error('Compiler ' + compiler.get_id() + ' is fail.') - endif - - if compiler.compiles(files('valid.c'), name : 'should succeed') == false - error('Compiler ' + compiler.get_id() + ' is fail.') - endif - - if compiler.compiles(breakcode, name : 'should fail') - error('Compiler ' + compiler.get_id() + ' returned true on broken code.') - endif - - if compiler.compiles(files('invalid.c'), name : 'should fail') - error('Compiler ' + compiler.get_id() + ' returned true on broken code.') - endif -endforeach diff --git a/test cases/common/31 try compile/valid.c b/test cases/common/31 try compile/valid.c deleted file mode 100644 index 3757f5a..0000000 --- a/test cases/common/31 try compile/valid.c +++ /dev/null @@ -1,2 +0,0 @@ -#include -void func() { printf("Something.\n"); } diff --git a/test cases/common/32 compiler id/meson.build b/test cases/common/32 compiler id/meson.build deleted file mode 100644 index 2b5c445..0000000 --- a/test cases/common/32 compiler id/meson.build +++ /dev/null @@ -1,7 +0,0 @@ -project('compiler id', 'c') - -comp = meson.get_compiler('c') -str = comp.get_id() - -message('Compiler name is:') -message(str) diff --git a/test cases/common/32 sizeof/config.h.in b/test cases/common/32 sizeof/config.h.in new file mode 100644 index 0000000..a442e8a --- /dev/null +++ b/test cases/common/32 sizeof/config.h.in @@ -0,0 +1,2 @@ +#define INTSIZE @INTSIZE@ +#define WCHARSIZE @WCHARSIZE@ diff --git a/test cases/common/32 sizeof/meson.build b/test cases/common/32 sizeof/meson.build new file mode 100644 index 0000000..9de5b78 --- /dev/null +++ b/test cases/common/32 sizeof/meson.build @@ -0,0 +1,33 @@ +project('sizeof', 'c', 'cpp') + +# Test with C +cc = meson.get_compiler('c') + +intsize = cc.sizeof('int') +wcharsize = cc.sizeof('wchar_t', prefix : '#include') + +cd = configuration_data() +cd.set('INTSIZE', intsize) +cd.set('WCHARSIZE', wcharsize) +cd.set('CONFIG', 'config.h') +configure_file(input : 'config.h.in', output : 'config.h', configuration : cd) +s = configure_file(input : 'prog.c.in', output : 'prog.c', configuration : cd) + +e = executable('prog', s) +test('sizeof test', e) + +# Test with C++ +cpp = meson.get_compiler('cpp') + +intsize = cpp.sizeof('int') +wcharsize = cpp.sizeof('wchar_t', prefix : '#include') + +cdpp = configuration_data() +cdpp.set('INTSIZE', intsize) +cdpp.set('WCHARSIZE', wcharsize) +cdpp.set('CONFIG', 'config.hpp') +configure_file(input : 'config.h.in', output : 'config.hpp', configuration : cdpp) +spp = configure_file(input : 'prog.c.in', output : 'prog.cc', configuration : cdpp) + +epp = executable('progpp', spp) +test('sizeof test c++', epp) diff --git a/test cases/common/32 sizeof/prog.c.in b/test cases/common/32 sizeof/prog.c.in new file mode 100644 index 0000000..85b1229 --- /dev/null +++ b/test cases/common/32 sizeof/prog.c.in @@ -0,0 +1,15 @@ +#include "@CONFIG@" +#include +#include + +int main(int argc, char **argv) { + if(INTSIZE != sizeof(int)) { + fprintf(stderr, "Mismatch: detected int size %d, actual size %d.\n", INTSIZE, (int)sizeof(int)); + return 1; + } + if(WCHARSIZE != sizeof(wchar_t)) { + fprintf(stderr, "Mismatch: detected wchar size %d, actual size %d.\n", WCHARSIZE, (int)sizeof(wchar_t)); + return 1; + } + return 0; +} diff --git a/test cases/common/33 define10/config.h.in b/test cases/common/33 define10/config.h.in new file mode 100644 index 0000000..dc77346 --- /dev/null +++ b/test cases/common/33 define10/config.h.in @@ -0,0 +1,2 @@ +#mesondefine ONE +#mesondefine ZERO diff --git a/test cases/common/33 define10/meson.build b/test cases/common/33 define10/meson.build new file mode 100644 index 0000000..a28e7e4 --- /dev/null +++ b/test cases/common/33 define10/meson.build @@ -0,0 +1,12 @@ +project('set10test', 'c') + +conf = configuration_data() +conf.set10('ONE', true) +conf.set10('ZERO', false) + +configure_file(input : 'config.h.in', + output : 'config.h', + configuration : conf) + +exe = executable('prog', 'prog.c') +test('10test', exe) diff --git a/test cases/common/33 define10/prog.c b/test cases/common/33 define10/prog.c new file mode 100644 index 0000000..10e94f1 --- /dev/null +++ b/test cases/common/33 define10/prog.c @@ -0,0 +1,13 @@ +#include +#include"config.h" + +int main(int argc, char **argv) { + if(ONE != 1) { + fprintf(stderr, "ONE is not 1.\n"); + return 1; + } + if(ZERO != 0) { + fprintf(stderr, "ZERO is not 0.\n"); + } + return 0; +} diff --git a/test cases/common/33 sizeof/config.h.in b/test cases/common/33 sizeof/config.h.in deleted file mode 100644 index a442e8a..0000000 --- a/test cases/common/33 sizeof/config.h.in +++ /dev/null @@ -1,2 +0,0 @@ -#define INTSIZE @INTSIZE@ -#define WCHARSIZE @WCHARSIZE@ diff --git a/test cases/common/33 sizeof/meson.build b/test cases/common/33 sizeof/meson.build deleted file mode 100644 index 9de5b78..0000000 --- a/test cases/common/33 sizeof/meson.build +++ /dev/null @@ -1,33 +0,0 @@ -project('sizeof', 'c', 'cpp') - -# Test with C -cc = meson.get_compiler('c') - -intsize = cc.sizeof('int') -wcharsize = cc.sizeof('wchar_t', prefix : '#include') - -cd = configuration_data() -cd.set('INTSIZE', intsize) -cd.set('WCHARSIZE', wcharsize) -cd.set('CONFIG', 'config.h') -configure_file(input : 'config.h.in', output : 'config.h', configuration : cd) -s = configure_file(input : 'prog.c.in', output : 'prog.c', configuration : cd) - -e = executable('prog', s) -test('sizeof test', e) - -# Test with C++ -cpp = meson.get_compiler('cpp') - -intsize = cpp.sizeof('int') -wcharsize = cpp.sizeof('wchar_t', prefix : '#include') - -cdpp = configuration_data() -cdpp.set('INTSIZE', intsize) -cdpp.set('WCHARSIZE', wcharsize) -cdpp.set('CONFIG', 'config.hpp') -configure_file(input : 'config.h.in', output : 'config.hpp', configuration : cdpp) -spp = configure_file(input : 'prog.c.in', output : 'prog.cc', configuration : cdpp) - -epp = executable('progpp', spp) -test('sizeof test c++', epp) diff --git a/test cases/common/33 sizeof/prog.c.in b/test cases/common/33 sizeof/prog.c.in deleted file mode 100644 index 85b1229..0000000 --- a/test cases/common/33 sizeof/prog.c.in +++ /dev/null @@ -1,15 +0,0 @@ -#include "@CONFIG@" -#include -#include - -int main(int argc, char **argv) { - if(INTSIZE != sizeof(int)) { - fprintf(stderr, "Mismatch: detected int size %d, actual size %d.\n", INTSIZE, (int)sizeof(int)); - return 1; - } - if(WCHARSIZE != sizeof(wchar_t)) { - fprintf(stderr, "Mismatch: detected wchar size %d, actual size %d.\n", WCHARSIZE, (int)sizeof(wchar_t)); - return 1; - } - return 0; -} diff --git a/test cases/common/34 define10/config.h.in b/test cases/common/34 define10/config.h.in deleted file mode 100644 index dc77346..0000000 --- a/test cases/common/34 define10/config.h.in +++ /dev/null @@ -1,2 +0,0 @@ -#mesondefine ONE -#mesondefine ZERO diff --git a/test cases/common/34 define10/meson.build b/test cases/common/34 define10/meson.build deleted file mode 100644 index a28e7e4..0000000 --- a/test cases/common/34 define10/meson.build +++ /dev/null @@ -1,12 +0,0 @@ -project('set10test', 'c') - -conf = configuration_data() -conf.set10('ONE', true) -conf.set10('ZERO', false) - -configure_file(input : 'config.h.in', - output : 'config.h', - configuration : conf) - -exe = executable('prog', 'prog.c') -test('10test', exe) diff --git a/test cases/common/34 define10/prog.c b/test cases/common/34 define10/prog.c deleted file mode 100644 index 10e94f1..0000000 --- a/test cases/common/34 define10/prog.c +++ /dev/null @@ -1,13 +0,0 @@ -#include -#include"config.h" - -int main(int argc, char **argv) { - if(ONE != 1) { - fprintf(stderr, "ONE is not 1.\n"); - return 1; - } - if(ZERO != 0) { - fprintf(stderr, "ZERO is not 0.\n"); - } - return 0; -} diff --git a/test cases/common/34 has header/meson.build b/test cases/common/34 has header/meson.build new file mode 100644 index 0000000..b53849c --- /dev/null +++ b/test cases/common/34 has header/meson.build @@ -0,0 +1,54 @@ +project('has header', 'c', 'cpp') + +host_system = host_machine.system() + +non_existant_header = 'ouagadougou.h' + +# Copy it into the builddir to ensure that it isn't found even if it's there +configure_file(input : non_existant_header, + output : non_existant_header, + configuration : configuration_data()) + +# Test that the fallback to __has_include also works on all compilers +if host_system != 'darwin' + fallbacks = ['', '\n#undef __has_include'] +else + # On Darwin's clang you can't redefine builtin macros so the above doesn't work + fallbacks = [''] +endif + +foreach fallback : fallbacks + foreach comp : [meson.get_compiler('c'), meson.get_compiler('cpp')] + assert(comp.has_header('stdio.h', prefix : fallback), 'Stdio missing.') + + # stdio.h doesn't actually need stdlib.h, but just test that setting the + # prefix does not result in an error. + assert(comp.has_header('stdio.h', prefix : '#include ' + fallback), + 'Stdio missing.') + + # XInput.h should not require type definitions from windows.h, but it does + # require macro definitions. Specifically, it requires an arch setting for + # VS2015 at least. + # We only do this check on MSVC because MinGW often defines its own wrappers + # that pre-include windows.h + if comp.get_id() == 'msvc' + assert(comp.has_header('XInput.h', prefix : '#include ' + fallback), + 'XInput.h should not be missing on Windows') + assert(comp.has_header('XInput.h', prefix : '#define _X86_' + fallback), + 'XInput.h should not need windows.h') + endif + + # Test that the following GCC bug doesn't happen: + # https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80005 + # https://github.com/mesonbuild/meson/issues/1458 + if host_system == 'linux' + assert(comp.has_header('linux/if.h', prefix : fallback), + 'Could not find ') + endif + + # This header exists in the source and the builddir, but we still must not + # find it since we are looking in the system directories. + assert(not comp.has_header(non_existant_header, prefix : fallback), + 'Found non-existant header.') + endforeach +endforeach diff --git a/test cases/common/34 has header/ouagadougou.h b/test cases/common/34 has header/ouagadougou.h new file mode 100644 index 0000000..2f76c49 --- /dev/null +++ b/test cases/common/34 has header/ouagadougou.h @@ -0,0 +1 @@ +#define OMG_THIS_SHOULDNT_BE_FOUND diff --git a/test cases/common/35 has header/meson.build b/test cases/common/35 has header/meson.build deleted file mode 100644 index b53849c..0000000 --- a/test cases/common/35 has header/meson.build +++ /dev/null @@ -1,54 +0,0 @@ -project('has header', 'c', 'cpp') - -host_system = host_machine.system() - -non_existant_header = 'ouagadougou.h' - -# Copy it into the builddir to ensure that it isn't found even if it's there -configure_file(input : non_existant_header, - output : non_existant_header, - configuration : configuration_data()) - -# Test that the fallback to __has_include also works on all compilers -if host_system != 'darwin' - fallbacks = ['', '\n#undef __has_include'] -else - # On Darwin's clang you can't redefine builtin macros so the above doesn't work - fallbacks = [''] -endif - -foreach fallback : fallbacks - foreach comp : [meson.get_compiler('c'), meson.get_compiler('cpp')] - assert(comp.has_header('stdio.h', prefix : fallback), 'Stdio missing.') - - # stdio.h doesn't actually need stdlib.h, but just test that setting the - # prefix does not result in an error. - assert(comp.has_header('stdio.h', prefix : '#include ' + fallback), - 'Stdio missing.') - - # XInput.h should not require type definitions from windows.h, but it does - # require macro definitions. Specifically, it requires an arch setting for - # VS2015 at least. - # We only do this check on MSVC because MinGW often defines its own wrappers - # that pre-include windows.h - if comp.get_id() == 'msvc' - assert(comp.has_header('XInput.h', prefix : '#include ' + fallback), - 'XInput.h should not be missing on Windows') - assert(comp.has_header('XInput.h', prefix : '#define _X86_' + fallback), - 'XInput.h should not need windows.h') - endif - - # Test that the following GCC bug doesn't happen: - # https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80005 - # https://github.com/mesonbuild/meson/issues/1458 - if host_system == 'linux' - assert(comp.has_header('linux/if.h', prefix : fallback), - 'Could not find ') - endif - - # This header exists in the source and the builddir, but we still must not - # find it since we are looking in the system directories. - assert(not comp.has_header(non_existant_header, prefix : fallback), - 'Found non-existant header.') - endforeach -endforeach diff --git a/test cases/common/35 has header/ouagadougou.h b/test cases/common/35 has header/ouagadougou.h deleted file mode 100644 index 2f76c49..0000000 --- a/test cases/common/35 has header/ouagadougou.h +++ /dev/null @@ -1 +0,0 @@ -#define OMG_THIS_SHOULDNT_BE_FOUND diff --git a/test cases/common/35 run program/get-version.py b/test cases/common/35 run program/get-version.py new file mode 100644 index 0000000..a22d559 --- /dev/null +++ b/test cases/common/35 run program/get-version.py @@ -0,0 +1,3 @@ +#!/usr/bin/env python3 + +print('1.2') diff --git a/test cases/common/35 run program/meson.build b/test cases/common/35 run program/meson.build new file mode 100644 index 0000000..93897e3 --- /dev/null +++ b/test cases/common/35 run program/meson.build @@ -0,0 +1,79 @@ +project('run command', version : run_command('get-version.py', check : true).stdout().strip()) + +if build_machine.system() == 'windows' + c = run_command('cmd', '/c', 'echo', 'hello') +else + c = run_command('echo', 'hello') +endif + +correct = 'hello' + +if c.returncode() != 0 + error('Executing echo failed.') +endif + +result = c.stdout().strip() + +if result != correct + error('Getting stdout failed.') +endif + +if c.stderr() != '' + error('Extra text in stderr.') +endif + +# Now the same with a script. + +if build_machine.system() == 'windows' + cs = run_command('scripts/hello.bat') +else + cs = run_command('scripts/hello.sh') +endif + +if cs.returncode() != 0 + error('Executing script failed.') +endif + +if cs.stdout().strip() != correct + error('Getting stdout failed (script).') +endif + +if cs.stderr() != '' + error('Extra text in stderr (script).') +endif + +# We should be able to have files() in argument +f = files('meson.build') + +if build_machine.system() == 'windows' + c = run_command('cmd', '/c', 'echo', f) +else + c = run_command('echo', f) +endif + +if c.returncode() != 0 + error('Using files() in argument failed.') +endif + +py3 = import('python3').find_python() + +ret = run_command(py3, '-c', 'print("some output")') +assert(ret.returncode() == 0, 'failed to run python3: ' + ret.stderr()) +assert(ret.stdout() == 'some output\n', 'failed to run python3') + +ret = run_command(py3, '-c', 'print("some output")', capture : false) +assert(ret.returncode() == 0, 'failed to run python3: ' + ret.stderr()) +assert(ret.stdout() == '', 'stdout is "@0@" instead of empty'.format(ret.stdout())) + +c_env = environment() +c_env.append('CUSTOM_ENV_VAR', 'FOOBAR') +ret = run_command(py3, '-c', 'import os; print(os.environ.get("CUSTOM_ENV_VAR"))', env : c_env) +assert(ret.returncode() == 0, 'failed to run python3: ' + ret.stderr()) +assert(ret.stdout() == 'FOOBAR\n', 'stdout is "@0@" instead of FOOBAR'.format(ret.stdout())) + +dd = find_program('dd', required : false) +if dd.found() + ret = run_command(dd, 'if=/dev/urandom', 'bs=10', 'count=1', capture: false) + assert(ret.returncode() == 0, 'failed to run dd: ' + ret.stderr()) + assert(ret.stdout() == '', 'stdout is "@0@" instead of empty'.format(ret.stdout())) +endif diff --git a/test cases/common/35 run program/scripts/hello.bat b/test cases/common/35 run program/scripts/hello.bat new file mode 100644 index 0000000..cbc346b --- /dev/null +++ b/test cases/common/35 run program/scripts/hello.bat @@ -0,0 +1,2 @@ +@ECHO OFF +ECHO hello diff --git a/test cases/common/35 run program/scripts/hello.sh b/test cases/common/35 run program/scripts/hello.sh new file mode 100755 index 0000000..2a22daa --- /dev/null +++ b/test cases/common/35 run program/scripts/hello.sh @@ -0,0 +1,3 @@ +#!/bin/sh + +echo hello diff --git a/test cases/common/36 run program/get-version.py b/test cases/common/36 run program/get-version.py deleted file mode 100644 index a22d559..0000000 --- a/test cases/common/36 run program/get-version.py +++ /dev/null @@ -1,3 +0,0 @@ -#!/usr/bin/env python3 - -print('1.2') diff --git a/test cases/common/36 run program/meson.build b/test cases/common/36 run program/meson.build deleted file mode 100644 index 93897e3..0000000 --- a/test cases/common/36 run program/meson.build +++ /dev/null @@ -1,79 +0,0 @@ -project('run command', version : run_command('get-version.py', check : true).stdout().strip()) - -if build_machine.system() == 'windows' - c = run_command('cmd', '/c', 'echo', 'hello') -else - c = run_command('echo', 'hello') -endif - -correct = 'hello' - -if c.returncode() != 0 - error('Executing echo failed.') -endif - -result = c.stdout().strip() - -if result != correct - error('Getting stdout failed.') -endif - -if c.stderr() != '' - error('Extra text in stderr.') -endif - -# Now the same with a script. - -if build_machine.system() == 'windows' - cs = run_command('scripts/hello.bat') -else - cs = run_command('scripts/hello.sh') -endif - -if cs.returncode() != 0 - error('Executing script failed.') -endif - -if cs.stdout().strip() != correct - error('Getting stdout failed (script).') -endif - -if cs.stderr() != '' - error('Extra text in stderr (script).') -endif - -# We should be able to have files() in argument -f = files('meson.build') - -if build_machine.system() == 'windows' - c = run_command('cmd', '/c', 'echo', f) -else - c = run_command('echo', f) -endif - -if c.returncode() != 0 - error('Using files() in argument failed.') -endif - -py3 = import('python3').find_python() - -ret = run_command(py3, '-c', 'print("some output")') -assert(ret.returncode() == 0, 'failed to run python3: ' + ret.stderr()) -assert(ret.stdout() == 'some output\n', 'failed to run python3') - -ret = run_command(py3, '-c', 'print("some output")', capture : false) -assert(ret.returncode() == 0, 'failed to run python3: ' + ret.stderr()) -assert(ret.stdout() == '', 'stdout is "@0@" instead of empty'.format(ret.stdout())) - -c_env = environment() -c_env.append('CUSTOM_ENV_VAR', 'FOOBAR') -ret = run_command(py3, '-c', 'import os; print(os.environ.get("CUSTOM_ENV_VAR"))', env : c_env) -assert(ret.returncode() == 0, 'failed to run python3: ' + ret.stderr()) -assert(ret.stdout() == 'FOOBAR\n', 'stdout is "@0@" instead of FOOBAR'.format(ret.stdout())) - -dd = find_program('dd', required : false) -if dd.found() - ret = run_command(dd, 'if=/dev/urandom', 'bs=10', 'count=1', capture: false) - assert(ret.returncode() == 0, 'failed to run dd: ' + ret.stderr()) - assert(ret.stdout() == '', 'stdout is "@0@" instead of empty'.format(ret.stdout())) -endif diff --git a/test cases/common/36 run program/scripts/hello.bat b/test cases/common/36 run program/scripts/hello.bat deleted file mode 100644 index cbc346b..0000000 --- a/test cases/common/36 run program/scripts/hello.bat +++ /dev/null @@ -1,2 +0,0 @@ -@ECHO OFF -ECHO hello diff --git a/test cases/common/36 run program/scripts/hello.sh b/test cases/common/36 run program/scripts/hello.sh deleted file mode 100755 index 2a22daa..0000000 --- a/test cases/common/36 run program/scripts/hello.sh +++ /dev/null @@ -1,3 +0,0 @@ -#!/bin/sh - -echo hello diff --git a/test cases/common/36 tryrun/error.c b/test cases/common/36 tryrun/error.c new file mode 100644 index 0000000..80eeb5d --- /dev/null +++ b/test cases/common/36 tryrun/error.c @@ -0,0 +1,3 @@ +int main(int argc, char **argv) { + return 1; +} diff --git a/test cases/common/36 tryrun/meson.build b/test cases/common/36 tryrun/meson.build new file mode 100644 index 0000000..c64446f --- /dev/null +++ b/test cases/common/36 tryrun/meson.build @@ -0,0 +1,78 @@ +project('tryrun', 'c', 'cpp') + +# Complex to exercise all code paths. +if meson.is_cross_build() + if meson.has_exe_wrapper() + compilers = [meson.get_compiler('c', native : false), meson.get_compiler('cpp', native : false)] + else + compilers = [meson.get_compiler('c', native : true), meson.get_compiler('cpp', native : true)] + endif +else + compilers = [meson.get_compiler('c'), meson.get_compiler('cpp')] +endif + +ok_code = '''#include +int main(int argc, char **argv) { + printf("%s\n", "stdout"); + fprintf(stderr, "%s\n", "stderr"); + return 0; +} +''' + +error_code = '''int main(int argc, char **argv) { + return 1; +} +''' + +no_compile_code = '''int main(int argc, char **argv) { +''' + +INPUTS = [ + ['String', ok_code, error_code, no_compile_code], + ['File', files('ok.c'), files('error.c'), files('no_compile.c')], +] + +foreach cc : compilers + foreach input : INPUTS + type = input[0] + ok = cc.run(input[1], name : type + ' should succeed') + err = cc.run(input[2], name : type + ' should fail') + noc = cc.run(input[3], name : type + ' does not compile') + + if noc.compiled() + error(type + ' compilation fail test failed.') + else + message(type + ' fail detected properly.') + endif + + if ok.compiled() + message(type + ' compilation worked.') + else + error(type + ' compilation did not work.') + endif + + if ok.returncode() == 0 + message(type + ' return code ok.') + else + error(type + ' return code fail') + endif + + if err.returncode() == 1 + message(type + ' bad return code ok.') + else + error(type + ' bad return code fail.') + endif + + if ok.stdout().strip() == 'stdout' + message(type + ' stdout ok.') + else + message(type + ' bad stdout.') + endif + + if ok.stderr().strip() == 'stderr' + message(type + ' stderr ok.') + else + message(type + ' bad stderr.') + endif + endforeach +endforeach diff --git a/test cases/common/36 tryrun/no_compile.c b/test cases/common/36 tryrun/no_compile.c new file mode 100644 index 0000000..86b67ac --- /dev/null +++ b/test cases/common/36 tryrun/no_compile.c @@ -0,0 +1 @@ +int main(int argc, char **argv) { diff --git a/test cases/common/36 tryrun/ok.c b/test cases/common/36 tryrun/ok.c new file mode 100644 index 0000000..4111c74 --- /dev/null +++ b/test cases/common/36 tryrun/ok.c @@ -0,0 +1,6 @@ +#include +int main(int argc, char **argv) { + printf("%s\n", "stdout"); + fprintf(stderr, "%s\n", "stderr"); + return 0; +} diff --git a/test cases/common/37 logic ops/meson.build b/test cases/common/37 logic ops/meson.build new file mode 100644 index 0000000..897054e --- /dev/null +++ b/test cases/common/37 logic ops/meson.build @@ -0,0 +1,95 @@ +project('logicopts', 'c') + +t = true +f = false + +if (true) + message('Ok.') +else + error('Not ok.') +endif + +if (false) + error('Not ok.') +else + message('Ok.') +endif + +if (f) + error('Not ok.') +else + message('Ok.') +endif + +if (t) + message('Ok.') +else + error('Not ok.') +endif + +if true and t + message('Ok.') +else + error('Not ok.') +endif + +if t and false + error('Not ok.') +else + message('Ok.') +endif + +if f and t + error('Not ok.') +else + message('Ok.') +endif + +if f or false + error('Not ok.') +else + message('Ok.') +endif + +if true or f + message('Ok.') +else + error('Not ok.') +endif + +if t or true + message('Ok.') +else + error('Not ok.') +endif + +if not true + error('Negation failed.') +else + message('Ok.') +endif + +if not f + message('Ok.') +else + error('Negation failed.') +endif + + +if f or f or f or f or f or f or f or f or t + message('Ok.') +else + error('Chain of ors failed.') +endif + +if t and t and t and t and t and t and t and t and f + error('Chain of ands failed.') +else + message('Ok.') +endif + +if t and t or t + message('Ok.') +else + error('Combination of and-or failed.') +endif diff --git a/test cases/common/37 tryrun/error.c b/test cases/common/37 tryrun/error.c deleted file mode 100644 index 80eeb5d..0000000 --- a/test cases/common/37 tryrun/error.c +++ /dev/null @@ -1,3 +0,0 @@ -int main(int argc, char **argv) { - return 1; -} diff --git a/test cases/common/37 tryrun/meson.build b/test cases/common/37 tryrun/meson.build deleted file mode 100644 index c64446f..0000000 --- a/test cases/common/37 tryrun/meson.build +++ /dev/null @@ -1,78 +0,0 @@ -project('tryrun', 'c', 'cpp') - -# Complex to exercise all code paths. -if meson.is_cross_build() - if meson.has_exe_wrapper() - compilers = [meson.get_compiler('c', native : false), meson.get_compiler('cpp', native : false)] - else - compilers = [meson.get_compiler('c', native : true), meson.get_compiler('cpp', native : true)] - endif -else - compilers = [meson.get_compiler('c'), meson.get_compiler('cpp')] -endif - -ok_code = '''#include -int main(int argc, char **argv) { - printf("%s\n", "stdout"); - fprintf(stderr, "%s\n", "stderr"); - return 0; -} -''' - -error_code = '''int main(int argc, char **argv) { - return 1; -} -''' - -no_compile_code = '''int main(int argc, char **argv) { -''' - -INPUTS = [ - ['String', ok_code, error_code, no_compile_code], - ['File', files('ok.c'), files('error.c'), files('no_compile.c')], -] - -foreach cc : compilers - foreach input : INPUTS - type = input[0] - ok = cc.run(input[1], name : type + ' should succeed') - err = cc.run(input[2], name : type + ' should fail') - noc = cc.run(input[3], name : type + ' does not compile') - - if noc.compiled() - error(type + ' compilation fail test failed.') - else - message(type + ' fail detected properly.') - endif - - if ok.compiled() - message(type + ' compilation worked.') - else - error(type + ' compilation did not work.') - endif - - if ok.returncode() == 0 - message(type + ' return code ok.') - else - error(type + ' return code fail') - endif - - if err.returncode() == 1 - message(type + ' bad return code ok.') - else - error(type + ' bad return code fail.') - endif - - if ok.stdout().strip() == 'stdout' - message(type + ' stdout ok.') - else - message(type + ' bad stdout.') - endif - - if ok.stderr().strip() == 'stderr' - message(type + ' stderr ok.') - else - message(type + ' bad stderr.') - endif - endforeach -endforeach diff --git a/test cases/common/37 tryrun/no_compile.c b/test cases/common/37 tryrun/no_compile.c deleted file mode 100644 index 86b67ac..0000000 --- a/test cases/common/37 tryrun/no_compile.c +++ /dev/null @@ -1 +0,0 @@ -int main(int argc, char **argv) { diff --git a/test cases/common/37 tryrun/ok.c b/test cases/common/37 tryrun/ok.c deleted file mode 100644 index 4111c74..0000000 --- a/test cases/common/37 tryrun/ok.c +++ /dev/null @@ -1,6 +0,0 @@ -#include -int main(int argc, char **argv) { - printf("%s\n", "stdout"); - fprintf(stderr, "%s\n", "stderr"); - return 0; -} diff --git a/test cases/common/38 logic ops/meson.build b/test cases/common/38 logic ops/meson.build deleted file mode 100644 index 897054e..0000000 --- a/test cases/common/38 logic ops/meson.build +++ /dev/null @@ -1,95 +0,0 @@ -project('logicopts', 'c') - -t = true -f = false - -if (true) - message('Ok.') -else - error('Not ok.') -endif - -if (false) - error('Not ok.') -else - message('Ok.') -endif - -if (f) - error('Not ok.') -else - message('Ok.') -endif - -if (t) - message('Ok.') -else - error('Not ok.') -endif - -if true and t - message('Ok.') -else - error('Not ok.') -endif - -if t and false - error('Not ok.') -else - message('Ok.') -endif - -if f and t - error('Not ok.') -else - message('Ok.') -endif - -if f or false - error('Not ok.') -else - message('Ok.') -endif - -if true or f - message('Ok.') -else - error('Not ok.') -endif - -if t or true - message('Ok.') -else - error('Not ok.') -endif - -if not true - error('Negation failed.') -else - message('Ok.') -endif - -if not f - message('Ok.') -else - error('Negation failed.') -endif - - -if f or f or f or f or f or f or f or f or t - message('Ok.') -else - error('Chain of ors failed.') -endif - -if t and t and t and t and t and t and t and t and f - error('Chain of ands failed.') -else - message('Ok.') -endif - -if t and t or t - message('Ok.') -else - error('Combination of and-or failed.') -endif diff --git a/test cases/common/38 string operations/meson.build b/test cases/common/38 string operations/meson.build new file mode 100644 index 0000000..6596142 --- /dev/null +++ b/test cases/common/38 string operations/meson.build @@ -0,0 +1,103 @@ +project('string formatting', 'c') + +templ = '@0@bar@1@' + +assert(templ.format('foo', 'baz') == 'foobarbaz', 'Basic string formatting is broken.') + +assert('@0@'.format(1) == '1', 'String number formatting is broken.') + +assert('@0@'.format(true) == 'true', 'String boolean formatting is broken.') + +templ2 = '@0@' +subs2 = '42' + +assert(templ2.format(subs2) == '42', 'String formatting with variables is broken.') + +assert('@@0@@ @@1@@'.format(1, 2) == '@1@ @2@', 'String format is recursive.') + +long = 'abcde' +prefix = 'abc' +suffix = 'cde' + +assert(long.startswith(prefix), 'Prefix.') + +assert(not long.startswith(suffix), 'Not prefix.') + +assert(long.endswith(suffix), 'Suffix.') + +assert(not long.endswith(prefix), 'Not suffix.') + +assert(long.contains(prefix), 'Does not contain prefix') + +assert(long.contains(suffix), 'Does not contain suffix') + +assert(long.contains('bcd'), 'Does not contain middle part') + +assert(not long.contains('dc'), 'Broken contains') + +assert(long.to_upper() == 'ABCDE', 'Broken to_upper') + +assert(long.to_upper().to_lower() == long, 'Broken to_lower') + +assert('struct stat.st_foo'.underscorify() == 'struct_stat_st_foo', 'Broken underscorify') + +assert('#include '.underscorify() == '_include__foo_bar_h_', 'Broken underscorify') + +# case should not change, space should be replaced, numbers are ok too +assert('Do SomeThing 09'.underscorify() == 'Do_SomeThing_09', 'Broken underscorify') + +assert('3'.to_int() == 3, 'String int conversion does not work.') + +assert(true.to_string() == 'true', 'bool string conversion failed') +assert(false.to_string() == 'false', 'bool string conversion failed') +assert(true.to_string('yes', 'no') == 'yes', 'bool string conversion with args failed') +assert(false.to_string('yes', 'no') == 'no', 'bool string conversion with args failed') +assert('@0@'.format(true) == 'true', 'bool string formatting failed') + +assert(' '.join(['a', 'b', 'c']) == 'a b c', 'join() array broken') +assert(''.join(['a', 'b', 'c']) == 'abc', 'empty join() broken') +assert(' '.join(['a']) == 'a', 'single join broken') + +version_number = '1.2.8' + +assert(version_number.version_compare('>=1.2.8'), 'Version_compare gt broken') +assert(not version_number.version_compare('>1.2.8'), 'Version_compare greater broken') +assert(not version_number.version_compare('<1.2.8'), 'Version_compare less broken') +assert(version_number.version_compare('<=1.2.8'), 'Version_compare le broken') +assert(version_number.version_compare('==1.2.8'), 'Version_compare eq broken') +assert(not version_number.version_compare('!=1.2.8'), 'Version_compare neq broken') + +assert(version_number.version_compare('<2.0'), 'Version_compare major less broken') +assert(version_number.version_compare('>0.9'), 'Version_compare major greater broken') + +assert(' spaces tabs '.strip() == 'spaces tabs', 'Spaces and tabs badly stripped') +assert(''' +multiline string '''.strip() == '''multiline string''', 'Newlines badly stripped') +assert('"1.1.20"'.strip('"') == '1.1.20', '" badly stripped') +assert('"1.1.20"'.strip('".') == '1.1.20', '". badly stripped') +assert('"1.1.20" '.strip('" ') == '1.1.20', '". badly stripped') + +bs_c = '''\c''' +bs_bs_c = '''\\c''' +nl = ''' +''' +bs_n = '''\n''' +bs_nl = '''\ +''' +bs_bs_n = '''\\n''' +bs_bs_nl = '''\\ +''' +bs_bs = '''\\''' +bs = '''\''' + +assert('\c' == bs_c, 'Single backslash broken') +assert('\\c' == bs_c, 'Double backslash broken') +assert('\\\c' == bs_bs_c, 'Three backslash broken') +assert('\\\\c' == bs_bs_c, 'Four backslash broken') +assert('\n' == nl, 'Newline escape broken') +assert('\\n' == bs_n, 'Double backslash broken before n') +assert('\\\n' == bs_nl, 'Three backslash broken before n') +assert('\\\\n' == bs_bs_n, 'Four backslash broken before n') +assert('\\\\\n' == bs_bs_nl, 'Five backslash broken before n') +assert('\\\\' == bs_bs, 'Double-backslash broken') +assert('\\' == bs, 'Backslash broken') diff --git a/test cases/common/39 has function/meson.build b/test cases/common/39 has function/meson.build new file mode 100644 index 0000000..539f313 --- /dev/null +++ b/test cases/common/39 has function/meson.build @@ -0,0 +1,91 @@ +project('has function', 'c', 'cpp') + +host_system = host_machine.system() + +# This is used in the `test_compiler_check_flags_order` unit test +unit_test_args = '-I/tmp' +defines_has_builtin = '''#ifndef __has_builtin +#error "no __has_builtin" +#endif +''' +compilers = [meson.get_compiler('c'), meson.get_compiler('cpp')] + +foreach cc : compilers + if not cc.has_function('printf', prefix : '#include', + args : unit_test_args) + error('"printf" function not found (should always exist).') + endif + + # Should also be able to detect it without specifying the header + # We check for a different function here to make sure the result is + # not taken from a cache (ie. the check above) + # On MSVC fprintf is defined as an inline function in the header, so it cannot + # be found without the include. + if not ['msvc', 'intel-cl'].contains(cc.get_id()) + assert(cc.has_function('fprintf', args : unit_test_args), + '"fprintf" function not found without include (on !msvc).') + else + assert(cc.has_function('fprintf', prefix : '#include ', + args : unit_test_args), + '"fprintf" function not found with include (on msvc).') + # Compiler intrinsics + assert(cc.has_function('strcmp'), + 'strcmp intrinsic should have been found on MSVC') + assert(cc.has_function('strcmp', prefix : '#include '), + 'strcmp intrinsic should have been found with #include on MSVC') + endif + + if cc.has_function('hfkerhisadf', prefix : '#include', + args : unit_test_args) + error('Found non-existent function "hfkerhisadf".') + endif + + if cc.has_function('hfkerhisadf', args : unit_test_args) + error('Found non-existent function "hfkerhisadf".') + endif + + # With glibc on Linux lchmod is a stub that will always return an error, + # we want to detect that and declare that the function is not available. + # We can't check for the C library used here of course, but if it's not + # implemented in glibc it's probably not implemented in any other 'slimmer' + # C library variants either, so the check should be safe either way hopefully. + if host_system == 'linux' or host_system == 'darwin' + assert (cc.has_function('poll', prefix : '#include ', + args : unit_test_args), + 'couldn\'t detect "poll" when defined by a header') + lchmod_prefix = '#include \n#include ' + if host_system == 'linux' + assert (not cc.has_function('lchmod', prefix : lchmod_prefix, + args : unit_test_args), + '"lchmod" check should have failed') + else + # macOS and *BSD have lchmod + assert (cc.has_function('lchmod', prefix : lchmod_prefix, + args : unit_test_args), + '"lchmod" check should have succeeded') + endif + # Check that built-ins are found properly both with and without headers + assert(cc.has_function('alloca', args : unit_test_args), + 'built-in alloca must be found on ' + host_system) + assert(cc.has_function('alloca', prefix : '#include ', + args : unit_test_args), + 'built-in alloca must be found with #include') + if not cc.compiles(defines_has_builtin, args : unit_test_args) + assert(not cc.has_function('alloca', + prefix : '#include \n#undef alloca', + args : unit_test_args), + 'built-in alloca must not be found with #include and #undef') + endif + endif + + # For some functions one needs to define _GNU_SOURCE before including the + # right headers to get them picked up. Make sure we can detect these functions + # as well without any prefix + if cc.has_header_symbol('sys/socket.h', 'recvmmsg', + prefix : '#define _GNU_SOURCE', + args : unit_test_args) + # We assume that if recvmmsg exists sendmmsg does too + assert (cc.has_function('sendmmsg', args : unit_test_args), + 'Failed to detect function "sendmmsg" (should always exist).') + endif +endforeach diff --git a/test cases/common/39 string operations/meson.build b/test cases/common/39 string operations/meson.build deleted file mode 100644 index 6596142..0000000 --- a/test cases/common/39 string operations/meson.build +++ /dev/null @@ -1,103 +0,0 @@ -project('string formatting', 'c') - -templ = '@0@bar@1@' - -assert(templ.format('foo', 'baz') == 'foobarbaz', 'Basic string formatting is broken.') - -assert('@0@'.format(1) == '1', 'String number formatting is broken.') - -assert('@0@'.format(true) == 'true', 'String boolean formatting is broken.') - -templ2 = '@0@' -subs2 = '42' - -assert(templ2.format(subs2) == '42', 'String formatting with variables is broken.') - -assert('@@0@@ @@1@@'.format(1, 2) == '@1@ @2@', 'String format is recursive.') - -long = 'abcde' -prefix = 'abc' -suffix = 'cde' - -assert(long.startswith(prefix), 'Prefix.') - -assert(not long.startswith(suffix), 'Not prefix.') - -assert(long.endswith(suffix), 'Suffix.') - -assert(not long.endswith(prefix), 'Not suffix.') - -assert(long.contains(prefix), 'Does not contain prefix') - -assert(long.contains(suffix), 'Does not contain suffix') - -assert(long.contains('bcd'), 'Does not contain middle part') - -assert(not long.contains('dc'), 'Broken contains') - -assert(long.to_upper() == 'ABCDE', 'Broken to_upper') - -assert(long.to_upper().to_lower() == long, 'Broken to_lower') - -assert('struct stat.st_foo'.underscorify() == 'struct_stat_st_foo', 'Broken underscorify') - -assert('#include '.underscorify() == '_include__foo_bar_h_', 'Broken underscorify') - -# case should not change, space should be replaced, numbers are ok too -assert('Do SomeThing 09'.underscorify() == 'Do_SomeThing_09', 'Broken underscorify') - -assert('3'.to_int() == 3, 'String int conversion does not work.') - -assert(true.to_string() == 'true', 'bool string conversion failed') -assert(false.to_string() == 'false', 'bool string conversion failed') -assert(true.to_string('yes', 'no') == 'yes', 'bool string conversion with args failed') -assert(false.to_string('yes', 'no') == 'no', 'bool string conversion with args failed') -assert('@0@'.format(true) == 'true', 'bool string formatting failed') - -assert(' '.join(['a', 'b', 'c']) == 'a b c', 'join() array broken') -assert(''.join(['a', 'b', 'c']) == 'abc', 'empty join() broken') -assert(' '.join(['a']) == 'a', 'single join broken') - -version_number = '1.2.8' - -assert(version_number.version_compare('>=1.2.8'), 'Version_compare gt broken') -assert(not version_number.version_compare('>1.2.8'), 'Version_compare greater broken') -assert(not version_number.version_compare('<1.2.8'), 'Version_compare less broken') -assert(version_number.version_compare('<=1.2.8'), 'Version_compare le broken') -assert(version_number.version_compare('==1.2.8'), 'Version_compare eq broken') -assert(not version_number.version_compare('!=1.2.8'), 'Version_compare neq broken') - -assert(version_number.version_compare('<2.0'), 'Version_compare major less broken') -assert(version_number.version_compare('>0.9'), 'Version_compare major greater broken') - -assert(' spaces tabs '.strip() == 'spaces tabs', 'Spaces and tabs badly stripped') -assert(''' -multiline string '''.strip() == '''multiline string''', 'Newlines badly stripped') -assert('"1.1.20"'.strip('"') == '1.1.20', '" badly stripped') -assert('"1.1.20"'.strip('".') == '1.1.20', '". badly stripped') -assert('"1.1.20" '.strip('" ') == '1.1.20', '". badly stripped') - -bs_c = '''\c''' -bs_bs_c = '''\\c''' -nl = ''' -''' -bs_n = '''\n''' -bs_nl = '''\ -''' -bs_bs_n = '''\\n''' -bs_bs_nl = '''\\ -''' -bs_bs = '''\\''' -bs = '''\''' - -assert('\c' == bs_c, 'Single backslash broken') -assert('\\c' == bs_c, 'Double backslash broken') -assert('\\\c' == bs_bs_c, 'Three backslash broken') -assert('\\\\c' == bs_bs_c, 'Four backslash broken') -assert('\n' == nl, 'Newline escape broken') -assert('\\n' == bs_n, 'Double backslash broken before n') -assert('\\\n' == bs_nl, 'Three backslash broken before n') -assert('\\\\n' == bs_bs_n, 'Four backslash broken before n') -assert('\\\\\n' == bs_bs_nl, 'Five backslash broken before n') -assert('\\\\' == bs_bs, 'Double-backslash broken') -assert('\\' == bs, 'Backslash broken') diff --git a/test cases/common/40 has function/meson.build b/test cases/common/40 has function/meson.build deleted file mode 100644 index 539f313..0000000 --- a/test cases/common/40 has function/meson.build +++ /dev/null @@ -1,91 +0,0 @@ -project('has function', 'c', 'cpp') - -host_system = host_machine.system() - -# This is used in the `test_compiler_check_flags_order` unit test -unit_test_args = '-I/tmp' -defines_has_builtin = '''#ifndef __has_builtin -#error "no __has_builtin" -#endif -''' -compilers = [meson.get_compiler('c'), meson.get_compiler('cpp')] - -foreach cc : compilers - if not cc.has_function('printf', prefix : '#include', - args : unit_test_args) - error('"printf" function not found (should always exist).') - endif - - # Should also be able to detect it without specifying the header - # We check for a different function here to make sure the result is - # not taken from a cache (ie. the check above) - # On MSVC fprintf is defined as an inline function in the header, so it cannot - # be found without the include. - if not ['msvc', 'intel-cl'].contains(cc.get_id()) - assert(cc.has_function('fprintf', args : unit_test_args), - '"fprintf" function not found without include (on !msvc).') - else - assert(cc.has_function('fprintf', prefix : '#include ', - args : unit_test_args), - '"fprintf" function not found with include (on msvc).') - # Compiler intrinsics - assert(cc.has_function('strcmp'), - 'strcmp intrinsic should have been found on MSVC') - assert(cc.has_function('strcmp', prefix : '#include '), - 'strcmp intrinsic should have been found with #include on MSVC') - endif - - if cc.has_function('hfkerhisadf', prefix : '#include', - args : unit_test_args) - error('Found non-existent function "hfkerhisadf".') - endif - - if cc.has_function('hfkerhisadf', args : unit_test_args) - error('Found non-existent function "hfkerhisadf".') - endif - - # With glibc on Linux lchmod is a stub that will always return an error, - # we want to detect that and declare that the function is not available. - # We can't check for the C library used here of course, but if it's not - # implemented in glibc it's probably not implemented in any other 'slimmer' - # C library variants either, so the check should be safe either way hopefully. - if host_system == 'linux' or host_system == 'darwin' - assert (cc.has_function('poll', prefix : '#include ', - args : unit_test_args), - 'couldn\'t detect "poll" when defined by a header') - lchmod_prefix = '#include \n#include ' - if host_system == 'linux' - assert (not cc.has_function('lchmod', prefix : lchmod_prefix, - args : unit_test_args), - '"lchmod" check should have failed') - else - # macOS and *BSD have lchmod - assert (cc.has_function('lchmod', prefix : lchmod_prefix, - args : unit_test_args), - '"lchmod" check should have succeeded') - endif - # Check that built-ins are found properly both with and without headers - assert(cc.has_function('alloca', args : unit_test_args), - 'built-in alloca must be found on ' + host_system) - assert(cc.has_function('alloca', prefix : '#include ', - args : unit_test_args), - 'built-in alloca must be found with #include') - if not cc.compiles(defines_has_builtin, args : unit_test_args) - assert(not cc.has_function('alloca', - prefix : '#include \n#undef alloca', - args : unit_test_args), - 'built-in alloca must not be found with #include and #undef') - endif - endif - - # For some functions one needs to define _GNU_SOURCE before including the - # right headers to get them picked up. Make sure we can detect these functions - # as well without any prefix - if cc.has_header_symbol('sys/socket.h', 'recvmmsg', - prefix : '#define _GNU_SOURCE', - args : unit_test_args) - # We assume that if recvmmsg exists sendmmsg does too - assert (cc.has_function('sendmmsg', args : unit_test_args), - 'Failed to detect function "sendmmsg" (should always exist).') - endif -endforeach diff --git a/test cases/common/40 has member/meson.build b/test cases/common/40 has member/meson.build new file mode 100644 index 0000000..4e61956 --- /dev/null +++ b/test cases/common/40 has member/meson.build @@ -0,0 +1,21 @@ +project('has member', 'c', 'cpp') + +compilers = [meson.get_compiler('c'), meson.get_compiler('cpp')] + +foreach cc : compilers + if not cc.has_member('struct tm', 'tm_sec', prefix : '#include') + error('Did not detect member of "struct tm" that exists: "tm_sec"') + endif + + if cc.has_member('struct tm', 'tm_nonexistent', prefix : '#include') + error('Not existing member "tm_nonexistent" found.') + endif + + if not cc.has_members('struct tm', 'tm_sec', 'tm_min', prefix : '#include') + error('Did not detect members of "struct tm" that exist: "tm_sec" "tm_min"') + endif + + if cc.has_members('struct tm', 'tm_sec', 'tm_nonexistent2', prefix : '#include') + error('Not existing member "tm_nonexistent2" found.') + endif +endforeach diff --git a/test cases/common/41 alignment/meson.build b/test cases/common/41 alignment/meson.build new file mode 100644 index 0000000..a9bd65b --- /dev/null +++ b/test cases/common/41 alignment/meson.build @@ -0,0 +1,31 @@ +project('alignment', 'c', 'cpp') + +compilers = [meson.get_compiler('c'), meson.get_compiler('cpp')] + +foreach cc : compilers + # These tests should return the same value on all + # platforms. If (and when) they don't, fix 'em up. + if cc.alignment('char') != 1 + error('Alignment of char misdetected.') + endif + + ptr_size = cc.sizeof('void*') + dbl_alignment = cc.alignment('double') + + # These tests are not thorough. Doing this properly + # would take a lot of work because it is strongly + # platform and compiler dependent. So just check + # that they produce something fairly sane. + + if ptr_size == 8 or ptr_size == 4 + message('Size of ptr ok.') + else + error('Size of ptr misdetected.') + endif + + if dbl_alignment == 8 or dbl_alignment == 4 + message('Alignment of double ok.') + else + error('Alignment of double misdetected.') + endif +endforeach diff --git a/test cases/common/41 has member/meson.build b/test cases/common/41 has member/meson.build deleted file mode 100644 index 4e61956..0000000 --- a/test cases/common/41 has member/meson.build +++ /dev/null @@ -1,21 +0,0 @@ -project('has member', 'c', 'cpp') - -compilers = [meson.get_compiler('c'), meson.get_compiler('cpp')] - -foreach cc : compilers - if not cc.has_member('struct tm', 'tm_sec', prefix : '#include') - error('Did not detect member of "struct tm" that exists: "tm_sec"') - endif - - if cc.has_member('struct tm', 'tm_nonexistent', prefix : '#include') - error('Not existing member "tm_nonexistent" found.') - endif - - if not cc.has_members('struct tm', 'tm_sec', 'tm_min', prefix : '#include') - error('Did not detect members of "struct tm" that exist: "tm_sec" "tm_min"') - endif - - if cc.has_members('struct tm', 'tm_sec', 'tm_nonexistent2', prefix : '#include') - error('Not existing member "tm_nonexistent2" found.') - endif -endforeach diff --git a/test cases/common/42 alignment/meson.build b/test cases/common/42 alignment/meson.build deleted file mode 100644 index a9bd65b..0000000 --- a/test cases/common/42 alignment/meson.build +++ /dev/null @@ -1,31 +0,0 @@ -project('alignment', 'c', 'cpp') - -compilers = [meson.get_compiler('c'), meson.get_compiler('cpp')] - -foreach cc : compilers - # These tests should return the same value on all - # platforms. If (and when) they don't, fix 'em up. - if cc.alignment('char') != 1 - error('Alignment of char misdetected.') - endif - - ptr_size = cc.sizeof('void*') - dbl_alignment = cc.alignment('double') - - # These tests are not thorough. Doing this properly - # would take a lot of work because it is strongly - # platform and compiler dependent. So just check - # that they produce something fairly sane. - - if ptr_size == 8 or ptr_size == 4 - message('Size of ptr ok.') - else - error('Size of ptr misdetected.') - endif - - if dbl_alignment == 8 or dbl_alignment == 4 - message('Alignment of double ok.') - else - error('Alignment of double misdetected.') - endif -endforeach diff --git a/test cases/common/42 library chain/installed_files.txt b/test cases/common/42 library chain/installed_files.txt new file mode 100644 index 0000000..5e796b0 --- /dev/null +++ b/test cases/common/42 library chain/installed_files.txt @@ -0,0 +1,2 @@ +usr/bin/prog?exe +?msvc:usr/bin/prog.pdb diff --git a/test cases/common/42 library chain/main.c b/test cases/common/42 library chain/main.c new file mode 100644 index 0000000..7b015b7 --- /dev/null +++ b/test cases/common/42 library chain/main.c @@ -0,0 +1,5 @@ +int libfun(); + +int main() { + return libfun(); +} diff --git a/test cases/common/42 library chain/meson.build b/test cases/common/42 library chain/meson.build new file mode 100644 index 0000000..77528d7 --- /dev/null +++ b/test cases/common/42 library chain/meson.build @@ -0,0 +1,5 @@ +project('libchain', 'c') + +subdir('subdir') +e = executable('prog', 'main.c', link_with : lib1, install : true) +test('tst', e) diff --git a/test cases/common/42 library chain/subdir/lib1.c b/test cases/common/42 library chain/subdir/lib1.c new file mode 100644 index 0000000..499ef82 --- /dev/null +++ b/test cases/common/42 library chain/subdir/lib1.c @@ -0,0 +1,17 @@ +int lib2fun(); +int lib3fun(); + +#if defined _WIN32 || defined __CYGWIN__ + #define DLL_PUBLIC __declspec(dllexport) +#else + #if defined __GNUC__ + #define DLL_PUBLIC __attribute__ ((visibility("default"))) + #else + #pragma message ("Compiler does not support symbol visibility.") + #define DLL_PUBLIC + #endif +#endif + +int DLL_PUBLIC libfun() { + return lib2fun() + lib3fun(); +} diff --git a/test cases/common/42 library chain/subdir/meson.build b/test cases/common/42 library chain/subdir/meson.build new file mode 100644 index 0000000..ab71bda --- /dev/null +++ b/test cases/common/42 library chain/subdir/meson.build @@ -0,0 +1,4 @@ +subdir('subdir2') +subdir('subdir3') + +lib1 = shared_library('lib1', 'lib1.c', install : false, link_with : [lib2, lib3]) diff --git a/test cases/common/42 library chain/subdir/subdir2/lib2.c b/test cases/common/42 library chain/subdir/subdir2/lib2.c new file mode 100644 index 0000000..34fadf2 --- /dev/null +++ b/test cases/common/42 library chain/subdir/subdir2/lib2.c @@ -0,0 +1,14 @@ +#if defined _WIN32 || defined __CYGWIN__ + #define DLL_PUBLIC __declspec(dllexport) +#else + #if defined __GNUC__ + #define DLL_PUBLIC __attribute__ ((visibility("default"))) + #else + #pragma message ("Compiler does not support symbol visibility.") + #define DLL_PUBLIC + #endif +#endif + +int DLL_PUBLIC lib2fun() { + return 0; +} diff --git a/test cases/common/42 library chain/subdir/subdir2/meson.build b/test cases/common/42 library chain/subdir/subdir2/meson.build new file mode 100644 index 0000000..befd94d --- /dev/null +++ b/test cases/common/42 library chain/subdir/subdir2/meson.build @@ -0,0 +1 @@ +lib2 = shared_library('lib2', 'lib2.c', install : false) diff --git a/test cases/common/42 library chain/subdir/subdir3/lib3.c b/test cases/common/42 library chain/subdir/subdir3/lib3.c new file mode 100644 index 0000000..7bd88af --- /dev/null +++ b/test cases/common/42 library chain/subdir/subdir3/lib3.c @@ -0,0 +1,14 @@ +#if defined _WIN32 || defined __CYGWIN__ + #define DLL_PUBLIC __declspec(dllexport) +#else + #if defined __GNUC__ + #define DLL_PUBLIC __attribute__ ((visibility("default"))) + #else + #pragma message ("Compiler does not support symbol visibility.") + #define DLL_PUBLIC + #endif +#endif + +int DLL_PUBLIC lib3fun() { + return 0; +} diff --git a/test cases/common/42 library chain/subdir/subdir3/meson.build b/test cases/common/42 library chain/subdir/subdir3/meson.build new file mode 100644 index 0000000..7bd249a --- /dev/null +++ b/test cases/common/42 library chain/subdir/subdir3/meson.build @@ -0,0 +1 @@ +lib3 = shared_library('lib3', 'lib3.c', install : false) diff --git a/test cases/common/43 library chain/installed_files.txt b/test cases/common/43 library chain/installed_files.txt deleted file mode 100644 index 5e796b0..0000000 --- a/test cases/common/43 library chain/installed_files.txt +++ /dev/null @@ -1,2 +0,0 @@ -usr/bin/prog?exe -?msvc:usr/bin/prog.pdb diff --git a/test cases/common/43 library chain/main.c b/test cases/common/43 library chain/main.c deleted file mode 100644 index 7b015b7..0000000 --- a/test cases/common/43 library chain/main.c +++ /dev/null @@ -1,5 +0,0 @@ -int libfun(); - -int main() { - return libfun(); -} diff --git a/test cases/common/43 library chain/meson.build b/test cases/common/43 library chain/meson.build deleted file mode 100644 index 77528d7..0000000 --- a/test cases/common/43 library chain/meson.build +++ /dev/null @@ -1,5 +0,0 @@ -project('libchain', 'c') - -subdir('subdir') -e = executable('prog', 'main.c', link_with : lib1, install : true) -test('tst', e) diff --git a/test cases/common/43 library chain/subdir/lib1.c b/test cases/common/43 library chain/subdir/lib1.c deleted file mode 100644 index 499ef82..0000000 --- a/test cases/common/43 library chain/subdir/lib1.c +++ /dev/null @@ -1,17 +0,0 @@ -int lib2fun(); -int lib3fun(); - -#if defined _WIN32 || defined __CYGWIN__ - #define DLL_PUBLIC __declspec(dllexport) -#else - #if defined __GNUC__ - #define DLL_PUBLIC __attribute__ ((visibility("default"))) - #else - #pragma message ("Compiler does not support symbol visibility.") - #define DLL_PUBLIC - #endif -#endif - -int DLL_PUBLIC libfun() { - return lib2fun() + lib3fun(); -} diff --git a/test cases/common/43 library chain/subdir/meson.build b/test cases/common/43 library chain/subdir/meson.build deleted file mode 100644 index ab71bda..0000000 --- a/test cases/common/43 library chain/subdir/meson.build +++ /dev/null @@ -1,4 +0,0 @@ -subdir('subdir2') -subdir('subdir3') - -lib1 = shared_library('lib1', 'lib1.c', install : false, link_with : [lib2, lib3]) diff --git a/test cases/common/43 library chain/subdir/subdir2/lib2.c b/test cases/common/43 library chain/subdir/subdir2/lib2.c deleted file mode 100644 index 34fadf2..0000000 --- a/test cases/common/43 library chain/subdir/subdir2/lib2.c +++ /dev/null @@ -1,14 +0,0 @@ -#if defined _WIN32 || defined __CYGWIN__ - #define DLL_PUBLIC __declspec(dllexport) -#else - #if defined __GNUC__ - #define DLL_PUBLIC __attribute__ ((visibility("default"))) - #else - #pragma message ("Compiler does not support symbol visibility.") - #define DLL_PUBLIC - #endif -#endif - -int DLL_PUBLIC lib2fun() { - return 0; -} diff --git a/test cases/common/43 library chain/subdir/subdir2/meson.build b/test cases/common/43 library chain/subdir/subdir2/meson.build deleted file mode 100644 index befd94d..0000000 --- a/test cases/common/43 library chain/subdir/subdir2/meson.build +++ /dev/null @@ -1 +0,0 @@ -lib2 = shared_library('lib2', 'lib2.c', install : false) diff --git a/test cases/common/43 library chain/subdir/subdir3/lib3.c b/test cases/common/43 library chain/subdir/subdir3/lib3.c deleted file mode 100644 index 7bd88af..0000000 --- a/test cases/common/43 library chain/subdir/subdir3/lib3.c +++ /dev/null @@ -1,14 +0,0 @@ -#if defined _WIN32 || defined __CYGWIN__ - #define DLL_PUBLIC __declspec(dllexport) -#else - #if defined __GNUC__ - #define DLL_PUBLIC __attribute__ ((visibility("default"))) - #else - #pragma message ("Compiler does not support symbol visibility.") - #define DLL_PUBLIC - #endif -#endif - -int DLL_PUBLIC lib3fun() { - return 0; -} diff --git a/test cases/common/43 library chain/subdir/subdir3/meson.build b/test cases/common/43 library chain/subdir/subdir3/meson.build deleted file mode 100644 index 7bd249a..0000000 --- a/test cases/common/43 library chain/subdir/subdir3/meson.build +++ /dev/null @@ -1 +0,0 @@ -lib3 = shared_library('lib3', 'lib3.c', install : false) diff --git a/test cases/common/43 options/meson.build b/test cases/common/43 options/meson.build new file mode 100644 index 0000000..c6cf9c8 --- /dev/null +++ b/test cases/common/43 options/meson.build @@ -0,0 +1,33 @@ +project('options', 'c') + +if get_option('testoption') != 'optval' + error('Incorrect value to test option') +endif + +if get_option('other_one') != false + error('Incorrect value to boolean option.') +endif + +if get_option('combo_opt') != 'combo' + error('Incorrect value to combo option.') +endif + +if get_option('array_opt') != ['one', 'two'] + message(get_option('array_opt')) + error('Incorrect value for array option') +endif + +# If the default changes, update test cases/unit/13 reconfigure +if get_option('b_lto') != false + error('Incorrect value in base option.') +endif + +if get_option('includedir') != 'include' + error('Incorrect value in builtin option.') +endif + +if get_option('integer_opt') != 3 + error('Incorrect value in integer option.') +endif + +assert(get_option('wrap_mode') == 'default', 'Wrap mode option is broken.') diff --git a/test cases/common/43 options/meson_options.txt b/test cases/common/43 options/meson_options.txt new file mode 100644 index 0000000..4e1c8d8 --- /dev/null +++ b/test cases/common/43 options/meson_options.txt @@ -0,0 +1,6 @@ +option('testoption', type : 'string', value : 'optval', description : 'An option to do something') +option('other_one', type : 'boolean', value : false) +option('combo_opt', type : 'combo', choices : ['one', 'two', 'combo'], value : 'combo') +option('array_opt', type : 'array', choices : ['one', 'two', 'three'], value : ['one', 'two']) +option('free_array_opt', type : 'array') +option('integer_opt', type : 'integer', min : 0, max : 5, value : 3) diff --git a/test cases/common/44 options/meson.build b/test cases/common/44 options/meson.build deleted file mode 100644 index c6cf9c8..0000000 --- a/test cases/common/44 options/meson.build +++ /dev/null @@ -1,33 +0,0 @@ -project('options', 'c') - -if get_option('testoption') != 'optval' - error('Incorrect value to test option') -endif - -if get_option('other_one') != false - error('Incorrect value to boolean option.') -endif - -if get_option('combo_opt') != 'combo' - error('Incorrect value to combo option.') -endif - -if get_option('array_opt') != ['one', 'two'] - message(get_option('array_opt')) - error('Incorrect value for array option') -endif - -# If the default changes, update test cases/unit/13 reconfigure -if get_option('b_lto') != false - error('Incorrect value in base option.') -endif - -if get_option('includedir') != 'include' - error('Incorrect value in builtin option.') -endif - -if get_option('integer_opt') != 3 - error('Incorrect value in integer option.') -endif - -assert(get_option('wrap_mode') == 'default', 'Wrap mode option is broken.') diff --git a/test cases/common/44 options/meson_options.txt b/test cases/common/44 options/meson_options.txt deleted file mode 100644 index 4e1c8d8..0000000 --- a/test cases/common/44 options/meson_options.txt +++ /dev/null @@ -1,6 +0,0 @@ -option('testoption', type : 'string', value : 'optval', description : 'An option to do something') -option('other_one', type : 'boolean', value : false) -option('combo_opt', type : 'combo', choices : ['one', 'two', 'combo'], value : 'combo') -option('array_opt', type : 'array', choices : ['one', 'two', 'three'], value : ['one', 'two']) -option('free_array_opt', type : 'array') -option('integer_opt', type : 'integer', min : 0, max : 5, value : 3) diff --git a/test cases/common/44 test args/cmd_args.c b/test cases/common/44 test args/cmd_args.c new file mode 100644 index 0000000..545b795 --- /dev/null +++ b/test cases/common/44 test args/cmd_args.c @@ -0,0 +1,18 @@ +#include +#include + +int main(int argc, char **argv) { + if(argc != 3) { + fprintf(stderr, "Incorrect number of arguments.\n"); + return 1; + } + if(strcmp(argv[1], "first") != 0) { + fprintf(stderr, "First argument is wrong.\n"); + return 1; + } + if(strcmp(argv[2], "second") != 0) { + fprintf(stderr, "Second argument is wrong.\n"); + return 1; + } + return 0; +} diff --git a/test cases/common/44 test args/copyfile.py b/test cases/common/44 test args/copyfile.py new file mode 100644 index 0000000..ff42ac3 --- /dev/null +++ b/test cases/common/44 test args/copyfile.py @@ -0,0 +1,6 @@ +#!/usr/bin/env python3 + +import sys +import shutil + +shutil.copyfile(sys.argv[1], sys.argv[2]) diff --git a/test cases/common/44 test args/env2vars.c b/test cases/common/44 test args/env2vars.c new file mode 100644 index 0000000..19250a8 --- /dev/null +++ b/test cases/common/44 test args/env2vars.c @@ -0,0 +1,23 @@ +#include +#include +#include + +int main(int argc, char **argv) { + if(strcmp(getenv("first"), "something-else") != 0) { + fprintf(stderr, "First envvar is wrong. %s\n", getenv("first")); + return 1; + } + if(strcmp(getenv("second"), "val2") != 0) { + fprintf(stderr, "Second envvar is wrong.\n"); + return 1; + } + if(strcmp(getenv("third"), "val3:and_more") != 0) { + fprintf(stderr, "Third envvar is wrong.\n"); + return 1; + } + if(strstr(getenv("PATH"), "fakepath:") != NULL) { + fprintf(stderr, "Third envvar is wrong.\n"); + return 1; + } + return 0; +} diff --git a/test cases/common/44 test args/envvars.c b/test cases/common/44 test args/envvars.c new file mode 100644 index 0000000..627e413 --- /dev/null +++ b/test cases/common/44 test args/envvars.c @@ -0,0 +1,23 @@ +#include +#include +#include + +int main(int argc, char **argv) { + if(strcmp(getenv("first"), "val1") != 0) { + fprintf(stderr, "First envvar is wrong. %s\n", getenv("first")); + return 1; + } + if(strcmp(getenv("second"), "val2") != 0) { + fprintf(stderr, "Second envvar is wrong.\n"); + return 1; + } + if(strcmp(getenv("third"), "val3:and_more") != 0) { + fprintf(stderr, "Third envvar is wrong.\n"); + return 1; + } + if(strstr(getenv("PATH"), "fakepath:") != NULL) { + fprintf(stderr, "Third envvar is wrong.\n"); + return 1; + } + return 0; +} diff --git a/test cases/common/44 test args/meson.build b/test cases/common/44 test args/meson.build new file mode 100644 index 0000000..81d3491 --- /dev/null +++ b/test cases/common/44 test args/meson.build @@ -0,0 +1,35 @@ +project('test features', 'c') + +e1 = executable('cmd_args', 'cmd_args.c') +e2 = executable('envvars', 'envvars.c') +e3 = executable('env2vars', 'env2vars.c') + +env = environment() +env.set('first', 'val1') +env.set('second', 'val2') +env.set('third', 'val3', 'and_more', separator: ':') +env.append('PATH', 'fakepath', separator: ':') + +# Make sure environment objects are copied on assignment and we can +# change the copy without affecting the original environment object. +env2 = env +env2.set('first', 'something-else') + +test('command line arguments', e1, args : ['first', 'second']) +test('environment variables', e2, env : env) +test('environment variables 2', e3, env : env2) + +# https://github.com/mesonbuild/meson/issues/2211#issuecomment-327741571 +env_array = ['MESONTESTING=picklerror'] +testfile = files('testfile.txt') +testerpy = find_program('tester.py') +test('file arg', testerpy, args : testfile, env : env_array) + +copy = find_program('copyfile.py') +tester = executable('tester', 'tester.c') +testfilect = custom_target('testfile', + input : testfile, + output : 'outfile.txt', + build_by_default : true, + command : [copy, '@INPUT@', '@OUTPUT@']) +test('custom target arg', tester, args : testfilect, env : env_array) diff --git a/test cases/common/44 test args/tester.c b/test cases/common/44 test args/tester.c new file mode 100644 index 0000000..419277e --- /dev/null +++ b/test cases/common/44 test args/tester.c @@ -0,0 +1,34 @@ +#include +#include +#include +#include + +#ifndef _MSC_VER +#include +#endif + +int main(int argc, char **argv) { + char data[10]; + int fd, size; + + if (argc != 2) { + fprintf(stderr, "Incorrect number of arguments, got %i\n", argc); + return 1; + } + fd = open(argv[1], O_RDONLY); + if (fd < 0) { + fprintf(stderr, "First argument is wrong.\n"); + return 1; + } + + size = read(fd, data, 8); + if (size < 0) { + fprintf(stderr, "Failed to read: %s\n", strerror(errno)); + return 1; + } + if (strncmp(data, "contents", 8) != 0) { + fprintf(stderr, "Contents don't match, got %s\n", data); + return 1; + } + return 0; +} diff --git a/test cases/common/44 test args/tester.py b/test cases/common/44 test args/tester.py new file mode 100755 index 0000000..0b4010a --- /dev/null +++ b/test cases/common/44 test args/tester.py @@ -0,0 +1,7 @@ +#!/usr/bin/env python3 + +import sys + +with open(sys.argv[1]) as f: + if f.read() != 'contents\n': + sys.exit(1) diff --git a/test cases/common/44 test args/testfile.txt b/test cases/common/44 test args/testfile.txt new file mode 100644 index 0000000..12f00e9 --- /dev/null +++ b/test cases/common/44 test args/testfile.txt @@ -0,0 +1 @@ +contents diff --git a/test cases/common/45 subproject/installed_files.txt b/test cases/common/45 subproject/installed_files.txt new file mode 100644 index 0000000..dba3202 --- /dev/null +++ b/test cases/common/45 subproject/installed_files.txt @@ -0,0 +1,3 @@ +usr/bin/user?exe +?msvc:usr/bin/user.pdb +usr/share/sublib/sublib.depmf diff --git a/test cases/common/45 subproject/meson.build b/test cases/common/45 subproject/meson.build new file mode 100644 index 0000000..2b939d1 --- /dev/null +++ b/test cases/common/45 subproject/meson.build @@ -0,0 +1,28 @@ +project('subproj user', 'c', + version : '2.3.4', + license : 'mylicense') + +assert(meson.project_name() == 'subproj user', 'Incorrect project name') + +sub = subproject('sublib', version : '1.0.0') + +if meson.project_version() != '2.3.4' + error('Incorrect master project version string:' + meson.project_version()) +endif + +if meson.is_subproject() + error('Claimed to be a subproject even though we are the master project.') +endif + +inc = sub.get_variable('i') +lib = sub.get_variable('l') + +e = executable('user', 'user.c', include_directories : inc, link_with : lib, install : true) +test('subdirtest', e) + +meson.install_dependency_manifest('share/sublib/sublib.depmf') + +unknown_var = sub.get_variable('does-not-exist', []) +if unknown_var != [] + error ('unexpetced fallback value for subproject.get_variable()') +endif diff --git a/test cases/common/45 subproject/subprojects/sublib/include/subdefs.h b/test cases/common/45 subproject/subprojects/sublib/include/subdefs.h new file mode 100644 index 0000000..681c7b8 --- /dev/null +++ b/test cases/common/45 subproject/subprojects/sublib/include/subdefs.h @@ -0,0 +1,21 @@ +#ifndef SUBDEFS_H_ +#define SUBDEFS_H_ + +#if defined _WIN32 || defined __CYGWIN__ +#if defined BUILDING_SUB + #define DLL_PUBLIC __declspec(dllexport) +#else + #define DLL_PUBLIC __declspec(dllimport) +#endif +#else + #if defined __GNUC__ + #define DLL_PUBLIC __attribute__ ((visibility("default"))) + #else + #pragma message ("Compiler does not support symbol visibility.") + #define DLL_PUBLIC + #endif +#endif + +int DLL_PUBLIC subfunc(); + +#endif diff --git a/test cases/common/45 subproject/subprojects/sublib/meson.build b/test cases/common/45 subproject/subprojects/sublib/meson.build new file mode 100644 index 0000000..acaf1bf --- /dev/null +++ b/test cases/common/45 subproject/subprojects/sublib/meson.build @@ -0,0 +1,19 @@ +project('subproject', 'c', + version : '1.0.0', + license : ['sublicense1', 'sublicense2']) + +if not meson.is_subproject() + error('Claimed to be master project even though we are a subproject.') +endif + +assert(meson.project_name() == 'subproject', 'Incorrect subproject name') + +if meson.project_version() != '1.0.0' + error('Incorrect version string in subproject.') +endif + +i = include_directories('include') +l = shared_library('sublib', 'sublib.c', include_directories : i, install : false, + c_args : '-DBUILDING_SUB=2') +t = executable('simpletest', 'simpletest.c', include_directories : i, link_with : l) +test('plain', t) diff --git a/test cases/common/45 subproject/subprojects/sublib/simpletest.c b/test cases/common/45 subproject/subprojects/sublib/simpletest.c new file mode 100644 index 0000000..3801a40 --- /dev/null +++ b/test cases/common/45 subproject/subprojects/sublib/simpletest.c @@ -0,0 +1,5 @@ +#include + +int main(int argc, char **argv) { + return subfunc() == 42 ? 0 : 1; +} diff --git a/test cases/common/45 subproject/subprojects/sublib/sublib.c b/test cases/common/45 subproject/subprojects/sublib/sublib.c new file mode 100644 index 0000000..c13326b --- /dev/null +++ b/test cases/common/45 subproject/subprojects/sublib/sublib.c @@ -0,0 +1,5 @@ +#include + +int DLL_PUBLIC subfunc() { + return 42; +} diff --git a/test cases/common/45 subproject/user.c b/test cases/common/45 subproject/user.c new file mode 100644 index 0000000..cfde532 --- /dev/null +++ b/test cases/common/45 subproject/user.c @@ -0,0 +1,16 @@ +#include +#include + + +int main(int argc, char **argv) { + int res; + printf("Calling into sublib now.\n"); + res = subfunc(); + if(res == 42) { + printf("Everything is fine.\n"); + return 0; + } else { + printf("Something went wrong.\n"); + return 1; + } +} diff --git a/test cases/common/45 test args/cmd_args.c b/test cases/common/45 test args/cmd_args.c deleted file mode 100644 index 545b795..0000000 --- a/test cases/common/45 test args/cmd_args.c +++ /dev/null @@ -1,18 +0,0 @@ -#include -#include - -int main(int argc, char **argv) { - if(argc != 3) { - fprintf(stderr, "Incorrect number of arguments.\n"); - return 1; - } - if(strcmp(argv[1], "first") != 0) { - fprintf(stderr, "First argument is wrong.\n"); - return 1; - } - if(strcmp(argv[2], "second") != 0) { - fprintf(stderr, "Second argument is wrong.\n"); - return 1; - } - return 0; -} diff --git a/test cases/common/45 test args/copyfile.py b/test cases/common/45 test args/copyfile.py deleted file mode 100644 index ff42ac3..0000000 --- a/test cases/common/45 test args/copyfile.py +++ /dev/null @@ -1,6 +0,0 @@ -#!/usr/bin/env python3 - -import sys -import shutil - -shutil.copyfile(sys.argv[1], sys.argv[2]) diff --git a/test cases/common/45 test args/env2vars.c b/test cases/common/45 test args/env2vars.c deleted file mode 100644 index 19250a8..0000000 --- a/test cases/common/45 test args/env2vars.c +++ /dev/null @@ -1,23 +0,0 @@ -#include -#include -#include - -int main(int argc, char **argv) { - if(strcmp(getenv("first"), "something-else") != 0) { - fprintf(stderr, "First envvar is wrong. %s\n", getenv("first")); - return 1; - } - if(strcmp(getenv("second"), "val2") != 0) { - fprintf(stderr, "Second envvar is wrong.\n"); - return 1; - } - if(strcmp(getenv("third"), "val3:and_more") != 0) { - fprintf(stderr, "Third envvar is wrong.\n"); - return 1; - } - if(strstr(getenv("PATH"), "fakepath:") != NULL) { - fprintf(stderr, "Third envvar is wrong.\n"); - return 1; - } - return 0; -} diff --git a/test cases/common/45 test args/envvars.c b/test cases/common/45 test args/envvars.c deleted file mode 100644 index 627e413..0000000 --- a/test cases/common/45 test args/envvars.c +++ /dev/null @@ -1,23 +0,0 @@ -#include -#include -#include - -int main(int argc, char **argv) { - if(strcmp(getenv("first"), "val1") != 0) { - fprintf(stderr, "First envvar is wrong. %s\n", getenv("first")); - return 1; - } - if(strcmp(getenv("second"), "val2") != 0) { - fprintf(stderr, "Second envvar is wrong.\n"); - return 1; - } - if(strcmp(getenv("third"), "val3:and_more") != 0) { - fprintf(stderr, "Third envvar is wrong.\n"); - return 1; - } - if(strstr(getenv("PATH"), "fakepath:") != NULL) { - fprintf(stderr, "Third envvar is wrong.\n"); - return 1; - } - return 0; -} diff --git a/test cases/common/45 test args/meson.build b/test cases/common/45 test args/meson.build deleted file mode 100644 index 81d3491..0000000 --- a/test cases/common/45 test args/meson.build +++ /dev/null @@ -1,35 +0,0 @@ -project('test features', 'c') - -e1 = executable('cmd_args', 'cmd_args.c') -e2 = executable('envvars', 'envvars.c') -e3 = executable('env2vars', 'env2vars.c') - -env = environment() -env.set('first', 'val1') -env.set('second', 'val2') -env.set('third', 'val3', 'and_more', separator: ':') -env.append('PATH', 'fakepath', separator: ':') - -# Make sure environment objects are copied on assignment and we can -# change the copy without affecting the original environment object. -env2 = env -env2.set('first', 'something-else') - -test('command line arguments', e1, args : ['first', 'second']) -test('environment variables', e2, env : env) -test('environment variables 2', e3, env : env2) - -# https://github.com/mesonbuild/meson/issues/2211#issuecomment-327741571 -env_array = ['MESONTESTING=picklerror'] -testfile = files('testfile.txt') -testerpy = find_program('tester.py') -test('file arg', testerpy, args : testfile, env : env_array) - -copy = find_program('copyfile.py') -tester = executable('tester', 'tester.c') -testfilect = custom_target('testfile', - input : testfile, - output : 'outfile.txt', - build_by_default : true, - command : [copy, '@INPUT@', '@OUTPUT@']) -test('custom target arg', tester, args : testfilect, env : env_array) diff --git a/test cases/common/45 test args/tester.c b/test cases/common/45 test args/tester.c deleted file mode 100644 index 419277e..0000000 --- a/test cases/common/45 test args/tester.c +++ /dev/null @@ -1,34 +0,0 @@ -#include -#include -#include -#include - -#ifndef _MSC_VER -#include -#endif - -int main(int argc, char **argv) { - char data[10]; - int fd, size; - - if (argc != 2) { - fprintf(stderr, "Incorrect number of arguments, got %i\n", argc); - return 1; - } - fd = open(argv[1], O_RDONLY); - if (fd < 0) { - fprintf(stderr, "First argument is wrong.\n"); - return 1; - } - - size = read(fd, data, 8); - if (size < 0) { - fprintf(stderr, "Failed to read: %s\n", strerror(errno)); - return 1; - } - if (strncmp(data, "contents", 8) != 0) { - fprintf(stderr, "Contents don't match, got %s\n", data); - return 1; - } - return 0; -} diff --git a/test cases/common/45 test args/tester.py b/test cases/common/45 test args/tester.py deleted file mode 100755 index 0b4010a..0000000 --- a/test cases/common/45 test args/tester.py +++ /dev/null @@ -1,7 +0,0 @@ -#!/usr/bin/env python3 - -import sys - -with open(sys.argv[1]) as f: - if f.read() != 'contents\n': - sys.exit(1) diff --git a/test cases/common/45 test args/testfile.txt b/test cases/common/45 test args/testfile.txt deleted file mode 100644 index 12f00e9..0000000 --- a/test cases/common/45 test args/testfile.txt +++ /dev/null @@ -1 +0,0 @@ -contents diff --git a/test cases/common/46 subproject options/meson.build b/test cases/common/46 subproject options/meson.build new file mode 100644 index 0000000..d4598b6 --- /dev/null +++ b/test cases/common/46 subproject options/meson.build @@ -0,0 +1,7 @@ +project('suboptions', 'c') + +subproject('subproject') + +if not get_option('opt') + error('option unset when it should be set') +endif diff --git a/test cases/common/46 subproject options/meson_options.txt b/test cases/common/46 subproject options/meson_options.txt new file mode 100644 index 0000000..c295ddd --- /dev/null +++ b/test cases/common/46 subproject options/meson_options.txt @@ -0,0 +1 @@ +option('opt', type : 'boolean', value : true, description : 'main project option') diff --git a/test cases/common/46 subproject options/subprojects/subproject/meson.build b/test cases/common/46 subproject options/subprojects/subproject/meson.build new file mode 100644 index 0000000..5000b86 --- /dev/null +++ b/test cases/common/46 subproject options/subprojects/subproject/meson.build @@ -0,0 +1,5 @@ +project('subproject', 'c') + +if get_option('opt') + error('option set when it should be unset.') +endif diff --git a/test cases/common/46 subproject options/subprojects/subproject/meson_options.txt b/test cases/common/46 subproject options/subprojects/subproject/meson_options.txt new file mode 100644 index 0000000..ac78533 --- /dev/null +++ b/test cases/common/46 subproject options/subprojects/subproject/meson_options.txt @@ -0,0 +1 @@ +option('opt', type : 'boolean', value : false, description : 'subproject option') diff --git a/test cases/common/46 subproject/installed_files.txt b/test cases/common/46 subproject/installed_files.txt deleted file mode 100644 index dba3202..0000000 --- a/test cases/common/46 subproject/installed_files.txt +++ /dev/null @@ -1,3 +0,0 @@ -usr/bin/user?exe -?msvc:usr/bin/user.pdb -usr/share/sublib/sublib.depmf diff --git a/test cases/common/46 subproject/meson.build b/test cases/common/46 subproject/meson.build deleted file mode 100644 index 2b939d1..0000000 --- a/test cases/common/46 subproject/meson.build +++ /dev/null @@ -1,28 +0,0 @@ -project('subproj user', 'c', - version : '2.3.4', - license : 'mylicense') - -assert(meson.project_name() == 'subproj user', 'Incorrect project name') - -sub = subproject('sublib', version : '1.0.0') - -if meson.project_version() != '2.3.4' - error('Incorrect master project version string:' + meson.project_version()) -endif - -if meson.is_subproject() - error('Claimed to be a subproject even though we are the master project.') -endif - -inc = sub.get_variable('i') -lib = sub.get_variable('l') - -e = executable('user', 'user.c', include_directories : inc, link_with : lib, install : true) -test('subdirtest', e) - -meson.install_dependency_manifest('share/sublib/sublib.depmf') - -unknown_var = sub.get_variable('does-not-exist', []) -if unknown_var != [] - error ('unexpetced fallback value for subproject.get_variable()') -endif diff --git a/test cases/common/46 subproject/subprojects/sublib/include/subdefs.h b/test cases/common/46 subproject/subprojects/sublib/include/subdefs.h deleted file mode 100644 index 681c7b8..0000000 --- a/test cases/common/46 subproject/subprojects/sublib/include/subdefs.h +++ /dev/null @@ -1,21 +0,0 @@ -#ifndef SUBDEFS_H_ -#define SUBDEFS_H_ - -#if defined _WIN32 || defined __CYGWIN__ -#if defined BUILDING_SUB - #define DLL_PUBLIC __declspec(dllexport) -#else - #define DLL_PUBLIC __declspec(dllimport) -#endif -#else - #if defined __GNUC__ - #define DLL_PUBLIC __attribute__ ((visibility("default"))) - #else - #pragma message ("Compiler does not support symbol visibility.") - #define DLL_PUBLIC - #endif -#endif - -int DLL_PUBLIC subfunc(); - -#endif diff --git a/test cases/common/46 subproject/subprojects/sublib/meson.build b/test cases/common/46 subproject/subprojects/sublib/meson.build deleted file mode 100644 index acaf1bf..0000000 --- a/test cases/common/46 subproject/subprojects/sublib/meson.build +++ /dev/null @@ -1,19 +0,0 @@ -project('subproject', 'c', - version : '1.0.0', - license : ['sublicense1', 'sublicense2']) - -if not meson.is_subproject() - error('Claimed to be master project even though we are a subproject.') -endif - -assert(meson.project_name() == 'subproject', 'Incorrect subproject name') - -if meson.project_version() != '1.0.0' - error('Incorrect version string in subproject.') -endif - -i = include_directories('include') -l = shared_library('sublib', 'sublib.c', include_directories : i, install : false, - c_args : '-DBUILDING_SUB=2') -t = executable('simpletest', 'simpletest.c', include_directories : i, link_with : l) -test('plain', t) diff --git a/test cases/common/46 subproject/subprojects/sublib/simpletest.c b/test cases/common/46 subproject/subprojects/sublib/simpletest.c deleted file mode 100644 index 3801a40..0000000 --- a/test cases/common/46 subproject/subprojects/sublib/simpletest.c +++ /dev/null @@ -1,5 +0,0 @@ -#include - -int main(int argc, char **argv) { - return subfunc() == 42 ? 0 : 1; -} diff --git a/test cases/common/46 subproject/subprojects/sublib/sublib.c b/test cases/common/46 subproject/subprojects/sublib/sublib.c deleted file mode 100644 index c13326b..0000000 --- a/test cases/common/46 subproject/subprojects/sublib/sublib.c +++ /dev/null @@ -1,5 +0,0 @@ -#include - -int DLL_PUBLIC subfunc() { - return 42; -} diff --git a/test cases/common/46 subproject/user.c b/test cases/common/46 subproject/user.c deleted file mode 100644 index cfde532..0000000 --- a/test cases/common/46 subproject/user.c +++ /dev/null @@ -1,16 +0,0 @@ -#include -#include - - -int main(int argc, char **argv) { - int res; - printf("Calling into sublib now.\n"); - res = subfunc(); - if(res == 42) { - printf("Everything is fine.\n"); - return 0; - } else { - printf("Something went wrong.\n"); - return 1; - } -} diff --git a/test cases/common/47 pkgconfig-gen/dependencies/custom.c b/test cases/common/47 pkgconfig-gen/dependencies/custom.c new file mode 100644 index 0000000..2cc5651 --- /dev/null +++ b/test cases/common/47 pkgconfig-gen/dependencies/custom.c @@ -0,0 +1,3 @@ +int custom_function() { + return 42; +} diff --git a/test cases/common/47 pkgconfig-gen/dependencies/exposed.c b/test cases/common/47 pkgconfig-gen/dependencies/exposed.c new file mode 100644 index 0000000..005202e --- /dev/null +++ b/test cases/common/47 pkgconfig-gen/dependencies/exposed.c @@ -0,0 +1,3 @@ +int exposed_function() { + return 42; +} diff --git a/test cases/common/47 pkgconfig-gen/dependencies/internal.c b/test cases/common/47 pkgconfig-gen/dependencies/internal.c new file mode 100644 index 0000000..1a41b11 --- /dev/null +++ b/test cases/common/47 pkgconfig-gen/dependencies/internal.c @@ -0,0 +1,3 @@ +int internal_function() { + return 42; +} diff --git a/test cases/common/47 pkgconfig-gen/dependencies/meson.build b/test cases/common/47 pkgconfig-gen/dependencies/meson.build new file mode 100644 index 0000000..c72f96b --- /dev/null +++ b/test cases/common/47 pkgconfig-gen/dependencies/meson.build @@ -0,0 +1,51 @@ +project('pkgconfig-gen-dependencies', 'c', version: '1.0') + +pkgg = import('pkgconfig') + +# libmain internally use libinternal and expose libexpose in its API +exposed_lib = shared_library('libexposed', 'exposed.c') +internal_lib = shared_library('libinternal', 'internal.c') +main_lib = both_libraries('libmain', link_with : [exposed_lib, internal_lib]) +custom_lib = shared_library('custom', 'custom.c') + +pkgg.generate(exposed_lib) + +# Declare a few different Dependency objects +pc_dep = dependency('libfoo', version : '>=1.0') +pc_dep_dup = dependency('libfoo', version : '>= 1.0') +notfound_dep = dependency('notfound', required : false) +threads_dep = dependency('threads') +custom_dep = declare_dependency(link_with : custom_lib, compile_args : ['-DCUSTOM']) +custom2_dep = declare_dependency(link_args : ['-lcustom2'], compile_args : ['-DCUSTOM2']) + +# Generate a PC file: +# - Having libmain in libraries should pull implicitly libexposed and libinternal in Libs.private +# - Having libexposed in libraries should remove it from Libs.private +# - We generated a pc file for libexposed so it should be in Requires instead of Libs +# - Having threads_dep in libraries should add '-pthread' in both Libs and Cflags +# - Having custom_dep in libraries and libraries_private should only add it in Libs +# - Having custom2_dep in libraries_private should not add its Cflags +# - Having pc_dep in libraries_private should add it in Requires.private +# - pc_dep_dup is the same library and same version, should be ignored +# - notfound_dep is not required so it shouldn't appear in the pc file. +pkgg.generate(libraries : [main_lib, exposed_lib, threads_dep, threads_dep, custom_dep, custom_dep, '-pthread'], + libraries_private : [custom_dep, custom2_dep, custom2_dep, pc_dep, pc_dep_dup, notfound_dep], + version : '1.0', + name : 'dependency-test', + filebase : 'dependency-test', + description : 'A dependency test.' +) + +pkgg.generate( + name : 'requires-test', + version : '1.0', + description : 'Dependency Requires field test.', + requires : [exposed_lib, pc_dep, 'libhello'], +) + +pkgg.generate( + name : 'requires-private-test', + version : '1.0', + description : 'Dependency Requires.private field test.', + requires_private : [exposed_lib, pc_dep, 'libhello', notfound_dep], +) diff --git a/test cases/common/47 pkgconfig-gen/installed_files.txt b/test cases/common/47 pkgconfig-gen/installed_files.txt new file mode 100644 index 0000000..94de704 --- /dev/null +++ b/test cases/common/47 pkgconfig-gen/installed_files.txt @@ -0,0 +1,4 @@ +usr/include/simple.h +usr/lib/pkgconfig/simple.pc +usr/lib/pkgconfig/libfoo.pc +usr/lib/pkgconfig/libhello.pc diff --git a/test cases/common/47 pkgconfig-gen/meson.build b/test cases/common/47 pkgconfig-gen/meson.build new file mode 100644 index 0000000..7e6c670 --- /dev/null +++ b/test cases/common/47 pkgconfig-gen/meson.build @@ -0,0 +1,54 @@ +project('pkgconfig-gen', 'c') + +# First check we have pkg-config >= 0.29 + +pkgconfig = find_program('pkg-config', required: false) +if not pkgconfig.found() + error('MESON_SKIP_TEST: pkg-config not found') +endif + +v = run_command(pkgconfig, '--version').stdout().strip() +if v.version_compare('<0.29') + error('MESON_SKIP_TEST: pkg-config version \'' + v + '\' too old') +endif + +pkgg = import('pkgconfig') + +lib = shared_library('simple', 'simple.c') +libver = '1.0' +h = install_headers('simple.h') + +pkgg.generate( + libraries : [lib, '-lz'], + subdirs : '.', + version : libver, + name : 'libsimple', + filebase : 'simple', + description : 'A simple demo library.', + requires : 'glib-2.0', # Not really, but only here to test that this works. + requires_private : ['gio-2.0', 'gobject-2.0'], + libraries_private : [lib, '-lz'], +) + +test('pkgconfig-validation', pkgconfig, + args: ['--validate', 'simple'], + env: [ 'PKG_CONFIG_PATH=' + meson.current_build_dir() + '/meson-private' ]) + +# Test that name_prefix='' and name='libfoo' results in '-lfoo' +lib2 = shared_library('libfoo', 'simple.c', + name_prefix : '', + version : libver) + +pkgg.generate( + libraries : lib2, + name : 'libfoo', + version : libver, + description : 'A foo library.', + variables : ['foo=bar', 'datadir=${prefix}/data'] +) + +pkgg.generate( + name : 'libhello', + description : 'A minimalistic pkgconfig file.', + version : libver, +) diff --git a/test cases/common/47 pkgconfig-gen/simple.c b/test cases/common/47 pkgconfig-gen/simple.c new file mode 100644 index 0000000..e8a6d83 --- /dev/null +++ b/test cases/common/47 pkgconfig-gen/simple.c @@ -0,0 +1,5 @@ +#include"simple.h" + +int simple_function() { + return 42; +} diff --git a/test cases/common/47 pkgconfig-gen/simple.h b/test cases/common/47 pkgconfig-gen/simple.h new file mode 100644 index 0000000..bb52e6d --- /dev/null +++ b/test cases/common/47 pkgconfig-gen/simple.h @@ -0,0 +1,6 @@ +#ifndef SIMPLE_H_ +#define SIMPLE_H_ + +int simple_function(); + +#endif diff --git a/test cases/common/47 subproject options/meson.build b/test cases/common/47 subproject options/meson.build deleted file mode 100644 index d4598b6..0000000 --- a/test cases/common/47 subproject options/meson.build +++ /dev/null @@ -1,7 +0,0 @@ -project('suboptions', 'c') - -subproject('subproject') - -if not get_option('opt') - error('option unset when it should be set') -endif diff --git a/test cases/common/47 subproject options/meson_options.txt b/test cases/common/47 subproject options/meson_options.txt deleted file mode 100644 index c295ddd..0000000 --- a/test cases/common/47 subproject options/meson_options.txt +++ /dev/null @@ -1 +0,0 @@ -option('opt', type : 'boolean', value : true, description : 'main project option') diff --git a/test cases/common/47 subproject options/subprojects/subproject/meson.build b/test cases/common/47 subproject options/subprojects/subproject/meson.build deleted file mode 100644 index 5000b86..0000000 --- a/test cases/common/47 subproject options/subprojects/subproject/meson.build +++ /dev/null @@ -1,5 +0,0 @@ -project('subproject', 'c') - -if get_option('opt') - error('option set when it should be unset.') -endif diff --git a/test cases/common/47 subproject options/subprojects/subproject/meson_options.txt b/test cases/common/47 subproject options/subprojects/subproject/meson_options.txt deleted file mode 100644 index ac78533..0000000 --- a/test cases/common/47 subproject options/subprojects/subproject/meson_options.txt +++ /dev/null @@ -1 +0,0 @@ -option('opt', type : 'boolean', value : false, description : 'subproject option') diff --git a/test cases/common/48 custom install dirs/datafile.cat b/test cases/common/48 custom install dirs/datafile.cat new file mode 100644 index 0000000..53d81fc --- /dev/null +++ b/test cases/common/48 custom install dirs/datafile.cat @@ -0,0 +1 @@ +Installed cat is installed. diff --git a/test cases/common/48 custom install dirs/installed_files.txt b/test cases/common/48 custom install dirs/installed_files.txt new file mode 100644 index 0000000..4e17c2d --- /dev/null +++ b/test cases/common/48 custom install dirs/installed_files.txt @@ -0,0 +1,12 @@ +usr/dib/dab/dub/prog?exe +?msvc:usr/dib/dab/dub/prog.pdb +usr/dib/dab/dub2/prog2?exe +?msvc:usr/dib/dab/dub2/prog2.pdb +usr/some/dir/sample.h +usr/some/dir2/sample.h +usr/woman/prog.1 +usr/woman2/prog.1 +usr/meow/datafile.cat +usr/meow2/datafile.cat +usr/woof/subdir/datafile.dog +usr/woof2/subdir/datafile.dog diff --git a/test cases/common/48 custom install dirs/meson.build b/test cases/common/48 custom install dirs/meson.build new file mode 100644 index 0000000..494ff0e --- /dev/null +++ b/test cases/common/48 custom install dirs/meson.build @@ -0,0 +1,11 @@ +project('custom install dirs', 'c') +executable('prog', 'prog.c', install : true, install_dir : 'dib/dab/dub') +executable('prog2', 'prog.c', install : true, install_dir : get_option('prefix') + '/dib/dab/dub2') +install_headers('sample.h', install_dir : 'some/dir') +install_headers('sample.h', install_dir : get_option('prefix') + '/some/dir2') +install_man('prog.1', install_dir : 'woman') +install_man('prog.1', install_dir : get_option('prefix') + '/woman2') +install_data('datafile.cat', install_dir : 'meow') +install_data('datafile.cat', install_dir : get_option('prefix') + '/meow2') +install_subdir('subdir', install_dir : 'woof') +install_subdir('subdir', install_dir : get_option('prefix') + '/woof2') diff --git a/test cases/common/48 custom install dirs/prog.1 b/test cases/common/48 custom install dirs/prog.1 new file mode 100644 index 0000000..08ef7da --- /dev/null +++ b/test cases/common/48 custom install dirs/prog.1 @@ -0,0 +1 @@ +Man up, you. diff --git a/test cases/common/48 custom install dirs/prog.c b/test cases/common/48 custom install dirs/prog.c new file mode 100644 index 0000000..0f0061d --- /dev/null +++ b/test cases/common/48 custom install dirs/prog.c @@ -0,0 +1,3 @@ +int main(int argc, char **arv) { + return 0; +} diff --git a/test cases/common/48 custom install dirs/sample.h b/test cases/common/48 custom install dirs/sample.h new file mode 100644 index 0000000..dc030da --- /dev/null +++ b/test cases/common/48 custom install dirs/sample.h @@ -0,0 +1,6 @@ +#ifndef SAMPLE_H +#define SAMPLE_H + +int wackiness(); + +#endif diff --git a/test cases/common/48 custom install dirs/subdir/datafile.dog b/test cases/common/48 custom install dirs/subdir/datafile.dog new file mode 100644 index 0000000..7a5bcb7 --- /dev/null +++ b/test cases/common/48 custom install dirs/subdir/datafile.dog @@ -0,0 +1 @@ +Installed dog is installed. diff --git a/test cases/common/48 pkgconfig-gen/dependencies/custom.c b/test cases/common/48 pkgconfig-gen/dependencies/custom.c deleted file mode 100644 index 2cc5651..0000000 --- a/test cases/common/48 pkgconfig-gen/dependencies/custom.c +++ /dev/null @@ -1,3 +0,0 @@ -int custom_function() { - return 42; -} diff --git a/test cases/common/48 pkgconfig-gen/dependencies/exposed.c b/test cases/common/48 pkgconfig-gen/dependencies/exposed.c deleted file mode 100644 index 005202e..0000000 --- a/test cases/common/48 pkgconfig-gen/dependencies/exposed.c +++ /dev/null @@ -1,3 +0,0 @@ -int exposed_function() { - return 42; -} diff --git a/test cases/common/48 pkgconfig-gen/dependencies/internal.c b/test cases/common/48 pkgconfig-gen/dependencies/internal.c deleted file mode 100644 index 1a41b11..0000000 --- a/test cases/common/48 pkgconfig-gen/dependencies/internal.c +++ /dev/null @@ -1,3 +0,0 @@ -int internal_function() { - return 42; -} diff --git a/test cases/common/48 pkgconfig-gen/dependencies/meson.build b/test cases/common/48 pkgconfig-gen/dependencies/meson.build deleted file mode 100644 index c72f96b..0000000 --- a/test cases/common/48 pkgconfig-gen/dependencies/meson.build +++ /dev/null @@ -1,51 +0,0 @@ -project('pkgconfig-gen-dependencies', 'c', version: '1.0') - -pkgg = import('pkgconfig') - -# libmain internally use libinternal and expose libexpose in its API -exposed_lib = shared_library('libexposed', 'exposed.c') -internal_lib = shared_library('libinternal', 'internal.c') -main_lib = both_libraries('libmain', link_with : [exposed_lib, internal_lib]) -custom_lib = shared_library('custom', 'custom.c') - -pkgg.generate(exposed_lib) - -# Declare a few different Dependency objects -pc_dep = dependency('libfoo', version : '>=1.0') -pc_dep_dup = dependency('libfoo', version : '>= 1.0') -notfound_dep = dependency('notfound', required : false) -threads_dep = dependency('threads') -custom_dep = declare_dependency(link_with : custom_lib, compile_args : ['-DCUSTOM']) -custom2_dep = declare_dependency(link_args : ['-lcustom2'], compile_args : ['-DCUSTOM2']) - -# Generate a PC file: -# - Having libmain in libraries should pull implicitly libexposed and libinternal in Libs.private -# - Having libexposed in libraries should remove it from Libs.private -# - We generated a pc file for libexposed so it should be in Requires instead of Libs -# - Having threads_dep in libraries should add '-pthread' in both Libs and Cflags -# - Having custom_dep in libraries and libraries_private should only add it in Libs -# - Having custom2_dep in libraries_private should not add its Cflags -# - Having pc_dep in libraries_private should add it in Requires.private -# - pc_dep_dup is the same library and same version, should be ignored -# - notfound_dep is not required so it shouldn't appear in the pc file. -pkgg.generate(libraries : [main_lib, exposed_lib, threads_dep, threads_dep, custom_dep, custom_dep, '-pthread'], - libraries_private : [custom_dep, custom2_dep, custom2_dep, pc_dep, pc_dep_dup, notfound_dep], - version : '1.0', - name : 'dependency-test', - filebase : 'dependency-test', - description : 'A dependency test.' -) - -pkgg.generate( - name : 'requires-test', - version : '1.0', - description : 'Dependency Requires field test.', - requires : [exposed_lib, pc_dep, 'libhello'], -) - -pkgg.generate( - name : 'requires-private-test', - version : '1.0', - description : 'Dependency Requires.private field test.', - requires_private : [exposed_lib, pc_dep, 'libhello', notfound_dep], -) diff --git a/test cases/common/48 pkgconfig-gen/installed_files.txt b/test cases/common/48 pkgconfig-gen/installed_files.txt deleted file mode 100644 index 94de704..0000000 --- a/test cases/common/48 pkgconfig-gen/installed_files.txt +++ /dev/null @@ -1,4 +0,0 @@ -usr/include/simple.h -usr/lib/pkgconfig/simple.pc -usr/lib/pkgconfig/libfoo.pc -usr/lib/pkgconfig/libhello.pc diff --git a/test cases/common/48 pkgconfig-gen/meson.build b/test cases/common/48 pkgconfig-gen/meson.build deleted file mode 100644 index 7e6c670..0000000 --- a/test cases/common/48 pkgconfig-gen/meson.build +++ /dev/null @@ -1,54 +0,0 @@ -project('pkgconfig-gen', 'c') - -# First check we have pkg-config >= 0.29 - -pkgconfig = find_program('pkg-config', required: false) -if not pkgconfig.found() - error('MESON_SKIP_TEST: pkg-config not found') -endif - -v = run_command(pkgconfig, '--version').stdout().strip() -if v.version_compare('<0.29') - error('MESON_SKIP_TEST: pkg-config version \'' + v + '\' too old') -endif - -pkgg = import('pkgconfig') - -lib = shared_library('simple', 'simple.c') -libver = '1.0' -h = install_headers('simple.h') - -pkgg.generate( - libraries : [lib, '-lz'], - subdirs : '.', - version : libver, - name : 'libsimple', - filebase : 'simple', - description : 'A simple demo library.', - requires : 'glib-2.0', # Not really, but only here to test that this works. - requires_private : ['gio-2.0', 'gobject-2.0'], - libraries_private : [lib, '-lz'], -) - -test('pkgconfig-validation', pkgconfig, - args: ['--validate', 'simple'], - env: [ 'PKG_CONFIG_PATH=' + meson.current_build_dir() + '/meson-private' ]) - -# Test that name_prefix='' and name='libfoo' results in '-lfoo' -lib2 = shared_library('libfoo', 'simple.c', - name_prefix : '', - version : libver) - -pkgg.generate( - libraries : lib2, - name : 'libfoo', - version : libver, - description : 'A foo library.', - variables : ['foo=bar', 'datadir=${prefix}/data'] -) - -pkgg.generate( - name : 'libhello', - description : 'A minimalistic pkgconfig file.', - version : libver, -) diff --git a/test cases/common/48 pkgconfig-gen/simple.c b/test cases/common/48 pkgconfig-gen/simple.c deleted file mode 100644 index e8a6d83..0000000 --- a/test cases/common/48 pkgconfig-gen/simple.c +++ /dev/null @@ -1,5 +0,0 @@ -#include"simple.h" - -int simple_function() { - return 42; -} diff --git a/test cases/common/48 pkgconfig-gen/simple.h b/test cases/common/48 pkgconfig-gen/simple.h deleted file mode 100644 index bb52e6d..0000000 --- a/test cases/common/48 pkgconfig-gen/simple.h +++ /dev/null @@ -1,6 +0,0 @@ -#ifndef SIMPLE_H_ -#define SIMPLE_H_ - -int simple_function(); - -#endif diff --git a/test cases/common/49 custom install dirs/datafile.cat b/test cases/common/49 custom install dirs/datafile.cat deleted file mode 100644 index 53d81fc..0000000 --- a/test cases/common/49 custom install dirs/datafile.cat +++ /dev/null @@ -1 +0,0 @@ -Installed cat is installed. diff --git a/test cases/common/49 custom install dirs/installed_files.txt b/test cases/common/49 custom install dirs/installed_files.txt deleted file mode 100644 index 4e17c2d..0000000 --- a/test cases/common/49 custom install dirs/installed_files.txt +++ /dev/null @@ -1,12 +0,0 @@ -usr/dib/dab/dub/prog?exe -?msvc:usr/dib/dab/dub/prog.pdb -usr/dib/dab/dub2/prog2?exe -?msvc:usr/dib/dab/dub2/prog2.pdb -usr/some/dir/sample.h -usr/some/dir2/sample.h -usr/woman/prog.1 -usr/woman2/prog.1 -usr/meow/datafile.cat -usr/meow2/datafile.cat -usr/woof/subdir/datafile.dog -usr/woof2/subdir/datafile.dog diff --git a/test cases/common/49 custom install dirs/meson.build b/test cases/common/49 custom install dirs/meson.build deleted file mode 100644 index 494ff0e..0000000 --- a/test cases/common/49 custom install dirs/meson.build +++ /dev/null @@ -1,11 +0,0 @@ -project('custom install dirs', 'c') -executable('prog', 'prog.c', install : true, install_dir : 'dib/dab/dub') -executable('prog2', 'prog.c', install : true, install_dir : get_option('prefix') + '/dib/dab/dub2') -install_headers('sample.h', install_dir : 'some/dir') -install_headers('sample.h', install_dir : get_option('prefix') + '/some/dir2') -install_man('prog.1', install_dir : 'woman') -install_man('prog.1', install_dir : get_option('prefix') + '/woman2') -install_data('datafile.cat', install_dir : 'meow') -install_data('datafile.cat', install_dir : get_option('prefix') + '/meow2') -install_subdir('subdir', install_dir : 'woof') -install_subdir('subdir', install_dir : get_option('prefix') + '/woof2') diff --git a/test cases/common/49 custom install dirs/prog.1 b/test cases/common/49 custom install dirs/prog.1 deleted file mode 100644 index 08ef7da..0000000 --- a/test cases/common/49 custom install dirs/prog.1 +++ /dev/null @@ -1 +0,0 @@ -Man up, you. diff --git a/test cases/common/49 custom install dirs/prog.c b/test cases/common/49 custom install dirs/prog.c deleted file mode 100644 index 0f0061d..0000000 --- a/test cases/common/49 custom install dirs/prog.c +++ /dev/null @@ -1,3 +0,0 @@ -int main(int argc, char **arv) { - return 0; -} diff --git a/test cases/common/49 custom install dirs/sample.h b/test cases/common/49 custom install dirs/sample.h deleted file mode 100644 index dc030da..0000000 --- a/test cases/common/49 custom install dirs/sample.h +++ /dev/null @@ -1,6 +0,0 @@ -#ifndef SAMPLE_H -#define SAMPLE_H - -int wackiness(); - -#endif diff --git a/test cases/common/49 custom install dirs/subdir/datafile.dog b/test cases/common/49 custom install dirs/subdir/datafile.dog deleted file mode 100644 index 7a5bcb7..0000000 --- a/test cases/common/49 custom install dirs/subdir/datafile.dog +++ /dev/null @@ -1 +0,0 @@ -Installed dog is installed. diff --git a/test cases/common/49 subproject subproject/meson.build b/test cases/common/49 subproject subproject/meson.build new file mode 100644 index 0000000..d8735a1 --- /dev/null +++ b/test cases/common/49 subproject subproject/meson.build @@ -0,0 +1,11 @@ +project('sub sub', 'c') + +a = subproject('a') +lib = a.get_variable('l') + +dependency('not-found-dep', required : false, + version : '>=1', + fallback : ['c', 'notfound_dep']) + +exe = executable('prog', 'prog.c', link_with : lib) +test('basic', exe) diff --git a/test cases/common/49 subproject subproject/prog.c b/test cases/common/49 subproject subproject/prog.c new file mode 100644 index 0000000..394f139 --- /dev/null +++ b/test cases/common/49 subproject subproject/prog.c @@ -0,0 +1,5 @@ +int func(); + +int main(int argc, char **argv) { + return func() == 42 ? 0 : 1; +} diff --git a/test cases/common/49 subproject subproject/subprojects/a/a.c b/test cases/common/49 subproject subproject/subprojects/a/a.c new file mode 100644 index 0000000..7ac3e5e --- /dev/null +++ b/test cases/common/49 subproject subproject/subprojects/a/a.c @@ -0,0 +1,15 @@ +int func2(); + +#if defined _WIN32 || defined __CYGWIN__ + #define DLL_PUBLIC __declspec(dllexport) +#else + #if defined __GNUC__ + #define DLL_PUBLIC __attribute__ ((visibility("default"))) + #else + #pragma message ("Compiler does not support symbol visibility.") + #define DLL_PUBLIC + #endif +#endif + +int DLL_PUBLIC func() { return func2(); } + diff --git a/test cases/common/49 subproject subproject/subprojects/a/meson.build b/test cases/common/49 subproject subproject/subprojects/a/meson.build new file mode 100644 index 0000000..f0dfc44 --- /dev/null +++ b/test cases/common/49 subproject subproject/subprojects/a/meson.build @@ -0,0 +1,4 @@ +project('a', 'c') + +b = subproject('b') +l = shared_library('a', 'a.c', link_with : b.get_variable('lb')) diff --git a/test cases/common/49 subproject subproject/subprojects/b/b.c b/test cases/common/49 subproject subproject/subprojects/b/b.c new file mode 100644 index 0000000..a95651b --- /dev/null +++ b/test cases/common/49 subproject subproject/subprojects/b/b.c @@ -0,0 +1,14 @@ +#if defined _WIN32 || defined __CYGWIN__ + #define DLL_PUBLIC __declspec(dllexport) +#else + #if defined __GNUC__ + #define DLL_PUBLIC __attribute__ ((visibility("default"))) + #else + #pragma message ("Compiler does not support symbol visibility.") + #define DLL_PUBLIC + #endif +#endif + +int DLL_PUBLIC func2() { + return 42; +} diff --git a/test cases/common/49 subproject subproject/subprojects/b/meson.build b/test cases/common/49 subproject subproject/subprojects/b/meson.build new file mode 100644 index 0000000..e7af606 --- /dev/null +++ b/test cases/common/49 subproject subproject/subprojects/b/meson.build @@ -0,0 +1,3 @@ +project('b', 'c') + +lb = shared_library('b', 'b.c') diff --git a/test cases/common/49 subproject subproject/subprojects/c/meson.build b/test cases/common/49 subproject subproject/subprojects/c/meson.build new file mode 100644 index 0000000..97a5be1 --- /dev/null +++ b/test cases/common/49 subproject subproject/subprojects/c/meson.build @@ -0,0 +1,3 @@ +project('not-found-dep-subproj', 'c', version : '1.0') + +notfound_dep = dependency('', required : false) diff --git a/test cases/common/50 same file name/d1/file.c b/test cases/common/50 same file name/d1/file.c new file mode 100644 index 0000000..8084d73 --- /dev/null +++ b/test cases/common/50 same file name/d1/file.c @@ -0,0 +1 @@ +int func1() { return 42; } diff --git a/test cases/common/50 same file name/d2/file.c b/test cases/common/50 same file name/d2/file.c new file mode 100644 index 0000000..d1444a2 --- /dev/null +++ b/test cases/common/50 same file name/d2/file.c @@ -0,0 +1 @@ +int func2() { return 42; } diff --git a/test cases/common/50 same file name/meson.build b/test cases/common/50 same file name/meson.build new file mode 100644 index 0000000..3f351af --- /dev/null +++ b/test cases/common/50 same file name/meson.build @@ -0,0 +1,3 @@ +project('samefile', 'c') + +test('basic', executable('prog', 'prog.c', 'd1/file.c', 'd2/file.c')) diff --git a/test cases/common/50 same file name/prog.c b/test cases/common/50 same file name/prog.c new file mode 100644 index 0000000..3441288 --- /dev/null +++ b/test cases/common/50 same file name/prog.c @@ -0,0 +1,6 @@ +int func1(); +int func2(); + +int main(int argc, char **argv) { + return func1() - func2(); +} diff --git a/test cases/common/50 subproject subproject/meson.build b/test cases/common/50 subproject subproject/meson.build deleted file mode 100644 index d8735a1..0000000 --- a/test cases/common/50 subproject subproject/meson.build +++ /dev/null @@ -1,11 +0,0 @@ -project('sub sub', 'c') - -a = subproject('a') -lib = a.get_variable('l') - -dependency('not-found-dep', required : false, - version : '>=1', - fallback : ['c', 'notfound_dep']) - -exe = executable('prog', 'prog.c', link_with : lib) -test('basic', exe) diff --git a/test cases/common/50 subproject subproject/prog.c b/test cases/common/50 subproject subproject/prog.c deleted file mode 100644 index 394f139..0000000 --- a/test cases/common/50 subproject subproject/prog.c +++ /dev/null @@ -1,5 +0,0 @@ -int func(); - -int main(int argc, char **argv) { - return func() == 42 ? 0 : 1; -} diff --git a/test cases/common/50 subproject subproject/subprojects/a/a.c b/test cases/common/50 subproject subproject/subprojects/a/a.c deleted file mode 100644 index 7ac3e5e..0000000 --- a/test cases/common/50 subproject subproject/subprojects/a/a.c +++ /dev/null @@ -1,15 +0,0 @@ -int func2(); - -#if defined _WIN32 || defined __CYGWIN__ - #define DLL_PUBLIC __declspec(dllexport) -#else - #if defined __GNUC__ - #define DLL_PUBLIC __attribute__ ((visibility("default"))) - #else - #pragma message ("Compiler does not support symbol visibility.") - #define DLL_PUBLIC - #endif -#endif - -int DLL_PUBLIC func() { return func2(); } - diff --git a/test cases/common/50 subproject subproject/subprojects/a/meson.build b/test cases/common/50 subproject subproject/subprojects/a/meson.build deleted file mode 100644 index f0dfc44..0000000 --- a/test cases/common/50 subproject subproject/subprojects/a/meson.build +++ /dev/null @@ -1,4 +0,0 @@ -project('a', 'c') - -b = subproject('b') -l = shared_library('a', 'a.c', link_with : b.get_variable('lb')) diff --git a/test cases/common/50 subproject subproject/subprojects/b/b.c b/test cases/common/50 subproject subproject/subprojects/b/b.c deleted file mode 100644 index a95651b..0000000 --- a/test cases/common/50 subproject subproject/subprojects/b/b.c +++ /dev/null @@ -1,14 +0,0 @@ -#if defined _WIN32 || defined __CYGWIN__ - #define DLL_PUBLIC __declspec(dllexport) -#else - #if defined __GNUC__ - #define DLL_PUBLIC __attribute__ ((visibility("default"))) - #else - #pragma message ("Compiler does not support symbol visibility.") - #define DLL_PUBLIC - #endif -#endif - -int DLL_PUBLIC func2() { - return 42; -} diff --git a/test cases/common/50 subproject subproject/subprojects/b/meson.build b/test cases/common/50 subproject subproject/subprojects/b/meson.build deleted file mode 100644 index e7af606..0000000 --- a/test cases/common/50 subproject subproject/subprojects/b/meson.build +++ /dev/null @@ -1,3 +0,0 @@ -project('b', 'c') - -lb = shared_library('b', 'b.c') diff --git a/test cases/common/50 subproject subproject/subprojects/c/meson.build b/test cases/common/50 subproject subproject/subprojects/c/meson.build deleted file mode 100644 index 97a5be1..0000000 --- a/test cases/common/50 subproject subproject/subprojects/c/meson.build +++ /dev/null @@ -1,3 +0,0 @@ -project('not-found-dep-subproj', 'c', version : '1.0') - -notfound_dep = dependency('', required : false) diff --git a/test cases/common/51 file grabber/a.c b/test cases/common/51 file grabber/a.c new file mode 100644 index 0000000..bee8ad7 --- /dev/null +++ b/test cases/common/51 file grabber/a.c @@ -0,0 +1 @@ +int funca() { return 0; } diff --git a/test cases/common/51 file grabber/b.c b/test cases/common/51 file grabber/b.c new file mode 100644 index 0000000..0fdd162 --- /dev/null +++ b/test cases/common/51 file grabber/b.c @@ -0,0 +1 @@ +int funcb() { return 0; } diff --git a/test cases/common/51 file grabber/c.c b/test cases/common/51 file grabber/c.c new file mode 100644 index 0000000..63f951c --- /dev/null +++ b/test cases/common/51 file grabber/c.c @@ -0,0 +1 @@ +int funcc() { return 0; } diff --git a/test cases/common/51 file grabber/grabber.bat b/test cases/common/51 file grabber/grabber.bat new file mode 100644 index 0000000..8660314 --- /dev/null +++ b/test cases/common/51 file grabber/grabber.bat @@ -0,0 +1,5 @@ +@ECHO OFF +echo a.c +echo b.c +echo c.c +echo prog.c diff --git a/test cases/common/51 file grabber/grabber.sh b/test cases/common/51 file grabber/grabber.sh new file mode 100755 index 0000000..5e8f4b9 --- /dev/null +++ b/test cases/common/51 file grabber/grabber.sh @@ -0,0 +1,5 @@ +#!/bin/sh + +for i in *.c; do + echo $i +done diff --git a/test cases/common/51 file grabber/grabber2.bat b/test cases/common/51 file grabber/grabber2.bat new file mode 100644 index 0000000..d1a3f98 --- /dev/null +++ b/test cases/common/51 file grabber/grabber2.bat @@ -0,0 +1,5 @@ +@ECHO OFF +echo suba.c +echo subb.c +echo subc.c +echo subprog.c diff --git a/test cases/common/51 file grabber/meson.build b/test cases/common/51 file grabber/meson.build new file mode 100644 index 0000000..e332c0b --- /dev/null +++ b/test cases/common/51 file grabber/meson.build @@ -0,0 +1,35 @@ +project('grabber', 'c') + +# What this script does is NOT reliable. Simply adding a file in this directory +# will NOT make it automatically appear in the build. You have to manually +# re-invoke Meson (not just Ninja) for that to happen. The simplest way +# is to touch meson-private/coredata.dat. + +# This is not the recommended way to do things, but if the tradeoffs are +# acceptable to you, then we're certainly not going to stop you. Just don't +# file bugs when it fails. :) + +if build_machine.system() == 'windows' + c = run_command('grabber.bat') + grabber = find_program('grabber2.bat') +else + c = run_command('grabber.sh') + grabber = find_program('grabber.sh') +endif + + +# First test running command explicitly. +if c.returncode() != 0 + error('Executing script failed.') +endif + +newline = ''' +''' + +sources = c.stdout().strip().split(newline) + +e = executable('prog', sources) +test('grabtest', e) + +# Then test using program with find_program +subdir('subdir') diff --git a/test cases/common/51 file grabber/prog.c b/test cases/common/51 file grabber/prog.c new file mode 100644 index 0000000..3524f60 --- /dev/null +++ b/test cases/common/51 file grabber/prog.c @@ -0,0 +1,7 @@ +int funca(); +int funcb(); +int funcc(); + +int main(int argc, char **argv) { + return funca() + funcb() + funcc(); +} diff --git a/test cases/common/51 file grabber/subdir/meson.build b/test cases/common/51 file grabber/subdir/meson.build new file mode 100644 index 0000000..230d6f7 --- /dev/null +++ b/test cases/common/51 file grabber/subdir/meson.build @@ -0,0 +1,5 @@ +sc = run_command(grabber) +subsources = sc.stdout().strip().split(newline) + +se = executable('subprog', subsources) +test('subgrabtest', se) diff --git a/test cases/common/51 file grabber/subdir/suba.c b/test cases/common/51 file grabber/subdir/suba.c new file mode 100644 index 0000000..bee8ad7 --- /dev/null +++ b/test cases/common/51 file grabber/subdir/suba.c @@ -0,0 +1 @@ +int funca() { return 0; } diff --git a/test cases/common/51 file grabber/subdir/subb.c b/test cases/common/51 file grabber/subdir/subb.c new file mode 100644 index 0000000..0fdd162 --- /dev/null +++ b/test cases/common/51 file grabber/subdir/subb.c @@ -0,0 +1 @@ +int funcb() { return 0; } diff --git a/test cases/common/51 file grabber/subdir/subc.c b/test cases/common/51 file grabber/subdir/subc.c new file mode 100644 index 0000000..63f951c --- /dev/null +++ b/test cases/common/51 file grabber/subdir/subc.c @@ -0,0 +1 @@ +int funcc() { return 0; } diff --git a/test cases/common/51 file grabber/subdir/subprog.c b/test cases/common/51 file grabber/subdir/subprog.c new file mode 100644 index 0000000..3524f60 --- /dev/null +++ b/test cases/common/51 file grabber/subdir/subprog.c @@ -0,0 +1,7 @@ +int funca(); +int funcb(); +int funcc(); + +int main(int argc, char **argv) { + return funca() + funcb() + funcc(); +} diff --git a/test cases/common/51 same file name/d1/file.c b/test cases/common/51 same file name/d1/file.c deleted file mode 100644 index 8084d73..0000000 --- a/test cases/common/51 same file name/d1/file.c +++ /dev/null @@ -1 +0,0 @@ -int func1() { return 42; } diff --git a/test cases/common/51 same file name/d2/file.c b/test cases/common/51 same file name/d2/file.c deleted file mode 100644 index d1444a2..0000000 --- a/test cases/common/51 same file name/d2/file.c +++ /dev/null @@ -1 +0,0 @@ -int func2() { return 42; } diff --git a/test cases/common/51 same file name/meson.build b/test cases/common/51 same file name/meson.build deleted file mode 100644 index 3f351af..0000000 --- a/test cases/common/51 same file name/meson.build +++ /dev/null @@ -1,3 +0,0 @@ -project('samefile', 'c') - -test('basic', executable('prog', 'prog.c', 'd1/file.c', 'd2/file.c')) diff --git a/test cases/common/51 same file name/prog.c b/test cases/common/51 same file name/prog.c deleted file mode 100644 index 3441288..0000000 --- a/test cases/common/51 same file name/prog.c +++ /dev/null @@ -1,6 +0,0 @@ -int func1(); -int func2(); - -int main(int argc, char **argv) { - return func1() - func2(); -} diff --git a/test cases/common/52 custom target/data_source.txt b/test cases/common/52 custom target/data_source.txt new file mode 100644 index 0000000..0c23cc0 --- /dev/null +++ b/test cases/common/52 custom target/data_source.txt @@ -0,0 +1 @@ +This is a text only input file. diff --git a/test cases/common/52 custom target/depfile/dep.py b/test cases/common/52 custom target/depfile/dep.py new file mode 100755 index 0000000..476e88b --- /dev/null +++ b/test cases/common/52 custom target/depfile/dep.py @@ -0,0 +1,15 @@ +#!/usr/bin/env python + +import sys, os +from glob import glob + +_, srcdir, depfile, output = sys.argv + +depfiles = glob(os.path.join(srcdir, '*')) + +quoted_depfiles = [x.replace(' ', r'\ ') for x in depfiles] + +with open(output, 'w') as f: + f.write('I am the result of globbing.') +with open(depfile, 'w') as f: + f.write('%s: %s\n' % (output, ' '.join(quoted_depfiles))) diff --git a/test cases/common/52 custom target/depfile/meson.build b/test cases/common/52 custom target/depfile/meson.build new file mode 100644 index 0000000..46bca74 --- /dev/null +++ b/test cases/common/52 custom target/depfile/meson.build @@ -0,0 +1,7 @@ + + +mytarget = custom_target('depfile', + output : 'dep.dat', + depfile : 'dep.dat.d', + command : [find_program('dep.py'), meson.current_source_dir(), '@DEPFILE@', '@OUTPUT@'], +) diff --git a/test cases/common/52 custom target/installed_files.txt b/test cases/common/52 custom target/installed_files.txt new file mode 100644 index 0000000..d90a6b0 --- /dev/null +++ b/test cases/common/52 custom target/installed_files.txt @@ -0,0 +1 @@ +usr/subdir/data.dat diff --git a/test cases/common/52 custom target/meson.build b/test cases/common/52 custom target/meson.build new file mode 100644 index 0000000..2e6f69c --- /dev/null +++ b/test cases/common/52 custom target/meson.build @@ -0,0 +1,22 @@ +project('custom target', 'c') + +python = find_program('python3', required : false) +if not python.found() + python = find_program('python') +endif + +# Note that this will not add a dependency to the compiler executable. +# Code will not be rebuilt if it changes. +comp = '@0@/@1@'.format(meson.current_source_dir(), 'my_compiler.py') +# Test that files() in command: works. The compiler just discards it. +useless = files('installed_files.txt') + +mytarget = custom_target('bindat', +output : 'data.dat', +input : 'data_source.txt', +command : [python, comp, '--input=@INPUT@', '--output=@OUTPUT@', useless], +install : true, +install_dir : 'subdir' +) + +subdir('depfile') diff --git a/test cases/common/52 custom target/my_compiler.py b/test cases/common/52 custom target/my_compiler.py new file mode 100755 index 0000000..f46d23a --- /dev/null +++ b/test cases/common/52 custom target/my_compiler.py @@ -0,0 +1,21 @@ +#!/usr/bin/env python3 + +import os +import sys + +assert(os.path.exists(sys.argv[3])) + +args = sys.argv[:-1] + +if __name__ == '__main__': + if len(args) != 3 or not args[1].startswith('--input') or \ + not args[2].startswith('--output'): + print(args[0], '--input=input_file --output=output_file') + sys.exit(1) + with open(args[1].split('=')[1]) as f: + ifile = f.read() + if ifile != 'This is a text only input file.\n': + print('Malformed input') + sys.exit(1) + with open(args[2].split('=')[1], 'w') as ofile: + ofile.write('This is a binary output file.\n') diff --git a/test cases/common/52 file grabber/a.c b/test cases/common/52 file grabber/a.c deleted file mode 100644 index bee8ad7..0000000 --- a/test cases/common/52 file grabber/a.c +++ /dev/null @@ -1 +0,0 @@ -int funca() { return 0; } diff --git a/test cases/common/52 file grabber/b.c b/test cases/common/52 file grabber/b.c deleted file mode 100644 index 0fdd162..0000000 --- a/test cases/common/52 file grabber/b.c +++ /dev/null @@ -1 +0,0 @@ -int funcb() { return 0; } diff --git a/test cases/common/52 file grabber/c.c b/test cases/common/52 file grabber/c.c deleted file mode 100644 index 63f951c..0000000 --- a/test cases/common/52 file grabber/c.c +++ /dev/null @@ -1 +0,0 @@ -int funcc() { return 0; } diff --git a/test cases/common/52 file grabber/grabber.bat b/test cases/common/52 file grabber/grabber.bat deleted file mode 100644 index 8660314..0000000 --- a/test cases/common/52 file grabber/grabber.bat +++ /dev/null @@ -1,5 +0,0 @@ -@ECHO OFF -echo a.c -echo b.c -echo c.c -echo prog.c diff --git a/test cases/common/52 file grabber/grabber.sh b/test cases/common/52 file grabber/grabber.sh deleted file mode 100755 index 5e8f4b9..0000000 --- a/test cases/common/52 file grabber/grabber.sh +++ /dev/null @@ -1,5 +0,0 @@ -#!/bin/sh - -for i in *.c; do - echo $i -done diff --git a/test cases/common/52 file grabber/grabber2.bat b/test cases/common/52 file grabber/grabber2.bat deleted file mode 100644 index d1a3f98..0000000 --- a/test cases/common/52 file grabber/grabber2.bat +++ /dev/null @@ -1,5 +0,0 @@ -@ECHO OFF -echo suba.c -echo subb.c -echo subc.c -echo subprog.c diff --git a/test cases/common/52 file grabber/meson.build b/test cases/common/52 file grabber/meson.build deleted file mode 100644 index e332c0b..0000000 --- a/test cases/common/52 file grabber/meson.build +++ /dev/null @@ -1,35 +0,0 @@ -project('grabber', 'c') - -# What this script does is NOT reliable. Simply adding a file in this directory -# will NOT make it automatically appear in the build. You have to manually -# re-invoke Meson (not just Ninja) for that to happen. The simplest way -# is to touch meson-private/coredata.dat. - -# This is not the recommended way to do things, but if the tradeoffs are -# acceptable to you, then we're certainly not going to stop you. Just don't -# file bugs when it fails. :) - -if build_machine.system() == 'windows' - c = run_command('grabber.bat') - grabber = find_program('grabber2.bat') -else - c = run_command('grabber.sh') - grabber = find_program('grabber.sh') -endif - - -# First test running command explicitly. -if c.returncode() != 0 - error('Executing script failed.') -endif - -newline = ''' -''' - -sources = c.stdout().strip().split(newline) - -e = executable('prog', sources) -test('grabtest', e) - -# Then test using program with find_program -subdir('subdir') diff --git a/test cases/common/52 file grabber/prog.c b/test cases/common/52 file grabber/prog.c deleted file mode 100644 index 3524f60..0000000 --- a/test cases/common/52 file grabber/prog.c +++ /dev/null @@ -1,7 +0,0 @@ -int funca(); -int funcb(); -int funcc(); - -int main(int argc, char **argv) { - return funca() + funcb() + funcc(); -} diff --git a/test cases/common/52 file grabber/subdir/meson.build b/test cases/common/52 file grabber/subdir/meson.build deleted file mode 100644 index 230d6f7..0000000 --- a/test cases/common/52 file grabber/subdir/meson.build +++ /dev/null @@ -1,5 +0,0 @@ -sc = run_command(grabber) -subsources = sc.stdout().strip().split(newline) - -se = executable('subprog', subsources) -test('subgrabtest', se) diff --git a/test cases/common/52 file grabber/subdir/suba.c b/test cases/common/52 file grabber/subdir/suba.c deleted file mode 100644 index bee8ad7..0000000 --- a/test cases/common/52 file grabber/subdir/suba.c +++ /dev/null @@ -1 +0,0 @@ -int funca() { return 0; } diff --git a/test cases/common/52 file grabber/subdir/subb.c b/test cases/common/52 file grabber/subdir/subb.c deleted file mode 100644 index 0fdd162..0000000 --- a/test cases/common/52 file grabber/subdir/subb.c +++ /dev/null @@ -1 +0,0 @@ -int funcb() { return 0; } diff --git a/test cases/common/52 file grabber/subdir/subc.c b/test cases/common/52 file grabber/subdir/subc.c deleted file mode 100644 index 63f951c..0000000 --- a/test cases/common/52 file grabber/subdir/subc.c +++ /dev/null @@ -1 +0,0 @@ -int funcc() { return 0; } diff --git a/test cases/common/52 file grabber/subdir/subprog.c b/test cases/common/52 file grabber/subdir/subprog.c deleted file mode 100644 index 3524f60..0000000 --- a/test cases/common/52 file grabber/subdir/subprog.c +++ /dev/null @@ -1,7 +0,0 @@ -int funca(); -int funcb(); -int funcc(); - -int main(int argc, char **argv) { - return funca() + funcb() + funcc(); -} diff --git a/test cases/common/53 custom target chain/data_source.txt b/test cases/common/53 custom target chain/data_source.txt new file mode 100644 index 0000000..0c23cc0 --- /dev/null +++ b/test cases/common/53 custom target chain/data_source.txt @@ -0,0 +1 @@ +This is a text only input file. diff --git a/test cases/common/53 custom target chain/installed_files.txt b/test cases/common/53 custom target chain/installed_files.txt new file mode 100644 index 0000000..7feb072 --- /dev/null +++ b/test cases/common/53 custom target chain/installed_files.txt @@ -0,0 +1,2 @@ +usr/subdir/data2.dat +usr/subdir/data3.dat diff --git a/test cases/common/53 custom target chain/meson.build b/test cases/common/53 custom target chain/meson.build new file mode 100644 index 0000000..138f795 --- /dev/null +++ b/test cases/common/53 custom target chain/meson.build @@ -0,0 +1,34 @@ +project('custom target', 'c') + +python = find_program('python3', required : false) +if not python.found() + python = find_program('python') +endif + +# files() is the correct way to do this, but some people +# do this so test that it works. +comp = '@0@/@1@'.format(meson.current_source_dir(), 'my_compiler.py') +comp2 = '@0@/@1@'.format(meson.current_source_dir(), 'my_compiler2.py') +infile = files('data_source.txt')[0] + +mytarget = custom_target('bindat', + output : 'data.dat', + command : [python, comp, infile, '@OUTPUT@'], +) + +mytarget2 = custom_target('bindat2', + output : 'data2.dat', + command : [python, comp2, mytarget, '@OUTPUT@'], + install : true, + install_dir : 'subdir' +) + +mytarget3 = custom_target('bindat3', + output : 'data3.dat', + input : [mytarget], + command : [python, comp2, '@INPUT@', '@OUTPUT@'], + install : true, + install_dir : 'subdir' +) + +subdir('usetarget') diff --git a/test cases/common/53 custom target chain/my_compiler.py b/test cases/common/53 custom target chain/my_compiler.py new file mode 100755 index 0000000..9cf4425 --- /dev/null +++ b/test cases/common/53 custom target chain/my_compiler.py @@ -0,0 +1,15 @@ +#!/usr/bin/env python + +import sys + +if __name__ == '__main__': + if len(sys.argv) != 3: + print(sys.argv[0], 'input_file output_file') + sys.exit(1) + with open(sys.argv[1]) as f: + ifile = f.read() + if ifile != 'This is a text only input file.\n': + print('Malformed input') + sys.exit(1) + with open(sys.argv[2], 'w') as ofile: + ofile.write('This is a binary output file.\n') diff --git a/test cases/common/53 custom target chain/my_compiler2.py b/test cases/common/53 custom target chain/my_compiler2.py new file mode 100755 index 0000000..0191f3f --- /dev/null +++ b/test cases/common/53 custom target chain/my_compiler2.py @@ -0,0 +1,15 @@ +#!/usr/bin/env python + +import sys + +if __name__ == '__main__': + if len(sys.argv) != 3: + print(sys.argv[0], 'input_file output_file') + sys.exit(1) + with open(sys.argv[1]) as f: + ifile = f.read() + if ifile != 'This is a binary output file.\n': + print('Malformed input') + sys.exit(1) + with open(sys.argv[2], 'w') as ofile: + ofile.write('This is a different binary output file.\n') diff --git a/test cases/common/53 custom target chain/usetarget/meson.build b/test cases/common/53 custom target chain/usetarget/meson.build new file mode 100644 index 0000000..9aece8c --- /dev/null +++ b/test cases/common/53 custom target chain/usetarget/meson.build @@ -0,0 +1,8 @@ +e = executable('myexe', 'myexe.c') +subexe = find_program('subcomp.py') + +custom_target('use_exe', + input : e, + output : 'subout.res', + command : [subexe, '@INPUT@', '@OUTPUT@'], +) diff --git a/test cases/common/53 custom target chain/usetarget/myexe.c b/test cases/common/53 custom target chain/usetarget/myexe.c new file mode 100644 index 0000000..f9874fd --- /dev/null +++ b/test cases/common/53 custom target chain/usetarget/myexe.c @@ -0,0 +1,6 @@ +#include + +int main(int argc, char **argv) { + printf("I am myexe.\n"); + return 0; +} diff --git a/test cases/common/53 custom target chain/usetarget/subcomp.py b/test cases/common/53 custom target chain/usetarget/subcomp.py new file mode 100755 index 0000000..b5f6eb0 --- /dev/null +++ b/test cases/common/53 custom target chain/usetarget/subcomp.py @@ -0,0 +1,7 @@ +#!/usr/bin/env python + +import sys + +with open(sys.argv[1], 'rb') as ifile: + with open(sys.argv[2], 'w') as ofile: + ofile.write('Everything ok.\n') diff --git a/test cases/common/53 custom target/data_source.txt b/test cases/common/53 custom target/data_source.txt deleted file mode 100644 index 0c23cc0..0000000 --- a/test cases/common/53 custom target/data_source.txt +++ /dev/null @@ -1 +0,0 @@ -This is a text only input file. diff --git a/test cases/common/53 custom target/depfile/dep.py b/test cases/common/53 custom target/depfile/dep.py deleted file mode 100755 index 476e88b..0000000 --- a/test cases/common/53 custom target/depfile/dep.py +++ /dev/null @@ -1,15 +0,0 @@ -#!/usr/bin/env python - -import sys, os -from glob import glob - -_, srcdir, depfile, output = sys.argv - -depfiles = glob(os.path.join(srcdir, '*')) - -quoted_depfiles = [x.replace(' ', r'\ ') for x in depfiles] - -with open(output, 'w') as f: - f.write('I am the result of globbing.') -with open(depfile, 'w') as f: - f.write('%s: %s\n' % (output, ' '.join(quoted_depfiles))) diff --git a/test cases/common/53 custom target/depfile/meson.build b/test cases/common/53 custom target/depfile/meson.build deleted file mode 100644 index 46bca74..0000000 --- a/test cases/common/53 custom target/depfile/meson.build +++ /dev/null @@ -1,7 +0,0 @@ - - -mytarget = custom_target('depfile', - output : 'dep.dat', - depfile : 'dep.dat.d', - command : [find_program('dep.py'), meson.current_source_dir(), '@DEPFILE@', '@OUTPUT@'], -) diff --git a/test cases/common/53 custom target/installed_files.txt b/test cases/common/53 custom target/installed_files.txt deleted file mode 100644 index d90a6b0..0000000 --- a/test cases/common/53 custom target/installed_files.txt +++ /dev/null @@ -1 +0,0 @@ -usr/subdir/data.dat diff --git a/test cases/common/53 custom target/meson.build b/test cases/common/53 custom target/meson.build deleted file mode 100644 index 2e6f69c..0000000 --- a/test cases/common/53 custom target/meson.build +++ /dev/null @@ -1,22 +0,0 @@ -project('custom target', 'c') - -python = find_program('python3', required : false) -if not python.found() - python = find_program('python') -endif - -# Note that this will not add a dependency to the compiler executable. -# Code will not be rebuilt if it changes. -comp = '@0@/@1@'.format(meson.current_source_dir(), 'my_compiler.py') -# Test that files() in command: works. The compiler just discards it. -useless = files('installed_files.txt') - -mytarget = custom_target('bindat', -output : 'data.dat', -input : 'data_source.txt', -command : [python, comp, '--input=@INPUT@', '--output=@OUTPUT@', useless], -install : true, -install_dir : 'subdir' -) - -subdir('depfile') diff --git a/test cases/common/53 custom target/my_compiler.py b/test cases/common/53 custom target/my_compiler.py deleted file mode 100755 index f46d23a..0000000 --- a/test cases/common/53 custom target/my_compiler.py +++ /dev/null @@ -1,21 +0,0 @@ -#!/usr/bin/env python3 - -import os -import sys - -assert(os.path.exists(sys.argv[3])) - -args = sys.argv[:-1] - -if __name__ == '__main__': - if len(args) != 3 or not args[1].startswith('--input') or \ - not args[2].startswith('--output'): - print(args[0], '--input=input_file --output=output_file') - sys.exit(1) - with open(args[1].split('=')[1]) as f: - ifile = f.read() - if ifile != 'This is a text only input file.\n': - print('Malformed input') - sys.exit(1) - with open(args[2].split('=')[1], 'w') as ofile: - ofile.write('This is a binary output file.\n') diff --git a/test cases/common/54 custom target chain/data_source.txt b/test cases/common/54 custom target chain/data_source.txt deleted file mode 100644 index 0c23cc0..0000000 --- a/test cases/common/54 custom target chain/data_source.txt +++ /dev/null @@ -1 +0,0 @@ -This is a text only input file. diff --git a/test cases/common/54 custom target chain/installed_files.txt b/test cases/common/54 custom target chain/installed_files.txt deleted file mode 100644 index 7feb072..0000000 --- a/test cases/common/54 custom target chain/installed_files.txt +++ /dev/null @@ -1,2 +0,0 @@ -usr/subdir/data2.dat -usr/subdir/data3.dat diff --git a/test cases/common/54 custom target chain/meson.build b/test cases/common/54 custom target chain/meson.build deleted file mode 100644 index 138f795..0000000 --- a/test cases/common/54 custom target chain/meson.build +++ /dev/null @@ -1,34 +0,0 @@ -project('custom target', 'c') - -python = find_program('python3', required : false) -if not python.found() - python = find_program('python') -endif - -# files() is the correct way to do this, but some people -# do this so test that it works. -comp = '@0@/@1@'.format(meson.current_source_dir(), 'my_compiler.py') -comp2 = '@0@/@1@'.format(meson.current_source_dir(), 'my_compiler2.py') -infile = files('data_source.txt')[0] - -mytarget = custom_target('bindat', - output : 'data.dat', - command : [python, comp, infile, '@OUTPUT@'], -) - -mytarget2 = custom_target('bindat2', - output : 'data2.dat', - command : [python, comp2, mytarget, '@OUTPUT@'], - install : true, - install_dir : 'subdir' -) - -mytarget3 = custom_target('bindat3', - output : 'data3.dat', - input : [mytarget], - command : [python, comp2, '@INPUT@', '@OUTPUT@'], - install : true, - install_dir : 'subdir' -) - -subdir('usetarget') diff --git a/test cases/common/54 custom target chain/my_compiler.py b/test cases/common/54 custom target chain/my_compiler.py deleted file mode 100755 index 9cf4425..0000000 --- a/test cases/common/54 custom target chain/my_compiler.py +++ /dev/null @@ -1,15 +0,0 @@ -#!/usr/bin/env python - -import sys - -if __name__ == '__main__': - if len(sys.argv) != 3: - print(sys.argv[0], 'input_file output_file') - sys.exit(1) - with open(sys.argv[1]) as f: - ifile = f.read() - if ifile != 'This is a text only input file.\n': - print('Malformed input') - sys.exit(1) - with open(sys.argv[2], 'w') as ofile: - ofile.write('This is a binary output file.\n') diff --git a/test cases/common/54 custom target chain/my_compiler2.py b/test cases/common/54 custom target chain/my_compiler2.py deleted file mode 100755 index 0191f3f..0000000 --- a/test cases/common/54 custom target chain/my_compiler2.py +++ /dev/null @@ -1,15 +0,0 @@ -#!/usr/bin/env python - -import sys - -if __name__ == '__main__': - if len(sys.argv) != 3: - print(sys.argv[0], 'input_file output_file') - sys.exit(1) - with open(sys.argv[1]) as f: - ifile = f.read() - if ifile != 'This is a binary output file.\n': - print('Malformed input') - sys.exit(1) - with open(sys.argv[2], 'w') as ofile: - ofile.write('This is a different binary output file.\n') diff --git a/test cases/common/54 custom target chain/usetarget/meson.build b/test cases/common/54 custom target chain/usetarget/meson.build deleted file mode 100644 index 9aece8c..0000000 --- a/test cases/common/54 custom target chain/usetarget/meson.build +++ /dev/null @@ -1,8 +0,0 @@ -e = executable('myexe', 'myexe.c') -subexe = find_program('subcomp.py') - -custom_target('use_exe', - input : e, - output : 'subout.res', - command : [subexe, '@INPUT@', '@OUTPUT@'], -) diff --git a/test cases/common/54 custom target chain/usetarget/myexe.c b/test cases/common/54 custom target chain/usetarget/myexe.c deleted file mode 100644 index f9874fd..0000000 --- a/test cases/common/54 custom target chain/usetarget/myexe.c +++ /dev/null @@ -1,6 +0,0 @@ -#include - -int main(int argc, char **argv) { - printf("I am myexe.\n"); - return 0; -} diff --git a/test cases/common/54 custom target chain/usetarget/subcomp.py b/test cases/common/54 custom target chain/usetarget/subcomp.py deleted file mode 100755 index b5f6eb0..0000000 --- a/test cases/common/54 custom target chain/usetarget/subcomp.py +++ /dev/null @@ -1,7 +0,0 @@ -#!/usr/bin/env python - -import sys - -with open(sys.argv[1], 'rb') as ifile: - with open(sys.argv[2], 'w') as ofile: - ofile.write('Everything ok.\n') diff --git a/test cases/common/54 run target/check_exists.py b/test cases/common/54 run target/check_exists.py new file mode 100755 index 0000000..b6fc967 --- /dev/null +++ b/test cases/common/54 run target/check_exists.py @@ -0,0 +1,7 @@ +#!/usr/bin/env python3 + +import os +import sys + +if not os.path.isfile(sys.argv[1]): + raise Exception("Couldn't find {!r}".format(sys.argv[1])) diff --git a/test cases/common/54 run target/configure.in b/test cases/common/54 run target/configure.in new file mode 100755 index 0000000..0d42d04 --- /dev/null +++ b/test cases/common/54 run target/configure.in @@ -0,0 +1,3 @@ +#!/usr/bin/env python3 + +print('Success') \ No newline at end of file diff --git a/test cases/common/54 run target/converter.py b/test cases/common/54 run target/converter.py new file mode 100644 index 0000000..8dd31fe --- /dev/null +++ b/test cases/common/54 run target/converter.py @@ -0,0 +1,6 @@ +#!/usr/bin/env python3 + +import sys + +with open(sys.argv[1], 'rb') as ifile, open(sys.argv[2], 'wb') as ofile: + ofile.write(ifile.read()) diff --git a/test cases/common/54 run target/fakeburner.py b/test cases/common/54 run target/fakeburner.py new file mode 100755 index 0000000..da3d0ac --- /dev/null +++ b/test cases/common/54 run target/fakeburner.py @@ -0,0 +1,16 @@ +#!/usr/bin/env python3 + +from __future__ import print_function + +import sys + +plain_arg = sys.argv[1] +_, filename, _ = plain_arg.split(':') +try: + with open(filename, 'rb') as f: + content = f.read() +except FileNotFoundError: + print('Could not open file. Missing dependency?') + sys.exit(1) +print('File opened, pretending to send it somewhere.') +print(len(content), 'bytes uploaded') diff --git a/test cases/common/54 run target/helloprinter.c b/test cases/common/54 run target/helloprinter.c new file mode 100644 index 0000000..4a6e0ac --- /dev/null +++ b/test cases/common/54 run target/helloprinter.c @@ -0,0 +1,11 @@ +#include + +int main(int argc, char **argv) { + if(argc != 2) { + printf("I can not haz argument.\n"); + return 1; + } else { + printf("I can haz argument: %s\n", argv[1]); + } + return 0; +} diff --git a/test cases/common/54 run target/meson.build b/test cases/common/54 run target/meson.build new file mode 100644 index 0000000..93a4ad0 --- /dev/null +++ b/test cases/common/54 run target/meson.build @@ -0,0 +1,59 @@ +project('run target', 'c') + +# Make it possible to run built programs. +# In cross builds exe_wrapper should be added if it exists. + +exe = executable('helloprinter', 'helloprinter.c') +run_target('runhello', + command : [exe, 'argument']) + +converter = find_program('converter.py') + +hex = custom_target('exe.hex', + input : exe, + output : 'exe.hex', + command : [converter, '@INPUT@', '@OUTPUT@', + ], +) + +fakeburner = find_program('fakeburner.py') + +# These emulates the Arduino flasher application. It sandwiches the filename inside +# a packed argument. Thus we need to declare it manually. +run_target('upload', + command : [fakeburner, 'x:@0@:y'.format(exe.full_path())], + depends : exe, +) + +run_target('upload2', + command : [fakeburner, 'x:@0@:y'.format(hex.full_path())], + depends : hex, +) + +python3 = find_program('python3', required : false) +if not python3.found() + python3 = find_program('python') +endif + +run_target('py3hi', + command : [python3, '-c', 'print("I am Python3.")']) + +run_target('check_exists', + command : [find_program('check_exists.py'), files('helloprinter.c')]) + +# What if the output of a custom_target is the command to +# execute. Obviously this will not work as hex is not an +# executable but test that the output is generated correctly. +run_target('donotrunme', + command : hex) + +# Ensure configure files can be passed +conf = configure_file( + input: 'configure.in', + output: 'configure', + configuration: configuration_data() +) + +run_target('configure_script', + command : conf +) diff --git a/test cases/common/54 run target/scripts/script.sh b/test cases/common/54 run target/scripts/script.sh new file mode 100755 index 0000000..0adf263 --- /dev/null +++ b/test cases/common/54 run target/scripts/script.sh @@ -0,0 +1,5 @@ +#!/bin/sh + +cd "$MESON_SOURCE_ROOT" +echo My current directory is `pwd` +echo Build dir is at $MESON_BUILD_ROOT diff --git a/test cases/common/55 object generator/meson.build b/test cases/common/55 object generator/meson.build new file mode 100644 index 0000000..e20da6f --- /dev/null +++ b/test cases/common/55 object generator/meson.build @@ -0,0 +1,34 @@ +project('object generator', 'c') + +python = find_program('python3', required : false) +if not python.found() + python = find_program('python') +endif + +# Note that this will not add a dependency to the compiler executable. +# Code will not be rebuilt if it changes. +comp = '@0@/@1@'.format(meson.current_source_dir(), 'obj_generator.py') + +if host_machine.system() == 'windows' + outputname = '@BASENAME@.obj' +else + outputname = '@BASENAME@.o' +endif + +cc = meson.get_compiler('c').cmd_array().get(-1) +# Generate an object file manually. +gen = generator(python, + output : outputname, + arguments : [comp, cc, '@INPUT@', '@OUTPUT@']) + +generated = gen.process(['source.c', 'source2.c']) + +# Generate an object file with indexed OUTPUT replacement. +gen2 = generator(python, + output : outputname, + arguments : [comp, cc, '@INPUT@', '@OUTPUT0@']) +generated2 = gen2.process(['source3.c']) + +e = executable('prog', 'prog.c', generated, generated2) + +test('objgen', e) \ No newline at end of file diff --git a/test cases/common/55 object generator/obj_generator.py b/test cases/common/55 object generator/obj_generator.py new file mode 100755 index 0000000..a33872a --- /dev/null +++ b/test cases/common/55 object generator/obj_generator.py @@ -0,0 +1,18 @@ +#!/usr/bin/env python3 + +# Mimic a binary that generates an object file (e.g. windres). + +import sys, subprocess + +if __name__ == '__main__': + if len(sys.argv) != 4: + print(sys.argv[0], 'compiler input_file output_file') + sys.exit(1) + compiler = sys.argv[1] + ifile = sys.argv[2] + ofile = sys.argv[3] + if compiler.endswith('cl'): + cmd = [compiler, '/nologo', '/MDd', '/Fo' + ofile, '/c', ifile] + else: + cmd = [compiler, '-c', ifile, '-o', ofile] + sys.exit(subprocess.call(cmd)) diff --git a/test cases/common/55 object generator/prog.c b/test cases/common/55 object generator/prog.c new file mode 100644 index 0000000..60459d6 --- /dev/null +++ b/test cases/common/55 object generator/prog.c @@ -0,0 +1,7 @@ +int func1_in_obj(); +int func2_in_obj(); +int func3_in_obj(); + +int main(int argc, char **argv) { + return func1_in_obj() + func2_in_obj() + func3_in_obj(); +} diff --git a/test cases/common/55 object generator/source.c b/test cases/common/55 object generator/source.c new file mode 100644 index 0000000..7779b33 --- /dev/null +++ b/test cases/common/55 object generator/source.c @@ -0,0 +1,3 @@ +int func1_in_obj() { + return 0; +} diff --git a/test cases/common/55 object generator/source2.c b/test cases/common/55 object generator/source2.c new file mode 100644 index 0000000..29aad40 --- /dev/null +++ b/test cases/common/55 object generator/source2.c @@ -0,0 +1,3 @@ +int func2_in_obj() { + return 0; +} diff --git a/test cases/common/55 object generator/source3.c b/test cases/common/55 object generator/source3.c new file mode 100644 index 0000000..1580f1e --- /dev/null +++ b/test cases/common/55 object generator/source3.c @@ -0,0 +1,3 @@ +int func3_in_obj() { + return 0; +} diff --git a/test cases/common/55 run target/check_exists.py b/test cases/common/55 run target/check_exists.py deleted file mode 100755 index b6fc967..0000000 --- a/test cases/common/55 run target/check_exists.py +++ /dev/null @@ -1,7 +0,0 @@ -#!/usr/bin/env python3 - -import os -import sys - -if not os.path.isfile(sys.argv[1]): - raise Exception("Couldn't find {!r}".format(sys.argv[1])) diff --git a/test cases/common/55 run target/configure.in b/test cases/common/55 run target/configure.in deleted file mode 100755 index 0d42d04..0000000 --- a/test cases/common/55 run target/configure.in +++ /dev/null @@ -1,3 +0,0 @@ -#!/usr/bin/env python3 - -print('Success') \ No newline at end of file diff --git a/test cases/common/55 run target/converter.py b/test cases/common/55 run target/converter.py deleted file mode 100644 index 8dd31fe..0000000 --- a/test cases/common/55 run target/converter.py +++ /dev/null @@ -1,6 +0,0 @@ -#!/usr/bin/env python3 - -import sys - -with open(sys.argv[1], 'rb') as ifile, open(sys.argv[2], 'wb') as ofile: - ofile.write(ifile.read()) diff --git a/test cases/common/55 run target/fakeburner.py b/test cases/common/55 run target/fakeburner.py deleted file mode 100755 index da3d0ac..0000000 --- a/test cases/common/55 run target/fakeburner.py +++ /dev/null @@ -1,16 +0,0 @@ -#!/usr/bin/env python3 - -from __future__ import print_function - -import sys - -plain_arg = sys.argv[1] -_, filename, _ = plain_arg.split(':') -try: - with open(filename, 'rb') as f: - content = f.read() -except FileNotFoundError: - print('Could not open file. Missing dependency?') - sys.exit(1) -print('File opened, pretending to send it somewhere.') -print(len(content), 'bytes uploaded') diff --git a/test cases/common/55 run target/helloprinter.c b/test cases/common/55 run target/helloprinter.c deleted file mode 100644 index 4a6e0ac..0000000 --- a/test cases/common/55 run target/helloprinter.c +++ /dev/null @@ -1,11 +0,0 @@ -#include - -int main(int argc, char **argv) { - if(argc != 2) { - printf("I can not haz argument.\n"); - return 1; - } else { - printf("I can haz argument: %s\n", argv[1]); - } - return 0; -} diff --git a/test cases/common/55 run target/meson.build b/test cases/common/55 run target/meson.build deleted file mode 100644 index 93a4ad0..0000000 --- a/test cases/common/55 run target/meson.build +++ /dev/null @@ -1,59 +0,0 @@ -project('run target', 'c') - -# Make it possible to run built programs. -# In cross builds exe_wrapper should be added if it exists. - -exe = executable('helloprinter', 'helloprinter.c') -run_target('runhello', - command : [exe, 'argument']) - -converter = find_program('converter.py') - -hex = custom_target('exe.hex', - input : exe, - output : 'exe.hex', - command : [converter, '@INPUT@', '@OUTPUT@', - ], -) - -fakeburner = find_program('fakeburner.py') - -# These emulates the Arduino flasher application. It sandwiches the filename inside -# a packed argument. Thus we need to declare it manually. -run_target('upload', - command : [fakeburner, 'x:@0@:y'.format(exe.full_path())], - depends : exe, -) - -run_target('upload2', - command : [fakeburner, 'x:@0@:y'.format(hex.full_path())], - depends : hex, -) - -python3 = find_program('python3', required : false) -if not python3.found() - python3 = find_program('python') -endif - -run_target('py3hi', - command : [python3, '-c', 'print("I am Python3.")']) - -run_target('check_exists', - command : [find_program('check_exists.py'), files('helloprinter.c')]) - -# What if the output of a custom_target is the command to -# execute. Obviously this will not work as hex is not an -# executable but test that the output is generated correctly. -run_target('donotrunme', - command : hex) - -# Ensure configure files can be passed -conf = configure_file( - input: 'configure.in', - output: 'configure', - configuration: configuration_data() -) - -run_target('configure_script', - command : conf -) diff --git a/test cases/common/55 run target/scripts/script.sh b/test cases/common/55 run target/scripts/script.sh deleted file mode 100755 index 0adf263..0000000 --- a/test cases/common/55 run target/scripts/script.sh +++ /dev/null @@ -1,5 +0,0 @@ -#!/bin/sh - -cd "$MESON_SOURCE_ROOT" -echo My current directory is `pwd` -echo Build dir is at $MESON_BUILD_ROOT diff --git a/test cases/common/56 install script/installed_files.txt b/test cases/common/56 install script/installed_files.txt new file mode 100644 index 0000000..28f9ed0 --- /dev/null +++ b/test cases/common/56 install script/installed_files.txt @@ -0,0 +1,5 @@ +usr/bin/prog?exe +?msvc:usr/bin/prog.pdb +usr/diiba/daaba/file.dat +usr/this/should/also-work.dat +usr/this/does/something-different.dat.in diff --git a/test cases/common/56 install script/meson.build b/test cases/common/56 install script/meson.build new file mode 100644 index 0000000..6351518 --- /dev/null +++ b/test cases/common/56 install script/meson.build @@ -0,0 +1,7 @@ +project('custom install script', 'c') + +executable('prog', 'prog.c', install : true) +meson.add_install_script('myinstall.py', 'diiba/daaba', 'file.dat') +meson.add_install_script('myinstall.py', 'this/should', 'also-work.dat') + +subdir('src') diff --git a/test cases/common/56 install script/myinstall.py b/test cases/common/56 install script/myinstall.py new file mode 100644 index 0000000..812561e --- /dev/null +++ b/test cases/common/56 install script/myinstall.py @@ -0,0 +1,12 @@ +#!/usr/bin/env python3 + +import os +import sys + +prefix = os.environ['MESON_INSTALL_DESTDIR_PREFIX'] + +dirname = os.path.join(prefix, sys.argv[1]) + +os.makedirs(dirname) +with open(os.path.join(dirname, sys.argv[2]), 'w') as f: + f.write('') diff --git a/test cases/common/56 install script/no-installed-files b/test cases/common/56 install script/no-installed-files new file mode 100644 index 0000000..e69de29 diff --git a/test cases/common/56 install script/prog.c b/test cases/common/56 install script/prog.c new file mode 100644 index 0000000..06bc6b1 --- /dev/null +++ b/test cases/common/56 install script/prog.c @@ -0,0 +1,6 @@ +#include + +int main(int argc, char **argv) { + printf("This is text.\n"); + return 0; +} diff --git a/test cases/common/56 install script/src/meson.build b/test cases/common/56 install script/src/meson.build new file mode 100644 index 0000000..b23574a --- /dev/null +++ b/test cases/common/56 install script/src/meson.build @@ -0,0 +1 @@ +meson.add_install_script('myinstall.py', 'this/does', 'something-different.dat') diff --git a/test cases/common/56 install script/src/myinstall.py b/test cases/common/56 install script/src/myinstall.py new file mode 100644 index 0000000..3b7ce37 --- /dev/null +++ b/test cases/common/56 install script/src/myinstall.py @@ -0,0 +1,12 @@ +#!/usr/bin/env python3 + +import os +import sys + +prefix = os.environ['MESON_INSTALL_DESTDIR_PREFIX'] + +dirname = os.path.join(prefix, sys.argv[1]) + +os.makedirs(dirname) +with open(os.path.join(dirname, sys.argv[2] + '.in'), 'w') as f: + f.write('') diff --git a/test cases/common/56 object generator/meson.build b/test cases/common/56 object generator/meson.build deleted file mode 100644 index e20da6f..0000000 --- a/test cases/common/56 object generator/meson.build +++ /dev/null @@ -1,34 +0,0 @@ -project('object generator', 'c') - -python = find_program('python3', required : false) -if not python.found() - python = find_program('python') -endif - -# Note that this will not add a dependency to the compiler executable. -# Code will not be rebuilt if it changes. -comp = '@0@/@1@'.format(meson.current_source_dir(), 'obj_generator.py') - -if host_machine.system() == 'windows' - outputname = '@BASENAME@.obj' -else - outputname = '@BASENAME@.o' -endif - -cc = meson.get_compiler('c').cmd_array().get(-1) -# Generate an object file manually. -gen = generator(python, - output : outputname, - arguments : [comp, cc, '@INPUT@', '@OUTPUT@']) - -generated = gen.process(['source.c', 'source2.c']) - -# Generate an object file with indexed OUTPUT replacement. -gen2 = generator(python, - output : outputname, - arguments : [comp, cc, '@INPUT@', '@OUTPUT0@']) -generated2 = gen2.process(['source3.c']) - -e = executable('prog', 'prog.c', generated, generated2) - -test('objgen', e) \ No newline at end of file diff --git a/test cases/common/56 object generator/obj_generator.py b/test cases/common/56 object generator/obj_generator.py deleted file mode 100755 index a33872a..0000000 --- a/test cases/common/56 object generator/obj_generator.py +++ /dev/null @@ -1,18 +0,0 @@ -#!/usr/bin/env python3 - -# Mimic a binary that generates an object file (e.g. windres). - -import sys, subprocess - -if __name__ == '__main__': - if len(sys.argv) != 4: - print(sys.argv[0], 'compiler input_file output_file') - sys.exit(1) - compiler = sys.argv[1] - ifile = sys.argv[2] - ofile = sys.argv[3] - if compiler.endswith('cl'): - cmd = [compiler, '/nologo', '/MDd', '/Fo' + ofile, '/c', ifile] - else: - cmd = [compiler, '-c', ifile, '-o', ofile] - sys.exit(subprocess.call(cmd)) diff --git a/test cases/common/56 object generator/prog.c b/test cases/common/56 object generator/prog.c deleted file mode 100644 index 60459d6..0000000 --- a/test cases/common/56 object generator/prog.c +++ /dev/null @@ -1,7 +0,0 @@ -int func1_in_obj(); -int func2_in_obj(); -int func3_in_obj(); - -int main(int argc, char **argv) { - return func1_in_obj() + func2_in_obj() + func3_in_obj(); -} diff --git a/test cases/common/56 object generator/source.c b/test cases/common/56 object generator/source.c deleted file mode 100644 index 7779b33..0000000 --- a/test cases/common/56 object generator/source.c +++ /dev/null @@ -1,3 +0,0 @@ -int func1_in_obj() { - return 0; -} diff --git a/test cases/common/56 object generator/source2.c b/test cases/common/56 object generator/source2.c deleted file mode 100644 index 29aad40..0000000 --- a/test cases/common/56 object generator/source2.c +++ /dev/null @@ -1,3 +0,0 @@ -int func2_in_obj() { - return 0; -} diff --git a/test cases/common/56 object generator/source3.c b/test cases/common/56 object generator/source3.c deleted file mode 100644 index 1580f1e..0000000 --- a/test cases/common/56 object generator/source3.c +++ /dev/null @@ -1,3 +0,0 @@ -int func3_in_obj() { - return 0; -} diff --git a/test cases/common/57 custom target source output/generator.py b/test cases/common/57 custom target source output/generator.py new file mode 100755 index 0000000..3464b0a --- /dev/null +++ b/test cases/common/57 custom target source output/generator.py @@ -0,0 +1,16 @@ +#!/usr/bin/env python3 + +import sys, os + +if len(sys.argv) != 2: + print(sys.argv[0], '') + +odir = sys.argv[1] + +with open(os.path.join(odir, 'mylib.h'), 'w') as f: + f.write('int func();\n') +with open(os.path.join(odir, 'mylib.c'), 'w') as f: + f.write('''int func() { + return 0; +} +''') diff --git a/test cases/common/57 custom target source output/main.c b/test cases/common/57 custom target source output/main.c new file mode 100644 index 0000000..2813c39 --- /dev/null +++ b/test cases/common/57 custom target source output/main.c @@ -0,0 +1,5 @@ +#include"mylib.h" + +int main(int argc, char **argv) { + return func(); +} diff --git a/test cases/common/57 custom target source output/meson.build b/test cases/common/57 custom target source output/meson.build new file mode 100644 index 0000000..f9d039d --- /dev/null +++ b/test cases/common/57 custom target source output/meson.build @@ -0,0 +1,9 @@ +project('source generation', 'c') + +ct = custom_target('gen', +output : ['mylib.h', 'mylib.c'], +command : [find_program('generator.py'), '@OUTDIR@'], +) + +e = executable('prog', 'main.c', ct) +test('gentest', e) diff --git a/test cases/common/57 install script/installed_files.txt b/test cases/common/57 install script/installed_files.txt deleted file mode 100644 index 28f9ed0..0000000 --- a/test cases/common/57 install script/installed_files.txt +++ /dev/null @@ -1,5 +0,0 @@ -usr/bin/prog?exe -?msvc:usr/bin/prog.pdb -usr/diiba/daaba/file.dat -usr/this/should/also-work.dat -usr/this/does/something-different.dat.in diff --git a/test cases/common/57 install script/meson.build b/test cases/common/57 install script/meson.build deleted file mode 100644 index 6351518..0000000 --- a/test cases/common/57 install script/meson.build +++ /dev/null @@ -1,7 +0,0 @@ -project('custom install script', 'c') - -executable('prog', 'prog.c', install : true) -meson.add_install_script('myinstall.py', 'diiba/daaba', 'file.dat') -meson.add_install_script('myinstall.py', 'this/should', 'also-work.dat') - -subdir('src') diff --git a/test cases/common/57 install script/myinstall.py b/test cases/common/57 install script/myinstall.py deleted file mode 100644 index 812561e..0000000 --- a/test cases/common/57 install script/myinstall.py +++ /dev/null @@ -1,12 +0,0 @@ -#!/usr/bin/env python3 - -import os -import sys - -prefix = os.environ['MESON_INSTALL_DESTDIR_PREFIX'] - -dirname = os.path.join(prefix, sys.argv[1]) - -os.makedirs(dirname) -with open(os.path.join(dirname, sys.argv[2]), 'w') as f: - f.write('') diff --git a/test cases/common/57 install script/no-installed-files b/test cases/common/57 install script/no-installed-files deleted file mode 100644 index e69de29..0000000 diff --git a/test cases/common/57 install script/prog.c b/test cases/common/57 install script/prog.c deleted file mode 100644 index 06bc6b1..0000000 --- a/test cases/common/57 install script/prog.c +++ /dev/null @@ -1,6 +0,0 @@ -#include - -int main(int argc, char **argv) { - printf("This is text.\n"); - return 0; -} diff --git a/test cases/common/57 install script/src/meson.build b/test cases/common/57 install script/src/meson.build deleted file mode 100644 index b23574a..0000000 --- a/test cases/common/57 install script/src/meson.build +++ /dev/null @@ -1 +0,0 @@ -meson.add_install_script('myinstall.py', 'this/does', 'something-different.dat') diff --git a/test cases/common/57 install script/src/myinstall.py b/test cases/common/57 install script/src/myinstall.py deleted file mode 100644 index 3b7ce37..0000000 --- a/test cases/common/57 install script/src/myinstall.py +++ /dev/null @@ -1,12 +0,0 @@ -#!/usr/bin/env python3 - -import os -import sys - -prefix = os.environ['MESON_INSTALL_DESTDIR_PREFIX'] - -dirname = os.path.join(prefix, sys.argv[1]) - -os.makedirs(dirname) -with open(os.path.join(dirname, sys.argv[2] + '.in'), 'w') as f: - f.write('') diff --git a/test cases/common/58 custom target source output/generator.py b/test cases/common/58 custom target source output/generator.py deleted file mode 100755 index 3464b0a..0000000 --- a/test cases/common/58 custom target source output/generator.py +++ /dev/null @@ -1,16 +0,0 @@ -#!/usr/bin/env python3 - -import sys, os - -if len(sys.argv) != 2: - print(sys.argv[0], '') - -odir = sys.argv[1] - -with open(os.path.join(odir, 'mylib.h'), 'w') as f: - f.write('int func();\n') -with open(os.path.join(odir, 'mylib.c'), 'w') as f: - f.write('''int func() { - return 0; -} -''') diff --git a/test cases/common/58 custom target source output/main.c b/test cases/common/58 custom target source output/main.c deleted file mode 100644 index 2813c39..0000000 --- a/test cases/common/58 custom target source output/main.c +++ /dev/null @@ -1,5 +0,0 @@ -#include"mylib.h" - -int main(int argc, char **argv) { - return func(); -} diff --git a/test cases/common/58 custom target source output/meson.build b/test cases/common/58 custom target source output/meson.build deleted file mode 100644 index f9d039d..0000000 --- a/test cases/common/58 custom target source output/meson.build +++ /dev/null @@ -1,9 +0,0 @@ -project('source generation', 'c') - -ct = custom_target('gen', -output : ['mylib.h', 'mylib.c'], -command : [find_program('generator.py'), '@OUTDIR@'], -) - -e = executable('prog', 'main.c', ct) -test('gentest', e) diff --git a/test cases/common/58 exe static shared/meson.build b/test cases/common/58 exe static shared/meson.build new file mode 100644 index 0000000..69ede5e --- /dev/null +++ b/test cases/common/58 exe static shared/meson.build @@ -0,0 +1,15 @@ +project('statchain', 'c') + +subdir('subdir') +# Test that -fPIC in c_args is also accepted (on platforms where it's permitted) +picflag = [] +if not ['darwin', 'windows'].contains(host_machine.system()) + picflag = ['-fPIC'] +endif +statlib2 = static_library('stat2', 'stat2.c', c_args : picflag, pic : false) +# Test that pic is needed for both direct and indirect static library +# dependencies of shared libraries (on Linux and BSD) +statlib = static_library('stat', 'stat.c', link_with : [shlib, statlib2], pic : true) +shlib2 = shared_library('shr2', 'shlib2.c', link_with : statlib) +exe = executable('prog', 'prog.c', link_with : shlib2) +test('runtest', exe) diff --git a/test cases/common/58 exe static shared/prog.c b/test cases/common/58 exe static shared/prog.c new file mode 100644 index 0000000..26603b6 --- /dev/null +++ b/test cases/common/58 exe static shared/prog.c @@ -0,0 +1,10 @@ +int shlibfunc2(); +int statlibfunc(); + +int main(int argc, char **argv) { + if (statlibfunc() != 42) + return 1; + if (shlibfunc2() != 24) + return 1; + return 0; +} diff --git a/test cases/common/58 exe static shared/shlib2.c b/test cases/common/58 exe static shared/shlib2.c new file mode 100644 index 0000000..12bc913 --- /dev/null +++ b/test cases/common/58 exe static shared/shlib2.c @@ -0,0 +1,8 @@ +#include "subdir/exports.h" + +int statlibfunc(void); +int statlibfunc2(void); + +int DLL_PUBLIC shlibfunc2(void) { + return statlibfunc() - statlibfunc2(); +} diff --git a/test cases/common/58 exe static shared/stat.c b/test cases/common/58 exe static shared/stat.c new file mode 100644 index 0000000..680ed92 --- /dev/null +++ b/test cases/common/58 exe static shared/stat.c @@ -0,0 +1,7 @@ +#include "subdir/exports.h" + +int shlibfunc(); + +int DLL_PUBLIC statlibfunc() { + return shlibfunc(); +} diff --git a/test cases/common/58 exe static shared/stat2.c b/test cases/common/58 exe static shared/stat2.c new file mode 100644 index 0000000..4ae3775 --- /dev/null +++ b/test cases/common/58 exe static shared/stat2.c @@ -0,0 +1,3 @@ +int statlibfunc2() { + return 18; +} diff --git a/test cases/common/58 exe static shared/subdir/exports.h b/test cases/common/58 exe static shared/subdir/exports.h new file mode 100644 index 0000000..c89ccb2 --- /dev/null +++ b/test cases/common/58 exe static shared/subdir/exports.h @@ -0,0 +1,12 @@ +#pragma once + +#if defined _WIN32 || defined __CYGWIN__ + #define DLL_PUBLIC __declspec(dllexport) +#else + #if defined __GNUC__ + #define DLL_PUBLIC __attribute__ ((visibility("default"))) + #else + #pragma message ("Compiler does not support symbol visibility.") + #define DLL_PUBLIC + #endif +#endif diff --git a/test cases/common/58 exe static shared/subdir/meson.build b/test cases/common/58 exe static shared/subdir/meson.build new file mode 100644 index 0000000..2b7393b --- /dev/null +++ b/test cases/common/58 exe static shared/subdir/meson.build @@ -0,0 +1 @@ +shlib = shared_library('shar', 'shlib.c') diff --git a/test cases/common/58 exe static shared/subdir/shlib.c b/test cases/common/58 exe static shared/subdir/shlib.c new file mode 100644 index 0000000..002c83f --- /dev/null +++ b/test cases/common/58 exe static shared/subdir/shlib.c @@ -0,0 +1,5 @@ +#include "exports.h" + +int DLL_PUBLIC shlibfunc() { + return 42; +} diff --git a/test cases/common/59 array methods/meson.build b/test cases/common/59 array methods/meson.build new file mode 100644 index 0000000..cdda41d --- /dev/null +++ b/test cases/common/59 array methods/meson.build @@ -0,0 +1,46 @@ +project('array methods', 'c') + +empty = [] +one = ['abc'] +two = ['def', 'ghi'] +combined = [empty, one, two] + +if empty.contains('abc') + error('Empty is not empty.') +endif + +if one.contains('a') + error('One claims to contain a') +endif + +if not one.contains('abc') + error('One claims to not contain abc.') +endif + +if one.contains('abcd') + error('One claims to contain abcd.') +endif + +if two.contains('abc') + error('Two claims to contain abc.') +endif + +if not two.contains('def') + error('Two claims not to contain def.') +endif + +if not two.contains('ghi') + error('Two claims not to contain ghi.') +endif + +if two.contains('defg') + error('Two claims to contain defg.') +endif + +if not combined.contains('abc') + error('Combined claims not to contain abc.') +endif + +if not combined.contains('ghi') + error('Combined claims not to contain ghi.') +endif diff --git a/test cases/common/59 exe static shared/meson.build b/test cases/common/59 exe static shared/meson.build deleted file mode 100644 index 69ede5e..0000000 --- a/test cases/common/59 exe static shared/meson.build +++ /dev/null @@ -1,15 +0,0 @@ -project('statchain', 'c') - -subdir('subdir') -# Test that -fPIC in c_args is also accepted (on platforms where it's permitted) -picflag = [] -if not ['darwin', 'windows'].contains(host_machine.system()) - picflag = ['-fPIC'] -endif -statlib2 = static_library('stat2', 'stat2.c', c_args : picflag, pic : false) -# Test that pic is needed for both direct and indirect static library -# dependencies of shared libraries (on Linux and BSD) -statlib = static_library('stat', 'stat.c', link_with : [shlib, statlib2], pic : true) -shlib2 = shared_library('shr2', 'shlib2.c', link_with : statlib) -exe = executable('prog', 'prog.c', link_with : shlib2) -test('runtest', exe) diff --git a/test cases/common/59 exe static shared/prog.c b/test cases/common/59 exe static shared/prog.c deleted file mode 100644 index 26603b6..0000000 --- a/test cases/common/59 exe static shared/prog.c +++ /dev/null @@ -1,10 +0,0 @@ -int shlibfunc2(); -int statlibfunc(); - -int main(int argc, char **argv) { - if (statlibfunc() != 42) - return 1; - if (shlibfunc2() != 24) - return 1; - return 0; -} diff --git a/test cases/common/59 exe static shared/shlib2.c b/test cases/common/59 exe static shared/shlib2.c deleted file mode 100644 index 12bc913..0000000 --- a/test cases/common/59 exe static shared/shlib2.c +++ /dev/null @@ -1,8 +0,0 @@ -#include "subdir/exports.h" - -int statlibfunc(void); -int statlibfunc2(void); - -int DLL_PUBLIC shlibfunc2(void) { - return statlibfunc() - statlibfunc2(); -} diff --git a/test cases/common/59 exe static shared/stat.c b/test cases/common/59 exe static shared/stat.c deleted file mode 100644 index 680ed92..0000000 --- a/test cases/common/59 exe static shared/stat.c +++ /dev/null @@ -1,7 +0,0 @@ -#include "subdir/exports.h" - -int shlibfunc(); - -int DLL_PUBLIC statlibfunc() { - return shlibfunc(); -} diff --git a/test cases/common/59 exe static shared/stat2.c b/test cases/common/59 exe static shared/stat2.c deleted file mode 100644 index 4ae3775..0000000 --- a/test cases/common/59 exe static shared/stat2.c +++ /dev/null @@ -1,3 +0,0 @@ -int statlibfunc2() { - return 18; -} diff --git a/test cases/common/59 exe static shared/subdir/exports.h b/test cases/common/59 exe static shared/subdir/exports.h deleted file mode 100644 index c89ccb2..0000000 --- a/test cases/common/59 exe static shared/subdir/exports.h +++ /dev/null @@ -1,12 +0,0 @@ -#pragma once - -#if defined _WIN32 || defined __CYGWIN__ - #define DLL_PUBLIC __declspec(dllexport) -#else - #if defined __GNUC__ - #define DLL_PUBLIC __attribute__ ((visibility("default"))) - #else - #pragma message ("Compiler does not support symbol visibility.") - #define DLL_PUBLIC - #endif -#endif diff --git a/test cases/common/59 exe static shared/subdir/meson.build b/test cases/common/59 exe static shared/subdir/meson.build deleted file mode 100644 index 2b7393b..0000000 --- a/test cases/common/59 exe static shared/subdir/meson.build +++ /dev/null @@ -1 +0,0 @@ -shlib = shared_library('shar', 'shlib.c') diff --git a/test cases/common/59 exe static shared/subdir/shlib.c b/test cases/common/59 exe static shared/subdir/shlib.c deleted file mode 100644 index 002c83f..0000000 --- a/test cases/common/59 exe static shared/subdir/shlib.c +++ /dev/null @@ -1,5 +0,0 @@ -#include "exports.h" - -int DLL_PUBLIC shlibfunc() { - return 42; -} diff --git a/test cases/common/60 array methods/meson.build b/test cases/common/60 array methods/meson.build deleted file mode 100644 index cdda41d..0000000 --- a/test cases/common/60 array methods/meson.build +++ /dev/null @@ -1,46 +0,0 @@ -project('array methods', 'c') - -empty = [] -one = ['abc'] -two = ['def', 'ghi'] -combined = [empty, one, two] - -if empty.contains('abc') - error('Empty is not empty.') -endif - -if one.contains('a') - error('One claims to contain a') -endif - -if not one.contains('abc') - error('One claims to not contain abc.') -endif - -if one.contains('abcd') - error('One claims to contain abcd.') -endif - -if two.contains('abc') - error('Two claims to contain abc.') -endif - -if not two.contains('def') - error('Two claims not to contain def.') -endif - -if not two.contains('ghi') - error('Two claims not to contain ghi.') -endif - -if two.contains('defg') - error('Two claims to contain defg.') -endif - -if not combined.contains('abc') - error('Combined claims not to contain abc.') -endif - -if not combined.contains('ghi') - error('Combined claims not to contain ghi.') -endif diff --git a/test cases/common/60 custom header generator/input.def b/test cases/common/60 custom header generator/input.def new file mode 100644 index 0000000..573541a --- /dev/null +++ b/test cases/common/60 custom header generator/input.def @@ -0,0 +1 @@ +0 diff --git a/test cases/common/60 custom header generator/makeheader.py b/test cases/common/60 custom header generator/makeheader.py new file mode 100644 index 0000000..f156834 --- /dev/null +++ b/test cases/common/60 custom header generator/makeheader.py @@ -0,0 +1,12 @@ +#!/usr/bin/env python3 + +# NOTE: this file does not have the executable bit set. This tests that +# Meson can automatically parse shebang lines. + +import sys + +template = '#define RET_VAL %s\n' +with open(sys.argv[1]) as f: + output = template % (f.readline().strip(), ) +with open(sys.argv[2], 'w') as f: + f.write(output) diff --git a/test cases/common/60 custom header generator/meson.build b/test cases/common/60 custom header generator/meson.build new file mode 100644 index 0000000..d43915a --- /dev/null +++ b/test cases/common/60 custom header generator/meson.build @@ -0,0 +1,21 @@ +project('custom header generator', 'c') + +cc_id = meson.get_compiler('c').get_id() +cc_ver = meson.get_compiler('c').version() + +if cc_id == 'intel' or (cc_id == 'lcc' and cc_ver.version_compare('<=1.23.08')) + # ICC and LCC <= 1.23.08 do not escape spaces in paths in the dependency file, so Ninja + # (correctly) thinks that the rule has multiple outputs and errors out: + # 'depfile has multiple output paths' + error('MESON_SKIP_TEST: Skipping test because your compiler is known to generate broken dependency files') +endif + +gen = find_program('makeheader.py') + +generated_h = custom_target('makeheader.py', + output : 'myheader.lh', # Suffix not .h to ensure this works with custom suffixes, too. + input : 'input.def', + command : [gen, '@INPUT0@', '@OUTPUT0@', files('somefile.txt')]) + +prog = executable('prog', 'prog.c', generated_h) +test('gentest', prog) diff --git a/test cases/common/60 custom header generator/prog.c b/test cases/common/60 custom header generator/prog.c new file mode 100644 index 0000000..184973a --- /dev/null +++ b/test cases/common/60 custom header generator/prog.c @@ -0,0 +1,5 @@ +#include"myheader.lh" + +int main(int argc, char **argv) { + return RET_VAL; +} diff --git a/test cases/common/60 custom header generator/somefile.txt b/test cases/common/60 custom header generator/somefile.txt new file mode 100644 index 0000000..e69de29 diff --git a/test cases/common/61 custom header generator/input.def b/test cases/common/61 custom header generator/input.def deleted file mode 100644 index 573541a..0000000 --- a/test cases/common/61 custom header generator/input.def +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test cases/common/61 custom header generator/makeheader.py b/test cases/common/61 custom header generator/makeheader.py deleted file mode 100644 index f156834..0000000 --- a/test cases/common/61 custom header generator/makeheader.py +++ /dev/null @@ -1,12 +0,0 @@ -#!/usr/bin/env python3 - -# NOTE: this file does not have the executable bit set. This tests that -# Meson can automatically parse shebang lines. - -import sys - -template = '#define RET_VAL %s\n' -with open(sys.argv[1]) as f: - output = template % (f.readline().strip(), ) -with open(sys.argv[2], 'w') as f: - f.write(output) diff --git a/test cases/common/61 custom header generator/meson.build b/test cases/common/61 custom header generator/meson.build deleted file mode 100644 index d43915a..0000000 --- a/test cases/common/61 custom header generator/meson.build +++ /dev/null @@ -1,21 +0,0 @@ -project('custom header generator', 'c') - -cc_id = meson.get_compiler('c').get_id() -cc_ver = meson.get_compiler('c').version() - -if cc_id == 'intel' or (cc_id == 'lcc' and cc_ver.version_compare('<=1.23.08')) - # ICC and LCC <= 1.23.08 do not escape spaces in paths in the dependency file, so Ninja - # (correctly) thinks that the rule has multiple outputs and errors out: - # 'depfile has multiple output paths' - error('MESON_SKIP_TEST: Skipping test because your compiler is known to generate broken dependency files') -endif - -gen = find_program('makeheader.py') - -generated_h = custom_target('makeheader.py', - output : 'myheader.lh', # Suffix not .h to ensure this works with custom suffixes, too. - input : 'input.def', - command : [gen, '@INPUT0@', '@OUTPUT0@', files('somefile.txt')]) - -prog = executable('prog', 'prog.c', generated_h) -test('gentest', prog) diff --git a/test cases/common/61 custom header generator/prog.c b/test cases/common/61 custom header generator/prog.c deleted file mode 100644 index 184973a..0000000 --- a/test cases/common/61 custom header generator/prog.c +++ /dev/null @@ -1,5 +0,0 @@ -#include"myheader.lh" - -int main(int argc, char **argv) { - return RET_VAL; -} diff --git a/test cases/common/61 custom header generator/somefile.txt b/test cases/common/61 custom header generator/somefile.txt deleted file mode 100644 index e69de29..0000000 diff --git a/test cases/common/61 multiple generators/data2.dat b/test cases/common/61 multiple generators/data2.dat new file mode 100644 index 0000000..0cfbf08 --- /dev/null +++ b/test cases/common/61 multiple generators/data2.dat @@ -0,0 +1 @@ +2 diff --git a/test cases/common/61 multiple generators/main.cpp b/test cases/common/61 multiple generators/main.cpp new file mode 100644 index 0000000..5277063 --- /dev/null +++ b/test cases/common/61 multiple generators/main.cpp @@ -0,0 +1,6 @@ +#include"source1.h" +#include"source2.h" + +int main(int argc, char **argv) { + return func1() + func2(); +} diff --git a/test cases/common/61 multiple generators/meson.build b/test cases/common/61 multiple generators/meson.build new file mode 100644 index 0000000..66f7fa9 --- /dev/null +++ b/test cases/common/61 multiple generators/meson.build @@ -0,0 +1,13 @@ +project('trickier generator', 'cpp') + +comp = find_program('mygen.py') +subdir('subdir') + +generated2 = custom_target('generated2', + output : ['source2.h', 'source2.cpp'], + input : 'data2.dat', + command : [comp, '@INPUT0@', '@OUTDIR@']) + +exe = executable('prog', 'main.cpp', generated, generated2, + include_directories : include_directories('subdir')) + test('generated test', exe) diff --git a/test cases/common/61 multiple generators/mygen.py b/test cases/common/61 multiple generators/mygen.py new file mode 100755 index 0000000..99dc331 --- /dev/null +++ b/test cases/common/61 multiple generators/mygen.py @@ -0,0 +1,22 @@ +#!/usr/bin/env python3 + +import sys, os + +if len(sys.argv) != 3: + print("You is fail.") + sys.exit(1) + +with open(sys.argv[1]) as f: + val = f.read().strip() +outdir = sys.argv[2] + +outhdr = os.path.join(outdir, 'source%s.h' % val) +outsrc = os.path.join(outdir, 'source%s.cpp' % val) + +with open(outhdr, 'w') as f: + f.write('int func%s();\n' % val) +with open(outsrc, 'w') as f: + f.write('''int func%s() { + return 0; +} +''' % val) diff --git a/test cases/common/61 multiple generators/subdir/data.dat b/test cases/common/61 multiple generators/subdir/data.dat new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/test cases/common/61 multiple generators/subdir/data.dat @@ -0,0 +1 @@ +1 diff --git a/test cases/common/61 multiple generators/subdir/meson.build b/test cases/common/61 multiple generators/subdir/meson.build new file mode 100644 index 0000000..2456ecb --- /dev/null +++ b/test cases/common/61 multiple generators/subdir/meson.build @@ -0,0 +1,4 @@ +generated = custom_target('generated', +output : ['source1.h', 'source1.cpp'], +input : 'data.dat', +command : [comp, '@INPUT0@', '@OUTDIR@']) diff --git a/test cases/common/62 install subdir/installed_files.txt b/test cases/common/62 install subdir/installed_files.txt new file mode 100644 index 0000000..3f561d5 --- /dev/null +++ b/test cases/common/62 install subdir/installed_files.txt @@ -0,0 +1,12 @@ +usr/share/dircheck/fifth.dat +usr/share/dircheck/seventh.dat +usr/share/dircheck/nineth.dat +usr/share/eighth.dat +usr/share/fourth.dat +usr/share/sixth.dat +usr/share/sub1/data1.dat +usr/share/sub1/second.dat +usr/share/sub1/third.dat +usr/share/sub1/sub2/data2.dat +usr/share/sub2/one.dat +usr/share/sub2/dircheck/excluded-three.dat diff --git a/test cases/common/62 install subdir/meson.build b/test cases/common/62 install subdir/meson.build new file mode 100644 index 0000000..6f92efd --- /dev/null +++ b/test cases/common/62 install subdir/meson.build @@ -0,0 +1,18 @@ +project('install a whole subdir', 'c', + default_options : ['install_umask=preserve']) + +# A subdir with an exclusion: +install_subdir('sub2', + exclude_files : ['excluded-three.dat'], + exclude_directories : ['excluded'], + install_dir : 'share') + +subdir('subdir') +# A subdir with write perms only for the owner +# and read-list perms for owner and group +install_subdir('sub1', install_dir : 'share', install_mode : ['rwxr-x--t', 'root']) +install_subdir('sub/sub1', install_dir : 'share') + +# strip_directory +install_subdir('sub_elided', install_dir : 'share', strip_directory : true) +install_subdir('nested_elided/sub', install_dir : 'share', strip_directory : true) diff --git a/test cases/common/62 install subdir/nested_elided/sub/dircheck/nineth.dat b/test cases/common/62 install subdir/nested_elided/sub/dircheck/nineth.dat new file mode 100644 index 0000000..c4eaca7 --- /dev/null +++ b/test cases/common/62 install subdir/nested_elided/sub/dircheck/nineth.dat @@ -0,0 +1 @@ +Nested file under nested elided directory. diff --git a/test cases/common/62 install subdir/nested_elided/sub/eighth.dat b/test cases/common/62 install subdir/nested_elided/sub/eighth.dat new file mode 100644 index 0000000..fa9b7b7 --- /dev/null +++ b/test cases/common/62 install subdir/nested_elided/sub/eighth.dat @@ -0,0 +1 @@ +File in nested elided directory. diff --git a/test cases/common/62 install subdir/sub/sub1/third.dat b/test cases/common/62 install subdir/sub/sub1/third.dat new file mode 100644 index 0000000..5ccbc43 --- /dev/null +++ b/test cases/common/62 install subdir/sub/sub1/third.dat @@ -0,0 +1 @@ +This is a third data file for sub1 dir. diff --git a/test cases/common/62 install subdir/sub1/second.dat b/test cases/common/62 install subdir/sub1/second.dat new file mode 100644 index 0000000..48857a8 --- /dev/null +++ b/test cases/common/62 install subdir/sub1/second.dat @@ -0,0 +1 @@ +Test that multiple install_subdirs meld their results. \ No newline at end of file diff --git a/test cases/common/62 install subdir/sub2/dircheck/excluded-three.dat b/test cases/common/62 install subdir/sub2/dircheck/excluded-three.dat new file mode 100644 index 0000000..e69de29 diff --git a/test cases/common/62 install subdir/sub2/excluded-three.dat b/test cases/common/62 install subdir/sub2/excluded-three.dat new file mode 100644 index 0000000..e69de29 diff --git a/test cases/common/62 install subdir/sub2/excluded/two.dat b/test cases/common/62 install subdir/sub2/excluded/two.dat new file mode 100644 index 0000000..e69de29 diff --git a/test cases/common/62 install subdir/sub2/one.dat b/test cases/common/62 install subdir/sub2/one.dat new file mode 100644 index 0000000..e69de29 diff --git a/test cases/common/62 install subdir/sub_elided/dircheck/fifth.dat b/test cases/common/62 install subdir/sub_elided/dircheck/fifth.dat new file mode 100644 index 0000000..b6ca009 --- /dev/null +++ b/test cases/common/62 install subdir/sub_elided/dircheck/fifth.dat @@ -0,0 +1 @@ +Data file in a subdir of elided directory. diff --git a/test cases/common/62 install subdir/sub_elided/fourth.dat b/test cases/common/62 install subdir/sub_elided/fourth.dat new file mode 100644 index 0000000..ca5f26a --- /dev/null +++ b/test cases/common/62 install subdir/sub_elided/fourth.dat @@ -0,0 +1 @@ +Test that this file is installed directly into install_dir. diff --git a/test cases/common/62 install subdir/subdir/meson.build b/test cases/common/62 install subdir/subdir/meson.build new file mode 100644 index 0000000..0f81cdb --- /dev/null +++ b/test cases/common/62 install subdir/subdir/meson.build @@ -0,0 +1,5 @@ +install_subdir('sub1', install_dir : 'share', + # This mode will be overridden by the mode set in the outer install_subdir + install_mode : 'rwxr-x---') + +install_subdir('sub_elided', install_dir : 'share', strip_directory : true) diff --git a/test cases/common/62 install subdir/subdir/sub1/data1.dat b/test cases/common/62 install subdir/subdir/sub1/data1.dat new file mode 100644 index 0000000..d83c370 --- /dev/null +++ b/test cases/common/62 install subdir/subdir/sub1/data1.dat @@ -0,0 +1 @@ +This is a data file in a subdir. diff --git a/test cases/common/62 install subdir/subdir/sub1/sub2/data2.dat b/test cases/common/62 install subdir/subdir/sub1/sub2/data2.dat new file mode 100644 index 0000000..8ce1392 --- /dev/null +++ b/test cases/common/62 install subdir/subdir/sub1/sub2/data2.dat @@ -0,0 +1 @@ +This is a data file in a deeper subdir. diff --git a/test cases/common/62 install subdir/subdir/sub_elided/dircheck/seventh.dat b/test cases/common/62 install subdir/subdir/sub_elided/dircheck/seventh.dat new file mode 100644 index 0000000..ea0b8dc --- /dev/null +++ b/test cases/common/62 install subdir/subdir/sub_elided/dircheck/seventh.dat @@ -0,0 +1 @@ +Nested file in a subdir. diff --git a/test cases/common/62 install subdir/subdir/sub_elided/sixth.dat b/test cases/common/62 install subdir/subdir/sub_elided/sixth.dat new file mode 100644 index 0000000..140f075 --- /dev/null +++ b/test cases/common/62 install subdir/subdir/sub_elided/sixth.dat @@ -0,0 +1 @@ +Elide test file in a subdir. diff --git a/test cases/common/62 multiple generators/data2.dat b/test cases/common/62 multiple generators/data2.dat deleted file mode 100644 index 0cfbf08..0000000 --- a/test cases/common/62 multiple generators/data2.dat +++ /dev/null @@ -1 +0,0 @@ -2 diff --git a/test cases/common/62 multiple generators/main.cpp b/test cases/common/62 multiple generators/main.cpp deleted file mode 100644 index 5277063..0000000 --- a/test cases/common/62 multiple generators/main.cpp +++ /dev/null @@ -1,6 +0,0 @@ -#include"source1.h" -#include"source2.h" - -int main(int argc, char **argv) { - return func1() + func2(); -} diff --git a/test cases/common/62 multiple generators/meson.build b/test cases/common/62 multiple generators/meson.build deleted file mode 100644 index 66f7fa9..0000000 --- a/test cases/common/62 multiple generators/meson.build +++ /dev/null @@ -1,13 +0,0 @@ -project('trickier generator', 'cpp') - -comp = find_program('mygen.py') -subdir('subdir') - -generated2 = custom_target('generated2', - output : ['source2.h', 'source2.cpp'], - input : 'data2.dat', - command : [comp, '@INPUT0@', '@OUTDIR@']) - -exe = executable('prog', 'main.cpp', generated, generated2, - include_directories : include_directories('subdir')) - test('generated test', exe) diff --git a/test cases/common/62 multiple generators/mygen.py b/test cases/common/62 multiple generators/mygen.py deleted file mode 100755 index 99dc331..0000000 --- a/test cases/common/62 multiple generators/mygen.py +++ /dev/null @@ -1,22 +0,0 @@ -#!/usr/bin/env python3 - -import sys, os - -if len(sys.argv) != 3: - print("You is fail.") - sys.exit(1) - -with open(sys.argv[1]) as f: - val = f.read().strip() -outdir = sys.argv[2] - -outhdr = os.path.join(outdir, 'source%s.h' % val) -outsrc = os.path.join(outdir, 'source%s.cpp' % val) - -with open(outhdr, 'w') as f: - f.write('int func%s();\n' % val) -with open(outsrc, 'w') as f: - f.write('''int func%s() { - return 0; -} -''' % val) diff --git a/test cases/common/62 multiple generators/subdir/data.dat b/test cases/common/62 multiple generators/subdir/data.dat deleted file mode 100644 index d00491f..0000000 --- a/test cases/common/62 multiple generators/subdir/data.dat +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test cases/common/62 multiple generators/subdir/meson.build b/test cases/common/62 multiple generators/subdir/meson.build deleted file mode 100644 index 2456ecb..0000000 --- a/test cases/common/62 multiple generators/subdir/meson.build +++ /dev/null @@ -1,4 +0,0 @@ -generated = custom_target('generated', -output : ['source1.h', 'source1.cpp'], -input : 'data.dat', -command : [comp, '@INPUT0@', '@OUTDIR@']) diff --git a/test cases/common/63 foreach/installed_files.txt b/test cases/common/63 foreach/installed_files.txt new file mode 100644 index 0000000..3376925 --- /dev/null +++ b/test cases/common/63 foreach/installed_files.txt @@ -0,0 +1,6 @@ +usr/bin/prog1?exe +?msvc:usr/bin/prog1.pdb +usr/bin/prog2?exe +?msvc:usr/bin/prog2.pdb +usr/bin/prog3?exe +?msvc:usr/bin/prog3.pdb diff --git a/test cases/common/63 foreach/meson.build b/test cases/common/63 foreach/meson.build new file mode 100644 index 0000000..7084e80 --- /dev/null +++ b/test cases/common/63 foreach/meson.build @@ -0,0 +1,33 @@ +project('foreach', 'c') + +tests = [['test1', 'prog1', 'prog1.c'], + ['test2', 'prog2', 'prog2.c', 'fallback'], + ['test3', 'prog3', 'prog3.c', 'urgh']] + +assert(tests[0].get(3, 'fallbck') == 'fallbck', 'array #1 fallback did not match') +assert(tests[1].get(3, 'failbk') == 'fallback', 'array #2 value did not match') +assert(tests[2].get(3, 'urgh') == 'urgh', 'array #3 value did not match') + +foreach i : tests + test(i.get(0), executable(i.get(1), i.get(2), install : true)) + + # Ensure that changing the tests variable does not + # affect ongoing iteration in the foreach loop. + # + # Being able to do that would make Meson Turing complete and + # we definitely don't want that. + tests = ['test4', 'prog4', 'prog4.c'] +endforeach + +items = ['a', 'continue', 'b', 'break', 'c'] +result = [] +foreach i : items + if i == 'continue' + continue + elif i == 'break' + break + endif + result += i +endforeach + +assert(result == ['a', 'b'], 'Continue or break in foreach failed') diff --git a/test cases/common/63 foreach/prog1.c b/test cases/common/63 foreach/prog1.c new file mode 100644 index 0000000..a5ef0f1 --- /dev/null +++ b/test cases/common/63 foreach/prog1.c @@ -0,0 +1,6 @@ +#include + +int main(int argc, char **argv) { + printf("This is test #1.\n"); + return 0; +} diff --git a/test cases/common/63 foreach/prog2.c b/test cases/common/63 foreach/prog2.c new file mode 100644 index 0000000..b9fddbe --- /dev/null +++ b/test cases/common/63 foreach/prog2.c @@ -0,0 +1,6 @@ +#include + +int main(int argc, char **argv) { + printf("This is test #2.\n"); + return 0; +} diff --git a/test cases/common/63 foreach/prog3.c b/test cases/common/63 foreach/prog3.c new file mode 100644 index 0000000..5657396 --- /dev/null +++ b/test cases/common/63 foreach/prog3.c @@ -0,0 +1,6 @@ +#include + +int main(int argc, char **argv) { + printf("This is test #3.\n"); + return 0; +} diff --git a/test cases/common/63 install subdir/installed_files.txt b/test cases/common/63 install subdir/installed_files.txt deleted file mode 100644 index 3f561d5..0000000 --- a/test cases/common/63 install subdir/installed_files.txt +++ /dev/null @@ -1,12 +0,0 @@ -usr/share/dircheck/fifth.dat -usr/share/dircheck/seventh.dat -usr/share/dircheck/nineth.dat -usr/share/eighth.dat -usr/share/fourth.dat -usr/share/sixth.dat -usr/share/sub1/data1.dat -usr/share/sub1/second.dat -usr/share/sub1/third.dat -usr/share/sub1/sub2/data2.dat -usr/share/sub2/one.dat -usr/share/sub2/dircheck/excluded-three.dat diff --git a/test cases/common/63 install subdir/meson.build b/test cases/common/63 install subdir/meson.build deleted file mode 100644 index 6f92efd..0000000 --- a/test cases/common/63 install subdir/meson.build +++ /dev/null @@ -1,18 +0,0 @@ -project('install a whole subdir', 'c', - default_options : ['install_umask=preserve']) - -# A subdir with an exclusion: -install_subdir('sub2', - exclude_files : ['excluded-three.dat'], - exclude_directories : ['excluded'], - install_dir : 'share') - -subdir('subdir') -# A subdir with write perms only for the owner -# and read-list perms for owner and group -install_subdir('sub1', install_dir : 'share', install_mode : ['rwxr-x--t', 'root']) -install_subdir('sub/sub1', install_dir : 'share') - -# strip_directory -install_subdir('sub_elided', install_dir : 'share', strip_directory : true) -install_subdir('nested_elided/sub', install_dir : 'share', strip_directory : true) diff --git a/test cases/common/63 install subdir/nested_elided/sub/dircheck/nineth.dat b/test cases/common/63 install subdir/nested_elided/sub/dircheck/nineth.dat deleted file mode 100644 index c4eaca7..0000000 --- a/test cases/common/63 install subdir/nested_elided/sub/dircheck/nineth.dat +++ /dev/null @@ -1 +0,0 @@ -Nested file under nested elided directory. diff --git a/test cases/common/63 install subdir/nested_elided/sub/eighth.dat b/test cases/common/63 install subdir/nested_elided/sub/eighth.dat deleted file mode 100644 index fa9b7b7..0000000 --- a/test cases/common/63 install subdir/nested_elided/sub/eighth.dat +++ /dev/null @@ -1 +0,0 @@ -File in nested elided directory. diff --git a/test cases/common/63 install subdir/sub/sub1/third.dat b/test cases/common/63 install subdir/sub/sub1/third.dat deleted file mode 100644 index 5ccbc43..0000000 --- a/test cases/common/63 install subdir/sub/sub1/third.dat +++ /dev/null @@ -1 +0,0 @@ -This is a third data file for sub1 dir. diff --git a/test cases/common/63 install subdir/sub1/second.dat b/test cases/common/63 install subdir/sub1/second.dat deleted file mode 100644 index 48857a8..0000000 --- a/test cases/common/63 install subdir/sub1/second.dat +++ /dev/null @@ -1 +0,0 @@ -Test that multiple install_subdirs meld their results. \ No newline at end of file diff --git a/test cases/common/63 install subdir/sub2/dircheck/excluded-three.dat b/test cases/common/63 install subdir/sub2/dircheck/excluded-three.dat deleted file mode 100644 index e69de29..0000000 diff --git a/test cases/common/63 install subdir/sub2/excluded-three.dat b/test cases/common/63 install subdir/sub2/excluded-three.dat deleted file mode 100644 index e69de29..0000000 diff --git a/test cases/common/63 install subdir/sub2/excluded/two.dat b/test cases/common/63 install subdir/sub2/excluded/two.dat deleted file mode 100644 index e69de29..0000000 diff --git a/test cases/common/63 install subdir/sub2/one.dat b/test cases/common/63 install subdir/sub2/one.dat deleted file mode 100644 index e69de29..0000000 diff --git a/test cases/common/63 install subdir/sub_elided/dircheck/fifth.dat b/test cases/common/63 install subdir/sub_elided/dircheck/fifth.dat deleted file mode 100644 index b6ca009..0000000 --- a/test cases/common/63 install subdir/sub_elided/dircheck/fifth.dat +++ /dev/null @@ -1 +0,0 @@ -Data file in a subdir of elided directory. diff --git a/test cases/common/63 install subdir/sub_elided/fourth.dat b/test cases/common/63 install subdir/sub_elided/fourth.dat deleted file mode 100644 index ca5f26a..0000000 --- a/test cases/common/63 install subdir/sub_elided/fourth.dat +++ /dev/null @@ -1 +0,0 @@ -Test that this file is installed directly into install_dir. diff --git a/test cases/common/63 install subdir/subdir/meson.build b/test cases/common/63 install subdir/subdir/meson.build deleted file mode 100644 index 0f81cdb..0000000 --- a/test cases/common/63 install subdir/subdir/meson.build +++ /dev/null @@ -1,5 +0,0 @@ -install_subdir('sub1', install_dir : 'share', - # This mode will be overridden by the mode set in the outer install_subdir - install_mode : 'rwxr-x---') - -install_subdir('sub_elided', install_dir : 'share', strip_directory : true) diff --git a/test cases/common/63 install subdir/subdir/sub1/data1.dat b/test cases/common/63 install subdir/subdir/sub1/data1.dat deleted file mode 100644 index d83c370..0000000 --- a/test cases/common/63 install subdir/subdir/sub1/data1.dat +++ /dev/null @@ -1 +0,0 @@ -This is a data file in a subdir. diff --git a/test cases/common/63 install subdir/subdir/sub1/sub2/data2.dat b/test cases/common/63 install subdir/subdir/sub1/sub2/data2.dat deleted file mode 100644 index 8ce1392..0000000 --- a/test cases/common/63 install subdir/subdir/sub1/sub2/data2.dat +++ /dev/null @@ -1 +0,0 @@ -This is a data file in a deeper subdir. diff --git a/test cases/common/63 install subdir/subdir/sub_elided/dircheck/seventh.dat b/test cases/common/63 install subdir/subdir/sub_elided/dircheck/seventh.dat deleted file mode 100644 index ea0b8dc..0000000 --- a/test cases/common/63 install subdir/subdir/sub_elided/dircheck/seventh.dat +++ /dev/null @@ -1 +0,0 @@ -Nested file in a subdir. diff --git a/test cases/common/63 install subdir/subdir/sub_elided/sixth.dat b/test cases/common/63 install subdir/subdir/sub_elided/sixth.dat deleted file mode 100644 index 140f075..0000000 --- a/test cases/common/63 install subdir/subdir/sub_elided/sixth.dat +++ /dev/null @@ -1 +0,0 @@ -Elide test file in a subdir. diff --git a/test cases/common/64 foreach/installed_files.txt b/test cases/common/64 foreach/installed_files.txt deleted file mode 100644 index 3376925..0000000 --- a/test cases/common/64 foreach/installed_files.txt +++ /dev/null @@ -1,6 +0,0 @@ -usr/bin/prog1?exe -?msvc:usr/bin/prog1.pdb -usr/bin/prog2?exe -?msvc:usr/bin/prog2.pdb -usr/bin/prog3?exe -?msvc:usr/bin/prog3.pdb diff --git a/test cases/common/64 foreach/meson.build b/test cases/common/64 foreach/meson.build deleted file mode 100644 index 7084e80..0000000 --- a/test cases/common/64 foreach/meson.build +++ /dev/null @@ -1,33 +0,0 @@ -project('foreach', 'c') - -tests = [['test1', 'prog1', 'prog1.c'], - ['test2', 'prog2', 'prog2.c', 'fallback'], - ['test3', 'prog3', 'prog3.c', 'urgh']] - -assert(tests[0].get(3, 'fallbck') == 'fallbck', 'array #1 fallback did not match') -assert(tests[1].get(3, 'failbk') == 'fallback', 'array #2 value did not match') -assert(tests[2].get(3, 'urgh') == 'urgh', 'array #3 value did not match') - -foreach i : tests - test(i.get(0), executable(i.get(1), i.get(2), install : true)) - - # Ensure that changing the tests variable does not - # affect ongoing iteration in the foreach loop. - # - # Being able to do that would make Meson Turing complete and - # we definitely don't want that. - tests = ['test4', 'prog4', 'prog4.c'] -endforeach - -items = ['a', 'continue', 'b', 'break', 'c'] -result = [] -foreach i : items - if i == 'continue' - continue - elif i == 'break' - break - endif - result += i -endforeach - -assert(result == ['a', 'b'], 'Continue or break in foreach failed') diff --git a/test cases/common/64 foreach/prog1.c b/test cases/common/64 foreach/prog1.c deleted file mode 100644 index a5ef0f1..0000000 --- a/test cases/common/64 foreach/prog1.c +++ /dev/null @@ -1,6 +0,0 @@ -#include - -int main(int argc, char **argv) { - printf("This is test #1.\n"); - return 0; -} diff --git a/test cases/common/64 foreach/prog2.c b/test cases/common/64 foreach/prog2.c deleted file mode 100644 index b9fddbe..0000000 --- a/test cases/common/64 foreach/prog2.c +++ /dev/null @@ -1,6 +0,0 @@ -#include - -int main(int argc, char **argv) { - printf("This is test #2.\n"); - return 0; -} diff --git a/test cases/common/64 foreach/prog3.c b/test cases/common/64 foreach/prog3.c deleted file mode 100644 index 5657396..0000000 --- a/test cases/common/64 foreach/prog3.c +++ /dev/null @@ -1,6 +0,0 @@ -#include - -int main(int argc, char **argv) { - printf("This is test #3.\n"); - return 0; -} diff --git a/test cases/common/64 number arithmetic/meson.build b/test cases/common/64 number arithmetic/meson.build new file mode 100644 index 0000000..e31d7e4 --- /dev/null +++ b/test cases/common/64 number arithmetic/meson.build @@ -0,0 +1,76 @@ +project('number arithmetic', 'c') + +if 6 + 4 != 10 + error('Number addition is broken') +endif +if 6 - 4 != 2 + error('Number subtraction is broken') +endif + +if 6 * 4 != 24 + error('Number multiplication is broken') +endif +if 16 / 4 != 4 + error('Number division is broken') +endif + +#if (1 / 3) * 3 != 1 +# error('Float interconversion broken') +#endif +if (5 / 3) * 3 != 3 + error('Integer division is broken') +endif + +assert((5 % 2) == 1, 'Integer modulo (odd) is broken') +assert((4 % 2) == 0, 'Integer modulo (even) is broken') + +if 2 * 1 % 2 != 0 + error('Modulo precedence with multiplication is broken') +endif +if 2 + 1 % 2 != 3 + error('Modulo precedence with addition is broken') +endif +if 9 / 9 % 2 != 1 + error('Modulo precedence with division is broken') +endif +if 9 - 9 % 2 != 8 + error('Modulo precedence with subtraction is broken') +endif + +assert(2.is_even(), 'int is_even() broken for even value') +assert(not(2.is_odd()), 'int is_odd() broken for even value') +assert(not(3.is_even()), 'int is_even() broken for odd value') +assert(3.is_odd(), 'int is_odd() broken for odd value') + +assert(3 < 4, 'Lt broken') +assert(not(4 < 3), 'Lt broken') +assert(3 <= 4, 'Lte broken') +assert(not(4 <= 3), 'Lte broken') +assert(3 <= 3, 'Lte broken') + +assert(4 > 3, 'Gt broken') +assert(not(3 > 4), 'Gt broken') +assert(4 >= 3, 'Gte broken') +assert(not(3 >= 4), 'Gte broken') +assert(3 >= 3, 'Gte broken') + +assert(true.to_int() == 1,'bool to_int() broken') +assert(false.to_int() == 0,'bool to_int() broken') + +hex_255 = 0xff +hex2_255 = 0XFF + +assert(hex_255 == 255, 'Hex parsing is broken.') +assert(hex2_255 == 255, 'Uppercase hex parsing is broken.') + +bin_123 = 0b1111011 +bin2_123 = 0B1111011 + +assert(bin_123 == 123, 'Bin number parsing is broken.') +assert(bin2_123 == 123, 'Uppercase bin number parsing is broken.') + +oct_493 = 0o755 +oct2_493 = 0O755 + +assert(oct_493 == 493, 'Oct number parsing is broken.') +assert(oct2_493 == 493, 'Uppercase oct number parsing is broken.') diff --git a/test cases/common/65 number arithmetic/meson.build b/test cases/common/65 number arithmetic/meson.build deleted file mode 100644 index e31d7e4..0000000 --- a/test cases/common/65 number arithmetic/meson.build +++ /dev/null @@ -1,76 +0,0 @@ -project('number arithmetic', 'c') - -if 6 + 4 != 10 - error('Number addition is broken') -endif -if 6 - 4 != 2 - error('Number subtraction is broken') -endif - -if 6 * 4 != 24 - error('Number multiplication is broken') -endif -if 16 / 4 != 4 - error('Number division is broken') -endif - -#if (1 / 3) * 3 != 1 -# error('Float interconversion broken') -#endif -if (5 / 3) * 3 != 3 - error('Integer division is broken') -endif - -assert((5 % 2) == 1, 'Integer modulo (odd) is broken') -assert((4 % 2) == 0, 'Integer modulo (even) is broken') - -if 2 * 1 % 2 != 0 - error('Modulo precedence with multiplication is broken') -endif -if 2 + 1 % 2 != 3 - error('Modulo precedence with addition is broken') -endif -if 9 / 9 % 2 != 1 - error('Modulo precedence with division is broken') -endif -if 9 - 9 % 2 != 8 - error('Modulo precedence with subtraction is broken') -endif - -assert(2.is_even(), 'int is_even() broken for even value') -assert(not(2.is_odd()), 'int is_odd() broken for even value') -assert(not(3.is_even()), 'int is_even() broken for odd value') -assert(3.is_odd(), 'int is_odd() broken for odd value') - -assert(3 < 4, 'Lt broken') -assert(not(4 < 3), 'Lt broken') -assert(3 <= 4, 'Lte broken') -assert(not(4 <= 3), 'Lte broken') -assert(3 <= 3, 'Lte broken') - -assert(4 > 3, 'Gt broken') -assert(not(3 > 4), 'Gt broken') -assert(4 >= 3, 'Gte broken') -assert(not(3 >= 4), 'Gte broken') -assert(3 >= 3, 'Gte broken') - -assert(true.to_int() == 1,'bool to_int() broken') -assert(false.to_int() == 0,'bool to_int() broken') - -hex_255 = 0xff -hex2_255 = 0XFF - -assert(hex_255 == 255, 'Hex parsing is broken.') -assert(hex2_255 == 255, 'Uppercase hex parsing is broken.') - -bin_123 = 0b1111011 -bin2_123 = 0B1111011 - -assert(bin_123 == 123, 'Bin number parsing is broken.') -assert(bin2_123 == 123, 'Uppercase bin number parsing is broken.') - -oct_493 = 0o755 -oct2_493 = 0O755 - -assert(oct_493 == 493, 'Oct number parsing is broken.') -assert(oct2_493 == 493, 'Uppercase oct number parsing is broken.') diff --git a/test cases/common/65 string arithmetic/meson.build b/test cases/common/65 string arithmetic/meson.build new file mode 100644 index 0000000..59567de --- /dev/null +++ b/test cases/common/65 string arithmetic/meson.build @@ -0,0 +1,16 @@ +project('string arithmetic', 'c') + +if 'foo' + 'bar' != 'foobar' + error('String concatenation is broken') +endif + +if 'foo' + 'bar' + 'baz' != 'foobarbaz' + error('Many-string concatenation is broken') +endif + +a = 'a' +b = 'b' + +if a + b + 'c' != 'abc' + error('String concat with variables is broken.') +endif diff --git a/test cases/common/66 array arithmetic/meson.build b/test cases/common/66 array arithmetic/meson.build new file mode 100644 index 0000000..8b8785a --- /dev/null +++ b/test cases/common/66 array arithmetic/meson.build @@ -0,0 +1,15 @@ +project('array arithmetic', 'c') + +array1 = ['foo', 'bar'] +array2 = ['qux', 'baz'] + +if array1 + array2 != ['foo', 'bar', 'qux', 'baz'] + error('Array concatenation is broken') +endif +if array2 + array1 != ['qux', 'baz', 'foo', 'bar'] + error('Array concatenation is broken') +endif + +if array1 + array1 + array1 != ['foo', 'bar', 'foo', 'bar', 'foo', 'bar'] + error('Many-array concatenation is broken') +endif diff --git a/test cases/common/66 string arithmetic/meson.build b/test cases/common/66 string arithmetic/meson.build deleted file mode 100644 index 59567de..0000000 --- a/test cases/common/66 string arithmetic/meson.build +++ /dev/null @@ -1,16 +0,0 @@ -project('string arithmetic', 'c') - -if 'foo' + 'bar' != 'foobar' - error('String concatenation is broken') -endif - -if 'foo' + 'bar' + 'baz' != 'foobarbaz' - error('Many-string concatenation is broken') -endif - -a = 'a' -b = 'b' - -if a + b + 'c' != 'abc' - error('String concat with variables is broken.') -endif diff --git a/test cases/common/67 arithmetic bidmas/meson.build b/test cases/common/67 arithmetic bidmas/meson.build new file mode 100644 index 0000000..c7334b4 --- /dev/null +++ b/test cases/common/67 arithmetic bidmas/meson.build @@ -0,0 +1,15 @@ +project('arithmetic bidmas', 'c') + +if 5 * 3 - 6 / 2 + 1 != 13 + error('Arithmetic bidmas broken') +endif +if 5 * (3 - 6 / 2) + 1 != 1 + error('Arithmetic bidmas with brackets broken') +endif + +if 5 * 12 / 2 * 3 != 90 + error('Sequential multiplication and division broken') +endif +if 5 * (12 / (2 * 3)) != 10 + error('Sequential multiplication and division with brackets broken') +endif diff --git a/test cases/common/67 array arithmetic/meson.build b/test cases/common/67 array arithmetic/meson.build deleted file mode 100644 index 8b8785a..0000000 --- a/test cases/common/67 array arithmetic/meson.build +++ /dev/null @@ -1,15 +0,0 @@ -project('array arithmetic', 'c') - -array1 = ['foo', 'bar'] -array2 = ['qux', 'baz'] - -if array1 + array2 != ['foo', 'bar', 'qux', 'baz'] - error('Array concatenation is broken') -endif -if array2 + array1 != ['qux', 'baz', 'foo', 'bar'] - error('Array concatenation is broken') -endif - -if array1 + array1 + array1 != ['foo', 'bar', 'foo', 'bar', 'foo', 'bar'] - error('Many-array concatenation is broken') -endif diff --git a/test cases/common/68 arithmetic bidmas/meson.build b/test cases/common/68 arithmetic bidmas/meson.build deleted file mode 100644 index c7334b4..0000000 --- a/test cases/common/68 arithmetic bidmas/meson.build +++ /dev/null @@ -1,15 +0,0 @@ -project('arithmetic bidmas', 'c') - -if 5 * 3 - 6 / 2 + 1 != 13 - error('Arithmetic bidmas broken') -endif -if 5 * (3 - 6 / 2) + 1 != 1 - error('Arithmetic bidmas with brackets broken') -endif - -if 5 * 12 / 2 * 3 != 90 - error('Sequential multiplication and division broken') -endif -if 5 * (12 / (2 * 3)) != 10 - error('Sequential multiplication and division with brackets broken') -endif diff --git a/test cases/common/68 build always/main.c b/test cases/common/68 build always/main.c new file mode 100644 index 0000000..f8d9ac9 --- /dev/null +++ b/test cases/common/68 build always/main.c @@ -0,0 +1,7 @@ +#include +#include"version.h" + +int main(int argc, char **argv) { + printf("Version is %s.\n", version_string); + return 0; +} diff --git a/test cases/common/68 build always/meson.build b/test cases/common/68 build always/meson.build new file mode 100644 index 0000000..f720c89 --- /dev/null +++ b/test cases/common/68 build always/meson.build @@ -0,0 +1,14 @@ +project('run always', 'c') + +version = '1.0.0' + +vgen = find_program('version_gen.py') + +version_src = custom_target('Version string', +input : 'version.c.in', +output : 'version.c', +command : [vgen, '@INPUT@', '@OUTPUT@', version], +build_always : true, +) + +executable('versionprinter', 'main.c', version_src) diff --git a/test cases/common/68 build always/version.c.in b/test cases/common/68 build always/version.c.in new file mode 100644 index 0000000..619e517 --- /dev/null +++ b/test cases/common/68 build always/version.c.in @@ -0,0 +1,3 @@ +#include"version.h" + +const char *version_string = "@VERSION@"; diff --git a/test cases/common/68 build always/version.h b/test cases/common/68 build always/version.h new file mode 100644 index 0000000..d3fe5c6 --- /dev/null +++ b/test cases/common/68 build always/version.h @@ -0,0 +1,3 @@ +#pragma once + +const char *version_string; diff --git a/test cases/common/68 build always/version_gen.py b/test cases/common/68 build always/version_gen.py new file mode 100755 index 0000000..fbe2df9 --- /dev/null +++ b/test cases/common/68 build always/version_gen.py @@ -0,0 +1,29 @@ +#!/usr/bin/env python3 + +import sys, os, subprocess + +def generate(infile, outfile, fallback): + workdir = os.path.split(infile)[0] + if workdir == '': + workdir = '.' + try: + version = subprocess.check_output(['git', 'describe'], cwd=workdir).decode().strip() + except (subprocess.CalledProcessError, OSError, UnicodeDecodeError): + version = fallback + with open(infile) as f: + newdata = f.read().replace('@VERSION@', version) + try: + with open(outfile) as f: + olddata = f.read() + if olddata == newdata: + return + except OSError: + pass + with open(outfile, 'w') as f: + f.write(newdata) + +if __name__ == '__main__': + infile = sys.argv[1] + outfile = sys.argv[2] + fallback = sys.argv[3] + generate(infile, outfile, fallback) diff --git a/test cases/common/69 build always/main.c b/test cases/common/69 build always/main.c deleted file mode 100644 index f8d9ac9..0000000 --- a/test cases/common/69 build always/main.c +++ /dev/null @@ -1,7 +0,0 @@ -#include -#include"version.h" - -int main(int argc, char **argv) { - printf("Version is %s.\n", version_string); - return 0; -} diff --git a/test cases/common/69 build always/meson.build b/test cases/common/69 build always/meson.build deleted file mode 100644 index f720c89..0000000 --- a/test cases/common/69 build always/meson.build +++ /dev/null @@ -1,14 +0,0 @@ -project('run always', 'c') - -version = '1.0.0' - -vgen = find_program('version_gen.py') - -version_src = custom_target('Version string', -input : 'version.c.in', -output : 'version.c', -command : [vgen, '@INPUT@', '@OUTPUT@', version], -build_always : true, -) - -executable('versionprinter', 'main.c', version_src) diff --git a/test cases/common/69 build always/version.c.in b/test cases/common/69 build always/version.c.in deleted file mode 100644 index 619e517..0000000 --- a/test cases/common/69 build always/version.c.in +++ /dev/null @@ -1,3 +0,0 @@ -#include"version.h" - -const char *version_string = "@VERSION@"; diff --git a/test cases/common/69 build always/version.h b/test cases/common/69 build always/version.h deleted file mode 100644 index d3fe5c6..0000000 --- a/test cases/common/69 build always/version.h +++ /dev/null @@ -1,3 +0,0 @@ -#pragma once - -const char *version_string; diff --git a/test cases/common/69 build always/version_gen.py b/test cases/common/69 build always/version_gen.py deleted file mode 100755 index fbe2df9..0000000 --- a/test cases/common/69 build always/version_gen.py +++ /dev/null @@ -1,29 +0,0 @@ -#!/usr/bin/env python3 - -import sys, os, subprocess - -def generate(infile, outfile, fallback): - workdir = os.path.split(infile)[0] - if workdir == '': - workdir = '.' - try: - version = subprocess.check_output(['git', 'describe'], cwd=workdir).decode().strip() - except (subprocess.CalledProcessError, OSError, UnicodeDecodeError): - version = fallback - with open(infile) as f: - newdata = f.read().replace('@VERSION@', version) - try: - with open(outfile) as f: - olddata = f.read() - if olddata == newdata: - return - except OSError: - pass - with open(outfile, 'w') as f: - f.write(newdata) - -if __name__ == '__main__': - infile = sys.argv[1] - outfile = sys.argv[2] - fallback = sys.argv[3] - generate(infile, outfile, fallback) diff --git a/test cases/common/69 vcstag/meson.build b/test cases/common/69 vcstag/meson.build new file mode 100644 index 0000000..7e5983a --- /dev/null +++ b/test cases/common/69 vcstag/meson.build @@ -0,0 +1,18 @@ +project('vcstag', 'c') + +version_src = vcs_tag(input : 'vcstag.c.in', +output : 'vcstag.c', +fallback : '1.0.0') + +version_src_custom = vcs_tag(input : 'vcstag.c.in', +output : 'vcstag-custom.c', +command : ['git', 'show-ref', '-s', 'refs/heads/master'], +fallback : '1.0.0') + +version_src_fallback = vcs_tag(input : 'vcstag.c.in', +output : 'vcstag-fallback.c') + +executable('tagprog', 'tagprog.c', version_src) +executable('tagprog-custom', 'tagprog.c', version_src_custom) +executable('tagprog-fallback', 'tagprog.c', version_src_fallback) + diff --git a/test cases/common/69 vcstag/tagprog.c b/test cases/common/69 vcstag/tagprog.c new file mode 100644 index 0000000..34146b4 --- /dev/null +++ b/test cases/common/69 vcstag/tagprog.c @@ -0,0 +1,9 @@ +#include + +const char *vcstag; + +int main(int argc, char **argv) { + printf("Version is %s\n", vcstag); + return 0; +} + diff --git a/test cases/common/69 vcstag/vcstag.c.in b/test cases/common/69 vcstag/vcstag.c.in new file mode 100644 index 0000000..09192d9 --- /dev/null +++ b/test cases/common/69 vcstag/vcstag.c.in @@ -0,0 +1,2 @@ +const char *vcstag = "@VCS_TAG@"; + diff --git a/test cases/common/70 modules/meson.build b/test cases/common/70 modules/meson.build new file mode 100644 index 0000000..e9750cd --- /dev/null +++ b/test cases/common/70 modules/meson.build @@ -0,0 +1,4 @@ +project('module test', 'c') + +modtest = import('modtest') +modtest.print_hello() diff --git a/test cases/common/70 vcstag/meson.build b/test cases/common/70 vcstag/meson.build deleted file mode 100644 index 7e5983a..0000000 --- a/test cases/common/70 vcstag/meson.build +++ /dev/null @@ -1,18 +0,0 @@ -project('vcstag', 'c') - -version_src = vcs_tag(input : 'vcstag.c.in', -output : 'vcstag.c', -fallback : '1.0.0') - -version_src_custom = vcs_tag(input : 'vcstag.c.in', -output : 'vcstag-custom.c', -command : ['git', 'show-ref', '-s', 'refs/heads/master'], -fallback : '1.0.0') - -version_src_fallback = vcs_tag(input : 'vcstag.c.in', -output : 'vcstag-fallback.c') - -executable('tagprog', 'tagprog.c', version_src) -executable('tagprog-custom', 'tagprog.c', version_src_custom) -executable('tagprog-fallback', 'tagprog.c', version_src_fallback) - diff --git a/test cases/common/70 vcstag/tagprog.c b/test cases/common/70 vcstag/tagprog.c deleted file mode 100644 index 34146b4..0000000 --- a/test cases/common/70 vcstag/tagprog.c +++ /dev/null @@ -1,9 +0,0 @@ -#include - -const char *vcstag; - -int main(int argc, char **argv) { - printf("Version is %s\n", vcstag); - return 0; -} - diff --git a/test cases/common/70 vcstag/vcstag.c.in b/test cases/common/70 vcstag/vcstag.c.in deleted file mode 100644 index 09192d9..0000000 --- a/test cases/common/70 vcstag/vcstag.c.in +++ /dev/null @@ -1,2 +0,0 @@ -const char *vcstag = "@VCS_TAG@"; - diff --git a/test cases/common/71 modules/meson.build b/test cases/common/71 modules/meson.build deleted file mode 100644 index e9750cd..0000000 --- a/test cases/common/71 modules/meson.build +++ /dev/null @@ -1,4 +0,0 @@ -project('module test', 'c') - -modtest = import('modtest') -modtest.print_hello() diff --git a/test cases/common/71 should fail/failing.c b/test cases/common/71 should fail/failing.c new file mode 100644 index 0000000..adada8d --- /dev/null +++ b/test cases/common/71 should fail/failing.c @@ -0,0 +1,3 @@ +int main(int argc, char **argv) { + return 1; +} diff --git a/test cases/common/71 should fail/meson.build b/test cases/common/71 should fail/meson.build new file mode 100644 index 0000000..dffbbb3 --- /dev/null +++ b/test cases/common/71 should fail/meson.build @@ -0,0 +1,4 @@ +project('should fail', 'c') + +exe = executable('prog', 'failing.c') +test('failing', exe, should_fail : true) diff --git a/test cases/common/72 configure file in custom target/inc/confdata.in b/test cases/common/72 configure file in custom target/inc/confdata.in new file mode 100644 index 0000000..e44cdea --- /dev/null +++ b/test cases/common/72 configure file in custom target/inc/confdata.in @@ -0,0 +1 @@ +@VALUE@ diff --git a/test cases/common/72 configure file in custom target/inc/meson.build b/test cases/common/72 configure file in custom target/inc/meson.build new file mode 100644 index 0000000..05d2dcb --- /dev/null +++ b/test cases/common/72 configure file in custom target/inc/meson.build @@ -0,0 +1,6 @@ +cdata = configuration_data() +cdata.set('VALUE', '42') + +cfile = configure_file(input : 'confdata.in', +output : 'confdata', +configuration : cdata) diff --git a/test cases/common/72 configure file in custom target/meson.build b/test cases/common/72 configure file in custom target/meson.build new file mode 100644 index 0000000..0a850a1 --- /dev/null +++ b/test cases/common/72 configure file in custom target/meson.build @@ -0,0 +1,4 @@ +project('conf file in custom target', 'c') + +subdir('inc') +subdir('src') diff --git a/test cases/common/72 configure file in custom target/src/meson.build b/test cases/common/72 configure file in custom target/src/meson.build new file mode 100644 index 0000000..e0ab9eb --- /dev/null +++ b/test cases/common/72 configure file in custom target/src/meson.build @@ -0,0 +1,20 @@ +custom_target('thing', +output : 'final.dat', +input : cfile, +command : [find_program('mycompiler.py'), '@INPUT@', '@OUTPUT@']) + +# Test usage of a `configure_file` as part of the command list +py3 = find_program('python3', required : false) +if not py3.found() + # Maybe 'python' is Python 3 + py3 = find_program('python') +endif + +compiler = configure_file(input : 'mycompiler.py', + output : 'mycompiler2.py', + copy: true) + +custom_target('thing2', +output : 'final2.dat', +input : cfile, +command : [py3, compiler, '@INPUT@', '@OUTPUT@']) diff --git a/test cases/common/72 configure file in custom target/src/mycompiler.py b/test cases/common/72 configure file in custom target/src/mycompiler.py new file mode 100644 index 0000000..b00c862 --- /dev/null +++ b/test cases/common/72 configure file in custom target/src/mycompiler.py @@ -0,0 +1,9 @@ +#!/usr/bin/env python3 + +import sys + +with open(sys.argv[1]) as ifile: + if ifile.readline().strip() != '42': + print('Incorrect input') +with open(sys.argv[2], 'w') as ofile: + ofile.write('Success\n') diff --git a/test cases/common/72 should fail/failing.c b/test cases/common/72 should fail/failing.c deleted file mode 100644 index adada8d..0000000 --- a/test cases/common/72 should fail/failing.c +++ /dev/null @@ -1,3 +0,0 @@ -int main(int argc, char **argv) { - return 1; -} diff --git a/test cases/common/72 should fail/meson.build b/test cases/common/72 should fail/meson.build deleted file mode 100644 index dffbbb3..0000000 --- a/test cases/common/72 should fail/meson.build +++ /dev/null @@ -1,4 +0,0 @@ -project('should fail', 'c') - -exe = executable('prog', 'failing.c') -test('failing', exe, should_fail : true) diff --git a/test cases/common/73 configure file in custom target/inc/confdata.in b/test cases/common/73 configure file in custom target/inc/confdata.in deleted file mode 100644 index e44cdea..0000000 --- a/test cases/common/73 configure file in custom target/inc/confdata.in +++ /dev/null @@ -1 +0,0 @@ -@VALUE@ diff --git a/test cases/common/73 configure file in custom target/inc/meson.build b/test cases/common/73 configure file in custom target/inc/meson.build deleted file mode 100644 index 05d2dcb..0000000 --- a/test cases/common/73 configure file in custom target/inc/meson.build +++ /dev/null @@ -1,6 +0,0 @@ -cdata = configuration_data() -cdata.set('VALUE', '42') - -cfile = configure_file(input : 'confdata.in', -output : 'confdata', -configuration : cdata) diff --git a/test cases/common/73 configure file in custom target/meson.build b/test cases/common/73 configure file in custom target/meson.build deleted file mode 100644 index 0a850a1..0000000 --- a/test cases/common/73 configure file in custom target/meson.build +++ /dev/null @@ -1,4 +0,0 @@ -project('conf file in custom target', 'c') - -subdir('inc') -subdir('src') diff --git a/test cases/common/73 configure file in custom target/src/meson.build b/test cases/common/73 configure file in custom target/src/meson.build deleted file mode 100644 index e0ab9eb..0000000 --- a/test cases/common/73 configure file in custom target/src/meson.build +++ /dev/null @@ -1,20 +0,0 @@ -custom_target('thing', -output : 'final.dat', -input : cfile, -command : [find_program('mycompiler.py'), '@INPUT@', '@OUTPUT@']) - -# Test usage of a `configure_file` as part of the command list -py3 = find_program('python3', required : false) -if not py3.found() - # Maybe 'python' is Python 3 - py3 = find_program('python') -endif - -compiler = configure_file(input : 'mycompiler.py', - output : 'mycompiler2.py', - copy: true) - -custom_target('thing2', -output : 'final2.dat', -input : cfile, -command : [py3, compiler, '@INPUT@', '@OUTPUT@']) diff --git a/test cases/common/73 configure file in custom target/src/mycompiler.py b/test cases/common/73 configure file in custom target/src/mycompiler.py deleted file mode 100644 index b00c862..0000000 --- a/test cases/common/73 configure file in custom target/src/mycompiler.py +++ /dev/null @@ -1,9 +0,0 @@ -#!/usr/bin/env python3 - -import sys - -with open(sys.argv[1]) as ifile: - if ifile.readline().strip() != '42': - print('Incorrect input') -with open(sys.argv[2], 'w') as ofile: - ofile.write('Success\n') diff --git a/test cases/common/73 external test program/meson.build b/test cases/common/73 external test program/meson.build new file mode 100644 index 0000000..d18ddcd --- /dev/null +++ b/test cases/common/73 external test program/meson.build @@ -0,0 +1,3 @@ +project('test is external', 'c') + +test('external', find_program('mytest.py'), args : ['correct']) diff --git a/test cases/common/73 external test program/mytest.py b/test cases/common/73 external test program/mytest.py new file mode 100755 index 0000000..9947773 --- /dev/null +++ b/test cases/common/73 external test program/mytest.py @@ -0,0 +1,11 @@ +#!/usr/bin/env python3 + +from __future__ import print_function + +import sys + +if sys.argv[1] == 'correct': + print('Argument is correct.') + sys.exit(0) +print('Argument is incorrect:', sys.argv[1]) +sys.exit(1) diff --git a/test cases/common/74 ctarget dependency/gen1.py b/test cases/common/74 ctarget dependency/gen1.py new file mode 100755 index 0000000..0fa6ea1 --- /dev/null +++ b/test cases/common/74 ctarget dependency/gen1.py @@ -0,0 +1,12 @@ +#!/usr/bin/env python3 + +import time, sys + +# Make sure other script runs first if dependency +# is missing. +time.sleep(0.5) + +with open(sys.argv[1], 'r') as f: + contents = f.read() +with open(sys.argv[2], 'w') as f: + f.write(contents) diff --git a/test cases/common/74 ctarget dependency/gen2.py b/test cases/common/74 ctarget dependency/gen2.py new file mode 100755 index 0000000..b087b02 --- /dev/null +++ b/test cases/common/74 ctarget dependency/gen2.py @@ -0,0 +1,10 @@ +#!/usr/bin/env python3 + +import sys, os +from glob import glob + +files = glob(os.path.join(sys.argv[1], '*.tmp')) +assert(len(files) == 1) + +with open(files[0], 'r') as ifile, open(sys.argv[2], 'w') as ofile: + ofile.write(ifile.read()) diff --git a/test cases/common/74 ctarget dependency/input.dat b/test cases/common/74 ctarget dependency/input.dat new file mode 100644 index 0000000..7af91e2 --- /dev/null +++ b/test cases/common/74 ctarget dependency/input.dat @@ -0,0 +1 @@ +This is a piece of text. diff --git a/test cases/common/74 ctarget dependency/meson.build b/test cases/common/74 ctarget dependency/meson.build new file mode 100644 index 0000000..cd11951 --- /dev/null +++ b/test cases/common/74 ctarget dependency/meson.build @@ -0,0 +1,20 @@ +project('custom target dependency', 'c') + +# Sometimes custom targets do not take input files +# but instead do globbing or some similar wackiness. +# In this case we need to be able to specify a +# manual dependency between two custom targets, +# if one needs to be run before the other. + +g1 = find_program('gen1.py') +g2 = find_program('gen2.py') + +c1 = custom_target('medput', +input : 'input.dat', +output : 'medput.tmp', +command : [g1, '@INPUT@', '@OUTPUT@']) + +custom_target('output', +output : 'output.dat', +command : [g2, '@OUTDIR@', '@OUTPUT@'], +depends : c1) diff --git a/test cases/common/74 external test program/meson.build b/test cases/common/74 external test program/meson.build deleted file mode 100644 index d18ddcd..0000000 --- a/test cases/common/74 external test program/meson.build +++ /dev/null @@ -1,3 +0,0 @@ -project('test is external', 'c') - -test('external', find_program('mytest.py'), args : ['correct']) diff --git a/test cases/common/74 external test program/mytest.py b/test cases/common/74 external test program/mytest.py deleted file mode 100755 index 9947773..0000000 --- a/test cases/common/74 external test program/mytest.py +++ /dev/null @@ -1,11 +0,0 @@ -#!/usr/bin/env python3 - -from __future__ import print_function - -import sys - -if sys.argv[1] == 'correct': - print('Argument is correct.') - sys.exit(0) -print('Argument is incorrect:', sys.argv[1]) -sys.exit(1) diff --git a/test cases/common/75 ctarget dependency/gen1.py b/test cases/common/75 ctarget dependency/gen1.py deleted file mode 100755 index 0fa6ea1..0000000 --- a/test cases/common/75 ctarget dependency/gen1.py +++ /dev/null @@ -1,12 +0,0 @@ -#!/usr/bin/env python3 - -import time, sys - -# Make sure other script runs first if dependency -# is missing. -time.sleep(0.5) - -with open(sys.argv[1], 'r') as f: - contents = f.read() -with open(sys.argv[2], 'w') as f: - f.write(contents) diff --git a/test cases/common/75 ctarget dependency/gen2.py b/test cases/common/75 ctarget dependency/gen2.py deleted file mode 100755 index b087b02..0000000 --- a/test cases/common/75 ctarget dependency/gen2.py +++ /dev/null @@ -1,10 +0,0 @@ -#!/usr/bin/env python3 - -import sys, os -from glob import glob - -files = glob(os.path.join(sys.argv[1], '*.tmp')) -assert(len(files) == 1) - -with open(files[0], 'r') as ifile, open(sys.argv[2], 'w') as ofile: - ofile.write(ifile.read()) diff --git a/test cases/common/75 ctarget dependency/input.dat b/test cases/common/75 ctarget dependency/input.dat deleted file mode 100644 index 7af91e2..0000000 --- a/test cases/common/75 ctarget dependency/input.dat +++ /dev/null @@ -1 +0,0 @@ -This is a piece of text. diff --git a/test cases/common/75 ctarget dependency/meson.build b/test cases/common/75 ctarget dependency/meson.build deleted file mode 100644 index cd11951..0000000 --- a/test cases/common/75 ctarget dependency/meson.build +++ /dev/null @@ -1,20 +0,0 @@ -project('custom target dependency', 'c') - -# Sometimes custom targets do not take input files -# but instead do globbing or some similar wackiness. -# In this case we need to be able to specify a -# manual dependency between two custom targets, -# if one needs to be run before the other. - -g1 = find_program('gen1.py') -g2 = find_program('gen2.py') - -c1 = custom_target('medput', -input : 'input.dat', -output : 'medput.tmp', -command : [g1, '@INPUT@', '@OUTPUT@']) - -custom_target('output', -output : 'output.dat', -command : [g2, '@OUTDIR@', '@OUTPUT@'], -depends : c1) diff --git a/test cases/common/75 shared subproject/a.c b/test cases/common/75 shared subproject/a.c new file mode 100644 index 0000000..6ed96fa --- /dev/null +++ b/test cases/common/75 shared subproject/a.c @@ -0,0 +1,13 @@ +#include +char func_b(); +char func_c(); + +int main(int argc, char **argv) { + if(func_b() != 'b') { + return 1; + } + if(func_c() != 'c') { + return 2; + } + return 0; +} diff --git a/test cases/common/75 shared subproject/meson.build b/test cases/common/75 shared subproject/meson.build new file mode 100644 index 0000000..6803d51 --- /dev/null +++ b/test cases/common/75 shared subproject/meson.build @@ -0,0 +1,10 @@ +project('A', 'c') + +B = subproject('B') +b = B.get_variable('b') + +C = subproject('C') +c = C.get_variable('c') + +a = executable('a', 'a.c', link_with : [b, c]) +test('a test', a) diff --git a/test cases/common/75 shared subproject/subprojects/B/b.c b/test cases/common/75 shared subproject/subprojects/B/b.c new file mode 100644 index 0000000..a1f3a51 --- /dev/null +++ b/test cases/common/75 shared subproject/subprojects/B/b.c @@ -0,0 +1,21 @@ +#include +#if defined _WIN32 || defined __CYGWIN__ +#define DLL_PUBLIC __declspec(dllexport) +#else + #if defined __GNUC__ + #define DLL_PUBLIC __attribute__ ((visibility("default"))) + #else + #pragma message ("Compiler does not support symbol visibility.") + #define DLL_PUBLIC + #endif +#endif + + +char func_c(); + +char DLL_PUBLIC func_b() { + if(func_c() != 'c') { + exit(3); + } + return 'b'; +} diff --git a/test cases/common/75 shared subproject/subprojects/B/meson.build b/test cases/common/75 shared subproject/subprojects/B/meson.build new file mode 100644 index 0000000..280c60c --- /dev/null +++ b/test cases/common/75 shared subproject/subprojects/B/meson.build @@ -0,0 +1,4 @@ +project('B', 'c') +C = subproject('C') +c = C.get_variable('c') +b = shared_library('b', 'b.c', link_with : c) diff --git a/test cases/common/75 shared subproject/subprojects/C/c.c b/test cases/common/75 shared subproject/subprojects/C/c.c new file mode 100644 index 0000000..eebfb9f --- /dev/null +++ b/test cases/common/75 shared subproject/subprojects/C/c.c @@ -0,0 +1,14 @@ +#if defined _WIN32 || defined __CYGWIN__ +#define DLL_PUBLIC __declspec(dllexport) +#else + #if defined __GNUC__ + #define DLL_PUBLIC __attribute__ ((visibility("default"))) + #else + #pragma message ("Compiler does not support symbol visibility.") + #define DLL_PUBLIC + #endif +#endif + +char DLL_PUBLIC func_c() { + return 'c'; +} diff --git a/test cases/common/75 shared subproject/subprojects/C/meson.build b/test cases/common/75 shared subproject/subprojects/C/meson.build new file mode 100644 index 0000000..abf0b1e --- /dev/null +++ b/test cases/common/75 shared subproject/subprojects/C/meson.build @@ -0,0 +1,2 @@ +project('C', 'c') +c = shared_library('c', 'c.c') diff --git a/test cases/common/76 shared subproject 2/a.c b/test cases/common/76 shared subproject 2/a.c new file mode 100644 index 0000000..6ed96fa --- /dev/null +++ b/test cases/common/76 shared subproject 2/a.c @@ -0,0 +1,13 @@ +#include +char func_b(); +char func_c(); + +int main(int argc, char **argv) { + if(func_b() != 'b') { + return 1; + } + if(func_c() != 'c') { + return 2; + } + return 0; +} diff --git a/test cases/common/76 shared subproject 2/meson.build b/test cases/common/76 shared subproject 2/meson.build new file mode 100644 index 0000000..0647325 --- /dev/null +++ b/test cases/common/76 shared subproject 2/meson.build @@ -0,0 +1,13 @@ +project('A', 'c') + +# Same as the previous test but use C and B in +# the opposite order. + +C = subproject('C') +c = C.get_variable('c') + +B = subproject('B') +b = B.get_variable('b') + +a = executable('a', 'a.c', link_with : [b, c]) +test('a test', a) diff --git a/test cases/common/76 shared subproject 2/subprojects/B/b.c b/test cases/common/76 shared subproject 2/subprojects/B/b.c new file mode 100644 index 0000000..4c94ee9 --- /dev/null +++ b/test cases/common/76 shared subproject 2/subprojects/B/b.c @@ -0,0 +1,20 @@ +#include +char func_c(); + +#if defined _WIN32 || defined __CYGWIN__ +#define DLL_PUBLIC __declspec(dllexport) +#else + #if defined __GNUC__ + #define DLL_PUBLIC __attribute__ ((visibility("default"))) + #else + #pragma message ("Compiler does not support symbol visibility.") + #define DLL_PUBLIC + #endif +#endif + +char DLL_PUBLIC func_b() { + if(func_c() != 'c') { + exit(3); + } + return 'b'; +} diff --git a/test cases/common/76 shared subproject 2/subprojects/B/meson.build b/test cases/common/76 shared subproject 2/subprojects/B/meson.build new file mode 100644 index 0000000..280c60c --- /dev/null +++ b/test cases/common/76 shared subproject 2/subprojects/B/meson.build @@ -0,0 +1,4 @@ +project('B', 'c') +C = subproject('C') +c = C.get_variable('c') +b = shared_library('b', 'b.c', link_with : c) diff --git a/test cases/common/76 shared subproject 2/subprojects/C/c.c b/test cases/common/76 shared subproject 2/subprojects/C/c.c new file mode 100644 index 0000000..eebfb9f --- /dev/null +++ b/test cases/common/76 shared subproject 2/subprojects/C/c.c @@ -0,0 +1,14 @@ +#if defined _WIN32 || defined __CYGWIN__ +#define DLL_PUBLIC __declspec(dllexport) +#else + #if defined __GNUC__ + #define DLL_PUBLIC __attribute__ ((visibility("default"))) + #else + #pragma message ("Compiler does not support symbol visibility.") + #define DLL_PUBLIC + #endif +#endif + +char DLL_PUBLIC func_c() { + return 'c'; +} diff --git a/test cases/common/76 shared subproject 2/subprojects/C/meson.build b/test cases/common/76 shared subproject 2/subprojects/C/meson.build new file mode 100644 index 0000000..abf0b1e --- /dev/null +++ b/test cases/common/76 shared subproject 2/subprojects/C/meson.build @@ -0,0 +1,2 @@ +project('C', 'c') +c = shared_library('c', 'c.c') diff --git a/test cases/common/76 shared subproject/a.c b/test cases/common/76 shared subproject/a.c deleted file mode 100644 index 6ed96fa..0000000 --- a/test cases/common/76 shared subproject/a.c +++ /dev/null @@ -1,13 +0,0 @@ -#include -char func_b(); -char func_c(); - -int main(int argc, char **argv) { - if(func_b() != 'b') { - return 1; - } - if(func_c() != 'c') { - return 2; - } - return 0; -} diff --git a/test cases/common/76 shared subproject/meson.build b/test cases/common/76 shared subproject/meson.build deleted file mode 100644 index 6803d51..0000000 --- a/test cases/common/76 shared subproject/meson.build +++ /dev/null @@ -1,10 +0,0 @@ -project('A', 'c') - -B = subproject('B') -b = B.get_variable('b') - -C = subproject('C') -c = C.get_variable('c') - -a = executable('a', 'a.c', link_with : [b, c]) -test('a test', a) diff --git a/test cases/common/76 shared subproject/subprojects/B/b.c b/test cases/common/76 shared subproject/subprojects/B/b.c deleted file mode 100644 index a1f3a51..0000000 --- a/test cases/common/76 shared subproject/subprojects/B/b.c +++ /dev/null @@ -1,21 +0,0 @@ -#include -#if defined _WIN32 || defined __CYGWIN__ -#define DLL_PUBLIC __declspec(dllexport) -#else - #if defined __GNUC__ - #define DLL_PUBLIC __attribute__ ((visibility("default"))) - #else - #pragma message ("Compiler does not support symbol visibility.") - #define DLL_PUBLIC - #endif -#endif - - -char func_c(); - -char DLL_PUBLIC func_b() { - if(func_c() != 'c') { - exit(3); - } - return 'b'; -} diff --git a/test cases/common/76 shared subproject/subprojects/B/meson.build b/test cases/common/76 shared subproject/subprojects/B/meson.build deleted file mode 100644 index 280c60c..0000000 --- a/test cases/common/76 shared subproject/subprojects/B/meson.build +++ /dev/null @@ -1,4 +0,0 @@ -project('B', 'c') -C = subproject('C') -c = C.get_variable('c') -b = shared_library('b', 'b.c', link_with : c) diff --git a/test cases/common/76 shared subproject/subprojects/C/c.c b/test cases/common/76 shared subproject/subprojects/C/c.c deleted file mode 100644 index eebfb9f..0000000 --- a/test cases/common/76 shared subproject/subprojects/C/c.c +++ /dev/null @@ -1,14 +0,0 @@ -#if defined _WIN32 || defined __CYGWIN__ -#define DLL_PUBLIC __declspec(dllexport) -#else - #if defined __GNUC__ - #define DLL_PUBLIC __attribute__ ((visibility("default"))) - #else - #pragma message ("Compiler does not support symbol visibility.") - #define DLL_PUBLIC - #endif -#endif - -char DLL_PUBLIC func_c() { - return 'c'; -} diff --git a/test cases/common/76 shared subproject/subprojects/C/meson.build b/test cases/common/76 shared subproject/subprojects/C/meson.build deleted file mode 100644 index abf0b1e..0000000 --- a/test cases/common/76 shared subproject/subprojects/C/meson.build +++ /dev/null @@ -1,2 +0,0 @@ -project('C', 'c') -c = shared_library('c', 'c.c') diff --git a/test cases/common/77 file object/lib.c b/test cases/common/77 file object/lib.c new file mode 100644 index 0000000..6f1c172 --- /dev/null +++ b/test cases/common/77 file object/lib.c @@ -0,0 +1,3 @@ +int func() { + return 0; +} diff --git a/test cases/common/77 file object/meson.build b/test cases/common/77 file object/meson.build new file mode 100644 index 0000000..c3ecb7b --- /dev/null +++ b/test cases/common/77 file object/meson.build @@ -0,0 +1,9 @@ +project('file object', 'c') + +prog0 = files('prog.c') +lib0 = files('lib.c') +test('fobj', executable('fobj', prog0, lib0)) + +subdir('subdir1') +subdir('subdir2') + diff --git a/test cases/common/77 file object/prog.c b/test cases/common/77 file object/prog.c new file mode 100644 index 0000000..884d678 --- /dev/null +++ b/test cases/common/77 file object/prog.c @@ -0,0 +1,13 @@ +#include + +int func(); /* Files in different subdirs return different values. */ + +int main(int argc, char **argv) { + if(func() == 0) { + printf("Iz success.\n"); + } else { + printf("Iz fail.\n"); + return 1; + } + return 0; +} diff --git a/test cases/common/77 file object/subdir1/lib.c b/test cases/common/77 file object/subdir1/lib.c new file mode 100644 index 0000000..bc1e7b0 --- /dev/null +++ b/test cases/common/77 file object/subdir1/lib.c @@ -0,0 +1,3 @@ +int func() { + return 1; +} diff --git a/test cases/common/77 file object/subdir1/meson.build b/test cases/common/77 file object/subdir1/meson.build new file mode 100644 index 0000000..f5066f0 --- /dev/null +++ b/test cases/common/77 file object/subdir1/meson.build @@ -0,0 +1,7 @@ +prog1 = files('prog.c') +lib1 = files('lib.c') + +test('subdir0', executable('subdir0', prog0, lib1), should_fail : true) +test('subdir1', executable('subdir1', prog1, lib0), should_fail : true) + +test('subdir2', executable('subdir2', prog1, lib1)) \ No newline at end of file diff --git a/test cases/common/77 file object/subdir1/prog.c b/test cases/common/77 file object/subdir1/prog.c new file mode 100644 index 0000000..37ccf72 --- /dev/null +++ b/test cases/common/77 file object/subdir1/prog.c @@ -0,0 +1,13 @@ +#include + +int func(); + +int main(int argc, char **argv) { + if(func() == 1) { + printf("Iz success.\n"); + } else { + printf("Iz fail.\n"); + return 1; + } + return 0; +} diff --git a/test cases/common/77 file object/subdir2/lib.c b/test cases/common/77 file object/subdir2/lib.c new file mode 100644 index 0000000..cfef4d0 --- /dev/null +++ b/test cases/common/77 file object/subdir2/lib.c @@ -0,0 +1,3 @@ +int func() { + return 2; +} diff --git a/test cases/common/77 file object/subdir2/meson.build b/test cases/common/77 file object/subdir2/meson.build new file mode 100644 index 0000000..5886510 --- /dev/null +++ b/test cases/common/77 file object/subdir2/meson.build @@ -0,0 +1,7 @@ +prog2 = files('prog.c') +lib2 = files('lib.c') + +test('subdir3', executable('subdir3', prog1, lib2), should_fail : true) +test('subdir4', executable('subdir4', prog2, lib1), should_fail : true) + +test('subdir4', executable('subdir5', prog2, lib2)) \ No newline at end of file diff --git a/test cases/common/77 file object/subdir2/prog.c b/test cases/common/77 file object/subdir2/prog.c new file mode 100644 index 0000000..3a90b0a --- /dev/null +++ b/test cases/common/77 file object/subdir2/prog.c @@ -0,0 +1,13 @@ +#include + +int func(); + +int main(int argc, char **argv) { + if(func() == 2) { + printf("Iz success.\n"); + } else { + printf("Iz fail.\n"); + return 1; + } + return 0; +} diff --git a/test cases/common/77 shared subproject 2/a.c b/test cases/common/77 shared subproject 2/a.c deleted file mode 100644 index 6ed96fa..0000000 --- a/test cases/common/77 shared subproject 2/a.c +++ /dev/null @@ -1,13 +0,0 @@ -#include -char func_b(); -char func_c(); - -int main(int argc, char **argv) { - if(func_b() != 'b') { - return 1; - } - if(func_c() != 'c') { - return 2; - } - return 0; -} diff --git a/test cases/common/77 shared subproject 2/meson.build b/test cases/common/77 shared subproject 2/meson.build deleted file mode 100644 index 0647325..0000000 --- a/test cases/common/77 shared subproject 2/meson.build +++ /dev/null @@ -1,13 +0,0 @@ -project('A', 'c') - -# Same as the previous test but use C and B in -# the opposite order. - -C = subproject('C') -c = C.get_variable('c') - -B = subproject('B') -b = B.get_variable('b') - -a = executable('a', 'a.c', link_with : [b, c]) -test('a test', a) diff --git a/test cases/common/77 shared subproject 2/subprojects/B/b.c b/test cases/common/77 shared subproject 2/subprojects/B/b.c deleted file mode 100644 index 4c94ee9..0000000 --- a/test cases/common/77 shared subproject 2/subprojects/B/b.c +++ /dev/null @@ -1,20 +0,0 @@ -#include -char func_c(); - -#if defined _WIN32 || defined __CYGWIN__ -#define DLL_PUBLIC __declspec(dllexport) -#else - #if defined __GNUC__ - #define DLL_PUBLIC __attribute__ ((visibility("default"))) - #else - #pragma message ("Compiler does not support symbol visibility.") - #define DLL_PUBLIC - #endif -#endif - -char DLL_PUBLIC func_b() { - if(func_c() != 'c') { - exit(3); - } - return 'b'; -} diff --git a/test cases/common/77 shared subproject 2/subprojects/B/meson.build b/test cases/common/77 shared subproject 2/subprojects/B/meson.build deleted file mode 100644 index 280c60c..0000000 --- a/test cases/common/77 shared subproject 2/subprojects/B/meson.build +++ /dev/null @@ -1,4 +0,0 @@ -project('B', 'c') -C = subproject('C') -c = C.get_variable('c') -b = shared_library('b', 'b.c', link_with : c) diff --git a/test cases/common/77 shared subproject 2/subprojects/C/c.c b/test cases/common/77 shared subproject 2/subprojects/C/c.c deleted file mode 100644 index eebfb9f..0000000 --- a/test cases/common/77 shared subproject 2/subprojects/C/c.c +++ /dev/null @@ -1,14 +0,0 @@ -#if defined _WIN32 || defined __CYGWIN__ -#define DLL_PUBLIC __declspec(dllexport) -#else - #if defined __GNUC__ - #define DLL_PUBLIC __attribute__ ((visibility("default"))) - #else - #pragma message ("Compiler does not support symbol visibility.") - #define DLL_PUBLIC - #endif -#endif - -char DLL_PUBLIC func_c() { - return 'c'; -} diff --git a/test cases/common/77 shared subproject 2/subprojects/C/meson.build b/test cases/common/77 shared subproject 2/subprojects/C/meson.build deleted file mode 100644 index abf0b1e..0000000 --- a/test cases/common/77 shared subproject 2/subprojects/C/meson.build +++ /dev/null @@ -1,2 +0,0 @@ -project('C', 'c') -c = shared_library('c', 'c.c') diff --git a/test cases/common/78 custom subproject dir/a.c b/test cases/common/78 custom subproject dir/a.c new file mode 100644 index 0000000..6ed96fa --- /dev/null +++ b/test cases/common/78 custom subproject dir/a.c @@ -0,0 +1,13 @@ +#include +char func_b(); +char func_c(); + +int main(int argc, char **argv) { + if(func_b() != 'b') { + return 1; + } + if(func_c() != 'c') { + return 2; + } + return 0; +} diff --git a/test cases/common/78 custom subproject dir/custom_subproject_dir/B/b.c b/test cases/common/78 custom subproject dir/custom_subproject_dir/B/b.c new file mode 100644 index 0000000..4c94ee9 --- /dev/null +++ b/test cases/common/78 custom subproject dir/custom_subproject_dir/B/b.c @@ -0,0 +1,20 @@ +#include +char func_c(); + +#if defined _WIN32 || defined __CYGWIN__ +#define DLL_PUBLIC __declspec(dllexport) +#else + #if defined __GNUC__ + #define DLL_PUBLIC __attribute__ ((visibility("default"))) + #else + #pragma message ("Compiler does not support symbol visibility.") + #define DLL_PUBLIC + #endif +#endif + +char DLL_PUBLIC func_b() { + if(func_c() != 'c') { + exit(3); + } + return 'b'; +} diff --git a/test cases/common/78 custom subproject dir/custom_subproject_dir/B/meson.build b/test cases/common/78 custom subproject dir/custom_subproject_dir/B/meson.build new file mode 100644 index 0000000..280c60c --- /dev/null +++ b/test cases/common/78 custom subproject dir/custom_subproject_dir/B/meson.build @@ -0,0 +1,4 @@ +project('B', 'c') +C = subproject('C') +c = C.get_variable('c') +b = shared_library('b', 'b.c', link_with : c) diff --git a/test cases/common/78 custom subproject dir/custom_subproject_dir/C/c.c b/test cases/common/78 custom subproject dir/custom_subproject_dir/C/c.c new file mode 100644 index 0000000..eebfb9f --- /dev/null +++ b/test cases/common/78 custom subproject dir/custom_subproject_dir/C/c.c @@ -0,0 +1,14 @@ +#if defined _WIN32 || defined __CYGWIN__ +#define DLL_PUBLIC __declspec(dllexport) +#else + #if defined __GNUC__ + #define DLL_PUBLIC __attribute__ ((visibility("default"))) + #else + #pragma message ("Compiler does not support symbol visibility.") + #define DLL_PUBLIC + #endif +#endif + +char DLL_PUBLIC func_c() { + return 'c'; +} diff --git a/test cases/common/78 custom subproject dir/custom_subproject_dir/C/meson.build b/test cases/common/78 custom subproject dir/custom_subproject_dir/C/meson.build new file mode 100644 index 0000000..abf0b1e --- /dev/null +++ b/test cases/common/78 custom subproject dir/custom_subproject_dir/C/meson.build @@ -0,0 +1,2 @@ +project('C', 'c') +c = shared_library('c', 'c.c') diff --git a/test cases/common/78 custom subproject dir/meson.build b/test cases/common/78 custom subproject dir/meson.build new file mode 100644 index 0000000..d9ba649 --- /dev/null +++ b/test cases/common/78 custom subproject dir/meson.build @@ -0,0 +1,10 @@ +project('A', 'c', subproject_dir:'custom_subproject_dir') + +B = subproject('B') +b = B.get_variable('b') + +C = subproject('C') +c = C.get_variable('c') + +a = executable('a', 'a.c', link_with : [b, c]) +test('a test', a) diff --git a/test cases/common/78 file object/lib.c b/test cases/common/78 file object/lib.c deleted file mode 100644 index 6f1c172..0000000 --- a/test cases/common/78 file object/lib.c +++ /dev/null @@ -1,3 +0,0 @@ -int func() { - return 0; -} diff --git a/test cases/common/78 file object/meson.build b/test cases/common/78 file object/meson.build deleted file mode 100644 index c3ecb7b..0000000 --- a/test cases/common/78 file object/meson.build +++ /dev/null @@ -1,9 +0,0 @@ -project('file object', 'c') - -prog0 = files('prog.c') -lib0 = files('lib.c') -test('fobj', executable('fobj', prog0, lib0)) - -subdir('subdir1') -subdir('subdir2') - diff --git a/test cases/common/78 file object/prog.c b/test cases/common/78 file object/prog.c deleted file mode 100644 index 884d678..0000000 --- a/test cases/common/78 file object/prog.c +++ /dev/null @@ -1,13 +0,0 @@ -#include - -int func(); /* Files in different subdirs return different values. */ - -int main(int argc, char **argv) { - if(func() == 0) { - printf("Iz success.\n"); - } else { - printf("Iz fail.\n"); - return 1; - } - return 0; -} diff --git a/test cases/common/78 file object/subdir1/lib.c b/test cases/common/78 file object/subdir1/lib.c deleted file mode 100644 index bc1e7b0..0000000 --- a/test cases/common/78 file object/subdir1/lib.c +++ /dev/null @@ -1,3 +0,0 @@ -int func() { - return 1; -} diff --git a/test cases/common/78 file object/subdir1/meson.build b/test cases/common/78 file object/subdir1/meson.build deleted file mode 100644 index f5066f0..0000000 --- a/test cases/common/78 file object/subdir1/meson.build +++ /dev/null @@ -1,7 +0,0 @@ -prog1 = files('prog.c') -lib1 = files('lib.c') - -test('subdir0', executable('subdir0', prog0, lib1), should_fail : true) -test('subdir1', executable('subdir1', prog1, lib0), should_fail : true) - -test('subdir2', executable('subdir2', prog1, lib1)) \ No newline at end of file diff --git a/test cases/common/78 file object/subdir1/prog.c b/test cases/common/78 file object/subdir1/prog.c deleted file mode 100644 index 37ccf72..0000000 --- a/test cases/common/78 file object/subdir1/prog.c +++ /dev/null @@ -1,13 +0,0 @@ -#include - -int func(); - -int main(int argc, char **argv) { - if(func() == 1) { - printf("Iz success.\n"); - } else { - printf("Iz fail.\n"); - return 1; - } - return 0; -} diff --git a/test cases/common/78 file object/subdir2/lib.c b/test cases/common/78 file object/subdir2/lib.c deleted file mode 100644 index cfef4d0..0000000 --- a/test cases/common/78 file object/subdir2/lib.c +++ /dev/null @@ -1,3 +0,0 @@ -int func() { - return 2; -} diff --git a/test cases/common/78 file object/subdir2/meson.build b/test cases/common/78 file object/subdir2/meson.build deleted file mode 100644 index 5886510..0000000 --- a/test cases/common/78 file object/subdir2/meson.build +++ /dev/null @@ -1,7 +0,0 @@ -prog2 = files('prog.c') -lib2 = files('lib.c') - -test('subdir3', executable('subdir3', prog1, lib2), should_fail : true) -test('subdir4', executable('subdir4', prog2, lib1), should_fail : true) - -test('subdir4', executable('subdir5', prog2, lib2)) \ No newline at end of file diff --git a/test cases/common/78 file object/subdir2/prog.c b/test cases/common/78 file object/subdir2/prog.c deleted file mode 100644 index 3a90b0a..0000000 --- a/test cases/common/78 file object/subdir2/prog.c +++ /dev/null @@ -1,13 +0,0 @@ -#include - -int func(); - -int main(int argc, char **argv) { - if(func() == 2) { - printf("Iz success.\n"); - } else { - printf("Iz fail.\n"); - return 1; - } - return 0; -} diff --git a/test cases/common/79 custom subproject dir/a.c b/test cases/common/79 custom subproject dir/a.c deleted file mode 100644 index 6ed96fa..0000000 --- a/test cases/common/79 custom subproject dir/a.c +++ /dev/null @@ -1,13 +0,0 @@ -#include -char func_b(); -char func_c(); - -int main(int argc, char **argv) { - if(func_b() != 'b') { - return 1; - } - if(func_c() != 'c') { - return 2; - } - return 0; -} diff --git a/test cases/common/79 custom subproject dir/custom_subproject_dir/B/b.c b/test cases/common/79 custom subproject dir/custom_subproject_dir/B/b.c deleted file mode 100644 index 4c94ee9..0000000 --- a/test cases/common/79 custom subproject dir/custom_subproject_dir/B/b.c +++ /dev/null @@ -1,20 +0,0 @@ -#include -char func_c(); - -#if defined _WIN32 || defined __CYGWIN__ -#define DLL_PUBLIC __declspec(dllexport) -#else - #if defined __GNUC__ - #define DLL_PUBLIC __attribute__ ((visibility("default"))) - #else - #pragma message ("Compiler does not support symbol visibility.") - #define DLL_PUBLIC - #endif -#endif - -char DLL_PUBLIC func_b() { - if(func_c() != 'c') { - exit(3); - } - return 'b'; -} diff --git a/test cases/common/79 custom subproject dir/custom_subproject_dir/B/meson.build b/test cases/common/79 custom subproject dir/custom_subproject_dir/B/meson.build deleted file mode 100644 index 280c60c..0000000 --- a/test cases/common/79 custom subproject dir/custom_subproject_dir/B/meson.build +++ /dev/null @@ -1,4 +0,0 @@ -project('B', 'c') -C = subproject('C') -c = C.get_variable('c') -b = shared_library('b', 'b.c', link_with : c) diff --git a/test cases/common/79 custom subproject dir/custom_subproject_dir/C/c.c b/test cases/common/79 custom subproject dir/custom_subproject_dir/C/c.c deleted file mode 100644 index eebfb9f..0000000 --- a/test cases/common/79 custom subproject dir/custom_subproject_dir/C/c.c +++ /dev/null @@ -1,14 +0,0 @@ -#if defined _WIN32 || defined __CYGWIN__ -#define DLL_PUBLIC __declspec(dllexport) -#else - #if defined __GNUC__ - #define DLL_PUBLIC __attribute__ ((visibility("default"))) - #else - #pragma message ("Compiler does not support symbol visibility.") - #define DLL_PUBLIC - #endif -#endif - -char DLL_PUBLIC func_c() { - return 'c'; -} diff --git a/test cases/common/79 custom subproject dir/custom_subproject_dir/C/meson.build b/test cases/common/79 custom subproject dir/custom_subproject_dir/C/meson.build deleted file mode 100644 index abf0b1e..0000000 --- a/test cases/common/79 custom subproject dir/custom_subproject_dir/C/meson.build +++ /dev/null @@ -1,2 +0,0 @@ -project('C', 'c') -c = shared_library('c', 'c.c') diff --git a/test cases/common/79 custom subproject dir/meson.build b/test cases/common/79 custom subproject dir/meson.build deleted file mode 100644 index d9ba649..0000000 --- a/test cases/common/79 custom subproject dir/meson.build +++ /dev/null @@ -1,10 +0,0 @@ -project('A', 'c', subproject_dir:'custom_subproject_dir') - -B = subproject('B') -b = B.get_variable('b') - -C = subproject('C') -c = C.get_variable('c') - -a = executable('a', 'a.c', link_with : [b, c]) -test('a test', a) diff --git a/test cases/common/79 has type/meson.build b/test cases/common/79 has type/meson.build new file mode 100644 index 0000000..de8dbc8 --- /dev/null +++ b/test cases/common/79 has type/meson.build @@ -0,0 +1,13 @@ +project('has type', 'c', 'cpp') + +compilers = [meson.get_compiler('c'), meson.get_compiler('cpp')] + +foreach cc : compilers + if not cc.has_type('time_t', prefix : '#include') + error('Did not detect type that exists.') + endif + + if cc.has_type('no_time_t', prefix : '#include') + error('Not existing type found.') + endif +endforeach diff --git a/test cases/common/80 extract from nested subdir/meson.build b/test cases/common/80 extract from nested subdir/meson.build new file mode 100644 index 0000000..3a42806 --- /dev/null +++ b/test cases/common/80 extract from nested subdir/meson.build @@ -0,0 +1,8 @@ +project('Extract objects from subdirs.', 'c') + +if meson.is_unity() + message('Unity build: skipping incompatible test') +else + subdir('src') + subdir('tst') +endif diff --git a/test cases/common/80 extract from nested subdir/src/first/lib_first.c b/test cases/common/80 extract from nested subdir/src/first/lib_first.c new file mode 100644 index 0000000..3004906 --- /dev/null +++ b/test cases/common/80 extract from nested subdir/src/first/lib_first.c @@ -0,0 +1,3 @@ +int first() { + return 1001; +} diff --git a/test cases/common/80 extract from nested subdir/src/first/meson.build b/test cases/common/80 extract from nested subdir/src/first/meson.build new file mode 100644 index 0000000..b97aef4 --- /dev/null +++ b/test cases/common/80 extract from nested subdir/src/first/meson.build @@ -0,0 +1 @@ +first_lib = shared_library('first_lib', 'lib_first.c') diff --git a/test cases/common/80 extract from nested subdir/src/meson.build b/test cases/common/80 extract from nested subdir/src/meson.build new file mode 100644 index 0000000..3f5ec32 --- /dev/null +++ b/test cases/common/80 extract from nested subdir/src/meson.build @@ -0,0 +1 @@ +subdir('first') diff --git a/test cases/common/80 extract from nested subdir/tst/first/exe_first.c b/test cases/common/80 extract from nested subdir/tst/first/exe_first.c new file mode 100644 index 0000000..f6c1f74 --- /dev/null +++ b/test cases/common/80 extract from nested subdir/tst/first/exe_first.c @@ -0,0 +1,5 @@ +int first(void); + +int main() { + return first() - 1001; +} diff --git a/test cases/common/80 extract from nested subdir/tst/first/meson.build b/test cases/common/80 extract from nested subdir/tst/first/meson.build new file mode 100644 index 0000000..a6fa7da --- /dev/null +++ b/test cases/common/80 extract from nested subdir/tst/first/meson.build @@ -0,0 +1,4 @@ +first_exe = executable('first_exe', 'exe_first.c', + objects : first_lib.extract_objects('lib_first.c')) + +test('first_test', first_exe) diff --git a/test cases/common/80 extract from nested subdir/tst/meson.build b/test cases/common/80 extract from nested subdir/tst/meson.build new file mode 100644 index 0000000..3f5ec32 --- /dev/null +++ b/test cases/common/80 extract from nested subdir/tst/meson.build @@ -0,0 +1 @@ +subdir('first') diff --git a/test cases/common/80 has type/meson.build b/test cases/common/80 has type/meson.build deleted file mode 100644 index de8dbc8..0000000 --- a/test cases/common/80 has type/meson.build +++ /dev/null @@ -1,13 +0,0 @@ -project('has type', 'c', 'cpp') - -compilers = [meson.get_compiler('c'), meson.get_compiler('cpp')] - -foreach cc : compilers - if not cc.has_type('time_t', prefix : '#include') - error('Did not detect type that exists.') - endif - - if cc.has_type('no_time_t', prefix : '#include') - error('Not existing type found.') - endif -endforeach diff --git a/test cases/common/81 extract from nested subdir/meson.build b/test cases/common/81 extract from nested subdir/meson.build deleted file mode 100644 index 3a42806..0000000 --- a/test cases/common/81 extract from nested subdir/meson.build +++ /dev/null @@ -1,8 +0,0 @@ -project('Extract objects from subdirs.', 'c') - -if meson.is_unity() - message('Unity build: skipping incompatible test') -else - subdir('src') - subdir('tst') -endif diff --git a/test cases/common/81 extract from nested subdir/src/first/lib_first.c b/test cases/common/81 extract from nested subdir/src/first/lib_first.c deleted file mode 100644 index 3004906..0000000 --- a/test cases/common/81 extract from nested subdir/src/first/lib_first.c +++ /dev/null @@ -1,3 +0,0 @@ -int first() { - return 1001; -} diff --git a/test cases/common/81 extract from nested subdir/src/first/meson.build b/test cases/common/81 extract from nested subdir/src/first/meson.build deleted file mode 100644 index b97aef4..0000000 --- a/test cases/common/81 extract from nested subdir/src/first/meson.build +++ /dev/null @@ -1 +0,0 @@ -first_lib = shared_library('first_lib', 'lib_first.c') diff --git a/test cases/common/81 extract from nested subdir/src/meson.build b/test cases/common/81 extract from nested subdir/src/meson.build deleted file mode 100644 index 3f5ec32..0000000 --- a/test cases/common/81 extract from nested subdir/src/meson.build +++ /dev/null @@ -1 +0,0 @@ -subdir('first') diff --git a/test cases/common/81 extract from nested subdir/tst/first/exe_first.c b/test cases/common/81 extract from nested subdir/tst/first/exe_first.c deleted file mode 100644 index f6c1f74..0000000 --- a/test cases/common/81 extract from nested subdir/tst/first/exe_first.c +++ /dev/null @@ -1,5 +0,0 @@ -int first(void); - -int main() { - return first() - 1001; -} diff --git a/test cases/common/81 extract from nested subdir/tst/first/meson.build b/test cases/common/81 extract from nested subdir/tst/first/meson.build deleted file mode 100644 index a6fa7da..0000000 --- a/test cases/common/81 extract from nested subdir/tst/first/meson.build +++ /dev/null @@ -1,4 +0,0 @@ -first_exe = executable('first_exe', 'exe_first.c', - objects : first_lib.extract_objects('lib_first.c')) - -test('first_test', first_exe) diff --git a/test cases/common/81 extract from nested subdir/tst/meson.build b/test cases/common/81 extract from nested subdir/tst/meson.build deleted file mode 100644 index 3f5ec32..0000000 --- a/test cases/common/81 extract from nested subdir/tst/meson.build +++ /dev/null @@ -1 +0,0 @@ -subdir('first') diff --git a/test cases/common/81 internal dependency/meson.build b/test cases/common/81 internal dependency/meson.build new file mode 100644 index 0000000..6faedb0 --- /dev/null +++ b/test cases/common/81 internal dependency/meson.build @@ -0,0 +1,4 @@ +project('internal dependency', 'c') + +subdir('proj1') +subdir('src') diff --git a/test cases/common/81 internal dependency/proj1/include/proj1.h b/test cases/common/81 internal dependency/proj1/include/proj1.h new file mode 100644 index 0000000..ded6f75 --- /dev/null +++ b/test cases/common/81 internal dependency/proj1/include/proj1.h @@ -0,0 +1,5 @@ +#pragma once + +void proj1_func1(); +void proj1_func2(); +void proj1_func3(); diff --git a/test cases/common/81 internal dependency/proj1/meson.build b/test cases/common/81 internal dependency/proj1/meson.build new file mode 100644 index 0000000..422021e --- /dev/null +++ b/test cases/common/81 internal dependency/proj1/meson.build @@ -0,0 +1,11 @@ +incdirs = include_directories('include') + +p1lib = static_library('proj1', 'proj1f1.c', + include_directories : incdirs +) + +indirect_source = files('proj1f2.c') + +proj1_dep = declare_dependency(include_directories : incdirs, + link_with : p1lib, + sources : ['proj1f3.c', indirect_source]) diff --git a/test cases/common/81 internal dependency/proj1/proj1f1.c b/test cases/common/81 internal dependency/proj1/proj1f1.c new file mode 100644 index 0000000..9077f4f --- /dev/null +++ b/test cases/common/81 internal dependency/proj1/proj1f1.c @@ -0,0 +1,6 @@ +#include +#include + +void proj1_func1() { + printf("In proj1_func1.\n"); +} diff --git a/test cases/common/81 internal dependency/proj1/proj1f2.c b/test cases/common/81 internal dependency/proj1/proj1f2.c new file mode 100644 index 0000000..374ee4e --- /dev/null +++ b/test cases/common/81 internal dependency/proj1/proj1f2.c @@ -0,0 +1,6 @@ +#include +#include + +void proj1_func2() { + printf("In proj1_func2.\n"); +} diff --git a/test cases/common/81 internal dependency/proj1/proj1f3.c b/test cases/common/81 internal dependency/proj1/proj1f3.c new file mode 100644 index 0000000..8c8fca4 --- /dev/null +++ b/test cases/common/81 internal dependency/proj1/proj1f3.c @@ -0,0 +1,6 @@ +#include +#include + +void proj1_func3() { + printf("In proj1_func3.\n"); +} diff --git a/test cases/common/81 internal dependency/src/main.c b/test cases/common/81 internal dependency/src/main.c new file mode 100644 index 0000000..7d50b05 --- /dev/null +++ b/test cases/common/81 internal dependency/src/main.c @@ -0,0 +1,10 @@ +#include +#include + +int main(int argc, char **argv) { + printf("Now calling into library.\n"); + proj1_func1(); + proj1_func2(); + proj1_func3(); + return 0; +} diff --git a/test cases/common/81 internal dependency/src/meson.build b/test cases/common/81 internal dependency/src/meson.build new file mode 100644 index 0000000..89f99ab --- /dev/null +++ b/test cases/common/81 internal dependency/src/meson.build @@ -0,0 +1,2 @@ +exe = executable('projtest', 'main.c', dependencies : proj1_dep) +test('projtest', exe) diff --git a/test cases/common/82 internal dependency/meson.build b/test cases/common/82 internal dependency/meson.build deleted file mode 100644 index 6faedb0..0000000 --- a/test cases/common/82 internal dependency/meson.build +++ /dev/null @@ -1,4 +0,0 @@ -project('internal dependency', 'c') - -subdir('proj1') -subdir('src') diff --git a/test cases/common/82 internal dependency/proj1/include/proj1.h b/test cases/common/82 internal dependency/proj1/include/proj1.h deleted file mode 100644 index ded6f75..0000000 --- a/test cases/common/82 internal dependency/proj1/include/proj1.h +++ /dev/null @@ -1,5 +0,0 @@ -#pragma once - -void proj1_func1(); -void proj1_func2(); -void proj1_func3(); diff --git a/test cases/common/82 internal dependency/proj1/meson.build b/test cases/common/82 internal dependency/proj1/meson.build deleted file mode 100644 index 422021e..0000000 --- a/test cases/common/82 internal dependency/proj1/meson.build +++ /dev/null @@ -1,11 +0,0 @@ -incdirs = include_directories('include') - -p1lib = static_library('proj1', 'proj1f1.c', - include_directories : incdirs -) - -indirect_source = files('proj1f2.c') - -proj1_dep = declare_dependency(include_directories : incdirs, - link_with : p1lib, - sources : ['proj1f3.c', indirect_source]) diff --git a/test cases/common/82 internal dependency/proj1/proj1f1.c b/test cases/common/82 internal dependency/proj1/proj1f1.c deleted file mode 100644 index 9077f4f..0000000 --- a/test cases/common/82 internal dependency/proj1/proj1f1.c +++ /dev/null @@ -1,6 +0,0 @@ -#include -#include - -void proj1_func1() { - printf("In proj1_func1.\n"); -} diff --git a/test cases/common/82 internal dependency/proj1/proj1f2.c b/test cases/common/82 internal dependency/proj1/proj1f2.c deleted file mode 100644 index 374ee4e..0000000 --- a/test cases/common/82 internal dependency/proj1/proj1f2.c +++ /dev/null @@ -1,6 +0,0 @@ -#include -#include - -void proj1_func2() { - printf("In proj1_func2.\n"); -} diff --git a/test cases/common/82 internal dependency/proj1/proj1f3.c b/test cases/common/82 internal dependency/proj1/proj1f3.c deleted file mode 100644 index 8c8fca4..0000000 --- a/test cases/common/82 internal dependency/proj1/proj1f3.c +++ /dev/null @@ -1,6 +0,0 @@ -#include -#include - -void proj1_func3() { - printf("In proj1_func3.\n"); -} diff --git a/test cases/common/82 internal dependency/src/main.c b/test cases/common/82 internal dependency/src/main.c deleted file mode 100644 index 7d50b05..0000000 --- a/test cases/common/82 internal dependency/src/main.c +++ /dev/null @@ -1,10 +0,0 @@ -#include -#include - -int main(int argc, char **argv) { - printf("Now calling into library.\n"); - proj1_func1(); - proj1_func2(); - proj1_func3(); - return 0; -} diff --git a/test cases/common/82 internal dependency/src/meson.build b/test cases/common/82 internal dependency/src/meson.build deleted file mode 100644 index 89f99ab..0000000 --- a/test cases/common/82 internal dependency/src/meson.build +++ /dev/null @@ -1,2 +0,0 @@ -exe = executable('projtest', 'main.c', dependencies : proj1_dep) -test('projtest', exe) diff --git a/test cases/common/82 same basename/exe1.c b/test cases/common/82 same basename/exe1.c new file mode 100644 index 0000000..175a90d --- /dev/null +++ b/test cases/common/82 same basename/exe1.c @@ -0,0 +1,5 @@ +int func(); + +int main(int argc, char **argv) { + return func(); +} diff --git a/test cases/common/82 same basename/exe2.c b/test cases/common/82 same basename/exe2.c new file mode 100644 index 0000000..56b04cc --- /dev/null +++ b/test cases/common/82 same basename/exe2.c @@ -0,0 +1,5 @@ +int func(); + +int main(int argc, char **argv) { + return func() == 1 ? 0 : 1; +} diff --git a/test cases/common/82 same basename/lib.c b/test cases/common/82 same basename/lib.c new file mode 100644 index 0000000..6fd432e --- /dev/null +++ b/test cases/common/82 same basename/lib.c @@ -0,0 +1,23 @@ +#if defined _WIN32 || defined __CYGWIN__ +#define DLL_PUBLIC __declspec(dllexport) +#else + #if defined __GNUC__ + #define DLL_PUBLIC __attribute__ ((visibility("default"))) + #else + #pragma message ("Compiler does not support symbol visibility.") + #define DLL_PUBLIC + #endif +#endif + +#if defined SHAR +int DLL_PUBLIC func() { + return 1; +} +#elif defined STAT +int func() { + return 0; +} +#else +#error "Missing type definition." +#endif + diff --git a/test cases/common/82 same basename/meson.build b/test cases/common/82 same basename/meson.build new file mode 100644 index 0000000..856c536 --- /dev/null +++ b/test cases/common/82 same basename/meson.build @@ -0,0 +1,14 @@ +project('same basename', 'c') + +subdir('sharedsub') +subdir('staticsub') + +# Use the same source file to check that each top level target +# has its own unique working directory. If they don't +# then the .o files will clobber each other. + +exe1 = executable('name', 'exe1.c', link_with : stlib) +exe2 = executable('name2', 'exe2.c', link_with : shlib) + +test('static', exe1) +test('shared', exe2) diff --git a/test cases/common/82 same basename/sharedsub/meson.build b/test cases/common/82 same basename/sharedsub/meson.build new file mode 100644 index 0000000..29654a9 --- /dev/null +++ b/test cases/common/82 same basename/sharedsub/meson.build @@ -0,0 +1 @@ +shlib = shared_library('name', '../lib.c', c_args : '-DSHAR') diff --git a/test cases/common/82 same basename/staticsub/meson.build b/test cases/common/82 same basename/staticsub/meson.build new file mode 100644 index 0000000..5e5242e --- /dev/null +++ b/test cases/common/82 same basename/staticsub/meson.build @@ -0,0 +1,3 @@ +# On Windows a static lib is now libfoo.a, so it does not conflict with foo.lib +# from the shared library above +stlib = static_library('name', '../lib.c', c_args : '-DSTAT') diff --git a/test cases/common/83 declare dep/entity/entity.h b/test cases/common/83 declare dep/entity/entity.h new file mode 100644 index 0000000..c695b14 --- /dev/null +++ b/test cases/common/83 declare dep/entity/entity.h @@ -0,0 +1,4 @@ +#pragma once + +int entity_func1(); +int entity_func2(); diff --git a/test cases/common/83 declare dep/entity/entity1.c b/test cases/common/83 declare dep/entity/entity1.c new file mode 100644 index 0000000..204eb8b --- /dev/null +++ b/test cases/common/83 declare dep/entity/entity1.c @@ -0,0 +1,9 @@ +#include"entity.h" + +#ifdef USING_ENT +#error "Entity use flag leaked into entity compilation." +#endif + +int entity_func1() { + return 5; +} diff --git a/test cases/common/83 declare dep/entity/entity2.c b/test cases/common/83 declare dep/entity/entity2.c new file mode 100644 index 0000000..f34f546 --- /dev/null +++ b/test cases/common/83 declare dep/entity/entity2.c @@ -0,0 +1,5 @@ +#include + +int entity_func2() { + return 9; +} diff --git a/test cases/common/83 declare dep/entity/meson.build b/test cases/common/83 declare dep/entity/meson.build new file mode 100644 index 0000000..469ecd3 --- /dev/null +++ b/test cases/common/83 declare dep/entity/meson.build @@ -0,0 +1,10 @@ +entity_lib = static_library('entity', 'entity1.c') + +entity_dep = declare_dependency(link_with : [[entity_lib]], + include_directories : [['.']], + sources : 'entity2.c', + compile_args : ['-DUSING_ENT=1'], + version : '1.2.3', + link_args : []) # No simple way of testing linker flags :(. + +assert(entity_dep.version().version_compare('==1.2.3'), 'Declare_dep has incorrect version string.') diff --git a/test cases/common/83 declare dep/main.c b/test cases/common/83 declare dep/main.c new file mode 100644 index 0000000..4ad9d2a --- /dev/null +++ b/test cases/common/83 declare dep/main.c @@ -0,0 +1,18 @@ +#include +#include + +#ifndef USING_ENT +#error "Entity use flag not used for compilation." +#endif + +int main(int argc, char **argv) { + if(entity_func1() != 5) { + printf("Error in func1.\n"); + return 1; + } + if(entity_func2() != 9) { + printf("Error in func2.\n"); + return 2; + } + return 0; +} diff --git a/test cases/common/83 declare dep/meson.build b/test cases/common/83 declare dep/meson.build new file mode 100644 index 0000000..e427def --- /dev/null +++ b/test cases/common/83 declare dep/meson.build @@ -0,0 +1,24 @@ +project('declare dependency', 'c') + +subdir('entity') + +exe = executable('dep_user', 'main.c', + dependencies : entity_dep) +test('dep', exe) + +# just to make sure [] works as a no-op dep here +executable('dummy', 'main.c', + dependencies : [entity_dep, []]) + +# simple case +declare_dependency(dependencies : entity_dep) + +# nested deps should be flattened +declare_dependency(dependencies : [entity_dep]) +declare_dependency(dependencies : [[entity_dep]]) + +# check that [] properly works as a no-op dep in declare_dependency() too +declare_dependency(dependencies : []) +declare_dependency(dependencies : [[]]) +declare_dependency(dependencies : [entity_dep, []]) +declare_dependency(dependencies : [[], entity_dep]) diff --git a/test cases/common/83 same basename/exe1.c b/test cases/common/83 same basename/exe1.c deleted file mode 100644 index 175a90d..0000000 --- a/test cases/common/83 same basename/exe1.c +++ /dev/null @@ -1,5 +0,0 @@ -int func(); - -int main(int argc, char **argv) { - return func(); -} diff --git a/test cases/common/83 same basename/exe2.c b/test cases/common/83 same basename/exe2.c deleted file mode 100644 index 56b04cc..0000000 --- a/test cases/common/83 same basename/exe2.c +++ /dev/null @@ -1,5 +0,0 @@ -int func(); - -int main(int argc, char **argv) { - return func() == 1 ? 0 : 1; -} diff --git a/test cases/common/83 same basename/lib.c b/test cases/common/83 same basename/lib.c deleted file mode 100644 index 6fd432e..0000000 --- a/test cases/common/83 same basename/lib.c +++ /dev/null @@ -1,23 +0,0 @@ -#if defined _WIN32 || defined __CYGWIN__ -#define DLL_PUBLIC __declspec(dllexport) -#else - #if defined __GNUC__ - #define DLL_PUBLIC __attribute__ ((visibility("default"))) - #else - #pragma message ("Compiler does not support symbol visibility.") - #define DLL_PUBLIC - #endif -#endif - -#if defined SHAR -int DLL_PUBLIC func() { - return 1; -} -#elif defined STAT -int func() { - return 0; -} -#else -#error "Missing type definition." -#endif - diff --git a/test cases/common/83 same basename/meson.build b/test cases/common/83 same basename/meson.build deleted file mode 100644 index 856c536..0000000 --- a/test cases/common/83 same basename/meson.build +++ /dev/null @@ -1,14 +0,0 @@ -project('same basename', 'c') - -subdir('sharedsub') -subdir('staticsub') - -# Use the same source file to check that each top level target -# has its own unique working directory. If they don't -# then the .o files will clobber each other. - -exe1 = executable('name', 'exe1.c', link_with : stlib) -exe2 = executable('name2', 'exe2.c', link_with : shlib) - -test('static', exe1) -test('shared', exe2) diff --git a/test cases/common/83 same basename/sharedsub/meson.build b/test cases/common/83 same basename/sharedsub/meson.build deleted file mode 100644 index 29654a9..0000000 --- a/test cases/common/83 same basename/sharedsub/meson.build +++ /dev/null @@ -1 +0,0 @@ -shlib = shared_library('name', '../lib.c', c_args : '-DSHAR') diff --git a/test cases/common/83 same basename/staticsub/meson.build b/test cases/common/83 same basename/staticsub/meson.build deleted file mode 100644 index 5e5242e..0000000 --- a/test cases/common/83 same basename/staticsub/meson.build +++ /dev/null @@ -1,3 +0,0 @@ -# On Windows a static lib is now libfoo.a, so it does not conflict with foo.lib -# from the shared library above -stlib = static_library('name', '../lib.c', c_args : '-DSTAT') diff --git a/test cases/common/84 declare dep/entity/entity.h b/test cases/common/84 declare dep/entity/entity.h deleted file mode 100644 index c695b14..0000000 --- a/test cases/common/84 declare dep/entity/entity.h +++ /dev/null @@ -1,4 +0,0 @@ -#pragma once - -int entity_func1(); -int entity_func2(); diff --git a/test cases/common/84 declare dep/entity/entity1.c b/test cases/common/84 declare dep/entity/entity1.c deleted file mode 100644 index 204eb8b..0000000 --- a/test cases/common/84 declare dep/entity/entity1.c +++ /dev/null @@ -1,9 +0,0 @@ -#include"entity.h" - -#ifdef USING_ENT -#error "Entity use flag leaked into entity compilation." -#endif - -int entity_func1() { - return 5; -} diff --git a/test cases/common/84 declare dep/entity/entity2.c b/test cases/common/84 declare dep/entity/entity2.c deleted file mode 100644 index f34f546..0000000 --- a/test cases/common/84 declare dep/entity/entity2.c +++ /dev/null @@ -1,5 +0,0 @@ -#include - -int entity_func2() { - return 9; -} diff --git a/test cases/common/84 declare dep/entity/meson.build b/test cases/common/84 declare dep/entity/meson.build deleted file mode 100644 index 469ecd3..0000000 --- a/test cases/common/84 declare dep/entity/meson.build +++ /dev/null @@ -1,10 +0,0 @@ -entity_lib = static_library('entity', 'entity1.c') - -entity_dep = declare_dependency(link_with : [[entity_lib]], - include_directories : [['.']], - sources : 'entity2.c', - compile_args : ['-DUSING_ENT=1'], - version : '1.2.3', - link_args : []) # No simple way of testing linker flags :(. - -assert(entity_dep.version().version_compare('==1.2.3'), 'Declare_dep has incorrect version string.') diff --git a/test cases/common/84 declare dep/main.c b/test cases/common/84 declare dep/main.c deleted file mode 100644 index 4ad9d2a..0000000 --- a/test cases/common/84 declare dep/main.c +++ /dev/null @@ -1,18 +0,0 @@ -#include -#include - -#ifndef USING_ENT -#error "Entity use flag not used for compilation." -#endif - -int main(int argc, char **argv) { - if(entity_func1() != 5) { - printf("Error in func1.\n"); - return 1; - } - if(entity_func2() != 9) { - printf("Error in func2.\n"); - return 2; - } - return 0; -} diff --git a/test cases/common/84 declare dep/meson.build b/test cases/common/84 declare dep/meson.build deleted file mode 100644 index e427def..0000000 --- a/test cases/common/84 declare dep/meson.build +++ /dev/null @@ -1,24 +0,0 @@ -project('declare dependency', 'c') - -subdir('entity') - -exe = executable('dep_user', 'main.c', - dependencies : entity_dep) -test('dep', exe) - -# just to make sure [] works as a no-op dep here -executable('dummy', 'main.c', - dependencies : [entity_dep, []]) - -# simple case -declare_dependency(dependencies : entity_dep) - -# nested deps should be flattened -declare_dependency(dependencies : [entity_dep]) -declare_dependency(dependencies : [[entity_dep]]) - -# check that [] properly works as a no-op dep in declare_dependency() too -declare_dependency(dependencies : []) -declare_dependency(dependencies : [[]]) -declare_dependency(dependencies : [entity_dep, []]) -declare_dependency(dependencies : [[], entity_dep]) diff --git a/test cases/common/84 extract all/extractor.h b/test cases/common/84 extract all/extractor.h new file mode 100644 index 0000000..d0917a1 --- /dev/null +++ b/test cases/common/84 extract all/extractor.h @@ -0,0 +1,6 @@ +#pragma once + +int func1(); +int func2(); +int func3(); +int func4(); diff --git a/test cases/common/84 extract all/four.c b/test cases/common/84 extract all/four.c new file mode 100644 index 0000000..5ca6696 --- /dev/null +++ b/test cases/common/84 extract all/four.c @@ -0,0 +1,5 @@ +#include"extractor.h" + +int func4() { + return 4; +} diff --git a/test cases/common/84 extract all/meson.build b/test cases/common/84 extract all/meson.build new file mode 100644 index 0000000..4f08a4f --- /dev/null +++ b/test cases/common/84 extract all/meson.build @@ -0,0 +1,13 @@ +project('extract all', 'c') + +a = static_library('a', 'one.c', 'two.c') +b = static_library('b', 'three.c', 'four.c') +c = static_library('c', objects : [a.extract_all_objects(), b.extract_all_objects()]) +d = static_library('d', objects : [a.extract_all_objects(), b.extract_all_objects(), c.extract_all_objects()]) +d_recursive = static_library('d_recursive', objects : [c.extract_all_objects(recursive : true)]) + +e = executable('proggie', 'prog.c', link_with : d) +test('extall', e) + +e = executable('proggie_recursive', 'prog.c', link_with : d_recursive) +test('extall_recursive', e) diff --git a/test cases/common/84 extract all/one.c b/test cases/common/84 extract all/one.c new file mode 100644 index 0000000..cfb0157 --- /dev/null +++ b/test cases/common/84 extract all/one.c @@ -0,0 +1,5 @@ +#include"extractor.h" + +int func1() { + return 1; +} diff --git a/test cases/common/84 extract all/prog.c b/test cases/common/84 extract all/prog.c new file mode 100644 index 0000000..57a4c64 --- /dev/null +++ b/test cases/common/84 extract all/prog.c @@ -0,0 +1,10 @@ +#include"extractor.h" +#include + +int main(int argc, char **argv) { + if((1+2+3+4) != (func1() + func2() + func3() + func4())) { + printf("Arithmetic is fail.\n"); + return 1; + } + return 0; +} diff --git a/test cases/common/84 extract all/three.c b/test cases/common/84 extract all/three.c new file mode 100644 index 0000000..c410046 --- /dev/null +++ b/test cases/common/84 extract all/three.c @@ -0,0 +1,5 @@ +#include"extractor.h" + +int func3() { + return 3; +} diff --git a/test cases/common/84 extract all/two.c b/test cases/common/84 extract all/two.c new file mode 100644 index 0000000..3ece512 --- /dev/null +++ b/test cases/common/84 extract all/two.c @@ -0,0 +1,5 @@ +#include"extractor.h" + +int func2() { + return 2; +} diff --git a/test cases/common/85 add language/meson.build b/test cases/common/85 add language/meson.build new file mode 100644 index 0000000..d9bc0fa --- /dev/null +++ b/test cases/common/85 add language/meson.build @@ -0,0 +1,8 @@ +project('add language', 'c') + +test('C', executable('cprog', 'prog.c')) + +assert(add_languages('cpp'), 'Add_languages returned false on success') +assert(not add_languages('klingon', required : false), 'Add_languages returned true on failure.') + +test('C++', executable('cppprog', 'prog.cc')) diff --git a/test cases/common/85 add language/prog.c b/test cases/common/85 add language/prog.c new file mode 100644 index 0000000..9b5685f --- /dev/null +++ b/test cases/common/85 add language/prog.c @@ -0,0 +1,6 @@ +#include + +int main(int argc, char **argv) { + printf("I am plain C.\n"); + return 0; +} diff --git a/test cases/common/85 add language/prog.cc b/test cases/common/85 add language/prog.cc new file mode 100644 index 0000000..03647dd --- /dev/null +++ b/test cases/common/85 add language/prog.cc @@ -0,0 +1,6 @@ +#include + +int main(int, char**) { + std::cout << "I am C++.\n"; + return 0; +} diff --git a/test cases/common/85 extract all/extractor.h b/test cases/common/85 extract all/extractor.h deleted file mode 100644 index d0917a1..0000000 --- a/test cases/common/85 extract all/extractor.h +++ /dev/null @@ -1,6 +0,0 @@ -#pragma once - -int func1(); -int func2(); -int func3(); -int func4(); diff --git a/test cases/common/85 extract all/four.c b/test cases/common/85 extract all/four.c deleted file mode 100644 index 5ca6696..0000000 --- a/test cases/common/85 extract all/four.c +++ /dev/null @@ -1,5 +0,0 @@ -#include"extractor.h" - -int func4() { - return 4; -} diff --git a/test cases/common/85 extract all/meson.build b/test cases/common/85 extract all/meson.build deleted file mode 100644 index 4f08a4f..0000000 --- a/test cases/common/85 extract all/meson.build +++ /dev/null @@ -1,13 +0,0 @@ -project('extract all', 'c') - -a = static_library('a', 'one.c', 'two.c') -b = static_library('b', 'three.c', 'four.c') -c = static_library('c', objects : [a.extract_all_objects(), b.extract_all_objects()]) -d = static_library('d', objects : [a.extract_all_objects(), b.extract_all_objects(), c.extract_all_objects()]) -d_recursive = static_library('d_recursive', objects : [c.extract_all_objects(recursive : true)]) - -e = executable('proggie', 'prog.c', link_with : d) -test('extall', e) - -e = executable('proggie_recursive', 'prog.c', link_with : d_recursive) -test('extall_recursive', e) diff --git a/test cases/common/85 extract all/one.c b/test cases/common/85 extract all/one.c deleted file mode 100644 index cfb0157..0000000 --- a/test cases/common/85 extract all/one.c +++ /dev/null @@ -1,5 +0,0 @@ -#include"extractor.h" - -int func1() { - return 1; -} diff --git a/test cases/common/85 extract all/prog.c b/test cases/common/85 extract all/prog.c deleted file mode 100644 index 57a4c64..0000000 --- a/test cases/common/85 extract all/prog.c +++ /dev/null @@ -1,10 +0,0 @@ -#include"extractor.h" -#include - -int main(int argc, char **argv) { - if((1+2+3+4) != (func1() + func2() + func3() + func4())) { - printf("Arithmetic is fail.\n"); - return 1; - } - return 0; -} diff --git a/test cases/common/85 extract all/three.c b/test cases/common/85 extract all/three.c deleted file mode 100644 index c410046..0000000 --- a/test cases/common/85 extract all/three.c +++ /dev/null @@ -1,5 +0,0 @@ -#include"extractor.h" - -int func3() { - return 3; -} diff --git a/test cases/common/85 extract all/two.c b/test cases/common/85 extract all/two.c deleted file mode 100644 index 3ece512..0000000 --- a/test cases/common/85 extract all/two.c +++ /dev/null @@ -1,5 +0,0 @@ -#include"extractor.h" - -int func2() { - return 2; -} diff --git a/test cases/common/86 add language/meson.build b/test cases/common/86 add language/meson.build deleted file mode 100644 index d9bc0fa..0000000 --- a/test cases/common/86 add language/meson.build +++ /dev/null @@ -1,8 +0,0 @@ -project('add language', 'c') - -test('C', executable('cprog', 'prog.c')) - -assert(add_languages('cpp'), 'Add_languages returned false on success') -assert(not add_languages('klingon', required : false), 'Add_languages returned true on failure.') - -test('C++', executable('cppprog', 'prog.cc')) diff --git a/test cases/common/86 add language/prog.c b/test cases/common/86 add language/prog.c deleted file mode 100644 index 9b5685f..0000000 --- a/test cases/common/86 add language/prog.c +++ /dev/null @@ -1,6 +0,0 @@ -#include - -int main(int argc, char **argv) { - printf("I am plain C.\n"); - return 0; -} diff --git a/test cases/common/86 add language/prog.cc b/test cases/common/86 add language/prog.cc deleted file mode 100644 index 03647dd..0000000 --- a/test cases/common/86 add language/prog.cc +++ /dev/null @@ -1,6 +0,0 @@ -#include - -int main(int, char**) { - std::cout << "I am C++.\n"; - return 0; -} diff --git a/test cases/common/86 identical target name in subproject/bar.c b/test cases/common/86 identical target name in subproject/bar.c new file mode 100644 index 0000000..864869b --- /dev/null +++ b/test cases/common/86 identical target name in subproject/bar.c @@ -0,0 +1,6 @@ +#include + +int main(int argc, char **argv) { + printf("I'm a main project bar.\n"); + return 0; +} diff --git a/test cases/common/86 identical target name in subproject/meson.build b/test cases/common/86 identical target name in subproject/meson.build new file mode 100644 index 0000000..c5be5b7 --- /dev/null +++ b/test cases/common/86 identical target name in subproject/meson.build @@ -0,0 +1,7 @@ +project('toplevel bar', 'c') + +subproject('foo') + +executable('bar', 'bar.c') +run_target('nop', command : ['true']) +custom_target('cus', output: ['cus.c'], command : ['true']) diff --git a/test cases/common/86 identical target name in subproject/subprojects/foo/bar.c b/test cases/common/86 identical target name in subproject/subprojects/foo/bar.c new file mode 100644 index 0000000..106005e --- /dev/null +++ b/test cases/common/86 identical target name in subproject/subprojects/foo/bar.c @@ -0,0 +1,6 @@ +#include + +int main(int argc, char **argv) { + printf("I'm a subproject bar.\n"); + return 0; +} diff --git a/test cases/common/86 identical target name in subproject/subprojects/foo/meson.build b/test cases/common/86 identical target name in subproject/subprojects/foo/meson.build new file mode 100644 index 0000000..06addb4 --- /dev/null +++ b/test cases/common/86 identical target name in subproject/subprojects/foo/meson.build @@ -0,0 +1,5 @@ +project('subfoo', 'c') + +executable('bar', 'bar.c') +run_target('nop', command : ['true']) +custom_target('cus', output: ['cus.c'], command : ['true']) diff --git a/test cases/common/87 identical target name in subproject/bar.c b/test cases/common/87 identical target name in subproject/bar.c deleted file mode 100644 index 864869b..0000000 --- a/test cases/common/87 identical target name in subproject/bar.c +++ /dev/null @@ -1,6 +0,0 @@ -#include - -int main(int argc, char **argv) { - printf("I'm a main project bar.\n"); - return 0; -} diff --git a/test cases/common/87 identical target name in subproject/meson.build b/test cases/common/87 identical target name in subproject/meson.build deleted file mode 100644 index c5be5b7..0000000 --- a/test cases/common/87 identical target name in subproject/meson.build +++ /dev/null @@ -1,7 +0,0 @@ -project('toplevel bar', 'c') - -subproject('foo') - -executable('bar', 'bar.c') -run_target('nop', command : ['true']) -custom_target('cus', output: ['cus.c'], command : ['true']) diff --git a/test cases/common/87 identical target name in subproject/subprojects/foo/bar.c b/test cases/common/87 identical target name in subproject/subprojects/foo/bar.c deleted file mode 100644 index 106005e..0000000 --- a/test cases/common/87 identical target name in subproject/subprojects/foo/bar.c +++ /dev/null @@ -1,6 +0,0 @@ -#include - -int main(int argc, char **argv) { - printf("I'm a subproject bar.\n"); - return 0; -} diff --git a/test cases/common/87 identical target name in subproject/subprojects/foo/meson.build b/test cases/common/87 identical target name in subproject/subprojects/foo/meson.build deleted file mode 100644 index 06addb4..0000000 --- a/test cases/common/87 identical target name in subproject/subprojects/foo/meson.build +++ /dev/null @@ -1,5 +0,0 @@ -project('subfoo', 'c') - -executable('bar', 'bar.c') -run_target('nop', command : ['true']) -custom_target('cus', output: ['cus.c'], command : ['true']) diff --git a/test cases/common/87 plusassign/meson.build b/test cases/common/87 plusassign/meson.build new file mode 100644 index 0000000..ac477e7 --- /dev/null +++ b/test cases/common/87 plusassign/meson.build @@ -0,0 +1,70 @@ +project('plusassign', 'c') + +x = [] + +x += 'a' + +if x.length() != 1 + error('Incorrect append') +endif + +if x[0] != 'a' + error('Incorrect append 2.') +endif + +y = x + +x += 'b' + +if y.length() != 1 + error('Immutability broken.') +endif + +if y[0] != 'a' + error('Immutability broken 2.') +endif + +if x.length() != 2 + error('Incorrect append 3') +endif + +if x[0] != 'a' + error('Incorrect append 4.') +endif + +if x[1] != 'b' + error('Incorrect append 5.') +endif + +# Now with evil added: append yourself. + +x += x + +if x.length() != 4 + error('Incorrect selfappend.') +endif + +# += on strings + +bra = 'bra' +foo = 'A' +foo += bra +foo += 'cada' +foo += bra +assert (foo == 'Abracadabra', 'string += failure [@0@]'.format(foo)) +assert (bra == 'bra', 'string += modified right argument!') +foo += ' ' + foo +assert (foo == 'Abracadabra Abracadabra', 'string += failure [@0@]'.format(foo)) + +# += on ints + +foo = 5 +foo += 6 +assert (foo == 11, 'int += failure [@0@]'.format(foo)) +bar = 99 +foo += bar +assert (foo == 110, 'int += failure [@0@]'.format(foo)) +assert (bar == 99, 'int += modified right argument"') +bar += foo + 1 +assert (bar == 210, 'int += failure [@0@]'.format(bar)) +assert (foo == 110, 'int += modified right argument"') diff --git a/test cases/common/88 plusassign/meson.build b/test cases/common/88 plusassign/meson.build deleted file mode 100644 index ac477e7..0000000 --- a/test cases/common/88 plusassign/meson.build +++ /dev/null @@ -1,70 +0,0 @@ -project('plusassign', 'c') - -x = [] - -x += 'a' - -if x.length() != 1 - error('Incorrect append') -endif - -if x[0] != 'a' - error('Incorrect append 2.') -endif - -y = x - -x += 'b' - -if y.length() != 1 - error('Immutability broken.') -endif - -if y[0] != 'a' - error('Immutability broken 2.') -endif - -if x.length() != 2 - error('Incorrect append 3') -endif - -if x[0] != 'a' - error('Incorrect append 4.') -endif - -if x[1] != 'b' - error('Incorrect append 5.') -endif - -# Now with evil added: append yourself. - -x += x - -if x.length() != 4 - error('Incorrect selfappend.') -endif - -# += on strings - -bra = 'bra' -foo = 'A' -foo += bra -foo += 'cada' -foo += bra -assert (foo == 'Abracadabra', 'string += failure [@0@]'.format(foo)) -assert (bra == 'bra', 'string += modified right argument!') -foo += ' ' + foo -assert (foo == 'Abracadabra Abracadabra', 'string += failure [@0@]'.format(foo)) - -# += on ints - -foo = 5 -foo += 6 -assert (foo == 11, 'int += failure [@0@]'.format(foo)) -bar = 99 -foo += bar -assert (foo == 110, 'int += failure [@0@]'.format(foo)) -assert (bar == 99, 'int += modified right argument"') -bar += foo + 1 -assert (bar == 210, 'int += failure [@0@]'.format(bar)) -assert (foo == 110, 'int += modified right argument"') diff --git a/test cases/common/88 skip subdir/meson.build b/test cases/common/88 skip subdir/meson.build new file mode 100644 index 0000000..30ede0e --- /dev/null +++ b/test cases/common/88 skip subdir/meson.build @@ -0,0 +1,3 @@ +project('foo', 'c') + +subdir('subdir1/subdir2') diff --git a/test cases/common/88 skip subdir/subdir1/meson.build b/test cases/common/88 skip subdir/subdir1/meson.build new file mode 100644 index 0000000..51cb003 --- /dev/null +++ b/test cases/common/88 skip subdir/subdir1/meson.build @@ -0,0 +1 @@ +error('This should not be called.') diff --git a/test cases/common/88 skip subdir/subdir1/subdir2/meson.build b/test cases/common/88 skip subdir/subdir1/subdir2/meson.build new file mode 100644 index 0000000..e37cad6 --- /dev/null +++ b/test cases/common/88 skip subdir/subdir1/subdir2/meson.build @@ -0,0 +1 @@ +message('I\'m in subdir subdir.') diff --git a/test cases/common/89 private include/meson.build b/test cases/common/89 private include/meson.build new file mode 100644 index 0000000..2485fbf --- /dev/null +++ b/test cases/common/89 private include/meson.build @@ -0,0 +1,4 @@ +project('access private', 'c') + +subdir('stlib') +subdir('user') diff --git a/test cases/common/89 private include/stlib/compiler.py b/test cases/common/89 private include/stlib/compiler.py new file mode 100755 index 0000000..98dbe46 --- /dev/null +++ b/test cases/common/89 private include/stlib/compiler.py @@ -0,0 +1,32 @@ +#!/usr/bin/env python3 + +import sys, os + +assert(len(sys.argv) == 3) + +h_templ = '''#pragma once +unsigned int %s(); +''' + +c_templ = '''#include"%s.h" + +unsigned int %s() { + return 0; +} +''' + +ifile = sys.argv[1] +outdir = sys.argv[2] + +base = os.path.splitext(os.path.split(ifile)[-1])[0] + +cfile = os.path.join(outdir, base + '.c') +hfile = os.path.join(outdir, base + '.h') + +c_code = c_templ % (base, base) +h_code = h_templ % base + +with open(cfile, 'w') as f: + f.write(c_code) +with open(hfile, 'w') as f: + f.write(h_code) diff --git a/test cases/common/89 private include/stlib/foo1.def b/test cases/common/89 private include/stlib/foo1.def new file mode 100644 index 0000000..e69de29 diff --git a/test cases/common/89 private include/stlib/foo2.def b/test cases/common/89 private include/stlib/foo2.def new file mode 100644 index 0000000..e69de29 diff --git a/test cases/common/89 private include/stlib/meson.build b/test cases/common/89 private include/stlib/meson.build new file mode 100644 index 0000000..8d70650 --- /dev/null +++ b/test cases/common/89 private include/stlib/meson.build @@ -0,0 +1,12 @@ +genbin = find_program('compiler.py') + +gen = generator(genbin, + output : ['@BASENAME@.h', '@BASENAME@.c'], + arguments : ['@INPUT@', '@BUILD_DIR@'] + ) + +defs = ['foo1.def', 'foo2.def'] +generated = gen.process(defs) + +stlib = static_library('st', generated) +st_priv_inc = stlib.private_dir_include() diff --git a/test cases/common/89 private include/user/libuser.c b/test cases/common/89 private include/user/libuser.c new file mode 100644 index 0000000..a74a973 --- /dev/null +++ b/test cases/common/89 private include/user/libuser.c @@ -0,0 +1,6 @@ +#include"foo1.h" +#include"foo2.h" + +int main(int argc, char **argv) { + return foo1() + foo2(); +} diff --git a/test cases/common/89 private include/user/meson.build b/test cases/common/89 private include/user/meson.build new file mode 100644 index 0000000..ab88b1d --- /dev/null +++ b/test cases/common/89 private include/user/meson.build @@ -0,0 +1,5 @@ +exe = executable('libuser', 'libuser.c', + link_with : stlib, + include_directories : st_priv_inc) + +test('libuser', exe) diff --git a/test cases/common/89 skip subdir/meson.build b/test cases/common/89 skip subdir/meson.build deleted file mode 100644 index 30ede0e..0000000 --- a/test cases/common/89 skip subdir/meson.build +++ /dev/null @@ -1,3 +0,0 @@ -project('foo', 'c') - -subdir('subdir1/subdir2') diff --git a/test cases/common/89 skip subdir/subdir1/meson.build b/test cases/common/89 skip subdir/subdir1/meson.build deleted file mode 100644 index 51cb003..0000000 --- a/test cases/common/89 skip subdir/subdir1/meson.build +++ /dev/null @@ -1 +0,0 @@ -error('This should not be called.') diff --git a/test cases/common/89 skip subdir/subdir1/subdir2/meson.build b/test cases/common/89 skip subdir/subdir1/subdir2/meson.build deleted file mode 100644 index e37cad6..0000000 --- a/test cases/common/89 skip subdir/subdir1/subdir2/meson.build +++ /dev/null @@ -1 +0,0 @@ -message('I\'m in subdir subdir.') diff --git a/test cases/common/90 default options/meson.build b/test cases/common/90 default options/meson.build new file mode 100644 index 0000000..4a9fc2f --- /dev/null +++ b/test cases/common/90 default options/meson.build @@ -0,0 +1,30 @@ +project('default options', 'cpp', 'c', default_options : [ + 'prefix=/absoluteprefix', + 'buildtype=debugoptimized', + 'cpp_std=c++11', + 'cpp_eh=none', + 'warning_level=3', + ]) + +assert(get_option('buildtype') == 'debugoptimized', 'Build type default value wrong.') + +cpp_eh = get_option('cpp_eh') +assert(cpp_eh == 'none', 'EH value is "' + cpp_eh + '" instead of "none"') +cpp_std = get_option('cpp_std') +assert(cpp_std == 'c++11', 'C++ std value is "' + cpp_std + '" instead of c++11.') + +w_level = get_option('warning_level') +assert(w_level == '3', 'warning level "' + w_level + '" instead of "3"') + +# FIXME. Since we no longer accept invalid options to c_std etc, +# there is no simple way to test this. Gcc does not seem to expose +# the C std used in a preprocessor token so we can't check for it. +# Think of a way to fix this. +# +# # Verify that project args are not used when told not to. +# # MSVC plain C does not have a simple arg to test so skip it. +# if cpp.get_id() != 'msvc' +# cc = meson.get_compiler('c') +# assert(not cc.compiles('int foobar;'), 'Default arg not used in test.') +# assert(cc.compiles('int foobar;', no_builtin_args : true), 'No_builtin did not disable builtins.') +# endif diff --git a/test cases/common/90 private include/meson.build b/test cases/common/90 private include/meson.build deleted file mode 100644 index 2485fbf..0000000 --- a/test cases/common/90 private include/meson.build +++ /dev/null @@ -1,4 +0,0 @@ -project('access private', 'c') - -subdir('stlib') -subdir('user') diff --git a/test cases/common/90 private include/stlib/compiler.py b/test cases/common/90 private include/stlib/compiler.py deleted file mode 100755 index 98dbe46..0000000 --- a/test cases/common/90 private include/stlib/compiler.py +++ /dev/null @@ -1,32 +0,0 @@ -#!/usr/bin/env python3 - -import sys, os - -assert(len(sys.argv) == 3) - -h_templ = '''#pragma once -unsigned int %s(); -''' - -c_templ = '''#include"%s.h" - -unsigned int %s() { - return 0; -} -''' - -ifile = sys.argv[1] -outdir = sys.argv[2] - -base = os.path.splitext(os.path.split(ifile)[-1])[0] - -cfile = os.path.join(outdir, base + '.c') -hfile = os.path.join(outdir, base + '.h') - -c_code = c_templ % (base, base) -h_code = h_templ % base - -with open(cfile, 'w') as f: - f.write(c_code) -with open(hfile, 'w') as f: - f.write(h_code) diff --git a/test cases/common/90 private include/stlib/foo1.def b/test cases/common/90 private include/stlib/foo1.def deleted file mode 100644 index e69de29..0000000 diff --git a/test cases/common/90 private include/stlib/foo2.def b/test cases/common/90 private include/stlib/foo2.def deleted file mode 100644 index e69de29..0000000 diff --git a/test cases/common/90 private include/stlib/meson.build b/test cases/common/90 private include/stlib/meson.build deleted file mode 100644 index 8d70650..0000000 --- a/test cases/common/90 private include/stlib/meson.build +++ /dev/null @@ -1,12 +0,0 @@ -genbin = find_program('compiler.py') - -gen = generator(genbin, - output : ['@BASENAME@.h', '@BASENAME@.c'], - arguments : ['@INPUT@', '@BUILD_DIR@'] - ) - -defs = ['foo1.def', 'foo2.def'] -generated = gen.process(defs) - -stlib = static_library('st', generated) -st_priv_inc = stlib.private_dir_include() diff --git a/test cases/common/90 private include/user/libuser.c b/test cases/common/90 private include/user/libuser.c deleted file mode 100644 index a74a973..0000000 --- a/test cases/common/90 private include/user/libuser.c +++ /dev/null @@ -1,6 +0,0 @@ -#include"foo1.h" -#include"foo2.h" - -int main(int argc, char **argv) { - return foo1() + foo2(); -} diff --git a/test cases/common/90 private include/user/meson.build b/test cases/common/90 private include/user/meson.build deleted file mode 100644 index ab88b1d..0000000 --- a/test cases/common/90 private include/user/meson.build +++ /dev/null @@ -1,5 +0,0 @@ -exe = executable('libuser', 'libuser.c', - link_with : stlib, - include_directories : st_priv_inc) - -test('libuser', exe) diff --git a/test cases/common/91 default options/meson.build b/test cases/common/91 default options/meson.build deleted file mode 100644 index 4a9fc2f..0000000 --- a/test cases/common/91 default options/meson.build +++ /dev/null @@ -1,30 +0,0 @@ -project('default options', 'cpp', 'c', default_options : [ - 'prefix=/absoluteprefix', - 'buildtype=debugoptimized', - 'cpp_std=c++11', - 'cpp_eh=none', - 'warning_level=3', - ]) - -assert(get_option('buildtype') == 'debugoptimized', 'Build type default value wrong.') - -cpp_eh = get_option('cpp_eh') -assert(cpp_eh == 'none', 'EH value is "' + cpp_eh + '" instead of "none"') -cpp_std = get_option('cpp_std') -assert(cpp_std == 'c++11', 'C++ std value is "' + cpp_std + '" instead of c++11.') - -w_level = get_option('warning_level') -assert(w_level == '3', 'warning level "' + w_level + '" instead of "3"') - -# FIXME. Since we no longer accept invalid options to c_std etc, -# there is no simple way to test this. Gcc does not seem to expose -# the C std used in a preprocessor token so we can't check for it. -# Think of a way to fix this. -# -# # Verify that project args are not used when told not to. -# # MSVC plain C does not have a simple arg to test so skip it. -# if cpp.get_id() != 'msvc' -# cc = meson.get_compiler('c') -# assert(not cc.compiles('int foobar;'), 'Default arg not used in test.') -# assert(cc.compiles('int foobar;', no_builtin_args : true), 'No_builtin did not disable builtins.') -# endif diff --git a/test cases/common/91 dep fallback/gensrc.py b/test cases/common/91 dep fallback/gensrc.py new file mode 100644 index 0000000..ff42ac3 --- /dev/null +++ b/test cases/common/91 dep fallback/gensrc.py @@ -0,0 +1,6 @@ +#!/usr/bin/env python3 + +import sys +import shutil + +shutil.copyfile(sys.argv[1], sys.argv[2]) diff --git a/test cases/common/91 dep fallback/meson.build b/test cases/common/91 dep fallback/meson.build new file mode 100644 index 0000000..a96520e --- /dev/null +++ b/test cases/common/91 dep fallback/meson.build @@ -0,0 +1,25 @@ +project('dep fallback', 'c') + +bob = dependency('boblib', fallback : ['boblib', 'bob_dep'], required: false, + default_options : 'warning_level=1') +if not bob.found() + error('Bob is actually needed') +endif +# boblib subproject exists, but sita_dep doesn't exist +sita = dependency('sitalib', fallback : ['boblib', 'sita_dep'], required: false) +# jimmylib subproject doesn't exist +jimmy = dependency('jimmylib', fallback : ['jimmylib', 'jimmy_dep'], required: false) +# dummylib subproject fails to configure +dummy = dependency('dummylib', fallback : ['dummylib', 'dummy_dep'], required: false) + +gensrc_py = find_program('gensrc.py') +gensrc = custom_target('gensrc.c', + input : 'tester.c', + output : 'gensrc.c', + command : [gensrc_py, '@INPUT@', '@OUTPUT@']) + +exe = executable('bobtester', + [gensrc], + dependencies : bob) + +test('bobtester', exe) diff --git a/test cases/common/91 dep fallback/subprojects/boblib/bob.c b/test cases/common/91 dep fallback/subprojects/boblib/bob.c new file mode 100644 index 0000000..ae0f394 --- /dev/null +++ b/test cases/common/91 dep fallback/subprojects/boblib/bob.c @@ -0,0 +1,8 @@ +#include"bob.h" + +#ifdef _MSC_VER +__declspec(dllexport) +#endif +const char* get_bob() { + return "bob"; +} diff --git a/test cases/common/91 dep fallback/subprojects/boblib/bob.h b/test cases/common/91 dep fallback/subprojects/boblib/bob.h new file mode 100644 index 0000000..f874ae7 --- /dev/null +++ b/test cases/common/91 dep fallback/subprojects/boblib/bob.h @@ -0,0 +1,6 @@ +#pragma once + +#ifdef _MSC_VER +__declspec(dllimport) +#endif +const char* get_bob(); diff --git a/test cases/common/91 dep fallback/subprojects/boblib/genbob.py b/test cases/common/91 dep fallback/subprojects/boblib/genbob.py new file mode 100644 index 0000000..34af779 --- /dev/null +++ b/test cases/common/91 dep fallback/subprojects/boblib/genbob.py @@ -0,0 +1,6 @@ +#!/usr/bin/env python3 + +import sys + +with open(sys.argv[1], 'w') as f: + f.write('') diff --git a/test cases/common/91 dep fallback/subprojects/boblib/meson.build b/test cases/common/91 dep fallback/subprojects/boblib/meson.build new file mode 100644 index 0000000..bb250e4 --- /dev/null +++ b/test cases/common/91 dep fallback/subprojects/boblib/meson.build @@ -0,0 +1,16 @@ +project('bob', 'c') + +gensrc_py = find_program('genbob.py') +genbob_h = custom_target('genbob.h', + output : 'genbob.h', + command : [gensrc_py, '@OUTPUT@']) +genbob_c = custom_target('genbob.c', + output : 'genbob.c', + command : [gensrc_py, '@OUTPUT@']) + +boblib = library('bob', ['bob.c', genbob_c]) +bobinc = include_directories('.') + +bob_dep = declare_dependency(link_with : boblib, + sources : [genbob_h], + include_directories : bobinc) diff --git a/test cases/common/91 dep fallback/subprojects/dummylib/meson.build b/test cases/common/91 dep fallback/subprojects/dummylib/meson.build new file mode 100644 index 0000000..3ad33e7 --- /dev/null +++ b/test cases/common/91 dep fallback/subprojects/dummylib/meson.build @@ -0,0 +1,4 @@ +project('dummylib', 'c') + +dummy_dep = declare_dependency() +error('this subproject fails to configure') diff --git a/test cases/common/91 dep fallback/tester.c b/test cases/common/91 dep fallback/tester.c new file mode 100644 index 0000000..e6651d9 --- /dev/null +++ b/test cases/common/91 dep fallback/tester.c @@ -0,0 +1,14 @@ +#include"bob.h" +#include"genbob.h" +#include +#include + +int main(int argc, char **argv) { + if(strcmp("bob", get_bob()) == 0) { + printf("Bob is indeed bob.\n"); + } else { + printf("ERROR: bob is not bob.\n"); + return 1; + } + return 0; +} diff --git a/test cases/common/92 default library/ef.cpp b/test cases/common/92 default library/ef.cpp new file mode 100644 index 0000000..34784f8 --- /dev/null +++ b/test cases/common/92 default library/ef.cpp @@ -0,0 +1,8 @@ +#include"ef.h" + +DLL_PUBLIC Ef::Ef() : x(99) { +} + +int DLL_PUBLIC Ef::get_x() const { + return x; +} diff --git a/test cases/common/92 default library/ef.h b/test cases/common/92 default library/ef.h new file mode 100644 index 0000000..21704b5 --- /dev/null +++ b/test cases/common/92 default library/ef.h @@ -0,0 +1,22 @@ +#pragma once + +#if defined _WIN32 || defined __CYGWIN__ + #define DLL_PUBLIC __declspec(dllexport) +#else + #if defined __GNUC__ + #define DLL_PUBLIC __attribute__ ((visibility("default"))) + #else + #pragma message ("Compiler does not support symbol visibility.") + #define DLL_PUBLIC + #endif +#endif + +class Ef { +private: + int x; + +public: + + DLL_PUBLIC Ef(); + int DLL_PUBLIC get_x() const; +}; diff --git a/test cases/common/92 default library/eftest.cpp b/test cases/common/92 default library/eftest.cpp new file mode 100644 index 0000000..4d4412d --- /dev/null +++ b/test cases/common/92 default library/eftest.cpp @@ -0,0 +1,14 @@ +#include"ef.h" + +#include + +int main(int, char **) { + Ef var; + if(var.get_x() == 99) { + std::cout << "All is fine.\n"; + return 0; + } else { + std::cout << "Something went wrong.\n"; + return 1; + } +} diff --git a/test cases/common/92 default library/meson.build b/test cases/common/92 default library/meson.build new file mode 100644 index 0000000..508f25f --- /dev/null +++ b/test cases/common/92 default library/meson.build @@ -0,0 +1,10 @@ +project('default library', 'cpp') + +flib = library('ef', 'ef.cpp') +exe = executable('eftest', 'eftest.cpp', link_with : flib) +test('eftest', exe) + +# Same as above, but using build_target() +flib2 = build_target('ef2', 'ef.cpp', target_type: 'library') +exe2 = executable('eftest2', 'eftest.cpp', link_with : flib2) +test('eftest2', exe2) diff --git a/test cases/common/92 dep fallback/gensrc.py b/test cases/common/92 dep fallback/gensrc.py deleted file mode 100644 index ff42ac3..0000000 --- a/test cases/common/92 dep fallback/gensrc.py +++ /dev/null @@ -1,6 +0,0 @@ -#!/usr/bin/env python3 - -import sys -import shutil - -shutil.copyfile(sys.argv[1], sys.argv[2]) diff --git a/test cases/common/92 dep fallback/meson.build b/test cases/common/92 dep fallback/meson.build deleted file mode 100644 index a96520e..0000000 --- a/test cases/common/92 dep fallback/meson.build +++ /dev/null @@ -1,25 +0,0 @@ -project('dep fallback', 'c') - -bob = dependency('boblib', fallback : ['boblib', 'bob_dep'], required: false, - default_options : 'warning_level=1') -if not bob.found() - error('Bob is actually needed') -endif -# boblib subproject exists, but sita_dep doesn't exist -sita = dependency('sitalib', fallback : ['boblib', 'sita_dep'], required: false) -# jimmylib subproject doesn't exist -jimmy = dependency('jimmylib', fallback : ['jimmylib', 'jimmy_dep'], required: false) -# dummylib subproject fails to configure -dummy = dependency('dummylib', fallback : ['dummylib', 'dummy_dep'], required: false) - -gensrc_py = find_program('gensrc.py') -gensrc = custom_target('gensrc.c', - input : 'tester.c', - output : 'gensrc.c', - command : [gensrc_py, '@INPUT@', '@OUTPUT@']) - -exe = executable('bobtester', - [gensrc], - dependencies : bob) - -test('bobtester', exe) diff --git a/test cases/common/92 dep fallback/subprojects/boblib/bob.c b/test cases/common/92 dep fallback/subprojects/boblib/bob.c deleted file mode 100644 index ae0f394..0000000 --- a/test cases/common/92 dep fallback/subprojects/boblib/bob.c +++ /dev/null @@ -1,8 +0,0 @@ -#include"bob.h" - -#ifdef _MSC_VER -__declspec(dllexport) -#endif -const char* get_bob() { - return "bob"; -} diff --git a/test cases/common/92 dep fallback/subprojects/boblib/bob.h b/test cases/common/92 dep fallback/subprojects/boblib/bob.h deleted file mode 100644 index f874ae7..0000000 --- a/test cases/common/92 dep fallback/subprojects/boblib/bob.h +++ /dev/null @@ -1,6 +0,0 @@ -#pragma once - -#ifdef _MSC_VER -__declspec(dllimport) -#endif -const char* get_bob(); diff --git a/test cases/common/92 dep fallback/subprojects/boblib/genbob.py b/test cases/common/92 dep fallback/subprojects/boblib/genbob.py deleted file mode 100644 index 34af779..0000000 --- a/test cases/common/92 dep fallback/subprojects/boblib/genbob.py +++ /dev/null @@ -1,6 +0,0 @@ -#!/usr/bin/env python3 - -import sys - -with open(sys.argv[1], 'w') as f: - f.write('') diff --git a/test cases/common/92 dep fallback/subprojects/boblib/meson.build b/test cases/common/92 dep fallback/subprojects/boblib/meson.build deleted file mode 100644 index bb250e4..0000000 --- a/test cases/common/92 dep fallback/subprojects/boblib/meson.build +++ /dev/null @@ -1,16 +0,0 @@ -project('bob', 'c') - -gensrc_py = find_program('genbob.py') -genbob_h = custom_target('genbob.h', - output : 'genbob.h', - command : [gensrc_py, '@OUTPUT@']) -genbob_c = custom_target('genbob.c', - output : 'genbob.c', - command : [gensrc_py, '@OUTPUT@']) - -boblib = library('bob', ['bob.c', genbob_c]) -bobinc = include_directories('.') - -bob_dep = declare_dependency(link_with : boblib, - sources : [genbob_h], - include_directories : bobinc) diff --git a/test cases/common/92 dep fallback/subprojects/dummylib/meson.build b/test cases/common/92 dep fallback/subprojects/dummylib/meson.build deleted file mode 100644 index 3ad33e7..0000000 --- a/test cases/common/92 dep fallback/subprojects/dummylib/meson.build +++ /dev/null @@ -1,4 +0,0 @@ -project('dummylib', 'c') - -dummy_dep = declare_dependency() -error('this subproject fails to configure') diff --git a/test cases/common/92 dep fallback/tester.c b/test cases/common/92 dep fallback/tester.c deleted file mode 100644 index e6651d9..0000000 --- a/test cases/common/92 dep fallback/tester.c +++ /dev/null @@ -1,14 +0,0 @@ -#include"bob.h" -#include"genbob.h" -#include -#include - -int main(int argc, char **argv) { - if(strcmp("bob", get_bob()) == 0) { - printf("Bob is indeed bob.\n"); - } else { - printf("ERROR: bob is not bob.\n"); - return 1; - } - return 0; -} diff --git a/test cases/common/93 default library/ef.cpp b/test cases/common/93 default library/ef.cpp deleted file mode 100644 index 34784f8..0000000 --- a/test cases/common/93 default library/ef.cpp +++ /dev/null @@ -1,8 +0,0 @@ -#include"ef.h" - -DLL_PUBLIC Ef::Ef() : x(99) { -} - -int DLL_PUBLIC Ef::get_x() const { - return x; -} diff --git a/test cases/common/93 default library/ef.h b/test cases/common/93 default library/ef.h deleted file mode 100644 index 21704b5..0000000 --- a/test cases/common/93 default library/ef.h +++ /dev/null @@ -1,22 +0,0 @@ -#pragma once - -#if defined _WIN32 || defined __CYGWIN__ - #define DLL_PUBLIC __declspec(dllexport) -#else - #if defined __GNUC__ - #define DLL_PUBLIC __attribute__ ((visibility("default"))) - #else - #pragma message ("Compiler does not support symbol visibility.") - #define DLL_PUBLIC - #endif -#endif - -class Ef { -private: - int x; - -public: - - DLL_PUBLIC Ef(); - int DLL_PUBLIC get_x() const; -}; diff --git a/test cases/common/93 default library/eftest.cpp b/test cases/common/93 default library/eftest.cpp deleted file mode 100644 index 4d4412d..0000000 --- a/test cases/common/93 default library/eftest.cpp +++ /dev/null @@ -1,14 +0,0 @@ -#include"ef.h" - -#include - -int main(int, char **) { - Ef var; - if(var.get_x() == 99) { - std::cout << "All is fine.\n"; - return 0; - } else { - std::cout << "Something went wrong.\n"; - return 1; - } -} diff --git a/test cases/common/93 default library/meson.build b/test cases/common/93 default library/meson.build deleted file mode 100644 index 508f25f..0000000 --- a/test cases/common/93 default library/meson.build +++ /dev/null @@ -1,10 +0,0 @@ -project('default library', 'cpp') - -flib = library('ef', 'ef.cpp') -exe = executable('eftest', 'eftest.cpp', link_with : flib) -test('eftest', exe) - -# Same as above, but using build_target() -flib2 = build_target('ef2', 'ef.cpp', target_type: 'library') -exe2 = executable('eftest2', 'eftest.cpp', link_with : flib2) -test('eftest2', exe2) diff --git a/test cases/common/93 selfbuilt custom/data.dat b/test cases/common/93 selfbuilt custom/data.dat new file mode 100644 index 0000000..83fd1d9 --- /dev/null +++ b/test cases/common/93 selfbuilt custom/data.dat @@ -0,0 +1 @@ +generated_function diff --git a/test cases/common/93 selfbuilt custom/mainprog.cpp b/test cases/common/93 selfbuilt custom/mainprog.cpp new file mode 100644 index 0000000..dcf9d20 --- /dev/null +++ b/test cases/common/93 selfbuilt custom/mainprog.cpp @@ -0,0 +1,5 @@ +#include"data.h" + +int main(int, char **) { + return generated_function() != 52; +} diff --git a/test cases/common/93 selfbuilt custom/meson.build b/test cases/common/93 selfbuilt custom/meson.build new file mode 100644 index 0000000..e5da27e --- /dev/null +++ b/test cases/common/93 selfbuilt custom/meson.build @@ -0,0 +1,16 @@ +project('selfbuilt custom', 'cpp') + +# Build an exe and use it in a custom target +# whose output is used to build a different exe. + +tool = executable('tool', 'tool.cpp', native : true) + +hfile = custom_target('datah', + output : 'data.h', + input : 'data.dat', + command : [tool, '@INPUT@', '@OUTPUT@'], +) + +main = executable('mainprog', 'mainprog.cpp', hfile) + +test('maintest', main) diff --git a/test cases/common/93 selfbuilt custom/tool.cpp b/test cases/common/93 selfbuilt custom/tool.cpp new file mode 100644 index 0000000..6a28dd8 --- /dev/null +++ b/test cases/common/93 selfbuilt custom/tool.cpp @@ -0,0 +1,34 @@ +#include +#include +#include + +using namespace std; + +const char prefix[] = "int "; +const char suffix[] = " () {\n return 52;}\n"; + +int main(int argc, char **argv) { + if(argc != 3) { + cout << "You is fail.\n"; + return 1; + } + ifstream is(argv[1], ifstream::binary); + if(!is) { + cout << "Opening input file failed.\n"; + return 1; + } + string funcname; + is >> funcname; + ofstream os(argv[2], ofstream::binary); + if(!os) { + cout << "Opening output file failed.\n"; + return 1; + } + os << prefix << funcname << suffix; + os.close(); + if(!os.good()) { + cout << "Writing data out failed.\n"; + return 1; + } + return 0; +} diff --git a/test cases/common/94 gen extra/meson.build b/test cases/common/94 gen extra/meson.build new file mode 100644 index 0000000..cbbdceb --- /dev/null +++ b/test cases/common/94 gen extra/meson.build @@ -0,0 +1,40 @@ +project('extra args in gen', 'c') + +prog = find_program('srcgen.py') + +gen = generator(prog, + output : '@BASENAME@.c', + arguments : ['--input=@INPUT@', '--output=@OUTPUT@', '@EXTRA_ARGS@']) + +g1 = gen.process('name.dat') +g2 = gen.process('name.dat', extra_args: '--upper') + +test('basic', executable('basic', 'plain.c', g1)) +test('upper', executable('upper', 'upper.c', g2)) + +prog2 = find_program('srcgen2.py') +basename_gen = generator(prog2, + output : ['@BASENAME@.tab.c', '@BASENAME@.tab.h'], + arguments : ['@BUILD_DIR@', '@BASENAME@', '@INPUT@']) + +basename_src = basename_gen.process('name.l') + +test('basename', executable('basename', basename_src)) + +plainname_gen = generator(prog2, + output : ['@PLAINNAME@.tab.c', '@PLAINNAME@.tab.h'], + arguments : ['@BUILD_DIR@', '@PLAINNAME@', '@INPUT@']) + +plainname_src = plainname_gen.process('name.l') + +test('plainname', executable('plainname', plainname_src)) + +prog3 = find_program('srcgen3.py') +capture_gen = generator(prog3, + output : ['@BASENAME@.yy.c'], + arguments : ['@INPUT@'], + capture : true) + +capture_src = capture_gen.process('name.l') + +test('capture', executable('capture', capture_src)) diff --git a/test cases/common/94 gen extra/name.dat b/test cases/common/94 gen extra/name.dat new file mode 100644 index 0000000..caf5b1c --- /dev/null +++ b/test cases/common/94 gen extra/name.dat @@ -0,0 +1 @@ +bob_mcbob diff --git a/test cases/common/94 gen extra/name.l b/test cases/common/94 gen extra/name.l new file mode 100644 index 0000000..3adda4f --- /dev/null +++ b/test cases/common/94 gen extra/name.l @@ -0,0 +1,3 @@ +int main() { +return 0; +} diff --git a/test cases/common/94 gen extra/plain.c b/test cases/common/94 gen extra/plain.c new file mode 100644 index 0000000..3845aee --- /dev/null +++ b/test cases/common/94 gen extra/plain.c @@ -0,0 +1,5 @@ +int bob_mcbob(); + +int main(int argc, char **argv) { + return bob_mcbob(); +} diff --git a/test cases/common/94 gen extra/srcgen.py b/test cases/common/94 gen extra/srcgen.py new file mode 100755 index 0000000..8988cd9 --- /dev/null +++ b/test cases/common/94 gen extra/srcgen.py @@ -0,0 +1,27 @@ +#!/usr/bin/env python3 + +import sys +import argparse + +parser = argparse.ArgumentParser() +parser.add_argument('--input', dest='input', + help='the input file') +parser.add_argument('--output', dest='output', + help='the output file') +parser.add_argument('--upper', dest='upper', action='store_true', default=False, + help='Convert to upper case.') + +c_templ = '''int %s() { + return 0; +} +''' + +options = parser.parse_args(sys.argv[1:]) + +with open(options.input) as f: + funcname = f.readline().strip() +if options.upper: + funcname = funcname.upper() + +with open(options.output, 'w') as f: + f.write(c_templ % funcname) diff --git a/test cases/common/94 gen extra/srcgen2.py b/test cases/common/94 gen extra/srcgen2.py new file mode 100644 index 0000000..9cdf12d --- /dev/null +++ b/test cases/common/94 gen extra/srcgen2.py @@ -0,0 +1,32 @@ +#!/usr/bin/env python3 + +import os +import sys +import argparse + +parser = argparse.ArgumentParser() +parser.add_argument('target_dir', + help='the target dir') +parser.add_argument('stem', + help='the stem') +parser.add_argument('input', + help='the input file') + +options = parser.parse_args(sys.argv[1:]) + +with open(options.input) as f: + content = f.read() + + +output_c = os.path.join(options.target_dir, options.stem + ".tab.c") +with open(output_c, 'w') as f: + f.write(content) + + +output_h = os.path.join(options.target_dir, options.stem + ".tab.h") +h_content = '''#pragma once + +int myfun(void); +''' +with open(output_h, 'w') as f: + f.write(h_content) diff --git a/test cases/common/94 gen extra/srcgen3.py b/test cases/common/94 gen extra/srcgen3.py new file mode 100644 index 0000000..b737114 --- /dev/null +++ b/test cases/common/94 gen extra/srcgen3.py @@ -0,0 +1,15 @@ +#!/usr/bin/env python3 + +import sys +import argparse + +parser = argparse.ArgumentParser() +parser.add_argument('input', + help='the input file') + +options = parser.parse_args(sys.argv[1:]) + +with open(options.input) as f: + content = f.read().strip() + +print(content) diff --git a/test cases/common/94 gen extra/upper.c b/test cases/common/94 gen extra/upper.c new file mode 100644 index 0000000..44f8ad7 --- /dev/null +++ b/test cases/common/94 gen extra/upper.c @@ -0,0 +1,5 @@ +int BOB_MCBOB(); + +int main(int argc, char **argv) { + return BOB_MCBOB(); +} diff --git a/test cases/common/94 selfbuilt custom/data.dat b/test cases/common/94 selfbuilt custom/data.dat deleted file mode 100644 index 83fd1d9..0000000 --- a/test cases/common/94 selfbuilt custom/data.dat +++ /dev/null @@ -1 +0,0 @@ -generated_function diff --git a/test cases/common/94 selfbuilt custom/mainprog.cpp b/test cases/common/94 selfbuilt custom/mainprog.cpp deleted file mode 100644 index dcf9d20..0000000 --- a/test cases/common/94 selfbuilt custom/mainprog.cpp +++ /dev/null @@ -1,5 +0,0 @@ -#include"data.h" - -int main(int, char **) { - return generated_function() != 52; -} diff --git a/test cases/common/94 selfbuilt custom/meson.build b/test cases/common/94 selfbuilt custom/meson.build deleted file mode 100644 index e5da27e..0000000 --- a/test cases/common/94 selfbuilt custom/meson.build +++ /dev/null @@ -1,16 +0,0 @@ -project('selfbuilt custom', 'cpp') - -# Build an exe and use it in a custom target -# whose output is used to build a different exe. - -tool = executable('tool', 'tool.cpp', native : true) - -hfile = custom_target('datah', - output : 'data.h', - input : 'data.dat', - command : [tool, '@INPUT@', '@OUTPUT@'], -) - -main = executable('mainprog', 'mainprog.cpp', hfile) - -test('maintest', main) diff --git a/test cases/common/94 selfbuilt custom/tool.cpp b/test cases/common/94 selfbuilt custom/tool.cpp deleted file mode 100644 index 6a28dd8..0000000 --- a/test cases/common/94 selfbuilt custom/tool.cpp +++ /dev/null @@ -1,34 +0,0 @@ -#include -#include -#include - -using namespace std; - -const char prefix[] = "int "; -const char suffix[] = " () {\n return 52;}\n"; - -int main(int argc, char **argv) { - if(argc != 3) { - cout << "You is fail.\n"; - return 1; - } - ifstream is(argv[1], ifstream::binary); - if(!is) { - cout << "Opening input file failed.\n"; - return 1; - } - string funcname; - is >> funcname; - ofstream os(argv[2], ofstream::binary); - if(!os) { - cout << "Opening output file failed.\n"; - return 1; - } - os << prefix << funcname << suffix; - os.close(); - if(!os.good()) { - cout << "Writing data out failed.\n"; - return 1; - } - return 0; -} diff --git a/test cases/common/95 benchmark/delayer.c b/test cases/common/95 benchmark/delayer.c new file mode 100644 index 0000000..cfcedad --- /dev/null +++ b/test cases/common/95 benchmark/delayer.c @@ -0,0 +1,20 @@ +/* Simple prog that sleeps for a random time. */ + +#include +#include +#if defined(_WIN32) +#include +#endif + +int main(int argc, char **argv) { + srand(time(NULL)); +#if !defined(_WIN32) + struct timespec t; + t.tv_sec = 0; + t.tv_nsec = 199999999.0*rand()/RAND_MAX; + nanosleep(&t, NULL); +#else + Sleep(50.0*rand()/RAND_MAX); +#endif + return 0; +} diff --git a/test cases/common/95 benchmark/meson.build b/test cases/common/95 benchmark/meson.build new file mode 100644 index 0000000..9d583d2 --- /dev/null +++ b/test cases/common/95 benchmark/meson.build @@ -0,0 +1,4 @@ +project('benchmark', 'c') + +delayer = executable('delayer', 'delayer.c', c_args : '-D_GNU_SOURCE') +benchmark('delayer', delayer) diff --git a/test cases/common/95 gen extra/meson.build b/test cases/common/95 gen extra/meson.build deleted file mode 100644 index cbbdceb..0000000 --- a/test cases/common/95 gen extra/meson.build +++ /dev/null @@ -1,40 +0,0 @@ -project('extra args in gen', 'c') - -prog = find_program('srcgen.py') - -gen = generator(prog, - output : '@BASENAME@.c', - arguments : ['--input=@INPUT@', '--output=@OUTPUT@', '@EXTRA_ARGS@']) - -g1 = gen.process('name.dat') -g2 = gen.process('name.dat', extra_args: '--upper') - -test('basic', executable('basic', 'plain.c', g1)) -test('upper', executable('upper', 'upper.c', g2)) - -prog2 = find_program('srcgen2.py') -basename_gen = generator(prog2, - output : ['@BASENAME@.tab.c', '@BASENAME@.tab.h'], - arguments : ['@BUILD_DIR@', '@BASENAME@', '@INPUT@']) - -basename_src = basename_gen.process('name.l') - -test('basename', executable('basename', basename_src)) - -plainname_gen = generator(prog2, - output : ['@PLAINNAME@.tab.c', '@PLAINNAME@.tab.h'], - arguments : ['@BUILD_DIR@', '@PLAINNAME@', '@INPUT@']) - -plainname_src = plainname_gen.process('name.l') - -test('plainname', executable('plainname', plainname_src)) - -prog3 = find_program('srcgen3.py') -capture_gen = generator(prog3, - output : ['@BASENAME@.yy.c'], - arguments : ['@INPUT@'], - capture : true) - -capture_src = capture_gen.process('name.l') - -test('capture', executable('capture', capture_src)) diff --git a/test cases/common/95 gen extra/name.dat b/test cases/common/95 gen extra/name.dat deleted file mode 100644 index caf5b1c..0000000 --- a/test cases/common/95 gen extra/name.dat +++ /dev/null @@ -1 +0,0 @@ -bob_mcbob diff --git a/test cases/common/95 gen extra/name.l b/test cases/common/95 gen extra/name.l deleted file mode 100644 index 3adda4f..0000000 --- a/test cases/common/95 gen extra/name.l +++ /dev/null @@ -1,3 +0,0 @@ -int main() { -return 0; -} diff --git a/test cases/common/95 gen extra/plain.c b/test cases/common/95 gen extra/plain.c deleted file mode 100644 index 3845aee..0000000 --- a/test cases/common/95 gen extra/plain.c +++ /dev/null @@ -1,5 +0,0 @@ -int bob_mcbob(); - -int main(int argc, char **argv) { - return bob_mcbob(); -} diff --git a/test cases/common/95 gen extra/srcgen.py b/test cases/common/95 gen extra/srcgen.py deleted file mode 100755 index 8988cd9..0000000 --- a/test cases/common/95 gen extra/srcgen.py +++ /dev/null @@ -1,27 +0,0 @@ -#!/usr/bin/env python3 - -import sys -import argparse - -parser = argparse.ArgumentParser() -parser.add_argument('--input', dest='input', - help='the input file') -parser.add_argument('--output', dest='output', - help='the output file') -parser.add_argument('--upper', dest='upper', action='store_true', default=False, - help='Convert to upper case.') - -c_templ = '''int %s() { - return 0; -} -''' - -options = parser.parse_args(sys.argv[1:]) - -with open(options.input) as f: - funcname = f.readline().strip() -if options.upper: - funcname = funcname.upper() - -with open(options.output, 'w') as f: - f.write(c_templ % funcname) diff --git a/test cases/common/95 gen extra/srcgen2.py b/test cases/common/95 gen extra/srcgen2.py deleted file mode 100644 index 9cdf12d..0000000 --- a/test cases/common/95 gen extra/srcgen2.py +++ /dev/null @@ -1,32 +0,0 @@ -#!/usr/bin/env python3 - -import os -import sys -import argparse - -parser = argparse.ArgumentParser() -parser.add_argument('target_dir', - help='the target dir') -parser.add_argument('stem', - help='the stem') -parser.add_argument('input', - help='the input file') - -options = parser.parse_args(sys.argv[1:]) - -with open(options.input) as f: - content = f.read() - - -output_c = os.path.join(options.target_dir, options.stem + ".tab.c") -with open(output_c, 'w') as f: - f.write(content) - - -output_h = os.path.join(options.target_dir, options.stem + ".tab.h") -h_content = '''#pragma once - -int myfun(void); -''' -with open(output_h, 'w') as f: - f.write(h_content) diff --git a/test cases/common/95 gen extra/srcgen3.py b/test cases/common/95 gen extra/srcgen3.py deleted file mode 100644 index b737114..0000000 --- a/test cases/common/95 gen extra/srcgen3.py +++ /dev/null @@ -1,15 +0,0 @@ -#!/usr/bin/env python3 - -import sys -import argparse - -parser = argparse.ArgumentParser() -parser.add_argument('input', - help='the input file') - -options = parser.parse_args(sys.argv[1:]) - -with open(options.input) as f: - content = f.read().strip() - -print(content) diff --git a/test cases/common/95 gen extra/upper.c b/test cases/common/95 gen extra/upper.c deleted file mode 100644 index 44f8ad7..0000000 --- a/test cases/common/95 gen extra/upper.c +++ /dev/null @@ -1,5 +0,0 @@ -int BOB_MCBOB(); - -int main(int argc, char **argv) { - return BOB_MCBOB(); -} diff --git a/test cases/common/96 benchmark/delayer.c b/test cases/common/96 benchmark/delayer.c deleted file mode 100644 index cfcedad..0000000 --- a/test cases/common/96 benchmark/delayer.c +++ /dev/null @@ -1,20 +0,0 @@ -/* Simple prog that sleeps for a random time. */ - -#include -#include -#if defined(_WIN32) -#include -#endif - -int main(int argc, char **argv) { - srand(time(NULL)); -#if !defined(_WIN32) - struct timespec t; - t.tv_sec = 0; - t.tv_nsec = 199999999.0*rand()/RAND_MAX; - nanosleep(&t, NULL); -#else - Sleep(50.0*rand()/RAND_MAX); -#endif - return 0; -} diff --git a/test cases/common/96 benchmark/meson.build b/test cases/common/96 benchmark/meson.build deleted file mode 100644 index 9d583d2..0000000 --- a/test cases/common/96 benchmark/meson.build +++ /dev/null @@ -1,4 +0,0 @@ -project('benchmark', 'c') - -delayer = executable('delayer', 'delayer.c', c_args : '-D_GNU_SOURCE') -benchmark('delayer', delayer) diff --git a/test cases/common/96 test workdir/meson.build b/test cases/common/96 test workdir/meson.build new file mode 100644 index 0000000..a8290f7 --- /dev/null +++ b/test cases/common/96 test workdir/meson.build @@ -0,0 +1,8 @@ +project('test workdir', 'c') + +exe = executable('opener', 'opener.c') + +test('basic', exe, workdir : meson.source_root()) +test('shouldfail', exe, should_fail : true) + +subdir('subdir') diff --git a/test cases/common/96 test workdir/opener.c b/test cases/common/96 test workdir/opener.c new file mode 100644 index 0000000..43c53ce --- /dev/null +++ b/test cases/common/96 test workdir/opener.c @@ -0,0 +1,12 @@ +// This test only succeeds if run in the source root dir. + +#include + +int main(int arg, char **argv) { + FILE *f = fopen("opener.c", "r"); + if(f) { + fclose(f); + return 0; + } + return 1; +} diff --git a/test cases/common/96 test workdir/subdir/checker.py b/test cases/common/96 test workdir/subdir/checker.py new file mode 100755 index 0000000..66e287d --- /dev/null +++ b/test cases/common/96 test workdir/subdir/checker.py @@ -0,0 +1,5 @@ +#!/usr/bin/env python3 + +import sys + +data = open(sys.argv[1], 'rb').read() diff --git a/test cases/common/96 test workdir/subdir/meson.build b/test cases/common/96 test workdir/subdir/meson.build new file mode 100644 index 0000000..687a1cf --- /dev/null +++ b/test cases/common/96 test workdir/subdir/meson.build @@ -0,0 +1,4 @@ +exe2 = executable('dummy', '../opener.c') +test('subdir', find_program('checker.py'), + workdir : meson.source_root(), + args: [exe2]) diff --git a/test cases/common/97 suites/exe1.c b/test cases/common/97 suites/exe1.c new file mode 100644 index 0000000..23894c0 --- /dev/null +++ b/test cases/common/97 suites/exe1.c @@ -0,0 +1,6 @@ +#include + +int main(int argc, char **argv) { + printf("I am test exe1.\n"); + return 0; +} diff --git a/test cases/common/97 suites/exe2.c b/test cases/common/97 suites/exe2.c new file mode 100644 index 0000000..ec88e20 --- /dev/null +++ b/test cases/common/97 suites/exe2.c @@ -0,0 +1,6 @@ +#include + +int main(int argc, char **argv) { + printf("I am test exe2.\n"); + return 0; +} diff --git a/test cases/common/97 suites/meson.build b/test cases/common/97 suites/meson.build new file mode 100644 index 0000000..057e059 --- /dev/null +++ b/test cases/common/97 suites/meson.build @@ -0,0 +1,9 @@ +project('multiple test suites', 'c') + +subproject('sub') + +exe1 = executable('exe1', 'exe1.c') +exe2 = executable('exe2', 'exe2.c') + +test('exe1', exe1) +test('exe2', exe2, suite : ['suite2', 'super-special']) diff --git a/test cases/common/97 suites/subprojects/sub/meson.build b/test cases/common/97 suites/subprojects/sub/meson.build new file mode 100644 index 0000000..697d95f --- /dev/null +++ b/test cases/common/97 suites/subprojects/sub/meson.build @@ -0,0 +1,7 @@ +project('subproject test suites', 'c') + +sub1 = executable('sub1', 'sub1.c') +sub2 = executable('sub2', 'sub2.c') + +test('sub1', sub1) +test('sub2', sub2, suite : 'suite2') diff --git a/test cases/common/97 suites/subprojects/sub/sub1.c b/test cases/common/97 suites/subprojects/sub/sub1.c new file mode 100644 index 0000000..3409e48 --- /dev/null +++ b/test cases/common/97 suites/subprojects/sub/sub1.c @@ -0,0 +1,6 @@ +#include + +int main(int argc, char **argv) { + printf("I am test sub1.\n"); + return 0; +} diff --git a/test cases/common/97 suites/subprojects/sub/sub2.c b/test cases/common/97 suites/subprojects/sub/sub2.c new file mode 100644 index 0000000..1a64a2a --- /dev/null +++ b/test cases/common/97 suites/subprojects/sub/sub2.c @@ -0,0 +1,6 @@ +#include + +int main(int argc, char **argv) { + printf("I am test sub2.\n"); + return 0; +} diff --git a/test cases/common/97 test workdir/meson.build b/test cases/common/97 test workdir/meson.build deleted file mode 100644 index a8290f7..0000000 --- a/test cases/common/97 test workdir/meson.build +++ /dev/null @@ -1,8 +0,0 @@ -project('test workdir', 'c') - -exe = executable('opener', 'opener.c') - -test('basic', exe, workdir : meson.source_root()) -test('shouldfail', exe, should_fail : true) - -subdir('subdir') diff --git a/test cases/common/97 test workdir/opener.c b/test cases/common/97 test workdir/opener.c deleted file mode 100644 index 43c53ce..0000000 --- a/test cases/common/97 test workdir/opener.c +++ /dev/null @@ -1,12 +0,0 @@ -// This test only succeeds if run in the source root dir. - -#include - -int main(int arg, char **argv) { - FILE *f = fopen("opener.c", "r"); - if(f) { - fclose(f); - return 0; - } - return 1; -} diff --git a/test cases/common/97 test workdir/subdir/checker.py b/test cases/common/97 test workdir/subdir/checker.py deleted file mode 100755 index 66e287d..0000000 --- a/test cases/common/97 test workdir/subdir/checker.py +++ /dev/null @@ -1,5 +0,0 @@ -#!/usr/bin/env python3 - -import sys - -data = open(sys.argv[1], 'rb').read() diff --git a/test cases/common/97 test workdir/subdir/meson.build b/test cases/common/97 test workdir/subdir/meson.build deleted file mode 100644 index 687a1cf..0000000 --- a/test cases/common/97 test workdir/subdir/meson.build +++ /dev/null @@ -1,4 +0,0 @@ -exe2 = executable('dummy', '../opener.c') -test('subdir', find_program('checker.py'), - workdir : meson.source_root(), - args: [exe2]) diff --git a/test cases/common/98 suites/exe1.c b/test cases/common/98 suites/exe1.c deleted file mode 100644 index 23894c0..0000000 --- a/test cases/common/98 suites/exe1.c +++ /dev/null @@ -1,6 +0,0 @@ -#include - -int main(int argc, char **argv) { - printf("I am test exe1.\n"); - return 0; -} diff --git a/test cases/common/98 suites/exe2.c b/test cases/common/98 suites/exe2.c deleted file mode 100644 index ec88e20..0000000 --- a/test cases/common/98 suites/exe2.c +++ /dev/null @@ -1,6 +0,0 @@ -#include - -int main(int argc, char **argv) { - printf("I am test exe2.\n"); - return 0; -} diff --git a/test cases/common/98 suites/meson.build b/test cases/common/98 suites/meson.build deleted file mode 100644 index 057e059..0000000 --- a/test cases/common/98 suites/meson.build +++ /dev/null @@ -1,9 +0,0 @@ -project('multiple test suites', 'c') - -subproject('sub') - -exe1 = executable('exe1', 'exe1.c') -exe2 = executable('exe2', 'exe2.c') - -test('exe1', exe1) -test('exe2', exe2, suite : ['suite2', 'super-special']) diff --git a/test cases/common/98 suites/subprojects/sub/meson.build b/test cases/common/98 suites/subprojects/sub/meson.build deleted file mode 100644 index 697d95f..0000000 --- a/test cases/common/98 suites/subprojects/sub/meson.build +++ /dev/null @@ -1,7 +0,0 @@ -project('subproject test suites', 'c') - -sub1 = executable('sub1', 'sub1.c') -sub2 = executable('sub2', 'sub2.c') - -test('sub1', sub1) -test('sub2', sub2, suite : 'suite2') diff --git a/test cases/common/98 suites/subprojects/sub/sub1.c b/test cases/common/98 suites/subprojects/sub/sub1.c deleted file mode 100644 index 3409e48..0000000 --- a/test cases/common/98 suites/subprojects/sub/sub1.c +++ /dev/null @@ -1,6 +0,0 @@ -#include - -int main(int argc, char **argv) { - printf("I am test sub1.\n"); - return 0; -} diff --git a/test cases/common/98 suites/subprojects/sub/sub2.c b/test cases/common/98 suites/subprojects/sub/sub2.c deleted file mode 100644 index 1a64a2a..0000000 --- a/test cases/common/98 suites/subprojects/sub/sub2.c +++ /dev/null @@ -1,6 +0,0 @@ -#include - -int main(int argc, char **argv) { - printf("I am test sub2.\n"); - return 0; -} diff --git a/test cases/common/98 threads/meson.build b/test cases/common/98 threads/meson.build new file mode 100644 index 0000000..1fbb15a --- /dev/null +++ b/test cases/common/98 threads/meson.build @@ -0,0 +1,16 @@ +project('threads', 'cpp', 'c', + default_options : ['cpp_std=c++11']) + +threaddep = dependency('threads') + +test('cppthreadtest', + executable('cppthreadprog', 'threadprog.cpp', + dependencies : threaddep + ) +) + +test('cthreadtest', + executable('cthreadprog', 'threadprog.c', + dependencies : threaddep + ) +) diff --git a/test cases/common/98 threads/threadprog.c b/test cases/common/98 threads/threadprog.c new file mode 100644 index 0000000..47a5d18 --- /dev/null +++ b/test cases/common/98 threads/threadprog.c @@ -0,0 +1,40 @@ +#if defined _WIN32 + +#include +#include + +DWORD WINAPI thread_func(LPVOID ignored) { + printf("Printing from a thread.\n"); + return 0; +} + +int main(int argc, char **argv) { + DWORD id; + HANDLE th; + printf("Starting thread.\n"); + th = CreateThread(NULL, 0, thread_func, NULL, 0, &id); + WaitForSingleObject(th, INFINITE); + printf("Stopped thread.\n"); + return 0; +} +#else + +#include +#include + +void* main_func(void* ignored) { + printf("Printing from a thread.\n"); + return NULL; +} + +int main(int argc, char** argv) { + pthread_t thread; + int rc; + printf("Starting thread.\n"); + rc = pthread_create(&thread, NULL, main_func, NULL); + rc = pthread_join(thread, NULL); + printf("Stopped thread.\n"); + return rc; +} + +#endif diff --git a/test cases/common/98 threads/threadprog.cpp b/test cases/common/98 threads/threadprog.cpp new file mode 100644 index 0000000..6fd747f --- /dev/null +++ b/test cases/common/98 threads/threadprog.cpp @@ -0,0 +1,43 @@ +/* On Windows not all versions of VS support C++11 and + * some (most?) versions of mingw don't support std::thread, + * even though they do support c++11. Since we only care about + * threads working, do the test with raw win threads. + */ + +#if defined _WIN32 + +#include +#include + +DWORD WINAPI thread_func(LPVOID) { + printf("Printing from a thread.\n"); + return 0; +} + +int main(int, char**) { + printf("Starting thread.\n"); + HANDLE th; + DWORD id; + th = CreateThread(NULL, 0, thread_func, NULL, 0, &id); + WaitForSingleObject(th, INFINITE); + printf("Stopped thread.\n"); + return 0; +} +#else + +#include +#include + +void main_func() { + printf("Printing from a thread.\n"); +} + +int main(int, char**) { + printf("Starting thread.\n"); + std::thread th(main_func); + th.join(); + printf("Stopped thread.\n"); + return 0; +} + +#endif diff --git a/test cases/common/99 manygen/depuser.c b/test cases/common/99 manygen/depuser.c new file mode 100644 index 0000000..1a825e0 --- /dev/null +++ b/test cases/common/99 manygen/depuser.c @@ -0,0 +1,8 @@ +#include"gen_func.h" + +int main(int argc, char **argv) { + unsigned int i = (unsigned int) gen_func_in_lib(); + unsigned int j = (unsigned int) gen_func_in_obj(); + unsigned int k = (unsigned int) gen_func_in_src(); + return (int)(i + j + k); +} diff --git a/test cases/common/99 manygen/meson.build b/test cases/common/99 manygen/meson.build new file mode 100644 index 0000000..e70a55a --- /dev/null +++ b/test cases/common/99 manygen/meson.build @@ -0,0 +1,14 @@ +project('manygen', 'c') + +if meson.is_cross_build() + # FIXME error out with skip message once cross test runner + # recognizes it. + message('Not running this test during cross build.') +else + subdir('subdir') + + exe = executable('depuser', 'depuser.c', + generated) + + test('depuser test', exe) +endif diff --git a/test cases/common/99 manygen/subdir/funcinfo.def b/test cases/common/99 manygen/subdir/funcinfo.def new file mode 100644 index 0000000..b074186 --- /dev/null +++ b/test cases/common/99 manygen/subdir/funcinfo.def @@ -0,0 +1 @@ +gen_func diff --git a/test cases/common/99 manygen/subdir/manygen.py b/test cases/common/99 manygen/subdir/manygen.py new file mode 100755 index 0000000..0fbc2ec --- /dev/null +++ b/test cases/common/99 manygen/subdir/manygen.py @@ -0,0 +1,83 @@ +#!/usr/bin/env python + +from __future__ import print_function + +# Generates a static library, object file, source +# file and a header file. + +import sys, os +import subprocess + +with open(sys.argv[1]) as f: + funcname = f.readline().strip() +outdir = sys.argv[2] +buildtype_args = sys.argv[3] +compiler_type = sys.argv[4] +compiler = sys.argv[5:] + +if not os.path.isdir(outdir): + print('Outdir does not exist.') + sys.exit(1) + +if compiler_type == 'msvc': + libsuffix = '.lib' + is_vs = True + if any(['clang-cl' in c for c in compiler]): + linker = 'llvm-lib' + else: + linker = 'lib' +else: + libsuffix = '.a' + is_vs = False + linker = 'ar' + +objsuffix = '.o' + +outo = os.path.join(outdir, funcname + objsuffix) +outa = os.path.join(outdir, funcname + libsuffix) +outh = os.path.join(outdir, funcname + '.h') +outc = os.path.join(outdir, funcname + '.c') + +tmpc = 'diibadaaba.c' +tmpo = 'diibadaaba' + objsuffix + +with open(outc, 'w') as f: + f.write('''#include"%s.h" +int %s_in_src() { + return 0; +} +''' % (funcname, funcname)) + +with open(outh, 'w') as f: + f.write('''#pragma once +int %s_in_lib(); +int %s_in_obj(); +int %s_in_src(); +''' % (funcname, funcname, funcname)) + +with open(tmpc, 'w') as f: + f.write('''int %s_in_obj() { + return 0; +} +''' % funcname) + +if is_vs: + subprocess.check_call(compiler + ['/nologo', '/c', buildtype_args, '/Fo' + outo, tmpc]) +else: + subprocess.check_call(compiler + ['-c', '-o', outo, tmpc]) + +with open(tmpc, 'w') as f: + f.write('''int %s_in_lib() { + return 0; +} +''' % funcname) + +if is_vs: + subprocess.check_call(compiler + ['/nologo', '/c', '/Fo' + tmpo, tmpc]) + subprocess.check_call([linker, '/NOLOGO', '/OUT:' + outa, tmpo]) +else: + subprocess.check_call(compiler + ['-c', '-o', tmpo, tmpc]) + subprocess.check_call([linker, 'csr', outa, tmpo]) + +os.unlink(tmpo) +os.unlink(tmpc) diff --git a/test cases/common/99 manygen/subdir/meson.build b/test cases/common/99 manygen/subdir/meson.build new file mode 100644 index 0000000..56f60e6 --- /dev/null +++ b/test cases/common/99 manygen/subdir/meson.build @@ -0,0 +1,26 @@ +gen = files('manygen.py') +py3_bin = import('python3').find_python() + +buildtype = get_option('buildtype') +buildtype_args = '-Dfooxxx' # a useless compiler argument +cc = meson.get_compiler('c') +if cc.get_argument_syntax() == 'msvc' + # We need our manually generated code to use the same CRT as the executable. + # Taken from compilers.py since build files do not have access to this. + if buildtype == 'debug' + buildtype_args = '/MDd' + elif buildtype == 'debugoptimized' + buildtype_args = '/MDd' + elif buildtype == 'release' + buildtype_args = '/MD' + endif + outfiles = ['gen_func.lib', 'gen_func.c', 'gen_func.h', 'gen_func.o'] +else + outfiles = ['gen_func.a', 'gen_func.c', 'gen_func.h', 'gen_func.o'] +endif + +generated = custom_target('manygen', + output : outfiles, + input : ['funcinfo.def'], + command : [py3_bin, gen[0], '@INPUT@', '@OUTDIR@', buildtype_args, cc.get_argument_syntax(), cc.cmd_array()], +) diff --git a/test cases/common/99 threads/meson.build b/test cases/common/99 threads/meson.build deleted file mode 100644 index 1fbb15a..0000000 --- a/test cases/common/99 threads/meson.build +++ /dev/null @@ -1,16 +0,0 @@ -project('threads', 'cpp', 'c', - default_options : ['cpp_std=c++11']) - -threaddep = dependency('threads') - -test('cppthreadtest', - executable('cppthreadprog', 'threadprog.cpp', - dependencies : threaddep - ) -) - -test('cthreadtest', - executable('cthreadprog', 'threadprog.c', - dependencies : threaddep - ) -) diff --git a/test cases/common/99 threads/threadprog.c b/test cases/common/99 threads/threadprog.c deleted file mode 100644 index 47a5d18..0000000 --- a/test cases/common/99 threads/threadprog.c +++ /dev/null @@ -1,40 +0,0 @@ -#if defined _WIN32 - -#include -#include - -DWORD WINAPI thread_func(LPVOID ignored) { - printf("Printing from a thread.\n"); - return 0; -} - -int main(int argc, char **argv) { - DWORD id; - HANDLE th; - printf("Starting thread.\n"); - th = CreateThread(NULL, 0, thread_func, NULL, 0, &id); - WaitForSingleObject(th, INFINITE); - printf("Stopped thread.\n"); - return 0; -} -#else - -#include -#include - -void* main_func(void* ignored) { - printf("Printing from a thread.\n"); - return NULL; -} - -int main(int argc, char** argv) { - pthread_t thread; - int rc; - printf("Starting thread.\n"); - rc = pthread_create(&thread, NULL, main_func, NULL); - rc = pthread_join(thread, NULL); - printf("Stopped thread.\n"); - return rc; -} - -#endif diff --git a/test cases/common/99 threads/threadprog.cpp b/test cases/common/99 threads/threadprog.cpp deleted file mode 100644 index 6fd747f..0000000 --- a/test cases/common/99 threads/threadprog.cpp +++ /dev/null @@ -1,43 +0,0 @@ -/* On Windows not all versions of VS support C++11 and - * some (most?) versions of mingw don't support std::thread, - * even though they do support c++11. Since we only care about - * threads working, do the test with raw win threads. - */ - -#if defined _WIN32 - -#include -#include - -DWORD WINAPI thread_func(LPVOID) { - printf("Printing from a thread.\n"); - return 0; -} - -int main(int, char**) { - printf("Starting thread.\n"); - HANDLE th; - DWORD id; - th = CreateThread(NULL, 0, thread_func, NULL, 0, &id); - WaitForSingleObject(th, INFINITE); - printf("Stopped thread.\n"); - return 0; -} -#else - -#include -#include - -void main_func() { - printf("Printing from a thread.\n"); -} - -int main(int, char**) { - printf("Starting thread.\n"); - std::thread th(main_func); - th.join(); - printf("Stopped thread.\n"); - return 0; -} - -#endif diff --git a/test cases/failing/89 subproj not-found dep/meson.build b/test cases/failing/89 subproj not-found dep/meson.build new file mode 100644 index 0000000..2b17df1 --- /dev/null +++ b/test cases/failing/89 subproj not-found dep/meson.build @@ -0,0 +1,2 @@ +project('dep-test') +missing = dependency('', fallback: ['somesubproj', 'notfound_dep'], required: true) diff --git a/test cases/failing/89 subproj not-found dep/subprojects/somesubproj/meson.build b/test cases/failing/89 subproj not-found dep/subprojects/somesubproj/meson.build new file mode 100644 index 0000000..5f451f4 --- /dev/null +++ b/test cases/failing/89 subproj not-found dep/subprojects/somesubproj/meson.build @@ -0,0 +1,3 @@ +project('dep', 'c') + +notfound_dep = dependency('', required : false) diff --git a/test cases/failing/90 invalid configure file/input b/test cases/failing/90 invalid configure file/input new file mode 100644 index 0000000..e69de29 diff --git a/test cases/failing/90 invalid configure file/meson.build b/test cases/failing/90 invalid configure file/meson.build new file mode 100644 index 0000000..08eca2b --- /dev/null +++ b/test cases/failing/90 invalid configure file/meson.build @@ -0,0 +1,9 @@ +project('invalid configura file') + +configure_file( + configuration : configuration_data(), + input : 'input', + output : 'output', + install_dir : '', + install : true, +) diff --git a/test cases/failing/90 subproj not-found dep/meson.build b/test cases/failing/90 subproj not-found dep/meson.build deleted file mode 100644 index 2b17df1..0000000 --- a/test cases/failing/90 subproj not-found dep/meson.build +++ /dev/null @@ -1,2 +0,0 @@ -project('dep-test') -missing = dependency('', fallback: ['somesubproj', 'notfound_dep'], required: true) diff --git a/test cases/failing/90 subproj not-found dep/subprojects/somesubproj/meson.build b/test cases/failing/90 subproj not-found dep/subprojects/somesubproj/meson.build deleted file mode 100644 index 5f451f4..0000000 --- a/test cases/failing/90 subproj not-found dep/subprojects/somesubproj/meson.build +++ /dev/null @@ -1,3 +0,0 @@ -project('dep', 'c') - -notfound_dep = dependency('', required : false) diff --git a/test cases/failing/91 invalid configure file/input b/test cases/failing/91 invalid configure file/input deleted file mode 100644 index e69de29..0000000 diff --git a/test cases/failing/91 invalid configure file/meson.build b/test cases/failing/91 invalid configure file/meson.build deleted file mode 100644 index 08eca2b..0000000 --- a/test cases/failing/91 invalid configure file/meson.build +++ /dev/null @@ -1,9 +0,0 @@ -project('invalid configura file') - -configure_file( - configuration : configuration_data(), - input : 'input', - output : 'output', - install_dir : '', - install : true, -) diff --git a/test cases/failing/91 kwarg dupe/meson.build b/test cases/failing/91 kwarg dupe/meson.build new file mode 100644 index 0000000..06821a2 --- /dev/null +++ b/test cases/failing/91 kwarg dupe/meson.build @@ -0,0 +1,6 @@ +project('dupe kwarg', 'c') + +dupedict = {'install': true} + +executable('prog', 'prog.c', install: true, + kwargs: dupedict) diff --git a/test cases/failing/91 kwarg dupe/prog.c b/test cases/failing/91 kwarg dupe/prog.c new file mode 100644 index 0000000..5f3fbe6 --- /dev/null +++ b/test cases/failing/91 kwarg dupe/prog.c @@ -0,0 +1,6 @@ +#include + +int main(int argc, char **argv) { + printf("I don't get built. It makes me saaaaaad. :(\n"); + return 0; +} diff --git a/test cases/failing/92 kwarg dupe/meson.build b/test cases/failing/92 kwarg dupe/meson.build deleted file mode 100644 index 06821a2..0000000 --- a/test cases/failing/92 kwarg dupe/meson.build +++ /dev/null @@ -1,6 +0,0 @@ -project('dupe kwarg', 'c') - -dupedict = {'install': true} - -executable('prog', 'prog.c', install: true, - kwargs: dupedict) diff --git a/test cases/failing/92 kwarg dupe/prog.c b/test cases/failing/92 kwarg dupe/prog.c deleted file mode 100644 index 5f3fbe6..0000000 --- a/test cases/failing/92 kwarg dupe/prog.c +++ /dev/null @@ -1,6 +0,0 @@ -#include - -int main(int argc, char **argv) { - printf("I don't get built. It makes me saaaaaad. :(\n"); - return 0; -} diff --git a/test cases/failing/92 missing pch file/meson.build b/test cases/failing/92 missing pch file/meson.build new file mode 100644 index 0000000..a67b798 --- /dev/null +++ b/test cases/failing/92 missing pch file/meson.build @@ -0,0 +1,3 @@ +project('pch test', 'c') +exe = executable('prog', 'prog.c', +c_pch : ['pch/prog_pch.c', 'pch/prog.h']) diff --git a/test cases/failing/92 missing pch file/prog.c b/test cases/failing/92 missing pch file/prog.c new file mode 100644 index 0000000..11b7fad --- /dev/null +++ b/test cases/failing/92 missing pch file/prog.c @@ -0,0 +1,3 @@ +int main(int argc, char **argv) { + return 0; +} diff --git a/test cases/failing/93 missing pch file/meson.build b/test cases/failing/93 missing pch file/meson.build deleted file mode 100644 index a67b798..0000000 --- a/test cases/failing/93 missing pch file/meson.build +++ /dev/null @@ -1,3 +0,0 @@ -project('pch test', 'c') -exe = executable('prog', 'prog.c', -c_pch : ['pch/prog_pch.c', 'pch/prog.h']) diff --git a/test cases/failing/93 missing pch file/prog.c b/test cases/failing/93 missing pch file/prog.c deleted file mode 100644 index 11b7fad..0000000 --- a/test cases/failing/93 missing pch file/prog.c +++ /dev/null @@ -1,3 +0,0 @@ -int main(int argc, char **argv) { - return 0; -} diff --git a/test cases/failing/93 pch source different folder/include/pch.h b/test cases/failing/93 pch source different folder/include/pch.h new file mode 100644 index 0000000..e69de29 diff --git a/test cases/failing/93 pch source different folder/meson.build b/test cases/failing/93 pch source different folder/meson.build new file mode 100644 index 0000000..d320717 --- /dev/null +++ b/test cases/failing/93 pch source different folder/meson.build @@ -0,0 +1,5 @@ +project('pch', 'c') +# It is not allowed to have the PCH implementation in a different +# folder than the header. +exe = executable('prog', 'prog.c', + c_pch : ['include/pch.h', 'src/pch.c']) diff --git a/test cases/failing/93 pch source different folder/prog.c b/test cases/failing/93 pch source different folder/prog.c new file mode 100644 index 0000000..c272dab --- /dev/null +++ b/test cases/failing/93 pch source different folder/prog.c @@ -0,0 +1 @@ +int main() {} \ No newline at end of file diff --git a/test cases/failing/93 pch source different folder/src/pch.c b/test cases/failing/93 pch source different folder/src/pch.c new file mode 100644 index 0000000..e69de29 diff --git a/test cases/failing/94 pch source different folder/include/pch.h b/test cases/failing/94 pch source different folder/include/pch.h deleted file mode 100644 index e69de29..0000000 diff --git a/test cases/failing/94 pch source different folder/meson.build b/test cases/failing/94 pch source different folder/meson.build deleted file mode 100644 index d320717..0000000 --- a/test cases/failing/94 pch source different folder/meson.build +++ /dev/null @@ -1,5 +0,0 @@ -project('pch', 'c') -# It is not allowed to have the PCH implementation in a different -# folder than the header. -exe = executable('prog', 'prog.c', - c_pch : ['include/pch.h', 'src/pch.c']) diff --git a/test cases/failing/94 pch source different folder/prog.c b/test cases/failing/94 pch source different folder/prog.c deleted file mode 100644 index c272dab..0000000 --- a/test cases/failing/94 pch source different folder/prog.c +++ /dev/null @@ -1 +0,0 @@ -int main() {} \ No newline at end of file diff --git a/test cases/failing/94 pch source different folder/src/pch.c b/test cases/failing/94 pch source different folder/src/pch.c deleted file mode 100644 index e69de29..0000000 diff --git a/test cases/failing/94 vala without c/meson.build b/test cases/failing/94 vala without c/meson.build new file mode 100644 index 0000000..ce39d5d --- /dev/null +++ b/test cases/failing/94 vala without c/meson.build @@ -0,0 +1,2 @@ +project('vala without c') +add_languages('vala') diff --git a/test cases/failing/95 unknown config tool/meson.build b/test cases/failing/95 unknown config tool/meson.build new file mode 100644 index 0000000..536976e --- /dev/null +++ b/test cases/failing/95 unknown config tool/meson.build @@ -0,0 +1,2 @@ +project('no-such-config-tool') +dependency('no-such-config-tool', method:'config-tool') diff --git a/test cases/failing/95 vala without c/meson.build b/test cases/failing/95 vala without c/meson.build deleted file mode 100644 index ce39d5d..0000000 --- a/test cases/failing/95 vala without c/meson.build +++ /dev/null @@ -1,2 +0,0 @@ -project('vala without c') -add_languages('vala') diff --git a/test cases/failing/96 custom target install data/Info.plist.cpp b/test cases/failing/96 custom target install data/Info.plist.cpp new file mode 100644 index 0000000..9ca2fcb --- /dev/null +++ b/test cases/failing/96 custom target install data/Info.plist.cpp @@ -0,0 +1 @@ +Some data which gets processed before installation diff --git a/test cases/failing/96 custom target install data/meson.build b/test cases/failing/96 custom target install data/meson.build new file mode 100644 index 0000000..00d348c --- /dev/null +++ b/test cases/failing/96 custom target install data/meson.build @@ -0,0 +1,11 @@ +project('custom target install data') + +preproc = find_program('preproc.py') + +t = custom_target('Info.plist', + command: [preproc, '@INPUT@', '@OUTPUT@'], + input: 'Info.plist.cpp', + output: 'Info.plist', +) + +install_data(t) diff --git a/test cases/failing/96 custom target install data/preproc.py b/test cases/failing/96 custom target install data/preproc.py new file mode 100644 index 0000000..e6eba4c --- /dev/null +++ b/test cases/failing/96 custom target install data/preproc.py @@ -0,0 +1,13 @@ +#!/usr/bin/env python3 + +import sys + +if len(sys.argv) != 3: + print(sys.argv[0], '', '') + +inf = sys.argv[1] +outf = sys.argv[2] + +with open(outf, 'wb') as o: + with open(inf, 'rb') as i: + o.write(i.read()) diff --git a/test cases/failing/96 unknown config tool/meson.build b/test cases/failing/96 unknown config tool/meson.build deleted file mode 100644 index 536976e..0000000 --- a/test cases/failing/96 unknown config tool/meson.build +++ /dev/null @@ -1,2 +0,0 @@ -project('no-such-config-tool') -dependency('no-such-config-tool', method:'config-tool') diff --git a/test cases/failing/97 custom target install data/Info.plist.cpp b/test cases/failing/97 custom target install data/Info.plist.cpp deleted file mode 100644 index 9ca2fcb..0000000 --- a/test cases/failing/97 custom target install data/Info.plist.cpp +++ /dev/null @@ -1 +0,0 @@ -Some data which gets processed before installation diff --git a/test cases/failing/97 custom target install data/meson.build b/test cases/failing/97 custom target install data/meson.build deleted file mode 100644 index 00d348c..0000000 --- a/test cases/failing/97 custom target install data/meson.build +++ /dev/null @@ -1,11 +0,0 @@ -project('custom target install data') - -preproc = find_program('preproc.py') - -t = custom_target('Info.plist', - command: [preproc, '@INPUT@', '@OUTPUT@'], - input: 'Info.plist.cpp', - output: 'Info.plist', -) - -install_data(t) diff --git a/test cases/failing/97 custom target install data/preproc.py b/test cases/failing/97 custom target install data/preproc.py deleted file mode 100644 index e6eba4c..0000000 --- a/test cases/failing/97 custom target install data/preproc.py +++ /dev/null @@ -1,13 +0,0 @@ -#!/usr/bin/env python3 - -import sys - -if len(sys.argv) != 3: - print(sys.argv[0], '', '') - -inf = sys.argv[1] -outf = sys.argv[2] - -with open(outf, 'wb') as o: - with open(inf, 'rb') as i: - o.write(i.read()) diff --git a/test cases/unit/50 std remains/meson.build b/test cases/unit/50 std remains/meson.build deleted file mode 100644 index ac6f9e2..0000000 --- a/test cases/unit/50 std remains/meson.build +++ /dev/null @@ -1,2 +0,0 @@ -project('std_remains', 'c', default_options: ['c_std=c99']) -executable('prog', 'prog.c') diff --git a/test cases/unit/50 std remains/prog.c b/test cases/unit/50 std remains/prog.c deleted file mode 100644 index 0314ff1..0000000 --- a/test cases/unit/50 std remains/prog.c +++ /dev/null @@ -1 +0,0 @@ -int main(int argc, char **argv) { return 0; } diff --git a/test cases/unit/51 ldflagdedup/bob.c b/test cases/unit/51 ldflagdedup/bob.c deleted file mode 100644 index a68d4b1..0000000 --- a/test cases/unit/51 ldflagdedup/bob.c +++ /dev/null @@ -1,5 +0,0 @@ -#include - -int func() { - return 0; -} diff --git a/test cases/unit/51 ldflagdedup/meson.build b/test cases/unit/51 ldflagdedup/meson.build deleted file mode 100644 index 0bbcc50..0000000 --- a/test cases/unit/51 ldflagdedup/meson.build +++ /dev/null @@ -1,12 +0,0 @@ -project('lddedup', 'c') - -# Chosen because its ldflags contains -Wl,--export-dynamic, -# which must be deduplicated. -gm = dependency('gmodule-2.0') - -lib = static_library('bob', 'bob.c', - dependencies: gm) - -executable('prog', 'prog.c', - link_with: lib, - dependencies: gm) diff --git a/test cases/unit/51 ldflagdedup/prog.c b/test cases/unit/51 ldflagdedup/prog.c deleted file mode 100644 index 02c599d..0000000 --- a/test cases/unit/51 ldflagdedup/prog.c +++ /dev/null @@ -1,7 +0,0 @@ -#include - -int func(); - -int main(int argc, char **argv) { - return func(); -} diff --git a/test cases/unit/51 std remains/meson.build b/test cases/unit/51 std remains/meson.build new file mode 100644 index 0000000..ac6f9e2 --- /dev/null +++ b/test cases/unit/51 std remains/meson.build @@ -0,0 +1,2 @@ +project('std_remains', 'c', default_options: ['c_std=c99']) +executable('prog', 'prog.c') diff --git a/test cases/unit/51 std remains/prog.c b/test cases/unit/51 std remains/prog.c new file mode 100644 index 0000000..0314ff1 --- /dev/null +++ b/test cases/unit/51 std remains/prog.c @@ -0,0 +1 @@ +int main(int argc, char **argv) { return 0; } diff --git a/test cases/unit/52 ldflagdedup/bob.c b/test cases/unit/52 ldflagdedup/bob.c new file mode 100644 index 0000000..a68d4b1 --- /dev/null +++ b/test cases/unit/52 ldflagdedup/bob.c @@ -0,0 +1,5 @@ +#include + +int func() { + return 0; +} diff --git a/test cases/unit/52 ldflagdedup/meson.build b/test cases/unit/52 ldflagdedup/meson.build new file mode 100644 index 0000000..0bbcc50 --- /dev/null +++ b/test cases/unit/52 ldflagdedup/meson.build @@ -0,0 +1,12 @@ +project('lddedup', 'c') + +# Chosen because its ldflags contains -Wl,--export-dynamic, +# which must be deduplicated. +gm = dependency('gmodule-2.0') + +lib = static_library('bob', 'bob.c', + dependencies: gm) + +executable('prog', 'prog.c', + link_with: lib, + dependencies: gm) diff --git a/test cases/unit/52 ldflagdedup/prog.c b/test cases/unit/52 ldflagdedup/prog.c new file mode 100644 index 0000000..02c599d --- /dev/null +++ b/test cases/unit/52 ldflagdedup/prog.c @@ -0,0 +1,7 @@ +#include + +int func(); + +int main(int argc, char **argv) { + return func(); +} diff --git a/test cases/unit/52 pkgconfig static link order/meson.build b/test cases/unit/52 pkgconfig static link order/meson.build deleted file mode 100644 index b61de9a..0000000 --- a/test cases/unit/52 pkgconfig static link order/meson.build +++ /dev/null @@ -1,11 +0,0 @@ -project('link order test', 'c') - -dep = library('dependency', []) -lib = static_library('something', [], link_with: dep) - -import('pkgconfig').generate( - name: 'libsomething', - description: 'test library', - libraries: lib, - version: '1' -) diff --git a/test cases/unit/53 clang-format/.clang-format b/test cases/unit/53 clang-format/.clang-format deleted file mode 100644 index 5c60ac9..0000000 --- a/test cases/unit/53 clang-format/.clang-format +++ /dev/null @@ -1,5 +0,0 @@ ---- -BasedOnStyle: LLVM -IndentWidth: 4 -UseTab: Never ---- diff --git a/test cases/unit/53 clang-format/header_expected_h b/test cases/unit/53 clang-format/header_expected_h deleted file mode 100644 index 4303176..0000000 --- a/test cases/unit/53 clang-format/header_expected_h +++ /dev/null @@ -1,3 +0,0 @@ -#pragma once - -int fun(int argc); diff --git a/test cases/unit/53 clang-format/header_orig_h b/test cases/unit/53 clang-format/header_orig_h deleted file mode 100644 index f2222f3..0000000 --- a/test cases/unit/53 clang-format/header_orig_h +++ /dev/null @@ -1,9 +0,0 @@ -#pragma once - -int -fun -( -int -argc -) -; diff --git a/test cases/unit/53 clang-format/meson.build b/test cases/unit/53 clang-format/meson.build deleted file mode 100644 index 1b93cd5..0000000 --- a/test cases/unit/53 clang-format/meson.build +++ /dev/null @@ -1,4 +0,0 @@ -project('clangformat', 'c') - -executable('prog', 'prog.c') - diff --git a/test cases/unit/53 clang-format/prog_expected_c b/test cases/unit/53 clang-format/prog_expected_c deleted file mode 100644 index a045966..0000000 --- a/test cases/unit/53 clang-format/prog_expected_c +++ /dev/null @@ -1,6 +0,0 @@ -#include - -int main(int argc, char **argv) { - printf("Awful.\n"); - return 0; -} diff --git a/test cases/unit/53 clang-format/prog_orig_c b/test cases/unit/53 clang-format/prog_orig_c deleted file mode 100644 index f098bbc..0000000 --- a/test cases/unit/53 clang-format/prog_orig_c +++ /dev/null @@ -1,21 +0,0 @@ -#include - - - - -int -main( -int -argc, -char** -argv) -{ -printf( -"Awful.\n" -) -; -return -0 -; -} - diff --git a/test cases/unit/53 pkgconfig static link order/meson.build b/test cases/unit/53 pkgconfig static link order/meson.build new file mode 100644 index 0000000..b61de9a --- /dev/null +++ b/test cases/unit/53 pkgconfig static link order/meson.build @@ -0,0 +1,11 @@ +project('link order test', 'c') + +dep = library('dependency', []) +lib = static_library('something', [], link_with: dep) + +import('pkgconfig').generate( + name: 'libsomething', + description: 'test library', + libraries: lib, + version: '1' +) diff --git a/test cases/unit/54 clang-format/.clang-format b/test cases/unit/54 clang-format/.clang-format new file mode 100644 index 0000000..5c60ac9 --- /dev/null +++ b/test cases/unit/54 clang-format/.clang-format @@ -0,0 +1,5 @@ +--- +BasedOnStyle: LLVM +IndentWidth: 4 +UseTab: Never +--- diff --git a/test cases/unit/54 clang-format/header_expected_h b/test cases/unit/54 clang-format/header_expected_h new file mode 100644 index 0000000..4303176 --- /dev/null +++ b/test cases/unit/54 clang-format/header_expected_h @@ -0,0 +1,3 @@ +#pragma once + +int fun(int argc); diff --git a/test cases/unit/54 clang-format/header_orig_h b/test cases/unit/54 clang-format/header_orig_h new file mode 100644 index 0000000..f2222f3 --- /dev/null +++ b/test cases/unit/54 clang-format/header_orig_h @@ -0,0 +1,9 @@ +#pragma once + +int +fun +( +int +argc +) +; diff --git a/test cases/unit/54 clang-format/meson.build b/test cases/unit/54 clang-format/meson.build new file mode 100644 index 0000000..1b93cd5 --- /dev/null +++ b/test cases/unit/54 clang-format/meson.build @@ -0,0 +1,4 @@ +project('clangformat', 'c') + +executable('prog', 'prog.c') + diff --git a/test cases/unit/54 clang-format/prog_expected_c b/test cases/unit/54 clang-format/prog_expected_c new file mode 100644 index 0000000..a045966 --- /dev/null +++ b/test cases/unit/54 clang-format/prog_expected_c @@ -0,0 +1,6 @@ +#include + +int main(int argc, char **argv) { + printf("Awful.\n"); + return 0; +} diff --git a/test cases/unit/54 clang-format/prog_orig_c b/test cases/unit/54 clang-format/prog_orig_c new file mode 100644 index 0000000..f098bbc --- /dev/null +++ b/test cases/unit/54 clang-format/prog_orig_c @@ -0,0 +1,21 @@ +#include + + + + +int +main( +int +argc, +char** +argv) +{ +printf( +"Awful.\n" +) +; +return +0 +; +} + diff --git a/test cases/unit/54 introspect buildoptions/subprojects/projectBad/meson.build b/test cases/unit/54 introspect buildoptions/subprojects/projectBad/meson.build deleted file mode 100644 index 4d0aeeb..0000000 --- a/test cases/unit/54 introspect buildoptions/subprojects/projectBad/meson.build +++ /dev/null @@ -1,9 +0,0 @@ -pfggggaergaeg(sdgrgjgn)aga - -rgqeh -th -thtr -e -tb -tbqebt -tbqebttrtt diff --git a/test cases/unit/54 introspect buildoptions/subprojects/projectBad/meson_options.txt b/test cases/unit/54 introspect buildoptions/subprojects/projectBad/meson_options.txt deleted file mode 100644 index f15d352..0000000 --- a/test cases/unit/54 introspect buildoptions/subprojects/projectBad/meson_options.txt +++ /dev/null @@ -1 +0,0 @@ -option('should_not_appear', type: 'integer', min: 0, value: 125) diff --git a/test cases/unit/55 dedup compiler libs/app/app.c b/test cases/unit/55 dedup compiler libs/app/app.c deleted file mode 100644 index 4e215b3..0000000 --- a/test cases/unit/55 dedup compiler libs/app/app.c +++ /dev/null @@ -1,13 +0,0 @@ -#include -#include -#include - -int -main(void) -{ - printf("start value = %d\n", liba_get()); - liba_add(2); - libb_mul(5); - printf("end value = %d\n", liba_get()); - return 0; -} diff --git a/test cases/unit/55 dedup compiler libs/app/meson.build b/test cases/unit/55 dedup compiler libs/app/meson.build deleted file mode 100644 index 82ac306..0000000 --- a/test cases/unit/55 dedup compiler libs/app/meson.build +++ /dev/null @@ -1,2 +0,0 @@ -executable('app', 'app.c', - dependencies: [liba_dep, libb_dep]) diff --git a/test cases/unit/55 dedup compiler libs/liba/liba.c b/test cases/unit/55 dedup compiler libs/liba/liba.c deleted file mode 100644 index 962d47f..0000000 --- a/test cases/unit/55 dedup compiler libs/liba/liba.c +++ /dev/null @@ -1,18 +0,0 @@ -#include "liba.h" - -static int val; - -void liba_add(int x) -{ - val += x; -} - -void liba_sub(int x) -{ - val -= x; -} - -int liba_get(void) -{ - return val; -} diff --git a/test cases/unit/55 dedup compiler libs/liba/liba.h b/test cases/unit/55 dedup compiler libs/liba/liba.h deleted file mode 100644 index a980cdc..0000000 --- a/test cases/unit/55 dedup compiler libs/liba/liba.h +++ /dev/null @@ -1,8 +0,0 @@ -#ifndef LIBA_H_ -#define LIBA_H_ - -void liba_add(int x); -void liba_sub(int x); -int liba_get(void); - -#endif diff --git a/test cases/unit/55 dedup compiler libs/liba/meson.build b/test cases/unit/55 dedup compiler libs/liba/meson.build deleted file mode 100644 index eccfa46..0000000 --- a/test cases/unit/55 dedup compiler libs/liba/meson.build +++ /dev/null @@ -1,8 +0,0 @@ -deps = [dependency('threads'), cc.find_library('dl'), cc.find_library('m')] - -liba = library('a', 'liba.c', - dependencies: deps) - -liba_dep = declare_dependency(link_with: liba, - include_directories: include_directories('.'), - dependencies: deps) diff --git a/test cases/unit/55 dedup compiler libs/libb/libb.c b/test cases/unit/55 dedup compiler libs/libb/libb.c deleted file mode 100644 index 3720868..0000000 --- a/test cases/unit/55 dedup compiler libs/libb/libb.c +++ /dev/null @@ -1,7 +0,0 @@ -#include -#include "libb.h" - -void libb_mul(int x) -{ - liba_add(liba_get() * (x - 1)); -} diff --git a/test cases/unit/55 dedup compiler libs/libb/libb.h b/test cases/unit/55 dedup compiler libs/libb/libb.h deleted file mode 100644 index 2e4ddd0..0000000 --- a/test cases/unit/55 dedup compiler libs/libb/libb.h +++ /dev/null @@ -1,6 +0,0 @@ -#ifndef _LIBB_H_ -#define _LIBB_H_ - -void libb_mul(int x); - -#endif diff --git a/test cases/unit/55 dedup compiler libs/libb/meson.build b/test cases/unit/55 dedup compiler libs/libb/meson.build deleted file mode 100644 index d59206f..0000000 --- a/test cases/unit/55 dedup compiler libs/libb/meson.build +++ /dev/null @@ -1,6 +0,0 @@ -libb = library('b', 'libb.c', - dependencies: liba_dep) - -libb_dep = declare_dependency(link_with: libb, - include_directories: include_directories('.'), - dependencies: liba_dep) diff --git a/test cases/unit/55 dedup compiler libs/meson.build b/test cases/unit/55 dedup compiler libs/meson.build deleted file mode 100644 index fad0ed5..0000000 --- a/test cases/unit/55 dedup compiler libs/meson.build +++ /dev/null @@ -1,7 +0,0 @@ -project('temp', 'c') - -cc = meson.get_compiler('c') - -subdir('liba') -subdir('libb') -subdir('app') diff --git a/test cases/unit/55 introspect buildoptions/subprojects/projectBad/meson.build b/test cases/unit/55 introspect buildoptions/subprojects/projectBad/meson.build new file mode 100644 index 0000000..4d0aeeb --- /dev/null +++ b/test cases/unit/55 introspect buildoptions/subprojects/projectBad/meson.build @@ -0,0 +1,9 @@ +pfggggaergaeg(sdgrgjgn)aga + +rgqeh +th +thtr +e +tb +tbqebt +tbqebttrtt diff --git a/test cases/unit/55 introspect buildoptions/subprojects/projectBad/meson_options.txt b/test cases/unit/55 introspect buildoptions/subprojects/projectBad/meson_options.txt new file mode 100644 index 0000000..f15d352 --- /dev/null +++ b/test cases/unit/55 introspect buildoptions/subprojects/projectBad/meson_options.txt @@ -0,0 +1 @@ +option('should_not_appear', type: 'integer', min: 0, value: 125) diff --git a/test cases/unit/55 introspection/meson.build b/test cases/unit/55 introspection/meson.build deleted file mode 100644 index 7589f3f..0000000 --- a/test cases/unit/55 introspection/meson.build +++ /dev/null @@ -1,46 +0,0 @@ -project('introspection', ['c', 'cpp'], version: '1.2.3', default_options: ['cpp_std=c++11', 'buildtype=debug']) - -dep1 = dependency('threads') -dep2 = dependency('zlib', required: false) -dep3 = dependency('bugDep1', required: get_option('test_opt1')) - -b1 = get_option('test_opt1') -b2 = get_option('test_opt2') -test_bool = b1 or b2 -test_bool = b1 and b2 - -set_variable('list_test_plusassign', []) -list_test_plusassign += ['bugs everywhere'] - -if false - dependency('somethingthatdoesnotexist', required: true) - dependency('look_i_have_a_fallback', fallback: ['oh_no', 'the_subproject_does_not_exist']) -endif - -subdir('sharedlib') -subdir('staticlib') - -var1 = '1' -var2 = 2.to_string() -var3 = 'test3' - -t1 = executable('test' + var1, ['t1.cpp'], link_with: [sharedlib], install: true, build_by_default: get_option('test_opt2')) -t2 = executable('test@0@'.format('@0@'.format(var2)), sources: ['t2.cpp'], link_with: [staticlib]) -t3 = executable(var3, 't3.cpp', link_with: [sharedlib, staticlib], dependencies: [dep1]) - -### BEGIN: Test inspired by taisei: https://github.com/taisei-project/taisei/blob/master/meson.build#L293 -systype = '@0@'.format(host_machine.system()) -systype = '@0@, @1@, @2@'.format(systype, host_machine.cpu_family(), host_machine.cpu()) -message(systype) -### END: Test inspired by taisei - -# Minimal code version to produce bug #5376 -# Code inspired by https://github.com/mesa3d/mesa/blob/974c4d679c23373dbed386c696e3e3bc1bfa23ae/meson.build#L1341-L1347 -osmesa_lib_name = 'OSMesa' -osmesa_bits = '8' -osmesa_lib_name = osmesa_lib_name + osmesa_bits -message(osmesa_lib_name) # Infinite recursion gets triggered here when the parameter osmesa_lib_name is resolved - -test('test case 1', t1) -test('test case 2', t2) -benchmark('benchmark 1', t3) diff --git a/test cases/unit/55 introspection/meson_options.txt b/test cases/unit/55 introspection/meson_options.txt deleted file mode 100644 index fc5cb4d..0000000 --- a/test cases/unit/55 introspection/meson_options.txt +++ /dev/null @@ -1,2 +0,0 @@ -option('test_opt1', type: 'boolean', value: false, description: 'simple boolean flag') -option('test_opt2', type: 'boolean', value: true, description: 'simple boolean flag') diff --git a/test cases/unit/55 introspection/sharedlib/meson.build b/test cases/unit/55 introspection/sharedlib/meson.build deleted file mode 100644 index 3de3493..0000000 --- a/test cases/unit/55 introspection/sharedlib/meson.build +++ /dev/null @@ -1,2 +0,0 @@ -SRC_shared = ['shared.cpp'] -sharedlib = shared_library('sharedTestLib', SRC_shared) diff --git a/test cases/unit/55 introspection/sharedlib/shared.cpp b/test cases/unit/55 introspection/sharedlib/shared.cpp deleted file mode 100644 index 5030ab7..0000000 --- a/test cases/unit/55 introspection/sharedlib/shared.cpp +++ /dev/null @@ -1,9 +0,0 @@ -#include "shared.hpp" - -void SharedClass::doStuff() { - number++; -} - -int SharedClass::getNumber() const { - return number; -} diff --git a/test cases/unit/55 introspection/sharedlib/shared.hpp b/test cases/unit/55 introspection/sharedlib/shared.hpp deleted file mode 100644 index dc9b2da..0000000 --- a/test cases/unit/55 introspection/sharedlib/shared.hpp +++ /dev/null @@ -1,10 +0,0 @@ -#pragma once - -class SharedClass { - private: - int number = 42; - public: - SharedClass() = default; - void doStuff(); - int getNumber() const; -}; \ No newline at end of file diff --git a/test cases/unit/55 introspection/staticlib/meson.build b/test cases/unit/55 introspection/staticlib/meson.build deleted file mode 100644 index b1b9afe..0000000 --- a/test cases/unit/55 introspection/staticlib/meson.build +++ /dev/null @@ -1,2 +0,0 @@ -SRC_static = ['static.c'] -staticlib = static_library('staticTestLib', SRC_static) diff --git a/test cases/unit/55 introspection/staticlib/static.c b/test cases/unit/55 introspection/staticlib/static.c deleted file mode 100644 index 37ebc0d..0000000 --- a/test cases/unit/55 introspection/staticlib/static.c +++ /dev/null @@ -1,5 +0,0 @@ -#include "static.h" - -int add_numbers(int a, int b) { - return a + b; -} \ No newline at end of file diff --git a/test cases/unit/55 introspection/staticlib/static.h b/test cases/unit/55 introspection/staticlib/static.h deleted file mode 100644 index 506784e..0000000 --- a/test cases/unit/55 introspection/staticlib/static.h +++ /dev/null @@ -1,3 +0,0 @@ -#pragma once - -int add_numbers(int a, int b); \ No newline at end of file diff --git a/test cases/unit/55 introspection/t1.cpp b/test cases/unit/55 introspection/t1.cpp deleted file mode 100644 index 2bcaab8..0000000 --- a/test cases/unit/55 introspection/t1.cpp +++ /dev/null @@ -1,13 +0,0 @@ -#include "sharedlib/shared.hpp" - -int main() { - SharedClass cl1; - if(cl1.getNumber() != 42) { - return 1; - } - cl1.doStuff(); - if(cl1.getNumber() != 43) { - return 2; - } - return 0; -} diff --git a/test cases/unit/55 introspection/t2.cpp b/test cases/unit/55 introspection/t2.cpp deleted file mode 100644 index fee5097..0000000 --- a/test cases/unit/55 introspection/t2.cpp +++ /dev/null @@ -1,8 +0,0 @@ -#include "staticlib/static.h" - -int main() { - if(add_numbers(1, 2) != 3) { - return 1; - } - return 0; -} diff --git a/test cases/unit/55 introspection/t3.cpp b/test cases/unit/55 introspection/t3.cpp deleted file mode 100644 index 8a906e0..0000000 --- a/test cases/unit/55 introspection/t3.cpp +++ /dev/null @@ -1,16 +0,0 @@ -#include "sharedlib/shared.hpp" -#include "staticlib/static.h" - -int main() { - for(int i = 0; i < 1000; add_numbers(i, 1)) { - SharedClass cl1; - if(cl1.getNumber() != 42) { - return 1; - } - cl1.doStuff(); - if(cl1.getNumber() != 43) { - return 2; - } - } - return 0; -} diff --git a/test cases/unit/55 pkg_config_path option/build_extra_path/totally_made_up_dep.pc b/test cases/unit/55 pkg_config_path option/build_extra_path/totally_made_up_dep.pc deleted file mode 100644 index 5b149f6..0000000 --- a/test cases/unit/55 pkg_config_path option/build_extra_path/totally_made_up_dep.pc +++ /dev/null @@ -1,7 +0,0 @@ -prefix=/ -libdir=${prefix}/lib -includedir=${prefix}/include - -Name: totally_made_up_dep -Description: completely and totally made up for a test case -Version: 4.5.6 diff --git a/test cases/unit/55 pkg_config_path option/host_extra_path/totally_made_up_dep.pc b/test cases/unit/55 pkg_config_path option/host_extra_path/totally_made_up_dep.pc deleted file mode 100644 index 6d08687..0000000 --- a/test cases/unit/55 pkg_config_path option/host_extra_path/totally_made_up_dep.pc +++ /dev/null @@ -1,7 +0,0 @@ -prefix=/ -libdir=${prefix}/lib -includedir=${prefix}/include - -Name: totally_made_up_dep -Description: completely and totally made up for a test case -Version: 1.2.3 \ No newline at end of file diff --git a/test cases/unit/55 pkg_config_path option/meson.build b/test cases/unit/55 pkg_config_path option/meson.build deleted file mode 100644 index f9ceead..0000000 --- a/test cases/unit/55 pkg_config_path option/meson.build +++ /dev/null @@ -1,7 +0,0 @@ -project('pkg_config_path option') - -build = dependency('totally_made_up_dep', native: true, method : 'pkg-config') -host = dependency('totally_made_up_dep', native: false, method : 'pkg-config') - -assert(build.version() == '4.5.6', 'wrong version for build machine dependency') -assert(host.version() == '1.2.3', 'wrong version for host machine dependency') diff --git a/test cases/unit/56 dedup compiler libs/app/app.c b/test cases/unit/56 dedup compiler libs/app/app.c new file mode 100644 index 0000000..4e215b3 --- /dev/null +++ b/test cases/unit/56 dedup compiler libs/app/app.c @@ -0,0 +1,13 @@ +#include +#include +#include + +int +main(void) +{ + printf("start value = %d\n", liba_get()); + liba_add(2); + libb_mul(5); + printf("end value = %d\n", liba_get()); + return 0; +} diff --git a/test cases/unit/56 dedup compiler libs/app/meson.build b/test cases/unit/56 dedup compiler libs/app/meson.build new file mode 100644 index 0000000..82ac306 --- /dev/null +++ b/test cases/unit/56 dedup compiler libs/app/meson.build @@ -0,0 +1,2 @@ +executable('app', 'app.c', + dependencies: [liba_dep, libb_dep]) diff --git a/test cases/unit/56 dedup compiler libs/liba/liba.c b/test cases/unit/56 dedup compiler libs/liba/liba.c new file mode 100644 index 0000000..962d47f --- /dev/null +++ b/test cases/unit/56 dedup compiler libs/liba/liba.c @@ -0,0 +1,18 @@ +#include "liba.h" + +static int val; + +void liba_add(int x) +{ + val += x; +} + +void liba_sub(int x) +{ + val -= x; +} + +int liba_get(void) +{ + return val; +} diff --git a/test cases/unit/56 dedup compiler libs/liba/liba.h b/test cases/unit/56 dedup compiler libs/liba/liba.h new file mode 100644 index 0000000..a980cdc --- /dev/null +++ b/test cases/unit/56 dedup compiler libs/liba/liba.h @@ -0,0 +1,8 @@ +#ifndef LIBA_H_ +#define LIBA_H_ + +void liba_add(int x); +void liba_sub(int x); +int liba_get(void); + +#endif diff --git a/test cases/unit/56 dedup compiler libs/liba/meson.build b/test cases/unit/56 dedup compiler libs/liba/meson.build new file mode 100644 index 0000000..eccfa46 --- /dev/null +++ b/test cases/unit/56 dedup compiler libs/liba/meson.build @@ -0,0 +1,8 @@ +deps = [dependency('threads'), cc.find_library('dl'), cc.find_library('m')] + +liba = library('a', 'liba.c', + dependencies: deps) + +liba_dep = declare_dependency(link_with: liba, + include_directories: include_directories('.'), + dependencies: deps) diff --git a/test cases/unit/56 dedup compiler libs/libb/libb.c b/test cases/unit/56 dedup compiler libs/libb/libb.c new file mode 100644 index 0000000..3720868 --- /dev/null +++ b/test cases/unit/56 dedup compiler libs/libb/libb.c @@ -0,0 +1,7 @@ +#include +#include "libb.h" + +void libb_mul(int x) +{ + liba_add(liba_get() * (x - 1)); +} diff --git a/test cases/unit/56 dedup compiler libs/libb/libb.h b/test cases/unit/56 dedup compiler libs/libb/libb.h new file mode 100644 index 0000000..2e4ddd0 --- /dev/null +++ b/test cases/unit/56 dedup compiler libs/libb/libb.h @@ -0,0 +1,6 @@ +#ifndef _LIBB_H_ +#define _LIBB_H_ + +void libb_mul(int x); + +#endif diff --git a/test cases/unit/56 dedup compiler libs/libb/meson.build b/test cases/unit/56 dedup compiler libs/libb/meson.build new file mode 100644 index 0000000..d59206f --- /dev/null +++ b/test cases/unit/56 dedup compiler libs/libb/meson.build @@ -0,0 +1,6 @@ +libb = library('b', 'libb.c', + dependencies: liba_dep) + +libb_dep = declare_dependency(link_with: libb, + include_directories: include_directories('.'), + dependencies: liba_dep) diff --git a/test cases/unit/56 dedup compiler libs/meson.build b/test cases/unit/56 dedup compiler libs/meson.build new file mode 100644 index 0000000..fad0ed5 --- /dev/null +++ b/test cases/unit/56 dedup compiler libs/meson.build @@ -0,0 +1,7 @@ +project('temp', 'c') + +cc = meson.get_compiler('c') + +subdir('liba') +subdir('libb') +subdir('app') diff --git a/test cases/unit/56 introspect buildoptions/c_compiler.py b/test cases/unit/56 introspect buildoptions/c_compiler.py deleted file mode 100644 index c7241e7..0000000 --- a/test cases/unit/56 introspect buildoptions/c_compiler.py +++ /dev/null @@ -1,3 +0,0 @@ -#!/usr/bin/env python3 - -print('c') diff --git a/test cases/unit/56 introspect buildoptions/main.c b/test cases/unit/56 introspect buildoptions/main.c deleted file mode 100644 index ef99ae6..0000000 --- a/test cases/unit/56 introspect buildoptions/main.c +++ /dev/null @@ -1,6 +0,0 @@ -#include - -int main() { - printf("Hello World"); - return 0; -} diff --git a/test cases/unit/56 introspect buildoptions/meson.build b/test cases/unit/56 introspect buildoptions/meson.build deleted file mode 100644 index 8052b5f..0000000 --- a/test cases/unit/56 introspect buildoptions/meson.build +++ /dev/null @@ -1,16 +0,0 @@ -project('introspect buildargs', ['c'], default_options: ['c_std=c11', 'cpp_std=c++14', 'buildtype=release']) - -subA = subproject('projectA') - -target_name = 'MAIN' -target_src = ['main.c'] - -executable(target_name, target_src) - -r = run_command(find_program('c_compiler.py')) -if r.returncode() != 0 - error('FAILED') -endif - -add_languages(r.stdout().strip(), required: true) -add_languages('afgggergearvearghergervergreaergaergasv', required: false) diff --git a/test cases/unit/56 introspect buildoptions/meson_options.txt b/test cases/unit/56 introspect buildoptions/meson_options.txt deleted file mode 100644 index 61f9a8d..0000000 --- a/test cases/unit/56 introspect buildoptions/meson_options.txt +++ /dev/null @@ -1,2 +0,0 @@ -option('max_register_count', type: 'integer', min: 0, value: 125) -option('use_external_fmt', type: 'boolean', value: false) diff --git a/test cases/unit/56 introspect buildoptions/subprojects/evilFile.txt b/test cases/unit/56 introspect buildoptions/subprojects/evilFile.txt deleted file mode 100644 index e69de29..0000000 diff --git a/test cases/unit/56 introspect buildoptions/subprojects/projectA/meson.build b/test cases/unit/56 introspect buildoptions/subprojects/projectA/meson.build deleted file mode 100644 index 1ab9ee8..0000000 --- a/test cases/unit/56 introspect buildoptions/subprojects/projectA/meson.build +++ /dev/null @@ -1,3 +0,0 @@ -project('introspect subproject A', 'c', default_options: ['cpp_std=c++11', 'buildtype=debug']) - -add_languages('cpp') diff --git a/test cases/unit/56 introspect buildoptions/subprojects/projectA/meson_options.txt b/test cases/unit/56 introspect buildoptions/subprojects/projectA/meson_options.txt deleted file mode 100644 index fa77f95..0000000 --- a/test cases/unit/56 introspect buildoptions/subprojects/projectA/meson_options.txt +++ /dev/null @@ -1 +0,0 @@ -option('subproj_var', type: 'boolean', value: false) diff --git a/test cases/unit/56 introspect buildoptions/subprojects/projectBad/meson.build b/test cases/unit/56 introspect buildoptions/subprojects/projectBad/meson.build deleted file mode 100644 index 500c1b9..0000000 --- a/test cases/unit/56 introspect buildoptions/subprojects/projectBad/meson.build +++ /dev/null @@ -1,9 +0,0 @@ -pfggggaergaeg(sdgrgjgn)aga - -rgqeh -th -thtr -e -tb -tbqebt -tbqebttrtt \ No newline at end of file diff --git a/test cases/unit/56 introspect buildoptions/subprojects/projectBad/meson_options.txt b/test cases/unit/56 introspect buildoptions/subprojects/projectBad/meson_options.txt deleted file mode 100644 index f15d352..0000000 --- a/test cases/unit/56 introspect buildoptions/subprojects/projectBad/meson_options.txt +++ /dev/null @@ -1 +0,0 @@ -option('should_not_appear', type: 'integer', min: 0, value: 125) diff --git a/test cases/unit/57 introspection/meson.build b/test cases/unit/57 introspection/meson.build new file mode 100644 index 0000000..7589f3f --- /dev/null +++ b/test cases/unit/57 introspection/meson.build @@ -0,0 +1,46 @@ +project('introspection', ['c', 'cpp'], version: '1.2.3', default_options: ['cpp_std=c++11', 'buildtype=debug']) + +dep1 = dependency('threads') +dep2 = dependency('zlib', required: false) +dep3 = dependency('bugDep1', required: get_option('test_opt1')) + +b1 = get_option('test_opt1') +b2 = get_option('test_opt2') +test_bool = b1 or b2 +test_bool = b1 and b2 + +set_variable('list_test_plusassign', []) +list_test_plusassign += ['bugs everywhere'] + +if false + dependency('somethingthatdoesnotexist', required: true) + dependency('look_i_have_a_fallback', fallback: ['oh_no', 'the_subproject_does_not_exist']) +endif + +subdir('sharedlib') +subdir('staticlib') + +var1 = '1' +var2 = 2.to_string() +var3 = 'test3' + +t1 = executable('test' + var1, ['t1.cpp'], link_with: [sharedlib], install: true, build_by_default: get_option('test_opt2')) +t2 = executable('test@0@'.format('@0@'.format(var2)), sources: ['t2.cpp'], link_with: [staticlib]) +t3 = executable(var3, 't3.cpp', link_with: [sharedlib, staticlib], dependencies: [dep1]) + +### BEGIN: Test inspired by taisei: https://github.com/taisei-project/taisei/blob/master/meson.build#L293 +systype = '@0@'.format(host_machine.system()) +systype = '@0@, @1@, @2@'.format(systype, host_machine.cpu_family(), host_machine.cpu()) +message(systype) +### END: Test inspired by taisei + +# Minimal code version to produce bug #5376 +# Code inspired by https://github.com/mesa3d/mesa/blob/974c4d679c23373dbed386c696e3e3bc1bfa23ae/meson.build#L1341-L1347 +osmesa_lib_name = 'OSMesa' +osmesa_bits = '8' +osmesa_lib_name = osmesa_lib_name + osmesa_bits +message(osmesa_lib_name) # Infinite recursion gets triggered here when the parameter osmesa_lib_name is resolved + +test('test case 1', t1) +test('test case 2', t2) +benchmark('benchmark 1', t3) diff --git a/test cases/unit/57 introspection/meson_options.txt b/test cases/unit/57 introspection/meson_options.txt new file mode 100644 index 0000000..fc5cb4d --- /dev/null +++ b/test cases/unit/57 introspection/meson_options.txt @@ -0,0 +1,2 @@ +option('test_opt1', type: 'boolean', value: false, description: 'simple boolean flag') +option('test_opt2', type: 'boolean', value: true, description: 'simple boolean flag') diff --git a/test cases/unit/57 introspection/sharedlib/meson.build b/test cases/unit/57 introspection/sharedlib/meson.build new file mode 100644 index 0000000..3de3493 --- /dev/null +++ b/test cases/unit/57 introspection/sharedlib/meson.build @@ -0,0 +1,2 @@ +SRC_shared = ['shared.cpp'] +sharedlib = shared_library('sharedTestLib', SRC_shared) diff --git a/test cases/unit/57 introspection/sharedlib/shared.cpp b/test cases/unit/57 introspection/sharedlib/shared.cpp new file mode 100644 index 0000000..5030ab7 --- /dev/null +++ b/test cases/unit/57 introspection/sharedlib/shared.cpp @@ -0,0 +1,9 @@ +#include "shared.hpp" + +void SharedClass::doStuff() { + number++; +} + +int SharedClass::getNumber() const { + return number; +} diff --git a/test cases/unit/57 introspection/sharedlib/shared.hpp b/test cases/unit/57 introspection/sharedlib/shared.hpp new file mode 100644 index 0000000..dc9b2da --- /dev/null +++ b/test cases/unit/57 introspection/sharedlib/shared.hpp @@ -0,0 +1,10 @@ +#pragma once + +class SharedClass { + private: + int number = 42; + public: + SharedClass() = default; + void doStuff(); + int getNumber() const; +}; \ No newline at end of file diff --git a/test cases/unit/57 introspection/staticlib/meson.build b/test cases/unit/57 introspection/staticlib/meson.build new file mode 100644 index 0000000..b1b9afe --- /dev/null +++ b/test cases/unit/57 introspection/staticlib/meson.build @@ -0,0 +1,2 @@ +SRC_static = ['static.c'] +staticlib = static_library('staticTestLib', SRC_static) diff --git a/test cases/unit/57 introspection/staticlib/static.c b/test cases/unit/57 introspection/staticlib/static.c new file mode 100644 index 0000000..37ebc0d --- /dev/null +++ b/test cases/unit/57 introspection/staticlib/static.c @@ -0,0 +1,5 @@ +#include "static.h" + +int add_numbers(int a, int b) { + return a + b; +} \ No newline at end of file diff --git a/test cases/unit/57 introspection/staticlib/static.h b/test cases/unit/57 introspection/staticlib/static.h new file mode 100644 index 0000000..506784e --- /dev/null +++ b/test cases/unit/57 introspection/staticlib/static.h @@ -0,0 +1,3 @@ +#pragma once + +int add_numbers(int a, int b); \ No newline at end of file diff --git a/test cases/unit/57 introspection/t1.cpp b/test cases/unit/57 introspection/t1.cpp new file mode 100644 index 0000000..2bcaab8 --- /dev/null +++ b/test cases/unit/57 introspection/t1.cpp @@ -0,0 +1,13 @@ +#include "sharedlib/shared.hpp" + +int main() { + SharedClass cl1; + if(cl1.getNumber() != 42) { + return 1; + } + cl1.doStuff(); + if(cl1.getNumber() != 43) { + return 2; + } + return 0; +} diff --git a/test cases/unit/57 introspection/t2.cpp b/test cases/unit/57 introspection/t2.cpp new file mode 100644 index 0000000..fee5097 --- /dev/null +++ b/test cases/unit/57 introspection/t2.cpp @@ -0,0 +1,8 @@ +#include "staticlib/static.h" + +int main() { + if(add_numbers(1, 2) != 3) { + return 1; + } + return 0; +} diff --git a/test cases/unit/57 introspection/t3.cpp b/test cases/unit/57 introspection/t3.cpp new file mode 100644 index 0000000..8a906e0 --- /dev/null +++ b/test cases/unit/57 introspection/t3.cpp @@ -0,0 +1,16 @@ +#include "sharedlib/shared.hpp" +#include "staticlib/static.h" + +int main() { + for(int i = 0; i < 1000; add_numbers(i, 1)) { + SharedClass cl1; + if(cl1.getNumber() != 42) { + return 1; + } + cl1.doStuff(); + if(cl1.getNumber() != 43) { + return 2; + } + } + return 0; +} diff --git a/test cases/unit/57 native file override/crossfile b/test cases/unit/57 native file override/crossfile deleted file mode 100644 index 9dc4fbc..0000000 --- a/test cases/unit/57 native file override/crossfile +++ /dev/null @@ -1,16 +0,0 @@ -[paths] -bindir = 'binbar' -datadir = 'databar' -includedir = 'includebar' -infodir = 'infobar' -libdir = 'libbar' -libexecdir = 'libexecbar' -localedir = 'localebar' -localstatedir = 'localstatebar' -mandir = 'manbar' -prefix = '/prefix' -sbindir = 'sbinbar' -sharedstatedir = 'sharedstatebar' -sysconfdir = 'sysconfbar' - -; vim: ft=dosini diff --git a/test cases/unit/57 native file override/crossfile2 b/test cases/unit/57 native file override/crossfile2 deleted file mode 100644 index 70946c9..0000000 --- a/test cases/unit/57 native file override/crossfile2 +++ /dev/null @@ -1,4 +0,0 @@ -[paths] -bindir = 'binbar2' - -; vim: ft=dosini diff --git a/test cases/unit/57 native file override/meson.build b/test cases/unit/57 native file override/meson.build deleted file mode 100644 index 8318aba..0000000 --- a/test cases/unit/57 native file override/meson.build +++ /dev/null @@ -1,10 +0,0 @@ -project('native file overrides') - -foreach o : ['bindir', 'datadir', 'includedir', 'infodir', 'libdir', - 'libexecdir', 'localedir', 'localstatedir', 'mandir', 'prefix', - 'sbindir', 'sharedstatedir', 'sysconfdir'] - expected = get_option('def_' + o) - actual = get_option(o) - assert(expected == actual, - '@0@ should have been @1@, but was @2@!'.format(o, expected, actual)) -endforeach diff --git a/test cases/unit/57 native file override/meson_options.txt b/test cases/unit/57 native file override/meson_options.txt deleted file mode 100644 index 4d2abf9..0000000 --- a/test cases/unit/57 native file override/meson_options.txt +++ /dev/null @@ -1,13 +0,0 @@ -option('def_bindir', type: 'string', value : 'binfoo',) -option('def_datadir', type: 'string', value : 'datafoo',) -option('def_includedir', type: 'string', value : 'includefoo',) -option('def_infodir', type: 'string', value : 'infofoo',) -option('def_libdir', type: 'string', value : 'libfoo',) -option('def_libexecdir', type: 'string', value : 'libexecfoo',) -option('def_localedir', type: 'string', value : 'localefoo',) -option('def_localstatedir', type: 'string', value : 'localstatefoo',) -option('def_mandir', type: 'string', value : 'manfoo',) -option('def_prefix', type: 'string', value : '/prefix',) -option('def_sbindir', type: 'string', value : 'sbinfoo',) -option('def_sharedstatedir', type: 'string', value : 'sharedstatefoo',) -option('def_sysconfdir', type: 'string', value : 'sysconffoo',) diff --git a/test cases/unit/57 native file override/nativefile b/test cases/unit/57 native file override/nativefile deleted file mode 100644 index a390725..0000000 --- a/test cases/unit/57 native file override/nativefile +++ /dev/null @@ -1,16 +0,0 @@ -[paths] -bindir = 'binfoo' -datadir = 'datafoo' -includedir = 'includefoo' -infodir = 'infofoo' -libdir = 'libfoo' -libexecdir = 'libexecfoo' -localedir = 'localefoo' -localstatedir = 'localstatefoo' -mandir = 'manfoo' -prefix = '/prefix' -sbindir = 'sbinfoo' -sharedstatedir = 'sharedstatefoo' -sysconfdir = 'sysconffoo' - -; vim: ft=dosini diff --git a/test cases/unit/58 identity cross/build_wrapper.py b/test cases/unit/58 identity cross/build_wrapper.py deleted file mode 100755 index 22e8b5d..0000000 --- a/test cases/unit/58 identity cross/build_wrapper.py +++ /dev/null @@ -1,5 +0,0 @@ -#!/usr/bin/env python - -import subprocess, sys - -subprocess.call(["cc", "-DEXTERNAL_BUILD"] + sys.argv[1:]) diff --git a/test cases/unit/58 identity cross/host_wrapper.py b/test cases/unit/58 identity cross/host_wrapper.py deleted file mode 100755 index 5b4eed8..0000000 --- a/test cases/unit/58 identity cross/host_wrapper.py +++ /dev/null @@ -1,5 +0,0 @@ -#!/usr/bin/env python - -import subprocess, sys - -subprocess.call(["cc", "-DEXTERNAL_HOST"] + sys.argv[1:]) diff --git a/test cases/unit/58 identity cross/meson.build b/test cases/unit/58 identity cross/meson.build deleted file mode 100644 index 950137a..0000000 --- a/test cases/unit/58 identity cross/meson.build +++ /dev/null @@ -1,15 +0,0 @@ -project('identity cross test', 'c') - -assert(meson.get_compiler('c', native: true).get_define( - 'GOT', - args : [ '-DARG_BUILD' ], - prefix : '#include "stuff.h"', - include_directories: include_directories('.'), -) == 'BUILD', 'did not get BUILD from native: true compiler') - -assert(meson.get_compiler('c', native: false).get_define( - 'GOT', - args : [ '-DARG_HOST' ], - prefix : '#include "stuff.h"', - include_directories: include_directories('.'), -) == 'HOST', 'did not get HOST from native: false compiler') diff --git a/test cases/unit/58 identity cross/stuff.h b/test cases/unit/58 identity cross/stuff.h deleted file mode 100644 index 62f1cc9..0000000 --- a/test cases/unit/58 identity cross/stuff.h +++ /dev/null @@ -1,27 +0,0 @@ -#ifdef EXTERNAL_BUILD - #ifndef ARG_BUILD - #error "External is build but arg_build is not set." - #elif defined(ARG_HOST) - #error "External is build but arg_host is set." - #else - #define GOT BUILD - #endif -#endif - -#ifdef EXTERNAL_HOST - #ifndef ARG_HOST - #error "External is host but arg_host is not set." - #elif defined(ARG_BUILD) - #error "External is host but arg_build is set." - #else - #define GOT HOST - #endif -#endif - -#if defined(EXTERNAL_BUILD) && defined(EXTERNAL_HOST) - #error "Both external build and external host set." -#endif - -#if !defined(EXTERNAL_BUILD) && !defined(EXTERNAL_HOST) - #error "Neither external build nor external host is set." -#endif diff --git a/test cases/unit/58 pkg_config_path option/build_extra_path/totally_made_up_dep.pc b/test cases/unit/58 pkg_config_path option/build_extra_path/totally_made_up_dep.pc new file mode 100644 index 0000000..5b149f6 --- /dev/null +++ b/test cases/unit/58 pkg_config_path option/build_extra_path/totally_made_up_dep.pc @@ -0,0 +1,7 @@ +prefix=/ +libdir=${prefix}/lib +includedir=${prefix}/include + +Name: totally_made_up_dep +Description: completely and totally made up for a test case +Version: 4.5.6 diff --git a/test cases/unit/58 pkg_config_path option/host_extra_path/totally_made_up_dep.pc b/test cases/unit/58 pkg_config_path option/host_extra_path/totally_made_up_dep.pc new file mode 100644 index 0000000..6d08687 --- /dev/null +++ b/test cases/unit/58 pkg_config_path option/host_extra_path/totally_made_up_dep.pc @@ -0,0 +1,7 @@ +prefix=/ +libdir=${prefix}/lib +includedir=${prefix}/include + +Name: totally_made_up_dep +Description: completely and totally made up for a test case +Version: 1.2.3 \ No newline at end of file diff --git a/test cases/unit/58 pkg_config_path option/meson.build b/test cases/unit/58 pkg_config_path option/meson.build new file mode 100644 index 0000000..f9ceead --- /dev/null +++ b/test cases/unit/58 pkg_config_path option/meson.build @@ -0,0 +1,7 @@ +project('pkg_config_path option') + +build = dependency('totally_made_up_dep', native: true, method : 'pkg-config') +host = dependency('totally_made_up_dep', native: false, method : 'pkg-config') + +assert(build.version() == '4.5.6', 'wrong version for build machine dependency') +assert(host.version() == '1.2.3', 'wrong version for host machine dependency') diff --git a/test cases/unit/58 pkgconfig relative paths/pkgconfig/librelativepath.pc b/test cases/unit/58 pkgconfig relative paths/pkgconfig/librelativepath.pc deleted file mode 100644 index dae1eed..0000000 --- a/test cases/unit/58 pkgconfig relative paths/pkgconfig/librelativepath.pc +++ /dev/null @@ -1,9 +0,0 @@ -prefix=../relativepath -exec_prefix=${prefix} -libdir=${exec_prefix}/lib - -Name: Relative path -Description: Relative path library -Version: 0.0.1 -Libs: -L${libdir} -lrelativepath -Cflags: diff --git a/test cases/unit/59 introspect buildoptions/c_compiler.py b/test cases/unit/59 introspect buildoptions/c_compiler.py new file mode 100644 index 0000000..c7241e7 --- /dev/null +++ b/test cases/unit/59 introspect buildoptions/c_compiler.py @@ -0,0 +1,3 @@ +#!/usr/bin/env python3 + +print('c') diff --git a/test cases/unit/59 introspect buildoptions/main.c b/test cases/unit/59 introspect buildoptions/main.c new file mode 100644 index 0000000..ef99ae6 --- /dev/null +++ b/test cases/unit/59 introspect buildoptions/main.c @@ -0,0 +1,6 @@ +#include + +int main() { + printf("Hello World"); + return 0; +} diff --git a/test cases/unit/59 introspect buildoptions/meson.build b/test cases/unit/59 introspect buildoptions/meson.build new file mode 100644 index 0000000..8052b5f --- /dev/null +++ b/test cases/unit/59 introspect buildoptions/meson.build @@ -0,0 +1,16 @@ +project('introspect buildargs', ['c'], default_options: ['c_std=c11', 'cpp_std=c++14', 'buildtype=release']) + +subA = subproject('projectA') + +target_name = 'MAIN' +target_src = ['main.c'] + +executable(target_name, target_src) + +r = run_command(find_program('c_compiler.py')) +if r.returncode() != 0 + error('FAILED') +endif + +add_languages(r.stdout().strip(), required: true) +add_languages('afgggergearvearghergervergreaergaergasv', required: false) diff --git a/test cases/unit/59 introspect buildoptions/meson_options.txt b/test cases/unit/59 introspect buildoptions/meson_options.txt new file mode 100644 index 0000000..61f9a8d --- /dev/null +++ b/test cases/unit/59 introspect buildoptions/meson_options.txt @@ -0,0 +1,2 @@ +option('max_register_count', type: 'integer', min: 0, value: 125) +option('use_external_fmt', type: 'boolean', value: false) diff --git a/test cases/unit/59 introspect buildoptions/subprojects/evilFile.txt b/test cases/unit/59 introspect buildoptions/subprojects/evilFile.txt new file mode 100644 index 0000000..e69de29 diff --git a/test cases/unit/59 introspect buildoptions/subprojects/projectA/meson.build b/test cases/unit/59 introspect buildoptions/subprojects/projectA/meson.build new file mode 100644 index 0000000..1ab9ee8 --- /dev/null +++ b/test cases/unit/59 introspect buildoptions/subprojects/projectA/meson.build @@ -0,0 +1,3 @@ +project('introspect subproject A', 'c', default_options: ['cpp_std=c++11', 'buildtype=debug']) + +add_languages('cpp') diff --git a/test cases/unit/59 introspect buildoptions/subprojects/projectA/meson_options.txt b/test cases/unit/59 introspect buildoptions/subprojects/projectA/meson_options.txt new file mode 100644 index 0000000..fa77f95 --- /dev/null +++ b/test cases/unit/59 introspect buildoptions/subprojects/projectA/meson_options.txt @@ -0,0 +1 @@ +option('subproj_var', type: 'boolean', value: false) diff --git a/test cases/unit/59 introspect buildoptions/subprojects/projectBad/meson.build b/test cases/unit/59 introspect buildoptions/subprojects/projectBad/meson.build new file mode 100644 index 0000000..500c1b9 --- /dev/null +++ b/test cases/unit/59 introspect buildoptions/subprojects/projectBad/meson.build @@ -0,0 +1,9 @@ +pfggggaergaeg(sdgrgjgn)aga + +rgqeh +th +thtr +e +tb +tbqebt +tbqebttrtt \ No newline at end of file diff --git a/test cases/unit/59 introspect buildoptions/subprojects/projectBad/meson_options.txt b/test cases/unit/59 introspect buildoptions/subprojects/projectBad/meson_options.txt new file mode 100644 index 0000000..f15d352 --- /dev/null +++ b/test cases/unit/59 introspect buildoptions/subprojects/projectBad/meson_options.txt @@ -0,0 +1 @@ +option('should_not_appear', type: 'integer', min: 0, value: 125) diff --git a/test cases/unit/59 test env doesn't stack/meson.build b/test cases/unit/59 test env doesn't stack/meson.build deleted file mode 100644 index 01f2637..0000000 --- a/test cases/unit/59 test env doesn't stack/meson.build +++ /dev/null @@ -1,12 +0,0 @@ -project('test env var stacking') - -testenv = environment() -testenv.set('TEST_VAR_SET', 'some-value') -testenv.set('TEST_VAR_APPEND', 'some-value') -testenv.set('TEST_VAR_PREPEND', 'some-value') - -testenv.append('TEST_VAR_APPEND', 'another-value-append', separator: ':') -testenv.prepend('TEST_VAR_PREPEND', 'another-value-prepend', separator: ':') -testenv.set('TEST_VAR_SET', 'another-value-set') - -test('check env', find_program('script.py'), env: testenv) diff --git a/test cases/unit/59 test env doesn't stack/script.py b/test cases/unit/59 test env doesn't stack/script.py deleted file mode 100755 index 2a76673..0000000 --- a/test cases/unit/59 test env doesn't stack/script.py +++ /dev/null @@ -1,9 +0,0 @@ -#!/usr/bin/env python3 - -import os - -for name in ('append', 'prepend', 'set'): - envname = 'TEST_VAR_' + name.upper() - value = 'another-value-' + name - envvalue = os.environ[envname] - assert (envvalue == value), (name, envvalue) diff --git a/test cases/unit/60 cmake_prefix_path/meson.build b/test cases/unit/60 cmake_prefix_path/meson.build deleted file mode 100644 index 442bbd3..0000000 --- a/test cases/unit/60 cmake_prefix_path/meson.build +++ /dev/null @@ -1,4 +0,0 @@ -project('cmake prefix path test') - -d = dependency('mesontest', method : 'cmake') -assert(d.version() == '1.2.3', 'Got the wrong version!') diff --git a/test cases/unit/60 cmake_prefix_path/prefix/lib/cmake/mesontest/mesontest-config.cmake b/test cases/unit/60 cmake_prefix_path/prefix/lib/cmake/mesontest/mesontest-config.cmake deleted file mode 100644 index 289b349..0000000 --- a/test cases/unit/60 cmake_prefix_path/prefix/lib/cmake/mesontest/mesontest-config.cmake +++ /dev/null @@ -1,4 +0,0 @@ -set(MESONTEST_VERSION "1.2.3") -set(MESONTEST_LIBRARIES "foo.so") -set(MESONTEST_INCLUDE_DIR "") -set(MESONTEST_FOUND "TRUE") diff --git a/test cases/unit/60 native file override/crossfile b/test cases/unit/60 native file override/crossfile new file mode 100644 index 0000000..9dc4fbc --- /dev/null +++ b/test cases/unit/60 native file override/crossfile @@ -0,0 +1,16 @@ +[paths] +bindir = 'binbar' +datadir = 'databar' +includedir = 'includebar' +infodir = 'infobar' +libdir = 'libbar' +libexecdir = 'libexecbar' +localedir = 'localebar' +localstatedir = 'localstatebar' +mandir = 'manbar' +prefix = '/prefix' +sbindir = 'sbinbar' +sharedstatedir = 'sharedstatebar' +sysconfdir = 'sysconfbar' + +; vim: ft=dosini diff --git a/test cases/unit/60 native file override/crossfile2 b/test cases/unit/60 native file override/crossfile2 new file mode 100644 index 0000000..70946c9 --- /dev/null +++ b/test cases/unit/60 native file override/crossfile2 @@ -0,0 +1,4 @@ +[paths] +bindir = 'binbar2' + +; vim: ft=dosini diff --git a/test cases/unit/60 native file override/meson.build b/test cases/unit/60 native file override/meson.build new file mode 100644 index 0000000..8318aba --- /dev/null +++ b/test cases/unit/60 native file override/meson.build @@ -0,0 +1,10 @@ +project('native file overrides') + +foreach o : ['bindir', 'datadir', 'includedir', 'infodir', 'libdir', + 'libexecdir', 'localedir', 'localstatedir', 'mandir', 'prefix', + 'sbindir', 'sharedstatedir', 'sysconfdir'] + expected = get_option('def_' + o) + actual = get_option(o) + assert(expected == actual, + '@0@ should have been @1@, but was @2@!'.format(o, expected, actual)) +endforeach diff --git a/test cases/unit/60 native file override/meson_options.txt b/test cases/unit/60 native file override/meson_options.txt new file mode 100644 index 0000000..4d2abf9 --- /dev/null +++ b/test cases/unit/60 native file override/meson_options.txt @@ -0,0 +1,13 @@ +option('def_bindir', type: 'string', value : 'binfoo',) +option('def_datadir', type: 'string', value : 'datafoo',) +option('def_includedir', type: 'string', value : 'includefoo',) +option('def_infodir', type: 'string', value : 'infofoo',) +option('def_libdir', type: 'string', value : 'libfoo',) +option('def_libexecdir', type: 'string', value : 'libexecfoo',) +option('def_localedir', type: 'string', value : 'localefoo',) +option('def_localstatedir', type: 'string', value : 'localstatefoo',) +option('def_mandir', type: 'string', value : 'manfoo',) +option('def_prefix', type: 'string', value : '/prefix',) +option('def_sbindir', type: 'string', value : 'sbinfoo',) +option('def_sharedstatedir', type: 'string', value : 'sharedstatefoo',) +option('def_sysconfdir', type: 'string', value : 'sysconffoo',) diff --git a/test cases/unit/60 native file override/nativefile b/test cases/unit/60 native file override/nativefile new file mode 100644 index 0000000..a390725 --- /dev/null +++ b/test cases/unit/60 native file override/nativefile @@ -0,0 +1,16 @@ +[paths] +bindir = 'binfoo' +datadir = 'datafoo' +includedir = 'includefoo' +infodir = 'infofoo' +libdir = 'libfoo' +libexecdir = 'libexecfoo' +localedir = 'localefoo' +localstatedir = 'localstatefoo' +mandir = 'manfoo' +prefix = '/prefix' +sbindir = 'sbinfoo' +sharedstatedir = 'sharedstatefoo' +sysconfdir = 'sysconffoo' + +; vim: ft=dosini diff --git a/test cases/unit/61 cmake parser/meson.build b/test cases/unit/61 cmake parser/meson.build deleted file mode 100644 index 62b9124..0000000 --- a/test cases/unit/61 cmake parser/meson.build +++ /dev/null @@ -1,19 +0,0 @@ -project('61 cmake parser') - -dep = dependency('mesontest') - -# Test a bunch of variations of the set() command -assert(dep.get_variable(cmake : 'VAR_WITHOUT_SPACES') == 'NoSpaces', 'set() without spaces incorrect') -assert(dep.get_variable(cmake : 'VAR_WITH_SPACES') == 'With Spaces', 'set() with spaces incorrect') - -assert(dep.get_variable(cmake : 'VAR_WITHOUT_SPACES_PS') == 'NoSpaces', 'set(PARENT_SCOPE) without spaces incorrect') -assert(dep.get_variable(cmake : 'VAR_WITH_SPACES_PS') == 'With Spaces', 'set(PARENT_SCOPE) with spaces incorrect') - -assert(dep.get_variable(cmake : 'VAR_THAT_IS_UNSET', default_value : 'sentinal') == 'sentinal', 'set() to unset is incorrect') -assert(dep.get_variable(cmake : 'CACHED_STRING_NS') == 'foo', 'set(CACHED) without spaces is incorrect') -assert(dep.get_variable(cmake : 'CACHED_STRING_WS') == 'foo bar', 'set(CACHED STRING) with spaces is incorrect') -assert(dep.get_variable(cmake : 'CACHED_STRING_ARRAY_NS') == ['foo', 'bar'], 'set(CACHED STRING) without spaces is incorrect') -assert(dep.get_variable(cmake : 'CACHED_STRING_ARRAY_WS') == ['foo', 'foo bar', 'bar'], 'set(CACHED STRING[]) with spaces is incorrect') - -# We don't suppor this, so it should be unset. -assert(dep.get_variable(cmake : 'ENV{var}', default_value : 'sentinal') == 'sentinal', 'set(ENV) should be ignored') \ No newline at end of file diff --git a/test cases/unit/61 cmake parser/prefix/lib/cmake/mesontest/mesontest-config.cmake b/test cases/unit/61 cmake parser/prefix/lib/cmake/mesontest/mesontest-config.cmake deleted file mode 100644 index 7474eb7..0000000 --- a/test cases/unit/61 cmake parser/prefix/lib/cmake/mesontest/mesontest-config.cmake +++ /dev/null @@ -1,63 +0,0 @@ -# This should be enough to satisfy the basic parser -set(MESONTEST_VERSION "1.2.3") -set(MESONTEST_LIBRARIES "foo.so") -set(MESONTEST_INCLUDE_DIR "") -set(MESONTEST_FOUND "TRUE") - -## Tests for set() in its various forms - -# Basic usage -set(VAR_WITHOUT_SPACES "NoSpaces") -set(VAR_WITH_SPACES "With Spaces") - -# test of PARENT_SCOPE, requires a function to have a parent scope obviously... -function(foo) - set(VAR_WITHOUT_SPACES_PS "NoSpaces" PARENT_SCOPE) - set(VAR_WITH_SPACES_PS "With Spaces" PARENT_SCOPE) -endfunction(foo) -foo() - -# Using set() to unset values -set(VAR_THAT_IS_UNSET "foo") -set(VAR_THAT_IS_UNSET) - -# The more advanced form that uses CACHE -# XXX: Why don't we read the type and use that instead of always treat things as strings? -set(CACHED_STRING_NS "foo" CACHE STRING "docstring") -set(CACHED_STRING_WS "foo bar" CACHE STRING "docstring") -set(CACHED_STRING_ARRAY_NS "foo;bar" CACHE STRING "doc string") -set(CACHED_STRING_ARRAY_WS "foo;foo bar;bar" CACHE STRING "stuff" FORCE) - -set(CACHED_BOOL ON CACHE BOOL "docstring") - -set(CACHED_PATH_NS "foo/bar" CACHE PATH "docstring") -set(CACHED_PATH_WS "foo bar/fin" CACHE PATH "docstring") - -set(CACHED_FILEPATH_NS "foo/bar.txt" CACHE FILEPATH "docstring") -set(CACHED_FILEPATH_WS "foo bar/fin.txt" CACHE FILEPATH "docstring") - -# Set ENV, we don't support this so it shouldn't be showing up -set(ENV{var}, "foo") - - -## Tests for set_properties() -# We need something to attach properties too -add_custom_target(MESONTEST_FOO ALL) - -set_property(TARGET MESONTEST_FOO PROPERTY FOLDER "value") -set_property(TARGET MESONTEST_FOO APPEND PROPERTY FOLDER "name") -set_property(TARGET MESONTEST_FOO PROPERTY FOLDER "value") -set_property(TARGET MESONTEST_FOO APPEND_STRING PROPERTY FOLDER "name") - -set_property(TARGET MESONTEST_FOO PROPERTY FOLDER "value space") -set_property(TARGET MESONTEST_FOO PROPERTY FOLDER "value space") -set_property(TARGET MESONTEST_FOO APPEND PROPERTY FOLDER "name space") -set_property(TARGET MESONTEST_FOO PROPERTY FOLDER "value space") -set_property(TARGET MESONTEST_FOO APPEND_STRING PROPERTY FOLDER "name space") - -## Tests for set_target_properties() -set_target_properties(MESONTEST_FOO PROPERTIES FOLDER "value") -set_target_properties(MESONTEST_FOO PROPERTIES FOLDER "value space") -set_target_properties(MESONTEST_FOO PROPERTIES FOLDER "value" OUTPUT_NAME "another value") -set_target_properties(MESONTEST_FOO PROPERTIES FOLDER "value space" OUTPUT_NAME "another value") -set_target_properties(MESONTEST_FOO PROPERTIES FOLDER "value space" OUTPUT_NAME "value") \ No newline at end of file diff --git a/test cases/unit/61 identity cross/build_wrapper.py b/test cases/unit/61 identity cross/build_wrapper.py new file mode 100755 index 0000000..22e8b5d --- /dev/null +++ b/test cases/unit/61 identity cross/build_wrapper.py @@ -0,0 +1,5 @@ +#!/usr/bin/env python + +import subprocess, sys + +subprocess.call(["cc", "-DEXTERNAL_BUILD"] + sys.argv[1:]) diff --git a/test cases/unit/61 identity cross/host_wrapper.py b/test cases/unit/61 identity cross/host_wrapper.py new file mode 100755 index 0000000..5b4eed8 --- /dev/null +++ b/test cases/unit/61 identity cross/host_wrapper.py @@ -0,0 +1,5 @@ +#!/usr/bin/env python + +import subprocess, sys + +subprocess.call(["cc", "-DEXTERNAL_HOST"] + sys.argv[1:]) diff --git a/test cases/unit/61 identity cross/meson.build b/test cases/unit/61 identity cross/meson.build new file mode 100644 index 0000000..950137a --- /dev/null +++ b/test cases/unit/61 identity cross/meson.build @@ -0,0 +1,15 @@ +project('identity cross test', 'c') + +assert(meson.get_compiler('c', native: true).get_define( + 'GOT', + args : [ '-DARG_BUILD' ], + prefix : '#include "stuff.h"', + include_directories: include_directories('.'), +) == 'BUILD', 'did not get BUILD from native: true compiler') + +assert(meson.get_compiler('c', native: false).get_define( + 'GOT', + args : [ '-DARG_HOST' ], + prefix : '#include "stuff.h"', + include_directories: include_directories('.'), +) == 'HOST', 'did not get HOST from native: false compiler') diff --git a/test cases/unit/61 identity cross/stuff.h b/test cases/unit/61 identity cross/stuff.h new file mode 100644 index 0000000..62f1cc9 --- /dev/null +++ b/test cases/unit/61 identity cross/stuff.h @@ -0,0 +1,27 @@ +#ifdef EXTERNAL_BUILD + #ifndef ARG_BUILD + #error "External is build but arg_build is not set." + #elif defined(ARG_HOST) + #error "External is build but arg_host is set." + #else + #define GOT BUILD + #endif +#endif + +#ifdef EXTERNAL_HOST + #ifndef ARG_HOST + #error "External is host but arg_host is not set." + #elif defined(ARG_BUILD) + #error "External is host but arg_build is set." + #else + #define GOT HOST + #endif +#endif + +#if defined(EXTERNAL_BUILD) && defined(EXTERNAL_HOST) + #error "Both external build and external host set." +#endif + +#if !defined(EXTERNAL_BUILD) && !defined(EXTERNAL_HOST) + #error "Neither external build nor external host is set." +#endif diff --git a/test cases/unit/62 alias target/main.c b/test cases/unit/62 alias target/main.c deleted file mode 100644 index 0fb4389..0000000 --- a/test cases/unit/62 alias target/main.c +++ /dev/null @@ -1,3 +0,0 @@ -int main(int argc, char *argv[]) { - return 0; -} diff --git a/test cases/unit/62 alias target/meson.build b/test cases/unit/62 alias target/meson.build deleted file mode 100644 index 6934cc7..0000000 --- a/test cases/unit/62 alias target/meson.build +++ /dev/null @@ -1,15 +0,0 @@ -project('alias target', 'c') - -python3 = import('python').find_installation() - -exe_target = executable('prog', 'main.c', - build_by_default : false) - -custom_target = custom_target('custom-target', - output : 'hello.txt', - command : [python3, '-c', 'print("hello")'], - capture : true, - build_by_default : false -) - -alias_target('build-all', [exe_target, custom_target]) diff --git a/test cases/unit/62 pkgconfig relative paths/pkgconfig/librelativepath.pc b/test cases/unit/62 pkgconfig relative paths/pkgconfig/librelativepath.pc new file mode 100644 index 0000000..dae1eed --- /dev/null +++ b/test cases/unit/62 pkgconfig relative paths/pkgconfig/librelativepath.pc @@ -0,0 +1,9 @@ +prefix=../relativepath +exec_prefix=${prefix} +libdir=${exec_prefix}/lib + +Name: Relative path +Description: Relative path library +Version: 0.0.1 +Libs: -L${libdir} -lrelativepath +Cflags: diff --git a/test cases/unit/63 test env does not stack/meson.build b/test cases/unit/63 test env does not stack/meson.build new file mode 100644 index 0000000..01f2637 --- /dev/null +++ b/test cases/unit/63 test env does not stack/meson.build @@ -0,0 +1,12 @@ +project('test env var stacking') + +testenv = environment() +testenv.set('TEST_VAR_SET', 'some-value') +testenv.set('TEST_VAR_APPEND', 'some-value') +testenv.set('TEST_VAR_PREPEND', 'some-value') + +testenv.append('TEST_VAR_APPEND', 'another-value-append', separator: ':') +testenv.prepend('TEST_VAR_PREPEND', 'another-value-prepend', separator: ':') +testenv.set('TEST_VAR_SET', 'another-value-set') + +test('check env', find_program('script.py'), env: testenv) diff --git a/test cases/unit/63 test env does not stack/script.py b/test cases/unit/63 test env does not stack/script.py new file mode 100755 index 0000000..2a76673 --- /dev/null +++ b/test cases/unit/63 test env does not stack/script.py @@ -0,0 +1,9 @@ +#!/usr/bin/env python3 + +import os + +for name in ('append', 'prepend', 'set'): + envname = 'TEST_VAR_' + name.upper() + value = 'another-value-' + name + envvalue = os.environ[envname] + assert (envvalue == value), (name, envvalue) diff --git a/test cases/unit/64 cmake_prefix_path/meson.build b/test cases/unit/64 cmake_prefix_path/meson.build new file mode 100644 index 0000000..442bbd3 --- /dev/null +++ b/test cases/unit/64 cmake_prefix_path/meson.build @@ -0,0 +1,4 @@ +project('cmake prefix path test') + +d = dependency('mesontest', method : 'cmake') +assert(d.version() == '1.2.3', 'Got the wrong version!') diff --git a/test cases/unit/64 cmake_prefix_path/prefix/lib/cmake/mesontest/mesontest-config.cmake b/test cases/unit/64 cmake_prefix_path/prefix/lib/cmake/mesontest/mesontest-config.cmake new file mode 100644 index 0000000..289b349 --- /dev/null +++ b/test cases/unit/64 cmake_prefix_path/prefix/lib/cmake/mesontest/mesontest-config.cmake @@ -0,0 +1,4 @@ +set(MESONTEST_VERSION "1.2.3") +set(MESONTEST_LIBRARIES "foo.so") +set(MESONTEST_INCLUDE_DIR "") +set(MESONTEST_FOUND "TRUE") diff --git a/test cases/unit/65 cmake parser/meson.build b/test cases/unit/65 cmake parser/meson.build new file mode 100644 index 0000000..62b9124 --- /dev/null +++ b/test cases/unit/65 cmake parser/meson.build @@ -0,0 +1,19 @@ +project('61 cmake parser') + +dep = dependency('mesontest') + +# Test a bunch of variations of the set() command +assert(dep.get_variable(cmake : 'VAR_WITHOUT_SPACES') == 'NoSpaces', 'set() without spaces incorrect') +assert(dep.get_variable(cmake : 'VAR_WITH_SPACES') == 'With Spaces', 'set() with spaces incorrect') + +assert(dep.get_variable(cmake : 'VAR_WITHOUT_SPACES_PS') == 'NoSpaces', 'set(PARENT_SCOPE) without spaces incorrect') +assert(dep.get_variable(cmake : 'VAR_WITH_SPACES_PS') == 'With Spaces', 'set(PARENT_SCOPE) with spaces incorrect') + +assert(dep.get_variable(cmake : 'VAR_THAT_IS_UNSET', default_value : 'sentinal') == 'sentinal', 'set() to unset is incorrect') +assert(dep.get_variable(cmake : 'CACHED_STRING_NS') == 'foo', 'set(CACHED) without spaces is incorrect') +assert(dep.get_variable(cmake : 'CACHED_STRING_WS') == 'foo bar', 'set(CACHED STRING) with spaces is incorrect') +assert(dep.get_variable(cmake : 'CACHED_STRING_ARRAY_NS') == ['foo', 'bar'], 'set(CACHED STRING) without spaces is incorrect') +assert(dep.get_variable(cmake : 'CACHED_STRING_ARRAY_WS') == ['foo', 'foo bar', 'bar'], 'set(CACHED STRING[]) with spaces is incorrect') + +# We don't suppor this, so it should be unset. +assert(dep.get_variable(cmake : 'ENV{var}', default_value : 'sentinal') == 'sentinal', 'set(ENV) should be ignored') \ No newline at end of file diff --git a/test cases/unit/65 cmake parser/prefix/lib/cmake/mesontest/mesontest-config.cmake b/test cases/unit/65 cmake parser/prefix/lib/cmake/mesontest/mesontest-config.cmake new file mode 100644 index 0000000..7474eb7 --- /dev/null +++ b/test cases/unit/65 cmake parser/prefix/lib/cmake/mesontest/mesontest-config.cmake @@ -0,0 +1,63 @@ +# This should be enough to satisfy the basic parser +set(MESONTEST_VERSION "1.2.3") +set(MESONTEST_LIBRARIES "foo.so") +set(MESONTEST_INCLUDE_DIR "") +set(MESONTEST_FOUND "TRUE") + +## Tests for set() in its various forms + +# Basic usage +set(VAR_WITHOUT_SPACES "NoSpaces") +set(VAR_WITH_SPACES "With Spaces") + +# test of PARENT_SCOPE, requires a function to have a parent scope obviously... +function(foo) + set(VAR_WITHOUT_SPACES_PS "NoSpaces" PARENT_SCOPE) + set(VAR_WITH_SPACES_PS "With Spaces" PARENT_SCOPE) +endfunction(foo) +foo() + +# Using set() to unset values +set(VAR_THAT_IS_UNSET "foo") +set(VAR_THAT_IS_UNSET) + +# The more advanced form that uses CACHE +# XXX: Why don't we read the type and use that instead of always treat things as strings? +set(CACHED_STRING_NS "foo" CACHE STRING "docstring") +set(CACHED_STRING_WS "foo bar" CACHE STRING "docstring") +set(CACHED_STRING_ARRAY_NS "foo;bar" CACHE STRING "doc string") +set(CACHED_STRING_ARRAY_WS "foo;foo bar;bar" CACHE STRING "stuff" FORCE) + +set(CACHED_BOOL ON CACHE BOOL "docstring") + +set(CACHED_PATH_NS "foo/bar" CACHE PATH "docstring") +set(CACHED_PATH_WS "foo bar/fin" CACHE PATH "docstring") + +set(CACHED_FILEPATH_NS "foo/bar.txt" CACHE FILEPATH "docstring") +set(CACHED_FILEPATH_WS "foo bar/fin.txt" CACHE FILEPATH "docstring") + +# Set ENV, we don't support this so it shouldn't be showing up +set(ENV{var}, "foo") + + +## Tests for set_properties() +# We need something to attach properties too +add_custom_target(MESONTEST_FOO ALL) + +set_property(TARGET MESONTEST_FOO PROPERTY FOLDER "value") +set_property(TARGET MESONTEST_FOO APPEND PROPERTY FOLDER "name") +set_property(TARGET MESONTEST_FOO PROPERTY FOLDER "value") +set_property(TARGET MESONTEST_FOO APPEND_STRING PROPERTY FOLDER "name") + +set_property(TARGET MESONTEST_FOO PROPERTY FOLDER "value space") +set_property(TARGET MESONTEST_FOO PROPERTY FOLDER "value space") +set_property(TARGET MESONTEST_FOO APPEND PROPERTY FOLDER "name space") +set_property(TARGET MESONTEST_FOO PROPERTY FOLDER "value space") +set_property(TARGET MESONTEST_FOO APPEND_STRING PROPERTY FOLDER "name space") + +## Tests for set_target_properties() +set_target_properties(MESONTEST_FOO PROPERTIES FOLDER "value") +set_target_properties(MESONTEST_FOO PROPERTIES FOLDER "value space") +set_target_properties(MESONTEST_FOO PROPERTIES FOLDER "value" OUTPUT_NAME "another value") +set_target_properties(MESONTEST_FOO PROPERTIES FOLDER "value space" OUTPUT_NAME "another value") +set_target_properties(MESONTEST_FOO PROPERTIES FOLDER "value space" OUTPUT_NAME "value") \ No newline at end of file diff --git a/test cases/unit/66 alias target/main.c b/test cases/unit/66 alias target/main.c new file mode 100644 index 0000000..0fb4389 --- /dev/null +++ b/test cases/unit/66 alias target/main.c @@ -0,0 +1,3 @@ +int main(int argc, char *argv[]) { + return 0; +} diff --git a/test cases/unit/66 alias target/meson.build b/test cases/unit/66 alias target/meson.build new file mode 100644 index 0000000..6934cc7 --- /dev/null +++ b/test cases/unit/66 alias target/meson.build @@ -0,0 +1,15 @@ +project('alias target', 'c') + +python3 = import('python').find_installation() + +exe_target = executable('prog', 'main.c', + build_by_default : false) + +custom_target = custom_target('custom-target', + output : 'hello.txt', + command : [python3, '-c', 'print("hello")'], + capture : true, + build_by_default : false +) + +alias_target('build-all', [exe_target, custom_target]) -- cgit v1.1