From e75e3976facda7de244fbb9a02eebf0d043ea1c8 Mon Sep 17 00:00:00 2001 From: Jussi Pakkanen Date: Mon, 26 Apr 2021 16:52:13 +0300 Subject: Condense test directory names. --- run_unittests.py | 204 ++++++++++----------- .../common/100 postconf with args/meson.build | 10 + .../common/100 postconf with args/postconf.py | 18 ++ test cases/common/100 postconf with args/prog.c | 5 + test cases/common/100 postconf with args/raw.dat | 1 + test cases/common/100 postconf/meson.build | 5 - test cases/common/100 postconf/postconf.py | 16 -- test cases/common/100 postconf/prog.c | 5 - test cases/common/100 postconf/raw.dat | 1 - .../common/101 postconf with args/meson.build | 10 - .../common/101 postconf with args/postconf.py | 18 -- test cases/common/101 postconf with args/prog.c | 5 - test cases/common/101 postconf with args/raw.dat | 1 - .../common/101 testframework options/meson.build | 8 + .../101 testframework options/meson_options.txt | 3 + .../common/101 testframework options/test.json | 10 + test cases/common/102 extract same name/lib.c | 3 + test cases/common/102 extract same name/main.c | 6 + .../common/102 extract same name/meson.build | 19 ++ test cases/common/102 extract same name/src/lib.c | 3 + .../common/102 testframework options/meson.build | 8 - .../102 testframework options/meson_options.txt | 3 - .../common/102 testframework options/test.json | 10 - test cases/common/103 extract same name/lib.c | 3 - test cases/common/103 extract same name/main.c | 6 - .../common/103 extract same name/meson.build | 19 -- test cases/common/103 extract same name/src/lib.c | 3 - .../common/103 has header symbol/meson.build | 36 ++++ test cases/common/104 has arg/meson.build | 60 ++++++ .../common/104 has header symbol/meson.build | 36 ---- test cases/common/105 generatorcustom/catter.py | 14 ++ test cases/common/105 generatorcustom/gen-resx.py | 9 + test cases/common/105 generatorcustom/gen.py | 13 ++ test cases/common/105 generatorcustom/main.c | 8 + test cases/common/105 generatorcustom/meson.build | 28 +++ test cases/common/105 generatorcustom/res1.txt | 1 + test cases/common/105 generatorcustom/res2.txt | 1 + test cases/common/105 has arg/meson.build | 60 ------ test cases/common/106 generatorcustom/catter.py | 14 -- test cases/common/106 generatorcustom/gen-resx.py | 9 - test cases/common/106 generatorcustom/gen.py | 13 -- test cases/common/106 generatorcustom/main.c | 8 - test cases/common/106 generatorcustom/meson.build | 28 --- test cases/common/106 generatorcustom/res1.txt | 1 - test cases/common/106 generatorcustom/res2.txt | 1 - .../106 multiple dir configure file/meson.build | 11 ++ .../106 multiple dir configure file/subdir/foo.txt | 0 .../subdir/meson.build | 11 ++ .../subdir/someinput.in | 0 .../107 multiple dir configure file/meson.build | 11 -- .../107 multiple dir configure file/subdir/foo.txt | 0 .../subdir/meson.build | 11 -- .../subdir/someinput.in | 0 .../107 spaces backslash/asm output/meson.build | 2 + .../107 spaces backslash/comparer-end-notstring.c | 20 ++ .../common/107 spaces backslash/comparer-end.c | 16 ++ test cases/common/107 spaces backslash/comparer.c | 16 ++ .../common/107 spaces backslash/include/comparer.h | 4 + test cases/common/107 spaces backslash/meson.build | 28 +++ .../108 spaces backslash/asm output/meson.build | 2 - .../108 spaces backslash/comparer-end-notstring.c | 20 -- .../common/108 spaces backslash/comparer-end.c | 16 -- test cases/common/108 spaces backslash/comparer.c | 16 -- .../common/108 spaces backslash/include/comparer.h | 4 - test cases/common/108 spaces backslash/meson.build | 28 --- test cases/common/108 ternary/meson.build | 12 ++ .../109 custom target capture/data_source.txt | 1 + .../common/109 custom target capture/meson.build | 24 +++ .../109 custom target capture/my_compiler.py | 14 ++ .../common/109 custom target capture/test.json | 5 + test cases/common/109 ternary/meson.build | 12 -- test cases/common/110 allgenerate/converter.py | 8 + test cases/common/110 allgenerate/foobar.cpp.in | 6 + test cases/common/110 allgenerate/meson.build | 20 ++ .../110 custom target capture/data_source.txt | 1 - .../common/110 custom target capture/meson.build | 24 --- .../110 custom target capture/my_compiler.py | 14 -- .../common/110 custom target capture/test.json | 5 - test cases/common/111 allgenerate/converter.py | 8 - test cases/common/111 allgenerate/foobar.cpp.in | 6 - test cases/common/111 allgenerate/meson.build | 20 -- test cases/common/111 pathjoin/meson.build | 24 +++ test cases/common/112 pathjoin/meson.build | 24 --- .../common/112 subdir subproject/meson.build | 2 + .../common/112 subdir subproject/prog/meson.build | 5 + .../common/112 subdir subproject/prog/prog.c | 5 + .../subprojects/sub/meson.build | 3 + .../112 subdir subproject/subprojects/sub/sub.c | 5 + .../112 subdir subproject/subprojects/sub/sub.h | 6 + .../meson.build | 20 ++ .../common/113 subdir subproject/meson.build | 2 - .../common/113 subdir subproject/prog/meson.build | 5 - .../common/113 subdir subproject/prog/prog.c | 5 - .../subprojects/sub/meson.build | 3 - .../113 subdir subproject/subprojects/sub/sub.c | 5 - .../113 subdir subproject/subprojects/sub/sub.h | 6 - .../meson.build | 20 -- test cases/common/114 skip/meson.build | 4 + test cases/common/115 skip/meson.build | 4 - .../common/115 subproject project arguments/exe.c | 27 +++ .../115 subproject project arguments/exe.cpp | 28 +++ .../115 subproject project arguments/meson.build | 17 ++ .../subprojects/subexe/meson.build | 13 ++ .../subprojects/subexe/subexe.c | 27 +++ .../common/116 subproject project arguments/exe.c | 27 --- .../116 subproject project arguments/exe.cpp | 28 --- .../116 subproject project arguments/meson.build | 17 -- .../subprojects/subexe/meson.build | 13 -- .../subprojects/subexe/subexe.c | 27 --- test cases/common/116 test skip/meson.build | 4 + test cases/common/116 test skip/test_skip.c | 3 + test cases/common/117 shared module/meson.build | 40 ++++ test cases/common/117 shared module/module.c | 96 ++++++++++ test cases/common/117 shared module/nosyms.c | 4 + test cases/common/117 shared module/prog.c | 103 +++++++++++ test cases/common/117 shared module/runtime.c | 19 ++ test cases/common/117 shared module/test.json | 7 + test cases/common/117 test skip/meson.build | 4 - test cases/common/117 test skip/test_skip.c | 3 - test cases/common/118 llvm ir and assembly/main.c | 13 ++ .../common/118 llvm ir and assembly/main.cpp | 15 ++ .../common/118 llvm ir and assembly/meson.build | 79 ++++++++ .../118 llvm ir and assembly/square-aarch64.S | 29 +++ .../common/118 llvm ir and assembly/square-arm.S | 29 +++ .../common/118 llvm ir and assembly/square-x86.S | 36 ++++ .../118 llvm ir and assembly/square-x86_64.S | 37 ++++ .../common/118 llvm ir and assembly/square.ll | 4 + .../118 llvm ir and assembly/symbol-underscore.h | 5 + test cases/common/118 shared module/meson.build | 40 ---- test cases/common/118 shared module/module.c | 96 ---------- test cases/common/118 shared module/nosyms.c | 4 - test cases/common/118 shared module/prog.c | 103 ----------- test cases/common/118 shared module/runtime.c | 19 -- test cases/common/118 shared module/test.json | 7 - test cases/common/119 cpp and asm/meson.build | 33 ++++ test cases/common/119 cpp and asm/retval-arm.S | 11 ++ test cases/common/119 cpp and asm/retval-x86.S | 11 ++ test cases/common/119 cpp and asm/retval-x86_64.S | 11 ++ .../common/119 cpp and asm/symbol-underscore.h | 5 + test cases/common/119 cpp and asm/trivial.cc | 16 ++ test cases/common/119 llvm ir and assembly/main.c | 13 -- .../common/119 llvm ir and assembly/main.cpp | 15 -- .../common/119 llvm ir and assembly/meson.build | 79 -------- .../119 llvm ir and assembly/square-aarch64.S | 29 --- .../common/119 llvm ir and assembly/square-arm.S | 29 --- .../common/119 llvm ir and assembly/square-x86.S | 36 ---- .../119 llvm ir and assembly/square-x86_64.S | 37 ---- .../common/119 llvm ir and assembly/square.ll | 4 - .../119 llvm ir and assembly/symbol-underscore.h | 5 - test cases/common/120 cpp and asm/meson.build | 33 ---- test cases/common/120 cpp and asm/retval-arm.S | 11 -- test cases/common/120 cpp and asm/retval-x86.S | 11 -- test cases/common/120 cpp and asm/retval-x86_64.S | 11 -- .../common/120 cpp and asm/symbol-underscore.h | 5 - test cases/common/120 cpp and asm/trivial.cc | 16 -- .../120 extract all shared library/extractor.h | 6 + .../common/120 extract all shared library/four.c | 5 + .../120 extract all shared library/func1234.def | 5 + .../120 extract all shared library/meson.build | 14 ++ .../common/120 extract all shared library/one.c | 5 + .../common/120 extract all shared library/prog.c | 10 + .../common/120 extract all shared library/three.c | 5 + .../common/120 extract all shared library/two.c | 5 + .../121 extract all shared library/extractor.h | 6 - .../common/121 extract all shared library/four.c | 5 - .../121 extract all shared library/func1234.def | 5 - .../121 extract all shared library/meson.build | 14 -- .../common/121 extract all shared library/one.c | 5 - .../common/121 extract all shared library/prog.c | 10 - .../common/121 extract all shared library/three.c | 5 - .../common/121 extract all shared library/two.c | 5 - .../common/121 object only target/meson.build | 49 +++++ .../common/121 object only target/obj_generator.py | 20 ++ test cases/common/121 object only target/prog.c | 7 + test cases/common/121 object only target/source.c | 3 + test cases/common/121 object only target/source2.c | 3 + .../common/121 object only target/source2.def | 2 + test cases/common/121 object only target/source3.c | 3 + test cases/common/121 object only target/test.json | 6 + .../common/122 no buildincdir/include/header.h | 3 + test cases/common/122 no buildincdir/meson.build | 14 ++ test cases/common/122 no buildincdir/prog.c | 5 + .../common/122 object only target/meson.build | 49 ----- .../common/122 object only target/obj_generator.py | 20 -- test cases/common/122 object only target/prog.c | 7 - test cases/common/122 object only target/source.c | 3 - test cases/common/122 object only target/source2.c | 3 - .../common/122 object only target/source2.def | 2 - test cases/common/122 object only target/source3.c | 3 - test cases/common/122 object only target/test.json | 6 - .../123 custom target directory install/docgen.py | 15 ++ .../meson.build | 9 + .../123 custom target directory install/test.json | 7 + .../common/123 no buildincdir/include/header.h | 3 - test cases/common/123 no buildincdir/meson.build | 14 -- test cases/common/123 no buildincdir/prog.c | 5 - .../124 custom target directory install/docgen.py | 15 -- .../meson.build | 9 - .../124 custom target directory install/test.json | 7 - .../common/124 dependency file generation/main .c | 3 + .../124 dependency file generation/meson.build | 14 ++ .../inc/confdata.in | 1 + .../inc/meson.build | 6 + .../125 configure file in generator/meson.build | 4 + .../125 configure file in generator/src/gen.py | 13 ++ .../125 configure file in generator/src/main.c | 17 ++ .../src/meson.build | 7 + .../125 configure file in generator/src/source | 1 + .../common/125 dependency file generation/main .c | 3 - .../125 dependency file generation/meson.build | 14 -- .../inc/confdata.in | 1 - .../inc/meson.build | 6 - .../126 configure file in generator/meson.build | 4 - .../126 configure file in generator/src/gen.py | 13 -- .../126 configure file in generator/src/main.c | 17 -- .../src/meson.build | 7 - .../126 configure file in generator/src/source | 1 - .../common/126 generated llvm ir/copyfile.py | 6 + test cases/common/126 generated llvm ir/main.c | 13 ++ .../common/126 generated llvm ir/meson.build | 28 +++ .../common/126 generated llvm ir/square.ll.in | 4 + .../common/127 generated assembly/copyfile.py | 6 + test cases/common/127 generated assembly/empty.c | 0 test cases/common/127 generated assembly/main.c | 16 ++ .../common/127 generated assembly/meson.build | 70 +++++++ .../common/127 generated assembly/square-arm.S.in | 13 ++ .../common/127 generated assembly/square-x86.S.in | 34 ++++ .../127 generated assembly/square-x86_64.S.in | 38 ++++ .../common/127 generated assembly/square.def | 2 + .../127 generated assembly/symbol-underscore.h | 5 + .../common/127 generated llvm ir/copyfile.py | 6 - test cases/common/127 generated llvm ir/main.c | 13 -- .../common/127 generated llvm ir/meson.build | 28 --- .../common/127 generated llvm ir/square.ll.in | 4 - .../128 build by default targets in tests/main.c | 3 + .../meson.build | 23 +++ .../write_file.py | 6 + .../common/128 generated assembly/copyfile.py | 6 - test cases/common/128 generated assembly/empty.c | 0 test cases/common/128 generated assembly/main.c | 16 -- .../common/128 generated assembly/meson.build | 70 ------- .../common/128 generated assembly/square-arm.S.in | 13 -- .../common/128 generated assembly/square-x86.S.in | 34 ---- .../128 generated assembly/square-x86_64.S.in | 38 ---- .../common/128 generated assembly/square.def | 2 - .../128 generated assembly/symbol-underscore.h | 5 - .../129 build by default targets in tests/main.c | 3 - .../meson.build | 23 --- .../write_file.py | 6 - .../common/129 build by default/checkexists.py | 10 + test cases/common/129 build by default/foo.c | 6 + test cases/common/129 build by default/meson.build | 45 +++++ test cases/common/129 build by default/mygen.py | 8 + test cases/common/129 build by default/source.txt | 1 + .../common/130 build by default/checkexists.py | 10 - test cases/common/130 build by default/foo.c | 6 - test cases/common/130 build by default/meson.build | 45 ----- test cases/common/130 build by default/mygen.py | 8 - test cases/common/130 build by default/source.txt | 1 - .../common/130 include order/ctsub/copyfile.py | 6 + .../common/130 include order/ctsub/emptyfile.c | 0 test cases/common/130 include order/ctsub/main.h | 1 + .../common/130 include order/ctsub/meson.build | 9 + test cases/common/130 include order/inc1/hdr.h | 1 + test cases/common/130 include order/inc2/hdr.h | 1 + test cases/common/130 include order/meson.build | 36 ++++ test cases/common/130 include order/ordertest.c | 10 + test cases/common/130 include order/sub1/main.h | 1 + .../common/130 include order/sub1/meson.build | 4 + test cases/common/130 include order/sub1/some.c | 6 + test cases/common/130 include order/sub1/some.h | 10 + test cases/common/130 include order/sub2/main.h | 1 + .../common/130 include order/sub2/meson.build | 2 + test cases/common/130 include order/sub3/main.h | 1 + .../common/130 include order/sub3/meson.build | 1 + test cases/common/130 include order/sub4/main.c | 8 + test cases/common/130 include order/sub4/main.h | 3 + .../common/130 include order/sub4/meson.build | 6 + .../common/131 include order/ctsub/copyfile.py | 6 - .../common/131 include order/ctsub/emptyfile.c | 0 test cases/common/131 include order/ctsub/main.h | 1 - .../common/131 include order/ctsub/meson.build | 9 - test cases/common/131 include order/inc1/hdr.h | 1 - test cases/common/131 include order/inc2/hdr.h | 1 - test cases/common/131 include order/meson.build | 36 ---- test cases/common/131 include order/ordertest.c | 10 - test cases/common/131 include order/sub1/main.h | 1 - .../common/131 include order/sub1/meson.build | 4 - test cases/common/131 include order/sub1/some.c | 6 - test cases/common/131 include order/sub1/some.h | 10 - test cases/common/131 include order/sub2/main.h | 1 - .../common/131 include order/sub2/meson.build | 2 - test cases/common/131 include order/sub3/main.h | 1 - .../common/131 include order/sub3/meson.build | 1 - test cases/common/131 include order/sub4/main.c | 8 - test cases/common/131 include order/sub4/main.h | 3 - .../common/131 include order/sub4/meson.build | 6 - test cases/common/131 override options/four.c | 9 + test cases/common/131 override options/meson.build | 6 + test cases/common/131 override options/one.c | 3 + test cases/common/131 override options/three.c | 7 + test cases/common/131 override options/two.c | 6 + test cases/common/132 get define/concat.h | 24 +++ test cases/common/132 get define/meson.build | 104 +++++++++++ test cases/common/132 get define/meson_options.txt | 1 + test cases/common/132 override options/four.c | 9 - test cases/common/132 override options/meson.build | 6 - test cases/common/132 override options/one.c | 3 - test cases/common/132 override options/three.c | 7 - test cases/common/132 override options/two.c | 6 - test cases/common/133 c cpp and asm/main.c | 8 + test cases/common/133 c cpp and asm/main.cpp | 11 ++ test cases/common/133 c cpp and asm/meson.build | 23 +++ test cases/common/133 c cpp and asm/retval-arm.S | 11 ++ test cases/common/133 c cpp and asm/retval-x86.S | 12 ++ .../common/133 c cpp and asm/retval-x86_64.S | 11 ++ test cases/common/133 c cpp and asm/somelib.c | 3 + .../common/133 c cpp and asm/symbol-underscore.h | 5 + test cases/common/133 get define/concat.h | 24 --- test cases/common/133 get define/meson.build | 104 ----------- test cases/common/133 get define/meson_options.txt | 1 - test cases/common/134 c cpp and asm/main.c | 8 - test cases/common/134 c cpp and asm/main.cpp | 11 -- test cases/common/134 c cpp and asm/meson.build | 23 --- test cases/common/134 c cpp and asm/retval-arm.S | 11 -- test cases/common/134 c cpp and asm/retval-x86.S | 12 -- .../common/134 c cpp and asm/retval-x86_64.S | 11 -- test cases/common/134 c cpp and asm/somelib.c | 3 - .../common/134 c cpp and asm/symbol-underscore.h | 5 - test cases/common/134 compute int/config.h.in | 4 + test cases/common/134 compute int/foobar.h | 6 + test cases/common/134 compute int/meson.build | 46 +++++ test cases/common/134 compute int/prog.c.in | 25 +++ test cases/common/135 compute int/config.h.in | 4 - test cases/common/135 compute int/foobar.h | 6 - test cases/common/135 compute int/meson.build | 46 ----- test cases/common/135 compute int/prog.c.in | 25 --- .../135 custom target object output/meson.build | 16 ++ .../obj_generator.py | 18 ++ .../objdir/meson.build | 5 + .../objdir/source.c | 3 + .../progdir/meson.build | 1 + .../135 custom target object output/progdir/prog.c | 5 + .../136 custom target object output/meson.build | 16 -- .../obj_generator.py | 18 -- .../objdir/meson.build | 5 - .../objdir/source.c | 3 - .../progdir/meson.build | 1 - .../136 custom target object output/progdir/prog.c | 5 - test cases/common/136 empty build file/meson.build | 2 + .../common/136 empty build file/subdir/meson.build | 0 test cases/common/137 empty build file/meson.build | 2 - .../common/137 empty build file/subdir/meson.build | 0 .../common/137 whole archive/exe/meson.build | 1 + .../common/137 whole archive/exe2/meson.build | 1 + .../common/137 whole archive/exe3/meson.build | 1 + .../common/137 whole archive/exe4/meson.build | 1 + test cases/common/137 whole archive/func1.c | 7 + test cases/common/137 whole archive/func2.c | 7 + test cases/common/137 whole archive/meson.build | 54 ++++++ test cases/common/137 whole archive/mylib.h | 21 +++ test cases/common/137 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/137 whole archive/st_func1/meson.build | 1 + .../common/137 whole archive/st_func2/meson.build | 1 + test cases/common/138 C and CPP link/dummy.c | 0 test cases/common/138 C and CPP link/foo.c | 19 ++ test cases/common/138 C and CPP link/foo.cpp | 34 ++++ test cases/common/138 C and CPP link/foo.h | 16 ++ test cases/common/138 C and CPP link/foo.hpp | 24 +++ test cases/common/138 C and CPP link/foobar.c | 27 +++ test cases/common/138 C and CPP link/foobar.h | 16 ++ test cases/common/138 C and CPP link/meson.build | 133 ++++++++++++++ test cases/common/138 C and CPP link/sub.c | 19 ++ test cases/common/138 C and CPP link/sub.h | 16 ++ .../common/138 whole archive/exe/meson.build | 1 - .../common/138 whole archive/exe2/meson.build | 1 - .../common/138 whole archive/exe3/meson.build | 1 - .../common/138 whole archive/exe4/meson.build | 1 - test cases/common/138 whole archive/func1.c | 7 - test cases/common/138 whole archive/func2.c | 7 - test cases/common/138 whole archive/meson.build | 54 ------ test cases/common/138 whole archive/mylib.h | 21 --- test cases/common/138 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/138 whole archive/st_func1/meson.build | 1 - .../common/138 whole archive/st_func2/meson.build | 1 - test cases/common/139 C and CPP link/dummy.c | 0 test cases/common/139 C and CPP link/foo.c | 19 -- test cases/common/139 C and CPP link/foo.cpp | 34 ---- test cases/common/139 C and CPP link/foo.h | 16 -- test cases/common/139 C and CPP link/foo.hpp | 24 --- test cases/common/139 C and CPP link/foobar.c | 27 --- test cases/common/139 C and CPP link/foobar.h | 16 -- test cases/common/139 C and CPP link/meson.build | 133 -------------- test cases/common/139 C and CPP link/sub.c | 19 -- test cases/common/139 C and CPP link/sub.h | 16 -- .../139 mesonintrospect from scripts/check_env.py | 28 +++ .../check_introspection.py | 18 ++ .../139 mesonintrospect from scripts/meson.build | 14 ++ .../generator.py | 14 ++ .../140 custom target multiple outputs/meson.build | 44 +++++ .../140 custom target multiple outputs/test.json | 10 + .../140 mesonintrospect from scripts/check_env.py | 28 --- .../check_introspection.py | 18 -- .../140 mesonintrospect from scripts/meson.build | 14 -- .../generator.py | 14 -- .../141 custom target multiple outputs/meson.build | 44 ----- .../141 custom target multiple outputs/test.json | 10 - .../common/141 special characters/arg-char-test.c | 10 + .../141 special characters/arg-string-test.c | 12 ++ .../141 special characters/arg-unquoted-test.c | 17 ++ .../common/141 special characters/check_quoting.py | 28 +++ .../common/141 special characters/meson.build | 75 ++++++++ test cases/common/141 special characters/test.json | 6 + test cases/common/142 nested links/meson.build | 8 + test cases/common/142 nested links/xephyr.c | 3 + .../common/142 special characters/arg-char-test.c | 10 - .../142 special characters/arg-string-test.c | 12 -- .../142 special characters/arg-unquoted-test.c | 17 -- .../common/142 special characters/check_quoting.py | 28 --- .../common/142 special characters/meson.build | 75 -------- test cases/common/142 special characters/test.json | 6 - test cases/common/143 list of file sources/foo | 1 + test cases/common/143 list of file sources/gen.py | 7 + .../common/143 list of file sources/meson.build | 12 ++ test cases/common/143 nested links/meson.build | 8 - test cases/common/143 nested links/xephyr.c | 3 - .../common/144 link depends custom target/foo.c | 15 ++ .../144 link depends custom target/make_file.py | 5 + .../144 link depends custom target/meson.build | 19 ++ test cases/common/144 list of file sources/foo | 1 - test cases/common/144 list of file sources/gen.py | 7 - .../common/144 list of file sources/meson.build | 12 -- .../common/145 link depends custom target/foo.c | 15 -- .../145 link depends custom target/make_file.py | 5 - .../145 link depends custom target/meson.build | 19 -- .../145 recursive linking/3rdorderdeps/lib.c.in | 8 + .../145 recursive linking/3rdorderdeps/main.c.in | 16 ++ .../145 recursive linking/3rdorderdeps/meson.build | 49 +++++ .../common/145 recursive linking/circular/lib1.c | 6 + .../common/145 recursive linking/circular/lib2.c | 6 + .../common/145 recursive linking/circular/lib3.c | 6 + .../common/145 recursive linking/circular/main.c | 28 +++ .../145 recursive linking/circular/meson.build | 5 + .../common/145 recursive linking/circular/prop1.c | 3 + .../common/145 recursive linking/circular/prop2.c | 3 + .../common/145 recursive linking/circular/prop3.c | 3 + .../145 recursive linking/edge-cases/libsto.c | 8 + .../145 recursive linking/edge-cases/meson.build | 9 + .../145 recursive linking/edge-cases/shstmain.c | 16 ++ .../145 recursive linking/edge-cases/stobuilt.c | 7 + .../145 recursive linking/edge-cases/stomain.c | 16 ++ test cases/common/145 recursive linking/lib.h | 17 ++ test cases/common/145 recursive linking/main.c | 46 +++++ .../common/145 recursive linking/meson.build | 29 +++ .../common/145 recursive linking/shnodep/lib.c | 6 + .../145 recursive linking/shnodep/meson.build | 1 + .../common/145 recursive linking/shshdep/lib.c | 8 + .../145 recursive linking/shshdep/meson.build | 1 + .../common/145 recursive linking/shstdep/lib.c | 8 + .../145 recursive linking/shstdep/meson.build | 1 + .../common/145 recursive linking/stnodep/lib.c | 6 + .../145 recursive linking/stnodep/meson.build | 2 + .../common/145 recursive linking/stshdep/lib.c | 8 + .../145 recursive linking/stshdep/meson.build | 2 + .../common/145 recursive linking/ststdep/lib.c | 8 + .../145 recursive linking/ststdep/meson.build | 2 + test cases/common/146 library at root/lib.c | 6 + test cases/common/146 library at root/main/main.c | 5 + .../common/146 library at root/main/meson.build | 2 + test cases/common/146 library at root/meson.build | 3 + .../146 recursive linking/3rdorderdeps/lib.c.in | 8 - .../146 recursive linking/3rdorderdeps/main.c.in | 16 -- .../146 recursive linking/3rdorderdeps/meson.build | 49 ----- .../common/146 recursive linking/circular/lib1.c | 6 - .../common/146 recursive linking/circular/lib2.c | 6 - .../common/146 recursive linking/circular/lib3.c | 6 - .../common/146 recursive linking/circular/main.c | 28 --- .../146 recursive linking/circular/meson.build | 5 - .../common/146 recursive linking/circular/prop1.c | 3 - .../common/146 recursive linking/circular/prop2.c | 3 - .../common/146 recursive linking/circular/prop3.c | 3 - .../146 recursive linking/edge-cases/libsto.c | 8 - .../146 recursive linking/edge-cases/meson.build | 9 - .../146 recursive linking/edge-cases/shstmain.c | 16 -- .../146 recursive linking/edge-cases/stobuilt.c | 7 - .../146 recursive linking/edge-cases/stomain.c | 16 -- test cases/common/146 recursive linking/lib.h | 17 -- test cases/common/146 recursive linking/main.c | 46 ----- .../common/146 recursive linking/meson.build | 29 --- .../common/146 recursive linking/shnodep/lib.c | 6 - .../146 recursive linking/shnodep/meson.build | 1 - .../common/146 recursive linking/shshdep/lib.c | 8 - .../146 recursive linking/shshdep/meson.build | 1 - .../common/146 recursive linking/shstdep/lib.c | 8 - .../146 recursive linking/shstdep/meson.build | 1 - .../common/146 recursive linking/stnodep/lib.c | 6 - .../146 recursive linking/stnodep/meson.build | 2 - .../common/146 recursive linking/stshdep/lib.c | 8 - .../146 recursive linking/stshdep/meson.build | 2 - .../common/146 recursive linking/ststdep/lib.c | 8 - .../146 recursive linking/ststdep/meson.build | 2 - test cases/common/147 library at root/lib.c | 6 - test cases/common/147 library at root/main/main.c | 5 - .../common/147 library at root/main/meson.build | 2 - test cases/common/147 library at root/meson.build | 3 - test cases/common/147 simd/fallback.c | 8 + test cases/common/147 simd/include/simdheader.h | 3 + test cases/common/147 simd/meson.build | 44 +++++ test cases/common/147 simd/simd_avx.c | 49 +++++ test cases/common/147 simd/simd_avx2.c | 42 +++++ test cases/common/147 simd/simd_mmx.c | 67 +++++++ test cases/common/147 simd/simd_neon.c | 20 ++ test cases/common/147 simd/simd_sse.c | 29 +++ test cases/common/147 simd/simd_sse2.c | 37 ++++ test cases/common/147 simd/simd_sse3.c | 38 ++++ test cases/common/147 simd/simd_sse41.c | 40 ++++ test cases/common/147 simd/simd_sse42.c | 43 +++++ test cases/common/147 simd/simd_ssse3.c | 48 +++++ test cases/common/147 simd/simdchecker.c | 143 +++++++++++++++ test cases/common/147 simd/simdfuncs.h | 75 ++++++++ .../meson.build | 20 ++ .../module.c | 16 ++ .../prog.c | 61 ++++++ test cases/common/148 simd/fallback.c | 8 - test cases/common/148 simd/include/simdheader.h | 3 - test cases/common/148 simd/meson.build | 44 ----- test cases/common/148 simd/simd_avx.c | 49 ----- test cases/common/148 simd/simd_avx2.c | 42 ----- test cases/common/148 simd/simd_mmx.c | 67 ------- test cases/common/148 simd/simd_neon.c | 20 -- test cases/common/148 simd/simd_sse.c | 29 --- test cases/common/148 simd/simd_sse2.c | 37 ---- test cases/common/148 simd/simd_sse3.c | 38 ---- test cases/common/148 simd/simd_sse41.c | 40 ---- test cases/common/148 simd/simd_sse42.c | 43 ----- test cases/common/148 simd/simd_ssse3.c | 48 ----- test cases/common/148 simd/simdchecker.c | 143 --------------- test cases/common/148 simd/simdfuncs.h | 75 -------- test cases/common/149 dotinclude/dotproc.c | 10 + test cases/common/149 dotinclude/meson.build | 5 + test cases/common/149 dotinclude/stdio.h | 6 + .../meson.build | 20 -- .../module.c | 16 -- .../prog.c | 61 ------ test cases/common/150 dotinclude/dotproc.c | 10 - test cases/common/150 dotinclude/meson.build | 5 - test cases/common/150 dotinclude/stdio.h | 6 - .../common/150 reserved targets/all/meson.build | 1 + .../150 reserved targets/benchmark/meson.build | 1 + .../150 reserved targets/clean-ctlist/meson.build | 1 + .../150 reserved targets/clean-gcda/meson.build | 1 + .../150 reserved targets/clean-gcno/meson.build | 1 + .../common/150 reserved targets/clean/meson.build | 1 + .../150 reserved targets/coverage-html/meson.build | 1 + .../150 reserved targets/coverage-text/meson.build | 1 + .../150 reserved targets/coverage-xml/meson.build | 1 + .../150 reserved targets/coverage/meson.build | 1 + .../common/150 reserved targets/dist/meson.build | 1 + .../150 reserved targets/distcheck/meson.build | 1 + .../150 reserved targets/install/meson.build | 1 + test cases/common/150 reserved targets/meson.build | 34 ++++ .../common/150 reserved targets/phony/meson.build | 1 + .../150 reserved targets/reconfigure/meson.build | 1 + .../common/150 reserved targets/runtarget/echo.py | 6 + .../150 reserved targets/runtarget/meson.build | 2 + .../150 reserved targets/scan-build/meson.build | 1 + test cases/common/150 reserved targets/test.c | 3 + .../common/150 reserved targets/test/meson.build | 1 + .../150 reserved targets/uninstall/meson.build | 1 + .../common/151 duplicate source names/dir1/file.c | 16 ++ .../151 duplicate source names/dir1/meson.build | 1 + .../151 duplicate source names/dir2/dir1/file.c | 1 + .../common/151 duplicate source names/dir2/file.c | 1 + .../151 duplicate source names/dir2/meson.build | 1 + .../151 duplicate source names/dir3/dir1/file.c | 1 + .../common/151 duplicate source names/dir3/file.c | 1 + .../151 duplicate source names/dir3/meson.build | 1 + .../common/151 duplicate source names/meson.build | 19 ++ .../common/151 reserved targets/all/meson.build | 1 - .../151 reserved targets/benchmark/meson.build | 1 - .../151 reserved targets/clean-ctlist/meson.build | 1 - .../151 reserved targets/clean-gcda/meson.build | 1 - .../151 reserved targets/clean-gcno/meson.build | 1 - .../common/151 reserved targets/clean/meson.build | 1 - .../151 reserved targets/coverage-html/meson.build | 1 - .../151 reserved targets/coverage-text/meson.build | 1 - .../151 reserved targets/coverage-xml/meson.build | 1 - .../151 reserved targets/coverage/meson.build | 1 - .../common/151 reserved targets/dist/meson.build | 1 - .../151 reserved targets/distcheck/meson.build | 1 - .../151 reserved targets/install/meson.build | 1 - test cases/common/151 reserved targets/meson.build | 34 ---- .../common/151 reserved targets/phony/meson.build | 1 - .../151 reserved targets/reconfigure/meson.build | 1 - .../common/151 reserved targets/runtarget/echo.py | 6 - .../151 reserved targets/runtarget/meson.build | 2 - .../151 reserved targets/scan-build/meson.build | 1 - test cases/common/151 reserved targets/test.c | 3 - .../common/151 reserved targets/test/meson.build | 1 - .../151 reserved targets/uninstall/meson.build | 1 - .../common/152 duplicate source names/dir1/file.c | 16 -- .../152 duplicate source names/dir1/meson.build | 1 - .../152 duplicate source names/dir2/dir1/file.c | 1 - .../common/152 duplicate source names/dir2/file.c | 1 - .../152 duplicate source names/dir2/meson.build | 1 - .../152 duplicate source names/dir3/dir1/file.c | 1 - .../common/152 duplicate source names/dir3/file.c | 1 - .../152 duplicate source names/dir3/meson.build | 1 - .../common/152 duplicate source names/meson.build | 19 -- .../common/152 index customtarget/check_args.py | 18 ++ .../common/152 index customtarget/gen_sources.py | 49 +++++ test cases/common/152 index customtarget/lib.c | 20 ++ .../common/152 index customtarget/meson.build | 80 ++++++++ .../common/152 index customtarget/subdir/foo.c | 22 +++ .../152 index customtarget/subdir/meson.build | 19 ++ .../common/153 index customtarget/check_args.py | 18 -- .../common/153 index customtarget/gen_sources.py | 49 ----- test cases/common/153 index customtarget/lib.c | 20 -- .../common/153 index customtarget/meson.build | 80 -------- .../common/153 index customtarget/subdir/foo.c | 22 --- .../153 index customtarget/subdir/meson.build | 19 -- .../153 wrap file should not failed/meson.build | 16 ++ .../src/meson.build | 6 + .../src/subprojects/foo/prog2.c | 7 + .../src/subprojects/prog.c | 7 + .../153 wrap file should not failed/src/test.c | 9 + .../subprojects/.gitignore | 3 + .../subprojects/bar.wrap | 8 + .../subprojects/foo.wrap | 11 ++ .../subprojects/packagecache/foo-1.0-patch.tar.xz | Bin 0 -> 244 bytes .../subprojects/packagecache/foo-1.0.tar.xz | Bin 0 -> 196 bytes .../subprojects/packagecache/zlib-1.2.8-8-wrap.zip | 1 + .../subprojects/packagecache/zlib-1.2.8.tar.gz | 1 + .../subprojects/packagefiles/bar-1.0-patch.tar.xz | Bin 0 -> 244 bytes .../subprojects/packagefiles/bar-1.0.tar.xz | Bin 0 -> 200 bytes .../subprojects/packagefiles/foo-1.0/meson.build | 2 + .../subprojects/patchdir.wrap | 9 + .../subprojects/zlib-1.2.8/foo.c | 3 + .../subprojects/zlib-1.2.8/meson.build | 2 + .../subprojects/zlib.wrap | 10 + .../common/154 includedir subproj/meson.build | 9 + test cases/common/154 includedir subproj/prog.c | 3 + .../subprojects/inctest/include/incfile.h | 2 + .../subprojects/inctest/meson.build | 13 ++ .../154 wrap file should not failed/meson.build | 16 -- .../src/meson.build | 6 - .../src/subprojects/foo/prog2.c | 7 - .../src/subprojects/prog.c | 7 - .../154 wrap file should not failed/src/test.c | 9 - .../subprojects/.gitignore | 3 - .../subprojects/bar.wrap | 8 - .../subprojects/foo.wrap | 11 -- .../subprojects/packagecache/foo-1.0-patch.tar.xz | Bin 244 -> 0 bytes .../subprojects/packagecache/foo-1.0.tar.xz | Bin 196 -> 0 bytes .../subprojects/packagecache/zlib-1.2.8-8-wrap.zip | 1 - .../subprojects/packagecache/zlib-1.2.8.tar.gz | 1 - .../subprojects/packagefiles/bar-1.0-patch.tar.xz | Bin 244 -> 0 bytes .../subprojects/packagefiles/bar-1.0.tar.xz | Bin 200 -> 0 bytes .../subprojects/packagefiles/foo-1.0/meson.build | 2 - .../subprojects/patchdir.wrap | 9 - .../subprojects/zlib-1.2.8/foo.c | 3 - .../subprojects/zlib-1.2.8/meson.build | 2 - .../subprojects/zlib.wrap | 10 - .../common/155 includedir subproj/meson.build | 9 - test cases/common/155 includedir subproj/prog.c | 3 - .../subprojects/inctest/include/incfile.h | 2 - .../subprojects/inctest/meson.build | 13 -- .../common/155 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 + .../155 subproject dir name collision/meson.build | 12 ++ .../other_subdir/custom_subproject_dir/other.c | 19 ++ .../other_subdir/meson.build | 1 + .../common/156 config tool variable/meson.build | 31 ++++ .../common/156 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 - .../156 subproject dir name collision/meson.build | 12 -- .../other_subdir/custom_subproject_dir/other.c | 19 -- .../other_subdir/meson.build | 1 - .../common/157 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 - test cases/common/158 disabler/meson.build | 153 ++++++++++++++++ test cases/common/159 array option/meson.build | 17 ++ .../common/159 array option/meson_options.txt | 19 ++ test cases/common/159 disabler/meson.build | 153 ---------------- test cases/common/16 comparison/meson.build | 154 ++++++++++++++++ test cases/common/16 comparison/prog.c | 1 + test cases/common/160 array option/meson.build | 17 -- .../common/160 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/161 not-found dependency/meson.build | 14 ++ .../161 not-found dependency/sub/meson.build | 1 + .../subprojects/trivial/meson.build | 3 + .../subprojects/trivial/trivial.c | 3 + .../common/161 not-found dependency/testlib.c | 0 .../common/162 not-found dependency/meson.build | 14 -- .../162 not-found dependency/sub/meson.build | 1 - .../subprojects/trivial/meson.build | 3 - .../subprojects/trivial/trivial.c | 3 - .../common/162 not-found dependency/testlib.c | 0 test cases/common/162 subdir if_found/meson.build | 11 ++ .../common/162 subdir if_found/subdir/meson.build | 1 + .../meson.build | 1 + test cases/common/163 subdir if_found/meson.build | 11 -- .../common/163 subdir if_found/subdir/meson.build | 1 - .../meson.build | 1 - .../common/164 dependency factory/meson.build | 51 ++++++ .../common/165 dependency factory/meson.build | 51 ------ test cases/common/165 get project license/bar.c | 6 + .../common/165 get project license/meson.build | 8 + test cases/common/166 get project license/bar.c | 6 - .../common/166 get project license/meson.build | 8 - test cases/common/166 yield/meson.build | 7 + test cases/common/166 yield/meson_options.txt | 3 + .../common/166 yield/subprojects/sub/meson.build | 5 + .../166 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 ++ .../167 subproject nested subproject dirs/prog.c | 5 + test cases/common/167 yield/meson.build | 7 - test cases/common/167 yield/meson_options.txt | 3 - .../common/167 yield/subprojects/sub/meson.build | 5 - .../167 yield/subprojects/sub/meson_options.txt | 3 - test cases/common/168 preserve gendir/base.inp | 1 + .../168 preserve gendir/com/mesonbuild/subbie.inp | 1 + test cases/common/168 preserve gendir/genprog.py | 46 +++++ test cases/common/168 preserve gendir/meson.build | 13 ++ test cases/common/168 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 -- .../168 subproject nested subproject dirs/prog.c | 5 - test cases/common/169 preserve gendir/base.inp | 1 - .../169 preserve gendir/com/mesonbuild/subbie.inp | 1 - test cases/common/169 preserve gendir/genprog.py | 46 ----- test cases/common/169 preserve gendir/meson.build | 13 -- test cases/common/169 preserve gendir/testprog.c | 6 - test cases/common/169 source in dep/bar.cpp | 5 + test cases/common/169 source in dep/foo.c | 3 + .../common/169 source in dep/generated/funname | 1 + .../169 source in dep/generated/genheader.py | 17 ++ .../common/169 source in dep/generated/main.c | 5 + .../common/169 source in dep/generated/meson.build | 12 ++ test cases/common/169 source in dep/meson.build | 8 + test cases/common/17 array/func.c | 1 + test cases/common/17 array/meson.build | 8 + test cases/common/17 array/prog.c | 3 + test cases/common/17 comparison/meson.build | 154 ---------------- test cases/common/17 comparison/prog.c | 1 - .../common/170 generator link whole/export.h | 18 ++ .../common/170 generator link whole/generator.py | 30 +++ test cases/common/170 generator link whole/main.c | 11 ++ .../common/170 generator link whole/meson.build | 69 +++++++ .../meson_test_function.tmpl | 0 .../pull_meson_test_function.c | 6 + test cases/common/170 source in dep/bar.cpp | 5 - test cases/common/170 source in dep/foo.c | 3 - .../common/170 source in dep/generated/funname | 1 - .../170 source in dep/generated/genheader.py | 17 -- .../common/170 source in dep/generated/main.c | 5 - .../common/170 source in dep/generated/meson.build | 12 -- test cases/common/170 source in dep/meson.build | 8 - .../common/171 generator link whole/export.h | 18 -- .../common/171 generator link whole/generator.py | 30 --- test cases/common/171 generator link whole/main.c | 11 -- .../common/171 generator link whole/meson.build | 69 ------- .../meson_test_function.tmpl | 0 .../pull_meson_test_function.c | 6 - test cases/common/171 initial c_args/meson.build | 7 + test cases/common/171 initial c_args/test.json | 8 + .../foo.c | 1 + .../main.c | 16 ++ .../meson.build | 15 ++ .../subprojects/subproj/foo.c | 1 + .../subprojects/subproj/meson.build | 3 + test cases/common/172 initial c_args/meson.build | 7 - test cases/common/172 initial c_args/test.json | 8 - test cases/common/173 as-needed/config.h | 14 ++ test cases/common/173 as-needed/libA.cpp | 7 + test cases/common/173 as-needed/libA.h | 5 + test cases/common/173 as-needed/libB.cpp | 19 ++ test cases/common/173 as-needed/main.cpp | 7 + test cases/common/173 as-needed/meson.build | 13 ++ .../foo.c | 1 - .../main.c | 16 -- .../meson.build | 15 -- .../subprojects/subproj/foo.c | 1 - .../subprojects/subproj/meson.build | 3 - test cases/common/174 as-needed/config.h | 14 -- test cases/common/174 as-needed/libA.cpp | 7 - test cases/common/174 as-needed/libA.h | 5 - test cases/common/174 as-needed/libB.cpp | 19 -- test cases/common/174 as-needed/main.cpp | 7 - test cases/common/174 as-needed/meson.build | 13 -- .../common/174 ndebug if-release enabled/main.c | 15 ++ .../174 ndebug if-release enabled/meson.build | 7 + .../common/175 ndebug if-release disabled/main.c | 7 + .../175 ndebug if-release disabled/meson.build | 7 + .../common/175 ndebug if-release enabled/main.c | 15 -- .../175 ndebug if-release enabled/meson.build | 7 - .../common/176 ndebug if-release disabled/main.c | 7 - .../176 ndebug if-release disabled/meson.build | 7 - .../common/176 subproject version/meson.build | 10 + .../subprojects/a/meson.build | 5 + test cases/common/177 subdir_done/meson.build | 12 ++ .../common/177 subproject version/meson.build | 10 - .../subprojects/a/meson.build | 5 - test cases/common/178 bothlibraries/libfile.c | 7 + test cases/common/178 bothlibraries/main.c | 8 + test cases/common/178 bothlibraries/meson.build | 25 +++ test cases/common/178 bothlibraries/mylib.h | 13 ++ test cases/common/178 subdir_done/meson.build | 12 -- test cases/common/179 bothlibraries/libfile.c | 7 - test cases/common/179 bothlibraries/main.c | 8 - test cases/common/179 bothlibraries/meson.build | 25 --- test cases/common/179 bothlibraries/mylib.h | 13 -- test cases/common/179 escape and unicode/file.c.in | 5 + test cases/common/179 escape and unicode/file.py | 10 + test cases/common/179 escape and unicode/find.py | 9 + test cases/common/179 escape and unicode/fun.c | 3 + test cases/common/179 escape and unicode/main.c | 12 ++ .../common/179 escape and unicode/meson.build | 38 ++++ test cases/common/18 array/func.c | 1 - test cases/common/18 array/meson.build | 8 - test cases/common/18 array/prog.c | 3 - test cases/common/18 includedir/include/func.h | 6 + test cases/common/18 includedir/meson.build | 4 + test cases/common/18 includedir/src/func.c | 5 + test cases/common/18 includedir/src/meson.build | 5 + test cases/common/18 includedir/src/prog.c | 5 + test cases/common/180 escape and unicode/file.c.in | 5 - test cases/common/180 escape and unicode/file.py | 10 - test cases/common/180 escape and unicode/find.py | 9 - test cases/common/180 escape and unicode/fun.c | 3 - test cases/common/180 escape and unicode/main.c | 12 -- .../common/180 escape and unicode/meson.build | 38 ---- test cases/common/180 has link arg/meson.build | 47 +++++ test cases/common/181 has link arg/meson.build | 47 ----- .../common/181 same target name flat layout/foo.c | 1 + .../common/181 same target name flat layout/main.c | 16 ++ .../181 same target name flat layout/meson.build | 15 ++ .../181 same target name flat layout/subdir/foo.c | 1 + .../subdir/meson.build | 1 + test cases/common/182 find override/meson.build | 15 ++ .../common/182 find override/otherdir/main.c | 5 + .../common/182 find override/otherdir/main2.c | 5 + .../common/182 find override/otherdir/meson.build | 26 +++ .../common/182 find override/otherdir/source.desc | 1 + .../common/182 find override/otherdir/source2.desc | 1 + .../common/182 find override/subdir/converter.py | 15 ++ .../182 find override/subdir/gencodegen.py.in | 15 ++ .../common/182 find override/subdir/meson.build | 14 ++ .../common/182 find override/subprojects/sub.wrap | 5 + .../182 find override/subprojects/sub/meson.build | 4 + .../common/182 same target name flat layout/foo.c | 1 - .../common/182 same target name flat layout/main.c | 16 -- .../182 same target name flat layout/meson.build | 15 -- .../182 same target name flat layout/subdir/foo.c | 1 - .../subdir/meson.build | 1 - test cases/common/183 find override/meson.build | 15 -- .../common/183 find override/otherdir/main.c | 5 - .../common/183 find override/otherdir/main2.c | 5 - .../common/183 find override/otherdir/meson.build | 26 --- .../common/183 find override/otherdir/source.desc | 1 - .../common/183 find override/otherdir/source2.desc | 1 - .../common/183 find override/subdir/converter.py | 15 -- .../183 find override/subdir/gencodegen.py.in | 15 -- .../common/183 find override/subdir/meson.build | 14 -- .../common/183 find override/subprojects/sub.wrap | 5 - .../183 find override/subprojects/sub/meson.build | 4 - .../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/183 partial dependency/meson.build | 17 ++ test cases/common/184 openmp/main.c | 16 ++ test cases/common/184 openmp/main.cpp | 16 ++ test cases/common/184 openmp/main.f90 | 9 + test cases/common/184 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/184 partial dependency/meson.build | 17 -- test cases/common/185 openmp/main.c | 16 -- test cases/common/185 openmp/main.cpp | 16 -- test cases/common/185 openmp/main.f90 | 9 - test cases/common/185 openmp/meson.build | 58 ------ test cases/common/185 same target name/file.c | 3 + test cases/common/185 same target name/meson.build | 4 + test cases/common/185 same target name/sub/file2.c | 3 + .../common/185 same target name/sub/meson.build | 1 + test cases/common/186 same target name/file.c | 3 - test cases/common/186 same target name/meson.build | 4 - test cases/common/186 same target name/sub/file2.c | 3 - .../common/186 same target name/sub/meson.build | 1 - test cases/common/186 test depends/gen.py | 13 ++ test cases/common/186 test depends/main.c | 1 + test cases/common/186 test depends/meson.build | 26 +++ test cases/common/186 test depends/test.py | 20 ++ test cases/common/187 args flattening/meson.build | 31 ++++ test cases/common/187 test depends/gen.py | 13 -- test cases/common/187 test depends/main.c | 1 - test cases/common/187 test depends/meson.build | 26 --- test cases/common/187 test depends/test.py | 20 -- test cases/common/188 args flattening/meson.build | 31 ---- test cases/common/188 dict/meson.build | 71 +++++++ test cases/common/188 dict/prog.c | 8 + test cases/common/189 check header/meson.build | 48 +++++ test cases/common/189 check header/ouagadougou.h | 1 + test cases/common/189 dict/meson.build | 71 ------- test cases/common/189 dict/prog.c | 8 - test cases/common/19 header in file list/header.h | 1 + .../common/19 header in file list/meson.build | 14 ++ test cases/common/19 header in file list/prog.c | 3 + test cases/common/19 includedir/include/func.h | 6 - test cases/common/19 includedir/meson.build | 4 - test cases/common/19 includedir/src/func.c | 5 - test cases/common/19 includedir/src/meson.build | 5 - test cases/common/19 includedir/src/prog.c | 5 - test cases/common/190 check header/meson.build | 48 ----- test cases/common/190 check header/ouagadougou.h | 1 - test cases/common/190 install_mode/config.h.in | 5 + test cases/common/190 install_mode/data_source.txt | 1 + test cases/common/190 install_mode/foo.1 | 1 + test cases/common/190 install_mode/meson.build | 59 ++++++ test cases/common/190 install_mode/rootdir.h | 3 + test cases/common/190 install_mode/runscript.sh | 3 + test cases/common/190 install_mode/stat.c | 1 + test cases/common/190 install_mode/sub1/second.dat | 1 + test cases/common/190 install_mode/sub2/stub | 0 test cases/common/190 install_mode/test.json | 15 ++ test cases/common/190 install_mode/trivial.c | 6 + test cases/common/191 install_mode/config.h.in | 5 - test cases/common/191 install_mode/data_source.txt | 1 - test cases/common/191 install_mode/foo.1 | 1 - test cases/common/191 install_mode/meson.build | 59 ------ test cases/common/191 install_mode/rootdir.h | 3 - test cases/common/191 install_mode/runscript.sh | 3 - test cases/common/191 install_mode/stat.c | 1 - test cases/common/191 install_mode/sub1/second.dat | 1 - test cases/common/191 install_mode/sub2/stub | 0 test cases/common/191 install_mode/test.json | 15 -- test cases/common/191 install_mode/trivial.c | 6 - .../191 subproject array version/meson.build | 3 + .../subprojects/foo/meson.build | 1 + test cases/common/192 feature option/meson.build | 47 +++++ .../common/192 feature option/meson_options.txt | 3 + .../192 subproject array version/meson.build | 3 - .../subprojects/foo/meson.build | 1 - .../common/193 feature option disabled/meson.build | 23 +++ .../193 feature option disabled/meson_options.txt | 3 + test cases/common/193 feature option/meson.build | 47 ----- .../common/193 feature option/meson_options.txt | 3 - .../common/194 feature option disabled/meson.build | 23 --- .../194 feature option disabled/meson_options.txt | 3 - test cases/common/194 static threads/lib1.c | 13 ++ test cases/common/194 static threads/lib2.c | 5 + test cases/common/194 static threads/meson.build | 13 ++ test cases/common/194 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/195 generator in subdir/meson.build | 3 + test cases/common/195 static threads/lib1.c | 13 -- test cases/common/195 static threads/lib2.c | 5 - test cases/common/195 static threads/meson.build | 13 -- test cases/common/195 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/196 generator in subdir/meson.build | 3 - .../196 subproject with features/meson.build | 17 ++ .../196 subproject with features/meson_options.txt | 3 + .../common/196 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/197 function attributes/meson.build | 111 +++++++++++ .../197 function attributes/meson_options.txt | 7 + .../common/197 function attributes/test.json | 10 + .../197 subproject with features/meson.build | 17 -- .../197 subproject with features/meson_options.txt | 3 - .../common/197 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/198 broken subproject/meson.build | 2 + .../subprojects/broken/broken.c | 1 + .../subprojects/broken/meson.build | 4 + .../common/198 function attributes/meson.build | 111 ----------- .../198 function attributes/meson_options.txt | 7 - .../common/198 function attributes/test.json | 10 - test cases/common/199 argument syntax/meson.build | 19 ++ .../common/199 broken subproject/meson.build | 2 - .../subprojects/broken/broken.c | 1 - .../subprojects/broken/meson.build | 4 - test cases/common/20 global arg/meson.build | 16 ++ test cases/common/20 global arg/prog.c | 43 +++++ test cases/common/20 global arg/prog.cc | 15 ++ test cases/common/20 header in file list/header.h | 1 - .../common/20 header in file list/meson.build | 14 -- test cases/common/20 header in file list/prog.c | 3 - test cases/common/200 argument syntax/meson.build | 19 -- .../200 install name_prefix name_suffix/libfile.c | 14 ++ .../meson.build | 13 ++ .../200 install name_prefix name_suffix/test.json | 19 ++ .../201 install name_prefix name_suffix/libfile.c | 14 -- .../meson.build | 13 -- .../201 install name_prefix name_suffix/test.json | 19 -- test cases/common/201 kwarg entry/inc/prog.h | 3 + test cases/common/201 kwarg entry/meson.build | 7 + test cases/common/201 kwarg entry/prog.c | 7 + test cases/common/201 kwarg entry/test.json | 6 + .../202 custom target build by default/docgen.py | 12 ++ .../202 custom target build by default/meson.build | 10 + .../202 custom target build by default/test.json | 5 + test cases/common/202 kwarg entry/inc/prog.h | 3 - test cases/common/202 kwarg entry/meson.build | 7 - test cases/common/202 kwarg entry/prog.c | 7 - test cases/common/202 kwarg entry/test.json | 6 - .../203 custom target build by default/docgen.py | 12 -- .../203 custom target build by default/meson.build | 10 - .../203 custom target build by default/test.json | 5 - .../common/203 find_library and headers/foo.h | 1 + .../203 find_library and headers/meson.build | 23 +++ .../common/204 find_library and headers/foo.h | 1 - .../204 find_library and headers/meson.build | 23 --- .../common/204 line continuation/meson.build | 17 ++ .../common/205 line continuation/meson.build | 17 -- .../common/205 native file path override/main.cpp | 5 + .../205 native file path override/meson.build | 7 + .../205 native file path override/nativefile.ini | 2 + .../common/205 native file path override/test.json | 6 + .../common/206 native file path override/main.cpp | 5 - .../206 native file path override/meson.build | 7 - .../206 native file path override/nativefile.ini | 2 - .../common/206 native file path override/test.json | 6 - test cases/common/206 tap tests/cat.c | 26 +++ test cases/common/206 tap tests/issue7515.txt | 27 +++ test cases/common/206 tap tests/meson.build | 14 ++ test cases/common/206 tap tests/tester.c | 10 + test cases/common/207 tap tests/cat.c | 26 --- test cases/common/207 tap tests/issue7515.txt | 27 --- test cases/common/207 tap tests/meson.build | 14 -- test cases/common/207 tap tests/tester.c | 10 - test cases/common/207 warning level 0/main.cpp | 12 ++ test cases/common/207 warning level 0/meson.build | 3 + test cases/common/208 link custom/custom_stlib.py | 81 ++++++++ test cases/common/208 link custom/custom_target.c | 6 + test cases/common/208 link custom/custom_target.py | 6 + test cases/common/208 link custom/dummy.c | 1 + test cases/common/208 link custom/lib.c | 7 + test cases/common/208 link custom/meson.build | 86 +++++++++ test cases/common/208 link custom/outerlib.c | 3 + test cases/common/208 link custom/prog.c | 6 + test cases/common/208 warning level 0/main.cpp | 12 -- test cases/common/208 warning level 0/meson.build | 3 - test cases/common/209 link custom/custom_stlib.py | 81 -------- test cases/common/209 link custom/custom_target.c | 6 - test cases/common/209 link custom/custom_target.py | 6 - test cases/common/209 link custom/dummy.c | 1 - test cases/common/209 link custom/lib.c | 7 - test cases/common/209 link custom/meson.build | 86 --------- test cases/common/209 link custom/outerlib.c | 3 - test cases/common/209 link custom/prog.c | 6 - .../generate_conflicting_stlibs.py | 90 +++++++++ .../meson.build | 42 +++++ .../209 link custom_i single from multiple/prog.c | 5 + test cases/common/21 global arg/meson.build | 16 -- test cases/common/21 global arg/prog.c | 43 ----- test cases/common/21 global arg/prog.cc | 15 -- test cases/common/21 target arg/func.c | 9 + test cases/common/21 target arg/func2.c | 9 + test cases/common/21 target arg/meson.build | 9 + test cases/common/21 target arg/prog.cc | 13 ++ test cases/common/21 target arg/prog2.cc | 13 ++ .../generate_stlibs.py | 92 ++++++++++ .../meson.build | 42 +++++ .../prog.c | 8 + .../generate_conflicting_stlibs.py | 90 --------- .../meson.build | 42 ----- .../210 link custom_i single from multiple/prog.c | 5 - .../211 dependency get_variable method/meson.build | 66 +++++++ .../generate_stlibs.py | 92 ---------- .../meson.build | 42 ----- .../prog.c | 8 - .../212 dependency get_variable method/meson.build | 66 ------- .../common/212 source set configuration_data/a.c | 8 + .../common/212 source set configuration_data/all.h | 9 + .../common/212 source set configuration_data/f.c | 7 + .../common/212 source set configuration_data/g.c | 6 + .../212 source set configuration_data/meson.build | 54 ++++++ .../212 source set configuration_data/nope.c | 3 + .../212 source set configuration_data/subdir/b.c | 13 ++ .../subdir/meson.build | 1 + .../common/213 source set configuration_data/a.c | 8 - .../common/213 source set configuration_data/all.h | 9 - .../common/213 source set configuration_data/f.c | 7 - .../common/213 source set configuration_data/g.c | 6 - .../213 source set configuration_data/meson.build | 54 ------ .../213 source set configuration_data/nope.c | 3 - .../213 source set configuration_data/subdir/b.c | 13 -- .../subdir/meson.build | 1 - test cases/common/213 source set dictionary/a.c | 8 + test cases/common/213 source set dictionary/all.h | 9 + test cases/common/213 source set dictionary/f.c | 7 + test cases/common/213 source set dictionary/g.c | 6 + .../common/213 source set dictionary/meson.build | 56 ++++++ test cases/common/213 source set dictionary/nope.c | 3 + .../common/213 source set dictionary/subdir/b.c | 13 ++ .../213 source set dictionary/subdir/meson.build | 1 + test cases/common/214 source set custom target/a.c | 7 + .../common/214 source set custom target/all.h | 2 + .../common/214 source set custom target/cp.py | 5 + test cases/common/214 source set custom target/f.c | 5 + test cases/common/214 source set custom target/g.c | 5 + .../214 source set custom target/meson.build | 28 +++ test cases/common/214 source set dictionary/a.c | 8 - test cases/common/214 source set dictionary/all.h | 9 - test cases/common/214 source set dictionary/f.c | 7 - test cases/common/214 source set dictionary/g.c | 6 - .../common/214 source set dictionary/meson.build | 56 ------ test cases/common/214 source set dictionary/nope.c | 3 - .../common/214 source set dictionary/subdir/b.c | 13 -- .../214 source set dictionary/subdir/meson.build | 1 - test cases/common/215 source set custom target/a.c | 7 - .../common/215 source set custom target/all.h | 2 - .../common/215 source set custom target/cp.py | 5 - test cases/common/215 source set custom target/f.c | 5 - test cases/common/215 source set custom target/g.c | 5 - .../215 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 +++ .../215 source set realistic example/common.h | 41 +++++ .../config/aarch64 | 5 + .../215 source set realistic example/config/arm | 3 + .../215 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 + .../215 source set realistic example/main.cc | 32 ++++ .../215 source set realistic example/meson.build | 52 ++++++ .../215 source set realistic example/not-found.cc | 8 + .../215 source set realistic example/was-found.cc | 7 + .../215 source set realistic example/zlib.cc | 15 ++ .../check_object.py | 13 ++ .../libdir/meson.build | 1 + .../libdir/source.c | 3 + .../meson.build | 18 ++ .../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 --- .../216 source set realistic example/common.h | 41 ----- .../config/aarch64 | 5 - .../216 source set realistic example/config/arm | 3 - .../216 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 - .../216 source set realistic example/main.cc | 32 ---- .../216 source set realistic example/meson.build | 52 ------ .../216 source set realistic example/not-found.cc | 8 - .../216 source set realistic example/was-found.cc | 7 - .../216 source set realistic example/zlib.cc | 15 -- .../check_object.py | 13 -- .../libdir/meson.build | 1 - .../libdir/source.c | 3 - .../meson.build | 18 -- test cases/common/217 test priorities/meson.build | 22 +++ test cases/common/217 test priorities/testprog.py | 5 + test cases/common/218 include_dir dot/meson.build | 8 + test cases/common/218 include_dir dot/rone.h | 1 + test cases/common/218 include_dir dot/src/main.c | 5 + .../common/218 include_dir dot/src/meson.build | 6 + test cases/common/218 include_dir dot/src/rone.c | 3 + test cases/common/218 test priorities/meson.build | 22 --- test cases/common/218 test priorities/testprog.py | 5 - test cases/common/219 include_dir dot/meson.build | 8 - test cases/common/219 include_dir dot/rone.h | 1 - test cases/common/219 include_dir dot/src/main.c | 5 - .../common/219 include_dir dot/src/meson.build | 6 - test cases/common/219 include_dir dot/src/rone.c | 3 - .../common/219 include_type dependency/main.cpp | 8 + .../common/219 include_type dependency/meson.build | 41 +++++ .../219 include_type dependency/pch/test.hpp | 1 + .../subprojects/subDep/meson.build | 3 + test cases/common/22 object extraction/lib.c | 3 + test cases/common/22 object extraction/lib2.c | 3 + test cases/common/22 object extraction/main.c | 5 + test cases/common/22 object extraction/meson.build | 23 +++ test cases/common/22 object extraction/src/lib.c | 3 + test cases/common/22 target arg/func.c | 9 - test cases/common/22 target arg/func2.c | 9 - test cases/common/22 target arg/meson.build | 9 - test cases/common/22 target arg/prog.cc | 13 -- test cases/common/22 target arg/prog2.cc | 13 -- test cases/common/220 fs module/meson.build | 119 ++++++++++++ test cases/common/220 fs module/subdir/meson.build | 3 + .../common/220 fs module/subdir/subdirfile.txt | 1 + .../220 fs module/subprojects/subbie/meson.build | 11 ++ .../subprojects/subbie/subprojectfile.txt | 1 + .../subprojects/subbie/subsub/meson.build | 3 + .../subprojects/subbie/subsub/subsubfile.txt | 1 + .../common/220 include_type dependency/main.cpp | 8 - .../common/220 include_type dependency/meson.build | 41 ----- .../220 include_type dependency/pch/test.hpp | 1 - .../subprojects/subDep/meson.build | 3 - test cases/common/221 fs module/meson.build | 119 ------------ test cases/common/221 fs module/subdir/meson.build | 3 - .../common/221 fs module/subdir/subdirfile.txt | 1 - .../221 fs module/subprojects/subbie/meson.build | 11 -- .../subprojects/subbie/subprojectfile.txt | 1 - .../subprojects/subbie/subsub/meson.build | 3 - .../subprojects/subbie/subsub/subsubfile.txt | 1 - test cases/common/221 zlib/meson.build | 23 +++ test cases/common/222 native prop/crossfile.ini | 4 + test cases/common/222 native prop/meson.build | 49 +++++ test cases/common/222 native prop/nativefile.ini | 3 + test cases/common/222 zlib/meson.build | 23 --- test cases/common/223 native prop/crossfile.ini | 4 - test cases/common/223 native prop/meson.build | 49 ----- test cases/common/223 native prop/nativefile.ini | 3 - test cases/common/223 persubproject options/foo.c | 5 + .../common/223 persubproject options/meson.build | 15 ++ .../subprojects/sub1/foo.c | 8 + .../subprojects/sub1/meson.build | 9 + .../subprojects/sub2/foo.c | 9 + .../subprojects/sub2/meson.build | 10 + .../common/224 arithmetic operators/meson.build | 8 + test cases/common/224 persubproject options/foo.c | 5 - .../common/224 persubproject options/meson.build | 15 -- .../subprojects/sub1/foo.c | 8 - .../subprojects/sub1/meson.build | 9 - .../subprojects/sub2/foo.c | 9 - .../subprojects/sub2/meson.build | 10 - .../common/225 arithmetic operators/meson.build | 8 - test cases/common/225 link language/c_linkage.cpp | 5 + test cases/common/225 link language/c_linkage.h | 10 + test cases/common/225 link language/lib.cpp | 5 + test cases/common/225 link language/main.c | 5 + test cases/common/225 link language/meson.build | 18 ++ .../check_arch.py | 32 ++++ .../226 link depends indexed custom target/foo.c | 15 ++ .../make_file.py | 8 + .../meson.build | 25 +++ test cases/common/226 link language/c_linkage.cpp | 5 - test cases/common/226 link language/c_linkage.h | 10 - test cases/common/226 link language/lib.cpp | 5 - test cases/common/226 link language/main.c | 5 - test cases/common/226 link language/meson.build | 18 -- .../check_arch.py | 32 ---- .../227 link depends indexed custom target/foo.c | 15 -- .../make_file.py | 8 - .../meson.build | 25 --- .../common/227 very long commmand line/codegen.py | 7 + .../common/227 very long commmand line/main.c | 1 + .../common/227 very long commmand line/meson.build | 49 +++++ .../common/227 very long commmand line/name_gen.py | 23 +++ test cases/common/228 custom_target source/a | 0 .../common/228 custom_target source/meson.build | 5 + test cases/common/228 custom_target source/x.py | 5 + .../common/228 very long commmand line/codegen.py | 7 - .../common/228 very long commmand line/main.c | 1 - .../common/228 very long commmand line/meson.build | 49 ----- .../common/228 very long commmand line/name_gen.py | 23 --- test cases/common/229 custom_target source/a | 0 .../common/229 custom_target source/meson.build | 5 - test cases/common/229 custom_target source/x.py | 5 - .../common/229 disabler array addition/meson.build | 9 + .../common/229 disabler array addition/test.c | 1 + test cases/common/23 endian/meson.build | 7 + test cases/common/23 endian/prog.c | 24 +++ test cases/common/23 object extraction/lib.c | 3 - test cases/common/23 object extraction/lib2.c | 3 - test cases/common/23 object extraction/main.c | 5 - test cases/common/23 object extraction/meson.build | 23 --- test cases/common/23 object extraction/src/lib.c | 3 - .../common/230 disabler array addition/meson.build | 9 - .../common/230 disabler array addition/test.c | 1 - test cases/common/230 external project/app.c | 7 + test cases/common/230 external project/func.c | 7 + test cases/common/230 external project/func.h | 1 + .../common/230 external project/libfoo/configure | 44 +++++ .../common/230 external project/libfoo/libfoo.c | 8 + .../common/230 external project/libfoo/libfoo.h | 3 + .../common/230 external project/libfoo/meson.build | 22 +++ test cases/common/230 external project/meson.build | 27 +++ test cases/common/230 external project/test.json | 7 + test cases/common/231 external project/app.c | 7 - test cases/common/231 external project/func.c | 7 - test cases/common/231 external project/func.h | 1 - .../common/231 external project/libfoo/configure | 44 ----- .../common/231 external project/libfoo/libfoo.c | 8 - .../common/231 external project/libfoo/libfoo.h | 3 - .../common/231 external project/libfoo/meson.build | 22 --- test cases/common/231 external project/meson.build | 27 --- test cases/common/231 external project/test.json | 7 - test cases/common/231 subdir files/meson.build | 3 + .../common/231 subdir files/subdir/meson.build | 1 + test cases/common/231 subdir files/subdir/prog.c | 1 + .../232 dependency allow_fallback/meson.build | 12 ++ .../subprojects/foob/meson.build | 2 + .../subprojects/foob3/meson.build | 2 + test cases/common/232 subdir files/meson.build | 3 - .../common/232 subdir files/subdir/meson.build | 1 - test cases/common/232 subdir files/subdir/prog.c | 1 - .../233 dependency allow_fallback/meson.build | 12 -- .../subprojects/foob/meson.build | 2 - .../subprojects/foob3/meson.build | 2 - test cases/common/233 wrap case/meson.build | 6 + test cases/common/233 wrap case/prog.c | 13 ++ .../common/233 wrap case/subprojects/up_down.wrap | 5 + .../233 wrap case/subprojects/up_down/meson.build | 3 + .../233 wrap case/subprojects/up_down/up_down.h | 3 + .../common/234 get_file_contents/.gitattributes | 1 + test cases/common/234 get_file_contents/VERSION | 1 + .../common/234 get_file_contents/meson.build | 21 +++ .../common/234 get_file_contents/other/meson.build | 3 + .../common/234 get_file_contents/utf-16-text | Bin 0 -> 150 bytes test cases/common/234 wrap case/meson.build | 6 - test cases/common/234 wrap case/prog.c | 13 -- .../common/234 wrap case/subprojects/up_down.wrap | 5 - .../234 wrap case/subprojects/up_down/meson.build | 3 - .../234 wrap case/subprojects/up_down/up_down.h | 3 - .../common/235 get_file_contents/.gitattributes | 1 - test cases/common/235 get_file_contents/VERSION | 1 - .../common/235 get_file_contents/meson.build | 21 --- .../common/235 get_file_contents/other/meson.build | 3 - .../common/235 get_file_contents/utf-16-text | Bin 150 -> 0 bytes .../235 invalid standard overriden to valid/main.c | 3 + .../meson.build | 8 + .../test.json | 9 + .../236 invalid standard overriden to valid/main.c | 3 - .../meson.build | 8 - .../test.json | 9 - test cases/common/236 proper args splitting/main.c | 11 ++ .../common/236 proper args splitting/meson.build | 9 + .../common/236 proper args splitting/test.json | 9 + test cases/common/237 fstrings/meson.build | 7 + test cases/common/237 proper args splitting/main.c | 11 -- .../common/237 proper args splitting/meson.build | 9 - .../common/237 proper args splitting/test.json | 9 - .../bar/meson.build | 5 + .../meson.build | 5 + .../subprojects/baz.wrap | 3 + .../subprojects/baz/meson.build | 3 + .../subprojects/foo.wrap | 3 + .../subprojects/foo/meson.build | 9 + test cases/common/238 fstrings/meson.build | 7 - .../bar/meson.build | 5 - .../meson.build | 5 - .../subprojects/baz.wrap | 3 - .../subprojects/baz/meson.build | 3 - .../subprojects/foo.wrap | 3 - .../subprojects/foo/meson.build | 9 - .../common/239 includedir violation/meson.build | 11 ++ .../subprojects/sub/include/placeholder.h | 3 + .../subprojects/sub/meson.build | 3 + .../common/239 includedir violation/test.json | 9 + test cases/common/24 endian/meson.build | 7 - test cases/common/24 endian/prog.c | 24 --- test cases/common/24 library versions/lib.c | 14 ++ test cases/common/24 library versions/meson.build | 9 + .../common/24 library versions/subdir/meson.build | 8 + test cases/common/24 library versions/test.json | 7 + .../common/240 includedir violation/meson.build | 11 -- .../subprojects/sub/include/placeholder.h | 3 - .../subprojects/sub/meson.build | 3 - .../common/240 includedir violation/test.json | 9 - .../common/25 config subdir/include/config.h.in | 6 + .../common/25 config subdir/include/meson.build | 4 + test cases/common/25 config subdir/meson.build | 6 + test cases/common/25 config subdir/src/meson.build | 2 + test cases/common/25 config subdir/src/prog.c | 5 + test cases/common/25 library versions/lib.c | 14 -- test cases/common/25 library versions/meson.build | 9 - .../common/25 library versions/subdir/meson.build | 8 - test cases/common/25 library versions/test.json | 7 - .../common/26 config subdir/include/config.h.in | 6 - .../common/26 config subdir/include/meson.build | 4 - test cases/common/26 config subdir/meson.build | 6 - test cases/common/26 config subdir/src/meson.build | 2 - test cases/common/26 config subdir/src/prog.c | 5 - test cases/common/26 find program/meson.build | 35 ++++ .../26 find program/print-version-with-prefix.py | 8 + test cases/common/26 find program/print-version.py | 8 + .../common/26 find program/scripts/test_subdir.py | 3 + test cases/common/26 find program/source.in | 3 + test cases/common/27 find program/meson.build | 35 ---- .../27 find program/print-version-with-prefix.py | 8 - test cases/common/27 find program/print-version.py | 8 - .../common/27 find program/scripts/test_subdir.py | 3 - test cases/common/27 find program/source.in | 3 - test cases/common/27 multiline string/meson.build | 37 ++++ test cases/common/28 multiline string/meson.build | 37 ---- test cases/common/28 try compile/invalid.c | 2 + test cases/common/28 try compile/meson.build | 27 +++ test cases/common/28 try compile/valid.c | 2 + test cases/common/29 compiler id/meson.build | 15 ++ test cases/common/29 try compile/invalid.c | 2 - test cases/common/29 try compile/meson.build | 27 --- test cases/common/29 try compile/valid.c | 2 - test cases/common/30 compiler id/meson.build | 15 -- test cases/common/30 sizeof/config.h.in | 2 + test cases/common/30 sizeof/meson.build | 33 ++++ test cases/common/30 sizeof/prog.c.in | 15 ++ test cases/common/31 define10/config.h.in | 2 + test cases/common/31 define10/meson.build | 12 ++ test cases/common/31 define10/prog.c | 13 ++ test cases/common/31 sizeof/config.h.in | 2 - test cases/common/31 sizeof/meson.build | 33 ---- test cases/common/31 sizeof/prog.c.in | 15 -- test cases/common/32 define10/config.h.in | 2 - test cases/common/32 define10/meson.build | 12 -- test cases/common/32 define10/prog.c | 13 -- test cases/common/32 has header/meson.build | 54 ++++++ test cases/common/32 has header/ouagadougou.h | 1 + test cases/common/33 has header/meson.build | 54 ------ test cases/common/33 has header/ouagadougou.h | 1 - test cases/common/33 run program/check-env.py | 6 + test cases/common/33 run program/get-version.py | 3 + test cases/common/33 run program/meson.build | 85 +++++++++ test cases/common/33 run program/scripts/hello.bat | 2 + test cases/common/33 run program/scripts/hello.sh | 3 + test cases/common/34 logic ops/meson.build | 95 ++++++++++ test cases/common/34 run program/check-env.py | 6 - test cases/common/34 run program/get-version.py | 3 - test cases/common/34 run program/meson.build | 85 --------- test cases/common/34 run program/scripts/hello.bat | 2 - test cases/common/34 run program/scripts/hello.sh | 3 - test cases/common/35 logic ops/meson.build | 95 ---------- test cases/common/35 string operations/meson.build | 122 ++++++++++++ test cases/common/36 has function/meson.build | 116 ++++++++++++ test cases/common/36 string operations/meson.build | 122 ------------ test cases/common/37 has function/meson.build | 116 ------------ test cases/common/37 has member/meson.build | 21 +++ test cases/common/38 alignment/meson.build | 31 ++++ test cases/common/38 has member/meson.build | 21 --- test cases/common/39 alignment/meson.build | 31 ---- test cases/common/39 library chain/main.c | 5 + test cases/common/39 library chain/meson.build | 5 + test cases/common/39 library chain/subdir/lib1.c | 17 ++ .../common/39 library chain/subdir/meson.build | 4 + .../common/39 library chain/subdir/subdir2/lib2.c | 14 ++ .../39 library chain/subdir/subdir2/meson.build | 1 + .../common/39 library chain/subdir/subdir3/lib3.c | 14 ++ .../39 library chain/subdir/subdir3/meson.build | 1 + test cases/common/39 library chain/test.json | 6 + test cases/common/40 library chain/main.c | 5 - test cases/common/40 library chain/meson.build | 5 - test cases/common/40 library chain/subdir/lib1.c | 17 -- .../common/40 library chain/subdir/meson.build | 4 - .../common/40 library chain/subdir/subdir2/lib2.c | 14 -- .../40 library chain/subdir/subdir2/meson.build | 1 - .../common/40 library chain/subdir/subdir3/lib3.c | 14 -- .../40 library chain/subdir/subdir3/meson.build | 1 - test cases/common/40 library chain/test.json | 6 - test cases/common/40 options/meson.build | 45 +++++ test cases/common/40 options/meson_options.txt | 9 + test cases/common/41 options/meson.build | 45 ----- test cases/common/41 options/meson_options.txt | 9 - test cases/common/41 test args/cmd_args.c | 18 ++ test cases/common/41 test args/copyfile.py | 6 + test cases/common/41 test args/env2vars.c | 23 +++ test cases/common/41 test args/envvars.c | 23 +++ test cases/common/41 test args/meson.build | 35 ++++ test cases/common/41 test args/tester.c | 34 ++++ test cases/common/41 test args/tester.py | 7 + test cases/common/41 test args/testfile.txt | 1 + test cases/common/42 subproject/meson.build | 28 +++ .../subprojects/sublib/include/subdefs.h | 21 +++ .../42 subproject/subprojects/sublib/meson.build | 19 ++ .../42 subproject/subprojects/sublib/simpletest.c | 5 + .../42 subproject/subprojects/sublib/sublib.c | 5 + test cases/common/42 subproject/test.json | 7 + test cases/common/42 subproject/user.c | 16 ++ test cases/common/42 test args/cmd_args.c | 18 -- test cases/common/42 test args/copyfile.py | 6 - test cases/common/42 test args/env2vars.c | 23 --- test cases/common/42 test args/envvars.c | 23 --- test cases/common/42 test args/meson.build | 35 ---- test cases/common/42 test args/tester.c | 34 ---- test cases/common/42 test args/tester.py | 7 - test cases/common/42 test args/testfile.txt | 1 - .../common/43 subproject options/meson.build | 7 + .../common/43 subproject options/meson_options.txt | 1 + .../subprojects/subproject/meson.build | 5 + .../subprojects/subproject/meson_options.txt | 1 + test cases/common/43 subproject/meson.build | 28 --- .../subprojects/sublib/include/subdefs.h | 21 --- .../43 subproject/subprojects/sublib/meson.build | 19 -- .../43 subproject/subprojects/sublib/simpletest.c | 5 - .../43 subproject/subprojects/sublib/sublib.c | 5 - test cases/common/43 subproject/test.json | 7 - test cases/common/43 subproject/user.c | 16 -- .../common/44 pkgconfig-gen/dependencies/custom.c | 3 + .../common/44 pkgconfig-gen/dependencies/exposed.c | 3 + .../44 pkgconfig-gen/dependencies/internal.c | 3 + .../common/44 pkgconfig-gen/dependencies/main.c | 10 + .../44 pkgconfig-gen/dependencies/meson.build | 62 +++++++ test cases/common/44 pkgconfig-gen/meson.build | 122 ++++++++++++ test cases/common/44 pkgconfig-gen/simple.c | 5 + test cases/common/44 pkgconfig-gen/simple.h | 6 + test cases/common/44 pkgconfig-gen/simple5.c | 6 + test cases/common/44 pkgconfig-gen/test.json | 15 ++ .../common/44 subproject options/meson.build | 7 - .../common/44 subproject options/meson_options.txt | 1 - .../subprojects/subproject/meson.build | 5 - .../subprojects/subproject/meson_options.txt | 1 - .../common/45 custom install dirs/datafile.cat | 1 + .../common/45 custom install dirs/meson.build | 11 ++ test cases/common/45 custom install dirs/prog.1 | 1 + test cases/common/45 custom install dirs/prog.c | 3 + test cases/common/45 custom install dirs/sample.h | 6 + .../45 custom install dirs/subdir/datafile.dog | 1 + test cases/common/45 custom install dirs/test.json | 16 ++ .../common/45 pkgconfig-gen/dependencies/custom.c | 3 - .../common/45 pkgconfig-gen/dependencies/exposed.c | 3 - .../45 pkgconfig-gen/dependencies/internal.c | 3 - .../common/45 pkgconfig-gen/dependencies/main.c | 10 - .../45 pkgconfig-gen/dependencies/meson.build | 62 ------- test cases/common/45 pkgconfig-gen/meson.build | 122 ------------ test cases/common/45 pkgconfig-gen/simple.c | 5 - test cases/common/45 pkgconfig-gen/simple.h | 6 - test cases/common/45 pkgconfig-gen/simple5.c | 6 - test cases/common/45 pkgconfig-gen/test.json | 15 -- .../common/46 custom install dirs/datafile.cat | 1 - .../common/46 custom install dirs/meson.build | 11 -- test cases/common/46 custom install dirs/prog.1 | 1 - test cases/common/46 custom install dirs/prog.c | 3 - test cases/common/46 custom install dirs/sample.h | 6 - .../46 custom install dirs/subdir/datafile.dog | 1 - test cases/common/46 custom install dirs/test.json | 16 -- .../common/46 subproject subproject/meson.build | 11 ++ test cases/common/46 subproject subproject/prog.c | 5 + .../46 subproject subproject/subprojects/a/a.c | 15 ++ .../subprojects/a/meson.build | 4 + .../46 subproject subproject/subprojects/b/b.c | 14 ++ .../subprojects/b/meson.build | 3 + .../subprojects/c/meson.build | 3 + test cases/common/47 same file name/d1/file.c | 1 + test cases/common/47 same file name/d2/file.c | 1 + test cases/common/47 same file name/meson.build | 3 + test cases/common/47 same file name/prog.c | 6 + .../common/47 subproject subproject/meson.build | 11 -- test cases/common/47 subproject subproject/prog.c | 5 - .../47 subproject subproject/subprojects/a/a.c | 15 -- .../subprojects/a/meson.build | 4 - .../47 subproject subproject/subprojects/b/b.c | 14 -- .../subprojects/b/meson.build | 3 - .../subprojects/c/meson.build | 3 - test cases/common/48 file grabber/a.c | 1 + test cases/common/48 file grabber/b.c | 1 + test cases/common/48 file grabber/c.c | 1 + test cases/common/48 file grabber/grabber.bat | 5 + test cases/common/48 file grabber/grabber.sh | 5 + test cases/common/48 file grabber/grabber2.bat | 5 + test cases/common/48 file grabber/meson.build | 35 ++++ test cases/common/48 file grabber/prog.c | 7 + .../common/48 file grabber/subdir/meson.build | 5 + test cases/common/48 file grabber/subdir/suba.c | 1 + test cases/common/48 file grabber/subdir/subb.c | 1 + test cases/common/48 file grabber/subdir/subc.c | 1 + test cases/common/48 file grabber/subdir/subprog.c | 7 + test cases/common/48 same file name/d1/file.c | 1 - test cases/common/48 same file name/d2/file.c | 1 - test cases/common/48 same file name/meson.build | 3 - test cases/common/48 same file name/prog.c | 6 - test cases/common/49 custom target/data_source.txt | 1 + test cases/common/49 custom target/depfile/dep.py | 15 ++ .../common/49 custom target/depfile/meson.build | 7 + test cases/common/49 custom target/meson.build | 67 +++++++ test cases/common/49 custom target/my_compiler.py | 22 +++ test cases/common/49 custom target/test.json | 5 + test cases/common/49 file grabber/a.c | 1 - test cases/common/49 file grabber/b.c | 1 - test cases/common/49 file grabber/c.c | 1 - test cases/common/49 file grabber/grabber.bat | 5 - test cases/common/49 file grabber/grabber.sh | 5 - test cases/common/49 file grabber/grabber2.bat | 5 - test cases/common/49 file grabber/meson.build | 35 ---- test cases/common/49 file grabber/prog.c | 7 - .../common/49 file grabber/subdir/meson.build | 5 - test cases/common/49 file grabber/subdir/suba.c | 1 - test cases/common/49 file grabber/subdir/subb.c | 1 - test cases/common/49 file grabber/subdir/subc.c | 1 - test cases/common/49 file grabber/subdir/subprog.c | 7 - .../common/50 custom target chain/data_source.txt | 1 + .../common/50 custom target chain/meson.build | 34 ++++ .../common/50 custom target chain/my_compiler.py | 15 ++ .../common/50 custom target chain/my_compiler2.py | 15 ++ test cases/common/50 custom target chain/test.json | 6 + .../50 custom target chain/usetarget/meson.build | 8 + .../50 custom target chain/usetarget/myexe.c | 6 + .../50 custom target chain/usetarget/subcomp.py | 7 + test cases/common/50 custom target/data_source.txt | 1 - test cases/common/50 custom target/depfile/dep.py | 15 -- .../common/50 custom target/depfile/meson.build | 7 - test cases/common/50 custom target/meson.build | 67 ------- test cases/common/50 custom target/my_compiler.py | 22 --- test cases/common/50 custom target/test.json | 5 - .../common/51 custom target chain/data_source.txt | 1 - .../common/51 custom target chain/meson.build | 34 ---- .../common/51 custom target chain/my_compiler.py | 15 -- .../common/51 custom target chain/my_compiler2.py | 15 -- test cases/common/51 custom target chain/test.json | 6 - .../51 custom target chain/usetarget/meson.build | 8 - .../51 custom target chain/usetarget/myexe.c | 6 - .../51 custom target chain/usetarget/subcomp.py | 7 - test cases/common/51 run target/check-env.py | 23 +++ test cases/common/51 run target/check_exists.py | 7 + test cases/common/51 run target/configure.in | 3 + test cases/common/51 run target/converter.py | 6 + test cases/common/51 run target/fakeburner.py | 15 ++ test cases/common/51 run target/helloprinter.c | 11 ++ test cases/common/51 run target/meson.build | 107 +++++++++++ .../common/51 run target/subdir/textprinter.py | 3 + test cases/common/52 object generator/meson.build | 34 ++++ .../common/52 object generator/obj_generator.py | 18 ++ test cases/common/52 object generator/prog.c | 7 + test cases/common/52 object generator/source.c | 3 + test cases/common/52 object generator/source2.c | 3 + test cases/common/52 object generator/source3.c | 3 + test cases/common/52 run target/check-env.py | 23 --- test cases/common/52 run target/check_exists.py | 7 - test cases/common/52 run target/configure.in | 3 - test cases/common/52 run target/converter.py | 6 - test cases/common/52 run target/fakeburner.py | 15 -- test cases/common/52 run target/helloprinter.c | 11 -- test cases/common/52 run target/meson.build | 107 ----------- .../common/52 run target/subdir/textprinter.py | 3 - .../common/53 install script/customtarget.py | 19 ++ test cases/common/53 install script/meson.build | 45 +++++ test cases/common/53 install script/myinstall.py | 31 ++++ test cases/common/53 install script/prog.c | 14 ++ test cases/common/53 install script/src/a file.txt | 0 test cases/common/53 install script/src/foo.c | 10 + .../common/53 install script/src/meson.build | 5 + .../common/53 install script/src/myinstall.py | 14 ++ test cases/common/53 install script/test.json | 15 ++ test cases/common/53 object generator/meson.build | 34 ---- .../common/53 object generator/obj_generator.py | 18 -- test cases/common/53 object generator/prog.c | 7 - test cases/common/53 object generator/source.c | 3 - test cases/common/53 object generator/source2.c | 3 - test cases/common/53 object generator/source3.c | 3 - .../54 custom target source output/generator.py | 16 ++ .../common/54 custom target source output/main.c | 5 + .../54 custom target source output/meson.build | 9 + .../common/54 install script/customtarget.py | 19 -- test cases/common/54 install script/meson.build | 45 ----- test cases/common/54 install script/myinstall.py | 31 ---- test cases/common/54 install script/prog.c | 14 -- test cases/common/54 install script/src/a file.txt | 0 test cases/common/54 install script/src/foo.c | 10 - .../common/54 install script/src/meson.build | 5 - .../common/54 install script/src/myinstall.py | 14 -- test cases/common/54 install script/test.json | 15 -- .../55 custom target source output/generator.py | 16 -- .../common/55 custom target source output/main.c | 5 - .../55 custom target source output/meson.build | 9 - test cases/common/55 exe static shared/meson.build | 15 ++ test cases/common/55 exe static shared/prog.c | 10 + test cases/common/55 exe static shared/shlib2.c | 8 + test cases/common/55 exe static shared/stat.c | 7 + test cases/common/55 exe static shared/stat2.c | 3 + .../common/55 exe static shared/subdir/exports.h | 12 ++ .../common/55 exe static shared/subdir/meson.build | 1 + .../common/55 exe static shared/subdir/shlib.c | 5 + test cases/common/56 array methods/meson.build | 46 +++++ test cases/common/56 exe static shared/meson.build | 15 -- test cases/common/56 exe static shared/prog.c | 10 - test cases/common/56 exe static shared/shlib2.c | 8 - test cases/common/56 exe static shared/stat.c | 7 - test cases/common/56 exe static shared/stat2.c | 3 - .../common/56 exe static shared/subdir/exports.h | 12 -- .../common/56 exe static shared/subdir/meson.build | 1 - .../common/56 exe static shared/subdir/shlib.c | 5 - test cases/common/57 array methods/meson.build | 46 ----- .../common/57 custom header generator/input.def | 1 + .../57 custom header generator/makeheader.py | 12 ++ .../common/57 custom header generator/meson.build | 21 +++ .../common/57 custom header generator/prog.c | 5 + .../common/57 custom header generator/somefile.txt | 0 .../common/58 custom header generator/input.def | 1 - .../58 custom header generator/makeheader.py | 12 -- .../common/58 custom header generator/meson.build | 21 --- .../common/58 custom header generator/prog.c | 5 - .../common/58 custom header generator/somefile.txt | 0 test cases/common/58 multiple generators/data2.dat | 1 + test cases/common/58 multiple generators/main.cpp | 6 + .../common/58 multiple generators/meson.build | 13 ++ test cases/common/58 multiple generators/mygen.py | 22 +++ .../common/58 multiple generators/subdir/data.dat | 1 + .../58 multiple generators/subdir/meson.build | 4 + test cases/common/59 install subdir/meson.build | 21 +++ .../nested_elided/sub/dircheck/ninth.dat | 1 + .../59 install subdir/nested_elided/sub/eighth.dat | 1 + .../common/59 install subdir/sub/sub1/third.dat | 1 + .../common/59 install subdir/sub1/second.dat | 1 + .../sub2/dircheck/excluded-three.dat | 0 .../59 install subdir/sub2/excluded-three.dat | 0 .../common/59 install subdir/sub2/excluded/two.dat | 0 test cases/common/59 install subdir/sub2/one.dat | 0 .../sub_elided/dircheck/fifth.dat | 1 + .../common/59 install subdir/sub_elided/fourth.dat | 1 + .../common/59 install subdir/subdir/meson.build | 5 + .../common/59 install subdir/subdir/sub1/data1.dat | 1 + .../59 install subdir/subdir/sub1/sub2/data2.dat | 1 + .../subdir/sub_elided/dircheck/seventh.dat | 1 + .../59 install subdir/subdir/sub_elided/sixth.dat | 1 + test cases/common/59 install subdir/test.json | 17 ++ test cases/common/59 multiple generators/data2.dat | 1 - test cases/common/59 multiple generators/main.cpp | 6 - .../common/59 multiple generators/meson.build | 13 -- test cases/common/59 multiple generators/mygen.py | 22 --- .../common/59 multiple generators/subdir/data.dat | 1 - .../59 multiple generators/subdir/meson.build | 4 - test cases/common/60 foreach/meson.build | 53 ++++++ test cases/common/60 foreach/prog1.c | 6 + test cases/common/60 foreach/prog2.c | 6 + test cases/common/60 foreach/prog3.c | 6 + test cases/common/60 foreach/test.json | 10 + test cases/common/60 install subdir/meson.build | 21 --- .../nested_elided/sub/dircheck/ninth.dat | 1 - .../60 install subdir/nested_elided/sub/eighth.dat | 1 - .../common/60 install subdir/sub/sub1/third.dat | 1 - .../common/60 install subdir/sub1/second.dat | 1 - .../sub2/dircheck/excluded-three.dat | 0 .../60 install subdir/sub2/excluded-three.dat | 0 .../common/60 install subdir/sub2/excluded/two.dat | 0 test cases/common/60 install subdir/sub2/one.dat | 0 .../sub_elided/dircheck/fifth.dat | 1 - .../common/60 install subdir/sub_elided/fourth.dat | 1 - .../common/60 install subdir/subdir/meson.build | 5 - .../common/60 install subdir/subdir/sub1/data1.dat | 1 - .../60 install subdir/subdir/sub1/sub2/data2.dat | 1 - .../subdir/sub_elided/dircheck/seventh.dat | 1 - .../60 install subdir/subdir/sub_elided/sixth.dat | 1 - test cases/common/60 install subdir/test.json | 17 -- test cases/common/61 foreach/meson.build | 53 ------ test cases/common/61 foreach/prog1.c | 6 - test cases/common/61 foreach/prog2.c | 6 - test cases/common/61 foreach/prog3.c | 6 - test cases/common/61 foreach/test.json | 10 - test cases/common/61 number arithmetic/meson.build | 76 ++++++++ test cases/common/62 number arithmetic/meson.build | 76 -------- test cases/common/62 string arithmetic/meson.build | 16 ++ test cases/common/63 array arithmetic/meson.build | 15 ++ test cases/common/63 string arithmetic/meson.build | 16 -- test cases/common/64 arithmetic bidmas/meson.build | 15 ++ test cases/common/64 array arithmetic/meson.build | 15 -- test cases/common/65 arithmetic bidmas/meson.build | 15 -- test cases/common/65 build always/main.c | 7 + test cases/common/65 build always/meson.build | 14 ++ test cases/common/65 build always/version.c.in | 3 + test cases/common/65 build always/version.h | 3 + test cases/common/65 build always/version_gen.py | 29 +++ test cases/common/66 build always/main.c | 7 - test cases/common/66 build always/meson.build | 14 -- test cases/common/66 build always/version.c.in | 3 - test cases/common/66 build always/version.h | 3 - test cases/common/66 build always/version_gen.py | 29 --- test cases/common/66 vcstag/meson.build | 18 ++ test cases/common/66 vcstag/tagprog.c | 9 + test cases/common/66 vcstag/vcstag.c.in | 2 + test cases/common/67 modules/meson.build | 4 + test cases/common/67 vcstag/meson.build | 18 -- test cases/common/67 vcstag/tagprog.c | 9 - test cases/common/67 vcstag/vcstag.c.in | 2 - test cases/common/68 modules/meson.build | 4 - test cases/common/68 should fail/failing.c | 3 + test cases/common/68 should fail/meson.build | 4 + .../inc/confdata.in | 1 + .../inc/meson.build | 6 + .../69 configure file in custom target/meson.build | 4 + .../src/meson.build | 20 ++ .../src/mycompiler.py | 9 + test cases/common/69 should fail/failing.c | 3 - test cases/common/69 should fail/meson.build | 4 - .../inc/confdata.in | 1 - .../inc/meson.build | 6 - .../70 configure file in custom target/meson.build | 4 - .../src/meson.build | 20 -- .../src/mycompiler.py | 9 - .../common/70 external test program/meson.build | 3 + .../common/70 external test program/mytest.py | 10 + test cases/common/71 ctarget dependency/gen1.py | 12 ++ test cases/common/71 ctarget dependency/gen2.py | 10 + test cases/common/71 ctarget dependency/input.dat | 1 + .../common/71 ctarget dependency/meson.build | 20 ++ .../common/71 external test program/meson.build | 3 - .../common/71 external test program/mytest.py | 10 - test cases/common/72 ctarget dependency/gen1.py | 12 -- test cases/common/72 ctarget dependency/gen2.py | 10 - test cases/common/72 ctarget dependency/input.dat | 1 - .../common/72 ctarget dependency/meson.build | 20 -- test cases/common/72 shared subproject/a.c | 13 ++ test cases/common/72 shared subproject/meson.build | 10 + .../common/72 shared subproject/subprojects/B/b.c | 21 +++ .../72 shared subproject/subprojects/B/meson.build | 4 + .../common/72 shared subproject/subprojects/C/c.c | 14 ++ .../72 shared subproject/subprojects/C/meson.build | 2 + test cases/common/73 shared subproject 2/a.c | 13 ++ .../common/73 shared subproject 2/meson.build | 13 ++ .../73 shared subproject 2/subprojects/B/b.c | 20 ++ .../subprojects/B/meson.build | 4 + .../73 shared subproject 2/subprojects/C/c.c | 14 ++ .../subprojects/C/meson.build | 2 + test cases/common/73 shared subproject/a.c | 13 -- test cases/common/73 shared subproject/meson.build | 10 - .../common/73 shared subproject/subprojects/B/b.c | 21 --- .../73 shared subproject/subprojects/B/meson.build | 4 - .../common/73 shared subproject/subprojects/C/c.c | 14 -- .../73 shared subproject/subprojects/C/meson.build | 2 - test cases/common/74 file object/lib.c | 3 + test cases/common/74 file object/meson.build | 9 + test cases/common/74 file object/prog.c | 13 ++ test cases/common/74 file object/subdir1/lib.c | 3 + .../common/74 file object/subdir1/meson.build | 7 + test cases/common/74 file object/subdir1/prog.c | 13 ++ test cases/common/74 file object/subdir2/lib.c | 3 + .../common/74 file object/subdir2/meson.build | 7 + test cases/common/74 file object/subdir2/prog.c | 13 ++ test cases/common/74 shared subproject 2/a.c | 13 -- .../common/74 shared subproject 2/meson.build | 13 -- .../74 shared subproject 2/subprojects/B/b.c | 20 -- .../subprojects/B/meson.build | 4 - .../74 shared subproject 2/subprojects/C/c.c | 14 -- .../subprojects/C/meson.build | 2 - test cases/common/75 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/75 custom subproject dir/meson.build | 10 + test cases/common/75 file object/lib.c | 3 - test cases/common/75 file object/meson.build | 9 - test cases/common/75 file object/prog.c | 13 -- test cases/common/75 file object/subdir1/lib.c | 3 - .../common/75 file object/subdir1/meson.build | 7 - test cases/common/75 file object/subdir1/prog.c | 13 -- test cases/common/75 file object/subdir2/lib.c | 3 - .../common/75 file object/subdir2/meson.build | 7 - test cases/common/75 file object/subdir2/prog.c | 13 -- test cases/common/76 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/76 custom subproject dir/meson.build | 10 - test cases/common/76 has type/meson.build | 13 ++ .../77 extract from nested subdir/meson.build | 8 + .../src/first/lib_first.c | 3 + .../src/first/meson.build | 1 + .../77 extract from nested subdir/src/meson.build | 1 + .../tst/first/exe_first.c | 5 + .../tst/first/meson.build | 4 + .../77 extract from nested subdir/tst/meson.build | 1 + test cases/common/77 has type/meson.build | 13 -- .../78 extract from nested subdir/meson.build | 8 - .../src/first/lib_first.c | 3 - .../src/first/meson.build | 1 - .../78 extract from nested subdir/src/meson.build | 1 - .../tst/first/exe_first.c | 5 - .../tst/first/meson.build | 4 - .../78 extract from nested subdir/tst/meson.build | 1 - .../common/78 internal dependency/meson.build | 4 + .../78 internal dependency/proj1/include/proj1.h | 5 + .../78 internal dependency/proj1/meson.build | 11 ++ .../common/78 internal dependency/proj1/proj1f1.c | 6 + .../common/78 internal dependency/proj1/proj1f2.c | 6 + .../common/78 internal dependency/proj1/proj1f3.c | 6 + .../common/78 internal dependency/src/main.c | 10 + .../common/78 internal dependency/src/meson.build | 2 + .../common/79 internal dependency/meson.build | 4 - .../79 internal dependency/proj1/include/proj1.h | 5 - .../79 internal dependency/proj1/meson.build | 11 -- .../common/79 internal dependency/proj1/proj1f1.c | 6 - .../common/79 internal dependency/proj1/proj1f2.c | 6 - .../common/79 internal dependency/proj1/proj1f3.c | 6 - .../common/79 internal dependency/src/main.c | 10 - .../common/79 internal dependency/src/meson.build | 2 - test cases/common/79 same basename/exe1.c | 5 + test cases/common/79 same basename/exe2.c | 5 + test cases/common/79 same basename/lib.c | 23 +++ test cases/common/79 same basename/meson.build | 14 ++ .../common/79 same basename/sharedsub/meson.build | 1 + .../common/79 same basename/staticsub/meson.build | 3 + test cases/common/80 declare dep/entity/entity.h | 4 + test cases/common/80 declare dep/entity/entity1.c | 9 + test cases/common/80 declare dep/entity/entity2.c | 5 + .../common/80 declare dep/entity/meson.build | 10 + test cases/common/80 declare dep/main.c | 18 ++ test cases/common/80 declare dep/meson.build | 24 +++ test cases/common/80 same basename/exe1.c | 5 - test cases/common/80 same basename/exe2.c | 5 - test cases/common/80 same basename/lib.c | 23 --- test cases/common/80 same basename/meson.build | 14 -- .../common/80 same basename/sharedsub/meson.build | 1 - .../common/80 same basename/staticsub/meson.build | 3 - test cases/common/81 declare dep/entity/entity.h | 4 - test cases/common/81 declare dep/entity/entity1.c | 9 - test cases/common/81 declare dep/entity/entity2.c | 5 - .../common/81 declare dep/entity/meson.build | 10 - test cases/common/81 declare dep/main.c | 18 -- test cases/common/81 declare dep/meson.build | 24 --- test cases/common/81 extract all/extractor.h | 6 + test cases/common/81 extract all/four.c | 5 + test cases/common/81 extract all/meson.build | 13 ++ test cases/common/81 extract all/one.c | 5 + test cases/common/81 extract all/prog.c | 10 + test cases/common/81 extract all/three.c | 5 + test cases/common/81 extract all/two.c | 5 + test cases/common/82 add language/meson.build | 10 + test cases/common/82 add language/prog.c | 6 + test cases/common/82 add language/prog.cc | 6 + test cases/common/82 extract all/extractor.h | 6 - test cases/common/82 extract all/four.c | 5 - test cases/common/82 extract all/meson.build | 13 -- test cases/common/82 extract all/one.c | 5 - test cases/common/82 extract all/prog.c | 10 - test cases/common/82 extract all/three.c | 5 - test cases/common/82 extract all/two.c | 5 - test cases/common/83 add language/meson.build | 10 - test cases/common/83 add language/prog.c | 6 - test cases/common/83 add language/prog.cc | 6 - .../83 identical target name in subproject/bar.c | 6 + .../meson.build | 9 + .../subprojects/foo/bar.c | 6 + .../subprojects/foo/meson.build | 7 + .../subprojects/foo/true.py | 4 + .../83 identical target name in subproject/true.py | 4 + .../84 identical target name in subproject/bar.c | 6 - .../meson.build | 9 - .../subprojects/foo/bar.c | 6 - .../subprojects/foo/meson.build | 7 - .../subprojects/foo/true.py | 4 - .../84 identical target name in subproject/true.py | 4 - test cases/common/84 plusassign/meson.build | 70 +++++++ test cases/common/85 plusassign/meson.build | 70 ------- test cases/common/85 skip subdir/meson.build | 3 + .../common/85 skip subdir/subdir1/meson.build | 1 + .../85 skip subdir/subdir1/subdir2/meson.build | 1 + test cases/common/86 private include/meson.build | 4 + .../common/86 private include/stlib/compiler.py | 32 ++++ .../common/86 private include/stlib/foo1.def | 0 .../common/86 private include/stlib/foo2.def | 0 .../common/86 private include/stlib/meson.build | 12 ++ .../common/86 private include/user/libuser.c | 6 + .../common/86 private include/user/meson.build | 5 + test cases/common/86 skip subdir/meson.build | 3 - .../common/86 skip subdir/subdir1/meson.build | 1 - .../86 skip subdir/subdir1/subdir2/meson.build | 1 - test cases/common/87 default options/meson.build | 33 ++++ .../subprojects/sub1/meson.build | 3 + .../subprojects/sub1/meson_options.txt | 1 + test cases/common/87 private include/meson.build | 4 - .../common/87 private include/stlib/compiler.py | 32 ---- .../common/87 private include/stlib/foo1.def | 0 .../common/87 private include/stlib/foo2.def | 0 .../common/87 private include/stlib/meson.build | 12 -- .../common/87 private include/user/libuser.c | 6 - .../common/87 private include/user/meson.build | 5 - test cases/common/88 default options/meson.build | 33 ---- .../subprojects/sub1/meson.build | 3 - .../subprojects/sub1/meson_options.txt | 1 - test cases/common/88 dep fallback/gensrc.py | 6 + test cases/common/88 dep fallback/meson.build | 25 +++ .../88 dep fallback/subprojects/boblib/bob.c | 8 + .../88 dep fallback/subprojects/boblib/bob.h | 6 + .../88 dep fallback/subprojects/boblib/genbob.py | 6 + .../88 dep fallback/subprojects/boblib/meson.build | 16 ++ .../subprojects/dummylib/meson.build | 4 + test cases/common/88 dep fallback/tester.c | 14 ++ test cases/common/89 default library/ef.cpp | 8 + test cases/common/89 default library/ef.h | 22 +++ test cases/common/89 default library/eftest.cpp | 14 ++ test cases/common/89 default library/meson.build | 10 + test cases/common/89 dep fallback/gensrc.py | 6 - test cases/common/89 dep fallback/meson.build | 25 --- .../89 dep fallback/subprojects/boblib/bob.c | 8 - .../89 dep fallback/subprojects/boblib/bob.h | 6 - .../89 dep fallback/subprojects/boblib/genbob.py | 6 - .../89 dep fallback/subprojects/boblib/meson.build | 16 -- .../subprojects/dummylib/meson.build | 4 - test cases/common/89 dep fallback/tester.c | 14 -- test cases/common/90 default library/ef.cpp | 8 - test cases/common/90 default library/ef.h | 22 --- test cases/common/90 default library/eftest.cpp | 14 -- test cases/common/90 default library/meson.build | 10 - test cases/common/90 gen extra/meson.build | 40 ++++ test cases/common/90 gen extra/name.dat | 1 + test cases/common/90 gen extra/name.l | 3 + test cases/common/90 gen extra/plain.c | 5 + test cases/common/90 gen extra/srcgen.py | 27 +++ test cases/common/90 gen extra/srcgen2.py | 32 ++++ test cases/common/90 gen extra/srcgen3.py | 15 ++ test cases/common/90 gen extra/upper.c | 5 + test cases/common/91 benchmark/delayer.c | 20 ++ test cases/common/91 benchmark/meson.build | 4 + test cases/common/91 gen extra/meson.build | 40 ---- test cases/common/91 gen extra/name.dat | 1 - test cases/common/91 gen extra/name.l | 3 - test cases/common/91 gen extra/plain.c | 5 - test cases/common/91 gen extra/srcgen.py | 27 --- test cases/common/91 gen extra/srcgen2.py | 32 ---- test cases/common/91 gen extra/srcgen3.py | 15 -- test cases/common/91 gen extra/upper.c | 5 - test cases/common/92 benchmark/delayer.c | 20 -- test cases/common/92 benchmark/meson.build | 4 - test cases/common/92 test workdir/meson.build | 8 + test cases/common/92 test workdir/opener.c | 12 ++ .../common/92 test workdir/subdir/checker.py | 5 + .../common/92 test workdir/subdir/meson.build | 4 + test cases/common/93 suites/exe1.c | 6 + test cases/common/93 suites/exe2.c | 6 + test cases/common/93 suites/meson.build | 9 + .../common/93 suites/subprojects/sub/meson.build | 7 + test cases/common/93 suites/subprojects/sub/sub1.c | 6 + test cases/common/93 suites/subprojects/sub/sub2.c | 6 + test cases/common/93 test workdir/meson.build | 8 - test cases/common/93 test workdir/opener.c | 12 -- .../common/93 test workdir/subdir/checker.py | 5 - .../common/93 test workdir/subdir/meson.build | 4 - test cases/common/94 suites/exe1.c | 6 - test cases/common/94 suites/exe2.c | 6 - test cases/common/94 suites/meson.build | 9 - .../common/94 suites/subprojects/sub/meson.build | 7 - test cases/common/94 suites/subprojects/sub/sub1.c | 6 - test cases/common/94 suites/subprojects/sub/sub2.c | 6 - test cases/common/94 threads/meson.build | 16 ++ test cases/common/94 threads/threadprog.c | 40 ++++ test cases/common/94 threads/threadprog.cpp | 43 +++++ test cases/common/95 manygen/depuser.c | 8 + test cases/common/95 manygen/meson.build | 14 ++ test cases/common/95 manygen/subdir/funcinfo.def | 1 + test cases/common/95 manygen/subdir/manygen.py | 82 +++++++++ test cases/common/95 manygen/subdir/meson.build | 26 +++ test cases/common/95 threads/meson.build | 16 -- test cases/common/95 threads/threadprog.c | 40 ---- test cases/common/95 threads/threadprog.cpp | 43 ----- test cases/common/96 manygen/depuser.c | 8 - test cases/common/96 manygen/meson.build | 14 -- test cases/common/96 manygen/subdir/funcinfo.def | 1 - test cases/common/96 manygen/subdir/manygen.py | 82 --------- test cases/common/96 manygen/subdir/meson.build | 26 --- test cases/common/96 stringdef/meson.build | 3 + test cases/common/96 stringdef/stringdef.c | 10 + test cases/common/97 find program path/meson.build | 22 +++ test cases/common/97 find program path/program.py | 3 + test cases/common/97 stringdef/meson.build | 3 - test cases/common/97 stringdef/stringdef.c | 10 - test cases/common/98 find program path/meson.build | 22 --- test cases/common/98 find program path/program.py | 3 - test cases/common/98 subproject subdir/meson.build | 67 +++++++ test cases/common/98 subproject subdir/prog.c | 5 + .../subprojects/sub/lib/meson.build | 3 + .../98 subproject subdir/subprojects/sub/lib/sub.c | 5 + .../98 subproject subdir/subprojects/sub/lib/sub.h | 6 + .../subprojects/sub/meson.build | 2 + .../subprojects/sub_implicit.wrap | 6 + .../subprojects/sub_implicit/meson.build | 11 ++ .../sub_implicit/subprojects/subsub/foo.h | 1 + .../sub_implicit/subprojects/subsub/meson.build | 7 + .../subprojects/packagefiles/subsubsub-1.0.zip | Bin 0 -> 455 bytes .../subprojects/subsub/subprojects/subsubsub.wrap | 4 + .../subprojects/sub_novar/meson.build | 4 + test cases/common/98 subproject subdir/test.json | 5 + test cases/common/99 postconf/meson.build | 5 + test cases/common/99 postconf/postconf.py | 16 ++ test cases/common/99 postconf/prog.c | 5 + test cases/common/99 postconf/raw.dat | 1 + test cases/common/99 subproject subdir/meson.build | 67 ------- test cases/common/99 subproject subdir/prog.c | 5 - .../subprojects/sub/lib/meson.build | 3 - .../99 subproject subdir/subprojects/sub/lib/sub.c | 5 - .../99 subproject subdir/subprojects/sub/lib/sub.h | 6 - .../subprojects/sub/meson.build | 2 - .../subprojects/sub_implicit.wrap | 6 - .../subprojects/sub_implicit/meson.build | 11 -- .../sub_implicit/subprojects/subsub/foo.h | 1 - .../sub_implicit/subprojects/subsub/meson.build | 7 - .../subprojects/packagefiles/subsubsub-1.0.zip | Bin 455 -> 0 bytes .../subprojects/subsub/subprojects/subsubsub.wrap | 4 - .../subprojects/sub_novar/meson.build | 4 - test cases/common/99 subproject subdir/test.json | 5 - test cases/unit/63 cmake_prefix_path/meson.build | 4 + .../lib/cmake/mesontest/mesontest-config.cmake | 4 + test cases/unit/64 cmake parser/meson.build | 19 ++ .../lib/cmake/mesontest/mesontest-config.cmake | 63 +++++++ test cases/unit/64 cmake_prefix_path/meson.build | 4 - .../lib/cmake/mesontest/mesontest-config.cmake | 4 - test cases/unit/65 alias target/main.c | 3 + test cases/unit/65 alias target/meson.build | 15 ++ 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 -- .../unit/66 static archive stripping/app/appA.c | 4 + .../unit/66 static archive stripping/app/appB.c | 4 + .../66 static archive stripping/app/meson.build | 7 + .../unit/66 static archive stripping/lib/libA.c | 5 + .../unit/66 static archive stripping/lib/libA.h | 1 + .../unit/66 static archive stripping/lib/libB.c | 5 + .../unit/66 static archive stripping/lib/libB.h | 1 + .../66 static archive stripping/lib/meson.build | 23 +++ .../unit/67 static archive stripping/app/appA.c | 4 - .../unit/67 static archive stripping/app/appB.c | 4 - .../67 static archive stripping/app/meson.build | 7 - .../unit/67 static archive stripping/lib/libA.c | 5 - .../unit/67 static archive stripping/lib/libA.h | 1 - .../unit/67 static archive stripping/lib/libB.c | 5 - .../unit/67 static archive stripping/lib/libB.h | 1 - .../67 static archive stripping/lib/meson.build | 23 --- test cases/unit/67 static link/lib/func1.c | 9 + test cases/unit/67 static link/lib/func10.c | 4 + test cases/unit/67 static link/lib/func11.c | 6 + test cases/unit/67 static link/lib/func12.c | 7 + test cases/unit/67 static link/lib/func14.c | 4 + test cases/unit/67 static link/lib/func15.c | 6 + test cases/unit/67 static link/lib/func16.c | 6 + test cases/unit/67 static link/lib/func17.c | 4 + test cases/unit/67 static link/lib/func18.c | 6 + test cases/unit/67 static link/lib/func19.c | 7 + test cases/unit/67 static link/lib/func2.c | 6 + test cases/unit/67 static link/lib/func3.c | 4 + test cases/unit/67 static link/lib/func4.c | 6 + test cases/unit/67 static link/lib/func5.c | 4 + test cases/unit/67 static link/lib/func6.c | 6 + test cases/unit/67 static link/lib/func7.c | 4 + test cases/unit/67 static link/lib/func8.c | 6 + test cases/unit/67 static link/lib/func9.c | 6 + test cases/unit/67 static link/lib/meson.build | 80 ++++++++ test cases/unit/67 static link/meson.build | 32 ++++ test cases/unit/67 static link/test1.c | 7 + test cases/unit/67 static link/test2.c | 6 + test cases/unit/67 static link/test3.c | 6 + test cases/unit/67 static link/test4.c | 6 + test cases/unit/67 static link/test5.c | 6 + test cases/unit/68 static link/lib/func1.c | 9 - test cases/unit/68 static link/lib/func10.c | 4 - test cases/unit/68 static link/lib/func11.c | 6 - test cases/unit/68 static link/lib/func12.c | 7 - test cases/unit/68 static link/lib/func14.c | 4 - test cases/unit/68 static link/lib/func15.c | 6 - test cases/unit/68 static link/lib/func16.c | 6 - test cases/unit/68 static link/lib/func17.c | 4 - test cases/unit/68 static link/lib/func18.c | 6 - test cases/unit/68 static link/lib/func19.c | 7 - test cases/unit/68 static link/lib/func2.c | 6 - test cases/unit/68 static link/lib/func3.c | 4 - test cases/unit/68 static link/lib/func4.c | 6 - test cases/unit/68 static link/lib/func5.c | 4 - test cases/unit/68 static link/lib/func6.c | 6 - test cases/unit/68 static link/lib/func7.c | 4 - test cases/unit/68 static link/lib/func8.c | 6 - test cases/unit/68 static link/lib/func9.c | 6 - test cases/unit/68 static link/lib/meson.build | 80 -------- test cases/unit/68 static link/meson.build | 32 ---- test cases/unit/68 static link/test1.c | 7 - test cases/unit/68 static link/test2.c | 6 - test cases/unit/68 static link/test3.c | 6 - test cases/unit/68 static link/test4.c | 6 - test cases/unit/68 static link/test5.c | 6 - test cases/unit/68 test env value/meson.build | 10 + test cases/unit/68 test env value/test.py | 6 + test cases/unit/69 clang-tidy/.clang-tidy | 1 + test cases/unit/69 clang-tidy/cttest.cpp | 7 + test cases/unit/69 clang-tidy/dummydir.h/dummy.dat | 1 + test cases/unit/69 clang-tidy/meson.build | 3 + test cases/unit/69 test env value/meson.build | 10 - test cases/unit/69 test env value/test.py | 6 - test cases/unit/70 clang-tidy/.clang-tidy | 1 - test cases/unit/70 clang-tidy/cttest.cpp | 7 - test cases/unit/70 clang-tidy/dummydir.h/dummy.dat | 1 - test cases/unit/70 clang-tidy/meson.build | 3 - test cases/unit/70 cross/crossfile.in | 5 + test cases/unit/70 cross/meson.build | 16 ++ test cases/unit/70 cross/meson_options.txt | 1 + test cases/unit/71 cross test passed/exewrapper.py | 24 +++ test cases/unit/71 cross test passed/meson.build | 19 ++ .../unit/71 cross test passed/meson_options.txt | 5 + test cases/unit/71 cross test passed/script.py | 7 + test cases/unit/71 cross test passed/src/main.c | 6 + test cases/unit/71 cross/crossfile.in | 5 - test cases/unit/71 cross/meson.build | 16 -- test cases/unit/71 cross/meson_options.txt | 1 - test cases/unit/72 cross test passed/exewrapper.py | 24 --- test cases/unit/72 cross test passed/meson.build | 19 -- .../unit/72 cross test passed/meson_options.txt | 5 - test cases/unit/72 cross test passed/script.py | 7 - test cases/unit/72 cross test passed/src/main.c | 6 - test cases/unit/72 summary/meson.build | 22 +++ test cases/unit/72 summary/meson_options.txt | 1 + .../unit/72 summary/subprojects/sub/meson.build | 4 + .../unit/72 summary/subprojects/sub2/meson.build | 5 + test cases/unit/73 summary/meson.build | 22 --- test cases/unit/73 summary/meson_options.txt | 1 - .../unit/73 summary/subprojects/sub/meson.build | 4 - .../unit/73 summary/subprojects/sub2/meson.build | 5 - test cases/unit/73 wrap file url/meson.build | 4 + .../73 wrap file url/subprojects/foo-patch.tar.xz | Bin 0 -> 228 bytes .../unit/73 wrap file url/subprojects/foo.tar.xz | Bin 0 -> 216 bytes test cases/unit/74 dep files/foo.c | 0 test cases/unit/74 dep files/meson.build | 16 ++ test cases/unit/74 wrap file url/meson.build | 4 - .../74 wrap file url/subprojects/foo-patch.tar.xz | Bin 228 -> 0 bytes .../unit/74 wrap file url/subprojects/foo.tar.xz | Bin 216 -> 0 bytes test cases/unit/75 dep files/foo.c | 0 test cases/unit/75 dep files/meson.build | 16 -- .../unit/75 pkgconfig prefixes/client/client.c | 8 + .../unit/75 pkgconfig prefixes/client/meson.build | 3 + .../unit/75 pkgconfig prefixes/val1/meson.build | 5 + test cases/unit/75 pkgconfig prefixes/val1/val1.c | 3 + test cases/unit/75 pkgconfig prefixes/val1/val1.h | 1 + .../unit/75 pkgconfig prefixes/val2/meson.build | 8 + test cases/unit/75 pkgconfig prefixes/val2/val2.c | 4 + test cases/unit/75 pkgconfig prefixes/val2/val2.h | 1 + .../unit/76 pkgconfig prefixes/client/client.c | 8 - .../unit/76 pkgconfig prefixes/client/meson.build | 3 - .../unit/76 pkgconfig prefixes/val1/meson.build | 5 - test cases/unit/76 pkgconfig prefixes/val1/val1.c | 3 - test cases/unit/76 pkgconfig prefixes/val1/val1.h | 1 - .../unit/76 pkgconfig prefixes/val2/meson.build | 8 - test cases/unit/76 pkgconfig prefixes/val2/val2.c | 4 - test cases/unit/76 pkgconfig prefixes/val2/val2.h | 1 - test cases/unit/76 subdir libdir/meson.build | 2 + .../76 subdir libdir/subprojects/flub/meson.build | 1 + test cases/unit/77 as link whole/bar.c | 6 + test cases/unit/77 as link whole/foo.c | 6 + test cases/unit/77 as link whole/meson.build | 11 ++ test cases/unit/77 subdir libdir/meson.build | 2 - .../77 subdir libdir/subprojects/flub/meson.build | 1 - test cases/unit/78 as link whole/bar.c | 6 - test cases/unit/78 as link whole/foo.c | 6 - test cases/unit/78 as link whole/meson.build | 11 -- test cases/unit/78 nostdlib/meson.build | 14 ++ test cases/unit/78 nostdlib/prog.c | 7 + .../unit/78 nostdlib/subprojects/mylibc/libc.c | 35 ++++ .../78 nostdlib/subprojects/mylibc/meson.build | 13 ++ .../unit/78 nostdlib/subprojects/mylibc/stdio.h | 5 + .../78 nostdlib/subprojects/mylibc/stubstart.s | 8 + test cases/unit/79 nostdlib/meson.build | 14 -- test cases/unit/79 nostdlib/prog.c | 7 - .../unit/79 nostdlib/subprojects/mylibc/libc.c | 35 ---- .../79 nostdlib/subprojects/mylibc/meson.build | 13 -- .../unit/79 nostdlib/subprojects/mylibc/stdio.h | 5 - .../79 nostdlib/subprojects/mylibc/stubstart.s | 8 - .../unit/79 user options for subproject/.gitignore | 1 + .../75 user options for subproject/.gitignore | 1 + .../75 user options for subproject/meson.build | 3 + test cases/unit/80 global-rpath/meson.build | 3 + test cases/unit/80 global-rpath/rpathified.cpp | 6 + test cases/unit/80 global-rpath/yonder/meson.build | 5 + test cases/unit/80 global-rpath/yonder/yonder.cpp | 3 + test cases/unit/80 global-rpath/yonder/yonder.h | 1 + .../unit/80 user options for subproject/.gitignore | 1 - .../75 user options for subproject/.gitignore | 1 - .../75 user options for subproject/meson.build | 3 - test cases/unit/81 global-rpath/meson.build | 3 - test cases/unit/81 global-rpath/rpathified.cpp | 6 - test cases/unit/81 global-rpath/yonder/meson.build | 5 - test cases/unit/81 global-rpath/yonder/yonder.cpp | 3 - test cases/unit/81 global-rpath/yonder/yonder.h | 1 - test cases/unit/81 wrap-git/meson.build | 4 + .../packagefiles/wrap_git_builddef/meson.build | 3 + .../subprojects/wrap_git_upstream/main.c | 4 + .../unit/82 meson version compare/meson.build | 17 ++ test cases/unit/82 wrap-git/meson.build | 4 - .../packagefiles/wrap_git_builddef/meson.build | 3 - .../subprojects/wrap_git_upstream/main.c | 4 - .../unit/83 cross only introspect/meson.build | 2 + .../unit/83 meson version compare/meson.build | 17 -- .../unit/84 change option choices/meson.build | 1 + .../84 change option choices/meson_options.1.txt | 13 ++ .../84 change option choices/meson_options.2.txt | 13 ++ .../unit/84 cross only introspect/meson.build | 2 - .../unit/85 change option choices/meson.build | 1 - .../85 change option choices/meson_options.1.txt | 13 -- .../85 change option choices/meson_options.2.txt | 13 -- .../85 nested subproject regenerate depends/main.c | 3 + .../meson.build | 6 + .../subprojects/sub1/meson.build | 4 + .../subprojects/sub2/CMakeLists.txt | 1 + test cases/unit/86 cpp modules/main.cpp | 7 + test cases/unit/86 cpp modules/meson.build | 17 ++ test cases/unit/86 cpp modules/src0.ixx | 7 + test cases/unit/86 cpp modules/src1.ixx | 7 + test cases/unit/86 cpp modules/src2.ixx | 7 + test cases/unit/86 cpp modules/src3.ixx | 7 + test cases/unit/86 cpp modules/src4.ixx | 7 + test cases/unit/86 cpp modules/src5.ixx | 7 + test cases/unit/86 cpp modules/src6.ixx | 7 + test cases/unit/86 cpp modules/src7.ixx | 7 + test cases/unit/86 cpp modules/src8.ixx | 7 + test cases/unit/86 cpp modules/src9.ixx | 5 + .../86 nested subproject regenerate depends/main.c | 3 - .../meson.build | 6 - .../subprojects/sub1/meson.build | 4 - .../subprojects/sub2/CMakeLists.txt | 1 - test cases/unit/87 cpp modules/main.cpp | 7 - test cases/unit/87 cpp modules/meson.build | 17 -- test cases/unit/87 cpp modules/src0.ixx | 7 - test cases/unit/87 cpp modules/src1.ixx | 7 - test cases/unit/87 cpp modules/src2.ixx | 7 - test cases/unit/87 cpp modules/src3.ixx | 7 - test cases/unit/87 cpp modules/src4.ixx | 7 - test cases/unit/87 cpp modules/src5.ixx | 7 - test cases/unit/87 cpp modules/src6.ixx | 7 - test cases/unit/87 cpp modules/src7.ixx | 7 - test cases/unit/87 cpp modules/src8.ixx | 7 - test cases/unit/87 cpp modules/src9.ixx | 5 - test cases/unit/87 prelinking/file1.c | 14 ++ test cases/unit/87 prelinking/file2.c | 9 + test cases/unit/87 prelinking/file3.c | 9 + test cases/unit/87 prelinking/file4.c | 9 + test cases/unit/87 prelinking/main.c | 10 + test cases/unit/87 prelinking/meson.build | 8 + test cases/unit/87 prelinking/private_header.h | 11 ++ test cases/unit/87 prelinking/public_header.h | 3 + test cases/unit/88 prelinking/file1.c | 14 -- test cases/unit/88 prelinking/file2.c | 9 - test cases/unit/88 prelinking/file3.c | 9 - test cases/unit/88 prelinking/file4.c | 9 - test cases/unit/88 prelinking/main.c | 10 - test cases/unit/88 prelinking/meson.build | 8 - test cases/unit/88 prelinking/private_header.h | 11 -- test cases/unit/88 prelinking/public_header.h | 3 - test cases/unit/88 run native test/main.c | 17 ++ test cases/unit/88 run native test/meson.build | 6 + test cases/unit/89 multiple envvars/meson.build | 4 + test cases/unit/89 multiple envvars/prog.c | 18 ++ test cases/unit/89 multiple envvars/prog.cpp | 18 ++ test cases/unit/89 run native test/main.c | 17 -- test cases/unit/89 run native test/meson.build | 6 - test cases/unit/90 multiple envvars/meson.build | 4 - test cases/unit/90 multiple envvars/prog.c | 18 -- test cases/unit/90 multiple envvars/prog.cpp | 18 -- test cases/unit/91 install skip subprojects/foo.c | 4 - .../unit/91 install skip subprojects/foo.dat | 1 - test cases/unit/91 install skip subprojects/foo.h | 1 - .../unit/91 install skip subprojects/foo/foofile | 0 .../unit/91 install skip subprojects/meson.build | 8 - .../subprojects/bar/bar.c | 4 - .../subprojects/bar/bar.dat | 1 - .../subprojects/bar/bar.h | 1 - .../subprojects/bar/bar/barfile | 1 - .../subprojects/bar/meson.build | 6 - test cases/unit/92 install skip subprojects/foo.c | 4 + .../unit/92 install skip subprojects/foo.dat | 1 + test cases/unit/92 install skip subprojects/foo.h | 1 + .../unit/92 install skip subprojects/foo/foofile | 0 .../unit/92 install skip subprojects/meson.build | 8 + .../subprojects/bar/bar.c | 4 + .../subprojects/bar/bar.dat | 1 + .../subprojects/bar/bar.h | 1 + .../subprojects/bar/bar/barfile | 1 + .../subprojects/bar/meson.build | 6 + .../meson.build | 7 - .../meson_options.txt | 3 - .../subprojects/sub/foo.c | 6 - .../subprojects/sub/meson.build | 7 - test cases/unit/93 clangformat/.clang-format | 4 - .../unit/93 clangformat/.clang-format-ignore | 3 - .../unit/93 clangformat/.clang-format-include | 3 - test cases/unit/93 clangformat/meson.build | 1 - .../unit/93 clangformat/not-included/badformat.cpp | 2 - test cases/unit/93 clangformat/src/badformat.c | 2 - test cases/unit/93 clangformat/src/badformat.cpp | 2 - .../meson.build | 7 + .../meson_options.txt | 3 + .../subprojects/sub/foo.c | 6 + .../subprojects/sub/meson.build | 7 + test cases/unit/94 clangformat/.clang-format | 4 + .../unit/94 clangformat/.clang-format-ignore | 3 + .../unit/94 clangformat/.clang-format-include | 3 + test cases/unit/94 clangformat/meson.build | 1 + .../unit/94 clangformat/not-included/badformat.cpp | 2 + test cases/unit/94 clangformat/src/badformat.c | 2 + test cases/unit/94 clangformat/src/badformat.cpp | 2 + test cases/unit/94 custominc/easytogrepfor/genh.py | 7 - .../unit/94 custominc/easytogrepfor/meson.build | 3 - test cases/unit/94 custominc/helper.c | 5 - test cases/unit/94 custominc/meson.build | 9 - test cases/unit/94 custominc/prog.c | 9 - test cases/unit/94 custominc/prog2.c | 10 - test cases/unit/95 custominc/easytogrepfor/genh.py | 7 + .../unit/95 custominc/easytogrepfor/meson.build | 3 + test cases/unit/95 custominc/helper.c | 5 + test cases/unit/95 custominc/meson.build | 9 + test cases/unit/95 custominc/prog.c | 9 + test cases/unit/95 custominc/prog2.c | 10 + 2461 files changed, 15322 insertions(+), 15322 deletions(-) create mode 100644 test cases/common/100 postconf with args/meson.build create mode 100644 test cases/common/100 postconf with args/postconf.py create mode 100644 test cases/common/100 postconf with args/prog.c create mode 100644 test cases/common/100 postconf with args/raw.dat delete mode 100644 test cases/common/100 postconf/meson.build delete mode 100644 test cases/common/100 postconf/postconf.py delete mode 100644 test cases/common/100 postconf/prog.c delete mode 100644 test cases/common/100 postconf/raw.dat delete mode 100644 test cases/common/101 postconf with args/meson.build delete mode 100644 test cases/common/101 postconf with args/postconf.py delete mode 100644 test cases/common/101 postconf with args/prog.c delete mode 100644 test cases/common/101 postconf with args/raw.dat create mode 100644 test cases/common/101 testframework options/meson.build create mode 100644 test cases/common/101 testframework options/meson_options.txt create mode 100644 test cases/common/101 testframework options/test.json create mode 100644 test cases/common/102 extract same name/lib.c create mode 100644 test cases/common/102 extract same name/main.c create mode 100644 test cases/common/102 extract same name/meson.build create mode 100644 test cases/common/102 extract same name/src/lib.c delete mode 100644 test cases/common/102 testframework options/meson.build delete mode 100644 test cases/common/102 testframework options/meson_options.txt delete mode 100644 test cases/common/102 testframework options/test.json delete mode 100644 test cases/common/103 extract same name/lib.c delete mode 100644 test cases/common/103 extract same name/main.c delete mode 100644 test cases/common/103 extract same name/meson.build delete mode 100644 test cases/common/103 extract same name/src/lib.c create mode 100644 test cases/common/103 has header symbol/meson.build create mode 100644 test cases/common/104 has arg/meson.build delete mode 100644 test cases/common/104 has header symbol/meson.build create mode 100755 test cases/common/105 generatorcustom/catter.py create mode 100755 test cases/common/105 generatorcustom/gen-resx.py create mode 100755 test cases/common/105 generatorcustom/gen.py create mode 100644 test cases/common/105 generatorcustom/main.c create mode 100644 test cases/common/105 generatorcustom/meson.build create mode 100644 test cases/common/105 generatorcustom/res1.txt create mode 100644 test cases/common/105 generatorcustom/res2.txt delete mode 100644 test cases/common/105 has arg/meson.build delete mode 100755 test cases/common/106 generatorcustom/catter.py delete mode 100755 test cases/common/106 generatorcustom/gen-resx.py delete mode 100755 test cases/common/106 generatorcustom/gen.py delete mode 100644 test cases/common/106 generatorcustom/main.c delete mode 100644 test cases/common/106 generatorcustom/meson.build delete mode 100644 test cases/common/106 generatorcustom/res1.txt delete mode 100644 test cases/common/106 generatorcustom/res2.txt create mode 100644 test cases/common/106 multiple dir configure file/meson.build create mode 100644 test cases/common/106 multiple dir configure file/subdir/foo.txt create mode 100644 test cases/common/106 multiple dir configure file/subdir/meson.build create mode 100644 test cases/common/106 multiple dir configure file/subdir/someinput.in delete mode 100644 test cases/common/107 multiple dir configure file/meson.build delete mode 100644 test cases/common/107 multiple dir configure file/subdir/foo.txt delete mode 100644 test cases/common/107 multiple dir configure file/subdir/meson.build delete mode 100644 test cases/common/107 multiple dir configure file/subdir/someinput.in create mode 100644 test cases/common/107 spaces backslash/asm output/meson.build create mode 100644 test cases/common/107 spaces backslash/comparer-end-notstring.c create mode 100644 test cases/common/107 spaces backslash/comparer-end.c create mode 100644 test cases/common/107 spaces backslash/comparer.c create mode 100644 test cases/common/107 spaces backslash/include/comparer.h create mode 100644 test cases/common/107 spaces backslash/meson.build delete mode 100644 test cases/common/108 spaces backslash/asm output/meson.build delete mode 100644 test cases/common/108 spaces backslash/comparer-end-notstring.c delete mode 100644 test cases/common/108 spaces backslash/comparer-end.c delete mode 100644 test cases/common/108 spaces backslash/comparer.c delete mode 100644 test cases/common/108 spaces backslash/include/comparer.h delete mode 100644 test cases/common/108 spaces backslash/meson.build create mode 100644 test cases/common/108 ternary/meson.build create mode 100644 test cases/common/109 custom target capture/data_source.txt create mode 100644 test cases/common/109 custom target capture/meson.build create mode 100755 test cases/common/109 custom target capture/my_compiler.py create mode 100644 test cases/common/109 custom target capture/test.json delete mode 100644 test cases/common/109 ternary/meson.build create mode 100755 test cases/common/110 allgenerate/converter.py create mode 100644 test cases/common/110 allgenerate/foobar.cpp.in create mode 100644 test cases/common/110 allgenerate/meson.build delete mode 100644 test cases/common/110 custom target capture/data_source.txt delete mode 100644 test cases/common/110 custom target capture/meson.build delete mode 100755 test cases/common/110 custom target capture/my_compiler.py delete mode 100644 test cases/common/110 custom target capture/test.json delete mode 100755 test cases/common/111 allgenerate/converter.py delete mode 100644 test cases/common/111 allgenerate/foobar.cpp.in delete mode 100644 test cases/common/111 allgenerate/meson.build create mode 100644 test cases/common/111 pathjoin/meson.build delete mode 100644 test cases/common/112 pathjoin/meson.build create mode 100644 test cases/common/112 subdir subproject/meson.build create mode 100644 test cases/common/112 subdir subproject/prog/meson.build create mode 100644 test cases/common/112 subdir subproject/prog/prog.c create mode 100644 test cases/common/112 subdir subproject/subprojects/sub/meson.build create mode 100644 test cases/common/112 subdir subproject/subprojects/sub/sub.c create mode 100644 test cases/common/112 subdir subproject/subprojects/sub/sub.h create mode 100644 test cases/common/113 interpreter copy mutable var on assignment/meson.build delete mode 100644 test cases/common/113 subdir subproject/meson.build delete mode 100644 test cases/common/113 subdir subproject/prog/meson.build delete mode 100644 test cases/common/113 subdir subproject/prog/prog.c delete mode 100644 test cases/common/113 subdir subproject/subprojects/sub/meson.build delete mode 100644 test cases/common/113 subdir subproject/subprojects/sub/sub.c delete mode 100644 test cases/common/113 subdir subproject/subprojects/sub/sub.h delete mode 100644 test cases/common/114 interpreter copy mutable var on assignment/meson.build create mode 100644 test cases/common/114 skip/meson.build delete mode 100644 test cases/common/115 skip/meson.build create mode 100644 test cases/common/115 subproject project arguments/exe.c create mode 100644 test cases/common/115 subproject project arguments/exe.cpp create mode 100644 test cases/common/115 subproject project arguments/meson.build create mode 100644 test cases/common/115 subproject project arguments/subprojects/subexe/meson.build create mode 100644 test cases/common/115 subproject project arguments/subprojects/subexe/subexe.c delete mode 100644 test cases/common/116 subproject project arguments/exe.c delete mode 100644 test cases/common/116 subproject project arguments/exe.cpp delete mode 100644 test cases/common/116 subproject project arguments/meson.build delete mode 100644 test cases/common/116 subproject project arguments/subprojects/subexe/meson.build delete mode 100644 test cases/common/116 subproject project arguments/subprojects/subexe/subexe.c create mode 100644 test cases/common/116 test skip/meson.build create mode 100644 test cases/common/116 test skip/test_skip.c create mode 100644 test cases/common/117 shared module/meson.build create mode 100644 test cases/common/117 shared module/module.c create mode 100644 test cases/common/117 shared module/nosyms.c create mode 100644 test cases/common/117 shared module/prog.c create mode 100644 test cases/common/117 shared module/runtime.c create mode 100644 test cases/common/117 shared module/test.json delete mode 100644 test cases/common/117 test skip/meson.build delete mode 100644 test cases/common/117 test skip/test_skip.c create mode 100644 test cases/common/118 llvm ir and assembly/main.c create mode 100644 test cases/common/118 llvm ir and assembly/main.cpp create mode 100644 test cases/common/118 llvm ir and assembly/meson.build create mode 100644 test cases/common/118 llvm ir and assembly/square-aarch64.S create mode 100644 test cases/common/118 llvm ir and assembly/square-arm.S create mode 100644 test cases/common/118 llvm ir and assembly/square-x86.S create mode 100644 test cases/common/118 llvm ir and assembly/square-x86_64.S create mode 100644 test cases/common/118 llvm ir and assembly/square.ll create mode 100644 test cases/common/118 llvm ir and assembly/symbol-underscore.h delete mode 100644 test cases/common/118 shared module/meson.build delete mode 100644 test cases/common/118 shared module/module.c delete mode 100644 test cases/common/118 shared module/nosyms.c delete mode 100644 test cases/common/118 shared module/prog.c delete mode 100644 test cases/common/118 shared module/runtime.c delete mode 100644 test cases/common/118 shared module/test.json create mode 100644 test cases/common/119 cpp and asm/meson.build create mode 100644 test cases/common/119 cpp and asm/retval-arm.S create mode 100644 test cases/common/119 cpp and asm/retval-x86.S create mode 100644 test cases/common/119 cpp and asm/retval-x86_64.S create mode 100644 test cases/common/119 cpp and asm/symbol-underscore.h create mode 100644 test cases/common/119 cpp and asm/trivial.cc delete mode 100644 test cases/common/119 llvm ir and assembly/main.c delete mode 100644 test cases/common/119 llvm ir and assembly/main.cpp delete mode 100644 test cases/common/119 llvm ir and assembly/meson.build delete mode 100644 test cases/common/119 llvm ir and assembly/square-aarch64.S delete mode 100644 test cases/common/119 llvm ir and assembly/square-arm.S delete mode 100644 test cases/common/119 llvm ir and assembly/square-x86.S delete mode 100644 test cases/common/119 llvm ir and assembly/square-x86_64.S delete mode 100644 test cases/common/119 llvm ir and assembly/square.ll delete mode 100644 test cases/common/119 llvm ir and assembly/symbol-underscore.h delete mode 100644 test cases/common/120 cpp and asm/meson.build delete mode 100644 test cases/common/120 cpp and asm/retval-arm.S delete mode 100644 test cases/common/120 cpp and asm/retval-x86.S delete mode 100644 test cases/common/120 cpp and asm/retval-x86_64.S delete mode 100644 test cases/common/120 cpp and asm/symbol-underscore.h delete mode 100644 test cases/common/120 cpp and asm/trivial.cc create mode 100644 test cases/common/120 extract all shared library/extractor.h create mode 100644 test cases/common/120 extract all shared library/four.c create mode 100644 test cases/common/120 extract all shared library/func1234.def create mode 100644 test cases/common/120 extract all shared library/meson.build create mode 100644 test cases/common/120 extract all shared library/one.c create mode 100644 test cases/common/120 extract all shared library/prog.c create mode 100644 test cases/common/120 extract all shared library/three.c create mode 100644 test cases/common/120 extract all shared library/two.c delete mode 100644 test cases/common/121 extract all shared library/extractor.h delete mode 100644 test cases/common/121 extract all shared library/four.c delete mode 100644 test cases/common/121 extract all shared library/func1234.def delete mode 100644 test cases/common/121 extract all shared library/meson.build delete mode 100644 test cases/common/121 extract all shared library/one.c delete mode 100644 test cases/common/121 extract all shared library/prog.c delete mode 100644 test cases/common/121 extract all shared library/three.c delete mode 100644 test cases/common/121 extract all shared library/two.c create mode 100644 test cases/common/121 object only target/meson.build create mode 100755 test cases/common/121 object only target/obj_generator.py create mode 100644 test cases/common/121 object only target/prog.c create mode 100644 test cases/common/121 object only target/source.c create mode 100644 test cases/common/121 object only target/source2.c create mode 100644 test cases/common/121 object only target/source2.def create mode 100644 test cases/common/121 object only target/source3.c create mode 100644 test cases/common/121 object only target/test.json create mode 100644 test cases/common/122 no buildincdir/include/header.h create mode 100644 test cases/common/122 no buildincdir/meson.build create mode 100644 test cases/common/122 no buildincdir/prog.c delete mode 100644 test cases/common/122 object only target/meson.build delete mode 100755 test cases/common/122 object only target/obj_generator.py delete mode 100644 test cases/common/122 object only target/prog.c delete mode 100644 test cases/common/122 object only target/source.c delete mode 100644 test cases/common/122 object only target/source2.c delete mode 100644 test cases/common/122 object only target/source2.def delete mode 100644 test cases/common/122 object only target/source3.c delete mode 100644 test cases/common/122 object only target/test.json create mode 100644 test cases/common/123 custom target directory install/docgen.py create mode 100644 test cases/common/123 custom target directory install/meson.build create mode 100644 test cases/common/123 custom target directory install/test.json delete mode 100644 test cases/common/123 no buildincdir/include/header.h delete mode 100644 test cases/common/123 no buildincdir/meson.build delete mode 100644 test cases/common/123 no buildincdir/prog.c delete mode 100644 test cases/common/124 custom target directory install/docgen.py delete mode 100644 test cases/common/124 custom target directory install/meson.build delete mode 100644 test cases/common/124 custom target directory install/test.json create mode 100644 test cases/common/124 dependency file generation/main .c create mode 100644 test cases/common/124 dependency file generation/meson.build create mode 100644 test cases/common/125 configure file in generator/inc/confdata.in create mode 100644 test cases/common/125 configure file in generator/inc/meson.build create mode 100644 test cases/common/125 configure file in generator/meson.build create mode 100755 test cases/common/125 configure file in generator/src/gen.py create mode 100644 test cases/common/125 configure file in generator/src/main.c create mode 100644 test cases/common/125 configure file in generator/src/meson.build create mode 100644 test cases/common/125 configure file in generator/src/source delete mode 100644 test cases/common/125 dependency file generation/main .c delete mode 100644 test cases/common/125 dependency file generation/meson.build delete mode 100644 test cases/common/126 configure file in generator/inc/confdata.in delete mode 100644 test cases/common/126 configure file in generator/inc/meson.build delete mode 100644 test cases/common/126 configure file in generator/meson.build delete mode 100755 test cases/common/126 configure file in generator/src/gen.py delete mode 100644 test cases/common/126 configure file in generator/src/main.c delete mode 100644 test cases/common/126 configure file in generator/src/meson.build delete mode 100644 test cases/common/126 configure file in generator/src/source create mode 100644 test cases/common/126 generated llvm ir/copyfile.py create mode 100644 test cases/common/126 generated llvm ir/main.c create mode 100644 test cases/common/126 generated llvm ir/meson.build create mode 100644 test cases/common/126 generated llvm ir/square.ll.in create mode 100644 test cases/common/127 generated assembly/copyfile.py create mode 100644 test cases/common/127 generated assembly/empty.c create mode 100644 test cases/common/127 generated assembly/main.c create mode 100644 test cases/common/127 generated assembly/meson.build create mode 100644 test cases/common/127 generated assembly/square-arm.S.in create mode 100644 test cases/common/127 generated assembly/square-x86.S.in create mode 100644 test cases/common/127 generated assembly/square-x86_64.S.in create mode 100644 test cases/common/127 generated assembly/square.def create mode 100644 test cases/common/127 generated assembly/symbol-underscore.h delete mode 100644 test cases/common/127 generated llvm ir/copyfile.py delete mode 100644 test cases/common/127 generated llvm ir/main.c delete mode 100644 test cases/common/127 generated llvm ir/meson.build delete mode 100644 test cases/common/127 generated llvm ir/square.ll.in create mode 100644 test cases/common/128 build by default targets in tests/main.c create mode 100644 test cases/common/128 build by default targets in tests/meson.build create mode 100644 test cases/common/128 build by default targets in tests/write_file.py delete mode 100644 test cases/common/128 generated assembly/copyfile.py delete mode 100644 test cases/common/128 generated assembly/empty.c delete mode 100644 test cases/common/128 generated assembly/main.c delete mode 100644 test cases/common/128 generated assembly/meson.build delete mode 100644 test cases/common/128 generated assembly/square-arm.S.in delete mode 100644 test cases/common/128 generated assembly/square-x86.S.in delete mode 100644 test cases/common/128 generated assembly/square-x86_64.S.in delete mode 100644 test cases/common/128 generated assembly/square.def delete mode 100644 test cases/common/128 generated assembly/symbol-underscore.h delete mode 100644 test cases/common/129 build by default targets in tests/main.c delete mode 100644 test cases/common/129 build by default targets in tests/meson.build delete mode 100644 test cases/common/129 build by default targets in tests/write_file.py create mode 100644 test cases/common/129 build by default/checkexists.py create mode 100644 test cases/common/129 build by default/foo.c create mode 100644 test cases/common/129 build by default/meson.build create mode 100644 test cases/common/129 build by default/mygen.py create mode 100644 test cases/common/129 build by default/source.txt delete mode 100644 test cases/common/130 build by default/checkexists.py delete mode 100644 test cases/common/130 build by default/foo.c delete mode 100644 test cases/common/130 build by default/meson.build delete mode 100644 test cases/common/130 build by default/mygen.py delete mode 100644 test cases/common/130 build by default/source.txt create mode 100644 test cases/common/130 include order/ctsub/copyfile.py create mode 100644 test cases/common/130 include order/ctsub/emptyfile.c create mode 100644 test cases/common/130 include order/ctsub/main.h create mode 100644 test cases/common/130 include order/ctsub/meson.build create mode 100644 test cases/common/130 include order/inc1/hdr.h create mode 100644 test cases/common/130 include order/inc2/hdr.h create mode 100644 test cases/common/130 include order/meson.build create mode 100644 test cases/common/130 include order/ordertest.c create mode 100644 test cases/common/130 include order/sub1/main.h create mode 100644 test cases/common/130 include order/sub1/meson.build create mode 100644 test cases/common/130 include order/sub1/some.c create mode 100644 test cases/common/130 include order/sub1/some.h create mode 100644 test cases/common/130 include order/sub2/main.h create mode 100644 test cases/common/130 include order/sub2/meson.build create mode 100644 test cases/common/130 include order/sub3/main.h create mode 100644 test cases/common/130 include order/sub3/meson.build create mode 100644 test cases/common/130 include order/sub4/main.c create mode 100644 test cases/common/130 include order/sub4/main.h create mode 100644 test cases/common/130 include order/sub4/meson.build delete mode 100644 test cases/common/131 include order/ctsub/copyfile.py delete mode 100644 test cases/common/131 include order/ctsub/emptyfile.c delete mode 100644 test cases/common/131 include order/ctsub/main.h delete mode 100644 test cases/common/131 include order/ctsub/meson.build delete mode 100644 test cases/common/131 include order/inc1/hdr.h delete mode 100644 test cases/common/131 include order/inc2/hdr.h delete mode 100644 test cases/common/131 include order/meson.build delete mode 100644 test cases/common/131 include order/ordertest.c delete mode 100644 test cases/common/131 include order/sub1/main.h delete mode 100644 test cases/common/131 include order/sub1/meson.build delete mode 100644 test cases/common/131 include order/sub1/some.c delete mode 100644 test cases/common/131 include order/sub1/some.h delete mode 100644 test cases/common/131 include order/sub2/main.h delete mode 100644 test cases/common/131 include order/sub2/meson.build delete mode 100644 test cases/common/131 include order/sub3/main.h delete mode 100644 test cases/common/131 include order/sub3/meson.build delete mode 100644 test cases/common/131 include order/sub4/main.c delete mode 100644 test cases/common/131 include order/sub4/main.h delete mode 100644 test cases/common/131 include order/sub4/meson.build create mode 100644 test cases/common/131 override options/four.c create mode 100644 test cases/common/131 override options/meson.build create mode 100644 test cases/common/131 override options/one.c create mode 100644 test cases/common/131 override options/three.c create mode 100644 test cases/common/131 override options/two.c create mode 100644 test cases/common/132 get define/concat.h create mode 100644 test cases/common/132 get define/meson.build create mode 100644 test cases/common/132 get define/meson_options.txt delete mode 100644 test cases/common/132 override options/four.c delete mode 100644 test cases/common/132 override options/meson.build delete mode 100644 test cases/common/132 override options/one.c delete mode 100644 test cases/common/132 override options/three.c delete mode 100644 test cases/common/132 override options/two.c create mode 100644 test cases/common/133 c cpp and asm/main.c create mode 100644 test cases/common/133 c cpp and asm/main.cpp create mode 100644 test cases/common/133 c cpp and asm/meson.build create mode 100644 test cases/common/133 c cpp and asm/retval-arm.S create mode 100644 test cases/common/133 c cpp and asm/retval-x86.S create mode 100644 test cases/common/133 c cpp and asm/retval-x86_64.S create mode 100644 test cases/common/133 c cpp and asm/somelib.c create mode 100644 test cases/common/133 c cpp and asm/symbol-underscore.h delete mode 100644 test cases/common/133 get define/concat.h delete mode 100644 test cases/common/133 get define/meson.build delete mode 100644 test cases/common/133 get define/meson_options.txt delete mode 100644 test cases/common/134 c cpp and asm/main.c delete mode 100644 test cases/common/134 c cpp and asm/main.cpp delete mode 100644 test cases/common/134 c cpp and asm/meson.build delete mode 100644 test cases/common/134 c cpp and asm/retval-arm.S delete mode 100644 test cases/common/134 c cpp and asm/retval-x86.S delete mode 100644 test cases/common/134 c cpp and asm/retval-x86_64.S delete mode 100644 test cases/common/134 c cpp and asm/somelib.c delete mode 100644 test cases/common/134 c cpp and asm/symbol-underscore.h create mode 100644 test cases/common/134 compute int/config.h.in create mode 100644 test cases/common/134 compute int/foobar.h create mode 100644 test cases/common/134 compute int/meson.build create mode 100644 test cases/common/134 compute int/prog.c.in delete mode 100644 test cases/common/135 compute int/config.h.in delete mode 100644 test cases/common/135 compute int/foobar.h delete mode 100644 test cases/common/135 compute int/meson.build delete mode 100644 test cases/common/135 compute int/prog.c.in create mode 100644 test cases/common/135 custom target object output/meson.build create mode 100644 test cases/common/135 custom target object output/obj_generator.py create mode 100644 test cases/common/135 custom target object output/objdir/meson.build create mode 100644 test cases/common/135 custom target object output/objdir/source.c create mode 100644 test cases/common/135 custom target object output/progdir/meson.build create mode 100644 test cases/common/135 custom target object output/progdir/prog.c delete mode 100644 test cases/common/136 custom target object output/meson.build delete mode 100644 test cases/common/136 custom target object output/obj_generator.py delete mode 100644 test cases/common/136 custom target object output/objdir/meson.build delete mode 100644 test cases/common/136 custom target object output/objdir/source.c delete mode 100644 test cases/common/136 custom target object output/progdir/meson.build delete mode 100644 test cases/common/136 custom target object output/progdir/prog.c create mode 100644 test cases/common/136 empty build file/meson.build create mode 100644 test cases/common/136 empty build file/subdir/meson.build delete mode 100644 test cases/common/137 empty build file/meson.build delete mode 100644 test cases/common/137 empty build file/subdir/meson.build create mode 100644 test cases/common/137 whole archive/exe/meson.build create mode 100644 test cases/common/137 whole archive/exe2/meson.build create mode 100644 test cases/common/137 whole archive/exe3/meson.build create mode 100644 test cases/common/137 whole archive/exe4/meson.build create mode 100644 test cases/common/137 whole archive/func1.c create mode 100644 test cases/common/137 whole archive/func2.c create mode 100644 test cases/common/137 whole archive/meson.build create mode 100644 test cases/common/137 whole archive/mylib.h create mode 100644 test cases/common/137 whole archive/prog.c create mode 100644 test cases/common/137 whole archive/sh_func2_dep_func1/meson.build create mode 100644 test cases/common/137 whole archive/sh_func2_linked_func1/meson.build create mode 100644 test cases/common/137 whole archive/sh_func2_transdep_func1/meson.build create mode 100644 test cases/common/137 whole archive/sh_only_link_whole/meson.build create mode 100644 test cases/common/137 whole archive/st_func1/meson.build create mode 100644 test cases/common/137 whole archive/st_func2/meson.build create mode 100644 test cases/common/138 C and CPP link/dummy.c create mode 100644 test cases/common/138 C and CPP link/foo.c create mode 100644 test cases/common/138 C and CPP link/foo.cpp create mode 100644 test cases/common/138 C and CPP link/foo.h create mode 100644 test cases/common/138 C and CPP link/foo.hpp create mode 100644 test cases/common/138 C and CPP link/foobar.c create mode 100644 test cases/common/138 C and CPP link/foobar.h create mode 100644 test cases/common/138 C and CPP link/meson.build create mode 100644 test cases/common/138 C and CPP link/sub.c create mode 100644 test cases/common/138 C and CPP link/sub.h delete mode 100644 test cases/common/138 whole archive/exe/meson.build delete mode 100644 test cases/common/138 whole archive/exe2/meson.build delete mode 100644 test cases/common/138 whole archive/exe3/meson.build delete mode 100644 test cases/common/138 whole archive/exe4/meson.build delete mode 100644 test cases/common/138 whole archive/func1.c delete mode 100644 test cases/common/138 whole archive/func2.c delete mode 100644 test cases/common/138 whole archive/meson.build delete mode 100644 test cases/common/138 whole archive/mylib.h delete mode 100644 test cases/common/138 whole archive/prog.c delete mode 100644 test cases/common/138 whole archive/sh_func2_dep_func1/meson.build delete mode 100644 test cases/common/138 whole archive/sh_func2_linked_func1/meson.build delete mode 100644 test cases/common/138 whole archive/sh_func2_transdep_func1/meson.build delete mode 100644 test cases/common/138 whole archive/sh_only_link_whole/meson.build delete mode 100644 test cases/common/138 whole archive/st_func1/meson.build delete mode 100644 test cases/common/138 whole archive/st_func2/meson.build delete mode 100644 test cases/common/139 C and CPP link/dummy.c delete mode 100644 test cases/common/139 C and CPP link/foo.c delete mode 100644 test cases/common/139 C and CPP link/foo.cpp delete mode 100644 test cases/common/139 C and CPP link/foo.h delete mode 100644 test cases/common/139 C and CPP link/foo.hpp delete mode 100644 test cases/common/139 C and CPP link/foobar.c delete mode 100644 test cases/common/139 C and CPP link/foobar.h delete mode 100644 test cases/common/139 C and CPP link/meson.build delete mode 100644 test cases/common/139 C and CPP link/sub.c delete mode 100644 test cases/common/139 C and CPP link/sub.h create mode 100644 test cases/common/139 mesonintrospect from scripts/check_env.py create mode 100644 test cases/common/139 mesonintrospect from scripts/check_introspection.py create mode 100644 test cases/common/139 mesonintrospect from scripts/meson.build create mode 100755 test cases/common/140 custom target multiple outputs/generator.py create mode 100644 test cases/common/140 custom target multiple outputs/meson.build create mode 100644 test cases/common/140 custom target multiple outputs/test.json delete mode 100644 test cases/common/140 mesonintrospect from scripts/check_env.py delete mode 100644 test cases/common/140 mesonintrospect from scripts/check_introspection.py delete mode 100644 test cases/common/140 mesonintrospect from scripts/meson.build delete mode 100755 test cases/common/141 custom target multiple outputs/generator.py delete mode 100644 test cases/common/141 custom target multiple outputs/meson.build delete mode 100644 test cases/common/141 custom target multiple outputs/test.json create mode 100644 test cases/common/141 special characters/arg-char-test.c create mode 100644 test cases/common/141 special characters/arg-string-test.c create mode 100644 test cases/common/141 special characters/arg-unquoted-test.c create mode 100644 test cases/common/141 special characters/check_quoting.py create mode 100644 test cases/common/141 special characters/meson.build create mode 100644 test cases/common/141 special characters/test.json create mode 100644 test cases/common/142 nested links/meson.build create mode 100644 test cases/common/142 nested links/xephyr.c delete mode 100644 test cases/common/142 special characters/arg-char-test.c delete mode 100644 test cases/common/142 special characters/arg-string-test.c delete mode 100644 test cases/common/142 special characters/arg-unquoted-test.c delete mode 100644 test cases/common/142 special characters/check_quoting.py delete mode 100644 test cases/common/142 special characters/meson.build delete mode 100644 test cases/common/142 special characters/test.json create mode 100644 test cases/common/143 list of file sources/foo create mode 100644 test cases/common/143 list of file sources/gen.py create mode 100644 test cases/common/143 list of file sources/meson.build delete mode 100644 test cases/common/143 nested links/meson.build delete mode 100644 test cases/common/143 nested links/xephyr.c create mode 100644 test cases/common/144 link depends custom target/foo.c create mode 100755 test cases/common/144 link depends custom target/make_file.py create mode 100644 test cases/common/144 link depends custom target/meson.build delete mode 100644 test cases/common/144 list of file sources/foo delete mode 100644 test cases/common/144 list of file sources/gen.py delete mode 100644 test cases/common/144 list of file sources/meson.build delete mode 100644 test cases/common/145 link depends custom target/foo.c delete mode 100755 test cases/common/145 link depends custom target/make_file.py delete mode 100644 test cases/common/145 link depends custom target/meson.build create mode 100644 test cases/common/145 recursive linking/3rdorderdeps/lib.c.in create mode 100644 test cases/common/145 recursive linking/3rdorderdeps/main.c.in create mode 100644 test cases/common/145 recursive linking/3rdorderdeps/meson.build create mode 100644 test cases/common/145 recursive linking/circular/lib1.c create mode 100644 test cases/common/145 recursive linking/circular/lib2.c create mode 100644 test cases/common/145 recursive linking/circular/lib3.c create mode 100644 test cases/common/145 recursive linking/circular/main.c create mode 100644 test cases/common/145 recursive linking/circular/meson.build create mode 100644 test cases/common/145 recursive linking/circular/prop1.c create mode 100644 test cases/common/145 recursive linking/circular/prop2.c create mode 100644 test cases/common/145 recursive linking/circular/prop3.c create mode 100644 test cases/common/145 recursive linking/edge-cases/libsto.c create mode 100644 test cases/common/145 recursive linking/edge-cases/meson.build create mode 100644 test cases/common/145 recursive linking/edge-cases/shstmain.c create mode 100644 test cases/common/145 recursive linking/edge-cases/stobuilt.c create mode 100644 test cases/common/145 recursive linking/edge-cases/stomain.c create mode 100644 test cases/common/145 recursive linking/lib.h create mode 100644 test cases/common/145 recursive linking/main.c create mode 100644 test cases/common/145 recursive linking/meson.build create mode 100644 test cases/common/145 recursive linking/shnodep/lib.c create mode 100644 test cases/common/145 recursive linking/shnodep/meson.build create mode 100644 test cases/common/145 recursive linking/shshdep/lib.c create mode 100644 test cases/common/145 recursive linking/shshdep/meson.build create mode 100644 test cases/common/145 recursive linking/shstdep/lib.c create mode 100644 test cases/common/145 recursive linking/shstdep/meson.build create mode 100644 test cases/common/145 recursive linking/stnodep/lib.c create mode 100644 test cases/common/145 recursive linking/stnodep/meson.build create mode 100644 test cases/common/145 recursive linking/stshdep/lib.c create mode 100644 test cases/common/145 recursive linking/stshdep/meson.build create mode 100644 test cases/common/145 recursive linking/ststdep/lib.c create mode 100644 test cases/common/145 recursive linking/ststdep/meson.build create mode 100644 test cases/common/146 library at root/lib.c create mode 100644 test cases/common/146 library at root/main/main.c create mode 100644 test cases/common/146 library at root/main/meson.build create mode 100644 test cases/common/146 library at root/meson.build delete mode 100644 test cases/common/146 recursive linking/3rdorderdeps/lib.c.in delete mode 100644 test cases/common/146 recursive linking/3rdorderdeps/main.c.in delete mode 100644 test cases/common/146 recursive linking/3rdorderdeps/meson.build delete mode 100644 test cases/common/146 recursive linking/circular/lib1.c delete mode 100644 test cases/common/146 recursive linking/circular/lib2.c delete mode 100644 test cases/common/146 recursive linking/circular/lib3.c delete mode 100644 test cases/common/146 recursive linking/circular/main.c delete mode 100644 test cases/common/146 recursive linking/circular/meson.build delete mode 100644 test cases/common/146 recursive linking/circular/prop1.c delete mode 100644 test cases/common/146 recursive linking/circular/prop2.c delete mode 100644 test cases/common/146 recursive linking/circular/prop3.c delete mode 100644 test cases/common/146 recursive linking/edge-cases/libsto.c delete mode 100644 test cases/common/146 recursive linking/edge-cases/meson.build delete mode 100644 test cases/common/146 recursive linking/edge-cases/shstmain.c delete mode 100644 test cases/common/146 recursive linking/edge-cases/stobuilt.c delete mode 100644 test cases/common/146 recursive linking/edge-cases/stomain.c delete mode 100644 test cases/common/146 recursive linking/lib.h delete mode 100644 test cases/common/146 recursive linking/main.c delete mode 100644 test cases/common/146 recursive linking/meson.build delete mode 100644 test cases/common/146 recursive linking/shnodep/lib.c delete mode 100644 test cases/common/146 recursive linking/shnodep/meson.build delete mode 100644 test cases/common/146 recursive linking/shshdep/lib.c delete mode 100644 test cases/common/146 recursive linking/shshdep/meson.build delete mode 100644 test cases/common/146 recursive linking/shstdep/lib.c delete mode 100644 test cases/common/146 recursive linking/shstdep/meson.build delete mode 100644 test cases/common/146 recursive linking/stnodep/lib.c delete mode 100644 test cases/common/146 recursive linking/stnodep/meson.build delete mode 100644 test cases/common/146 recursive linking/stshdep/lib.c delete mode 100644 test cases/common/146 recursive linking/stshdep/meson.build delete mode 100644 test cases/common/146 recursive linking/ststdep/lib.c delete mode 100644 test cases/common/146 recursive linking/ststdep/meson.build delete mode 100644 test cases/common/147 library at root/lib.c delete mode 100644 test cases/common/147 library at root/main/main.c delete mode 100644 test cases/common/147 library at root/main/meson.build delete mode 100644 test cases/common/147 library at root/meson.build create mode 100644 test cases/common/147 simd/fallback.c create mode 100644 test cases/common/147 simd/include/simdheader.h create mode 100644 test cases/common/147 simd/meson.build create mode 100644 test cases/common/147 simd/simd_avx.c create mode 100644 test cases/common/147 simd/simd_avx2.c create mode 100644 test cases/common/147 simd/simd_mmx.c create mode 100644 test cases/common/147 simd/simd_neon.c create mode 100644 test cases/common/147 simd/simd_sse.c create mode 100644 test cases/common/147 simd/simd_sse2.c create mode 100644 test cases/common/147 simd/simd_sse3.c create mode 100644 test cases/common/147 simd/simd_sse41.c create mode 100644 test cases/common/147 simd/simd_sse42.c create mode 100644 test cases/common/147 simd/simd_ssse3.c create mode 100644 test cases/common/147 simd/simdchecker.c create mode 100644 test cases/common/147 simd/simdfuncs.h create mode 100644 test cases/common/148 shared module resolving symbol in executable/meson.build create mode 100644 test cases/common/148 shared module resolving symbol in executable/module.c create mode 100644 test cases/common/148 shared module resolving symbol in executable/prog.c delete mode 100644 test cases/common/148 simd/fallback.c delete mode 100644 test cases/common/148 simd/include/simdheader.h delete mode 100644 test cases/common/148 simd/meson.build delete mode 100644 test cases/common/148 simd/simd_avx.c delete mode 100644 test cases/common/148 simd/simd_avx2.c delete mode 100644 test cases/common/148 simd/simd_mmx.c delete mode 100644 test cases/common/148 simd/simd_neon.c delete mode 100644 test cases/common/148 simd/simd_sse.c delete mode 100644 test cases/common/148 simd/simd_sse2.c delete mode 100644 test cases/common/148 simd/simd_sse3.c delete mode 100644 test cases/common/148 simd/simd_sse41.c delete mode 100644 test cases/common/148 simd/simd_sse42.c delete mode 100644 test cases/common/148 simd/simd_ssse3.c delete mode 100644 test cases/common/148 simd/simdchecker.c delete mode 100644 test cases/common/148 simd/simdfuncs.h create mode 100644 test cases/common/149 dotinclude/dotproc.c create mode 100644 test cases/common/149 dotinclude/meson.build create mode 100644 test cases/common/149 dotinclude/stdio.h delete mode 100644 test cases/common/149 shared module resolving symbol in executable/meson.build delete mode 100644 test cases/common/149 shared module resolving symbol in executable/module.c delete mode 100644 test cases/common/149 shared module resolving symbol in executable/prog.c delete mode 100644 test cases/common/150 dotinclude/dotproc.c delete mode 100644 test cases/common/150 dotinclude/meson.build delete mode 100644 test cases/common/150 dotinclude/stdio.h create mode 100644 test cases/common/150 reserved targets/all/meson.build create mode 100644 test cases/common/150 reserved targets/benchmark/meson.build create mode 100644 test cases/common/150 reserved targets/clean-ctlist/meson.build create mode 100644 test cases/common/150 reserved targets/clean-gcda/meson.build create mode 100644 test cases/common/150 reserved targets/clean-gcno/meson.build create mode 100644 test cases/common/150 reserved targets/clean/meson.build create mode 100644 test cases/common/150 reserved targets/coverage-html/meson.build create mode 100644 test cases/common/150 reserved targets/coverage-text/meson.build create mode 100644 test cases/common/150 reserved targets/coverage-xml/meson.build create mode 100644 test cases/common/150 reserved targets/coverage/meson.build create mode 100644 test cases/common/150 reserved targets/dist/meson.build create mode 100644 test cases/common/150 reserved targets/distcheck/meson.build create mode 100644 test cases/common/150 reserved targets/install/meson.build create mode 100644 test cases/common/150 reserved targets/meson.build create mode 100644 test cases/common/150 reserved targets/phony/meson.build create mode 100644 test cases/common/150 reserved targets/reconfigure/meson.build create mode 100644 test cases/common/150 reserved targets/runtarget/echo.py create mode 100644 test cases/common/150 reserved targets/runtarget/meson.build create mode 100644 test cases/common/150 reserved targets/scan-build/meson.build create mode 100644 test cases/common/150 reserved targets/test.c create mode 100644 test cases/common/150 reserved targets/test/meson.build create mode 100644 test cases/common/150 reserved targets/uninstall/meson.build create mode 100644 test cases/common/151 duplicate source names/dir1/file.c create mode 100644 test cases/common/151 duplicate source names/dir1/meson.build create mode 100644 test cases/common/151 duplicate source names/dir2/dir1/file.c create mode 100644 test cases/common/151 duplicate source names/dir2/file.c create mode 100644 test cases/common/151 duplicate source names/dir2/meson.build create mode 100644 test cases/common/151 duplicate source names/dir3/dir1/file.c create mode 100644 test cases/common/151 duplicate source names/dir3/file.c create mode 100644 test cases/common/151 duplicate source names/dir3/meson.build create mode 100644 test cases/common/151 duplicate source names/meson.build delete mode 100644 test cases/common/151 reserved targets/all/meson.build delete mode 100644 test cases/common/151 reserved targets/benchmark/meson.build delete mode 100644 test cases/common/151 reserved targets/clean-ctlist/meson.build delete mode 100644 test cases/common/151 reserved targets/clean-gcda/meson.build delete mode 100644 test cases/common/151 reserved targets/clean-gcno/meson.build delete mode 100644 test cases/common/151 reserved targets/clean/meson.build delete mode 100644 test cases/common/151 reserved targets/coverage-html/meson.build delete mode 100644 test cases/common/151 reserved targets/coverage-text/meson.build delete mode 100644 test cases/common/151 reserved targets/coverage-xml/meson.build delete mode 100644 test cases/common/151 reserved targets/coverage/meson.build delete mode 100644 test cases/common/151 reserved targets/dist/meson.build delete mode 100644 test cases/common/151 reserved targets/distcheck/meson.build delete mode 100644 test cases/common/151 reserved targets/install/meson.build delete mode 100644 test cases/common/151 reserved targets/meson.build delete mode 100644 test cases/common/151 reserved targets/phony/meson.build delete mode 100644 test cases/common/151 reserved targets/reconfigure/meson.build delete mode 100644 test cases/common/151 reserved targets/runtarget/echo.py delete mode 100644 test cases/common/151 reserved targets/runtarget/meson.build delete mode 100644 test cases/common/151 reserved targets/scan-build/meson.build delete mode 100644 test cases/common/151 reserved targets/test.c delete mode 100644 test cases/common/151 reserved targets/test/meson.build delete mode 100644 test cases/common/151 reserved targets/uninstall/meson.build delete mode 100644 test cases/common/152 duplicate source names/dir1/file.c delete mode 100644 test cases/common/152 duplicate source names/dir1/meson.build delete mode 100644 test cases/common/152 duplicate source names/dir2/dir1/file.c delete mode 100644 test cases/common/152 duplicate source names/dir2/file.c delete mode 100644 test cases/common/152 duplicate source names/dir2/meson.build delete mode 100644 test cases/common/152 duplicate source names/dir3/dir1/file.c delete mode 100644 test cases/common/152 duplicate source names/dir3/file.c delete mode 100644 test cases/common/152 duplicate source names/dir3/meson.build delete mode 100644 test cases/common/152 duplicate source names/meson.build create mode 100644 test cases/common/152 index customtarget/check_args.py create mode 100644 test cases/common/152 index customtarget/gen_sources.py create mode 100644 test cases/common/152 index customtarget/lib.c create mode 100644 test cases/common/152 index customtarget/meson.build create mode 100644 test cases/common/152 index customtarget/subdir/foo.c create mode 100644 test cases/common/152 index customtarget/subdir/meson.build delete mode 100644 test cases/common/153 index customtarget/check_args.py delete mode 100644 test cases/common/153 index customtarget/gen_sources.py delete mode 100644 test cases/common/153 index customtarget/lib.c delete mode 100644 test cases/common/153 index customtarget/meson.build delete mode 100644 test cases/common/153 index customtarget/subdir/foo.c delete mode 100644 test cases/common/153 index customtarget/subdir/meson.build create mode 100644 test cases/common/153 wrap file should not failed/meson.build create mode 100644 test cases/common/153 wrap file should not failed/src/meson.build create mode 100644 test cases/common/153 wrap file should not failed/src/subprojects/foo/prog2.c create mode 100644 test cases/common/153 wrap file should not failed/src/subprojects/prog.c create mode 100644 test cases/common/153 wrap file should not failed/src/test.c create mode 100644 test cases/common/153 wrap file should not failed/subprojects/.gitignore create mode 100644 test cases/common/153 wrap file should not failed/subprojects/bar.wrap create mode 100644 test cases/common/153 wrap file should not failed/subprojects/foo.wrap create mode 100644 test cases/common/153 wrap file should not failed/subprojects/packagecache/foo-1.0-patch.tar.xz create mode 100644 test cases/common/153 wrap file should not failed/subprojects/packagecache/foo-1.0.tar.xz create mode 100644 test cases/common/153 wrap file should not failed/subprojects/packagecache/zlib-1.2.8-8-wrap.zip create mode 100644 test cases/common/153 wrap file should not failed/subprojects/packagecache/zlib-1.2.8.tar.gz create mode 100644 test cases/common/153 wrap file should not failed/subprojects/packagefiles/bar-1.0-patch.tar.xz create mode 100644 test cases/common/153 wrap file should not failed/subprojects/packagefiles/bar-1.0.tar.xz create mode 100644 test cases/common/153 wrap file should not failed/subprojects/packagefiles/foo-1.0/meson.build create mode 100644 test cases/common/153 wrap file should not failed/subprojects/patchdir.wrap create mode 100644 test cases/common/153 wrap file should not failed/subprojects/zlib-1.2.8/foo.c create mode 100644 test cases/common/153 wrap file should not failed/subprojects/zlib-1.2.8/meson.build create mode 100644 test cases/common/153 wrap file should not failed/subprojects/zlib.wrap create mode 100644 test cases/common/154 includedir subproj/meson.build create mode 100644 test cases/common/154 includedir subproj/prog.c create mode 100644 test cases/common/154 includedir subproj/subprojects/inctest/include/incfile.h create mode 100644 test cases/common/154 includedir subproj/subprojects/inctest/meson.build delete mode 100644 test cases/common/154 wrap file should not failed/meson.build delete mode 100644 test cases/common/154 wrap file should not failed/src/meson.build delete mode 100644 test cases/common/154 wrap file should not failed/src/subprojects/foo/prog2.c delete mode 100644 test cases/common/154 wrap file should not failed/src/subprojects/prog.c delete mode 100644 test cases/common/154 wrap file should not failed/src/test.c delete mode 100644 test cases/common/154 wrap file should not failed/subprojects/.gitignore delete mode 100644 test cases/common/154 wrap file should not failed/subprojects/bar.wrap delete mode 100644 test cases/common/154 wrap file should not failed/subprojects/foo.wrap delete mode 100644 test cases/common/154 wrap file should not failed/subprojects/packagecache/foo-1.0-patch.tar.xz delete mode 100644 test cases/common/154 wrap file should not failed/subprojects/packagecache/foo-1.0.tar.xz delete mode 100644 test cases/common/154 wrap file should not failed/subprojects/packagecache/zlib-1.2.8-8-wrap.zip delete mode 100644 test cases/common/154 wrap file should not failed/subprojects/packagecache/zlib-1.2.8.tar.gz delete mode 100644 test cases/common/154 wrap file should not failed/subprojects/packagefiles/bar-1.0-patch.tar.xz delete mode 100644 test cases/common/154 wrap file should not failed/subprojects/packagefiles/bar-1.0.tar.xz delete mode 100644 test cases/common/154 wrap file should not failed/subprojects/packagefiles/foo-1.0/meson.build delete mode 100644 test cases/common/154 wrap file should not failed/subprojects/patchdir.wrap delete mode 100644 test cases/common/154 wrap file should not failed/subprojects/zlib-1.2.8/foo.c delete mode 100644 test cases/common/154 wrap file should not failed/subprojects/zlib-1.2.8/meson.build delete mode 100644 test cases/common/154 wrap file should not failed/subprojects/zlib.wrap delete mode 100644 test cases/common/155 includedir subproj/meson.build delete mode 100644 test cases/common/155 includedir subproj/prog.c delete mode 100644 test cases/common/155 includedir subproj/subprojects/inctest/include/incfile.h delete mode 100644 test cases/common/155 includedir subproj/subprojects/inctest/meson.build create mode 100644 test cases/common/155 subproject dir name collision/a.c create mode 100644 test cases/common/155 subproject dir name collision/custom_subproject_dir/B/b.c create mode 100644 test cases/common/155 subproject dir name collision/custom_subproject_dir/B/meson.build create mode 100644 test cases/common/155 subproject dir name collision/custom_subproject_dir/C/c.c create mode 100644 test cases/common/155 subproject dir name collision/custom_subproject_dir/C/meson.build create mode 100644 test cases/common/155 subproject dir name collision/meson.build create mode 100644 test cases/common/155 subproject dir name collision/other_subdir/custom_subproject_dir/other.c create mode 100644 test cases/common/155 subproject dir name collision/other_subdir/meson.build create mode 100644 test cases/common/156 config tool variable/meson.build delete mode 100644 test cases/common/156 subproject dir name collision/a.c delete mode 100644 test cases/common/156 subproject dir name collision/custom_subproject_dir/B/b.c delete mode 100644 test cases/common/156 subproject dir name collision/custom_subproject_dir/B/meson.build delete mode 100644 test cases/common/156 subproject dir name collision/custom_subproject_dir/C/c.c delete mode 100644 test cases/common/156 subproject dir name collision/custom_subproject_dir/C/meson.build delete mode 100644 test cases/common/156 subproject dir name collision/meson.build delete mode 100644 test cases/common/156 subproject dir name collision/other_subdir/custom_subproject_dir/other.c delete mode 100644 test cases/common/156 subproject dir name collision/other_subdir/meson.build delete mode 100644 test cases/common/157 config tool variable/meson.build create mode 100644 test cases/common/157 custom target subdir depend files/copyfile.py create mode 100644 test cases/common/157 custom target subdir depend files/meson.build create mode 100644 test cases/common/157 custom target subdir depend files/subdir/dep.dat create mode 100644 test cases/common/157 custom target subdir depend files/subdir/foo.c.in create mode 100644 test cases/common/157 custom target subdir depend files/subdir/meson.build delete mode 100644 test cases/common/158 custom target subdir depend files/copyfile.py delete mode 100644 test cases/common/158 custom target subdir depend files/meson.build delete mode 100644 test cases/common/158 custom target subdir depend files/subdir/dep.dat delete mode 100644 test cases/common/158 custom target subdir depend files/subdir/foo.c.in delete mode 100644 test cases/common/158 custom target subdir depend files/subdir/meson.build create mode 100644 test cases/common/158 disabler/meson.build create mode 100644 test cases/common/159 array option/meson.build create mode 100644 test cases/common/159 array option/meson_options.txt delete mode 100644 test cases/common/159 disabler/meson.build create mode 100644 test cases/common/16 comparison/meson.build create mode 100644 test cases/common/16 comparison/prog.c delete mode 100644 test cases/common/160 array option/meson.build delete mode 100644 test cases/common/160 array option/meson_options.txt create mode 100644 test cases/common/160 custom target template substitution/checkcopy.py create mode 100644 test cases/common/160 custom target template substitution/foo.c.in create mode 100644 test cases/common/160 custom target template substitution/meson.build delete mode 100644 test cases/common/161 custom target template substitution/checkcopy.py delete mode 100644 test cases/common/161 custom target template substitution/foo.c.in delete mode 100644 test cases/common/161 custom target template substitution/meson.build create mode 100644 test cases/common/161 not-found dependency/meson.build create mode 100644 test cases/common/161 not-found dependency/sub/meson.build create mode 100644 test cases/common/161 not-found dependency/subprojects/trivial/meson.build create mode 100644 test cases/common/161 not-found dependency/subprojects/trivial/trivial.c create mode 100644 test cases/common/161 not-found dependency/testlib.c delete mode 100644 test cases/common/162 not-found dependency/meson.build delete mode 100644 test cases/common/162 not-found dependency/sub/meson.build delete mode 100644 test cases/common/162 not-found dependency/subprojects/trivial/meson.build delete mode 100644 test cases/common/162 not-found dependency/subprojects/trivial/trivial.c delete mode 100644 test cases/common/162 not-found dependency/testlib.c create mode 100644 test cases/common/162 subdir if_found/meson.build create mode 100644 test cases/common/162 subdir if_found/subdir/meson.build create mode 100644 test cases/common/163 default options prefix dependent defaults/meson.build delete mode 100644 test cases/common/163 subdir if_found/meson.build delete mode 100644 test cases/common/163 subdir if_found/subdir/meson.build delete mode 100644 test cases/common/164 default options prefix dependent defaults/meson.build create mode 100644 test cases/common/164 dependency factory/meson.build delete mode 100644 test cases/common/165 dependency factory/meson.build create mode 100644 test cases/common/165 get project license/bar.c create mode 100644 test cases/common/165 get project license/meson.build delete mode 100644 test cases/common/166 get project license/bar.c delete mode 100644 test cases/common/166 get project license/meson.build create mode 100644 test cases/common/166 yield/meson.build create mode 100644 test cases/common/166 yield/meson_options.txt create mode 100644 test cases/common/166 yield/subprojects/sub/meson.build create mode 100644 test cases/common/166 yield/subprojects/sub/meson_options.txt create mode 100644 test cases/common/167 subproject nested subproject dirs/contrib/subprojects/alpha/a.c create mode 100644 test cases/common/167 subproject nested subproject dirs/contrib/subprojects/alpha/meson.build create mode 100644 test cases/common/167 subproject nested subproject dirs/contrib/subprojects/alpha/var/subprojects/wrap_files_might_be_here create mode 100644 test cases/common/167 subproject nested subproject dirs/contrib/subprojects/beta/b.c create mode 100644 test cases/common/167 subproject nested subproject dirs/contrib/subprojects/beta/meson.build create mode 100644 test cases/common/167 subproject nested subproject dirs/meson.build create mode 100644 test cases/common/167 subproject nested subproject dirs/prog.c delete mode 100644 test cases/common/167 yield/meson.build delete mode 100644 test cases/common/167 yield/meson_options.txt delete mode 100644 test cases/common/167 yield/subprojects/sub/meson.build delete mode 100644 test cases/common/167 yield/subprojects/sub/meson_options.txt create mode 100644 test cases/common/168 preserve gendir/base.inp create mode 100644 test cases/common/168 preserve gendir/com/mesonbuild/subbie.inp create mode 100755 test cases/common/168 preserve gendir/genprog.py create mode 100644 test cases/common/168 preserve gendir/meson.build create mode 100644 test cases/common/168 preserve gendir/testprog.c delete mode 100644 test cases/common/168 subproject nested subproject dirs/contrib/subprojects/alpha/a.c delete mode 100644 test cases/common/168 subproject nested subproject dirs/contrib/subprojects/alpha/meson.build delete mode 100644 test cases/common/168 subproject nested subproject dirs/contrib/subprojects/alpha/var/subprojects/wrap_files_might_be_here delete mode 100644 test cases/common/168 subproject nested subproject dirs/contrib/subprojects/beta/b.c delete mode 100644 test cases/common/168 subproject nested subproject dirs/contrib/subprojects/beta/meson.build delete mode 100644 test cases/common/168 subproject nested subproject dirs/meson.build delete mode 100644 test cases/common/168 subproject nested subproject dirs/prog.c delete mode 100644 test cases/common/169 preserve gendir/base.inp delete mode 100644 test cases/common/169 preserve gendir/com/mesonbuild/subbie.inp delete mode 100755 test cases/common/169 preserve gendir/genprog.py delete mode 100644 test cases/common/169 preserve gendir/meson.build delete mode 100644 test cases/common/169 preserve gendir/testprog.c create mode 100644 test cases/common/169 source in dep/bar.cpp create mode 100644 test cases/common/169 source in dep/foo.c create mode 100644 test cases/common/169 source in dep/generated/funname create mode 100755 test cases/common/169 source in dep/generated/genheader.py create mode 100644 test cases/common/169 source in dep/generated/main.c create mode 100644 test cases/common/169 source in dep/generated/meson.build create mode 100644 test cases/common/169 source in dep/meson.build create mode 100644 test cases/common/17 array/func.c create mode 100644 test cases/common/17 array/meson.build create mode 100644 test cases/common/17 array/prog.c delete mode 100644 test cases/common/17 comparison/meson.build delete mode 100644 test cases/common/17 comparison/prog.c create mode 100644 test cases/common/170 generator link whole/export.h create mode 100755 test cases/common/170 generator link whole/generator.py create mode 100644 test cases/common/170 generator link whole/main.c create mode 100644 test cases/common/170 generator link whole/meson.build create mode 100644 test cases/common/170 generator link whole/meson_test_function.tmpl create mode 100644 test cases/common/170 generator link whole/pull_meson_test_function.c delete mode 100644 test cases/common/170 source in dep/bar.cpp delete mode 100644 test cases/common/170 source in dep/foo.c delete mode 100644 test cases/common/170 source in dep/generated/funname delete mode 100755 test cases/common/170 source in dep/generated/genheader.py delete mode 100644 test cases/common/170 source in dep/generated/main.c delete mode 100644 test cases/common/170 source in dep/generated/meson.build delete mode 100644 test cases/common/170 source in dep/meson.build delete mode 100644 test cases/common/171 generator link whole/export.h delete mode 100755 test cases/common/171 generator link whole/generator.py delete mode 100644 test cases/common/171 generator link whole/main.c delete mode 100644 test cases/common/171 generator link whole/meson.build delete mode 100644 test cases/common/171 generator link whole/meson_test_function.tmpl delete mode 100644 test cases/common/171 generator link whole/pull_meson_test_function.c create mode 100644 test cases/common/171 initial c_args/meson.build create mode 100644 test cases/common/171 initial c_args/test.json create mode 100644 test cases/common/172 identical target name in subproject flat layout/foo.c create mode 100644 test cases/common/172 identical target name in subproject flat layout/main.c create mode 100644 test cases/common/172 identical target name in subproject flat layout/meson.build create mode 100644 test cases/common/172 identical target name in subproject flat layout/subprojects/subproj/foo.c create mode 100644 test cases/common/172 identical target name in subproject flat layout/subprojects/subproj/meson.build delete mode 100644 test cases/common/172 initial c_args/meson.build delete mode 100644 test cases/common/172 initial c_args/test.json create mode 100644 test cases/common/173 as-needed/config.h create mode 100644 test cases/common/173 as-needed/libA.cpp create mode 100644 test cases/common/173 as-needed/libA.h create mode 100644 test cases/common/173 as-needed/libB.cpp create mode 100644 test cases/common/173 as-needed/main.cpp create mode 100644 test cases/common/173 as-needed/meson.build delete mode 100644 test cases/common/173 identical target name in subproject flat layout/foo.c delete mode 100644 test cases/common/173 identical target name in subproject flat layout/main.c delete mode 100644 test cases/common/173 identical target name in subproject flat layout/meson.build delete mode 100644 test cases/common/173 identical target name in subproject flat layout/subprojects/subproj/foo.c delete mode 100644 test cases/common/173 identical target name in subproject flat layout/subprojects/subproj/meson.build delete mode 100644 test cases/common/174 as-needed/config.h delete mode 100644 test cases/common/174 as-needed/libA.cpp delete mode 100644 test cases/common/174 as-needed/libA.h delete mode 100644 test cases/common/174 as-needed/libB.cpp delete mode 100644 test cases/common/174 as-needed/main.cpp delete mode 100644 test cases/common/174 as-needed/meson.build create mode 100644 test cases/common/174 ndebug if-release enabled/main.c create mode 100644 test cases/common/174 ndebug if-release enabled/meson.build create mode 100644 test cases/common/175 ndebug if-release disabled/main.c create mode 100644 test cases/common/175 ndebug if-release disabled/meson.build delete mode 100644 test cases/common/175 ndebug if-release enabled/main.c delete mode 100644 test cases/common/175 ndebug if-release enabled/meson.build delete mode 100644 test cases/common/176 ndebug if-release disabled/main.c delete mode 100644 test cases/common/176 ndebug if-release disabled/meson.build create mode 100644 test cases/common/176 subproject version/meson.build create mode 100644 test cases/common/176 subproject version/subprojects/a/meson.build create mode 100644 test cases/common/177 subdir_done/meson.build delete mode 100644 test cases/common/177 subproject version/meson.build delete mode 100644 test cases/common/177 subproject version/subprojects/a/meson.build create mode 100644 test cases/common/178 bothlibraries/libfile.c create mode 100644 test cases/common/178 bothlibraries/main.c create mode 100644 test cases/common/178 bothlibraries/meson.build create mode 100644 test cases/common/178 bothlibraries/mylib.h delete mode 100644 test cases/common/178 subdir_done/meson.build delete mode 100644 test cases/common/179 bothlibraries/libfile.c delete mode 100644 test cases/common/179 bothlibraries/main.c delete mode 100644 test cases/common/179 bothlibraries/meson.build delete mode 100644 test cases/common/179 bothlibraries/mylib.h create mode 100644 test cases/common/179 escape and unicode/file.c.in create mode 100644 test cases/common/179 escape and unicode/file.py create mode 100644 test cases/common/179 escape and unicode/find.py create mode 100644 test cases/common/179 escape and unicode/fun.c create mode 100644 test cases/common/179 escape and unicode/main.c create mode 100644 test cases/common/179 escape and unicode/meson.build delete mode 100644 test cases/common/18 array/func.c delete mode 100644 test cases/common/18 array/meson.build delete mode 100644 test cases/common/18 array/prog.c create mode 100644 test cases/common/18 includedir/include/func.h create mode 100644 test cases/common/18 includedir/meson.build create mode 100644 test cases/common/18 includedir/src/func.c create mode 100644 test cases/common/18 includedir/src/meson.build create mode 100644 test cases/common/18 includedir/src/prog.c delete mode 100644 test cases/common/180 escape and unicode/file.c.in delete mode 100644 test cases/common/180 escape and unicode/file.py delete mode 100644 test cases/common/180 escape and unicode/find.py delete mode 100644 test cases/common/180 escape and unicode/fun.c delete mode 100644 test cases/common/180 escape and unicode/main.c delete mode 100644 test cases/common/180 escape and unicode/meson.build create mode 100644 test cases/common/180 has link arg/meson.build delete mode 100644 test cases/common/181 has link arg/meson.build create mode 100644 test cases/common/181 same target name flat layout/foo.c create mode 100644 test cases/common/181 same target name flat layout/main.c create mode 100644 test cases/common/181 same target name flat layout/meson.build create mode 100644 test cases/common/181 same target name flat layout/subdir/foo.c create mode 100644 test cases/common/181 same target name flat layout/subdir/meson.build create mode 100644 test cases/common/182 find override/meson.build create mode 100644 test cases/common/182 find override/otherdir/main.c create mode 100644 test cases/common/182 find override/otherdir/main2.c create mode 100644 test cases/common/182 find override/otherdir/meson.build create mode 100644 test cases/common/182 find override/otherdir/source.desc create mode 100644 test cases/common/182 find override/otherdir/source2.desc create mode 100755 test cases/common/182 find override/subdir/converter.py create mode 100755 test cases/common/182 find override/subdir/gencodegen.py.in create mode 100644 test cases/common/182 find override/subdir/meson.build create mode 100644 test cases/common/182 find override/subprojects/sub.wrap create mode 100644 test cases/common/182 find override/subprojects/sub/meson.build delete mode 100644 test cases/common/182 same target name flat layout/foo.c delete mode 100644 test cases/common/182 same target name flat layout/main.c delete mode 100644 test cases/common/182 same target name flat layout/meson.build delete mode 100644 test cases/common/182 same target name flat layout/subdir/foo.c delete mode 100644 test cases/common/182 same target name flat layout/subdir/meson.build delete mode 100644 test cases/common/183 find override/meson.build delete mode 100644 test cases/common/183 find override/otherdir/main.c delete mode 100644 test cases/common/183 find override/otherdir/main2.c delete mode 100644 test cases/common/183 find override/otherdir/meson.build delete mode 100644 test cases/common/183 find override/otherdir/source.desc delete mode 100644 test cases/common/183 find override/otherdir/source2.desc delete mode 100755 test cases/common/183 find override/subdir/converter.py delete mode 100755 test cases/common/183 find override/subdir/gencodegen.py.in delete mode 100644 test cases/common/183 find override/subdir/meson.build delete mode 100644 test cases/common/183 find override/subprojects/sub.wrap delete mode 100644 test cases/common/183 find override/subprojects/sub/meson.build create mode 100644 test cases/common/183 partial dependency/declare_dependency/headers/foo.c create mode 100644 test cases/common/183 partial dependency/declare_dependency/headers/foo.h create mode 100644 test cases/common/183 partial dependency/declare_dependency/main.c create mode 100644 test cases/common/183 partial dependency/declare_dependency/meson.build create mode 100644 test cases/common/183 partial dependency/declare_dependency/other.c create mode 100644 test cases/common/183 partial dependency/meson.build create mode 100644 test cases/common/184 openmp/main.c create mode 100644 test cases/common/184 openmp/main.cpp create mode 100644 test cases/common/184 openmp/main.f90 create mode 100644 test cases/common/184 openmp/meson.build delete mode 100644 test cases/common/184 partial dependency/declare_dependency/headers/foo.c delete mode 100644 test cases/common/184 partial dependency/declare_dependency/headers/foo.h delete mode 100644 test cases/common/184 partial dependency/declare_dependency/main.c delete mode 100644 test cases/common/184 partial dependency/declare_dependency/meson.build delete mode 100644 test cases/common/184 partial dependency/declare_dependency/other.c delete mode 100644 test cases/common/184 partial dependency/meson.build delete mode 100644 test cases/common/185 openmp/main.c delete mode 100644 test cases/common/185 openmp/main.cpp delete mode 100644 test cases/common/185 openmp/main.f90 delete mode 100644 test cases/common/185 openmp/meson.build create mode 100644 test cases/common/185 same target name/file.c create mode 100644 test cases/common/185 same target name/meson.build create mode 100644 test cases/common/185 same target name/sub/file2.c create mode 100644 test cases/common/185 same target name/sub/meson.build delete mode 100644 test cases/common/186 same target name/file.c delete mode 100644 test cases/common/186 same target name/meson.build delete mode 100644 test cases/common/186 same target name/sub/file2.c delete mode 100644 test cases/common/186 same target name/sub/meson.build create mode 100755 test cases/common/186 test depends/gen.py create mode 100644 test cases/common/186 test depends/main.c create mode 100644 test cases/common/186 test depends/meson.build create mode 100755 test cases/common/186 test depends/test.py create mode 100644 test cases/common/187 args flattening/meson.build delete mode 100755 test cases/common/187 test depends/gen.py delete mode 100644 test cases/common/187 test depends/main.c delete mode 100644 test cases/common/187 test depends/meson.build delete mode 100755 test cases/common/187 test depends/test.py delete mode 100644 test cases/common/188 args flattening/meson.build create mode 100644 test cases/common/188 dict/meson.build create mode 100644 test cases/common/188 dict/prog.c create mode 100644 test cases/common/189 check header/meson.build create mode 100644 test cases/common/189 check header/ouagadougou.h delete mode 100644 test cases/common/189 dict/meson.build delete mode 100644 test cases/common/189 dict/prog.c create mode 100644 test cases/common/19 header in file list/header.h create mode 100644 test cases/common/19 header in file list/meson.build create mode 100644 test cases/common/19 header in file list/prog.c delete mode 100644 test cases/common/19 includedir/include/func.h delete mode 100644 test cases/common/19 includedir/meson.build delete mode 100644 test cases/common/19 includedir/src/func.c delete mode 100644 test cases/common/19 includedir/src/meson.build delete mode 100644 test cases/common/19 includedir/src/prog.c delete mode 100644 test cases/common/190 check header/meson.build delete mode 100644 test cases/common/190 check header/ouagadougou.h create mode 100644 test cases/common/190 install_mode/config.h.in create mode 100644 test cases/common/190 install_mode/data_source.txt create mode 100644 test cases/common/190 install_mode/foo.1 create mode 100644 test cases/common/190 install_mode/meson.build create mode 100644 test cases/common/190 install_mode/rootdir.h create mode 100644 test cases/common/190 install_mode/runscript.sh create mode 100644 test cases/common/190 install_mode/stat.c create mode 100644 test cases/common/190 install_mode/sub1/second.dat create mode 100644 test cases/common/190 install_mode/sub2/stub create mode 100644 test cases/common/190 install_mode/test.json create mode 100644 test cases/common/190 install_mode/trivial.c delete mode 100644 test cases/common/191 install_mode/config.h.in delete mode 100644 test cases/common/191 install_mode/data_source.txt delete mode 100644 test cases/common/191 install_mode/foo.1 delete mode 100644 test cases/common/191 install_mode/meson.build delete mode 100644 test cases/common/191 install_mode/rootdir.h delete mode 100644 test cases/common/191 install_mode/runscript.sh delete mode 100644 test cases/common/191 install_mode/stat.c delete mode 100644 test cases/common/191 install_mode/sub1/second.dat delete mode 100644 test cases/common/191 install_mode/sub2/stub delete mode 100644 test cases/common/191 install_mode/test.json delete mode 100644 test cases/common/191 install_mode/trivial.c create mode 100644 test cases/common/191 subproject array version/meson.build create mode 100644 test cases/common/191 subproject array version/subprojects/foo/meson.build create mode 100644 test cases/common/192 feature option/meson.build create mode 100644 test cases/common/192 feature option/meson_options.txt delete mode 100644 test cases/common/192 subproject array version/meson.build delete mode 100644 test cases/common/192 subproject array version/subprojects/foo/meson.build create mode 100644 test cases/common/193 feature option disabled/meson.build create mode 100644 test cases/common/193 feature option disabled/meson_options.txt delete mode 100644 test cases/common/193 feature option/meson.build delete mode 100644 test cases/common/193 feature option/meson_options.txt delete mode 100644 test cases/common/194 feature option disabled/meson.build delete mode 100644 test cases/common/194 feature option disabled/meson_options.txt create mode 100644 test cases/common/194 static threads/lib1.c create mode 100644 test cases/common/194 static threads/lib2.c create mode 100644 test cases/common/194 static threads/meson.build create mode 100644 test cases/common/194 static threads/prog.c create mode 100644 test cases/common/195 generator in subdir/com/mesonbuild/genprog.py create mode 100644 test cases/common/195 generator in subdir/com/mesonbuild/meson.build create mode 100644 test cases/common/195 generator in subdir/com/mesonbuild/subbie.inp create mode 100644 test cases/common/195 generator in subdir/com/mesonbuild/testprog.c create mode 100644 test cases/common/195 generator in subdir/meson.build delete mode 100644 test cases/common/195 static threads/lib1.c delete mode 100644 test cases/common/195 static threads/lib2.c delete mode 100644 test cases/common/195 static threads/meson.build delete mode 100644 test cases/common/195 static threads/prog.c delete mode 100644 test cases/common/196 generator in subdir/com/mesonbuild/genprog.py delete mode 100644 test cases/common/196 generator in subdir/com/mesonbuild/meson.build delete mode 100644 test cases/common/196 generator in subdir/com/mesonbuild/subbie.inp delete mode 100644 test cases/common/196 generator in subdir/com/mesonbuild/testprog.c delete mode 100644 test cases/common/196 generator in subdir/meson.build create mode 100644 test cases/common/196 subproject with features/meson.build create mode 100644 test cases/common/196 subproject with features/meson_options.txt create mode 100644 test cases/common/196 subproject with features/nothing.c create mode 100644 test cases/common/196 subproject with features/subprojects/auto_sub_with_missing_dep/meson.build create mode 100644 test cases/common/196 subproject with features/subprojects/disabled_sub/lib/meson.build create mode 100644 test cases/common/196 subproject with features/subprojects/disabled_sub/lib/sub.c create mode 100644 test cases/common/196 subproject with features/subprojects/disabled_sub/lib/sub.h create mode 100644 test cases/common/196 subproject with features/subprojects/disabled_sub/meson.build create mode 100644 test cases/common/196 subproject with features/subprojects/sub/lib/meson.build create mode 100644 test cases/common/196 subproject with features/subprojects/sub/lib/sub.c create mode 100644 test cases/common/196 subproject with features/subprojects/sub/lib/sub.h create mode 100644 test cases/common/196 subproject with features/subprojects/sub/meson.build create mode 100644 test cases/common/197 function attributes/meson.build create mode 100644 test cases/common/197 function attributes/meson_options.txt create mode 100644 test cases/common/197 function attributes/test.json delete mode 100644 test cases/common/197 subproject with features/meson.build delete mode 100644 test cases/common/197 subproject with features/meson_options.txt delete mode 100644 test cases/common/197 subproject with features/nothing.c delete mode 100644 test cases/common/197 subproject with features/subprojects/auto_sub_with_missing_dep/meson.build delete mode 100644 test cases/common/197 subproject with features/subprojects/disabled_sub/lib/meson.build delete mode 100644 test cases/common/197 subproject with features/subprojects/disabled_sub/lib/sub.c delete mode 100644 test cases/common/197 subproject with features/subprojects/disabled_sub/lib/sub.h delete mode 100644 test cases/common/197 subproject with features/subprojects/disabled_sub/meson.build delete mode 100644 test cases/common/197 subproject with features/subprojects/sub/lib/meson.build delete mode 100644 test cases/common/197 subproject with features/subprojects/sub/lib/sub.c delete mode 100644 test cases/common/197 subproject with features/subprojects/sub/lib/sub.h delete mode 100644 test cases/common/197 subproject with features/subprojects/sub/meson.build create mode 100644 test cases/common/198 broken subproject/meson.build create mode 100644 test cases/common/198 broken subproject/subprojects/broken/broken.c create mode 100644 test cases/common/198 broken subproject/subprojects/broken/meson.build delete mode 100644 test cases/common/198 function attributes/meson.build delete mode 100644 test cases/common/198 function attributes/meson_options.txt delete mode 100644 test cases/common/198 function attributes/test.json create mode 100644 test cases/common/199 argument syntax/meson.build delete mode 100644 test cases/common/199 broken subproject/meson.build delete mode 100644 test cases/common/199 broken subproject/subprojects/broken/broken.c delete mode 100644 test cases/common/199 broken subproject/subprojects/broken/meson.build create mode 100644 test cases/common/20 global arg/meson.build create mode 100644 test cases/common/20 global arg/prog.c create mode 100644 test cases/common/20 global arg/prog.cc delete mode 100644 test cases/common/20 header in file list/header.h delete mode 100644 test cases/common/20 header in file list/meson.build delete mode 100644 test cases/common/20 header in file list/prog.c delete mode 100644 test cases/common/200 argument syntax/meson.build create mode 100644 test cases/common/200 install name_prefix name_suffix/libfile.c create mode 100644 test cases/common/200 install name_prefix name_suffix/meson.build create mode 100644 test cases/common/200 install name_prefix name_suffix/test.json delete mode 100644 test cases/common/201 install name_prefix name_suffix/libfile.c delete mode 100644 test cases/common/201 install name_prefix name_suffix/meson.build delete mode 100644 test cases/common/201 install name_prefix name_suffix/test.json create mode 100644 test cases/common/201 kwarg entry/inc/prog.h create mode 100644 test cases/common/201 kwarg entry/meson.build create mode 100644 test cases/common/201 kwarg entry/prog.c create mode 100644 test cases/common/201 kwarg entry/test.json create mode 100644 test cases/common/202 custom target build by default/docgen.py create mode 100644 test cases/common/202 custom target build by default/meson.build create mode 100644 test cases/common/202 custom target build by default/test.json delete mode 100644 test cases/common/202 kwarg entry/inc/prog.h delete mode 100644 test cases/common/202 kwarg entry/meson.build delete mode 100644 test cases/common/202 kwarg entry/prog.c delete mode 100644 test cases/common/202 kwarg entry/test.json delete mode 100644 test cases/common/203 custom target build by default/docgen.py delete mode 100644 test cases/common/203 custom target build by default/meson.build delete mode 100644 test cases/common/203 custom target build by default/test.json create mode 100644 test cases/common/203 find_library and headers/foo.h create mode 100644 test cases/common/203 find_library and headers/meson.build delete mode 100644 test cases/common/204 find_library and headers/foo.h delete mode 100644 test cases/common/204 find_library and headers/meson.build create mode 100644 test cases/common/204 line continuation/meson.build delete mode 100644 test cases/common/205 line continuation/meson.build create mode 100644 test cases/common/205 native file path override/main.cpp create mode 100644 test cases/common/205 native file path override/meson.build create mode 100644 test cases/common/205 native file path override/nativefile.ini create mode 100644 test cases/common/205 native file path override/test.json delete mode 100644 test cases/common/206 native file path override/main.cpp delete mode 100644 test cases/common/206 native file path override/meson.build delete mode 100644 test cases/common/206 native file path override/nativefile.ini delete mode 100644 test cases/common/206 native file path override/test.json create mode 100644 test cases/common/206 tap tests/cat.c create mode 100644 test cases/common/206 tap tests/issue7515.txt create mode 100644 test cases/common/206 tap tests/meson.build create mode 100644 test cases/common/206 tap tests/tester.c delete mode 100644 test cases/common/207 tap tests/cat.c delete mode 100644 test cases/common/207 tap tests/issue7515.txt delete mode 100644 test cases/common/207 tap tests/meson.build delete mode 100644 test cases/common/207 tap tests/tester.c create mode 100644 test cases/common/207 warning level 0/main.cpp create mode 100644 test cases/common/207 warning level 0/meson.build create mode 100755 test cases/common/208 link custom/custom_stlib.py create mode 100644 test cases/common/208 link custom/custom_target.c create mode 100644 test cases/common/208 link custom/custom_target.py create mode 100644 test cases/common/208 link custom/dummy.c create mode 100644 test cases/common/208 link custom/lib.c create mode 100644 test cases/common/208 link custom/meson.build create mode 100644 test cases/common/208 link custom/outerlib.c create mode 100644 test cases/common/208 link custom/prog.c delete mode 100644 test cases/common/208 warning level 0/main.cpp delete mode 100644 test cases/common/208 warning level 0/meson.build delete mode 100755 test cases/common/209 link custom/custom_stlib.py delete mode 100644 test cases/common/209 link custom/custom_target.c delete mode 100644 test cases/common/209 link custom/custom_target.py delete mode 100644 test cases/common/209 link custom/dummy.c delete mode 100644 test cases/common/209 link custom/lib.c delete mode 100644 test cases/common/209 link custom/meson.build delete mode 100644 test cases/common/209 link custom/outerlib.c delete mode 100644 test cases/common/209 link custom/prog.c create mode 100644 test cases/common/209 link custom_i single from multiple/generate_conflicting_stlibs.py create mode 100644 test cases/common/209 link custom_i single from multiple/meson.build create mode 100644 test cases/common/209 link custom_i single from multiple/prog.c delete mode 100644 test cases/common/21 global arg/meson.build delete mode 100644 test cases/common/21 global arg/prog.c delete mode 100644 test cases/common/21 global arg/prog.cc create mode 100644 test cases/common/21 target arg/func.c create mode 100644 test cases/common/21 target arg/func2.c create mode 100644 test cases/common/21 target arg/meson.build create mode 100644 test cases/common/21 target arg/prog.cc create mode 100644 test cases/common/21 target arg/prog2.cc create mode 100644 test cases/common/210 link custom_i multiple from multiple/generate_stlibs.py create mode 100644 test cases/common/210 link custom_i multiple from multiple/meson.build create mode 100644 test cases/common/210 link custom_i multiple from multiple/prog.c delete mode 100644 test cases/common/210 link custom_i single from multiple/generate_conflicting_stlibs.py delete mode 100644 test cases/common/210 link custom_i single from multiple/meson.build delete mode 100644 test cases/common/210 link custom_i single from multiple/prog.c create mode 100644 test cases/common/211 dependency get_variable method/meson.build delete mode 100644 test cases/common/211 link custom_i multiple from multiple/generate_stlibs.py delete mode 100644 test cases/common/211 link custom_i multiple from multiple/meson.build delete mode 100644 test cases/common/211 link custom_i multiple from multiple/prog.c delete mode 100644 test cases/common/212 dependency get_variable method/meson.build create mode 100644 test cases/common/212 source set configuration_data/a.c create mode 100644 test cases/common/212 source set configuration_data/all.h create mode 100644 test cases/common/212 source set configuration_data/f.c create mode 100644 test cases/common/212 source set configuration_data/g.c create mode 100644 test cases/common/212 source set configuration_data/meson.build create mode 100644 test cases/common/212 source set configuration_data/nope.c create mode 100644 test cases/common/212 source set configuration_data/subdir/b.c create mode 100644 test cases/common/212 source set configuration_data/subdir/meson.build delete mode 100644 test cases/common/213 source set configuration_data/a.c delete mode 100644 test cases/common/213 source set configuration_data/all.h delete mode 100644 test cases/common/213 source set configuration_data/f.c delete mode 100644 test cases/common/213 source set configuration_data/g.c delete mode 100644 test cases/common/213 source set configuration_data/meson.build delete mode 100644 test cases/common/213 source set configuration_data/nope.c delete mode 100644 test cases/common/213 source set configuration_data/subdir/b.c delete mode 100644 test cases/common/213 source set configuration_data/subdir/meson.build create mode 100644 test cases/common/213 source set dictionary/a.c create mode 100644 test cases/common/213 source set dictionary/all.h create mode 100644 test cases/common/213 source set dictionary/f.c create mode 100644 test cases/common/213 source set dictionary/g.c create mode 100644 test cases/common/213 source set dictionary/meson.build create mode 100644 test cases/common/213 source set dictionary/nope.c create mode 100644 test cases/common/213 source set dictionary/subdir/b.c create mode 100644 test cases/common/213 source set dictionary/subdir/meson.build create mode 100644 test cases/common/214 source set custom target/a.c create mode 100644 test cases/common/214 source set custom target/all.h create mode 100644 test cases/common/214 source set custom target/cp.py create mode 100644 test cases/common/214 source set custom target/f.c create mode 100644 test cases/common/214 source set custom target/g.c create mode 100644 test cases/common/214 source set custom target/meson.build delete mode 100644 test cases/common/214 source set dictionary/a.c delete mode 100644 test cases/common/214 source set dictionary/all.h delete mode 100644 test cases/common/214 source set dictionary/f.c delete mode 100644 test cases/common/214 source set dictionary/g.c delete mode 100644 test cases/common/214 source set dictionary/meson.build delete mode 100644 test cases/common/214 source set dictionary/nope.c delete mode 100644 test cases/common/214 source set dictionary/subdir/b.c delete mode 100644 test cases/common/214 source set dictionary/subdir/meson.build delete mode 100644 test cases/common/215 source set custom target/a.c delete mode 100644 test cases/common/215 source set custom target/all.h delete mode 100644 test cases/common/215 source set custom target/cp.py delete mode 100644 test cases/common/215 source set custom target/f.c delete mode 100644 test cases/common/215 source set custom target/g.c delete mode 100644 test cases/common/215 source set custom target/meson.build create mode 100644 test cases/common/215 source set realistic example/boards/arm/aarch64.cc create mode 100644 test cases/common/215 source set realistic example/boards/arm/arm.cc create mode 100644 test cases/common/215 source set realistic example/boards/arm/arm.h create mode 100644 test cases/common/215 source set realistic example/boards/arm/arm32.cc create mode 100644 test cases/common/215 source set realistic example/boards/arm/versatilepb.cc create mode 100644 test cases/common/215 source set realistic example/boards/arm/virt.cc create mode 100644 test cases/common/215 source set realistic example/boards/arm/xlnx_zcu102.cc create mode 100644 test cases/common/215 source set realistic example/boards/meson.build create mode 100644 test cases/common/215 source set realistic example/boards/x86/pc.cc create mode 100644 test cases/common/215 source set realistic example/common.h create mode 100644 test cases/common/215 source set realistic example/config/aarch64 create mode 100644 test cases/common/215 source set realistic example/config/arm create mode 100644 test cases/common/215 source set realistic example/config/x86 create mode 100644 test cases/common/215 source set realistic example/devices/meson.build create mode 100644 test cases/common/215 source set realistic example/devices/virtio-mmio.cc create mode 100644 test cases/common/215 source set realistic example/devices/virtio-pci.cc create mode 100644 test cases/common/215 source set realistic example/devices/virtio.cc create mode 100644 test cases/common/215 source set realistic example/devices/virtio.h create mode 100644 test cases/common/215 source set realistic example/main.cc create mode 100644 test cases/common/215 source set realistic example/meson.build create mode 100644 test cases/common/215 source set realistic example/not-found.cc create mode 100644 test cases/common/215 source set realistic example/was-found.cc create mode 100644 test cases/common/215 source set realistic example/zlib.cc create mode 100644 test cases/common/216 custom target input extracted objects/check_object.py create mode 100644 test cases/common/216 custom target input extracted objects/libdir/meson.build create mode 100644 test cases/common/216 custom target input extracted objects/libdir/source.c create mode 100644 test cases/common/216 custom target input extracted objects/meson.build delete mode 100644 test cases/common/216 source set realistic example/boards/arm/aarch64.cc delete mode 100644 test cases/common/216 source set realistic example/boards/arm/arm.cc delete mode 100644 test cases/common/216 source set realistic example/boards/arm/arm.h delete mode 100644 test cases/common/216 source set realistic example/boards/arm/arm32.cc delete mode 100644 test cases/common/216 source set realistic example/boards/arm/versatilepb.cc delete mode 100644 test cases/common/216 source set realistic example/boards/arm/virt.cc delete mode 100644 test cases/common/216 source set realistic example/boards/arm/xlnx_zcu102.cc delete mode 100644 test cases/common/216 source set realistic example/boards/meson.build delete mode 100644 test cases/common/216 source set realistic example/boards/x86/pc.cc delete mode 100644 test cases/common/216 source set realistic example/common.h delete mode 100644 test cases/common/216 source set realistic example/config/aarch64 delete mode 100644 test cases/common/216 source set realistic example/config/arm delete mode 100644 test cases/common/216 source set realistic example/config/x86 delete mode 100644 test cases/common/216 source set realistic example/devices/meson.build delete mode 100644 test cases/common/216 source set realistic example/devices/virtio-mmio.cc delete mode 100644 test cases/common/216 source set realistic example/devices/virtio-pci.cc delete mode 100644 test cases/common/216 source set realistic example/devices/virtio.cc delete mode 100644 test cases/common/216 source set realistic example/devices/virtio.h delete mode 100644 test cases/common/216 source set realistic example/main.cc delete mode 100644 test cases/common/216 source set realistic example/meson.build delete mode 100644 test cases/common/216 source set realistic example/not-found.cc delete mode 100644 test cases/common/216 source set realistic example/was-found.cc delete mode 100644 test cases/common/216 source set realistic example/zlib.cc delete mode 100644 test cases/common/217 custom target input extracted objects/check_object.py delete mode 100644 test cases/common/217 custom target input extracted objects/libdir/meson.build delete mode 100644 test cases/common/217 custom target input extracted objects/libdir/source.c delete mode 100644 test cases/common/217 custom target input extracted objects/meson.build create mode 100644 test cases/common/217 test priorities/meson.build create mode 100644 test cases/common/217 test priorities/testprog.py create mode 100644 test cases/common/218 include_dir dot/meson.build create mode 100644 test cases/common/218 include_dir dot/rone.h create mode 100644 test cases/common/218 include_dir dot/src/main.c create mode 100644 test cases/common/218 include_dir dot/src/meson.build create mode 100644 test cases/common/218 include_dir dot/src/rone.c delete mode 100644 test cases/common/218 test priorities/meson.build delete mode 100644 test cases/common/218 test priorities/testprog.py delete mode 100644 test cases/common/219 include_dir dot/meson.build delete mode 100644 test cases/common/219 include_dir dot/rone.h delete mode 100644 test cases/common/219 include_dir dot/src/main.c delete mode 100644 test cases/common/219 include_dir dot/src/meson.build delete mode 100644 test cases/common/219 include_dir dot/src/rone.c create mode 100644 test cases/common/219 include_type dependency/main.cpp create mode 100644 test cases/common/219 include_type dependency/meson.build create mode 100644 test cases/common/219 include_type dependency/pch/test.hpp create mode 100644 test cases/common/219 include_type dependency/subprojects/subDep/meson.build create mode 100644 test cases/common/22 object extraction/lib.c create mode 100644 test cases/common/22 object extraction/lib2.c create mode 100644 test cases/common/22 object extraction/main.c create mode 100644 test cases/common/22 object extraction/meson.build create mode 100644 test cases/common/22 object extraction/src/lib.c delete mode 100644 test cases/common/22 target arg/func.c delete mode 100644 test cases/common/22 target arg/func2.c delete mode 100644 test cases/common/22 target arg/meson.build delete mode 100644 test cases/common/22 target arg/prog.cc delete mode 100644 test cases/common/22 target arg/prog2.cc create mode 100644 test cases/common/220 fs module/meson.build create mode 100644 test cases/common/220 fs module/subdir/meson.build create mode 100644 test cases/common/220 fs module/subdir/subdirfile.txt create mode 100644 test cases/common/220 fs module/subprojects/subbie/meson.build create mode 100644 test cases/common/220 fs module/subprojects/subbie/subprojectfile.txt create mode 100644 test cases/common/220 fs module/subprojects/subbie/subsub/meson.build create mode 100644 test cases/common/220 fs module/subprojects/subbie/subsub/subsubfile.txt delete mode 100644 test cases/common/220 include_type dependency/main.cpp delete mode 100644 test cases/common/220 include_type dependency/meson.build delete mode 100644 test cases/common/220 include_type dependency/pch/test.hpp delete mode 100644 test cases/common/220 include_type dependency/subprojects/subDep/meson.build delete mode 100644 test cases/common/221 fs module/meson.build delete mode 100644 test cases/common/221 fs module/subdir/meson.build delete mode 100644 test cases/common/221 fs module/subdir/subdirfile.txt delete mode 100644 test cases/common/221 fs module/subprojects/subbie/meson.build delete mode 100644 test cases/common/221 fs module/subprojects/subbie/subprojectfile.txt delete mode 100644 test cases/common/221 fs module/subprojects/subbie/subsub/meson.build delete mode 100644 test cases/common/221 fs module/subprojects/subbie/subsub/subsubfile.txt create mode 100644 test cases/common/221 zlib/meson.build create mode 100644 test cases/common/222 native prop/crossfile.ini create mode 100644 test cases/common/222 native prop/meson.build create mode 100644 test cases/common/222 native prop/nativefile.ini delete mode 100644 test cases/common/222 zlib/meson.build delete mode 100644 test cases/common/223 native prop/crossfile.ini delete mode 100644 test cases/common/223 native prop/meson.build delete mode 100644 test cases/common/223 native prop/nativefile.ini create mode 100644 test cases/common/223 persubproject options/foo.c create mode 100644 test cases/common/223 persubproject options/meson.build create mode 100644 test cases/common/223 persubproject options/subprojects/sub1/foo.c create mode 100644 test cases/common/223 persubproject options/subprojects/sub1/meson.build create mode 100644 test cases/common/223 persubproject options/subprojects/sub2/foo.c create mode 100644 test cases/common/223 persubproject options/subprojects/sub2/meson.build create mode 100644 test cases/common/224 arithmetic operators/meson.build delete mode 100644 test cases/common/224 persubproject options/foo.c delete mode 100644 test cases/common/224 persubproject options/meson.build delete mode 100644 test cases/common/224 persubproject options/subprojects/sub1/foo.c delete mode 100644 test cases/common/224 persubproject options/subprojects/sub1/meson.build delete mode 100644 test cases/common/224 persubproject options/subprojects/sub2/foo.c delete mode 100644 test cases/common/224 persubproject options/subprojects/sub2/meson.build delete mode 100644 test cases/common/225 arithmetic operators/meson.build create mode 100644 test cases/common/225 link language/c_linkage.cpp create mode 100644 test cases/common/225 link language/c_linkage.h create mode 100644 test cases/common/225 link language/lib.cpp create mode 100644 test cases/common/225 link language/main.c create mode 100644 test cases/common/225 link language/meson.build create mode 100644 test cases/common/226 link depends indexed custom target/check_arch.py create mode 100644 test cases/common/226 link depends indexed custom target/foo.c create mode 100644 test cases/common/226 link depends indexed custom target/make_file.py create mode 100644 test cases/common/226 link depends indexed custom target/meson.build delete mode 100644 test cases/common/226 link language/c_linkage.cpp delete mode 100644 test cases/common/226 link language/c_linkage.h delete mode 100644 test cases/common/226 link language/lib.cpp delete mode 100644 test cases/common/226 link language/main.c delete mode 100644 test cases/common/226 link language/meson.build delete mode 100644 test cases/common/227 link depends indexed custom target/check_arch.py delete mode 100644 test cases/common/227 link depends indexed custom target/foo.c delete mode 100644 test cases/common/227 link depends indexed custom target/make_file.py delete mode 100644 test cases/common/227 link depends indexed custom target/meson.build create mode 100755 test cases/common/227 very long commmand line/codegen.py create mode 100644 test cases/common/227 very long commmand line/main.c create mode 100644 test cases/common/227 very long commmand line/meson.build create mode 100755 test cases/common/227 very long commmand line/name_gen.py create mode 100644 test cases/common/228 custom_target source/a create mode 100644 test cases/common/228 custom_target source/meson.build create mode 100644 test cases/common/228 custom_target source/x.py delete mode 100755 test cases/common/228 very long commmand line/codegen.py delete mode 100644 test cases/common/228 very long commmand line/main.c delete mode 100644 test cases/common/228 very long commmand line/meson.build delete mode 100755 test cases/common/228 very long commmand line/name_gen.py delete mode 100644 test cases/common/229 custom_target source/a delete mode 100644 test cases/common/229 custom_target source/meson.build delete mode 100644 test cases/common/229 custom_target source/x.py create mode 100644 test cases/common/229 disabler array addition/meson.build create mode 100644 test cases/common/229 disabler array addition/test.c create mode 100644 test cases/common/23 endian/meson.build create mode 100644 test cases/common/23 endian/prog.c delete mode 100644 test cases/common/23 object extraction/lib.c delete mode 100644 test cases/common/23 object extraction/lib2.c delete mode 100644 test cases/common/23 object extraction/main.c delete mode 100644 test cases/common/23 object extraction/meson.build delete mode 100644 test cases/common/23 object extraction/src/lib.c delete mode 100644 test cases/common/230 disabler array addition/meson.build delete mode 100644 test cases/common/230 disabler array addition/test.c create mode 100644 test cases/common/230 external project/app.c create mode 100644 test cases/common/230 external project/func.c create mode 100644 test cases/common/230 external project/func.h create mode 100755 test cases/common/230 external project/libfoo/configure create mode 100644 test cases/common/230 external project/libfoo/libfoo.c create mode 100644 test cases/common/230 external project/libfoo/libfoo.h create mode 100644 test cases/common/230 external project/libfoo/meson.build create mode 100644 test cases/common/230 external project/meson.build create mode 100644 test cases/common/230 external project/test.json delete mode 100644 test cases/common/231 external project/app.c delete mode 100644 test cases/common/231 external project/func.c delete mode 100644 test cases/common/231 external project/func.h delete mode 100755 test cases/common/231 external project/libfoo/configure delete mode 100644 test cases/common/231 external project/libfoo/libfoo.c delete mode 100644 test cases/common/231 external project/libfoo/libfoo.h delete mode 100644 test cases/common/231 external project/libfoo/meson.build delete mode 100644 test cases/common/231 external project/meson.build delete mode 100644 test cases/common/231 external project/test.json create mode 100644 test cases/common/231 subdir files/meson.build create mode 100644 test cases/common/231 subdir files/subdir/meson.build create mode 100644 test cases/common/231 subdir files/subdir/prog.c create mode 100644 test cases/common/232 dependency allow_fallback/meson.build create mode 100644 test cases/common/232 dependency allow_fallback/subprojects/foob/meson.build create mode 100644 test cases/common/232 dependency allow_fallback/subprojects/foob3/meson.build delete mode 100644 test cases/common/232 subdir files/meson.build delete mode 100644 test cases/common/232 subdir files/subdir/meson.build delete mode 100644 test cases/common/232 subdir files/subdir/prog.c delete mode 100644 test cases/common/233 dependency allow_fallback/meson.build delete mode 100644 test cases/common/233 dependency allow_fallback/subprojects/foob/meson.build delete mode 100644 test cases/common/233 dependency allow_fallback/subprojects/foob3/meson.build create mode 100644 test cases/common/233 wrap case/meson.build create mode 100644 test cases/common/233 wrap case/prog.c create mode 100644 test cases/common/233 wrap case/subprojects/up_down.wrap create mode 100644 test cases/common/233 wrap case/subprojects/up_down/meson.build create mode 100644 test cases/common/233 wrap case/subprojects/up_down/up_down.h create mode 100644 test cases/common/234 get_file_contents/.gitattributes create mode 100644 test cases/common/234 get_file_contents/VERSION create mode 100644 test cases/common/234 get_file_contents/meson.build create mode 100644 test cases/common/234 get_file_contents/other/meson.build create mode 100644 test cases/common/234 get_file_contents/utf-16-text delete mode 100644 test cases/common/234 wrap case/meson.build delete mode 100644 test cases/common/234 wrap case/prog.c delete mode 100644 test cases/common/234 wrap case/subprojects/up_down.wrap delete mode 100644 test cases/common/234 wrap case/subprojects/up_down/meson.build delete mode 100644 test cases/common/234 wrap case/subprojects/up_down/up_down.h delete mode 100644 test cases/common/235 get_file_contents/.gitattributes delete mode 100644 test cases/common/235 get_file_contents/VERSION delete mode 100644 test cases/common/235 get_file_contents/meson.build delete mode 100644 test cases/common/235 get_file_contents/other/meson.build delete mode 100644 test cases/common/235 get_file_contents/utf-16-text create mode 100644 test cases/common/235 invalid standard overriden to valid/main.c create mode 100644 test cases/common/235 invalid standard overriden to valid/meson.build create mode 100644 test cases/common/235 invalid standard overriden to valid/test.json delete mode 100644 test cases/common/236 invalid standard overriden to valid/main.c delete mode 100644 test cases/common/236 invalid standard overriden to valid/meson.build delete mode 100644 test cases/common/236 invalid standard overriden to valid/test.json create mode 100644 test cases/common/236 proper args splitting/main.c create mode 100644 test cases/common/236 proper args splitting/meson.build create mode 100644 test cases/common/236 proper args splitting/test.json create mode 100644 test cases/common/237 fstrings/meson.build delete mode 100644 test cases/common/237 proper args splitting/main.c delete mode 100644 test cases/common/237 proper args splitting/meson.build delete mode 100644 test cases/common/237 proper args splitting/test.json create mode 100644 test cases/common/238 dependency include_type inconsistency/bar/meson.build create mode 100644 test cases/common/238 dependency include_type inconsistency/meson.build create mode 100644 test cases/common/238 dependency include_type inconsistency/subprojects/baz.wrap create mode 100644 test cases/common/238 dependency include_type inconsistency/subprojects/baz/meson.build create mode 100644 test cases/common/238 dependency include_type inconsistency/subprojects/foo.wrap create mode 100644 test cases/common/238 dependency include_type inconsistency/subprojects/foo/meson.build delete mode 100644 test cases/common/238 fstrings/meson.build delete mode 100644 test cases/common/239 dependency include_type inconsistency/bar/meson.build delete mode 100644 test cases/common/239 dependency include_type inconsistency/meson.build delete mode 100644 test cases/common/239 dependency include_type inconsistency/subprojects/baz.wrap delete mode 100644 test cases/common/239 dependency include_type inconsistency/subprojects/baz/meson.build delete mode 100644 test cases/common/239 dependency include_type inconsistency/subprojects/foo.wrap delete mode 100644 test cases/common/239 dependency include_type inconsistency/subprojects/foo/meson.build create mode 100644 test cases/common/239 includedir violation/meson.build create mode 100644 test cases/common/239 includedir violation/subprojects/sub/include/placeholder.h create mode 100644 test cases/common/239 includedir violation/subprojects/sub/meson.build create mode 100644 test cases/common/239 includedir violation/test.json delete mode 100644 test cases/common/24 endian/meson.build delete mode 100644 test cases/common/24 endian/prog.c create mode 100644 test cases/common/24 library versions/lib.c create mode 100644 test cases/common/24 library versions/meson.build create mode 100644 test cases/common/24 library versions/subdir/meson.build create mode 100644 test cases/common/24 library versions/test.json delete mode 100644 test cases/common/240 includedir violation/meson.build delete mode 100644 test cases/common/240 includedir violation/subprojects/sub/include/placeholder.h delete mode 100644 test cases/common/240 includedir violation/subprojects/sub/meson.build delete mode 100644 test cases/common/240 includedir violation/test.json create mode 100644 test cases/common/25 config subdir/include/config.h.in create mode 100644 test cases/common/25 config subdir/include/meson.build create mode 100644 test cases/common/25 config subdir/meson.build create mode 100644 test cases/common/25 config subdir/src/meson.build create mode 100644 test cases/common/25 config subdir/src/prog.c delete mode 100644 test cases/common/25 library versions/lib.c delete mode 100644 test cases/common/25 library versions/meson.build delete mode 100644 test cases/common/25 library versions/subdir/meson.build delete mode 100644 test cases/common/25 library versions/test.json delete mode 100644 test cases/common/26 config subdir/include/config.h.in delete mode 100644 test cases/common/26 config subdir/include/meson.build delete mode 100644 test cases/common/26 config subdir/meson.build delete mode 100644 test cases/common/26 config subdir/src/meson.build delete mode 100644 test cases/common/26 config subdir/src/prog.c create mode 100644 test cases/common/26 find program/meson.build create mode 100644 test cases/common/26 find program/print-version-with-prefix.py create mode 100644 test cases/common/26 find program/print-version.py create mode 100644 test cases/common/26 find program/scripts/test_subdir.py create mode 100644 test cases/common/26 find program/source.in delete mode 100644 test cases/common/27 find program/meson.build delete mode 100644 test cases/common/27 find program/print-version-with-prefix.py delete mode 100644 test cases/common/27 find program/print-version.py delete mode 100644 test cases/common/27 find program/scripts/test_subdir.py delete mode 100644 test cases/common/27 find program/source.in create mode 100644 test cases/common/27 multiline string/meson.build delete mode 100644 test cases/common/28 multiline string/meson.build create mode 100644 test cases/common/28 try compile/invalid.c create mode 100644 test cases/common/28 try compile/meson.build create mode 100644 test cases/common/28 try compile/valid.c create mode 100644 test cases/common/29 compiler id/meson.build delete mode 100644 test cases/common/29 try compile/invalid.c delete mode 100644 test cases/common/29 try compile/meson.build delete mode 100644 test cases/common/29 try compile/valid.c delete mode 100644 test cases/common/30 compiler id/meson.build create mode 100644 test cases/common/30 sizeof/config.h.in create mode 100644 test cases/common/30 sizeof/meson.build create mode 100644 test cases/common/30 sizeof/prog.c.in create mode 100644 test cases/common/31 define10/config.h.in create mode 100644 test cases/common/31 define10/meson.build create mode 100644 test cases/common/31 define10/prog.c delete mode 100644 test cases/common/31 sizeof/config.h.in delete mode 100644 test cases/common/31 sizeof/meson.build delete mode 100644 test cases/common/31 sizeof/prog.c.in delete mode 100644 test cases/common/32 define10/config.h.in delete mode 100644 test cases/common/32 define10/meson.build delete mode 100644 test cases/common/32 define10/prog.c create mode 100644 test cases/common/32 has header/meson.build create mode 100644 test cases/common/32 has header/ouagadougou.h delete mode 100644 test cases/common/33 has header/meson.build delete mode 100644 test cases/common/33 has header/ouagadougou.h create mode 100644 test cases/common/33 run program/check-env.py create mode 100644 test cases/common/33 run program/get-version.py create mode 100644 test cases/common/33 run program/meson.build create mode 100644 test cases/common/33 run program/scripts/hello.bat create mode 100755 test cases/common/33 run program/scripts/hello.sh create mode 100644 test cases/common/34 logic ops/meson.build delete mode 100644 test cases/common/34 run program/check-env.py delete mode 100644 test cases/common/34 run program/get-version.py delete mode 100644 test cases/common/34 run program/meson.build delete mode 100644 test cases/common/34 run program/scripts/hello.bat delete mode 100755 test cases/common/34 run program/scripts/hello.sh delete mode 100644 test cases/common/35 logic ops/meson.build create mode 100644 test cases/common/35 string operations/meson.build create mode 100644 test cases/common/36 has function/meson.build delete mode 100644 test cases/common/36 string operations/meson.build delete mode 100644 test cases/common/37 has function/meson.build create mode 100644 test cases/common/37 has member/meson.build create mode 100644 test cases/common/38 alignment/meson.build delete mode 100644 test cases/common/38 has member/meson.build delete mode 100644 test cases/common/39 alignment/meson.build create mode 100644 test cases/common/39 library chain/main.c create mode 100644 test cases/common/39 library chain/meson.build create mode 100644 test cases/common/39 library chain/subdir/lib1.c create mode 100644 test cases/common/39 library chain/subdir/meson.build create mode 100644 test cases/common/39 library chain/subdir/subdir2/lib2.c create mode 100644 test cases/common/39 library chain/subdir/subdir2/meson.build create mode 100644 test cases/common/39 library chain/subdir/subdir3/lib3.c create mode 100644 test cases/common/39 library chain/subdir/subdir3/meson.build create mode 100644 test cases/common/39 library chain/test.json delete mode 100644 test cases/common/40 library chain/main.c delete mode 100644 test cases/common/40 library chain/meson.build delete mode 100644 test cases/common/40 library chain/subdir/lib1.c delete mode 100644 test cases/common/40 library chain/subdir/meson.build delete mode 100644 test cases/common/40 library chain/subdir/subdir2/lib2.c delete mode 100644 test cases/common/40 library chain/subdir/subdir2/meson.build delete mode 100644 test cases/common/40 library chain/subdir/subdir3/lib3.c delete mode 100644 test cases/common/40 library chain/subdir/subdir3/meson.build delete mode 100644 test cases/common/40 library chain/test.json create mode 100644 test cases/common/40 options/meson.build create mode 100644 test cases/common/40 options/meson_options.txt delete mode 100644 test cases/common/41 options/meson.build delete mode 100644 test cases/common/41 options/meson_options.txt create mode 100644 test cases/common/41 test args/cmd_args.c create mode 100644 test cases/common/41 test args/copyfile.py create mode 100644 test cases/common/41 test args/env2vars.c create mode 100644 test cases/common/41 test args/envvars.c create mode 100644 test cases/common/41 test args/meson.build create mode 100644 test cases/common/41 test args/tester.c create mode 100755 test cases/common/41 test args/tester.py create mode 100644 test cases/common/41 test args/testfile.txt create mode 100644 test cases/common/42 subproject/meson.build create mode 100644 test cases/common/42 subproject/subprojects/sublib/include/subdefs.h create mode 100644 test cases/common/42 subproject/subprojects/sublib/meson.build create mode 100644 test cases/common/42 subproject/subprojects/sublib/simpletest.c create mode 100644 test cases/common/42 subproject/subprojects/sublib/sublib.c create mode 100644 test cases/common/42 subproject/test.json create mode 100644 test cases/common/42 subproject/user.c delete mode 100644 test cases/common/42 test args/cmd_args.c delete mode 100644 test cases/common/42 test args/copyfile.py delete mode 100644 test cases/common/42 test args/env2vars.c delete mode 100644 test cases/common/42 test args/envvars.c delete mode 100644 test cases/common/42 test args/meson.build delete mode 100644 test cases/common/42 test args/tester.c delete mode 100755 test cases/common/42 test args/tester.py delete mode 100644 test cases/common/42 test args/testfile.txt create mode 100644 test cases/common/43 subproject options/meson.build create mode 100644 test cases/common/43 subproject options/meson_options.txt create mode 100644 test cases/common/43 subproject options/subprojects/subproject/meson.build create mode 100644 test cases/common/43 subproject options/subprojects/subproject/meson_options.txt delete mode 100644 test cases/common/43 subproject/meson.build delete mode 100644 test cases/common/43 subproject/subprojects/sublib/include/subdefs.h delete mode 100644 test cases/common/43 subproject/subprojects/sublib/meson.build delete mode 100644 test cases/common/43 subproject/subprojects/sublib/simpletest.c delete mode 100644 test cases/common/43 subproject/subprojects/sublib/sublib.c delete mode 100644 test cases/common/43 subproject/test.json delete mode 100644 test cases/common/43 subproject/user.c create mode 100644 test cases/common/44 pkgconfig-gen/dependencies/custom.c create mode 100644 test cases/common/44 pkgconfig-gen/dependencies/exposed.c create mode 100644 test cases/common/44 pkgconfig-gen/dependencies/internal.c create mode 100644 test cases/common/44 pkgconfig-gen/dependencies/main.c create mode 100644 test cases/common/44 pkgconfig-gen/dependencies/meson.build create mode 100644 test cases/common/44 pkgconfig-gen/meson.build create mode 100644 test cases/common/44 pkgconfig-gen/simple.c create mode 100644 test cases/common/44 pkgconfig-gen/simple.h create mode 100644 test cases/common/44 pkgconfig-gen/simple5.c create mode 100644 test cases/common/44 pkgconfig-gen/test.json delete mode 100644 test cases/common/44 subproject options/meson.build delete mode 100644 test cases/common/44 subproject options/meson_options.txt delete mode 100644 test cases/common/44 subproject options/subprojects/subproject/meson.build delete mode 100644 test cases/common/44 subproject options/subprojects/subproject/meson_options.txt create mode 100644 test cases/common/45 custom install dirs/datafile.cat create mode 100644 test cases/common/45 custom install dirs/meson.build create mode 100644 test cases/common/45 custom install dirs/prog.1 create mode 100644 test cases/common/45 custom install dirs/prog.c create mode 100644 test cases/common/45 custom install dirs/sample.h create mode 100644 test cases/common/45 custom install dirs/subdir/datafile.dog create mode 100644 test cases/common/45 custom install dirs/test.json delete mode 100644 test cases/common/45 pkgconfig-gen/dependencies/custom.c delete mode 100644 test cases/common/45 pkgconfig-gen/dependencies/exposed.c delete mode 100644 test cases/common/45 pkgconfig-gen/dependencies/internal.c delete mode 100644 test cases/common/45 pkgconfig-gen/dependencies/main.c delete mode 100644 test cases/common/45 pkgconfig-gen/dependencies/meson.build delete mode 100644 test cases/common/45 pkgconfig-gen/meson.build delete mode 100644 test cases/common/45 pkgconfig-gen/simple.c delete mode 100644 test cases/common/45 pkgconfig-gen/simple.h delete mode 100644 test cases/common/45 pkgconfig-gen/simple5.c delete mode 100644 test cases/common/45 pkgconfig-gen/test.json delete mode 100644 test cases/common/46 custom install dirs/datafile.cat delete mode 100644 test cases/common/46 custom install dirs/meson.build delete mode 100644 test cases/common/46 custom install dirs/prog.1 delete mode 100644 test cases/common/46 custom install dirs/prog.c delete mode 100644 test cases/common/46 custom install dirs/sample.h delete mode 100644 test cases/common/46 custom install dirs/subdir/datafile.dog delete mode 100644 test cases/common/46 custom install dirs/test.json create mode 100644 test cases/common/46 subproject subproject/meson.build create mode 100644 test cases/common/46 subproject subproject/prog.c create mode 100644 test cases/common/46 subproject subproject/subprojects/a/a.c create mode 100644 test cases/common/46 subproject subproject/subprojects/a/meson.build create mode 100644 test cases/common/46 subproject subproject/subprojects/b/b.c create mode 100644 test cases/common/46 subproject subproject/subprojects/b/meson.build create mode 100644 test cases/common/46 subproject subproject/subprojects/c/meson.build create mode 100644 test cases/common/47 same file name/d1/file.c create mode 100644 test cases/common/47 same file name/d2/file.c create mode 100644 test cases/common/47 same file name/meson.build create mode 100644 test cases/common/47 same file name/prog.c delete mode 100644 test cases/common/47 subproject subproject/meson.build delete mode 100644 test cases/common/47 subproject subproject/prog.c delete mode 100644 test cases/common/47 subproject subproject/subprojects/a/a.c delete mode 100644 test cases/common/47 subproject subproject/subprojects/a/meson.build delete mode 100644 test cases/common/47 subproject subproject/subprojects/b/b.c delete mode 100644 test cases/common/47 subproject subproject/subprojects/b/meson.build delete mode 100644 test cases/common/47 subproject subproject/subprojects/c/meson.build create mode 100644 test cases/common/48 file grabber/a.c create mode 100644 test cases/common/48 file grabber/b.c create mode 100644 test cases/common/48 file grabber/c.c create mode 100644 test cases/common/48 file grabber/grabber.bat create mode 100755 test cases/common/48 file grabber/grabber.sh create mode 100644 test cases/common/48 file grabber/grabber2.bat create mode 100644 test cases/common/48 file grabber/meson.build create mode 100644 test cases/common/48 file grabber/prog.c create mode 100644 test cases/common/48 file grabber/subdir/meson.build create mode 100644 test cases/common/48 file grabber/subdir/suba.c create mode 100644 test cases/common/48 file grabber/subdir/subb.c create mode 100644 test cases/common/48 file grabber/subdir/subc.c create mode 100644 test cases/common/48 file grabber/subdir/subprog.c delete mode 100644 test cases/common/48 same file name/d1/file.c delete mode 100644 test cases/common/48 same file name/d2/file.c delete mode 100644 test cases/common/48 same file name/meson.build delete mode 100644 test cases/common/48 same file name/prog.c create mode 100644 test cases/common/49 custom target/data_source.txt create mode 100755 test cases/common/49 custom target/depfile/dep.py create mode 100644 test cases/common/49 custom target/depfile/meson.build create mode 100644 test cases/common/49 custom target/meson.build create mode 100755 test cases/common/49 custom target/my_compiler.py create mode 100644 test cases/common/49 custom target/test.json delete mode 100644 test cases/common/49 file grabber/a.c delete mode 100644 test cases/common/49 file grabber/b.c delete mode 100644 test cases/common/49 file grabber/c.c delete mode 100644 test cases/common/49 file grabber/grabber.bat delete mode 100755 test cases/common/49 file grabber/grabber.sh delete mode 100644 test cases/common/49 file grabber/grabber2.bat delete mode 100644 test cases/common/49 file grabber/meson.build delete mode 100644 test cases/common/49 file grabber/prog.c delete mode 100644 test cases/common/49 file grabber/subdir/meson.build delete mode 100644 test cases/common/49 file grabber/subdir/suba.c delete mode 100644 test cases/common/49 file grabber/subdir/subb.c delete mode 100644 test cases/common/49 file grabber/subdir/subc.c delete mode 100644 test cases/common/49 file grabber/subdir/subprog.c create mode 100644 test cases/common/50 custom target chain/data_source.txt create mode 100644 test cases/common/50 custom target chain/meson.build create mode 100755 test cases/common/50 custom target chain/my_compiler.py create mode 100755 test cases/common/50 custom target chain/my_compiler2.py create mode 100644 test cases/common/50 custom target chain/test.json create mode 100644 test cases/common/50 custom target chain/usetarget/meson.build create mode 100644 test cases/common/50 custom target chain/usetarget/myexe.c create mode 100755 test cases/common/50 custom target chain/usetarget/subcomp.py delete mode 100644 test cases/common/50 custom target/data_source.txt delete mode 100755 test cases/common/50 custom target/depfile/dep.py delete mode 100644 test cases/common/50 custom target/depfile/meson.build delete mode 100644 test cases/common/50 custom target/meson.build delete mode 100755 test cases/common/50 custom target/my_compiler.py delete mode 100644 test cases/common/50 custom target/test.json delete mode 100644 test cases/common/51 custom target chain/data_source.txt delete mode 100644 test cases/common/51 custom target chain/meson.build delete mode 100755 test cases/common/51 custom target chain/my_compiler.py delete mode 100755 test cases/common/51 custom target chain/my_compiler2.py delete mode 100644 test cases/common/51 custom target chain/test.json delete mode 100644 test cases/common/51 custom target chain/usetarget/meson.build delete mode 100644 test cases/common/51 custom target chain/usetarget/myexe.c delete mode 100755 test cases/common/51 custom target chain/usetarget/subcomp.py create mode 100644 test cases/common/51 run target/check-env.py create mode 100755 test cases/common/51 run target/check_exists.py create mode 100755 test cases/common/51 run target/configure.in create mode 100644 test cases/common/51 run target/converter.py create mode 100755 test cases/common/51 run target/fakeburner.py create mode 100644 test cases/common/51 run target/helloprinter.c create mode 100644 test cases/common/51 run target/meson.build create mode 100644 test cases/common/51 run target/subdir/textprinter.py create mode 100644 test cases/common/52 object generator/meson.build create mode 100755 test cases/common/52 object generator/obj_generator.py create mode 100644 test cases/common/52 object generator/prog.c create mode 100644 test cases/common/52 object generator/source.c create mode 100644 test cases/common/52 object generator/source2.c create mode 100644 test cases/common/52 object generator/source3.c delete mode 100644 test cases/common/52 run target/check-env.py delete mode 100755 test cases/common/52 run target/check_exists.py delete mode 100755 test cases/common/52 run target/configure.in delete mode 100644 test cases/common/52 run target/converter.py delete mode 100755 test cases/common/52 run target/fakeburner.py delete mode 100644 test cases/common/52 run target/helloprinter.c delete mode 100644 test cases/common/52 run target/meson.build delete mode 100644 test cases/common/52 run target/subdir/textprinter.py create mode 100755 test cases/common/53 install script/customtarget.py create mode 100644 test cases/common/53 install script/meson.build create mode 100755 test cases/common/53 install script/myinstall.py create mode 100644 test cases/common/53 install script/prog.c create mode 100644 test cases/common/53 install script/src/a file.txt create mode 100644 test cases/common/53 install script/src/foo.c create mode 100644 test cases/common/53 install script/src/meson.build create mode 100644 test cases/common/53 install script/src/myinstall.py create mode 100644 test cases/common/53 install script/test.json delete mode 100644 test cases/common/53 object generator/meson.build delete mode 100755 test cases/common/53 object generator/obj_generator.py delete mode 100644 test cases/common/53 object generator/prog.c delete mode 100644 test cases/common/53 object generator/source.c delete mode 100644 test cases/common/53 object generator/source2.c delete mode 100644 test cases/common/53 object generator/source3.c create mode 100755 test cases/common/54 custom target source output/generator.py create mode 100644 test cases/common/54 custom target source output/main.c create mode 100644 test cases/common/54 custom target source output/meson.build delete mode 100755 test cases/common/54 install script/customtarget.py delete mode 100644 test cases/common/54 install script/meson.build delete mode 100755 test cases/common/54 install script/myinstall.py delete mode 100644 test cases/common/54 install script/prog.c delete mode 100644 test cases/common/54 install script/src/a file.txt delete mode 100644 test cases/common/54 install script/src/foo.c delete mode 100644 test cases/common/54 install script/src/meson.build delete mode 100644 test cases/common/54 install script/src/myinstall.py delete mode 100644 test cases/common/54 install script/test.json delete mode 100755 test cases/common/55 custom target source output/generator.py delete mode 100644 test cases/common/55 custom target source output/main.c delete mode 100644 test cases/common/55 custom target source output/meson.build create mode 100644 test cases/common/55 exe static shared/meson.build create mode 100644 test cases/common/55 exe static shared/prog.c create mode 100644 test cases/common/55 exe static shared/shlib2.c create mode 100644 test cases/common/55 exe static shared/stat.c create mode 100644 test cases/common/55 exe static shared/stat2.c create mode 100644 test cases/common/55 exe static shared/subdir/exports.h create mode 100644 test cases/common/55 exe static shared/subdir/meson.build create mode 100644 test cases/common/55 exe static shared/subdir/shlib.c create mode 100644 test cases/common/56 array methods/meson.build delete mode 100644 test cases/common/56 exe static shared/meson.build delete mode 100644 test cases/common/56 exe static shared/prog.c delete mode 100644 test cases/common/56 exe static shared/shlib2.c delete mode 100644 test cases/common/56 exe static shared/stat.c delete mode 100644 test cases/common/56 exe static shared/stat2.c delete mode 100644 test cases/common/56 exe static shared/subdir/exports.h delete mode 100644 test cases/common/56 exe static shared/subdir/meson.build delete mode 100644 test cases/common/56 exe static shared/subdir/shlib.c delete mode 100644 test cases/common/57 array methods/meson.build create mode 100644 test cases/common/57 custom header generator/input.def create mode 100644 test cases/common/57 custom header generator/makeheader.py create mode 100644 test cases/common/57 custom header generator/meson.build create mode 100644 test cases/common/57 custom header generator/prog.c create mode 100644 test cases/common/57 custom header generator/somefile.txt delete mode 100644 test cases/common/58 custom header generator/input.def delete mode 100644 test cases/common/58 custom header generator/makeheader.py delete mode 100644 test cases/common/58 custom header generator/meson.build delete mode 100644 test cases/common/58 custom header generator/prog.c delete mode 100644 test cases/common/58 custom header generator/somefile.txt create mode 100644 test cases/common/58 multiple generators/data2.dat create mode 100644 test cases/common/58 multiple generators/main.cpp create mode 100644 test cases/common/58 multiple generators/meson.build create mode 100755 test cases/common/58 multiple generators/mygen.py create mode 100644 test cases/common/58 multiple generators/subdir/data.dat create mode 100644 test cases/common/58 multiple generators/subdir/meson.build create mode 100644 test cases/common/59 install subdir/meson.build create mode 100644 test cases/common/59 install subdir/nested_elided/sub/dircheck/ninth.dat create mode 100644 test cases/common/59 install subdir/nested_elided/sub/eighth.dat create mode 100644 test cases/common/59 install subdir/sub/sub1/third.dat create mode 100644 test cases/common/59 install subdir/sub1/second.dat create mode 100644 test cases/common/59 install subdir/sub2/dircheck/excluded-three.dat create mode 100644 test cases/common/59 install subdir/sub2/excluded-three.dat create mode 100644 test cases/common/59 install subdir/sub2/excluded/two.dat create mode 100644 test cases/common/59 install subdir/sub2/one.dat create mode 100644 test cases/common/59 install subdir/sub_elided/dircheck/fifth.dat create mode 100644 test cases/common/59 install subdir/sub_elided/fourth.dat create mode 100644 test cases/common/59 install subdir/subdir/meson.build create mode 100644 test cases/common/59 install subdir/subdir/sub1/data1.dat create mode 100644 test cases/common/59 install subdir/subdir/sub1/sub2/data2.dat create mode 100644 test cases/common/59 install subdir/subdir/sub_elided/dircheck/seventh.dat create mode 100644 test cases/common/59 install subdir/subdir/sub_elided/sixth.dat create mode 100644 test cases/common/59 install subdir/test.json delete mode 100644 test cases/common/59 multiple generators/data2.dat delete mode 100644 test cases/common/59 multiple generators/main.cpp delete mode 100644 test cases/common/59 multiple generators/meson.build delete mode 100755 test cases/common/59 multiple generators/mygen.py delete mode 100644 test cases/common/59 multiple generators/subdir/data.dat delete mode 100644 test cases/common/59 multiple generators/subdir/meson.build create mode 100644 test cases/common/60 foreach/meson.build create mode 100644 test cases/common/60 foreach/prog1.c create mode 100644 test cases/common/60 foreach/prog2.c create mode 100644 test cases/common/60 foreach/prog3.c create mode 100644 test cases/common/60 foreach/test.json delete mode 100644 test cases/common/60 install subdir/meson.build delete mode 100644 test cases/common/60 install subdir/nested_elided/sub/dircheck/ninth.dat delete mode 100644 test cases/common/60 install subdir/nested_elided/sub/eighth.dat delete mode 100644 test cases/common/60 install subdir/sub/sub1/third.dat delete mode 100644 test cases/common/60 install subdir/sub1/second.dat delete mode 100644 test cases/common/60 install subdir/sub2/dircheck/excluded-three.dat delete mode 100644 test cases/common/60 install subdir/sub2/excluded-three.dat delete mode 100644 test cases/common/60 install subdir/sub2/excluded/two.dat delete mode 100644 test cases/common/60 install subdir/sub2/one.dat delete mode 100644 test cases/common/60 install subdir/sub_elided/dircheck/fifth.dat delete mode 100644 test cases/common/60 install subdir/sub_elided/fourth.dat delete mode 100644 test cases/common/60 install subdir/subdir/meson.build delete mode 100644 test cases/common/60 install subdir/subdir/sub1/data1.dat delete mode 100644 test cases/common/60 install subdir/subdir/sub1/sub2/data2.dat delete mode 100644 test cases/common/60 install subdir/subdir/sub_elided/dircheck/seventh.dat delete mode 100644 test cases/common/60 install subdir/subdir/sub_elided/sixth.dat delete mode 100644 test cases/common/60 install subdir/test.json delete mode 100644 test cases/common/61 foreach/meson.build delete mode 100644 test cases/common/61 foreach/prog1.c delete mode 100644 test cases/common/61 foreach/prog2.c delete mode 100644 test cases/common/61 foreach/prog3.c delete mode 100644 test cases/common/61 foreach/test.json create mode 100644 test cases/common/61 number arithmetic/meson.build delete mode 100644 test cases/common/62 number arithmetic/meson.build create mode 100644 test cases/common/62 string arithmetic/meson.build create mode 100644 test cases/common/63 array arithmetic/meson.build delete mode 100644 test cases/common/63 string arithmetic/meson.build create mode 100644 test cases/common/64 arithmetic bidmas/meson.build delete mode 100644 test cases/common/64 array arithmetic/meson.build delete mode 100644 test cases/common/65 arithmetic bidmas/meson.build create mode 100644 test cases/common/65 build always/main.c create mode 100644 test cases/common/65 build always/meson.build create mode 100644 test cases/common/65 build always/version.c.in create mode 100644 test cases/common/65 build always/version.h create mode 100755 test cases/common/65 build always/version_gen.py delete mode 100644 test cases/common/66 build always/main.c delete mode 100644 test cases/common/66 build always/meson.build delete mode 100644 test cases/common/66 build always/version.c.in delete mode 100644 test cases/common/66 build always/version.h delete mode 100755 test cases/common/66 build always/version_gen.py create mode 100644 test cases/common/66 vcstag/meson.build create mode 100644 test cases/common/66 vcstag/tagprog.c create mode 100644 test cases/common/66 vcstag/vcstag.c.in create mode 100644 test cases/common/67 modules/meson.build delete mode 100644 test cases/common/67 vcstag/meson.build delete mode 100644 test cases/common/67 vcstag/tagprog.c delete mode 100644 test cases/common/67 vcstag/vcstag.c.in delete mode 100644 test cases/common/68 modules/meson.build create mode 100644 test cases/common/68 should fail/failing.c create mode 100644 test cases/common/68 should fail/meson.build create mode 100644 test cases/common/69 configure file in custom target/inc/confdata.in create mode 100644 test cases/common/69 configure file in custom target/inc/meson.build create mode 100644 test cases/common/69 configure file in custom target/meson.build create mode 100644 test cases/common/69 configure file in custom target/src/meson.build create mode 100644 test cases/common/69 configure file in custom target/src/mycompiler.py delete mode 100644 test cases/common/69 should fail/failing.c delete mode 100644 test cases/common/69 should fail/meson.build delete mode 100644 test cases/common/70 configure file in custom target/inc/confdata.in delete mode 100644 test cases/common/70 configure file in custom target/inc/meson.build delete mode 100644 test cases/common/70 configure file in custom target/meson.build delete mode 100644 test cases/common/70 configure file in custom target/src/meson.build delete mode 100644 test cases/common/70 configure file in custom target/src/mycompiler.py create mode 100644 test cases/common/70 external test program/meson.build create mode 100755 test cases/common/70 external test program/mytest.py create mode 100755 test cases/common/71 ctarget dependency/gen1.py create mode 100755 test cases/common/71 ctarget dependency/gen2.py create mode 100644 test cases/common/71 ctarget dependency/input.dat create mode 100644 test cases/common/71 ctarget dependency/meson.build delete mode 100644 test cases/common/71 external test program/meson.build delete mode 100755 test cases/common/71 external test program/mytest.py delete mode 100755 test cases/common/72 ctarget dependency/gen1.py delete mode 100755 test cases/common/72 ctarget dependency/gen2.py delete mode 100644 test cases/common/72 ctarget dependency/input.dat delete mode 100644 test cases/common/72 ctarget dependency/meson.build create mode 100644 test cases/common/72 shared subproject/a.c create mode 100644 test cases/common/72 shared subproject/meson.build create mode 100644 test cases/common/72 shared subproject/subprojects/B/b.c create mode 100644 test cases/common/72 shared subproject/subprojects/B/meson.build create mode 100644 test cases/common/72 shared subproject/subprojects/C/c.c create mode 100644 test cases/common/72 shared subproject/subprojects/C/meson.build create mode 100644 test cases/common/73 shared subproject 2/a.c create mode 100644 test cases/common/73 shared subproject 2/meson.build create mode 100644 test cases/common/73 shared subproject 2/subprojects/B/b.c create mode 100644 test cases/common/73 shared subproject 2/subprojects/B/meson.build create mode 100644 test cases/common/73 shared subproject 2/subprojects/C/c.c create mode 100644 test cases/common/73 shared subproject 2/subprojects/C/meson.build delete mode 100644 test cases/common/73 shared subproject/a.c delete mode 100644 test cases/common/73 shared subproject/meson.build delete mode 100644 test cases/common/73 shared subproject/subprojects/B/b.c delete mode 100644 test cases/common/73 shared subproject/subprojects/B/meson.build delete mode 100644 test cases/common/73 shared subproject/subprojects/C/c.c delete mode 100644 test cases/common/73 shared subproject/subprojects/C/meson.build create mode 100644 test cases/common/74 file object/lib.c create mode 100644 test cases/common/74 file object/meson.build create mode 100644 test cases/common/74 file object/prog.c create mode 100644 test cases/common/74 file object/subdir1/lib.c create mode 100644 test cases/common/74 file object/subdir1/meson.build create mode 100644 test cases/common/74 file object/subdir1/prog.c create mode 100644 test cases/common/74 file object/subdir2/lib.c create mode 100644 test cases/common/74 file object/subdir2/meson.build create mode 100644 test cases/common/74 file object/subdir2/prog.c delete mode 100644 test cases/common/74 shared subproject 2/a.c delete mode 100644 test cases/common/74 shared subproject 2/meson.build delete mode 100644 test cases/common/74 shared subproject 2/subprojects/B/b.c delete mode 100644 test cases/common/74 shared subproject 2/subprojects/B/meson.build delete mode 100644 test cases/common/74 shared subproject 2/subprojects/C/c.c delete mode 100644 test cases/common/74 shared subproject 2/subprojects/C/meson.build create mode 100644 test cases/common/75 custom subproject dir/a.c create mode 100644 test cases/common/75 custom subproject dir/custom_subproject_dir/B/b.c create mode 100644 test cases/common/75 custom subproject dir/custom_subproject_dir/B/meson.build create mode 100644 test cases/common/75 custom subproject dir/custom_subproject_dir/C/c.c create mode 100644 test cases/common/75 custom subproject dir/custom_subproject_dir/C/meson.build create mode 100644 test cases/common/75 custom subproject dir/meson.build delete mode 100644 test cases/common/75 file object/lib.c delete mode 100644 test cases/common/75 file object/meson.build delete mode 100644 test cases/common/75 file object/prog.c delete mode 100644 test cases/common/75 file object/subdir1/lib.c delete mode 100644 test cases/common/75 file object/subdir1/meson.build delete mode 100644 test cases/common/75 file object/subdir1/prog.c delete mode 100644 test cases/common/75 file object/subdir2/lib.c delete mode 100644 test cases/common/75 file object/subdir2/meson.build delete mode 100644 test cases/common/75 file object/subdir2/prog.c delete mode 100644 test cases/common/76 custom subproject dir/a.c delete mode 100644 test cases/common/76 custom subproject dir/custom_subproject_dir/B/b.c delete mode 100644 test cases/common/76 custom subproject dir/custom_subproject_dir/B/meson.build delete mode 100644 test cases/common/76 custom subproject dir/custom_subproject_dir/C/c.c delete mode 100644 test cases/common/76 custom subproject dir/custom_subproject_dir/C/meson.build delete mode 100644 test cases/common/76 custom subproject dir/meson.build create mode 100644 test cases/common/76 has type/meson.build create mode 100644 test cases/common/77 extract from nested subdir/meson.build create mode 100644 test cases/common/77 extract from nested subdir/src/first/lib_first.c create mode 100644 test cases/common/77 extract from nested subdir/src/first/meson.build create mode 100644 test cases/common/77 extract from nested subdir/src/meson.build create mode 100644 test cases/common/77 extract from nested subdir/tst/first/exe_first.c create mode 100644 test cases/common/77 extract from nested subdir/tst/first/meson.build create mode 100644 test cases/common/77 extract from nested subdir/tst/meson.build delete mode 100644 test cases/common/77 has type/meson.build delete mode 100644 test cases/common/78 extract from nested subdir/meson.build delete mode 100644 test cases/common/78 extract from nested subdir/src/first/lib_first.c delete mode 100644 test cases/common/78 extract from nested subdir/src/first/meson.build delete mode 100644 test cases/common/78 extract from nested subdir/src/meson.build delete mode 100644 test cases/common/78 extract from nested subdir/tst/first/exe_first.c delete mode 100644 test cases/common/78 extract from nested subdir/tst/first/meson.build delete mode 100644 test cases/common/78 extract from nested subdir/tst/meson.build create mode 100644 test cases/common/78 internal dependency/meson.build create mode 100644 test cases/common/78 internal dependency/proj1/include/proj1.h create mode 100644 test cases/common/78 internal dependency/proj1/meson.build create mode 100644 test cases/common/78 internal dependency/proj1/proj1f1.c create mode 100644 test cases/common/78 internal dependency/proj1/proj1f2.c create mode 100644 test cases/common/78 internal dependency/proj1/proj1f3.c create mode 100644 test cases/common/78 internal dependency/src/main.c create mode 100644 test cases/common/78 internal dependency/src/meson.build delete mode 100644 test cases/common/79 internal dependency/meson.build delete mode 100644 test cases/common/79 internal dependency/proj1/include/proj1.h delete mode 100644 test cases/common/79 internal dependency/proj1/meson.build delete mode 100644 test cases/common/79 internal dependency/proj1/proj1f1.c delete mode 100644 test cases/common/79 internal dependency/proj1/proj1f2.c delete mode 100644 test cases/common/79 internal dependency/proj1/proj1f3.c delete mode 100644 test cases/common/79 internal dependency/src/main.c delete mode 100644 test cases/common/79 internal dependency/src/meson.build create mode 100644 test cases/common/79 same basename/exe1.c create mode 100644 test cases/common/79 same basename/exe2.c create mode 100644 test cases/common/79 same basename/lib.c create mode 100644 test cases/common/79 same basename/meson.build create mode 100644 test cases/common/79 same basename/sharedsub/meson.build create mode 100644 test cases/common/79 same basename/staticsub/meson.build create mode 100644 test cases/common/80 declare dep/entity/entity.h create mode 100644 test cases/common/80 declare dep/entity/entity1.c create mode 100644 test cases/common/80 declare dep/entity/entity2.c create mode 100644 test cases/common/80 declare dep/entity/meson.build create mode 100644 test cases/common/80 declare dep/main.c create mode 100644 test cases/common/80 declare dep/meson.build delete mode 100644 test cases/common/80 same basename/exe1.c delete mode 100644 test cases/common/80 same basename/exe2.c delete mode 100644 test cases/common/80 same basename/lib.c delete mode 100644 test cases/common/80 same basename/meson.build delete mode 100644 test cases/common/80 same basename/sharedsub/meson.build delete mode 100644 test cases/common/80 same basename/staticsub/meson.build delete mode 100644 test cases/common/81 declare dep/entity/entity.h delete mode 100644 test cases/common/81 declare dep/entity/entity1.c delete mode 100644 test cases/common/81 declare dep/entity/entity2.c delete mode 100644 test cases/common/81 declare dep/entity/meson.build delete mode 100644 test cases/common/81 declare dep/main.c delete mode 100644 test cases/common/81 declare dep/meson.build create mode 100644 test cases/common/81 extract all/extractor.h create mode 100644 test cases/common/81 extract all/four.c create mode 100644 test cases/common/81 extract all/meson.build create mode 100644 test cases/common/81 extract all/one.c create mode 100644 test cases/common/81 extract all/prog.c create mode 100644 test cases/common/81 extract all/three.c create mode 100644 test cases/common/81 extract all/two.c create mode 100644 test cases/common/82 add language/meson.build create mode 100644 test cases/common/82 add language/prog.c create mode 100644 test cases/common/82 add language/prog.cc delete mode 100644 test cases/common/82 extract all/extractor.h delete mode 100644 test cases/common/82 extract all/four.c delete mode 100644 test cases/common/82 extract all/meson.build delete mode 100644 test cases/common/82 extract all/one.c delete mode 100644 test cases/common/82 extract all/prog.c delete mode 100644 test cases/common/82 extract all/three.c delete mode 100644 test cases/common/82 extract all/two.c delete mode 100644 test cases/common/83 add language/meson.build delete mode 100644 test cases/common/83 add language/prog.c delete mode 100644 test cases/common/83 add language/prog.cc create mode 100644 test cases/common/83 identical target name in subproject/bar.c create mode 100644 test cases/common/83 identical target name in subproject/meson.build create mode 100644 test cases/common/83 identical target name in subproject/subprojects/foo/bar.c create mode 100644 test cases/common/83 identical target name in subproject/subprojects/foo/meson.build create mode 100644 test cases/common/83 identical target name in subproject/subprojects/foo/true.py create mode 100644 test cases/common/83 identical target name in subproject/true.py delete mode 100644 test cases/common/84 identical target name in subproject/bar.c delete mode 100644 test cases/common/84 identical target name in subproject/meson.build delete mode 100644 test cases/common/84 identical target name in subproject/subprojects/foo/bar.c delete mode 100644 test cases/common/84 identical target name in subproject/subprojects/foo/meson.build delete mode 100644 test cases/common/84 identical target name in subproject/subprojects/foo/true.py delete mode 100644 test cases/common/84 identical target name in subproject/true.py create mode 100644 test cases/common/84 plusassign/meson.build delete mode 100644 test cases/common/85 plusassign/meson.build create mode 100644 test cases/common/85 skip subdir/meson.build create mode 100644 test cases/common/85 skip subdir/subdir1/meson.build create mode 100644 test cases/common/85 skip subdir/subdir1/subdir2/meson.build create mode 100644 test cases/common/86 private include/meson.build create mode 100755 test cases/common/86 private include/stlib/compiler.py create mode 100644 test cases/common/86 private include/stlib/foo1.def create mode 100644 test cases/common/86 private include/stlib/foo2.def create mode 100644 test cases/common/86 private include/stlib/meson.build create mode 100644 test cases/common/86 private include/user/libuser.c create mode 100644 test cases/common/86 private include/user/meson.build delete mode 100644 test cases/common/86 skip subdir/meson.build delete mode 100644 test cases/common/86 skip subdir/subdir1/meson.build delete mode 100644 test cases/common/86 skip subdir/subdir1/subdir2/meson.build create mode 100644 test cases/common/87 default options/meson.build create mode 100644 test cases/common/87 default options/subprojects/sub1/meson.build create mode 100644 test cases/common/87 default options/subprojects/sub1/meson_options.txt delete mode 100644 test cases/common/87 private include/meson.build delete mode 100755 test cases/common/87 private include/stlib/compiler.py delete mode 100644 test cases/common/87 private include/stlib/foo1.def delete mode 100644 test cases/common/87 private include/stlib/foo2.def delete mode 100644 test cases/common/87 private include/stlib/meson.build delete mode 100644 test cases/common/87 private include/user/libuser.c delete mode 100644 test cases/common/87 private include/user/meson.build delete mode 100644 test cases/common/88 default options/meson.build delete mode 100644 test cases/common/88 default options/subprojects/sub1/meson.build delete mode 100644 test cases/common/88 default options/subprojects/sub1/meson_options.txt create mode 100644 test cases/common/88 dep fallback/gensrc.py create mode 100644 test cases/common/88 dep fallback/meson.build create mode 100644 test cases/common/88 dep fallback/subprojects/boblib/bob.c create mode 100644 test cases/common/88 dep fallback/subprojects/boblib/bob.h create mode 100644 test cases/common/88 dep fallback/subprojects/boblib/genbob.py create mode 100644 test cases/common/88 dep fallback/subprojects/boblib/meson.build create mode 100644 test cases/common/88 dep fallback/subprojects/dummylib/meson.build create mode 100644 test cases/common/88 dep fallback/tester.c create mode 100644 test cases/common/89 default library/ef.cpp create mode 100644 test cases/common/89 default library/ef.h create mode 100644 test cases/common/89 default library/eftest.cpp create mode 100644 test cases/common/89 default library/meson.build delete mode 100644 test cases/common/89 dep fallback/gensrc.py delete mode 100644 test cases/common/89 dep fallback/meson.build delete mode 100644 test cases/common/89 dep fallback/subprojects/boblib/bob.c delete mode 100644 test cases/common/89 dep fallback/subprojects/boblib/bob.h delete mode 100644 test cases/common/89 dep fallback/subprojects/boblib/genbob.py delete mode 100644 test cases/common/89 dep fallback/subprojects/boblib/meson.build delete mode 100644 test cases/common/89 dep fallback/subprojects/dummylib/meson.build delete mode 100644 test cases/common/89 dep fallback/tester.c delete mode 100644 test cases/common/90 default library/ef.cpp delete mode 100644 test cases/common/90 default library/ef.h delete mode 100644 test cases/common/90 default library/eftest.cpp delete mode 100644 test cases/common/90 default library/meson.build create mode 100644 test cases/common/90 gen extra/meson.build create mode 100644 test cases/common/90 gen extra/name.dat create mode 100644 test cases/common/90 gen extra/name.l create mode 100644 test cases/common/90 gen extra/plain.c create mode 100755 test cases/common/90 gen extra/srcgen.py create mode 100644 test cases/common/90 gen extra/srcgen2.py create mode 100644 test cases/common/90 gen extra/srcgen3.py create mode 100644 test cases/common/90 gen extra/upper.c create mode 100644 test cases/common/91 benchmark/delayer.c create mode 100644 test cases/common/91 benchmark/meson.build delete mode 100644 test cases/common/91 gen extra/meson.build delete mode 100644 test cases/common/91 gen extra/name.dat delete mode 100644 test cases/common/91 gen extra/name.l delete mode 100644 test cases/common/91 gen extra/plain.c delete mode 100755 test cases/common/91 gen extra/srcgen.py delete mode 100644 test cases/common/91 gen extra/srcgen2.py delete mode 100644 test cases/common/91 gen extra/srcgen3.py delete mode 100644 test cases/common/91 gen extra/upper.c delete mode 100644 test cases/common/92 benchmark/delayer.c delete mode 100644 test cases/common/92 benchmark/meson.build create mode 100644 test cases/common/92 test workdir/meson.build create mode 100644 test cases/common/92 test workdir/opener.c create mode 100755 test cases/common/92 test workdir/subdir/checker.py create mode 100644 test cases/common/92 test workdir/subdir/meson.build create mode 100644 test cases/common/93 suites/exe1.c create mode 100644 test cases/common/93 suites/exe2.c create mode 100644 test cases/common/93 suites/meson.build create mode 100644 test cases/common/93 suites/subprojects/sub/meson.build create mode 100644 test cases/common/93 suites/subprojects/sub/sub1.c create mode 100644 test cases/common/93 suites/subprojects/sub/sub2.c delete mode 100644 test cases/common/93 test workdir/meson.build delete mode 100644 test cases/common/93 test workdir/opener.c delete mode 100755 test cases/common/93 test workdir/subdir/checker.py delete mode 100644 test cases/common/93 test workdir/subdir/meson.build delete mode 100644 test cases/common/94 suites/exe1.c delete mode 100644 test cases/common/94 suites/exe2.c delete mode 100644 test cases/common/94 suites/meson.build delete mode 100644 test cases/common/94 suites/subprojects/sub/meson.build delete mode 100644 test cases/common/94 suites/subprojects/sub/sub1.c delete mode 100644 test cases/common/94 suites/subprojects/sub/sub2.c create mode 100644 test cases/common/94 threads/meson.build create mode 100644 test cases/common/94 threads/threadprog.c create mode 100644 test cases/common/94 threads/threadprog.cpp create mode 100644 test cases/common/95 manygen/depuser.c create mode 100644 test cases/common/95 manygen/meson.build create mode 100644 test cases/common/95 manygen/subdir/funcinfo.def create mode 100755 test cases/common/95 manygen/subdir/manygen.py create mode 100644 test cases/common/95 manygen/subdir/meson.build delete mode 100644 test cases/common/95 threads/meson.build delete mode 100644 test cases/common/95 threads/threadprog.c delete mode 100644 test cases/common/95 threads/threadprog.cpp delete mode 100644 test cases/common/96 manygen/depuser.c delete mode 100644 test cases/common/96 manygen/meson.build delete mode 100644 test cases/common/96 manygen/subdir/funcinfo.def delete mode 100755 test cases/common/96 manygen/subdir/manygen.py delete mode 100644 test cases/common/96 manygen/subdir/meson.build create mode 100644 test cases/common/96 stringdef/meson.build create mode 100644 test cases/common/96 stringdef/stringdef.c create mode 100644 test cases/common/97 find program path/meson.build create mode 100755 test cases/common/97 find program path/program.py delete mode 100644 test cases/common/97 stringdef/meson.build delete mode 100644 test cases/common/97 stringdef/stringdef.c delete mode 100644 test cases/common/98 find program path/meson.build delete mode 100755 test cases/common/98 find program path/program.py create mode 100644 test cases/common/98 subproject subdir/meson.build create mode 100644 test cases/common/98 subproject subdir/prog.c create mode 100644 test cases/common/98 subproject subdir/subprojects/sub/lib/meson.build create mode 100644 test cases/common/98 subproject subdir/subprojects/sub/lib/sub.c create mode 100644 test cases/common/98 subproject subdir/subprojects/sub/lib/sub.h create mode 100644 test cases/common/98 subproject subdir/subprojects/sub/meson.build create mode 100644 test cases/common/98 subproject subdir/subprojects/sub_implicit.wrap create mode 100644 test cases/common/98 subproject subdir/subprojects/sub_implicit/meson.build create mode 100644 test cases/common/98 subproject subdir/subprojects/sub_implicit/subprojects/subsub/foo.h create mode 100644 test cases/common/98 subproject subdir/subprojects/sub_implicit/subprojects/subsub/meson.build create mode 100644 test cases/common/98 subproject subdir/subprojects/sub_implicit/subprojects/subsub/subprojects/packagefiles/subsubsub-1.0.zip create mode 100644 test cases/common/98 subproject subdir/subprojects/sub_implicit/subprojects/subsub/subprojects/subsubsub.wrap create mode 100644 test cases/common/98 subproject subdir/subprojects/sub_novar/meson.build create mode 100644 test cases/common/98 subproject subdir/test.json create mode 100644 test cases/common/99 postconf/meson.build create mode 100644 test cases/common/99 postconf/postconf.py create mode 100644 test cases/common/99 postconf/prog.c create mode 100644 test cases/common/99 postconf/raw.dat delete mode 100644 test cases/common/99 subproject subdir/meson.build delete mode 100644 test cases/common/99 subproject subdir/prog.c delete mode 100644 test cases/common/99 subproject subdir/subprojects/sub/lib/meson.build delete mode 100644 test cases/common/99 subproject subdir/subprojects/sub/lib/sub.c delete mode 100644 test cases/common/99 subproject subdir/subprojects/sub/lib/sub.h delete mode 100644 test cases/common/99 subproject subdir/subprojects/sub/meson.build delete mode 100644 test cases/common/99 subproject subdir/subprojects/sub_implicit.wrap delete mode 100644 test cases/common/99 subproject subdir/subprojects/sub_implicit/meson.build delete mode 100644 test cases/common/99 subproject subdir/subprojects/sub_implicit/subprojects/subsub/foo.h delete mode 100644 test cases/common/99 subproject subdir/subprojects/sub_implicit/subprojects/subsub/meson.build delete mode 100644 test cases/common/99 subproject subdir/subprojects/sub_implicit/subprojects/subsub/subprojects/packagefiles/subsubsub-1.0.zip delete mode 100644 test cases/common/99 subproject subdir/subprojects/sub_implicit/subprojects/subsub/subprojects/subsubsub.wrap delete mode 100644 test cases/common/99 subproject subdir/subprojects/sub_novar/meson.build delete mode 100644 test cases/common/99 subproject subdir/test.json create mode 100644 test cases/unit/63 cmake_prefix_path/meson.build create mode 100644 test cases/unit/63 cmake_prefix_path/prefix/lib/cmake/mesontest/mesontest-config.cmake create mode 100644 test cases/unit/64 cmake parser/meson.build create mode 100644 test cases/unit/64 cmake parser/prefix/lib/cmake/mesontest/mesontest-config.cmake delete mode 100644 test cases/unit/64 cmake_prefix_path/meson.build delete mode 100644 test cases/unit/64 cmake_prefix_path/prefix/lib/cmake/mesontest/mesontest-config.cmake create mode 100644 test cases/unit/65 alias target/main.c create mode 100644 test cases/unit/65 alias target/meson.build delete mode 100644 test cases/unit/65 cmake parser/meson.build delete mode 100644 test cases/unit/65 cmake parser/prefix/lib/cmake/mesontest/mesontest-config.cmake delete mode 100644 test cases/unit/66 alias target/main.c delete mode 100644 test cases/unit/66 alias target/meson.build create mode 100644 test cases/unit/66 static archive stripping/app/appA.c create mode 100644 test cases/unit/66 static archive stripping/app/appB.c create mode 100644 test cases/unit/66 static archive stripping/app/meson.build create mode 100644 test cases/unit/66 static archive stripping/lib/libA.c create mode 100644 test cases/unit/66 static archive stripping/lib/libA.h create mode 100644 test cases/unit/66 static archive stripping/lib/libB.c create mode 100644 test cases/unit/66 static archive stripping/lib/libB.h create mode 100644 test cases/unit/66 static archive stripping/lib/meson.build delete mode 100644 test cases/unit/67 static archive stripping/app/appA.c delete mode 100644 test cases/unit/67 static archive stripping/app/appB.c delete mode 100644 test cases/unit/67 static archive stripping/app/meson.build delete mode 100644 test cases/unit/67 static archive stripping/lib/libA.c delete mode 100644 test cases/unit/67 static archive stripping/lib/libA.h delete mode 100644 test cases/unit/67 static archive stripping/lib/libB.c delete mode 100644 test cases/unit/67 static archive stripping/lib/libB.h delete mode 100644 test cases/unit/67 static archive stripping/lib/meson.build create mode 100644 test cases/unit/67 static link/lib/func1.c create mode 100644 test cases/unit/67 static link/lib/func10.c create mode 100644 test cases/unit/67 static link/lib/func11.c create mode 100644 test cases/unit/67 static link/lib/func12.c create mode 100644 test cases/unit/67 static link/lib/func14.c create mode 100644 test cases/unit/67 static link/lib/func15.c create mode 100644 test cases/unit/67 static link/lib/func16.c create mode 100644 test cases/unit/67 static link/lib/func17.c create mode 100644 test cases/unit/67 static link/lib/func18.c create mode 100644 test cases/unit/67 static link/lib/func19.c create mode 100644 test cases/unit/67 static link/lib/func2.c create mode 100644 test cases/unit/67 static link/lib/func3.c create mode 100644 test cases/unit/67 static link/lib/func4.c create mode 100644 test cases/unit/67 static link/lib/func5.c create mode 100644 test cases/unit/67 static link/lib/func6.c create mode 100644 test cases/unit/67 static link/lib/func7.c create mode 100644 test cases/unit/67 static link/lib/func8.c create mode 100644 test cases/unit/67 static link/lib/func9.c create mode 100644 test cases/unit/67 static link/lib/meson.build create mode 100644 test cases/unit/67 static link/meson.build create mode 100644 test cases/unit/67 static link/test1.c create mode 100644 test cases/unit/67 static link/test2.c create mode 100644 test cases/unit/67 static link/test3.c create mode 100644 test cases/unit/67 static link/test4.c create mode 100644 test cases/unit/67 static link/test5.c delete mode 100644 test cases/unit/68 static link/lib/func1.c delete mode 100644 test cases/unit/68 static link/lib/func10.c delete mode 100644 test cases/unit/68 static link/lib/func11.c delete mode 100644 test cases/unit/68 static link/lib/func12.c delete mode 100644 test cases/unit/68 static link/lib/func14.c delete mode 100644 test cases/unit/68 static link/lib/func15.c delete mode 100644 test cases/unit/68 static link/lib/func16.c delete mode 100644 test cases/unit/68 static link/lib/func17.c delete mode 100644 test cases/unit/68 static link/lib/func18.c delete mode 100644 test cases/unit/68 static link/lib/func19.c delete mode 100644 test cases/unit/68 static link/lib/func2.c delete mode 100644 test cases/unit/68 static link/lib/func3.c delete mode 100644 test cases/unit/68 static link/lib/func4.c delete mode 100644 test cases/unit/68 static link/lib/func5.c delete mode 100644 test cases/unit/68 static link/lib/func6.c delete mode 100644 test cases/unit/68 static link/lib/func7.c delete mode 100644 test cases/unit/68 static link/lib/func8.c delete mode 100644 test cases/unit/68 static link/lib/func9.c delete mode 100644 test cases/unit/68 static link/lib/meson.build delete mode 100644 test cases/unit/68 static link/meson.build delete mode 100644 test cases/unit/68 static link/test1.c delete mode 100644 test cases/unit/68 static link/test2.c delete mode 100644 test cases/unit/68 static link/test3.c delete mode 100644 test cases/unit/68 static link/test4.c delete mode 100644 test cases/unit/68 static link/test5.c create mode 100644 test cases/unit/68 test env value/meson.build create mode 100755 test cases/unit/68 test env value/test.py create mode 100644 test cases/unit/69 clang-tidy/.clang-tidy create mode 100644 test cases/unit/69 clang-tidy/cttest.cpp create mode 100644 test cases/unit/69 clang-tidy/dummydir.h/dummy.dat create mode 100644 test cases/unit/69 clang-tidy/meson.build delete mode 100644 test cases/unit/69 test env value/meson.build delete mode 100755 test cases/unit/69 test env value/test.py delete mode 100644 test cases/unit/70 clang-tidy/.clang-tidy delete mode 100644 test cases/unit/70 clang-tidy/cttest.cpp delete mode 100644 test cases/unit/70 clang-tidy/dummydir.h/dummy.dat delete mode 100644 test cases/unit/70 clang-tidy/meson.build create mode 100644 test cases/unit/70 cross/crossfile.in create mode 100644 test cases/unit/70 cross/meson.build create mode 100644 test cases/unit/70 cross/meson_options.txt create mode 100755 test cases/unit/71 cross test passed/exewrapper.py create mode 100644 test cases/unit/71 cross test passed/meson.build create mode 100644 test cases/unit/71 cross test passed/meson_options.txt create mode 100644 test cases/unit/71 cross test passed/script.py create mode 100644 test cases/unit/71 cross test passed/src/main.c delete mode 100644 test cases/unit/71 cross/crossfile.in delete mode 100644 test cases/unit/71 cross/meson.build delete mode 100644 test cases/unit/71 cross/meson_options.txt delete mode 100755 test cases/unit/72 cross test passed/exewrapper.py delete mode 100644 test cases/unit/72 cross test passed/meson.build delete mode 100644 test cases/unit/72 cross test passed/meson_options.txt delete mode 100644 test cases/unit/72 cross test passed/script.py delete mode 100644 test cases/unit/72 cross test passed/src/main.c create mode 100644 test cases/unit/72 summary/meson.build create mode 100644 test cases/unit/72 summary/meson_options.txt create mode 100644 test cases/unit/72 summary/subprojects/sub/meson.build create mode 100644 test cases/unit/72 summary/subprojects/sub2/meson.build delete mode 100644 test cases/unit/73 summary/meson.build delete mode 100644 test cases/unit/73 summary/meson_options.txt delete mode 100644 test cases/unit/73 summary/subprojects/sub/meson.build delete mode 100644 test cases/unit/73 summary/subprojects/sub2/meson.build create mode 100644 test cases/unit/73 wrap file url/meson.build create mode 100644 test cases/unit/73 wrap file url/subprojects/foo-patch.tar.xz create mode 100644 test cases/unit/73 wrap file url/subprojects/foo.tar.xz create mode 100644 test cases/unit/74 dep files/foo.c create mode 100644 test cases/unit/74 dep files/meson.build delete mode 100644 test cases/unit/74 wrap file url/meson.build delete mode 100644 test cases/unit/74 wrap file url/subprojects/foo-patch.tar.xz delete mode 100644 test cases/unit/74 wrap file url/subprojects/foo.tar.xz delete mode 100644 test cases/unit/75 dep files/foo.c delete mode 100644 test cases/unit/75 dep files/meson.build create mode 100644 test cases/unit/75 pkgconfig prefixes/client/client.c create mode 100644 test cases/unit/75 pkgconfig prefixes/client/meson.build create mode 100644 test cases/unit/75 pkgconfig prefixes/val1/meson.build create mode 100644 test cases/unit/75 pkgconfig prefixes/val1/val1.c create mode 100644 test cases/unit/75 pkgconfig prefixes/val1/val1.h create mode 100644 test cases/unit/75 pkgconfig prefixes/val2/meson.build create mode 100644 test cases/unit/75 pkgconfig prefixes/val2/val2.c create mode 100644 test cases/unit/75 pkgconfig prefixes/val2/val2.h delete mode 100644 test cases/unit/76 pkgconfig prefixes/client/client.c delete mode 100644 test cases/unit/76 pkgconfig prefixes/client/meson.build delete mode 100644 test cases/unit/76 pkgconfig prefixes/val1/meson.build delete mode 100644 test cases/unit/76 pkgconfig prefixes/val1/val1.c delete mode 100644 test cases/unit/76 pkgconfig prefixes/val1/val1.h delete mode 100644 test cases/unit/76 pkgconfig prefixes/val2/meson.build delete mode 100644 test cases/unit/76 pkgconfig prefixes/val2/val2.c delete mode 100644 test cases/unit/76 pkgconfig prefixes/val2/val2.h create mode 100644 test cases/unit/76 subdir libdir/meson.build create mode 100644 test cases/unit/76 subdir libdir/subprojects/flub/meson.build create mode 100644 test cases/unit/77 as link whole/bar.c create mode 100644 test cases/unit/77 as link whole/foo.c create mode 100644 test cases/unit/77 as link whole/meson.build delete mode 100644 test cases/unit/77 subdir libdir/meson.build delete mode 100644 test cases/unit/77 subdir libdir/subprojects/flub/meson.build delete mode 100644 test cases/unit/78 as link whole/bar.c delete mode 100644 test cases/unit/78 as link whole/foo.c delete mode 100644 test cases/unit/78 as link whole/meson.build create mode 100644 test cases/unit/78 nostdlib/meson.build create mode 100644 test cases/unit/78 nostdlib/prog.c create mode 100644 test cases/unit/78 nostdlib/subprojects/mylibc/libc.c create mode 100644 test cases/unit/78 nostdlib/subprojects/mylibc/meson.build create mode 100644 test cases/unit/78 nostdlib/subprojects/mylibc/stdio.h create mode 100644 test cases/unit/78 nostdlib/subprojects/mylibc/stubstart.s delete mode 100644 test cases/unit/79 nostdlib/meson.build delete mode 100644 test cases/unit/79 nostdlib/prog.c delete mode 100644 test cases/unit/79 nostdlib/subprojects/mylibc/libc.c delete mode 100644 test cases/unit/79 nostdlib/subprojects/mylibc/meson.build delete mode 100644 test cases/unit/79 nostdlib/subprojects/mylibc/stdio.h delete mode 100644 test cases/unit/79 nostdlib/subprojects/mylibc/stubstart.s create mode 100644 test cases/unit/79 user options for subproject/.gitignore create mode 100644 test cases/unit/79 user options for subproject/75 user options for subproject/.gitignore create mode 100644 test cases/unit/79 user options for subproject/75 user options for subproject/meson.build create mode 100644 test cases/unit/80 global-rpath/meson.build create mode 100644 test cases/unit/80 global-rpath/rpathified.cpp create mode 100644 test cases/unit/80 global-rpath/yonder/meson.build create mode 100644 test cases/unit/80 global-rpath/yonder/yonder.cpp create mode 100644 test cases/unit/80 global-rpath/yonder/yonder.h delete mode 100644 test cases/unit/80 user options for subproject/.gitignore delete mode 100644 test cases/unit/80 user options for subproject/75 user options for subproject/.gitignore delete mode 100644 test cases/unit/80 user options for subproject/75 user options for subproject/meson.build delete mode 100644 test cases/unit/81 global-rpath/meson.build delete mode 100644 test cases/unit/81 global-rpath/rpathified.cpp delete mode 100644 test cases/unit/81 global-rpath/yonder/meson.build delete mode 100644 test cases/unit/81 global-rpath/yonder/yonder.cpp delete mode 100644 test cases/unit/81 global-rpath/yonder/yonder.h create mode 100644 test cases/unit/81 wrap-git/meson.build create mode 100644 test cases/unit/81 wrap-git/subprojects/packagefiles/wrap_git_builddef/meson.build create mode 100644 test cases/unit/81 wrap-git/subprojects/wrap_git_upstream/main.c create mode 100644 test cases/unit/82 meson version compare/meson.build delete mode 100644 test cases/unit/82 wrap-git/meson.build delete mode 100644 test cases/unit/82 wrap-git/subprojects/packagefiles/wrap_git_builddef/meson.build delete mode 100644 test cases/unit/82 wrap-git/subprojects/wrap_git_upstream/main.c create mode 100644 test cases/unit/83 cross only introspect/meson.build delete mode 100644 test cases/unit/83 meson version compare/meson.build create mode 100644 test cases/unit/84 change option choices/meson.build create mode 100644 test cases/unit/84 change option choices/meson_options.1.txt create mode 100644 test cases/unit/84 change option choices/meson_options.2.txt delete mode 100644 test cases/unit/84 cross only introspect/meson.build delete mode 100644 test cases/unit/85 change option choices/meson.build delete mode 100644 test cases/unit/85 change option choices/meson_options.1.txt delete mode 100644 test cases/unit/85 change option choices/meson_options.2.txt create mode 100644 test cases/unit/85 nested subproject regenerate depends/main.c create mode 100644 test cases/unit/85 nested subproject regenerate depends/meson.build create mode 100644 test cases/unit/85 nested subproject regenerate depends/subprojects/sub1/meson.build create mode 100644 test cases/unit/85 nested subproject regenerate depends/subprojects/sub2/CMakeLists.txt create mode 100644 test cases/unit/86 cpp modules/main.cpp create mode 100644 test cases/unit/86 cpp modules/meson.build create mode 100644 test cases/unit/86 cpp modules/src0.ixx create mode 100644 test cases/unit/86 cpp modules/src1.ixx create mode 100644 test cases/unit/86 cpp modules/src2.ixx create mode 100644 test cases/unit/86 cpp modules/src3.ixx create mode 100644 test cases/unit/86 cpp modules/src4.ixx create mode 100644 test cases/unit/86 cpp modules/src5.ixx create mode 100644 test cases/unit/86 cpp modules/src6.ixx create mode 100644 test cases/unit/86 cpp modules/src7.ixx create mode 100644 test cases/unit/86 cpp modules/src8.ixx create mode 100644 test cases/unit/86 cpp modules/src9.ixx delete mode 100644 test cases/unit/86 nested subproject regenerate depends/main.c delete mode 100644 test cases/unit/86 nested subproject regenerate depends/meson.build delete mode 100644 test cases/unit/86 nested subproject regenerate depends/subprojects/sub1/meson.build delete mode 100644 test cases/unit/86 nested subproject regenerate depends/subprojects/sub2/CMakeLists.txt delete mode 100644 test cases/unit/87 cpp modules/main.cpp delete mode 100644 test cases/unit/87 cpp modules/meson.build delete mode 100644 test cases/unit/87 cpp modules/src0.ixx delete mode 100644 test cases/unit/87 cpp modules/src1.ixx delete mode 100644 test cases/unit/87 cpp modules/src2.ixx delete mode 100644 test cases/unit/87 cpp modules/src3.ixx delete mode 100644 test cases/unit/87 cpp modules/src4.ixx delete mode 100644 test cases/unit/87 cpp modules/src5.ixx delete mode 100644 test cases/unit/87 cpp modules/src6.ixx delete mode 100644 test cases/unit/87 cpp modules/src7.ixx delete mode 100644 test cases/unit/87 cpp modules/src8.ixx delete mode 100644 test cases/unit/87 cpp modules/src9.ixx create mode 100644 test cases/unit/87 prelinking/file1.c create mode 100644 test cases/unit/87 prelinking/file2.c create mode 100644 test cases/unit/87 prelinking/file3.c create mode 100644 test cases/unit/87 prelinking/file4.c create mode 100644 test cases/unit/87 prelinking/main.c create mode 100644 test cases/unit/87 prelinking/meson.build create mode 100644 test cases/unit/87 prelinking/private_header.h create mode 100644 test cases/unit/87 prelinking/public_header.h delete mode 100644 test cases/unit/88 prelinking/file1.c delete mode 100644 test cases/unit/88 prelinking/file2.c delete mode 100644 test cases/unit/88 prelinking/file3.c delete mode 100644 test cases/unit/88 prelinking/file4.c delete mode 100644 test cases/unit/88 prelinking/main.c delete mode 100644 test cases/unit/88 prelinking/meson.build delete mode 100644 test cases/unit/88 prelinking/private_header.h delete mode 100644 test cases/unit/88 prelinking/public_header.h create mode 100644 test cases/unit/88 run native test/main.c create mode 100644 test cases/unit/88 run native test/meson.build create mode 100644 test cases/unit/89 multiple envvars/meson.build create mode 100644 test cases/unit/89 multiple envvars/prog.c create mode 100644 test cases/unit/89 multiple envvars/prog.cpp delete mode 100644 test cases/unit/89 run native test/main.c delete mode 100644 test cases/unit/89 run native test/meson.build delete mode 100644 test cases/unit/90 multiple envvars/meson.build delete mode 100644 test cases/unit/90 multiple envvars/prog.c delete mode 100644 test cases/unit/90 multiple envvars/prog.cpp delete mode 100644 test cases/unit/91 install skip subprojects/foo.c delete mode 100644 test cases/unit/91 install skip subprojects/foo.dat delete mode 100644 test cases/unit/91 install skip subprojects/foo.h delete mode 100644 test cases/unit/91 install skip subprojects/foo/foofile delete mode 100644 test cases/unit/91 install skip subprojects/meson.build delete mode 100644 test cases/unit/91 install skip subprojects/subprojects/bar/bar.c delete mode 100644 test cases/unit/91 install skip subprojects/subprojects/bar/bar.dat delete mode 100644 test cases/unit/91 install skip subprojects/subprojects/bar/bar.h delete mode 100644 test cases/unit/91 install skip subprojects/subprojects/bar/bar/barfile delete mode 100644 test cases/unit/91 install skip subprojects/subprojects/bar/meson.build create mode 100644 test cases/unit/92 install skip subprojects/foo.c create mode 100644 test cases/unit/92 install skip subprojects/foo.dat create mode 100644 test cases/unit/92 install skip subprojects/foo.h create mode 100644 test cases/unit/92 install skip subprojects/foo/foofile create mode 100644 test cases/unit/92 install skip subprojects/meson.build create mode 100644 test cases/unit/92 install skip subprojects/subprojects/bar/bar.c create mode 100644 test cases/unit/92 install skip subprojects/subprojects/bar/bar.dat create mode 100644 test cases/unit/92 install skip subprojects/subprojects/bar/bar.h create mode 100644 test cases/unit/92 install skip subprojects/subprojects/bar/bar/barfile create mode 100644 test cases/unit/92 install skip subprojects/subprojects/bar/meson.build delete mode 100644 test cases/unit/92 new subproject in configured project/meson.build delete mode 100644 test cases/unit/92 new subproject in configured project/meson_options.txt delete mode 100644 test cases/unit/92 new subproject in configured project/subprojects/sub/foo.c delete mode 100644 test cases/unit/92 new subproject in configured project/subprojects/sub/meson.build delete mode 100644 test cases/unit/93 clangformat/.clang-format delete mode 100644 test cases/unit/93 clangformat/.clang-format-ignore delete mode 100644 test cases/unit/93 clangformat/.clang-format-include delete mode 100644 test cases/unit/93 clangformat/meson.build delete mode 100644 test cases/unit/93 clangformat/not-included/badformat.cpp delete mode 100644 test cases/unit/93 clangformat/src/badformat.c delete mode 100644 test cases/unit/93 clangformat/src/badformat.cpp create mode 100644 test cases/unit/93 new subproject in configured project/meson.build create mode 100644 test cases/unit/93 new subproject in configured project/meson_options.txt create mode 100644 test cases/unit/93 new subproject in configured project/subprojects/sub/foo.c create mode 100644 test cases/unit/93 new subproject in configured project/subprojects/sub/meson.build create mode 100644 test cases/unit/94 clangformat/.clang-format create mode 100644 test cases/unit/94 clangformat/.clang-format-ignore create mode 100644 test cases/unit/94 clangformat/.clang-format-include create mode 100644 test cases/unit/94 clangformat/meson.build create mode 100644 test cases/unit/94 clangformat/not-included/badformat.cpp create mode 100644 test cases/unit/94 clangformat/src/badformat.c create mode 100644 test cases/unit/94 clangformat/src/badformat.cpp delete mode 100644 test cases/unit/94 custominc/easytogrepfor/genh.py delete mode 100644 test cases/unit/94 custominc/easytogrepfor/meson.build delete mode 100644 test cases/unit/94 custominc/helper.c delete mode 100644 test cases/unit/94 custominc/meson.build delete mode 100644 test cases/unit/94 custominc/prog.c delete mode 100644 test cases/unit/94 custominc/prog2.c create mode 100644 test cases/unit/95 custominc/easytogrepfor/genh.py create mode 100644 test cases/unit/95 custominc/easytogrepfor/meson.build create mode 100644 test cases/unit/95 custominc/helper.c create mode 100644 test cases/unit/95 custominc/meson.build create mode 100644 test cases/unit/95 custominc/prog.c create mode 100644 test cases/unit/95 custominc/prog2.c diff --git a/run_unittests.py b/run_unittests.py index 3faa20c..c52d13c 100755 --- a/run_unittests.py +++ b/run_unittests.py @@ -2098,7 +2098,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, '88 default options') + testdir = os.path.join(self.common_test_dir, '87 default options') self.init(testdir, default_args=False, inprocess=True) opts = self.introspect('--buildoptions') for opt in opts: @@ -2179,7 +2179,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, '88 default options') + testdir = os.path.join(self.common_test_dir, '87 default options') # on Windows, /someabs is *not* an absolute path prefix = 'x:/someabs' if is_windows() else '/someabs' libdir = 'libdir' @@ -2277,7 +2277,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, '164 default options prefix dependent defaults') + testdir = os.path.join(self.common_test_dir, '163 default options prefix dependent defaults') expected = { '': {'prefix': '/usr', @@ -2380,7 +2380,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, '52 run target') + testdir = os.path.join(self.common_test_dir, '51 run target') self.init(testdir) self.run_target('check_exists') self.run_target('check-env') @@ -2391,7 +2391,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, '52 run target') + testdir = os.path.join(self.common_test_dir, '51 run target') self.init(testdir) self.run_target('textprinter') @@ -2415,7 +2415,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, '60 install subdir') + testdir = os.path.join(self.common_test_dir, '59 install subdir') self.init(testdir) intro = self.introspect('--installed') expected = { @@ -2449,7 +2449,7 @@ class AllPlatformTests(BasePlatformTests): ''' if self.backend is not Backend.ninja: raise unittest.SkipTest(f'{self.backend.name!r} backend can\'t install files') - testdir = os.path.join(self.common_test_dir, '141 custom target multiple outputs') + testdir = os.path.join(self.common_test_dir, '140 custom target multiple outputs') self.init(testdir) intro = self.introspect('--targets') if intro[0]['type'] == 'executable': @@ -2465,7 +2465,7 @@ class AllPlatformTests(BasePlatformTests): Specifically checks that the log file only contains one entry per file/directory. https://github.com/mesonbuild/meson/issues/4499 ''' - testdir = os.path.join(self.common_test_dir, '60 install subdir') + testdir = os.path.join(self.common_test_dir, '59 install subdir') self.init(testdir) self.install() installpath = Path(self.installdir) @@ -2522,7 +2522,7 @@ class AllPlatformTests(BasePlatformTests): self.init(testdir, extra_args=['--force-fallback-for=something']) def test_nopromote(self): - testdir = os.path.join(self.common_test_dir, '99 subproject subdir') + testdir = os.path.join(self.common_test_dir, '98 subproject subdir') with self.assertRaises(subprocess.CalledProcessError) as cm: self.init(testdir, extra_args=['--wrap-mode=nopromote']) self.assertIn('Dependency "subsub" not found', cm.exception.stdout) @@ -2534,7 +2534,7 @@ class AllPlatformTests(BasePlatformTests): self.run_tests() def test_testrepeat(self): - testdir = os.path.join(self.common_test_dir, '207 tap tests') + testdir = os.path.join(self.common_test_dir, '206 tap tests') self.init(testdir) self.build() self._run(self.mtest_command + ['--repeat=2']) @@ -2694,7 +2694,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, '130 build by default') + testdir = os.path.join(self.common_test_dir, '129 build by default') self.init(testdir) self.build() genfile1 = os.path.join(self.builddir, 'generated1.dat') @@ -2714,7 +2714,7 @@ class AllPlatformTests(BasePlatformTests): if mesonbuild.environment.detect_msys2_arch() and ('MESON_RSP_THRESHOLD' in os.environ): raise unittest.SkipTest('Test does not yet support gcc rsp files on msys2') - testdir = os.path.join(self.common_test_dir, '131 include order') + testdir = os.path.join(self.common_test_dir, '130 include order') self.init(testdir) execmd = fxecmd = None for cmd in self.get_compdb(): @@ -2901,7 +2901,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, '134 c cpp and asm') + testdir = os.path.join(self.common_test_dir, '133 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': @@ -2971,7 +2971,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, '133 get define') + testdir = os.path.join(self.common_test_dir, '132 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 @@ -2986,7 +2986,7 @@ class AllPlatformTests(BasePlatformTests): self.init(testdir, extra_args=[f'-D{define}={value}'], override_envvars=env) def test_custom_target_exe_data_deterministic(self): - testdir = os.path.join(self.common_test_dir, '110 custom target capture') + testdir = os.path.join(self.common_test_dir, '109 custom target capture') self.init(testdir) meson_exe_dat1 = glob(os.path.join(self.privatedir, 'meson_exe*.dat')) self.wipe() @@ -3017,7 +3017,7 @@ class AllPlatformTests(BasePlatformTests): changes to unused files (as determined by the dependency file) in the input files list. ''' - testdir = os.path.join(self.common_test_dir, '20 header in file list') + testdir = os.path.join(self.common_test_dir, '19 header in file list') self.init(testdir) self.build() # Immediately rebuilding should not do anything @@ -3032,7 +3032,7 @@ class AllPlatformTests(BasePlatformTests): ExternalProgram, and any File objects on the command-line cause a rebuild. ''' - testdir = os.path.join(self.common_test_dir, '58 custom header generator') + testdir = os.path.join(self.common_test_dir, '57 custom header generator') self.init(testdir) self.build() # Immediately rebuilding should not do anything @@ -3047,7 +3047,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, '91 gen extra') + testdir = os.path.join(self.common_test_dir, '90 gen extra') self.init(testdir) self.build() # Immediately rebuilding should not do anything @@ -3322,7 +3322,7 @@ class AllPlatformTests(BasePlatformTests): ''' 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, '40 library chain') + testdir = os.path.join(self.common_test_dir, '39 library chain') self.init(testdir) self.build() for each in ('prog', 'subdir/liblib1.so', ): @@ -3358,10 +3358,10 @@ class AllPlatformTests(BasePlatformTests): def test_all_forbidden_targets_tested(self): ''' - Test that all forbidden targets are tested in the '151 reserved targets' + Test that all forbidden targets are tested in the '150 reserved targets' test. Needs to be a unit test because it accesses Meson internals. ''' - testdir = os.path.join(self.common_test_dir, '151 reserved targets') + testdir = os.path.join(self.common_test_dir, '150 reserved targets') targets = mesonbuild.coredata.FORBIDDEN_TARGET_NAMES # We don't actually define a target with this name targets.pop('build.ninja') @@ -3534,7 +3534,7 @@ class AllPlatformTests(BasePlatformTests): @skipIfNoPkgconfig @mock.patch.dict(os.environ) def test_pkgconfig_gen_escaping(self): - testdir = os.path.join(self.common_test_dir, '45 pkgconfig-gen') + testdir = os.path.join(self.common_test_dir, '44 pkgconfig-gen') prefix = '/usr/with spaces' libdir = 'lib' self.init(testdir, extra_args=['--prefix=' + prefix, @@ -3638,7 +3638,7 @@ class AllPlatformTests(BasePlatformTests): self.assertTrue(found, "Array option not found in introspect data.") def test_free_stringarray_setting(self): - testdir = os.path.join(self.common_test_dir, '41 options') + testdir = os.path.join(self.common_test_dir, '40 options') self.init(testdir) self.opt_has('free_array_opt', []) self.setconf('-Dfree_array_opt=foo,bar', will_build=False) @@ -3657,7 +3657,7 @@ class AllPlatformTests(BasePlatformTests): def test_options_with_choices_changing(self) -> None: """Detect when options like arrays or combos have their choices change.""" - testdir = Path(os.path.join(self.unit_test_dir, '85 change option choices')) + testdir = Path(os.path.join(self.unit_test_dir, '84 change option choices')) options1 = str(testdir / 'meson_options.1.txt') options2 = str(testdir / 'meson_options.2.txt') @@ -3860,7 +3860,7 @@ class AllPlatformTests(BasePlatformTests): Test that identical targets in different subprojects do not collide if layout is flat. ''' - testdir = os.path.join(self.common_test_dir, '173 identical target name in subproject flat layout') + testdir = os.path.join(self.common_test_dir, '172 identical target name in subproject flat layout') self.init(testdir, extra_args=['--layout=flat']) self.build() @@ -3869,7 +3869,7 @@ class AllPlatformTests(BasePlatformTests): Test that identical targets in different subdirs do not collide if layout is flat. ''' - testdir = os.path.join(self.common_test_dir, '182 same target name flat layout') + testdir = os.path.join(self.common_test_dir, '181 same target name flat layout') self.init(testdir, extra_args=['--layout=flat']) self.build() @@ -4167,7 +4167,7 @@ class AllPlatformTests(BasePlatformTests): pass def test_warning_level_0(self): - testdir = os.path.join(self.common_test_dir, '208 warning level 0') + testdir = os.path.join(self.common_test_dir, '207 warning level 0') # Verify default values when passing no args self.init(testdir) @@ -4374,7 +4374,7 @@ class AllPlatformTests(BasePlatformTests): self.run_tests() def test_wipe_from_builddir(self): - testdir = os.path.join(self.common_test_dir, '158 custom target subdir depend files') + testdir = os.path.join(self.common_test_dir, '157 custom target subdir depend files') self.init(testdir) self.__reconfigure() @@ -4409,21 +4409,21 @@ class AllPlatformTests(BasePlatformTests): self.assertEqual('81d46d1@@target2-id@other', target_id) def test_introspect_projectinfo_without_configured_build(self): - testfile = os.path.join(self.common_test_dir, '34 run program', 'meson.build') + testfile = os.path.join(self.common_test_dir, '33 run program', 'meson.build') res = self.introspect_directory(testfile, '--projectinfo') self.assertEqual(set(res['buildsystem_files']), {'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, '41 options', 'meson.build') + testfile = os.path.join(self.common_test_dir, '40 options', 'meson.build') res = self.introspect_directory(testfile, '--projectinfo') self.assertEqual(set(res['buildsystem_files']), {'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, '44 subproject options', 'meson.build') + testfile = os.path.join(self.common_test_dir, '43 subproject options', 'meson.build') res = self.introspect_directory(testfile, '--projectinfo') self.assertEqual(set(res['buildsystem_files']), {'meson_options.txt', 'meson.build'}) self.assertEqual(res['version'], 'undefined') @@ -4436,7 +4436,7 @@ class AllPlatformTests(BasePlatformTests): self.assertEqual(res['subprojects'][0]['descriptive_name'], 'subproject') def test_introspect_projectinfo_subprojects(self): - testdir = os.path.join(self.common_test_dir, '99 subproject subdir') + testdir = os.path.join(self.common_test_dir, '98 subproject subdir') self.init(testdir) res = self.introspect('--projectinfo') expected = { @@ -4475,7 +4475,7 @@ class AllPlatformTests(BasePlatformTests): self.assertDictEqual(expected, res) def test_introspection_target_subproject(self): - testdir = os.path.join(self.common_test_dir, '43 subproject') + testdir = os.path.join(self.common_test_dir, '42 subproject') self.init(testdir) res = self.introspect('--targets') @@ -4490,14 +4490,14 @@ class AllPlatformTests(BasePlatformTests): self.assertEqual(entry['subproject'], expected[name]) def test_introspect_projectinfo_subproject_dir(self): - testdir = os.path.join(self.common_test_dir, '76 custom subproject dir') + testdir = os.path.join(self.common_test_dir, '75 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, '76 custom subproject dir', 'meson.build') + testfile = os.path.join(self.common_test_dir, '75 custom subproject dir', 'meson.build') res = self.introspect_directory(testfile, '--projectinfo') self.assertEqual(res['subproject_dir'], 'custom_subproject_dir') @@ -4538,7 +4538,7 @@ class AllPlatformTests(BasePlatformTests): raise unittest.SkipTest('Clang-tidy breaks when ccache is used and "c++" not in path.') if is_osx(): raise unittest.SkipTest('Apple ships a broken clang-tidy that chokes on -pipe.') - testdir = os.path.join(self.unit_test_dir, '70 clang-tidy') + testdir = os.path.join(self.unit_test_dir, '69 clang-tidy') dummydir = os.path.join(testdir, 'dummydir.h') self.init(testdir, override_envvars={'CXX': 'c++'}) out = self.run_target('clang-tidy') @@ -4546,7 +4546,7 @@ class AllPlatformTests(BasePlatformTests): self.assertNotIn(dummydir, out) def test_identity_cross(self): - testdir = os.path.join(self.unit_test_dir, '71 cross') + testdir = os.path.join(self.unit_test_dir, '70 cross') # Do a build to generate a cross file where the host is this target self.init(testdir, extra_args=['-Dgenerate=true']) self.meson_cross_file = os.path.join(self.builddir, "crossfile") @@ -4570,7 +4570,7 @@ class AllPlatformTests(BasePlatformTests): self._run(self.mconf_command + [testdir]) def test_introspect_buildoptions_cross_only(self): - testdir = os.path.join(self.unit_test_dir, '84 cross only introspect') + testdir = os.path.join(self.unit_test_dir, '83 cross only introspect') testfile = os.path.join(testdir, 'meson.build') res = self.introspect_directory(testfile, ['--buildoptions'] + self.meson_args) optnames = [o['name'] for o in res] @@ -5022,19 +5022,19 @@ class AllPlatformTests(BasePlatformTests): @skip_if_no_cmake def test_cmake_prefix_path(self): - testdir = os.path.join(self.unit_test_dir, '64 cmake_prefix_path') + testdir = os.path.join(self.unit_test_dir, '63 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, '65 cmake parser') + testdir = os.path.join(self.unit_test_dir, '64 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(f'Skipping alias_target test with {self.backend.name} backend') - testdir = os.path.join(self.unit_test_dir, '66 alias target') + testdir = os.path.join(self.unit_test_dir, '65 alias target') self.init(testdir) self.build() self.assertPathDoesNotExist(os.path.join(self.builddir, 'prog' + exe_suffix)) @@ -5049,7 +5049,7 @@ class AllPlatformTests(BasePlatformTests): self._run(self.mconf_command + [self.builddir]) def test_summary(self): - testdir = os.path.join(self.unit_test_dir, '73 summary') + testdir = os.path.join(self.unit_test_dir, '72 summary') out = self.init(testdir) expected = textwrap.dedent(r''' Some Subproject 2.0 @@ -5149,7 +5149,7 @@ class AllPlatformTests(BasePlatformTests): # Target specified in a project with non unique names - testdir = os.path.join(self.common_test_dir, '186 same target name') + testdir = os.path.join(self.common_test_dir, '185 same target name') self.init(testdir, extra_args=['--wipe']) self._run([*self.meson_command, 'compile', '-C', self.builddir, './foo']) self.assertPathExists(os.path.join(self.builddir, get_static_lib_name('foo'))) @@ -5158,7 +5158,7 @@ class AllPlatformTests(BasePlatformTests): # run_target - testdir = os.path.join(self.common_test_dir, '52 run target') + testdir = os.path.join(self.common_test_dir, '51 run target') self.init(testdir, extra_args=['--wipe']) out = self._run([*self.meson_command, 'compile', '-C', self.builddir, 'py3hi']) self.assertIn('I am Python3.', out) @@ -5179,7 +5179,7 @@ class AllPlatformTests(BasePlatformTests): self.assertPathDoesNotExist(os.path.join(self.builddir, get_exe_name('trivialprog'))) def test_spurious_reconfigure_built_dep_file(self): - testdir = os.path.join(self.unit_test_dir, '75 dep files') + testdir = os.path.join(self.unit_test_dir, '74 dep files') # Regression test: Spurious reconfigure was happening when build # directory is inside source directory. @@ -5225,10 +5225,10 @@ class AllPlatformTests(BasePlatformTests): self.fail(e.error_log) def test_junit_valid_tap(self): - self._test_junit(os.path.join(self.common_test_dir, '207 tap tests')) + self._test_junit(os.path.join(self.common_test_dir, '206 tap tests')) def test_junit_valid_exitcode(self): - self._test_junit(os.path.join(self.common_test_dir, '42 test args')) + self._test_junit(os.path.join(self.common_test_dir, '41 test args')) def test_junit_valid_gtest(self): self._test_junit(os.path.join(self.framework_test_dir, '2 gtest')) @@ -5239,7 +5239,7 @@ class AllPlatformTests(BasePlatformTests): if self.backend is not Backend.ninja: raise unittest.SkipTest('This test reads the ninja file') - testdir = os.path.join(self.common_test_dir, '226 link language') + testdir = os.path.join(self.common_test_dir, '225 link language') self.init(testdir) build_ninja = os.path.join(self.builddir, 'build.ninja') @@ -5333,7 +5333,7 @@ class AllPlatformTests(BasePlatformTests): gcovr_exe, gcovr_new_rootdir = mesonbuild.environment.detect_gcovr() if not gcovr_exe: raise unittest.SkipTest('gcovr not found, or too old') - testdir = os.path.join(self.common_test_dir, '106 generatorcustom') + testdir = os.path.join(self.common_test_dir, '105 generatorcustom') env = get_fake_env(testdir, self.builddir, self.prefix) cc = env.detect_c_compiler(MachineChoice.HOST) if cc.get_id() == 'clang': @@ -5441,7 +5441,7 @@ class AllPlatformTests(BasePlatformTests): def test_wrap_git(self): with tempfile.TemporaryDirectory() as tmpdir: srcdir = os.path.join(tmpdir, 'src') - shutil.copytree(os.path.join(self.unit_test_dir, '82 wrap-git'), srcdir) + shutil.copytree(os.path.join(self.unit_test_dir, '81 wrap-git'), srcdir) upstream = os.path.join(srcdir, 'subprojects', 'wrap_git_upstream') upstream_uri = Path(upstream).as_uri() _git_init(upstream) @@ -5457,7 +5457,7 @@ class AllPlatformTests(BasePlatformTests): self.run_tests() def test_multi_output_custom_target_no_warning(self): - testdir = os.path.join(self.common_test_dir, '229 custom_target source') + testdir = os.path.join(self.common_test_dir, '228 custom_target source') out = self.init(testdir) self.assertNotRegex(out, 'WARNING:.*Using the first one.') @@ -5467,7 +5467,7 @@ class AllPlatformTests(BasePlatformTests): @unittest.skipUnless(is_linux() and (re.search('^i.86$|^x86$|^x64$|^x86_64$|^amd64$', platform.processor()) is not None), 'Requires ASM compiler for x86 or x86_64 platform currently only available on Linux CI runners') def test_nostdlib(self): - testdir = os.path.join(self.unit_test_dir, '79 nostdlib') + testdir = os.path.join(self.unit_test_dir, '78 nostdlib') machinefile = os.path.join(self.builddir, 'machine.txt') with open(machinefile, 'w') as f: f.write(textwrap.dedent(''' @@ -5488,7 +5488,7 @@ class AllPlatformTests(BasePlatformTests): self.build() def test_meson_version_compare(self): - testdir = os.path.join(self.unit_test_dir, '83 meson version compare') + testdir = os.path.join(self.unit_test_dir, '82 meson version compare') out = self.init(testdir) self.assertNotRegex(out, r'WARNING') @@ -5543,7 +5543,7 @@ class AllPlatformTests(BasePlatformTests): # This checks a bug where if a non-meson project is used as a third # level (or deeper) subproject it doesn't cause a rebuild if the build # files for that project are changed - testdir = os.path.join(self.unit_test_dir, '86 nested subproject regenerate depends') + testdir = os.path.join(self.unit_test_dir, '85 nested subproject regenerate depends') cmakefile = Path(testdir) / 'subprojects' / 'sub2' / 'CMakeLists.txt' self.init(testdir) self.build() @@ -5561,7 +5561,7 @@ class AllPlatformTests(BasePlatformTests): envs = {'CPPFLAGS': '-DCPPFLAG', 'CFLAGS': '-DCFLAG', 'CXXFLAGS': '-DCXXFLAG'} - srcdir = os.path.join(self.unit_test_dir, '90 multiple envvars') + srcdir = os.path.join(self.unit_test_dir, '89 multiple envvars') self.init(srcdir, override_envvars=envs) self.build() @@ -5571,7 +5571,7 @@ class AllPlatformTests(BasePlatformTests): self.init(srcdir, extra_args=['-Dbuild.b_lto=true']) def test_install_skip_subprojects(self): - testdir = os.path.join(self.unit_test_dir, '91 install skip subprojects') + testdir = os.path.join(self.unit_test_dir, '92 install skip subprojects') self.init(testdir) self.build() @@ -5617,7 +5617,7 @@ class AllPlatformTests(BasePlatformTests): check_installed_files(['--skip-subprojects', 'another'], all_expected) def test_adding_subproject_to_configure_project(self) -> None: - srcdir = os.path.join(self.unit_test_dir, '92 new subproject in configured project') + srcdir = os.path.join(self.unit_test_dir, '93 new subproject in configured project') self.init(srcdir) self.build() self.setconf('-Duse-sub=true') @@ -5640,7 +5640,7 @@ class AllPlatformTests(BasePlatformTests): if not shutil.which('clang-format'): raise unittest.SkipTest('clang-format not found') - testdir = os.path.join(self.unit_test_dir, '93 clangformat') + testdir = os.path.join(self.unit_test_dir, '94 clangformat') newdir = os.path.join(self.builddir, 'testdir') shutil.copytree(testdir, newdir) self.new_builddir() @@ -5664,7 +5664,7 @@ class AllPlatformTests(BasePlatformTests): self.build('clang-format-check') def test_custom_target_implicit_include(self): - testdir = os.path.join(self.unit_test_dir, '94 custominc') + testdir = os.path.join(self.unit_test_dir, '95 custominc') self.init(testdir) self.build() compdb = self.get_compdb() @@ -6343,7 +6343,7 @@ class WindowsTests(BasePlatformTests): raise unittest.SkipTest('C++ modules is only supported with Visual Studio.') if version_compare(os.environ['VSCMD_VER'], '<16.10.0'): raise unittest.SkipTest('C++ modules are only supported with VS 2019 Preview or newer.') - self.init(os.path.join(self.unit_test_dir, '87 cpp modules')) + self.init(os.path.join(self.unit_test_dir, '86 cpp modules')) self.build() @@ -6401,7 +6401,7 @@ class DarwinTests(BasePlatformTests): ''' Same as above, just for shared_module() ''' - testdir = os.path.join(self.common_test_dir, '149 shared module resolving symbol in executable') + testdir = os.path.join(self.common_test_dir, '148 shared module resolving symbol in executable') # Ensure that it builds even with bitcode enabled self.init(testdir, extra_args='-Db_bitcode=true') self.build() @@ -6447,7 +6447,7 @@ class DarwinTests(BasePlatformTests): self.install() def test_removing_unused_linker_args(self): - testdir = os.path.join(self.common_test_dir, '105 has arg') + testdir = os.path.join(self.common_test_dir, '104 has arg') env = {'CFLAGS': '-L/tmp -L /var/tmp -headerpad_max_install_names -Wl,-export_dynamic -framework Foundation'} self.init(testdir, override_envvars=env) @@ -6479,7 +6479,7 @@ class LinuxlikeTests(BasePlatformTests): case because we need to run `readelf` and actually check the soname. https://github.com/mesonbuild/meson/issues/785 ''' - testdir = os.path.join(self.common_test_dir, '25 library versions') + testdir = os.path.join(self.common_test_dir, '24 library versions') self.init(testdir) self.build() lib1 = os.path.join(self.builddir, 'prefixsomelib.suffix') @@ -6513,7 +6513,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, '45 pkgconfig-gen') + testdir = os.path.join(self.common_test_dir, '44 pkgconfig-gen') self.init(testdir) env = get_fake_env(testdir, self.builddir, self.prefix) kwargs = {'required': True, 'silent': True} @@ -6543,12 +6543,12 @@ class LinuxlikeTests(BasePlatformTests): ''' Test that generated pkg-config files correctly handle dependencies ''' - testdir = os.path.join(self.common_test_dir, '45 pkgconfig-gen') + testdir = os.path.join(self.common_test_dir, '44 pkgconfig-gen') self.init(testdir) privatedir1 = self.privatedir self.new_builddir() - testdir = os.path.join(self.common_test_dir, '45 pkgconfig-gen', 'dependencies') + testdir = os.path.join(self.common_test_dir, '44 pkgconfig-gen', 'dependencies') self.init(testdir, override_envvars={'PKG_CONFIG_LIBDIR': privatedir1}) privatedir2 = self.privatedir @@ -6599,7 +6599,7 @@ class LinuxlikeTests(BasePlatformTests): out = self._run(cmd + ['--libs'], override_envvars=env).strip().split() self.assertEqual(out, ['-llibmain2', '-llibinternal']) - # See common/45 pkgconfig-gen/meson.build for description of the case this test + # See common/44 pkgconfig-gen/meson.build for description of the case this test with open(os.path.join(privatedir1, 'simple2.pc')) as f: content = f.read() self.assertIn('Libs: -L${libdir} -lsimple2 -lsimple1', content) @@ -6615,7 +6615,7 @@ class LinuxlikeTests(BasePlatformTests): @mock.patch.dict(os.environ) def test_pkgconfig_uninstalled(self): - testdir = os.path.join(self.common_test_dir, '45 pkgconfig-gen') + testdir = os.path.join(self.common_test_dir, '44 pkgconfig-gen') self.init(testdir) self.build() @@ -6624,7 +6624,7 @@ class LinuxlikeTests(BasePlatformTests): os.environ['PATH'] += os.pathsep + self.builddir self.new_builddir() - testdir = os.path.join(self.common_test_dir, '45 pkgconfig-gen', 'dependencies') + testdir = os.path.join(self.common_test_dir, '44 pkgconfig-gen', 'dependencies') self.init(testdir) self.build() self.run_tests() @@ -6805,7 +6805,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, '37 has function') + testdir = os.path.join(self.common_test_dir, '36 has function') env = get_fake_env(testdir, self.builddir, self.prefix) cpp = env.detect_cpp_compiler(MachineChoice.HOST) Oflag = '-O3' @@ -6822,7 +6822,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 '37 has function' test case + # This is set in the '36 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')] @@ -6913,7 +6913,7 @@ class LinuxlikeTests(BasePlatformTests): self._test_stds_impl(testdir, cpp) def test_unity_subproj(self): - testdir = os.path.join(self.common_test_dir, '43 subproject') + testdir = os.path.join(self.common_test_dir, '42 subproject') self.init(testdir, extra_args='--unity=subprojects') pdirs = glob(os.path.join(self.builddir, 'subprojects/sublib/simpletest*.p')) self.assertEqual(len(pdirs), 1) @@ -6964,7 +6964,7 @@ class LinuxlikeTests(BasePlatformTests): self.wipe() # Test directory modes - testdir = os.path.join(self.common_test_dir, '60 install subdir') + testdir = os.path.join(self.common_test_dir, '59 install subdir') self.init(testdir) self.install() @@ -6981,7 +6981,7 @@ class LinuxlikeTests(BasePlatformTests): ''' Test that files are installed with correct permissions using install_mode. ''' - testdir = os.path.join(self.common_test_dir, '191 install_mode') + testdir = os.path.join(self.common_test_dir, '190 install_mode') self.init(testdir) self.build() self.install() @@ -7281,7 +7281,7 @@ class LinuxlikeTests(BasePlatformTests): if is_osx(): raise unittest.SkipTest('Global RPATHs via LDFLAGS not yet supported on MacOS (does anybody need it?)') - testdir = os.path.join(self.unit_test_dir, '81 global-rpath') + testdir = os.path.join(self.unit_test_dir, '80 global-rpath') oldinstalldir = self.installdir # Build and install an external library without DESTDIR. @@ -7500,7 +7500,7 @@ class LinuxlikeTests(BasePlatformTests): Check that Meson produces valid static archives with --strip enabled ''' with tempfile.TemporaryDirectory() as tempdirname: - testdirbase = os.path.join(self.unit_test_dir, '67 static archive stripping') + testdirbase = os.path.join(self.unit_test_dir, '66 static archive stripping') # build lib self.new_builddir() @@ -7668,7 +7668,7 @@ class LinuxlikeTests(BasePlatformTests): oldinstalldir = self.installdir # Build and install both external libraries without DESTDIR - val1dir = os.path.join(self.unit_test_dir, '76 pkgconfig prefixes', 'val1') + val1dir = os.path.join(self.unit_test_dir, '75 pkgconfig prefixes', 'val1') val1prefix = os.path.join(oldinstalldir, 'val1') self.prefix = val1prefix self.installdir = val1prefix @@ -7679,7 +7679,7 @@ class LinuxlikeTests(BasePlatformTests): env1 = {} env1['PKG_CONFIG_PATH'] = os.path.join(val1prefix, self.libdir, 'pkgconfig') - val2dir = os.path.join(self.unit_test_dir, '76 pkgconfig prefixes', 'val2') + val2dir = os.path.join(self.unit_test_dir, '75 pkgconfig prefixes', 'val2') val2prefix = os.path.join(oldinstalldir, 'val2') self.prefix = val2prefix self.installdir = val2prefix @@ -7691,7 +7691,7 @@ class LinuxlikeTests(BasePlatformTests): # Build, install, and run the client program env2 = {} env2['PKG_CONFIG_PATH'] = os.path.join(val2prefix, self.libdir, 'pkgconfig') - testdir = os.path.join(self.unit_test_dir, '76 pkgconfig prefixes', 'client') + testdir = os.path.join(self.unit_test_dir, '75 pkgconfig prefixes', 'client') testprefix = os.path.join(oldinstalldir, 'client') self.prefix = testprefix self.installdir = testprefix @@ -7735,13 +7735,13 @@ class LinuxlikeTests(BasePlatformTests): os.remove(os.path.join(subdir, 'invalid-symlink.txt')) def test_install_subdir_symlinks(self): - self.install_subdir_invalid_symlinks('60 install subdir', os.path.join('sub', 'sub1')) + self.install_subdir_invalid_symlinks('59 install subdir', os.path.join('sub', 'sub1')) def test_install_subdir_symlinks_with_default_umask(self): - self.install_subdir_invalid_symlinks('191 install_mode', 'sub2') + self.install_subdir_invalid_symlinks('190 install_mode', 'sub2') def test_install_subdir_symlinks_with_default_umask_and_mode(self): - self.install_subdir_invalid_symlinks('191 install_mode', 'sub1') + self.install_subdir_invalid_symlinks('190 install_mode', 'sub1') @skipIfNoPkgconfigDep('gmodule-2.0') def test_ldflag_dedup(self): @@ -7829,7 +7829,7 @@ class LinuxlikeTests(BasePlatformTests): raise unittest.SkipTest("Cygwin doesn't support LD_LIBRARY_PATH.") # Build some libraries and install them - testdir = os.path.join(self.unit_test_dir, '68 static link/lib') + testdir = os.path.join(self.unit_test_dir, '67 static link/lib') libdir = os.path.join(self.installdir, self.libdir) oldprefix = self.prefix self.prefix = self.installdir @@ -7841,7 +7841,7 @@ class LinuxlikeTests(BasePlatformTests): self.prefix = oldprefix meson_args = [f'-Dc_link_args=-L{libdir}', '--fatal-meson-warnings'] - testdir = os.path.join(self.unit_test_dir, '68 static link') + testdir = os.path.join(self.unit_test_dir, '67 static link') env = {'PKG_CONFIG_LIBDIR': os.path.join(libdir, 'pkgconfig')} self.init(testdir, extra_args=meson_args, override_envvars=env) self.build() @@ -7913,7 +7913,7 @@ class LinuxlikeTests(BasePlatformTests): return hashlib.sha256(f.read()).hexdigest() def test_wrap_with_file_url(self): - testdir = os.path.join(self.unit_test_dir, '74 wrap file url') + testdir = os.path.join(self.unit_test_dir, '73 wrap file url') source_filename = os.path.join(testdir, 'subprojects', 'foo.tar.xz') patch_filename = os.path.join(testdir, 'subprojects', 'foo-patch.tar.xz') wrap_filename = os.path.join(testdir, 'subprojects', 'foo.wrap') @@ -7952,7 +7952,7 @@ class LinuxlikeTests(BasePlatformTests): def test_lookup_system_after_broken_fallback(self): # Just to generate libfoo.pc so we can test system dependency lookup. - testdir = os.path.join(self.common_test_dir, '45 pkgconfig-gen') + testdir = os.path.join(self.common_test_dir, '44 pkgconfig-gen') self.init(testdir) privatedir = self.privatedir @@ -7970,7 +7970,7 @@ class LinuxlikeTests(BasePlatformTests): self.init(d, override_envvars={'PKG_CONFIG_LIBDIR': privatedir}) def test_as_link_whole(self): - testdir = os.path.join(self.unit_test_dir, '78 as link whole') + testdir = os.path.join(self.unit_test_dir, '77 as link whole') self.init(testdir) with open(os.path.join(self.privatedir, 'bar1.pc')) as f: content = f.read() @@ -7990,7 +7990,7 @@ class LinuxlikeTests(BasePlatformTests): gccver = subprocess.check_output(['cc', '--version']) if b'7.5.0' in gccver: raise unittest.SkipTest('GCC on Bionic is too old to be supported.') - testdir = os.path.join(self.unit_test_dir, '88 prelinking') + testdir = os.path.join(self.unit_test_dir, '87 prelinking') self.init(testdir) self.build() outlib = os.path.join(self.builddir, 'libprelinked.a') @@ -8065,7 +8065,7 @@ class LinuxCrossArmTests(BaseLinuxCrossTests): def test_cross_libdir_subproject(self): # Guard against a regression where calling "subproject" # would reset the value of libdir to its default value. - testdir = os.path.join(self.unit_test_dir, '77 subdir libdir') + testdir = os.path.join(self.unit_test_dir, '76 subdir libdir') self.init(testdir, extra_args=['--libdir=fuf']) for i in self.introspect('--buildoptions'): if i['name'] == 'libdir': @@ -8096,7 +8096,7 @@ class LinuxCrossArmTests(BaseLinuxCrossTests): https://github.com/mesonbuild/meson/issues/7997 check run native test in crossbuild without exe wrapper ''' - testdir = os.path.join(self.unit_test_dir, '89 run native test') + testdir = os.path.join(self.unit_test_dir, '88 run native test') stamp_file = os.path.join(self.builddir, 'native_test_has_run.stamp') self.init(testdir) self.build() @@ -8909,7 +8909,7 @@ class NativeFileTests(BasePlatformTests): self.build() def test_user_options(self): - testcase = os.path.join(self.common_test_dir, '41 options') + testcase = os.path.join(self.common_test_dir, '40 options') for opt, value in [('testoption', 'some other val'), ('other_one', True), ('combo_opt', 'one'), ('array_opt', ['two']), ('integer_opt', 0), @@ -8921,19 +8921,19 @@ class NativeFileTests(BasePlatformTests): self.assertRegex(cm.exception.stdout, r'Incorrect value to [a-z]+ option') def test_user_options_command_line_overrides(self): - testcase = os.path.join(self.common_test_dir, '41 options') + testcase = os.path.join(self.common_test_dir, '40 options') config = self.helper_create_native_file({'project options': {'other_one': True}}) self.init(testcase, extra_args=['--native-file', config, '-Dother_one=false']) def test_user_options_subproject(self): - testcase = os.path.join(self.unit_test_dir, '80 user options for subproject') + testcase = os.path.join(self.unit_test_dir, '79 user options for subproject') s = os.path.join(testcase, 'subprojects') if not os.path.exists(s): os.mkdir(s) s = os.path.join(s, 'sub') if not os.path.exists(s): - sub = os.path.join(self.common_test_dir, '41 options') + sub = os.path.join(self.common_test_dir, '40 options') shutil.copytree(sub, s) for opt, value in [('testoption', 'some other val'), ('other_one', True), @@ -8999,7 +8999,7 @@ class NativeFileTests(BasePlatformTests): self.fail('Did not find pkg_config_path in build options?') def test_builtin_options_subprojects(self): - testcase = os.path.join(self.common_test_dir, '99 subproject subdir') + testcase = os.path.join(self.common_test_dir, '98 subproject subdir') config = self.helper_create_native_file({'built-in options': {'default_library': 'both', 'c_args': ['-Dfoo']}, 'sub:built-in options': {'default_library': 'static'}}) self.init(testcase, extra_args=['--native-file', config]) @@ -9021,7 +9021,7 @@ class NativeFileTests(BasePlatformTests): def test_builtin_options_subprojects_overrides_buildfiles(self): # If the buildfile says subproject(... default_library: shared), ensure that's overwritten - testcase = os.path.join(self.common_test_dir, '224 persubproject options') + testcase = os.path.join(self.common_test_dir, '223 persubproject options') config = self.helper_create_native_file({'sub2:built-in options': {'default_library': 'shared'}}) with self.assertRaises((RuntimeError, subprocess.CalledProcessError)) as cm: @@ -9034,7 +9034,7 @@ class NativeFileTests(BasePlatformTests): def test_builtin_options_subprojects_dont_inherits_parent_override(self): # If the buildfile says subproject(... default_library: shared), ensure that's overwritten - testcase = os.path.join(self.common_test_dir, '224 persubproject options') + testcase = os.path.join(self.common_test_dir, '223 persubproject options') config = self.helper_create_native_file({'built-in options': {'default_library': 'both'}}) self.init(testcase, extra_args=['--native-file', config]) @@ -9154,7 +9154,7 @@ class CrossFileTests(BasePlatformTests): ''') def test_needs_exe_wrapper_true(self): - testdir = os.path.join(self.unit_test_dir, '72 cross test passed') + testdir = os.path.join(self.unit_test_dir, '71 cross test passed') with tempfile.TemporaryDirectory() as d: p = Path(d) / 'crossfile' with p.open('wt') as f: @@ -9164,7 +9164,7 @@ class CrossFileTests(BasePlatformTests): self.assertRegex(out, r'Skipped:\s*1\s*\n') def test_needs_exe_wrapper_false(self): - testdir = os.path.join(self.unit_test_dir, '72 cross test passed') + testdir = os.path.join(self.unit_test_dir, '71 cross test passed') with tempfile.TemporaryDirectory() as d: p = Path(d) / 'crossfile' with p.open('wt') as f: @@ -9174,7 +9174,7 @@ class CrossFileTests(BasePlatformTests): self.assertNotRegex(out, r'Skipped:\s*1\n') def test_needs_exe_wrapper_true_wrapper(self): - testdir = os.path.join(self.unit_test_dir, '72 cross test passed') + testdir = os.path.join(self.unit_test_dir, '71 cross test passed') with tempfile.TemporaryDirectory() as d: s = Path(d) / 'wrapper.py' with s.open('wt') as f: @@ -9191,7 +9191,7 @@ class CrossFileTests(BasePlatformTests): self.assertRegex(out, r'Ok:\s*3\s*\n') def test_cross_exe_passed_no_wrapper(self): - testdir = os.path.join(self.unit_test_dir, '72 cross test passed') + testdir = os.path.join(self.unit_test_dir, '71 cross test passed') with tempfile.TemporaryDirectory() as d: p = Path(d) / 'crossfile' with p.open('wt') as f: @@ -9318,7 +9318,7 @@ class CrossFileTests(BasePlatformTests): def test_user_options(self): # This is just a touch test for cross file, since the implementation # shares code after loading from the files - testcase = os.path.join(self.common_test_dir, '41 options') + testcase = os.path.join(self.common_test_dir, '40 options') config = self.helper_create_cross_file({'project options': {'testoption': 'some other value'}}) with self.assertRaises(subprocess.CalledProcessError) as cm: self.init(testcase, extra_args=['--cross-file', config]) diff --git a/test cases/common/100 postconf with args/meson.build b/test cases/common/100 postconf with args/meson.build new file mode 100644 index 0000000..a34502c --- /dev/null +++ b/test cases/common/100 postconf with args/meson.build @@ -0,0 +1,10 @@ +project('postconf script', 'c') + +conf = configure_file( + configuration : configuration_data(), + output : 'out' +) + +meson.add_postconf_script(find_program('postconf.py'), '5', '33', conf) + +test('post', executable('prog', 'prog.c')) diff --git a/test cases/common/100 postconf with args/postconf.py b/test cases/common/100 postconf with args/postconf.py new file mode 100644 index 0000000..cef7f79 --- /dev/null +++ b/test cases/common/100 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/100 postconf with args/prog.c b/test cases/common/100 postconf with args/prog.c new file mode 100644 index 0000000..5db9d17 --- /dev/null +++ b/test cases/common/100 postconf with args/prog.c @@ -0,0 +1,5 @@ +#include"generated.h" + +int main(void) { + return THE_NUMBER != 9 || THE_ARG1 != 5 || THE_ARG2 != 33; +} diff --git a/test cases/common/100 postconf with args/raw.dat b/test cases/common/100 postconf with args/raw.dat new file mode 100644 index 0000000..ec63514 --- /dev/null +++ b/test cases/common/100 postconf with args/raw.dat @@ -0,0 +1 @@ +9 diff --git a/test cases/common/100 postconf/meson.build b/test cases/common/100 postconf/meson.build deleted file mode 100644 index 12b3c5b..0000000 --- a/test cases/common/100 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/100 postconf/postconf.py b/test cases/common/100 postconf/postconf.py deleted file mode 100644 index 950c706..0000000 --- a/test cases/common/100 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/100 postconf/prog.c b/test cases/common/100 postconf/prog.c deleted file mode 100644 index 85a25a3..0000000 --- a/test cases/common/100 postconf/prog.c +++ /dev/null @@ -1,5 +0,0 @@ -#include"generated.h" - -int main(void) { - return THE_NUMBER != 9; -} diff --git a/test cases/common/100 postconf/raw.dat b/test cases/common/100 postconf/raw.dat deleted file mode 100644 index ec63514..0000000 --- a/test cases/common/100 postconf/raw.dat +++ /dev/null @@ -1 +0,0 @@ -9 diff --git a/test cases/common/101 postconf with args/meson.build b/test cases/common/101 postconf with args/meson.build deleted file mode 100644 index a34502c..0000000 --- a/test cases/common/101 postconf with args/meson.build +++ /dev/null @@ -1,10 +0,0 @@ -project('postconf script', 'c') - -conf = configure_file( - configuration : configuration_data(), - output : 'out' -) - -meson.add_postconf_script(find_program('postconf.py'), '5', '33', conf) - -test('post', executable('prog', 'prog.c')) diff --git a/test cases/common/101 postconf with args/postconf.py b/test cases/common/101 postconf with args/postconf.py deleted file mode 100644 index cef7f79..0000000 --- a/test cases/common/101 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/101 postconf with args/prog.c b/test cases/common/101 postconf with args/prog.c deleted file mode 100644 index 5db9d17..0000000 --- a/test cases/common/101 postconf with args/prog.c +++ /dev/null @@ -1,5 +0,0 @@ -#include"generated.h" - -int main(void) { - return THE_NUMBER != 9 || THE_ARG1 != 5 || THE_ARG2 != 33; -} diff --git a/test cases/common/101 postconf with args/raw.dat b/test cases/common/101 postconf with args/raw.dat deleted file mode 100644 index ec63514..0000000 --- a/test cases/common/101 postconf with args/raw.dat +++ /dev/null @@ -1 +0,0 @@ -9 diff --git a/test cases/common/101 testframework options/meson.build b/test cases/common/101 testframework options/meson.build new file mode 100644 index 0000000..827bae7 --- /dev/null +++ b/test cases/common/101 testframework options/meson.build @@ -0,0 +1,8 @@ +# normally run only from run_tests.py or run_project_tests.py +# else do like +# meson build '-Dtestoption=A string with spaces' -Dother_one=true -Dcombo_opt=one -Dprefix=/usr -Dlibdir=lib -Dbackend=ninja -Dwerror=True +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/101 testframework options/meson_options.txt b/test cases/common/101 testframework options/meson_options.txt new file mode 100644 index 0000000..653dd75 --- /dev/null +++ b/test cases/common/101 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/101 testframework options/test.json b/test cases/common/101 testframework options/test.json new file mode 100644 index 0000000..65bf3c0 --- /dev/null +++ b/test cases/common/101 testframework options/test.json @@ -0,0 +1,10 @@ +{ + "matrix": { + "options": { + "testoption": [{ "val": "A string with spaces" }], + "other_one": [{ "val": "true" }], + "combo_opt": [{ "val": "one" }], + "werror": [{ "val": "true" }] + } + } +} diff --git a/test cases/common/102 extract same name/lib.c b/test cases/common/102 extract same name/lib.c new file mode 100644 index 0000000..f3d0417 --- /dev/null +++ b/test cases/common/102 extract same name/lib.c @@ -0,0 +1,3 @@ +int func1(void) { + return 23; +} diff --git a/test cases/common/102 extract same name/main.c b/test cases/common/102 extract same name/main.c new file mode 100644 index 0000000..e5a0c1e --- /dev/null +++ b/test cases/common/102 extract same name/main.c @@ -0,0 +1,6 @@ +int func1(void); +int func2(void); + +int main(void) { + return !(func1() == 23 && func2() == 42); +} diff --git a/test cases/common/102 extract same name/meson.build b/test cases/common/102 extract same name/meson.build new file mode 100644 index 0000000..e15561d --- /dev/null +++ b/test cases/common/102 extract same name/meson.build @@ -0,0 +1,19 @@ +project('object extraction', 'c') + +if meson.backend() == 'xcode' + # Xcode gives object files unique names but only if they would clash. For example + # two files named lib.o instead get the following names: + # + # lib-4fbe522d8ba4cb1f1b89cc2df640a2336b92e1a5565f0a4c5a79b5b5e2969eb9.o + # lib-4fbe522d8ba4cb1f1b89cc2df640a2336deeff2bc2297affaadbe20f5cbfee56.o + # + # No-one has reverse engineered the naming scheme so we would access them. + # IF you feel up to the challenge, patches welcome. + error('MESON_SKIP_TEST, Xcode can not extract objs when they would have the same filename.') +endif + +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/102 extract same name/src/lib.c b/test cases/common/102 extract same name/src/lib.c new file mode 100644 index 0000000..a7d7e77 --- /dev/null +++ b/test cases/common/102 extract same name/src/lib.c @@ -0,0 +1,3 @@ +int func2(void) { + return 42; +} diff --git a/test cases/common/102 testframework options/meson.build b/test cases/common/102 testframework options/meson.build deleted file mode 100644 index 827bae7..0000000 --- a/test cases/common/102 testframework options/meson.build +++ /dev/null @@ -1,8 +0,0 @@ -# normally run only from run_tests.py or run_project_tests.py -# else do like -# meson build '-Dtestoption=A string with spaces' -Dother_one=true -Dcombo_opt=one -Dprefix=/usr -Dlibdir=lib -Dbackend=ninja -Dwerror=True -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/102 testframework options/meson_options.txt b/test cases/common/102 testframework options/meson_options.txt deleted file mode 100644 index 653dd75..0000000 --- a/test cases/common/102 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/102 testframework options/test.json b/test cases/common/102 testframework options/test.json deleted file mode 100644 index 65bf3c0..0000000 --- a/test cases/common/102 testframework options/test.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "matrix": { - "options": { - "testoption": [{ "val": "A string with spaces" }], - "other_one": [{ "val": "true" }], - "combo_opt": [{ "val": "one" }], - "werror": [{ "val": "true" }] - } - } -} diff --git a/test cases/common/103 extract same name/lib.c b/test cases/common/103 extract same name/lib.c deleted file mode 100644 index f3d0417..0000000 --- a/test cases/common/103 extract same name/lib.c +++ /dev/null @@ -1,3 +0,0 @@ -int func1(void) { - return 23; -} diff --git a/test cases/common/103 extract same name/main.c b/test cases/common/103 extract same name/main.c deleted file mode 100644 index e5a0c1e..0000000 --- a/test cases/common/103 extract same name/main.c +++ /dev/null @@ -1,6 +0,0 @@ -int func1(void); -int func2(void); - -int main(void) { - return !(func1() == 23 && func2() == 42); -} diff --git a/test cases/common/103 extract same name/meson.build b/test cases/common/103 extract same name/meson.build deleted file mode 100644 index e15561d..0000000 --- a/test cases/common/103 extract same name/meson.build +++ /dev/null @@ -1,19 +0,0 @@ -project('object extraction', 'c') - -if meson.backend() == 'xcode' - # Xcode gives object files unique names but only if they would clash. For example - # two files named lib.o instead get the following names: - # - # lib-4fbe522d8ba4cb1f1b89cc2df640a2336b92e1a5565f0a4c5a79b5b5e2969eb9.o - # lib-4fbe522d8ba4cb1f1b89cc2df640a2336deeff2bc2297affaadbe20f5cbfee56.o - # - # No-one has reverse engineered the naming scheme so we would access them. - # IF you feel up to the challenge, patches welcome. - error('MESON_SKIP_TEST, Xcode can not extract objs when they would have the same filename.') -endif - -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/103 extract same name/src/lib.c b/test cases/common/103 extract same name/src/lib.c deleted file mode 100644 index a7d7e77..0000000 --- a/test cases/common/103 extract same name/src/lib.c +++ /dev/null @@ -1,3 +0,0 @@ -int func2(void) { - return 42; -} diff --git a/test cases/common/103 has header symbol/meson.build b/test cases/common/103 has header symbol/meson.build new file mode 100644 index 0000000..54cedce --- /dev/null +++ b/test cases/common/103 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/104 has arg/meson.build b/test cases/common/104 has arg/meson.build new file mode 100644 index 0000000..ba07311 --- /dev/null +++ b/test cases/common/104 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/104 has header symbol/meson.build b/test cases/common/104 has header symbol/meson.build deleted file mode 100644 index 54cedce..0000000 --- a/test cases/common/104 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/105 generatorcustom/catter.py b/test cases/common/105 generatorcustom/catter.py new file mode 100755 index 0000000..c272672 --- /dev/null +++ b/test cases/common/105 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) as ifile: + content = ifile.read() + ofile.write(content) + ofile.write('\n') diff --git a/test cases/common/105 generatorcustom/gen-resx.py b/test cases/common/105 generatorcustom/gen-resx.py new file mode 100755 index 0000000..242a962 --- /dev/null +++ b/test cases/common/105 generatorcustom/gen-resx.py @@ -0,0 +1,9 @@ +#!/usr/bin/env python3 + +import sys + +ofile = sys.argv[1] +num = sys.argv[2] + +with open(ofile, 'w') as f: + f.write(f'res{num}\n') diff --git a/test cases/common/105 generatorcustom/gen.py b/test cases/common/105 generatorcustom/gen.py new file mode 100755 index 0000000..1464008 --- /dev/null +++ b/test cases/common/105 generatorcustom/gen.py @@ -0,0 +1,13 @@ +#!/usr/bin/env python3 + +import sys + +ifile = sys.argv[1] +ofile = sys.argv[2] + +with open(ifile) 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/105 generatorcustom/main.c b/test cases/common/105 generatorcustom/main.c new file mode 100644 index 0000000..153dc12 --- /dev/null +++ b/test cases/common/105 generatorcustom/main.c @@ -0,0 +1,8 @@ +#include + +#include "alltogether.h" + +int main(void) { + printf("%s - %s - %s - %s\n", res1, res2, res3, res4); + return 0; +} diff --git a/test cases/common/105 generatorcustom/meson.build b/test cases/common/105 generatorcustom/meson.build new file mode 100644 index 0000000..2128d21 --- /dev/null +++ b/test cases/common/105 generatorcustom/meson.build @@ -0,0 +1,28 @@ +project('generatorcustom', 'c') + +creator = find_program('gen.py') +catter = find_program('catter.py') +gen_resx = find_program('gen-resx.py') + +gen = generator(creator, + output: '@BASENAME@.h', + arguments : ['@INPUT@', '@OUTPUT@']) + +res3 = custom_target('gen-res3', + output : 'res3.txt', + command : [gen_resx, '@OUTPUT@', '3']) + +res4 = custom_target('gen-res4', + output : 'res4.txt', + command : [gen_resx, '@OUTPUT@', '4']) + +hs = gen.process('res1.txt', 'res2.txt', res3, res4[0]) + +allinone = custom_target('alltogether', + input : hs, + output : 'alltogether.h', + command : [catter, '@INPUT@', '@OUTPUT@']) + +proggie = executable('proggie', 'main.c', allinone) + +test('proggie', proggie) diff --git a/test cases/common/105 generatorcustom/res1.txt b/test cases/common/105 generatorcustom/res1.txt new file mode 100644 index 0000000..6487c56 --- /dev/null +++ b/test cases/common/105 generatorcustom/res1.txt @@ -0,0 +1 @@ +res1 diff --git a/test cases/common/105 generatorcustom/res2.txt b/test cases/common/105 generatorcustom/res2.txt new file mode 100644 index 0000000..0a8879d --- /dev/null +++ b/test cases/common/105 generatorcustom/res2.txt @@ -0,0 +1 @@ +res2 diff --git a/test cases/common/105 has arg/meson.build b/test cases/common/105 has arg/meson.build deleted file mode 100644 index ba07311..0000000 --- a/test cases/common/105 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/106 generatorcustom/catter.py b/test cases/common/106 generatorcustom/catter.py deleted file mode 100755 index c272672..0000000 --- a/test cases/common/106 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) as ifile: - content = ifile.read() - ofile.write(content) - ofile.write('\n') diff --git a/test cases/common/106 generatorcustom/gen-resx.py b/test cases/common/106 generatorcustom/gen-resx.py deleted file mode 100755 index 242a962..0000000 --- a/test cases/common/106 generatorcustom/gen-resx.py +++ /dev/null @@ -1,9 +0,0 @@ -#!/usr/bin/env python3 - -import sys - -ofile = sys.argv[1] -num = sys.argv[2] - -with open(ofile, 'w') as f: - f.write(f'res{num}\n') diff --git a/test cases/common/106 generatorcustom/gen.py b/test cases/common/106 generatorcustom/gen.py deleted file mode 100755 index 1464008..0000000 --- a/test cases/common/106 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) 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/106 generatorcustom/main.c b/test cases/common/106 generatorcustom/main.c deleted file mode 100644 index 153dc12..0000000 --- a/test cases/common/106 generatorcustom/main.c +++ /dev/null @@ -1,8 +0,0 @@ -#include - -#include "alltogether.h" - -int main(void) { - printf("%s - %s - %s - %s\n", res1, res2, res3, res4); - return 0; -} diff --git a/test cases/common/106 generatorcustom/meson.build b/test cases/common/106 generatorcustom/meson.build deleted file mode 100644 index 2128d21..0000000 --- a/test cases/common/106 generatorcustom/meson.build +++ /dev/null @@ -1,28 +0,0 @@ -project('generatorcustom', 'c') - -creator = find_program('gen.py') -catter = find_program('catter.py') -gen_resx = find_program('gen-resx.py') - -gen = generator(creator, - output: '@BASENAME@.h', - arguments : ['@INPUT@', '@OUTPUT@']) - -res3 = custom_target('gen-res3', - output : 'res3.txt', - command : [gen_resx, '@OUTPUT@', '3']) - -res4 = custom_target('gen-res4', - output : 'res4.txt', - command : [gen_resx, '@OUTPUT@', '4']) - -hs = gen.process('res1.txt', 'res2.txt', res3, res4[0]) - -allinone = custom_target('alltogether', - input : hs, - output : 'alltogether.h', - command : [catter, '@INPUT@', '@OUTPUT@']) - -proggie = executable('proggie', 'main.c', allinone) - -test('proggie', proggie) diff --git a/test cases/common/106 generatorcustom/res1.txt b/test cases/common/106 generatorcustom/res1.txt deleted file mode 100644 index 6487c56..0000000 --- a/test cases/common/106 generatorcustom/res1.txt +++ /dev/null @@ -1 +0,0 @@ -res1 diff --git a/test cases/common/106 generatorcustom/res2.txt b/test cases/common/106 generatorcustom/res2.txt deleted file mode 100644 index 0a8879d..0000000 --- a/test cases/common/106 generatorcustom/res2.txt +++ /dev/null @@ -1 +0,0 @@ -res2 diff --git a/test cases/common/106 multiple dir configure file/meson.build b/test cases/common/106 multiple dir configure file/meson.build new file mode 100644 index 0000000..a4615fa --- /dev/null +++ b/test cases/common/106 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/106 multiple dir configure file/subdir/foo.txt b/test cases/common/106 multiple dir configure file/subdir/foo.txt new file mode 100644 index 0000000..e69de29 diff --git a/test cases/common/106 multiple dir configure file/subdir/meson.build b/test cases/common/106 multiple dir configure file/subdir/meson.build new file mode 100644 index 0000000..503df96 --- /dev/null +++ b/test cases/common/106 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/106 multiple dir configure file/subdir/someinput.in b/test cases/common/106 multiple dir configure file/subdir/someinput.in new file mode 100644 index 0000000..e69de29 diff --git a/test cases/common/107 multiple dir configure file/meson.build b/test cases/common/107 multiple dir configure file/meson.build deleted file mode 100644 index a4615fa..0000000 --- a/test cases/common/107 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/107 multiple dir configure file/subdir/foo.txt b/test cases/common/107 multiple dir configure file/subdir/foo.txt deleted file mode 100644 index e69de29..0000000 diff --git a/test cases/common/107 multiple dir configure file/subdir/meson.build b/test cases/common/107 multiple dir configure file/subdir/meson.build deleted file mode 100644 index 503df96..0000000 --- a/test cases/common/107 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/107 multiple dir configure file/subdir/someinput.in b/test cases/common/107 multiple dir configure file/subdir/someinput.in deleted file mode 100644 index e69de29..0000000 diff --git a/test cases/common/107 spaces backslash/asm output/meson.build b/test cases/common/107 spaces backslash/asm output/meson.build new file mode 100644 index 0000000..b5f13f5 --- /dev/null +++ b/test cases/common/107 spaces backslash/asm output/meson.build @@ -0,0 +1,2 @@ +configure_file(output : 'blank.txt', configuration : configuration_data()) + diff --git a/test cases/common/107 spaces backslash/comparer-end-notstring.c b/test cases/common/107 spaces backslash/comparer-end-notstring.c new file mode 100644 index 0000000..8b8190f --- /dev/null +++ b/test cases/common/107 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(void) { + 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/107 spaces backslash/comparer-end.c b/test cases/common/107 spaces backslash/comparer-end.c new file mode 100644 index 0000000..8cff1b1 --- /dev/null +++ b/test cases/common/107 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(void) { + 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/107 spaces backslash/comparer.c b/test cases/common/107 spaces backslash/comparer.c new file mode 100644 index 0000000..7e3033e --- /dev/null +++ b/test cases/common/107 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(void) { + 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/107 spaces backslash/include/comparer.h b/test cases/common/107 spaces backslash/include/comparer.h new file mode 100644 index 0000000..624d96c --- /dev/null +++ b/test cases/common/107 spaces backslash/include/comparer.h @@ -0,0 +1,4 @@ +#include +#include + +#define COMPARER_INCLUDED diff --git a/test cases/common/107 spaces backslash/meson.build b/test cases/common/107 spaces backslash/meson.build new file mode 100644 index 0000000..d590494 --- /dev/null +++ b/test cases/common/107 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/108 spaces backslash/asm output/meson.build b/test cases/common/108 spaces backslash/asm output/meson.build deleted file mode 100644 index b5f13f5..0000000 --- a/test cases/common/108 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/108 spaces backslash/comparer-end-notstring.c b/test cases/common/108 spaces backslash/comparer-end-notstring.c deleted file mode 100644 index 8b8190f..0000000 --- a/test cases/common/108 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(void) { - 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/108 spaces backslash/comparer-end.c b/test cases/common/108 spaces backslash/comparer-end.c deleted file mode 100644 index 8cff1b1..0000000 --- a/test cases/common/108 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(void) { - 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/108 spaces backslash/comparer.c b/test cases/common/108 spaces backslash/comparer.c deleted file mode 100644 index 7e3033e..0000000 --- a/test cases/common/108 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(void) { - 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/108 spaces backslash/include/comparer.h b/test cases/common/108 spaces backslash/include/comparer.h deleted file mode 100644 index 624d96c..0000000 --- a/test cases/common/108 spaces backslash/include/comparer.h +++ /dev/null @@ -1,4 +0,0 @@ -#include -#include - -#define COMPARER_INCLUDED diff --git a/test cases/common/108 spaces backslash/meson.build b/test cases/common/108 spaces backslash/meson.build deleted file mode 100644 index d590494..0000000 --- a/test cases/common/108 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/108 ternary/meson.build b/test cases/common/108 ternary/meson.build new file mode 100644 index 0000000..7539d56 --- /dev/null +++ b/test cases/common/108 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/109 custom target capture/data_source.txt b/test cases/common/109 custom target capture/data_source.txt new file mode 100644 index 0000000..0c23cc0 --- /dev/null +++ b/test cases/common/109 custom target capture/data_source.txt @@ -0,0 +1 @@ +This is a text only input file. diff --git a/test cases/common/109 custom target capture/meson.build b/test cases/common/109 custom target capture/meson.build new file mode 100644 index 0000000..58a69ca --- /dev/null +++ b/test cases/common/109 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/109 custom target capture/my_compiler.py b/test cases/common/109 custom target capture/my_compiler.py new file mode 100755 index 0000000..b60722a --- /dev/null +++ b/test cases/common/109 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/109 custom target capture/test.json b/test cases/common/109 custom target capture/test.json new file mode 100644 index 0000000..ba66b02 --- /dev/null +++ b/test cases/common/109 custom target capture/test.json @@ -0,0 +1,5 @@ +{ + "installed": [ + {"type": "file", "file": "usr/subdir/data.dat"} + ] +} diff --git a/test cases/common/109 ternary/meson.build b/test cases/common/109 ternary/meson.build deleted file mode 100644 index 7539d56..0000000 --- a/test cases/common/109 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/110 allgenerate/converter.py b/test cases/common/110 allgenerate/converter.py new file mode 100755 index 0000000..f8e2ca0 --- /dev/null +++ b/test cases/common/110 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/110 allgenerate/foobar.cpp.in b/test cases/common/110 allgenerate/foobar.cpp.in new file mode 100644 index 0000000..32e1261 --- /dev/null +++ b/test cases/common/110 allgenerate/foobar.cpp.in @@ -0,0 +1,6 @@ +#include + +int main(void) { + printf("I am a program.\n"); + return 0; +} diff --git a/test cases/common/110 allgenerate/meson.build b/test cases/common/110 allgenerate/meson.build new file mode 100644 index 0000000..049e849 --- /dev/null +++ b/test cases/common/110 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/110 custom target capture/data_source.txt b/test cases/common/110 custom target capture/data_source.txt deleted file mode 100644 index 0c23cc0..0000000 --- a/test cases/common/110 custom target capture/data_source.txt +++ /dev/null @@ -1 +0,0 @@ -This is a text only input file. diff --git a/test cases/common/110 custom target capture/meson.build b/test cases/common/110 custom target capture/meson.build deleted file mode 100644 index 58a69ca..0000000 --- a/test cases/common/110 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/110 custom target capture/my_compiler.py b/test cases/common/110 custom target capture/my_compiler.py deleted file mode 100755 index b60722a..0000000 --- a/test cases/common/110 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/110 custom target capture/test.json b/test cases/common/110 custom target capture/test.json deleted file mode 100644 index ba66b02..0000000 --- a/test cases/common/110 custom target capture/test.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "installed": [ - {"type": "file", "file": "usr/subdir/data.dat"} - ] -} diff --git a/test cases/common/111 allgenerate/converter.py b/test cases/common/111 allgenerate/converter.py deleted file mode 100755 index f8e2ca0..0000000 --- a/test cases/common/111 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/111 allgenerate/foobar.cpp.in b/test cases/common/111 allgenerate/foobar.cpp.in deleted file mode 100644 index 32e1261..0000000 --- a/test cases/common/111 allgenerate/foobar.cpp.in +++ /dev/null @@ -1,6 +0,0 @@ -#include - -int main(void) { - printf("I am a program.\n"); - return 0; -} diff --git a/test cases/common/111 allgenerate/meson.build b/test cases/common/111 allgenerate/meson.build deleted file mode 100644 index 049e849..0000000 --- a/test cases/common/111 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/111 pathjoin/meson.build b/test cases/common/111 pathjoin/meson.build new file mode 100644 index 0000000..d3957dd --- /dev/null +++ b/test cases/common/111 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/112 pathjoin/meson.build b/test cases/common/112 pathjoin/meson.build deleted file mode 100644 index d3957dd..0000000 --- a/test cases/common/112 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/112 subdir subproject/meson.build b/test cases/common/112 subdir subproject/meson.build new file mode 100644 index 0000000..54ecfe0 --- /dev/null +++ b/test cases/common/112 subdir subproject/meson.build @@ -0,0 +1,2 @@ +project('proj', 'c') +subdir('prog') diff --git a/test cases/common/112 subdir subproject/prog/meson.build b/test cases/common/112 subdir subproject/prog/meson.build new file mode 100644 index 0000000..360b5f5 --- /dev/null +++ b/test cases/common/112 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/112 subdir subproject/prog/prog.c b/test cases/common/112 subdir subproject/prog/prog.c new file mode 100644 index 0000000..9035ff1 --- /dev/null +++ b/test cases/common/112 subdir subproject/prog/prog.c @@ -0,0 +1,5 @@ +#include + +int main(void) { + return sub(); +} diff --git a/test cases/common/112 subdir subproject/subprojects/sub/meson.build b/test cases/common/112 subdir subproject/subprojects/sub/meson.build new file mode 100644 index 0000000..94e9eec --- /dev/null +++ b/test cases/common/112 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/112 subdir subproject/subprojects/sub/sub.c b/test cases/common/112 subdir subproject/subprojects/sub/sub.c new file mode 100644 index 0000000..e748ac7 --- /dev/null +++ b/test cases/common/112 subdir subproject/subprojects/sub/sub.c @@ -0,0 +1,5 @@ +#include "sub.h" + +int sub(void) { + return 0; +} diff --git a/test cases/common/112 subdir subproject/subprojects/sub/sub.h b/test cases/common/112 subdir subproject/subprojects/sub/sub.h new file mode 100644 index 0000000..2b59a3a --- /dev/null +++ b/test cases/common/112 subdir subproject/subprojects/sub/sub.h @@ -0,0 +1,6 @@ +#ifndef SUB_H +#define SUB_H + +int sub(void); + +#endif diff --git a/test cases/common/113 interpreter copy mutable var on assignment/meson.build b/test cases/common/113 interpreter copy mutable var on assignment/meson.build new file mode 100644 index 0000000..8b15357 --- /dev/null +++ b/test cases/common/113 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/113 subdir subproject/meson.build b/test cases/common/113 subdir subproject/meson.build deleted file mode 100644 index 54ecfe0..0000000 --- a/test cases/common/113 subdir subproject/meson.build +++ /dev/null @@ -1,2 +0,0 @@ -project('proj', 'c') -subdir('prog') diff --git a/test cases/common/113 subdir subproject/prog/meson.build b/test cases/common/113 subdir subproject/prog/meson.build deleted file mode 100644 index 360b5f5..0000000 --- a/test cases/common/113 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/113 subdir subproject/prog/prog.c b/test cases/common/113 subdir subproject/prog/prog.c deleted file mode 100644 index 9035ff1..0000000 --- a/test cases/common/113 subdir subproject/prog/prog.c +++ /dev/null @@ -1,5 +0,0 @@ -#include - -int main(void) { - return sub(); -} diff --git a/test cases/common/113 subdir subproject/subprojects/sub/meson.build b/test cases/common/113 subdir subproject/subprojects/sub/meson.build deleted file mode 100644 index 94e9eec..0000000 --- a/test cases/common/113 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/113 subdir subproject/subprojects/sub/sub.c b/test cases/common/113 subdir subproject/subprojects/sub/sub.c deleted file mode 100644 index e748ac7..0000000 --- a/test cases/common/113 subdir subproject/subprojects/sub/sub.c +++ /dev/null @@ -1,5 +0,0 @@ -#include "sub.h" - -int sub(void) { - return 0; -} diff --git a/test cases/common/113 subdir subproject/subprojects/sub/sub.h b/test cases/common/113 subdir subproject/subprojects/sub/sub.h deleted file mode 100644 index 2b59a3a..0000000 --- a/test cases/common/113 subdir subproject/subprojects/sub/sub.h +++ /dev/null @@ -1,6 +0,0 @@ -#ifndef SUB_H -#define SUB_H - -int sub(void); - -#endif diff --git a/test cases/common/114 interpreter copy mutable var on assignment/meson.build b/test cases/common/114 interpreter copy mutable var on assignment/meson.build deleted file mode 100644 index 8b15357..0000000 --- a/test cases/common/114 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/114 skip/meson.build b/test cases/common/114 skip/meson.build new file mode 100644 index 0000000..1adedb6 --- /dev/null +++ b/test cases/common/114 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/115 skip/meson.build b/test cases/common/115 skip/meson.build deleted file mode 100644 index 1adedb6..0000000 --- a/test cases/common/115 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/115 subproject project arguments/exe.c b/test cases/common/115 subproject project arguments/exe.c new file mode 100644 index 0000000..e8f2271 --- /dev/null +++ b/test cases/common/115 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(void) { + return 0; +} diff --git a/test cases/common/115 subproject project arguments/exe.cpp b/test cases/common/115 subproject project arguments/exe.cpp new file mode 100644 index 0000000..9cfaec4 --- /dev/null +++ b/test cases/common/115 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(void) { + return 0; +} + diff --git a/test cases/common/115 subproject project arguments/meson.build b/test cases/common/115 subproject project arguments/meson.build new file mode 100644 index 0000000..90d4c05 --- /dev/null +++ b/test cases/common/115 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/115 subproject project arguments/subprojects/subexe/meson.build b/test cases/common/115 subproject project arguments/subprojects/subexe/meson.build new file mode 100644 index 0000000..ef141dc --- /dev/null +++ b/test cases/common/115 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/115 subproject project arguments/subprojects/subexe/subexe.c b/test cases/common/115 subproject project arguments/subprojects/subexe/subexe.c new file mode 100644 index 0000000..bd5316d --- /dev/null +++ b/test cases/common/115 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(void) { + return 0; +} diff --git a/test cases/common/116 subproject project arguments/exe.c b/test cases/common/116 subproject project arguments/exe.c deleted file mode 100644 index e8f2271..0000000 --- a/test cases/common/116 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(void) { - return 0; -} diff --git a/test cases/common/116 subproject project arguments/exe.cpp b/test cases/common/116 subproject project arguments/exe.cpp deleted file mode 100644 index 9cfaec4..0000000 --- a/test cases/common/116 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(void) { - return 0; -} - diff --git a/test cases/common/116 subproject project arguments/meson.build b/test cases/common/116 subproject project arguments/meson.build deleted file mode 100644 index 90d4c05..0000000 --- a/test cases/common/116 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/116 subproject project arguments/subprojects/subexe/meson.build b/test cases/common/116 subproject project arguments/subprojects/subexe/meson.build deleted file mode 100644 index ef141dc..0000000 --- a/test cases/common/116 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/116 subproject project arguments/subprojects/subexe/subexe.c b/test cases/common/116 subproject project arguments/subprojects/subexe/subexe.c deleted file mode 100644 index bd5316d..0000000 --- a/test cases/common/116 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(void) { - return 0; -} diff --git a/test cases/common/116 test skip/meson.build b/test cases/common/116 test skip/meson.build new file mode 100644 index 0000000..568527f --- /dev/null +++ b/test cases/common/116 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/116 test skip/test_skip.c b/test cases/common/116 test skip/test_skip.c new file mode 100644 index 0000000..59c134b --- /dev/null +++ b/test cases/common/116 test skip/test_skip.c @@ -0,0 +1,3 @@ +int main(void) { + return 77; +} diff --git a/test cases/common/117 shared module/meson.build b/test cases/common/117 shared module/meson.build new file mode 100644 index 0000000..936c839 --- /dev/null +++ b/test cases/common/117 shared module/meson.build @@ -0,0 +1,40 @@ +project('shared module', 'c') + +c = meson.get_compiler('c') + +# Windows UWP doesn't support the ToolHelp API we use in this test to emulate +# runtime symbol resolution. +if host_machine.system() == 'windows' + if not c.compiles(''' +#include +#include + +HANDLE func(void) +{ + return CreateToolhelp32Snapshot(TH32CS_SNAPMODULE, 0); +} +''') + error('MESON_SKIP_TEST Windows UWP does not support this test.') + endif +endif + +dl = 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/117 shared module/module.c b/test cases/common/117 shared module/module.c new file mode 100644 index 0000000..5dd26d7 --- /dev/null +++ b/test cases/common/117 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(void) { + 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(void); + +int DLL_PUBLIC func(void) { + return func_from_language_runtime(); +} +#endif diff --git a/test cases/common/117 shared module/nosyms.c b/test cases/common/117 shared module/nosyms.c new file mode 100644 index 0000000..3432b1c --- /dev/null +++ b/test cases/common/117 shared module/nosyms.c @@ -0,0 +1,4 @@ +static int +func_not_exported (void) { + return 99; +} diff --git a/test cases/common/117 shared module/prog.c b/test cases/common/117 shared module/prog.c new file mode 100644 index 0000000..4741185 --- /dev/null +++ b/test cases/common/117 shared module/prog.c @@ -0,0 +1,103 @@ + +#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; + if(argc==0) {}; + + 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; + if(argc==0) {}; + + 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/117 shared module/runtime.c b/test cases/common/117 shared module/runtime.c new file mode 100644 index 0000000..03bde86 --- /dev/null +++ b/test cases/common/117 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/117 shared module/test.json b/test cases/common/117 shared module/test.json new file mode 100644 index 0000000..33bfeff --- /dev/null +++ b/test cases/common/117 shared module/test.json @@ -0,0 +1,7 @@ +{ + "installed": [ + {"type": "expr", "file": "usr/lib/modules/libnosyms?so"}, + {"type": "implibempty", "file": "usr/lib/modules/libnosyms"}, + {"type": "pdb", "file": "usr/lib/modules/nosyms"} + ] +} diff --git a/test cases/common/117 test skip/meson.build b/test cases/common/117 test skip/meson.build deleted file mode 100644 index 568527f..0000000 --- a/test cases/common/117 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/117 test skip/test_skip.c b/test cases/common/117 test skip/test_skip.c deleted file mode 100644 index 59c134b..0000000 --- a/test cases/common/117 test skip/test_skip.c +++ /dev/null @@ -1,3 +0,0 @@ -int main(void) { - return 77; -} diff --git a/test cases/common/118 llvm ir and assembly/main.c b/test cases/common/118 llvm ir and assembly/main.c new file mode 100644 index 0000000..35e8ed6 --- /dev/null +++ b/test cases/common/118 llvm ir and assembly/main.c @@ -0,0 +1,13 @@ +#include + +unsigned square_unsigned (unsigned a); + +int main(void) +{ + 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/118 llvm ir and assembly/main.cpp b/test cases/common/118 llvm ir and assembly/main.cpp new file mode 100644 index 0000000..aac3cbf --- /dev/null +++ b/test cases/common/118 llvm ir and assembly/main.cpp @@ -0,0 +1,15 @@ +#include + +extern "C" { + unsigned square_unsigned (unsigned a); +} + +int main (void) +{ + 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/118 llvm ir and assembly/meson.build b/test cases/common/118 llvm ir and assembly/meson.build new file mode 100644 index 0000000..2aec7f0 --- /dev/null +++ b/test cases/common/118 llvm ir and assembly/meson.build @@ -0,0 +1,79 @@ +project('llvm-ir', 'c', 'cpp') + +if meson.backend() == 'xcode' + error('MESON_SKIP_TEST: asm not supported with the Xcode backend. Patches welcome.') +endif + +cpu = host_machine.cpu_family() +supported_cpus = ['arm', 'aarch64', '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 ml.exe or armasm.exe + # assembler. Then we can link it into the executable. + if cc.get_argument_syntax() == 'msvc' + cl = cc.cmd_array() + if cpu == 'x86' + asmcmd = 'ml' + elif cpu == 'x86_64' + asmcmd = 'ml64' + elif cpu == 'aarch64' + asmcmd = 'armasm64' + elif cpu == 'arm' + asmcmd = 'armasm' + else + error('Unsupported cpu family: "' + cpu + '"') + endif + ml = find_program(asmcmd, required: false) + if not ml.found() + error('MESON_SKIP_TEST: Microsoft assembler (ml/armasm) 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 + if asmcmd.startswith('armasm') + square_impl = custom_target(lang + square_impl, + input : square_preproc, + output : lang + square_base + '.obj', + command : [ml, '-nologo', '-o', '@OUTPUT@', '@INPUT@']) + else + square_impl = custom_target(lang + square_impl, + input : square_preproc, + output : lang + square_base + '.obj', + command : [ml, '/nologo', '/safeseh', '/Fo', '@OUTPUT@', '/c', '@INPUT@']) + endif + 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/118 llvm ir and assembly/square-aarch64.S b/test cases/common/118 llvm ir and assembly/square-aarch64.S new file mode 100644 index 0000000..02f1a12 --- /dev/null +++ b/test cases/common/118 llvm ir and assembly/square-aarch64.S @@ -0,0 +1,29 @@ +#include "symbol-underscore.h" + +#ifdef _MSC_VER + + AREA _TEXT, ARM64, CODE, READONLY + + EXPORT SYMBOL_NAME(square_unsigned) +SYMBOL_NAME(square_unsigned) PROC + mul x1, x0, x0 + mov x0, x1 + ret +SYMBOL_NAME(square_unsigned) ENDP + + END + +#else + +.text +.globl SYMBOL_NAME(square_unsigned) +# ifdef __linux__ +.type square_unsigned, %function +#endif + +SYMBOL_NAME(square_unsigned): + mul x1, x0, x0 + mov x0, x1 + ret + +#endif diff --git a/test cases/common/118 llvm ir and assembly/square-arm.S b/test cases/common/118 llvm ir and assembly/square-arm.S new file mode 100644 index 0000000..aea3f1f --- /dev/null +++ b/test cases/common/118 llvm ir and assembly/square-arm.S @@ -0,0 +1,29 @@ +#include "symbol-underscore.h" + +#ifdef _MSC_VER + + AREA _TEXT, ARM, CODE, READONLY + + EXPORT SYMBOL_NAME(square_unsigned) +SYMBOL_NAME(square_unsigned) PROC + mul r1, r0, r0 + mov r0, r1 + mov pc, lr +SYMBOL_NAME(square_unsigned) ENDP + + END + +#else + +.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 + +#endif diff --git a/test cases/common/118 llvm ir and assembly/square-x86.S b/test cases/common/118 llvm ir and assembly/square-x86.S new file mode 100644 index 0000000..18284c1 --- /dev/null +++ b/test cases/common/118 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/118 llvm ir and assembly/square-x86_64.S b/test cases/common/118 llvm ir and assembly/square-x86_64.S new file mode 100644 index 0000000..5678d00 --- /dev/null +++ b/test cases/common/118 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/118 llvm ir and assembly/square.ll b/test cases/common/118 llvm ir and assembly/square.ll new file mode 100644 index 0000000..7c321aa --- /dev/null +++ b/test cases/common/118 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/118 llvm ir and assembly/symbol-underscore.h b/test cases/common/118 llvm ir and assembly/symbol-underscore.h new file mode 100644 index 0000000..d0f3ef9 --- /dev/null +++ b/test cases/common/118 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/118 shared module/meson.build b/test cases/common/118 shared module/meson.build deleted file mode 100644 index 936c839..0000000 --- a/test cases/common/118 shared module/meson.build +++ /dev/null @@ -1,40 +0,0 @@ -project('shared module', 'c') - -c = meson.get_compiler('c') - -# Windows UWP doesn't support the ToolHelp API we use in this test to emulate -# runtime symbol resolution. -if host_machine.system() == 'windows' - if not c.compiles(''' -#include -#include - -HANDLE func(void) -{ - return CreateToolhelp32Snapshot(TH32CS_SNAPMODULE, 0); -} -''') - error('MESON_SKIP_TEST Windows UWP does not support this test.') - endif -endif - -dl = 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/118 shared module/module.c b/test cases/common/118 shared module/module.c deleted file mode 100644 index 5dd26d7..0000000 --- a/test cases/common/118 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(void) { - 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(void); - -int DLL_PUBLIC func(void) { - return func_from_language_runtime(); -} -#endif diff --git a/test cases/common/118 shared module/nosyms.c b/test cases/common/118 shared module/nosyms.c deleted file mode 100644 index 3432b1c..0000000 --- a/test cases/common/118 shared module/nosyms.c +++ /dev/null @@ -1,4 +0,0 @@ -static int -func_not_exported (void) { - return 99; -} diff --git a/test cases/common/118 shared module/prog.c b/test cases/common/118 shared module/prog.c deleted file mode 100644 index 4741185..0000000 --- a/test cases/common/118 shared module/prog.c +++ /dev/null @@ -1,103 +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; - if(argc==0) {}; - - 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; - if(argc==0) {}; - - 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/118 shared module/runtime.c b/test cases/common/118 shared module/runtime.c deleted file mode 100644 index 03bde86..0000000 --- a/test cases/common/118 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/118 shared module/test.json b/test cases/common/118 shared module/test.json deleted file mode 100644 index 33bfeff..0000000 --- a/test cases/common/118 shared module/test.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "installed": [ - {"type": "expr", "file": "usr/lib/modules/libnosyms?so"}, - {"type": "implibempty", "file": "usr/lib/modules/libnosyms"}, - {"type": "pdb", "file": "usr/lib/modules/nosyms"} - ] -} diff --git a/test cases/common/119 cpp and asm/meson.build b/test cases/common/119 cpp and asm/meson.build new file mode 100644 index 0000000..99713d4 --- /dev/null +++ b/test cases/common/119 cpp and asm/meson.build @@ -0,0 +1,33 @@ +project('c++ and assembly test') +add_languages('cpp') + +if meson.backend() == 'xcode' + error('MESON_SKIP_TEST: asm not supported with the Xcode backend. Patches welcome.') +endif + +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/119 cpp and asm/retval-arm.S b/test cases/common/119 cpp and asm/retval-arm.S new file mode 100644 index 0000000..a892362 --- /dev/null +++ b/test cases/common/119 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/119 cpp and asm/retval-x86.S b/test cases/common/119 cpp and asm/retval-x86.S new file mode 100644 index 0000000..f9e8190 --- /dev/null +++ b/test cases/common/119 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/119 cpp and asm/retval-x86_64.S b/test cases/common/119 cpp and asm/retval-x86_64.S new file mode 100644 index 0000000..1a5f3eb --- /dev/null +++ b/test cases/common/119 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/119 cpp and asm/symbol-underscore.h b/test cases/common/119 cpp and asm/symbol-underscore.h new file mode 100644 index 0000000..d0f3ef9 --- /dev/null +++ b/test cases/common/119 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/119 cpp and asm/trivial.cc b/test cases/common/119 cpp and asm/trivial.cc new file mode 100644 index 0000000..19d5e94 --- /dev/null +++ b/test cases/common/119 cpp and asm/trivial.cc @@ -0,0 +1,16 @@ +#include + +extern "C" { + int get_retval(void); +} + +int main(void) { + 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/119 llvm ir and assembly/main.c b/test cases/common/119 llvm ir and assembly/main.c deleted file mode 100644 index 35e8ed6..0000000 --- a/test cases/common/119 llvm ir and assembly/main.c +++ /dev/null @@ -1,13 +0,0 @@ -#include - -unsigned square_unsigned (unsigned a); - -int main(void) -{ - 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/119 llvm ir and assembly/main.cpp b/test cases/common/119 llvm ir and assembly/main.cpp deleted file mode 100644 index aac3cbf..0000000 --- a/test cases/common/119 llvm ir and assembly/main.cpp +++ /dev/null @@ -1,15 +0,0 @@ -#include - -extern "C" { - unsigned square_unsigned (unsigned a); -} - -int main (void) -{ - 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/119 llvm ir and assembly/meson.build b/test cases/common/119 llvm ir and assembly/meson.build deleted file mode 100644 index 2aec7f0..0000000 --- a/test cases/common/119 llvm ir and assembly/meson.build +++ /dev/null @@ -1,79 +0,0 @@ -project('llvm-ir', 'c', 'cpp') - -if meson.backend() == 'xcode' - error('MESON_SKIP_TEST: asm not supported with the Xcode backend. Patches welcome.') -endif - -cpu = host_machine.cpu_family() -supported_cpus = ['arm', 'aarch64', '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 ml.exe or armasm.exe - # assembler. Then we can link it into the executable. - if cc.get_argument_syntax() == 'msvc' - cl = cc.cmd_array() - if cpu == 'x86' - asmcmd = 'ml' - elif cpu == 'x86_64' - asmcmd = 'ml64' - elif cpu == 'aarch64' - asmcmd = 'armasm64' - elif cpu == 'arm' - asmcmd = 'armasm' - else - error('Unsupported cpu family: "' + cpu + '"') - endif - ml = find_program(asmcmd, required: false) - if not ml.found() - error('MESON_SKIP_TEST: Microsoft assembler (ml/armasm) 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 - if asmcmd.startswith('armasm') - square_impl = custom_target(lang + square_impl, - input : square_preproc, - output : lang + square_base + '.obj', - command : [ml, '-nologo', '-o', '@OUTPUT@', '@INPUT@']) - else - square_impl = custom_target(lang + square_impl, - input : square_preproc, - output : lang + square_base + '.obj', - command : [ml, '/nologo', '/safeseh', '/Fo', '@OUTPUT@', '/c', '@INPUT@']) - endif - 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/119 llvm ir and assembly/square-aarch64.S b/test cases/common/119 llvm ir and assembly/square-aarch64.S deleted file mode 100644 index 02f1a12..0000000 --- a/test cases/common/119 llvm ir and assembly/square-aarch64.S +++ /dev/null @@ -1,29 +0,0 @@ -#include "symbol-underscore.h" - -#ifdef _MSC_VER - - AREA _TEXT, ARM64, CODE, READONLY - - EXPORT SYMBOL_NAME(square_unsigned) -SYMBOL_NAME(square_unsigned) PROC - mul x1, x0, x0 - mov x0, x1 - ret -SYMBOL_NAME(square_unsigned) ENDP - - END - -#else - -.text -.globl SYMBOL_NAME(square_unsigned) -# ifdef __linux__ -.type square_unsigned, %function -#endif - -SYMBOL_NAME(square_unsigned): - mul x1, x0, x0 - mov x0, x1 - ret - -#endif diff --git a/test cases/common/119 llvm ir and assembly/square-arm.S b/test cases/common/119 llvm ir and assembly/square-arm.S deleted file mode 100644 index aea3f1f..0000000 --- a/test cases/common/119 llvm ir and assembly/square-arm.S +++ /dev/null @@ -1,29 +0,0 @@ -#include "symbol-underscore.h" - -#ifdef _MSC_VER - - AREA _TEXT, ARM, CODE, READONLY - - EXPORT SYMBOL_NAME(square_unsigned) -SYMBOL_NAME(square_unsigned) PROC - mul r1, r0, r0 - mov r0, r1 - mov pc, lr -SYMBOL_NAME(square_unsigned) ENDP - - END - -#else - -.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 - -#endif diff --git a/test cases/common/119 llvm ir and assembly/square-x86.S b/test cases/common/119 llvm ir and assembly/square-x86.S deleted file mode 100644 index 18284c1..0000000 --- a/test cases/common/119 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/119 llvm ir and assembly/square-x86_64.S b/test cases/common/119 llvm ir and assembly/square-x86_64.S deleted file mode 100644 index 5678d00..0000000 --- a/test cases/common/119 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/119 llvm ir and assembly/square.ll b/test cases/common/119 llvm ir and assembly/square.ll deleted file mode 100644 index 7c321aa..0000000 --- a/test cases/common/119 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/119 llvm ir and assembly/symbol-underscore.h b/test cases/common/119 llvm ir and assembly/symbol-underscore.h deleted file mode 100644 index d0f3ef9..0000000 --- a/test cases/common/119 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/120 cpp and asm/meson.build b/test cases/common/120 cpp and asm/meson.build deleted file mode 100644 index 99713d4..0000000 --- a/test cases/common/120 cpp and asm/meson.build +++ /dev/null @@ -1,33 +0,0 @@ -project('c++ and assembly test') -add_languages('cpp') - -if meson.backend() == 'xcode' - error('MESON_SKIP_TEST: asm not supported with the Xcode backend. Patches welcome.') -endif - -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/120 cpp and asm/retval-arm.S b/test cases/common/120 cpp and asm/retval-arm.S deleted file mode 100644 index a892362..0000000 --- a/test cases/common/120 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/120 cpp and asm/retval-x86.S b/test cases/common/120 cpp and asm/retval-x86.S deleted file mode 100644 index f9e8190..0000000 --- a/test cases/common/120 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/120 cpp and asm/retval-x86_64.S b/test cases/common/120 cpp and asm/retval-x86_64.S deleted file mode 100644 index 1a5f3eb..0000000 --- a/test cases/common/120 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/120 cpp and asm/symbol-underscore.h b/test cases/common/120 cpp and asm/symbol-underscore.h deleted file mode 100644 index d0f3ef9..0000000 --- a/test cases/common/120 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/120 cpp and asm/trivial.cc b/test cases/common/120 cpp and asm/trivial.cc deleted file mode 100644 index 19d5e94..0000000 --- a/test cases/common/120 cpp and asm/trivial.cc +++ /dev/null @@ -1,16 +0,0 @@ -#include - -extern "C" { - int get_retval(void); -} - -int main(void) { - 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/120 extract all shared library/extractor.h b/test cases/common/120 extract all shared library/extractor.h new file mode 100644 index 0000000..cfb7ff6 --- /dev/null +++ b/test cases/common/120 extract all shared library/extractor.h @@ -0,0 +1,6 @@ +#pragma once + +int func1(void); +int func2(void); +int func3(void); +int func4(void); diff --git a/test cases/common/120 extract all shared library/four.c b/test cases/common/120 extract all shared library/four.c new file mode 100644 index 0000000..f67a85e --- /dev/null +++ b/test cases/common/120 extract all shared library/four.c @@ -0,0 +1,5 @@ +#include"extractor.h" + +int func4(void) { + return 4; +} diff --git a/test cases/common/120 extract all shared library/func1234.def b/test cases/common/120 extract all shared library/func1234.def new file mode 100644 index 0000000..d62c08d --- /dev/null +++ b/test cases/common/120 extract all shared library/func1234.def @@ -0,0 +1,5 @@ +EXPORTS + func1 + func2 + func3 + func4 diff --git a/test cases/common/120 extract all shared library/meson.build b/test cases/common/120 extract all shared library/meson.build new file mode 100644 index 0000000..340c031 --- /dev/null +++ b/test cases/common/120 extract all shared library/meson.build @@ -0,0 +1,14 @@ +project('extract all', 'c', 'cpp') + +if meson.backend() == 'xcode' + error('MESON_SKIP_TEST: Xcode backend does not handle libraries with only objects, not sources.') +endif + +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/120 extract all shared library/one.c b/test cases/common/120 extract all shared library/one.c new file mode 100644 index 0000000..152a145 --- /dev/null +++ b/test cases/common/120 extract all shared library/one.c @@ -0,0 +1,5 @@ +#include"extractor.h" + +int func1(void) { + return 1; +} diff --git a/test cases/common/120 extract all shared library/prog.c b/test cases/common/120 extract all shared library/prog.c new file mode 100644 index 0000000..de0cc7f --- /dev/null +++ b/test cases/common/120 extract all shared library/prog.c @@ -0,0 +1,10 @@ +#include"extractor.h" +#include + +int main(void) { + if((1+2+3+4) != (func1() + func2() + func3() + func4())) { + printf("Arithmetic is fail.\n"); + return 1; + } + return 0; +} diff --git a/test cases/common/120 extract all shared library/three.c b/test cases/common/120 extract all shared library/three.c new file mode 100644 index 0000000..24604ed --- /dev/null +++ b/test cases/common/120 extract all shared library/three.c @@ -0,0 +1,5 @@ +#include"extractor.h" + +int func3(void) { + return 3; +} diff --git a/test cases/common/120 extract all shared library/two.c b/test cases/common/120 extract all shared library/two.c new file mode 100644 index 0000000..800cd2d --- /dev/null +++ b/test cases/common/120 extract all shared library/two.c @@ -0,0 +1,5 @@ +#include"extractor.h" + +int func2(void) { + return 2; +} diff --git a/test cases/common/121 extract all shared library/extractor.h b/test cases/common/121 extract all shared library/extractor.h deleted file mode 100644 index cfb7ff6..0000000 --- a/test cases/common/121 extract all shared library/extractor.h +++ /dev/null @@ -1,6 +0,0 @@ -#pragma once - -int func1(void); -int func2(void); -int func3(void); -int func4(void); diff --git a/test cases/common/121 extract all shared library/four.c b/test cases/common/121 extract all shared library/four.c deleted file mode 100644 index f67a85e..0000000 --- a/test cases/common/121 extract all shared library/four.c +++ /dev/null @@ -1,5 +0,0 @@ -#include"extractor.h" - -int func4(void) { - return 4; -} diff --git a/test cases/common/121 extract all shared library/func1234.def b/test cases/common/121 extract all shared library/func1234.def deleted file mode 100644 index d62c08d..0000000 --- a/test cases/common/121 extract all shared library/func1234.def +++ /dev/null @@ -1,5 +0,0 @@ -EXPORTS - func1 - func2 - func3 - func4 diff --git a/test cases/common/121 extract all shared library/meson.build b/test cases/common/121 extract all shared library/meson.build deleted file mode 100644 index 340c031..0000000 --- a/test cases/common/121 extract all shared library/meson.build +++ /dev/null @@ -1,14 +0,0 @@ -project('extract all', 'c', 'cpp') - -if meson.backend() == 'xcode' - error('MESON_SKIP_TEST: Xcode backend does not handle libraries with only objects, not sources.') -endif - -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/121 extract all shared library/one.c b/test cases/common/121 extract all shared library/one.c deleted file mode 100644 index 152a145..0000000 --- a/test cases/common/121 extract all shared library/one.c +++ /dev/null @@ -1,5 +0,0 @@ -#include"extractor.h" - -int func1(void) { - return 1; -} diff --git a/test cases/common/121 extract all shared library/prog.c b/test cases/common/121 extract all shared library/prog.c deleted file mode 100644 index de0cc7f..0000000 --- a/test cases/common/121 extract all shared library/prog.c +++ /dev/null @@ -1,10 +0,0 @@ -#include"extractor.h" -#include - -int main(void) { - if((1+2+3+4) != (func1() + func2() + func3() + func4())) { - printf("Arithmetic is fail.\n"); - return 1; - } - return 0; -} diff --git a/test cases/common/121 extract all shared library/three.c b/test cases/common/121 extract all shared library/three.c deleted file mode 100644 index 24604ed..0000000 --- a/test cases/common/121 extract all shared library/three.c +++ /dev/null @@ -1,5 +0,0 @@ -#include"extractor.h" - -int func3(void) { - return 3; -} diff --git a/test cases/common/121 extract all shared library/two.c b/test cases/common/121 extract all shared library/two.c deleted file mode 100644 index 800cd2d..0000000 --- a/test cases/common/121 extract all shared library/two.c +++ /dev/null @@ -1,5 +0,0 @@ -#include"extractor.h" - -int func2(void) { - return 2; -} diff --git a/test cases/common/121 object only target/meson.build b/test cases/common/121 object only target/meson.build new file mode 100644 index 0000000..e2ce43e --- /dev/null +++ b/test cases/common/121 object only target/meson.build @@ -0,0 +1,49 @@ +project('object generator', 'c') + +if meson.backend() == 'xcode' + error('MESON_SKIP_TEST object-only libraries not supported in Xcode. Patches welcome.') +endif + +# 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/121 object only target/obj_generator.py b/test cases/common/121 object only target/obj_generator.py new file mode 100755 index 0000000..afdbc09 --- /dev/null +++ b/test cases/common/121 object only target/obj_generator.py @@ -0,0 +1,20 @@ +#!/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] + elif sys.platform == 'sunos5': + cmd = [compiler, '-fpic', '-c', ifile, '-o', ofile] + else: + cmd = [compiler, '-c', ifile, '-o', ofile] + sys.exit(subprocess.call(cmd)) diff --git a/test cases/common/121 object only target/prog.c b/test cases/common/121 object only target/prog.c new file mode 100644 index 0000000..9841180 --- /dev/null +++ b/test cases/common/121 object only target/prog.c @@ -0,0 +1,7 @@ +int func1_in_obj(void); +int func2_in_obj(void); +int func3_in_obj(void); + +int main(void) { + return func1_in_obj() + func2_in_obj() + func3_in_obj(); +} diff --git a/test cases/common/121 object only target/source.c b/test cases/common/121 object only target/source.c new file mode 100644 index 0000000..1dc08e1 --- /dev/null +++ b/test cases/common/121 object only target/source.c @@ -0,0 +1,3 @@ +int func1_in_obj(void) { + return 0; +} diff --git a/test cases/common/121 object only target/source2.c b/test cases/common/121 object only target/source2.c new file mode 100644 index 0000000..8024b97 --- /dev/null +++ b/test cases/common/121 object only target/source2.c @@ -0,0 +1,3 @@ +int func2_in_obj(void) { + return 0; +} diff --git a/test cases/common/121 object only target/source2.def b/test cases/common/121 object only target/source2.def new file mode 100644 index 0000000..a993ab8 --- /dev/null +++ b/test cases/common/121 object only target/source2.def @@ -0,0 +1,2 @@ +EXPORTS + func2_in_obj diff --git a/test cases/common/121 object only target/source3.c b/test cases/common/121 object only target/source3.c new file mode 100644 index 0000000..c4362c4 --- /dev/null +++ b/test cases/common/121 object only target/source3.c @@ -0,0 +1,3 @@ +int func3_in_obj(void) { + return 0; +} diff --git a/test cases/common/121 object only target/test.json b/test cases/common/121 object only target/test.json new file mode 100644 index 0000000..135300d --- /dev/null +++ b/test cases/common/121 object only target/test.json @@ -0,0 +1,6 @@ +{ + "installed": [ + {"type": "exe", "file": "usr/bin/prog"}, + {"type": "pdb", "file": "usr/bin/prog"} + ] +} diff --git a/test cases/common/122 no buildincdir/include/header.h b/test cases/common/122 no buildincdir/include/header.h new file mode 100644 index 0000000..1170ee3 --- /dev/null +++ b/test cases/common/122 no buildincdir/include/header.h @@ -0,0 +1,3 @@ +#pragma once + +int foobar(void); diff --git a/test cases/common/122 no buildincdir/meson.build b/test cases/common/122 no buildincdir/meson.build new file mode 100644 index 0000000..53f1a7f --- /dev/null +++ b/test cases/common/122 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/122 no buildincdir/prog.c b/test cases/common/122 no buildincdir/prog.c new file mode 100644 index 0000000..b356f65 --- /dev/null +++ b/test cases/common/122 no buildincdir/prog.c @@ -0,0 +1,5 @@ +#include"header.h" + +int main(void) { + return 0; +} diff --git a/test cases/common/122 object only target/meson.build b/test cases/common/122 object only target/meson.build deleted file mode 100644 index e2ce43e..0000000 --- a/test cases/common/122 object only target/meson.build +++ /dev/null @@ -1,49 +0,0 @@ -project('object generator', 'c') - -if meson.backend() == 'xcode' - error('MESON_SKIP_TEST object-only libraries not supported in Xcode. Patches welcome.') -endif - -# 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/122 object only target/obj_generator.py b/test cases/common/122 object only target/obj_generator.py deleted file mode 100755 index afdbc09..0000000 --- a/test cases/common/122 object only target/obj_generator.py +++ /dev/null @@ -1,20 +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] - elif sys.platform == 'sunos5': - cmd = [compiler, '-fpic', '-c', ifile, '-o', ofile] - else: - cmd = [compiler, '-c', ifile, '-o', ofile] - sys.exit(subprocess.call(cmd)) diff --git a/test cases/common/122 object only target/prog.c b/test cases/common/122 object only target/prog.c deleted file mode 100644 index 9841180..0000000 --- a/test cases/common/122 object only target/prog.c +++ /dev/null @@ -1,7 +0,0 @@ -int func1_in_obj(void); -int func2_in_obj(void); -int func3_in_obj(void); - -int main(void) { - return func1_in_obj() + func2_in_obj() + func3_in_obj(); -} diff --git a/test cases/common/122 object only target/source.c b/test cases/common/122 object only target/source.c deleted file mode 100644 index 1dc08e1..0000000 --- a/test cases/common/122 object only target/source.c +++ /dev/null @@ -1,3 +0,0 @@ -int func1_in_obj(void) { - return 0; -} diff --git a/test cases/common/122 object only target/source2.c b/test cases/common/122 object only target/source2.c deleted file mode 100644 index 8024b97..0000000 --- a/test cases/common/122 object only target/source2.c +++ /dev/null @@ -1,3 +0,0 @@ -int func2_in_obj(void) { - return 0; -} diff --git a/test cases/common/122 object only target/source2.def b/test cases/common/122 object only target/source2.def deleted file mode 100644 index a993ab8..0000000 --- a/test cases/common/122 object only target/source2.def +++ /dev/null @@ -1,2 +0,0 @@ -EXPORTS - func2_in_obj diff --git a/test cases/common/122 object only target/source3.c b/test cases/common/122 object only target/source3.c deleted file mode 100644 index c4362c4..0000000 --- a/test cases/common/122 object only target/source3.c +++ /dev/null @@ -1,3 +0,0 @@ -int func3_in_obj(void) { - return 0; -} diff --git a/test cases/common/122 object only target/test.json b/test cases/common/122 object only target/test.json deleted file mode 100644 index 135300d..0000000 --- a/test cases/common/122 object only target/test.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "installed": [ - {"type": "exe", "file": "usr/bin/prog"}, - {"type": "pdb", "file": "usr/bin/prog"} - ] -} diff --git a/test cases/common/123 custom target directory install/docgen.py b/test cases/common/123 custom target directory install/docgen.py new file mode 100644 index 0000000..97a3f90 --- /dev/null +++ b/test cases/common/123 custom target directory install/docgen.py @@ -0,0 +1,15 @@ +#!/usr/bin/env python3 + +import os +import sys + +out = sys.argv[1] + +try: + os.mkdir(out) +except FileExistsError: + pass + +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/123 custom target directory install/meson.build b/test cases/common/123 custom target directory install/meson.build new file mode 100644 index 0000000..ada9ae1 --- /dev/null +++ b/test cases/common/123 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/123 custom target directory install/test.json b/test cases/common/123 custom target directory install/test.json new file mode 100644 index 0000000..c7eebf5 --- /dev/null +++ b/test cases/common/123 custom target directory install/test.json @@ -0,0 +1,7 @@ +{ + "installed": [ + {"type": "file", "file": "usr/share/doc/testpkgname/html/a.html"}, + {"type": "file", "file": "usr/share/doc/testpkgname/html/b.html"}, + {"type": "file", "file": "usr/share/doc/testpkgname/html/c.html"} + ] +} diff --git a/test cases/common/123 no buildincdir/include/header.h b/test cases/common/123 no buildincdir/include/header.h deleted file mode 100644 index 1170ee3..0000000 --- a/test cases/common/123 no buildincdir/include/header.h +++ /dev/null @@ -1,3 +0,0 @@ -#pragma once - -int foobar(void); diff --git a/test cases/common/123 no buildincdir/meson.build b/test cases/common/123 no buildincdir/meson.build deleted file mode 100644 index 53f1a7f..0000000 --- a/test cases/common/123 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/123 no buildincdir/prog.c b/test cases/common/123 no buildincdir/prog.c deleted file mode 100644 index b356f65..0000000 --- a/test cases/common/123 no buildincdir/prog.c +++ /dev/null @@ -1,5 +0,0 @@ -#include"header.h" - -int main(void) { - return 0; -} diff --git a/test cases/common/124 custom target directory install/docgen.py b/test cases/common/124 custom target directory install/docgen.py deleted file mode 100644 index 97a3f90..0000000 --- a/test cases/common/124 custom target directory install/docgen.py +++ /dev/null @@ -1,15 +0,0 @@ -#!/usr/bin/env python3 - -import os -import sys - -out = sys.argv[1] - -try: - os.mkdir(out) -except FileExistsError: - pass - -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/124 custom target directory install/meson.build b/test cases/common/124 custom target directory install/meson.build deleted file mode 100644 index ada9ae1..0000000 --- a/test cases/common/124 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/124 custom target directory install/test.json b/test cases/common/124 custom target directory install/test.json deleted file mode 100644 index c7eebf5..0000000 --- a/test cases/common/124 custom target directory install/test.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "installed": [ - {"type": "file", "file": "usr/share/doc/testpkgname/html/a.html"}, - {"type": "file", "file": "usr/share/doc/testpkgname/html/b.html"}, - {"type": "file", "file": "usr/share/doc/testpkgname/html/c.html"} - ] -} diff --git a/test cases/common/124 dependency file generation/main .c b/test cases/common/124 dependency file generation/main .c new file mode 100644 index 0000000..03b2213 --- /dev/null +++ b/test cases/common/124 dependency file generation/main .c @@ -0,0 +1,3 @@ +int main(void) { + return 0; +} diff --git a/test cases/common/124 dependency file generation/meson.build b/test cases/common/124 dependency file generation/meson.build new file mode 100644 index 0000000..b5ee47b --- /dev/null +++ b/test cases/common/124 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/125 configure file in generator/inc/confdata.in b/test cases/common/125 configure file in generator/inc/confdata.in new file mode 100644 index 0000000..e44cdea --- /dev/null +++ b/test cases/common/125 configure file in generator/inc/confdata.in @@ -0,0 +1 @@ +@VALUE@ diff --git a/test cases/common/125 configure file in generator/inc/meson.build b/test cases/common/125 configure file in generator/inc/meson.build new file mode 100644 index 0000000..05d2dcb --- /dev/null +++ b/test cases/common/125 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/125 configure file in generator/meson.build b/test cases/common/125 configure file in generator/meson.build new file mode 100644 index 0000000..e1c26b6 --- /dev/null +++ b/test cases/common/125 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/125 configure file in generator/src/gen.py b/test cases/common/125 configure file in generator/src/gen.py new file mode 100755 index 0000000..426d0b7 --- /dev/null +++ b/test cases/common/125 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) 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/125 configure file in generator/src/main.c b/test cases/common/125 configure file in generator/src/main.c new file mode 100644 index 0000000..6329e47 --- /dev/null +++ b/test cases/common/125 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(void) { + return 0; +} diff --git a/test cases/common/125 configure file in generator/src/meson.build b/test cases/common/125 configure file in generator/src/meson.build new file mode 100644 index 0000000..2fb804e --- /dev/null +++ b/test cases/common/125 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/125 configure file in generator/src/source b/test cases/common/125 configure file in generator/src/source new file mode 100644 index 0000000..4099407 --- /dev/null +++ b/test cases/common/125 configure file in generator/src/source @@ -0,0 +1 @@ +23 diff --git a/test cases/common/125 dependency file generation/main .c b/test cases/common/125 dependency file generation/main .c deleted file mode 100644 index 03b2213..0000000 --- a/test cases/common/125 dependency file generation/main .c +++ /dev/null @@ -1,3 +0,0 @@ -int main(void) { - return 0; -} diff --git a/test cases/common/125 dependency file generation/meson.build b/test cases/common/125 dependency file generation/meson.build deleted file mode 100644 index b5ee47b..0000000 --- a/test cases/common/125 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/126 configure file in generator/inc/confdata.in b/test cases/common/126 configure file in generator/inc/confdata.in deleted file mode 100644 index e44cdea..0000000 --- a/test cases/common/126 configure file in generator/inc/confdata.in +++ /dev/null @@ -1 +0,0 @@ -@VALUE@ diff --git a/test cases/common/126 configure file in generator/inc/meson.build b/test cases/common/126 configure file in generator/inc/meson.build deleted file mode 100644 index 05d2dcb..0000000 --- a/test cases/common/126 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/126 configure file in generator/meson.build b/test cases/common/126 configure file in generator/meson.build deleted file mode 100644 index e1c26b6..0000000 --- a/test cases/common/126 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/126 configure file in generator/src/gen.py b/test cases/common/126 configure file in generator/src/gen.py deleted file mode 100755 index 426d0b7..0000000 --- a/test cases/common/126 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) 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/126 configure file in generator/src/main.c b/test cases/common/126 configure file in generator/src/main.c deleted file mode 100644 index 6329e47..0000000 --- a/test cases/common/126 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(void) { - return 0; -} diff --git a/test cases/common/126 configure file in generator/src/meson.build b/test cases/common/126 configure file in generator/src/meson.build deleted file mode 100644 index 2fb804e..0000000 --- a/test cases/common/126 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/126 configure file in generator/src/source b/test cases/common/126 configure file in generator/src/source deleted file mode 100644 index 4099407..0000000 --- a/test cases/common/126 configure file in generator/src/source +++ /dev/null @@ -1 +0,0 @@ -23 diff --git a/test cases/common/126 generated llvm ir/copyfile.py b/test cases/common/126 generated llvm ir/copyfile.py new file mode 100644 index 0000000..ff42ac3 --- /dev/null +++ b/test cases/common/126 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/126 generated llvm ir/main.c b/test cases/common/126 generated llvm ir/main.c new file mode 100644 index 0000000..35e8ed6 --- /dev/null +++ b/test cases/common/126 generated llvm ir/main.c @@ -0,0 +1,13 @@ +#include + +unsigned square_unsigned (unsigned a); + +int main(void) +{ + 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/126 generated llvm ir/meson.build b/test cases/common/126 generated llvm ir/meson.build new file mode 100644 index 0000000..e5c68bc --- /dev/null +++ b/test cases/common/126 generated llvm ir/meson.build @@ -0,0 +1,28 @@ +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 + +if meson.backend() == 'xcode' + error('MESON_SKIP_TEST: LLMV ir not supported with the Xcode backend. Patches welcome.') +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/126 generated llvm ir/square.ll.in b/test cases/common/126 generated llvm ir/square.ll.in new file mode 100644 index 0000000..7c321aa --- /dev/null +++ b/test cases/common/126 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/127 generated assembly/copyfile.py b/test cases/common/127 generated assembly/copyfile.py new file mode 100644 index 0000000..ff42ac3 --- /dev/null +++ b/test cases/common/127 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/127 generated assembly/empty.c b/test cases/common/127 generated assembly/empty.c new file mode 100644 index 0000000..e69de29 diff --git a/test cases/common/127 generated assembly/main.c b/test cases/common/127 generated assembly/main.c new file mode 100644 index 0000000..fb38f9d --- /dev/null +++ b/test cases/common/127 generated assembly/main.c @@ -0,0 +1,16 @@ +#include + +#if defined(_WIN32) || defined(__CYGWIN__) + __declspec(dllimport) +#endif +unsigned square_unsigned (unsigned a); + +int main(void) +{ + 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/127 generated assembly/meson.build b/test cases/common/127 generated assembly/meson.build new file mode 100644 index 0000000..9d406cf --- /dev/null +++ b/test cases/common/127 generated assembly/meson.build @@ -0,0 +1,70 @@ +project('generated assembly', 'c') + +cc = meson.get_compiler('c') + +if build_machine.system() == 'cygwin' + error('MESON_SKIP_TEST: Cygwin is broken and nobody knows how to fix it. Patches welcome.') +endif + +if ['msvc', 'intel-cl'].contains(cc.get_id()) + error('MESON_SKIP_TEST: assembly files cannot be compiled directly by the compiler') +endif + +if meson.backend() == 'xcode' + error('MESON_SKIP_TEST: asm not supported with the Xcode backend. Patches welcome.') +endif + + +crt_workaround = [] +if cc.get_linker_id() == 'lld-link' + # It seems that when building without a .c file, lld-link.exe + # misses the fact that it needs to include the c runtime to + # make a working .dll. So here we add an empty .c file to easily + # pull in crt. + crt_workaround += 'empty.c' + if host_machine.cpu_family() == 'x86' + # x86 assembly needs manual annotation to be compatible with + # Safe Exception Handlers (?) This assembly doesn't have such + # annotation, so just disable the feature. + add_project_link_arguments('/SAFESEH:NO', language : 'c') + endif +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.get_id() == 'clang-cl' and cc.version().version_compare('< 12.0.0') and cpu == 'arm' + # https://reviews.llvm.org/D89622 + error('MESON_SKIP_TEST: arm debug symbols not supported in clang-cl < 12.0.0') +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', crt_workaround + [copygen.process(input)], + vs_module_defs: 'square.def') + +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', crt_workaround + [copyct], + vs_module_defs: 'square.def') + +test('square-ct-test', executable('square-ct-test', 'main.c', link_with : l)) diff --git a/test cases/common/127 generated assembly/square-arm.S.in b/test cases/common/127 generated assembly/square-arm.S.in new file mode 100644 index 0000000..d2fb7ac --- /dev/null +++ b/test cases/common/127 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/127 generated assembly/square-x86.S.in b/test cases/common/127 generated assembly/square-x86.S.in new file mode 100644 index 0000000..1a48fc4 --- /dev/null +++ b/test cases/common/127 generated assembly/square-x86.S.in @@ -0,0 +1,34 @@ +#include "symbol-underscore.h" + +#if defined(_MSC_VER) && !defined(__clang__) + +.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/127 generated assembly/square-x86_64.S.in b/test cases/common/127 generated assembly/square-x86_64.S.in new file mode 100644 index 0000000..d504341 --- /dev/null +++ b/test cases/common/127 generated assembly/square-x86_64.S.in @@ -0,0 +1,38 @@ +#include "symbol-underscore.h" + +#if defined(_MSC_VER) && !defined(__clang__) /* 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__) || defined(__sun) +.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/127 generated assembly/square.def b/test cases/common/127 generated assembly/square.def new file mode 100644 index 0000000..79f3d65 --- /dev/null +++ b/test cases/common/127 generated assembly/square.def @@ -0,0 +1,2 @@ +EXPORTS + square_unsigned diff --git a/test cases/common/127 generated assembly/symbol-underscore.h b/test cases/common/127 generated assembly/symbol-underscore.h new file mode 100644 index 0000000..d0f3ef9 --- /dev/null +++ b/test cases/common/127 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/127 generated llvm ir/copyfile.py b/test cases/common/127 generated llvm ir/copyfile.py deleted file mode 100644 index ff42ac3..0000000 --- a/test cases/common/127 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/127 generated llvm ir/main.c b/test cases/common/127 generated llvm ir/main.c deleted file mode 100644 index 35e8ed6..0000000 --- a/test cases/common/127 generated llvm ir/main.c +++ /dev/null @@ -1,13 +0,0 @@ -#include - -unsigned square_unsigned (unsigned a); - -int main(void) -{ - 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/127 generated llvm ir/meson.build b/test cases/common/127 generated llvm ir/meson.build deleted file mode 100644 index e5c68bc..0000000 --- a/test cases/common/127 generated llvm ir/meson.build +++ /dev/null @@ -1,28 +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 - -if meson.backend() == 'xcode' - error('MESON_SKIP_TEST: LLMV ir not supported with the Xcode backend. Patches welcome.') -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/127 generated llvm ir/square.ll.in b/test cases/common/127 generated llvm ir/square.ll.in deleted file mode 100644 index 7c321aa..0000000 --- a/test cases/common/127 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/128 build by default targets in tests/main.c b/test cases/common/128 build by default targets in tests/main.c new file mode 100644 index 0000000..03b2213 --- /dev/null +++ b/test cases/common/128 build by default targets in tests/main.c @@ -0,0 +1,3 @@ +int main(void) { + return 0; +} diff --git a/test cases/common/128 build by default targets in tests/meson.build b/test cases/common/128 build by default targets in tests/meson.build new file mode 100644 index 0000000..5cc5055 --- /dev/null +++ b/test cases/common/128 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/128 build by default targets in tests/write_file.py b/test cases/common/128 build by default targets in tests/write_file.py new file mode 100644 index 0000000..ff9c224 --- /dev/null +++ b/test cases/common/128 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/128 generated assembly/copyfile.py b/test cases/common/128 generated assembly/copyfile.py deleted file mode 100644 index ff42ac3..0000000 --- a/test cases/common/128 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/128 generated assembly/empty.c b/test cases/common/128 generated assembly/empty.c deleted file mode 100644 index e69de29..0000000 diff --git a/test cases/common/128 generated assembly/main.c b/test cases/common/128 generated assembly/main.c deleted file mode 100644 index fb38f9d..0000000 --- a/test cases/common/128 generated assembly/main.c +++ /dev/null @@ -1,16 +0,0 @@ -#include - -#if defined(_WIN32) || defined(__CYGWIN__) - __declspec(dllimport) -#endif -unsigned square_unsigned (unsigned a); - -int main(void) -{ - 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/128 generated assembly/meson.build b/test cases/common/128 generated assembly/meson.build deleted file mode 100644 index 9d406cf..0000000 --- a/test cases/common/128 generated assembly/meson.build +++ /dev/null @@ -1,70 +0,0 @@ -project('generated assembly', 'c') - -cc = meson.get_compiler('c') - -if build_machine.system() == 'cygwin' - error('MESON_SKIP_TEST: Cygwin is broken and nobody knows how to fix it. Patches welcome.') -endif - -if ['msvc', 'intel-cl'].contains(cc.get_id()) - error('MESON_SKIP_TEST: assembly files cannot be compiled directly by the compiler') -endif - -if meson.backend() == 'xcode' - error('MESON_SKIP_TEST: asm not supported with the Xcode backend. Patches welcome.') -endif - - -crt_workaround = [] -if cc.get_linker_id() == 'lld-link' - # It seems that when building without a .c file, lld-link.exe - # misses the fact that it needs to include the c runtime to - # make a working .dll. So here we add an empty .c file to easily - # pull in crt. - crt_workaround += 'empty.c' - if host_machine.cpu_family() == 'x86' - # x86 assembly needs manual annotation to be compatible with - # Safe Exception Handlers (?) This assembly doesn't have such - # annotation, so just disable the feature. - add_project_link_arguments('/SAFESEH:NO', language : 'c') - endif -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.get_id() == 'clang-cl' and cc.version().version_compare('< 12.0.0') and cpu == 'arm' - # https://reviews.llvm.org/D89622 - error('MESON_SKIP_TEST: arm debug symbols not supported in clang-cl < 12.0.0') -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', crt_workaround + [copygen.process(input)], - vs_module_defs: 'square.def') - -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', crt_workaround + [copyct], - vs_module_defs: 'square.def') - -test('square-ct-test', executable('square-ct-test', 'main.c', link_with : l)) diff --git a/test cases/common/128 generated assembly/square-arm.S.in b/test cases/common/128 generated assembly/square-arm.S.in deleted file mode 100644 index d2fb7ac..0000000 --- a/test cases/common/128 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/128 generated assembly/square-x86.S.in b/test cases/common/128 generated assembly/square-x86.S.in deleted file mode 100644 index 1a48fc4..0000000 --- a/test cases/common/128 generated assembly/square-x86.S.in +++ /dev/null @@ -1,34 +0,0 @@ -#include "symbol-underscore.h" - -#if defined(_MSC_VER) && !defined(__clang__) - -.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/128 generated assembly/square-x86_64.S.in b/test cases/common/128 generated assembly/square-x86_64.S.in deleted file mode 100644 index d504341..0000000 --- a/test cases/common/128 generated assembly/square-x86_64.S.in +++ /dev/null @@ -1,38 +0,0 @@ -#include "symbol-underscore.h" - -#if defined(_MSC_VER) && !defined(__clang__) /* 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__) || defined(__sun) -.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/128 generated assembly/square.def b/test cases/common/128 generated assembly/square.def deleted file mode 100644 index 79f3d65..0000000 --- a/test cases/common/128 generated assembly/square.def +++ /dev/null @@ -1,2 +0,0 @@ -EXPORTS - square_unsigned diff --git a/test cases/common/128 generated assembly/symbol-underscore.h b/test cases/common/128 generated assembly/symbol-underscore.h deleted file mode 100644 index d0f3ef9..0000000 --- a/test cases/common/128 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/129 build by default targets in tests/main.c b/test cases/common/129 build by default targets in tests/main.c deleted file mode 100644 index 03b2213..0000000 --- a/test cases/common/129 build by default targets in tests/main.c +++ /dev/null @@ -1,3 +0,0 @@ -int main(void) { - return 0; -} diff --git a/test cases/common/129 build by default targets in tests/meson.build b/test cases/common/129 build by default targets in tests/meson.build deleted file mode 100644 index 5cc5055..0000000 --- a/test cases/common/129 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/129 build by default targets in tests/write_file.py b/test cases/common/129 build by default targets in tests/write_file.py deleted file mode 100644 index ff9c224..0000000 --- a/test cases/common/129 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/129 build by default/checkexists.py b/test cases/common/129 build by default/checkexists.py new file mode 100644 index 0000000..6664f72 --- /dev/null +++ b/test cases/common/129 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/129 build by default/foo.c b/test cases/common/129 build by default/foo.c new file mode 100644 index 0000000..0322828 --- /dev/null +++ b/test cases/common/129 build by default/foo.c @@ -0,0 +1,6 @@ +#include + +int main(void) { + printf("Existentialism.\n"); + return 0; +} diff --git a/test cases/common/129 build by default/meson.build b/test cases/common/129 build by default/meson.build new file mode 100644 index 0000000..b28b634 --- /dev/null +++ b/test cases/common/129 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/129 build by default/mygen.py b/test cases/common/129 build by default/mygen.py new file mode 100644 index 0000000..5a74153 --- /dev/null +++ b/test cases/common/129 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/129 build by default/source.txt b/test cases/common/129 build by default/source.txt new file mode 100644 index 0000000..3573f4b --- /dev/null +++ b/test cases/common/129 build by default/source.txt @@ -0,0 +1 @@ +I am a bunch of text. diff --git a/test cases/common/130 build by default/checkexists.py b/test cases/common/130 build by default/checkexists.py deleted file mode 100644 index 6664f72..0000000 --- a/test cases/common/130 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/130 build by default/foo.c b/test cases/common/130 build by default/foo.c deleted file mode 100644 index 0322828..0000000 --- a/test cases/common/130 build by default/foo.c +++ /dev/null @@ -1,6 +0,0 @@ -#include - -int main(void) { - printf("Existentialism.\n"); - return 0; -} diff --git a/test cases/common/130 build by default/meson.build b/test cases/common/130 build by default/meson.build deleted file mode 100644 index b28b634..0000000 --- a/test cases/common/130 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/130 build by default/mygen.py b/test cases/common/130 build by default/mygen.py deleted file mode 100644 index 5a74153..0000000 --- a/test cases/common/130 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/130 build by default/source.txt b/test cases/common/130 build by default/source.txt deleted file mode 100644 index 3573f4b..0000000 --- a/test cases/common/130 build by default/source.txt +++ /dev/null @@ -1 +0,0 @@ -I am a bunch of text. diff --git a/test cases/common/130 include order/ctsub/copyfile.py b/test cases/common/130 include order/ctsub/copyfile.py new file mode 100644 index 0000000..ff42ac3 --- /dev/null +++ b/test cases/common/130 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/130 include order/ctsub/emptyfile.c b/test cases/common/130 include order/ctsub/emptyfile.c new file mode 100644 index 0000000..e69de29 diff --git a/test cases/common/130 include order/ctsub/main.h b/test cases/common/130 include order/ctsub/main.h new file mode 100644 index 0000000..9d9acf3 --- /dev/null +++ b/test cases/common/130 include order/ctsub/main.h @@ -0,0 +1 @@ +#error "ctsub/main.h included" diff --git a/test cases/common/130 include order/ctsub/meson.build b/test cases/common/130 include order/ctsub/meson.build new file mode 100644 index 0000000..a242e07 --- /dev/null +++ b/test cases/common/130 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/130 include order/inc1/hdr.h b/test cases/common/130 include order/inc1/hdr.h new file mode 100644 index 0000000..9d755a8 --- /dev/null +++ b/test cases/common/130 include order/inc1/hdr.h @@ -0,0 +1 @@ +#define SOME_DEFINE 42 diff --git a/test cases/common/130 include order/inc2/hdr.h b/test cases/common/130 include order/inc2/hdr.h new file mode 100644 index 0000000..2ebcaca --- /dev/null +++ b/test cases/common/130 include order/inc2/hdr.h @@ -0,0 +1 @@ +#undef SOME_DEFINE diff --git a/test cases/common/130 include order/meson.build b/test cases/common/130 include order/meson.build new file mode 100644 index 0000000..9f275b8 --- /dev/null +++ b/test cases/common/130 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/130 include order/ordertest.c b/test cases/common/130 include order/ordertest.c new file mode 100644 index 0000000..775e34f --- /dev/null +++ b/test cases/common/130 include order/ordertest.c @@ -0,0 +1,10 @@ +#include "hdr.h" + +#if !defined(SOME_DEFINE) || SOME_DEFINE != 42 +#error "Should have picked up hdr.h from inc1/hdr.h" +#endif + +int main(void) +{ + return 0; +} diff --git a/test cases/common/130 include order/sub1/main.h b/test cases/common/130 include order/sub1/main.h new file mode 100644 index 0000000..acf4a35 --- /dev/null +++ b/test cases/common/130 include order/sub1/main.h @@ -0,0 +1 @@ +#error "sub1/main.h included" diff --git a/test cases/common/130 include order/sub1/meson.build b/test cases/common/130 include order/sub1/meson.build new file mode 100644 index 0000000..9672945 --- /dev/null +++ b/test cases/common/130 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/130 include order/sub1/some.c b/test cases/common/130 include order/sub1/some.c new file mode 100644 index 0000000..1ab0db4 --- /dev/null +++ b/test cases/common/130 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/130 include order/sub1/some.h b/test cases/common/130 include order/sub1/some.h new file mode 100644 index 0000000..6479492 --- /dev/null +++ b/test cases/common/130 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/130 include order/sub2/main.h b/test cases/common/130 include order/sub2/main.h new file mode 100644 index 0000000..b9c0da9 --- /dev/null +++ b/test cases/common/130 include order/sub2/main.h @@ -0,0 +1 @@ +#error "sub2/main.h included" diff --git a/test cases/common/130 include order/sub2/meson.build b/test cases/common/130 include order/sub2/meson.build new file mode 100644 index 0000000..b1e6190 --- /dev/null +++ b/test cases/common/130 include order/sub2/meson.build @@ -0,0 +1,2 @@ +j = include_directories('.') +wronginc = declare_dependency(include_directories : j) diff --git a/test cases/common/130 include order/sub3/main.h b/test cases/common/130 include order/sub3/main.h new file mode 100644 index 0000000..1ab7231 --- /dev/null +++ b/test cases/common/130 include order/sub3/main.h @@ -0,0 +1 @@ +#error "sub3/main.h included" diff --git a/test cases/common/130 include order/sub3/meson.build b/test cases/common/130 include order/sub3/meson.build new file mode 100644 index 0000000..0bd3906 --- /dev/null +++ b/test cases/common/130 include order/sub3/meson.build @@ -0,0 +1 @@ +sub3 = meson.current_source_dir() diff --git a/test cases/common/130 include order/sub4/main.c b/test cases/common/130 include order/sub4/main.c new file mode 100644 index 0000000..89226a4 --- /dev/null +++ b/test cases/common/130 include order/sub4/main.c @@ -0,0 +1,8 @@ +/* Use the <> include notation to force searching in include directories */ +#include + +int main(void) { + if (somefunc() == 1984) + return 0; + return 1; +} diff --git a/test cases/common/130 include order/sub4/main.h b/test cases/common/130 include order/sub4/main.h new file mode 100644 index 0000000..194d7fe --- /dev/null +++ b/test cases/common/130 include order/sub4/main.h @@ -0,0 +1,3 @@ +#pragma once + +#include "some.h" diff --git a/test cases/common/130 include order/sub4/meson.build b/test cases/common/130 include order/sub4/meson.build new file mode 100644 index 0000000..c01edaa --- /dev/null +++ b/test cases/common/130 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/131 include order/ctsub/copyfile.py b/test cases/common/131 include order/ctsub/copyfile.py deleted file mode 100644 index ff42ac3..0000000 --- a/test cases/common/131 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/131 include order/ctsub/emptyfile.c b/test cases/common/131 include order/ctsub/emptyfile.c deleted file mode 100644 index e69de29..0000000 diff --git a/test cases/common/131 include order/ctsub/main.h b/test cases/common/131 include order/ctsub/main.h deleted file mode 100644 index 9d9acf3..0000000 --- a/test cases/common/131 include order/ctsub/main.h +++ /dev/null @@ -1 +0,0 @@ -#error "ctsub/main.h included" diff --git a/test cases/common/131 include order/ctsub/meson.build b/test cases/common/131 include order/ctsub/meson.build deleted file mode 100644 index a242e07..0000000 --- a/test cases/common/131 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/131 include order/inc1/hdr.h b/test cases/common/131 include order/inc1/hdr.h deleted file mode 100644 index 9d755a8..0000000 --- a/test cases/common/131 include order/inc1/hdr.h +++ /dev/null @@ -1 +0,0 @@ -#define SOME_DEFINE 42 diff --git a/test cases/common/131 include order/inc2/hdr.h b/test cases/common/131 include order/inc2/hdr.h deleted file mode 100644 index 2ebcaca..0000000 --- a/test cases/common/131 include order/inc2/hdr.h +++ /dev/null @@ -1 +0,0 @@ -#undef SOME_DEFINE diff --git a/test cases/common/131 include order/meson.build b/test cases/common/131 include order/meson.build deleted file mode 100644 index 9f275b8..0000000 --- a/test cases/common/131 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/131 include order/ordertest.c b/test cases/common/131 include order/ordertest.c deleted file mode 100644 index 775e34f..0000000 --- a/test cases/common/131 include order/ordertest.c +++ /dev/null @@ -1,10 +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(void) -{ - return 0; -} diff --git a/test cases/common/131 include order/sub1/main.h b/test cases/common/131 include order/sub1/main.h deleted file mode 100644 index acf4a35..0000000 --- a/test cases/common/131 include order/sub1/main.h +++ /dev/null @@ -1 +0,0 @@ -#error "sub1/main.h included" diff --git a/test cases/common/131 include order/sub1/meson.build b/test cases/common/131 include order/sub1/meson.build deleted file mode 100644 index 9672945..0000000 --- a/test cases/common/131 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/131 include order/sub1/some.c b/test cases/common/131 include order/sub1/some.c deleted file mode 100644 index 1ab0db4..0000000 --- a/test cases/common/131 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/131 include order/sub1/some.h b/test cases/common/131 include order/sub1/some.h deleted file mode 100644 index 6479492..0000000 --- a/test cases/common/131 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/131 include order/sub2/main.h b/test cases/common/131 include order/sub2/main.h deleted file mode 100644 index b9c0da9..0000000 --- a/test cases/common/131 include order/sub2/main.h +++ /dev/null @@ -1 +0,0 @@ -#error "sub2/main.h included" diff --git a/test cases/common/131 include order/sub2/meson.build b/test cases/common/131 include order/sub2/meson.build deleted file mode 100644 index b1e6190..0000000 --- a/test cases/common/131 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/131 include order/sub3/main.h b/test cases/common/131 include order/sub3/main.h deleted file mode 100644 index 1ab7231..0000000 --- a/test cases/common/131 include order/sub3/main.h +++ /dev/null @@ -1 +0,0 @@ -#error "sub3/main.h included" diff --git a/test cases/common/131 include order/sub3/meson.build b/test cases/common/131 include order/sub3/meson.build deleted file mode 100644 index 0bd3906..0000000 --- a/test cases/common/131 include order/sub3/meson.build +++ /dev/null @@ -1 +0,0 @@ -sub3 = meson.current_source_dir() diff --git a/test cases/common/131 include order/sub4/main.c b/test cases/common/131 include order/sub4/main.c deleted file mode 100644 index 89226a4..0000000 --- a/test cases/common/131 include order/sub4/main.c +++ /dev/null @@ -1,8 +0,0 @@ -/* Use the <> include notation to force searching in include directories */ -#include - -int main(void) { - if (somefunc() == 1984) - return 0; - return 1; -} diff --git a/test cases/common/131 include order/sub4/main.h b/test cases/common/131 include order/sub4/main.h deleted file mode 100644 index 194d7fe..0000000 --- a/test cases/common/131 include order/sub4/main.h +++ /dev/null @@ -1,3 +0,0 @@ -#pragma once - -#include "some.h" diff --git a/test cases/common/131 include order/sub4/meson.build b/test cases/common/131 include order/sub4/meson.build deleted file mode 100644 index c01edaa..0000000 --- a/test cases/common/131 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/131 override options/four.c b/test cases/common/131 override options/four.c new file mode 100644 index 0000000..44e344f --- /dev/null +++ b/test cases/common/131 override options/four.c @@ -0,0 +1,9 @@ +int func(void); + +static int duplicate_func(void) { + return -4; +} + +int main(void) { + return duplicate_func() + func(); +} diff --git a/test cases/common/131 override options/meson.build b/test cases/common/131 override options/meson.build new file mode 100644 index 0000000..4dd8d79 --- /dev/null +++ b/test cases/common/131 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/131 override options/one.c b/test cases/common/131 override options/one.c new file mode 100644 index 0000000..6120d48 --- /dev/null +++ b/test cases/common/131 override options/one.c @@ -0,0 +1,3 @@ +static int hidden_func(void) { + return 0; +} diff --git a/test cases/common/131 override options/three.c b/test cases/common/131 override options/three.c new file mode 100644 index 0000000..094260e --- /dev/null +++ b/test cases/common/131 override options/three.c @@ -0,0 +1,7 @@ +static int duplicate_func(void) { + return 4; +} + +int func(void) { + return duplicate_func(); +} diff --git a/test cases/common/131 override options/two.c b/test cases/common/131 override options/two.c new file mode 100644 index 0000000..0f8048c --- /dev/null +++ b/test cases/common/131 override options/two.c @@ -0,0 +1,6 @@ +/* + * Requires a Unity build. Otherwise hidden_func is not specified. + */ +int main(void) { + return hidden_func(); +} diff --git a/test cases/common/132 get define/concat.h b/test cases/common/132 get define/concat.h new file mode 100644 index 0000000..6eb3e5e --- /dev/null +++ b/test cases/common/132 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/132 get define/meson.build b/test cases/common/132 get define/meson.build new file mode 100644 index 0000000..df3d02a --- /dev/null +++ b/test cases/common/132 get define/meson.build @@ -0,0 +1,104 @@ +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)) + elif host_system == 'sunos' + d = cc.get_define('__sun__') + assert(d == '1', '__sun__ 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/132 get define/meson_options.txt b/test cases/common/132 get define/meson_options.txt new file mode 100644 index 0000000..7d34a2e --- /dev/null +++ b/test cases/common/132 get define/meson_options.txt @@ -0,0 +1 @@ +option('MESON_TEST_DEFINE_VALUE', type : 'string', value : '') diff --git a/test cases/common/132 override options/four.c b/test cases/common/132 override options/four.c deleted file mode 100644 index 44e344f..0000000 --- a/test cases/common/132 override options/four.c +++ /dev/null @@ -1,9 +0,0 @@ -int func(void); - -static int duplicate_func(void) { - return -4; -} - -int main(void) { - return duplicate_func() + func(); -} diff --git a/test cases/common/132 override options/meson.build b/test cases/common/132 override options/meson.build deleted file mode 100644 index 4dd8d79..0000000 --- a/test cases/common/132 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/132 override options/one.c b/test cases/common/132 override options/one.c deleted file mode 100644 index 6120d48..0000000 --- a/test cases/common/132 override options/one.c +++ /dev/null @@ -1,3 +0,0 @@ -static int hidden_func(void) { - return 0; -} diff --git a/test cases/common/132 override options/three.c b/test cases/common/132 override options/three.c deleted file mode 100644 index 094260e..0000000 --- a/test cases/common/132 override options/three.c +++ /dev/null @@ -1,7 +0,0 @@ -static int duplicate_func(void) { - return 4; -} - -int func(void) { - return duplicate_func(); -} diff --git a/test cases/common/132 override options/two.c b/test cases/common/132 override options/two.c deleted file mode 100644 index 0f8048c..0000000 --- a/test cases/common/132 override options/two.c +++ /dev/null @@ -1,6 +0,0 @@ -/* - * Requires a Unity build. Otherwise hidden_func is not specified. - */ -int main(void) { - return hidden_func(); -} diff --git a/test cases/common/133 c cpp and asm/main.c b/test cases/common/133 c cpp and asm/main.c new file mode 100644 index 0000000..293258f --- /dev/null +++ b/test cases/common/133 c cpp and asm/main.c @@ -0,0 +1,8 @@ +#include + +int get_retval(void); + +int main(void) { + printf("C seems to be working.\n"); + return get_retval(); +} diff --git a/test cases/common/133 c cpp and asm/main.cpp b/test cases/common/133 c cpp and asm/main.cpp new file mode 100644 index 0000000..debb97a --- /dev/null +++ b/test cases/common/133 c cpp and asm/main.cpp @@ -0,0 +1,11 @@ +#include + +extern "C" { + int get_retval(void); + int get_cval(void); +} + +int main(void) { + std::cout << "C++ seems to be working." << std::endl; + return get_retval(); +} diff --git a/test cases/common/133 c cpp and asm/meson.build b/test cases/common/133 c cpp and asm/meson.build new file mode 100644 index 0000000..ca820e2 --- /dev/null +++ b/test cases/common/133 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/133 c cpp and asm/retval-arm.S b/test cases/common/133 c cpp and asm/retval-arm.S new file mode 100644 index 0000000..a892362 --- /dev/null +++ b/test cases/common/133 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/133 c cpp and asm/retval-x86.S b/test cases/common/133 c cpp and asm/retval-x86.S new file mode 100644 index 0000000..3cb0237 --- /dev/null +++ b/test cases/common/133 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/133 c cpp and asm/retval-x86_64.S b/test cases/common/133 c cpp and asm/retval-x86_64.S new file mode 100644 index 0000000..1a5f3eb --- /dev/null +++ b/test cases/common/133 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/133 c cpp and asm/somelib.c b/test cases/common/133 c cpp and asm/somelib.c new file mode 100644 index 0000000..e585b8e --- /dev/null +++ b/test cases/common/133 c cpp and asm/somelib.c @@ -0,0 +1,3 @@ +int get_cval (void) { + return 0; +} diff --git a/test cases/common/133 c cpp and asm/symbol-underscore.h b/test cases/common/133 c cpp and asm/symbol-underscore.h new file mode 100644 index 0000000..d0f3ef9 --- /dev/null +++ b/test cases/common/133 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/133 get define/concat.h b/test cases/common/133 get define/concat.h deleted file mode 100644 index 6eb3e5e..0000000 --- a/test cases/common/133 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/133 get define/meson.build b/test cases/common/133 get define/meson.build deleted file mode 100644 index df3d02a..0000000 --- a/test cases/common/133 get define/meson.build +++ /dev/null @@ -1,104 +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)) - elif host_system == 'sunos' - d = cc.get_define('__sun__') - assert(d == '1', '__sun__ 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/133 get define/meson_options.txt b/test cases/common/133 get define/meson_options.txt deleted file mode 100644 index 7d34a2e..0000000 --- a/test cases/common/133 get define/meson_options.txt +++ /dev/null @@ -1 +0,0 @@ -option('MESON_TEST_DEFINE_VALUE', type : 'string', value : '') diff --git a/test cases/common/134 c cpp and asm/main.c b/test cases/common/134 c cpp and asm/main.c deleted file mode 100644 index 293258f..0000000 --- a/test cases/common/134 c cpp and asm/main.c +++ /dev/null @@ -1,8 +0,0 @@ -#include - -int get_retval(void); - -int main(void) { - printf("C seems to be working.\n"); - return get_retval(); -} diff --git a/test cases/common/134 c cpp and asm/main.cpp b/test cases/common/134 c cpp and asm/main.cpp deleted file mode 100644 index debb97a..0000000 --- a/test cases/common/134 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(void) { - std::cout << "C++ seems to be working." << std::endl; - return get_retval(); -} diff --git a/test cases/common/134 c cpp and asm/meson.build b/test cases/common/134 c cpp and asm/meson.build deleted file mode 100644 index ca820e2..0000000 --- a/test cases/common/134 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/134 c cpp and asm/retval-arm.S b/test cases/common/134 c cpp and asm/retval-arm.S deleted file mode 100644 index a892362..0000000 --- a/test cases/common/134 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/134 c cpp and asm/retval-x86.S b/test cases/common/134 c cpp and asm/retval-x86.S deleted file mode 100644 index 3cb0237..0000000 --- a/test cases/common/134 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/134 c cpp and asm/retval-x86_64.S b/test cases/common/134 c cpp and asm/retval-x86_64.S deleted file mode 100644 index 1a5f3eb..0000000 --- a/test cases/common/134 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/134 c cpp and asm/somelib.c b/test cases/common/134 c cpp and asm/somelib.c deleted file mode 100644 index e585b8e..0000000 --- a/test cases/common/134 c cpp and asm/somelib.c +++ /dev/null @@ -1,3 +0,0 @@ -int get_cval (void) { - return 0; -} diff --git a/test cases/common/134 c cpp and asm/symbol-underscore.h b/test cases/common/134 c cpp and asm/symbol-underscore.h deleted file mode 100644 index d0f3ef9..0000000 --- a/test cases/common/134 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/134 compute int/config.h.in b/test cases/common/134 compute int/config.h.in new file mode 100644 index 0000000..0de63ab --- /dev/null +++ b/test cases/common/134 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/134 compute int/foobar.h b/test cases/common/134 compute int/foobar.h new file mode 100644 index 0000000..fd3cb5e --- /dev/null +++ b/test cases/common/134 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/134 compute int/meson.build b/test cases/common/134 compute int/meson.build new file mode 100644 index 0000000..89f4746 --- /dev/null +++ b/test cases/common/134 compute int/meson.build @@ -0,0 +1,46 @@ +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 ') + +# Regression test for the special case -1 that used to fail when cross compiling +assert(cc.compute_int('-1') == -1, 'compute_int(-1) failed') + +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/134 compute int/prog.c.in b/test cases/common/134 compute int/prog.c.in new file mode 100644 index 0000000..0983aff --- /dev/null +++ b/test cases/common/134 compute int/prog.c.in @@ -0,0 +1,25 @@ +#include "@CONFIG@" +#include +#include +#include +#include "foobar.h" + +int main(void) { + 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/135 compute int/config.h.in b/test cases/common/135 compute int/config.h.in deleted file mode 100644 index 0de63ab..0000000 --- a/test cases/common/135 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/135 compute int/foobar.h b/test cases/common/135 compute int/foobar.h deleted file mode 100644 index fd3cb5e..0000000 --- a/test cases/common/135 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/135 compute int/meson.build b/test cases/common/135 compute int/meson.build deleted file mode 100644 index 89f4746..0000000 --- a/test cases/common/135 compute int/meson.build +++ /dev/null @@ -1,46 +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 ') - -# Regression test for the special case -1 that used to fail when cross compiling -assert(cc.compute_int('-1') == -1, 'compute_int(-1) failed') - -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/135 compute int/prog.c.in b/test cases/common/135 compute int/prog.c.in deleted file mode 100644 index 0983aff..0000000 --- a/test cases/common/135 compute int/prog.c.in +++ /dev/null @@ -1,25 +0,0 @@ -#include "@CONFIG@" -#include -#include -#include -#include "foobar.h" - -int main(void) { - 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/135 custom target object output/meson.build b/test cases/common/135 custom target object output/meson.build new file mode 100644 index 0000000..ede165b --- /dev/null +++ b/test cases/common/135 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/135 custom target object output/obj_generator.py b/test cases/common/135 custom target object output/obj_generator.py new file mode 100644 index 0000000..a33872a --- /dev/null +++ b/test cases/common/135 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/135 custom target object output/objdir/meson.build b/test cases/common/135 custom target object output/objdir/meson.build new file mode 100644 index 0000000..0d7f6c2 --- /dev/null +++ b/test cases/common/135 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/135 custom target object output/objdir/source.c b/test cases/common/135 custom target object output/objdir/source.c new file mode 100644 index 0000000..1dc08e1 --- /dev/null +++ b/test cases/common/135 custom target object output/objdir/source.c @@ -0,0 +1,3 @@ +int func1_in_obj(void) { + return 0; +} diff --git a/test cases/common/135 custom target object output/progdir/meson.build b/test cases/common/135 custom target object output/progdir/meson.build new file mode 100644 index 0000000..4216c24 --- /dev/null +++ b/test cases/common/135 custom target object output/progdir/meson.build @@ -0,0 +1 @@ +e = executable('prog', 'prog.c', object) diff --git a/test cases/common/135 custom target object output/progdir/prog.c b/test cases/common/135 custom target object output/progdir/prog.c new file mode 100644 index 0000000..bc3caf3 --- /dev/null +++ b/test cases/common/135 custom target object output/progdir/prog.c @@ -0,0 +1,5 @@ +int func1_in_obj(void); + +int main(void) { + return func1_in_obj(); +} diff --git a/test cases/common/136 custom target object output/meson.build b/test cases/common/136 custom target object output/meson.build deleted file mode 100644 index ede165b..0000000 --- a/test cases/common/136 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/136 custom target object output/obj_generator.py b/test cases/common/136 custom target object output/obj_generator.py deleted file mode 100644 index a33872a..0000000 --- a/test cases/common/136 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/136 custom target object output/objdir/meson.build b/test cases/common/136 custom target object output/objdir/meson.build deleted file mode 100644 index 0d7f6c2..0000000 --- a/test cases/common/136 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/136 custom target object output/objdir/source.c b/test cases/common/136 custom target object output/objdir/source.c deleted file mode 100644 index 1dc08e1..0000000 --- a/test cases/common/136 custom target object output/objdir/source.c +++ /dev/null @@ -1,3 +0,0 @@ -int func1_in_obj(void) { - return 0; -} diff --git a/test cases/common/136 custom target object output/progdir/meson.build b/test cases/common/136 custom target object output/progdir/meson.build deleted file mode 100644 index 4216c24..0000000 --- a/test cases/common/136 custom target object output/progdir/meson.build +++ /dev/null @@ -1 +0,0 @@ -e = executable('prog', 'prog.c', object) diff --git a/test cases/common/136 custom target object output/progdir/prog.c b/test cases/common/136 custom target object output/progdir/prog.c deleted file mode 100644 index bc3caf3..0000000 --- a/test cases/common/136 custom target object output/progdir/prog.c +++ /dev/null @@ -1,5 +0,0 @@ -int func1_in_obj(void); - -int main(void) { - return func1_in_obj(); -} diff --git a/test cases/common/136 empty build file/meson.build b/test cases/common/136 empty build file/meson.build new file mode 100644 index 0000000..73d0397 --- /dev/null +++ b/test cases/common/136 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/136 empty build file/subdir/meson.build b/test cases/common/136 empty build file/subdir/meson.build new file mode 100644 index 0000000..e69de29 diff --git a/test cases/common/137 empty build file/meson.build b/test cases/common/137 empty build file/meson.build deleted file mode 100644 index 73d0397..0000000 --- a/test cases/common/137 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/137 empty build file/subdir/meson.build b/test cases/common/137 empty build file/subdir/meson.build deleted file mode 100644 index e69de29..0000000 diff --git a/test cases/common/137 whole archive/exe/meson.build b/test cases/common/137 whole archive/exe/meson.build new file mode 100644 index 0000000..91d298d --- /dev/null +++ b/test cases/common/137 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/137 whole archive/exe2/meson.build b/test cases/common/137 whole archive/exe2/meson.build new file mode 100644 index 0000000..9184864 --- /dev/null +++ b/test cases/common/137 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/137 whole archive/exe3/meson.build b/test cases/common/137 whole archive/exe3/meson.build new file mode 100644 index 0000000..82cf57e --- /dev/null +++ b/test cases/common/137 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/137 whole archive/exe4/meson.build b/test cases/common/137 whole archive/exe4/meson.build new file mode 100644 index 0000000..0781250 --- /dev/null +++ b/test cases/common/137 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/137 whole archive/func1.c b/test cases/common/137 whole archive/func1.c new file mode 100644 index 0000000..161c5da --- /dev/null +++ b/test cases/common/137 whole archive/func1.c @@ -0,0 +1,7 @@ +#define BUILDING_DLL + +#include + +int func1(void) { + return 42; +} diff --git a/test cases/common/137 whole archive/func2.c b/test cases/common/137 whole archive/func2.c new file mode 100644 index 0000000..4fe7150 --- /dev/null +++ b/test cases/common/137 whole archive/func2.c @@ -0,0 +1,7 @@ +#define BUILDING_DLL + +#include + +int func2(void) { + return 42; +} diff --git a/test cases/common/137 whole archive/meson.build b/test cases/common/137 whole archive/meson.build new file mode 100644 index 0000000..33fe1ea --- /dev/null +++ b/test cases/common/137 whole archive/meson.build @@ -0,0 +1,54 @@ +project('whole archive', 'c') + +if meson.backend() == 'xcode' + error('MESON_SKIP_TEST: whole-archive not supported in Xcode. Patches welcome.') +endif + +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/137 whole archive/mylib.h b/test cases/common/137 whole archive/mylib.h new file mode 100644 index 0000000..79ce585 --- /dev/null +++ b/test cases/common/137 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(void); +int DLL_PUBLIC func2(void); diff --git a/test cases/common/137 whole archive/prog.c b/test cases/common/137 whole archive/prog.c new file mode 100644 index 0000000..1f553e5 --- /dev/null +++ b/test cases/common/137 whole archive/prog.c @@ -0,0 +1,5 @@ +#include + +int main(void) { + return func1() - func2(); +} diff --git a/test cases/common/137 whole archive/sh_func2_dep_func1/meson.build b/test cases/common/137 whole archive/sh_func2_dep_func1/meson.build new file mode 100644 index 0000000..92baca6 --- /dev/null +++ b/test cases/common/137 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/137 whole archive/sh_func2_linked_func1/meson.build b/test cases/common/137 whole archive/sh_func2_linked_func1/meson.build new file mode 100644 index 0000000..2858f65 --- /dev/null +++ b/test cases/common/137 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/137 whole archive/sh_func2_transdep_func1/meson.build b/test cases/common/137 whole archive/sh_func2_transdep_func1/meson.build new file mode 100644 index 0000000..0703077 --- /dev/null +++ b/test cases/common/137 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/137 whole archive/sh_only_link_whole/meson.build b/test cases/common/137 whole archive/sh_only_link_whole/meson.build new file mode 100644 index 0000000..64baabd --- /dev/null +++ b/test cases/common/137 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/137 whole archive/st_func1/meson.build b/test cases/common/137 whole archive/st_func1/meson.build new file mode 100644 index 0000000..c84d781 --- /dev/null +++ b/test cases/common/137 whole archive/st_func1/meson.build @@ -0,0 +1 @@ +st_func1 = static_library('st_func1', '../func1.c') diff --git a/test cases/common/137 whole archive/st_func2/meson.build b/test cases/common/137 whole archive/st_func2/meson.build new file mode 100644 index 0000000..2732f96 --- /dev/null +++ b/test cases/common/137 whole archive/st_func2/meson.build @@ -0,0 +1 @@ +st_func2 = static_library('st_func2', '../func2.c') diff --git a/test cases/common/138 C and CPP link/dummy.c b/test cases/common/138 C and CPP link/dummy.c new file mode 100644 index 0000000..e69de29 diff --git a/test cases/common/138 C and CPP link/foo.c b/test cases/common/138 C and CPP link/foo.c new file mode 100644 index 0000000..77c7e39 --- /dev/null +++ b/test cases/common/138 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/138 C and CPP link/foo.cpp b/test cases/common/138 C and CPP link/foo.cpp new file mode 100644 index 0000000..9db7fb2 --- /dev/null +++ b/test cases/common/138 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/138 C and CPP link/foo.h b/test cases/common/138 C and CPP link/foo.h new file mode 100644 index 0000000..1ed8ce9 --- /dev/null +++ b/test cases/common/138 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/138 C and CPP link/foo.hpp b/test cases/common/138 C and CPP link/foo.hpp new file mode 100644 index 0000000..e47f01d --- /dev/null +++ b/test cases/common/138 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/138 C and CPP link/foobar.c b/test cases/common/138 C and CPP link/foobar.c new file mode 100644 index 0000000..27928bf --- /dev/null +++ b/test cases/common/138 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/138 C and CPP link/foobar.h b/test cases/common/138 C and CPP link/foobar.h new file mode 100644 index 0000000..6dcb096 --- /dev/null +++ b/test cases/common/138 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/138 C and CPP link/meson.build b/test cases/common/138 C and CPP link/meson.build new file mode 100644 index 0000000..32d1843 --- /dev/null +++ b/test cases/common/138 C and CPP link/meson.build @@ -0,0 +1,133 @@ +# 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']) + +if meson.backend() == 'xcode' + error('''MESON_SKIP_TEST: overriding link language is not supported in Xcode. + +If you really need this, then patches are welcome. The only known way is +to create a dummy C++ file in the meson-private directory and adding +that to the target's source list when needed. The primitives exist +but may need some tweaking. Grep for language_stdlib_only_link_flags to find +where this is handled in other backends.''') +endif + +# 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/138 C and CPP link/sub.c b/test cases/common/138 C and CPP link/sub.c new file mode 100644 index 0000000..7c078f8 --- /dev/null +++ b/test cases/common/138 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/138 C and CPP link/sub.h b/test cases/common/138 C and CPP link/sub.h new file mode 100644 index 0000000..5b02e17 --- /dev/null +++ b/test cases/common/138 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/138 whole archive/exe/meson.build b/test cases/common/138 whole archive/exe/meson.build deleted file mode 100644 index 91d298d..0000000 --- a/test cases/common/138 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/138 whole archive/exe2/meson.build b/test cases/common/138 whole archive/exe2/meson.build deleted file mode 100644 index 9184864..0000000 --- a/test cases/common/138 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/138 whole archive/exe3/meson.build b/test cases/common/138 whole archive/exe3/meson.build deleted file mode 100644 index 82cf57e..0000000 --- a/test cases/common/138 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/138 whole archive/exe4/meson.build b/test cases/common/138 whole archive/exe4/meson.build deleted file mode 100644 index 0781250..0000000 --- a/test cases/common/138 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/138 whole archive/func1.c b/test cases/common/138 whole archive/func1.c deleted file mode 100644 index 161c5da..0000000 --- a/test cases/common/138 whole archive/func1.c +++ /dev/null @@ -1,7 +0,0 @@ -#define BUILDING_DLL - -#include - -int func1(void) { - return 42; -} diff --git a/test cases/common/138 whole archive/func2.c b/test cases/common/138 whole archive/func2.c deleted file mode 100644 index 4fe7150..0000000 --- a/test cases/common/138 whole archive/func2.c +++ /dev/null @@ -1,7 +0,0 @@ -#define BUILDING_DLL - -#include - -int func2(void) { - return 42; -} diff --git a/test cases/common/138 whole archive/meson.build b/test cases/common/138 whole archive/meson.build deleted file mode 100644 index 33fe1ea..0000000 --- a/test cases/common/138 whole archive/meson.build +++ /dev/null @@ -1,54 +0,0 @@ -project('whole archive', 'c') - -if meson.backend() == 'xcode' - error('MESON_SKIP_TEST: whole-archive not supported in Xcode. Patches welcome.') -endif - -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/138 whole archive/mylib.h b/test cases/common/138 whole archive/mylib.h deleted file mode 100644 index 79ce585..0000000 --- a/test cases/common/138 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(void); -int DLL_PUBLIC func2(void); diff --git a/test cases/common/138 whole archive/prog.c b/test cases/common/138 whole archive/prog.c deleted file mode 100644 index 1f553e5..0000000 --- a/test cases/common/138 whole archive/prog.c +++ /dev/null @@ -1,5 +0,0 @@ -#include - -int main(void) { - return func1() - func2(); -} diff --git a/test cases/common/138 whole archive/sh_func2_dep_func1/meson.build b/test cases/common/138 whole archive/sh_func2_dep_func1/meson.build deleted file mode 100644 index 92baca6..0000000 --- a/test cases/common/138 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/138 whole archive/sh_func2_linked_func1/meson.build b/test cases/common/138 whole archive/sh_func2_linked_func1/meson.build deleted file mode 100644 index 2858f65..0000000 --- a/test cases/common/138 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/138 whole archive/sh_func2_transdep_func1/meson.build b/test cases/common/138 whole archive/sh_func2_transdep_func1/meson.build deleted file mode 100644 index 0703077..0000000 --- a/test cases/common/138 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/138 whole archive/sh_only_link_whole/meson.build b/test cases/common/138 whole archive/sh_only_link_whole/meson.build deleted file mode 100644 index 64baabd..0000000 --- a/test cases/common/138 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/138 whole archive/st_func1/meson.build b/test cases/common/138 whole archive/st_func1/meson.build deleted file mode 100644 index c84d781..0000000 --- a/test cases/common/138 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/138 whole archive/st_func2/meson.build b/test cases/common/138 whole archive/st_func2/meson.build deleted file mode 100644 index 2732f96..0000000 --- a/test cases/common/138 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/139 C and CPP link/dummy.c b/test cases/common/139 C and CPP link/dummy.c deleted file mode 100644 index e69de29..0000000 diff --git a/test cases/common/139 C and CPP link/foo.c b/test cases/common/139 C and CPP link/foo.c deleted file mode 100644 index 77c7e39..0000000 --- a/test cases/common/139 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/139 C and CPP link/foo.cpp b/test cases/common/139 C and CPP link/foo.cpp deleted file mode 100644 index 9db7fb2..0000000 --- a/test cases/common/139 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/139 C and CPP link/foo.h b/test cases/common/139 C and CPP link/foo.h deleted file mode 100644 index 1ed8ce9..0000000 --- a/test cases/common/139 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/139 C and CPP link/foo.hpp b/test cases/common/139 C and CPP link/foo.hpp deleted file mode 100644 index e47f01d..0000000 --- a/test cases/common/139 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/139 C and CPP link/foobar.c b/test cases/common/139 C and CPP link/foobar.c deleted file mode 100644 index 27928bf..0000000 --- a/test cases/common/139 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/139 C and CPP link/foobar.h b/test cases/common/139 C and CPP link/foobar.h deleted file mode 100644 index 6dcb096..0000000 --- a/test cases/common/139 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/139 C and CPP link/meson.build b/test cases/common/139 C and CPP link/meson.build deleted file mode 100644 index 32d1843..0000000 --- a/test cases/common/139 C and CPP link/meson.build +++ /dev/null @@ -1,133 +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']) - -if meson.backend() == 'xcode' - error('''MESON_SKIP_TEST: overriding link language is not supported in Xcode. - -If you really need this, then patches are welcome. The only known way is -to create a dummy C++ file in the meson-private directory and adding -that to the target's source list when needed. The primitives exist -but may need some tweaking. Grep for language_stdlib_only_link_flags to find -where this is handled in other backends.''') -endif - -# 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/139 C and CPP link/sub.c b/test cases/common/139 C and CPP link/sub.c deleted file mode 100644 index 7c078f8..0000000 --- a/test cases/common/139 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/139 C and CPP link/sub.h b/test cases/common/139 C and CPP link/sub.h deleted file mode 100644 index 5b02e17..0000000 --- a/test cases/common/139 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/139 mesonintrospect from scripts/check_env.py b/test cases/common/139 mesonintrospect from scripts/check_env.py new file mode 100644 index 0000000..61de546 --- /dev/null +++ b/test cases/common/139 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(f'{mesonintrospect!r} does not exist') + +if do_print: + print(some_executable, end='') diff --git a/test cases/common/139 mesonintrospect from scripts/check_introspection.py b/test cases/common/139 mesonintrospect from scripts/check_introspection.py new file mode 100644 index 0000000..851a415 --- /dev/null +++ b/test cases/common/139 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/139 mesonintrospect from scripts/meson.build b/test cases/common/139 mesonintrospect from scripts/meson.build new file mode 100644 index 0000000..1117672 --- /dev/null +++ b/test cases/common/139 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/140 custom target multiple outputs/generator.py b/test cases/common/140 custom target multiple outputs/generator.py new file mode 100755 index 0000000..39dbd11 --- /dev/null +++ b/test cases/common/140 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/140 custom target multiple outputs/meson.build b/test cases/common/140 custom target multiple outputs/meson.build new file mode 100644 index 0000000..3030505 --- /dev/null +++ b/test cases/common/140 custom target multiple outputs/meson.build @@ -0,0 +1,44 @@ +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]) + +targets = 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'))]) + +paths = [] +foreach i : targets.to_list() + paths += i.full_path() +endforeach + +# The Xcode backend has a different output naming scheme. +if meson.backend() == 'xcode' + assert(paths == [meson.project_build_root() / get_option('buildtype') / 'second.h', + meson.project_build_root() / get_option('buildtype') / 'second.sh']) + +# Skip on Windows because paths are not identical, '/' VS '\'. +elif host_machine.system() != 'windows' + assert(paths == [meson.current_build_dir() / 'second.h', + meson.current_build_dir() / 'second.sh']) +endif diff --git a/test cases/common/140 custom target multiple outputs/test.json b/test cases/common/140 custom target multiple outputs/test.json new file mode 100644 index 0000000..e59cb9f --- /dev/null +++ b/test cases/common/140 custom target multiple outputs/test.json @@ -0,0 +1,10 @@ +{ + "installed": [ + {"type": "file", "file": "usr/include/diff.h"}, + {"type": "file", "file": "usr/include/first.h"}, + {"type": "file", "file": "usr/bin/diff.sh"}, + {"type": "file", "file": "usr/bin/second.sh"}, + {"type": "file", "file": "opt/same.h"}, + {"type": "file", "file": "opt/same.sh"} + ] +} diff --git a/test cases/common/140 mesonintrospect from scripts/check_env.py b/test cases/common/140 mesonintrospect from scripts/check_env.py deleted file mode 100644 index 61de546..0000000 --- a/test cases/common/140 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(f'{mesonintrospect!r} does not exist') - -if do_print: - print(some_executable, end='') diff --git a/test cases/common/140 mesonintrospect from scripts/check_introspection.py b/test cases/common/140 mesonintrospect from scripts/check_introspection.py deleted file mode 100644 index 851a415..0000000 --- a/test cases/common/140 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/140 mesonintrospect from scripts/meson.build b/test cases/common/140 mesonintrospect from scripts/meson.build deleted file mode 100644 index 1117672..0000000 --- a/test cases/common/140 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/141 custom target multiple outputs/generator.py b/test cases/common/141 custom target multiple outputs/generator.py deleted file mode 100755 index 39dbd11..0000000 --- a/test cases/common/141 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/141 custom target multiple outputs/meson.build b/test cases/common/141 custom target multiple outputs/meson.build deleted file mode 100644 index 3030505..0000000 --- a/test cases/common/141 custom target multiple outputs/meson.build +++ /dev/null @@ -1,44 +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]) - -targets = 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'))]) - -paths = [] -foreach i : targets.to_list() - paths += i.full_path() -endforeach - -# The Xcode backend has a different output naming scheme. -if meson.backend() == 'xcode' - assert(paths == [meson.project_build_root() / get_option('buildtype') / 'second.h', - meson.project_build_root() / get_option('buildtype') / 'second.sh']) - -# Skip on Windows because paths are not identical, '/' VS '\'. -elif host_machine.system() != 'windows' - assert(paths == [meson.current_build_dir() / 'second.h', - meson.current_build_dir() / 'second.sh']) -endif diff --git a/test cases/common/141 custom target multiple outputs/test.json b/test cases/common/141 custom target multiple outputs/test.json deleted file mode 100644 index e59cb9f..0000000 --- a/test cases/common/141 custom target multiple outputs/test.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "installed": [ - {"type": "file", "file": "usr/include/diff.h"}, - {"type": "file", "file": "usr/include/first.h"}, - {"type": "file", "file": "usr/bin/diff.sh"}, - {"type": "file", "file": "usr/bin/second.sh"}, - {"type": "file", "file": "opt/same.h"}, - {"type": "file", "file": "opt/same.sh"} - ] -} diff --git a/test cases/common/141 special characters/arg-char-test.c b/test cases/common/141 special characters/arg-char-test.c new file mode 100644 index 0000000..04e02f8 --- /dev/null +++ b/test cases/common/141 special characters/arg-char-test.c @@ -0,0 +1,10 @@ +#include +#include + +int main(int argc, char **argv) { + char c = CHAR; + assert(argc == 2); + if (c != argv[1][0]) + fprintf(stderr, "Expected %x, got %x\n", (unsigned int) c, (unsigned int) argv[1][0]); + assert(c == argv[1][0]); +} diff --git a/test cases/common/141 special characters/arg-string-test.c b/test cases/common/141 special characters/arg-string-test.c new file mode 100644 index 0000000..199fd79 --- /dev/null +++ b/test cases/common/141 special characters/arg-string-test.c @@ -0,0 +1,12 @@ +#include +#include +#include + +int main(int argc, char **argv) { + const char *s = CHAR; + assert(argc == 2); + assert(strlen(s) == 1); + if (s[0] != argv[1][0]) + fprintf(stderr, "Expected %x, got %x\n", (unsigned int) s[0], (unsigned int) argv[1][0]); + assert(s[0] == argv[1][0]); +} diff --git a/test cases/common/141 special characters/arg-unquoted-test.c b/test cases/common/141 special characters/arg-unquoted-test.c new file mode 100644 index 0000000..7f679ca --- /dev/null +++ b/test cases/common/141 special characters/arg-unquoted-test.c @@ -0,0 +1,17 @@ +#include +#include +#include + +#define Q(x) #x +#define QUOTE(x) Q(x) + +int main(int argc, char **argv) { + const char *s = QUOTE(CHAR); + assert(argc == 2); + assert(strlen(s) == 1); + if (s[0] != argv[1][0]) + fprintf(stderr, "Expected %x, got %x\n", (unsigned int) s[0], (unsigned int) argv[1][0]); + assert(s[0] == argv[1][0]); + // There is no way to convert a macro argument into a character constant. + // Otherwise we'd test that as well +} diff --git a/test cases/common/141 special characters/check_quoting.py b/test cases/common/141 special characters/check_quoting.py new file mode 100644 index 0000000..d6e50ea --- /dev/null +++ b/test cases/common/141 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/141 special characters/meson.build b/test cases/common/141 special characters/meson.build new file mode 100644 index 0000000..579601e --- /dev/null +++ b/test cases/common/141 special characters/meson.build @@ -0,0 +1,75 @@ +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')) + +# Test that we can pass these special characters in compiler arguments +# +# (this part of the test is crafted so we don't try to use these special +# characters in filenames or target names) +# +# TODO: similar tests needed for languages other than C +# TODO: add similar test for quote, doublequote, and hash, carefully +# Re hash, see +# https://docs.microsoft.com/en-us/cpp/build/reference/d-preprocessor-definitions + +special = [ + ['amp', '&'], + ['at', '@'], + ['backslash', '\\'], + ['dollar', '$'], + ['gt', '>'], + ['lt', '<'], + ['slash', '/'], +] + +cc = meson.get_compiler('c') + +foreach s : special + args = '-DCHAR="@0@"'.format(s[1]) + e = executable('arg-string-' + s[0], 'arg-string-test.c', c_args: args) + test('arg-string-' + s[0], e, args: s[1]) + + args = '-DCHAR=@0@'.format(s[1]) + e = executable('arg-unquoted-' + s[0], 'arg-unquoted-test.c', c_args: args) + test('arg-unquoted-' + s[0], e, args: s[1]) +endforeach + +foreach s : special + args = '-DCHAR=\'@0@\''.format(s[1]) + e = executable('arg-char-' + s[0], 'arg-char-test.c', c_args: args) + test('arg-char-' + s[0], e, args: s[1]) +endforeach diff --git a/test cases/common/141 special characters/test.json b/test cases/common/141 special characters/test.json new file mode 100644 index 0000000..9709e5b --- /dev/null +++ b/test cases/common/141 special characters/test.json @@ -0,0 +1,6 @@ +{ + "installed": [ + {"type": "file", "file": "usr/share/result"}, + {"type": "file", "file": "usr/share/result2"} + ] +} diff --git a/test cases/common/142 nested links/meson.build b/test cases/common/142 nested links/meson.build new file mode 100644 index 0000000..0821b03 --- /dev/null +++ b/test cases/common/142 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/142 nested links/xephyr.c b/test cases/common/142 nested links/xephyr.c new file mode 100644 index 0000000..9b6bdc2 --- /dev/null +++ b/test cases/common/142 nested links/xephyr.c @@ -0,0 +1,3 @@ +int main(void) { + return 0; +} diff --git a/test cases/common/142 special characters/arg-char-test.c b/test cases/common/142 special characters/arg-char-test.c deleted file mode 100644 index 04e02f8..0000000 --- a/test cases/common/142 special characters/arg-char-test.c +++ /dev/null @@ -1,10 +0,0 @@ -#include -#include - -int main(int argc, char **argv) { - char c = CHAR; - assert(argc == 2); - if (c != argv[1][0]) - fprintf(stderr, "Expected %x, got %x\n", (unsigned int) c, (unsigned int) argv[1][0]); - assert(c == argv[1][0]); -} diff --git a/test cases/common/142 special characters/arg-string-test.c b/test cases/common/142 special characters/arg-string-test.c deleted file mode 100644 index 199fd79..0000000 --- a/test cases/common/142 special characters/arg-string-test.c +++ /dev/null @@ -1,12 +0,0 @@ -#include -#include -#include - -int main(int argc, char **argv) { - const char *s = CHAR; - assert(argc == 2); - assert(strlen(s) == 1); - if (s[0] != argv[1][0]) - fprintf(stderr, "Expected %x, got %x\n", (unsigned int) s[0], (unsigned int) argv[1][0]); - assert(s[0] == argv[1][0]); -} diff --git a/test cases/common/142 special characters/arg-unquoted-test.c b/test cases/common/142 special characters/arg-unquoted-test.c deleted file mode 100644 index 7f679ca..0000000 --- a/test cases/common/142 special characters/arg-unquoted-test.c +++ /dev/null @@ -1,17 +0,0 @@ -#include -#include -#include - -#define Q(x) #x -#define QUOTE(x) Q(x) - -int main(int argc, char **argv) { - const char *s = QUOTE(CHAR); - assert(argc == 2); - assert(strlen(s) == 1); - if (s[0] != argv[1][0]) - fprintf(stderr, "Expected %x, got %x\n", (unsigned int) s[0], (unsigned int) argv[1][0]); - assert(s[0] == argv[1][0]); - // There is no way to convert a macro argument into a character constant. - // Otherwise we'd test that as well -} diff --git a/test cases/common/142 special characters/check_quoting.py b/test cases/common/142 special characters/check_quoting.py deleted file mode 100644 index d6e50ea..0000000 --- a/test cases/common/142 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/142 special characters/meson.build b/test cases/common/142 special characters/meson.build deleted file mode 100644 index 579601e..0000000 --- a/test cases/common/142 special characters/meson.build +++ /dev/null @@ -1,75 +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')) - -# Test that we can pass these special characters in compiler arguments -# -# (this part of the test is crafted so we don't try to use these special -# characters in filenames or target names) -# -# TODO: similar tests needed for languages other than C -# TODO: add similar test for quote, doublequote, and hash, carefully -# Re hash, see -# https://docs.microsoft.com/en-us/cpp/build/reference/d-preprocessor-definitions - -special = [ - ['amp', '&'], - ['at', '@'], - ['backslash', '\\'], - ['dollar', '$'], - ['gt', '>'], - ['lt', '<'], - ['slash', '/'], -] - -cc = meson.get_compiler('c') - -foreach s : special - args = '-DCHAR="@0@"'.format(s[1]) - e = executable('arg-string-' + s[0], 'arg-string-test.c', c_args: args) - test('arg-string-' + s[0], e, args: s[1]) - - args = '-DCHAR=@0@'.format(s[1]) - e = executable('arg-unquoted-' + s[0], 'arg-unquoted-test.c', c_args: args) - test('arg-unquoted-' + s[0], e, args: s[1]) -endforeach - -foreach s : special - args = '-DCHAR=\'@0@\''.format(s[1]) - e = executable('arg-char-' + s[0], 'arg-char-test.c', c_args: args) - test('arg-char-' + s[0], e, args: s[1]) -endforeach diff --git a/test cases/common/142 special characters/test.json b/test cases/common/142 special characters/test.json deleted file mode 100644 index 9709e5b..0000000 --- a/test cases/common/142 special characters/test.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "installed": [ - {"type": "file", "file": "usr/share/result"}, - {"type": "file", "file": "usr/share/result2"} - ] -} diff --git a/test cases/common/143 list of file sources/foo b/test cases/common/143 list of file sources/foo new file mode 100644 index 0000000..7b57bd2 --- /dev/null +++ b/test cases/common/143 list of file sources/foo @@ -0,0 +1 @@ +some text diff --git a/test cases/common/143 list of file sources/gen.py b/test cases/common/143 list of file sources/gen.py new file mode 100644 index 0000000..2337d3d --- /dev/null +++ b/test cases/common/143 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/143 list of file sources/meson.build b/test cases/common/143 list of file sources/meson.build new file mode 100644 index 0000000..819509d --- /dev/null +++ b/test cases/common/143 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/143 nested links/meson.build b/test cases/common/143 nested links/meson.build deleted file mode 100644 index 0821b03..0000000 --- a/test cases/common/143 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/143 nested links/xephyr.c b/test cases/common/143 nested links/xephyr.c deleted file mode 100644 index 9b6bdc2..0000000 --- a/test cases/common/143 nested links/xephyr.c +++ /dev/null @@ -1,3 +0,0 @@ -int main(void) { - return 0; -} diff --git a/test cases/common/144 link depends custom target/foo.c b/test cases/common/144 link depends custom target/foo.c new file mode 100644 index 0000000..58c86a6 --- /dev/null +++ b/test cases/common/144 link depends custom target/foo.c @@ -0,0 +1,15 @@ +#include + +int main(void) { + 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/144 link depends custom target/make_file.py b/test cases/common/144 link depends custom target/make_file.py new file mode 100755 index 0000000..ceb6e19 --- /dev/null +++ b/test cases/common/144 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/144 link depends custom target/meson.build b/test cases/common/144 link depends custom target/meson.build new file mode 100644 index 0000000..ee7a865 --- /dev/null +++ b/test cases/common/144 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/144 list of file sources/foo b/test cases/common/144 list of file sources/foo deleted file mode 100644 index 7b57bd2..0000000 --- a/test cases/common/144 list of file sources/foo +++ /dev/null @@ -1 +0,0 @@ -some text diff --git a/test cases/common/144 list of file sources/gen.py b/test cases/common/144 list of file sources/gen.py deleted file mode 100644 index 2337d3d..0000000 --- a/test cases/common/144 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/144 list of file sources/meson.build b/test cases/common/144 list of file sources/meson.build deleted file mode 100644 index 819509d..0000000 --- a/test cases/common/144 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/145 link depends custom target/foo.c b/test cases/common/145 link depends custom target/foo.c deleted file mode 100644 index 58c86a6..0000000 --- a/test cases/common/145 link depends custom target/foo.c +++ /dev/null @@ -1,15 +0,0 @@ -#include - -int main(void) { - 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/145 link depends custom target/make_file.py b/test cases/common/145 link depends custom target/make_file.py deleted file mode 100755 index ceb6e19..0000000 --- a/test cases/common/145 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/145 link depends custom target/meson.build b/test cases/common/145 link depends custom target/meson.build deleted file mode 100644 index ee7a865..0000000 --- a/test cases/common/145 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/145 recursive linking/3rdorderdeps/lib.c.in b/test cases/common/145 recursive linking/3rdorderdeps/lib.c.in new file mode 100644 index 0000000..461f859 --- /dev/null +++ b/test cases/common/145 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/145 recursive linking/3rdorderdeps/main.c.in b/test cases/common/145 recursive linking/3rdorderdeps/main.c.in new file mode 100644 index 0000000..643c246 --- /dev/null +++ b/test cases/common/145 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(void) { + 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/145 recursive linking/3rdorderdeps/meson.build b/test cases/common/145 recursive linking/3rdorderdeps/meson.build new file mode 100644 index 0000000..4c5ac73 --- /dev/null +++ b/test cases/common/145 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 + '_test', main_c, link_with : dep3_lib, + c_args : build_args) + test(name + 'test', dep3_bin) + endforeach + endforeach +endforeach diff --git a/test cases/common/145 recursive linking/circular/lib1.c b/test cases/common/145 recursive linking/circular/lib1.c new file mode 100644 index 0000000..38889cf --- /dev/null +++ b/test cases/common/145 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/145 recursive linking/circular/lib2.c b/test cases/common/145 recursive linking/circular/lib2.c new file mode 100644 index 0000000..31cd37c --- /dev/null +++ b/test cases/common/145 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/145 recursive linking/circular/lib3.c b/test cases/common/145 recursive linking/circular/lib3.c new file mode 100644 index 0000000..67d473a --- /dev/null +++ b/test cases/common/145 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/145 recursive linking/circular/main.c b/test cases/common/145 recursive linking/circular/main.c new file mode 100644 index 0000000..164abdf --- /dev/null +++ b/test cases/common/145 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(void) { + 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/145 recursive linking/circular/meson.build b/test cases/common/145 recursive linking/circular/meson.build new file mode 100644 index 0000000..b7a70a8 --- /dev/null +++ b/test cases/common/145 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/145 recursive linking/circular/prop1.c b/test cases/common/145 recursive linking/circular/prop1.c new file mode 100644 index 0000000..4e571f5 --- /dev/null +++ b/test cases/common/145 recursive linking/circular/prop1.c @@ -0,0 +1,3 @@ +int get_st1_prop (void) { + return 1; +} diff --git a/test cases/common/145 recursive linking/circular/prop2.c b/test cases/common/145 recursive linking/circular/prop2.c new file mode 100644 index 0000000..ceabba0 --- /dev/null +++ b/test cases/common/145 recursive linking/circular/prop2.c @@ -0,0 +1,3 @@ +int get_st2_prop (void) { + return 2; +} diff --git a/test cases/common/145 recursive linking/circular/prop3.c b/test cases/common/145 recursive linking/circular/prop3.c new file mode 100644 index 0000000..246206c --- /dev/null +++ b/test cases/common/145 recursive linking/circular/prop3.c @@ -0,0 +1,3 @@ +int get_st3_prop (void) { + return 3; +} diff --git a/test cases/common/145 recursive linking/edge-cases/libsto.c b/test cases/common/145 recursive linking/edge-cases/libsto.c new file mode 100644 index 0000000..93f46a8 --- /dev/null +++ b/test cases/common/145 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/145 recursive linking/edge-cases/meson.build b/test cases/common/145 recursive linking/edge-cases/meson.build new file mode 100644 index 0000000..6a46266 --- /dev/null +++ b/test cases/common/145 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/145 recursive linking/edge-cases/shstmain.c b/test cases/common/145 recursive linking/edge-cases/shstmain.c new file mode 100644 index 0000000..334f867 --- /dev/null +++ b/test cases/common/145 recursive linking/edge-cases/shstmain.c @@ -0,0 +1,16 @@ +#include + +#include "../lib.h" + +int get_stshdep_value (void); + +int main(void) { + 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/145 recursive linking/edge-cases/stobuilt.c b/test cases/common/145 recursive linking/edge-cases/stobuilt.c new file mode 100644 index 0000000..9cc15bc --- /dev/null +++ b/test cases/common/145 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/145 recursive linking/edge-cases/stomain.c b/test cases/common/145 recursive linking/edge-cases/stomain.c new file mode 100644 index 0000000..a16a89b --- /dev/null +++ b/test cases/common/145 recursive linking/edge-cases/stomain.c @@ -0,0 +1,16 @@ +#include + +#include "../lib.h" + +int get_stodep_value (void); + +int main(void) { + 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/145 recursive linking/lib.h b/test cases/common/145 recursive linking/lib.h new file mode 100644 index 0000000..b54bf36 --- /dev/null +++ b/test cases/common/145 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/145 recursive linking/main.c b/test cases/common/145 recursive linking/main.c new file mode 100644 index 0000000..cf091d0 --- /dev/null +++ b/test cases/common/145 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(void) { + 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/145 recursive linking/meson.build b/test cases/common/145 recursive linking/meson.build new file mode 100644 index 0000000..2ca7151 --- /dev/null +++ b/test cases/common/145 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/145 recursive linking/shnodep/lib.c b/test cases/common/145 recursive linking/shnodep/lib.c new file mode 100644 index 0000000..a3b7993 --- /dev/null +++ b/test cases/common/145 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/145 recursive linking/shnodep/meson.build b/test cases/common/145 recursive linking/shnodep/meson.build new file mode 100644 index 0000000..66cfd9b --- /dev/null +++ b/test cases/common/145 recursive linking/shnodep/meson.build @@ -0,0 +1 @@ +shnodep = shared_library('shnodep', 'lib.c', version: '0.0.0') diff --git a/test cases/common/145 recursive linking/shshdep/lib.c b/test cases/common/145 recursive linking/shshdep/lib.c new file mode 100644 index 0000000..715d120 --- /dev/null +++ b/test cases/common/145 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/145 recursive linking/shshdep/meson.build b/test cases/common/145 recursive linking/shshdep/meson.build new file mode 100644 index 0000000..020b481 --- /dev/null +++ b/test cases/common/145 recursive linking/shshdep/meson.build @@ -0,0 +1 @@ +shshdep = shared_library('shshdep', 'lib.c', link_with : shnodep) diff --git a/test cases/common/145 recursive linking/shstdep/lib.c b/test cases/common/145 recursive linking/shstdep/lib.c new file mode 100644 index 0000000..5da8d0b --- /dev/null +++ b/test cases/common/145 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/145 recursive linking/shstdep/meson.build b/test cases/common/145 recursive linking/shstdep/meson.build new file mode 100644 index 0000000..008f9f8 --- /dev/null +++ b/test cases/common/145 recursive linking/shstdep/meson.build @@ -0,0 +1 @@ +shstdep = shared_library('shstdep', 'lib.c', link_with : stnodep) diff --git a/test cases/common/145 recursive linking/stnodep/lib.c b/test cases/common/145 recursive linking/stnodep/lib.c new file mode 100644 index 0000000..4bc50be --- /dev/null +++ b/test cases/common/145 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/145 recursive linking/stnodep/meson.build b/test cases/common/145 recursive linking/stnodep/meson.build new file mode 100644 index 0000000..77f7129 --- /dev/null +++ b/test cases/common/145 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/145 recursive linking/stshdep/lib.c b/test cases/common/145 recursive linking/stshdep/lib.c new file mode 100644 index 0000000..3cfa12b --- /dev/null +++ b/test cases/common/145 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/145 recursive linking/stshdep/meson.build b/test cases/common/145 recursive linking/stshdep/meson.build new file mode 100644 index 0000000..0967c1c --- /dev/null +++ b/test cases/common/145 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/145 recursive linking/ststdep/lib.c b/test cases/common/145 recursive linking/ststdep/lib.c new file mode 100644 index 0000000..fca8706 --- /dev/null +++ b/test cases/common/145 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/145 recursive linking/ststdep/meson.build b/test cases/common/145 recursive linking/ststdep/meson.build new file mode 100644 index 0000000..3602442 --- /dev/null +++ b/test cases/common/145 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/146 library at root/lib.c b/test cases/common/146 library at root/lib.c new file mode 100644 index 0000000..a5b3dc3 --- /dev/null +++ b/test cases/common/146 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/146 library at root/main/main.c b/test cases/common/146 library at root/main/main.c new file mode 100644 index 0000000..eadf7e8 --- /dev/null +++ b/test cases/common/146 library at root/main/main.c @@ -0,0 +1,5 @@ +extern int fn(void); + +int main(void) { + return 1 + fn(); +} diff --git a/test cases/common/146 library at root/main/meson.build b/test cases/common/146 library at root/main/meson.build new file mode 100644 index 0000000..557378a --- /dev/null +++ b/test cases/common/146 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/146 library at root/meson.build b/test cases/common/146 library at root/meson.build new file mode 100644 index 0000000..bfdd869 --- /dev/null +++ b/test cases/common/146 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/146 recursive linking/3rdorderdeps/lib.c.in b/test cases/common/146 recursive linking/3rdorderdeps/lib.c.in deleted file mode 100644 index 461f859..0000000 --- a/test cases/common/146 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/146 recursive linking/3rdorderdeps/main.c.in b/test cases/common/146 recursive linking/3rdorderdeps/main.c.in deleted file mode 100644 index 643c246..0000000 --- a/test cases/common/146 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(void) { - 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/146 recursive linking/3rdorderdeps/meson.build b/test cases/common/146 recursive linking/3rdorderdeps/meson.build deleted file mode 100644 index 4c5ac73..0000000 --- a/test cases/common/146 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 + '_test', main_c, link_with : dep3_lib, - c_args : build_args) - test(name + 'test', dep3_bin) - endforeach - endforeach -endforeach diff --git a/test cases/common/146 recursive linking/circular/lib1.c b/test cases/common/146 recursive linking/circular/lib1.c deleted file mode 100644 index 38889cf..0000000 --- a/test cases/common/146 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/146 recursive linking/circular/lib2.c b/test cases/common/146 recursive linking/circular/lib2.c deleted file mode 100644 index 31cd37c..0000000 --- a/test cases/common/146 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/146 recursive linking/circular/lib3.c b/test cases/common/146 recursive linking/circular/lib3.c deleted file mode 100644 index 67d473a..0000000 --- a/test cases/common/146 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/146 recursive linking/circular/main.c b/test cases/common/146 recursive linking/circular/main.c deleted file mode 100644 index 164abdf..0000000 --- a/test cases/common/146 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(void) { - 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/146 recursive linking/circular/meson.build b/test cases/common/146 recursive linking/circular/meson.build deleted file mode 100644 index b7a70a8..0000000 --- a/test cases/common/146 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/146 recursive linking/circular/prop1.c b/test cases/common/146 recursive linking/circular/prop1.c deleted file mode 100644 index 4e571f5..0000000 --- a/test cases/common/146 recursive linking/circular/prop1.c +++ /dev/null @@ -1,3 +0,0 @@ -int get_st1_prop (void) { - return 1; -} diff --git a/test cases/common/146 recursive linking/circular/prop2.c b/test cases/common/146 recursive linking/circular/prop2.c deleted file mode 100644 index ceabba0..0000000 --- a/test cases/common/146 recursive linking/circular/prop2.c +++ /dev/null @@ -1,3 +0,0 @@ -int get_st2_prop (void) { - return 2; -} diff --git a/test cases/common/146 recursive linking/circular/prop3.c b/test cases/common/146 recursive linking/circular/prop3.c deleted file mode 100644 index 246206c..0000000 --- a/test cases/common/146 recursive linking/circular/prop3.c +++ /dev/null @@ -1,3 +0,0 @@ -int get_st3_prop (void) { - return 3; -} diff --git a/test cases/common/146 recursive linking/edge-cases/libsto.c b/test cases/common/146 recursive linking/edge-cases/libsto.c deleted file mode 100644 index 93f46a8..0000000 --- a/test cases/common/146 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/146 recursive linking/edge-cases/meson.build b/test cases/common/146 recursive linking/edge-cases/meson.build deleted file mode 100644 index 6a46266..0000000 --- a/test cases/common/146 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/146 recursive linking/edge-cases/shstmain.c b/test cases/common/146 recursive linking/edge-cases/shstmain.c deleted file mode 100644 index 334f867..0000000 --- a/test cases/common/146 recursive linking/edge-cases/shstmain.c +++ /dev/null @@ -1,16 +0,0 @@ -#include - -#include "../lib.h" - -int get_stshdep_value (void); - -int main(void) { - 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/146 recursive linking/edge-cases/stobuilt.c b/test cases/common/146 recursive linking/edge-cases/stobuilt.c deleted file mode 100644 index 9cc15bc..0000000 --- a/test cases/common/146 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/146 recursive linking/edge-cases/stomain.c b/test cases/common/146 recursive linking/edge-cases/stomain.c deleted file mode 100644 index a16a89b..0000000 --- a/test cases/common/146 recursive linking/edge-cases/stomain.c +++ /dev/null @@ -1,16 +0,0 @@ -#include - -#include "../lib.h" - -int get_stodep_value (void); - -int main(void) { - 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/146 recursive linking/lib.h b/test cases/common/146 recursive linking/lib.h deleted file mode 100644 index b54bf36..0000000 --- a/test cases/common/146 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/146 recursive linking/main.c b/test cases/common/146 recursive linking/main.c deleted file mode 100644 index cf091d0..0000000 --- a/test cases/common/146 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(void) { - 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/146 recursive linking/meson.build b/test cases/common/146 recursive linking/meson.build deleted file mode 100644 index 2ca7151..0000000 --- a/test cases/common/146 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/146 recursive linking/shnodep/lib.c b/test cases/common/146 recursive linking/shnodep/lib.c deleted file mode 100644 index a3b7993..0000000 --- a/test cases/common/146 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/146 recursive linking/shnodep/meson.build b/test cases/common/146 recursive linking/shnodep/meson.build deleted file mode 100644 index 66cfd9b..0000000 --- a/test cases/common/146 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/146 recursive linking/shshdep/lib.c b/test cases/common/146 recursive linking/shshdep/lib.c deleted file mode 100644 index 715d120..0000000 --- a/test cases/common/146 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/146 recursive linking/shshdep/meson.build b/test cases/common/146 recursive linking/shshdep/meson.build deleted file mode 100644 index 020b481..0000000 --- a/test cases/common/146 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/146 recursive linking/shstdep/lib.c b/test cases/common/146 recursive linking/shstdep/lib.c deleted file mode 100644 index 5da8d0b..0000000 --- a/test cases/common/146 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/146 recursive linking/shstdep/meson.build b/test cases/common/146 recursive linking/shstdep/meson.build deleted file mode 100644 index 008f9f8..0000000 --- a/test cases/common/146 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/146 recursive linking/stnodep/lib.c b/test cases/common/146 recursive linking/stnodep/lib.c deleted file mode 100644 index 4bc50be..0000000 --- a/test cases/common/146 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/146 recursive linking/stnodep/meson.build b/test cases/common/146 recursive linking/stnodep/meson.build deleted file mode 100644 index 77f7129..0000000 --- a/test cases/common/146 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/146 recursive linking/stshdep/lib.c b/test cases/common/146 recursive linking/stshdep/lib.c deleted file mode 100644 index 3cfa12b..0000000 --- a/test cases/common/146 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/146 recursive linking/stshdep/meson.build b/test cases/common/146 recursive linking/stshdep/meson.build deleted file mode 100644 index 0967c1c..0000000 --- a/test cases/common/146 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/146 recursive linking/ststdep/lib.c b/test cases/common/146 recursive linking/ststdep/lib.c deleted file mode 100644 index fca8706..0000000 --- a/test cases/common/146 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/146 recursive linking/ststdep/meson.build b/test cases/common/146 recursive linking/ststdep/meson.build deleted file mode 100644 index 3602442..0000000 --- a/test cases/common/146 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/147 library at root/lib.c b/test cases/common/147 library at root/lib.c deleted file mode 100644 index a5b3dc3..0000000 --- a/test cases/common/147 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/147 library at root/main/main.c b/test cases/common/147 library at root/main/main.c deleted file mode 100644 index eadf7e8..0000000 --- a/test cases/common/147 library at root/main/main.c +++ /dev/null @@ -1,5 +0,0 @@ -extern int fn(void); - -int main(void) { - return 1 + fn(); -} diff --git a/test cases/common/147 library at root/main/meson.build b/test cases/common/147 library at root/main/meson.build deleted file mode 100644 index 557378a..0000000 --- a/test cases/common/147 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/147 library at root/meson.build b/test cases/common/147 library at root/meson.build deleted file mode 100644 index bfdd869..0000000 --- a/test cases/common/147 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/147 simd/fallback.c b/test cases/common/147 simd/fallback.c new file mode 100644 index 0000000..ab435f4 --- /dev/null +++ b/test cases/common/147 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/147 simd/include/simdheader.h b/test cases/common/147 simd/include/simdheader.h new file mode 100644 index 0000000..6515e41 --- /dev/null +++ b/test cases/common/147 simd/include/simdheader.h @@ -0,0 +1,3 @@ +#pragma once + +#define I_CAN_HAZ_SIMD diff --git a/test cases/common/147 simd/meson.build b/test cases/common/147 simd/meson.build new file mode 100644 index 0000000..2628a12 --- /dev/null +++ b/test cases/common/147 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/147 simd/simd_avx.c b/test cases/common/147 simd/simd_avx.c new file mode 100644 index 0000000..5f45a4e --- /dev/null +++ b/test cases/common/147 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(void) { + 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(void) { return 0; } +#else + +int avx_available(void) { + 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/147 simd/simd_avx2.c b/test cases/common/147 simd/simd_avx2.c new file mode 100644 index 0000000..c79819b --- /dev/null +++ b/test cases/common/147 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(void) { + return 0; +} +#else +#include +#include + +#if defined(__APPLE__) +int avx2_available(void) { return 0; } +#else +int avx2_available(void) { + 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/147 simd/simd_mmx.c b/test cases/common/147 simd/simd_mmx.c new file mode 100644 index 0000000..7605442 --- /dev/null +++ b/test cases/common/147 simd/simd_mmx.c @@ -0,0 +1,67 @@ +#include +#include + +#include + +#ifdef _MSC_VER +#include +int mmx_available(void) { + 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(void) { + 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(void) { return 1; } +#else +int mmx_available(void) { + 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/147 simd/simd_neon.c b/test cases/common/147 simd/simd_neon.c new file mode 100644 index 0000000..2834b30 --- /dev/null +++ b/test cases/common/147 simd/simd_neon.c @@ -0,0 +1,20 @@ +#include +#include + +#include +#include + +int neon_available(void) { + 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/147 simd/simd_sse.c b/test cases/common/147 simd/simd_sse.c new file mode 100644 index 0000000..6014e0c --- /dev/null +++ b/test cases/common/147 simd/simd_sse.c @@ -0,0 +1,29 @@ +#include +#include + +#ifdef _MSC_VER +#include +int sse_available(void) { + return 1; +} +#else + +#include +#include +#include + +#if defined(__APPLE__) +int sse_available(void) { return 1; } +#else +int sse_available(void) { + 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/147 simd/simd_sse2.c b/test cases/common/147 simd/simd_sse2.c new file mode 100644 index 0000000..445afb6 --- /dev/null +++ b/test cases/common/147 simd/simd_sse2.c @@ -0,0 +1,37 @@ +#include +#include +#include + +#ifdef _MSC_VER +int sse2_available(void) { + return 1; +} + +#else +#include +#include + +#if defined(__APPLE__) +int sse2_available(void) { return 1; } +#else +int sse2_available(void) { + 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/147 simd/simd_sse3.c b/test cases/common/147 simd/simd_sse3.c new file mode 100644 index 0000000..29a35e6 --- /dev/null +++ b/test cases/common/147 simd/simd_sse3.c @@ -0,0 +1,38 @@ +#include +#include + +#ifdef _MSC_VER +#include +int sse3_available(void) { + return 1; +} +#else + +#include +#include +#include + +#if defined(__APPLE__) +int sse3_available(void) { return 1; } +#else +int sse3_available(void) { + 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/147 simd/simd_sse41.c b/test cases/common/147 simd/simd_sse41.c new file mode 100644 index 0000000..29f2555 --- /dev/null +++ b/test cases/common/147 simd/simd_sse41.c @@ -0,0 +1,40 @@ +#include +#include + +#include + +#ifdef _MSC_VER +#include + +int sse41_available(void) { + return 1; +} + +#else +#include +#include + +#if defined(__APPLE__) +int sse41_available(void) { return 1; } +#else +int sse41_available(void) { + 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/147 simd/simd_sse42.c b/test cases/common/147 simd/simd_sse42.c new file mode 100644 index 0000000..f1564e2 --- /dev/null +++ b/test cases/common/147 simd/simd_sse42.c @@ -0,0 +1,43 @@ +#include +#include +#include + +#ifdef _MSC_VER +#include + +int sse42_available(void) { + return 1; +} + +#else + +#include +#include + +#ifdef __APPLE__ +int sse42_available(void) { + return 1; +} +#else +int sse42_available(void) { + 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/147 simd/simd_ssse3.c b/test cases/common/147 simd/simd_ssse3.c new file mode 100644 index 0000000..fa557f4 --- /dev/null +++ b/test cases/common/147 simd/simd_ssse3.c @@ -0,0 +1,48 @@ +#include +#include + +#include +#include + +#ifdef _MSC_VER +#include + +int ssse3_available(void) { + return 1; +} + +#else + +#include +#include + +int ssse3_available(void) { +#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/147 simd/simdchecker.c b/test cases/common/147 simd/simdchecker.c new file mode 100644 index 0000000..c7a0a97 --- /dev/null +++ b/test cases/common/147 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); +void increment_mmx(float arr[4]); +#endif + +#if HAVE_SSE +int sse_available(void); +void increment_sse(float arr[4]); +#endif + +#if HAVE_SSE2 +int sse2_available(void); +void increment_sse2(float arr[4]); +#endif + +#if HAVE_SSE3 +int sse3_available(void); +void increment_sse3(float arr[4]); +#endif + +#if HAVE_SSSE3 +int ssse3_available(void); +void increment_ssse3(float arr[4]); +#endif + +#if HAVE_SSE41 +int sse41_available(void); +void increment_sse41(float arr[4]); +#endif + +#if HAVE_SSE42 +int sse42_available(void); +void increment_sse42(float arr[4]); +#endif + +#if HAVE_AVX +int avx_available(void); +void increment_avx(float arr[4]); +#endif + +#if HAVE_AVX2 +int avx2_available(void); +void increment_avx2(float arr[4]); +#endif + +#if HAVE_NEON +int neon_available(void); +void increment_neon(float arr[4]); +#endif + +#if HAVE_ALTIVEC +int altivec_available(void); +void increment_altivec(float arr[4]); +#endif + +/* And so on. */ diff --git a/test cases/common/148 shared module resolving symbol in executable/meson.build b/test cases/common/148 shared module resolving symbol in executable/meson.build new file mode 100644 index 0000000..4e5188f --- /dev/null +++ b/test cases/common/148 shared module resolving symbol in executable/meson.build @@ -0,0 +1,20 @@ +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. + +cc = meson.get_compiler('c') +if cc.get_id() == 'pgi' + error('MESON_SKIP_TEST PGI has its own unique set of macros that would need to be handled') +endif + +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/148 shared module resolving symbol in executable/module.c b/test cases/common/148 shared module resolving symbol in executable/module.c new file mode 100644 index 0000000..64374d5 --- /dev/null +++ b/test cases/common/148 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/148 shared module resolving symbol in executable/prog.c b/test cases/common/148 shared module resolving symbol in executable/prog.c new file mode 100644 index 0000000..b2abcdb --- /dev/null +++ b/test cases/common/148 shared module resolving symbol in executable/prog.c @@ -0,0 +1,61 @@ +#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; + + if (argc=0) {}; // noop + +#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/148 simd/fallback.c b/test cases/common/148 simd/fallback.c deleted file mode 100644 index ab435f4..0000000 --- a/test cases/common/148 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/148 simd/include/simdheader.h b/test cases/common/148 simd/include/simdheader.h deleted file mode 100644 index 6515e41..0000000 --- a/test cases/common/148 simd/include/simdheader.h +++ /dev/null @@ -1,3 +0,0 @@ -#pragma once - -#define I_CAN_HAZ_SIMD diff --git a/test cases/common/148 simd/meson.build b/test cases/common/148 simd/meson.build deleted file mode 100644 index 2628a12..0000000 --- a/test cases/common/148 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/148 simd/simd_avx.c b/test cases/common/148 simd/simd_avx.c deleted file mode 100644 index 5f45a4e..0000000 --- a/test cases/common/148 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(void) { - 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(void) { return 0; } -#else - -int avx_available(void) { - 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/148 simd/simd_avx2.c b/test cases/common/148 simd/simd_avx2.c deleted file mode 100644 index c79819b..0000000 --- a/test cases/common/148 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(void) { - return 0; -} -#else -#include -#include - -#if defined(__APPLE__) -int avx2_available(void) { return 0; } -#else -int avx2_available(void) { - 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/148 simd/simd_mmx.c b/test cases/common/148 simd/simd_mmx.c deleted file mode 100644 index 7605442..0000000 --- a/test cases/common/148 simd/simd_mmx.c +++ /dev/null @@ -1,67 +0,0 @@ -#include -#include - -#include - -#ifdef _MSC_VER -#include -int mmx_available(void) { - 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(void) { - 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(void) { return 1; } -#else -int mmx_available(void) { - 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/148 simd/simd_neon.c b/test cases/common/148 simd/simd_neon.c deleted file mode 100644 index 2834b30..0000000 --- a/test cases/common/148 simd/simd_neon.c +++ /dev/null @@ -1,20 +0,0 @@ -#include -#include - -#include -#include - -int neon_available(void) { - 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/148 simd/simd_sse.c b/test cases/common/148 simd/simd_sse.c deleted file mode 100644 index 6014e0c..0000000 --- a/test cases/common/148 simd/simd_sse.c +++ /dev/null @@ -1,29 +0,0 @@ -#include -#include - -#ifdef _MSC_VER -#include -int sse_available(void) { - return 1; -} -#else - -#include -#include -#include - -#if defined(__APPLE__) -int sse_available(void) { return 1; } -#else -int sse_available(void) { - 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/148 simd/simd_sse2.c b/test cases/common/148 simd/simd_sse2.c deleted file mode 100644 index 445afb6..0000000 --- a/test cases/common/148 simd/simd_sse2.c +++ /dev/null @@ -1,37 +0,0 @@ -#include -#include -#include - -#ifdef _MSC_VER -int sse2_available(void) { - return 1; -} - -#else -#include -#include - -#if defined(__APPLE__) -int sse2_available(void) { return 1; } -#else -int sse2_available(void) { - 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/148 simd/simd_sse3.c b/test cases/common/148 simd/simd_sse3.c deleted file mode 100644 index 29a35e6..0000000 --- a/test cases/common/148 simd/simd_sse3.c +++ /dev/null @@ -1,38 +0,0 @@ -#include -#include - -#ifdef _MSC_VER -#include -int sse3_available(void) { - return 1; -} -#else - -#include -#include -#include - -#if defined(__APPLE__) -int sse3_available(void) { return 1; } -#else -int sse3_available(void) { - 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/148 simd/simd_sse41.c b/test cases/common/148 simd/simd_sse41.c deleted file mode 100644 index 29f2555..0000000 --- a/test cases/common/148 simd/simd_sse41.c +++ /dev/null @@ -1,40 +0,0 @@ -#include -#include - -#include - -#ifdef _MSC_VER -#include - -int sse41_available(void) { - return 1; -} - -#else -#include -#include - -#if defined(__APPLE__) -int sse41_available(void) { return 1; } -#else -int sse41_available(void) { - 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/148 simd/simd_sse42.c b/test cases/common/148 simd/simd_sse42.c deleted file mode 100644 index f1564e2..0000000 --- a/test cases/common/148 simd/simd_sse42.c +++ /dev/null @@ -1,43 +0,0 @@ -#include -#include -#include - -#ifdef _MSC_VER -#include - -int sse42_available(void) { - return 1; -} - -#else - -#include -#include - -#ifdef __APPLE__ -int sse42_available(void) { - return 1; -} -#else -int sse42_available(void) { - 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/148 simd/simd_ssse3.c b/test cases/common/148 simd/simd_ssse3.c deleted file mode 100644 index fa557f4..0000000 --- a/test cases/common/148 simd/simd_ssse3.c +++ /dev/null @@ -1,48 +0,0 @@ -#include -#include - -#include -#include - -#ifdef _MSC_VER -#include - -int ssse3_available(void) { - return 1; -} - -#else - -#include -#include - -int ssse3_available(void) { -#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/148 simd/simdchecker.c b/test cases/common/148 simd/simdchecker.c deleted file mode 100644 index c7a0a97..0000000 --- a/test cases/common/148 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); -void increment_mmx(float arr[4]); -#endif - -#if HAVE_SSE -int sse_available(void); -void increment_sse(float arr[4]); -#endif - -#if HAVE_SSE2 -int sse2_available(void); -void increment_sse2(float arr[4]); -#endif - -#if HAVE_SSE3 -int sse3_available(void); -void increment_sse3(float arr[4]); -#endif - -#if HAVE_SSSE3 -int ssse3_available(void); -void increment_ssse3(float arr[4]); -#endif - -#if HAVE_SSE41 -int sse41_available(void); -void increment_sse41(float arr[4]); -#endif - -#if HAVE_SSE42 -int sse42_available(void); -void increment_sse42(float arr[4]); -#endif - -#if HAVE_AVX -int avx_available(void); -void increment_avx(float arr[4]); -#endif - -#if HAVE_AVX2 -int avx2_available(void); -void increment_avx2(float arr[4]); -#endif - -#if HAVE_NEON -int neon_available(void); -void increment_neon(float arr[4]); -#endif - -#if HAVE_ALTIVEC -int altivec_available(void); -void increment_altivec(float arr[4]); -#endif - -/* And so on. */ diff --git a/test cases/common/149 dotinclude/dotproc.c b/test cases/common/149 dotinclude/dotproc.c new file mode 100644 index 0000000..f48c330 --- /dev/null +++ b/test cases/common/149 dotinclude/dotproc.c @@ -0,0 +1,10 @@ +#include"stdio.h" + +#ifndef WRAPPER_INCLUDED +#error The wrapper stdio.h was not included. +#endif + +int main(void) { + printf("Eventually I got printed.\n"); + return 0; +} diff --git a/test cases/common/149 dotinclude/meson.build b/test cases/common/149 dotinclude/meson.build new file mode 100644 index 0000000..e0c2cd7 --- /dev/null +++ b/test cases/common/149 dotinclude/meson.build @@ -0,0 +1,5 @@ +project('dotinclude', 'c') + +executable('dotproc', 'dotproc.c', + implicit_include_directories : false) + diff --git a/test cases/common/149 dotinclude/stdio.h b/test cases/common/149 dotinclude/stdio.h new file mode 100644 index 0000000..b6bd09f --- /dev/null +++ b/test cases/common/149 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/149 shared module resolving symbol in executable/meson.build b/test cases/common/149 shared module resolving symbol in executable/meson.build deleted file mode 100644 index 4e5188f..0000000 --- a/test cases/common/149 shared module resolving symbol in executable/meson.build +++ /dev/null @@ -1,20 +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. - -cc = meson.get_compiler('c') -if cc.get_id() == 'pgi' - error('MESON_SKIP_TEST PGI has its own unique set of macros that would need to be handled') -endif - -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/149 shared module resolving symbol in executable/module.c b/test cases/common/149 shared module resolving symbol in executable/module.c deleted file mode 100644 index 64374d5..0000000 --- a/test cases/common/149 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/149 shared module resolving symbol in executable/prog.c b/test cases/common/149 shared module resolving symbol in executable/prog.c deleted file mode 100644 index b2abcdb..0000000 --- a/test cases/common/149 shared module resolving symbol in executable/prog.c +++ /dev/null @@ -1,61 +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; - - if (argc=0) {}; // noop - -#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/150 dotinclude/dotproc.c b/test cases/common/150 dotinclude/dotproc.c deleted file mode 100644 index f48c330..0000000 --- a/test cases/common/150 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(void) { - printf("Eventually I got printed.\n"); - return 0; -} diff --git a/test cases/common/150 dotinclude/meson.build b/test cases/common/150 dotinclude/meson.build deleted file mode 100644 index e0c2cd7..0000000 --- a/test cases/common/150 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/150 dotinclude/stdio.h b/test cases/common/150 dotinclude/stdio.h deleted file mode 100644 index b6bd09f..0000000 --- a/test cases/common/150 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/150 reserved targets/all/meson.build b/test cases/common/150 reserved targets/all/meson.build new file mode 100644 index 0000000..adee882 --- /dev/null +++ b/test cases/common/150 reserved targets/all/meson.build @@ -0,0 +1 @@ +executable('test-all', '../test.c') diff --git a/test cases/common/150 reserved targets/benchmark/meson.build b/test cases/common/150 reserved targets/benchmark/meson.build new file mode 100644 index 0000000..242cc23 --- /dev/null +++ b/test cases/common/150 reserved targets/benchmark/meson.build @@ -0,0 +1 @@ +executable('test-benchmark', '../test.c') diff --git a/test cases/common/150 reserved targets/clean-ctlist/meson.build b/test cases/common/150 reserved targets/clean-ctlist/meson.build new file mode 100644 index 0000000..75eb207 --- /dev/null +++ b/test cases/common/150 reserved targets/clean-ctlist/meson.build @@ -0,0 +1 @@ +executable('test-clean-ctlist', '../test.c') diff --git a/test cases/common/150 reserved targets/clean-gcda/meson.build b/test cases/common/150 reserved targets/clean-gcda/meson.build new file mode 100644 index 0000000..488a527 --- /dev/null +++ b/test cases/common/150 reserved targets/clean-gcda/meson.build @@ -0,0 +1 @@ +executable('test-clean-gcda', '../test.c') diff --git a/test cases/common/150 reserved targets/clean-gcno/meson.build b/test cases/common/150 reserved targets/clean-gcno/meson.build new file mode 100644 index 0000000..eec789a --- /dev/null +++ b/test cases/common/150 reserved targets/clean-gcno/meson.build @@ -0,0 +1 @@ +executable('test-clean-gcno', '../test.c') diff --git a/test cases/common/150 reserved targets/clean/meson.build b/test cases/common/150 reserved targets/clean/meson.build new file mode 100644 index 0000000..4e27b6c --- /dev/null +++ b/test cases/common/150 reserved targets/clean/meson.build @@ -0,0 +1 @@ +executable('test-clean', '../test.c') diff --git a/test cases/common/150 reserved targets/coverage-html/meson.build b/test cases/common/150 reserved targets/coverage-html/meson.build new file mode 100644 index 0000000..10a4cc8 --- /dev/null +++ b/test cases/common/150 reserved targets/coverage-html/meson.build @@ -0,0 +1 @@ +executable('test-coverage-html', '../test.c') diff --git a/test cases/common/150 reserved targets/coverage-text/meson.build b/test cases/common/150 reserved targets/coverage-text/meson.build new file mode 100644 index 0000000..21dcae5 --- /dev/null +++ b/test cases/common/150 reserved targets/coverage-text/meson.build @@ -0,0 +1 @@ +executable('test-coverage-text', '../test.c') diff --git a/test cases/common/150 reserved targets/coverage-xml/meson.build b/test cases/common/150 reserved targets/coverage-xml/meson.build new file mode 100644 index 0000000..44d7bfb --- /dev/null +++ b/test cases/common/150 reserved targets/coverage-xml/meson.build @@ -0,0 +1 @@ +executable('test-coverage-xml', '../test.c') diff --git a/test cases/common/150 reserved targets/coverage/meson.build b/test cases/common/150 reserved targets/coverage/meson.build new file mode 100644 index 0000000..b401055 --- /dev/null +++ b/test cases/common/150 reserved targets/coverage/meson.build @@ -0,0 +1 @@ +executable('test-coverage', '../test.c') diff --git a/test cases/common/150 reserved targets/dist/meson.build b/test cases/common/150 reserved targets/dist/meson.build new file mode 100644 index 0000000..951bbb4 --- /dev/null +++ b/test cases/common/150 reserved targets/dist/meson.build @@ -0,0 +1 @@ +executable('test-dist', '../test.c') diff --git a/test cases/common/150 reserved targets/distcheck/meson.build b/test cases/common/150 reserved targets/distcheck/meson.build new file mode 100644 index 0000000..12b9328 --- /dev/null +++ b/test cases/common/150 reserved targets/distcheck/meson.build @@ -0,0 +1 @@ +executable('test-distcheck', '../test.c') diff --git a/test cases/common/150 reserved targets/install/meson.build b/test cases/common/150 reserved targets/install/meson.build new file mode 100644 index 0000000..4839901 --- /dev/null +++ b/test cases/common/150 reserved targets/install/meson.build @@ -0,0 +1 @@ +executable('test-install', '../test.c') diff --git a/test cases/common/150 reserved targets/meson.build b/test cases/common/150 reserved targets/meson.build new file mode 100644 index 0000000..24fd937 --- /dev/null +++ b/test cases/common/150 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/150 reserved targets/phony/meson.build b/test cases/common/150 reserved targets/phony/meson.build new file mode 100644 index 0000000..6710fc1 --- /dev/null +++ b/test cases/common/150 reserved targets/phony/meson.build @@ -0,0 +1 @@ +executable('test-phony', '../test.c') diff --git a/test cases/common/150 reserved targets/reconfigure/meson.build b/test cases/common/150 reserved targets/reconfigure/meson.build new file mode 100644 index 0000000..c3ea3da --- /dev/null +++ b/test cases/common/150 reserved targets/reconfigure/meson.build @@ -0,0 +1 @@ +executable('test-reconfigure', '../test.c') diff --git a/test cases/common/150 reserved targets/runtarget/echo.py b/test cases/common/150 reserved targets/runtarget/echo.py new file mode 100644 index 0000000..7f9f179 --- /dev/null +++ b/test cases/common/150 reserved targets/runtarget/echo.py @@ -0,0 +1,6 @@ +#!/usr/bin/env python3 + +import sys + +if len(sys.argv) > 1: + print(sys.argv[1]) diff --git a/test cases/common/150 reserved targets/runtarget/meson.build b/test cases/common/150 reserved targets/runtarget/meson.build new file mode 100644 index 0000000..7ba0b8c --- /dev/null +++ b/test cases/common/150 reserved targets/runtarget/meson.build @@ -0,0 +1,2 @@ +configure_file(output : 'config.h', configuration: configuration_data()) +run_target('runtarget', command : [find_program('echo.py')]) diff --git a/test cases/common/150 reserved targets/scan-build/meson.build b/test cases/common/150 reserved targets/scan-build/meson.build new file mode 100644 index 0000000..1002053 --- /dev/null +++ b/test cases/common/150 reserved targets/scan-build/meson.build @@ -0,0 +1 @@ +executable('test-scan-build', '../test.c') diff --git a/test cases/common/150 reserved targets/test.c b/test cases/common/150 reserved targets/test.c new file mode 100644 index 0000000..03b2213 --- /dev/null +++ b/test cases/common/150 reserved targets/test.c @@ -0,0 +1,3 @@ +int main(void) { + return 0; +} diff --git a/test cases/common/150 reserved targets/test/meson.build b/test cases/common/150 reserved targets/test/meson.build new file mode 100644 index 0000000..4ab123c --- /dev/null +++ b/test cases/common/150 reserved targets/test/meson.build @@ -0,0 +1 @@ +executable('test-test', '../test.c') diff --git a/test cases/common/150 reserved targets/uninstall/meson.build b/test cases/common/150 reserved targets/uninstall/meson.build new file mode 100644 index 0000000..21c6ca6 --- /dev/null +++ b/test cases/common/150 reserved targets/uninstall/meson.build @@ -0,0 +1 @@ +executable('test-uninstall', '../test.c') diff --git a/test cases/common/151 duplicate source names/dir1/file.c b/test cases/common/151 duplicate source names/dir1/file.c new file mode 100644 index 0000000..1c4753e --- /dev/null +++ b/test cases/common/151 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(void) { + 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/151 duplicate source names/dir1/meson.build b/test cases/common/151 duplicate source names/dir1/meson.build new file mode 100644 index 0000000..00bc85d --- /dev/null +++ b/test cases/common/151 duplicate source names/dir1/meson.build @@ -0,0 +1 @@ +sources += files('file.c') diff --git a/test cases/common/151 duplicate source names/dir2/dir1/file.c b/test cases/common/151 duplicate source names/dir2/dir1/file.c new file mode 100644 index 0000000..5aac8e5 --- /dev/null +++ b/test cases/common/151 duplicate source names/dir2/dir1/file.c @@ -0,0 +1 @@ +int dir2_dir1 = 21; diff --git a/test cases/common/151 duplicate source names/dir2/file.c b/test cases/common/151 duplicate source names/dir2/file.c new file mode 100644 index 0000000..6cf8d66 --- /dev/null +++ b/test cases/common/151 duplicate source names/dir2/file.c @@ -0,0 +1 @@ +int dir2 = 20; diff --git a/test cases/common/151 duplicate source names/dir2/meson.build b/test cases/common/151 duplicate source names/dir2/meson.build new file mode 100644 index 0000000..f116a02 --- /dev/null +++ b/test cases/common/151 duplicate source names/dir2/meson.build @@ -0,0 +1 @@ +sources += files('file.c', 'dir1/file.c') diff --git a/test cases/common/151 duplicate source names/dir3/dir1/file.c b/test cases/common/151 duplicate source names/dir3/dir1/file.c new file mode 100644 index 0000000..04667c2 --- /dev/null +++ b/test cases/common/151 duplicate source names/dir3/dir1/file.c @@ -0,0 +1 @@ +int dir3_dir1 = 31; diff --git a/test cases/common/151 duplicate source names/dir3/file.c b/test cases/common/151 duplicate source names/dir3/file.c new file mode 100644 index 0000000..d16d0a8 --- /dev/null +++ b/test cases/common/151 duplicate source names/dir3/file.c @@ -0,0 +1 @@ +int dir3 = 30; diff --git a/test cases/common/151 duplicate source names/dir3/meson.build b/test cases/common/151 duplicate source names/dir3/meson.build new file mode 100644 index 0000000..70ddbf2 --- /dev/null +++ b/test cases/common/151 duplicate source names/dir3/meson.build @@ -0,0 +1 @@ +lib = static_library('lib', 'file.c', 'dir1/file.c') diff --git a/test cases/common/151 duplicate source names/meson.build b/test cases/common/151 duplicate source names/meson.build new file mode 100644 index 0000000..635aa8c --- /dev/null +++ b/test cases/common/151 duplicate source names/meson.build @@ -0,0 +1,19 @@ +project('proj', 'c') + +if meson.backend() == 'xcode' + # Xcode gives object files unique names but only if they would clash. For example + # two files named lib.o instead get the following names: + # + # lib-4fbe522d8ba4cb1f1b89cc2df640a2336b92e1a5565f0a4c5a79b5b5e2969eb9.o + # lib-4fbe522d8ba4cb1f1b89cc2df640a2336deeff2bc2297affaadbe20f5cbfee56.o + # + # No-one has reverse engineered the naming scheme so we would access them. + # IF you feel up to the challenge, patches welcome. + error('MESON_SKIP_TEST, Xcode can not extract objs when they would have the same filename.') +endif + +sources = [] +subdir('dir1') +subdir('dir2') +subdir('dir3') +executable('a.out', sources : sources, objects : lib.extract_all_objects()) diff --git a/test cases/common/151 reserved targets/all/meson.build b/test cases/common/151 reserved targets/all/meson.build deleted file mode 100644 index adee882..0000000 --- a/test cases/common/151 reserved targets/all/meson.build +++ /dev/null @@ -1 +0,0 @@ -executable('test-all', '../test.c') diff --git a/test cases/common/151 reserved targets/benchmark/meson.build b/test cases/common/151 reserved targets/benchmark/meson.build deleted file mode 100644 index 242cc23..0000000 --- a/test cases/common/151 reserved targets/benchmark/meson.build +++ /dev/null @@ -1 +0,0 @@ -executable('test-benchmark', '../test.c') diff --git a/test cases/common/151 reserved targets/clean-ctlist/meson.build b/test cases/common/151 reserved targets/clean-ctlist/meson.build deleted file mode 100644 index 75eb207..0000000 --- a/test cases/common/151 reserved targets/clean-ctlist/meson.build +++ /dev/null @@ -1 +0,0 @@ -executable('test-clean-ctlist', '../test.c') diff --git a/test cases/common/151 reserved targets/clean-gcda/meson.build b/test cases/common/151 reserved targets/clean-gcda/meson.build deleted file mode 100644 index 488a527..0000000 --- a/test cases/common/151 reserved targets/clean-gcda/meson.build +++ /dev/null @@ -1 +0,0 @@ -executable('test-clean-gcda', '../test.c') diff --git a/test cases/common/151 reserved targets/clean-gcno/meson.build b/test cases/common/151 reserved targets/clean-gcno/meson.build deleted file mode 100644 index eec789a..0000000 --- a/test cases/common/151 reserved targets/clean-gcno/meson.build +++ /dev/null @@ -1 +0,0 @@ -executable('test-clean-gcno', '../test.c') diff --git a/test cases/common/151 reserved targets/clean/meson.build b/test cases/common/151 reserved targets/clean/meson.build deleted file mode 100644 index 4e27b6c..0000000 --- a/test cases/common/151 reserved targets/clean/meson.build +++ /dev/null @@ -1 +0,0 @@ -executable('test-clean', '../test.c') diff --git a/test cases/common/151 reserved targets/coverage-html/meson.build b/test cases/common/151 reserved targets/coverage-html/meson.build deleted file mode 100644 index 10a4cc8..0000000 --- a/test cases/common/151 reserved targets/coverage-html/meson.build +++ /dev/null @@ -1 +0,0 @@ -executable('test-coverage-html', '../test.c') diff --git a/test cases/common/151 reserved targets/coverage-text/meson.build b/test cases/common/151 reserved targets/coverage-text/meson.build deleted file mode 100644 index 21dcae5..0000000 --- a/test cases/common/151 reserved targets/coverage-text/meson.build +++ /dev/null @@ -1 +0,0 @@ -executable('test-coverage-text', '../test.c') diff --git a/test cases/common/151 reserved targets/coverage-xml/meson.build b/test cases/common/151 reserved targets/coverage-xml/meson.build deleted file mode 100644 index 44d7bfb..0000000 --- a/test cases/common/151 reserved targets/coverage-xml/meson.build +++ /dev/null @@ -1 +0,0 @@ -executable('test-coverage-xml', '../test.c') diff --git a/test cases/common/151 reserved targets/coverage/meson.build b/test cases/common/151 reserved targets/coverage/meson.build deleted file mode 100644 index b401055..0000000 --- a/test cases/common/151 reserved targets/coverage/meson.build +++ /dev/null @@ -1 +0,0 @@ -executable('test-coverage', '../test.c') diff --git a/test cases/common/151 reserved targets/dist/meson.build b/test cases/common/151 reserved targets/dist/meson.build deleted file mode 100644 index 951bbb4..0000000 --- a/test cases/common/151 reserved targets/dist/meson.build +++ /dev/null @@ -1 +0,0 @@ -executable('test-dist', '../test.c') diff --git a/test cases/common/151 reserved targets/distcheck/meson.build b/test cases/common/151 reserved targets/distcheck/meson.build deleted file mode 100644 index 12b9328..0000000 --- a/test cases/common/151 reserved targets/distcheck/meson.build +++ /dev/null @@ -1 +0,0 @@ -executable('test-distcheck', '../test.c') diff --git a/test cases/common/151 reserved targets/install/meson.build b/test cases/common/151 reserved targets/install/meson.build deleted file mode 100644 index 4839901..0000000 --- a/test cases/common/151 reserved targets/install/meson.build +++ /dev/null @@ -1 +0,0 @@ -executable('test-install', '../test.c') diff --git a/test cases/common/151 reserved targets/meson.build b/test cases/common/151 reserved targets/meson.build deleted file mode 100644 index 24fd937..0000000 --- a/test cases/common/151 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/151 reserved targets/phony/meson.build b/test cases/common/151 reserved targets/phony/meson.build deleted file mode 100644 index 6710fc1..0000000 --- a/test cases/common/151 reserved targets/phony/meson.build +++ /dev/null @@ -1 +0,0 @@ -executable('test-phony', '../test.c') diff --git a/test cases/common/151 reserved targets/reconfigure/meson.build b/test cases/common/151 reserved targets/reconfigure/meson.build deleted file mode 100644 index c3ea3da..0000000 --- a/test cases/common/151 reserved targets/reconfigure/meson.build +++ /dev/null @@ -1 +0,0 @@ -executable('test-reconfigure', '../test.c') diff --git a/test cases/common/151 reserved targets/runtarget/echo.py b/test cases/common/151 reserved targets/runtarget/echo.py deleted file mode 100644 index 7f9f179..0000000 --- a/test cases/common/151 reserved targets/runtarget/echo.py +++ /dev/null @@ -1,6 +0,0 @@ -#!/usr/bin/env python3 - -import sys - -if len(sys.argv) > 1: - print(sys.argv[1]) diff --git a/test cases/common/151 reserved targets/runtarget/meson.build b/test cases/common/151 reserved targets/runtarget/meson.build deleted file mode 100644 index 7ba0b8c..0000000 --- a/test cases/common/151 reserved targets/runtarget/meson.build +++ /dev/null @@ -1,2 +0,0 @@ -configure_file(output : 'config.h', configuration: configuration_data()) -run_target('runtarget', command : [find_program('echo.py')]) diff --git a/test cases/common/151 reserved targets/scan-build/meson.build b/test cases/common/151 reserved targets/scan-build/meson.build deleted file mode 100644 index 1002053..0000000 --- a/test cases/common/151 reserved targets/scan-build/meson.build +++ /dev/null @@ -1 +0,0 @@ -executable('test-scan-build', '../test.c') diff --git a/test cases/common/151 reserved targets/test.c b/test cases/common/151 reserved targets/test.c deleted file mode 100644 index 03b2213..0000000 --- a/test cases/common/151 reserved targets/test.c +++ /dev/null @@ -1,3 +0,0 @@ -int main(void) { - return 0; -} diff --git a/test cases/common/151 reserved targets/test/meson.build b/test cases/common/151 reserved targets/test/meson.build deleted file mode 100644 index 4ab123c..0000000 --- a/test cases/common/151 reserved targets/test/meson.build +++ /dev/null @@ -1 +0,0 @@ -executable('test-test', '../test.c') diff --git a/test cases/common/151 reserved targets/uninstall/meson.build b/test cases/common/151 reserved targets/uninstall/meson.build deleted file mode 100644 index 21c6ca6..0000000 --- a/test cases/common/151 reserved targets/uninstall/meson.build +++ /dev/null @@ -1 +0,0 @@ -executable('test-uninstall', '../test.c') diff --git a/test cases/common/152 duplicate source names/dir1/file.c b/test cases/common/152 duplicate source names/dir1/file.c deleted file mode 100644 index 1c4753e..0000000 --- a/test cases/common/152 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(void) { - 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/152 duplicate source names/dir1/meson.build b/test cases/common/152 duplicate source names/dir1/meson.build deleted file mode 100644 index 00bc85d..0000000 --- a/test cases/common/152 duplicate source names/dir1/meson.build +++ /dev/null @@ -1 +0,0 @@ -sources += files('file.c') diff --git a/test cases/common/152 duplicate source names/dir2/dir1/file.c b/test cases/common/152 duplicate source names/dir2/dir1/file.c deleted file mode 100644 index 5aac8e5..0000000 --- a/test cases/common/152 duplicate source names/dir2/dir1/file.c +++ /dev/null @@ -1 +0,0 @@ -int dir2_dir1 = 21; diff --git a/test cases/common/152 duplicate source names/dir2/file.c b/test cases/common/152 duplicate source names/dir2/file.c deleted file mode 100644 index 6cf8d66..0000000 --- a/test cases/common/152 duplicate source names/dir2/file.c +++ /dev/null @@ -1 +0,0 @@ -int dir2 = 20; diff --git a/test cases/common/152 duplicate source names/dir2/meson.build b/test cases/common/152 duplicate source names/dir2/meson.build deleted file mode 100644 index f116a02..0000000 --- a/test cases/common/152 duplicate source names/dir2/meson.build +++ /dev/null @@ -1 +0,0 @@ -sources += files('file.c', 'dir1/file.c') diff --git a/test cases/common/152 duplicate source names/dir3/dir1/file.c b/test cases/common/152 duplicate source names/dir3/dir1/file.c deleted file mode 100644 index 04667c2..0000000 --- a/test cases/common/152 duplicate source names/dir3/dir1/file.c +++ /dev/null @@ -1 +0,0 @@ -int dir3_dir1 = 31; diff --git a/test cases/common/152 duplicate source names/dir3/file.c b/test cases/common/152 duplicate source names/dir3/file.c deleted file mode 100644 index d16d0a8..0000000 --- a/test cases/common/152 duplicate source names/dir3/file.c +++ /dev/null @@ -1 +0,0 @@ -int dir3 = 30; diff --git a/test cases/common/152 duplicate source names/dir3/meson.build b/test cases/common/152 duplicate source names/dir3/meson.build deleted file mode 100644 index 70ddbf2..0000000 --- a/test cases/common/152 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/152 duplicate source names/meson.build b/test cases/common/152 duplicate source names/meson.build deleted file mode 100644 index 635aa8c..0000000 --- a/test cases/common/152 duplicate source names/meson.build +++ /dev/null @@ -1,19 +0,0 @@ -project('proj', 'c') - -if meson.backend() == 'xcode' - # Xcode gives object files unique names but only if they would clash. For example - # two files named lib.o instead get the following names: - # - # lib-4fbe522d8ba4cb1f1b89cc2df640a2336b92e1a5565f0a4c5a79b5b5e2969eb9.o - # lib-4fbe522d8ba4cb1f1b89cc2df640a2336deeff2bc2297affaadbe20f5cbfee56.o - # - # No-one has reverse engineered the naming scheme so we would access them. - # IF you feel up to the challenge, patches welcome. - error('MESON_SKIP_TEST, Xcode can not extract objs when they would have the same filename.') -endif - -sources = [] -subdir('dir1') -subdir('dir2') -subdir('dir3') -executable('a.out', sources : sources, objects : lib.extract_all_objects()) diff --git a/test cases/common/152 index customtarget/check_args.py b/test cases/common/152 index customtarget/check_args.py new file mode 100644 index 0000000..8663a6f --- /dev/null +++ b/test cases/common/152 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/152 index customtarget/gen_sources.py b/test cases/common/152 index customtarget/gen_sources.py new file mode 100644 index 0000000..0bdb529 --- /dev/null +++ b/test cases/common/152 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/152 index customtarget/lib.c b/test cases/common/152 index customtarget/lib.c new file mode 100644 index 0000000..17117d5 --- /dev/null +++ b/test cases/common/152 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/152 index customtarget/meson.build b/test cases/common/152 index customtarget/meson.build new file mode 100644 index 0000000..efddfac --- /dev/null +++ b/test cases/common/152 index customtarget/meson.build @@ -0,0 +1,80 @@ +# 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@'], +) + +has_not_changed = false +if is_disabler(gen) + has_not_changed = true +else + has_not_changed = true +endif + +assert(has_not_changed, 'Custom target has changed.') + +assert(not is_disabler(gen), 'Custom target is a disabler.') + +lib = static_library( + 'libfoo', + ['lib.c', gen[1]], +) + +has_not_changed = false +if is_disabler(lib) + has_not_changed = true +else + has_not_changed = true +endif + +assert(has_not_changed, 'Static library has changed.') + +assert(not is_disabler(lib), 'Static library is a disabler.') + +custom_target( + 'foo', + input: gen[0], + output: 'foo', + command: [find_program('check_args.py'), '@INPUT@'], +) + +subdir('subdir') + +gen = disabler() + +assert(is_disabler(gen), 'Generator is not a disabler.') + +lib = static_library( + 'libfoo', + ['lib.c', gen[1]], +) + +assert(is_disabler(lib), 'Static library is not a disabler.') + +if lib.found() + lib_disabled = false +else + lib_disabled = true +endif + +assert(lib_disabled, 'Static library was not disabled.') diff --git a/test cases/common/152 index customtarget/subdir/foo.c b/test cases/common/152 index customtarget/subdir/foo.c new file mode 100644 index 0000000..c620a11 --- /dev/null +++ b/test cases/common/152 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/152 index customtarget/subdir/meson.build b/test cases/common/152 index customtarget/subdir/meson.build new file mode 100644 index 0000000..47bcd32 --- /dev/null +++ b/test cases/common/152 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/153 index customtarget/check_args.py b/test cases/common/153 index customtarget/check_args.py deleted file mode 100644 index 8663a6f..0000000 --- a/test cases/common/153 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/153 index customtarget/gen_sources.py b/test cases/common/153 index customtarget/gen_sources.py deleted file mode 100644 index 0bdb529..0000000 --- a/test cases/common/153 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/153 index customtarget/lib.c b/test cases/common/153 index customtarget/lib.c deleted file mode 100644 index 17117d5..0000000 --- a/test cases/common/153 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/153 index customtarget/meson.build b/test cases/common/153 index customtarget/meson.build deleted file mode 100644 index efddfac..0000000 --- a/test cases/common/153 index customtarget/meson.build +++ /dev/null @@ -1,80 +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@'], -) - -has_not_changed = false -if is_disabler(gen) - has_not_changed = true -else - has_not_changed = true -endif - -assert(has_not_changed, 'Custom target has changed.') - -assert(not is_disabler(gen), 'Custom target is a disabler.') - -lib = static_library( - 'libfoo', - ['lib.c', gen[1]], -) - -has_not_changed = false -if is_disabler(lib) - has_not_changed = true -else - has_not_changed = true -endif - -assert(has_not_changed, 'Static library has changed.') - -assert(not is_disabler(lib), 'Static library is a disabler.') - -custom_target( - 'foo', - input: gen[0], - output: 'foo', - command: [find_program('check_args.py'), '@INPUT@'], -) - -subdir('subdir') - -gen = disabler() - -assert(is_disabler(gen), 'Generator is not a disabler.') - -lib = static_library( - 'libfoo', - ['lib.c', gen[1]], -) - -assert(is_disabler(lib), 'Static library is not a disabler.') - -if lib.found() - lib_disabled = false -else - lib_disabled = true -endif - -assert(lib_disabled, 'Static library was not disabled.') diff --git a/test cases/common/153 index customtarget/subdir/foo.c b/test cases/common/153 index customtarget/subdir/foo.c deleted file mode 100644 index c620a11..0000000 --- a/test cases/common/153 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/153 index customtarget/subdir/meson.build b/test cases/common/153 index customtarget/subdir/meson.build deleted file mode 100644 index 47bcd32..0000000 --- a/test cases/common/153 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/153 wrap file should not failed/meson.build b/test cases/common/153 wrap file should not failed/meson.build new file mode 100644 index 0000000..48d1068 --- /dev/null +++ b/test cases/common/153 wrap file should not failed/meson.build @@ -0,0 +1,16 @@ +project('mainproj', 'c', + default_options : ['wrap_mode=nodownload'], +) + +subproject('zlib') +foo = subproject('foo') +bar = subproject('bar') + +libfoo = foo.get_variable('libfoo') +libbar = bar.get_variable('libbar') + +executable('grabprog', files('src/subprojects/prog.c')) +executable('grabprog2', files('src/subprojects/foo/prog2.c')) +subdir('src') + +subproject('patchdir') diff --git a/test cases/common/153 wrap file should not failed/src/meson.build b/test cases/common/153 wrap file should not failed/src/meson.build new file mode 100644 index 0000000..0c82165 --- /dev/null +++ b/test cases/common/153 wrap file should not failed/src/meson.build @@ -0,0 +1,6 @@ +executable('grabprog3', files('subprojects/prog.c')) +executable('grabprog4', files('subprojects/foo/prog2.c')) + +texe = executable('testexe', files('test.c'), link_with: [libfoo, libbar]) + +test('t1', texe) diff --git a/test cases/common/153 wrap file should not failed/src/subprojects/foo/prog2.c b/test cases/common/153 wrap file should not failed/src/subprojects/foo/prog2.c new file mode 100644 index 0000000..849b400 --- /dev/null +++ b/test cases/common/153 wrap file should not failed/src/subprojects/foo/prog2.c @@ -0,0 +1,7 @@ +#include + +int main(void) { + 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/153 wrap file should not failed/src/subprojects/prog.c b/test cases/common/153 wrap file should not failed/src/subprojects/prog.c new file mode 100644 index 0000000..849b400 --- /dev/null +++ b/test cases/common/153 wrap file should not failed/src/subprojects/prog.c @@ -0,0 +1,7 @@ +#include + +int main(void) { + 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/153 wrap file should not failed/src/test.c b/test cases/common/153 wrap file should not failed/src/test.c new file mode 100644 index 0000000..34cf991 --- /dev/null +++ b/test cases/common/153 wrap file should not failed/src/test.c @@ -0,0 +1,9 @@ +#include + +int bar_dummy_func(void); +int dummy_func(void); + +int main(void) { + printf("Hello world %d\n", bar_dummy_func() + dummy_func()); + return 0; +} diff --git a/test cases/common/153 wrap file should not failed/subprojects/.gitignore b/test cases/common/153 wrap file should not failed/subprojects/.gitignore new file mode 100644 index 0000000..aabded6 --- /dev/null +++ b/test cases/common/153 wrap file should not failed/subprojects/.gitignore @@ -0,0 +1,3 @@ +/foo-1.0 +/bar-1.0 +/foo-1.0-patchdir diff --git a/test cases/common/153 wrap file should not failed/subprojects/bar.wrap b/test cases/common/153 wrap file should not failed/subprojects/bar.wrap new file mode 100644 index 0000000..4e8f7e3 --- /dev/null +++ b/test cases/common/153 wrap file should not failed/subprojects/bar.wrap @@ -0,0 +1,8 @@ +[wrap-file] +directory = bar-1.0 +lead_directory_missing = true + +source_filename = bar-1.0.tar.xz +source_hash = f0f61948530dc0d33e3028cd71a9f8ee869f6b3665960d8f41d715cf4aed6467 + +patch_filename = bar-1.0-patch.tar.xz diff --git a/test cases/common/153 wrap file should not failed/subprojects/foo.wrap b/test cases/common/153 wrap file should not failed/subprojects/foo.wrap new file mode 100644 index 0000000..c67c5e5 --- /dev/null +++ b/test cases/common/153 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 = 9ed8f67d75e43d3be161efb6eddf30dd01995a958ca83951ea64234bac8908c1 +lead_directory_missing = true + +patch_url = https://something.invalid/patch +patch_filename = foo-1.0-patch.tar.xz +patch_hash = d0ddc5e60fdb27d808552f5ac8d0bb603ea2cba306538b4427b985535b26c9c5 diff --git a/test cases/common/153 wrap file should not failed/subprojects/packagecache/foo-1.0-patch.tar.xz b/test cases/common/153 wrap file should not failed/subprojects/packagecache/foo-1.0-patch.tar.xz new file mode 100644 index 0000000..e26b8e0 Binary files /dev/null and b/test cases/common/153 wrap file should not failed/subprojects/packagecache/foo-1.0-patch.tar.xz differ diff --git a/test cases/common/153 wrap file should not failed/subprojects/packagecache/foo-1.0.tar.xz b/test cases/common/153 wrap file should not failed/subprojects/packagecache/foo-1.0.tar.xz new file mode 100644 index 0000000..37eb6cc Binary files /dev/null and b/test cases/common/153 wrap file should not failed/subprojects/packagecache/foo-1.0.tar.xz differ diff --git a/test cases/common/153 wrap file should not failed/subprojects/packagecache/zlib-1.2.8-8-wrap.zip b/test cases/common/153 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/153 wrap file should not failed/subprojects/packagecache/zlib-1.2.8-8-wrap.zip @@ -0,0 +1 @@ +dummy diff --git a/test cases/common/153 wrap file should not failed/subprojects/packagecache/zlib-1.2.8.tar.gz b/test cases/common/153 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/153 wrap file should not failed/subprojects/packagecache/zlib-1.2.8.tar.gz @@ -0,0 +1 @@ +dummy diff --git a/test cases/common/153 wrap file should not failed/subprojects/packagefiles/bar-1.0-patch.tar.xz b/test cases/common/153 wrap file should not failed/subprojects/packagefiles/bar-1.0-patch.tar.xz new file mode 100644 index 0000000..f257a19 Binary files /dev/null and b/test cases/common/153 wrap file should not failed/subprojects/packagefiles/bar-1.0-patch.tar.xz differ diff --git a/test cases/common/153 wrap file should not failed/subprojects/packagefiles/bar-1.0.tar.xz b/test cases/common/153 wrap file should not failed/subprojects/packagefiles/bar-1.0.tar.xz new file mode 100644 index 0000000..d90a9e8 Binary files /dev/null and b/test cases/common/153 wrap file should not failed/subprojects/packagefiles/bar-1.0.tar.xz differ diff --git a/test cases/common/153 wrap file should not failed/subprojects/packagefiles/foo-1.0/meson.build b/test cases/common/153 wrap file should not failed/subprojects/packagefiles/foo-1.0/meson.build new file mode 100644 index 0000000..dbaf91f --- /dev/null +++ b/test cases/common/153 wrap file should not failed/subprojects/packagefiles/foo-1.0/meson.build @@ -0,0 +1,2 @@ +project('static lib patchdir', 'c') +libfoo = static_library('foo', 'foo.c') diff --git a/test cases/common/153 wrap file should not failed/subprojects/patchdir.wrap b/test cases/common/153 wrap file should not failed/subprojects/patchdir.wrap new file mode 100644 index 0000000..1a2134c --- /dev/null +++ b/test cases/common/153 wrap file should not failed/subprojects/patchdir.wrap @@ -0,0 +1,9 @@ +[wrap-file] +directory = foo-1.0-patchdir + +source_url = http://something.invalid +source_filename = foo-1.0.tar.xz +source_hash = 9ed8f67d75e43d3be161efb6eddf30dd01995a958ca83951ea64234bac8908c1 +lead_directory_missing = true + +patch_directory = foo-1.0 diff --git a/test cases/common/153 wrap file should not failed/subprojects/zlib-1.2.8/foo.c b/test cases/common/153 wrap file should not failed/subprojects/zlib-1.2.8/foo.c new file mode 100644 index 0000000..267b43a --- /dev/null +++ b/test cases/common/153 wrap file should not failed/subprojects/zlib-1.2.8/foo.c @@ -0,0 +1,3 @@ +int dummy_func(void) { + return 42; +} diff --git a/test cases/common/153 wrap file should not failed/subprojects/zlib-1.2.8/meson.build b/test cases/common/153 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/153 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/153 wrap file should not failed/subprojects/zlib.wrap b/test cases/common/153 wrap file should not failed/subprojects/zlib.wrap new file mode 100644 index 0000000..6d5896f --- /dev/null +++ b/test cases/common/153 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/154 includedir subproj/meson.build b/test cases/common/154 includedir subproj/meson.build new file mode 100644 index 0000000..b3de5af --- /dev/null +++ b/test cases/common/154 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/154 includedir subproj/prog.c b/test cases/common/154 includedir subproj/prog.c new file mode 100644 index 0000000..03b2213 --- /dev/null +++ b/test cases/common/154 includedir subproj/prog.c @@ -0,0 +1,3 @@ +int main(void) { + return 0; +} diff --git a/test cases/common/154 includedir subproj/subprojects/inctest/include/incfile.h b/test cases/common/154 includedir subproj/subprojects/inctest/include/incfile.h new file mode 100644 index 0000000..ec740da --- /dev/null +++ b/test cases/common/154 includedir subproj/subprojects/inctest/include/incfile.h @@ -0,0 +1,2 @@ + +/* file which is used in the subproject */ diff --git a/test cases/common/154 includedir subproj/subprojects/inctest/meson.build b/test cases/common/154 includedir subproj/subprojects/inctest/meson.build new file mode 100644 index 0000000..74aabcb --- /dev/null +++ b/test cases/common/154 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/154 wrap file should not failed/meson.build b/test cases/common/154 wrap file should not failed/meson.build deleted file mode 100644 index 48d1068..0000000 --- a/test cases/common/154 wrap file should not failed/meson.build +++ /dev/null @@ -1,16 +0,0 @@ -project('mainproj', 'c', - default_options : ['wrap_mode=nodownload'], -) - -subproject('zlib') -foo = subproject('foo') -bar = subproject('bar') - -libfoo = foo.get_variable('libfoo') -libbar = bar.get_variable('libbar') - -executable('grabprog', files('src/subprojects/prog.c')) -executable('grabprog2', files('src/subprojects/foo/prog2.c')) -subdir('src') - -subproject('patchdir') diff --git a/test cases/common/154 wrap file should not failed/src/meson.build b/test cases/common/154 wrap file should not failed/src/meson.build deleted file mode 100644 index 0c82165..0000000 --- a/test cases/common/154 wrap file should not failed/src/meson.build +++ /dev/null @@ -1,6 +0,0 @@ -executable('grabprog3', files('subprojects/prog.c')) -executable('grabprog4', files('subprojects/foo/prog2.c')) - -texe = executable('testexe', files('test.c'), link_with: [libfoo, libbar]) - -test('t1', texe) diff --git a/test cases/common/154 wrap file should not failed/src/subprojects/foo/prog2.c b/test cases/common/154 wrap file should not failed/src/subprojects/foo/prog2.c deleted file mode 100644 index 849b400..0000000 --- a/test cases/common/154 wrap file should not failed/src/subprojects/foo/prog2.c +++ /dev/null @@ -1,7 +0,0 @@ -#include - -int main(void) { - 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/154 wrap file should not failed/src/subprojects/prog.c b/test cases/common/154 wrap file should not failed/src/subprojects/prog.c deleted file mode 100644 index 849b400..0000000 --- a/test cases/common/154 wrap file should not failed/src/subprojects/prog.c +++ /dev/null @@ -1,7 +0,0 @@ -#include - -int main(void) { - 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/154 wrap file should not failed/src/test.c b/test cases/common/154 wrap file should not failed/src/test.c deleted file mode 100644 index 34cf991..0000000 --- a/test cases/common/154 wrap file should not failed/src/test.c +++ /dev/null @@ -1,9 +0,0 @@ -#include - -int bar_dummy_func(void); -int dummy_func(void); - -int main(void) { - printf("Hello world %d\n", bar_dummy_func() + dummy_func()); - return 0; -} diff --git a/test cases/common/154 wrap file should not failed/subprojects/.gitignore b/test cases/common/154 wrap file should not failed/subprojects/.gitignore deleted file mode 100644 index aabded6..0000000 --- a/test cases/common/154 wrap file should not failed/subprojects/.gitignore +++ /dev/null @@ -1,3 +0,0 @@ -/foo-1.0 -/bar-1.0 -/foo-1.0-patchdir diff --git a/test cases/common/154 wrap file should not failed/subprojects/bar.wrap b/test cases/common/154 wrap file should not failed/subprojects/bar.wrap deleted file mode 100644 index 4e8f7e3..0000000 --- a/test cases/common/154 wrap file should not failed/subprojects/bar.wrap +++ /dev/null @@ -1,8 +0,0 @@ -[wrap-file] -directory = bar-1.0 -lead_directory_missing = true - -source_filename = bar-1.0.tar.xz -source_hash = f0f61948530dc0d33e3028cd71a9f8ee869f6b3665960d8f41d715cf4aed6467 - -patch_filename = bar-1.0-patch.tar.xz diff --git a/test cases/common/154 wrap file should not failed/subprojects/foo.wrap b/test cases/common/154 wrap file should not failed/subprojects/foo.wrap deleted file mode 100644 index c67c5e5..0000000 --- a/test cases/common/154 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 = 9ed8f67d75e43d3be161efb6eddf30dd01995a958ca83951ea64234bac8908c1 -lead_directory_missing = true - -patch_url = https://something.invalid/patch -patch_filename = foo-1.0-patch.tar.xz -patch_hash = d0ddc5e60fdb27d808552f5ac8d0bb603ea2cba306538b4427b985535b26c9c5 diff --git a/test cases/common/154 wrap file should not failed/subprojects/packagecache/foo-1.0-patch.tar.xz b/test cases/common/154 wrap file should not failed/subprojects/packagecache/foo-1.0-patch.tar.xz deleted file mode 100644 index e26b8e0..0000000 Binary files a/test cases/common/154 wrap file should not failed/subprojects/packagecache/foo-1.0-patch.tar.xz and /dev/null differ diff --git a/test cases/common/154 wrap file should not failed/subprojects/packagecache/foo-1.0.tar.xz b/test cases/common/154 wrap file should not failed/subprojects/packagecache/foo-1.0.tar.xz deleted file mode 100644 index 37eb6cc..0000000 Binary files a/test cases/common/154 wrap file should not failed/subprojects/packagecache/foo-1.0.tar.xz and /dev/null differ diff --git a/test cases/common/154 wrap file should not failed/subprojects/packagecache/zlib-1.2.8-8-wrap.zip b/test cases/common/154 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/154 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/154 wrap file should not failed/subprojects/packagecache/zlib-1.2.8.tar.gz b/test cases/common/154 wrap file should not failed/subprojects/packagecache/zlib-1.2.8.tar.gz deleted file mode 100644 index 421376d..0000000 --- a/test cases/common/154 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/154 wrap file should not failed/subprojects/packagefiles/bar-1.0-patch.tar.xz b/test cases/common/154 wrap file should not failed/subprojects/packagefiles/bar-1.0-patch.tar.xz deleted file mode 100644 index f257a19..0000000 Binary files a/test cases/common/154 wrap file should not failed/subprojects/packagefiles/bar-1.0-patch.tar.xz and /dev/null differ diff --git a/test cases/common/154 wrap file should not failed/subprojects/packagefiles/bar-1.0.tar.xz b/test cases/common/154 wrap file should not failed/subprojects/packagefiles/bar-1.0.tar.xz deleted file mode 100644 index d90a9e8..0000000 Binary files a/test cases/common/154 wrap file should not failed/subprojects/packagefiles/bar-1.0.tar.xz and /dev/null differ diff --git a/test cases/common/154 wrap file should not failed/subprojects/packagefiles/foo-1.0/meson.build b/test cases/common/154 wrap file should not failed/subprojects/packagefiles/foo-1.0/meson.build deleted file mode 100644 index dbaf91f..0000000 --- a/test cases/common/154 wrap file should not failed/subprojects/packagefiles/foo-1.0/meson.build +++ /dev/null @@ -1,2 +0,0 @@ -project('static lib patchdir', 'c') -libfoo = static_library('foo', 'foo.c') diff --git a/test cases/common/154 wrap file should not failed/subprojects/patchdir.wrap b/test cases/common/154 wrap file should not failed/subprojects/patchdir.wrap deleted file mode 100644 index 1a2134c..0000000 --- a/test cases/common/154 wrap file should not failed/subprojects/patchdir.wrap +++ /dev/null @@ -1,9 +0,0 @@ -[wrap-file] -directory = foo-1.0-patchdir - -source_url = http://something.invalid -source_filename = foo-1.0.tar.xz -source_hash = 9ed8f67d75e43d3be161efb6eddf30dd01995a958ca83951ea64234bac8908c1 -lead_directory_missing = true - -patch_directory = foo-1.0 diff --git a/test cases/common/154 wrap file should not failed/subprojects/zlib-1.2.8/foo.c b/test cases/common/154 wrap file should not failed/subprojects/zlib-1.2.8/foo.c deleted file mode 100644 index 267b43a..0000000 --- a/test cases/common/154 wrap file should not failed/subprojects/zlib-1.2.8/foo.c +++ /dev/null @@ -1,3 +0,0 @@ -int dummy_func(void) { - return 42; -} diff --git a/test cases/common/154 wrap file should not failed/subprojects/zlib-1.2.8/meson.build b/test cases/common/154 wrap file should not failed/subprojects/zlib-1.2.8/meson.build deleted file mode 100644 index 8d8008e..0000000 --- a/test cases/common/154 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/154 wrap file should not failed/subprojects/zlib.wrap b/test cases/common/154 wrap file should not failed/subprojects/zlib.wrap deleted file mode 100644 index 6d5896f..0000000 --- a/test cases/common/154 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/155 includedir subproj/meson.build b/test cases/common/155 includedir subproj/meson.build deleted file mode 100644 index b3de5af..0000000 --- a/test cases/common/155 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/155 includedir subproj/prog.c b/test cases/common/155 includedir subproj/prog.c deleted file mode 100644 index 03b2213..0000000 --- a/test cases/common/155 includedir subproj/prog.c +++ /dev/null @@ -1,3 +0,0 @@ -int main(void) { - return 0; -} diff --git a/test cases/common/155 includedir subproj/subprojects/inctest/include/incfile.h b/test cases/common/155 includedir subproj/subprojects/inctest/include/incfile.h deleted file mode 100644 index ec740da..0000000 --- a/test cases/common/155 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/155 includedir subproj/subprojects/inctest/meson.build b/test cases/common/155 includedir subproj/subprojects/inctest/meson.build deleted file mode 100644 index 74aabcb..0000000 --- a/test cases/common/155 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/155 subproject dir name collision/a.c b/test cases/common/155 subproject dir name collision/a.c new file mode 100644 index 0000000..7510a1b --- /dev/null +++ b/test cases/common/155 subproject dir name collision/a.c @@ -0,0 +1,13 @@ +#include +char func_b(void); +char func_c(void); + +int main(void) { + if(func_b() != 'b') { + return 1; + } + if(func_c() != 'c') { + return 2; + } + return 0; +} diff --git a/test cases/common/155 subproject dir name collision/custom_subproject_dir/B/b.c b/test cases/common/155 subproject dir name collision/custom_subproject_dir/B/b.c new file mode 100644 index 0000000..4d71c0f --- /dev/null +++ b/test cases/common/155 subproject dir name collision/custom_subproject_dir/B/b.c @@ -0,0 +1,20 @@ +#include +char func_c(void); + +#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(void) { + if(func_c() != 'c') { + exit(3); + } + return 'b'; +} diff --git a/test cases/common/155 subproject dir name collision/custom_subproject_dir/B/meson.build b/test cases/common/155 subproject dir name collision/custom_subproject_dir/B/meson.build new file mode 100644 index 0000000..280c60c --- /dev/null +++ b/test cases/common/155 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/155 subproject dir name collision/custom_subproject_dir/C/c.c b/test cases/common/155 subproject dir name collision/custom_subproject_dir/C/c.c new file mode 100644 index 0000000..facd199 --- /dev/null +++ b/test cases/common/155 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(void) { + return 'c'; +} diff --git a/test cases/common/155 subproject dir name collision/custom_subproject_dir/C/meson.build b/test cases/common/155 subproject dir name collision/custom_subproject_dir/C/meson.build new file mode 100644 index 0000000..abf0b1e --- /dev/null +++ b/test cases/common/155 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/155 subproject dir name collision/meson.build b/test cases/common/155 subproject dir name collision/meson.build new file mode 100644 index 0000000..5531217 --- /dev/null +++ b/test cases/common/155 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/155 subproject dir name collision/other_subdir/custom_subproject_dir/other.c b/test cases/common/155 subproject dir name collision/other_subdir/custom_subproject_dir/other.c new file mode 100644 index 0000000..fa1953e --- /dev/null +++ b/test cases/common/155 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(void) { + if('c' != 'c') { + exit(3); + } + return 'b'; +} diff --git a/test cases/common/155 subproject dir name collision/other_subdir/meson.build b/test cases/common/155 subproject dir name collision/other_subdir/meson.build new file mode 100644 index 0000000..90cb67a --- /dev/null +++ b/test cases/common/155 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/156 config tool variable/meson.build b/test cases/common/156 config tool variable/meson.build new file mode 100644 index 0000000..9584117 --- /dev/null +++ b/test cases/common/156 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/156 subproject dir name collision/a.c b/test cases/common/156 subproject dir name collision/a.c deleted file mode 100644 index 7510a1b..0000000 --- a/test cases/common/156 subproject dir name collision/a.c +++ /dev/null @@ -1,13 +0,0 @@ -#include -char func_b(void); -char func_c(void); - -int main(void) { - if(func_b() != 'b') { - return 1; - } - if(func_c() != 'c') { - return 2; - } - return 0; -} diff --git a/test cases/common/156 subproject dir name collision/custom_subproject_dir/B/b.c b/test cases/common/156 subproject dir name collision/custom_subproject_dir/B/b.c deleted file mode 100644 index 4d71c0f..0000000 --- a/test cases/common/156 subproject dir name collision/custom_subproject_dir/B/b.c +++ /dev/null @@ -1,20 +0,0 @@ -#include -char func_c(void); - -#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(void) { - if(func_c() != 'c') { - exit(3); - } - return 'b'; -} diff --git a/test cases/common/156 subproject dir name collision/custom_subproject_dir/B/meson.build b/test cases/common/156 subproject dir name collision/custom_subproject_dir/B/meson.build deleted file mode 100644 index 280c60c..0000000 --- a/test cases/common/156 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/156 subproject dir name collision/custom_subproject_dir/C/c.c b/test cases/common/156 subproject dir name collision/custom_subproject_dir/C/c.c deleted file mode 100644 index facd199..0000000 --- a/test cases/common/156 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(void) { - return 'c'; -} diff --git a/test cases/common/156 subproject dir name collision/custom_subproject_dir/C/meson.build b/test cases/common/156 subproject dir name collision/custom_subproject_dir/C/meson.build deleted file mode 100644 index abf0b1e..0000000 --- a/test cases/common/156 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/156 subproject dir name collision/meson.build b/test cases/common/156 subproject dir name collision/meson.build deleted file mode 100644 index 5531217..0000000 --- a/test cases/common/156 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/156 subproject dir name collision/other_subdir/custom_subproject_dir/other.c b/test cases/common/156 subproject dir name collision/other_subdir/custom_subproject_dir/other.c deleted file mode 100644 index fa1953e..0000000 --- a/test cases/common/156 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(void) { - if('c' != 'c') { - exit(3); - } - return 'b'; -} diff --git a/test cases/common/156 subproject dir name collision/other_subdir/meson.build b/test cases/common/156 subproject dir name collision/other_subdir/meson.build deleted file mode 100644 index 90cb67a..0000000 --- a/test cases/common/156 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/157 config tool variable/meson.build b/test cases/common/157 config tool variable/meson.build deleted file mode 100644 index 9584117..0000000 --- a/test cases/common/157 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/157 custom target subdir depend files/copyfile.py b/test cases/common/157 custom target subdir depend files/copyfile.py new file mode 100644 index 0000000..ff42ac3 --- /dev/null +++ b/test cases/common/157 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/157 custom target subdir depend files/meson.build b/test cases/common/157 custom target subdir depend files/meson.build new file mode 100644 index 0000000..44f5c71 --- /dev/null +++ b/test cases/common/157 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/157 custom target subdir depend files/subdir/dep.dat b/test cases/common/157 custom target subdir depend files/subdir/dep.dat new file mode 100644 index 0000000..5daee49 --- /dev/null +++ b/test cases/common/157 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/157 custom target subdir depend files/subdir/foo.c.in b/test cases/common/157 custom target subdir depend files/subdir/foo.c.in new file mode 100644 index 0000000..a867b32 --- /dev/null +++ b/test cases/common/157 custom target subdir depend files/subdir/foo.c.in @@ -0,0 +1,6 @@ +#include + +int main(void) { + printf("foo is working.\n"); + return 0; +} diff --git a/test cases/common/157 custom target subdir depend files/subdir/meson.build b/test cases/common/157 custom target subdir depend files/subdir/meson.build new file mode 100644 index 0000000..f9d31c4 --- /dev/null +++ b/test cases/common/157 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/158 custom target subdir depend files/copyfile.py b/test cases/common/158 custom target subdir depend files/copyfile.py deleted file mode 100644 index ff42ac3..0000000 --- a/test cases/common/158 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/158 custom target subdir depend files/meson.build b/test cases/common/158 custom target subdir depend files/meson.build deleted file mode 100644 index 44f5c71..0000000 --- a/test cases/common/158 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/158 custom target subdir depend files/subdir/dep.dat b/test cases/common/158 custom target subdir depend files/subdir/dep.dat deleted file mode 100644 index 5daee49..0000000 --- a/test cases/common/158 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/158 custom target subdir depend files/subdir/foo.c.in b/test cases/common/158 custom target subdir depend files/subdir/foo.c.in deleted file mode 100644 index a867b32..0000000 --- a/test cases/common/158 custom target subdir depend files/subdir/foo.c.in +++ /dev/null @@ -1,6 +0,0 @@ -#include - -int main(void) { - printf("foo is working.\n"); - return 0; -} diff --git a/test cases/common/158 custom target subdir depend files/subdir/meson.build b/test cases/common/158 custom target subdir depend files/subdir/meson.build deleted file mode 100644 index f9d31c4..0000000 --- a/test cases/common/158 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/158 disabler/meson.build b/test cases/common/158 disabler/meson.build new file mode 100644 index 0000000..d132e2b --- /dev/null +++ b/test cases/common/158 disabler/meson.build @@ -0,0 +1,153 @@ +project('dolphin option', 'c') + +d = disabler() + +full_path = d.full_path() +assert(is_disabler(full_path), 'Method call is not a disabler') + +d2 = dependency(d) +d3 = (d == d2) +d4 = d + 0 +d5 = d2 or true +set_variable('d6', disabler()) + +has_not_changed = false +if is_disabler(d) + has_not_changed = true +else + has_not_changed = true +endif +assert(has_not_changed, 'Disabler has changed.') + +assert(is_disabler(d), 'Disabler was not identified correctly.') +assert(is_disabler(d2), 'Function laundered disabler was not identified correctly.') +assert(is_disabler(d3), 'Disabler comparison should yield disabler.') +assert(is_disabler(d4), 'Disabler addition should yield disabler.') +assert(is_disabler(d5), 'Disabler logic op should yield disabler.') +assert(is_disabler(d6), 'set_variable with a disabler should set variable to disabler.') + +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.') +assert(d6, 'set_variable with a disabler did not cause this to be skipped.') + +number = 0 + +if d + number = 1 +else + number = 2 +endif + +has_not_changed = false +if is_disabler(number) + has_not_changed = true +else + has_not_changed = true +endif +assert(has_not_changed, 'Number has changed.') + +assert(not is_disabler(number), 'Number should not be a disabler.') +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]) +assert(is_disabler(app), 'App is not a disabler.') +app = executable('myapp', 'notfound.c', dependencies : [[dep]]) +assert(is_disabler(app), 'App is not a disabler.') + +cc = meson.get_compiler('c') +dep = cc.find_library('notfounddep', required : false, disabler : true) +app = executable('myapp', 'notfound.c', dependencies : [dep]) +assert(is_disabler(app), 'App is not a disabler.') + +dep = find_program('donotfindme', required : false, disabler : true) +app = executable('myapp', 'notfound.c', dependencies : [dep]) +assert(is_disabler(app), 'App is not a disabler.') + +has_not_changed = false +if is_disabler(app) + has_not_changed = true +else + has_not_changed = true +endif +assert(has_not_changed, 'App has changed.') + +assert(not is_disabler(is_variable('d6')), 'is_variable should not return a disabler') +assert(is_variable('d6'), 'is_variable for a disabler should return true') + +if_is_not_disabled = false +if is_variable('d6') + if_is_not_disabled = true +else + if_is_not_disabled = true +endif +assert(if_is_not_disabled, 'Disabler in is_variable should not skip blocks') + +get_d = get_variable('d6') +assert(is_disabler(get_d), 'get_variable should yield a disabler') + +get_fallback_d = get_variable('nonexistant', disabler()) +assert(is_disabler(get_fallback_d), 'get_variable fallback should yield a disabler') + +var_true = true +get_no_fallback_d = get_variable('var_true', disabler()) +assert(not is_disabler(get_no_fallback_d), 'get_variable should not fallback to disabler') +assert(get_no_fallback_d, 'get_variable should yield true') + +assert(is_disabler(get_variable(disabler())), 'get_variable should yield a disabler') +assert(is_disabler(get_variable(disabler(), var_true)), 'get_variable should yield a disabler') + +if_is_disabled = true +if disabler() + if_is_disabled = false +else + if_is_disabled = false +endif +assert(if_is_disabled, 'Disabler in "if condition" must skip both blocks') + +if not disabler() + if_is_disabled = false +else + if_is_disabled = false +endif +assert(if_is_disabled, 'Disabler in "if not condition" must skip both blocks') + +if disabler() == 1 + if_is_disabled = false +else + if_is_disabled = false +endif +assert(if_is_disabled, 'Disabler in "if a==b" must skip both blocks') + +loops = 0 +disablers = 0 +foreach i : [true, disabler(), true] + loops += 1 + if is_disabler(i) + disablers += 1 + endif +endforeach +assert(loops == 3, 'Disabler in foreach array') +assert(disablers == 1, 'Disabler in foreach array') + +loops = 0 +disablers = 0 +foreach k, i : {'a': true, 'b': disabler(), 'c': true} + loops += 1 + if is_disabler(i) + disablers += 1 + endif +endforeach +assert(loops == 3, 'Disabler in foreach dict') +assert(disablers == 1, 'Disabler in foreach dict') diff --git a/test cases/common/159 array option/meson.build b/test cases/common/159 array option/meson.build new file mode 100644 index 0000000..034b9a5 --- /dev/null +++ b/test cases/common/159 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/159 array option/meson_options.txt b/test cases/common/159 array option/meson_options.txt new file mode 100644 index 0000000..7ed0ac1 --- /dev/null +++ b/test cases/common/159 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/159 disabler/meson.build b/test cases/common/159 disabler/meson.build deleted file mode 100644 index d132e2b..0000000 --- a/test cases/common/159 disabler/meson.build +++ /dev/null @@ -1,153 +0,0 @@ -project('dolphin option', 'c') - -d = disabler() - -full_path = d.full_path() -assert(is_disabler(full_path), 'Method call is not a disabler') - -d2 = dependency(d) -d3 = (d == d2) -d4 = d + 0 -d5 = d2 or true -set_variable('d6', disabler()) - -has_not_changed = false -if is_disabler(d) - has_not_changed = true -else - has_not_changed = true -endif -assert(has_not_changed, 'Disabler has changed.') - -assert(is_disabler(d), 'Disabler was not identified correctly.') -assert(is_disabler(d2), 'Function laundered disabler was not identified correctly.') -assert(is_disabler(d3), 'Disabler comparison should yield disabler.') -assert(is_disabler(d4), 'Disabler addition should yield disabler.') -assert(is_disabler(d5), 'Disabler logic op should yield disabler.') -assert(is_disabler(d6), 'set_variable with a disabler should set variable to disabler.') - -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.') -assert(d6, 'set_variable with a disabler did not cause this to be skipped.') - -number = 0 - -if d - number = 1 -else - number = 2 -endif - -has_not_changed = false -if is_disabler(number) - has_not_changed = true -else - has_not_changed = true -endif -assert(has_not_changed, 'Number has changed.') - -assert(not is_disabler(number), 'Number should not be a disabler.') -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]) -assert(is_disabler(app), 'App is not a disabler.') -app = executable('myapp', 'notfound.c', dependencies : [[dep]]) -assert(is_disabler(app), 'App is not a disabler.') - -cc = meson.get_compiler('c') -dep = cc.find_library('notfounddep', required : false, disabler : true) -app = executable('myapp', 'notfound.c', dependencies : [dep]) -assert(is_disabler(app), 'App is not a disabler.') - -dep = find_program('donotfindme', required : false, disabler : true) -app = executable('myapp', 'notfound.c', dependencies : [dep]) -assert(is_disabler(app), 'App is not a disabler.') - -has_not_changed = false -if is_disabler(app) - has_not_changed = true -else - has_not_changed = true -endif -assert(has_not_changed, 'App has changed.') - -assert(not is_disabler(is_variable('d6')), 'is_variable should not return a disabler') -assert(is_variable('d6'), 'is_variable for a disabler should return true') - -if_is_not_disabled = false -if is_variable('d6') - if_is_not_disabled = true -else - if_is_not_disabled = true -endif -assert(if_is_not_disabled, 'Disabler in is_variable should not skip blocks') - -get_d = get_variable('d6') -assert(is_disabler(get_d), 'get_variable should yield a disabler') - -get_fallback_d = get_variable('nonexistant', disabler()) -assert(is_disabler(get_fallback_d), 'get_variable fallback should yield a disabler') - -var_true = true -get_no_fallback_d = get_variable('var_true', disabler()) -assert(not is_disabler(get_no_fallback_d), 'get_variable should not fallback to disabler') -assert(get_no_fallback_d, 'get_variable should yield true') - -assert(is_disabler(get_variable(disabler())), 'get_variable should yield a disabler') -assert(is_disabler(get_variable(disabler(), var_true)), 'get_variable should yield a disabler') - -if_is_disabled = true -if disabler() - if_is_disabled = false -else - if_is_disabled = false -endif -assert(if_is_disabled, 'Disabler in "if condition" must skip both blocks') - -if not disabler() - if_is_disabled = false -else - if_is_disabled = false -endif -assert(if_is_disabled, 'Disabler in "if not condition" must skip both blocks') - -if disabler() == 1 - if_is_disabled = false -else - if_is_disabled = false -endif -assert(if_is_disabled, 'Disabler in "if a==b" must skip both blocks') - -loops = 0 -disablers = 0 -foreach i : [true, disabler(), true] - loops += 1 - if is_disabler(i) - disablers += 1 - endif -endforeach -assert(loops == 3, 'Disabler in foreach array') -assert(disablers == 1, 'Disabler in foreach array') - -loops = 0 -disablers = 0 -foreach k, i : {'a': true, 'b': disabler(), 'c': true} - loops += 1 - if is_disabler(i) - disablers += 1 - endif -endforeach -assert(loops == 3, 'Disabler in foreach dict') -assert(disablers == 1, 'Disabler in foreach dict') diff --git a/test cases/common/16 comparison/meson.build b/test cases/common/16 comparison/meson.build new file mode 100644 index 0000000..bba0168 --- /dev/null +++ b/test cases/common/16 comparison/meson.build @@ -0,0 +1,154 @@ +project('comparison', 'c') + +# Compare equality of strings + +var1 = 'foo' +var2 = 'bar' + +if var1 == var2 + exe1 = executable('broken', 'broken.c') +else + exe1 = executable('prog1', 'prog.c') +endif + +if var1 == var1 + exe2 = executable('prog2', 'prog.c') +else + exe2 = executable('broken', 'broken.c') +endif + +if var1 != var2 + exe3 = executable('prog3', 'prog.c') +else + exe3 = executable('broken', 'broken.c') +endif + +if var1 != var1 + exe4 = executable('broken', 'broken.c') +else + exe4 = executable('prog4', 'prog.c') +endif + +test('equalfalse', exe1) +test('equaltrue', exe2) +test('nequaltrue', exe3) +test('nequalfalse', exe4) + +# Non-equality comparisons + +var3 = 3 +var4 = 4 + +if var3 < var4 + exe5 = executable('prog5', 'prog.c') +else + exe5 = executable('broken', 'broken.c') +endif + +if var3 < var3 + exe6 = executable('broken', 'broken.c') +else + exe6 = executable('prog6', 'prog.c') +endif + +if var4 > var3 + exe7 = executable('prog7', 'prog.c') +else + exe7 = executable('broken', 'broken.c') +endif + +if var3 > var3 + exe8 = executable('broken', 'broken.c') +else + exe8 = executable('prog8', 'prog.c') +endif + +if var4 <= var3 + exe9 = executable('broken', 'broken.c') +else + exe9 = executable('prog9', 'prog.c') +endif + +if var3 <= var3 + exe10 = executable('prog10', 'prog.c') +else + exe10 = executable('broken', 'broken.c') +endif + +if var3 >= var4 + exe11 = executable('broken', 'broken.c') +else + exe11 = executable('prog11', 'prog.c') +endif + +if var3 >= var3 + exe12 = executable('prog12', 'prog.c') +else + exe12 = executable('broken', 'broken.c') +endif + +test('lttrue', exe5) +test('ltfalse', exe6) +test('gttrue', exe7) +test('gtfalse', exe8) +test('lefalse', exe9) +test('letrue', exe10) +test('gefalse', exe11) +test('getrue', exe12) + +# Non-elementary type comparisons + +if exe1 == exe2 + exe13 = executable('broken', 'broken.c') +else + exe13 = executable('prog13', 'prog.c') +endif + +if exe1 == exe1 + exe14 = executable('prog14', 'prog.c') +else + exe14 = executable('broken', 'broken.c') +endif + +if exe1 != exe2 + exe15 = executable('prog15', 'prog.c') +else + exe15 = executable('broken', 'broken.c') +endif + +if exe1 != exe1 + exe16 = executable('broken', 'broken.c') +else + exe16 = executable('prog16', 'prog.c') +endif + +test('equalfalse', exe13) +test('equaltrue', exe14) +test('nequaltrue', exe15) +test('nequalfalse', exe16) + +# Equality comparisons of different elementary types +# (these all cause warnings currently, will become an error in future) + +assert([] != 'st', 'not equal') +assert([] != 1, 'not equal') +assert(2 != 'st', 'not equal') + +assert(not ([] == 'st'), 'not equal') +assert(not ([] == 1), 'not equal') +assert(not (2 == 'st'), 'not equal') + +# "in" and "not in" operators + +assert(1 in [1, 2], '''1 should be in [1, 2]''') +assert(3 not in [1, 2], '''3 shouldn't be in [1, 2]''') +assert(not (3 in [1, 2]), '''3 shouldn't be in [1, 2]''') + +assert('b' in ['a', 'b'], ''''b' should be in ['a', 'b']''') +assert('c' not in ['a', 'b'], ''''c' shouldn't be in ['a', 'b']''') + +assert(exe1 in [exe1, exe2], ''''exe1 should be in [exe1, exe2]''') +assert(exe3 not in [exe1, exe2], ''''exe3 shouldn't be in [exe1, exe2]''') + +assert('a' in {'a': 'b'}, '''1 should be in {'a': 'b'}''') +assert('b' not in {'a': 'b'}, '''1 should be in {'a': 'b'}''') diff --git a/test cases/common/16 comparison/prog.c b/test cases/common/16 comparison/prog.c new file mode 100644 index 0000000..78f2de1 --- /dev/null +++ b/test cases/common/16 comparison/prog.c @@ -0,0 +1 @@ +int main(void) { return 0; } diff --git a/test cases/common/160 array option/meson.build b/test cases/common/160 array option/meson.build deleted file mode 100644 index 034b9a5..0000000 --- a/test cases/common/160 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/160 array option/meson_options.txt b/test cases/common/160 array option/meson_options.txt deleted file mode 100644 index 7ed0ac1..0000000 --- a/test cases/common/160 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/160 custom target template substitution/checkcopy.py b/test cases/common/160 custom target template substitution/checkcopy.py new file mode 100644 index 0000000..ab9f436 --- /dev/null +++ b/test cases/common/160 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/160 custom target template substitution/foo.c.in b/test cases/common/160 custom target template substitution/foo.c.in new file mode 100644 index 0000000..a867b32 --- /dev/null +++ b/test cases/common/160 custom target template substitution/foo.c.in @@ -0,0 +1,6 @@ +#include + +int main(void) { + printf("foo is working.\n"); + return 0; +} diff --git a/test cases/common/160 custom target template substitution/meson.build b/test cases/common/160 custom target template substitution/meson.build new file mode 100644 index 0000000..737408e --- /dev/null +++ b/test cases/common/160 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/161 custom target template substitution/checkcopy.py b/test cases/common/161 custom target template substitution/checkcopy.py deleted file mode 100644 index ab9f436..0000000 --- a/test cases/common/161 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/161 custom target template substitution/foo.c.in b/test cases/common/161 custom target template substitution/foo.c.in deleted file mode 100644 index a867b32..0000000 --- a/test cases/common/161 custom target template substitution/foo.c.in +++ /dev/null @@ -1,6 +0,0 @@ -#include - -int main(void) { - printf("foo is working.\n"); - return 0; -} diff --git a/test cases/common/161 custom target template substitution/meson.build b/test cases/common/161 custom target template substitution/meson.build deleted file mode 100644 index 737408e..0000000 --- a/test cases/common/161 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/161 not-found dependency/meson.build b/test cases/common/161 not-found dependency/meson.build new file mode 100644 index 0000000..02072b6 --- /dev/null +++ b/test cases/common/161 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/161 not-found dependency/sub/meson.build b/test cases/common/161 not-found dependency/sub/meson.build new file mode 100644 index 0000000..2a33cae --- /dev/null +++ b/test cases/common/161 not-found dependency/sub/meson.build @@ -0,0 +1 @@ +error('should be disabled by subdir(if_found:)') diff --git a/test cases/common/161 not-found dependency/subprojects/trivial/meson.build b/test cases/common/161 not-found dependency/subprojects/trivial/meson.build new file mode 100644 index 0000000..8769c70 --- /dev/null +++ b/test cases/common/161 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/161 not-found dependency/subprojects/trivial/trivial.c b/test cases/common/161 not-found dependency/subprojects/trivial/trivial.c new file mode 100644 index 0000000..cb0c02f --- /dev/null +++ b/test cases/common/161 not-found dependency/subprojects/trivial/trivial.c @@ -0,0 +1,3 @@ +int subfunc(void) { + return 42; +} diff --git a/test cases/common/161 not-found dependency/testlib.c b/test cases/common/161 not-found dependency/testlib.c new file mode 100644 index 0000000..e69de29 diff --git a/test cases/common/162 not-found dependency/meson.build b/test cases/common/162 not-found dependency/meson.build deleted file mode 100644 index 02072b6..0000000 --- a/test cases/common/162 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/162 not-found dependency/sub/meson.build b/test cases/common/162 not-found dependency/sub/meson.build deleted file mode 100644 index 2a33cae..0000000 --- a/test cases/common/162 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/162 not-found dependency/subprojects/trivial/meson.build b/test cases/common/162 not-found dependency/subprojects/trivial/meson.build deleted file mode 100644 index 8769c70..0000000 --- a/test cases/common/162 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/162 not-found dependency/subprojects/trivial/trivial.c b/test cases/common/162 not-found dependency/subprojects/trivial/trivial.c deleted file mode 100644 index cb0c02f..0000000 --- a/test cases/common/162 not-found dependency/subprojects/trivial/trivial.c +++ /dev/null @@ -1,3 +0,0 @@ -int subfunc(void) { - return 42; -} diff --git a/test cases/common/162 not-found dependency/testlib.c b/test cases/common/162 not-found dependency/testlib.c deleted file mode 100644 index e69de29..0000000 diff --git a/test cases/common/162 subdir if_found/meson.build b/test cases/common/162 subdir if_found/meson.build new file mode 100644 index 0000000..2c640cf --- /dev/null +++ b/test cases/common/162 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/162 subdir if_found/subdir/meson.build b/test cases/common/162 subdir if_found/subdir/meson.build new file mode 100644 index 0000000..1030e25 --- /dev/null +++ b/test cases/common/162 subdir if_found/subdir/meson.build @@ -0,0 +1 @@ +variable = 5 diff --git a/test cases/common/163 default options prefix dependent defaults/meson.build b/test cases/common/163 default options prefix dependent defaults/meson.build new file mode 100644 index 0000000..9ca4ec5 --- /dev/null +++ b/test cases/common/163 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/163 subdir if_found/meson.build b/test cases/common/163 subdir if_found/meson.build deleted file mode 100644 index 2c640cf..0000000 --- a/test cases/common/163 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/163 subdir if_found/subdir/meson.build b/test cases/common/163 subdir if_found/subdir/meson.build deleted file mode 100644 index 1030e25..0000000 --- a/test cases/common/163 subdir if_found/subdir/meson.build +++ /dev/null @@ -1 +0,0 @@ -variable = 5 diff --git a/test cases/common/164 default options prefix dependent defaults/meson.build b/test cases/common/164 default options prefix dependent defaults/meson.build deleted file mode 100644 index 9ca4ec5..0000000 --- a/test cases/common/164 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/164 dependency factory/meson.build b/test cases/common/164 dependency factory/meson.build new file mode 100644 index 0000000..2de0f0e --- /dev/null +++ b/test cases/common/164 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/165 dependency factory/meson.build b/test cases/common/165 dependency factory/meson.build deleted file mode 100644 index 2de0f0e..0000000 --- a/test cases/common/165 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/165 get project license/bar.c b/test cases/common/165 get project license/bar.c new file mode 100644 index 0000000..f1bd822 --- /dev/null +++ b/test cases/common/165 get project license/bar.c @@ -0,0 +1,6 @@ +#include + +int main(void) { + printf("I'm a main project bar.\n"); + return 0; +} diff --git a/test cases/common/165 get project license/meson.build b/test cases/common/165 get project license/meson.build new file mode 100644 index 0000000..e7e9deb --- /dev/null +++ b/test cases/common/165 get project license/meson.build @@ -0,0 +1,8 @@ +project('bar', 'c', license: 'Apache-2.0') + +executable('bar', 'bar.c') + +license = meson.project_license()[0] +if license != 'Apache-2.0' + error('The license should be Apache-2.0, but it is: ' + license) +endif diff --git a/test cases/common/166 get project license/bar.c b/test cases/common/166 get project license/bar.c deleted file mode 100644 index f1bd822..0000000 --- a/test cases/common/166 get project license/bar.c +++ /dev/null @@ -1,6 +0,0 @@ -#include - -int main(void) { - printf("I'm a main project bar.\n"); - return 0; -} diff --git a/test cases/common/166 get project license/meson.build b/test cases/common/166 get project license/meson.build deleted file mode 100644 index e7e9deb..0000000 --- a/test cases/common/166 get project license/meson.build +++ /dev/null @@ -1,8 +0,0 @@ -project('bar', 'c', license: 'Apache-2.0') - -executable('bar', 'bar.c') - -license = meson.project_license()[0] -if license != 'Apache-2.0' - error('The license should be Apache-2.0, but it is: ' + license) -endif diff --git a/test cases/common/166 yield/meson.build b/test cases/common/166 yield/meson.build new file mode 100644 index 0000000..9b11569 --- /dev/null +++ b/test cases/common/166 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/166 yield/meson_options.txt b/test cases/common/166 yield/meson_options.txt new file mode 100644 index 0000000..9f58fbb --- /dev/null +++ b/test cases/common/166 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/166 yield/subprojects/sub/meson.build b/test cases/common/166 yield/subprojects/sub/meson.build new file mode 100644 index 0000000..832c13c --- /dev/null +++ b/test cases/common/166 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/166 yield/subprojects/sub/meson_options.txt b/test cases/common/166 yield/subprojects/sub/meson_options.txt new file mode 100644 index 0000000..101122e --- /dev/null +++ b/test cases/common/166 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/167 subproject nested subproject dirs/contrib/subprojects/alpha/a.c b/test cases/common/167 subproject nested subproject dirs/contrib/subprojects/alpha/a.c new file mode 100644 index 0000000..f9848c1 --- /dev/null +++ b/test cases/common/167 subproject nested subproject dirs/contrib/subprojects/alpha/a.c @@ -0,0 +1,15 @@ +int func2(void); + +#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(void) { return func2(); } + diff --git a/test cases/common/167 subproject nested subproject dirs/contrib/subprojects/alpha/meson.build b/test cases/common/167 subproject nested subproject dirs/contrib/subprojects/alpha/meson.build new file mode 100644 index 0000000..12f6564 --- /dev/null +++ b/test cases/common/167 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/167 subproject nested subproject dirs/contrib/subprojects/alpha/var/subprojects/wrap_files_might_be_here b/test cases/common/167 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/167 subproject nested subproject dirs/contrib/subprojects/alpha/var/subprojects/wrap_files_might_be_here @@ -0,0 +1 @@ + diff --git a/test cases/common/167 subproject nested subproject dirs/contrib/subprojects/beta/b.c b/test cases/common/167 subproject nested subproject dirs/contrib/subprojects/beta/b.c new file mode 100644 index 0000000..8c07177 --- /dev/null +++ b/test cases/common/167 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(void) { + return 42; +} diff --git a/test cases/common/167 subproject nested subproject dirs/contrib/subprojects/beta/meson.build b/test cases/common/167 subproject nested subproject dirs/contrib/subprojects/beta/meson.build new file mode 100644 index 0000000..1720d3e --- /dev/null +++ b/test cases/common/167 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/167 subproject nested subproject dirs/meson.build b/test cases/common/167 subproject nested subproject dirs/meson.build new file mode 100644 index 0000000..875eed3 --- /dev/null +++ b/test cases/common/167 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/167 subproject nested subproject dirs/prog.c b/test cases/common/167 subproject nested subproject dirs/prog.c new file mode 100644 index 0000000..27162c5 --- /dev/null +++ b/test cases/common/167 subproject nested subproject dirs/prog.c @@ -0,0 +1,5 @@ +int func(void); + +int main(void) { + return func() == 42 ? 0 : 1; +} diff --git a/test cases/common/167 yield/meson.build b/test cases/common/167 yield/meson.build deleted file mode 100644 index 9b11569..0000000 --- a/test cases/common/167 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/167 yield/meson_options.txt b/test cases/common/167 yield/meson_options.txt deleted file mode 100644 index 9f58fbb..0000000 --- a/test cases/common/167 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/167 yield/subprojects/sub/meson.build b/test cases/common/167 yield/subprojects/sub/meson.build deleted file mode 100644 index 832c13c..0000000 --- a/test cases/common/167 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/167 yield/subprojects/sub/meson_options.txt b/test cases/common/167 yield/subprojects/sub/meson_options.txt deleted file mode 100644 index 101122e..0000000 --- a/test cases/common/167 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/168 preserve gendir/base.inp b/test cases/common/168 preserve gendir/base.inp new file mode 100644 index 0000000..df967b9 --- /dev/null +++ b/test cases/common/168 preserve gendir/base.inp @@ -0,0 +1 @@ +base diff --git a/test cases/common/168 preserve gendir/com/mesonbuild/subbie.inp b/test cases/common/168 preserve gendir/com/mesonbuild/subbie.inp new file mode 100644 index 0000000..df0f4e9 --- /dev/null +++ b/test cases/common/168 preserve gendir/com/mesonbuild/subbie.inp @@ -0,0 +1 @@ +subbie diff --git a/test cases/common/168 preserve gendir/genprog.py b/test cases/common/168 preserve gendir/genprog.py new file mode 100755 index 0000000..681c43a --- /dev/null +++ b/test cases/common/168 preserve gendir/genprog.py @@ -0,0 +1,46 @@ +#!/usr/bin/env python3 + +import os, sys, argparse + +h_templ = '''#pragma once + +int %s(void); +''' + +c_templ = '''#include"%s.h" + +int %s(void) { + 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(f'Input file {ifile} does not start with search dir {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/168 preserve gendir/meson.build b/test cases/common/168 preserve gendir/meson.build new file mode 100644 index 0000000..ce219f0 --- /dev/null +++ b/test cases/common/168 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/168 preserve gendir/testprog.c b/test cases/common/168 preserve gendir/testprog.c new file mode 100644 index 0000000..b6a9926 --- /dev/null +++ b/test cases/common/168 preserve gendir/testprog.c @@ -0,0 +1,6 @@ +#include"base.h" +#include"com/mesonbuild/subbie.h" + +int main(void) { + return base() + subbie(); +} diff --git a/test cases/common/168 subproject nested subproject dirs/contrib/subprojects/alpha/a.c b/test cases/common/168 subproject nested subproject dirs/contrib/subprojects/alpha/a.c deleted file mode 100644 index f9848c1..0000000 --- a/test cases/common/168 subproject nested subproject dirs/contrib/subprojects/alpha/a.c +++ /dev/null @@ -1,15 +0,0 @@ -int func2(void); - -#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(void) { return func2(); } - diff --git a/test cases/common/168 subproject nested subproject dirs/contrib/subprojects/alpha/meson.build b/test cases/common/168 subproject nested subproject dirs/contrib/subprojects/alpha/meson.build deleted file mode 100644 index 12f6564..0000000 --- a/test cases/common/168 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/168 subproject nested subproject dirs/contrib/subprojects/alpha/var/subprojects/wrap_files_might_be_here b/test cases/common/168 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/168 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/168 subproject nested subproject dirs/contrib/subprojects/beta/b.c b/test cases/common/168 subproject nested subproject dirs/contrib/subprojects/beta/b.c deleted file mode 100644 index 8c07177..0000000 --- a/test cases/common/168 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(void) { - return 42; -} diff --git a/test cases/common/168 subproject nested subproject dirs/contrib/subprojects/beta/meson.build b/test cases/common/168 subproject nested subproject dirs/contrib/subprojects/beta/meson.build deleted file mode 100644 index 1720d3e..0000000 --- a/test cases/common/168 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/168 subproject nested subproject dirs/meson.build b/test cases/common/168 subproject nested subproject dirs/meson.build deleted file mode 100644 index 875eed3..0000000 --- a/test cases/common/168 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/168 subproject nested subproject dirs/prog.c b/test cases/common/168 subproject nested subproject dirs/prog.c deleted file mode 100644 index 27162c5..0000000 --- a/test cases/common/168 subproject nested subproject dirs/prog.c +++ /dev/null @@ -1,5 +0,0 @@ -int func(void); - -int main(void) { - return func() == 42 ? 0 : 1; -} diff --git a/test cases/common/169 preserve gendir/base.inp b/test cases/common/169 preserve gendir/base.inp deleted file mode 100644 index df967b9..0000000 --- a/test cases/common/169 preserve gendir/base.inp +++ /dev/null @@ -1 +0,0 @@ -base diff --git a/test cases/common/169 preserve gendir/com/mesonbuild/subbie.inp b/test cases/common/169 preserve gendir/com/mesonbuild/subbie.inp deleted file mode 100644 index df0f4e9..0000000 --- a/test cases/common/169 preserve gendir/com/mesonbuild/subbie.inp +++ /dev/null @@ -1 +0,0 @@ -subbie diff --git a/test cases/common/169 preserve gendir/genprog.py b/test cases/common/169 preserve gendir/genprog.py deleted file mode 100755 index 681c43a..0000000 --- a/test cases/common/169 preserve gendir/genprog.py +++ /dev/null @@ -1,46 +0,0 @@ -#!/usr/bin/env python3 - -import os, sys, argparse - -h_templ = '''#pragma once - -int %s(void); -''' - -c_templ = '''#include"%s.h" - -int %s(void) { - 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(f'Input file {ifile} does not start with search dir {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/169 preserve gendir/meson.build b/test cases/common/169 preserve gendir/meson.build deleted file mode 100644 index ce219f0..0000000 --- a/test cases/common/169 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/169 preserve gendir/testprog.c b/test cases/common/169 preserve gendir/testprog.c deleted file mode 100644 index b6a9926..0000000 --- a/test cases/common/169 preserve gendir/testprog.c +++ /dev/null @@ -1,6 +0,0 @@ -#include"base.h" -#include"com/mesonbuild/subbie.h" - -int main(void) { - return base() + subbie(); -} diff --git a/test cases/common/169 source in dep/bar.cpp b/test cases/common/169 source in dep/bar.cpp new file mode 100644 index 0000000..2ea623b --- /dev/null +++ b/test cases/common/169 source in dep/bar.cpp @@ -0,0 +1,5 @@ +extern "C" int foo(void); + +int main(void) { + return foo() != 42; +} diff --git a/test cases/common/169 source in dep/foo.c b/test cases/common/169 source in dep/foo.c new file mode 100644 index 0000000..c1be8d0 --- /dev/null +++ b/test cases/common/169 source in dep/foo.c @@ -0,0 +1,3 @@ +int foo(void) { + return 42; +} diff --git a/test cases/common/169 source in dep/generated/funname b/test cases/common/169 source in dep/generated/funname new file mode 100644 index 0000000..79f3c86 --- /dev/null +++ b/test cases/common/169 source in dep/generated/funname @@ -0,0 +1 @@ +my_wonderful_function diff --git a/test cases/common/169 source in dep/generated/genheader.py b/test cases/common/169 source in dep/generated/genheader.py new file mode 100755 index 0000000..489db23 --- /dev/null +++ b/test cases/common/169 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(void) { + return 42; +} +''' + +funname = open(ifile).readline().strip() + +open(ofile, 'w').write(templ % funname) diff --git a/test cases/common/169 source in dep/generated/main.c b/test cases/common/169 source in dep/generated/main.c new file mode 100644 index 0000000..1ab980a --- /dev/null +++ b/test cases/common/169 source in dep/generated/main.c @@ -0,0 +1,5 @@ +#include"funheader.h" + +int main(void) { + return my_wonderful_function() != 42; +} diff --git a/test cases/common/169 source in dep/generated/meson.build b/test cases/common/169 source in dep/generated/meson.build new file mode 100644 index 0000000..2862709 --- /dev/null +++ b/test cases/common/169 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/169 source in dep/meson.build b/test cases/common/169 source in dep/meson.build new file mode 100644 index 0000000..7111ba1 --- /dev/null +++ b/test cases/common/169 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/17 array/func.c b/test cases/common/17 array/func.c new file mode 100644 index 0000000..a324dca --- /dev/null +++ b/test cases/common/17 array/func.c @@ -0,0 +1 @@ +int func(void) { return 0; } diff --git a/test cases/common/17 array/meson.build b/test cases/common/17 array/meson.build new file mode 100644 index 0000000..0d17374 --- /dev/null +++ b/test cases/common/17 array/meson.build @@ -0,0 +1,8 @@ +project('array test', 'c') + +arr = [ + 'func.c', + 'prog.c'] + +exe = executable('prog', sources : arr) +test('arr test', exe) diff --git a/test cases/common/17 array/prog.c b/test cases/common/17 array/prog.c new file mode 100644 index 0000000..f794e1b --- /dev/null +++ b/test cases/common/17 array/prog.c @@ -0,0 +1,3 @@ +extern int func(void); + +int main(void) { return func(); } diff --git a/test cases/common/17 comparison/meson.build b/test cases/common/17 comparison/meson.build deleted file mode 100644 index bba0168..0000000 --- a/test cases/common/17 comparison/meson.build +++ /dev/null @@ -1,154 +0,0 @@ -project('comparison', 'c') - -# Compare equality of strings - -var1 = 'foo' -var2 = 'bar' - -if var1 == var2 - exe1 = executable('broken', 'broken.c') -else - exe1 = executable('prog1', 'prog.c') -endif - -if var1 == var1 - exe2 = executable('prog2', 'prog.c') -else - exe2 = executable('broken', 'broken.c') -endif - -if var1 != var2 - exe3 = executable('prog3', 'prog.c') -else - exe3 = executable('broken', 'broken.c') -endif - -if var1 != var1 - exe4 = executable('broken', 'broken.c') -else - exe4 = executable('prog4', 'prog.c') -endif - -test('equalfalse', exe1) -test('equaltrue', exe2) -test('nequaltrue', exe3) -test('nequalfalse', exe4) - -# Non-equality comparisons - -var3 = 3 -var4 = 4 - -if var3 < var4 - exe5 = executable('prog5', 'prog.c') -else - exe5 = executable('broken', 'broken.c') -endif - -if var3 < var3 - exe6 = executable('broken', 'broken.c') -else - exe6 = executable('prog6', 'prog.c') -endif - -if var4 > var3 - exe7 = executable('prog7', 'prog.c') -else - exe7 = executable('broken', 'broken.c') -endif - -if var3 > var3 - exe8 = executable('broken', 'broken.c') -else - exe8 = executable('prog8', 'prog.c') -endif - -if var4 <= var3 - exe9 = executable('broken', 'broken.c') -else - exe9 = executable('prog9', 'prog.c') -endif - -if var3 <= var3 - exe10 = executable('prog10', 'prog.c') -else - exe10 = executable('broken', 'broken.c') -endif - -if var3 >= var4 - exe11 = executable('broken', 'broken.c') -else - exe11 = executable('prog11', 'prog.c') -endif - -if var3 >= var3 - exe12 = executable('prog12', 'prog.c') -else - exe12 = executable('broken', 'broken.c') -endif - -test('lttrue', exe5) -test('ltfalse', exe6) -test('gttrue', exe7) -test('gtfalse', exe8) -test('lefalse', exe9) -test('letrue', exe10) -test('gefalse', exe11) -test('getrue', exe12) - -# Non-elementary type comparisons - -if exe1 == exe2 - exe13 = executable('broken', 'broken.c') -else - exe13 = executable('prog13', 'prog.c') -endif - -if exe1 == exe1 - exe14 = executable('prog14', 'prog.c') -else - exe14 = executable('broken', 'broken.c') -endif - -if exe1 != exe2 - exe15 = executable('prog15', 'prog.c') -else - exe15 = executable('broken', 'broken.c') -endif - -if exe1 != exe1 - exe16 = executable('broken', 'broken.c') -else - exe16 = executable('prog16', 'prog.c') -endif - -test('equalfalse', exe13) -test('equaltrue', exe14) -test('nequaltrue', exe15) -test('nequalfalse', exe16) - -# Equality comparisons of different elementary types -# (these all cause warnings currently, will become an error in future) - -assert([] != 'st', 'not equal') -assert([] != 1, 'not equal') -assert(2 != 'st', 'not equal') - -assert(not ([] == 'st'), 'not equal') -assert(not ([] == 1), 'not equal') -assert(not (2 == 'st'), 'not equal') - -# "in" and "not in" operators - -assert(1 in [1, 2], '''1 should be in [1, 2]''') -assert(3 not in [1, 2], '''3 shouldn't be in [1, 2]''') -assert(not (3 in [1, 2]), '''3 shouldn't be in [1, 2]''') - -assert('b' in ['a', 'b'], ''''b' should be in ['a', 'b']''') -assert('c' not in ['a', 'b'], ''''c' shouldn't be in ['a', 'b']''') - -assert(exe1 in [exe1, exe2], ''''exe1 should be in [exe1, exe2]''') -assert(exe3 not in [exe1, exe2], ''''exe3 shouldn't be in [exe1, exe2]''') - -assert('a' in {'a': 'b'}, '''1 should be in {'a': 'b'}''') -assert('b' not in {'a': 'b'}, '''1 should be in {'a': 'b'}''') diff --git a/test cases/common/17 comparison/prog.c b/test cases/common/17 comparison/prog.c deleted file mode 100644 index 78f2de1..0000000 --- a/test cases/common/17 comparison/prog.c +++ /dev/null @@ -1 +0,0 @@ -int main(void) { return 0; } diff --git a/test cases/common/170 generator link whole/export.h b/test cases/common/170 generator link whole/export.h new file mode 100644 index 0000000..f4f6f45 --- /dev/null +++ b/test cases/common/170 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/170 generator link whole/generator.py b/test cases/common/170 generator link whole/generator.py new file mode 100755 index 0000000..18a6cc2 --- /dev/null +++ b/test cases/common/170 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}(void); +'''.format(name=name)) + with open(cname, 'w') as cfile: + cfile.write(''' +#include "{name}.h" +int {name}(void) {{ + return {size}; +}} +'''.format(name=name, size=len(name))) + + +if __name__ == '__main__': + main() diff --git a/test cases/common/170 generator link whole/main.c b/test cases/common/170 generator link whole/main.c new file mode 100644 index 0000000..7605022 --- /dev/null +++ b/test cases/common/170 generator link whole/main.c @@ -0,0 +1,11 @@ +#include "meson_test_function.h" + +#include + +int main(void) { + if (meson_test_function() != 19) { + printf("Bad meson_test_function()\n"); + return 1; + } + return 0; +} diff --git a/test cases/common/170 generator link whole/meson.build b/test cases/common/170 generator link whole/meson.build new file mode 100644 index 0000000..106153a --- /dev/null +++ b/test cases/common/170 generator link whole/meson.build @@ -0,0 +1,69 @@ +project('generator link_whole', 'c') + +if meson.backend() == 'xcode' + error('MESON_SKIP_TEST: whole-archive not supported in Xcode. Patches welcome.') +endif + +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/170 generator link whole/meson_test_function.tmpl b/test cases/common/170 generator link whole/meson_test_function.tmpl new file mode 100644 index 0000000..e69de29 diff --git a/test cases/common/170 generator link whole/pull_meson_test_function.c b/test cases/common/170 generator link whole/pull_meson_test_function.c new file mode 100644 index 0000000..23d24ac --- /dev/null +++ b/test cases/common/170 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(void) { + return meson_test_function(); +} diff --git a/test cases/common/170 source in dep/bar.cpp b/test cases/common/170 source in dep/bar.cpp deleted file mode 100644 index 2ea623b..0000000 --- a/test cases/common/170 source in dep/bar.cpp +++ /dev/null @@ -1,5 +0,0 @@ -extern "C" int foo(void); - -int main(void) { - return foo() != 42; -} diff --git a/test cases/common/170 source in dep/foo.c b/test cases/common/170 source in dep/foo.c deleted file mode 100644 index c1be8d0..0000000 --- a/test cases/common/170 source in dep/foo.c +++ /dev/null @@ -1,3 +0,0 @@ -int foo(void) { - return 42; -} diff --git a/test cases/common/170 source in dep/generated/funname b/test cases/common/170 source in dep/generated/funname deleted file mode 100644 index 79f3c86..0000000 --- a/test cases/common/170 source in dep/generated/funname +++ /dev/null @@ -1 +0,0 @@ -my_wonderful_function diff --git a/test cases/common/170 source in dep/generated/genheader.py b/test cases/common/170 source in dep/generated/genheader.py deleted file mode 100755 index 489db23..0000000 --- a/test cases/common/170 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(void) { - return 42; -} -''' - -funname = open(ifile).readline().strip() - -open(ofile, 'w').write(templ % funname) diff --git a/test cases/common/170 source in dep/generated/main.c b/test cases/common/170 source in dep/generated/main.c deleted file mode 100644 index 1ab980a..0000000 --- a/test cases/common/170 source in dep/generated/main.c +++ /dev/null @@ -1,5 +0,0 @@ -#include"funheader.h" - -int main(void) { - return my_wonderful_function() != 42; -} diff --git a/test cases/common/170 source in dep/generated/meson.build b/test cases/common/170 source in dep/generated/meson.build deleted file mode 100644 index 2862709..0000000 --- a/test cases/common/170 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/170 source in dep/meson.build b/test cases/common/170 source in dep/meson.build deleted file mode 100644 index 7111ba1..0000000 --- a/test cases/common/170 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/171 generator link whole/export.h b/test cases/common/171 generator link whole/export.h deleted file mode 100644 index f4f6f45..0000000 --- a/test cases/common/171 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/171 generator link whole/generator.py b/test cases/common/171 generator link whole/generator.py deleted file mode 100755 index 18a6cc2..0000000 --- a/test cases/common/171 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}(void); -'''.format(name=name)) - with open(cname, 'w') as cfile: - cfile.write(''' -#include "{name}.h" -int {name}(void) {{ - return {size}; -}} -'''.format(name=name, size=len(name))) - - -if __name__ == '__main__': - main() diff --git a/test cases/common/171 generator link whole/main.c b/test cases/common/171 generator link whole/main.c deleted file mode 100644 index 7605022..0000000 --- a/test cases/common/171 generator link whole/main.c +++ /dev/null @@ -1,11 +0,0 @@ -#include "meson_test_function.h" - -#include - -int main(void) { - if (meson_test_function() != 19) { - printf("Bad meson_test_function()\n"); - return 1; - } - return 0; -} diff --git a/test cases/common/171 generator link whole/meson.build b/test cases/common/171 generator link whole/meson.build deleted file mode 100644 index 106153a..0000000 --- a/test cases/common/171 generator link whole/meson.build +++ /dev/null @@ -1,69 +0,0 @@ -project('generator link_whole', 'c') - -if meson.backend() == 'xcode' - error('MESON_SKIP_TEST: whole-archive not supported in Xcode. Patches welcome.') -endif - -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/171 generator link whole/meson_test_function.tmpl b/test cases/common/171 generator link whole/meson_test_function.tmpl deleted file mode 100644 index e69de29..0000000 diff --git a/test cases/common/171 generator link whole/pull_meson_test_function.c b/test cases/common/171 generator link whole/pull_meson_test_function.c deleted file mode 100644 index 23d24ac..0000000 --- a/test cases/common/171 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(void) { - return meson_test_function(); -} diff --git a/test cases/common/171 initial c_args/meson.build b/test cases/common/171 initial c_args/meson.build new file mode 100644 index 0000000..638f8c2 --- /dev/null +++ b/test cases/common/171 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/171 initial c_args/test.json b/test cases/common/171 initial c_args/test.json new file mode 100644 index 0000000..f9b73a4 --- /dev/null +++ b/test cases/common/171 initial c_args/test.json @@ -0,0 +1,8 @@ +{ + "matrix": { + "options": { + "c_args": [{ "val": "-funroll-loops" }], + "c_link_args": [{ "val": "-Dtest_harmless_but_useless_link_arg" }] + } + } +} diff --git a/test cases/common/172 identical target name in subproject flat layout/foo.c b/test cases/common/172 identical target name in subproject flat layout/foo.c new file mode 100644 index 0000000..ed42789 --- /dev/null +++ b/test cases/common/172 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/172 identical target name in subproject flat layout/main.c b/test cases/common/172 identical target name in subproject flat layout/main.c new file mode 100644 index 0000000..6f02aeb --- /dev/null +++ b/test cases/common/172 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/172 identical target name in subproject flat layout/meson.build b/test cases/common/172 identical target name in subproject flat layout/meson.build new file mode 100644 index 0000000..ce1d4b8 --- /dev/null +++ b/test cases/common/172 identical target name in subproject flat layout/meson.build @@ -0,0 +1,15 @@ +project('subproject targets', 'c') + +if meson.backend() == 'xcode' + error('MESON_SKIP_TEST: many targets with the same name not supported in Xcode. Patches welcome.') +endif + +# 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/172 identical target name in subproject flat layout/subprojects/subproj/foo.c b/test cases/common/172 identical target name in subproject flat layout/subprojects/subproj/foo.c new file mode 100644 index 0000000..f334292 --- /dev/null +++ b/test cases/common/172 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/172 identical target name in subproject flat layout/subprojects/subproj/meson.build b/test cases/common/172 identical target name in subproject flat layout/subprojects/subproj/meson.build new file mode 100644 index 0000000..c927194 --- /dev/null +++ b/test cases/common/172 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/172 initial c_args/meson.build b/test cases/common/172 initial c_args/meson.build deleted file mode 100644 index 638f8c2..0000000 --- a/test cases/common/172 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/172 initial c_args/test.json b/test cases/common/172 initial c_args/test.json deleted file mode 100644 index f9b73a4..0000000 --- a/test cases/common/172 initial c_args/test.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "matrix": { - "options": { - "c_args": [{ "val": "-funroll-loops" }], - "c_link_args": [{ "val": "-Dtest_harmless_but_useless_link_arg" }] - } - } -} diff --git a/test cases/common/173 as-needed/config.h b/test cases/common/173 as-needed/config.h new file mode 100644 index 0000000..b8fb60f --- /dev/null +++ b/test cases/common/173 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/173 as-needed/libA.cpp b/test cases/common/173 as-needed/libA.cpp new file mode 100644 index 0000000..5f45bc0 --- /dev/null +++ b/test cases/common/173 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/173 as-needed/libA.h b/test cases/common/173 as-needed/libA.h new file mode 100644 index 0000000..8e76d22 --- /dev/null +++ b/test cases/common/173 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/173 as-needed/libB.cpp b/test cases/common/173 as-needed/libB.cpp new file mode 100644 index 0000000..a872394 --- /dev/null +++ b/test cases/common/173 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/173 as-needed/main.cpp b/test cases/common/173 as-needed/main.cpp new file mode 100644 index 0000000..a893431 --- /dev/null +++ b/test cases/common/173 as-needed/main.cpp @@ -0,0 +1,7 @@ +#include + +#include "libA.h" + +int main(void) { + return !meson_test_as_needed::linked ? EXIT_SUCCESS : EXIT_FAILURE; +} diff --git a/test cases/common/173 as-needed/meson.build b/test cases/common/173 as-needed/meson.build new file mode 100644 index 0000000..3b54aaa --- /dev/null +++ b/test cases/common/173 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/173 identical target name in subproject flat layout/foo.c b/test cases/common/173 identical target name in subproject flat layout/foo.c deleted file mode 100644 index ed42789..0000000 --- a/test cases/common/173 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/173 identical target name in subproject flat layout/main.c b/test cases/common/173 identical target name in subproject flat layout/main.c deleted file mode 100644 index 6f02aeb..0000000 --- a/test cases/common/173 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/173 identical target name in subproject flat layout/meson.build b/test cases/common/173 identical target name in subproject flat layout/meson.build deleted file mode 100644 index ce1d4b8..0000000 --- a/test cases/common/173 identical target name in subproject flat layout/meson.build +++ /dev/null @@ -1,15 +0,0 @@ -project('subproject targets', 'c') - -if meson.backend() == 'xcode' - error('MESON_SKIP_TEST: many targets with the same name not supported in Xcode. Patches welcome.') -endif - -# 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/173 identical target name in subproject flat layout/subprojects/subproj/foo.c b/test cases/common/173 identical target name in subproject flat layout/subprojects/subproj/foo.c deleted file mode 100644 index f334292..0000000 --- a/test cases/common/173 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/173 identical target name in subproject flat layout/subprojects/subproj/meson.build b/test cases/common/173 identical target name in subproject flat layout/subprojects/subproj/meson.build deleted file mode 100644 index c927194..0000000 --- a/test cases/common/173 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/174 as-needed/config.h b/test cases/common/174 as-needed/config.h deleted file mode 100644 index b8fb60f..0000000 --- a/test cases/common/174 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/174 as-needed/libA.cpp b/test cases/common/174 as-needed/libA.cpp deleted file mode 100644 index 5f45bc0..0000000 --- a/test cases/common/174 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/174 as-needed/libA.h b/test cases/common/174 as-needed/libA.h deleted file mode 100644 index 8e76d22..0000000 --- a/test cases/common/174 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/174 as-needed/libB.cpp b/test cases/common/174 as-needed/libB.cpp deleted file mode 100644 index a872394..0000000 --- a/test cases/common/174 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/174 as-needed/main.cpp b/test cases/common/174 as-needed/main.cpp deleted file mode 100644 index a893431..0000000 --- a/test cases/common/174 as-needed/main.cpp +++ /dev/null @@ -1,7 +0,0 @@ -#include - -#include "libA.h" - -int main(void) { - return !meson_test_as_needed::linked ? EXIT_SUCCESS : EXIT_FAILURE; -} diff --git a/test cases/common/174 as-needed/meson.build b/test cases/common/174 as-needed/meson.build deleted file mode 100644 index 3b54aaa..0000000 --- a/test cases/common/174 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/174 ndebug if-release enabled/main.c b/test cases/common/174 ndebug if-release enabled/main.c new file mode 100644 index 0000000..984ebca --- /dev/null +++ b/test cases/common/174 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/174 ndebug if-release enabled/meson.build b/test cases/common/174 ndebug if-release enabled/meson.build new file mode 100644 index 0000000..be26375 --- /dev/null +++ b/test cases/common/174 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/175 ndebug if-release disabled/main.c b/test cases/common/175 ndebug if-release disabled/main.c new file mode 100644 index 0000000..cb3ec3f --- /dev/null +++ b/test cases/common/175 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/175 ndebug if-release disabled/meson.build b/test cases/common/175 ndebug if-release disabled/meson.build new file mode 100644 index 0000000..a9a79ea --- /dev/null +++ b/test cases/common/175 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/175 ndebug if-release enabled/main.c b/test cases/common/175 ndebug if-release enabled/main.c deleted file mode 100644 index 984ebca..0000000 --- a/test cases/common/175 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/175 ndebug if-release enabled/meson.build b/test cases/common/175 ndebug if-release enabled/meson.build deleted file mode 100644 index be26375..0000000 --- a/test cases/common/175 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/176 ndebug if-release disabled/main.c b/test cases/common/176 ndebug if-release disabled/main.c deleted file mode 100644 index cb3ec3f..0000000 --- a/test cases/common/176 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/176 ndebug if-release disabled/meson.build b/test cases/common/176 ndebug if-release disabled/meson.build deleted file mode 100644 index a9a79ea..0000000 --- a/test cases/common/176 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/176 subproject version/meson.build b/test cases/common/176 subproject version/meson.build new file mode 100644 index 0000000..bd8fc03 --- /dev/null +++ b/test cases/common/176 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/176 subproject version/subprojects/a/meson.build b/test cases/common/176 subproject version/subprojects/a/meson.build new file mode 100644 index 0000000..dae3130 --- /dev/null +++ b/test cases/common/176 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/177 subdir_done/meson.build b/test cases/common/177 subdir_done/meson.build new file mode 100644 index 0000000..457e613 --- /dev/null +++ b/test cases/common/177 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/177 subproject version/meson.build b/test cases/common/177 subproject version/meson.build deleted file mode 100644 index bd8fc03..0000000 --- a/test cases/common/177 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/177 subproject version/subprojects/a/meson.build b/test cases/common/177 subproject version/subprojects/a/meson.build deleted file mode 100644 index dae3130..0000000 --- a/test cases/common/177 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/178 bothlibraries/libfile.c b/test cases/common/178 bothlibraries/libfile.c new file mode 100644 index 0000000..f5e228e --- /dev/null +++ b/test cases/common/178 bothlibraries/libfile.c @@ -0,0 +1,7 @@ +#include "mylib.h" + +DO_EXPORT int retval = 42; + +DO_EXPORT int func(void) { + return retval; +} diff --git a/test cases/common/178 bothlibraries/main.c b/test cases/common/178 bothlibraries/main.c new file mode 100644 index 0000000..8237bae --- /dev/null +++ b/test cases/common/178 bothlibraries/main.c @@ -0,0 +1,8 @@ +#include "mylib.h" + +DO_IMPORT int func(void); +DO_IMPORT int retval; + +int main(void) { + return func() == retval ? 0 : 1; +} diff --git a/test cases/common/178 bothlibraries/meson.build b/test cases/common/178 bothlibraries/meson.build new file mode 100644 index 0000000..0bfba76 --- /dev/null +++ b/test cases/common/178 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/178 bothlibraries/mylib.h b/test cases/common/178 bothlibraries/mylib.h new file mode 100644 index 0000000..1038a01 --- /dev/null +++ b/test cases/common/178 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/178 subdir_done/meson.build b/test cases/common/178 subdir_done/meson.build deleted file mode 100644 index 457e613..0000000 --- a/test cases/common/178 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/179 bothlibraries/libfile.c b/test cases/common/179 bothlibraries/libfile.c deleted file mode 100644 index f5e228e..0000000 --- a/test cases/common/179 bothlibraries/libfile.c +++ /dev/null @@ -1,7 +0,0 @@ -#include "mylib.h" - -DO_EXPORT int retval = 42; - -DO_EXPORT int func(void) { - return retval; -} diff --git a/test cases/common/179 bothlibraries/main.c b/test cases/common/179 bothlibraries/main.c deleted file mode 100644 index 8237bae..0000000 --- a/test cases/common/179 bothlibraries/main.c +++ /dev/null @@ -1,8 +0,0 @@ -#include "mylib.h" - -DO_IMPORT int func(void); -DO_IMPORT int retval; - -int main(void) { - return func() == retval ? 0 : 1; -} diff --git a/test cases/common/179 bothlibraries/meson.build b/test cases/common/179 bothlibraries/meson.build deleted file mode 100644 index 0bfba76..0000000 --- a/test cases/common/179 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/179 bothlibraries/mylib.h b/test cases/common/179 bothlibraries/mylib.h deleted file mode 100644 index 1038a01..0000000 --- a/test cases/common/179 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/179 escape and unicode/file.c.in b/test cases/common/179 escape and unicode/file.c.in new file mode 100644 index 0000000..5dd6e50 --- /dev/null +++ b/test cases/common/179 escape and unicode/file.c.in @@ -0,0 +1,5 @@ +#include +const char* does_it_work(void) { + printf("{NAME}\n"); + return "yes it does"; +} diff --git a/test cases/common/179 escape and unicode/file.py b/test cases/common/179 escape and unicode/file.py new file mode 100644 index 0000000..40fa7ca --- /dev/null +++ b/test cases/common/179 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/179 escape and unicode/find.py b/test cases/common/179 escape and unicode/find.py new file mode 100644 index 0000000..34a3eb8 --- /dev/null +++ b/test cases/common/179 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/179 escape and unicode/fun.c b/test cases/common/179 escape and unicode/fun.c new file mode 100644 index 0000000..c5634d8 --- /dev/null +++ b/test cases/common/179 escape and unicode/fun.c @@ -0,0 +1,3 @@ +int a_fun(void) { + return 1; +} diff --git a/test cases/common/179 escape and unicode/main.c b/test cases/common/179 escape and unicode/main.c new file mode 100644 index 0000000..6137ad7 --- /dev/null +++ b/test cases/common/179 escape and unicode/main.c @@ -0,0 +1,12 @@ +#include + +const char* does_it_work(void); + +int a_fun(void); + +int main(void) { + if(strcmp(does_it_work(), "yes it does") != 0) { + return -a_fun(); + } + return 0; +} diff --git a/test cases/common/179 escape and unicode/meson.build b/test cases/common/179 escape and unicode/meson.build new file mode 100644 index 0000000..e4fe628 --- /dev/null +++ b/test cases/common/179 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/18 array/func.c b/test cases/common/18 array/func.c deleted file mode 100644 index a324dca..0000000 --- a/test cases/common/18 array/func.c +++ /dev/null @@ -1 +0,0 @@ -int func(void) { return 0; } diff --git a/test cases/common/18 array/meson.build b/test cases/common/18 array/meson.build deleted file mode 100644 index 0d17374..0000000 --- a/test cases/common/18 array/meson.build +++ /dev/null @@ -1,8 +0,0 @@ -project('array test', 'c') - -arr = [ - 'func.c', - 'prog.c'] - -exe = executable('prog', sources : arr) -test('arr test', exe) diff --git a/test cases/common/18 array/prog.c b/test cases/common/18 array/prog.c deleted file mode 100644 index f794e1b..0000000 --- a/test cases/common/18 array/prog.c +++ /dev/null @@ -1,3 +0,0 @@ -extern int func(void); - -int main(void) { return func(); } diff --git a/test cases/common/18 includedir/include/func.h b/test cases/common/18 includedir/include/func.h new file mode 100644 index 0000000..647b72f --- /dev/null +++ b/test cases/common/18 includedir/include/func.h @@ -0,0 +1,6 @@ +#ifndef FUNC_H__ +#define FUNC_H__ + +int func(void); + +#endif diff --git a/test cases/common/18 includedir/meson.build b/test cases/common/18 includedir/meson.build new file mode 100644 index 0000000..17eec0e --- /dev/null +++ b/test cases/common/18 includedir/meson.build @@ -0,0 +1,4 @@ +project('include dir test', 'c') + +inc = include_directories('include') +subdir('src') diff --git a/test cases/common/18 includedir/src/func.c b/test cases/common/18 includedir/src/func.c new file mode 100644 index 0000000..215beff --- /dev/null +++ b/test cases/common/18 includedir/src/func.c @@ -0,0 +1,5 @@ +#include "func.h" + +int func(void) { + return 0; +} diff --git a/test cases/common/18 includedir/src/meson.build b/test cases/common/18 includedir/src/meson.build new file mode 100644 index 0000000..30d2e0c --- /dev/null +++ b/test cases/common/18 includedir/src/meson.build @@ -0,0 +1,5 @@ +exe = executable('prog', 'prog.c', 'func.c', include_directories : inc) +test('inc test', exe) + +exe2 = executable('prog2', 'prog.c', 'func.c', include_directories : [['../include']]) +test('inc test 2', exe2) diff --git a/test cases/common/18 includedir/src/prog.c b/test cases/common/18 includedir/src/prog.c new file mode 100644 index 0000000..ce4dd67 --- /dev/null +++ b/test cases/common/18 includedir/src/prog.c @@ -0,0 +1,5 @@ +#include "func.h" + +int main(void) { + return func(); +} diff --git a/test cases/common/180 escape and unicode/file.c.in b/test cases/common/180 escape and unicode/file.c.in deleted file mode 100644 index 5dd6e50..0000000 --- a/test cases/common/180 escape and unicode/file.c.in +++ /dev/null @@ -1,5 +0,0 @@ -#include -const char* does_it_work(void) { - printf("{NAME}\n"); - return "yes it does"; -} diff --git a/test cases/common/180 escape and unicode/file.py b/test cases/common/180 escape and unicode/file.py deleted file mode 100644 index 40fa7ca..0000000 --- a/test cases/common/180 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/180 escape and unicode/find.py b/test cases/common/180 escape and unicode/find.py deleted file mode 100644 index 34a3eb8..0000000 --- a/test cases/common/180 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/180 escape and unicode/fun.c b/test cases/common/180 escape and unicode/fun.c deleted file mode 100644 index c5634d8..0000000 --- a/test cases/common/180 escape and unicode/fun.c +++ /dev/null @@ -1,3 +0,0 @@ -int a_fun(void) { - return 1; -} diff --git a/test cases/common/180 escape and unicode/main.c b/test cases/common/180 escape and unicode/main.c deleted file mode 100644 index 6137ad7..0000000 --- a/test cases/common/180 escape and unicode/main.c +++ /dev/null @@ -1,12 +0,0 @@ -#include - -const char* does_it_work(void); - -int a_fun(void); - -int main(void) { - if(strcmp(does_it_work(), "yes it does") != 0) { - return -a_fun(); - } - return 0; -} diff --git a/test cases/common/180 escape and unicode/meson.build b/test cases/common/180 escape and unicode/meson.build deleted file mode 100644 index e4fe628..0000000 --- a/test cases/common/180 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/180 has link arg/meson.build b/test cases/common/180 has link arg/meson.build new file mode 100644 index 0000000..6bfbd59 --- /dev/null +++ b/test cases/common/180 has link arg/meson.build @@ -0,0 +1,47 @@ +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,-L/tmp' + useless = '-Wl,-L/usr' + isnt_arg = '-Wl,-iambroken' +endif + +assert(cc.has_link_argument(is_arg), 'Arg that should have worked does not work.') +assert(cpp.has_link_argument(is_arg), 'Arg that should have worked does not work.') + +if cc.get_id() != 'pgi' +assert(not cc.has_link_argument(isnt_arg), 'Arg that should be broken is not.') +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(not cc.has_link_argument('-Wl,-z,nodelete42'), 'Did not detect wrong -z linker argument') +endif + +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.') diff --git a/test cases/common/181 has link arg/meson.build b/test cases/common/181 has link arg/meson.build deleted file mode 100644 index 6bfbd59..0000000 --- a/test cases/common/181 has link arg/meson.build +++ /dev/null @@ -1,47 +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,-L/tmp' - useless = '-Wl,-L/usr' - isnt_arg = '-Wl,-iambroken' -endif - -assert(cc.has_link_argument(is_arg), 'Arg that should have worked does not work.') -assert(cpp.has_link_argument(is_arg), 'Arg that should have worked does not work.') - -if cc.get_id() != 'pgi' -assert(not cc.has_link_argument(isnt_arg), 'Arg that should be broken is not.') -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(not cc.has_link_argument('-Wl,-z,nodelete42'), 'Did not detect wrong -z linker argument') -endif - -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.') diff --git a/test cases/common/181 same target name flat layout/foo.c b/test cases/common/181 same target name flat layout/foo.c new file mode 100644 index 0000000..ed42789 --- /dev/null +++ b/test cases/common/181 same target name flat layout/foo.c @@ -0,0 +1 @@ +int meson_test_main_foo(void) { return 10; } diff --git a/test cases/common/181 same target name flat layout/main.c b/test cases/common/181 same target name flat layout/main.c new file mode 100644 index 0000000..6f02aeb --- /dev/null +++ b/test cases/common/181 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/181 same target name flat layout/meson.build b/test cases/common/181 same target name flat layout/meson.build new file mode 100644 index 0000000..cfad2c2 --- /dev/null +++ b/test cases/common/181 same target name flat layout/meson.build @@ -0,0 +1,15 @@ +project('subdir targets', 'c') + +if meson.backend() == 'xcode' + error('MESON_SKIP_TEST: many targets with the same name not supported in Xcode. Patches welcome.') +endif + +# 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/181 same target name flat layout/subdir/foo.c b/test cases/common/181 same target name flat layout/subdir/foo.c new file mode 100644 index 0000000..f334292 --- /dev/null +++ b/test cases/common/181 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/181 same target name flat layout/subdir/meson.build b/test cases/common/181 same target name flat layout/subdir/meson.build new file mode 100644 index 0000000..223a5ef --- /dev/null +++ b/test cases/common/181 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/182 find override/meson.build b/test cases/common/182 find override/meson.build new file mode 100644 index 0000000..b277459 --- /dev/null +++ b/test cases/common/182 find override/meson.build @@ -0,0 +1,15 @@ +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') + +tool = find_program('sometool') +assert(tool.found()) diff --git a/test cases/common/182 find override/otherdir/main.c b/test cases/common/182 find override/otherdir/main.c new file mode 100644 index 0000000..5fb6371 --- /dev/null +++ b/test cases/common/182 find override/otherdir/main.c @@ -0,0 +1,5 @@ +int be_seeing_you(void); + +int main(void) { + return be_seeing_you() == 6 ? 0 : 1; +} diff --git a/test cases/common/182 find override/otherdir/main2.c b/test cases/common/182 find override/otherdir/main2.c new file mode 100644 index 0000000..80a3009 --- /dev/null +++ b/test cases/common/182 find override/otherdir/main2.c @@ -0,0 +1,5 @@ +int number_returner(void); + +int main(void) { + return number_returner() == 100 ? 0 : 1; +} diff --git a/test cases/common/182 find override/otherdir/meson.build b/test cases/common/182 find override/otherdir/meson.build new file mode 100644 index 0000000..5cefc88 --- /dev/null +++ b/test cases/common/182 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 generated +# 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/182 find override/otherdir/source.desc b/test cases/common/182 find override/otherdir/source.desc new file mode 100644 index 0000000..8b19c9c --- /dev/null +++ b/test cases/common/182 find override/otherdir/source.desc @@ -0,0 +1 @@ +be_seeing_you diff --git a/test cases/common/182 find override/otherdir/source2.desc b/test cases/common/182 find override/otherdir/source2.desc new file mode 100644 index 0000000..965f868 --- /dev/null +++ b/test cases/common/182 find override/otherdir/source2.desc @@ -0,0 +1 @@ +number_returner diff --git a/test cases/common/182 find override/subdir/converter.py b/test cases/common/182 find override/subdir/converter.py new file mode 100755 index 0000000..efe0464 --- /dev/null +++ b/test cases/common/182 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(void) { + 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/182 find override/subdir/gencodegen.py.in b/test cases/common/182 find override/subdir/gencodegen.py.in new file mode 100755 index 0000000..78ebb2f --- /dev/null +++ b/test cases/common/182 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(void) { + 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/182 find override/subdir/meson.build b/test cases/common/182 find override/subdir/meson.build new file mode 100644 index 0000000..e5de34d --- /dev/null +++ b/test cases/common/182 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/182 find override/subprojects/sub.wrap b/test cases/common/182 find override/subprojects/sub.wrap new file mode 100644 index 0000000..17aa332 --- /dev/null +++ b/test cases/common/182 find override/subprojects/sub.wrap @@ -0,0 +1,5 @@ +[wrap-file] +directory = sub + +[provide] +program_names = sometool diff --git a/test cases/common/182 find override/subprojects/sub/meson.build b/test cases/common/182 find override/subprojects/sub/meson.build new file mode 100644 index 0000000..640f270 --- /dev/null +++ b/test cases/common/182 find override/subprojects/sub/meson.build @@ -0,0 +1,4 @@ +project('tools') + +exe = find_program('gencodegen') +meson.override_find_program('sometool', exe) diff --git a/test cases/common/182 same target name flat layout/foo.c b/test cases/common/182 same target name flat layout/foo.c deleted file mode 100644 index ed42789..0000000 --- a/test cases/common/182 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/182 same target name flat layout/main.c b/test cases/common/182 same target name flat layout/main.c deleted file mode 100644 index 6f02aeb..0000000 --- a/test cases/common/182 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/182 same target name flat layout/meson.build b/test cases/common/182 same target name flat layout/meson.build deleted file mode 100644 index cfad2c2..0000000 --- a/test cases/common/182 same target name flat layout/meson.build +++ /dev/null @@ -1,15 +0,0 @@ -project('subdir targets', 'c') - -if meson.backend() == 'xcode' - error('MESON_SKIP_TEST: many targets with the same name not supported in Xcode. Patches welcome.') -endif - -# 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/182 same target name flat layout/subdir/foo.c b/test cases/common/182 same target name flat layout/subdir/foo.c deleted file mode 100644 index f334292..0000000 --- a/test cases/common/182 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/182 same target name flat layout/subdir/meson.build b/test cases/common/182 same target name flat layout/subdir/meson.build deleted file mode 100644 index 223a5ef..0000000 --- a/test cases/common/182 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/183 find override/meson.build b/test cases/common/183 find override/meson.build deleted file mode 100644 index b277459..0000000 --- a/test cases/common/183 find override/meson.build +++ /dev/null @@ -1,15 +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') - -tool = find_program('sometool') -assert(tool.found()) diff --git a/test cases/common/183 find override/otherdir/main.c b/test cases/common/183 find override/otherdir/main.c deleted file mode 100644 index 5fb6371..0000000 --- a/test cases/common/183 find override/otherdir/main.c +++ /dev/null @@ -1,5 +0,0 @@ -int be_seeing_you(void); - -int main(void) { - return be_seeing_you() == 6 ? 0 : 1; -} diff --git a/test cases/common/183 find override/otherdir/main2.c b/test cases/common/183 find override/otherdir/main2.c deleted file mode 100644 index 80a3009..0000000 --- a/test cases/common/183 find override/otherdir/main2.c +++ /dev/null @@ -1,5 +0,0 @@ -int number_returner(void); - -int main(void) { - return number_returner() == 100 ? 0 : 1; -} diff --git a/test cases/common/183 find override/otherdir/meson.build b/test cases/common/183 find override/otherdir/meson.build deleted file mode 100644 index 5cefc88..0000000 --- a/test cases/common/183 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 generated -# 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/183 find override/otherdir/source.desc b/test cases/common/183 find override/otherdir/source.desc deleted file mode 100644 index 8b19c9c..0000000 --- a/test cases/common/183 find override/otherdir/source.desc +++ /dev/null @@ -1 +0,0 @@ -be_seeing_you diff --git a/test cases/common/183 find override/otherdir/source2.desc b/test cases/common/183 find override/otherdir/source2.desc deleted file mode 100644 index 965f868..0000000 --- a/test cases/common/183 find override/otherdir/source2.desc +++ /dev/null @@ -1 +0,0 @@ -number_returner diff --git a/test cases/common/183 find override/subdir/converter.py b/test cases/common/183 find override/subdir/converter.py deleted file mode 100755 index efe0464..0000000 --- a/test cases/common/183 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(void) { - 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/183 find override/subdir/gencodegen.py.in b/test cases/common/183 find override/subdir/gencodegen.py.in deleted file mode 100755 index 78ebb2f..0000000 --- a/test cases/common/183 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(void) { - 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/183 find override/subdir/meson.build b/test cases/common/183 find override/subdir/meson.build deleted file mode 100644 index e5de34d..0000000 --- a/test cases/common/183 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/183 find override/subprojects/sub.wrap b/test cases/common/183 find override/subprojects/sub.wrap deleted file mode 100644 index 17aa332..0000000 --- a/test cases/common/183 find override/subprojects/sub.wrap +++ /dev/null @@ -1,5 +0,0 @@ -[wrap-file] -directory = sub - -[provide] -program_names = sometool diff --git a/test cases/common/183 find override/subprojects/sub/meson.build b/test cases/common/183 find override/subprojects/sub/meson.build deleted file mode 100644 index 640f270..0000000 --- a/test cases/common/183 find override/subprojects/sub/meson.build +++ /dev/null @@ -1,4 +0,0 @@ -project('tools') - -exe = find_program('gencodegen') -meson.override_find_program('sometool', exe) diff --git a/test cases/common/183 partial dependency/declare_dependency/headers/foo.c b/test cases/common/183 partial dependency/declare_dependency/headers/foo.c new file mode 100644 index 0000000..215112c --- /dev/null +++ b/test cases/common/183 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/183 partial dependency/declare_dependency/headers/foo.h b/test cases/common/183 partial dependency/declare_dependency/headers/foo.h new file mode 100644 index 0000000..28c81c9 --- /dev/null +++ b/test cases/common/183 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/183 partial dependency/declare_dependency/main.c b/test cases/common/183 partial dependency/declare_dependency/main.c new file mode 100644 index 0000000..057b713 --- /dev/null +++ b/test cases/common/183 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(void) { + int a = foo(); + if (a == 1) { + return 0; + } else { + return 1; + } +} diff --git a/test cases/common/183 partial dependency/declare_dependency/meson.build b/test cases/common/183 partial dependency/declare_dependency/meson.build new file mode 100644 index 0000000..3783f66 --- /dev/null +++ b/test cases/common/183 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/183 partial dependency/declare_dependency/other.c b/test cases/common/183 partial dependency/declare_dependency/other.c new file mode 100644 index 0000000..b1e199e --- /dev/null +++ b/test cases/common/183 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/183 partial dependency/meson.build b/test cases/common/183 partial dependency/meson.build new file mode 100644 index 0000000..e908487 --- /dev/null +++ b/test cases/common/183 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/184 openmp/main.c b/test cases/common/184 openmp/main.c new file mode 100644 index 0000000..cc81f48 --- /dev/null +++ b/test cases/common/184 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/184 openmp/main.cpp b/test cases/common/184 openmp/main.cpp new file mode 100644 index 0000000..b12be3f --- /dev/null +++ b/test cases/common/184 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/184 openmp/main.f90 b/test cases/common/184 openmp/main.f90 new file mode 100644 index 0000000..d80f90f --- /dev/null +++ b/test cases/common/184 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/184 openmp/meson.build b/test cases/common/184 openmp/meson.build new file mode 100644 index 0000000..a1154c2 --- /dev/null +++ b/test cases/common/184 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/184 partial dependency/declare_dependency/headers/foo.c b/test cases/common/184 partial dependency/declare_dependency/headers/foo.c deleted file mode 100644 index 215112c..0000000 --- a/test cases/common/184 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/184 partial dependency/declare_dependency/headers/foo.h b/test cases/common/184 partial dependency/declare_dependency/headers/foo.h deleted file mode 100644 index 28c81c9..0000000 --- a/test cases/common/184 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/184 partial dependency/declare_dependency/main.c b/test cases/common/184 partial dependency/declare_dependency/main.c deleted file mode 100644 index 057b713..0000000 --- a/test cases/common/184 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(void) { - int a = foo(); - if (a == 1) { - return 0; - } else { - return 1; - } -} diff --git a/test cases/common/184 partial dependency/declare_dependency/meson.build b/test cases/common/184 partial dependency/declare_dependency/meson.build deleted file mode 100644 index 3783f66..0000000 --- a/test cases/common/184 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/184 partial dependency/declare_dependency/other.c b/test cases/common/184 partial dependency/declare_dependency/other.c deleted file mode 100644 index b1e199e..0000000 --- a/test cases/common/184 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/184 partial dependency/meson.build b/test cases/common/184 partial dependency/meson.build deleted file mode 100644 index e908487..0000000 --- a/test cases/common/184 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/185 openmp/main.c b/test cases/common/185 openmp/main.c deleted file mode 100644 index cc81f48..0000000 --- a/test cases/common/185 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/185 openmp/main.cpp b/test cases/common/185 openmp/main.cpp deleted file mode 100644 index b12be3f..0000000 --- a/test cases/common/185 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/185 openmp/main.f90 b/test cases/common/185 openmp/main.f90 deleted file mode 100644 index d80f90f..0000000 --- a/test cases/common/185 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/185 openmp/meson.build b/test cases/common/185 openmp/meson.build deleted file mode 100644 index a1154c2..0000000 --- a/test cases/common/185 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/185 same target name/file.c b/test cases/common/185 same target name/file.c new file mode 100644 index 0000000..9180030 --- /dev/null +++ b/test cases/common/185 same target name/file.c @@ -0,0 +1,3 @@ +int func(void) { + return 0; +} diff --git a/test cases/common/185 same target name/meson.build b/test cases/common/185 same target name/meson.build new file mode 100644 index 0000000..4e585d5 --- /dev/null +++ b/test cases/common/185 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/185 same target name/sub/file2.c b/test cases/common/185 same target name/sub/file2.c new file mode 100644 index 0000000..3d1a1c3 --- /dev/null +++ b/test cases/common/185 same target name/sub/file2.c @@ -0,0 +1,3 @@ +int func(void) { + return 5; +} diff --git a/test cases/common/185 same target name/sub/meson.build b/test cases/common/185 same target name/sub/meson.build new file mode 100644 index 0000000..610a4a3 --- /dev/null +++ b/test cases/common/185 same target name/sub/meson.build @@ -0,0 +1 @@ +static_library('foo', 'file2.c') diff --git a/test cases/common/186 same target name/file.c b/test cases/common/186 same target name/file.c deleted file mode 100644 index 9180030..0000000 --- a/test cases/common/186 same target name/file.c +++ /dev/null @@ -1,3 +0,0 @@ -int func(void) { - return 0; -} diff --git a/test cases/common/186 same target name/meson.build b/test cases/common/186 same target name/meson.build deleted file mode 100644 index 4e585d5..0000000 --- a/test cases/common/186 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/186 same target name/sub/file2.c b/test cases/common/186 same target name/sub/file2.c deleted file mode 100644 index 3d1a1c3..0000000 --- a/test cases/common/186 same target name/sub/file2.c +++ /dev/null @@ -1,3 +0,0 @@ -int func(void) { - return 5; -} diff --git a/test cases/common/186 same target name/sub/meson.build b/test cases/common/186 same target name/sub/meson.build deleted file mode 100644 index 610a4a3..0000000 --- a/test cases/common/186 same target name/sub/meson.build +++ /dev/null @@ -1 +0,0 @@ -static_library('foo', 'file2.c') diff --git a/test cases/common/186 test depends/gen.py b/test cases/common/186 test depends/gen.py new file mode 100755 index 0000000..ee4ed98 --- /dev/null +++ b/test cases/common/186 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/186 test depends/main.c b/test cases/common/186 test depends/main.c new file mode 100644 index 0000000..78f2de1 --- /dev/null +++ b/test cases/common/186 test depends/main.c @@ -0,0 +1 @@ +int main(void) { return 0; } diff --git a/test cases/common/186 test depends/meson.build b/test cases/common/186 test depends/meson.build new file mode 100644 index 0000000..888c451 --- /dev/null +++ b/test cases/common/186 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/186 test depends/test.py b/test cases/common/186 test depends/test.py new file mode 100755 index 0000000..5b9f65c --- /dev/null +++ b/test cases/common/186 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/187 args flattening/meson.build b/test cases/common/187 args flattening/meson.build new file mode 100644 index 0000000..1dac2f9 --- /dev/null +++ b/test cases/common/187 args flattening/meson.build @@ -0,0 +1,31 @@ +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') + +arr = meson.get_external_property('does-not-exist', ['bar', 'baz']) +assert(arr == ['bar', 'baz'], 'meson.get_external_property with array fallback is broken') + +arr = meson.get_external_property('does-not-exist', ['bar', 'baz'], native: true) +assert(arr == ['bar', 'baz'], 'meson.get_external_property native:true with array fallback is broken') + +arr = meson.get_external_property('does-not-exist', ['bar', 'baz'], native: false) +assert(arr == ['bar', 'baz'], 'meson.get_external_property native:false with array fallback is broken') + +# Test deprecated behaviour + +conf.set(['foo', 'bar']) +message(conf.get('foo')) diff --git a/test cases/common/187 test depends/gen.py b/test cases/common/187 test depends/gen.py deleted file mode 100755 index ee4ed98..0000000 --- a/test cases/common/187 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/187 test depends/main.c b/test cases/common/187 test depends/main.c deleted file mode 100644 index 78f2de1..0000000 --- a/test cases/common/187 test depends/main.c +++ /dev/null @@ -1 +0,0 @@ -int main(void) { return 0; } diff --git a/test cases/common/187 test depends/meson.build b/test cases/common/187 test depends/meson.build deleted file mode 100644 index 888c451..0000000 --- a/test cases/common/187 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/187 test depends/test.py b/test cases/common/187 test depends/test.py deleted file mode 100755 index 5b9f65c..0000000 --- a/test cases/common/187 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/188 args flattening/meson.build b/test cases/common/188 args flattening/meson.build deleted file mode 100644 index 1dac2f9..0000000 --- a/test cases/common/188 args flattening/meson.build +++ /dev/null @@ -1,31 +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') - -arr = meson.get_external_property('does-not-exist', ['bar', 'baz']) -assert(arr == ['bar', 'baz'], 'meson.get_external_property with array fallback is broken') - -arr = meson.get_external_property('does-not-exist', ['bar', 'baz'], native: true) -assert(arr == ['bar', 'baz'], 'meson.get_external_property native:true with array fallback is broken') - -arr = meson.get_external_property('does-not-exist', ['bar', 'baz'], native: false) -assert(arr == ['bar', 'baz'], 'meson.get_external_property native:false with array fallback is broken') - -# Test deprecated behaviour - -conf.set(['foo', 'bar']) -message(conf.get('foo')) diff --git a/test cases/common/188 dict/meson.build b/test cases/common/188 dict/meson.build new file mode 100644 index 0000000..dacf01d --- /dev/null +++ b/test cases/common/188 dict/meson.build @@ -0,0 +1,71 @@ +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') + +dict1 = {} + +# A variable to be used as a key +testkey1 = 'myKey1' +testkey2 = 'myKey2' + +# Add new entry using the variable +dict1 += {testkey1 : 'myValue'} +dict1 += {testkey2 : 42} + +# Test that the stored values are correct +assert(dict1[testkey1] == 'myValue', + 'Incorrect string value retrieved from dictionary - variable key') +assert(dict1['myKey1'] == 'myValue', + 'Incorrect string value retrieved from dictionary - literal key') +assert(dict1[testkey2] == 42, + 'Incorrect int value retrieved from dictionary - variable key') +assert(dict1['myKey2'] == 42, + 'Incorrect int value retrieved from dictionary - literal key') + +d = {testkey1 : 1} +assert(d[testkey1] == 1, + 'Incorrect int value retrieved from dictionary - variable key') +assert(d['myKey1'] == 1, + 'Incorrect int value retrieved from dictionary - literal key') + +d = {'1' / '2' : 1, join_paths('a', 'b') : 2} +k1 = '1' / '2' +k2 = join_paths('a', 'b') +assert(d[k1] == 1, 'Incorrect expression evaluation in dictionary key') +assert(d[k2] == 2, 'Incorrect expression evaluation in dictionary key') + +d = {'a' + 'b' : 1} +assert(d['a' + 'b'] == 1, 'Incorrect expression evaluation in dictionary key') +assert(d['ab'] == 1, 'Incorrect expression evaluation in dictionary key') diff --git a/test cases/common/188 dict/prog.c b/test cases/common/188 dict/prog.c new file mode 100644 index 0000000..bf0999d --- /dev/null +++ b/test cases/common/188 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/189 check header/meson.build b/test cases/common/189 check header/meson.build new file mode 100644 index 0000000..98b395d --- /dev/null +++ b/test cases/common/189 check header/meson.build @@ -0,0 +1,48 @@ +project('check header', 'c', 'cpp') + +host_system = host_machine.system() + +non_existent_header = 'ouagadougou.h' + +# Copy it into the builddir to ensure that it isn't found even if it's there +configure_file(input : non_existent_header, + output : non_existent_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_existent_header, prefix : fallback), + 'Found non-existent header.') +endforeach diff --git a/test cases/common/189 check header/ouagadougou.h b/test cases/common/189 check header/ouagadougou.h new file mode 100644 index 0000000..2f76c49 --- /dev/null +++ b/test cases/common/189 check header/ouagadougou.h @@ -0,0 +1 @@ +#define OMG_THIS_SHOULDNT_BE_FOUND diff --git a/test cases/common/189 dict/meson.build b/test cases/common/189 dict/meson.build deleted file mode 100644 index dacf01d..0000000 --- a/test cases/common/189 dict/meson.build +++ /dev/null @@ -1,71 +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') - -dict1 = {} - -# A variable to be used as a key -testkey1 = 'myKey1' -testkey2 = 'myKey2' - -# Add new entry using the variable -dict1 += {testkey1 : 'myValue'} -dict1 += {testkey2 : 42} - -# Test that the stored values are correct -assert(dict1[testkey1] == 'myValue', - 'Incorrect string value retrieved from dictionary - variable key') -assert(dict1['myKey1'] == 'myValue', - 'Incorrect string value retrieved from dictionary - literal key') -assert(dict1[testkey2] == 42, - 'Incorrect int value retrieved from dictionary - variable key') -assert(dict1['myKey2'] == 42, - 'Incorrect int value retrieved from dictionary - literal key') - -d = {testkey1 : 1} -assert(d[testkey1] == 1, - 'Incorrect int value retrieved from dictionary - variable key') -assert(d['myKey1'] == 1, - 'Incorrect int value retrieved from dictionary - literal key') - -d = {'1' / '2' : 1, join_paths('a', 'b') : 2} -k1 = '1' / '2' -k2 = join_paths('a', 'b') -assert(d[k1] == 1, 'Incorrect expression evaluation in dictionary key') -assert(d[k2] == 2, 'Incorrect expression evaluation in dictionary key') - -d = {'a' + 'b' : 1} -assert(d['a' + 'b'] == 1, 'Incorrect expression evaluation in dictionary key') -assert(d['ab'] == 1, 'Incorrect expression evaluation in dictionary key') diff --git a/test cases/common/189 dict/prog.c b/test cases/common/189 dict/prog.c deleted file mode 100644 index bf0999d..0000000 --- a/test cases/common/189 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/19 header in file list/header.h b/test cases/common/19 header in file list/header.h new file mode 100644 index 0000000..354499a --- /dev/null +++ b/test cases/common/19 header in file list/header.h @@ -0,0 +1 @@ +#include diff --git a/test cases/common/19 header in file list/meson.build b/test cases/common/19 header in file list/meson.build new file mode 100644 index 0000000..79eec8d --- /dev/null +++ b/test cases/common/19 header in file list/meson.build @@ -0,0 +1,14 @@ +project('header in file list', '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 + +exe = executable('prog', 'prog.c', 'header.h') +test('basic', exe) diff --git a/test cases/common/19 header in file list/prog.c b/test cases/common/19 header in file list/prog.c new file mode 100644 index 0000000..97acb3f --- /dev/null +++ b/test cases/common/19 header in file list/prog.c @@ -0,0 +1,3 @@ +#include "header.h" + +int main(void) { return 0; } diff --git a/test cases/common/19 includedir/include/func.h b/test cases/common/19 includedir/include/func.h deleted file mode 100644 index 647b72f..0000000 --- a/test cases/common/19 includedir/include/func.h +++ /dev/null @@ -1,6 +0,0 @@ -#ifndef FUNC_H__ -#define FUNC_H__ - -int func(void); - -#endif diff --git a/test cases/common/19 includedir/meson.build b/test cases/common/19 includedir/meson.build deleted file mode 100644 index 17eec0e..0000000 --- a/test cases/common/19 includedir/meson.build +++ /dev/null @@ -1,4 +0,0 @@ -project('include dir test', 'c') - -inc = include_directories('include') -subdir('src') diff --git a/test cases/common/19 includedir/src/func.c b/test cases/common/19 includedir/src/func.c deleted file mode 100644 index 215beff..0000000 --- a/test cases/common/19 includedir/src/func.c +++ /dev/null @@ -1,5 +0,0 @@ -#include "func.h" - -int func(void) { - return 0; -} diff --git a/test cases/common/19 includedir/src/meson.build b/test cases/common/19 includedir/src/meson.build deleted file mode 100644 index 30d2e0c..0000000 --- a/test cases/common/19 includedir/src/meson.build +++ /dev/null @@ -1,5 +0,0 @@ -exe = executable('prog', 'prog.c', 'func.c', include_directories : inc) -test('inc test', exe) - -exe2 = executable('prog2', 'prog.c', 'func.c', include_directories : [['../include']]) -test('inc test 2', exe2) diff --git a/test cases/common/19 includedir/src/prog.c b/test cases/common/19 includedir/src/prog.c deleted file mode 100644 index ce4dd67..0000000 --- a/test cases/common/19 includedir/src/prog.c +++ /dev/null @@ -1,5 +0,0 @@ -#include "func.h" - -int main(void) { - return func(); -} diff --git a/test cases/common/190 check header/meson.build b/test cases/common/190 check header/meson.build deleted file mode 100644 index 98b395d..0000000 --- a/test cases/common/190 check header/meson.build +++ /dev/null @@ -1,48 +0,0 @@ -project('check header', 'c', 'cpp') - -host_system = host_machine.system() - -non_existent_header = 'ouagadougou.h' - -# Copy it into the builddir to ensure that it isn't found even if it's there -configure_file(input : non_existent_header, - output : non_existent_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_existent_header, prefix : fallback), - 'Found non-existent header.') -endforeach diff --git a/test cases/common/190 check header/ouagadougou.h b/test cases/common/190 check header/ouagadougou.h deleted file mode 100644 index 2f76c49..0000000 --- a/test cases/common/190 check header/ouagadougou.h +++ /dev/null @@ -1 +0,0 @@ -#define OMG_THIS_SHOULDNT_BE_FOUND diff --git a/test cases/common/190 install_mode/config.h.in b/test cases/common/190 install_mode/config.h.in new file mode 100644 index 0000000..14a1558 --- /dev/null +++ b/test cases/common/190 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/190 install_mode/data_source.txt b/test cases/common/190 install_mode/data_source.txt new file mode 100644 index 0000000..0c23cc0 --- /dev/null +++ b/test cases/common/190 install_mode/data_source.txt @@ -0,0 +1 @@ +This is a text only input file. diff --git a/test cases/common/190 install_mode/foo.1 b/test cases/common/190 install_mode/foo.1 new file mode 100644 index 0000000..647c097 --- /dev/null +++ b/test cases/common/190 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/190 install_mode/meson.build b/test cases/common/190 install_mode/meson.build new file mode 100644 index 0000000..cae1e91 --- /dev/null +++ b/test cases/common/190 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/190 install_mode/rootdir.h b/test cases/common/190 install_mode/rootdir.h new file mode 100644 index 0000000..72fb132 --- /dev/null +++ b/test cases/common/190 install_mode/rootdir.h @@ -0,0 +1,3 @@ +/* This header goes to include dir root. */ + +int root_func(); diff --git a/test cases/common/190 install_mode/runscript.sh b/test cases/common/190 install_mode/runscript.sh new file mode 100644 index 0000000..8bc5ca6 --- /dev/null +++ b/test cases/common/190 install_mode/runscript.sh @@ -0,0 +1,3 @@ +#!/bin/sh + +echo "Runscript" diff --git a/test cases/common/190 install_mode/stat.c b/test cases/common/190 install_mode/stat.c new file mode 100644 index 0000000..4825cef --- /dev/null +++ b/test cases/common/190 install_mode/stat.c @@ -0,0 +1 @@ +int func(void) { return 933; } diff --git a/test cases/common/190 install_mode/sub1/second.dat b/test cases/common/190 install_mode/sub1/second.dat new file mode 100644 index 0000000..48857a8 --- /dev/null +++ b/test cases/common/190 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/190 install_mode/sub2/stub b/test cases/common/190 install_mode/sub2/stub new file mode 100644 index 0000000..e69de29 diff --git a/test cases/common/190 install_mode/test.json b/test cases/common/190 install_mode/test.json new file mode 100644 index 0000000..3614dbc --- /dev/null +++ b/test cases/common/190 install_mode/test.json @@ -0,0 +1,15 @@ +{ + "installed": [ + {"type": "file", "file": "usr/bin/runscript.sh"}, + {"type": "exe", "file": "usr/bin/trivialprog"}, + {"type": "pdb", "file": "usr/bin/trivialprog"}, + {"type": "file", "file": "usr/include/config.h"}, + {"type": "file", "file": "usr/include/rootdir.h"}, + {"type": "file", "file": "usr/libtest/libstat.a"}, + {"type": "file", "file": "usr/share/man/man1/foo.1"}, + {"type": "file", "file": "usr/share/sub1/second.dat"}, + {"type": "file", "file": "usr/share/sub2/stub"}, + {"type": "file", "file": "usr/subdir/data.dat"} + ], + "do_not_set_opts": ["libdir"] +} diff --git a/test cases/common/190 install_mode/trivial.c b/test cases/common/190 install_mode/trivial.c new file mode 100644 index 0000000..96612d4 --- /dev/null +++ b/test cases/common/190 install_mode/trivial.c @@ -0,0 +1,6 @@ +#include + +int main(void) { + printf("Trivial test is working.\n"); + return 0; +} diff --git a/test cases/common/191 install_mode/config.h.in b/test cases/common/191 install_mode/config.h.in deleted file mode 100644 index 14a1558..0000000 --- a/test cases/common/191 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/191 install_mode/data_source.txt b/test cases/common/191 install_mode/data_source.txt deleted file mode 100644 index 0c23cc0..0000000 --- a/test cases/common/191 install_mode/data_source.txt +++ /dev/null @@ -1 +0,0 @@ -This is a text only input file. diff --git a/test cases/common/191 install_mode/foo.1 b/test cases/common/191 install_mode/foo.1 deleted file mode 100644 index 647c097..0000000 --- a/test cases/common/191 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/191 install_mode/meson.build b/test cases/common/191 install_mode/meson.build deleted file mode 100644 index cae1e91..0000000 --- a/test cases/common/191 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/191 install_mode/rootdir.h b/test cases/common/191 install_mode/rootdir.h deleted file mode 100644 index 72fb132..0000000 --- a/test cases/common/191 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/191 install_mode/runscript.sh b/test cases/common/191 install_mode/runscript.sh deleted file mode 100644 index 8bc5ca6..0000000 --- a/test cases/common/191 install_mode/runscript.sh +++ /dev/null @@ -1,3 +0,0 @@ -#!/bin/sh - -echo "Runscript" diff --git a/test cases/common/191 install_mode/stat.c b/test cases/common/191 install_mode/stat.c deleted file mode 100644 index 4825cef..0000000 --- a/test cases/common/191 install_mode/stat.c +++ /dev/null @@ -1 +0,0 @@ -int func(void) { return 933; } diff --git a/test cases/common/191 install_mode/sub1/second.dat b/test cases/common/191 install_mode/sub1/second.dat deleted file mode 100644 index 48857a8..0000000 --- a/test cases/common/191 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/191 install_mode/sub2/stub b/test cases/common/191 install_mode/sub2/stub deleted file mode 100644 index e69de29..0000000 diff --git a/test cases/common/191 install_mode/test.json b/test cases/common/191 install_mode/test.json deleted file mode 100644 index 3614dbc..0000000 --- a/test cases/common/191 install_mode/test.json +++ /dev/null @@ -1,15 +0,0 @@ -{ - "installed": [ - {"type": "file", "file": "usr/bin/runscript.sh"}, - {"type": "exe", "file": "usr/bin/trivialprog"}, - {"type": "pdb", "file": "usr/bin/trivialprog"}, - {"type": "file", "file": "usr/include/config.h"}, - {"type": "file", "file": "usr/include/rootdir.h"}, - {"type": "file", "file": "usr/libtest/libstat.a"}, - {"type": "file", "file": "usr/share/man/man1/foo.1"}, - {"type": "file", "file": "usr/share/sub1/second.dat"}, - {"type": "file", "file": "usr/share/sub2/stub"}, - {"type": "file", "file": "usr/subdir/data.dat"} - ], - "do_not_set_opts": ["libdir"] -} diff --git a/test cases/common/191 install_mode/trivial.c b/test cases/common/191 install_mode/trivial.c deleted file mode 100644 index 96612d4..0000000 --- a/test cases/common/191 install_mode/trivial.c +++ /dev/null @@ -1,6 +0,0 @@ -#include - -int main(void) { - printf("Trivial test is working.\n"); - return 0; -} diff --git a/test cases/common/191 subproject array version/meson.build b/test cases/common/191 subproject array version/meson.build new file mode 100644 index 0000000..0870bc4 --- /dev/null +++ b/test cases/common/191 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/191 subproject array version/subprojects/foo/meson.build b/test cases/common/191 subproject array version/subprojects/foo/meson.build new file mode 100644 index 0000000..f4ff535 --- /dev/null +++ b/test cases/common/191 subproject array version/subprojects/foo/meson.build @@ -0,0 +1 @@ +project('foo', 'c', version : '1.0.0') diff --git a/test cases/common/192 feature option/meson.build b/test cases/common/192 feature option/meson.build new file mode 100644 index 0000000..ef3fa22 --- /dev/null +++ b/test cases/common/192 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/192 feature option/meson_options.txt b/test cases/common/192 feature option/meson_options.txt new file mode 100644 index 0000000..063a35f --- /dev/null +++ b/test cases/common/192 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/192 subproject array version/meson.build b/test cases/common/192 subproject array version/meson.build deleted file mode 100644 index 0870bc4..0000000 --- a/test cases/common/192 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/192 subproject array version/subprojects/foo/meson.build b/test cases/common/192 subproject array version/subprojects/foo/meson.build deleted file mode 100644 index f4ff535..0000000 --- a/test cases/common/192 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/193 feature option disabled/meson.build b/test cases/common/193 feature option disabled/meson.build new file mode 100644 index 0000000..1a83187 --- /dev/null +++ b/test cases/common/193 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/193 feature option disabled/meson_options.txt b/test cases/common/193 feature option disabled/meson_options.txt new file mode 100644 index 0000000..063a35f --- /dev/null +++ b/test cases/common/193 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/193 feature option/meson.build b/test cases/common/193 feature option/meson.build deleted file mode 100644 index ef3fa22..0000000 --- a/test cases/common/193 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/193 feature option/meson_options.txt b/test cases/common/193 feature option/meson_options.txt deleted file mode 100644 index 063a35f..0000000 --- a/test cases/common/193 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/194 feature option disabled/meson.build b/test cases/common/194 feature option disabled/meson.build deleted file mode 100644 index 1a83187..0000000 --- a/test cases/common/194 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/194 feature option disabled/meson_options.txt b/test cases/common/194 feature option disabled/meson_options.txt deleted file mode 100644 index 063a35f..0000000 --- a/test cases/common/194 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/194 static threads/lib1.c b/test cases/common/194 static threads/lib1.c new file mode 100644 index 0000000..1aa786c --- /dev/null +++ b/test cases/common/194 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/194 static threads/lib2.c b/test cases/common/194 static threads/lib2.c new file mode 100644 index 0000000..e988814 --- /dev/null +++ b/test cases/common/194 static threads/lib2.c @@ -0,0 +1,5 @@ +extern void *f(void); + +void *g(void) { + return f(); +} diff --git a/test cases/common/194 static threads/meson.build b/test cases/common/194 static threads/meson.build new file mode 100644 index 0000000..4279200 --- /dev/null +++ b/test cases/common/194 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/194 static threads/prog.c b/test cases/common/194 static threads/prog.c new file mode 100644 index 0000000..14a7c76 --- /dev/null +++ b/test cases/common/194 static threads/prog.c @@ -0,0 +1,6 @@ +extern void *g(void); + +int main(void) { + g(); + return 0; +} diff --git a/test cases/common/195 generator in subdir/com/mesonbuild/genprog.py b/test cases/common/195 generator in subdir/com/mesonbuild/genprog.py new file mode 100644 index 0000000..681c43a --- /dev/null +++ b/test cases/common/195 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(void); +''' + +c_templ = '''#include"%s.h" + +int %s(void) { + 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(f'Input file {ifile} does not start with search dir {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/195 generator in subdir/com/mesonbuild/meson.build b/test cases/common/195 generator in subdir/com/mesonbuild/meson.build new file mode 100644 index 0000000..4808743 --- /dev/null +++ b/test cases/common/195 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/195 generator in subdir/com/mesonbuild/subbie.inp b/test cases/common/195 generator in subdir/com/mesonbuild/subbie.inp new file mode 100644 index 0000000..df0f4e9 --- /dev/null +++ b/test cases/common/195 generator in subdir/com/mesonbuild/subbie.inp @@ -0,0 +1 @@ +subbie diff --git a/test cases/common/195 generator in subdir/com/mesonbuild/testprog.c b/test cases/common/195 generator in subdir/com/mesonbuild/testprog.c new file mode 100644 index 0000000..7a7cdf7 --- /dev/null +++ b/test cases/common/195 generator in subdir/com/mesonbuild/testprog.c @@ -0,0 +1,5 @@ +#include"subbie.h" + +int main(void) { + return subbie(); +} diff --git a/test cases/common/195 generator in subdir/meson.build b/test cases/common/195 generator in subdir/meson.build new file mode 100644 index 0000000..9b8eb7c --- /dev/null +++ b/test cases/common/195 generator in subdir/meson.build @@ -0,0 +1,3 @@ +project('generator in subdir', 'c') + +subdir('com/mesonbuild') diff --git a/test cases/common/195 static threads/lib1.c b/test cases/common/195 static threads/lib1.c deleted file mode 100644 index 1aa786c..0000000 --- a/test cases/common/195 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/195 static threads/lib2.c b/test cases/common/195 static threads/lib2.c deleted file mode 100644 index e988814..0000000 --- a/test cases/common/195 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/195 static threads/meson.build b/test cases/common/195 static threads/meson.build deleted file mode 100644 index 4279200..0000000 --- a/test cases/common/195 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/195 static threads/prog.c b/test cases/common/195 static threads/prog.c deleted file mode 100644 index 14a7c76..0000000 --- a/test cases/common/195 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/196 generator in subdir/com/mesonbuild/genprog.py b/test cases/common/196 generator in subdir/com/mesonbuild/genprog.py deleted file mode 100644 index 681c43a..0000000 --- a/test cases/common/196 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(void); -''' - -c_templ = '''#include"%s.h" - -int %s(void) { - 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(f'Input file {ifile} does not start with search dir {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/196 generator in subdir/com/mesonbuild/meson.build b/test cases/common/196 generator in subdir/com/mesonbuild/meson.build deleted file mode 100644 index 4808743..0000000 --- a/test cases/common/196 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/196 generator in subdir/com/mesonbuild/subbie.inp b/test cases/common/196 generator in subdir/com/mesonbuild/subbie.inp deleted file mode 100644 index df0f4e9..0000000 --- a/test cases/common/196 generator in subdir/com/mesonbuild/subbie.inp +++ /dev/null @@ -1 +0,0 @@ -subbie diff --git a/test cases/common/196 generator in subdir/com/mesonbuild/testprog.c b/test cases/common/196 generator in subdir/com/mesonbuild/testprog.c deleted file mode 100644 index 7a7cdf7..0000000 --- a/test cases/common/196 generator in subdir/com/mesonbuild/testprog.c +++ /dev/null @@ -1,5 +0,0 @@ -#include"subbie.h" - -int main(void) { - return subbie(); -} diff --git a/test cases/common/196 generator in subdir/meson.build b/test cases/common/196 generator in subdir/meson.build deleted file mode 100644 index 9b8eb7c..0000000 --- a/test cases/common/196 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/196 subproject with features/meson.build b/test cases/common/196 subproject with features/meson.build new file mode 100644 index 0000000..5bdfefb --- /dev/null +++ b/test cases/common/196 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/196 subproject with features/meson_options.txt b/test cases/common/196 subproject with features/meson_options.txt new file mode 100644 index 0000000..a46e5fb --- /dev/null +++ b/test cases/common/196 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/196 subproject with features/nothing.c b/test cases/common/196 subproject with features/nothing.c new file mode 100644 index 0000000..58fe692 --- /dev/null +++ b/test cases/common/196 subproject with features/nothing.c @@ -0,0 +1,4 @@ +int main(void) +{ + return 0; +} diff --git a/test cases/common/196 subproject with features/subprojects/auto_sub_with_missing_dep/meson.build b/test cases/common/196 subproject with features/subprojects/auto_sub_with_missing_dep/meson.build new file mode 100644 index 0000000..fa6b011 --- /dev/null +++ b/test cases/common/196 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/196 subproject with features/subprojects/disabled_sub/lib/meson.build b/test cases/common/196 subproject with features/subprojects/disabled_sub/lib/meson.build new file mode 100644 index 0000000..933001a --- /dev/null +++ b/test cases/common/196 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/196 subproject with features/subprojects/disabled_sub/lib/sub.c b/test cases/common/196 subproject with features/subprojects/disabled_sub/lib/sub.c new file mode 100644 index 0000000..e748ac7 --- /dev/null +++ b/test cases/common/196 subproject with features/subprojects/disabled_sub/lib/sub.c @@ -0,0 +1,5 @@ +#include "sub.h" + +int sub(void) { + return 0; +} diff --git a/test cases/common/196 subproject with features/subprojects/disabled_sub/lib/sub.h b/test cases/common/196 subproject with features/subprojects/disabled_sub/lib/sub.h new file mode 100644 index 0000000..f1ab0e1 --- /dev/null +++ b/test cases/common/196 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/196 subproject with features/subprojects/disabled_sub/meson.build b/test cases/common/196 subproject with features/subprojects/disabled_sub/meson.build new file mode 100644 index 0000000..65fef03 --- /dev/null +++ b/test cases/common/196 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/196 subproject with features/subprojects/sub/lib/meson.build b/test cases/common/196 subproject with features/subprojects/sub/lib/meson.build new file mode 100644 index 0000000..731d22b --- /dev/null +++ b/test cases/common/196 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/196 subproject with features/subprojects/sub/lib/sub.c b/test cases/common/196 subproject with features/subprojects/sub/lib/sub.c new file mode 100644 index 0000000..768ed36 --- /dev/null +++ b/test cases/common/196 subproject with features/subprojects/sub/lib/sub.c @@ -0,0 +1,5 @@ +#include "sub.h" + +int sub(void) { + return 0; +} diff --git a/test cases/common/196 subproject with features/subprojects/sub/lib/sub.h b/test cases/common/196 subproject with features/subprojects/sub/lib/sub.h new file mode 100644 index 0000000..2b59a3a --- /dev/null +++ b/test cases/common/196 subproject with features/subprojects/sub/lib/sub.h @@ -0,0 +1,6 @@ +#ifndef SUB_H +#define SUB_H + +int sub(void); + +#endif diff --git a/test cases/common/196 subproject with features/subprojects/sub/meson.build b/test cases/common/196 subproject with features/subprojects/sub/meson.build new file mode 100644 index 0000000..31882ac --- /dev/null +++ b/test cases/common/196 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/197 function attributes/meson.build b/test cases/common/197 function attributes/meson.build new file mode 100644 index 0000000..9817309 --- /dev/null +++ b/test cases/common/197 function attributes/meson.build @@ -0,0 +1,111 @@ +# 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') + +if c.get_id() == 'pgi' + error('MESON_SKIP_TEST: PGI supports its own set of features, will need a separate list for PGI to test it.') +endif + +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', + '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' + attributes += 'alloc_size' +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 + +if get_option('mode') == 'single' + 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 +else + 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++)') +endif diff --git a/test cases/common/197 function attributes/meson_options.txt b/test cases/common/197 function attributes/meson_options.txt new file mode 100644 index 0000000..4a1d87c --- /dev/null +++ b/test cases/common/197 function attributes/meson_options.txt @@ -0,0 +1,7 @@ +option( + 'mode', + type : 'combo', + choices : ['single', 'parallel'], + value : 'single', + description : 'Test the one at a time function or many at a time function.' +) diff --git a/test cases/common/197 function attributes/test.json b/test cases/common/197 function attributes/test.json new file mode 100644 index 0000000..d06a24a --- /dev/null +++ b/test cases/common/197 function attributes/test.json @@ -0,0 +1,10 @@ +{ + "matrix": { + "options": { + "mode": [ + { "val": "single" }, + { "val": "parallel" } + ] + } + } +} diff --git a/test cases/common/197 subproject with features/meson.build b/test cases/common/197 subproject with features/meson.build deleted file mode 100644 index 5bdfefb..0000000 --- a/test cases/common/197 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/197 subproject with features/meson_options.txt b/test cases/common/197 subproject with features/meson_options.txt deleted file mode 100644 index a46e5fb..0000000 --- a/test cases/common/197 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/197 subproject with features/nothing.c b/test cases/common/197 subproject with features/nothing.c deleted file mode 100644 index 58fe692..0000000 --- a/test cases/common/197 subproject with features/nothing.c +++ /dev/null @@ -1,4 +0,0 @@ -int main(void) -{ - return 0; -} diff --git a/test cases/common/197 subproject with features/subprojects/auto_sub_with_missing_dep/meson.build b/test cases/common/197 subproject with features/subprojects/auto_sub_with_missing_dep/meson.build deleted file mode 100644 index fa6b011..0000000 --- a/test cases/common/197 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/197 subproject with features/subprojects/disabled_sub/lib/meson.build b/test cases/common/197 subproject with features/subprojects/disabled_sub/lib/meson.build deleted file mode 100644 index 933001a..0000000 --- a/test cases/common/197 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/197 subproject with features/subprojects/disabled_sub/lib/sub.c b/test cases/common/197 subproject with features/subprojects/disabled_sub/lib/sub.c deleted file mode 100644 index e748ac7..0000000 --- a/test cases/common/197 subproject with features/subprojects/disabled_sub/lib/sub.c +++ /dev/null @@ -1,5 +0,0 @@ -#include "sub.h" - -int sub(void) { - return 0; -} diff --git a/test cases/common/197 subproject with features/subprojects/disabled_sub/lib/sub.h b/test cases/common/197 subproject with features/subprojects/disabled_sub/lib/sub.h deleted file mode 100644 index f1ab0e1..0000000 --- a/test cases/common/197 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/197 subproject with features/subprojects/disabled_sub/meson.build b/test cases/common/197 subproject with features/subprojects/disabled_sub/meson.build deleted file mode 100644 index 65fef03..0000000 --- a/test cases/common/197 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/197 subproject with features/subprojects/sub/lib/meson.build b/test cases/common/197 subproject with features/subprojects/sub/lib/meson.build deleted file mode 100644 index 731d22b..0000000 --- a/test cases/common/197 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/197 subproject with features/subprojects/sub/lib/sub.c b/test cases/common/197 subproject with features/subprojects/sub/lib/sub.c deleted file mode 100644 index 768ed36..0000000 --- a/test cases/common/197 subproject with features/subprojects/sub/lib/sub.c +++ /dev/null @@ -1,5 +0,0 @@ -#include "sub.h" - -int sub(void) { - return 0; -} diff --git a/test cases/common/197 subproject with features/subprojects/sub/lib/sub.h b/test cases/common/197 subproject with features/subprojects/sub/lib/sub.h deleted file mode 100644 index 2b59a3a..0000000 --- a/test cases/common/197 subproject with features/subprojects/sub/lib/sub.h +++ /dev/null @@ -1,6 +0,0 @@ -#ifndef SUB_H -#define SUB_H - -int sub(void); - -#endif diff --git a/test cases/common/197 subproject with features/subprojects/sub/meson.build b/test cases/common/197 subproject with features/subprojects/sub/meson.build deleted file mode 100644 index 31882ac..0000000 --- a/test cases/common/197 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/198 broken subproject/meson.build b/test cases/common/198 broken subproject/meson.build new file mode 100644 index 0000000..e3a6cae --- /dev/null +++ b/test cases/common/198 broken subproject/meson.build @@ -0,0 +1,2 @@ +project('test broken subproject') +subproject('broken', required : false) diff --git a/test cases/common/198 broken subproject/subprojects/broken/broken.c b/test cases/common/198 broken subproject/subprojects/broken/broken.c new file mode 100644 index 0000000..a9fc4b1 --- /dev/null +++ b/test cases/common/198 broken subproject/subprojects/broken/broken.c @@ -0,0 +1 @@ +#error This must not compile diff --git a/test cases/common/198 broken subproject/subprojects/broken/meson.build b/test cases/common/198 broken subproject/subprojects/broken/meson.build new file mode 100644 index 0000000..2d64fde --- /dev/null +++ b/test cases/common/198 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/198 function attributes/meson.build b/test cases/common/198 function attributes/meson.build deleted file mode 100644 index 9817309..0000000 --- a/test cases/common/198 function attributes/meson.build +++ /dev/null @@ -1,111 +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') - -if c.get_id() == 'pgi' - error('MESON_SKIP_TEST: PGI supports its own set of features, will need a separate list for PGI to test it.') -endif - -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', - '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' - attributes += 'alloc_size' -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 - -if get_option('mode') == 'single' - 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 -else - 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++)') -endif diff --git a/test cases/common/198 function attributes/meson_options.txt b/test cases/common/198 function attributes/meson_options.txt deleted file mode 100644 index 4a1d87c..0000000 --- a/test cases/common/198 function attributes/meson_options.txt +++ /dev/null @@ -1,7 +0,0 @@ -option( - 'mode', - type : 'combo', - choices : ['single', 'parallel'], - value : 'single', - description : 'Test the one at a time function or many at a time function.' -) diff --git a/test cases/common/198 function attributes/test.json b/test cases/common/198 function attributes/test.json deleted file mode 100644 index d06a24a..0000000 --- a/test cases/common/198 function attributes/test.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "matrix": { - "options": { - "mode": [ - { "val": "single" }, - { "val": "parallel" } - ] - } - } -} diff --git a/test cases/common/199 argument syntax/meson.build b/test cases/common/199 argument syntax/meson.build new file mode 100644 index 0000000..b97ca74 --- /dev/null +++ b/test cases/common/199 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/199 broken subproject/meson.build b/test cases/common/199 broken subproject/meson.build deleted file mode 100644 index e3a6cae..0000000 --- a/test cases/common/199 broken subproject/meson.build +++ /dev/null @@ -1,2 +0,0 @@ -project('test broken subproject') -subproject('broken', required : false) diff --git a/test cases/common/199 broken subproject/subprojects/broken/broken.c b/test cases/common/199 broken subproject/subprojects/broken/broken.c deleted file mode 100644 index a9fc4b1..0000000 --- a/test cases/common/199 broken subproject/subprojects/broken/broken.c +++ /dev/null @@ -1 +0,0 @@ -#error This must not compile diff --git a/test cases/common/199 broken subproject/subprojects/broken/meson.build b/test cases/common/199 broken subproject/subprojects/broken/meson.build deleted file mode 100644 index 2d64fde..0000000 --- a/test cases/common/199 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/20 global arg/meson.build b/test cases/common/20 global arg/meson.build new file mode 100644 index 0000000..2a1c736 --- /dev/null +++ b/test cases/common/20 global arg/meson.build @@ -0,0 +1,16 @@ +project('global arg test', 'cpp', 'c') + +add_global_arguments('-DMYTHING', language : 'c') +add_global_arguments('-DMYCPPTHING', language : 'cpp') +add_global_arguments('-DGLOBAL_HOST', language : 'c') + +build_c_args = ['-DARG_BUILD'] +c_args = ['-DARG_HOST'] + +add_global_arguments('-DMYCANDCPPTHING', language: ['c', 'cpp']) + +exe2 = executable('prog2', 'prog.c', c_args : c_args) +exe3 = executable('prog3', 'prog.cc') + +test('prog2', exe2) +test('prog3', exe3) diff --git a/test cases/common/20 global arg/prog.c b/test cases/common/20 global arg/prog.c new file mode 100644 index 0000000..2a71236 --- /dev/null +++ b/test cases/common/20 global arg/prog.c @@ -0,0 +1,43 @@ +#ifndef MYTHING + #error "Global argument not set" +#endif + +#ifdef MYCPPTHING + #error "Wrong global argument set" +#endif + +#ifndef MYCANDCPPTHING + #error "Global argument not set" +#endif + +#if !defined(GLOBAL_HOST) && !defined(GLOBAL_BUILD) + #error "Neither global_host nor glogal_build is set." +#endif + +#if defined(GLOBAL_HOST) && defined(GLOBAL_BUILD) + #error "Both global build and global host set." +#endif + +#ifdef GLOBAL_BUILD + #ifndef ARG_BUILD + #error "Global is build but arg_build is not set." + #endif + + #ifdef ARG_HOST + #error "Global is build but arg host is set." + #endif +#endif + +#ifdef GLOBAL_HOST + #ifndef ARG_HOST + #error "Global is host but arg_host is not set." + #endif + + #ifdef ARG_BUILD + #error "Global is host but arg_build is set." + #endif +#endif + +int main(void) { + return 0; +} diff --git a/test cases/common/20 global arg/prog.cc b/test cases/common/20 global arg/prog.cc new file mode 100644 index 0000000..5c32209 --- /dev/null +++ b/test cases/common/20 global arg/prog.cc @@ -0,0 +1,15 @@ +#ifdef MYTHING +#error "Wrong global argument set" +#endif + +#ifndef MYCPPTHING +#error "Global argument not set" +#endif + +#ifndef MYCANDCPPTHING +#error "Global argument not set" +#endif + +int main(void) { + return 0; +} diff --git a/test cases/common/20 header in file list/header.h b/test cases/common/20 header in file list/header.h deleted file mode 100644 index 354499a..0000000 --- a/test cases/common/20 header in file list/header.h +++ /dev/null @@ -1 +0,0 @@ -#include diff --git a/test cases/common/20 header in file list/meson.build b/test cases/common/20 header in file list/meson.build deleted file mode 100644 index 79eec8d..0000000 --- a/test cases/common/20 header in file list/meson.build +++ /dev/null @@ -1,14 +0,0 @@ -project('header in file list', '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 - -exe = executable('prog', 'prog.c', 'header.h') -test('basic', exe) diff --git a/test cases/common/20 header in file list/prog.c b/test cases/common/20 header in file list/prog.c deleted file mode 100644 index 97acb3f..0000000 --- a/test cases/common/20 header in file list/prog.c +++ /dev/null @@ -1,3 +0,0 @@ -#include "header.h" - -int main(void) { return 0; } diff --git a/test cases/common/200 argument syntax/meson.build b/test cases/common/200 argument syntax/meson.build deleted file mode 100644 index b97ca74..0000000 --- a/test cases/common/200 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/200 install name_prefix name_suffix/libfile.c b/test cases/common/200 install name_prefix name_suffix/libfile.c new file mode 100644 index 0000000..91489b2 --- /dev/null +++ b/test cases/common/200 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(void) { + return 0; +} diff --git a/test cases/common/200 install name_prefix name_suffix/meson.build b/test cases/common/200 install name_prefix name_suffix/meson.build new file mode 100644 index 0000000..044f915 --- /dev/null +++ b/test cases/common/200 install name_prefix name_suffix/meson.build @@ -0,0 +1,13 @@ +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) + +# exercise default name_prefix and name_suffix +shared_library('garply', 'libfile.c', name_prefix: [], name_suffix: [], install : true) diff --git a/test cases/common/200 install name_prefix name_suffix/test.json b/test cases/common/200 install name_prefix name_suffix/test.json new file mode 100644 index 0000000..b92a985 --- /dev/null +++ b/test cases/common/200 install name_prefix name_suffix/test.json @@ -0,0 +1,19 @@ +{ + "installed": [ + {"type": "pdb", "file": "usr/bin/baz"}, + {"type": "pdb", "file": "usr/bin/bowcorge"}, + {"type": "pdb", "file": "usr/bin/foo"}, + {"type": "expr", "file": "usr/?lib/bowcorge.stern"}, + {"type": "expr", "file": "usr/lib/?libbaz.cheese"}, + {"type": "file", "file": "usr/lib/bar.a"}, + {"type": "implib", "file": "usr/lib/bowcorge"}, + {"type": "file", "file": "usr/lib/bowgrault.stern"}, + {"type": "implib", "file": "usr/lib/foo"}, + {"type": "expr", "file": "usr/lib/foo?so"}, + {"type": "implib", "file": "usr/lib/libbaz"}, + {"type": "file", "file": "usr/lib/libqux.cheese"}, + {"type": "expr", "file": "usr/?lib/libgarply?so"}, + {"type": "implib", "file": "usr/lib/libgarply"}, + {"type": "pdb", "file": "usr/bin/garply"} + ] +} diff --git a/test cases/common/201 install name_prefix name_suffix/libfile.c b/test cases/common/201 install name_prefix name_suffix/libfile.c deleted file mode 100644 index 91489b2..0000000 --- a/test cases/common/201 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(void) { - return 0; -} diff --git a/test cases/common/201 install name_prefix name_suffix/meson.build b/test cases/common/201 install name_prefix name_suffix/meson.build deleted file mode 100644 index 044f915..0000000 --- a/test cases/common/201 install name_prefix name_suffix/meson.build +++ /dev/null @@ -1,13 +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) - -# exercise default name_prefix and name_suffix -shared_library('garply', 'libfile.c', name_prefix: [], name_suffix: [], install : true) diff --git a/test cases/common/201 install name_prefix name_suffix/test.json b/test cases/common/201 install name_prefix name_suffix/test.json deleted file mode 100644 index b92a985..0000000 --- a/test cases/common/201 install name_prefix name_suffix/test.json +++ /dev/null @@ -1,19 +0,0 @@ -{ - "installed": [ - {"type": "pdb", "file": "usr/bin/baz"}, - {"type": "pdb", "file": "usr/bin/bowcorge"}, - {"type": "pdb", "file": "usr/bin/foo"}, - {"type": "expr", "file": "usr/?lib/bowcorge.stern"}, - {"type": "expr", "file": "usr/lib/?libbaz.cheese"}, - {"type": "file", "file": "usr/lib/bar.a"}, - {"type": "implib", "file": "usr/lib/bowcorge"}, - {"type": "file", "file": "usr/lib/bowgrault.stern"}, - {"type": "implib", "file": "usr/lib/foo"}, - {"type": "expr", "file": "usr/lib/foo?so"}, - {"type": "implib", "file": "usr/lib/libbaz"}, - {"type": "file", "file": "usr/lib/libqux.cheese"}, - {"type": "expr", "file": "usr/?lib/libgarply?so"}, - {"type": "implib", "file": "usr/lib/libgarply"}, - {"type": "pdb", "file": "usr/bin/garply"} - ] -} diff --git a/test cases/common/201 kwarg entry/inc/prog.h b/test cases/common/201 kwarg entry/inc/prog.h new file mode 100644 index 0000000..665521d --- /dev/null +++ b/test cases/common/201 kwarg entry/inc/prog.h @@ -0,0 +1,3 @@ +#pragma once + +#define MESSAGE "Hello there.\n" diff --git a/test cases/common/201 kwarg entry/meson.build b/test cases/common/201 kwarg entry/meson.build new file mode 100644 index 0000000..564ec37 --- /dev/null +++ b/test cases/common/201 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/201 kwarg entry/prog.c b/test cases/common/201 kwarg entry/prog.c new file mode 100644 index 0000000..2eec26b --- /dev/null +++ b/test cases/common/201 kwarg entry/prog.c @@ -0,0 +1,7 @@ +#include +#include + +int main(void) { + printf(MESSAGE); + return 0; +} diff --git a/test cases/common/201 kwarg entry/test.json b/test cases/common/201 kwarg entry/test.json new file mode 100644 index 0000000..135300d --- /dev/null +++ b/test cases/common/201 kwarg entry/test.json @@ -0,0 +1,6 @@ +{ + "installed": [ + {"type": "exe", "file": "usr/bin/prog"}, + {"type": "pdb", "file": "usr/bin/prog"} + ] +} diff --git a/test cases/common/202 custom target build by default/docgen.py b/test cases/common/202 custom target build by default/docgen.py new file mode 100644 index 0000000..f343f21 --- /dev/null +++ b/test cases/common/202 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/202 custom target build by default/meson.build b/test cases/common/202 custom target build by default/meson.build new file mode 100644 index 0000000..7c81aa2 --- /dev/null +++ b/test cases/common/202 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/202 custom target build by default/test.json b/test cases/common/202 custom target build by default/test.json new file mode 100644 index 0000000..df8bcb9 --- /dev/null +++ b/test cases/common/202 custom target build by default/test.json @@ -0,0 +1,5 @@ +{ + "installed": [ + + ] +} diff --git a/test cases/common/202 kwarg entry/inc/prog.h b/test cases/common/202 kwarg entry/inc/prog.h deleted file mode 100644 index 665521d..0000000 --- a/test cases/common/202 kwarg entry/inc/prog.h +++ /dev/null @@ -1,3 +0,0 @@ -#pragma once - -#define MESSAGE "Hello there.\n" diff --git a/test cases/common/202 kwarg entry/meson.build b/test cases/common/202 kwarg entry/meson.build deleted file mode 100644 index 564ec37..0000000 --- a/test cases/common/202 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/202 kwarg entry/prog.c b/test cases/common/202 kwarg entry/prog.c deleted file mode 100644 index 2eec26b..0000000 --- a/test cases/common/202 kwarg entry/prog.c +++ /dev/null @@ -1,7 +0,0 @@ -#include -#include - -int main(void) { - printf(MESSAGE); - return 0; -} diff --git a/test cases/common/202 kwarg entry/test.json b/test cases/common/202 kwarg entry/test.json deleted file mode 100644 index 135300d..0000000 --- a/test cases/common/202 kwarg entry/test.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "installed": [ - {"type": "exe", "file": "usr/bin/prog"}, - {"type": "pdb", "file": "usr/bin/prog"} - ] -} diff --git a/test cases/common/203 custom target build by default/docgen.py b/test cases/common/203 custom target build by default/docgen.py deleted file mode 100644 index f343f21..0000000 --- a/test cases/common/203 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/203 custom target build by default/meson.build b/test cases/common/203 custom target build by default/meson.build deleted file mode 100644 index 7c81aa2..0000000 --- a/test cases/common/203 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/203 custom target build by default/test.json b/test cases/common/203 custom target build by default/test.json deleted file mode 100644 index df8bcb9..0000000 --- a/test cases/common/203 custom target build by default/test.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "installed": [ - - ] -} diff --git a/test cases/common/203 find_library and headers/foo.h b/test cases/common/203 find_library and headers/foo.h new file mode 100644 index 0000000..014e06e --- /dev/null +++ b/test cases/common/203 find_library and headers/foo.h @@ -0,0 +1 @@ +#define VAL 42 diff --git a/test cases/common/203 find_library and headers/meson.build b/test cases/common/203 find_library and headers/meson.build new file mode 100644 index 0000000..bcd71f1 --- /dev/null +++ b/test cases/common/203 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/204 find_library and headers/foo.h b/test cases/common/204 find_library and headers/foo.h deleted file mode 100644 index 014e06e..0000000 --- a/test cases/common/204 find_library and headers/foo.h +++ /dev/null @@ -1 +0,0 @@ -#define VAL 42 diff --git a/test cases/common/204 find_library and headers/meson.build b/test cases/common/204 find_library and headers/meson.build deleted file mode 100644 index bcd71f1..0000000 --- a/test cases/common/204 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/204 line continuation/meson.build b/test cases/common/204 line continuation/meson.build new file mode 100644 index 0000000..16c72f9 --- /dev/null +++ b/test cases/common/204 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/205 line continuation/meson.build b/test cases/common/205 line continuation/meson.build deleted file mode 100644 index 16c72f9..0000000 --- a/test cases/common/205 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/205 native file path override/main.cpp b/test cases/common/205 native file path override/main.cpp new file mode 100644 index 0000000..91bc809 --- /dev/null +++ b/test cases/common/205 native file path override/main.cpp @@ -0,0 +1,5 @@ +#include + +int main(void) { + std::cout << "Hello world!" << std::endl; +} diff --git a/test cases/common/205 native file path override/meson.build b/test cases/common/205 native file path override/meson.build new file mode 100644 index 0000000..142ca1c --- /dev/null +++ b/test cases/common/205 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/205 native file path override/nativefile.ini b/test cases/common/205 native file path override/nativefile.ini new file mode 100644 index 0000000..1c295c7 --- /dev/null +++ b/test cases/common/205 native file path override/nativefile.ini @@ -0,0 +1,2 @@ +[paths] +bindir = 'custom_bindir' diff --git a/test cases/common/205 native file path override/test.json b/test cases/common/205 native file path override/test.json new file mode 100644 index 0000000..7954c8e --- /dev/null +++ b/test cases/common/205 native file path override/test.json @@ -0,0 +1,6 @@ +{ + "installed": [ + {"type": "exe", "file": "usr/custom_bindir/main"}, + {"type": "pdb", "file": "usr/custom_bindir/main"} + ] +} diff --git a/test cases/common/206 native file path override/main.cpp b/test cases/common/206 native file path override/main.cpp deleted file mode 100644 index 91bc809..0000000 --- a/test cases/common/206 native file path override/main.cpp +++ /dev/null @@ -1,5 +0,0 @@ -#include - -int main(void) { - std::cout << "Hello world!" << std::endl; -} diff --git a/test cases/common/206 native file path override/meson.build b/test cases/common/206 native file path override/meson.build deleted file mode 100644 index 142ca1c..0000000 --- a/test cases/common/206 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/206 native file path override/nativefile.ini b/test cases/common/206 native file path override/nativefile.ini deleted file mode 100644 index 1c295c7..0000000 --- a/test cases/common/206 native file path override/nativefile.ini +++ /dev/null @@ -1,2 +0,0 @@ -[paths] -bindir = 'custom_bindir' diff --git a/test cases/common/206 native file path override/test.json b/test cases/common/206 native file path override/test.json deleted file mode 100644 index 7954c8e..0000000 --- a/test cases/common/206 native file path override/test.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "installed": [ - {"type": "exe", "file": "usr/custom_bindir/main"}, - {"type": "pdb", "file": "usr/custom_bindir/main"} - ] -} diff --git a/test cases/common/206 tap tests/cat.c b/test cases/common/206 tap tests/cat.c new file mode 100644 index 0000000..4b92010 --- /dev/null +++ b/test cases/common/206 tap tests/cat.c @@ -0,0 +1,26 @@ +#include +#include + +int main(int argc, char **argv) { + char buf[1024]; + size_t len; + FILE *fh; + + if (argc != 2) { + fprintf(stderr, "Incorrect number of arguments, got %i\n", argc); + return 1; + } + fh = fopen(argv[1], "r"); + if (fh == NULL) { + fprintf(stderr, "Opening %s: errno=%i\n", argv[1], errno); + return 1; + } + do { + len = fread(buf, 1, sizeof(buf), fh); + if (len > 0) { + fwrite(buf, 1, len, stdout); + } + } while (len > 0); + fclose(fh); + return 0; +} diff --git a/test cases/common/206 tap tests/issue7515.txt b/test cases/common/206 tap tests/issue7515.txt new file mode 100644 index 0000000..ca85637 --- /dev/null +++ b/test cases/common/206 tap tests/issue7515.txt @@ -0,0 +1,27 @@ +1..26 +ok 1 Gtk overrides UI template sets up internal and public template children +ok 2 Gtk overrides UI template sets up public template children with the correct widgets +ok 3 Gtk overrides UI template sets up internal template children with the correct widgets +ok 4 Gtk overrides UI template connects template callbacks to the correct handler +ok 5 Gtk overrides UI template binds template callbacks to the correct object +ok 6 Gtk overrides UI template from resource sets up internal and public template children +ok 7 Gtk overrides UI template from resource sets up public template children with the correct widgets +ok 8 Gtk overrides UI template from resource sets up internal template children with the correct widgets +ok 9 Gtk overrides UI template from resource connects template callbacks to the correct handler +ok 10 Gtk overrides UI template from resource binds template callbacks to the correct object +ok 11 Gtk overrides UI template from file sets up internal and public template children +ok 12 Gtk overrides UI template from file sets up public template children with the correct widgets +ok 13 Gtk overrides UI template from file sets up internal template children with the correct widgets +ok 14 Gtk overrides UI template from file connects template callbacks to the correct handler +ok 15 Gtk overrides UI template from file binds template callbacks to the correct object +ok 16 Gtk overrides Class inheriting from template class sets up internal and public template children # SKIP pending +ok 17 Gtk overrides Class inheriting from template class sets up public template children with the correct widgets # SKIP pending +ok 18 Gtk overrides Class inheriting from template class sets up internal template children with the correct widgets # SKIP pending +ok 19 Gtk overrides Class inheriting from template class connects template callbacks to the correct handler # SKIP pending +ok 20 Gtk overrides Class inheriting from template class binds template callbacks to the correct object # SKIP pending +ok 21 Gtk overrides sets CSS names on classes +ok 22 Gtk overrides avoid crashing when GTK vfuncs are called in garbage collection +ok 23 Gtk overrides accepts string in place of GdkAtom +ok 24 Gtk overrides accepts null in place of GdkAtom as GDK_NONE +ok 25 Gtk overrides uses the correct GType for null child properties +ok 26 Gtk overrides can create a Gtk.TreeIter with accessible stamp field diff --git a/test cases/common/206 tap tests/meson.build b/test cases/common/206 tap tests/meson.build new file mode 100644 index 0000000..5221319 --- /dev/null +++ b/test cases/common/206 tap tests/meson.build @@ -0,0 +1,14 @@ +project('test features', 'c') + +tester = executable('tester', 'tester.c') +cat = executable('cat', 'cat.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('partially skipped', tester, args : ['ok 1\nok 2 # skip'], protocol: 'tap') +test('partially skipped (real-world example)', cat, args : [files('issue7515.txt')], protocol: 'tap') +test('skip comment', tester, args : ['ok # Skipped: with a comment'], 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/206 tap tests/tester.c b/test cases/common/206 tap tests/tester.c new file mode 100644 index 0000000..ac582e7 --- /dev/null +++ b/test cases/common/206 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/207 tap tests/cat.c b/test cases/common/207 tap tests/cat.c deleted file mode 100644 index 4b92010..0000000 --- a/test cases/common/207 tap tests/cat.c +++ /dev/null @@ -1,26 +0,0 @@ -#include -#include - -int main(int argc, char **argv) { - char buf[1024]; - size_t len; - FILE *fh; - - if (argc != 2) { - fprintf(stderr, "Incorrect number of arguments, got %i\n", argc); - return 1; - } - fh = fopen(argv[1], "r"); - if (fh == NULL) { - fprintf(stderr, "Opening %s: errno=%i\n", argv[1], errno); - return 1; - } - do { - len = fread(buf, 1, sizeof(buf), fh); - if (len > 0) { - fwrite(buf, 1, len, stdout); - } - } while (len > 0); - fclose(fh); - return 0; -} diff --git a/test cases/common/207 tap tests/issue7515.txt b/test cases/common/207 tap tests/issue7515.txt deleted file mode 100644 index ca85637..0000000 --- a/test cases/common/207 tap tests/issue7515.txt +++ /dev/null @@ -1,27 +0,0 @@ -1..26 -ok 1 Gtk overrides UI template sets up internal and public template children -ok 2 Gtk overrides UI template sets up public template children with the correct widgets -ok 3 Gtk overrides UI template sets up internal template children with the correct widgets -ok 4 Gtk overrides UI template connects template callbacks to the correct handler -ok 5 Gtk overrides UI template binds template callbacks to the correct object -ok 6 Gtk overrides UI template from resource sets up internal and public template children -ok 7 Gtk overrides UI template from resource sets up public template children with the correct widgets -ok 8 Gtk overrides UI template from resource sets up internal template children with the correct widgets -ok 9 Gtk overrides UI template from resource connects template callbacks to the correct handler -ok 10 Gtk overrides UI template from resource binds template callbacks to the correct object -ok 11 Gtk overrides UI template from file sets up internal and public template children -ok 12 Gtk overrides UI template from file sets up public template children with the correct widgets -ok 13 Gtk overrides UI template from file sets up internal template children with the correct widgets -ok 14 Gtk overrides UI template from file connects template callbacks to the correct handler -ok 15 Gtk overrides UI template from file binds template callbacks to the correct object -ok 16 Gtk overrides Class inheriting from template class sets up internal and public template children # SKIP pending -ok 17 Gtk overrides Class inheriting from template class sets up public template children with the correct widgets # SKIP pending -ok 18 Gtk overrides Class inheriting from template class sets up internal template children with the correct widgets # SKIP pending -ok 19 Gtk overrides Class inheriting from template class connects template callbacks to the correct handler # SKIP pending -ok 20 Gtk overrides Class inheriting from template class binds template callbacks to the correct object # SKIP pending -ok 21 Gtk overrides sets CSS names on classes -ok 22 Gtk overrides avoid crashing when GTK vfuncs are called in garbage collection -ok 23 Gtk overrides accepts string in place of GdkAtom -ok 24 Gtk overrides accepts null in place of GdkAtom as GDK_NONE -ok 25 Gtk overrides uses the correct GType for null child properties -ok 26 Gtk overrides can create a Gtk.TreeIter with accessible stamp field diff --git a/test cases/common/207 tap tests/meson.build b/test cases/common/207 tap tests/meson.build deleted file mode 100644 index 5221319..0000000 --- a/test cases/common/207 tap tests/meson.build +++ /dev/null @@ -1,14 +0,0 @@ -project('test features', 'c') - -tester = executable('tester', 'tester.c') -cat = executable('cat', 'cat.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('partially skipped', tester, args : ['ok 1\nok 2 # skip'], protocol: 'tap') -test('partially skipped (real-world example)', cat, args : [files('issue7515.txt')], protocol: 'tap') -test('skip comment', tester, args : ['ok # Skipped: with a comment'], 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/207 tap tests/tester.c b/test cases/common/207 tap tests/tester.c deleted file mode 100644 index ac582e7..0000000 --- a/test cases/common/207 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/207 warning level 0/main.cpp b/test cases/common/207 warning level 0/main.cpp new file mode 100644 index 0000000..954d9ce --- /dev/null +++ b/test cases/common/207 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/207 warning level 0/meson.build b/test cases/common/207 warning level 0/meson.build new file mode 100644 index 0000000..f2bd339 --- /dev/null +++ b/test cases/common/207 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/208 link custom/custom_stlib.py b/test cases/common/208 link custom/custom_stlib.py new file mode 100755 index 0000000..6a090f3 --- /dev/null +++ b/test cases/common/208 link custom/custom_stlib.py @@ -0,0 +1,81 @@ +#!/usr/bin/env python3 + +import shutil, sys, subprocess, argparse, pathlib +import platform + +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(void) { + printf("Now flobbing.\\n"); +} +''' + +def get_pic_args(): + platname = platform.system().lower() + if platname in ['windows', 'darwin'] or sys.platform == 'cygwin': + return [] + return ['-fPIC'] + +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)] + compile_cmd += get_pic_args() + 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/208 link custom/custom_target.c b/test cases/common/208 link custom/custom_target.c new file mode 100644 index 0000000..1bbe82c --- /dev/null +++ b/test cases/common/208 link custom/custom_target.c @@ -0,0 +1,6 @@ +void outer_lib_func(void); + +int main(void) { + outer_lib_func(); + return 0; +} diff --git a/test cases/common/208 link custom/custom_target.py b/test cases/common/208 link custom/custom_target.py new file mode 100644 index 0000000..c246344 --- /dev/null +++ b/test cases/common/208 link custom/custom_target.py @@ -0,0 +1,6 @@ +#!/usr/bin/env python3 + +import shutil, sys + +if __name__ == '__main__': + shutil.copyfile(sys.argv[1], sys.argv[2]) diff --git a/test cases/common/208 link custom/dummy.c b/test cases/common/208 link custom/dummy.c new file mode 100644 index 0000000..53a4a40 --- /dev/null +++ b/test cases/common/208 link custom/dummy.c @@ -0,0 +1 @@ +void inner_lib_func(void) {} \ No newline at end of file diff --git a/test cases/common/208 link custom/lib.c b/test cases/common/208 link custom/lib.c new file mode 100644 index 0000000..585b6c9 --- /dev/null +++ b/test cases/common/208 link custom/lib.c @@ -0,0 +1,7 @@ +void flob(void); + +int foo(void) +{ + flob(); + return 0; +} diff --git a/test cases/common/208 link custom/meson.build b/test cases/common/208 link custom/meson.build new file mode 100644 index 0000000..4d4f655 --- /dev/null +++ b/test cases/common/208 link custom/meson.build @@ -0,0 +1,86 @@ +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 + +if meson.backend() == 'xcode' + message('Xcode does not support link whole so skipping.') +else + 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) +endif + +# 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 + +if meson.backend() == 'xcode' + message('Xcode does not support link whole so skipping.') +else + shared_library('lib1', 'lib.c', link_whole: clib) + + 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) +endif + +# Link with custom target + +dummy = static_library('dummy', 'dummy.c') + +custom_prog = find_program('custom_target.py') +t = custom_target('custom', input: dummy, output: 'libcustom.a', command: [custom_prog, '@INPUT@', '@OUTPUT@']) + +dep1 = declare_dependency(link_with: t) +dep2 = declare_dependency(link_with: t[0]) + +lib1 = static_library('lib1', 'outerlib.c', dependencies: dep1) +lib2 = static_library('lib2', 'outerlib.c', dependencies: dep2) + +exe1 = executable('exe1', 'custom_target.c', link_with: lib1) +test('custom_target_1', exe1) + +exe1_2 = executable('exe1_2', 'custom_target.c', link_with: lib2) +test('custom_target_2', exe2) \ No newline at end of file diff --git a/test cases/common/208 link custom/outerlib.c b/test cases/common/208 link custom/outerlib.c new file mode 100644 index 0000000..6861f8d --- /dev/null +++ b/test cases/common/208 link custom/outerlib.c @@ -0,0 +1,3 @@ +void inner_lib_func(void); + +void outer_lib_func(void) { inner_lib_func(); } \ No newline at end of file diff --git a/test cases/common/208 link custom/prog.c b/test cases/common/208 link custom/prog.c new file mode 100644 index 0000000..efecbef --- /dev/null +++ b/test cases/common/208 link custom/prog.c @@ -0,0 +1,6 @@ +void flob(void); + +int main(void) { + flob(); + return 0; +} diff --git a/test cases/common/208 warning level 0/main.cpp b/test cases/common/208 warning level 0/main.cpp deleted file mode 100644 index 954d9ce..0000000 --- a/test cases/common/208 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/208 warning level 0/meson.build b/test cases/common/208 warning level 0/meson.build deleted file mode 100644 index f2bd339..0000000 --- a/test cases/common/208 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/209 link custom/custom_stlib.py b/test cases/common/209 link custom/custom_stlib.py deleted file mode 100755 index 6a090f3..0000000 --- a/test cases/common/209 link custom/custom_stlib.py +++ /dev/null @@ -1,81 +0,0 @@ -#!/usr/bin/env python3 - -import shutil, sys, subprocess, argparse, pathlib -import platform - -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(void) { - printf("Now flobbing.\\n"); -} -''' - -def get_pic_args(): - platname = platform.system().lower() - if platname in ['windows', 'darwin'] or sys.platform == 'cygwin': - return [] - return ['-fPIC'] - -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)] - compile_cmd += get_pic_args() - 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/209 link custom/custom_target.c b/test cases/common/209 link custom/custom_target.c deleted file mode 100644 index 1bbe82c..0000000 --- a/test cases/common/209 link custom/custom_target.c +++ /dev/null @@ -1,6 +0,0 @@ -void outer_lib_func(void); - -int main(void) { - outer_lib_func(); - return 0; -} diff --git a/test cases/common/209 link custom/custom_target.py b/test cases/common/209 link custom/custom_target.py deleted file mode 100644 index c246344..0000000 --- a/test cases/common/209 link custom/custom_target.py +++ /dev/null @@ -1,6 +0,0 @@ -#!/usr/bin/env python3 - -import shutil, sys - -if __name__ == '__main__': - shutil.copyfile(sys.argv[1], sys.argv[2]) diff --git a/test cases/common/209 link custom/dummy.c b/test cases/common/209 link custom/dummy.c deleted file mode 100644 index 53a4a40..0000000 --- a/test cases/common/209 link custom/dummy.c +++ /dev/null @@ -1 +0,0 @@ -void inner_lib_func(void) {} \ No newline at end of file diff --git a/test cases/common/209 link custom/lib.c b/test cases/common/209 link custom/lib.c deleted file mode 100644 index 585b6c9..0000000 --- a/test cases/common/209 link custom/lib.c +++ /dev/null @@ -1,7 +0,0 @@ -void flob(void); - -int foo(void) -{ - flob(); - return 0; -} diff --git a/test cases/common/209 link custom/meson.build b/test cases/common/209 link custom/meson.build deleted file mode 100644 index 4d4f655..0000000 --- a/test cases/common/209 link custom/meson.build +++ /dev/null @@ -1,86 +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 - -if meson.backend() == 'xcode' - message('Xcode does not support link whole so skipping.') -else - 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) -endif - -# 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 - -if meson.backend() == 'xcode' - message('Xcode does not support link whole so skipping.') -else - shared_library('lib1', 'lib.c', link_whole: clib) - - 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) -endif - -# Link with custom target - -dummy = static_library('dummy', 'dummy.c') - -custom_prog = find_program('custom_target.py') -t = custom_target('custom', input: dummy, output: 'libcustom.a', command: [custom_prog, '@INPUT@', '@OUTPUT@']) - -dep1 = declare_dependency(link_with: t) -dep2 = declare_dependency(link_with: t[0]) - -lib1 = static_library('lib1', 'outerlib.c', dependencies: dep1) -lib2 = static_library('lib2', 'outerlib.c', dependencies: dep2) - -exe1 = executable('exe1', 'custom_target.c', link_with: lib1) -test('custom_target_1', exe1) - -exe1_2 = executable('exe1_2', 'custom_target.c', link_with: lib2) -test('custom_target_2', exe2) \ No newline at end of file diff --git a/test cases/common/209 link custom/outerlib.c b/test cases/common/209 link custom/outerlib.c deleted file mode 100644 index 6861f8d..0000000 --- a/test cases/common/209 link custom/outerlib.c +++ /dev/null @@ -1,3 +0,0 @@ -void inner_lib_func(void); - -void outer_lib_func(void) { inner_lib_func(); } \ No newline at end of file diff --git a/test cases/common/209 link custom/prog.c b/test cases/common/209 link custom/prog.c deleted file mode 100644 index efecbef..0000000 --- a/test cases/common/209 link custom/prog.c +++ /dev/null @@ -1,6 +0,0 @@ -void flob(void); - -int main(void) { - flob(); - return 0; -} diff --git a/test cases/common/209 link custom_i single from multiple/generate_conflicting_stlibs.py b/test cases/common/209 link custom_i single from multiple/generate_conflicting_stlibs.py new file mode 100644 index 0000000..42d6631 --- /dev/null +++ b/test cases/common/209 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/209 link custom_i single from multiple/meson.build b/test cases/common/209 link custom_i single from multiple/meson.build new file mode 100644 index 0000000..7aadb17 --- /dev/null +++ b/test cases/common/209 link custom_i single from multiple/meson.build @@ -0,0 +1,42 @@ +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 + +if meson.backend() == 'xcode' + message('Xcode does not support link whole so skipping.') + subdir_done() +endif + +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/209 link custom_i single from multiple/prog.c b/test cases/common/209 link custom_i single from multiple/prog.c new file mode 100644 index 0000000..040672a --- /dev/null +++ b/test cases/common/209 link custom_i single from multiple/prog.c @@ -0,0 +1,5 @@ +int flob(void); + +int main(void) { + return (flob() == 1 ? 0 : 1); +} diff --git a/test cases/common/21 global arg/meson.build b/test cases/common/21 global arg/meson.build deleted file mode 100644 index 2a1c736..0000000 --- a/test cases/common/21 global arg/meson.build +++ /dev/null @@ -1,16 +0,0 @@ -project('global arg test', 'cpp', 'c') - -add_global_arguments('-DMYTHING', language : 'c') -add_global_arguments('-DMYCPPTHING', language : 'cpp') -add_global_arguments('-DGLOBAL_HOST', language : 'c') - -build_c_args = ['-DARG_BUILD'] -c_args = ['-DARG_HOST'] - -add_global_arguments('-DMYCANDCPPTHING', language: ['c', 'cpp']) - -exe2 = executable('prog2', 'prog.c', c_args : c_args) -exe3 = executable('prog3', 'prog.cc') - -test('prog2', exe2) -test('prog3', exe3) diff --git a/test cases/common/21 global arg/prog.c b/test cases/common/21 global arg/prog.c deleted file mode 100644 index 2a71236..0000000 --- a/test cases/common/21 global arg/prog.c +++ /dev/null @@ -1,43 +0,0 @@ -#ifndef MYTHING - #error "Global argument not set" -#endif - -#ifdef MYCPPTHING - #error "Wrong global argument set" -#endif - -#ifndef MYCANDCPPTHING - #error "Global argument not set" -#endif - -#if !defined(GLOBAL_HOST) && !defined(GLOBAL_BUILD) - #error "Neither global_host nor glogal_build is set." -#endif - -#if defined(GLOBAL_HOST) && defined(GLOBAL_BUILD) - #error "Both global build and global host set." -#endif - -#ifdef GLOBAL_BUILD - #ifndef ARG_BUILD - #error "Global is build but arg_build is not set." - #endif - - #ifdef ARG_HOST - #error "Global is build but arg host is set." - #endif -#endif - -#ifdef GLOBAL_HOST - #ifndef ARG_HOST - #error "Global is host but arg_host is not set." - #endif - - #ifdef ARG_BUILD - #error "Global is host but arg_build is set." - #endif -#endif - -int main(void) { - return 0; -} diff --git a/test cases/common/21 global arg/prog.cc b/test cases/common/21 global arg/prog.cc deleted file mode 100644 index 5c32209..0000000 --- a/test cases/common/21 global arg/prog.cc +++ /dev/null @@ -1,15 +0,0 @@ -#ifdef MYTHING -#error "Wrong global argument set" -#endif - -#ifndef MYCPPTHING -#error "Global argument not set" -#endif - -#ifndef MYCANDCPPTHING -#error "Global argument not set" -#endif - -int main(void) { - return 0; -} diff --git a/test cases/common/21 target arg/func.c b/test cases/common/21 target arg/func.c new file mode 100644 index 0000000..8c0659e --- /dev/null +++ b/test cases/common/21 target arg/func.c @@ -0,0 +1,9 @@ +#ifndef CTHING +#error "Local argument not set" +#endif + +#ifdef CPPTHING +#error "Wrong local argument set" +#endif + +int func(void) { return 0; } diff --git a/test cases/common/21 target arg/func2.c b/test cases/common/21 target arg/func2.c new file mode 100644 index 0000000..1897cf7 --- /dev/null +++ b/test cases/common/21 target arg/func2.c @@ -0,0 +1,9 @@ +#ifdef CTHING +#error "Local C argument set in wrong target" +#endif + +#ifdef CPPTHING +#error "Local CPP argument set in wrong target" +#endif + +int func(void) { return 0; } diff --git a/test cases/common/21 target arg/meson.build b/test cases/common/21 target arg/meson.build new file mode 100644 index 0000000..11ac006 --- /dev/null +++ b/test cases/common/21 target arg/meson.build @@ -0,0 +1,9 @@ +project('local arg test', 'cpp', 'c') + +exe1 = executable('prog', 'prog.cc', 'func.c', \ +c_args : '-DCTHING', \ +cpp_args : '-DCPPTHING') +exe2 = executable('prog2', 'prog2.cc', 'func2.c') + +test('prog1', exe1) +test('prog2', exe2) diff --git a/test cases/common/21 target arg/prog.cc b/test cases/common/21 target arg/prog.cc new file mode 100644 index 0000000..23028af --- /dev/null +++ b/test cases/common/21 target arg/prog.cc @@ -0,0 +1,13 @@ +#ifdef CTHING +#error "Wrong local argument set" +#endif + +#ifndef CPPTHING +#error "Local argument not set" +#endif + +extern "C" int func(); + +int main(void) { + return func(); +} diff --git a/test cases/common/21 target arg/prog2.cc b/test cases/common/21 target arg/prog2.cc new file mode 100644 index 0000000..e2ffe62 --- /dev/null +++ b/test cases/common/21 target arg/prog2.cc @@ -0,0 +1,13 @@ +#ifdef CTHING +#error "Local C argument set in wrong target" +#endif + +#ifdef CPPTHING +#error "Local CPP argument set in wrong target" +#endif + +extern "C" int func(); + +int main(void) { + return func(); +} diff --git a/test cases/common/210 link custom_i multiple from multiple/generate_stlibs.py b/test cases/common/210 link custom_i multiple from multiple/generate_stlibs.py new file mode 100644 index 0000000..5292006 --- /dev/null +++ b/test cases/common/210 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/210 link custom_i multiple from multiple/meson.build b/test cases/common/210 link custom_i multiple from multiple/meson.build new file mode 100644 index 0000000..ede059e --- /dev/null +++ b/test cases/common/210 link custom_i multiple from multiple/meson.build @@ -0,0 +1,42 @@ +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 + +if meson.backend() == 'xcode' + message('Xcode does not support link whole so skipping.') + subdir_done() +endif + +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/210 link custom_i multiple from multiple/prog.c b/test cases/common/210 link custom_i multiple from multiple/prog.c new file mode 100644 index 0000000..7b0c5cf --- /dev/null +++ b/test cases/common/210 link custom_i multiple from multiple/prog.c @@ -0,0 +1,8 @@ +void flob_1(void); +void flob_2(void); + +int main(void) { + flob_1(); + flob_2(); + return 0; +} diff --git a/test cases/common/210 link custom_i single from multiple/generate_conflicting_stlibs.py b/test cases/common/210 link custom_i single from multiple/generate_conflicting_stlibs.py deleted file mode 100644 index 42d6631..0000000 --- a/test cases/common/210 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/210 link custom_i single from multiple/meson.build b/test cases/common/210 link custom_i single from multiple/meson.build deleted file mode 100644 index 7aadb17..0000000 --- a/test cases/common/210 link custom_i single from multiple/meson.build +++ /dev/null @@ -1,42 +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 - -if meson.backend() == 'xcode' - message('Xcode does not support link whole so skipping.') - subdir_done() -endif - -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/210 link custom_i single from multiple/prog.c b/test cases/common/210 link custom_i single from multiple/prog.c deleted file mode 100644 index 040672a..0000000 --- a/test cases/common/210 link custom_i single from multiple/prog.c +++ /dev/null @@ -1,5 +0,0 @@ -int flob(void); - -int main(void) { - return (flob() == 1 ? 0 : 1); -} diff --git a/test cases/common/211 dependency get_variable method/meson.build b/test cases/common/211 dependency get_variable method/meson.build new file mode 100644 index 0000000..384b3f3 --- /dev/null +++ b/test cases/common/211 dependency get_variable method/meson.build @@ -0,0 +1,66 @@ +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 available 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 didn\'t get default when we should have.') + assert(dep.get_variable(pkgconfig : 'prefix', default_value : default) != default, + 'pkg-config got default when we shouldn\'t 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 didn\'t get default when we should have.') + assert(dep_ct.get_variable(configtool : 'has-rtti', default_value : default) != default, + 'config-tool got default when we shouldn\'t 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 didn\'t 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 shouldn\'t have.') +endif + +idep = declare_dependency(variables : {'foo' : 'value'}) +assert(idep.get_variable(pkgconfig : 'foo', cmake : 'foo', configtool : 'foo', + internal : 'foo', default_value : default) == 'value', + 'internal got default when it shouldn\'t have.') +assert(idep.get_variable(pkgconfig : 'foo', cmake : 'foo', configtool : 'foo', + internal : 'bar', default_value : default) == default, + 'internal didn\'t default when it should have.') + +idep = declare_dependency() +assert(idep.get_variable(pkgconfig : 'foo', cmake : 'foo', configtool : 'foo', + default_value : default) == default, + 'something went wrong with an InternalDependency with no variables.') + +idep = declare_dependency(variables : ['foo=value']) +assert(idep.get_variable(internal: 'foo') == 'value') +assert(idep.get_variable('foo') == 'value') +assert(idep.get_variable('invalid', internal: 'foo') == 'value') diff --git a/test cases/common/211 link custom_i multiple from multiple/generate_stlibs.py b/test cases/common/211 link custom_i multiple from multiple/generate_stlibs.py deleted file mode 100644 index 5292006..0000000 --- a/test cases/common/211 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/211 link custom_i multiple from multiple/meson.build b/test cases/common/211 link custom_i multiple from multiple/meson.build deleted file mode 100644 index ede059e..0000000 --- a/test cases/common/211 link custom_i multiple from multiple/meson.build +++ /dev/null @@ -1,42 +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 - -if meson.backend() == 'xcode' - message('Xcode does not support link whole so skipping.') - subdir_done() -endif - -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/211 link custom_i multiple from multiple/prog.c b/test cases/common/211 link custom_i multiple from multiple/prog.c deleted file mode 100644 index 7b0c5cf..0000000 --- a/test cases/common/211 link custom_i multiple from multiple/prog.c +++ /dev/null @@ -1,8 +0,0 @@ -void flob_1(void); -void flob_2(void); - -int main(void) { - flob_1(); - flob_2(); - return 0; -} diff --git a/test cases/common/212 dependency get_variable method/meson.build b/test cases/common/212 dependency get_variable method/meson.build deleted file mode 100644 index 384b3f3..0000000 --- a/test cases/common/212 dependency get_variable method/meson.build +++ /dev/null @@ -1,66 +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 available 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 didn\'t get default when we should have.') - assert(dep.get_variable(pkgconfig : 'prefix', default_value : default) != default, - 'pkg-config got default when we shouldn\'t 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 didn\'t get default when we should have.') - assert(dep_ct.get_variable(configtool : 'has-rtti', default_value : default) != default, - 'config-tool got default when we shouldn\'t 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 didn\'t 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 shouldn\'t have.') -endif - -idep = declare_dependency(variables : {'foo' : 'value'}) -assert(idep.get_variable(pkgconfig : 'foo', cmake : 'foo', configtool : 'foo', - internal : 'foo', default_value : default) == 'value', - 'internal got default when it shouldn\'t have.') -assert(idep.get_variable(pkgconfig : 'foo', cmake : 'foo', configtool : 'foo', - internal : 'bar', default_value : default) == default, - 'internal didn\'t default when it should have.') - -idep = declare_dependency() -assert(idep.get_variable(pkgconfig : 'foo', cmake : 'foo', configtool : 'foo', - default_value : default) == default, - 'something went wrong with an InternalDependency with no variables.') - -idep = declare_dependency(variables : ['foo=value']) -assert(idep.get_variable(internal: 'foo') == 'value') -assert(idep.get_variable('foo') == 'value') -assert(idep.get_variable('invalid', internal: 'foo') == 'value') diff --git a/test cases/common/212 source set configuration_data/a.c b/test cases/common/212 source set configuration_data/a.c new file mode 100644 index 0000000..0570dff --- /dev/null +++ b/test cases/common/212 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/212 source set configuration_data/all.h b/test cases/common/212 source set configuration_data/all.h new file mode 100644 index 0000000..e3547df --- /dev/null +++ b/test cases/common/212 source set configuration_data/all.h @@ -0,0 +1,9 @@ +extern void f(void); +extern void g(void); +extern void h(void); +extern void undefined(void); + +/* Defined in nope.c and f.c, + * value depends on the source set and configuration used. + */ +extern void (*p)(void); diff --git a/test cases/common/212 source set configuration_data/f.c b/test cases/common/212 source set configuration_data/f.c new file mode 100644 index 0000000..33d2f18 --- /dev/null +++ b/test cases/common/212 source set configuration_data/f.c @@ -0,0 +1,7 @@ +#include "all.h" + +void (*p)(void) = (void *)0x12AB34CD; + +void f(void) +{ +} diff --git a/test cases/common/212 source set configuration_data/g.c b/test cases/common/212 source set configuration_data/g.c new file mode 100644 index 0000000..4a6f253 --- /dev/null +++ b/test cases/common/212 source set configuration_data/g.c @@ -0,0 +1,6 @@ +#include "all.h" + +void g(void) +{ + h(); +} diff --git a/test cases/common/212 source set configuration_data/meson.build b/test cases/common/212 source set configuration_data/meson.build new file mode 100644 index 0000000..104f39d --- /dev/null +++ b/test cases/common/212 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/212 source set configuration_data/nope.c b/test cases/common/212 source set configuration_data/nope.c new file mode 100644 index 0000000..0ce1d3b --- /dev/null +++ b/test cases/common/212 source set configuration_data/nope.c @@ -0,0 +1,3 @@ +#include "all.h" + +void (*p)(void) = undefined; diff --git a/test cases/common/212 source set configuration_data/subdir/b.c b/test cases/common/212 source set configuration_data/subdir/b.c new file mode 100644 index 0000000..31c3789 --- /dev/null +++ b/test cases/common/212 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/212 source set configuration_data/subdir/meson.build b/test cases/common/212 source set configuration_data/subdir/meson.build new file mode 100644 index 0000000..b497de5 --- /dev/null +++ b/test cases/common/212 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/213 source set configuration_data/a.c b/test cases/common/213 source set configuration_data/a.c deleted file mode 100644 index 0570dff..0000000 --- a/test cases/common/213 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/213 source set configuration_data/all.h b/test cases/common/213 source set configuration_data/all.h deleted file mode 100644 index e3547df..0000000 --- a/test cases/common/213 source set configuration_data/all.h +++ /dev/null @@ -1,9 +0,0 @@ -extern void f(void); -extern void g(void); -extern void h(void); -extern void undefined(void); - -/* Defined in nope.c and f.c, - * value depends on the source set and configuration used. - */ -extern void (*p)(void); diff --git a/test cases/common/213 source set configuration_data/f.c b/test cases/common/213 source set configuration_data/f.c deleted file mode 100644 index 33d2f18..0000000 --- a/test cases/common/213 source set configuration_data/f.c +++ /dev/null @@ -1,7 +0,0 @@ -#include "all.h" - -void (*p)(void) = (void *)0x12AB34CD; - -void f(void) -{ -} diff --git a/test cases/common/213 source set configuration_data/g.c b/test cases/common/213 source set configuration_data/g.c deleted file mode 100644 index 4a6f253..0000000 --- a/test cases/common/213 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/213 source set configuration_data/meson.build b/test cases/common/213 source set configuration_data/meson.build deleted file mode 100644 index 104f39d..0000000 --- a/test cases/common/213 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/213 source set configuration_data/nope.c b/test cases/common/213 source set configuration_data/nope.c deleted file mode 100644 index 0ce1d3b..0000000 --- a/test cases/common/213 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/213 source set configuration_data/subdir/b.c b/test cases/common/213 source set configuration_data/subdir/b.c deleted file mode 100644 index 31c3789..0000000 --- a/test cases/common/213 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/213 source set configuration_data/subdir/meson.build b/test cases/common/213 source set configuration_data/subdir/meson.build deleted file mode 100644 index b497de5..0000000 --- a/test cases/common/213 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/213 source set dictionary/a.c b/test cases/common/213 source set dictionary/a.c new file mode 100644 index 0000000..0570dff --- /dev/null +++ b/test cases/common/213 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/213 source set dictionary/all.h b/test cases/common/213 source set dictionary/all.h new file mode 100644 index 0000000..e3547df --- /dev/null +++ b/test cases/common/213 source set dictionary/all.h @@ -0,0 +1,9 @@ +extern void f(void); +extern void g(void); +extern void h(void); +extern void undefined(void); + +/* Defined in nope.c and f.c, + * value depends on the source set and configuration used. + */ +extern void (*p)(void); diff --git a/test cases/common/213 source set dictionary/f.c b/test cases/common/213 source set dictionary/f.c new file mode 100644 index 0000000..9c5bb1c --- /dev/null +++ b/test cases/common/213 source set dictionary/f.c @@ -0,0 +1,7 @@ +#include "all.h" + +void (*p)(void) = (void *)0x1234ABCD; + +void f(void) +{ +} diff --git a/test cases/common/213 source set dictionary/g.c b/test cases/common/213 source set dictionary/g.c new file mode 100644 index 0000000..4a6f253 --- /dev/null +++ b/test cases/common/213 source set dictionary/g.c @@ -0,0 +1,6 @@ +#include "all.h" + +void g(void) +{ + h(); +} diff --git a/test cases/common/213 source set dictionary/meson.build b/test cases/common/213 source set dictionary/meson.build new file mode 100644 index 0000000..9a34507 --- /dev/null +++ b/test cases/common/213 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/213 source set dictionary/nope.c b/test cases/common/213 source set dictionary/nope.c new file mode 100644 index 0000000..0ce1d3b --- /dev/null +++ b/test cases/common/213 source set dictionary/nope.c @@ -0,0 +1,3 @@ +#include "all.h" + +void (*p)(void) = undefined; diff --git a/test cases/common/213 source set dictionary/subdir/b.c b/test cases/common/213 source set dictionary/subdir/b.c new file mode 100644 index 0000000..31c3789 --- /dev/null +++ b/test cases/common/213 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/213 source set dictionary/subdir/meson.build b/test cases/common/213 source set dictionary/subdir/meson.build new file mode 100644 index 0000000..b497de5 --- /dev/null +++ b/test cases/common/213 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/214 source set custom target/a.c b/test cases/common/214 source set custom target/a.c new file mode 100644 index 0000000..39a3b6b --- /dev/null +++ b/test cases/common/214 source set custom target/a.c @@ -0,0 +1,7 @@ +#include "all.h" + +int main(void) +{ + f(); + g(); +} diff --git a/test cases/common/214 source set custom target/all.h b/test cases/common/214 source set custom target/all.h new file mode 100644 index 0000000..5885e32 --- /dev/null +++ b/test cases/common/214 source set custom target/all.h @@ -0,0 +1,2 @@ +extern void f(void); +extern void g(void); diff --git a/test cases/common/214 source set custom target/cp.py b/test cases/common/214 source set custom target/cp.py new file mode 100644 index 0000000..cb09cf3 --- /dev/null +++ b/test cases/common/214 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/214 source set custom target/f.c b/test cases/common/214 source set custom target/f.c new file mode 100644 index 0000000..a50ecda --- /dev/null +++ b/test cases/common/214 source set custom target/f.c @@ -0,0 +1,5 @@ +#include "all.h" + +void f(void) +{ +} diff --git a/test cases/common/214 source set custom target/g.c b/test cases/common/214 source set custom target/g.c new file mode 100644 index 0000000..7098584 --- /dev/null +++ b/test cases/common/214 source set custom target/g.c @@ -0,0 +1,5 @@ +#include "all.h" + +void g(void) +{ +} diff --git a/test cases/common/214 source set custom target/meson.build b/test cases/common/214 source set custom target/meson.build new file mode 100644 index 0000000..fe6e6e1 --- /dev/null +++ b/test cases/common/214 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/214 source set dictionary/a.c b/test cases/common/214 source set dictionary/a.c deleted file mode 100644 index 0570dff..0000000 --- a/test cases/common/214 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/214 source set dictionary/all.h b/test cases/common/214 source set dictionary/all.h deleted file mode 100644 index e3547df..0000000 --- a/test cases/common/214 source set dictionary/all.h +++ /dev/null @@ -1,9 +0,0 @@ -extern void f(void); -extern void g(void); -extern void h(void); -extern void undefined(void); - -/* Defined in nope.c and f.c, - * value depends on the source set and configuration used. - */ -extern void (*p)(void); diff --git a/test cases/common/214 source set dictionary/f.c b/test cases/common/214 source set dictionary/f.c deleted file mode 100644 index 9c5bb1c..0000000 --- a/test cases/common/214 source set dictionary/f.c +++ /dev/null @@ -1,7 +0,0 @@ -#include "all.h" - -void (*p)(void) = (void *)0x1234ABCD; - -void f(void) -{ -} diff --git a/test cases/common/214 source set dictionary/g.c b/test cases/common/214 source set dictionary/g.c deleted file mode 100644 index 4a6f253..0000000 --- a/test cases/common/214 source set dictionary/g.c +++ /dev/null @@ -1,6 +0,0 @@ -#include "all.h" - -void g(void) -{ - h(); -} diff --git a/test cases/common/214 source set dictionary/meson.build b/test cases/common/214 source set dictionary/meson.build deleted file mode 100644 index 9a34507..0000000 --- a/test cases/common/214 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/214 source set dictionary/nope.c b/test cases/common/214 source set dictionary/nope.c deleted file mode 100644 index 0ce1d3b..0000000 --- a/test cases/common/214 source set dictionary/nope.c +++ /dev/null @@ -1,3 +0,0 @@ -#include "all.h" - -void (*p)(void) = undefined; diff --git a/test cases/common/214 source set dictionary/subdir/b.c b/test cases/common/214 source set dictionary/subdir/b.c deleted file mode 100644 index 31c3789..0000000 --- a/test cases/common/214 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/214 source set dictionary/subdir/meson.build b/test cases/common/214 source set dictionary/subdir/meson.build deleted file mode 100644 index b497de5..0000000 --- a/test cases/common/214 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/215 source set custom target/a.c b/test cases/common/215 source set custom target/a.c deleted file mode 100644 index 39a3b6b..0000000 --- a/test cases/common/215 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/215 source set custom target/all.h b/test cases/common/215 source set custom target/all.h deleted file mode 100644 index 5885e32..0000000 --- a/test cases/common/215 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/215 source set custom target/cp.py b/test cases/common/215 source set custom target/cp.py deleted file mode 100644 index cb09cf3..0000000 --- a/test cases/common/215 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/215 source set custom target/f.c b/test cases/common/215 source set custom target/f.c deleted file mode 100644 index a50ecda..0000000 --- a/test cases/common/215 source set custom target/f.c +++ /dev/null @@ -1,5 +0,0 @@ -#include "all.h" - -void f(void) -{ -} diff --git a/test cases/common/215 source set custom target/g.c b/test cases/common/215 source set custom target/g.c deleted file mode 100644 index 7098584..0000000 --- a/test cases/common/215 source set custom target/g.c +++ /dev/null @@ -1,5 +0,0 @@ -#include "all.h" - -void g(void) -{ -} diff --git a/test cases/common/215 source set custom target/meson.build b/test cases/common/215 source set custom target/meson.build deleted file mode 100644 index fe6e6e1..0000000 --- a/test cases/common/215 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/215 source set realistic example/boards/arm/aarch64.cc b/test cases/common/215 source set realistic example/boards/arm/aarch64.cc new file mode 100644 index 0000000..386c771 --- /dev/null +++ b/test cases/common/215 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/215 source set realistic example/boards/arm/arm.cc b/test cases/common/215 source set realistic example/boards/arm/arm.cc new file mode 100644 index 0000000..b463ebe --- /dev/null +++ b/test cases/common/215 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/215 source set realistic example/boards/arm/arm.h b/test cases/common/215 source set realistic example/boards/arm/arm.h new file mode 100644 index 0000000..4dd6b69 --- /dev/null +++ b/test cases/common/215 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/215 source set realistic example/boards/arm/arm32.cc b/test cases/common/215 source set realistic example/boards/arm/arm32.cc new file mode 100644 index 0000000..72a2427 --- /dev/null +++ b/test cases/common/215 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/215 source set realistic example/boards/arm/versatilepb.cc b/test cases/common/215 source set realistic example/boards/arm/versatilepb.cc new file mode 100644 index 0000000..3d1a9fe --- /dev/null +++ b/test cases/common/215 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/215 source set realistic example/boards/arm/virt.cc b/test cases/common/215 source set realistic example/boards/arm/virt.cc new file mode 100644 index 0000000..6f9a1ca --- /dev/null +++ b/test cases/common/215 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/215 source set realistic example/boards/arm/xlnx_zcu102.cc b/test cases/common/215 source set realistic example/boards/arm/xlnx_zcu102.cc new file mode 100644 index 0000000..8921e00 --- /dev/null +++ b/test cases/common/215 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/215 source set realistic example/boards/meson.build b/test cases/common/215 source set realistic example/boards/meson.build new file mode 100644 index 0000000..41ead4c --- /dev/null +++ b/test cases/common/215 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/215 source set realistic example/boards/x86/pc.cc b/test cases/common/215 source set realistic example/boards/x86/pc.cc new file mode 100644 index 0000000..04ec392 --- /dev/null +++ b/test cases/common/215 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/215 source set realistic example/common.h b/test cases/common/215 source set realistic example/common.h new file mode 100644 index 0000000..6e325c7 --- /dev/null +++ b/test cases/common/215 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/215 source set realistic example/config/aarch64 b/test cases/common/215 source set realistic example/config/aarch64 new file mode 100644 index 0000000..55b90eb --- /dev/null +++ b/test cases/common/215 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/215 source set realistic example/config/arm b/test cases/common/215 source set realistic example/config/arm new file mode 100644 index 0000000..d3f7ac7 --- /dev/null +++ b/test cases/common/215 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/215 source set realistic example/config/x86 b/test cases/common/215 source set realistic example/config/x86 new file mode 100644 index 0000000..6caa3e2 --- /dev/null +++ b/test cases/common/215 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/215 source set realistic example/devices/meson.build b/test cases/common/215 source set realistic example/devices/meson.build new file mode 100644 index 0000000..68ee68e --- /dev/null +++ b/test cases/common/215 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/215 source set realistic example/devices/virtio-mmio.cc b/test cases/common/215 source set realistic example/devices/virtio-mmio.cc new file mode 100644 index 0000000..5dab97e --- /dev/null +++ b/test cases/common/215 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/215 source set realistic example/devices/virtio-pci.cc b/test cases/common/215 source set realistic example/devices/virtio-pci.cc new file mode 100644 index 0000000..7df7a82 --- /dev/null +++ b/test cases/common/215 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/215 source set realistic example/devices/virtio.cc b/test cases/common/215 source set realistic example/devices/virtio.cc new file mode 100644 index 0000000..fc51275 --- /dev/null +++ b/test cases/common/215 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/215 source set realistic example/devices/virtio.h b/test cases/common/215 source set realistic example/devices/virtio.h new file mode 100644 index 0000000..a157731 --- /dev/null +++ b/test cases/common/215 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/215 source set realistic example/main.cc b/test cases/common/215 source set realistic example/main.cc new file mode 100644 index 0000000..2b55217 --- /dev/null +++ b/test cases/common/215 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(void) +{ + 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/215 source set realistic example/meson.build b/test cases/common/215 source set realistic example/meson.build new file mode 100644 index 0000000..d986b99 --- /dev/null +++ b/test cases/common/215 source set realistic example/meson.build @@ -0,0 +1,52 @@ +# a sort-of realistic example that combines the sourceset and keyval +# modules, inspired by QEMU's build system + +project('sourceset-example', 'cpp', default_options: ['cpp_std=c++11']) + +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') +keyval = import('keyval') + +zlib = declare_dependency(compile_args: '-DZLIB=1') +another = declare_dependency(compile_args: '-DANOTHER=1') +not_found = dependency('not-found', required: false) + +common = ss.source_set() +specific = ss.source_set() + +common.add(files('main.cc')) +common.add(when: [zlib, another], 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(), + dependencies: common.all_dependencies()) + +targets = [ 'arm', 'aarch64', 'x86' ] +target_dirs = { 'arm' : 'arm', 'aarch64' : 'arm', 'x86': 'x86' } + +foreach x : targets + config = keyval.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/215 source set realistic example/not-found.cc b/test cases/common/215 source set realistic example/not-found.cc new file mode 100644 index 0000000..955a7a2 --- /dev/null +++ b/test cases/common/215 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/215 source set realistic example/was-found.cc b/test cases/common/215 source set realistic example/was-found.cc new file mode 100644 index 0000000..f1eaf1e --- /dev/null +++ b/test cases/common/215 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/215 source set realistic example/zlib.cc b/test cases/common/215 source set realistic example/zlib.cc new file mode 100644 index 0000000..434e0b7 --- /dev/null +++ b/test cases/common/215 source set realistic example/zlib.cc @@ -0,0 +1,15 @@ +#include +#include "common.h" + +struct ZLibDependency : Dependency { + void initialize(); +}; + +void ZLibDependency::initialize() { + if (ZLIB && ANOTHER) { + std::cout << ANSI_START << "hello from zlib" + << ANSI_END << std::endl; + } +} + +ZLibDependency zlib; diff --git a/test cases/common/216 custom target input extracted objects/check_object.py b/test cases/common/216 custom target input extracted objects/check_object.py new file mode 100644 index 0000000..bafcf2c --- /dev/null +++ b/test cases/common/216 custom target input extracted objects/check_object.py @@ -0,0 +1,13 @@ +#!/usr/bin/env python3 + +import sys, os + +if __name__ == '__main__': + if len(sys.argv) != 3: + print(sys.argv[0], 'object', 'output') + sys.exit(1) + elif os.path.exists(sys.argv[1]): + with open(sys.argv[2], 'wb') as out: + pass + else: + sys.exit(1) diff --git a/test cases/common/216 custom target input extracted objects/libdir/meson.build b/test cases/common/216 custom target input extracted objects/libdir/meson.build new file mode 100644 index 0000000..7f83311 --- /dev/null +++ b/test cases/common/216 custom target input extracted objects/libdir/meson.build @@ -0,0 +1 @@ +objlib = static_library('object', 'source.c', override_options : ['unity=off']) diff --git a/test cases/common/216 custom target input extracted objects/libdir/source.c b/test cases/common/216 custom target input extracted objects/libdir/source.c new file mode 100644 index 0000000..1dc08e1 --- /dev/null +++ b/test cases/common/216 custom target input extracted objects/libdir/source.c @@ -0,0 +1,3 @@ +int func1_in_obj(void) { + return 0; +} diff --git a/test cases/common/216 custom target input extracted objects/meson.build b/test cases/common/216 custom target input extracted objects/meson.build new file mode 100644 index 0000000..8f8b22f --- /dev/null +++ b/test cases/common/216 custom target input extracted objects/meson.build @@ -0,0 +1,18 @@ +project('custom target input extracted objects', 'c') + +if meson.backend() == 'xcode' + error('MESON_SKIP_TEST: sometimes Xcode puts object files in weird paths and we can not extract them.') +endif + + +checker = find_program('check_object.py') + +cc = meson.get_compiler('c').cmd_array().get(-1) + +subdir('libdir') + +custom_target('check', + input: objlib.extract_objects('source.c'), + output: 'objcheck', + command: [checker, '@INPUT@', '@OUTPUT@'], + build_by_default: true) diff --git a/test cases/common/216 source set realistic example/boards/arm/aarch64.cc b/test cases/common/216 source set realistic example/boards/arm/aarch64.cc deleted file mode 100644 index 386c771..0000000 --- a/test cases/common/216 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/216 source set realistic example/boards/arm/arm.cc b/test cases/common/216 source set realistic example/boards/arm/arm.cc deleted file mode 100644 index b463ebe..0000000 --- a/test cases/common/216 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/216 source set realistic example/boards/arm/arm.h b/test cases/common/216 source set realistic example/boards/arm/arm.h deleted file mode 100644 index 4dd6b69..0000000 --- a/test cases/common/216 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/216 source set realistic example/boards/arm/arm32.cc b/test cases/common/216 source set realistic example/boards/arm/arm32.cc deleted file mode 100644 index 72a2427..0000000 --- a/test cases/common/216 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/216 source set realistic example/boards/arm/versatilepb.cc b/test cases/common/216 source set realistic example/boards/arm/versatilepb.cc deleted file mode 100644 index 3d1a9fe..0000000 --- a/test cases/common/216 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/216 source set realistic example/boards/arm/virt.cc b/test cases/common/216 source set realistic example/boards/arm/virt.cc deleted file mode 100644 index 6f9a1ca..0000000 --- a/test cases/common/216 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/216 source set realistic example/boards/arm/xlnx_zcu102.cc b/test cases/common/216 source set realistic example/boards/arm/xlnx_zcu102.cc deleted file mode 100644 index 8921e00..0000000 --- a/test cases/common/216 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/216 source set realistic example/boards/meson.build b/test cases/common/216 source set realistic example/boards/meson.build deleted file mode 100644 index 41ead4c..0000000 --- a/test cases/common/216 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/216 source set realistic example/boards/x86/pc.cc b/test cases/common/216 source set realistic example/boards/x86/pc.cc deleted file mode 100644 index 04ec392..0000000 --- a/test cases/common/216 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/216 source set realistic example/common.h b/test cases/common/216 source set realistic example/common.h deleted file mode 100644 index 6e325c7..0000000 --- a/test cases/common/216 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/216 source set realistic example/config/aarch64 b/test cases/common/216 source set realistic example/config/aarch64 deleted file mode 100644 index 55b90eb..0000000 --- a/test cases/common/216 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/216 source set realistic example/config/arm b/test cases/common/216 source set realistic example/config/arm deleted file mode 100644 index d3f7ac7..0000000 --- a/test cases/common/216 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/216 source set realistic example/config/x86 b/test cases/common/216 source set realistic example/config/x86 deleted file mode 100644 index 6caa3e2..0000000 --- a/test cases/common/216 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/216 source set realistic example/devices/meson.build b/test cases/common/216 source set realistic example/devices/meson.build deleted file mode 100644 index 68ee68e..0000000 --- a/test cases/common/216 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/216 source set realistic example/devices/virtio-mmio.cc b/test cases/common/216 source set realistic example/devices/virtio-mmio.cc deleted file mode 100644 index 5dab97e..0000000 --- a/test cases/common/216 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/216 source set realistic example/devices/virtio-pci.cc b/test cases/common/216 source set realistic example/devices/virtio-pci.cc deleted file mode 100644 index 7df7a82..0000000 --- a/test cases/common/216 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/216 source set realistic example/devices/virtio.cc b/test cases/common/216 source set realistic example/devices/virtio.cc deleted file mode 100644 index fc51275..0000000 --- a/test cases/common/216 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/216 source set realistic example/devices/virtio.h b/test cases/common/216 source set realistic example/devices/virtio.h deleted file mode 100644 index a157731..0000000 --- a/test cases/common/216 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/216 source set realistic example/main.cc b/test cases/common/216 source set realistic example/main.cc deleted file mode 100644 index 2b55217..0000000 --- a/test cases/common/216 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(void) -{ - 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/216 source set realistic example/meson.build b/test cases/common/216 source set realistic example/meson.build deleted file mode 100644 index d986b99..0000000 --- a/test cases/common/216 source set realistic example/meson.build +++ /dev/null @@ -1,52 +0,0 @@ -# a sort-of realistic example that combines the sourceset and keyval -# modules, inspired by QEMU's build system - -project('sourceset-example', 'cpp', default_options: ['cpp_std=c++11']) - -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') -keyval = import('keyval') - -zlib = declare_dependency(compile_args: '-DZLIB=1') -another = declare_dependency(compile_args: '-DANOTHER=1') -not_found = dependency('not-found', required: false) - -common = ss.source_set() -specific = ss.source_set() - -common.add(files('main.cc')) -common.add(when: [zlib, another], 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(), - dependencies: common.all_dependencies()) - -targets = [ 'arm', 'aarch64', 'x86' ] -target_dirs = { 'arm' : 'arm', 'aarch64' : 'arm', 'x86': 'x86' } - -foreach x : targets - config = keyval.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/216 source set realistic example/not-found.cc b/test cases/common/216 source set realistic example/not-found.cc deleted file mode 100644 index 955a7a2..0000000 --- a/test cases/common/216 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/216 source set realistic example/was-found.cc b/test cases/common/216 source set realistic example/was-found.cc deleted file mode 100644 index f1eaf1e..0000000 --- a/test cases/common/216 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/216 source set realistic example/zlib.cc b/test cases/common/216 source set realistic example/zlib.cc deleted file mode 100644 index 434e0b7..0000000 --- a/test cases/common/216 source set realistic example/zlib.cc +++ /dev/null @@ -1,15 +0,0 @@ -#include -#include "common.h" - -struct ZLibDependency : Dependency { - void initialize(); -}; - -void ZLibDependency::initialize() { - if (ZLIB && ANOTHER) { - std::cout << ANSI_START << "hello from zlib" - << ANSI_END << std::endl; - } -} - -ZLibDependency zlib; diff --git a/test cases/common/217 custom target input extracted objects/check_object.py b/test cases/common/217 custom target input extracted objects/check_object.py deleted file mode 100644 index bafcf2c..0000000 --- a/test cases/common/217 custom target input extracted objects/check_object.py +++ /dev/null @@ -1,13 +0,0 @@ -#!/usr/bin/env python3 - -import sys, os - -if __name__ == '__main__': - if len(sys.argv) != 3: - print(sys.argv[0], 'object', 'output') - sys.exit(1) - elif os.path.exists(sys.argv[1]): - with open(sys.argv[2], 'wb') as out: - pass - else: - sys.exit(1) diff --git a/test cases/common/217 custom target input extracted objects/libdir/meson.build b/test cases/common/217 custom target input extracted objects/libdir/meson.build deleted file mode 100644 index 7f83311..0000000 --- a/test cases/common/217 custom target input extracted objects/libdir/meson.build +++ /dev/null @@ -1 +0,0 @@ -objlib = static_library('object', 'source.c', override_options : ['unity=off']) diff --git a/test cases/common/217 custom target input extracted objects/libdir/source.c b/test cases/common/217 custom target input extracted objects/libdir/source.c deleted file mode 100644 index 1dc08e1..0000000 --- a/test cases/common/217 custom target input extracted objects/libdir/source.c +++ /dev/null @@ -1,3 +0,0 @@ -int func1_in_obj(void) { - return 0; -} diff --git a/test cases/common/217 custom target input extracted objects/meson.build b/test cases/common/217 custom target input extracted objects/meson.build deleted file mode 100644 index 8f8b22f..0000000 --- a/test cases/common/217 custom target input extracted objects/meson.build +++ /dev/null @@ -1,18 +0,0 @@ -project('custom target input extracted objects', 'c') - -if meson.backend() == 'xcode' - error('MESON_SKIP_TEST: sometimes Xcode puts object files in weird paths and we can not extract them.') -endif - - -checker = find_program('check_object.py') - -cc = meson.get_compiler('c').cmd_array().get(-1) - -subdir('libdir') - -custom_target('check', - input: objlib.extract_objects('source.c'), - output: 'objcheck', - command: [checker, '@INPUT@', '@OUTPUT@'], - build_by_default: true) diff --git a/test cases/common/217 test priorities/meson.build b/test cases/common/217 test priorities/meson.build new file mode 100644 index 0000000..33c6fa3 --- /dev/null +++ b/test cases/common/217 test priorities/meson.build @@ -0,0 +1,22 @@ +project('test priorities', 'c') + +test_prog = find_program('testprog.py') + +test('priority 0', test_prog, + args : ['0'], +) + +test('priority neg 10', test_prog, + args : ['-10'], + priority : -10 +) + +test('priority 1000', test_prog, + args : ['1000'], + priority : 1000 +) + +test('priority 50', test_prog, + args : ['50'], + priority : 50 +) diff --git a/test cases/common/217 test priorities/testprog.py b/test cases/common/217 test priorities/testprog.py new file mode 100644 index 0000000..470f28c --- /dev/null +++ b/test cases/common/217 test priorities/testprog.py @@ -0,0 +1,5 @@ +#!/usr/bin/env python3 + +import sys + +print(sys.argv[1]) diff --git a/test cases/common/218 include_dir dot/meson.build b/test cases/common/218 include_dir dot/meson.build new file mode 100644 index 0000000..71f7189 --- /dev/null +++ b/test cases/common/218 include_dir dot/meson.build @@ -0,0 +1,8 @@ +project('Include Here', 'c') + +# The layout with the .h file in . and the .c files in src/ is critical to +# tickle the bug #5847 + +inc = include_directories('.') + +subdir('src') \ No newline at end of file diff --git a/test cases/common/218 include_dir dot/rone.h b/test cases/common/218 include_dir dot/rone.h new file mode 100644 index 0000000..48d7a79 --- /dev/null +++ b/test cases/common/218 include_dir dot/rone.h @@ -0,0 +1 @@ +int rOne(void); \ No newline at end of file diff --git a/test cases/common/218 include_dir dot/src/main.c b/test cases/common/218 include_dir dot/src/main.c new file mode 100644 index 0000000..192b783 --- /dev/null +++ b/test cases/common/218 include_dir dot/src/main.c @@ -0,0 +1,5 @@ +#include "rone.h" + +int main(void) { + return rOne(); +} diff --git a/test cases/common/218 include_dir dot/src/meson.build b/test cases/common/218 include_dir dot/src/meson.build new file mode 100644 index 0000000..fcbefb0 --- /dev/null +++ b/test cases/common/218 include_dir dot/src/meson.build @@ -0,0 +1,6 @@ +t = executable( + 'main', + ['main.c', 'rone.c'], + include_directories : inc, + implicit_include_directories : false, +) \ No newline at end of file diff --git a/test cases/common/218 include_dir dot/src/rone.c b/test cases/common/218 include_dir dot/src/rone.c new file mode 100644 index 0000000..63cb0d3 --- /dev/null +++ b/test cases/common/218 include_dir dot/src/rone.c @@ -0,0 +1,3 @@ +int rOne(void) { + return 1; +} \ No newline at end of file diff --git a/test cases/common/218 test priorities/meson.build b/test cases/common/218 test priorities/meson.build deleted file mode 100644 index 33c6fa3..0000000 --- a/test cases/common/218 test priorities/meson.build +++ /dev/null @@ -1,22 +0,0 @@ -project('test priorities', 'c') - -test_prog = find_program('testprog.py') - -test('priority 0', test_prog, - args : ['0'], -) - -test('priority neg 10', test_prog, - args : ['-10'], - priority : -10 -) - -test('priority 1000', test_prog, - args : ['1000'], - priority : 1000 -) - -test('priority 50', test_prog, - args : ['50'], - priority : 50 -) diff --git a/test cases/common/218 test priorities/testprog.py b/test cases/common/218 test priorities/testprog.py deleted file mode 100644 index 470f28c..0000000 --- a/test cases/common/218 test priorities/testprog.py +++ /dev/null @@ -1,5 +0,0 @@ -#!/usr/bin/env python3 - -import sys - -print(sys.argv[1]) diff --git a/test cases/common/219 include_dir dot/meson.build b/test cases/common/219 include_dir dot/meson.build deleted file mode 100644 index 71f7189..0000000 --- a/test cases/common/219 include_dir dot/meson.build +++ /dev/null @@ -1,8 +0,0 @@ -project('Include Here', 'c') - -# The layout with the .h file in . and the .c files in src/ is critical to -# tickle the bug #5847 - -inc = include_directories('.') - -subdir('src') \ No newline at end of file diff --git a/test cases/common/219 include_dir dot/rone.h b/test cases/common/219 include_dir dot/rone.h deleted file mode 100644 index 48d7a79..0000000 --- a/test cases/common/219 include_dir dot/rone.h +++ /dev/null @@ -1 +0,0 @@ -int rOne(void); \ No newline at end of file diff --git a/test cases/common/219 include_dir dot/src/main.c b/test cases/common/219 include_dir dot/src/main.c deleted file mode 100644 index 192b783..0000000 --- a/test cases/common/219 include_dir dot/src/main.c +++ /dev/null @@ -1,5 +0,0 @@ -#include "rone.h" - -int main(void) { - return rOne(); -} diff --git a/test cases/common/219 include_dir dot/src/meson.build b/test cases/common/219 include_dir dot/src/meson.build deleted file mode 100644 index fcbefb0..0000000 --- a/test cases/common/219 include_dir dot/src/meson.build +++ /dev/null @@ -1,6 +0,0 @@ -t = executable( - 'main', - ['main.c', 'rone.c'], - include_directories : inc, - implicit_include_directories : false, -) \ No newline at end of file diff --git a/test cases/common/219 include_dir dot/src/rone.c b/test cases/common/219 include_dir dot/src/rone.c deleted file mode 100644 index 63cb0d3..0000000 --- a/test cases/common/219 include_dir dot/src/rone.c +++ /dev/null @@ -1,3 +0,0 @@ -int rOne(void) { - return 1; -} \ No newline at end of file diff --git a/test cases/common/219 include_type dependency/main.cpp b/test cases/common/219 include_type dependency/main.cpp new file mode 100644 index 0000000..bf8c4a4 --- /dev/null +++ b/test cases/common/219 include_type dependency/main.cpp @@ -0,0 +1,8 @@ +#include +#include + +using namespace std; + +int main(void) { + return 0; +} diff --git a/test cases/common/219 include_type dependency/meson.build b/test cases/common/219 include_type dependency/meson.build new file mode 100644 index 0000000..fe21dbb --- /dev/null +++ b/test cases/common/219 include_type dependency/meson.build @@ -0,0 +1,41 @@ +project( + 'dependency include_type', + ['c', 'cpp'], +) + +dep = dependency('zlib', method: 'pkg-config', required : false) +boost_dep = dependency('boost', modules: ['graph'], include_type : 'system', required: false) + +if not dep.found() + error('MESON_SKIP_TEST zlib was not found') +endif + +if not boost_dep.found() + error('MESON_SKIP_TEST boost was not found') +endif + +assert(dep.include_type() == 'preserve', 'include_type must default to "preserve"') + +dep_sys = dep.as_system() +assert(dep_sys.include_type() == 'system', 'as_system must return a system dep') + +dep2 = dependency('zlib', method: 'pkg-config', include_type : 'system') +assert(dep2.include_type() == 'system', 'include_type must be true when set') + +dep2_sys = dep2.as_system('non-system') +assert(dep2_sys.include_type() == 'non-system', 'as_system must set include_type correctly') + +sp = subproject('subDep') +sp_dep = sp.get_variable('subDep_dep') +assert(sp_dep.include_type() == 'preserve', 'default is preserve') + +sp_dep_sys = sp_dep.as_system('system') +assert(sp_dep_sys.include_type() == 'system', 'changing include_type works') +assert(sp_dep.include_type() == 'preserve', 'as_system must not mutate the original object') + +fallback = dependency('sdffgagf_does_not_exist', include_type: 'system', fallback: ['subDep', 'subDep_dep']) +assert(fallback.include_type() == 'system', 'include_type works with dependency fallback') + +# Check that PCH works with `include_type : 'system'` See https://github.com/mesonbuild/meson/issues/7167 +main_exe = executable('main_exe', 'main.cpp', cpp_pch: 'pch/test.hpp', dependencies: boost_dep) +test('main_test', main_exe) diff --git a/test cases/common/219 include_type dependency/pch/test.hpp b/test cases/common/219 include_type dependency/pch/test.hpp new file mode 100644 index 0000000..0d40fe1 --- /dev/null +++ b/test cases/common/219 include_type dependency/pch/test.hpp @@ -0,0 +1 @@ +#include diff --git a/test cases/common/219 include_type dependency/subprojects/subDep/meson.build b/test cases/common/219 include_type dependency/subprojects/subDep/meson.build new file mode 100644 index 0000000..c3e87c4 --- /dev/null +++ b/test cases/common/219 include_type dependency/subprojects/subDep/meson.build @@ -0,0 +1,3 @@ +project('subDep', ['cpp']) + +subDep_dep = declare_dependency(compile_args : []) diff --git a/test cases/common/22 object extraction/lib.c b/test cases/common/22 object extraction/lib.c new file mode 100644 index 0000000..8180551 --- /dev/null +++ b/test cases/common/22 object extraction/lib.c @@ -0,0 +1,3 @@ +int func(void) { + return 42; +} diff --git a/test cases/common/22 object extraction/lib2.c b/test cases/common/22 object extraction/lib2.c new file mode 100644 index 0000000..5020593 --- /dev/null +++ b/test cases/common/22 object extraction/lib2.c @@ -0,0 +1,3 @@ +int retval(void) { + return 43; +} diff --git a/test cases/common/22 object extraction/main.c b/test cases/common/22 object extraction/main.c new file mode 100644 index 0000000..27162c5 --- /dev/null +++ b/test cases/common/22 object extraction/main.c @@ -0,0 +1,5 @@ +int func(void); + +int main(void) { + return func() == 42 ? 0 : 1; +} diff --git a/test cases/common/22 object extraction/meson.build b/test cases/common/22 object extraction/meson.build new file mode 100644 index 0000000..18be1db --- /dev/null +++ b/test cases/common/22 object extraction/meson.build @@ -0,0 +1,23 @@ +project('object extraction', 'c') + +if meson.is_unity() + message('Skipping extraction test because this is a Unity build.') +else + lib1 = shared_library('somelib', 'src/lib.c') + lib2 = shared_library('somelib2', 'lib.c', 'lib2.c') + + obj1 = lib1.extract_objects('src/lib.c') + obj2 = lib2.extract_objects(['lib.c']) + obj3 = lib2.extract_objects(files('lib.c')) + obj4 = lib2.extract_objects(['lib.c', 'lib.c']) + + e1 = executable('main1', 'main.c', objects : obj1) + e2 = executable('main2', 'main.c', objects : obj2) + e3 = executable('main3', 'main.c', objects : obj3) + e4 = executable('main4', 'main.c', objects : obj4) + + test('extraction test 1', e1) + test('extraction test 2', e2) + test('extraction test 3', e3) + test('extraction test 4', e4) +endif diff --git a/test cases/common/22 object extraction/src/lib.c b/test cases/common/22 object extraction/src/lib.c new file mode 100644 index 0000000..8180551 --- /dev/null +++ b/test cases/common/22 object extraction/src/lib.c @@ -0,0 +1,3 @@ +int func(void) { + return 42; +} diff --git a/test cases/common/22 target arg/func.c b/test cases/common/22 target arg/func.c deleted file mode 100644 index 8c0659e..0000000 --- a/test cases/common/22 target arg/func.c +++ /dev/null @@ -1,9 +0,0 @@ -#ifndef CTHING -#error "Local argument not set" -#endif - -#ifdef CPPTHING -#error "Wrong local argument set" -#endif - -int func(void) { return 0; } diff --git a/test cases/common/22 target arg/func2.c b/test cases/common/22 target arg/func2.c deleted file mode 100644 index 1897cf7..0000000 --- a/test cases/common/22 target arg/func2.c +++ /dev/null @@ -1,9 +0,0 @@ -#ifdef CTHING -#error "Local C argument set in wrong target" -#endif - -#ifdef CPPTHING -#error "Local CPP argument set in wrong target" -#endif - -int func(void) { return 0; } diff --git a/test cases/common/22 target arg/meson.build b/test cases/common/22 target arg/meson.build deleted file mode 100644 index 11ac006..0000000 --- a/test cases/common/22 target arg/meson.build +++ /dev/null @@ -1,9 +0,0 @@ -project('local arg test', 'cpp', 'c') - -exe1 = executable('prog', 'prog.cc', 'func.c', \ -c_args : '-DCTHING', \ -cpp_args : '-DCPPTHING') -exe2 = executable('prog2', 'prog2.cc', 'func2.c') - -test('prog1', exe1) -test('prog2', exe2) diff --git a/test cases/common/22 target arg/prog.cc b/test cases/common/22 target arg/prog.cc deleted file mode 100644 index 23028af..0000000 --- a/test cases/common/22 target arg/prog.cc +++ /dev/null @@ -1,13 +0,0 @@ -#ifdef CTHING -#error "Wrong local argument set" -#endif - -#ifndef CPPTHING -#error "Local argument not set" -#endif - -extern "C" int func(); - -int main(void) { - return func(); -} diff --git a/test cases/common/22 target arg/prog2.cc b/test cases/common/22 target arg/prog2.cc deleted file mode 100644 index e2ffe62..0000000 --- a/test cases/common/22 target arg/prog2.cc +++ /dev/null @@ -1,13 +0,0 @@ -#ifdef CTHING -#error "Local C argument set in wrong target" -#endif - -#ifdef CPPTHING -#error "Local CPP argument set in wrong target" -#endif - -extern "C" int func(); - -int main(void) { - return func(); -} diff --git a/test cases/common/220 fs module/meson.build b/test cases/common/220 fs module/meson.build new file mode 100644 index 0000000..300e777 --- /dev/null +++ b/test cases/common/220 fs module/meson.build @@ -0,0 +1,119 @@ +project('fs module test') + +is_windows = build_machine.system() == 'windows' + +fs = import('fs') + +assert(fs.exists('meson.build'), 'Existing file reported as missing.') +assert(not fs.exists('nonexisting'), 'Nonexisting file was found.') + +if not is_windows and build_machine.system() != 'cygwin' + # Symlinks on Windows have specific requirements including: + # * Meson running under Python >= 3.8 + # * Windows user permissions to create symlinks, and/or Windows in Developer mode + # so at this time the symlink test is skipped for Windows. + symlink = meson.current_build_dir() / 'a_symlink' + run_command('ln', '-s', meson.current_source_dir() / 'meson.build', symlink) + assert(fs.is_symlink(symlink), 'Symlink not detected.') + assert(not fs.is_symlink('meson.build'), 'Regular file detected as symlink.') +endif + +assert(fs.is_file('meson.build'), 'File not detected as a file.') +assert(not fs.is_file('subprojects'), 'Directory detected as a file.') +assert(not fs.is_file('nonexisting'), 'Bad path detected as a file.') + +assert(fs.is_dir('subprojects'), 'Dir not detected correctly.') +assert(not fs.is_dir('meson.build'), 'File detected as a dir.') +assert(not fs.is_dir('nonexisting'), 'Bad path detected as a dir.') + +assert(fs.is_dir('~'), 'home directory not detected') +assert(not fs.is_file('~'), 'home directory detected as file') + +# -- expanduser +assert(fs.expanduser('~') != '~','expanduser failed') +assert(fs.expanduser('~/foo').endswith('foo'), 'expanduser with tail failed') + +# -- as_posix +assert(fs.as_posix('/') == '/', 'as_posix idempotent') +assert(fs.as_posix('\\') == '/', 'as_posix simple') +assert(fs.as_posix('\\\\') == '/', 'as_posix simple') +assert(fs.as_posix('foo\\bar/baz') == 'foo/bar/baz', 'as_posix mixed slash') + +# -- is_absolute +winabs = 'q:/foo' +unixabs = '/foo' +if is_windows + assert(fs.is_absolute(winabs), 'is_absolute windows not detected') + assert(not fs.is_absolute(unixabs), 'is_absolute unix false positive') +else + assert(fs.is_absolute(unixabs), 'is_absolute unix not detected') + assert(not fs.is_absolute(winabs), 'is_absolute windows false positive') +endif + +# -- replace_suffix + +original = 'foo' +assert(fs.replace_suffix(original, '') == original, 'replace_suffix idempotent') + +original = 'foo.txt' +new = fs.replace_suffix(original, '.ini') +assert(new == 'foo.ini', 'replace_suffix failed') + +original = 'foo' +new = fs.replace_suffix(original, '.ini') +assert(new == 'foo.ini', 'replace_suffix did not add suffix to suffixless file') + +original = 'foo.dll.a' +new = fs.replace_suffix(original, '.so') +assert(new == 'foo.dll.so', 'replace_suffix did not only modify last suffix') + +original = 'foo.dll' +new = fs.replace_suffix(original, '') +assert(new == 'foo', 'replace_suffix did not only delete last suffix') + +# `/` on windows is interpreted like `.drive` which in general may not be `c:/` +# the files need not exist for fs.replace_suffix() +original = is_windows ? 'j:/foo/bar.txt' : '/foo/bar.txt' +new_check = is_windows ? 'j:\\foo\\bar.ini' : '/foo/bar.ini' + +new = fs.replace_suffix(original, '.ini') +assert(new == new_check, 'absolute path replace_suffix failed') + +# -- hash + +md5 = fs.hash('subdir/subdirfile.txt', 'md5') +sha256 = fs.hash('subdir/subdirfile.txt', 'sha256') +assert(md5 == 'd0795db41614d25affdd548314b30b3b', 'md5sum did not match') +assert(sha256 == 'be2170b0dae535b73f6775694fffa3fd726a43b5fabea11b7342f0605917a42a', 'sha256sum did not match') + +# -- size + +size = fs.size('subdir/subdirfile.txt') +assert(size == 19, 'file size not found correctly') + +# -- are filenames referring to the same file? +f1 = 'meson.build' +f2 = 'subdir/../meson.build' +assert(fs.is_samepath(f1, f2), 'is_samepath not detercting same files') +assert(fs.is_samepath(meson.source_root(), 'subdir/..'), 'is_samepath not detecting same directory') +assert(fs.is_samepath(meson.project_source_root(), 'subdir/..'), 'is_samepath not detecting same directory') +assert(fs.is_samepath(meson.project_build_root(), meson.current_build_dir() / 'subdir/..'), 'is_samepath not detecting same directory') +assert(fs.is_samepath(meson.global_source_root(), meson.current_source_dir()), 'is_samepath not detecting same directory') +assert(fs.is_samepath(meson.global_build_root(), meson.current_build_dir()), 'is_samepath not detecting same directory') +assert(not fs.is_samepath(f1, 'subdir/subdirfile.txt'), 'is_samepath known bad comparison') +assert(not fs.is_samepath('not-a-path', f2), 'is_samepath should not error if path(s) do not exist') + +if not is_windows and build_machine.system() != 'cygwin' + assert(fs.is_samepath(symlink, 'meson.build'), 'symlink is_samepath fail') +endif + +# parts of path +assert(fs.parent('foo/bar') == 'foo', 'failed to get dirname') +assert(fs.name('foo/bar') == 'bar', 'failed to get basename') +assert(fs.name('foo/bar/baz.dll.a') == 'baz.dll.a', 'failed to get basename with compound suffix') +assert(fs.stem('foo/bar/baz.dll') == 'baz', 'failed to get stem with suffix') +assert(fs.stem('foo/bar/baz.dll.a') == 'baz.dll', 'failed to get stem with compound suffix') + +subdir('subdir') + +subproject('subbie') diff --git a/test cases/common/220 fs module/subdir/meson.build b/test cases/common/220 fs module/subdir/meson.build new file mode 100644 index 0000000..dc04b41 --- /dev/null +++ b/test cases/common/220 fs module/subdir/meson.build @@ -0,0 +1,3 @@ +assert(fs.exists('subdirfile.txt'), 'Subdir file lookup is broken.') +assert(fs.is_samepath(meson.project_source_root(), '..'), 'is_samepath not detecting same directory') +assert(fs.is_samepath(meson.project_build_root(), meson.current_build_dir() / '..'), 'is_samepath not detecting same directory') diff --git a/test cases/common/220 fs module/subdir/subdirfile.txt b/test cases/common/220 fs module/subdir/subdirfile.txt new file mode 100644 index 0000000..bcf7cc0 --- /dev/null +++ b/test cases/common/220 fs module/subdir/subdirfile.txt @@ -0,0 +1 @@ +I have no content. diff --git a/test cases/common/220 fs module/subprojects/subbie/meson.build b/test cases/common/220 fs module/subprojects/subbie/meson.build new file mode 100644 index 0000000..f1e21ea --- /dev/null +++ b/test cases/common/220 fs module/subprojects/subbie/meson.build @@ -0,0 +1,11 @@ +project('subbie') + +fs = import('fs') + +assert(fs.exists('subprojectfile.txt'), 'Subproject root file not found.') +assert(fs.is_samepath(meson.project_source_root(), meson.current_source_dir()), 'is_samepath not detecting same directory') +assert(fs.is_samepath(meson.project_build_root(), meson.current_build_dir()), 'is_samepath not detecting same directory') +assert(fs.is_samepath(meson.global_source_root(), meson.current_source_dir() / '../..'), 'is_samepath not detecting same directory') +assert(fs.is_samepath(meson.global_build_root(), meson.current_build_dir() / '../..'), 'is_samepath not detecting same directory') + +subdir('subsub') diff --git a/test cases/common/220 fs module/subprojects/subbie/subprojectfile.txt b/test cases/common/220 fs module/subprojects/subbie/subprojectfile.txt new file mode 100644 index 0000000..bedb84c --- /dev/null +++ b/test cases/common/220 fs module/subprojects/subbie/subprojectfile.txt @@ -0,0 +1 @@ +I'm not empty. So there's at least that. diff --git a/test cases/common/220 fs module/subprojects/subbie/subsub/meson.build b/test cases/common/220 fs module/subprojects/subbie/subsub/meson.build new file mode 100644 index 0000000..4ac68ae --- /dev/null +++ b/test cases/common/220 fs module/subprojects/subbie/subsub/meson.build @@ -0,0 +1,3 @@ +assert(fs.exists('subsubfile.txt'), 'Subproject subdir lookup failed.') +assert(fs.is_samepath(meson.project_source_root(), meson.current_source_dir() / '..'), 'is_samepath not detecting same directory') +assert(fs.is_samepath(meson.project_build_root(), meson.current_build_dir() / '..'), 'is_samepath not detecting same directory') diff --git a/test cases/common/220 fs module/subprojects/subbie/subsub/subsubfile.txt b/test cases/common/220 fs module/subprojects/subbie/subsub/subsubfile.txt new file mode 100644 index 0000000..2d5120d --- /dev/null +++ b/test cases/common/220 fs module/subprojects/subbie/subsub/subsubfile.txt @@ -0,0 +1 @@ +Thank you for looking inside me. diff --git a/test cases/common/220 include_type dependency/main.cpp b/test cases/common/220 include_type dependency/main.cpp deleted file mode 100644 index bf8c4a4..0000000 --- a/test cases/common/220 include_type dependency/main.cpp +++ /dev/null @@ -1,8 +0,0 @@ -#include -#include - -using namespace std; - -int main(void) { - return 0; -} diff --git a/test cases/common/220 include_type dependency/meson.build b/test cases/common/220 include_type dependency/meson.build deleted file mode 100644 index fe21dbb..0000000 --- a/test cases/common/220 include_type dependency/meson.build +++ /dev/null @@ -1,41 +0,0 @@ -project( - 'dependency include_type', - ['c', 'cpp'], -) - -dep = dependency('zlib', method: 'pkg-config', required : false) -boost_dep = dependency('boost', modules: ['graph'], include_type : 'system', required: false) - -if not dep.found() - error('MESON_SKIP_TEST zlib was not found') -endif - -if not boost_dep.found() - error('MESON_SKIP_TEST boost was not found') -endif - -assert(dep.include_type() == 'preserve', 'include_type must default to "preserve"') - -dep_sys = dep.as_system() -assert(dep_sys.include_type() == 'system', 'as_system must return a system dep') - -dep2 = dependency('zlib', method: 'pkg-config', include_type : 'system') -assert(dep2.include_type() == 'system', 'include_type must be true when set') - -dep2_sys = dep2.as_system('non-system') -assert(dep2_sys.include_type() == 'non-system', 'as_system must set include_type correctly') - -sp = subproject('subDep') -sp_dep = sp.get_variable('subDep_dep') -assert(sp_dep.include_type() == 'preserve', 'default is preserve') - -sp_dep_sys = sp_dep.as_system('system') -assert(sp_dep_sys.include_type() == 'system', 'changing include_type works') -assert(sp_dep.include_type() == 'preserve', 'as_system must not mutate the original object') - -fallback = dependency('sdffgagf_does_not_exist', include_type: 'system', fallback: ['subDep', 'subDep_dep']) -assert(fallback.include_type() == 'system', 'include_type works with dependency fallback') - -# Check that PCH works with `include_type : 'system'` See https://github.com/mesonbuild/meson/issues/7167 -main_exe = executable('main_exe', 'main.cpp', cpp_pch: 'pch/test.hpp', dependencies: boost_dep) -test('main_test', main_exe) diff --git a/test cases/common/220 include_type dependency/pch/test.hpp b/test cases/common/220 include_type dependency/pch/test.hpp deleted file mode 100644 index 0d40fe1..0000000 --- a/test cases/common/220 include_type dependency/pch/test.hpp +++ /dev/null @@ -1 +0,0 @@ -#include diff --git a/test cases/common/220 include_type dependency/subprojects/subDep/meson.build b/test cases/common/220 include_type dependency/subprojects/subDep/meson.build deleted file mode 100644 index c3e87c4..0000000 --- a/test cases/common/220 include_type dependency/subprojects/subDep/meson.build +++ /dev/null @@ -1,3 +0,0 @@ -project('subDep', ['cpp']) - -subDep_dep = declare_dependency(compile_args : []) diff --git a/test cases/common/221 fs module/meson.build b/test cases/common/221 fs module/meson.build deleted file mode 100644 index 300e777..0000000 --- a/test cases/common/221 fs module/meson.build +++ /dev/null @@ -1,119 +0,0 @@ -project('fs module test') - -is_windows = build_machine.system() == 'windows' - -fs = import('fs') - -assert(fs.exists('meson.build'), 'Existing file reported as missing.') -assert(not fs.exists('nonexisting'), 'Nonexisting file was found.') - -if not is_windows and build_machine.system() != 'cygwin' - # Symlinks on Windows have specific requirements including: - # * Meson running under Python >= 3.8 - # * Windows user permissions to create symlinks, and/or Windows in Developer mode - # so at this time the symlink test is skipped for Windows. - symlink = meson.current_build_dir() / 'a_symlink' - run_command('ln', '-s', meson.current_source_dir() / 'meson.build', symlink) - assert(fs.is_symlink(symlink), 'Symlink not detected.') - assert(not fs.is_symlink('meson.build'), 'Regular file detected as symlink.') -endif - -assert(fs.is_file('meson.build'), 'File not detected as a file.') -assert(not fs.is_file('subprojects'), 'Directory detected as a file.') -assert(not fs.is_file('nonexisting'), 'Bad path detected as a file.') - -assert(fs.is_dir('subprojects'), 'Dir not detected correctly.') -assert(not fs.is_dir('meson.build'), 'File detected as a dir.') -assert(not fs.is_dir('nonexisting'), 'Bad path detected as a dir.') - -assert(fs.is_dir('~'), 'home directory not detected') -assert(not fs.is_file('~'), 'home directory detected as file') - -# -- expanduser -assert(fs.expanduser('~') != '~','expanduser failed') -assert(fs.expanduser('~/foo').endswith('foo'), 'expanduser with tail failed') - -# -- as_posix -assert(fs.as_posix('/') == '/', 'as_posix idempotent') -assert(fs.as_posix('\\') == '/', 'as_posix simple') -assert(fs.as_posix('\\\\') == '/', 'as_posix simple') -assert(fs.as_posix('foo\\bar/baz') == 'foo/bar/baz', 'as_posix mixed slash') - -# -- is_absolute -winabs = 'q:/foo' -unixabs = '/foo' -if is_windows - assert(fs.is_absolute(winabs), 'is_absolute windows not detected') - assert(not fs.is_absolute(unixabs), 'is_absolute unix false positive') -else - assert(fs.is_absolute(unixabs), 'is_absolute unix not detected') - assert(not fs.is_absolute(winabs), 'is_absolute windows false positive') -endif - -# -- replace_suffix - -original = 'foo' -assert(fs.replace_suffix(original, '') == original, 'replace_suffix idempotent') - -original = 'foo.txt' -new = fs.replace_suffix(original, '.ini') -assert(new == 'foo.ini', 'replace_suffix failed') - -original = 'foo' -new = fs.replace_suffix(original, '.ini') -assert(new == 'foo.ini', 'replace_suffix did not add suffix to suffixless file') - -original = 'foo.dll.a' -new = fs.replace_suffix(original, '.so') -assert(new == 'foo.dll.so', 'replace_suffix did not only modify last suffix') - -original = 'foo.dll' -new = fs.replace_suffix(original, '') -assert(new == 'foo', 'replace_suffix did not only delete last suffix') - -# `/` on windows is interpreted like `.drive` which in general may not be `c:/` -# the files need not exist for fs.replace_suffix() -original = is_windows ? 'j:/foo/bar.txt' : '/foo/bar.txt' -new_check = is_windows ? 'j:\\foo\\bar.ini' : '/foo/bar.ini' - -new = fs.replace_suffix(original, '.ini') -assert(new == new_check, 'absolute path replace_suffix failed') - -# -- hash - -md5 = fs.hash('subdir/subdirfile.txt', 'md5') -sha256 = fs.hash('subdir/subdirfile.txt', 'sha256') -assert(md5 == 'd0795db41614d25affdd548314b30b3b', 'md5sum did not match') -assert(sha256 == 'be2170b0dae535b73f6775694fffa3fd726a43b5fabea11b7342f0605917a42a', 'sha256sum did not match') - -# -- size - -size = fs.size('subdir/subdirfile.txt') -assert(size == 19, 'file size not found correctly') - -# -- are filenames referring to the same file? -f1 = 'meson.build' -f2 = 'subdir/../meson.build' -assert(fs.is_samepath(f1, f2), 'is_samepath not detercting same files') -assert(fs.is_samepath(meson.source_root(), 'subdir/..'), 'is_samepath not detecting same directory') -assert(fs.is_samepath(meson.project_source_root(), 'subdir/..'), 'is_samepath not detecting same directory') -assert(fs.is_samepath(meson.project_build_root(), meson.current_build_dir() / 'subdir/..'), 'is_samepath not detecting same directory') -assert(fs.is_samepath(meson.global_source_root(), meson.current_source_dir()), 'is_samepath not detecting same directory') -assert(fs.is_samepath(meson.global_build_root(), meson.current_build_dir()), 'is_samepath not detecting same directory') -assert(not fs.is_samepath(f1, 'subdir/subdirfile.txt'), 'is_samepath known bad comparison') -assert(not fs.is_samepath('not-a-path', f2), 'is_samepath should not error if path(s) do not exist') - -if not is_windows and build_machine.system() != 'cygwin' - assert(fs.is_samepath(symlink, 'meson.build'), 'symlink is_samepath fail') -endif - -# parts of path -assert(fs.parent('foo/bar') == 'foo', 'failed to get dirname') -assert(fs.name('foo/bar') == 'bar', 'failed to get basename') -assert(fs.name('foo/bar/baz.dll.a') == 'baz.dll.a', 'failed to get basename with compound suffix') -assert(fs.stem('foo/bar/baz.dll') == 'baz', 'failed to get stem with suffix') -assert(fs.stem('foo/bar/baz.dll.a') == 'baz.dll', 'failed to get stem with compound suffix') - -subdir('subdir') - -subproject('subbie') diff --git a/test cases/common/221 fs module/subdir/meson.build b/test cases/common/221 fs module/subdir/meson.build deleted file mode 100644 index dc04b41..0000000 --- a/test cases/common/221 fs module/subdir/meson.build +++ /dev/null @@ -1,3 +0,0 @@ -assert(fs.exists('subdirfile.txt'), 'Subdir file lookup is broken.') -assert(fs.is_samepath(meson.project_source_root(), '..'), 'is_samepath not detecting same directory') -assert(fs.is_samepath(meson.project_build_root(), meson.current_build_dir() / '..'), 'is_samepath not detecting same directory') diff --git a/test cases/common/221 fs module/subdir/subdirfile.txt b/test cases/common/221 fs module/subdir/subdirfile.txt deleted file mode 100644 index bcf7cc0..0000000 --- a/test cases/common/221 fs module/subdir/subdirfile.txt +++ /dev/null @@ -1 +0,0 @@ -I have no content. diff --git a/test cases/common/221 fs module/subprojects/subbie/meson.build b/test cases/common/221 fs module/subprojects/subbie/meson.build deleted file mode 100644 index f1e21ea..0000000 --- a/test cases/common/221 fs module/subprojects/subbie/meson.build +++ /dev/null @@ -1,11 +0,0 @@ -project('subbie') - -fs = import('fs') - -assert(fs.exists('subprojectfile.txt'), 'Subproject root file not found.') -assert(fs.is_samepath(meson.project_source_root(), meson.current_source_dir()), 'is_samepath not detecting same directory') -assert(fs.is_samepath(meson.project_build_root(), meson.current_build_dir()), 'is_samepath not detecting same directory') -assert(fs.is_samepath(meson.global_source_root(), meson.current_source_dir() / '../..'), 'is_samepath not detecting same directory') -assert(fs.is_samepath(meson.global_build_root(), meson.current_build_dir() / '../..'), 'is_samepath not detecting same directory') - -subdir('subsub') diff --git a/test cases/common/221 fs module/subprojects/subbie/subprojectfile.txt b/test cases/common/221 fs module/subprojects/subbie/subprojectfile.txt deleted file mode 100644 index bedb84c..0000000 --- a/test cases/common/221 fs module/subprojects/subbie/subprojectfile.txt +++ /dev/null @@ -1 +0,0 @@ -I'm not empty. So there's at least that. diff --git a/test cases/common/221 fs module/subprojects/subbie/subsub/meson.build b/test cases/common/221 fs module/subprojects/subbie/subsub/meson.build deleted file mode 100644 index 4ac68ae..0000000 --- a/test cases/common/221 fs module/subprojects/subbie/subsub/meson.build +++ /dev/null @@ -1,3 +0,0 @@ -assert(fs.exists('subsubfile.txt'), 'Subproject subdir lookup failed.') -assert(fs.is_samepath(meson.project_source_root(), meson.current_source_dir() / '..'), 'is_samepath not detecting same directory') -assert(fs.is_samepath(meson.project_build_root(), meson.current_build_dir() / '..'), 'is_samepath not detecting same directory') diff --git a/test cases/common/221 fs module/subprojects/subbie/subsub/subsubfile.txt b/test cases/common/221 fs module/subprojects/subbie/subsub/subsubfile.txt deleted file mode 100644 index 2d5120d..0000000 --- a/test cases/common/221 fs module/subprojects/subbie/subsub/subsubfile.txt +++ /dev/null @@ -1 +0,0 @@ -Thank you for looking inside me. diff --git a/test cases/common/221 zlib/meson.build b/test cases/common/221 zlib/meson.build new file mode 100644 index 0000000..c53f71e --- /dev/null +++ b/test cases/common/221 zlib/meson.build @@ -0,0 +1,23 @@ +project('zlib system dependency', 'c') + +if not ['darwin', 'freebsd', 'dragonfly', 'windows'].contains(host_machine.system()) + error('MESON_SKIP_TEST only applicable on macOS, FreeBSD, DragonflyBSD, and Windows.') +endif + +cc = meson.get_compiler('c') + +if host_machine.system() == 'darwin' and cc.get_id() != 'clang' + # this will only work on mac if using Apple's clang compiler, but there is no + # way in the meson source level to differentiate apple clang and llvm clang + # In the meson CI only apple clang is tested + error('MESON_SKIP_TEST on macOS only clang is supported.') +endif + +if not (cc.find_library('z', required: false).found() or + cc.find_library('zlib', required : false).found() or + cc.find_library('zlib1', required : false).found()) + error('MESON_SKIP_TEST Cannot seem to find zlib via find_library, this test will probably fail.') +endif + +z = dependency('zlib', method : 'system') +assert(z.version().version_compare('>= 1.2'), 'Version does not seem to have been detected correctly.') diff --git a/test cases/common/222 native prop/crossfile.ini b/test cases/common/222 native prop/crossfile.ini new file mode 100644 index 0000000..13deef3 --- /dev/null +++ b/test cases/common/222 native prop/crossfile.ini @@ -0,0 +1,4 @@ +[properties] +astring = 'cross' +anarray = ['one', 'two'] +red = true diff --git a/test cases/common/222 native prop/meson.build b/test cases/common/222 native prop/meson.build new file mode 100644 index 0000000..8752371 --- /dev/null +++ b/test cases/common/222 native prop/meson.build @@ -0,0 +1,49 @@ +project('get prop') + +x = meson.get_external_property('astring') +ref = meson.is_cross_build() ? 'cross' : 'mystring' +assert(x==ref, 'did not get native property string. did you use "meson setup --native-file native.txt"') + +x = meson.get_external_property('astring', native: true) +assert(x=='mystring', 'did not get native property with native:true and non-cross build.') + +x = meson.get_external_property('astring', 'fallback', native: false) +assert(x==ref, 'did not get get native property with native:false and non-cross build.') + + +x = meson.get_external_property('notexist', 'fallback') +assert(x=='fallback', 'fallback did not work') + +x = meson.get_external_property('notexist', 'fallback', native: true) +assert(x=='fallback', 'fallback native:true did not work') + +x = meson.get_external_property('notexist', 'fallback', native: false) +assert(x=='fallback', 'fallback native:false did not work') + + +x = meson.get_external_property('anarray') +assert(x==['one', 'two'], 'array did not work') + +assert(meson.has_external_property('anarray'), 'expected property "anarray" to exist') +assert(meson.has_external_property('astring'), 'expected property "astring" to exist') +assert(not meson.has_external_property('abool'), 'did not expect property "abool" to exist') + +# These exist in both +assert(meson.has_external_property('anarray', native: false), 'FIXME') +assert(meson.has_external_property('anarray', native: true), 'FIXME') +assert(meson.has_external_property('astring', native: false), 'FIXME') +assert(meson.has_external_property('astring', native: true), 'FIXME') + +if meson.is_cross_build() + # This property only exists in the cross file + assert(meson.has_external_property('red'), 'expected property "red" to exist in cross file') + assert(meson.has_external_property('red', native: false), 'expected property "red" to exist in cross file') + assert(not meson.has_external_property('red', native: true), 'did not expect property "red" to exist in native file') + + assert(not meson.has_external_property('abool', native: false), 'FIXME') + assert(not meson.has_external_property('abool', native: false), 'FIXME') +else + assert(not meson.has_external_property('red'), 'did not expect property "red" to exist in native file') + assert(not meson.has_external_property('red', native: false), 'did not expect property "red" to exist in cross file because we are not doing a cross build') + assert(not meson.has_external_property('red', native: true), 'did not expect property "red" to exist in native file') +endif diff --git a/test cases/common/222 native prop/nativefile.ini b/test cases/common/222 native prop/nativefile.ini new file mode 100644 index 0000000..03c1e03 --- /dev/null +++ b/test cases/common/222 native prop/nativefile.ini @@ -0,0 +1,3 @@ +[properties] +astring = 'mystring' +anarray = ['one', 'two'] \ No newline at end of file diff --git a/test cases/common/222 zlib/meson.build b/test cases/common/222 zlib/meson.build deleted file mode 100644 index c53f71e..0000000 --- a/test cases/common/222 zlib/meson.build +++ /dev/null @@ -1,23 +0,0 @@ -project('zlib system dependency', 'c') - -if not ['darwin', 'freebsd', 'dragonfly', 'windows'].contains(host_machine.system()) - error('MESON_SKIP_TEST only applicable on macOS, FreeBSD, DragonflyBSD, and Windows.') -endif - -cc = meson.get_compiler('c') - -if host_machine.system() == 'darwin' and cc.get_id() != 'clang' - # this will only work on mac if using Apple's clang compiler, but there is no - # way in the meson source level to differentiate apple clang and llvm clang - # In the meson CI only apple clang is tested - error('MESON_SKIP_TEST on macOS only clang is supported.') -endif - -if not (cc.find_library('z', required: false).found() or - cc.find_library('zlib', required : false).found() or - cc.find_library('zlib1', required : false).found()) - error('MESON_SKIP_TEST Cannot seem to find zlib via find_library, this test will probably fail.') -endif - -z = dependency('zlib', method : 'system') -assert(z.version().version_compare('>= 1.2'), 'Version does not seem to have been detected correctly.') diff --git a/test cases/common/223 native prop/crossfile.ini b/test cases/common/223 native prop/crossfile.ini deleted file mode 100644 index 13deef3..0000000 --- a/test cases/common/223 native prop/crossfile.ini +++ /dev/null @@ -1,4 +0,0 @@ -[properties] -astring = 'cross' -anarray = ['one', 'two'] -red = true diff --git a/test cases/common/223 native prop/meson.build b/test cases/common/223 native prop/meson.build deleted file mode 100644 index 8752371..0000000 --- a/test cases/common/223 native prop/meson.build +++ /dev/null @@ -1,49 +0,0 @@ -project('get prop') - -x = meson.get_external_property('astring') -ref = meson.is_cross_build() ? 'cross' : 'mystring' -assert(x==ref, 'did not get native property string. did you use "meson setup --native-file native.txt"') - -x = meson.get_external_property('astring', native: true) -assert(x=='mystring', 'did not get native property with native:true and non-cross build.') - -x = meson.get_external_property('astring', 'fallback', native: false) -assert(x==ref, 'did not get get native property with native:false and non-cross build.') - - -x = meson.get_external_property('notexist', 'fallback') -assert(x=='fallback', 'fallback did not work') - -x = meson.get_external_property('notexist', 'fallback', native: true) -assert(x=='fallback', 'fallback native:true did not work') - -x = meson.get_external_property('notexist', 'fallback', native: false) -assert(x=='fallback', 'fallback native:false did not work') - - -x = meson.get_external_property('anarray') -assert(x==['one', 'two'], 'array did not work') - -assert(meson.has_external_property('anarray'), 'expected property "anarray" to exist') -assert(meson.has_external_property('astring'), 'expected property "astring" to exist') -assert(not meson.has_external_property('abool'), 'did not expect property "abool" to exist') - -# These exist in both -assert(meson.has_external_property('anarray', native: false), 'FIXME') -assert(meson.has_external_property('anarray', native: true), 'FIXME') -assert(meson.has_external_property('astring', native: false), 'FIXME') -assert(meson.has_external_property('astring', native: true), 'FIXME') - -if meson.is_cross_build() - # This property only exists in the cross file - assert(meson.has_external_property('red'), 'expected property "red" to exist in cross file') - assert(meson.has_external_property('red', native: false), 'expected property "red" to exist in cross file') - assert(not meson.has_external_property('red', native: true), 'did not expect property "red" to exist in native file') - - assert(not meson.has_external_property('abool', native: false), 'FIXME') - assert(not meson.has_external_property('abool', native: false), 'FIXME') -else - assert(not meson.has_external_property('red'), 'did not expect property "red" to exist in native file') - assert(not meson.has_external_property('red', native: false), 'did not expect property "red" to exist in cross file because we are not doing a cross build') - assert(not meson.has_external_property('red', native: true), 'did not expect property "red" to exist in native file') -endif diff --git a/test cases/common/223 native prop/nativefile.ini b/test cases/common/223 native prop/nativefile.ini deleted file mode 100644 index 03c1e03..0000000 --- a/test cases/common/223 native prop/nativefile.ini +++ /dev/null @@ -1,3 +0,0 @@ -[properties] -astring = 'mystring' -anarray = ['one', 'two'] \ No newline at end of file diff --git a/test cases/common/223 persubproject options/foo.c b/test cases/common/223 persubproject options/foo.c new file mode 100644 index 0000000..63e4de6 --- /dev/null +++ b/test cases/common/223 persubproject options/foo.c @@ -0,0 +1,5 @@ +int foo(void); + +int foo(void) { + return 0; +} diff --git a/test cases/common/223 persubproject options/meson.build b/test cases/common/223 persubproject options/meson.build new file mode 100644 index 0000000..f76a70c --- /dev/null +++ b/test cases/common/223 persubproject options/meson.build @@ -0,0 +1,15 @@ +project('persubproject options', 'c', + default_options : ['default_library=both', + 'werror=true', + 'warning_level=3']) + +assert(get_option('default_library') == 'both', 'Parent default_library should be "both"') +assert(get_option('werror')) +assert(get_option('warning_level') == '3') + +# Check it build both by calling a method only both_libraries target implement +lib = library('lib1', 'foo.c') +lib.get_static_lib() + +subproject('sub1') +subproject('sub2', default_options : ['default_library=static']) diff --git a/test cases/common/223 persubproject options/subprojects/sub1/foo.c b/test cases/common/223 persubproject options/subprojects/sub1/foo.c new file mode 100644 index 0000000..82ad2c2 --- /dev/null +++ b/test cases/common/223 persubproject options/subprojects/sub1/foo.c @@ -0,0 +1,8 @@ +int foo(void); + +int foo(void) { + /* This is built with -Werror, it would error if warning_level=3 was inherited + * from main project and not overridden by this subproject's default_options. */ + int x; + return 0; +} diff --git a/test cases/common/223 persubproject options/subprojects/sub1/meson.build b/test cases/common/223 persubproject options/subprojects/sub1/meson.build new file mode 100644 index 0000000..4e4bc1b --- /dev/null +++ b/test cases/common/223 persubproject options/subprojects/sub1/meson.build @@ -0,0 +1,9 @@ +project('sub1', 'c', + default_options : ['warning_level=0']) + +assert(get_option('default_library') == 'both', 'Should inherit parent project default_library') +assert(get_option('warning_level') == '0') + +# Check it build both by calling a method only both_libraries target implement +lib = library('lib1', 'foo.c') +lib.get_static_lib() diff --git a/test cases/common/223 persubproject options/subprojects/sub2/foo.c b/test cases/common/223 persubproject options/subprojects/sub2/foo.c new file mode 100644 index 0000000..cf7201b --- /dev/null +++ b/test cases/common/223 persubproject options/subprojects/sub2/foo.c @@ -0,0 +1,9 @@ +int foo(void); + +#ifdef __GNUC__ +#warning This should not produce error +#endif + +int foo(void) { + return 0; +} diff --git a/test cases/common/223 persubproject options/subprojects/sub2/meson.build b/test cases/common/223 persubproject options/subprojects/sub2/meson.build new file mode 100644 index 0000000..f1226b8 --- /dev/null +++ b/test cases/common/223 persubproject options/subprojects/sub2/meson.build @@ -0,0 +1,10 @@ +project('sub2', 'c', + default_options : ['default_library=shared', + 'werror=false']) + +assert(get_option('default_library') == 'static', 'Parent should override default_library') +assert(not get_option('werror')) + +# If it doesn't build only a static library, it would make target name clash. +library('lib1', 'foo.c') +shared_library('lib1', 'foo.c') diff --git a/test cases/common/224 arithmetic operators/meson.build b/test cases/common/224 arithmetic operators/meson.build new file mode 100644 index 0000000..a904bd0 --- /dev/null +++ b/test cases/common/224 arithmetic operators/meson.build @@ -0,0 +1,8 @@ +project('arithmetic operators') +assert(5 - 3 - 1 == 1) +assert(5 - (3 - 1) == 3) +assert(5 - 1 * 3 - 3 == -1) +assert(420 - 300 - 51 == 69) +assert(1000 / 2 / 2 / 2 == 125) +assert(4 * 9 / 3 % 8 - 3 - 10 / 2 == -4) +assert(94 - 30 + (2 - (40 - 6 + 7) - 9) - 10 == 6) diff --git a/test cases/common/224 persubproject options/foo.c b/test cases/common/224 persubproject options/foo.c deleted file mode 100644 index 63e4de6..0000000 --- a/test cases/common/224 persubproject options/foo.c +++ /dev/null @@ -1,5 +0,0 @@ -int foo(void); - -int foo(void) { - return 0; -} diff --git a/test cases/common/224 persubproject options/meson.build b/test cases/common/224 persubproject options/meson.build deleted file mode 100644 index f76a70c..0000000 --- a/test cases/common/224 persubproject options/meson.build +++ /dev/null @@ -1,15 +0,0 @@ -project('persubproject options', 'c', - default_options : ['default_library=both', - 'werror=true', - 'warning_level=3']) - -assert(get_option('default_library') == 'both', 'Parent default_library should be "both"') -assert(get_option('werror')) -assert(get_option('warning_level') == '3') - -# Check it build both by calling a method only both_libraries target implement -lib = library('lib1', 'foo.c') -lib.get_static_lib() - -subproject('sub1') -subproject('sub2', default_options : ['default_library=static']) diff --git a/test cases/common/224 persubproject options/subprojects/sub1/foo.c b/test cases/common/224 persubproject options/subprojects/sub1/foo.c deleted file mode 100644 index 82ad2c2..0000000 --- a/test cases/common/224 persubproject options/subprojects/sub1/foo.c +++ /dev/null @@ -1,8 +0,0 @@ -int foo(void); - -int foo(void) { - /* This is built with -Werror, it would error if warning_level=3 was inherited - * from main project and not overridden by this subproject's default_options. */ - int x; - return 0; -} diff --git a/test cases/common/224 persubproject options/subprojects/sub1/meson.build b/test cases/common/224 persubproject options/subprojects/sub1/meson.build deleted file mode 100644 index 4e4bc1b..0000000 --- a/test cases/common/224 persubproject options/subprojects/sub1/meson.build +++ /dev/null @@ -1,9 +0,0 @@ -project('sub1', 'c', - default_options : ['warning_level=0']) - -assert(get_option('default_library') == 'both', 'Should inherit parent project default_library') -assert(get_option('warning_level') == '0') - -# Check it build both by calling a method only both_libraries target implement -lib = library('lib1', 'foo.c') -lib.get_static_lib() diff --git a/test cases/common/224 persubproject options/subprojects/sub2/foo.c b/test cases/common/224 persubproject options/subprojects/sub2/foo.c deleted file mode 100644 index cf7201b..0000000 --- a/test cases/common/224 persubproject options/subprojects/sub2/foo.c +++ /dev/null @@ -1,9 +0,0 @@ -int foo(void); - -#ifdef __GNUC__ -#warning This should not produce error -#endif - -int foo(void) { - return 0; -} diff --git a/test cases/common/224 persubproject options/subprojects/sub2/meson.build b/test cases/common/224 persubproject options/subprojects/sub2/meson.build deleted file mode 100644 index f1226b8..0000000 --- a/test cases/common/224 persubproject options/subprojects/sub2/meson.build +++ /dev/null @@ -1,10 +0,0 @@ -project('sub2', 'c', - default_options : ['default_library=shared', - 'werror=false']) - -assert(get_option('default_library') == 'static', 'Parent should override default_library') -assert(not get_option('werror')) - -# If it doesn't build only a static library, it would make target name clash. -library('lib1', 'foo.c') -shared_library('lib1', 'foo.c') diff --git a/test cases/common/225 arithmetic operators/meson.build b/test cases/common/225 arithmetic operators/meson.build deleted file mode 100644 index a904bd0..0000000 --- a/test cases/common/225 arithmetic operators/meson.build +++ /dev/null @@ -1,8 +0,0 @@ -project('arithmetic operators') -assert(5 - 3 - 1 == 1) -assert(5 - (3 - 1) == 3) -assert(5 - 1 * 3 - 3 == -1) -assert(420 - 300 - 51 == 69) -assert(1000 / 2 / 2 / 2 == 125) -assert(4 * 9 / 3 % 8 - 3 - 10 / 2 == -4) -assert(94 - 30 + (2 - (40 - 6 + 7) - 9) - 10 == 6) diff --git a/test cases/common/225 link language/c_linkage.cpp b/test cases/common/225 link language/c_linkage.cpp new file mode 100644 index 0000000..dc006b9 --- /dev/null +++ b/test cases/common/225 link language/c_linkage.cpp @@ -0,0 +1,5 @@ +extern "C" { + int makeInt(void) { + return 0; + } +} diff --git a/test cases/common/225 link language/c_linkage.h b/test cases/common/225 link language/c_linkage.h new file mode 100644 index 0000000..1609f47 --- /dev/null +++ b/test cases/common/225 link language/c_linkage.h @@ -0,0 +1,10 @@ + +#ifdef __cplusplus +extern "C" { +#endif + +int makeInt(void); + +#ifdef __cplusplus +} +#endif diff --git a/test cases/common/225 link language/lib.cpp b/test cases/common/225 link language/lib.cpp new file mode 100644 index 0000000..ab43828 --- /dev/null +++ b/test cases/common/225 link language/lib.cpp @@ -0,0 +1,5 @@ +extern "C" { + int makeInt(void) { + return 1; + } +} diff --git a/test cases/common/225 link language/main.c b/test cases/common/225 link language/main.c new file mode 100644 index 0000000..5a167e7 --- /dev/null +++ b/test cases/common/225 link language/main.c @@ -0,0 +1,5 @@ +#include "c_linkage.h" + +int main(void) { + return makeInt(); +} diff --git a/test cases/common/225 link language/meson.build b/test cases/common/225 link language/meson.build new file mode 100644 index 0000000..f9af6cd --- /dev/null +++ b/test cases/common/225 link language/meson.build @@ -0,0 +1,18 @@ +project( + 'link_language', + ['c', 'cpp'], +) + +exe = executable( + 'main', + ['main.c', 'c_linkage.cpp'], + link_language : 'c', +) + +lib = library( + 'mylib', + ['lib.cpp'], + link_language : 'c', +) + +test('main', exe) diff --git a/test cases/common/226 link depends indexed custom target/check_arch.py b/test cases/common/226 link depends indexed custom target/check_arch.py new file mode 100644 index 0000000..927bf87 --- /dev/null +++ b/test cases/common/226 link depends indexed custom target/check_arch.py @@ -0,0 +1,32 @@ +#!/usr/bin/env python3 + +import re +import sys +import shutil +import subprocess + +exepath = sys.argv[1] +want_arch = sys.argv[2] +dummy_output = sys.argv[3] + +with open(dummy_output, 'w') as f: + f.write('') + +if not shutil.which('dumpbin'): + print('dumpbin not found, skipping') + sys.exit(0) + +out = subprocess.check_output(['dumpbin', '/HEADERS', exepath], + universal_newlines=True) +for line in out.split('\n'): + m = re.match(r'.* machine \(([A-Za-z0-9]+)\)$', line) + if m: + arch = m.groups()[0].lower() + +if arch == 'arm64': + arch = 'aarch64' +elif arch == 'x64': + arch = 'x86_64' + +if arch != want_arch: + raise RuntimeError(f'Wanted arch {want_arch} but exe uses {arch}') diff --git a/test cases/common/226 link depends indexed custom target/foo.c b/test cases/common/226 link depends indexed custom target/foo.c new file mode 100644 index 0000000..58c86a6 --- /dev/null +++ b/test cases/common/226 link depends indexed custom target/foo.c @@ -0,0 +1,15 @@ +#include + +int main(void) { + 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/226 link depends indexed custom target/make_file.py b/test cases/common/226 link depends indexed custom target/make_file.py new file mode 100644 index 0000000..6a43b7d --- /dev/null +++ b/test cases/common/226 link depends indexed custom target/make_file.py @@ -0,0 +1,8 @@ +#!/usr/bin/env python3 +import sys + +with open(sys.argv[1], 'w') as f: + print('# this file does nothing', file=f) + +with open(sys.argv[2], 'w') as f: + print('# this file does nothing', file=f) diff --git a/test cases/common/226 link depends indexed custom target/meson.build b/test cases/common/226 link depends indexed custom target/meson.build new file mode 100644 index 0000000..c41c4c1 --- /dev/null +++ b/test cases/common/226 link depends indexed custom target/meson.build @@ -0,0 +1,25 @@ +project('link_depends_indexed_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_files = custom_target('gen_dep', + command: [cmd, '@OUTPUT@'], + output: ['dep_file1', 'dep_file2']) + +exe = executable('foo', 'foo.c', + link_depends: dep_files[1], + c_args: ['-DDEPFILE="' + dep_files[0].full_path()+ '"']) + +check_arch = find_program('check_arch.py') +custom_target('check-arch', + command: [check_arch, exe, host_machine.cpu_family(), '@OUTPUT@'], + build_by_default: true, + output: 'dummy.txt') + +# check that dep_file1 exists, which means that link_depends target ran +test('runtest', exe) diff --git a/test cases/common/226 link language/c_linkage.cpp b/test cases/common/226 link language/c_linkage.cpp deleted file mode 100644 index dc006b9..0000000 --- a/test cases/common/226 link language/c_linkage.cpp +++ /dev/null @@ -1,5 +0,0 @@ -extern "C" { - int makeInt(void) { - return 0; - } -} diff --git a/test cases/common/226 link language/c_linkage.h b/test cases/common/226 link language/c_linkage.h deleted file mode 100644 index 1609f47..0000000 --- a/test cases/common/226 link language/c_linkage.h +++ /dev/null @@ -1,10 +0,0 @@ - -#ifdef __cplusplus -extern "C" { -#endif - -int makeInt(void); - -#ifdef __cplusplus -} -#endif diff --git a/test cases/common/226 link language/lib.cpp b/test cases/common/226 link language/lib.cpp deleted file mode 100644 index ab43828..0000000 --- a/test cases/common/226 link language/lib.cpp +++ /dev/null @@ -1,5 +0,0 @@ -extern "C" { - int makeInt(void) { - return 1; - } -} diff --git a/test cases/common/226 link language/main.c b/test cases/common/226 link language/main.c deleted file mode 100644 index 5a167e7..0000000 --- a/test cases/common/226 link language/main.c +++ /dev/null @@ -1,5 +0,0 @@ -#include "c_linkage.h" - -int main(void) { - return makeInt(); -} diff --git a/test cases/common/226 link language/meson.build b/test cases/common/226 link language/meson.build deleted file mode 100644 index f9af6cd..0000000 --- a/test cases/common/226 link language/meson.build +++ /dev/null @@ -1,18 +0,0 @@ -project( - 'link_language', - ['c', 'cpp'], -) - -exe = executable( - 'main', - ['main.c', 'c_linkage.cpp'], - link_language : 'c', -) - -lib = library( - 'mylib', - ['lib.cpp'], - link_language : 'c', -) - -test('main', exe) diff --git a/test cases/common/227 link depends indexed custom target/check_arch.py b/test cases/common/227 link depends indexed custom target/check_arch.py deleted file mode 100644 index 927bf87..0000000 --- a/test cases/common/227 link depends indexed custom target/check_arch.py +++ /dev/null @@ -1,32 +0,0 @@ -#!/usr/bin/env python3 - -import re -import sys -import shutil -import subprocess - -exepath = sys.argv[1] -want_arch = sys.argv[2] -dummy_output = sys.argv[3] - -with open(dummy_output, 'w') as f: - f.write('') - -if not shutil.which('dumpbin'): - print('dumpbin not found, skipping') - sys.exit(0) - -out = subprocess.check_output(['dumpbin', '/HEADERS', exepath], - universal_newlines=True) -for line in out.split('\n'): - m = re.match(r'.* machine \(([A-Za-z0-9]+)\)$', line) - if m: - arch = m.groups()[0].lower() - -if arch == 'arm64': - arch = 'aarch64' -elif arch == 'x64': - arch = 'x86_64' - -if arch != want_arch: - raise RuntimeError(f'Wanted arch {want_arch} but exe uses {arch}') diff --git a/test cases/common/227 link depends indexed custom target/foo.c b/test cases/common/227 link depends indexed custom target/foo.c deleted file mode 100644 index 58c86a6..0000000 --- a/test cases/common/227 link depends indexed custom target/foo.c +++ /dev/null @@ -1,15 +0,0 @@ -#include - -int main(void) { - 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/227 link depends indexed custom target/make_file.py b/test cases/common/227 link depends indexed custom target/make_file.py deleted file mode 100644 index 6a43b7d..0000000 --- a/test cases/common/227 link depends indexed custom target/make_file.py +++ /dev/null @@ -1,8 +0,0 @@ -#!/usr/bin/env python3 -import sys - -with open(sys.argv[1], 'w') as f: - print('# this file does nothing', file=f) - -with open(sys.argv[2], 'w') as f: - print('# this file does nothing', file=f) diff --git a/test cases/common/227 link depends indexed custom target/meson.build b/test cases/common/227 link depends indexed custom target/meson.build deleted file mode 100644 index c41c4c1..0000000 --- a/test cases/common/227 link depends indexed custom target/meson.build +++ /dev/null @@ -1,25 +0,0 @@ -project('link_depends_indexed_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_files = custom_target('gen_dep', - command: [cmd, '@OUTPUT@'], - output: ['dep_file1', 'dep_file2']) - -exe = executable('foo', 'foo.c', - link_depends: dep_files[1], - c_args: ['-DDEPFILE="' + dep_files[0].full_path()+ '"']) - -check_arch = find_program('check_arch.py') -custom_target('check-arch', - command: [check_arch, exe, host_machine.cpu_family(), '@OUTPUT@'], - build_by_default: true, - output: 'dummy.txt') - -# check that dep_file1 exists, which means that link_depends target ran -test('runtest', exe) diff --git a/test cases/common/227 very long commmand line/codegen.py b/test cases/common/227 very long commmand line/codegen.py new file mode 100755 index 0000000..b1de607 --- /dev/null +++ b/test cases/common/227 very long commmand line/codegen.py @@ -0,0 +1,7 @@ +#!/usr/bin/env python3 + +import sys +from pathlib import Path + +Path(sys.argv[2]).write_text( + 'int func{n}(void) {{ return {n}; }}'.format(n=sys.argv[1])) diff --git a/test cases/common/227 very long commmand line/main.c b/test cases/common/227 very long commmand line/main.c new file mode 100644 index 0000000..78f2de1 --- /dev/null +++ b/test cases/common/227 very long commmand line/main.c @@ -0,0 +1 @@ +int main(void) { return 0; } diff --git a/test cases/common/227 very long commmand line/meson.build b/test cases/common/227 very long commmand line/meson.build new file mode 100644 index 0000000..70058e6 --- /dev/null +++ b/test cases/common/227 very long commmand line/meson.build @@ -0,0 +1,49 @@ +project('very long command lines', 'c') + +# Get the current system's commandline length limit. +if build_machine.system() == 'windows' + # Various limits on windows: + # cmd.exe: 8kb + # CreateProcess: 32kb + limit = 32767 + # NOTE: filename limit is 260 characters unless + # 1. Python >= 3.6 is being used + # 2. Windows 10 registry has been edited to enable long pathnaems + # ninja backend uses absolute filenames, so we ensure they don't exceed 260. +elif build_machine.system() == 'cygwin' + # cygwin-to-win32: see above + # cygwin-to-cygwin: no limit? + # Cygwin is slow, so only test it lightly here. + limit = 8192 +else + # ninja passes whole line as a single argument, for which + # the limit is 128k as of Linux 2.6.23. See MAX_ARG_STRLEN. + # BSD seems similar, see https://www.in-ulm.de/~mascheck/various/argmax + limit = 131072 +endif +# Now exceed that limit, but not so far that the test takes too long. +namelen = 260 +nfiles = 50 + limit / namelen +message('Expected link commandline length is approximately ' + '@0@'.format((nfiles * (namelen+28)))) + +seq = run_command('name_gen.py', nfiles.to_string(), meson.build_root()).stdout().strip().split('\n') + +sources = [] +codegen = find_program('codegen.py') + +i=0 +foreach name : seq + sources += custom_target('codegen' + i.to_string(), + command: [codegen, i.to_string(), '@OUTPUT@'], + output: name + '.c') + i+=1 +endforeach + +shared_library('sharedlib', sources) +static_library('staticlib', sources) +executable('app', 'main.c', sources) + +# Also test short commandlines to make sure that doesn't regress +shared_library('sharedlib0', sources[0]) +static_library('staticlib0', sources[0]) +executable('app0', 'main.c', sources[0]) diff --git a/test cases/common/227 very long commmand line/name_gen.py b/test cases/common/227 very long commmand line/name_gen.py new file mode 100755 index 0000000..8435298 --- /dev/null +++ b/test cases/common/227 very long commmand line/name_gen.py @@ -0,0 +1,23 @@ +#!/usr/bin/env python3 +""" +generate sequence of filename that does not exceed MAX_LEN=260 +for Python < 3.6 and Windows without modified registry +""" + +import sys +import string + +name_len = 260 - len(sys.argv[2]) - 4 - 39 - 4 - 2 +if name_len < 1: + raise ValueError('The meson build directory pathname is so long ' + 'that we cannot generate filenames within 260 characters.') +# leave room for suffix and file separators, and meson generated text +# e.g. ".c.obj.d" and other decorators added by Meson at configuration +# for intermediate files + +base = string.ascii_letters * 5 # 260 characters +max_num_len = len(str(sys.argv[1])) +base = base[: name_len - max_num_len] + +for i in range(int(sys.argv[1])): + print("{base}{i:0{max_num_len}d}".format(base=base, max_num_len=max_num_len, i=i)) diff --git a/test cases/common/228 custom_target source/a b/test cases/common/228 custom_target source/a new file mode 100644 index 0000000..e69de29 diff --git a/test cases/common/228 custom_target source/meson.build b/test cases/common/228 custom_target source/meson.build new file mode 100644 index 0000000..98b9d26 --- /dev/null +++ b/test cases/common/228 custom_target source/meson.build @@ -0,0 +1,5 @@ +project('a', ['c']) + +x = find_program('x.py') +outs = custom_target('foo', output: ['x.c', 'y'], input: 'a', command: [x]) +executable('testprog', outs[0]) diff --git a/test cases/common/228 custom_target source/x.py b/test cases/common/228 custom_target source/x.py new file mode 100644 index 0000000..12f40c8 --- /dev/null +++ b/test cases/common/228 custom_target source/x.py @@ -0,0 +1,5 @@ +#! /usr/bin/env python3 +with open('x.c', 'w') as f: + print('int main(void) { return 0; }', file=f) +with open('y', 'w'): + pass diff --git a/test cases/common/228 very long commmand line/codegen.py b/test cases/common/228 very long commmand line/codegen.py deleted file mode 100755 index b1de607..0000000 --- a/test cases/common/228 very long commmand line/codegen.py +++ /dev/null @@ -1,7 +0,0 @@ -#!/usr/bin/env python3 - -import sys -from pathlib import Path - -Path(sys.argv[2]).write_text( - 'int func{n}(void) {{ return {n}; }}'.format(n=sys.argv[1])) diff --git a/test cases/common/228 very long commmand line/main.c b/test cases/common/228 very long commmand line/main.c deleted file mode 100644 index 78f2de1..0000000 --- a/test cases/common/228 very long commmand line/main.c +++ /dev/null @@ -1 +0,0 @@ -int main(void) { return 0; } diff --git a/test cases/common/228 very long commmand line/meson.build b/test cases/common/228 very long commmand line/meson.build deleted file mode 100644 index 70058e6..0000000 --- a/test cases/common/228 very long commmand line/meson.build +++ /dev/null @@ -1,49 +0,0 @@ -project('very long command lines', 'c') - -# Get the current system's commandline length limit. -if build_machine.system() == 'windows' - # Various limits on windows: - # cmd.exe: 8kb - # CreateProcess: 32kb - limit = 32767 - # NOTE: filename limit is 260 characters unless - # 1. Python >= 3.6 is being used - # 2. Windows 10 registry has been edited to enable long pathnaems - # ninja backend uses absolute filenames, so we ensure they don't exceed 260. -elif build_machine.system() == 'cygwin' - # cygwin-to-win32: see above - # cygwin-to-cygwin: no limit? - # Cygwin is slow, so only test it lightly here. - limit = 8192 -else - # ninja passes whole line as a single argument, for which - # the limit is 128k as of Linux 2.6.23. See MAX_ARG_STRLEN. - # BSD seems similar, see https://www.in-ulm.de/~mascheck/various/argmax - limit = 131072 -endif -# Now exceed that limit, but not so far that the test takes too long. -namelen = 260 -nfiles = 50 + limit / namelen -message('Expected link commandline length is approximately ' + '@0@'.format((nfiles * (namelen+28)))) - -seq = run_command('name_gen.py', nfiles.to_string(), meson.build_root()).stdout().strip().split('\n') - -sources = [] -codegen = find_program('codegen.py') - -i=0 -foreach name : seq - sources += custom_target('codegen' + i.to_string(), - command: [codegen, i.to_string(), '@OUTPUT@'], - output: name + '.c') - i+=1 -endforeach - -shared_library('sharedlib', sources) -static_library('staticlib', sources) -executable('app', 'main.c', sources) - -# Also test short commandlines to make sure that doesn't regress -shared_library('sharedlib0', sources[0]) -static_library('staticlib0', sources[0]) -executable('app0', 'main.c', sources[0]) diff --git a/test cases/common/228 very long commmand line/name_gen.py b/test cases/common/228 very long commmand line/name_gen.py deleted file mode 100755 index 8435298..0000000 --- a/test cases/common/228 very long commmand line/name_gen.py +++ /dev/null @@ -1,23 +0,0 @@ -#!/usr/bin/env python3 -""" -generate sequence of filename that does not exceed MAX_LEN=260 -for Python < 3.6 and Windows without modified registry -""" - -import sys -import string - -name_len = 260 - len(sys.argv[2]) - 4 - 39 - 4 - 2 -if name_len < 1: - raise ValueError('The meson build directory pathname is so long ' - 'that we cannot generate filenames within 260 characters.') -# leave room for suffix and file separators, and meson generated text -# e.g. ".c.obj.d" and other decorators added by Meson at configuration -# for intermediate files - -base = string.ascii_letters * 5 # 260 characters -max_num_len = len(str(sys.argv[1])) -base = base[: name_len - max_num_len] - -for i in range(int(sys.argv[1])): - print("{base}{i:0{max_num_len}d}".format(base=base, max_num_len=max_num_len, i=i)) diff --git a/test cases/common/229 custom_target source/a b/test cases/common/229 custom_target source/a deleted file mode 100644 index e69de29..0000000 diff --git a/test cases/common/229 custom_target source/meson.build b/test cases/common/229 custom_target source/meson.build deleted file mode 100644 index 98b9d26..0000000 --- a/test cases/common/229 custom_target source/meson.build +++ /dev/null @@ -1,5 +0,0 @@ -project('a', ['c']) - -x = find_program('x.py') -outs = custom_target('foo', output: ['x.c', 'y'], input: 'a', command: [x]) -executable('testprog', outs[0]) diff --git a/test cases/common/229 custom_target source/x.py b/test cases/common/229 custom_target source/x.py deleted file mode 100644 index 12f40c8..0000000 --- a/test cases/common/229 custom_target source/x.py +++ /dev/null @@ -1,5 +0,0 @@ -#! /usr/bin/env python3 -with open('x.c', 'w') as f: - print('int main(void) { return 0; }', file=f) -with open('y', 'w'): - pass diff --git a/test cases/common/229 disabler array addition/meson.build b/test cases/common/229 disabler array addition/meson.build new file mode 100644 index 0000000..231f76a --- /dev/null +++ b/test cases/common/229 disabler array addition/meson.build @@ -0,0 +1,9 @@ +project('disabler_inside_array', 'c') + +exes = [] + +exes += library('a', 'test.c') + +exes += library('b', 'test.c', dependencies : disabler()) + +exes += library('c', 'test.c') diff --git a/test cases/common/229 disabler array addition/test.c b/test cases/common/229 disabler array addition/test.c new file mode 100644 index 0000000..e9a7aac --- /dev/null +++ b/test cases/common/229 disabler array addition/test.c @@ -0,0 +1 @@ +int stub(void) { return 0; } diff --git a/test cases/common/23 endian/meson.build b/test cases/common/23 endian/meson.build new file mode 100644 index 0000000..80186fe --- /dev/null +++ b/test cases/common/23 endian/meson.build @@ -0,0 +1,7 @@ +project('endian check', 'c') + +if host_machine.endian() == 'big' + add_global_arguments('-DIS_BE', language : 'c') +endif + +test('endiantest', executable('prog', 'prog.c')) diff --git a/test cases/common/23 endian/prog.c b/test cases/common/23 endian/prog.c new file mode 100644 index 0000000..90bd958 --- /dev/null +++ b/test cases/common/23 endian/prog.c @@ -0,0 +1,24 @@ +#include + +int is_big_endian(void) { + uint32_t one = 1; + if(*((uint8_t*) &one) == 1) + return 0; + return 1; +} + + +int main(void) { + int is_be_check = is_big_endian(); + int is_be; +#ifdef IS_BE + is_be = 1; +#else + is_be = 0; +#endif + if(is_be_check && is_be) + return 0; + if(!is_be_check && !is_be) + return 0; + return 1; +} diff --git a/test cases/common/23 object extraction/lib.c b/test cases/common/23 object extraction/lib.c deleted file mode 100644 index 8180551..0000000 --- a/test cases/common/23 object extraction/lib.c +++ /dev/null @@ -1,3 +0,0 @@ -int func(void) { - return 42; -} diff --git a/test cases/common/23 object extraction/lib2.c b/test cases/common/23 object extraction/lib2.c deleted file mode 100644 index 5020593..0000000 --- a/test cases/common/23 object extraction/lib2.c +++ /dev/null @@ -1,3 +0,0 @@ -int retval(void) { - return 43; -} diff --git a/test cases/common/23 object extraction/main.c b/test cases/common/23 object extraction/main.c deleted file mode 100644 index 27162c5..0000000 --- a/test cases/common/23 object extraction/main.c +++ /dev/null @@ -1,5 +0,0 @@ -int func(void); - -int main(void) { - return func() == 42 ? 0 : 1; -} diff --git a/test cases/common/23 object extraction/meson.build b/test cases/common/23 object extraction/meson.build deleted file mode 100644 index 18be1db..0000000 --- a/test cases/common/23 object extraction/meson.build +++ /dev/null @@ -1,23 +0,0 @@ -project('object extraction', 'c') - -if meson.is_unity() - message('Skipping extraction test because this is a Unity build.') -else - lib1 = shared_library('somelib', 'src/lib.c') - lib2 = shared_library('somelib2', 'lib.c', 'lib2.c') - - obj1 = lib1.extract_objects('src/lib.c') - obj2 = lib2.extract_objects(['lib.c']) - obj3 = lib2.extract_objects(files('lib.c')) - obj4 = lib2.extract_objects(['lib.c', 'lib.c']) - - e1 = executable('main1', 'main.c', objects : obj1) - e2 = executable('main2', 'main.c', objects : obj2) - e3 = executable('main3', 'main.c', objects : obj3) - e4 = executable('main4', 'main.c', objects : obj4) - - test('extraction test 1', e1) - test('extraction test 2', e2) - test('extraction test 3', e3) - test('extraction test 4', e4) -endif diff --git a/test cases/common/23 object extraction/src/lib.c b/test cases/common/23 object extraction/src/lib.c deleted file mode 100644 index 8180551..0000000 --- a/test cases/common/23 object extraction/src/lib.c +++ /dev/null @@ -1,3 +0,0 @@ -int func(void) { - return 42; -} diff --git a/test cases/common/230 disabler array addition/meson.build b/test cases/common/230 disabler array addition/meson.build deleted file mode 100644 index 231f76a..0000000 --- a/test cases/common/230 disabler array addition/meson.build +++ /dev/null @@ -1,9 +0,0 @@ -project('disabler_inside_array', 'c') - -exes = [] - -exes += library('a', 'test.c') - -exes += library('b', 'test.c', dependencies : disabler()) - -exes += library('c', 'test.c') diff --git a/test cases/common/230 disabler array addition/test.c b/test cases/common/230 disabler array addition/test.c deleted file mode 100644 index e9a7aac..0000000 --- a/test cases/common/230 disabler array addition/test.c +++ /dev/null @@ -1 +0,0 @@ -int stub(void) { return 0; } diff --git a/test cases/common/230 external project/app.c b/test cases/common/230 external project/app.c new file mode 100644 index 0000000..166f007 --- /dev/null +++ b/test cases/common/230 external project/app.c @@ -0,0 +1,7 @@ +#include + +int main(void) +{ + return call_foo() == 42 ? 0 : 1; +} + diff --git a/test cases/common/230 external project/func.c b/test cases/common/230 external project/func.c new file mode 100644 index 0000000..5e8f933 --- /dev/null +++ b/test cases/common/230 external project/func.c @@ -0,0 +1,7 @@ +#include "func.h" + +int func(void) +{ + return 1; +} + diff --git a/test cases/common/230 external project/func.h b/test cases/common/230 external project/func.h new file mode 100644 index 0000000..340b82a --- /dev/null +++ b/test cases/common/230 external project/func.h @@ -0,0 +1 @@ +int func(void); diff --git a/test cases/common/230 external project/libfoo/configure b/test cases/common/230 external project/libfoo/configure new file mode 100755 index 0000000..0e4aa72 --- /dev/null +++ b/test cases/common/230 external project/libfoo/configure @@ -0,0 +1,44 @@ +#! /bin/sh + +srcdir=$(dirname "$0") + +for i in "$@" +do +case $i in + --prefix=*) + PREFIX="${i#*=}" + shift + ;; + --libdir=*) + LIBDIR="${i#*=}" + shift + ;; + --includedir=*) + INCDIR="${i#*=}" + shift + ;; + --libext=*) + LIBEXT="${i#*=}" + shift + ;; + *) + shift + ;; +esac +done + +DEP_ARGS=$(pkg-config --cflags --libs somelib) + +cat > Makefile << EOL +all: libfoo.$LIBEXT + +libfoo.$LIBEXT: + $CC "$srcdir/libfoo.c" -shared -fPIC $DEP_ARGS -o \$@ + +install: libfoo.$LIBEXT + mkdir -p "\$(DESTDIR)$LIBDIR"; + mkdir -p "\$(DESTDIR)$LIBDIR/pkgconfig"; + mkdir -p "\$(DESTDIR)$INCDIR"; + cp \$< "\$(DESTDIR)$LIBDIR"; + cp "$srcdir/libfoo.h" "\$(DESTDIR)$INCDIR"; +EOL diff --git a/test cases/common/230 external project/libfoo/libfoo.c b/test cases/common/230 external project/libfoo/libfoo.c new file mode 100644 index 0000000..3f62282 --- /dev/null +++ b/test cases/common/230 external project/libfoo/libfoo.c @@ -0,0 +1,8 @@ +#include "libfoo.h" + +int func(void); + +int call_foo() +{ + return func() == 1 ? 42 : 0; +} diff --git a/test cases/common/230 external project/libfoo/libfoo.h b/test cases/common/230 external project/libfoo/libfoo.h new file mode 100644 index 0000000..8981f18 --- /dev/null +++ b/test cases/common/230 external project/libfoo/libfoo.h @@ -0,0 +1,3 @@ +#pragma once + +int call_foo(void); diff --git a/test cases/common/230 external project/libfoo/meson.build b/test cases/common/230 external project/libfoo/meson.build new file mode 100644 index 0000000..941e13f --- /dev/null +++ b/test cases/common/230 external project/libfoo/meson.build @@ -0,0 +1,22 @@ +mod = import('unstable_external_project') + +target_system = target_machine.system() +if target_system in ['windows', 'cygwin'] + libext = 'dll' +elif target_system == 'darwin' + libext = 'dylib' +else + libext = 'so' +endif + +p = mod.add_project('configure', + configure_options : [ + '--prefix=@PREFIX@', + '--libdir=@PREFIX@/@LIBDIR@', + '--includedir=@PREFIX@/@INCLUDEDIR@', + '--libext=' + libext, + ], +) + +libfoo_dep = declare_dependency(link_with : somelib, + dependencies : p.dependency('foo')) diff --git a/test cases/common/230 external project/meson.build b/test cases/common/230 external project/meson.build new file mode 100644 index 0000000..d1ed797 --- /dev/null +++ b/test cases/common/230 external project/meson.build @@ -0,0 +1,27 @@ +project('test external project', 'c') + +if not find_program('pkg-config', required: false).found() + error('MESON_SKIP_TEST: pkg-config not found') +endif + +if not find_program('make', required : false).found() + error('MESON_SKIP_TEST: make not found') +endif + +if host_machine.system() == 'windows' + error('MESON_SKIP_TEST: The fake configure script is too dumb to work on Windows') +endif + +if meson.is_cross_build() + # CI uses PKG_CONFIG_SYSROOT_DIR which breaks -uninstalled.pc usage. + error('MESON_SKIP_TEST: Cross build support is too limited for this test') +endif + +pkg = import('pkgconfig') + +somelib = library('somelib', 'func.c') +pkg.generate(somelib) + +subdir('libfoo') + +executable('test-find-library', 'app.c', dependencies : libfoo_dep) diff --git a/test cases/common/230 external project/test.json b/test cases/common/230 external project/test.json new file mode 100644 index 0000000..4888e87 --- /dev/null +++ b/test cases/common/230 external project/test.json @@ -0,0 +1,7 @@ +{ + "installed": [ + { "type": "shared_lib", "file": "usr/lib/foo" }, + { "type": "file", "file": "usr/include/libfoo.h" }, + { "type": "file", "file": "usr/lib/pkgconfig/somelib.pc" } + ] +} diff --git a/test cases/common/231 external project/app.c b/test cases/common/231 external project/app.c deleted file mode 100644 index 166f007..0000000 --- a/test cases/common/231 external project/app.c +++ /dev/null @@ -1,7 +0,0 @@ -#include - -int main(void) -{ - return call_foo() == 42 ? 0 : 1; -} - diff --git a/test cases/common/231 external project/func.c b/test cases/common/231 external project/func.c deleted file mode 100644 index 5e8f933..0000000 --- a/test cases/common/231 external project/func.c +++ /dev/null @@ -1,7 +0,0 @@ -#include "func.h" - -int func(void) -{ - return 1; -} - diff --git a/test cases/common/231 external project/func.h b/test cases/common/231 external project/func.h deleted file mode 100644 index 340b82a..0000000 --- a/test cases/common/231 external project/func.h +++ /dev/null @@ -1 +0,0 @@ -int func(void); diff --git a/test cases/common/231 external project/libfoo/configure b/test cases/common/231 external project/libfoo/configure deleted file mode 100755 index 0e4aa72..0000000 --- a/test cases/common/231 external project/libfoo/configure +++ /dev/null @@ -1,44 +0,0 @@ -#! /bin/sh - -srcdir=$(dirname "$0") - -for i in "$@" -do -case $i in - --prefix=*) - PREFIX="${i#*=}" - shift - ;; - --libdir=*) - LIBDIR="${i#*=}" - shift - ;; - --includedir=*) - INCDIR="${i#*=}" - shift - ;; - --libext=*) - LIBEXT="${i#*=}" - shift - ;; - *) - shift - ;; -esac -done - -DEP_ARGS=$(pkg-config --cflags --libs somelib) - -cat > Makefile << EOL -all: libfoo.$LIBEXT - -libfoo.$LIBEXT: - $CC "$srcdir/libfoo.c" -shared -fPIC $DEP_ARGS -o \$@ - -install: libfoo.$LIBEXT - mkdir -p "\$(DESTDIR)$LIBDIR"; - mkdir -p "\$(DESTDIR)$LIBDIR/pkgconfig"; - mkdir -p "\$(DESTDIR)$INCDIR"; - cp \$< "\$(DESTDIR)$LIBDIR"; - cp "$srcdir/libfoo.h" "\$(DESTDIR)$INCDIR"; -EOL diff --git a/test cases/common/231 external project/libfoo/libfoo.c b/test cases/common/231 external project/libfoo/libfoo.c deleted file mode 100644 index 3f62282..0000000 --- a/test cases/common/231 external project/libfoo/libfoo.c +++ /dev/null @@ -1,8 +0,0 @@ -#include "libfoo.h" - -int func(void); - -int call_foo() -{ - return func() == 1 ? 42 : 0; -} diff --git a/test cases/common/231 external project/libfoo/libfoo.h b/test cases/common/231 external project/libfoo/libfoo.h deleted file mode 100644 index 8981f18..0000000 --- a/test cases/common/231 external project/libfoo/libfoo.h +++ /dev/null @@ -1,3 +0,0 @@ -#pragma once - -int call_foo(void); diff --git a/test cases/common/231 external project/libfoo/meson.build b/test cases/common/231 external project/libfoo/meson.build deleted file mode 100644 index 941e13f..0000000 --- a/test cases/common/231 external project/libfoo/meson.build +++ /dev/null @@ -1,22 +0,0 @@ -mod = import('unstable_external_project') - -target_system = target_machine.system() -if target_system in ['windows', 'cygwin'] - libext = 'dll' -elif target_system == 'darwin' - libext = 'dylib' -else - libext = 'so' -endif - -p = mod.add_project('configure', - configure_options : [ - '--prefix=@PREFIX@', - '--libdir=@PREFIX@/@LIBDIR@', - '--includedir=@PREFIX@/@INCLUDEDIR@', - '--libext=' + libext, - ], -) - -libfoo_dep = declare_dependency(link_with : somelib, - dependencies : p.dependency('foo')) diff --git a/test cases/common/231 external project/meson.build b/test cases/common/231 external project/meson.build deleted file mode 100644 index d1ed797..0000000 --- a/test cases/common/231 external project/meson.build +++ /dev/null @@ -1,27 +0,0 @@ -project('test external project', 'c') - -if not find_program('pkg-config', required: false).found() - error('MESON_SKIP_TEST: pkg-config not found') -endif - -if not find_program('make', required : false).found() - error('MESON_SKIP_TEST: make not found') -endif - -if host_machine.system() == 'windows' - error('MESON_SKIP_TEST: The fake configure script is too dumb to work on Windows') -endif - -if meson.is_cross_build() - # CI uses PKG_CONFIG_SYSROOT_DIR which breaks -uninstalled.pc usage. - error('MESON_SKIP_TEST: Cross build support is too limited for this test') -endif - -pkg = import('pkgconfig') - -somelib = library('somelib', 'func.c') -pkg.generate(somelib) - -subdir('libfoo') - -executable('test-find-library', 'app.c', dependencies : libfoo_dep) diff --git a/test cases/common/231 external project/test.json b/test cases/common/231 external project/test.json deleted file mode 100644 index 4888e87..0000000 --- a/test cases/common/231 external project/test.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "installed": [ - { "type": "shared_lib", "file": "usr/lib/foo" }, - { "type": "file", "file": "usr/include/libfoo.h" }, - { "type": "file", "file": "usr/lib/pkgconfig/somelib.pc" } - ] -} diff --git a/test cases/common/231 subdir files/meson.build b/test cases/common/231 subdir files/meson.build new file mode 100644 index 0000000..eb472f3 --- /dev/null +++ b/test cases/common/231 subdir files/meson.build @@ -0,0 +1,3 @@ +project('subdir files test', 'c') +subdir('subdir') +executable('prog', sources: subdir_sources) diff --git a/test cases/common/231 subdir files/subdir/meson.build b/test cases/common/231 subdir files/subdir/meson.build new file mode 100644 index 0000000..70909c7 --- /dev/null +++ b/test cases/common/231 subdir files/subdir/meson.build @@ -0,0 +1 @@ +subdir_sources = files(['prog.c']) diff --git a/test cases/common/231 subdir files/subdir/prog.c b/test cases/common/231 subdir files/subdir/prog.c new file mode 100644 index 0000000..78f2de1 --- /dev/null +++ b/test cases/common/231 subdir files/subdir/prog.c @@ -0,0 +1 @@ +int main(void) { return 0; } diff --git a/test cases/common/232 dependency allow_fallback/meson.build b/test cases/common/232 dependency allow_fallback/meson.build new file mode 100644 index 0000000..b189faf --- /dev/null +++ b/test cases/common/232 dependency allow_fallback/meson.build @@ -0,0 +1,12 @@ +project('subproject fallback', 'c') + +foob_dep = dependency('foob', allow_fallback: true, required: false) +assert(foob_dep.found()) + +# Careful! Once a submodule has been triggered and it has +# overridden the dependency, it sticks. +foob_dep = dependency('foob', allow_fallback: false, required: false) +assert(foob_dep.found()) + +foob3_dep = dependency('foob3', allow_fallback: false, required: false) +assert(not foob3_dep.found()) diff --git a/test cases/common/232 dependency allow_fallback/subprojects/foob/meson.build b/test cases/common/232 dependency allow_fallback/subprojects/foob/meson.build new file mode 100644 index 0000000..b2c4814 --- /dev/null +++ b/test cases/common/232 dependency allow_fallback/subprojects/foob/meson.build @@ -0,0 +1,2 @@ +project('foob', 'c') +meson.override_dependency('foob', declare_dependency()) diff --git a/test cases/common/232 dependency allow_fallback/subprojects/foob3/meson.build b/test cases/common/232 dependency allow_fallback/subprojects/foob3/meson.build new file mode 100644 index 0000000..9fdb188 --- /dev/null +++ b/test cases/common/232 dependency allow_fallback/subprojects/foob3/meson.build @@ -0,0 +1,2 @@ +project('foob3', 'c') +# Note that there is no override_dependency here diff --git a/test cases/common/232 subdir files/meson.build b/test cases/common/232 subdir files/meson.build deleted file mode 100644 index eb472f3..0000000 --- a/test cases/common/232 subdir files/meson.build +++ /dev/null @@ -1,3 +0,0 @@ -project('subdir files test', 'c') -subdir('subdir') -executable('prog', sources: subdir_sources) diff --git a/test cases/common/232 subdir files/subdir/meson.build b/test cases/common/232 subdir files/subdir/meson.build deleted file mode 100644 index 70909c7..0000000 --- a/test cases/common/232 subdir files/subdir/meson.build +++ /dev/null @@ -1 +0,0 @@ -subdir_sources = files(['prog.c']) diff --git a/test cases/common/232 subdir files/subdir/prog.c b/test cases/common/232 subdir files/subdir/prog.c deleted file mode 100644 index 78f2de1..0000000 --- a/test cases/common/232 subdir files/subdir/prog.c +++ /dev/null @@ -1 +0,0 @@ -int main(void) { return 0; } diff --git a/test cases/common/233 dependency allow_fallback/meson.build b/test cases/common/233 dependency allow_fallback/meson.build deleted file mode 100644 index b189faf..0000000 --- a/test cases/common/233 dependency allow_fallback/meson.build +++ /dev/null @@ -1,12 +0,0 @@ -project('subproject fallback', 'c') - -foob_dep = dependency('foob', allow_fallback: true, required: false) -assert(foob_dep.found()) - -# Careful! Once a submodule has been triggered and it has -# overridden the dependency, it sticks. -foob_dep = dependency('foob', allow_fallback: false, required: false) -assert(foob_dep.found()) - -foob3_dep = dependency('foob3', allow_fallback: false, required: false) -assert(not foob3_dep.found()) diff --git a/test cases/common/233 dependency allow_fallback/subprojects/foob/meson.build b/test cases/common/233 dependency allow_fallback/subprojects/foob/meson.build deleted file mode 100644 index b2c4814..0000000 --- a/test cases/common/233 dependency allow_fallback/subprojects/foob/meson.build +++ /dev/null @@ -1,2 +0,0 @@ -project('foob', 'c') -meson.override_dependency('foob', declare_dependency()) diff --git a/test cases/common/233 dependency allow_fallback/subprojects/foob3/meson.build b/test cases/common/233 dependency allow_fallback/subprojects/foob3/meson.build deleted file mode 100644 index 9fdb188..0000000 --- a/test cases/common/233 dependency allow_fallback/subprojects/foob3/meson.build +++ /dev/null @@ -1,2 +0,0 @@ -project('foob3', 'c') -# Note that there is no override_dependency here diff --git a/test cases/common/233 wrap case/meson.build b/test cases/common/233 wrap case/meson.build new file mode 100644 index 0000000..2b82bf3 --- /dev/null +++ b/test cases/common/233 wrap case/meson.build @@ -0,0 +1,6 @@ +project('CaSe DePenDenCy In Wrap', 'c') + +d = dependency('UP_down') + +e = executable('prog', 'prog.c', dependencies: d) +test('prog', e) diff --git a/test cases/common/233 wrap case/prog.c b/test cases/common/233 wrap case/prog.c new file mode 100644 index 0000000..5183dea --- /dev/null +++ b/test cases/common/233 wrap case/prog.c @@ -0,0 +1,13 @@ +#include +#include + +int main(int argc, char **argv) { + if(argc == 42) { + printf("Very sneaky, %s\n", argv[0]); + } +#ifdef UP_IS_DOWN + return 0; +#else + return 1; +#endif +} diff --git a/test cases/common/233 wrap case/subprojects/up_down.wrap b/test cases/common/233 wrap case/subprojects/up_down.wrap new file mode 100644 index 0000000..d66818f --- /dev/null +++ b/test cases/common/233 wrap case/subprojects/up_down.wrap @@ -0,0 +1,5 @@ +[wrap-file] +directory = up_down + +[provide] +UP_down = up_down_dep diff --git a/test cases/common/233 wrap case/subprojects/up_down/meson.build b/test cases/common/233 wrap case/subprojects/up_down/meson.build new file mode 100644 index 0000000..5db89d1 --- /dev/null +++ b/test cases/common/233 wrap case/subprojects/up_down/meson.build @@ -0,0 +1,3 @@ +project('up down', 'c') + +up_down_dep = declare_dependency(include_directories: '.') diff --git a/test cases/common/233 wrap case/subprojects/up_down/up_down.h b/test cases/common/233 wrap case/subprojects/up_down/up_down.h new file mode 100644 index 0000000..8d968ce --- /dev/null +++ b/test cases/common/233 wrap case/subprojects/up_down/up_down.h @@ -0,0 +1,3 @@ +#pragma once + +#define UP_IS_DOWN diff --git a/test cases/common/234 get_file_contents/.gitattributes b/test cases/common/234 get_file_contents/.gitattributes new file mode 100644 index 0000000..abec47d --- /dev/null +++ b/test cases/common/234 get_file_contents/.gitattributes @@ -0,0 +1 @@ +utf-16-text binary diff --git a/test cases/common/234 get_file_contents/VERSION b/test cases/common/234 get_file_contents/VERSION new file mode 100644 index 0000000..26aaba0 --- /dev/null +++ b/test cases/common/234 get_file_contents/VERSION @@ -0,0 +1 @@ +1.2.0 diff --git a/test cases/common/234 get_file_contents/meson.build b/test cases/common/234 get_file_contents/meson.build new file mode 100644 index 0000000..a8c68d6 --- /dev/null +++ b/test cases/common/234 get_file_contents/meson.build @@ -0,0 +1,21 @@ +project( + 'meson-fs-read-file', + [], + version: files('VERSION') +) +fs = import('fs') + +assert(fs.read('VERSION').strip() == meson.project_version(), 'file misread') + +expected = ( + '∮ E⋅da = Q, n → ∞, ∑ f(i) = ∏ g(i), ∀x∈ℝ: ⌈x⌉ = −⌊−x⌋, α ∧ ¬β = ¬(¬α ∨ β)' +) +assert( + fs.read('utf-16-text', encoding: 'utf-16').strip() == expected, + 'file was not decoded correctly' +) + +# Make sure we handle `files()` objects properly, too +version_file = files('VERSION') + +subdir('other') diff --git a/test cases/common/234 get_file_contents/other/meson.build b/test cases/common/234 get_file_contents/other/meson.build new file mode 100644 index 0000000..9a7e4be --- /dev/null +++ b/test cases/common/234 get_file_contents/other/meson.build @@ -0,0 +1,3 @@ +fs = import('fs') +assert(fs.read(version_file).strip() == '1.2.0') +assert(fs.read('../VERSION').strip() == '1.2.0') diff --git a/test cases/common/234 get_file_contents/utf-16-text b/test cases/common/234 get_file_contents/utf-16-text new file mode 100644 index 0000000..ed1fefe Binary files /dev/null and b/test cases/common/234 get_file_contents/utf-16-text differ diff --git a/test cases/common/234 wrap case/meson.build b/test cases/common/234 wrap case/meson.build deleted file mode 100644 index 2b82bf3..0000000 --- a/test cases/common/234 wrap case/meson.build +++ /dev/null @@ -1,6 +0,0 @@ -project('CaSe DePenDenCy In Wrap', 'c') - -d = dependency('UP_down') - -e = executable('prog', 'prog.c', dependencies: d) -test('prog', e) diff --git a/test cases/common/234 wrap case/prog.c b/test cases/common/234 wrap case/prog.c deleted file mode 100644 index 5183dea..0000000 --- a/test cases/common/234 wrap case/prog.c +++ /dev/null @@ -1,13 +0,0 @@ -#include -#include - -int main(int argc, char **argv) { - if(argc == 42) { - printf("Very sneaky, %s\n", argv[0]); - } -#ifdef UP_IS_DOWN - return 0; -#else - return 1; -#endif -} diff --git a/test cases/common/234 wrap case/subprojects/up_down.wrap b/test cases/common/234 wrap case/subprojects/up_down.wrap deleted file mode 100644 index d66818f..0000000 --- a/test cases/common/234 wrap case/subprojects/up_down.wrap +++ /dev/null @@ -1,5 +0,0 @@ -[wrap-file] -directory = up_down - -[provide] -UP_down = up_down_dep diff --git a/test cases/common/234 wrap case/subprojects/up_down/meson.build b/test cases/common/234 wrap case/subprojects/up_down/meson.build deleted file mode 100644 index 5db89d1..0000000 --- a/test cases/common/234 wrap case/subprojects/up_down/meson.build +++ /dev/null @@ -1,3 +0,0 @@ -project('up down', 'c') - -up_down_dep = declare_dependency(include_directories: '.') diff --git a/test cases/common/234 wrap case/subprojects/up_down/up_down.h b/test cases/common/234 wrap case/subprojects/up_down/up_down.h deleted file mode 100644 index 8d968ce..0000000 --- a/test cases/common/234 wrap case/subprojects/up_down/up_down.h +++ /dev/null @@ -1,3 +0,0 @@ -#pragma once - -#define UP_IS_DOWN diff --git a/test cases/common/235 get_file_contents/.gitattributes b/test cases/common/235 get_file_contents/.gitattributes deleted file mode 100644 index abec47d..0000000 --- a/test cases/common/235 get_file_contents/.gitattributes +++ /dev/null @@ -1 +0,0 @@ -utf-16-text binary diff --git a/test cases/common/235 get_file_contents/VERSION b/test cases/common/235 get_file_contents/VERSION deleted file mode 100644 index 26aaba0..0000000 --- a/test cases/common/235 get_file_contents/VERSION +++ /dev/null @@ -1 +0,0 @@ -1.2.0 diff --git a/test cases/common/235 get_file_contents/meson.build b/test cases/common/235 get_file_contents/meson.build deleted file mode 100644 index a8c68d6..0000000 --- a/test cases/common/235 get_file_contents/meson.build +++ /dev/null @@ -1,21 +0,0 @@ -project( - 'meson-fs-read-file', - [], - version: files('VERSION') -) -fs = import('fs') - -assert(fs.read('VERSION').strip() == meson.project_version(), 'file misread') - -expected = ( - '∮ E⋅da = Q, n → ∞, ∑ f(i) = ∏ g(i), ∀x∈ℝ: ⌈x⌉ = −⌊−x⌋, α ∧ ¬β = ¬(¬α ∨ β)' -) -assert( - fs.read('utf-16-text', encoding: 'utf-16').strip() == expected, - 'file was not decoded correctly' -) - -# Make sure we handle `files()` objects properly, too -version_file = files('VERSION') - -subdir('other') diff --git a/test cases/common/235 get_file_contents/other/meson.build b/test cases/common/235 get_file_contents/other/meson.build deleted file mode 100644 index 9a7e4be..0000000 --- a/test cases/common/235 get_file_contents/other/meson.build +++ /dev/null @@ -1,3 +0,0 @@ -fs = import('fs') -assert(fs.read(version_file).strip() == '1.2.0') -assert(fs.read('../VERSION').strip() == '1.2.0') diff --git a/test cases/common/235 get_file_contents/utf-16-text b/test cases/common/235 get_file_contents/utf-16-text deleted file mode 100644 index ed1fefe..0000000 Binary files a/test cases/common/235 get_file_contents/utf-16-text and /dev/null differ diff --git a/test cases/common/235 invalid standard overriden to valid/main.c b/test cases/common/235 invalid standard overriden to valid/main.c new file mode 100644 index 0000000..9b6bdc2 --- /dev/null +++ b/test cases/common/235 invalid standard overriden to valid/main.c @@ -0,0 +1,3 @@ +int main(void) { + return 0; +} diff --git a/test cases/common/235 invalid standard overriden to valid/meson.build b/test cases/common/235 invalid standard overriden to valid/meson.build new file mode 100644 index 0000000..9463e43 --- /dev/null +++ b/test cases/common/235 invalid standard overriden to valid/meson.build @@ -0,0 +1,8 @@ +project( + 'invalid C standard overriden to valid one', + 'c', + default_options : ['c_std=invalid99'], +) + +exe = executable('main', 'main.c') +test('main', exe) diff --git a/test cases/common/235 invalid standard overriden to valid/test.json b/test cases/common/235 invalid standard overriden to valid/test.json new file mode 100644 index 0000000..c9b00ce --- /dev/null +++ b/test cases/common/235 invalid standard overriden to valid/test.json @@ -0,0 +1,9 @@ +{ + "matrix": { + "options": { + "c_std": [ + { "val": "c89" } + ] + } + } +} diff --git a/test cases/common/236 invalid standard overriden to valid/main.c b/test cases/common/236 invalid standard overriden to valid/main.c deleted file mode 100644 index 9b6bdc2..0000000 --- a/test cases/common/236 invalid standard overriden to valid/main.c +++ /dev/null @@ -1,3 +0,0 @@ -int main(void) { - return 0; -} diff --git a/test cases/common/236 invalid standard overriden to valid/meson.build b/test cases/common/236 invalid standard overriden to valid/meson.build deleted file mode 100644 index 9463e43..0000000 --- a/test cases/common/236 invalid standard overriden to valid/meson.build +++ /dev/null @@ -1,8 +0,0 @@ -project( - 'invalid C standard overriden to valid one', - 'c', - default_options : ['c_std=invalid99'], -) - -exe = executable('main', 'main.c') -test('main', exe) diff --git a/test cases/common/236 invalid standard overriden to valid/test.json b/test cases/common/236 invalid standard overriden to valid/test.json deleted file mode 100644 index c9b00ce..0000000 --- a/test cases/common/236 invalid standard overriden to valid/test.json +++ /dev/null @@ -1,9 +0,0 @@ -{ - "matrix": { - "options": { - "c_std": [ - { "val": "c89" } - ] - } - } -} diff --git a/test cases/common/236 proper args splitting/main.c b/test cases/common/236 proper args splitting/main.c new file mode 100644 index 0000000..4b2038f --- /dev/null +++ b/test cases/common/236 proper args splitting/main.c @@ -0,0 +1,11 @@ +#ifndef FOO +# error "FOO is not defined" +#endif + +#ifndef BAR +# error "BAR is not defined" +#endif + +int main(void) { + return 0; +} diff --git a/test cases/common/236 proper args splitting/meson.build b/test cases/common/236 proper args splitting/meson.build new file mode 100644 index 0000000..4a36f9c --- /dev/null +++ b/test cases/common/236 proper args splitting/meson.build @@ -0,0 +1,9 @@ +project('proper args splitting', 'c') + +test( + 'main', + executable( + 'main', + 'main.c', + ) +) diff --git a/test cases/common/236 proper args splitting/test.json b/test cases/common/236 proper args splitting/test.json new file mode 100644 index 0000000..b1738aa --- /dev/null +++ b/test cases/common/236 proper args splitting/test.json @@ -0,0 +1,9 @@ +{ + "matrix": { + "options": { + "c_args": [ + { "val": "-DFOO -DBAR" } + ] + } + } +} diff --git a/test cases/common/237 fstrings/meson.build b/test cases/common/237 fstrings/meson.build new file mode 100644 index 0000000..2db2649 --- /dev/null +++ b/test cases/common/237 fstrings/meson.build @@ -0,0 +1,7 @@ +project('meson-test', 'c') + +n = 10 +m = 'bar' +s = f'test @n@ string (@@n@@): @m@' + +assert(s == 'test 10 string (@10@): bar', 'Incorrect string formatting') diff --git a/test cases/common/237 proper args splitting/main.c b/test cases/common/237 proper args splitting/main.c deleted file mode 100644 index 4b2038f..0000000 --- a/test cases/common/237 proper args splitting/main.c +++ /dev/null @@ -1,11 +0,0 @@ -#ifndef FOO -# error "FOO is not defined" -#endif - -#ifndef BAR -# error "BAR is not defined" -#endif - -int main(void) { - return 0; -} diff --git a/test cases/common/237 proper args splitting/meson.build b/test cases/common/237 proper args splitting/meson.build deleted file mode 100644 index 4a36f9c..0000000 --- a/test cases/common/237 proper args splitting/meson.build +++ /dev/null @@ -1,9 +0,0 @@ -project('proper args splitting', 'c') - -test( - 'main', - executable( - 'main', - 'main.c', - ) -) diff --git a/test cases/common/237 proper args splitting/test.json b/test cases/common/237 proper args splitting/test.json deleted file mode 100644 index b1738aa..0000000 --- a/test cases/common/237 proper args splitting/test.json +++ /dev/null @@ -1,9 +0,0 @@ -{ - "matrix": { - "options": { - "c_args": [ - { "val": "-DFOO -DBAR" } - ] - } - } -} diff --git a/test cases/common/238 dependency include_type inconsistency/bar/meson.build b/test cases/common/238 dependency include_type inconsistency/bar/meson.build new file mode 100644 index 0000000..6e1218b --- /dev/null +++ b/test cases/common/238 dependency include_type inconsistency/bar/meson.build @@ -0,0 +1,5 @@ +baz_dep = dependency('baz', + fallback: ['baz', 'baz_dep'], + include_type: 'system', + method: 'pkg-config', # if we comment this out or change to 'auto' the build is successful + required: false) diff --git a/test cases/common/238 dependency include_type inconsistency/meson.build b/test cases/common/238 dependency include_type inconsistency/meson.build new file mode 100644 index 0000000..7f28e25 --- /dev/null +++ b/test cases/common/238 dependency include_type inconsistency/meson.build @@ -0,0 +1,5 @@ +project('test', 'c', 'cpp') + +foo_dep = subproject('foo').get_variable('foo_dep') + +subdir('bar') diff --git a/test cases/common/238 dependency include_type inconsistency/subprojects/baz.wrap b/test cases/common/238 dependency include_type inconsistency/subprojects/baz.wrap new file mode 100644 index 0000000..c727794 --- /dev/null +++ b/test cases/common/238 dependency include_type inconsistency/subprojects/baz.wrap @@ -0,0 +1,3 @@ +[wrap-file] +source_url = http://host.invalid/baz.tar.gz +source_filename = baz.tar.gz diff --git a/test cases/common/238 dependency include_type inconsistency/subprojects/baz/meson.build b/test cases/common/238 dependency include_type inconsistency/subprojects/baz/meson.build new file mode 100644 index 0000000..a6a3775 --- /dev/null +++ b/test cases/common/238 dependency include_type inconsistency/subprojects/baz/meson.build @@ -0,0 +1,3 @@ +project('baz', 'cpp') + +baz_dep = declare_dependency() diff --git a/test cases/common/238 dependency include_type inconsistency/subprojects/foo.wrap b/test cases/common/238 dependency include_type inconsistency/subprojects/foo.wrap new file mode 100644 index 0000000..dcc434b --- /dev/null +++ b/test cases/common/238 dependency include_type inconsistency/subprojects/foo.wrap @@ -0,0 +1,3 @@ +[wrap-file] +source_url = http://host.invalid/foo.tar.gz +source_filename = foo.tar.gz diff --git a/test cases/common/238 dependency include_type inconsistency/subprojects/foo/meson.build b/test cases/common/238 dependency include_type inconsistency/subprojects/foo/meson.build new file mode 100644 index 0000000..51d9503 --- /dev/null +++ b/test cases/common/238 dependency include_type inconsistency/subprojects/foo/meson.build @@ -0,0 +1,9 @@ +project('foo', 'c', 'cpp') + +baz_dep = dependency('baz', + fallback: ['baz', 'baz_dep'], + include_type: 'system', + method: 'pkg-config', + required: false) + +foo_dep = declare_dependency(dependencies: baz_dep) diff --git a/test cases/common/238 fstrings/meson.build b/test cases/common/238 fstrings/meson.build deleted file mode 100644 index 2db2649..0000000 --- a/test cases/common/238 fstrings/meson.build +++ /dev/null @@ -1,7 +0,0 @@ -project('meson-test', 'c') - -n = 10 -m = 'bar' -s = f'test @n@ string (@@n@@): @m@' - -assert(s == 'test 10 string (@10@): bar', 'Incorrect string formatting') diff --git a/test cases/common/239 dependency include_type inconsistency/bar/meson.build b/test cases/common/239 dependency include_type inconsistency/bar/meson.build deleted file mode 100644 index 6e1218b..0000000 --- a/test cases/common/239 dependency include_type inconsistency/bar/meson.build +++ /dev/null @@ -1,5 +0,0 @@ -baz_dep = dependency('baz', - fallback: ['baz', 'baz_dep'], - include_type: 'system', - method: 'pkg-config', # if we comment this out or change to 'auto' the build is successful - required: false) diff --git a/test cases/common/239 dependency include_type inconsistency/meson.build b/test cases/common/239 dependency include_type inconsistency/meson.build deleted file mode 100644 index 7f28e25..0000000 --- a/test cases/common/239 dependency include_type inconsistency/meson.build +++ /dev/null @@ -1,5 +0,0 @@ -project('test', 'c', 'cpp') - -foo_dep = subproject('foo').get_variable('foo_dep') - -subdir('bar') diff --git a/test cases/common/239 dependency include_type inconsistency/subprojects/baz.wrap b/test cases/common/239 dependency include_type inconsistency/subprojects/baz.wrap deleted file mode 100644 index c727794..0000000 --- a/test cases/common/239 dependency include_type inconsistency/subprojects/baz.wrap +++ /dev/null @@ -1,3 +0,0 @@ -[wrap-file] -source_url = http://host.invalid/baz.tar.gz -source_filename = baz.tar.gz diff --git a/test cases/common/239 dependency include_type inconsistency/subprojects/baz/meson.build b/test cases/common/239 dependency include_type inconsistency/subprojects/baz/meson.build deleted file mode 100644 index a6a3775..0000000 --- a/test cases/common/239 dependency include_type inconsistency/subprojects/baz/meson.build +++ /dev/null @@ -1,3 +0,0 @@ -project('baz', 'cpp') - -baz_dep = declare_dependency() diff --git a/test cases/common/239 dependency include_type inconsistency/subprojects/foo.wrap b/test cases/common/239 dependency include_type inconsistency/subprojects/foo.wrap deleted file mode 100644 index dcc434b..0000000 --- a/test cases/common/239 dependency include_type inconsistency/subprojects/foo.wrap +++ /dev/null @@ -1,3 +0,0 @@ -[wrap-file] -source_url = http://host.invalid/foo.tar.gz -source_filename = foo.tar.gz diff --git a/test cases/common/239 dependency include_type inconsistency/subprojects/foo/meson.build b/test cases/common/239 dependency include_type inconsistency/subprojects/foo/meson.build deleted file mode 100644 index 51d9503..0000000 --- a/test cases/common/239 dependency include_type inconsistency/subprojects/foo/meson.build +++ /dev/null @@ -1,9 +0,0 @@ -project('foo', 'c', 'cpp') - -baz_dep = dependency('baz', - fallback: ['baz', 'baz_dep'], - include_type: 'system', - method: 'pkg-config', - required: false) - -foo_dep = declare_dependency(dependencies: baz_dep) diff --git a/test cases/common/239 includedir violation/meson.build b/test cases/common/239 includedir violation/meson.build new file mode 100644 index 0000000..0216be6 --- /dev/null +++ b/test cases/common/239 includedir violation/meson.build @@ -0,0 +1,11 @@ +project('foo', 'c') + +# It is fine to include the root source dir +include_directories('.') +subproject('sub') + +# This is here rather than in failing because this needs a +# transition period to avoid breaking existing projects. +# Once this becomes an error, move this under failing tests. + +inc = include_directories('subprojects/sub/include') diff --git a/test cases/common/239 includedir violation/subprojects/sub/include/placeholder.h b/test cases/common/239 includedir violation/subprojects/sub/include/placeholder.h new file mode 100644 index 0000000..196f917 --- /dev/null +++ b/test cases/common/239 includedir violation/subprojects/sub/include/placeholder.h @@ -0,0 +1,3 @@ +#pragma once + +// Git can not handle empty directories, so there must be something here. diff --git a/test cases/common/239 includedir violation/subprojects/sub/meson.build b/test cases/common/239 includedir violation/subprojects/sub/meson.build new file mode 100644 index 0000000..352f4a2 --- /dev/null +++ b/test cases/common/239 includedir violation/subprojects/sub/meson.build @@ -0,0 +1,3 @@ +project('subproj', 'c') + +include_directories('.') diff --git a/test cases/common/239 includedir violation/test.json b/test cases/common/239 includedir violation/test.json new file mode 100644 index 0000000..fea19a1 --- /dev/null +++ b/test cases/common/239 includedir violation/test.json @@ -0,0 +1,9 @@ +{ + "stdout": [ + { + "line": ".*WARNING: include_directories sandbox violation!", + "match": "re", + "count": 1 + } + ] +} diff --git a/test cases/common/24 endian/meson.build b/test cases/common/24 endian/meson.build deleted file mode 100644 index 80186fe..0000000 --- a/test cases/common/24 endian/meson.build +++ /dev/null @@ -1,7 +0,0 @@ -project('endian check', 'c') - -if host_machine.endian() == 'big' - add_global_arguments('-DIS_BE', language : 'c') -endif - -test('endiantest', executable('prog', 'prog.c')) diff --git a/test cases/common/24 endian/prog.c b/test cases/common/24 endian/prog.c deleted file mode 100644 index 90bd958..0000000 --- a/test cases/common/24 endian/prog.c +++ /dev/null @@ -1,24 +0,0 @@ -#include - -int is_big_endian(void) { - uint32_t one = 1; - if(*((uint8_t*) &one) == 1) - return 0; - return 1; -} - - -int main(void) { - int is_be_check = is_big_endian(); - int is_be; -#ifdef IS_BE - is_be = 1; -#else - is_be = 0; -#endif - if(is_be_check && is_be) - return 0; - if(!is_be_check && !is_be) - return 0; - return 1; -} diff --git a/test cases/common/24 library versions/lib.c b/test cases/common/24 library versions/lib.c new file mode 100644 index 0000000..e49cb2d --- /dev/null +++ b/test cases/common/24 library versions/lib.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 myFunc(void) { + return 55; +} diff --git a/test cases/common/24 library versions/meson.build b/test cases/common/24 library versions/meson.build new file mode 100644 index 0000000..2e2bef7 --- /dev/null +++ b/test cases/common/24 library versions/meson.build @@ -0,0 +1,9 @@ +project('library versions', 'c') + +shared_library('somelib', 'lib.c', + name_prefix : 'prefix', + name_suffix : 'suffix', + install_dir : 'lib', + install : true) + +subdir('subdir') diff --git a/test cases/common/24 library versions/subdir/meson.build b/test cases/common/24 library versions/subdir/meson.build new file mode 100644 index 0000000..a83fdb5 --- /dev/null +++ b/test cases/common/24 library versions/subdir/meson.build @@ -0,0 +1,8 @@ +# Test that using files generated with configure_file as sources works. +# We do this inside a subdir so that the path isn't accidentally correct +# because there is no structure in the build dir. +genlib = configure_file(input : '../lib.c', + output : 'genlib.c', + copy: true) +shared_library('genlib', genlib, + install : false) diff --git a/test cases/common/24 library versions/test.json b/test cases/common/24 library versions/test.json new file mode 100644 index 0000000..64b7ab0 --- /dev/null +++ b/test cases/common/24 library versions/test.json @@ -0,0 +1,7 @@ +{ + "installed": [ + {"type": "file", "file": "usr/lib/prefixsomelib.suffix"}, + {"type": "implib", "file": "usr/lib/prefixsomelib"}, + {"type": "pdb", "file": "usr/lib/prefixsomelib"} + ] +} diff --git a/test cases/common/240 includedir violation/meson.build b/test cases/common/240 includedir violation/meson.build deleted file mode 100644 index 0216be6..0000000 --- a/test cases/common/240 includedir violation/meson.build +++ /dev/null @@ -1,11 +0,0 @@ -project('foo', 'c') - -# It is fine to include the root source dir -include_directories('.') -subproject('sub') - -# This is here rather than in failing because this needs a -# transition period to avoid breaking existing projects. -# Once this becomes an error, move this under failing tests. - -inc = include_directories('subprojects/sub/include') diff --git a/test cases/common/240 includedir violation/subprojects/sub/include/placeholder.h b/test cases/common/240 includedir violation/subprojects/sub/include/placeholder.h deleted file mode 100644 index 196f917..0000000 --- a/test cases/common/240 includedir violation/subprojects/sub/include/placeholder.h +++ /dev/null @@ -1,3 +0,0 @@ -#pragma once - -// Git can not handle empty directories, so there must be something here. diff --git a/test cases/common/240 includedir violation/subprojects/sub/meson.build b/test cases/common/240 includedir violation/subprojects/sub/meson.build deleted file mode 100644 index 352f4a2..0000000 --- a/test cases/common/240 includedir violation/subprojects/sub/meson.build +++ /dev/null @@ -1,3 +0,0 @@ -project('subproj', 'c') - -include_directories('.') diff --git a/test cases/common/240 includedir violation/test.json b/test cases/common/240 includedir violation/test.json deleted file mode 100644 index fea19a1..0000000 --- a/test cases/common/240 includedir violation/test.json +++ /dev/null @@ -1,9 +0,0 @@ -{ - "stdout": [ - { - "line": ".*WARNING: include_directories sandbox violation!", - "match": "re", - "count": 1 - } - ] -} diff --git a/test cases/common/25 config subdir/include/config.h.in b/test cases/common/25 config subdir/include/config.h.in new file mode 100644 index 0000000..4c3c62d --- /dev/null +++ b/test cases/common/25 config subdir/include/config.h.in @@ -0,0 +1,6 @@ +#ifndef CONFIG_H_ +#define CONFIG_H_ + +#define RETURN_VALUE @number@ + +#endif diff --git a/test cases/common/25 config subdir/include/meson.build b/test cases/common/25 config subdir/include/meson.build new file mode 100644 index 0000000..f14111a --- /dev/null +++ b/test cases/common/25 config subdir/include/meson.build @@ -0,0 +1,4 @@ +conf_data = configuration_data() +conf_data.set('number', '0') + +configure_file(input:'config.h.in', output:'config.h', configuration:conf_data) diff --git a/test cases/common/25 config subdir/meson.build b/test cases/common/25 config subdir/meson.build new file mode 100644 index 0000000..25f53db --- /dev/null +++ b/test cases/common/25 config subdir/meson.build @@ -0,0 +1,6 @@ +project('subdirconfig', 'c') + +inc = include_directories('include') + +subdir('include') +subdir('src') diff --git a/test cases/common/25 config subdir/src/meson.build b/test cases/common/25 config subdir/src/meson.build new file mode 100644 index 0000000..97598a4 --- /dev/null +++ b/test cases/common/25 config subdir/src/meson.build @@ -0,0 +1,2 @@ +exe = executable('prog', 'prog.c', include_directories : inc) +test('subdir config', exe) diff --git a/test cases/common/25 config subdir/src/prog.c b/test cases/common/25 config subdir/src/prog.c new file mode 100644 index 0000000..b9db890 --- /dev/null +++ b/test cases/common/25 config subdir/src/prog.c @@ -0,0 +1,5 @@ +#include "config.h" + +int main(void) { + return RETURN_VALUE; +} diff --git a/test cases/common/25 library versions/lib.c b/test cases/common/25 library versions/lib.c deleted file mode 100644 index e49cb2d..0000000 --- a/test cases/common/25 library versions/lib.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 myFunc(void) { - return 55; -} diff --git a/test cases/common/25 library versions/meson.build b/test cases/common/25 library versions/meson.build deleted file mode 100644 index 2e2bef7..0000000 --- a/test cases/common/25 library versions/meson.build +++ /dev/null @@ -1,9 +0,0 @@ -project('library versions', 'c') - -shared_library('somelib', 'lib.c', - name_prefix : 'prefix', - name_suffix : 'suffix', - install_dir : 'lib', - install : true) - -subdir('subdir') diff --git a/test cases/common/25 library versions/subdir/meson.build b/test cases/common/25 library versions/subdir/meson.build deleted file mode 100644 index a83fdb5..0000000 --- a/test cases/common/25 library versions/subdir/meson.build +++ /dev/null @@ -1,8 +0,0 @@ -# Test that using files generated with configure_file as sources works. -# We do this inside a subdir so that the path isn't accidentally correct -# because there is no structure in the build dir. -genlib = configure_file(input : '../lib.c', - output : 'genlib.c', - copy: true) -shared_library('genlib', genlib, - install : false) diff --git a/test cases/common/25 library versions/test.json b/test cases/common/25 library versions/test.json deleted file mode 100644 index 64b7ab0..0000000 --- a/test cases/common/25 library versions/test.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "installed": [ - {"type": "file", "file": "usr/lib/prefixsomelib.suffix"}, - {"type": "implib", "file": "usr/lib/prefixsomelib"}, - {"type": "pdb", "file": "usr/lib/prefixsomelib"} - ] -} diff --git a/test cases/common/26 config subdir/include/config.h.in b/test cases/common/26 config subdir/include/config.h.in deleted file mode 100644 index 4c3c62d..0000000 --- a/test cases/common/26 config subdir/include/config.h.in +++ /dev/null @@ -1,6 +0,0 @@ -#ifndef CONFIG_H_ -#define CONFIG_H_ - -#define RETURN_VALUE @number@ - -#endif diff --git a/test cases/common/26 config subdir/include/meson.build b/test cases/common/26 config subdir/include/meson.build deleted file mode 100644 index f14111a..0000000 --- a/test cases/common/26 config subdir/include/meson.build +++ /dev/null @@ -1,4 +0,0 @@ -conf_data = configuration_data() -conf_data.set('number', '0') - -configure_file(input:'config.h.in', output:'config.h', configuration:conf_data) diff --git a/test cases/common/26 config subdir/meson.build b/test cases/common/26 config subdir/meson.build deleted file mode 100644 index 25f53db..0000000 --- a/test cases/common/26 config subdir/meson.build +++ /dev/null @@ -1,6 +0,0 @@ -project('subdirconfig', 'c') - -inc = include_directories('include') - -subdir('include') -subdir('src') diff --git a/test cases/common/26 config subdir/src/meson.build b/test cases/common/26 config subdir/src/meson.build deleted file mode 100644 index 97598a4..0000000 --- a/test cases/common/26 config subdir/src/meson.build +++ /dev/null @@ -1,2 +0,0 @@ -exe = executable('prog', 'prog.c', include_directories : inc) -test('subdir config', exe) diff --git a/test cases/common/26 config subdir/src/prog.c b/test cases/common/26 config subdir/src/prog.c deleted file mode 100644 index b9db890..0000000 --- a/test cases/common/26 config subdir/src/prog.c +++ /dev/null @@ -1,5 +0,0 @@ -#include "config.h" - -int main(void) { - return RETURN_VALUE; -} diff --git a/test cases/common/26 find program/meson.build b/test cases/common/26 find program/meson.build new file mode 100644 index 0000000..3b59caa --- /dev/null +++ b/test cases/common/26 find program/meson.build @@ -0,0 +1,35 @@ +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') + +prog = find_program('test_subdir.py', required : false) +assert(not prog.found(), 'Program should not be found') + +prog = find_program('test_subdir.py', dirs : ['/donotexist', meson.current_source_dir() / 'scripts']) +assert(prog.found(), 'Program should be found') diff --git a/test cases/common/26 find program/print-version-with-prefix.py b/test cases/common/26 find program/print-version-with-prefix.py new file mode 100644 index 0000000..520e0ba --- /dev/null +++ b/test cases/common/26 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/26 find program/print-version.py b/test cases/common/26 find program/print-version.py new file mode 100644 index 0000000..4a78e5b --- /dev/null +++ b/test cases/common/26 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/26 find program/scripts/test_subdir.py b/test cases/common/26 find program/scripts/test_subdir.py new file mode 100644 index 0000000..947ffe4 --- /dev/null +++ b/test cases/common/26 find program/scripts/test_subdir.py @@ -0,0 +1,3 @@ +#!/usr/bin/env python3 + +exit(0) diff --git a/test cases/common/26 find program/source.in b/test cases/common/26 find program/source.in new file mode 100644 index 0000000..03b2213 --- /dev/null +++ b/test cases/common/26 find program/source.in @@ -0,0 +1,3 @@ +int main(void) { + return 0; +} diff --git a/test cases/common/27 find program/meson.build b/test cases/common/27 find program/meson.build deleted file mode 100644 index 3b59caa..0000000 --- a/test cases/common/27 find program/meson.build +++ /dev/null @@ -1,35 +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') - -prog = find_program('test_subdir.py', required : false) -assert(not prog.found(), 'Program should not be found') - -prog = find_program('test_subdir.py', dirs : ['/donotexist', meson.current_source_dir() / 'scripts']) -assert(prog.found(), 'Program should be found') diff --git a/test cases/common/27 find program/print-version-with-prefix.py b/test cases/common/27 find program/print-version-with-prefix.py deleted file mode 100644 index 520e0ba..0000000 --- a/test cases/common/27 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/27 find program/print-version.py b/test cases/common/27 find program/print-version.py deleted file mode 100644 index 4a78e5b..0000000 --- a/test cases/common/27 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/27 find program/scripts/test_subdir.py b/test cases/common/27 find program/scripts/test_subdir.py deleted file mode 100644 index 947ffe4..0000000 --- a/test cases/common/27 find program/scripts/test_subdir.py +++ /dev/null @@ -1,3 +0,0 @@ -#!/usr/bin/env python3 - -exit(0) diff --git a/test cases/common/27 find program/source.in b/test cases/common/27 find program/source.in deleted file mode 100644 index 03b2213..0000000 --- a/test cases/common/27 find program/source.in +++ /dev/null @@ -1,3 +0,0 @@ -int main(void) { - return 0; -} diff --git a/test cases/common/27 multiline string/meson.build b/test cases/common/27 multiline string/meson.build new file mode 100644 index 0000000..a87d29a --- /dev/null +++ b/test cases/common/27 multiline string/meson.build @@ -0,0 +1,37 @@ +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 = ''' +#include + +int main(void) { + int num = 1; + printf("%d\n", num); + return 0; +}''' + +assert(cc.compiles(prog), 'multline test compile failed') diff --git a/test cases/common/28 multiline string/meson.build b/test cases/common/28 multiline string/meson.build deleted file mode 100644 index a87d29a..0000000 --- a/test cases/common/28 multiline string/meson.build +++ /dev/null @@ -1,37 +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 = ''' -#include - -int main(void) { - int num = 1; - printf("%d\n", num); - return 0; -}''' - -assert(cc.compiles(prog), 'multline test compile failed') diff --git a/test cases/common/28 try compile/invalid.c b/test cases/common/28 try compile/invalid.c new file mode 100644 index 0000000..6c9cfb8 --- /dev/null +++ b/test cases/common/28 try compile/invalid.c @@ -0,0 +1,2 @@ +#include +void func(void) { printf("This won't work.\n"); } diff --git a/test cases/common/28 try compile/meson.build b/test cases/common/28 try compile/meson.build new file mode 100644 index 0000000..cb41e1d --- /dev/null +++ b/test cases/common/28 try compile/meson.build @@ -0,0 +1,27 @@ +project('try compile', 'c', 'cpp') + +code = '''#include +void func(void) { printf("Something.\n"); } +''' + +breakcode = '''#include +void func(void) { 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/28 try compile/valid.c b/test cases/common/28 try compile/valid.c new file mode 100644 index 0000000..f8e76f4 --- /dev/null +++ b/test cases/common/28 try compile/valid.c @@ -0,0 +1,2 @@ +#include +void func(void) { printf("Something.\n"); } diff --git a/test cases/common/29 compiler id/meson.build b/test cases/common/29 compiler id/meson.build new file mode 100644 index 0000000..280d4f7 --- /dev/null +++ b/test cases/common/29 compiler id/meson.build @@ -0,0 +1,15 @@ +project('compiler_id') + +foreach lang : ['c', 'cpp', 'fortran', 'objc', 'objcpp'] + + if not add_languages(lang, required: false) + continue + endif + + comp = meson.get_compiler(lang) + + message(lang + ' compiler name is: ' + comp.get_id()) + + message(lang + ' linker name is: ' + comp.get_linker_id()) + +endforeach \ No newline at end of file diff --git a/test cases/common/29 try compile/invalid.c b/test cases/common/29 try compile/invalid.c deleted file mode 100644 index 6c9cfb8..0000000 --- a/test cases/common/29 try compile/invalid.c +++ /dev/null @@ -1,2 +0,0 @@ -#include -void func(void) { printf("This won't work.\n"); } diff --git a/test cases/common/29 try compile/meson.build b/test cases/common/29 try compile/meson.build deleted file mode 100644 index cb41e1d..0000000 --- a/test cases/common/29 try compile/meson.build +++ /dev/null @@ -1,27 +0,0 @@ -project('try compile', 'c', 'cpp') - -code = '''#include -void func(void) { printf("Something.\n"); } -''' - -breakcode = '''#include -void func(void) { 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/29 try compile/valid.c b/test cases/common/29 try compile/valid.c deleted file mode 100644 index f8e76f4..0000000 --- a/test cases/common/29 try compile/valid.c +++ /dev/null @@ -1,2 +0,0 @@ -#include -void func(void) { printf("Something.\n"); } diff --git a/test cases/common/30 compiler id/meson.build b/test cases/common/30 compiler id/meson.build deleted file mode 100644 index 280d4f7..0000000 --- a/test cases/common/30 compiler id/meson.build +++ /dev/null @@ -1,15 +0,0 @@ -project('compiler_id') - -foreach lang : ['c', 'cpp', 'fortran', 'objc', 'objcpp'] - - if not add_languages(lang, required: false) - continue - endif - - comp = meson.get_compiler(lang) - - message(lang + ' compiler name is: ' + comp.get_id()) - - message(lang + ' linker name is: ' + comp.get_linker_id()) - -endforeach \ No newline at end of file diff --git a/test cases/common/30 sizeof/config.h.in b/test cases/common/30 sizeof/config.h.in new file mode 100644 index 0000000..a442e8a --- /dev/null +++ b/test cases/common/30 sizeof/config.h.in @@ -0,0 +1,2 @@ +#define INTSIZE @INTSIZE@ +#define WCHARSIZE @WCHARSIZE@ diff --git a/test cases/common/30 sizeof/meson.build b/test cases/common/30 sizeof/meson.build new file mode 100644 index 0000000..9de5b78 --- /dev/null +++ b/test cases/common/30 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/30 sizeof/prog.c.in b/test cases/common/30 sizeof/prog.c.in new file mode 100644 index 0000000..44918ec --- /dev/null +++ b/test cases/common/30 sizeof/prog.c.in @@ -0,0 +1,15 @@ +#include "@CONFIG@" +#include +#include + +int main(void) { + 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/31 define10/config.h.in b/test cases/common/31 define10/config.h.in new file mode 100644 index 0000000..dc77346 --- /dev/null +++ b/test cases/common/31 define10/config.h.in @@ -0,0 +1,2 @@ +#mesondefine ONE +#mesondefine ZERO diff --git a/test cases/common/31 define10/meson.build b/test cases/common/31 define10/meson.build new file mode 100644 index 0000000..a28e7e4 --- /dev/null +++ b/test cases/common/31 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/31 define10/prog.c b/test cases/common/31 define10/prog.c new file mode 100644 index 0000000..519b40d --- /dev/null +++ b/test cases/common/31 define10/prog.c @@ -0,0 +1,13 @@ +#include +#include"config.h" + +int main(void) { + 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/31 sizeof/config.h.in b/test cases/common/31 sizeof/config.h.in deleted file mode 100644 index a442e8a..0000000 --- a/test cases/common/31 sizeof/config.h.in +++ /dev/null @@ -1,2 +0,0 @@ -#define INTSIZE @INTSIZE@ -#define WCHARSIZE @WCHARSIZE@ diff --git a/test cases/common/31 sizeof/meson.build b/test cases/common/31 sizeof/meson.build deleted file mode 100644 index 9de5b78..0000000 --- a/test cases/common/31 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/31 sizeof/prog.c.in b/test cases/common/31 sizeof/prog.c.in deleted file mode 100644 index 44918ec..0000000 --- a/test cases/common/31 sizeof/prog.c.in +++ /dev/null @@ -1,15 +0,0 @@ -#include "@CONFIG@" -#include -#include - -int main(void) { - 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/32 define10/config.h.in b/test cases/common/32 define10/config.h.in deleted file mode 100644 index dc77346..0000000 --- a/test cases/common/32 define10/config.h.in +++ /dev/null @@ -1,2 +0,0 @@ -#mesondefine ONE -#mesondefine ZERO diff --git a/test cases/common/32 define10/meson.build b/test cases/common/32 define10/meson.build deleted file mode 100644 index a28e7e4..0000000 --- a/test cases/common/32 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/32 define10/prog.c b/test cases/common/32 define10/prog.c deleted file mode 100644 index 519b40d..0000000 --- a/test cases/common/32 define10/prog.c +++ /dev/null @@ -1,13 +0,0 @@ -#include -#include"config.h" - -int main(void) { - 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/32 has header/meson.build b/test cases/common/32 has header/meson.build new file mode 100644 index 0000000..8096763 --- /dev/null +++ b/test cases/common/32 has header/meson.build @@ -0,0 +1,54 @@ +project('has header', 'c', 'cpp') + +host_system = host_machine.system() + +non_existent_header = 'ouagadougou.h' + +# Copy it into the builddir to ensure that it isn't found even if it's there +configure_file(input : non_existent_header, + output : non_existent_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_existent_header, prefix : fallback), + 'Found non-existent header.') + endforeach +endforeach diff --git a/test cases/common/32 has header/ouagadougou.h b/test cases/common/32 has header/ouagadougou.h new file mode 100644 index 0000000..2f76c49 --- /dev/null +++ b/test cases/common/32 has header/ouagadougou.h @@ -0,0 +1 @@ +#define OMG_THIS_SHOULDNT_BE_FOUND diff --git a/test cases/common/33 has header/meson.build b/test cases/common/33 has header/meson.build deleted file mode 100644 index 8096763..0000000 --- a/test cases/common/33 has header/meson.build +++ /dev/null @@ -1,54 +0,0 @@ -project('has header', 'c', 'cpp') - -host_system = host_machine.system() - -non_existent_header = 'ouagadougou.h' - -# Copy it into the builddir to ensure that it isn't found even if it's there -configure_file(input : non_existent_header, - output : non_existent_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_existent_header, prefix : fallback), - 'Found non-existent header.') - endforeach -endforeach diff --git a/test cases/common/33 has header/ouagadougou.h b/test cases/common/33 has header/ouagadougou.h deleted file mode 100644 index 2f76c49..0000000 --- a/test cases/common/33 has header/ouagadougou.h +++ /dev/null @@ -1 +0,0 @@ -#define OMG_THIS_SHOULDNT_BE_FOUND diff --git a/test cases/common/33 run program/check-env.py b/test cases/common/33 run program/check-env.py new file mode 100644 index 0000000..7f106c6 --- /dev/null +++ b/test cases/common/33 run program/check-env.py @@ -0,0 +1,6 @@ +#!/usr/bin/env python3 + +import os + +assert os.environ['MY_PATH'] == os.pathsep.join(['0', '1', '2']) + diff --git a/test cases/common/33 run program/get-version.py b/test cases/common/33 run program/get-version.py new file mode 100644 index 0000000..a22d559 --- /dev/null +++ b/test cases/common/33 run program/get-version.py @@ -0,0 +1,3 @@ +#!/usr/bin/env python3 + +print('1.2') diff --git a/test cases/common/33 run program/meson.build b/test cases/common/33 run program/meson.build new file mode 100644 index 0000000..8e472fd --- /dev/null +++ b/test cases/common/33 run program/meson.build @@ -0,0 +1,85 @@ +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 + +env = environment() +env.append('MY_PATH', '1') +env.append('MY_PATH', '2') +env.prepend('MY_PATH', '0') +run_command('check-env.py', env: env, check: true) diff --git a/test cases/common/33 run program/scripts/hello.bat b/test cases/common/33 run program/scripts/hello.bat new file mode 100644 index 0000000..cbc346b --- /dev/null +++ b/test cases/common/33 run program/scripts/hello.bat @@ -0,0 +1,2 @@ +@ECHO OFF +ECHO hello diff --git a/test cases/common/33 run program/scripts/hello.sh b/test cases/common/33 run program/scripts/hello.sh new file mode 100755 index 0000000..2a22daa --- /dev/null +++ b/test cases/common/33 run program/scripts/hello.sh @@ -0,0 +1,3 @@ +#!/bin/sh + +echo hello diff --git a/test cases/common/34 logic ops/meson.build b/test cases/common/34 logic ops/meson.build new file mode 100644 index 0000000..897054e --- /dev/null +++ b/test cases/common/34 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/34 run program/check-env.py b/test cases/common/34 run program/check-env.py deleted file mode 100644 index 7f106c6..0000000 --- a/test cases/common/34 run program/check-env.py +++ /dev/null @@ -1,6 +0,0 @@ -#!/usr/bin/env python3 - -import os - -assert os.environ['MY_PATH'] == os.pathsep.join(['0', '1', '2']) - diff --git a/test cases/common/34 run program/get-version.py b/test cases/common/34 run program/get-version.py deleted file mode 100644 index a22d559..0000000 --- a/test cases/common/34 run program/get-version.py +++ /dev/null @@ -1,3 +0,0 @@ -#!/usr/bin/env python3 - -print('1.2') diff --git a/test cases/common/34 run program/meson.build b/test cases/common/34 run program/meson.build deleted file mode 100644 index 8e472fd..0000000 --- a/test cases/common/34 run program/meson.build +++ /dev/null @@ -1,85 +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 - -env = environment() -env.append('MY_PATH', '1') -env.append('MY_PATH', '2') -env.prepend('MY_PATH', '0') -run_command('check-env.py', env: env, check: true) diff --git a/test cases/common/34 run program/scripts/hello.bat b/test cases/common/34 run program/scripts/hello.bat deleted file mode 100644 index cbc346b..0000000 --- a/test cases/common/34 run program/scripts/hello.bat +++ /dev/null @@ -1,2 +0,0 @@ -@ECHO OFF -ECHO hello diff --git a/test cases/common/34 run program/scripts/hello.sh b/test cases/common/34 run program/scripts/hello.sh deleted file mode 100755 index 2a22daa..0000000 --- a/test cases/common/34 run program/scripts/hello.sh +++ /dev/null @@ -1,3 +0,0 @@ -#!/bin/sh - -echo hello diff --git a/test cases/common/35 logic ops/meson.build b/test cases/common/35 logic ops/meson.build deleted file mode 100644 index 897054e..0000000 --- a/test cases/common/35 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/35 string operations/meson.build b/test cases/common/35 string operations/meson.build new file mode 100644 index 0000000..ca0342d --- /dev/null +++ b/test cases/common/35 string operations/meson.build @@ -0,0 +1,122 @@ +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.replace('b', 'd') == 'adcde') +assert(long.replace('z', 'x') == long) +assert(long.replace(prefix, suffix) == 'cdede') + +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') + +mysubstring='foobarbaz' +assert(mysubstring.substring() == 'foobarbaz', 'substring is broken') +assert(mysubstring.substring(0) == 'foobarbaz', 'substring is broken') +assert(mysubstring.substring(1) == 'oobarbaz', 'substring is broken') +assert(mysubstring.substring(-5) == 'arbaz', 'substring is broken') +assert(mysubstring.substring(1, 4) == 'oob', 'substring is broken') +assert(mysubstring.substring(1,-5) == 'oob', 'substring is broken') +assert(mysubstring.substring(1, 0) == '', 'substring is broken') +assert(mysubstring.substring(0, 100) == 'foobarbaz', 'substring is broken') +assert(mysubstring.substring(-1, -5) == '', 'substring is broken') +assert(mysubstring.substring(10, -25) == '', 'substring is broken') +assert(mysubstring.substring(-4, 2) == '', 'substring is broken') +assert(mysubstring.substring(10, 9) == '', 'substring is broken') +assert(mysubstring.substring(8, 10) == 'z', 'substring is broken') diff --git a/test cases/common/36 has function/meson.build b/test cases/common/36 has function/meson.build new file mode 100644 index 0000000..a3f0a3c --- /dev/null +++ b/test cases/common/36 has function/meson.build @@ -0,0 +1,116 @@ +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 (before 2.32, see below) 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 the main + # alternative Linux C library (musl) doesn't use glibc's stub mechanism; + # also, it has implemented lchmod since 2013, so it should be safe to check + # that lchmod is available on Linux when not using glibc. + 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 ' + has_lchmod = cc.has_function('lchmod', prefix : lchmod_prefix, args : unit_test_args) + + if host_system == 'linux' + # __GLIBC__ macro can be retrieved by including almost any C library header + glibc_major = cc.get_define('__GLIBC__', prefix: '#include ', args: unit_test_args) + # __GLIBC__ will only be set for glibc + if glibc_major != '' + glibc_minor = cc.get_define('__GLIBC_MINOR__', prefix: '#include ', args: unit_test_args) + glibc_vers = '@0@.@1@'.format(glibc_major, glibc_minor) + message('GLIBC version:', glibc_vers) + + # lchmod was implemented in glibc 2.32 (https://sourceware.org/pipermail/libc-announce/2020/000029.html) + if glibc_vers.version_compare('<2.32') + assert (not has_lchmod, '"lchmod" check should have failed') + else + assert (has_lchmod, '"lchmod" check should have succeeded') + endif + else + # Other C libraries for Linux should have lchmod + assert (has_lchmod, '"lchmod" check should have succeeded') + endif + else + # macOS and *BSD have lchmod + assert (has_lchmod, '"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 + + # We should be able to find GCC and Clang __builtin functions + if ['gcc', 'clang'].contains(cc.get_id()) + # __builtin_constant_p is documented to exist at least as far back as + # GCC 2.95.3 + assert(cc.has_function('__builtin_constant_p', args : unit_test_args), + '__builtin_constant_p must be found under gcc and clang') + endif +endforeach diff --git a/test cases/common/36 string operations/meson.build b/test cases/common/36 string operations/meson.build deleted file mode 100644 index ca0342d..0000000 --- a/test cases/common/36 string operations/meson.build +++ /dev/null @@ -1,122 +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.replace('b', 'd') == 'adcde') -assert(long.replace('z', 'x') == long) -assert(long.replace(prefix, suffix) == 'cdede') - -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') - -mysubstring='foobarbaz' -assert(mysubstring.substring() == 'foobarbaz', 'substring is broken') -assert(mysubstring.substring(0) == 'foobarbaz', 'substring is broken') -assert(mysubstring.substring(1) == 'oobarbaz', 'substring is broken') -assert(mysubstring.substring(-5) == 'arbaz', 'substring is broken') -assert(mysubstring.substring(1, 4) == 'oob', 'substring is broken') -assert(mysubstring.substring(1,-5) == 'oob', 'substring is broken') -assert(mysubstring.substring(1, 0) == '', 'substring is broken') -assert(mysubstring.substring(0, 100) == 'foobarbaz', 'substring is broken') -assert(mysubstring.substring(-1, -5) == '', 'substring is broken') -assert(mysubstring.substring(10, -25) == '', 'substring is broken') -assert(mysubstring.substring(-4, 2) == '', 'substring is broken') -assert(mysubstring.substring(10, 9) == '', 'substring is broken') -assert(mysubstring.substring(8, 10) == 'z', 'substring is broken') diff --git a/test cases/common/37 has function/meson.build b/test cases/common/37 has function/meson.build deleted file mode 100644 index a3f0a3c..0000000 --- a/test cases/common/37 has function/meson.build +++ /dev/null @@ -1,116 +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 (before 2.32, see below) 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 the main - # alternative Linux C library (musl) doesn't use glibc's stub mechanism; - # also, it has implemented lchmod since 2013, so it should be safe to check - # that lchmod is available on Linux when not using glibc. - 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 ' - has_lchmod = cc.has_function('lchmod', prefix : lchmod_prefix, args : unit_test_args) - - if host_system == 'linux' - # __GLIBC__ macro can be retrieved by including almost any C library header - glibc_major = cc.get_define('__GLIBC__', prefix: '#include ', args: unit_test_args) - # __GLIBC__ will only be set for glibc - if glibc_major != '' - glibc_minor = cc.get_define('__GLIBC_MINOR__', prefix: '#include ', args: unit_test_args) - glibc_vers = '@0@.@1@'.format(glibc_major, glibc_minor) - message('GLIBC version:', glibc_vers) - - # lchmod was implemented in glibc 2.32 (https://sourceware.org/pipermail/libc-announce/2020/000029.html) - if glibc_vers.version_compare('<2.32') - assert (not has_lchmod, '"lchmod" check should have failed') - else - assert (has_lchmod, '"lchmod" check should have succeeded') - endif - else - # Other C libraries for Linux should have lchmod - assert (has_lchmod, '"lchmod" check should have succeeded') - endif - else - # macOS and *BSD have lchmod - assert (has_lchmod, '"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 - - # We should be able to find GCC and Clang __builtin functions - if ['gcc', 'clang'].contains(cc.get_id()) - # __builtin_constant_p is documented to exist at least as far back as - # GCC 2.95.3 - assert(cc.has_function('__builtin_constant_p', args : unit_test_args), - '__builtin_constant_p must be found under gcc and clang') - endif -endforeach diff --git a/test cases/common/37 has member/meson.build b/test cases/common/37 has member/meson.build new file mode 100644 index 0000000..4e61956 --- /dev/null +++ b/test cases/common/37 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/38 alignment/meson.build b/test cases/common/38 alignment/meson.build new file mode 100644 index 0000000..a9bd65b --- /dev/null +++ b/test cases/common/38 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/38 has member/meson.build b/test cases/common/38 has member/meson.build deleted file mode 100644 index 4e61956..0000000 --- a/test cases/common/38 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/39 alignment/meson.build b/test cases/common/39 alignment/meson.build deleted file mode 100644 index a9bd65b..0000000 --- a/test cases/common/39 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/39 library chain/main.c b/test cases/common/39 library chain/main.c new file mode 100644 index 0000000..9c88e73 --- /dev/null +++ b/test cases/common/39 library chain/main.c @@ -0,0 +1,5 @@ +int libfun(void); + +int main(void) { + return libfun(); +} diff --git a/test cases/common/39 library chain/meson.build b/test cases/common/39 library chain/meson.build new file mode 100644 index 0000000..77528d7 --- /dev/null +++ b/test cases/common/39 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/39 library chain/subdir/lib1.c b/test cases/common/39 library chain/subdir/lib1.c new file mode 100644 index 0000000..88436b2 --- /dev/null +++ b/test cases/common/39 library chain/subdir/lib1.c @@ -0,0 +1,17 @@ +int lib2fun(void); +int lib3fun(void); + +#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(void) { + return lib2fun() + lib3fun(); +} diff --git a/test cases/common/39 library chain/subdir/meson.build b/test cases/common/39 library chain/subdir/meson.build new file mode 100644 index 0000000..ab71bda --- /dev/null +++ b/test cases/common/39 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/39 library chain/subdir/subdir2/lib2.c b/test cases/common/39 library chain/subdir/subdir2/lib2.c new file mode 100644 index 0000000..e788f07 --- /dev/null +++ b/test cases/common/39 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(void) { + return 0; +} diff --git a/test cases/common/39 library chain/subdir/subdir2/meson.build b/test cases/common/39 library chain/subdir/subdir2/meson.build new file mode 100644 index 0000000..befd94d --- /dev/null +++ b/test cases/common/39 library chain/subdir/subdir2/meson.build @@ -0,0 +1 @@ +lib2 = shared_library('lib2', 'lib2.c', install : false) diff --git a/test cases/common/39 library chain/subdir/subdir3/lib3.c b/test cases/common/39 library chain/subdir/subdir3/lib3.c new file mode 100644 index 0000000..a99c64e --- /dev/null +++ b/test cases/common/39 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(void) { + return 0; +} diff --git a/test cases/common/39 library chain/subdir/subdir3/meson.build b/test cases/common/39 library chain/subdir/subdir3/meson.build new file mode 100644 index 0000000..7bd249a --- /dev/null +++ b/test cases/common/39 library chain/subdir/subdir3/meson.build @@ -0,0 +1 @@ +lib3 = shared_library('lib3', 'lib3.c', install : false) diff --git a/test cases/common/39 library chain/test.json b/test cases/common/39 library chain/test.json new file mode 100644 index 0000000..135300d --- /dev/null +++ b/test cases/common/39 library chain/test.json @@ -0,0 +1,6 @@ +{ + "installed": [ + {"type": "exe", "file": "usr/bin/prog"}, + {"type": "pdb", "file": "usr/bin/prog"} + ] +} diff --git a/test cases/common/40 library chain/main.c b/test cases/common/40 library chain/main.c deleted file mode 100644 index 9c88e73..0000000 --- a/test cases/common/40 library chain/main.c +++ /dev/null @@ -1,5 +0,0 @@ -int libfun(void); - -int main(void) { - return libfun(); -} diff --git a/test cases/common/40 library chain/meson.build b/test cases/common/40 library chain/meson.build deleted file mode 100644 index 77528d7..0000000 --- a/test cases/common/40 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/40 library chain/subdir/lib1.c b/test cases/common/40 library chain/subdir/lib1.c deleted file mode 100644 index 88436b2..0000000 --- a/test cases/common/40 library chain/subdir/lib1.c +++ /dev/null @@ -1,17 +0,0 @@ -int lib2fun(void); -int lib3fun(void); - -#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(void) { - return lib2fun() + lib3fun(); -} diff --git a/test cases/common/40 library chain/subdir/meson.build b/test cases/common/40 library chain/subdir/meson.build deleted file mode 100644 index ab71bda..0000000 --- a/test cases/common/40 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/40 library chain/subdir/subdir2/lib2.c b/test cases/common/40 library chain/subdir/subdir2/lib2.c deleted file mode 100644 index e788f07..0000000 --- a/test cases/common/40 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(void) { - return 0; -} diff --git a/test cases/common/40 library chain/subdir/subdir2/meson.build b/test cases/common/40 library chain/subdir/subdir2/meson.build deleted file mode 100644 index befd94d..0000000 --- a/test cases/common/40 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/40 library chain/subdir/subdir3/lib3.c b/test cases/common/40 library chain/subdir/subdir3/lib3.c deleted file mode 100644 index a99c64e..0000000 --- a/test cases/common/40 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(void) { - return 0; -} diff --git a/test cases/common/40 library chain/subdir/subdir3/meson.build b/test cases/common/40 library chain/subdir/subdir3/meson.build deleted file mode 100644 index 7bd249a..0000000 --- a/test cases/common/40 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/40 library chain/test.json b/test cases/common/40 library chain/test.json deleted file mode 100644 index 135300d..0000000 --- a/test cases/common/40 library chain/test.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "installed": [ - {"type": "exe", "file": "usr/bin/prog"}, - {"type": "pdb", "file": "usr/bin/prog"} - ] -} diff --git a/test cases/common/40 options/meson.build b/test cases/common/40 options/meson.build new file mode 100644 index 0000000..2eccef7 --- /dev/null +++ b/test cases/common/40 options/meson.build @@ -0,0 +1,45 @@ +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 + +if get_option('neg_int_opt') != -3 + error('Incorrect value in negative integer option.') +endif + +if get_option('CaseSenSiTivE') != 'Some CAPS' + error('Incorrect value in mixed caps option.') +endif + +if get_option('CASESENSITIVE') != 'ALL CAPS' + error('Incorrect value in all caps option.') +endif + +assert(get_option('wrap_mode') == 'default', 'Wrap mode option is broken.') diff --git a/test cases/common/40 options/meson_options.txt b/test cases/common/40 options/meson_options.txt new file mode 100644 index 0000000..8067eae --- /dev/null +++ b/test cases/common/40 options/meson_options.txt @@ -0,0 +1,9 @@ +option('testoption', type : 'string', value : 'optval', description : 'An option ' + 'to do something') +option('other_one', type : 'boolean', value : not (not (not (not false)))) +option('combo_opt', type : 'co' + 'mbo', 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) +option('neg' + '_' + 'int' + '_' + 'opt', type : 'integer', min : -5, max : 5, value : -3) +option('CaseSenSiTivE', type : 'string', value: 'Some CAPS', description : 'An option with mixed capitaliziation') +option('CASESENSITIVE', type : 'string', value: 'ALL CAPS', description : 'An option with all caps') diff --git a/test cases/common/41 options/meson.build b/test cases/common/41 options/meson.build deleted file mode 100644 index 2eccef7..0000000 --- a/test cases/common/41 options/meson.build +++ /dev/null @@ -1,45 +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 - -if get_option('neg_int_opt') != -3 - error('Incorrect value in negative integer option.') -endif - -if get_option('CaseSenSiTivE') != 'Some CAPS' - error('Incorrect value in mixed caps option.') -endif - -if get_option('CASESENSITIVE') != 'ALL CAPS' - error('Incorrect value in all caps option.') -endif - -assert(get_option('wrap_mode') == 'default', 'Wrap mode option is broken.') diff --git a/test cases/common/41 options/meson_options.txt b/test cases/common/41 options/meson_options.txt deleted file mode 100644 index 8067eae..0000000 --- a/test cases/common/41 options/meson_options.txt +++ /dev/null @@ -1,9 +0,0 @@ -option('testoption', type : 'string', value : 'optval', description : 'An option ' + 'to do something') -option('other_one', type : 'boolean', value : not (not (not (not false)))) -option('combo_opt', type : 'co' + 'mbo', 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) -option('neg' + '_' + 'int' + '_' + 'opt', type : 'integer', min : -5, max : 5, value : -3) -option('CaseSenSiTivE', type : 'string', value: 'Some CAPS', description : 'An option with mixed capitaliziation') -option('CASESENSITIVE', type : 'string', value: 'ALL CAPS', description : 'An option with all caps') diff --git a/test cases/common/41 test args/cmd_args.c b/test cases/common/41 test args/cmd_args.c new file mode 100644 index 0000000..545b795 --- /dev/null +++ b/test cases/common/41 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/41 test args/copyfile.py b/test cases/common/41 test args/copyfile.py new file mode 100644 index 0000000..ff42ac3 --- /dev/null +++ b/test cases/common/41 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/41 test args/env2vars.c b/test cases/common/41 test args/env2vars.c new file mode 100644 index 0000000..e940c9a --- /dev/null +++ b/test cases/common/41 test args/env2vars.c @@ -0,0 +1,23 @@ +#include +#include +#include + +int main(void) { + 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/41 test args/envvars.c b/test cases/common/41 test args/envvars.c new file mode 100644 index 0000000..086b0be --- /dev/null +++ b/test cases/common/41 test args/envvars.c @@ -0,0 +1,23 @@ +#include +#include +#include + +int main(void) { + 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/41 test args/meson.build b/test cases/common/41 test args/meson.build new file mode 100644 index 0000000..81d3491 --- /dev/null +++ b/test cases/common/41 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/41 test args/tester.c b/test cases/common/41 test args/tester.c new file mode 100644 index 0000000..419277e --- /dev/null +++ b/test cases/common/41 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/41 test args/tester.py b/test cases/common/41 test args/tester.py new file mode 100755 index 0000000..0b4010a --- /dev/null +++ b/test cases/common/41 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/41 test args/testfile.txt b/test cases/common/41 test args/testfile.txt new file mode 100644 index 0000000..12f00e9 --- /dev/null +++ b/test cases/common/41 test args/testfile.txt @@ -0,0 +1 @@ +contents diff --git a/test cases/common/42 subproject/meson.build b/test cases/common/42 subproject/meson.build new file mode 100644 index 0000000..2b939d1 --- /dev/null +++ b/test cases/common/42 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/42 subproject/subprojects/sublib/include/subdefs.h b/test cases/common/42 subproject/subprojects/sublib/include/subdefs.h new file mode 100644 index 0000000..6ae8462 --- /dev/null +++ b/test cases/common/42 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(void); + +#endif diff --git a/test cases/common/42 subproject/subprojects/sublib/meson.build b/test cases/common/42 subproject/subprojects/sublib/meson.build new file mode 100644 index 0000000..acaf1bf --- /dev/null +++ b/test cases/common/42 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/42 subproject/subprojects/sublib/simpletest.c b/test cases/common/42 subproject/subprojects/sublib/simpletest.c new file mode 100644 index 0000000..2184bc6 --- /dev/null +++ b/test cases/common/42 subproject/subprojects/sublib/simpletest.c @@ -0,0 +1,5 @@ +#include + +int main(void) { + return subfunc() == 42 ? 0 : 1; +} diff --git a/test cases/common/42 subproject/subprojects/sublib/sublib.c b/test cases/common/42 subproject/subprojects/sublib/sublib.c new file mode 100644 index 0000000..f71564f --- /dev/null +++ b/test cases/common/42 subproject/subprojects/sublib/sublib.c @@ -0,0 +1,5 @@ +#include + +int DLL_PUBLIC subfunc(void) { + return 42; +} diff --git a/test cases/common/42 subproject/test.json b/test cases/common/42 subproject/test.json new file mode 100644 index 0000000..a56106f --- /dev/null +++ b/test cases/common/42 subproject/test.json @@ -0,0 +1,7 @@ +{ + "installed": [ + {"type": "exe", "file": "usr/bin/user"}, + {"type": "pdb", "file": "usr/bin/user"}, + {"type": "file", "file": "usr/share/sublib/sublib.depmf"} + ] +} diff --git a/test cases/common/42 subproject/user.c b/test cases/common/42 subproject/user.c new file mode 100644 index 0000000..9181622 --- /dev/null +++ b/test cases/common/42 subproject/user.c @@ -0,0 +1,16 @@ +#include +#include + + +int main(void) { + 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/42 test args/cmd_args.c b/test cases/common/42 test args/cmd_args.c deleted file mode 100644 index 545b795..0000000 --- a/test cases/common/42 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/42 test args/copyfile.py b/test cases/common/42 test args/copyfile.py deleted file mode 100644 index ff42ac3..0000000 --- a/test cases/common/42 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/42 test args/env2vars.c b/test cases/common/42 test args/env2vars.c deleted file mode 100644 index e940c9a..0000000 --- a/test cases/common/42 test args/env2vars.c +++ /dev/null @@ -1,23 +0,0 @@ -#include -#include -#include - -int main(void) { - 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/42 test args/envvars.c b/test cases/common/42 test args/envvars.c deleted file mode 100644 index 086b0be..0000000 --- a/test cases/common/42 test args/envvars.c +++ /dev/null @@ -1,23 +0,0 @@ -#include -#include -#include - -int main(void) { - 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/42 test args/meson.build b/test cases/common/42 test args/meson.build deleted file mode 100644 index 81d3491..0000000 --- a/test cases/common/42 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/42 test args/tester.c b/test cases/common/42 test args/tester.c deleted file mode 100644 index 419277e..0000000 --- a/test cases/common/42 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/42 test args/tester.py b/test cases/common/42 test args/tester.py deleted file mode 100755 index 0b4010a..0000000 --- a/test cases/common/42 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/42 test args/testfile.txt b/test cases/common/42 test args/testfile.txt deleted file mode 100644 index 12f00e9..0000000 --- a/test cases/common/42 test args/testfile.txt +++ /dev/null @@ -1 +0,0 @@ -contents diff --git a/test cases/common/43 subproject options/meson.build b/test cases/common/43 subproject options/meson.build new file mode 100644 index 0000000..d4598b6 --- /dev/null +++ b/test cases/common/43 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/43 subproject options/meson_options.txt b/test cases/common/43 subproject options/meson_options.txt new file mode 100644 index 0000000..c295ddd --- /dev/null +++ b/test cases/common/43 subproject options/meson_options.txt @@ -0,0 +1 @@ +option('opt', type : 'boolean', value : true, description : 'main project option') diff --git a/test cases/common/43 subproject options/subprojects/subproject/meson.build b/test cases/common/43 subproject options/subprojects/subproject/meson.build new file mode 100644 index 0000000..5000b86 --- /dev/null +++ b/test cases/common/43 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/43 subproject options/subprojects/subproject/meson_options.txt b/test cases/common/43 subproject options/subprojects/subproject/meson_options.txt new file mode 100644 index 0000000..ac78533 --- /dev/null +++ b/test cases/common/43 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/43 subproject/meson.build b/test cases/common/43 subproject/meson.build deleted file mode 100644 index 2b939d1..0000000 --- a/test cases/common/43 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/43 subproject/subprojects/sublib/include/subdefs.h b/test cases/common/43 subproject/subprojects/sublib/include/subdefs.h deleted file mode 100644 index 6ae8462..0000000 --- a/test cases/common/43 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(void); - -#endif diff --git a/test cases/common/43 subproject/subprojects/sublib/meson.build b/test cases/common/43 subproject/subprojects/sublib/meson.build deleted file mode 100644 index acaf1bf..0000000 --- a/test cases/common/43 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/43 subproject/subprojects/sublib/simpletest.c b/test cases/common/43 subproject/subprojects/sublib/simpletest.c deleted file mode 100644 index 2184bc6..0000000 --- a/test cases/common/43 subproject/subprojects/sublib/simpletest.c +++ /dev/null @@ -1,5 +0,0 @@ -#include - -int main(void) { - return subfunc() == 42 ? 0 : 1; -} diff --git a/test cases/common/43 subproject/subprojects/sublib/sublib.c b/test cases/common/43 subproject/subprojects/sublib/sublib.c deleted file mode 100644 index f71564f..0000000 --- a/test cases/common/43 subproject/subprojects/sublib/sublib.c +++ /dev/null @@ -1,5 +0,0 @@ -#include - -int DLL_PUBLIC subfunc(void) { - return 42; -} diff --git a/test cases/common/43 subproject/test.json b/test cases/common/43 subproject/test.json deleted file mode 100644 index a56106f..0000000 --- a/test cases/common/43 subproject/test.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "installed": [ - {"type": "exe", "file": "usr/bin/user"}, - {"type": "pdb", "file": "usr/bin/user"}, - {"type": "file", "file": "usr/share/sublib/sublib.depmf"} - ] -} diff --git a/test cases/common/43 subproject/user.c b/test cases/common/43 subproject/user.c deleted file mode 100644 index 9181622..0000000 --- a/test cases/common/43 subproject/user.c +++ /dev/null @@ -1,16 +0,0 @@ -#include -#include - - -int main(void) { - 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/44 pkgconfig-gen/dependencies/custom.c b/test cases/common/44 pkgconfig-gen/dependencies/custom.c new file mode 100644 index 0000000..1d3deca --- /dev/null +++ b/test cases/common/44 pkgconfig-gen/dependencies/custom.c @@ -0,0 +1,3 @@ +int custom_function(void) { + return 42; +} diff --git a/test cases/common/44 pkgconfig-gen/dependencies/exposed.c b/test cases/common/44 pkgconfig-gen/dependencies/exposed.c new file mode 100644 index 0000000..caa4591 --- /dev/null +++ b/test cases/common/44 pkgconfig-gen/dependencies/exposed.c @@ -0,0 +1,3 @@ +int exposed_function(void) { + return 42; +} diff --git a/test cases/common/44 pkgconfig-gen/dependencies/internal.c b/test cases/common/44 pkgconfig-gen/dependencies/internal.c new file mode 100644 index 0000000..23b07ec --- /dev/null +++ b/test cases/common/44 pkgconfig-gen/dependencies/internal.c @@ -0,0 +1,3 @@ +int internal_function(void) { + return 42; +} diff --git a/test cases/common/44 pkgconfig-gen/dependencies/main.c b/test cases/common/44 pkgconfig-gen/dependencies/main.c new file mode 100644 index 0000000..397d40c --- /dev/null +++ b/test cases/common/44 pkgconfig-gen/dependencies/main.c @@ -0,0 +1,10 @@ +#include + +#ifndef LIBFOO +#error LIBFOO should be defined in pkgconfig cflags +#endif + +int main(int argc, char *argv[]) +{ + return simple_function() == 42 ? 0 : 1; +} diff --git a/test cases/common/44 pkgconfig-gen/dependencies/meson.build b/test cases/common/44 pkgconfig-gen/dependencies/meson.build new file mode 100644 index 0000000..fb4e6b4 --- /dev/null +++ b/test cases/common/44 pkgconfig-gen/dependencies/meson.build @@ -0,0 +1,62 @@ +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']) + +exe = executable('test1', 'main.c', dependencies : [pc_dep]) +test('Test1', exe) + +# 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], +) + +# Verify that if we promote internal_lib as public dependency, it comes after +# the main library. +main_lib2 = both_libraries('libmain2', link_with : internal_lib) +pkgg.generate(main_lib2, + libraries : internal_lib, + filebase : 'pub-lib-order', +) diff --git a/test cases/common/44 pkgconfig-gen/meson.build b/test cases/common/44 pkgconfig-gen/meson.build new file mode 100644 index 0000000..7885391 --- /dev/null +++ b/test cases/common/44 pkgconfig-gen/meson.build @@ -0,0 +1,122 @@ +project('pkgconfig-gen', 'c') + +# Some CI runners does not have zlib, just skip them as we need some common +# external dependency. +cc = meson.get_compiler('c') +if not cc.find_library('z', required: false).found() + error('MESON_SKIP_TEST: zlib missing') +endif + +# 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'], + extra_cflags : ['-DLIBFOO'], +) + +pkgg.generate( + name : 'libhello', + description : 'A minimalistic pkgconfig file.', + version : libver, +) + +pkgg.generate( + name : 'libhello_nolib', + description : 'A minimalistic pkgconfig file.', + version : libver, + dataonly: true, + variables : { + 'foo': 'bar', + # prefix is not set by default for dataonly pc files, but it is allowed to + # define it manually. + 'prefix': get_option('prefix'), + }, +) + +# Regression test for 2 cases: +# - link_whole from InternalDependency used to be ignored, but we should still +# recurse to add libraries they link to. In this case it must add `-lsimple1` +# in generated pc file. +# - dependencies from InternalDependency used to be ignored. In this it must add +# `-lz` in generated pc file. +simple1 = shared_library('simple1', 'simple.c') +stat1 = static_library('stat1', 'simple.c', link_with: simple1) +dep = declare_dependency(link_whole: stat1, dependencies: cc.find_library('z')) +simple2 = library('simple2', 'simple.c') +pkgg.generate(simple2, libraries: dep) + +# Regression test: as_system() does a deepcopy() of the InternalDependency object +# which caused `-lsimple3` to be duplicated because generator used to compare +# Target instances instead of their id. +simple3 = shared_library('simple3', 'simple.c') +dep1 = declare_dependency(link_with: simple3) +dep2 = dep1.as_system() +pkgg.generate(libraries: [dep1, dep2], + name: 'simple3', + description: 'desc') + +# Regression test: stat2 is both link_with and link_whole, it should not appear +# in generated pc file. +stat2 = static_library('stat2', 'simple.c', install: true) +simple4 = library('simple4', 'simple.c', link_with: stat2) +simple5 = library('simple5', 'simple5.c', link_with: simple4, link_whole: stat2) +pkgg.generate(simple5) + +# Test passing a linkable CustomTarget and CustomTargetIndex to generator. +# Do this only with gcc/clang to not have to deal with other compiler command +# line specificities. +if cc.get_id() in ['gcc', 'clang'] + ct = custom_target('ct', + input: 'simple.c', + output: 'libct.so', + command: [cc.cmd_array(), '@INPUT@', '-shared', '-o', '@OUTPUT@'], + ) + pkgg.generate(libraries: ct, + name: 'ct', + description: 'custom target' + ) + pkgg.generate(libraries: ct[0], + name: 'ct0', + description: 'custom target index' + ) +endif diff --git a/test cases/common/44 pkgconfig-gen/simple.c b/test cases/common/44 pkgconfig-gen/simple.c new file mode 100644 index 0000000..ff86f31 --- /dev/null +++ b/test cases/common/44 pkgconfig-gen/simple.c @@ -0,0 +1,5 @@ +#include"simple.h" + +int simple_function(void) { + return 42; +} diff --git a/test cases/common/44 pkgconfig-gen/simple.h b/test cases/common/44 pkgconfig-gen/simple.h new file mode 100644 index 0000000..6896bfd --- /dev/null +++ b/test cases/common/44 pkgconfig-gen/simple.h @@ -0,0 +1,6 @@ +#ifndef SIMPLE_H_ +#define SIMPLE_H_ + +int simple_function(void); + +#endif diff --git a/test cases/common/44 pkgconfig-gen/simple5.c b/test cases/common/44 pkgconfig-gen/simple5.c new file mode 100644 index 0000000..9f924bd --- /dev/null +++ b/test cases/common/44 pkgconfig-gen/simple5.c @@ -0,0 +1,6 @@ +int simple5(void); + +int simple5(void) +{ + return 0; +} diff --git a/test cases/common/44 pkgconfig-gen/test.json b/test cases/common/44 pkgconfig-gen/test.json new file mode 100644 index 0000000..e741a62 --- /dev/null +++ b/test cases/common/44 pkgconfig-gen/test.json @@ -0,0 +1,15 @@ +{ + "installed": [ + {"type": "file", "file": "usr/include/simple.h"}, + {"type": "file", "file": "usr/lib/libstat2.a"}, + {"type": "file", "file": "usr/lib/pkgconfig/simple.pc"}, + {"type": "file", "file": "usr/lib/pkgconfig/libfoo.pc"}, + {"type": "file", "file": "usr/lib/pkgconfig/libhello.pc"}, + {"type": "file", "file": "usr/lib/pkgconfig/libhello_nolib.pc"}, + {"type": "file", "file": "usr/lib/pkgconfig/simple2.pc"}, + {"type": "file", "file": "usr/lib/pkgconfig/simple3.pc"}, + {"type": "file", "file": "usr/lib/pkgconfig/simple5.pc"}, + {"type": "file", "file": "usr/lib/pkgconfig/ct.pc"}, + {"type": "file", "file": "usr/lib/pkgconfig/ct0.pc"} + ] +} diff --git a/test cases/common/44 subproject options/meson.build b/test cases/common/44 subproject options/meson.build deleted file mode 100644 index d4598b6..0000000 --- a/test cases/common/44 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/44 subproject options/meson_options.txt b/test cases/common/44 subproject options/meson_options.txt deleted file mode 100644 index c295ddd..0000000 --- a/test cases/common/44 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/44 subproject options/subprojects/subproject/meson.build b/test cases/common/44 subproject options/subprojects/subproject/meson.build deleted file mode 100644 index 5000b86..0000000 --- a/test cases/common/44 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/44 subproject options/subprojects/subproject/meson_options.txt b/test cases/common/44 subproject options/subprojects/subproject/meson_options.txt deleted file mode 100644 index ac78533..0000000 --- a/test cases/common/44 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/45 custom install dirs/datafile.cat b/test cases/common/45 custom install dirs/datafile.cat new file mode 100644 index 0000000..53d81fc --- /dev/null +++ b/test cases/common/45 custom install dirs/datafile.cat @@ -0,0 +1 @@ +Installed cat is installed. diff --git a/test cases/common/45 custom install dirs/meson.build b/test cases/common/45 custom install dirs/meson.build new file mode 100644 index 0000000..494ff0e --- /dev/null +++ b/test cases/common/45 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/45 custom install dirs/prog.1 b/test cases/common/45 custom install dirs/prog.1 new file mode 100644 index 0000000..08ef7da --- /dev/null +++ b/test cases/common/45 custom install dirs/prog.1 @@ -0,0 +1 @@ +Man up, you. diff --git a/test cases/common/45 custom install dirs/prog.c b/test cases/common/45 custom install dirs/prog.c new file mode 100644 index 0000000..9b6bdc2 --- /dev/null +++ b/test cases/common/45 custom install dirs/prog.c @@ -0,0 +1,3 @@ +int main(void) { + return 0; +} diff --git a/test cases/common/45 custom install dirs/sample.h b/test cases/common/45 custom install dirs/sample.h new file mode 100644 index 0000000..dc030da --- /dev/null +++ b/test cases/common/45 custom install dirs/sample.h @@ -0,0 +1,6 @@ +#ifndef SAMPLE_H +#define SAMPLE_H + +int wackiness(); + +#endif diff --git a/test cases/common/45 custom install dirs/subdir/datafile.dog b/test cases/common/45 custom install dirs/subdir/datafile.dog new file mode 100644 index 0000000..7a5bcb7 --- /dev/null +++ b/test cases/common/45 custom install dirs/subdir/datafile.dog @@ -0,0 +1 @@ +Installed dog is installed. diff --git a/test cases/common/45 custom install dirs/test.json b/test cases/common/45 custom install dirs/test.json new file mode 100644 index 0000000..ac82fdb --- /dev/null +++ b/test cases/common/45 custom install dirs/test.json @@ -0,0 +1,16 @@ +{ + "installed": [ + {"type": "exe", "file": "usr/dib/dab/dub/prog"}, + {"type": "pdb", "file": "usr/dib/dab/dub/prog"}, + {"type": "exe", "file": "usr/dib/dab/dub2/prog2"}, + {"type": "pdb", "file": "usr/dib/dab/dub2/prog2"}, + {"type": "file", "file": "usr/some/dir/sample.h"}, + {"type": "file", "file": "usr/some/dir2/sample.h"}, + {"type": "file", "file": "usr/woman/prog.1"}, + {"type": "file", "file": "usr/woman2/prog.1"}, + {"type": "file", "file": "usr/meow/datafile.cat"}, + {"type": "file", "file": "usr/meow2/datafile.cat"}, + {"type": "file", "file": "usr/woof/subdir/datafile.dog"}, + {"type": "file", "file": "usr/woof2/subdir/datafile.dog"} + ] +} diff --git a/test cases/common/45 pkgconfig-gen/dependencies/custom.c b/test cases/common/45 pkgconfig-gen/dependencies/custom.c deleted file mode 100644 index 1d3deca..0000000 --- a/test cases/common/45 pkgconfig-gen/dependencies/custom.c +++ /dev/null @@ -1,3 +0,0 @@ -int custom_function(void) { - return 42; -} diff --git a/test cases/common/45 pkgconfig-gen/dependencies/exposed.c b/test cases/common/45 pkgconfig-gen/dependencies/exposed.c deleted file mode 100644 index caa4591..0000000 --- a/test cases/common/45 pkgconfig-gen/dependencies/exposed.c +++ /dev/null @@ -1,3 +0,0 @@ -int exposed_function(void) { - return 42; -} diff --git a/test cases/common/45 pkgconfig-gen/dependencies/internal.c b/test cases/common/45 pkgconfig-gen/dependencies/internal.c deleted file mode 100644 index 23b07ec..0000000 --- a/test cases/common/45 pkgconfig-gen/dependencies/internal.c +++ /dev/null @@ -1,3 +0,0 @@ -int internal_function(void) { - return 42; -} diff --git a/test cases/common/45 pkgconfig-gen/dependencies/main.c b/test cases/common/45 pkgconfig-gen/dependencies/main.c deleted file mode 100644 index 397d40c..0000000 --- a/test cases/common/45 pkgconfig-gen/dependencies/main.c +++ /dev/null @@ -1,10 +0,0 @@ -#include - -#ifndef LIBFOO -#error LIBFOO should be defined in pkgconfig cflags -#endif - -int main(int argc, char *argv[]) -{ - return simple_function() == 42 ? 0 : 1; -} diff --git a/test cases/common/45 pkgconfig-gen/dependencies/meson.build b/test cases/common/45 pkgconfig-gen/dependencies/meson.build deleted file mode 100644 index fb4e6b4..0000000 --- a/test cases/common/45 pkgconfig-gen/dependencies/meson.build +++ /dev/null @@ -1,62 +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']) - -exe = executable('test1', 'main.c', dependencies : [pc_dep]) -test('Test1', exe) - -# 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], -) - -# Verify that if we promote internal_lib as public dependency, it comes after -# the main library. -main_lib2 = both_libraries('libmain2', link_with : internal_lib) -pkgg.generate(main_lib2, - libraries : internal_lib, - filebase : 'pub-lib-order', -) diff --git a/test cases/common/45 pkgconfig-gen/meson.build b/test cases/common/45 pkgconfig-gen/meson.build deleted file mode 100644 index 7885391..0000000 --- a/test cases/common/45 pkgconfig-gen/meson.build +++ /dev/null @@ -1,122 +0,0 @@ -project('pkgconfig-gen', 'c') - -# Some CI runners does not have zlib, just skip them as we need some common -# external dependency. -cc = meson.get_compiler('c') -if not cc.find_library('z', required: false).found() - error('MESON_SKIP_TEST: zlib missing') -endif - -# 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'], - extra_cflags : ['-DLIBFOO'], -) - -pkgg.generate( - name : 'libhello', - description : 'A minimalistic pkgconfig file.', - version : libver, -) - -pkgg.generate( - name : 'libhello_nolib', - description : 'A minimalistic pkgconfig file.', - version : libver, - dataonly: true, - variables : { - 'foo': 'bar', - # prefix is not set by default for dataonly pc files, but it is allowed to - # define it manually. - 'prefix': get_option('prefix'), - }, -) - -# Regression test for 2 cases: -# - link_whole from InternalDependency used to be ignored, but we should still -# recurse to add libraries they link to. In this case it must add `-lsimple1` -# in generated pc file. -# - dependencies from InternalDependency used to be ignored. In this it must add -# `-lz` in generated pc file. -simple1 = shared_library('simple1', 'simple.c') -stat1 = static_library('stat1', 'simple.c', link_with: simple1) -dep = declare_dependency(link_whole: stat1, dependencies: cc.find_library('z')) -simple2 = library('simple2', 'simple.c') -pkgg.generate(simple2, libraries: dep) - -# Regression test: as_system() does a deepcopy() of the InternalDependency object -# which caused `-lsimple3` to be duplicated because generator used to compare -# Target instances instead of their id. -simple3 = shared_library('simple3', 'simple.c') -dep1 = declare_dependency(link_with: simple3) -dep2 = dep1.as_system() -pkgg.generate(libraries: [dep1, dep2], - name: 'simple3', - description: 'desc') - -# Regression test: stat2 is both link_with and link_whole, it should not appear -# in generated pc file. -stat2 = static_library('stat2', 'simple.c', install: true) -simple4 = library('simple4', 'simple.c', link_with: stat2) -simple5 = library('simple5', 'simple5.c', link_with: simple4, link_whole: stat2) -pkgg.generate(simple5) - -# Test passing a linkable CustomTarget and CustomTargetIndex to generator. -# Do this only with gcc/clang to not have to deal with other compiler command -# line specificities. -if cc.get_id() in ['gcc', 'clang'] - ct = custom_target('ct', - input: 'simple.c', - output: 'libct.so', - command: [cc.cmd_array(), '@INPUT@', '-shared', '-o', '@OUTPUT@'], - ) - pkgg.generate(libraries: ct, - name: 'ct', - description: 'custom target' - ) - pkgg.generate(libraries: ct[0], - name: 'ct0', - description: 'custom target index' - ) -endif diff --git a/test cases/common/45 pkgconfig-gen/simple.c b/test cases/common/45 pkgconfig-gen/simple.c deleted file mode 100644 index ff86f31..0000000 --- a/test cases/common/45 pkgconfig-gen/simple.c +++ /dev/null @@ -1,5 +0,0 @@ -#include"simple.h" - -int simple_function(void) { - return 42; -} diff --git a/test cases/common/45 pkgconfig-gen/simple.h b/test cases/common/45 pkgconfig-gen/simple.h deleted file mode 100644 index 6896bfd..0000000 --- a/test cases/common/45 pkgconfig-gen/simple.h +++ /dev/null @@ -1,6 +0,0 @@ -#ifndef SIMPLE_H_ -#define SIMPLE_H_ - -int simple_function(void); - -#endif diff --git a/test cases/common/45 pkgconfig-gen/simple5.c b/test cases/common/45 pkgconfig-gen/simple5.c deleted file mode 100644 index 9f924bd..0000000 --- a/test cases/common/45 pkgconfig-gen/simple5.c +++ /dev/null @@ -1,6 +0,0 @@ -int simple5(void); - -int simple5(void) -{ - return 0; -} diff --git a/test cases/common/45 pkgconfig-gen/test.json b/test cases/common/45 pkgconfig-gen/test.json deleted file mode 100644 index e741a62..0000000 --- a/test cases/common/45 pkgconfig-gen/test.json +++ /dev/null @@ -1,15 +0,0 @@ -{ - "installed": [ - {"type": "file", "file": "usr/include/simple.h"}, - {"type": "file", "file": "usr/lib/libstat2.a"}, - {"type": "file", "file": "usr/lib/pkgconfig/simple.pc"}, - {"type": "file", "file": "usr/lib/pkgconfig/libfoo.pc"}, - {"type": "file", "file": "usr/lib/pkgconfig/libhello.pc"}, - {"type": "file", "file": "usr/lib/pkgconfig/libhello_nolib.pc"}, - {"type": "file", "file": "usr/lib/pkgconfig/simple2.pc"}, - {"type": "file", "file": "usr/lib/pkgconfig/simple3.pc"}, - {"type": "file", "file": "usr/lib/pkgconfig/simple5.pc"}, - {"type": "file", "file": "usr/lib/pkgconfig/ct.pc"}, - {"type": "file", "file": "usr/lib/pkgconfig/ct0.pc"} - ] -} diff --git a/test cases/common/46 custom install dirs/datafile.cat b/test cases/common/46 custom install dirs/datafile.cat deleted file mode 100644 index 53d81fc..0000000 --- a/test cases/common/46 custom install dirs/datafile.cat +++ /dev/null @@ -1 +0,0 @@ -Installed cat is installed. diff --git a/test cases/common/46 custom install dirs/meson.build b/test cases/common/46 custom install dirs/meson.build deleted file mode 100644 index 494ff0e..0000000 --- a/test cases/common/46 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/46 custom install dirs/prog.1 b/test cases/common/46 custom install dirs/prog.1 deleted file mode 100644 index 08ef7da..0000000 --- a/test cases/common/46 custom install dirs/prog.1 +++ /dev/null @@ -1 +0,0 @@ -Man up, you. diff --git a/test cases/common/46 custom install dirs/prog.c b/test cases/common/46 custom install dirs/prog.c deleted file mode 100644 index 9b6bdc2..0000000 --- a/test cases/common/46 custom install dirs/prog.c +++ /dev/null @@ -1,3 +0,0 @@ -int main(void) { - return 0; -} diff --git a/test cases/common/46 custom install dirs/sample.h b/test cases/common/46 custom install dirs/sample.h deleted file mode 100644 index dc030da..0000000 --- a/test cases/common/46 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/46 custom install dirs/subdir/datafile.dog b/test cases/common/46 custom install dirs/subdir/datafile.dog deleted file mode 100644 index 7a5bcb7..0000000 --- a/test cases/common/46 custom install dirs/subdir/datafile.dog +++ /dev/null @@ -1 +0,0 @@ -Installed dog is installed. diff --git a/test cases/common/46 custom install dirs/test.json b/test cases/common/46 custom install dirs/test.json deleted file mode 100644 index ac82fdb..0000000 --- a/test cases/common/46 custom install dirs/test.json +++ /dev/null @@ -1,16 +0,0 @@ -{ - "installed": [ - {"type": "exe", "file": "usr/dib/dab/dub/prog"}, - {"type": "pdb", "file": "usr/dib/dab/dub/prog"}, - {"type": "exe", "file": "usr/dib/dab/dub2/prog2"}, - {"type": "pdb", "file": "usr/dib/dab/dub2/prog2"}, - {"type": "file", "file": "usr/some/dir/sample.h"}, - {"type": "file", "file": "usr/some/dir2/sample.h"}, - {"type": "file", "file": "usr/woman/prog.1"}, - {"type": "file", "file": "usr/woman2/prog.1"}, - {"type": "file", "file": "usr/meow/datafile.cat"}, - {"type": "file", "file": "usr/meow2/datafile.cat"}, - {"type": "file", "file": "usr/woof/subdir/datafile.dog"}, - {"type": "file", "file": "usr/woof2/subdir/datafile.dog"} - ] -} diff --git a/test cases/common/46 subproject subproject/meson.build b/test cases/common/46 subproject subproject/meson.build new file mode 100644 index 0000000..d8735a1 --- /dev/null +++ b/test cases/common/46 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/46 subproject subproject/prog.c b/test cases/common/46 subproject subproject/prog.c new file mode 100644 index 0000000..27162c5 --- /dev/null +++ b/test cases/common/46 subproject subproject/prog.c @@ -0,0 +1,5 @@ +int func(void); + +int main(void) { + return func() == 42 ? 0 : 1; +} diff --git a/test cases/common/46 subproject subproject/subprojects/a/a.c b/test cases/common/46 subproject subproject/subprojects/a/a.c new file mode 100644 index 0000000..f9848c1 --- /dev/null +++ b/test cases/common/46 subproject subproject/subprojects/a/a.c @@ -0,0 +1,15 @@ +int func2(void); + +#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(void) { return func2(); } + diff --git a/test cases/common/46 subproject subproject/subprojects/a/meson.build b/test cases/common/46 subproject subproject/subprojects/a/meson.build new file mode 100644 index 0000000..f0dfc44 --- /dev/null +++ b/test cases/common/46 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/46 subproject subproject/subprojects/b/b.c b/test cases/common/46 subproject subproject/subprojects/b/b.c new file mode 100644 index 0000000..8c07177 --- /dev/null +++ b/test cases/common/46 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(void) { + return 42; +} diff --git a/test cases/common/46 subproject subproject/subprojects/b/meson.build b/test cases/common/46 subproject subproject/subprojects/b/meson.build new file mode 100644 index 0000000..e7af606 --- /dev/null +++ b/test cases/common/46 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/46 subproject subproject/subprojects/c/meson.build b/test cases/common/46 subproject subproject/subprojects/c/meson.build new file mode 100644 index 0000000..97a5be1 --- /dev/null +++ b/test cases/common/46 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/47 same file name/d1/file.c b/test cases/common/47 same file name/d1/file.c new file mode 100644 index 0000000..46e5172 --- /dev/null +++ b/test cases/common/47 same file name/d1/file.c @@ -0,0 +1 @@ +int func1(void) { return 42; } diff --git a/test cases/common/47 same file name/d2/file.c b/test cases/common/47 same file name/d2/file.c new file mode 100644 index 0000000..3d367f1 --- /dev/null +++ b/test cases/common/47 same file name/d2/file.c @@ -0,0 +1 @@ +int func2(void) { return 42; } diff --git a/test cases/common/47 same file name/meson.build b/test cases/common/47 same file name/meson.build new file mode 100644 index 0000000..3f351af --- /dev/null +++ b/test cases/common/47 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/47 same file name/prog.c b/test cases/common/47 same file name/prog.c new file mode 100644 index 0000000..1eee6c2 --- /dev/null +++ b/test cases/common/47 same file name/prog.c @@ -0,0 +1,6 @@ +int func1(void); +int func2(void); + +int main(void) { + return func1() - func2(); +} diff --git a/test cases/common/47 subproject subproject/meson.build b/test cases/common/47 subproject subproject/meson.build deleted file mode 100644 index d8735a1..0000000 --- a/test cases/common/47 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/47 subproject subproject/prog.c b/test cases/common/47 subproject subproject/prog.c deleted file mode 100644 index 27162c5..0000000 --- a/test cases/common/47 subproject subproject/prog.c +++ /dev/null @@ -1,5 +0,0 @@ -int func(void); - -int main(void) { - return func() == 42 ? 0 : 1; -} diff --git a/test cases/common/47 subproject subproject/subprojects/a/a.c b/test cases/common/47 subproject subproject/subprojects/a/a.c deleted file mode 100644 index f9848c1..0000000 --- a/test cases/common/47 subproject subproject/subprojects/a/a.c +++ /dev/null @@ -1,15 +0,0 @@ -int func2(void); - -#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(void) { return func2(); } - diff --git a/test cases/common/47 subproject subproject/subprojects/a/meson.build b/test cases/common/47 subproject subproject/subprojects/a/meson.build deleted file mode 100644 index f0dfc44..0000000 --- a/test cases/common/47 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/47 subproject subproject/subprojects/b/b.c b/test cases/common/47 subproject subproject/subprojects/b/b.c deleted file mode 100644 index 8c07177..0000000 --- a/test cases/common/47 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(void) { - return 42; -} diff --git a/test cases/common/47 subproject subproject/subprojects/b/meson.build b/test cases/common/47 subproject subproject/subprojects/b/meson.build deleted file mode 100644 index e7af606..0000000 --- a/test cases/common/47 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/47 subproject subproject/subprojects/c/meson.build b/test cases/common/47 subproject subproject/subprojects/c/meson.build deleted file mode 100644 index 97a5be1..0000000 --- a/test cases/common/47 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/48 file grabber/a.c b/test cases/common/48 file grabber/a.c new file mode 100644 index 0000000..8f63c2d --- /dev/null +++ b/test cases/common/48 file grabber/a.c @@ -0,0 +1 @@ +int funca(void) { return 0; } diff --git a/test cases/common/48 file grabber/b.c b/test cases/common/48 file grabber/b.c new file mode 100644 index 0000000..f38baca --- /dev/null +++ b/test cases/common/48 file grabber/b.c @@ -0,0 +1 @@ +int funcb(void) { return 0; } diff --git a/test cases/common/48 file grabber/c.c b/test cases/common/48 file grabber/c.c new file mode 100644 index 0000000..2e8abbf --- /dev/null +++ b/test cases/common/48 file grabber/c.c @@ -0,0 +1 @@ +int funcc(void) { return 0; } diff --git a/test cases/common/48 file grabber/grabber.bat b/test cases/common/48 file grabber/grabber.bat new file mode 100644 index 0000000..8660314 --- /dev/null +++ b/test cases/common/48 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/48 file grabber/grabber.sh b/test cases/common/48 file grabber/grabber.sh new file mode 100755 index 0000000..5e8f4b9 --- /dev/null +++ b/test cases/common/48 file grabber/grabber.sh @@ -0,0 +1,5 @@ +#!/bin/sh + +for i in *.c; do + echo $i +done diff --git a/test cases/common/48 file grabber/grabber2.bat b/test cases/common/48 file grabber/grabber2.bat new file mode 100644 index 0000000..d1a3f98 --- /dev/null +++ b/test cases/common/48 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/48 file grabber/meson.build b/test cases/common/48 file grabber/meson.build new file mode 100644 index 0000000..e332c0b --- /dev/null +++ b/test cases/common/48 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/48 file grabber/prog.c b/test cases/common/48 file grabber/prog.c new file mode 100644 index 0000000..ff55723 --- /dev/null +++ b/test cases/common/48 file grabber/prog.c @@ -0,0 +1,7 @@ +int funca(void); +int funcb(void); +int funcc(void); + +int main(void) { + return funca() + funcb() + funcc(); +} diff --git a/test cases/common/48 file grabber/subdir/meson.build b/test cases/common/48 file grabber/subdir/meson.build new file mode 100644 index 0000000..230d6f7 --- /dev/null +++ b/test cases/common/48 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/48 file grabber/subdir/suba.c b/test cases/common/48 file grabber/subdir/suba.c new file mode 100644 index 0000000..8f63c2d --- /dev/null +++ b/test cases/common/48 file grabber/subdir/suba.c @@ -0,0 +1 @@ +int funca(void) { return 0; } diff --git a/test cases/common/48 file grabber/subdir/subb.c b/test cases/common/48 file grabber/subdir/subb.c new file mode 100644 index 0000000..f38baca --- /dev/null +++ b/test cases/common/48 file grabber/subdir/subb.c @@ -0,0 +1 @@ +int funcb(void) { return 0; } diff --git a/test cases/common/48 file grabber/subdir/subc.c b/test cases/common/48 file grabber/subdir/subc.c new file mode 100644 index 0000000..2e8abbf --- /dev/null +++ b/test cases/common/48 file grabber/subdir/subc.c @@ -0,0 +1 @@ +int funcc(void) { return 0; } diff --git a/test cases/common/48 file grabber/subdir/subprog.c b/test cases/common/48 file grabber/subdir/subprog.c new file mode 100644 index 0000000..ff55723 --- /dev/null +++ b/test cases/common/48 file grabber/subdir/subprog.c @@ -0,0 +1,7 @@ +int funca(void); +int funcb(void); +int funcc(void); + +int main(void) { + return funca() + funcb() + funcc(); +} diff --git a/test cases/common/48 same file name/d1/file.c b/test cases/common/48 same file name/d1/file.c deleted file mode 100644 index 46e5172..0000000 --- a/test cases/common/48 same file name/d1/file.c +++ /dev/null @@ -1 +0,0 @@ -int func1(void) { return 42; } diff --git a/test cases/common/48 same file name/d2/file.c b/test cases/common/48 same file name/d2/file.c deleted file mode 100644 index 3d367f1..0000000 --- a/test cases/common/48 same file name/d2/file.c +++ /dev/null @@ -1 +0,0 @@ -int func2(void) { return 42; } diff --git a/test cases/common/48 same file name/meson.build b/test cases/common/48 same file name/meson.build deleted file mode 100644 index 3f351af..0000000 --- a/test cases/common/48 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/48 same file name/prog.c b/test cases/common/48 same file name/prog.c deleted file mode 100644 index 1eee6c2..0000000 --- a/test cases/common/48 same file name/prog.c +++ /dev/null @@ -1,6 +0,0 @@ -int func1(void); -int func2(void); - -int main(void) { - return func1() - func2(); -} diff --git a/test cases/common/49 custom target/data_source.txt b/test cases/common/49 custom target/data_source.txt new file mode 100644 index 0000000..0c23cc0 --- /dev/null +++ b/test cases/common/49 custom target/data_source.txt @@ -0,0 +1 @@ +This is a text only input file. diff --git a/test cases/common/49 custom target/depfile/dep.py b/test cases/common/49 custom target/depfile/dep.py new file mode 100755 index 0000000..c9e8f94 --- /dev/null +++ b/test cases/common/49 custom target/depfile/dep.py @@ -0,0 +1,15 @@ +#!/usr/bin/env python3 + +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('{}: {}\n'.format(output, ' '.join(quoted_depfiles))) diff --git a/test cases/common/49 custom target/depfile/meson.build b/test cases/common/49 custom target/depfile/meson.build new file mode 100644 index 0000000..46bca74 --- /dev/null +++ b/test cases/common/49 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/49 custom target/meson.build b/test cases/common/49 custom target/meson.build new file mode 100644 index 0000000..52e8630 --- /dev/null +++ b/test cases/common/49 custom target/meson.build @@ -0,0 +1,67 @@ +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('test.json') + +mytarget = custom_target('bindat', +output : 'data.dat', +input : 'data_source.txt', +command : [python, comp, '--input=@INPUT@', '--output=@OUTPUT@', useless], +env: {'MY_COMPILER_ENV': 'value'}, +install : true, +install_dir : 'subdir' +) + +has_not_changed = false +if is_disabler(mytarget) + has_not_changed = true +else + has_not_changed = true +endif +assert(has_not_changed, 'Custom target has changed.') + +assert(not is_disabler(mytarget), 'Custom target is a disabler.') + +mytarget_disabler = custom_target('bindat', +output : 'data.dat', +input : 'data_source.txt', +command : [disabler(), comp, '--input=@INPUT@', '--output=@OUTPUT@', useless], +install : true, +install_dir : 'subdir' +) + +if mytarget_disabler.found() + mytarget_disabled = false +else + mytarget_disabled = true +endif + +assert(mytarget_disabled, 'Disabled custom target should not be found.') + +mytarget_disabler = custom_target('bindat', +output : 'data.dat', +input : disabler(), +command : [python, comp, '--input=@INPUT@', '--output=@OUTPUT@', useless], +install : true, +install_dir : 'subdir' +) + +assert(is_disabler(mytarget_disabler), 'Disabled custom target is not a disabler.') + +if mytarget_disabler.found() + mytarget_disabled = false +else + mytarget_disabled = true +endif + +assert(mytarget_disabled, 'Disabled custom target should not be found.') + +subdir('depfile') diff --git a/test cases/common/49 custom target/my_compiler.py b/test cases/common/49 custom target/my_compiler.py new file mode 100755 index 0000000..9869111 --- /dev/null +++ b/test cases/common/49 custom target/my_compiler.py @@ -0,0 +1,22 @@ +#!/usr/bin/env python3 + +import os +import sys + +assert(os.path.exists(sys.argv[3])) + +args = sys.argv[:-1] + +if __name__ == '__main__': + assert os.environ['MY_COMPILER_ENV'] == 'value' + 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/49 custom target/test.json b/test cases/common/49 custom target/test.json new file mode 100644 index 0000000..ba66b02 --- /dev/null +++ b/test cases/common/49 custom target/test.json @@ -0,0 +1,5 @@ +{ + "installed": [ + {"type": "file", "file": "usr/subdir/data.dat"} + ] +} diff --git a/test cases/common/49 file grabber/a.c b/test cases/common/49 file grabber/a.c deleted file mode 100644 index 8f63c2d..0000000 --- a/test cases/common/49 file grabber/a.c +++ /dev/null @@ -1 +0,0 @@ -int funca(void) { return 0; } diff --git a/test cases/common/49 file grabber/b.c b/test cases/common/49 file grabber/b.c deleted file mode 100644 index f38baca..0000000 --- a/test cases/common/49 file grabber/b.c +++ /dev/null @@ -1 +0,0 @@ -int funcb(void) { return 0; } diff --git a/test cases/common/49 file grabber/c.c b/test cases/common/49 file grabber/c.c deleted file mode 100644 index 2e8abbf..0000000 --- a/test cases/common/49 file grabber/c.c +++ /dev/null @@ -1 +0,0 @@ -int funcc(void) { return 0; } diff --git a/test cases/common/49 file grabber/grabber.bat b/test cases/common/49 file grabber/grabber.bat deleted file mode 100644 index 8660314..0000000 --- a/test cases/common/49 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/49 file grabber/grabber.sh b/test cases/common/49 file grabber/grabber.sh deleted file mode 100755 index 5e8f4b9..0000000 --- a/test cases/common/49 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/49 file grabber/grabber2.bat b/test cases/common/49 file grabber/grabber2.bat deleted file mode 100644 index d1a3f98..0000000 --- a/test cases/common/49 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/49 file grabber/meson.build b/test cases/common/49 file grabber/meson.build deleted file mode 100644 index e332c0b..0000000 --- a/test cases/common/49 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/49 file grabber/prog.c b/test cases/common/49 file grabber/prog.c deleted file mode 100644 index ff55723..0000000 --- a/test cases/common/49 file grabber/prog.c +++ /dev/null @@ -1,7 +0,0 @@ -int funca(void); -int funcb(void); -int funcc(void); - -int main(void) { - return funca() + funcb() + funcc(); -} diff --git a/test cases/common/49 file grabber/subdir/meson.build b/test cases/common/49 file grabber/subdir/meson.build deleted file mode 100644 index 230d6f7..0000000 --- a/test cases/common/49 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/49 file grabber/subdir/suba.c b/test cases/common/49 file grabber/subdir/suba.c deleted file mode 100644 index 8f63c2d..0000000 --- a/test cases/common/49 file grabber/subdir/suba.c +++ /dev/null @@ -1 +0,0 @@ -int funca(void) { return 0; } diff --git a/test cases/common/49 file grabber/subdir/subb.c b/test cases/common/49 file grabber/subdir/subb.c deleted file mode 100644 index f38baca..0000000 --- a/test cases/common/49 file grabber/subdir/subb.c +++ /dev/null @@ -1 +0,0 @@ -int funcb(void) { return 0; } diff --git a/test cases/common/49 file grabber/subdir/subc.c b/test cases/common/49 file grabber/subdir/subc.c deleted file mode 100644 index 2e8abbf..0000000 --- a/test cases/common/49 file grabber/subdir/subc.c +++ /dev/null @@ -1 +0,0 @@ -int funcc(void) { return 0; } diff --git a/test cases/common/49 file grabber/subdir/subprog.c b/test cases/common/49 file grabber/subdir/subprog.c deleted file mode 100644 index ff55723..0000000 --- a/test cases/common/49 file grabber/subdir/subprog.c +++ /dev/null @@ -1,7 +0,0 @@ -int funca(void); -int funcb(void); -int funcc(void); - -int main(void) { - return funca() + funcb() + funcc(); -} diff --git a/test cases/common/50 custom target chain/data_source.txt b/test cases/common/50 custom target chain/data_source.txt new file mode 100644 index 0000000..0c23cc0 --- /dev/null +++ b/test cases/common/50 custom target chain/data_source.txt @@ -0,0 +1 @@ +This is a text only input file. diff --git a/test cases/common/50 custom target chain/meson.build b/test cases/common/50 custom target chain/meson.build new file mode 100644 index 0000000..138f795 --- /dev/null +++ b/test cases/common/50 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/50 custom target chain/my_compiler.py b/test cases/common/50 custom target chain/my_compiler.py new file mode 100755 index 0000000..d99029b --- /dev/null +++ b/test cases/common/50 custom target chain/my_compiler.py @@ -0,0 +1,15 @@ +#!/usr/bin/env python3 + +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/50 custom target chain/my_compiler2.py b/test cases/common/50 custom target chain/my_compiler2.py new file mode 100755 index 0000000..22ec789 --- /dev/null +++ b/test cases/common/50 custom target chain/my_compiler2.py @@ -0,0 +1,15 @@ +#!/usr/bin/env python3 + +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/50 custom target chain/test.json b/test cases/common/50 custom target chain/test.json new file mode 100644 index 0000000..d6b0fa9 --- /dev/null +++ b/test cases/common/50 custom target chain/test.json @@ -0,0 +1,6 @@ +{ + "installed": [ + {"type": "file", "file": "usr/subdir/data2.dat"}, + {"type": "file", "file": "usr/subdir/data3.dat"} + ] +} diff --git a/test cases/common/50 custom target chain/usetarget/meson.build b/test cases/common/50 custom target chain/usetarget/meson.build new file mode 100644 index 0000000..9aece8c --- /dev/null +++ b/test cases/common/50 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/50 custom target chain/usetarget/myexe.c b/test cases/common/50 custom target chain/usetarget/myexe.c new file mode 100644 index 0000000..3331133 --- /dev/null +++ b/test cases/common/50 custom target chain/usetarget/myexe.c @@ -0,0 +1,6 @@ +#include + +int main(void) { + printf("I am myexe.\n"); + return 0; +} diff --git a/test cases/common/50 custom target chain/usetarget/subcomp.py b/test cases/common/50 custom target chain/usetarget/subcomp.py new file mode 100755 index 0000000..52dc0bb --- /dev/null +++ b/test cases/common/50 custom target chain/usetarget/subcomp.py @@ -0,0 +1,7 @@ +#!/usr/bin/env python3 + +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/50 custom target/data_source.txt b/test cases/common/50 custom target/data_source.txt deleted file mode 100644 index 0c23cc0..0000000 --- a/test cases/common/50 custom target/data_source.txt +++ /dev/null @@ -1 +0,0 @@ -This is a text only input file. diff --git a/test cases/common/50 custom target/depfile/dep.py b/test cases/common/50 custom target/depfile/dep.py deleted file mode 100755 index c9e8f94..0000000 --- a/test cases/common/50 custom target/depfile/dep.py +++ /dev/null @@ -1,15 +0,0 @@ -#!/usr/bin/env python3 - -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('{}: {}\n'.format(output, ' '.join(quoted_depfiles))) diff --git a/test cases/common/50 custom target/depfile/meson.build b/test cases/common/50 custom target/depfile/meson.build deleted file mode 100644 index 46bca74..0000000 --- a/test cases/common/50 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/50 custom target/meson.build b/test cases/common/50 custom target/meson.build deleted file mode 100644 index 52e8630..0000000 --- a/test cases/common/50 custom target/meson.build +++ /dev/null @@ -1,67 +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('test.json') - -mytarget = custom_target('bindat', -output : 'data.dat', -input : 'data_source.txt', -command : [python, comp, '--input=@INPUT@', '--output=@OUTPUT@', useless], -env: {'MY_COMPILER_ENV': 'value'}, -install : true, -install_dir : 'subdir' -) - -has_not_changed = false -if is_disabler(mytarget) - has_not_changed = true -else - has_not_changed = true -endif -assert(has_not_changed, 'Custom target has changed.') - -assert(not is_disabler(mytarget), 'Custom target is a disabler.') - -mytarget_disabler = custom_target('bindat', -output : 'data.dat', -input : 'data_source.txt', -command : [disabler(), comp, '--input=@INPUT@', '--output=@OUTPUT@', useless], -install : true, -install_dir : 'subdir' -) - -if mytarget_disabler.found() - mytarget_disabled = false -else - mytarget_disabled = true -endif - -assert(mytarget_disabled, 'Disabled custom target should not be found.') - -mytarget_disabler = custom_target('bindat', -output : 'data.dat', -input : disabler(), -command : [python, comp, '--input=@INPUT@', '--output=@OUTPUT@', useless], -install : true, -install_dir : 'subdir' -) - -assert(is_disabler(mytarget_disabler), 'Disabled custom target is not a disabler.') - -if mytarget_disabler.found() - mytarget_disabled = false -else - mytarget_disabled = true -endif - -assert(mytarget_disabled, 'Disabled custom target should not be found.') - -subdir('depfile') diff --git a/test cases/common/50 custom target/my_compiler.py b/test cases/common/50 custom target/my_compiler.py deleted file mode 100755 index 9869111..0000000 --- a/test cases/common/50 custom target/my_compiler.py +++ /dev/null @@ -1,22 +0,0 @@ -#!/usr/bin/env python3 - -import os -import sys - -assert(os.path.exists(sys.argv[3])) - -args = sys.argv[:-1] - -if __name__ == '__main__': - assert os.environ['MY_COMPILER_ENV'] == 'value' - 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/50 custom target/test.json b/test cases/common/50 custom target/test.json deleted file mode 100644 index ba66b02..0000000 --- a/test cases/common/50 custom target/test.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "installed": [ - {"type": "file", "file": "usr/subdir/data.dat"} - ] -} diff --git a/test cases/common/51 custom target chain/data_source.txt b/test cases/common/51 custom target chain/data_source.txt deleted file mode 100644 index 0c23cc0..0000000 --- a/test cases/common/51 custom target chain/data_source.txt +++ /dev/null @@ -1 +0,0 @@ -This is a text only input file. diff --git a/test cases/common/51 custom target chain/meson.build b/test cases/common/51 custom target chain/meson.build deleted file mode 100644 index 138f795..0000000 --- a/test cases/common/51 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/51 custom target chain/my_compiler.py b/test cases/common/51 custom target chain/my_compiler.py deleted file mode 100755 index d99029b..0000000 --- a/test cases/common/51 custom target chain/my_compiler.py +++ /dev/null @@ -1,15 +0,0 @@ -#!/usr/bin/env python3 - -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/51 custom target chain/my_compiler2.py b/test cases/common/51 custom target chain/my_compiler2.py deleted file mode 100755 index 22ec789..0000000 --- a/test cases/common/51 custom target chain/my_compiler2.py +++ /dev/null @@ -1,15 +0,0 @@ -#!/usr/bin/env python3 - -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/51 custom target chain/test.json b/test cases/common/51 custom target chain/test.json deleted file mode 100644 index d6b0fa9..0000000 --- a/test cases/common/51 custom target chain/test.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "installed": [ - {"type": "file", "file": "usr/subdir/data2.dat"}, - {"type": "file", "file": "usr/subdir/data3.dat"} - ] -} diff --git a/test cases/common/51 custom target chain/usetarget/meson.build b/test cases/common/51 custom target chain/usetarget/meson.build deleted file mode 100644 index 9aece8c..0000000 --- a/test cases/common/51 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/51 custom target chain/usetarget/myexe.c b/test cases/common/51 custom target chain/usetarget/myexe.c deleted file mode 100644 index 3331133..0000000 --- a/test cases/common/51 custom target chain/usetarget/myexe.c +++ /dev/null @@ -1,6 +0,0 @@ -#include - -int main(void) { - printf("I am myexe.\n"); - return 0; -} diff --git a/test cases/common/51 custom target chain/usetarget/subcomp.py b/test cases/common/51 custom target chain/usetarget/subcomp.py deleted file mode 100755 index 52dc0bb..0000000 --- a/test cases/common/51 custom target chain/usetarget/subcomp.py +++ /dev/null @@ -1,7 +0,0 @@ -#!/usr/bin/env python3 - -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/51 run target/check-env.py b/test cases/common/51 run target/check-env.py new file mode 100644 index 0000000..cf3eb7c --- /dev/null +++ b/test cases/common/51 run target/check-env.py @@ -0,0 +1,23 @@ +#!/usr/bin/env python3 + +import os, sys +from pathlib import Path + +assert 'MESON_SOURCE_ROOT' in os.environ +assert 'MESON_BUILD_ROOT' in os.environ +assert 'MESON_SUBDIR' in os.environ +assert 'MESONINTROSPECT' in os.environ +assert 'MY_ENV' in os.environ + +# Environment has absolute paths and argv has relative paths when using ninja +# backend and absolute paths when using vs backend. What matters is once +# resolved they point to same location. +env_source_root = Path(os.environ['MESON_SOURCE_ROOT']).resolve() +env_build_root = Path(os.environ['MESON_BUILD_ROOT']).resolve() +env_current_source_dir = Path(env_source_root, os.environ['MESON_SUBDIR']).resolve() +argv_paths = [Path(i).resolve() for i in sys.argv[1:]] +source_root, build_root, current_source_dir = argv_paths + +assert source_root == env_source_root +assert build_root == env_build_root +assert current_source_dir == env_current_source_dir diff --git a/test cases/common/51 run target/check_exists.py b/test cases/common/51 run target/check_exists.py new file mode 100755 index 0000000..b6fc967 --- /dev/null +++ b/test cases/common/51 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/51 run target/configure.in b/test cases/common/51 run target/configure.in new file mode 100755 index 0000000..0d42d04 --- /dev/null +++ b/test cases/common/51 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/51 run target/converter.py b/test cases/common/51 run target/converter.py new file mode 100644 index 0000000..8dd31fe --- /dev/null +++ b/test cases/common/51 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/51 run target/fakeburner.py b/test cases/common/51 run target/fakeburner.py new file mode 100755 index 0000000..8b1f353 --- /dev/null +++ b/test cases/common/51 run target/fakeburner.py @@ -0,0 +1,15 @@ +#!/usr/bin/env python3 + + +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/51 run target/helloprinter.c b/test cases/common/51 run target/helloprinter.c new file mode 100644 index 0000000..4a6e0ac --- /dev/null +++ b/test cases/common/51 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/51 run target/meson.build b/test cases/common/51 run target/meson.build new file mode 100644 index 0000000..85d30f0 --- /dev/null +++ b/test cases/common/51 run target/meson.build @@ -0,0 +1,107 @@ +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') + +if not meson.is_cross_build() or meson.can_run_host_binaries() + run_target('runhello', + command : [exe, 'argument']) +endif + +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')]) + +run_target('check_exists', + command : [find_program('check_exists.py'), files('helloprinter.c')], + depends : disabler(), +) + +run_target('check_exists', + command : [disabler(), 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 +) + +custom_target('configure_script_ct', + command: conf, + output: 'dummy.txt', + capture: true) + +# Target names that clash with potential builtin functionality. +run_target('ctags', + command : converter) + +run_target('clang-format', + command : converter) + +# Check we can pass env to the program. Also check some string substitutions +# that were added in 0.57.0 but not documented. This is documented behaviour +# since 0.57.1. +run_target('check-env', + command: [find_program('check-env.py'), '@SOURCE_ROOT@', '@BUILD_ROOT@', + '@CURRENT_SOURCE_DIR@'], + env: {'MY_ENV': '1'}, +) + +# Check some string substitutions that has always been done but never documented. +# Some projects have been relying on this implementation detail. This is +# documented behaviour since 0.57.1. +custom_target('check-env-ct', + command: [find_program('check-env.py'), '@SOURCE_ROOT@', '@BUILD_ROOT@', + '@CURRENT_SOURCE_DIR@'], + env: {'MESON_SOURCE_ROOT': meson.source_root(), + 'MESON_BUILD_ROOT': meson.build_root(), + 'MESON_SUBDIR': meson.current_source_dir(), + 'MESONINTROSPECT': 'fake value', + 'MY_ENV': '1'}, + output: 'check-env-ct', +) + +run_target('textprinter', command: ['subdir/textprinter.py']) diff --git a/test cases/common/51 run target/subdir/textprinter.py b/test cases/common/51 run target/subdir/textprinter.py new file mode 100644 index 0000000..3159c08 --- /dev/null +++ b/test cases/common/51 run target/subdir/textprinter.py @@ -0,0 +1,3 @@ +#!/usr/bin/env python3 + +print('I am a script. Being run.') diff --git a/test cases/common/52 object generator/meson.build b/test cases/common/52 object generator/meson.build new file mode 100644 index 0000000..e20da6f --- /dev/null +++ b/test cases/common/52 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/52 object generator/obj_generator.py b/test cases/common/52 object generator/obj_generator.py new file mode 100755 index 0000000..a33872a --- /dev/null +++ b/test cases/common/52 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/52 object generator/prog.c b/test cases/common/52 object generator/prog.c new file mode 100644 index 0000000..9841180 --- /dev/null +++ b/test cases/common/52 object generator/prog.c @@ -0,0 +1,7 @@ +int func1_in_obj(void); +int func2_in_obj(void); +int func3_in_obj(void); + +int main(void) { + return func1_in_obj() + func2_in_obj() + func3_in_obj(); +} diff --git a/test cases/common/52 object generator/source.c b/test cases/common/52 object generator/source.c new file mode 100644 index 0000000..1dc08e1 --- /dev/null +++ b/test cases/common/52 object generator/source.c @@ -0,0 +1,3 @@ +int func1_in_obj(void) { + return 0; +} diff --git a/test cases/common/52 object generator/source2.c b/test cases/common/52 object generator/source2.c new file mode 100644 index 0000000..8024b97 --- /dev/null +++ b/test cases/common/52 object generator/source2.c @@ -0,0 +1,3 @@ +int func2_in_obj(void) { + return 0; +} diff --git a/test cases/common/52 object generator/source3.c b/test cases/common/52 object generator/source3.c new file mode 100644 index 0000000..c4362c4 --- /dev/null +++ b/test cases/common/52 object generator/source3.c @@ -0,0 +1,3 @@ +int func3_in_obj(void) { + return 0; +} diff --git a/test cases/common/52 run target/check-env.py b/test cases/common/52 run target/check-env.py deleted file mode 100644 index cf3eb7c..0000000 --- a/test cases/common/52 run target/check-env.py +++ /dev/null @@ -1,23 +0,0 @@ -#!/usr/bin/env python3 - -import os, sys -from pathlib import Path - -assert 'MESON_SOURCE_ROOT' in os.environ -assert 'MESON_BUILD_ROOT' in os.environ -assert 'MESON_SUBDIR' in os.environ -assert 'MESONINTROSPECT' in os.environ -assert 'MY_ENV' in os.environ - -# Environment has absolute paths and argv has relative paths when using ninja -# backend and absolute paths when using vs backend. What matters is once -# resolved they point to same location. -env_source_root = Path(os.environ['MESON_SOURCE_ROOT']).resolve() -env_build_root = Path(os.environ['MESON_BUILD_ROOT']).resolve() -env_current_source_dir = Path(env_source_root, os.environ['MESON_SUBDIR']).resolve() -argv_paths = [Path(i).resolve() for i in sys.argv[1:]] -source_root, build_root, current_source_dir = argv_paths - -assert source_root == env_source_root -assert build_root == env_build_root -assert current_source_dir == env_current_source_dir diff --git a/test cases/common/52 run target/check_exists.py b/test cases/common/52 run target/check_exists.py deleted file mode 100755 index b6fc967..0000000 --- a/test cases/common/52 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/52 run target/configure.in b/test cases/common/52 run target/configure.in deleted file mode 100755 index 0d42d04..0000000 --- a/test cases/common/52 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/52 run target/converter.py b/test cases/common/52 run target/converter.py deleted file mode 100644 index 8dd31fe..0000000 --- a/test cases/common/52 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/52 run target/fakeburner.py b/test cases/common/52 run target/fakeburner.py deleted file mode 100755 index 8b1f353..0000000 --- a/test cases/common/52 run target/fakeburner.py +++ /dev/null @@ -1,15 +0,0 @@ -#!/usr/bin/env python3 - - -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/52 run target/helloprinter.c b/test cases/common/52 run target/helloprinter.c deleted file mode 100644 index 4a6e0ac..0000000 --- a/test cases/common/52 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/52 run target/meson.build b/test cases/common/52 run target/meson.build deleted file mode 100644 index 85d30f0..0000000 --- a/test cases/common/52 run target/meson.build +++ /dev/null @@ -1,107 +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') - -if not meson.is_cross_build() or meson.can_run_host_binaries() - run_target('runhello', - command : [exe, 'argument']) -endif - -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')]) - -run_target('check_exists', - command : [find_program('check_exists.py'), files('helloprinter.c')], - depends : disabler(), -) - -run_target('check_exists', - command : [disabler(), 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 -) - -custom_target('configure_script_ct', - command: conf, - output: 'dummy.txt', - capture: true) - -# Target names that clash with potential builtin functionality. -run_target('ctags', - command : converter) - -run_target('clang-format', - command : converter) - -# Check we can pass env to the program. Also check some string substitutions -# that were added in 0.57.0 but not documented. This is documented behaviour -# since 0.57.1. -run_target('check-env', - command: [find_program('check-env.py'), '@SOURCE_ROOT@', '@BUILD_ROOT@', - '@CURRENT_SOURCE_DIR@'], - env: {'MY_ENV': '1'}, -) - -# Check some string substitutions that has always been done but never documented. -# Some projects have been relying on this implementation detail. This is -# documented behaviour since 0.57.1. -custom_target('check-env-ct', - command: [find_program('check-env.py'), '@SOURCE_ROOT@', '@BUILD_ROOT@', - '@CURRENT_SOURCE_DIR@'], - env: {'MESON_SOURCE_ROOT': meson.source_root(), - 'MESON_BUILD_ROOT': meson.build_root(), - 'MESON_SUBDIR': meson.current_source_dir(), - 'MESONINTROSPECT': 'fake value', - 'MY_ENV': '1'}, - output: 'check-env-ct', -) - -run_target('textprinter', command: ['subdir/textprinter.py']) diff --git a/test cases/common/52 run target/subdir/textprinter.py b/test cases/common/52 run target/subdir/textprinter.py deleted file mode 100644 index 3159c08..0000000 --- a/test cases/common/52 run target/subdir/textprinter.py +++ /dev/null @@ -1,3 +0,0 @@ -#!/usr/bin/env python3 - -print('I am a script. Being run.') diff --git a/test cases/common/53 install script/customtarget.py b/test cases/common/53 install script/customtarget.py new file mode 100755 index 0000000..e28373a --- /dev/null +++ b/test cases/common/53 install script/customtarget.py @@ -0,0 +1,19 @@ +#!/usr/bin/env python3 + +import argparse +import os + + +def main() -> None: + parser = argparse.ArgumentParser() + parser.add_argument('dirname') + args = parser.parse_args() + + with open(os.path.join(args.dirname, '1.txt'), 'w') as f: + f.write('') + with open(os.path.join(args.dirname, '2.txt'), 'w') as f: + f.write('') + + +if __name__ == "__main__": + main() diff --git a/test cases/common/53 install script/meson.build b/test cases/common/53 install script/meson.build new file mode 100644 index 0000000..24d5dc8 --- /dev/null +++ b/test cases/common/53 install script/meson.build @@ -0,0 +1,45 @@ +project('custom install script', 'c') + +meson.add_install_script('myinstall.py', 'diiba/daaba', 'file.dat') +meson.add_install_script('myinstall.py', 'this/should', 'also-work.dat') + +subdir('src') + +meson.add_install_script('myinstall.py', 'dir', afile, '--mode=copy') + +data = configuration_data() +data.set10('foo', true) +conf = configure_file( + configuration : data, + output : 'conf.txt' +) + +meson.add_install_script('myinstall.py', 'dir', conf, '--mode=copy') + +t = custom_target( + 'ct', + command : [find_program('customtarget.py'), '@OUTDIR@'], + output : ['1.txt', '2.txt'], +) + +meson.add_install_script('myinstall.py', 'customtarget', t, '--mode=copy') +meson.add_install_script('myinstall.py', 'customtargetindex', t[0], '--mode=copy') + +installer = configure_file( + input : 'myinstall.py', + output : 'myinstall_copy.py', + copy : true, +) + +meson.add_install_script(installer, 'otherdir', afile, '--mode=copy') + +# This executable links on a library built in src/ directory. On Windows this +# means meson must add src/ into $PATH to find the DLL when running it as +# install script. +myexe = executable('prog', 'prog.c', + link_with: mylib, + install : true, +) +if meson.can_run_host_binaries() + meson.add_install_script(myexe) +endif diff --git a/test cases/common/53 install script/myinstall.py b/test cases/common/53 install script/myinstall.py new file mode 100755 index 0000000..a573342 --- /dev/null +++ b/test cases/common/53 install script/myinstall.py @@ -0,0 +1,31 @@ +#!/usr/bin/env python3 + +import argparse +import os +import shutil + +prefix = os.environ['MESON_INSTALL_DESTDIR_PREFIX'] + + +def main() -> None: + parser = argparse.ArgumentParser() + parser.add_argument('dirname') + parser.add_argument('files', nargs='+') + parser.add_argument('--mode', action='store', default='create', choices=['create', 'copy']) + args = parser.parse_args() + + dirname = os.path.join(prefix, args.dirname) + if not os.path.exists(dirname): + os.makedirs(dirname) + + if args.mode == 'create': + for name in args.files: + with open(os.path.join(dirname, name), 'w') as f: + f.write('') + else: + for name in args.files: + shutil.copy(name, dirname) + + +if __name__ == "__main__": + main() diff --git a/test cases/common/53 install script/prog.c b/test cases/common/53 install script/prog.c new file mode 100644 index 0000000..85f8df9 --- /dev/null +++ b/test cases/common/53 install script/prog.c @@ -0,0 +1,14 @@ +#include + +#ifdef _WIN32 + #define DO_IMPORT __declspec(dllimport) +#else + #define DO_IMPORT +#endif + +DO_IMPORT int foo(void); + +int main(void) { + printf("This is text.\n"); + return foo(); +} diff --git a/test cases/common/53 install script/src/a file.txt b/test cases/common/53 install script/src/a file.txt new file mode 100644 index 0000000..e69de29 diff --git a/test cases/common/53 install script/src/foo.c b/test cases/common/53 install script/src/foo.c new file mode 100644 index 0000000..46cb845 --- /dev/null +++ b/test cases/common/53 install script/src/foo.c @@ -0,0 +1,10 @@ +#ifdef _WIN32 + #define DO_EXPORT __declspec(dllexport) +#else + #define DO_EXPORT +#endif + +DO_EXPORT int foo(void) +{ + return 0; +} diff --git a/test cases/common/53 install script/src/meson.build b/test cases/common/53 install script/src/meson.build new file mode 100644 index 0000000..72de346 --- /dev/null +++ b/test cases/common/53 install script/src/meson.build @@ -0,0 +1,5 @@ +meson.add_install_script('myinstall.py', 'this/does', 'something-different.dat') + +afile = files('a file.txt') + +mylib = shared_library('mylib', 'foo.c') diff --git a/test cases/common/53 install script/src/myinstall.py b/test cases/common/53 install script/src/myinstall.py new file mode 100644 index 0000000..3a9d89b --- /dev/null +++ b/test cases/common/53 install script/src/myinstall.py @@ -0,0 +1,14 @@ +#!/usr/bin/env python3 + +import os +import sys + +prefix = os.environ['MESON_INSTALL_DESTDIR_PREFIX'] + +dirname = os.path.join(prefix, sys.argv[1]) + +if not os.path.exists(dirname): + os.makedirs(dirname) + +with open(os.path.join(dirname, sys.argv[2] + '.in'), 'w') as f: + f.write('') diff --git a/test cases/common/53 install script/test.json b/test cases/common/53 install script/test.json new file mode 100644 index 0000000..7ac2607 --- /dev/null +++ b/test cases/common/53 install script/test.json @@ -0,0 +1,15 @@ +{ + "installed": [ + {"type": "exe", "file": "usr/bin/prog"}, + {"type": "pdb", "file": "usr/bin/prog"}, + {"type": "file", "file": "usr/diiba/daaba/file.dat"}, + {"type": "file", "file": "usr/this/should/also-work.dat"}, + {"type": "file", "file": "usr/this/does/something-different.dat.in"}, + {"type": "file", "file": "usr/dir/a file.txt"}, + {"type": "file", "file": "usr/dir/conf.txt"}, + {"type": "file", "file": "usr/otherdir/a file.txt"}, + {"type": "file", "file": "usr/customtarget/1.txt"}, + {"type": "file", "file": "usr/customtarget/2.txt"}, + {"type": "file", "file": "usr/customtargetindex/1.txt"} + ] +} diff --git a/test cases/common/53 object generator/meson.build b/test cases/common/53 object generator/meson.build deleted file mode 100644 index e20da6f..0000000 --- a/test cases/common/53 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/53 object generator/obj_generator.py b/test cases/common/53 object generator/obj_generator.py deleted file mode 100755 index a33872a..0000000 --- a/test cases/common/53 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/53 object generator/prog.c b/test cases/common/53 object generator/prog.c deleted file mode 100644 index 9841180..0000000 --- a/test cases/common/53 object generator/prog.c +++ /dev/null @@ -1,7 +0,0 @@ -int func1_in_obj(void); -int func2_in_obj(void); -int func3_in_obj(void); - -int main(void) { - return func1_in_obj() + func2_in_obj() + func3_in_obj(); -} diff --git a/test cases/common/53 object generator/source.c b/test cases/common/53 object generator/source.c deleted file mode 100644 index 1dc08e1..0000000 --- a/test cases/common/53 object generator/source.c +++ /dev/null @@ -1,3 +0,0 @@ -int func1_in_obj(void) { - return 0; -} diff --git a/test cases/common/53 object generator/source2.c b/test cases/common/53 object generator/source2.c deleted file mode 100644 index 8024b97..0000000 --- a/test cases/common/53 object generator/source2.c +++ /dev/null @@ -1,3 +0,0 @@ -int func2_in_obj(void) { - return 0; -} diff --git a/test cases/common/53 object generator/source3.c b/test cases/common/53 object generator/source3.c deleted file mode 100644 index c4362c4..0000000 --- a/test cases/common/53 object generator/source3.c +++ /dev/null @@ -1,3 +0,0 @@ -int func3_in_obj(void) { - return 0; -} diff --git a/test cases/common/54 custom target source output/generator.py b/test cases/common/54 custom target source output/generator.py new file mode 100755 index 0000000..1bec8e8 --- /dev/null +++ b/test cases/common/54 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(void);\n') +with open(os.path.join(odir, 'mylib.c'), 'w') as f: + f.write('''int func(void) { + return 0; +} +''') diff --git a/test cases/common/54 custom target source output/main.c b/test cases/common/54 custom target source output/main.c new file mode 100644 index 0000000..bca1387 --- /dev/null +++ b/test cases/common/54 custom target source output/main.c @@ -0,0 +1,5 @@ +#include"mylib.h" + +int main(void) { + return func(); +} diff --git a/test cases/common/54 custom target source output/meson.build b/test cases/common/54 custom target source output/meson.build new file mode 100644 index 0000000..f9d039d --- /dev/null +++ b/test cases/common/54 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/54 install script/customtarget.py b/test cases/common/54 install script/customtarget.py deleted file mode 100755 index e28373a..0000000 --- a/test cases/common/54 install script/customtarget.py +++ /dev/null @@ -1,19 +0,0 @@ -#!/usr/bin/env python3 - -import argparse -import os - - -def main() -> None: - parser = argparse.ArgumentParser() - parser.add_argument('dirname') - args = parser.parse_args() - - with open(os.path.join(args.dirname, '1.txt'), 'w') as f: - f.write('') - with open(os.path.join(args.dirname, '2.txt'), 'w') as f: - f.write('') - - -if __name__ == "__main__": - main() diff --git a/test cases/common/54 install script/meson.build b/test cases/common/54 install script/meson.build deleted file mode 100644 index 24d5dc8..0000000 --- a/test cases/common/54 install script/meson.build +++ /dev/null @@ -1,45 +0,0 @@ -project('custom install script', 'c') - -meson.add_install_script('myinstall.py', 'diiba/daaba', 'file.dat') -meson.add_install_script('myinstall.py', 'this/should', 'also-work.dat') - -subdir('src') - -meson.add_install_script('myinstall.py', 'dir', afile, '--mode=copy') - -data = configuration_data() -data.set10('foo', true) -conf = configure_file( - configuration : data, - output : 'conf.txt' -) - -meson.add_install_script('myinstall.py', 'dir', conf, '--mode=copy') - -t = custom_target( - 'ct', - command : [find_program('customtarget.py'), '@OUTDIR@'], - output : ['1.txt', '2.txt'], -) - -meson.add_install_script('myinstall.py', 'customtarget', t, '--mode=copy') -meson.add_install_script('myinstall.py', 'customtargetindex', t[0], '--mode=copy') - -installer = configure_file( - input : 'myinstall.py', - output : 'myinstall_copy.py', - copy : true, -) - -meson.add_install_script(installer, 'otherdir', afile, '--mode=copy') - -# This executable links on a library built in src/ directory. On Windows this -# means meson must add src/ into $PATH to find the DLL when running it as -# install script. -myexe = executable('prog', 'prog.c', - link_with: mylib, - install : true, -) -if meson.can_run_host_binaries() - meson.add_install_script(myexe) -endif diff --git a/test cases/common/54 install script/myinstall.py b/test cases/common/54 install script/myinstall.py deleted file mode 100755 index a573342..0000000 --- a/test cases/common/54 install script/myinstall.py +++ /dev/null @@ -1,31 +0,0 @@ -#!/usr/bin/env python3 - -import argparse -import os -import shutil - -prefix = os.environ['MESON_INSTALL_DESTDIR_PREFIX'] - - -def main() -> None: - parser = argparse.ArgumentParser() - parser.add_argument('dirname') - parser.add_argument('files', nargs='+') - parser.add_argument('--mode', action='store', default='create', choices=['create', 'copy']) - args = parser.parse_args() - - dirname = os.path.join(prefix, args.dirname) - if not os.path.exists(dirname): - os.makedirs(dirname) - - if args.mode == 'create': - for name in args.files: - with open(os.path.join(dirname, name), 'w') as f: - f.write('') - else: - for name in args.files: - shutil.copy(name, dirname) - - -if __name__ == "__main__": - main() diff --git a/test cases/common/54 install script/prog.c b/test cases/common/54 install script/prog.c deleted file mode 100644 index 85f8df9..0000000 --- a/test cases/common/54 install script/prog.c +++ /dev/null @@ -1,14 +0,0 @@ -#include - -#ifdef _WIN32 - #define DO_IMPORT __declspec(dllimport) -#else - #define DO_IMPORT -#endif - -DO_IMPORT int foo(void); - -int main(void) { - printf("This is text.\n"); - return foo(); -} diff --git a/test cases/common/54 install script/src/a file.txt b/test cases/common/54 install script/src/a file.txt deleted file mode 100644 index e69de29..0000000 diff --git a/test cases/common/54 install script/src/foo.c b/test cases/common/54 install script/src/foo.c deleted file mode 100644 index 46cb845..0000000 --- a/test cases/common/54 install script/src/foo.c +++ /dev/null @@ -1,10 +0,0 @@ -#ifdef _WIN32 - #define DO_EXPORT __declspec(dllexport) -#else - #define DO_EXPORT -#endif - -DO_EXPORT int foo(void) -{ - return 0; -} diff --git a/test cases/common/54 install script/src/meson.build b/test cases/common/54 install script/src/meson.build deleted file mode 100644 index 72de346..0000000 --- a/test cases/common/54 install script/src/meson.build +++ /dev/null @@ -1,5 +0,0 @@ -meson.add_install_script('myinstall.py', 'this/does', 'something-different.dat') - -afile = files('a file.txt') - -mylib = shared_library('mylib', 'foo.c') diff --git a/test cases/common/54 install script/src/myinstall.py b/test cases/common/54 install script/src/myinstall.py deleted file mode 100644 index 3a9d89b..0000000 --- a/test cases/common/54 install script/src/myinstall.py +++ /dev/null @@ -1,14 +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]) - -if not os.path.exists(dirname): - os.makedirs(dirname) - -with open(os.path.join(dirname, sys.argv[2] + '.in'), 'w') as f: - f.write('') diff --git a/test cases/common/54 install script/test.json b/test cases/common/54 install script/test.json deleted file mode 100644 index 7ac2607..0000000 --- a/test cases/common/54 install script/test.json +++ /dev/null @@ -1,15 +0,0 @@ -{ - "installed": [ - {"type": "exe", "file": "usr/bin/prog"}, - {"type": "pdb", "file": "usr/bin/prog"}, - {"type": "file", "file": "usr/diiba/daaba/file.dat"}, - {"type": "file", "file": "usr/this/should/also-work.dat"}, - {"type": "file", "file": "usr/this/does/something-different.dat.in"}, - {"type": "file", "file": "usr/dir/a file.txt"}, - {"type": "file", "file": "usr/dir/conf.txt"}, - {"type": "file", "file": "usr/otherdir/a file.txt"}, - {"type": "file", "file": "usr/customtarget/1.txt"}, - {"type": "file", "file": "usr/customtarget/2.txt"}, - {"type": "file", "file": "usr/customtargetindex/1.txt"} - ] -} diff --git a/test cases/common/55 custom target source output/generator.py b/test cases/common/55 custom target source output/generator.py deleted file mode 100755 index 1bec8e8..0000000 --- a/test cases/common/55 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(void);\n') -with open(os.path.join(odir, 'mylib.c'), 'w') as f: - f.write('''int func(void) { - return 0; -} -''') diff --git a/test cases/common/55 custom target source output/main.c b/test cases/common/55 custom target source output/main.c deleted file mode 100644 index bca1387..0000000 --- a/test cases/common/55 custom target source output/main.c +++ /dev/null @@ -1,5 +0,0 @@ -#include"mylib.h" - -int main(void) { - return func(); -} diff --git a/test cases/common/55 custom target source output/meson.build b/test cases/common/55 custom target source output/meson.build deleted file mode 100644 index f9d039d..0000000 --- a/test cases/common/55 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/55 exe static shared/meson.build b/test cases/common/55 exe static shared/meson.build new file mode 100644 index 0000000..69ede5e --- /dev/null +++ b/test cases/common/55 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/55 exe static shared/prog.c b/test cases/common/55 exe static shared/prog.c new file mode 100644 index 0000000..6dba60d --- /dev/null +++ b/test cases/common/55 exe static shared/prog.c @@ -0,0 +1,10 @@ +int shlibfunc2(void); +int statlibfunc(void); + +int main(void) { + if (statlibfunc() != 42) + return 1; + if (shlibfunc2() != 24) + return 1; + return 0; +} diff --git a/test cases/common/55 exe static shared/shlib2.c b/test cases/common/55 exe static shared/shlib2.c new file mode 100644 index 0000000..12bc913 --- /dev/null +++ b/test cases/common/55 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/55 exe static shared/stat.c b/test cases/common/55 exe static shared/stat.c new file mode 100644 index 0000000..eddc4d8 --- /dev/null +++ b/test cases/common/55 exe static shared/stat.c @@ -0,0 +1,7 @@ +#include "subdir/exports.h" + +int shlibfunc(void); + +int DLL_PUBLIC statlibfunc(void) { + return shlibfunc(); +} diff --git a/test cases/common/55 exe static shared/stat2.c b/test cases/common/55 exe static shared/stat2.c new file mode 100644 index 0000000..4abb49f --- /dev/null +++ b/test cases/common/55 exe static shared/stat2.c @@ -0,0 +1,3 @@ +int statlibfunc2(void) { + return 18; +} diff --git a/test cases/common/55 exe static shared/subdir/exports.h b/test cases/common/55 exe static shared/subdir/exports.h new file mode 100644 index 0000000..c89ccb2 --- /dev/null +++ b/test cases/common/55 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/55 exe static shared/subdir/meson.build b/test cases/common/55 exe static shared/subdir/meson.build new file mode 100644 index 0000000..2b7393b --- /dev/null +++ b/test cases/common/55 exe static shared/subdir/meson.build @@ -0,0 +1 @@ +shlib = shared_library('shar', 'shlib.c') diff --git a/test cases/common/55 exe static shared/subdir/shlib.c b/test cases/common/55 exe static shared/subdir/shlib.c new file mode 100644 index 0000000..dd9c6b2 --- /dev/null +++ b/test cases/common/55 exe static shared/subdir/shlib.c @@ -0,0 +1,5 @@ +#include "exports.h" + +int DLL_PUBLIC shlibfunc(void) { + return 42; +} diff --git a/test cases/common/56 array methods/meson.build b/test cases/common/56 array methods/meson.build new file mode 100644 index 0000000..cdda41d --- /dev/null +++ b/test cases/common/56 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/56 exe static shared/meson.build b/test cases/common/56 exe static shared/meson.build deleted file mode 100644 index 69ede5e..0000000 --- a/test cases/common/56 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/56 exe static shared/prog.c b/test cases/common/56 exe static shared/prog.c deleted file mode 100644 index 6dba60d..0000000 --- a/test cases/common/56 exe static shared/prog.c +++ /dev/null @@ -1,10 +0,0 @@ -int shlibfunc2(void); -int statlibfunc(void); - -int main(void) { - if (statlibfunc() != 42) - return 1; - if (shlibfunc2() != 24) - return 1; - return 0; -} diff --git a/test cases/common/56 exe static shared/shlib2.c b/test cases/common/56 exe static shared/shlib2.c deleted file mode 100644 index 12bc913..0000000 --- a/test cases/common/56 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/56 exe static shared/stat.c b/test cases/common/56 exe static shared/stat.c deleted file mode 100644 index eddc4d8..0000000 --- a/test cases/common/56 exe static shared/stat.c +++ /dev/null @@ -1,7 +0,0 @@ -#include "subdir/exports.h" - -int shlibfunc(void); - -int DLL_PUBLIC statlibfunc(void) { - return shlibfunc(); -} diff --git a/test cases/common/56 exe static shared/stat2.c b/test cases/common/56 exe static shared/stat2.c deleted file mode 100644 index 4abb49f..0000000 --- a/test cases/common/56 exe static shared/stat2.c +++ /dev/null @@ -1,3 +0,0 @@ -int statlibfunc2(void) { - return 18; -} diff --git a/test cases/common/56 exe static shared/subdir/exports.h b/test cases/common/56 exe static shared/subdir/exports.h deleted file mode 100644 index c89ccb2..0000000 --- a/test cases/common/56 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/56 exe static shared/subdir/meson.build b/test cases/common/56 exe static shared/subdir/meson.build deleted file mode 100644 index 2b7393b..0000000 --- a/test cases/common/56 exe static shared/subdir/meson.build +++ /dev/null @@ -1 +0,0 @@ -shlib = shared_library('shar', 'shlib.c') diff --git a/test cases/common/56 exe static shared/subdir/shlib.c b/test cases/common/56 exe static shared/subdir/shlib.c deleted file mode 100644 index dd9c6b2..0000000 --- a/test cases/common/56 exe static shared/subdir/shlib.c +++ /dev/null @@ -1,5 +0,0 @@ -#include "exports.h" - -int DLL_PUBLIC shlibfunc(void) { - return 42; -} diff --git a/test cases/common/57 array methods/meson.build b/test cases/common/57 array methods/meson.build deleted file mode 100644 index cdda41d..0000000 --- a/test cases/common/57 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/57 custom header generator/input.def b/test cases/common/57 custom header generator/input.def new file mode 100644 index 0000000..573541a --- /dev/null +++ b/test cases/common/57 custom header generator/input.def @@ -0,0 +1 @@ +0 diff --git a/test cases/common/57 custom header generator/makeheader.py b/test cases/common/57 custom header generator/makeheader.py new file mode 100644 index 0000000..f156834 --- /dev/null +++ b/test cases/common/57 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/57 custom header generator/meson.build b/test cases/common/57 custom header generator/meson.build new file mode 100644 index 0000000..d43915a --- /dev/null +++ b/test cases/common/57 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/57 custom header generator/prog.c b/test cases/common/57 custom header generator/prog.c new file mode 100644 index 0000000..acd0ff7 --- /dev/null +++ b/test cases/common/57 custom header generator/prog.c @@ -0,0 +1,5 @@ +#include"myheader.lh" + +int main(void) { + return RET_VAL; +} diff --git a/test cases/common/57 custom header generator/somefile.txt b/test cases/common/57 custom header generator/somefile.txt new file mode 100644 index 0000000..e69de29 diff --git a/test cases/common/58 custom header generator/input.def b/test cases/common/58 custom header generator/input.def deleted file mode 100644 index 573541a..0000000 --- a/test cases/common/58 custom header generator/input.def +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test cases/common/58 custom header generator/makeheader.py b/test cases/common/58 custom header generator/makeheader.py deleted file mode 100644 index f156834..0000000 --- a/test cases/common/58 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/58 custom header generator/meson.build b/test cases/common/58 custom header generator/meson.build deleted file mode 100644 index d43915a..0000000 --- a/test cases/common/58 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/58 custom header generator/prog.c b/test cases/common/58 custom header generator/prog.c deleted file mode 100644 index acd0ff7..0000000 --- a/test cases/common/58 custom header generator/prog.c +++ /dev/null @@ -1,5 +0,0 @@ -#include"myheader.lh" - -int main(void) { - return RET_VAL; -} diff --git a/test cases/common/58 custom header generator/somefile.txt b/test cases/common/58 custom header generator/somefile.txt deleted file mode 100644 index e69de29..0000000 diff --git a/test cases/common/58 multiple generators/data2.dat b/test cases/common/58 multiple generators/data2.dat new file mode 100644 index 0000000..0cfbf08 --- /dev/null +++ b/test cases/common/58 multiple generators/data2.dat @@ -0,0 +1 @@ +2 diff --git a/test cases/common/58 multiple generators/main.cpp b/test cases/common/58 multiple generators/main.cpp new file mode 100644 index 0000000..f1a01bd --- /dev/null +++ b/test cases/common/58 multiple generators/main.cpp @@ -0,0 +1,6 @@ +#include"source1.h" +#include"source2.h" + +int main(void) { + return func1() + func2(); +} diff --git a/test cases/common/58 multiple generators/meson.build b/test cases/common/58 multiple generators/meson.build new file mode 100644 index 0000000..66f7fa9 --- /dev/null +++ b/test cases/common/58 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/58 multiple generators/mygen.py b/test cases/common/58 multiple generators/mygen.py new file mode 100755 index 0000000..99dc331 --- /dev/null +++ b/test cases/common/58 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/58 multiple generators/subdir/data.dat b/test cases/common/58 multiple generators/subdir/data.dat new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/test cases/common/58 multiple generators/subdir/data.dat @@ -0,0 +1 @@ +1 diff --git a/test cases/common/58 multiple generators/subdir/meson.build b/test cases/common/58 multiple generators/subdir/meson.build new file mode 100644 index 0000000..2456ecb --- /dev/null +++ b/test cases/common/58 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/59 install subdir/meson.build b/test cases/common/59 install subdir/meson.build new file mode 100644 index 0000000..59f3b4d --- /dev/null +++ b/test cases/common/59 install subdir/meson.build @@ -0,0 +1,21 @@ +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) + +# Create new empty directory that doesn't exist in the source tree +install_subdir('new_directory', install_dir : 'share') diff --git a/test cases/common/59 install subdir/nested_elided/sub/dircheck/ninth.dat b/test cases/common/59 install subdir/nested_elided/sub/dircheck/ninth.dat new file mode 100644 index 0000000..c4eaca7 --- /dev/null +++ b/test cases/common/59 install subdir/nested_elided/sub/dircheck/ninth.dat @@ -0,0 +1 @@ +Nested file under nested elided directory. diff --git a/test cases/common/59 install subdir/nested_elided/sub/eighth.dat b/test cases/common/59 install subdir/nested_elided/sub/eighth.dat new file mode 100644 index 0000000..fa9b7b7 --- /dev/null +++ b/test cases/common/59 install subdir/nested_elided/sub/eighth.dat @@ -0,0 +1 @@ +File in nested elided directory. diff --git a/test cases/common/59 install subdir/sub/sub1/third.dat b/test cases/common/59 install subdir/sub/sub1/third.dat new file mode 100644 index 0000000..5ccbc43 --- /dev/null +++ b/test cases/common/59 install subdir/sub/sub1/third.dat @@ -0,0 +1 @@ +This is a third data file for sub1 dir. diff --git a/test cases/common/59 install subdir/sub1/second.dat b/test cases/common/59 install subdir/sub1/second.dat new file mode 100644 index 0000000..48857a8 --- /dev/null +++ b/test cases/common/59 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/59 install subdir/sub2/dircheck/excluded-three.dat b/test cases/common/59 install subdir/sub2/dircheck/excluded-three.dat new file mode 100644 index 0000000..e69de29 diff --git a/test cases/common/59 install subdir/sub2/excluded-three.dat b/test cases/common/59 install subdir/sub2/excluded-three.dat new file mode 100644 index 0000000..e69de29 diff --git a/test cases/common/59 install subdir/sub2/excluded/two.dat b/test cases/common/59 install subdir/sub2/excluded/two.dat new file mode 100644 index 0000000..e69de29 diff --git a/test cases/common/59 install subdir/sub2/one.dat b/test cases/common/59 install subdir/sub2/one.dat new file mode 100644 index 0000000..e69de29 diff --git a/test cases/common/59 install subdir/sub_elided/dircheck/fifth.dat b/test cases/common/59 install subdir/sub_elided/dircheck/fifth.dat new file mode 100644 index 0000000..b6ca009 --- /dev/null +++ b/test cases/common/59 install subdir/sub_elided/dircheck/fifth.dat @@ -0,0 +1 @@ +Data file in a subdir of elided directory. diff --git a/test cases/common/59 install subdir/sub_elided/fourth.dat b/test cases/common/59 install subdir/sub_elided/fourth.dat new file mode 100644 index 0000000..ca5f26a --- /dev/null +++ b/test cases/common/59 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/59 install subdir/subdir/meson.build b/test cases/common/59 install subdir/subdir/meson.build new file mode 100644 index 0000000..0f81cdb --- /dev/null +++ b/test cases/common/59 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/59 install subdir/subdir/sub1/data1.dat b/test cases/common/59 install subdir/subdir/sub1/data1.dat new file mode 100644 index 0000000..d83c370 --- /dev/null +++ b/test cases/common/59 install subdir/subdir/sub1/data1.dat @@ -0,0 +1 @@ +This is a data file in a subdir. diff --git a/test cases/common/59 install subdir/subdir/sub1/sub2/data2.dat b/test cases/common/59 install subdir/subdir/sub1/sub2/data2.dat new file mode 100644 index 0000000..8ce1392 --- /dev/null +++ b/test cases/common/59 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/59 install subdir/subdir/sub_elided/dircheck/seventh.dat b/test cases/common/59 install subdir/subdir/sub_elided/dircheck/seventh.dat new file mode 100644 index 0000000..ea0b8dc --- /dev/null +++ b/test cases/common/59 install subdir/subdir/sub_elided/dircheck/seventh.dat @@ -0,0 +1 @@ +Nested file in a subdir. diff --git a/test cases/common/59 install subdir/subdir/sub_elided/sixth.dat b/test cases/common/59 install subdir/subdir/sub_elided/sixth.dat new file mode 100644 index 0000000..140f075 --- /dev/null +++ b/test cases/common/59 install subdir/subdir/sub_elided/sixth.dat @@ -0,0 +1 @@ +Elide test file in a subdir. diff --git a/test cases/common/59 install subdir/test.json b/test cases/common/59 install subdir/test.json new file mode 100644 index 0000000..0dd885c --- /dev/null +++ b/test cases/common/59 install subdir/test.json @@ -0,0 +1,17 @@ +{ + "installed": [ + {"type": "file", "file": "usr/share/dircheck/fifth.dat"}, + {"type": "file", "file": "usr/share/dircheck/seventh.dat"}, + {"type": "file", "file": "usr/share/dircheck/ninth.dat"}, + {"type": "file", "file": "usr/share/eighth.dat"}, + {"type": "file", "file": "usr/share/fourth.dat"}, + {"type": "file", "file": "usr/share/sixth.dat"}, + {"type": "file", "file": "usr/share/sub1/data1.dat"}, + {"type": "file", "file": "usr/share/sub1/second.dat"}, + {"type": "file", "file": "usr/share/sub1/third.dat"}, + {"type": "file", "file": "usr/share/sub1/sub2/data2.dat"}, + {"type": "file", "file": "usr/share/sub2/one.dat"}, + {"type": "file", "file": "usr/share/sub2/dircheck/excluded-three.dat"}, + {"type": "dir", "file": "usr/share/new_directory"} + ] +} diff --git a/test cases/common/59 multiple generators/data2.dat b/test cases/common/59 multiple generators/data2.dat deleted file mode 100644 index 0cfbf08..0000000 --- a/test cases/common/59 multiple generators/data2.dat +++ /dev/null @@ -1 +0,0 @@ -2 diff --git a/test cases/common/59 multiple generators/main.cpp b/test cases/common/59 multiple generators/main.cpp deleted file mode 100644 index f1a01bd..0000000 --- a/test cases/common/59 multiple generators/main.cpp +++ /dev/null @@ -1,6 +0,0 @@ -#include"source1.h" -#include"source2.h" - -int main(void) { - return func1() + func2(); -} diff --git a/test cases/common/59 multiple generators/meson.build b/test cases/common/59 multiple generators/meson.build deleted file mode 100644 index 66f7fa9..0000000 --- a/test cases/common/59 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/59 multiple generators/mygen.py b/test cases/common/59 multiple generators/mygen.py deleted file mode 100755 index 99dc331..0000000 --- a/test cases/common/59 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/59 multiple generators/subdir/data.dat b/test cases/common/59 multiple generators/subdir/data.dat deleted file mode 100644 index d00491f..0000000 --- a/test cases/common/59 multiple generators/subdir/data.dat +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test cases/common/59 multiple generators/subdir/meson.build b/test cases/common/59 multiple generators/subdir/meson.build deleted file mode 100644 index 2456ecb..0000000 --- a/test cases/common/59 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/60 foreach/meson.build b/test cases/common/60 foreach/meson.build new file mode 100644 index 0000000..af60e0f --- /dev/null +++ b/test cases/common/60 foreach/meson.build @@ -0,0 +1,53 @@ +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') + +items = [] +iter = range(2) +foreach i : iter + items += i +endforeach +assert(items == [0, 1]) +assert(iter[1] == 1) + +items = [] +foreach i : range(1, 2) + items += i +endforeach +assert(items == [1]) + +items = [] +foreach i : range(1, 10, 2) + items += i +endforeach +assert(items == [1, 3, 5, 7, 9]) diff --git a/test cases/common/60 foreach/prog1.c b/test cases/common/60 foreach/prog1.c new file mode 100644 index 0000000..339dc49 --- /dev/null +++ b/test cases/common/60 foreach/prog1.c @@ -0,0 +1,6 @@ +#include + +int main(void) { + printf("This is test #1.\n"); + return 0; +} diff --git a/test cases/common/60 foreach/prog2.c b/test cases/common/60 foreach/prog2.c new file mode 100644 index 0000000..c213288 --- /dev/null +++ b/test cases/common/60 foreach/prog2.c @@ -0,0 +1,6 @@ +#include + +int main(void) { + printf("This is test #2.\n"); + return 0; +} diff --git a/test cases/common/60 foreach/prog3.c b/test cases/common/60 foreach/prog3.c new file mode 100644 index 0000000..905a530 --- /dev/null +++ b/test cases/common/60 foreach/prog3.c @@ -0,0 +1,6 @@ +#include + +int main(void) { + printf("This is test #3.\n"); + return 0; +} diff --git a/test cases/common/60 foreach/test.json b/test cases/common/60 foreach/test.json new file mode 100644 index 0000000..2fc952d --- /dev/null +++ b/test cases/common/60 foreach/test.json @@ -0,0 +1,10 @@ +{ + "installed": [ + {"type": "exe", "file": "usr/bin/prog1"}, + {"type": "pdb", "file": "usr/bin/prog1"}, + {"type": "exe", "file": "usr/bin/prog2"}, + {"type": "pdb", "file": "usr/bin/prog2"}, + {"type": "exe", "file": "usr/bin/prog3"}, + {"type": "pdb", "file": "usr/bin/prog3"} + ] +} diff --git a/test cases/common/60 install subdir/meson.build b/test cases/common/60 install subdir/meson.build deleted file mode 100644 index 59f3b4d..0000000 --- a/test cases/common/60 install subdir/meson.build +++ /dev/null @@ -1,21 +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) - -# Create new empty directory that doesn't exist in the source tree -install_subdir('new_directory', install_dir : 'share') diff --git a/test cases/common/60 install subdir/nested_elided/sub/dircheck/ninth.dat b/test cases/common/60 install subdir/nested_elided/sub/dircheck/ninth.dat deleted file mode 100644 index c4eaca7..0000000 --- a/test cases/common/60 install subdir/nested_elided/sub/dircheck/ninth.dat +++ /dev/null @@ -1 +0,0 @@ -Nested file under nested elided directory. diff --git a/test cases/common/60 install subdir/nested_elided/sub/eighth.dat b/test cases/common/60 install subdir/nested_elided/sub/eighth.dat deleted file mode 100644 index fa9b7b7..0000000 --- a/test cases/common/60 install subdir/nested_elided/sub/eighth.dat +++ /dev/null @@ -1 +0,0 @@ -File in nested elided directory. diff --git a/test cases/common/60 install subdir/sub/sub1/third.dat b/test cases/common/60 install subdir/sub/sub1/third.dat deleted file mode 100644 index 5ccbc43..0000000 --- a/test cases/common/60 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/60 install subdir/sub1/second.dat b/test cases/common/60 install subdir/sub1/second.dat deleted file mode 100644 index 48857a8..0000000 --- a/test cases/common/60 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/60 install subdir/sub2/dircheck/excluded-three.dat b/test cases/common/60 install subdir/sub2/dircheck/excluded-three.dat deleted file mode 100644 index e69de29..0000000 diff --git a/test cases/common/60 install subdir/sub2/excluded-three.dat b/test cases/common/60 install subdir/sub2/excluded-three.dat deleted file mode 100644 index e69de29..0000000 diff --git a/test cases/common/60 install subdir/sub2/excluded/two.dat b/test cases/common/60 install subdir/sub2/excluded/two.dat deleted file mode 100644 index e69de29..0000000 diff --git a/test cases/common/60 install subdir/sub2/one.dat b/test cases/common/60 install subdir/sub2/one.dat deleted file mode 100644 index e69de29..0000000 diff --git a/test cases/common/60 install subdir/sub_elided/dircheck/fifth.dat b/test cases/common/60 install subdir/sub_elided/dircheck/fifth.dat deleted file mode 100644 index b6ca009..0000000 --- a/test cases/common/60 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/60 install subdir/sub_elided/fourth.dat b/test cases/common/60 install subdir/sub_elided/fourth.dat deleted file mode 100644 index ca5f26a..0000000 --- a/test cases/common/60 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/60 install subdir/subdir/meson.build b/test cases/common/60 install subdir/subdir/meson.build deleted file mode 100644 index 0f81cdb..0000000 --- a/test cases/common/60 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/60 install subdir/subdir/sub1/data1.dat b/test cases/common/60 install subdir/subdir/sub1/data1.dat deleted file mode 100644 index d83c370..0000000 --- a/test cases/common/60 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/60 install subdir/subdir/sub1/sub2/data2.dat b/test cases/common/60 install subdir/subdir/sub1/sub2/data2.dat deleted file mode 100644 index 8ce1392..0000000 --- a/test cases/common/60 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/60 install subdir/subdir/sub_elided/dircheck/seventh.dat b/test cases/common/60 install subdir/subdir/sub_elided/dircheck/seventh.dat deleted file mode 100644 index ea0b8dc..0000000 --- a/test cases/common/60 install subdir/subdir/sub_elided/dircheck/seventh.dat +++ /dev/null @@ -1 +0,0 @@ -Nested file in a subdir. diff --git a/test cases/common/60 install subdir/subdir/sub_elided/sixth.dat b/test cases/common/60 install subdir/subdir/sub_elided/sixth.dat deleted file mode 100644 index 140f075..0000000 --- a/test cases/common/60 install subdir/subdir/sub_elided/sixth.dat +++ /dev/null @@ -1 +0,0 @@ -Elide test file in a subdir. diff --git a/test cases/common/60 install subdir/test.json b/test cases/common/60 install subdir/test.json deleted file mode 100644 index 0dd885c..0000000 --- a/test cases/common/60 install subdir/test.json +++ /dev/null @@ -1,17 +0,0 @@ -{ - "installed": [ - {"type": "file", "file": "usr/share/dircheck/fifth.dat"}, - {"type": "file", "file": "usr/share/dircheck/seventh.dat"}, - {"type": "file", "file": "usr/share/dircheck/ninth.dat"}, - {"type": "file", "file": "usr/share/eighth.dat"}, - {"type": "file", "file": "usr/share/fourth.dat"}, - {"type": "file", "file": "usr/share/sixth.dat"}, - {"type": "file", "file": "usr/share/sub1/data1.dat"}, - {"type": "file", "file": "usr/share/sub1/second.dat"}, - {"type": "file", "file": "usr/share/sub1/third.dat"}, - {"type": "file", "file": "usr/share/sub1/sub2/data2.dat"}, - {"type": "file", "file": "usr/share/sub2/one.dat"}, - {"type": "file", "file": "usr/share/sub2/dircheck/excluded-three.dat"}, - {"type": "dir", "file": "usr/share/new_directory"} - ] -} diff --git a/test cases/common/61 foreach/meson.build b/test cases/common/61 foreach/meson.build deleted file mode 100644 index af60e0f..0000000 --- a/test cases/common/61 foreach/meson.build +++ /dev/null @@ -1,53 +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') - -items = [] -iter = range(2) -foreach i : iter - items += i -endforeach -assert(items == [0, 1]) -assert(iter[1] == 1) - -items = [] -foreach i : range(1, 2) - items += i -endforeach -assert(items == [1]) - -items = [] -foreach i : range(1, 10, 2) - items += i -endforeach -assert(items == [1, 3, 5, 7, 9]) diff --git a/test cases/common/61 foreach/prog1.c b/test cases/common/61 foreach/prog1.c deleted file mode 100644 index 339dc49..0000000 --- a/test cases/common/61 foreach/prog1.c +++ /dev/null @@ -1,6 +0,0 @@ -#include - -int main(void) { - printf("This is test #1.\n"); - return 0; -} diff --git a/test cases/common/61 foreach/prog2.c b/test cases/common/61 foreach/prog2.c deleted file mode 100644 index c213288..0000000 --- a/test cases/common/61 foreach/prog2.c +++ /dev/null @@ -1,6 +0,0 @@ -#include - -int main(void) { - printf("This is test #2.\n"); - return 0; -} diff --git a/test cases/common/61 foreach/prog3.c b/test cases/common/61 foreach/prog3.c deleted file mode 100644 index 905a530..0000000 --- a/test cases/common/61 foreach/prog3.c +++ /dev/null @@ -1,6 +0,0 @@ -#include - -int main(void) { - printf("This is test #3.\n"); - return 0; -} diff --git a/test cases/common/61 foreach/test.json b/test cases/common/61 foreach/test.json deleted file mode 100644 index 2fc952d..0000000 --- a/test cases/common/61 foreach/test.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "installed": [ - {"type": "exe", "file": "usr/bin/prog1"}, - {"type": "pdb", "file": "usr/bin/prog1"}, - {"type": "exe", "file": "usr/bin/prog2"}, - {"type": "pdb", "file": "usr/bin/prog2"}, - {"type": "exe", "file": "usr/bin/prog3"}, - {"type": "pdb", "file": "usr/bin/prog3"} - ] -} diff --git a/test cases/common/61 number arithmetic/meson.build b/test cases/common/61 number arithmetic/meson.build new file mode 100644 index 0000000..e31d7e4 --- /dev/null +++ b/test cases/common/61 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/62 number arithmetic/meson.build b/test cases/common/62 number arithmetic/meson.build deleted file mode 100644 index e31d7e4..0000000 --- a/test cases/common/62 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/62 string arithmetic/meson.build b/test cases/common/62 string arithmetic/meson.build new file mode 100644 index 0000000..59567de --- /dev/null +++ b/test cases/common/62 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/63 array arithmetic/meson.build b/test cases/common/63 array arithmetic/meson.build new file mode 100644 index 0000000..8b8785a --- /dev/null +++ b/test cases/common/63 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/63 string arithmetic/meson.build b/test cases/common/63 string arithmetic/meson.build deleted file mode 100644 index 59567de..0000000 --- a/test cases/common/63 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/64 arithmetic bidmas/meson.build b/test cases/common/64 arithmetic bidmas/meson.build new file mode 100644 index 0000000..c7334b4 --- /dev/null +++ b/test cases/common/64 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/64 array arithmetic/meson.build b/test cases/common/64 array arithmetic/meson.build deleted file mode 100644 index 8b8785a..0000000 --- a/test cases/common/64 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/65 arithmetic bidmas/meson.build b/test cases/common/65 arithmetic bidmas/meson.build deleted file mode 100644 index c7334b4..0000000 --- a/test cases/common/65 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/65 build always/main.c b/test cases/common/65 build always/main.c new file mode 100644 index 0000000..a9ee55e --- /dev/null +++ b/test cases/common/65 build always/main.c @@ -0,0 +1,7 @@ +#include +#include"version.h" + +int main(void) { + printf("Version is %s.\n", version_string); + return 0; +} diff --git a/test cases/common/65 build always/meson.build b/test cases/common/65 build always/meson.build new file mode 100644 index 0000000..f720c89 --- /dev/null +++ b/test cases/common/65 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/65 build always/version.c.in b/test cases/common/65 build always/version.c.in new file mode 100644 index 0000000..619e517 --- /dev/null +++ b/test cases/common/65 build always/version.c.in @@ -0,0 +1,3 @@ +#include"version.h" + +const char *version_string = "@VERSION@"; diff --git a/test cases/common/65 build always/version.h b/test cases/common/65 build always/version.h new file mode 100644 index 0000000..7d433f0 --- /dev/null +++ b/test cases/common/65 build always/version.h @@ -0,0 +1,3 @@ +#pragma once + +extern const char *version_string; diff --git a/test cases/common/65 build always/version_gen.py b/test cases/common/65 build always/version_gen.py new file mode 100755 index 0000000..fbe2df9 --- /dev/null +++ b/test cases/common/65 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/66 build always/main.c b/test cases/common/66 build always/main.c deleted file mode 100644 index a9ee55e..0000000 --- a/test cases/common/66 build always/main.c +++ /dev/null @@ -1,7 +0,0 @@ -#include -#include"version.h" - -int main(void) { - printf("Version is %s.\n", version_string); - return 0; -} diff --git a/test cases/common/66 build always/meson.build b/test cases/common/66 build always/meson.build deleted file mode 100644 index f720c89..0000000 --- a/test cases/common/66 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/66 build always/version.c.in b/test cases/common/66 build always/version.c.in deleted file mode 100644 index 619e517..0000000 --- a/test cases/common/66 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/66 build always/version.h b/test cases/common/66 build always/version.h deleted file mode 100644 index 7d433f0..0000000 --- a/test cases/common/66 build always/version.h +++ /dev/null @@ -1,3 +0,0 @@ -#pragma once - -extern const char *version_string; diff --git a/test cases/common/66 build always/version_gen.py b/test cases/common/66 build always/version_gen.py deleted file mode 100755 index fbe2df9..0000000 --- a/test cases/common/66 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/66 vcstag/meson.build b/test cases/common/66 vcstag/meson.build new file mode 100644 index 0000000..7e5983a --- /dev/null +++ b/test cases/common/66 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/66 vcstag/tagprog.c b/test cases/common/66 vcstag/tagprog.c new file mode 100644 index 0000000..27c3cc5 --- /dev/null +++ b/test cases/common/66 vcstag/tagprog.c @@ -0,0 +1,9 @@ +#include + +extern const char *vcstag; + +int main(void) { + printf("Version is %s\n", vcstag); + return 0; +} + diff --git a/test cases/common/66 vcstag/vcstag.c.in b/test cases/common/66 vcstag/vcstag.c.in new file mode 100644 index 0000000..09192d9 --- /dev/null +++ b/test cases/common/66 vcstag/vcstag.c.in @@ -0,0 +1,2 @@ +const char *vcstag = "@VCS_TAG@"; + diff --git a/test cases/common/67 modules/meson.build b/test cases/common/67 modules/meson.build new file mode 100644 index 0000000..e9750cd --- /dev/null +++ b/test cases/common/67 modules/meson.build @@ -0,0 +1,4 @@ +project('module test', 'c') + +modtest = import('modtest') +modtest.print_hello() diff --git a/test cases/common/67 vcstag/meson.build b/test cases/common/67 vcstag/meson.build deleted file mode 100644 index 7e5983a..0000000 --- a/test cases/common/67 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/67 vcstag/tagprog.c b/test cases/common/67 vcstag/tagprog.c deleted file mode 100644 index 27c3cc5..0000000 --- a/test cases/common/67 vcstag/tagprog.c +++ /dev/null @@ -1,9 +0,0 @@ -#include - -extern const char *vcstag; - -int main(void) { - printf("Version is %s\n", vcstag); - return 0; -} - diff --git a/test cases/common/67 vcstag/vcstag.c.in b/test cases/common/67 vcstag/vcstag.c.in deleted file mode 100644 index 09192d9..0000000 --- a/test cases/common/67 vcstag/vcstag.c.in +++ /dev/null @@ -1,2 +0,0 @@ -const char *vcstag = "@VCS_TAG@"; - diff --git a/test cases/common/68 modules/meson.build b/test cases/common/68 modules/meson.build deleted file mode 100644 index e9750cd..0000000 --- a/test cases/common/68 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/68 should fail/failing.c b/test cases/common/68 should fail/failing.c new file mode 100644 index 0000000..3e70e50 --- /dev/null +++ b/test cases/common/68 should fail/failing.c @@ -0,0 +1,3 @@ +int main(void) { + return 1; +} diff --git a/test cases/common/68 should fail/meson.build b/test cases/common/68 should fail/meson.build new file mode 100644 index 0000000..dffbbb3 --- /dev/null +++ b/test cases/common/68 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/69 configure file in custom target/inc/confdata.in b/test cases/common/69 configure file in custom target/inc/confdata.in new file mode 100644 index 0000000..e44cdea --- /dev/null +++ b/test cases/common/69 configure file in custom target/inc/confdata.in @@ -0,0 +1 @@ +@VALUE@ diff --git a/test cases/common/69 configure file in custom target/inc/meson.build b/test cases/common/69 configure file in custom target/inc/meson.build new file mode 100644 index 0000000..05d2dcb --- /dev/null +++ b/test cases/common/69 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/69 configure file in custom target/meson.build b/test cases/common/69 configure file in custom target/meson.build new file mode 100644 index 0000000..0a850a1 --- /dev/null +++ b/test cases/common/69 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/69 configure file in custom target/src/meson.build b/test cases/common/69 configure file in custom target/src/meson.build new file mode 100644 index 0000000..e0ab9eb --- /dev/null +++ b/test cases/common/69 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/69 configure file in custom target/src/mycompiler.py b/test cases/common/69 configure file in custom target/src/mycompiler.py new file mode 100644 index 0000000..b00c862 --- /dev/null +++ b/test cases/common/69 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/69 should fail/failing.c b/test cases/common/69 should fail/failing.c deleted file mode 100644 index 3e70e50..0000000 --- a/test cases/common/69 should fail/failing.c +++ /dev/null @@ -1,3 +0,0 @@ -int main(void) { - return 1; -} diff --git a/test cases/common/69 should fail/meson.build b/test cases/common/69 should fail/meson.build deleted file mode 100644 index dffbbb3..0000000 --- a/test cases/common/69 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/70 configure file in custom target/inc/confdata.in b/test cases/common/70 configure file in custom target/inc/confdata.in deleted file mode 100644 index e44cdea..0000000 --- a/test cases/common/70 configure file in custom target/inc/confdata.in +++ /dev/null @@ -1 +0,0 @@ -@VALUE@ diff --git a/test cases/common/70 configure file in custom target/inc/meson.build b/test cases/common/70 configure file in custom target/inc/meson.build deleted file mode 100644 index 05d2dcb..0000000 --- a/test cases/common/70 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/70 configure file in custom target/meson.build b/test cases/common/70 configure file in custom target/meson.build deleted file mode 100644 index 0a850a1..0000000 --- a/test cases/common/70 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/70 configure file in custom target/src/meson.build b/test cases/common/70 configure file in custom target/src/meson.build deleted file mode 100644 index e0ab9eb..0000000 --- a/test cases/common/70 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/70 configure file in custom target/src/mycompiler.py b/test cases/common/70 configure file in custom target/src/mycompiler.py deleted file mode 100644 index b00c862..0000000 --- a/test cases/common/70 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/70 external test program/meson.build b/test cases/common/70 external test program/meson.build new file mode 100644 index 0000000..d18ddcd --- /dev/null +++ b/test cases/common/70 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/70 external test program/mytest.py b/test cases/common/70 external test program/mytest.py new file mode 100755 index 0000000..fee94e0 --- /dev/null +++ b/test cases/common/70 external test program/mytest.py @@ -0,0 +1,10 @@ +#!/usr/bin/env python3 + + +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/71 ctarget dependency/gen1.py b/test cases/common/71 ctarget dependency/gen1.py new file mode 100755 index 0000000..dbadb6d --- /dev/null +++ b/test cases/common/71 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]) as f: + contents = f.read() +with open(sys.argv[2], 'w') as f: + f.write(contents) diff --git a/test cases/common/71 ctarget dependency/gen2.py b/test cases/common/71 ctarget dependency/gen2.py new file mode 100755 index 0000000..dc6525b --- /dev/null +++ b/test cases/common/71 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]) as ifile, open(sys.argv[2], 'w') as ofile: + ofile.write(ifile.read()) diff --git a/test cases/common/71 ctarget dependency/input.dat b/test cases/common/71 ctarget dependency/input.dat new file mode 100644 index 0000000..7af91e2 --- /dev/null +++ b/test cases/common/71 ctarget dependency/input.dat @@ -0,0 +1 @@ +This is a piece of text. diff --git a/test cases/common/71 ctarget dependency/meson.build b/test cases/common/71 ctarget dependency/meson.build new file mode 100644 index 0000000..cd11951 --- /dev/null +++ b/test cases/common/71 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/71 external test program/meson.build b/test cases/common/71 external test program/meson.build deleted file mode 100644 index d18ddcd..0000000 --- a/test cases/common/71 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/71 external test program/mytest.py b/test cases/common/71 external test program/mytest.py deleted file mode 100755 index fee94e0..0000000 --- a/test cases/common/71 external test program/mytest.py +++ /dev/null @@ -1,10 +0,0 @@ -#!/usr/bin/env python3 - - -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/72 ctarget dependency/gen1.py b/test cases/common/72 ctarget dependency/gen1.py deleted file mode 100755 index dbadb6d..0000000 --- a/test cases/common/72 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]) as f: - contents = f.read() -with open(sys.argv[2], 'w') as f: - f.write(contents) diff --git a/test cases/common/72 ctarget dependency/gen2.py b/test cases/common/72 ctarget dependency/gen2.py deleted file mode 100755 index dc6525b..0000000 --- a/test cases/common/72 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]) as ifile, open(sys.argv[2], 'w') as ofile: - ofile.write(ifile.read()) diff --git a/test cases/common/72 ctarget dependency/input.dat b/test cases/common/72 ctarget dependency/input.dat deleted file mode 100644 index 7af91e2..0000000 --- a/test cases/common/72 ctarget dependency/input.dat +++ /dev/null @@ -1 +0,0 @@ -This is a piece of text. diff --git a/test cases/common/72 ctarget dependency/meson.build b/test cases/common/72 ctarget dependency/meson.build deleted file mode 100644 index cd11951..0000000 --- a/test cases/common/72 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/72 shared subproject/a.c b/test cases/common/72 shared subproject/a.c new file mode 100644 index 0000000..7510a1b --- /dev/null +++ b/test cases/common/72 shared subproject/a.c @@ -0,0 +1,13 @@ +#include +char func_b(void); +char func_c(void); + +int main(void) { + if(func_b() != 'b') { + return 1; + } + if(func_c() != 'c') { + return 2; + } + return 0; +} diff --git a/test cases/common/72 shared subproject/meson.build b/test cases/common/72 shared subproject/meson.build new file mode 100644 index 0000000..6803d51 --- /dev/null +++ b/test cases/common/72 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/72 shared subproject/subprojects/B/b.c b/test cases/common/72 shared subproject/subprojects/B/b.c new file mode 100644 index 0000000..b8c7d83 --- /dev/null +++ b/test cases/common/72 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(void); + +char DLL_PUBLIC func_b(void) { + if(func_c() != 'c') { + exit(3); + } + return 'b'; +} diff --git a/test cases/common/72 shared subproject/subprojects/B/meson.build b/test cases/common/72 shared subproject/subprojects/B/meson.build new file mode 100644 index 0000000..280c60c --- /dev/null +++ b/test cases/common/72 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/72 shared subproject/subprojects/C/c.c b/test cases/common/72 shared subproject/subprojects/C/c.c new file mode 100644 index 0000000..facd199 --- /dev/null +++ b/test cases/common/72 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(void) { + return 'c'; +} diff --git a/test cases/common/72 shared subproject/subprojects/C/meson.build b/test cases/common/72 shared subproject/subprojects/C/meson.build new file mode 100644 index 0000000..abf0b1e --- /dev/null +++ b/test cases/common/72 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/73 shared subproject 2/a.c b/test cases/common/73 shared subproject 2/a.c new file mode 100644 index 0000000..7510a1b --- /dev/null +++ b/test cases/common/73 shared subproject 2/a.c @@ -0,0 +1,13 @@ +#include +char func_b(void); +char func_c(void); + +int main(void) { + if(func_b() != 'b') { + return 1; + } + if(func_c() != 'c') { + return 2; + } + return 0; +} diff --git a/test cases/common/73 shared subproject 2/meson.build b/test cases/common/73 shared subproject 2/meson.build new file mode 100644 index 0000000..0647325 --- /dev/null +++ b/test cases/common/73 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/73 shared subproject 2/subprojects/B/b.c b/test cases/common/73 shared subproject 2/subprojects/B/b.c new file mode 100644 index 0000000..4d71c0f --- /dev/null +++ b/test cases/common/73 shared subproject 2/subprojects/B/b.c @@ -0,0 +1,20 @@ +#include +char func_c(void); + +#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(void) { + if(func_c() != 'c') { + exit(3); + } + return 'b'; +} diff --git a/test cases/common/73 shared subproject 2/subprojects/B/meson.build b/test cases/common/73 shared subproject 2/subprojects/B/meson.build new file mode 100644 index 0000000..280c60c --- /dev/null +++ b/test cases/common/73 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/73 shared subproject 2/subprojects/C/c.c b/test cases/common/73 shared subproject 2/subprojects/C/c.c new file mode 100644 index 0000000..facd199 --- /dev/null +++ b/test cases/common/73 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(void) { + return 'c'; +} diff --git a/test cases/common/73 shared subproject 2/subprojects/C/meson.build b/test cases/common/73 shared subproject 2/subprojects/C/meson.build new file mode 100644 index 0000000..abf0b1e --- /dev/null +++ b/test cases/common/73 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/73 shared subproject/a.c b/test cases/common/73 shared subproject/a.c deleted file mode 100644 index 7510a1b..0000000 --- a/test cases/common/73 shared subproject/a.c +++ /dev/null @@ -1,13 +0,0 @@ -#include -char func_b(void); -char func_c(void); - -int main(void) { - if(func_b() != 'b') { - return 1; - } - if(func_c() != 'c') { - return 2; - } - return 0; -} diff --git a/test cases/common/73 shared subproject/meson.build b/test cases/common/73 shared subproject/meson.build deleted file mode 100644 index 6803d51..0000000 --- a/test cases/common/73 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/73 shared subproject/subprojects/B/b.c b/test cases/common/73 shared subproject/subprojects/B/b.c deleted file mode 100644 index b8c7d83..0000000 --- a/test cases/common/73 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(void); - -char DLL_PUBLIC func_b(void) { - if(func_c() != 'c') { - exit(3); - } - return 'b'; -} diff --git a/test cases/common/73 shared subproject/subprojects/B/meson.build b/test cases/common/73 shared subproject/subprojects/B/meson.build deleted file mode 100644 index 280c60c..0000000 --- a/test cases/common/73 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/73 shared subproject/subprojects/C/c.c b/test cases/common/73 shared subproject/subprojects/C/c.c deleted file mode 100644 index facd199..0000000 --- a/test cases/common/73 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(void) { - return 'c'; -} diff --git a/test cases/common/73 shared subproject/subprojects/C/meson.build b/test cases/common/73 shared subproject/subprojects/C/meson.build deleted file mode 100644 index abf0b1e..0000000 --- a/test cases/common/73 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/74 file object/lib.c b/test cases/common/74 file object/lib.c new file mode 100644 index 0000000..9180030 --- /dev/null +++ b/test cases/common/74 file object/lib.c @@ -0,0 +1,3 @@ +int func(void) { + return 0; +} diff --git a/test cases/common/74 file object/meson.build b/test cases/common/74 file object/meson.build new file mode 100644 index 0000000..c3ecb7b --- /dev/null +++ b/test cases/common/74 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/74 file object/prog.c b/test cases/common/74 file object/prog.c new file mode 100644 index 0000000..78c6acc --- /dev/null +++ b/test cases/common/74 file object/prog.c @@ -0,0 +1,13 @@ +#include + +int func(void); /* Files in different subdirs return different values. */ + +int main(void) { + if(func() == 0) { + printf("Iz success.\n"); + } else { + printf("Iz fail.\n"); + return 1; + } + return 0; +} diff --git a/test cases/common/74 file object/subdir1/lib.c b/test cases/common/74 file object/subdir1/lib.c new file mode 100644 index 0000000..8c13c21 --- /dev/null +++ b/test cases/common/74 file object/subdir1/lib.c @@ -0,0 +1,3 @@ +int func(void) { + return 1; +} diff --git a/test cases/common/74 file object/subdir1/meson.build b/test cases/common/74 file object/subdir1/meson.build new file mode 100644 index 0000000..f5066f0 --- /dev/null +++ b/test cases/common/74 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/74 file object/subdir1/prog.c b/test cases/common/74 file object/subdir1/prog.c new file mode 100644 index 0000000..38d13d2 --- /dev/null +++ b/test cases/common/74 file object/subdir1/prog.c @@ -0,0 +1,13 @@ +#include + +int func(void); + +int main(void) { + if(func() == 1) { + printf("Iz success.\n"); + } else { + printf("Iz fail.\n"); + return 1; + } + return 0; +} diff --git a/test cases/common/74 file object/subdir2/lib.c b/test cases/common/74 file object/subdir2/lib.c new file mode 100644 index 0000000..8e2b4eb --- /dev/null +++ b/test cases/common/74 file object/subdir2/lib.c @@ -0,0 +1,3 @@ +int func(void) { + return 2; +} diff --git a/test cases/common/74 file object/subdir2/meson.build b/test cases/common/74 file object/subdir2/meson.build new file mode 100644 index 0000000..5886510 --- /dev/null +++ b/test cases/common/74 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/74 file object/subdir2/prog.c b/test cases/common/74 file object/subdir2/prog.c new file mode 100644 index 0000000..8a8f0d0 --- /dev/null +++ b/test cases/common/74 file object/subdir2/prog.c @@ -0,0 +1,13 @@ +#include + +int func(void); + +int main(void) { + if(func() == 2) { + printf("Iz success.\n"); + } else { + printf("Iz fail.\n"); + return 1; + } + return 0; +} diff --git a/test cases/common/74 shared subproject 2/a.c b/test cases/common/74 shared subproject 2/a.c deleted file mode 100644 index 7510a1b..0000000 --- a/test cases/common/74 shared subproject 2/a.c +++ /dev/null @@ -1,13 +0,0 @@ -#include -char func_b(void); -char func_c(void); - -int main(void) { - if(func_b() != 'b') { - return 1; - } - if(func_c() != 'c') { - return 2; - } - return 0; -} diff --git a/test cases/common/74 shared subproject 2/meson.build b/test cases/common/74 shared subproject 2/meson.build deleted file mode 100644 index 0647325..0000000 --- a/test cases/common/74 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/74 shared subproject 2/subprojects/B/b.c b/test cases/common/74 shared subproject 2/subprojects/B/b.c deleted file mode 100644 index 4d71c0f..0000000 --- a/test cases/common/74 shared subproject 2/subprojects/B/b.c +++ /dev/null @@ -1,20 +0,0 @@ -#include -char func_c(void); - -#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(void) { - if(func_c() != 'c') { - exit(3); - } - return 'b'; -} diff --git a/test cases/common/74 shared subproject 2/subprojects/B/meson.build b/test cases/common/74 shared subproject 2/subprojects/B/meson.build deleted file mode 100644 index 280c60c..0000000 --- a/test cases/common/74 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/74 shared subproject 2/subprojects/C/c.c b/test cases/common/74 shared subproject 2/subprojects/C/c.c deleted file mode 100644 index facd199..0000000 --- a/test cases/common/74 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(void) { - return 'c'; -} diff --git a/test cases/common/74 shared subproject 2/subprojects/C/meson.build b/test cases/common/74 shared subproject 2/subprojects/C/meson.build deleted file mode 100644 index abf0b1e..0000000 --- a/test cases/common/74 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/75 custom subproject dir/a.c b/test cases/common/75 custom subproject dir/a.c new file mode 100644 index 0000000..7510a1b --- /dev/null +++ b/test cases/common/75 custom subproject dir/a.c @@ -0,0 +1,13 @@ +#include +char func_b(void); +char func_c(void); + +int main(void) { + if(func_b() != 'b') { + return 1; + } + if(func_c() != 'c') { + return 2; + } + return 0; +} diff --git a/test cases/common/75 custom subproject dir/custom_subproject_dir/B/b.c b/test cases/common/75 custom subproject dir/custom_subproject_dir/B/b.c new file mode 100644 index 0000000..4d71c0f --- /dev/null +++ b/test cases/common/75 custom subproject dir/custom_subproject_dir/B/b.c @@ -0,0 +1,20 @@ +#include +char func_c(void); + +#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(void) { + if(func_c() != 'c') { + exit(3); + } + return 'b'; +} diff --git a/test cases/common/75 custom subproject dir/custom_subproject_dir/B/meson.build b/test cases/common/75 custom subproject dir/custom_subproject_dir/B/meson.build new file mode 100644 index 0000000..280c60c --- /dev/null +++ b/test cases/common/75 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/75 custom subproject dir/custom_subproject_dir/C/c.c b/test cases/common/75 custom subproject dir/custom_subproject_dir/C/c.c new file mode 100644 index 0000000..facd199 --- /dev/null +++ b/test cases/common/75 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(void) { + return 'c'; +} diff --git a/test cases/common/75 custom subproject dir/custom_subproject_dir/C/meson.build b/test cases/common/75 custom subproject dir/custom_subproject_dir/C/meson.build new file mode 100644 index 0000000..abf0b1e --- /dev/null +++ b/test cases/common/75 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/75 custom subproject dir/meson.build b/test cases/common/75 custom subproject dir/meson.build new file mode 100644 index 0000000..d9ba649 --- /dev/null +++ b/test cases/common/75 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/75 file object/lib.c b/test cases/common/75 file object/lib.c deleted file mode 100644 index 9180030..0000000 --- a/test cases/common/75 file object/lib.c +++ /dev/null @@ -1,3 +0,0 @@ -int func(void) { - return 0; -} diff --git a/test cases/common/75 file object/meson.build b/test cases/common/75 file object/meson.build deleted file mode 100644 index c3ecb7b..0000000 --- a/test cases/common/75 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/75 file object/prog.c b/test cases/common/75 file object/prog.c deleted file mode 100644 index 78c6acc..0000000 --- a/test cases/common/75 file object/prog.c +++ /dev/null @@ -1,13 +0,0 @@ -#include - -int func(void); /* Files in different subdirs return different values. */ - -int main(void) { - if(func() == 0) { - printf("Iz success.\n"); - } else { - printf("Iz fail.\n"); - return 1; - } - return 0; -} diff --git a/test cases/common/75 file object/subdir1/lib.c b/test cases/common/75 file object/subdir1/lib.c deleted file mode 100644 index 8c13c21..0000000 --- a/test cases/common/75 file object/subdir1/lib.c +++ /dev/null @@ -1,3 +0,0 @@ -int func(void) { - return 1; -} diff --git a/test cases/common/75 file object/subdir1/meson.build b/test cases/common/75 file object/subdir1/meson.build deleted file mode 100644 index f5066f0..0000000 --- a/test cases/common/75 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/75 file object/subdir1/prog.c b/test cases/common/75 file object/subdir1/prog.c deleted file mode 100644 index 38d13d2..0000000 --- a/test cases/common/75 file object/subdir1/prog.c +++ /dev/null @@ -1,13 +0,0 @@ -#include - -int func(void); - -int main(void) { - if(func() == 1) { - printf("Iz success.\n"); - } else { - printf("Iz fail.\n"); - return 1; - } - return 0; -} diff --git a/test cases/common/75 file object/subdir2/lib.c b/test cases/common/75 file object/subdir2/lib.c deleted file mode 100644 index 8e2b4eb..0000000 --- a/test cases/common/75 file object/subdir2/lib.c +++ /dev/null @@ -1,3 +0,0 @@ -int func(void) { - return 2; -} diff --git a/test cases/common/75 file object/subdir2/meson.build b/test cases/common/75 file object/subdir2/meson.build deleted file mode 100644 index 5886510..0000000 --- a/test cases/common/75 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/75 file object/subdir2/prog.c b/test cases/common/75 file object/subdir2/prog.c deleted file mode 100644 index 8a8f0d0..0000000 --- a/test cases/common/75 file object/subdir2/prog.c +++ /dev/null @@ -1,13 +0,0 @@ -#include - -int func(void); - -int main(void) { - if(func() == 2) { - printf("Iz success.\n"); - } else { - printf("Iz fail.\n"); - return 1; - } - return 0; -} diff --git a/test cases/common/76 custom subproject dir/a.c b/test cases/common/76 custom subproject dir/a.c deleted file mode 100644 index 7510a1b..0000000 --- a/test cases/common/76 custom subproject dir/a.c +++ /dev/null @@ -1,13 +0,0 @@ -#include -char func_b(void); -char func_c(void); - -int main(void) { - if(func_b() != 'b') { - return 1; - } - if(func_c() != 'c') { - return 2; - } - return 0; -} diff --git a/test cases/common/76 custom subproject dir/custom_subproject_dir/B/b.c b/test cases/common/76 custom subproject dir/custom_subproject_dir/B/b.c deleted file mode 100644 index 4d71c0f..0000000 --- a/test cases/common/76 custom subproject dir/custom_subproject_dir/B/b.c +++ /dev/null @@ -1,20 +0,0 @@ -#include -char func_c(void); - -#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(void) { - if(func_c() != 'c') { - exit(3); - } - return 'b'; -} diff --git a/test cases/common/76 custom subproject dir/custom_subproject_dir/B/meson.build b/test cases/common/76 custom subproject dir/custom_subproject_dir/B/meson.build deleted file mode 100644 index 280c60c..0000000 --- a/test cases/common/76 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/76 custom subproject dir/custom_subproject_dir/C/c.c b/test cases/common/76 custom subproject dir/custom_subproject_dir/C/c.c deleted file mode 100644 index facd199..0000000 --- a/test cases/common/76 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(void) { - return 'c'; -} diff --git a/test cases/common/76 custom subproject dir/custom_subproject_dir/C/meson.build b/test cases/common/76 custom subproject dir/custom_subproject_dir/C/meson.build deleted file mode 100644 index abf0b1e..0000000 --- a/test cases/common/76 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/76 custom subproject dir/meson.build b/test cases/common/76 custom subproject dir/meson.build deleted file mode 100644 index d9ba649..0000000 --- a/test cases/common/76 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/76 has type/meson.build b/test cases/common/76 has type/meson.build new file mode 100644 index 0000000..de8dbc8 --- /dev/null +++ b/test cases/common/76 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/77 extract from nested subdir/meson.build b/test cases/common/77 extract from nested subdir/meson.build new file mode 100644 index 0000000..000e1aa --- /dev/null +++ b/test cases/common/77 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/77 extract from nested subdir/src/first/lib_first.c b/test cases/common/77 extract from nested subdir/src/first/lib_first.c new file mode 100644 index 0000000..5fc3267 --- /dev/null +++ b/test cases/common/77 extract from nested subdir/src/first/lib_first.c @@ -0,0 +1,3 @@ +int first(void) { + return 1001; +} diff --git a/test cases/common/77 extract from nested subdir/src/first/meson.build b/test cases/common/77 extract from nested subdir/src/first/meson.build new file mode 100644 index 0000000..b97aef4 --- /dev/null +++ b/test cases/common/77 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/77 extract from nested subdir/src/meson.build b/test cases/common/77 extract from nested subdir/src/meson.build new file mode 100644 index 0000000..3f5ec32 --- /dev/null +++ b/test cases/common/77 extract from nested subdir/src/meson.build @@ -0,0 +1 @@ +subdir('first') diff --git a/test cases/common/77 extract from nested subdir/tst/first/exe_first.c b/test cases/common/77 extract from nested subdir/tst/first/exe_first.c new file mode 100644 index 0000000..e8188cd --- /dev/null +++ b/test cases/common/77 extract from nested subdir/tst/first/exe_first.c @@ -0,0 +1,5 @@ +int first(void); + +int main(void) { + return first() - 1001; +} diff --git a/test cases/common/77 extract from nested subdir/tst/first/meson.build b/test cases/common/77 extract from nested subdir/tst/first/meson.build new file mode 100644 index 0000000..a6fa7da --- /dev/null +++ b/test cases/common/77 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/77 extract from nested subdir/tst/meson.build b/test cases/common/77 extract from nested subdir/tst/meson.build new file mode 100644 index 0000000..3f5ec32 --- /dev/null +++ b/test cases/common/77 extract from nested subdir/tst/meson.build @@ -0,0 +1 @@ +subdir('first') diff --git a/test cases/common/77 has type/meson.build b/test cases/common/77 has type/meson.build deleted file mode 100644 index de8dbc8..0000000 --- a/test cases/common/77 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/78 extract from nested subdir/meson.build b/test cases/common/78 extract from nested subdir/meson.build deleted file mode 100644 index 000e1aa..0000000 --- a/test cases/common/78 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/78 extract from nested subdir/src/first/lib_first.c b/test cases/common/78 extract from nested subdir/src/first/lib_first.c deleted file mode 100644 index 5fc3267..0000000 --- a/test cases/common/78 extract from nested subdir/src/first/lib_first.c +++ /dev/null @@ -1,3 +0,0 @@ -int first(void) { - return 1001; -} diff --git a/test cases/common/78 extract from nested subdir/src/first/meson.build b/test cases/common/78 extract from nested subdir/src/first/meson.build deleted file mode 100644 index b97aef4..0000000 --- a/test cases/common/78 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/78 extract from nested subdir/src/meson.build b/test cases/common/78 extract from nested subdir/src/meson.build deleted file mode 100644 index 3f5ec32..0000000 --- a/test cases/common/78 extract from nested subdir/src/meson.build +++ /dev/null @@ -1 +0,0 @@ -subdir('first') diff --git a/test cases/common/78 extract from nested subdir/tst/first/exe_first.c b/test cases/common/78 extract from nested subdir/tst/first/exe_first.c deleted file mode 100644 index e8188cd..0000000 --- a/test cases/common/78 extract from nested subdir/tst/first/exe_first.c +++ /dev/null @@ -1,5 +0,0 @@ -int first(void); - -int main(void) { - return first() - 1001; -} diff --git a/test cases/common/78 extract from nested subdir/tst/first/meson.build b/test cases/common/78 extract from nested subdir/tst/first/meson.build deleted file mode 100644 index a6fa7da..0000000 --- a/test cases/common/78 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/78 extract from nested subdir/tst/meson.build b/test cases/common/78 extract from nested subdir/tst/meson.build deleted file mode 100644 index 3f5ec32..0000000 --- a/test cases/common/78 extract from nested subdir/tst/meson.build +++ /dev/null @@ -1 +0,0 @@ -subdir('first') diff --git a/test cases/common/78 internal dependency/meson.build b/test cases/common/78 internal dependency/meson.build new file mode 100644 index 0000000..6faedb0 --- /dev/null +++ b/test cases/common/78 internal dependency/meson.build @@ -0,0 +1,4 @@ +project('internal dependency', 'c') + +subdir('proj1') +subdir('src') diff --git a/test cases/common/78 internal dependency/proj1/include/proj1.h b/test cases/common/78 internal dependency/proj1/include/proj1.h new file mode 100644 index 0000000..ecb1e4b --- /dev/null +++ b/test cases/common/78 internal dependency/proj1/include/proj1.h @@ -0,0 +1,5 @@ +#pragma once + +void proj1_func1(void); +void proj1_func2(void); +void proj1_func3(void); diff --git a/test cases/common/78 internal dependency/proj1/meson.build b/test cases/common/78 internal dependency/proj1/meson.build new file mode 100644 index 0000000..422021e --- /dev/null +++ b/test cases/common/78 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/78 internal dependency/proj1/proj1f1.c b/test cases/common/78 internal dependency/proj1/proj1f1.c new file mode 100644 index 0000000..69fa823 --- /dev/null +++ b/test cases/common/78 internal dependency/proj1/proj1f1.c @@ -0,0 +1,6 @@ +#include +#include + +void proj1_func1(void) { + printf("In proj1_func1.\n"); +} diff --git a/test cases/common/78 internal dependency/proj1/proj1f2.c b/test cases/common/78 internal dependency/proj1/proj1f2.c new file mode 100644 index 0000000..7dd621c --- /dev/null +++ b/test cases/common/78 internal dependency/proj1/proj1f2.c @@ -0,0 +1,6 @@ +#include +#include + +void proj1_func2(void) { + printf("In proj1_func2.\n"); +} diff --git a/test cases/common/78 internal dependency/proj1/proj1f3.c b/test cases/common/78 internal dependency/proj1/proj1f3.c new file mode 100644 index 0000000..2861ddc --- /dev/null +++ b/test cases/common/78 internal dependency/proj1/proj1f3.c @@ -0,0 +1,6 @@ +#include +#include + +void proj1_func3(void) { + printf("In proj1_func3.\n"); +} diff --git a/test cases/common/78 internal dependency/src/main.c b/test cases/common/78 internal dependency/src/main.c new file mode 100644 index 0000000..dbb7c4a --- /dev/null +++ b/test cases/common/78 internal dependency/src/main.c @@ -0,0 +1,10 @@ +#include +#include + +int main(void) { + printf("Now calling into library.\n"); + proj1_func1(); + proj1_func2(); + proj1_func3(); + return 0; +} diff --git a/test cases/common/78 internal dependency/src/meson.build b/test cases/common/78 internal dependency/src/meson.build new file mode 100644 index 0000000..89f99ab --- /dev/null +++ b/test cases/common/78 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/79 internal dependency/meson.build b/test cases/common/79 internal dependency/meson.build deleted file mode 100644 index 6faedb0..0000000 --- a/test cases/common/79 internal dependency/meson.build +++ /dev/null @@ -1,4 +0,0 @@ -project('internal dependency', 'c') - -subdir('proj1') -subdir('src') diff --git a/test cases/common/79 internal dependency/proj1/include/proj1.h b/test cases/common/79 internal dependency/proj1/include/proj1.h deleted file mode 100644 index ecb1e4b..0000000 --- a/test cases/common/79 internal dependency/proj1/include/proj1.h +++ /dev/null @@ -1,5 +0,0 @@ -#pragma once - -void proj1_func1(void); -void proj1_func2(void); -void proj1_func3(void); diff --git a/test cases/common/79 internal dependency/proj1/meson.build b/test cases/common/79 internal dependency/proj1/meson.build deleted file mode 100644 index 422021e..0000000 --- a/test cases/common/79 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/79 internal dependency/proj1/proj1f1.c b/test cases/common/79 internal dependency/proj1/proj1f1.c deleted file mode 100644 index 69fa823..0000000 --- a/test cases/common/79 internal dependency/proj1/proj1f1.c +++ /dev/null @@ -1,6 +0,0 @@ -#include -#include - -void proj1_func1(void) { - printf("In proj1_func1.\n"); -} diff --git a/test cases/common/79 internal dependency/proj1/proj1f2.c b/test cases/common/79 internal dependency/proj1/proj1f2.c deleted file mode 100644 index 7dd621c..0000000 --- a/test cases/common/79 internal dependency/proj1/proj1f2.c +++ /dev/null @@ -1,6 +0,0 @@ -#include -#include - -void proj1_func2(void) { - printf("In proj1_func2.\n"); -} diff --git a/test cases/common/79 internal dependency/proj1/proj1f3.c b/test cases/common/79 internal dependency/proj1/proj1f3.c deleted file mode 100644 index 2861ddc..0000000 --- a/test cases/common/79 internal dependency/proj1/proj1f3.c +++ /dev/null @@ -1,6 +0,0 @@ -#include -#include - -void proj1_func3(void) { - printf("In proj1_func3.\n"); -} diff --git a/test cases/common/79 internal dependency/src/main.c b/test cases/common/79 internal dependency/src/main.c deleted file mode 100644 index dbb7c4a..0000000 --- a/test cases/common/79 internal dependency/src/main.c +++ /dev/null @@ -1,10 +0,0 @@ -#include -#include - -int main(void) { - printf("Now calling into library.\n"); - proj1_func1(); - proj1_func2(); - proj1_func3(); - return 0; -} diff --git a/test cases/common/79 internal dependency/src/meson.build b/test cases/common/79 internal dependency/src/meson.build deleted file mode 100644 index 89f99ab..0000000 --- a/test cases/common/79 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/79 same basename/exe1.c b/test cases/common/79 same basename/exe1.c new file mode 100644 index 0000000..128f2bb --- /dev/null +++ b/test cases/common/79 same basename/exe1.c @@ -0,0 +1,5 @@ +int func(void); + +int main(void) { + return func(); +} diff --git a/test cases/common/79 same basename/exe2.c b/test cases/common/79 same basename/exe2.c new file mode 100644 index 0000000..d2d8995 --- /dev/null +++ b/test cases/common/79 same basename/exe2.c @@ -0,0 +1,5 @@ +int func(void); + +int main(void) { + return func() == 1 ? 0 : 1; +} diff --git a/test cases/common/79 same basename/lib.c b/test cases/common/79 same basename/lib.c new file mode 100644 index 0000000..b3798e9 --- /dev/null +++ b/test cases/common/79 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(void) { + return 1; +} +#elif defined STAT +int func(void) { + return 0; +} +#else +#error "Missing type definition." +#endif + diff --git a/test cases/common/79 same basename/meson.build b/test cases/common/79 same basename/meson.build new file mode 100644 index 0000000..856c536 --- /dev/null +++ b/test cases/common/79 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/79 same basename/sharedsub/meson.build b/test cases/common/79 same basename/sharedsub/meson.build new file mode 100644 index 0000000..29654a9 --- /dev/null +++ b/test cases/common/79 same basename/sharedsub/meson.build @@ -0,0 +1 @@ +shlib = shared_library('name', '../lib.c', c_args : '-DSHAR') diff --git a/test cases/common/79 same basename/staticsub/meson.build b/test cases/common/79 same basename/staticsub/meson.build new file mode 100644 index 0000000..5e5242e --- /dev/null +++ b/test cases/common/79 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/80 declare dep/entity/entity.h b/test cases/common/80 declare dep/entity/entity.h new file mode 100644 index 0000000..959a8c3 --- /dev/null +++ b/test cases/common/80 declare dep/entity/entity.h @@ -0,0 +1,4 @@ +#pragma once + +int entity_func1(void); +int entity_func2(void); diff --git a/test cases/common/80 declare dep/entity/entity1.c b/test cases/common/80 declare dep/entity/entity1.c new file mode 100644 index 0000000..d124e24 --- /dev/null +++ b/test cases/common/80 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(void) { + return 5; +} diff --git a/test cases/common/80 declare dep/entity/entity2.c b/test cases/common/80 declare dep/entity/entity2.c new file mode 100644 index 0000000..4e8bb07 --- /dev/null +++ b/test cases/common/80 declare dep/entity/entity2.c @@ -0,0 +1,5 @@ +#include + +int entity_func2(void) { + return 9; +} diff --git a/test cases/common/80 declare dep/entity/meson.build b/test cases/common/80 declare dep/entity/meson.build new file mode 100644 index 0000000..469ecd3 --- /dev/null +++ b/test cases/common/80 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/80 declare dep/main.c b/test cases/common/80 declare dep/main.c new file mode 100644 index 0000000..62200c9 --- /dev/null +++ b/test cases/common/80 declare dep/main.c @@ -0,0 +1,18 @@ +#include +#include + +#ifndef USING_ENT +#error "Entity use flag not used for compilation." +#endif + +int main(void) { + 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/80 declare dep/meson.build b/test cases/common/80 declare dep/meson.build new file mode 100644 index 0000000..e427def --- /dev/null +++ b/test cases/common/80 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/80 same basename/exe1.c b/test cases/common/80 same basename/exe1.c deleted file mode 100644 index 128f2bb..0000000 --- a/test cases/common/80 same basename/exe1.c +++ /dev/null @@ -1,5 +0,0 @@ -int func(void); - -int main(void) { - return func(); -} diff --git a/test cases/common/80 same basename/exe2.c b/test cases/common/80 same basename/exe2.c deleted file mode 100644 index d2d8995..0000000 --- a/test cases/common/80 same basename/exe2.c +++ /dev/null @@ -1,5 +0,0 @@ -int func(void); - -int main(void) { - return func() == 1 ? 0 : 1; -} diff --git a/test cases/common/80 same basename/lib.c b/test cases/common/80 same basename/lib.c deleted file mode 100644 index b3798e9..0000000 --- a/test cases/common/80 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(void) { - return 1; -} -#elif defined STAT -int func(void) { - return 0; -} -#else -#error "Missing type definition." -#endif - diff --git a/test cases/common/80 same basename/meson.build b/test cases/common/80 same basename/meson.build deleted file mode 100644 index 856c536..0000000 --- a/test cases/common/80 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/80 same basename/sharedsub/meson.build b/test cases/common/80 same basename/sharedsub/meson.build deleted file mode 100644 index 29654a9..0000000 --- a/test cases/common/80 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/80 same basename/staticsub/meson.build b/test cases/common/80 same basename/staticsub/meson.build deleted file mode 100644 index 5e5242e..0000000 --- a/test cases/common/80 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/81 declare dep/entity/entity.h b/test cases/common/81 declare dep/entity/entity.h deleted file mode 100644 index 959a8c3..0000000 --- a/test cases/common/81 declare dep/entity/entity.h +++ /dev/null @@ -1,4 +0,0 @@ -#pragma once - -int entity_func1(void); -int entity_func2(void); diff --git a/test cases/common/81 declare dep/entity/entity1.c b/test cases/common/81 declare dep/entity/entity1.c deleted file mode 100644 index d124e24..0000000 --- a/test cases/common/81 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(void) { - return 5; -} diff --git a/test cases/common/81 declare dep/entity/entity2.c b/test cases/common/81 declare dep/entity/entity2.c deleted file mode 100644 index 4e8bb07..0000000 --- a/test cases/common/81 declare dep/entity/entity2.c +++ /dev/null @@ -1,5 +0,0 @@ -#include - -int entity_func2(void) { - return 9; -} diff --git a/test cases/common/81 declare dep/entity/meson.build b/test cases/common/81 declare dep/entity/meson.build deleted file mode 100644 index 469ecd3..0000000 --- a/test cases/common/81 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/81 declare dep/main.c b/test cases/common/81 declare dep/main.c deleted file mode 100644 index 62200c9..0000000 --- a/test cases/common/81 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(void) { - 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/81 declare dep/meson.build b/test cases/common/81 declare dep/meson.build deleted file mode 100644 index e427def..0000000 --- a/test cases/common/81 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/81 extract all/extractor.h b/test cases/common/81 extract all/extractor.h new file mode 100644 index 0000000..cfb7ff6 --- /dev/null +++ b/test cases/common/81 extract all/extractor.h @@ -0,0 +1,6 @@ +#pragma once + +int func1(void); +int func2(void); +int func3(void); +int func4(void); diff --git a/test cases/common/81 extract all/four.c b/test cases/common/81 extract all/four.c new file mode 100644 index 0000000..f67a85e --- /dev/null +++ b/test cases/common/81 extract all/four.c @@ -0,0 +1,5 @@ +#include"extractor.h" + +int func4(void) { + return 4; +} diff --git a/test cases/common/81 extract all/meson.build b/test cases/common/81 extract all/meson.build new file mode 100644 index 0000000..4f08a4f --- /dev/null +++ b/test cases/common/81 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/81 extract all/one.c b/test cases/common/81 extract all/one.c new file mode 100644 index 0000000..152a145 --- /dev/null +++ b/test cases/common/81 extract all/one.c @@ -0,0 +1,5 @@ +#include"extractor.h" + +int func1(void) { + return 1; +} diff --git a/test cases/common/81 extract all/prog.c b/test cases/common/81 extract all/prog.c new file mode 100644 index 0000000..de0cc7f --- /dev/null +++ b/test cases/common/81 extract all/prog.c @@ -0,0 +1,10 @@ +#include"extractor.h" +#include + +int main(void) { + if((1+2+3+4) != (func1() + func2() + func3() + func4())) { + printf("Arithmetic is fail.\n"); + return 1; + } + return 0; +} diff --git a/test cases/common/81 extract all/three.c b/test cases/common/81 extract all/three.c new file mode 100644 index 0000000..24604ed --- /dev/null +++ b/test cases/common/81 extract all/three.c @@ -0,0 +1,5 @@ +#include"extractor.h" + +int func3(void) { + return 3; +} diff --git a/test cases/common/81 extract all/two.c b/test cases/common/81 extract all/two.c new file mode 100644 index 0000000..800cd2d --- /dev/null +++ b/test cases/common/81 extract all/two.c @@ -0,0 +1,5 @@ +#include"extractor.h" + +int func2(void) { + return 2; +} diff --git a/test cases/common/82 add language/meson.build b/test cases/common/82 add language/meson.build new file mode 100644 index 0000000..e99f33a --- /dev/null +++ b/test cases/common/82 add language/meson.build @@ -0,0 +1,10 @@ +project('add language', 'c') + +test('C', executable('cprog', 'prog.c')) + +assert(add_languages('cpp', native: false), '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')) + +add_languages('c', native: false) diff --git a/test cases/common/82 add language/prog.c b/test cases/common/82 add language/prog.c new file mode 100644 index 0000000..9d747f0 --- /dev/null +++ b/test cases/common/82 add language/prog.c @@ -0,0 +1,6 @@ +#include + +int main(void) { + printf("I am plain C.\n"); + return 0; +} diff --git a/test cases/common/82 add language/prog.cc b/test cases/common/82 add language/prog.cc new file mode 100644 index 0000000..03647dd --- /dev/null +++ b/test cases/common/82 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/82 extract all/extractor.h b/test cases/common/82 extract all/extractor.h deleted file mode 100644 index cfb7ff6..0000000 --- a/test cases/common/82 extract all/extractor.h +++ /dev/null @@ -1,6 +0,0 @@ -#pragma once - -int func1(void); -int func2(void); -int func3(void); -int func4(void); diff --git a/test cases/common/82 extract all/four.c b/test cases/common/82 extract all/four.c deleted file mode 100644 index f67a85e..0000000 --- a/test cases/common/82 extract all/four.c +++ /dev/null @@ -1,5 +0,0 @@ -#include"extractor.h" - -int func4(void) { - return 4; -} diff --git a/test cases/common/82 extract all/meson.build b/test cases/common/82 extract all/meson.build deleted file mode 100644 index 4f08a4f..0000000 --- a/test cases/common/82 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/82 extract all/one.c b/test cases/common/82 extract all/one.c deleted file mode 100644 index 152a145..0000000 --- a/test cases/common/82 extract all/one.c +++ /dev/null @@ -1,5 +0,0 @@ -#include"extractor.h" - -int func1(void) { - return 1; -} diff --git a/test cases/common/82 extract all/prog.c b/test cases/common/82 extract all/prog.c deleted file mode 100644 index de0cc7f..0000000 --- a/test cases/common/82 extract all/prog.c +++ /dev/null @@ -1,10 +0,0 @@ -#include"extractor.h" -#include - -int main(void) { - if((1+2+3+4) != (func1() + func2() + func3() + func4())) { - printf("Arithmetic is fail.\n"); - return 1; - } - return 0; -} diff --git a/test cases/common/82 extract all/three.c b/test cases/common/82 extract all/three.c deleted file mode 100644 index 24604ed..0000000 --- a/test cases/common/82 extract all/three.c +++ /dev/null @@ -1,5 +0,0 @@ -#include"extractor.h" - -int func3(void) { - return 3; -} diff --git a/test cases/common/82 extract all/two.c b/test cases/common/82 extract all/two.c deleted file mode 100644 index 800cd2d..0000000 --- a/test cases/common/82 extract all/two.c +++ /dev/null @@ -1,5 +0,0 @@ -#include"extractor.h" - -int func2(void) { - return 2; -} diff --git a/test cases/common/83 add language/meson.build b/test cases/common/83 add language/meson.build deleted file mode 100644 index e99f33a..0000000 --- a/test cases/common/83 add language/meson.build +++ /dev/null @@ -1,10 +0,0 @@ -project('add language', 'c') - -test('C', executable('cprog', 'prog.c')) - -assert(add_languages('cpp', native: false), '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')) - -add_languages('c', native: false) diff --git a/test cases/common/83 add language/prog.c b/test cases/common/83 add language/prog.c deleted file mode 100644 index 9d747f0..0000000 --- a/test cases/common/83 add language/prog.c +++ /dev/null @@ -1,6 +0,0 @@ -#include - -int main(void) { - printf("I am plain C.\n"); - return 0; -} diff --git a/test cases/common/83 add language/prog.cc b/test cases/common/83 add language/prog.cc deleted file mode 100644 index 03647dd..0000000 --- a/test cases/common/83 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/83 identical target name in subproject/bar.c b/test cases/common/83 identical target name in subproject/bar.c new file mode 100644 index 0000000..f1bd822 --- /dev/null +++ b/test cases/common/83 identical target name in subproject/bar.c @@ -0,0 +1,6 @@ +#include + +int main(void) { + printf("I'm a main project bar.\n"); + return 0; +} diff --git a/test cases/common/83 identical target name in subproject/meson.build b/test cases/common/83 identical target name in subproject/meson.build new file mode 100644 index 0000000..64b4363 --- /dev/null +++ b/test cases/common/83 identical target name in subproject/meson.build @@ -0,0 +1,9 @@ +project('toplevel bar', 'c') + +subproject('foo') + +true_cmd = find_program('true.py') + +executable('bar', 'bar.c') +run_target('nop', command : [true_cmd]) +custom_target('cus', output: ['cus.c'], command : [true_cmd]) diff --git a/test cases/common/83 identical target name in subproject/subprojects/foo/bar.c b/test cases/common/83 identical target name in subproject/subprojects/foo/bar.c new file mode 100644 index 0000000..5e7006b --- /dev/null +++ b/test cases/common/83 identical target name in subproject/subprojects/foo/bar.c @@ -0,0 +1,6 @@ +#include + +int main(void) { + printf("I'm a subproject bar.\n"); + return 0; +} diff --git a/test cases/common/83 identical target name in subproject/subprojects/foo/meson.build b/test cases/common/83 identical target name in subproject/subprojects/foo/meson.build new file mode 100644 index 0000000..94b235c --- /dev/null +++ b/test cases/common/83 identical target name in subproject/subprojects/foo/meson.build @@ -0,0 +1,7 @@ +project('subfoo', 'c') + +true_cmd = find_program('true.py') + +executable('bar', 'bar.c') +run_target('nop', command : [true_cmd]) +custom_target('cus', output: ['cus.c'], command : [true_cmd]) diff --git a/test cases/common/83 identical target name in subproject/subprojects/foo/true.py b/test cases/common/83 identical target name in subproject/subprojects/foo/true.py new file mode 100644 index 0000000..ddcac9e --- /dev/null +++ b/test cases/common/83 identical target name in subproject/subprojects/foo/true.py @@ -0,0 +1,4 @@ +#!/usr/bin/env python3 + +if __name__ == '__main__': + pass diff --git a/test cases/common/83 identical target name in subproject/true.py b/test cases/common/83 identical target name in subproject/true.py new file mode 100644 index 0000000..ddcac9e --- /dev/null +++ b/test cases/common/83 identical target name in subproject/true.py @@ -0,0 +1,4 @@ +#!/usr/bin/env python3 + +if __name__ == '__main__': + pass diff --git a/test cases/common/84 identical target name in subproject/bar.c b/test cases/common/84 identical target name in subproject/bar.c deleted file mode 100644 index f1bd822..0000000 --- a/test cases/common/84 identical target name in subproject/bar.c +++ /dev/null @@ -1,6 +0,0 @@ -#include - -int main(void) { - printf("I'm a main project bar.\n"); - return 0; -} diff --git a/test cases/common/84 identical target name in subproject/meson.build b/test cases/common/84 identical target name in subproject/meson.build deleted file mode 100644 index 64b4363..0000000 --- a/test cases/common/84 identical target name in subproject/meson.build +++ /dev/null @@ -1,9 +0,0 @@ -project('toplevel bar', 'c') - -subproject('foo') - -true_cmd = find_program('true.py') - -executable('bar', 'bar.c') -run_target('nop', command : [true_cmd]) -custom_target('cus', output: ['cus.c'], command : [true_cmd]) diff --git a/test cases/common/84 identical target name in subproject/subprojects/foo/bar.c b/test cases/common/84 identical target name in subproject/subprojects/foo/bar.c deleted file mode 100644 index 5e7006b..0000000 --- a/test cases/common/84 identical target name in subproject/subprojects/foo/bar.c +++ /dev/null @@ -1,6 +0,0 @@ -#include - -int main(void) { - printf("I'm a subproject bar.\n"); - return 0; -} diff --git a/test cases/common/84 identical target name in subproject/subprojects/foo/meson.build b/test cases/common/84 identical target name in subproject/subprojects/foo/meson.build deleted file mode 100644 index 94b235c..0000000 --- a/test cases/common/84 identical target name in subproject/subprojects/foo/meson.build +++ /dev/null @@ -1,7 +0,0 @@ -project('subfoo', 'c') - -true_cmd = find_program('true.py') - -executable('bar', 'bar.c') -run_target('nop', command : [true_cmd]) -custom_target('cus', output: ['cus.c'], command : [true_cmd]) diff --git a/test cases/common/84 identical target name in subproject/subprojects/foo/true.py b/test cases/common/84 identical target name in subproject/subprojects/foo/true.py deleted file mode 100644 index ddcac9e..0000000 --- a/test cases/common/84 identical target name in subproject/subprojects/foo/true.py +++ /dev/null @@ -1,4 +0,0 @@ -#!/usr/bin/env python3 - -if __name__ == '__main__': - pass diff --git a/test cases/common/84 identical target name in subproject/true.py b/test cases/common/84 identical target name in subproject/true.py deleted file mode 100644 index ddcac9e..0000000 --- a/test cases/common/84 identical target name in subproject/true.py +++ /dev/null @@ -1,4 +0,0 @@ -#!/usr/bin/env python3 - -if __name__ == '__main__': - pass diff --git a/test cases/common/84 plusassign/meson.build b/test cases/common/84 plusassign/meson.build new file mode 100644 index 0000000..ac477e7 --- /dev/null +++ b/test cases/common/84 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/85 plusassign/meson.build b/test cases/common/85 plusassign/meson.build deleted file mode 100644 index ac477e7..0000000 --- a/test cases/common/85 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/85 skip subdir/meson.build b/test cases/common/85 skip subdir/meson.build new file mode 100644 index 0000000..30ede0e --- /dev/null +++ b/test cases/common/85 skip subdir/meson.build @@ -0,0 +1,3 @@ +project('foo', 'c') + +subdir('subdir1/subdir2') diff --git a/test cases/common/85 skip subdir/subdir1/meson.build b/test cases/common/85 skip subdir/subdir1/meson.build new file mode 100644 index 0000000..51cb003 --- /dev/null +++ b/test cases/common/85 skip subdir/subdir1/meson.build @@ -0,0 +1 @@ +error('This should not be called.') diff --git a/test cases/common/85 skip subdir/subdir1/subdir2/meson.build b/test cases/common/85 skip subdir/subdir1/subdir2/meson.build new file mode 100644 index 0000000..e37cad6 --- /dev/null +++ b/test cases/common/85 skip subdir/subdir1/subdir2/meson.build @@ -0,0 +1 @@ +message('I\'m in subdir subdir.') diff --git a/test cases/common/86 private include/meson.build b/test cases/common/86 private include/meson.build new file mode 100644 index 0000000..2485fbf --- /dev/null +++ b/test cases/common/86 private include/meson.build @@ -0,0 +1,4 @@ +project('access private', 'c') + +subdir('stlib') +subdir('user') diff --git a/test cases/common/86 private include/stlib/compiler.py b/test cases/common/86 private include/stlib/compiler.py new file mode 100755 index 0000000..c8597dd --- /dev/null +++ b/test cases/common/86 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(void); +''' + +c_templ = '''#include"%s.h" + +unsigned int %s(void) { + 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/86 private include/stlib/foo1.def b/test cases/common/86 private include/stlib/foo1.def new file mode 100644 index 0000000..e69de29 diff --git a/test cases/common/86 private include/stlib/foo2.def b/test cases/common/86 private include/stlib/foo2.def new file mode 100644 index 0000000..e69de29 diff --git a/test cases/common/86 private include/stlib/meson.build b/test cases/common/86 private include/stlib/meson.build new file mode 100644 index 0000000..8d70650 --- /dev/null +++ b/test cases/common/86 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/86 private include/user/libuser.c b/test cases/common/86 private include/user/libuser.c new file mode 100644 index 0000000..c172486 --- /dev/null +++ b/test cases/common/86 private include/user/libuser.c @@ -0,0 +1,6 @@ +#include"foo1.h" +#include"foo2.h" + +int main(void) { + return foo1() + foo2(); +} diff --git a/test cases/common/86 private include/user/meson.build b/test cases/common/86 private include/user/meson.build new file mode 100644 index 0000000..ab88b1d --- /dev/null +++ b/test cases/common/86 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/86 skip subdir/meson.build b/test cases/common/86 skip subdir/meson.build deleted file mode 100644 index 30ede0e..0000000 --- a/test cases/common/86 skip subdir/meson.build +++ /dev/null @@ -1,3 +0,0 @@ -project('foo', 'c') - -subdir('subdir1/subdir2') diff --git a/test cases/common/86 skip subdir/subdir1/meson.build b/test cases/common/86 skip subdir/subdir1/meson.build deleted file mode 100644 index 51cb003..0000000 --- a/test cases/common/86 skip subdir/subdir1/meson.build +++ /dev/null @@ -1 +0,0 @@ -error('This should not be called.') diff --git a/test cases/common/86 skip subdir/subdir1/subdir2/meson.build b/test cases/common/86 skip subdir/subdir1/subdir2/meson.build deleted file mode 100644 index e37cad6..0000000 --- a/test cases/common/86 skip subdir/subdir1/subdir2/meson.build +++ /dev/null @@ -1 +0,0 @@ -message('I\'m in subdir subdir.') diff --git a/test cases/common/87 default options/meson.build b/test cases/common/87 default options/meson.build new file mode 100644 index 0000000..51b5cda --- /dev/null +++ b/test cases/common/87 default options/meson.build @@ -0,0 +1,33 @@ +project('default options', 'cpp', 'c', default_options : [ + 'prefix=/absoluteprefix', + 'buildtype=debugoptimized', + 'cpp_std=c++11', + 'cpp_eh=none', + 'warning_level=3', + 'sub1:test_option=false', + ]) + +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 + +subproject('sub1') diff --git a/test cases/common/87 default options/subprojects/sub1/meson.build b/test cases/common/87 default options/subprojects/sub1/meson.build new file mode 100644 index 0000000..de0dc21 --- /dev/null +++ b/test cases/common/87 default options/subprojects/sub1/meson.build @@ -0,0 +1,3 @@ +project('sub1') + +assert(get_option('test_option') == false) diff --git a/test cases/common/87 default options/subprojects/sub1/meson_options.txt b/test cases/common/87 default options/subprojects/sub1/meson_options.txt new file mode 100644 index 0000000..fc96f5e --- /dev/null +++ b/test cases/common/87 default options/subprojects/sub1/meson_options.txt @@ -0,0 +1 @@ +option('test_option', type : 'boolean', value : true, description : 'Test option. Superproject overrides default to "false"') diff --git a/test cases/common/87 private include/meson.build b/test cases/common/87 private include/meson.build deleted file mode 100644 index 2485fbf..0000000 --- a/test cases/common/87 private include/meson.build +++ /dev/null @@ -1,4 +0,0 @@ -project('access private', 'c') - -subdir('stlib') -subdir('user') diff --git a/test cases/common/87 private include/stlib/compiler.py b/test cases/common/87 private include/stlib/compiler.py deleted file mode 100755 index c8597dd..0000000 --- a/test cases/common/87 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(void); -''' - -c_templ = '''#include"%s.h" - -unsigned int %s(void) { - 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/87 private include/stlib/foo1.def b/test cases/common/87 private include/stlib/foo1.def deleted file mode 100644 index e69de29..0000000 diff --git a/test cases/common/87 private include/stlib/foo2.def b/test cases/common/87 private include/stlib/foo2.def deleted file mode 100644 index e69de29..0000000 diff --git a/test cases/common/87 private include/stlib/meson.build b/test cases/common/87 private include/stlib/meson.build deleted file mode 100644 index 8d70650..0000000 --- a/test cases/common/87 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/87 private include/user/libuser.c b/test cases/common/87 private include/user/libuser.c deleted file mode 100644 index c172486..0000000 --- a/test cases/common/87 private include/user/libuser.c +++ /dev/null @@ -1,6 +0,0 @@ -#include"foo1.h" -#include"foo2.h" - -int main(void) { - return foo1() + foo2(); -} diff --git a/test cases/common/87 private include/user/meson.build b/test cases/common/87 private include/user/meson.build deleted file mode 100644 index ab88b1d..0000000 --- a/test cases/common/87 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/88 default options/meson.build b/test cases/common/88 default options/meson.build deleted file mode 100644 index 51b5cda..0000000 --- a/test cases/common/88 default options/meson.build +++ /dev/null @@ -1,33 +0,0 @@ -project('default options', 'cpp', 'c', default_options : [ - 'prefix=/absoluteprefix', - 'buildtype=debugoptimized', - 'cpp_std=c++11', - 'cpp_eh=none', - 'warning_level=3', - 'sub1:test_option=false', - ]) - -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 - -subproject('sub1') diff --git a/test cases/common/88 default options/subprojects/sub1/meson.build b/test cases/common/88 default options/subprojects/sub1/meson.build deleted file mode 100644 index de0dc21..0000000 --- a/test cases/common/88 default options/subprojects/sub1/meson.build +++ /dev/null @@ -1,3 +0,0 @@ -project('sub1') - -assert(get_option('test_option') == false) diff --git a/test cases/common/88 default options/subprojects/sub1/meson_options.txt b/test cases/common/88 default options/subprojects/sub1/meson_options.txt deleted file mode 100644 index fc96f5e..0000000 --- a/test cases/common/88 default options/subprojects/sub1/meson_options.txt +++ /dev/null @@ -1 +0,0 @@ -option('test_option', type : 'boolean', value : true, description : 'Test option. Superproject overrides default to "false"') diff --git a/test cases/common/88 dep fallback/gensrc.py b/test cases/common/88 dep fallback/gensrc.py new file mode 100644 index 0000000..ff42ac3 --- /dev/null +++ b/test cases/common/88 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/88 dep fallback/meson.build b/test cases/common/88 dep fallback/meson.build new file mode 100644 index 0000000..a96520e --- /dev/null +++ b/test cases/common/88 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/88 dep fallback/subprojects/boblib/bob.c b/test cases/common/88 dep fallback/subprojects/boblib/bob.c new file mode 100644 index 0000000..52cf479 --- /dev/null +++ b/test cases/common/88 dep fallback/subprojects/boblib/bob.c @@ -0,0 +1,8 @@ +#include"bob.h" + +#ifdef _MSC_VER +__declspec(dllexport) +#endif +const char* get_bob(void) { + return "bob"; +} diff --git a/test cases/common/88 dep fallback/subprojects/boblib/bob.h b/test cases/common/88 dep fallback/subprojects/boblib/bob.h new file mode 100644 index 0000000..8dd4b33 --- /dev/null +++ b/test cases/common/88 dep fallback/subprojects/boblib/bob.h @@ -0,0 +1,6 @@ +#pragma once + +#ifdef _MSC_VER +__declspec(dllimport) +#endif +const char* get_bob(void); diff --git a/test cases/common/88 dep fallback/subprojects/boblib/genbob.py b/test cases/common/88 dep fallback/subprojects/boblib/genbob.py new file mode 100644 index 0000000..34af779 --- /dev/null +++ b/test cases/common/88 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/88 dep fallback/subprojects/boblib/meson.build b/test cases/common/88 dep fallback/subprojects/boblib/meson.build new file mode 100644 index 0000000..bb250e4 --- /dev/null +++ b/test cases/common/88 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/88 dep fallback/subprojects/dummylib/meson.build b/test cases/common/88 dep fallback/subprojects/dummylib/meson.build new file mode 100644 index 0000000..3ad33e7 --- /dev/null +++ b/test cases/common/88 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/88 dep fallback/tester.c b/test cases/common/88 dep fallback/tester.c new file mode 100644 index 0000000..a46f3f6 --- /dev/null +++ b/test cases/common/88 dep fallback/tester.c @@ -0,0 +1,14 @@ +#include"bob.h" +#include"genbob.h" +#include +#include + +int main(void) { + 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/89 default library/ef.cpp b/test cases/common/89 default library/ef.cpp new file mode 100644 index 0000000..34784f8 --- /dev/null +++ b/test cases/common/89 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/89 default library/ef.h b/test cases/common/89 default library/ef.h new file mode 100644 index 0000000..21704b5 --- /dev/null +++ b/test cases/common/89 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/89 default library/eftest.cpp b/test cases/common/89 default library/eftest.cpp new file mode 100644 index 0000000..4d4412d --- /dev/null +++ b/test cases/common/89 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/89 default library/meson.build b/test cases/common/89 default library/meson.build new file mode 100644 index 0000000..508f25f --- /dev/null +++ b/test cases/common/89 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/89 dep fallback/gensrc.py b/test cases/common/89 dep fallback/gensrc.py deleted file mode 100644 index ff42ac3..0000000 --- a/test cases/common/89 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/89 dep fallback/meson.build b/test cases/common/89 dep fallback/meson.build deleted file mode 100644 index a96520e..0000000 --- a/test cases/common/89 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/89 dep fallback/subprojects/boblib/bob.c b/test cases/common/89 dep fallback/subprojects/boblib/bob.c deleted file mode 100644 index 52cf479..0000000 --- a/test cases/common/89 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(void) { - return "bob"; -} diff --git a/test cases/common/89 dep fallback/subprojects/boblib/bob.h b/test cases/common/89 dep fallback/subprojects/boblib/bob.h deleted file mode 100644 index 8dd4b33..0000000 --- a/test cases/common/89 dep fallback/subprojects/boblib/bob.h +++ /dev/null @@ -1,6 +0,0 @@ -#pragma once - -#ifdef _MSC_VER -__declspec(dllimport) -#endif -const char* get_bob(void); diff --git a/test cases/common/89 dep fallback/subprojects/boblib/genbob.py b/test cases/common/89 dep fallback/subprojects/boblib/genbob.py deleted file mode 100644 index 34af779..0000000 --- a/test cases/common/89 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/89 dep fallback/subprojects/boblib/meson.build b/test cases/common/89 dep fallback/subprojects/boblib/meson.build deleted file mode 100644 index bb250e4..0000000 --- a/test cases/common/89 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/89 dep fallback/subprojects/dummylib/meson.build b/test cases/common/89 dep fallback/subprojects/dummylib/meson.build deleted file mode 100644 index 3ad33e7..0000000 --- a/test cases/common/89 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/89 dep fallback/tester.c b/test cases/common/89 dep fallback/tester.c deleted file mode 100644 index a46f3f6..0000000 --- a/test cases/common/89 dep fallback/tester.c +++ /dev/null @@ -1,14 +0,0 @@ -#include"bob.h" -#include"genbob.h" -#include -#include - -int main(void) { - 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/90 default library/ef.cpp b/test cases/common/90 default library/ef.cpp deleted file mode 100644 index 34784f8..0000000 --- a/test cases/common/90 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/90 default library/ef.h b/test cases/common/90 default library/ef.h deleted file mode 100644 index 21704b5..0000000 --- a/test cases/common/90 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/90 default library/eftest.cpp b/test cases/common/90 default library/eftest.cpp deleted file mode 100644 index 4d4412d..0000000 --- a/test cases/common/90 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/90 default library/meson.build b/test cases/common/90 default library/meson.build deleted file mode 100644 index 508f25f..0000000 --- a/test cases/common/90 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/90 gen extra/meson.build b/test cases/common/90 gen extra/meson.build new file mode 100644 index 0000000..cbbdceb --- /dev/null +++ b/test cases/common/90 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/90 gen extra/name.dat b/test cases/common/90 gen extra/name.dat new file mode 100644 index 0000000..caf5b1c --- /dev/null +++ b/test cases/common/90 gen extra/name.dat @@ -0,0 +1 @@ +bob_mcbob diff --git a/test cases/common/90 gen extra/name.l b/test cases/common/90 gen extra/name.l new file mode 100644 index 0000000..c4ba277 --- /dev/null +++ b/test cases/common/90 gen extra/name.l @@ -0,0 +1,3 @@ +int main(void) { +return 0; +} diff --git a/test cases/common/90 gen extra/plain.c b/test cases/common/90 gen extra/plain.c new file mode 100644 index 0000000..c068a02 --- /dev/null +++ b/test cases/common/90 gen extra/plain.c @@ -0,0 +1,5 @@ +int bob_mcbob(void); + +int main(void) { + return bob_mcbob(); +} diff --git a/test cases/common/90 gen extra/srcgen.py b/test cases/common/90 gen extra/srcgen.py new file mode 100755 index 0000000..c64f540 --- /dev/null +++ b/test cases/common/90 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(void) { + 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/90 gen extra/srcgen2.py b/test cases/common/90 gen extra/srcgen2.py new file mode 100644 index 0000000..9cdf12d --- /dev/null +++ b/test cases/common/90 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/90 gen extra/srcgen3.py b/test cases/common/90 gen extra/srcgen3.py new file mode 100644 index 0000000..b737114 --- /dev/null +++ b/test cases/common/90 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/90 gen extra/upper.c b/test cases/common/90 gen extra/upper.c new file mode 100644 index 0000000..82c3252 --- /dev/null +++ b/test cases/common/90 gen extra/upper.c @@ -0,0 +1,5 @@ +int BOB_MCBOB(void); + +int main(void) { + return BOB_MCBOB(); +} diff --git a/test cases/common/91 benchmark/delayer.c b/test cases/common/91 benchmark/delayer.c new file mode 100644 index 0000000..b410c46 --- /dev/null +++ b/test cases/common/91 benchmark/delayer.c @@ -0,0 +1,20 @@ +/* Simple prog that sleeps for a random time. */ + +#include +#include +#if defined(_WIN32) +#include +#endif + +int main(void) { + 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/91 benchmark/meson.build b/test cases/common/91 benchmark/meson.build new file mode 100644 index 0000000..9d583d2 --- /dev/null +++ b/test cases/common/91 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/91 gen extra/meson.build b/test cases/common/91 gen extra/meson.build deleted file mode 100644 index cbbdceb..0000000 --- a/test cases/common/91 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/91 gen extra/name.dat b/test cases/common/91 gen extra/name.dat deleted file mode 100644 index caf5b1c..0000000 --- a/test cases/common/91 gen extra/name.dat +++ /dev/null @@ -1 +0,0 @@ -bob_mcbob diff --git a/test cases/common/91 gen extra/name.l b/test cases/common/91 gen extra/name.l deleted file mode 100644 index c4ba277..0000000 --- a/test cases/common/91 gen extra/name.l +++ /dev/null @@ -1,3 +0,0 @@ -int main(void) { -return 0; -} diff --git a/test cases/common/91 gen extra/plain.c b/test cases/common/91 gen extra/plain.c deleted file mode 100644 index c068a02..0000000 --- a/test cases/common/91 gen extra/plain.c +++ /dev/null @@ -1,5 +0,0 @@ -int bob_mcbob(void); - -int main(void) { - return bob_mcbob(); -} diff --git a/test cases/common/91 gen extra/srcgen.py b/test cases/common/91 gen extra/srcgen.py deleted file mode 100755 index c64f540..0000000 --- a/test cases/common/91 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(void) { - 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/91 gen extra/srcgen2.py b/test cases/common/91 gen extra/srcgen2.py deleted file mode 100644 index 9cdf12d..0000000 --- a/test cases/common/91 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/91 gen extra/srcgen3.py b/test cases/common/91 gen extra/srcgen3.py deleted file mode 100644 index b737114..0000000 --- a/test cases/common/91 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/91 gen extra/upper.c b/test cases/common/91 gen extra/upper.c deleted file mode 100644 index 82c3252..0000000 --- a/test cases/common/91 gen extra/upper.c +++ /dev/null @@ -1,5 +0,0 @@ -int BOB_MCBOB(void); - -int main(void) { - return BOB_MCBOB(); -} diff --git a/test cases/common/92 benchmark/delayer.c b/test cases/common/92 benchmark/delayer.c deleted file mode 100644 index b410c46..0000000 --- a/test cases/common/92 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(void) { - 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/92 benchmark/meson.build b/test cases/common/92 benchmark/meson.build deleted file mode 100644 index 9d583d2..0000000 --- a/test cases/common/92 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/92 test workdir/meson.build b/test cases/common/92 test workdir/meson.build new file mode 100644 index 0000000..a8290f7 --- /dev/null +++ b/test cases/common/92 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/92 test workdir/opener.c b/test cases/common/92 test workdir/opener.c new file mode 100644 index 0000000..c946e18 --- /dev/null +++ b/test cases/common/92 test workdir/opener.c @@ -0,0 +1,12 @@ +// This test only succeeds if run in the source root dir. + +#include + +int main(void) { + FILE *f = fopen("opener.c", "r"); + if(f) { + fclose(f); + return 0; + } + return 1; +} diff --git a/test cases/common/92 test workdir/subdir/checker.py b/test cases/common/92 test workdir/subdir/checker.py new file mode 100755 index 0000000..66e287d --- /dev/null +++ b/test cases/common/92 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/92 test workdir/subdir/meson.build b/test cases/common/92 test workdir/subdir/meson.build new file mode 100644 index 0000000..687a1cf --- /dev/null +++ b/test cases/common/92 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/93 suites/exe1.c b/test cases/common/93 suites/exe1.c new file mode 100644 index 0000000..6e32362 --- /dev/null +++ b/test cases/common/93 suites/exe1.c @@ -0,0 +1,6 @@ +#include + +int main(void) { + printf("I am test exe1.\n"); + return 0; +} diff --git a/test cases/common/93 suites/exe2.c b/test cases/common/93 suites/exe2.c new file mode 100644 index 0000000..21a9dd6 --- /dev/null +++ b/test cases/common/93 suites/exe2.c @@ -0,0 +1,6 @@ +#include + +int main(void) { + printf("I am test exe2.\n"); + return 0; +} diff --git a/test cases/common/93 suites/meson.build b/test cases/common/93 suites/meson.build new file mode 100644 index 0000000..057e059 --- /dev/null +++ b/test cases/common/93 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/93 suites/subprojects/sub/meson.build b/test cases/common/93 suites/subprojects/sub/meson.build new file mode 100644 index 0000000..697d95f --- /dev/null +++ b/test cases/common/93 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/93 suites/subprojects/sub/sub1.c b/test cases/common/93 suites/subprojects/sub/sub1.c new file mode 100644 index 0000000..e067624 --- /dev/null +++ b/test cases/common/93 suites/subprojects/sub/sub1.c @@ -0,0 +1,6 @@ +#include + +int main(void) { + printf("I am test sub1.\n"); + return 0; +} diff --git a/test cases/common/93 suites/subprojects/sub/sub2.c b/test cases/common/93 suites/subprojects/sub/sub2.c new file mode 100644 index 0000000..0b457dc --- /dev/null +++ b/test cases/common/93 suites/subprojects/sub/sub2.c @@ -0,0 +1,6 @@ +#include + +int main(void) { + printf("I am test sub2.\n"); + return 0; +} diff --git a/test cases/common/93 test workdir/meson.build b/test cases/common/93 test workdir/meson.build deleted file mode 100644 index a8290f7..0000000 --- a/test cases/common/93 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/93 test workdir/opener.c b/test cases/common/93 test workdir/opener.c deleted file mode 100644 index c946e18..0000000 --- a/test cases/common/93 test workdir/opener.c +++ /dev/null @@ -1,12 +0,0 @@ -// This test only succeeds if run in the source root dir. - -#include - -int main(void) { - FILE *f = fopen("opener.c", "r"); - if(f) { - fclose(f); - return 0; - } - return 1; -} diff --git a/test cases/common/93 test workdir/subdir/checker.py b/test cases/common/93 test workdir/subdir/checker.py deleted file mode 100755 index 66e287d..0000000 --- a/test cases/common/93 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/93 test workdir/subdir/meson.build b/test cases/common/93 test workdir/subdir/meson.build deleted file mode 100644 index 687a1cf..0000000 --- a/test cases/common/93 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/94 suites/exe1.c b/test cases/common/94 suites/exe1.c deleted file mode 100644 index 6e32362..0000000 --- a/test cases/common/94 suites/exe1.c +++ /dev/null @@ -1,6 +0,0 @@ -#include - -int main(void) { - printf("I am test exe1.\n"); - return 0; -} diff --git a/test cases/common/94 suites/exe2.c b/test cases/common/94 suites/exe2.c deleted file mode 100644 index 21a9dd6..0000000 --- a/test cases/common/94 suites/exe2.c +++ /dev/null @@ -1,6 +0,0 @@ -#include - -int main(void) { - printf("I am test exe2.\n"); - return 0; -} diff --git a/test cases/common/94 suites/meson.build b/test cases/common/94 suites/meson.build deleted file mode 100644 index 057e059..0000000 --- a/test cases/common/94 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/94 suites/subprojects/sub/meson.build b/test cases/common/94 suites/subprojects/sub/meson.build deleted file mode 100644 index 697d95f..0000000 --- a/test cases/common/94 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/94 suites/subprojects/sub/sub1.c b/test cases/common/94 suites/subprojects/sub/sub1.c deleted file mode 100644 index e067624..0000000 --- a/test cases/common/94 suites/subprojects/sub/sub1.c +++ /dev/null @@ -1,6 +0,0 @@ -#include - -int main(void) { - printf("I am test sub1.\n"); - return 0; -} diff --git a/test cases/common/94 suites/subprojects/sub/sub2.c b/test cases/common/94 suites/subprojects/sub/sub2.c deleted file mode 100644 index 0b457dc..0000000 --- a/test cases/common/94 suites/subprojects/sub/sub2.c +++ /dev/null @@ -1,6 +0,0 @@ -#include - -int main(void) { - printf("I am test sub2.\n"); - return 0; -} diff --git a/test cases/common/94 threads/meson.build b/test cases/common/94 threads/meson.build new file mode 100644 index 0000000..1fbb15a --- /dev/null +++ b/test cases/common/94 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/94 threads/threadprog.c b/test cases/common/94 threads/threadprog.c new file mode 100644 index 0000000..7bfb7c4 --- /dev/null +++ b/test cases/common/94 threads/threadprog.c @@ -0,0 +1,40 @@ +#if defined _WIN32 + +#include +#include + +DWORD WINAPI thread_func(void) { + printf("Printing from a thread.\n"); + return 0; +} + +int main(void) { + 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) { + printf("Printing from a thread.\n"); + return NULL; +} + +int main(void) { + 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/94 threads/threadprog.cpp b/test cases/common/94 threads/threadprog.cpp new file mode 100644 index 0000000..3c69dc3 --- /dev/null +++ b/test cases/common/94 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(void) { + 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(void) { + printf("Printing from a thread.\n"); +} + +int main(void) { + printf("Starting thread.\n"); + std::thread th(main_func); + th.join(); + printf("Stopped thread.\n"); + return 0; +} + +#endif diff --git a/test cases/common/95 manygen/depuser.c b/test cases/common/95 manygen/depuser.c new file mode 100644 index 0000000..1ab2487 --- /dev/null +++ b/test cases/common/95 manygen/depuser.c @@ -0,0 +1,8 @@ +#include"gen_func.h" + +int main(void) { + 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/95 manygen/meson.build b/test cases/common/95 manygen/meson.build new file mode 100644 index 0000000..e70a55a --- /dev/null +++ b/test cases/common/95 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/95 manygen/subdir/funcinfo.def b/test cases/common/95 manygen/subdir/funcinfo.def new file mode 100644 index 0000000..b074186 --- /dev/null +++ b/test cases/common/95 manygen/subdir/funcinfo.def @@ -0,0 +1 @@ +gen_func diff --git a/test cases/common/95 manygen/subdir/manygen.py b/test cases/common/95 manygen/subdir/manygen.py new file mode 100755 index 0000000..931fb61 --- /dev/null +++ b/test cases/common/95 manygen/subdir/manygen.py @@ -0,0 +1,82 @@ +#!/usr/bin/env python3 + + +# 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"{}.h" +int {}_in_src(void) {{ + return 0; +}} +'''.format(funcname, funcname)) + +with open(outh, 'w') as f: + f.write('''#pragma once +int {}_in_lib(void); +int {}_in_obj(void); +int {}_in_src(void); +'''.format(funcname, funcname, funcname)) + +with open(tmpc, 'w') as f: + f.write('''int %s_in_obj(void) { + 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/95 manygen/subdir/meson.build b/test cases/common/95 manygen/subdir/meson.build new file mode 100644 index 0000000..56f60e6 --- /dev/null +++ b/test cases/common/95 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/95 threads/meson.build b/test cases/common/95 threads/meson.build deleted file mode 100644 index 1fbb15a..0000000 --- a/test cases/common/95 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/95 threads/threadprog.c b/test cases/common/95 threads/threadprog.c deleted file mode 100644 index 7bfb7c4..0000000 --- a/test cases/common/95 threads/threadprog.c +++ /dev/null @@ -1,40 +0,0 @@ -#if defined _WIN32 - -#include -#include - -DWORD WINAPI thread_func(void) { - printf("Printing from a thread.\n"); - return 0; -} - -int main(void) { - 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) { - printf("Printing from a thread.\n"); - return NULL; -} - -int main(void) { - 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/95 threads/threadprog.cpp b/test cases/common/95 threads/threadprog.cpp deleted file mode 100644 index 3c69dc3..0000000 --- a/test cases/common/95 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(void) { - 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(void) { - printf("Printing from a thread.\n"); -} - -int main(void) { - printf("Starting thread.\n"); - std::thread th(main_func); - th.join(); - printf("Stopped thread.\n"); - return 0; -} - -#endif diff --git a/test cases/common/96 manygen/depuser.c b/test cases/common/96 manygen/depuser.c deleted file mode 100644 index 1ab2487..0000000 --- a/test cases/common/96 manygen/depuser.c +++ /dev/null @@ -1,8 +0,0 @@ -#include"gen_func.h" - -int main(void) { - 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/96 manygen/meson.build b/test cases/common/96 manygen/meson.build deleted file mode 100644 index e70a55a..0000000 --- a/test cases/common/96 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/96 manygen/subdir/funcinfo.def b/test cases/common/96 manygen/subdir/funcinfo.def deleted file mode 100644 index b074186..0000000 --- a/test cases/common/96 manygen/subdir/funcinfo.def +++ /dev/null @@ -1 +0,0 @@ -gen_func diff --git a/test cases/common/96 manygen/subdir/manygen.py b/test cases/common/96 manygen/subdir/manygen.py deleted file mode 100755 index 931fb61..0000000 --- a/test cases/common/96 manygen/subdir/manygen.py +++ /dev/null @@ -1,82 +0,0 @@ -#!/usr/bin/env python3 - - -# 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"{}.h" -int {}_in_src(void) {{ - return 0; -}} -'''.format(funcname, funcname)) - -with open(outh, 'w') as f: - f.write('''#pragma once -int {}_in_lib(void); -int {}_in_obj(void); -int {}_in_src(void); -'''.format(funcname, funcname, funcname)) - -with open(tmpc, 'w') as f: - f.write('''int %s_in_obj(void) { - 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/96 manygen/subdir/meson.build b/test cases/common/96 manygen/subdir/meson.build deleted file mode 100644 index 56f60e6..0000000 --- a/test cases/common/96 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/96 stringdef/meson.build b/test cases/common/96 stringdef/meson.build new file mode 100644 index 0000000..3f9170e --- /dev/null +++ b/test cases/common/96 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/96 stringdef/stringdef.c b/test cases/common/96 stringdef/stringdef.c new file mode 100644 index 0000000..17e29fd --- /dev/null +++ b/test cases/common/96 stringdef/stringdef.c @@ -0,0 +1,10 @@ +#include +#include + +int main(void) { + if(strcmp(FOO, "bar")) { + printf("FOO is misquoted: %s\n", FOO); + return 1; + } + return 0; +} diff --git a/test cases/common/97 find program path/meson.build b/test cases/common/97 find program path/meson.build new file mode 100644 index 0000000..0a81249 --- /dev/null +++ b/test cases/common/97 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/97 find program path/program.py b/test cases/common/97 find program path/program.py new file mode 100755 index 0000000..2ebc564 --- /dev/null +++ b/test cases/common/97 find program path/program.py @@ -0,0 +1,3 @@ +#!/usr/bin/env python3 + +print("Found") diff --git a/test cases/common/97 stringdef/meson.build b/test cases/common/97 stringdef/meson.build deleted file mode 100644 index 3f9170e..0000000 --- a/test cases/common/97 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/97 stringdef/stringdef.c b/test cases/common/97 stringdef/stringdef.c deleted file mode 100644 index 17e29fd..0000000 --- a/test cases/common/97 stringdef/stringdef.c +++ /dev/null @@ -1,10 +0,0 @@ -#include -#include - -int main(void) { - if(strcmp(FOO, "bar")) { - printf("FOO is misquoted: %s\n", FOO); - return 1; - } - return 0; -} diff --git a/test cases/common/98 find program path/meson.build b/test cases/common/98 find program path/meson.build deleted file mode 100644 index 0a81249..0000000 --- a/test cases/common/98 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/98 find program path/program.py b/test cases/common/98 find program path/program.py deleted file mode 100755 index 2ebc564..0000000 --- a/test cases/common/98 find program path/program.py +++ /dev/null @@ -1,3 +0,0 @@ -#!/usr/bin/env python3 - -print("Found") diff --git a/test cases/common/98 subproject subdir/meson.build b/test cases/common/98 subproject subdir/meson.build new file mode 100644 index 0000000..36e48a7 --- /dev/null +++ b/test cases/common/98 subproject subdir/meson.build @@ -0,0 +1,67 @@ +project('proj', 'c') +subproject('sub') +libSub = dependency('sub', fallback: ['sub', 'libSub']) + +exe = executable('prog', 'prog.c', dependencies: libSub) +test('subproject subdir', exe) + +# Verify the subproject has placed dependency override. +dependency('sub-1.0') + +# Verify we can now take 'sub' dependency without fallback, but only version 1.0. +dependency('sub') +d = dependency('sub', version : '>=2.0', required : false) +assert(not d.found(), 'version should not match') + +# Verify that not-found does not get cached, we can still fallback afterward. +dependency('sub2', required : false) +d = dependency('sub2', fallback: ['sub', 'libSub']) +assert(d.found(), 'Should fallback even if a previous call returned not-found') + +# Verify we can get a fallback dependency without specifying the variable name, +# because the subproject overridden 'sub-novar'. +dependency('sub-novar', fallback : 'sub_novar') + +# Verify a subproject can force a dependency to be not-found +d = dependency('sub-notfound', fallback : 'sub_novar', required : false) +assert(not d.found(), 'Dependency should be not-found') + +# Verify that implicit fallback works because subprojects/sub_implicit directory exists +d = dependency('sub_implicit') +assert(d.found(), 'Should implicitly fallback') + +# Verify that implicit fallback works because sub_implicit.wrap has +# `dependency_names=sub_implicit_provide1` and the subproject overrides sub_implicit_provide1. +d = dependency('sub_implicit_provide1') +assert(d.found(), 'Should implicitly fallback') + +# Verify that implicit fallback works because sub_implicit.wrap has +# `sub_implicit_provide2=sub_implicit_provide2_dep` and does not override +# sub_implicit_provide2. +d = dependency('sub_implicit_provide2') +assert(d.found(), 'Should implicitly fallback') + +# sub_implicit.wrap provides glib-2.0 and we already configured that subproject, +# so we must not return the system dependency here. Using glib-2.0 here because +# some CI runners have it installed. +d = dependency('glib-2.0', required : false) +assert(d.found()) +assert(d.type_name() == 'internal') + +# sub_implicit.wrap provides gobject-2.0 and we already configured that subproject, +# so we must not return the system dependency here. But since the subproject did +# not override that dependency and its not required, not-found should be returned. +# Using gobject-2.0 here because some CI runners have it installed. +d = dependency('gobject-2.0', required : false) +assert(not d.found()) + +# Verify that implicit fallback works because subprojects/sub_implicit/subprojects/subsub +# directory exists. +d = dependency('subsub') +assert(d.found(), 'Should be able to fallback to sub-subproject') + +# Verify that implicit fallback works because +# subprojects/sub_implicit/subprojects/subsub/subprojects/subsubsub.wrap +# file exists. +d = dependency('subsubsub') +assert(d.found(), 'Should be able to fallback to sub-sub-subproject') diff --git a/test cases/common/98 subproject subdir/prog.c b/test cases/common/98 subproject subdir/prog.c new file mode 100644 index 0000000..9035ff1 --- /dev/null +++ b/test cases/common/98 subproject subdir/prog.c @@ -0,0 +1,5 @@ +#include + +int main(void) { + return sub(); +} diff --git a/test cases/common/98 subproject subdir/subprojects/sub/lib/meson.build b/test cases/common/98 subproject subdir/subprojects/sub/lib/meson.build new file mode 100644 index 0000000..53233ab --- /dev/null +++ b/test cases/common/98 subproject subdir/subprojects/sub/lib/meson.build @@ -0,0 +1,3 @@ +lib = static_library('sub', 'sub.c') +libSub = declare_dependency(include_directories: include_directories('.'), link_with: lib) +meson.override_dependency('sub-1.0', libSub) diff --git a/test cases/common/98 subproject subdir/subprojects/sub/lib/sub.c b/test cases/common/98 subproject subdir/subprojects/sub/lib/sub.c new file mode 100644 index 0000000..e748ac7 --- /dev/null +++ b/test cases/common/98 subproject subdir/subprojects/sub/lib/sub.c @@ -0,0 +1,5 @@ +#include "sub.h" + +int sub(void) { + return 0; +} diff --git a/test cases/common/98 subproject subdir/subprojects/sub/lib/sub.h b/test cases/common/98 subproject subdir/subprojects/sub/lib/sub.h new file mode 100644 index 0000000..2b59a3a --- /dev/null +++ b/test cases/common/98 subproject subdir/subprojects/sub/lib/sub.h @@ -0,0 +1,6 @@ +#ifndef SUB_H +#define SUB_H + +int sub(void); + +#endif diff --git a/test cases/common/98 subproject subdir/subprojects/sub/meson.build b/test cases/common/98 subproject subdir/subprojects/sub/meson.build new file mode 100644 index 0000000..d8c4dce --- /dev/null +++ b/test cases/common/98 subproject subdir/subprojects/sub/meson.build @@ -0,0 +1,2 @@ +project('sub', 'c', version : '1.0') +subdir('lib') diff --git a/test cases/common/98 subproject subdir/subprojects/sub_implicit.wrap b/test cases/common/98 subproject subdir/subprojects/sub_implicit.wrap new file mode 100644 index 0000000..a809c43 --- /dev/null +++ b/test cases/common/98 subproject subdir/subprojects/sub_implicit.wrap @@ -0,0 +1,6 @@ +[wrap-file] + +[provide] +glib-2.0 = glib_dep +dependency_names = sub_implicit_provide1, gobject-2.0 +sub_implicit_provide2 = sub_implicit_provide2_dep diff --git a/test cases/common/98 subproject subdir/subprojects/sub_implicit/meson.build b/test cases/common/98 subproject subdir/subprojects/sub_implicit/meson.build new file mode 100644 index 0000000..a1c46a1 --- /dev/null +++ b/test cases/common/98 subproject subdir/subprojects/sub_implicit/meson.build @@ -0,0 +1,11 @@ +project('sub_implicit', 'c', version : '1.0') + +dep = declare_dependency() +meson.override_dependency('sub_implicit', dep) +meson.override_dependency('sub_implicit_provide1', dep) + +# This one is not overridden but the wrap file tells the variable name to use. +sub_implicit_provide2_dep = dep + +# This one is not overridden but the wrap file tells the variable name to use. +glib_dep = dep diff --git a/test cases/common/98 subproject subdir/subprojects/sub_implicit/subprojects/subsub/foo.h b/test cases/common/98 subproject subdir/subprojects/sub_implicit/subprojects/subsub/foo.h new file mode 100644 index 0000000..a8ad3da --- /dev/null +++ b/test cases/common/98 subproject subdir/subprojects/sub_implicit/subprojects/subsub/foo.h @@ -0,0 +1 @@ +#define DUMMY 42 diff --git a/test cases/common/98 subproject subdir/subprojects/sub_implicit/subprojects/subsub/meson.build b/test cases/common/98 subproject subdir/subprojects/sub_implicit/subprojects/subsub/meson.build new file mode 100644 index 0000000..fdbb03f --- /dev/null +++ b/test cases/common/98 subproject subdir/subprojects/sub_implicit/subprojects/subsub/meson.build @@ -0,0 +1,7 @@ +project('subsub') + +meson.override_dependency('subsub', declare_dependency()) + +# Regression test: Installing a header from nested sub-subproject used to raise: +# ERROR: Sandbox violation: Tried to grab file foo.h from a nested subproject. +install_headers('foo.h') diff --git a/test cases/common/98 subproject subdir/subprojects/sub_implicit/subprojects/subsub/subprojects/packagefiles/subsubsub-1.0.zip b/test cases/common/98 subproject subdir/subprojects/sub_implicit/subprojects/subsub/subprojects/packagefiles/subsubsub-1.0.zip new file mode 100644 index 0000000..dfb7576 Binary files /dev/null and b/test cases/common/98 subproject subdir/subprojects/sub_implicit/subprojects/subsub/subprojects/packagefiles/subsubsub-1.0.zip differ diff --git a/test cases/common/98 subproject subdir/subprojects/sub_implicit/subprojects/subsub/subprojects/subsubsub.wrap b/test cases/common/98 subproject subdir/subprojects/sub_implicit/subprojects/subsub/subprojects/subsubsub.wrap new file mode 100644 index 0000000..6567ed0 --- /dev/null +++ b/test cases/common/98 subproject subdir/subprojects/sub_implicit/subprojects/subsub/subprojects/subsubsub.wrap @@ -0,0 +1,4 @@ +[wrap-file] +directory = subsubsub-1.0 +source_filename = subsubsub-1.0.zip +source_hash = c073a96b7251937e53216578f6f03d91b84816618a0f1ce3ecfb867beddf1498 diff --git a/test cases/common/98 subproject subdir/subprojects/sub_novar/meson.build b/test cases/common/98 subproject subdir/subprojects/sub_novar/meson.build new file mode 100644 index 0000000..6450a10 --- /dev/null +++ b/test cases/common/98 subproject subdir/subprojects/sub_novar/meson.build @@ -0,0 +1,4 @@ +project('sub-novar', 'c', version : '1.0') + +meson.override_dependency('sub-novar', declare_dependency()) +meson.override_dependency('sub-notfound', dependency('', required : false)) diff --git a/test cases/common/98 subproject subdir/test.json b/test cases/common/98 subproject subdir/test.json new file mode 100644 index 0000000..1921fe5 --- /dev/null +++ b/test cases/common/98 subproject subdir/test.json @@ -0,0 +1,5 @@ +{ + "installed": [ + { "type": "file", "file": "usr/include/foo.h" } + ] +} diff --git a/test cases/common/99 postconf/meson.build b/test cases/common/99 postconf/meson.build new file mode 100644 index 0000000..12b3c5b --- /dev/null +++ b/test cases/common/99 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/99 postconf/postconf.py b/test cases/common/99 postconf/postconf.py new file mode 100644 index 0000000..950c706 --- /dev/null +++ b/test cases/common/99 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/99 postconf/prog.c b/test cases/common/99 postconf/prog.c new file mode 100644 index 0000000..85a25a3 --- /dev/null +++ b/test cases/common/99 postconf/prog.c @@ -0,0 +1,5 @@ +#include"generated.h" + +int main(void) { + return THE_NUMBER != 9; +} diff --git a/test cases/common/99 postconf/raw.dat b/test cases/common/99 postconf/raw.dat new file mode 100644 index 0000000..ec63514 --- /dev/null +++ b/test cases/common/99 postconf/raw.dat @@ -0,0 +1 @@ +9 diff --git a/test cases/common/99 subproject subdir/meson.build b/test cases/common/99 subproject subdir/meson.build deleted file mode 100644 index 36e48a7..0000000 --- a/test cases/common/99 subproject subdir/meson.build +++ /dev/null @@ -1,67 +0,0 @@ -project('proj', 'c') -subproject('sub') -libSub = dependency('sub', fallback: ['sub', 'libSub']) - -exe = executable('prog', 'prog.c', dependencies: libSub) -test('subproject subdir', exe) - -# Verify the subproject has placed dependency override. -dependency('sub-1.0') - -# Verify we can now take 'sub' dependency without fallback, but only version 1.0. -dependency('sub') -d = dependency('sub', version : '>=2.0', required : false) -assert(not d.found(), 'version should not match') - -# Verify that not-found does not get cached, we can still fallback afterward. -dependency('sub2', required : false) -d = dependency('sub2', fallback: ['sub', 'libSub']) -assert(d.found(), 'Should fallback even if a previous call returned not-found') - -# Verify we can get a fallback dependency without specifying the variable name, -# because the subproject overridden 'sub-novar'. -dependency('sub-novar', fallback : 'sub_novar') - -# Verify a subproject can force a dependency to be not-found -d = dependency('sub-notfound', fallback : 'sub_novar', required : false) -assert(not d.found(), 'Dependency should be not-found') - -# Verify that implicit fallback works because subprojects/sub_implicit directory exists -d = dependency('sub_implicit') -assert(d.found(), 'Should implicitly fallback') - -# Verify that implicit fallback works because sub_implicit.wrap has -# `dependency_names=sub_implicit_provide1` and the subproject overrides sub_implicit_provide1. -d = dependency('sub_implicit_provide1') -assert(d.found(), 'Should implicitly fallback') - -# Verify that implicit fallback works because sub_implicit.wrap has -# `sub_implicit_provide2=sub_implicit_provide2_dep` and does not override -# sub_implicit_provide2. -d = dependency('sub_implicit_provide2') -assert(d.found(), 'Should implicitly fallback') - -# sub_implicit.wrap provides glib-2.0 and we already configured that subproject, -# so we must not return the system dependency here. Using glib-2.0 here because -# some CI runners have it installed. -d = dependency('glib-2.0', required : false) -assert(d.found()) -assert(d.type_name() == 'internal') - -# sub_implicit.wrap provides gobject-2.0 and we already configured that subproject, -# so we must not return the system dependency here. But since the subproject did -# not override that dependency and its not required, not-found should be returned. -# Using gobject-2.0 here because some CI runners have it installed. -d = dependency('gobject-2.0', required : false) -assert(not d.found()) - -# Verify that implicit fallback works because subprojects/sub_implicit/subprojects/subsub -# directory exists. -d = dependency('subsub') -assert(d.found(), 'Should be able to fallback to sub-subproject') - -# Verify that implicit fallback works because -# subprojects/sub_implicit/subprojects/subsub/subprojects/subsubsub.wrap -# file exists. -d = dependency('subsubsub') -assert(d.found(), 'Should be able to fallback to sub-sub-subproject') diff --git a/test cases/common/99 subproject subdir/prog.c b/test cases/common/99 subproject subdir/prog.c deleted file mode 100644 index 9035ff1..0000000 --- a/test cases/common/99 subproject subdir/prog.c +++ /dev/null @@ -1,5 +0,0 @@ -#include - -int main(void) { - return sub(); -} diff --git a/test cases/common/99 subproject subdir/subprojects/sub/lib/meson.build b/test cases/common/99 subproject subdir/subprojects/sub/lib/meson.build deleted file mode 100644 index 53233ab..0000000 --- a/test cases/common/99 subproject subdir/subprojects/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) -meson.override_dependency('sub-1.0', libSub) diff --git a/test cases/common/99 subproject subdir/subprojects/sub/lib/sub.c b/test cases/common/99 subproject subdir/subprojects/sub/lib/sub.c deleted file mode 100644 index e748ac7..0000000 --- a/test cases/common/99 subproject subdir/subprojects/sub/lib/sub.c +++ /dev/null @@ -1,5 +0,0 @@ -#include "sub.h" - -int sub(void) { - return 0; -} diff --git a/test cases/common/99 subproject subdir/subprojects/sub/lib/sub.h b/test cases/common/99 subproject subdir/subprojects/sub/lib/sub.h deleted file mode 100644 index 2b59a3a..0000000 --- a/test cases/common/99 subproject subdir/subprojects/sub/lib/sub.h +++ /dev/null @@ -1,6 +0,0 @@ -#ifndef SUB_H -#define SUB_H - -int sub(void); - -#endif diff --git a/test cases/common/99 subproject subdir/subprojects/sub/meson.build b/test cases/common/99 subproject subdir/subprojects/sub/meson.build deleted file mode 100644 index d8c4dce..0000000 --- a/test cases/common/99 subproject subdir/subprojects/sub/meson.build +++ /dev/null @@ -1,2 +0,0 @@ -project('sub', 'c', version : '1.0') -subdir('lib') diff --git a/test cases/common/99 subproject subdir/subprojects/sub_implicit.wrap b/test cases/common/99 subproject subdir/subprojects/sub_implicit.wrap deleted file mode 100644 index a809c43..0000000 --- a/test cases/common/99 subproject subdir/subprojects/sub_implicit.wrap +++ /dev/null @@ -1,6 +0,0 @@ -[wrap-file] - -[provide] -glib-2.0 = glib_dep -dependency_names = sub_implicit_provide1, gobject-2.0 -sub_implicit_provide2 = sub_implicit_provide2_dep diff --git a/test cases/common/99 subproject subdir/subprojects/sub_implicit/meson.build b/test cases/common/99 subproject subdir/subprojects/sub_implicit/meson.build deleted file mode 100644 index a1c46a1..0000000 --- a/test cases/common/99 subproject subdir/subprojects/sub_implicit/meson.build +++ /dev/null @@ -1,11 +0,0 @@ -project('sub_implicit', 'c', version : '1.0') - -dep = declare_dependency() -meson.override_dependency('sub_implicit', dep) -meson.override_dependency('sub_implicit_provide1', dep) - -# This one is not overridden but the wrap file tells the variable name to use. -sub_implicit_provide2_dep = dep - -# This one is not overridden but the wrap file tells the variable name to use. -glib_dep = dep diff --git a/test cases/common/99 subproject subdir/subprojects/sub_implicit/subprojects/subsub/foo.h b/test cases/common/99 subproject subdir/subprojects/sub_implicit/subprojects/subsub/foo.h deleted file mode 100644 index a8ad3da..0000000 --- a/test cases/common/99 subproject subdir/subprojects/sub_implicit/subprojects/subsub/foo.h +++ /dev/null @@ -1 +0,0 @@ -#define DUMMY 42 diff --git a/test cases/common/99 subproject subdir/subprojects/sub_implicit/subprojects/subsub/meson.build b/test cases/common/99 subproject subdir/subprojects/sub_implicit/subprojects/subsub/meson.build deleted file mode 100644 index fdbb03f..0000000 --- a/test cases/common/99 subproject subdir/subprojects/sub_implicit/subprojects/subsub/meson.build +++ /dev/null @@ -1,7 +0,0 @@ -project('subsub') - -meson.override_dependency('subsub', declare_dependency()) - -# Regression test: Installing a header from nested sub-subproject used to raise: -# ERROR: Sandbox violation: Tried to grab file foo.h from a nested subproject. -install_headers('foo.h') diff --git a/test cases/common/99 subproject subdir/subprojects/sub_implicit/subprojects/subsub/subprojects/packagefiles/subsubsub-1.0.zip b/test cases/common/99 subproject subdir/subprojects/sub_implicit/subprojects/subsub/subprojects/packagefiles/subsubsub-1.0.zip deleted file mode 100644 index dfb7576..0000000 Binary files a/test cases/common/99 subproject subdir/subprojects/sub_implicit/subprojects/subsub/subprojects/packagefiles/subsubsub-1.0.zip and /dev/null differ diff --git a/test cases/common/99 subproject subdir/subprojects/sub_implicit/subprojects/subsub/subprojects/subsubsub.wrap b/test cases/common/99 subproject subdir/subprojects/sub_implicit/subprojects/subsub/subprojects/subsubsub.wrap deleted file mode 100644 index 6567ed0..0000000 --- a/test cases/common/99 subproject subdir/subprojects/sub_implicit/subprojects/subsub/subprojects/subsubsub.wrap +++ /dev/null @@ -1,4 +0,0 @@ -[wrap-file] -directory = subsubsub-1.0 -source_filename = subsubsub-1.0.zip -source_hash = c073a96b7251937e53216578f6f03d91b84816618a0f1ce3ecfb867beddf1498 diff --git a/test cases/common/99 subproject subdir/subprojects/sub_novar/meson.build b/test cases/common/99 subproject subdir/subprojects/sub_novar/meson.build deleted file mode 100644 index 6450a10..0000000 --- a/test cases/common/99 subproject subdir/subprojects/sub_novar/meson.build +++ /dev/null @@ -1,4 +0,0 @@ -project('sub-novar', 'c', version : '1.0') - -meson.override_dependency('sub-novar', declare_dependency()) -meson.override_dependency('sub-notfound', dependency('', required : false)) diff --git a/test cases/common/99 subproject subdir/test.json b/test cases/common/99 subproject subdir/test.json deleted file mode 100644 index 1921fe5..0000000 --- a/test cases/common/99 subproject subdir/test.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "installed": [ - { "type": "file", "file": "usr/include/foo.h" } - ] -} diff --git a/test cases/unit/63 cmake_prefix_path/meson.build b/test cases/unit/63 cmake_prefix_path/meson.build new file mode 100644 index 0000000..442bbd3 --- /dev/null +++ b/test cases/unit/63 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/63 cmake_prefix_path/prefix/lib/cmake/mesontest/mesontest-config.cmake b/test cases/unit/63 cmake_prefix_path/prefix/lib/cmake/mesontest/mesontest-config.cmake new file mode 100644 index 0000000..289b349 --- /dev/null +++ b/test cases/unit/63 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/64 cmake parser/meson.build b/test cases/unit/64 cmake parser/meson.build new file mode 100644 index 0000000..061bab0 --- /dev/null +++ b/test cases/unit/64 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 support 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/64 cmake parser/prefix/lib/cmake/mesontest/mesontest-config.cmake b/test cases/unit/64 cmake parser/prefix/lib/cmake/mesontest/mesontest-config.cmake new file mode 100644 index 0000000..7474eb7 --- /dev/null +++ b/test cases/unit/64 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/64 cmake_prefix_path/meson.build b/test cases/unit/64 cmake_prefix_path/meson.build deleted file mode 100644 index 442bbd3..0000000 --- a/test cases/unit/64 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/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 deleted file mode 100644 index 289b349..0000000 --- a/test cases/unit/64 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/65 alias target/main.c b/test cases/unit/65 alias target/main.c new file mode 100644 index 0000000..0fb4389 --- /dev/null +++ b/test cases/unit/65 alias target/main.c @@ -0,0 +1,3 @@ +int main(int argc, char *argv[]) { + return 0; +} diff --git a/test cases/unit/65 alias target/meson.build b/test cases/unit/65 alias target/meson.build new file mode 100644 index 0000000..6934cc7 --- /dev/null +++ b/test cases/unit/65 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]) diff --git a/test cases/unit/65 cmake parser/meson.build b/test cases/unit/65 cmake parser/meson.build deleted file mode 100644 index 061bab0..0000000 --- a/test cases/unit/65 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 support 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 deleted file mode 100644 index 7474eb7..0000000 --- a/test cases/unit/65 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/66 alias target/main.c b/test cases/unit/66 alias target/main.c deleted file mode 100644 index 0fb4389..0000000 --- a/test cases/unit/66 alias target/main.c +++ /dev/null @@ -1,3 +0,0 @@ -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 deleted file mode 100644 index 6934cc7..0000000 --- a/test cases/unit/66 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/66 static archive stripping/app/appA.c b/test cases/unit/66 static archive stripping/app/appA.c new file mode 100644 index 0000000..e44b54a --- /dev/null +++ b/test cases/unit/66 static archive stripping/app/appA.c @@ -0,0 +1,4 @@ +#include +#include + +int main(void) { printf("The answer is: %d\n", libA_func()); } diff --git a/test cases/unit/66 static archive stripping/app/appB.c b/test cases/unit/66 static archive stripping/app/appB.c new file mode 100644 index 0000000..0ec0b62 --- /dev/null +++ b/test cases/unit/66 static archive stripping/app/appB.c @@ -0,0 +1,4 @@ +#include +#include + +int main(void) { printf("The answer is: %d\n", libB_func()); } diff --git a/test cases/unit/66 static archive stripping/app/meson.build b/test cases/unit/66 static archive stripping/app/meson.build new file mode 100644 index 0000000..118719d --- /dev/null +++ b/test cases/unit/66 static archive stripping/app/meson.build @@ -0,0 +1,7 @@ +project('app', ['c']) + +a = dependency('test-a') +b = dependency('test-b') + +executable('appA', files('appA.c'), dependencies : a) +executable('appB', files('appB.c'), dependencies : b) diff --git a/test cases/unit/66 static archive stripping/lib/libA.c b/test cases/unit/66 static archive stripping/lib/libA.c new file mode 100644 index 0000000..a97185e --- /dev/null +++ b/test cases/unit/66 static archive stripping/lib/libA.c @@ -0,0 +1,5 @@ +#include + +static int libA_func_impl(void) { return 0; } + +int libA_func(void) { return libA_func_impl(); } diff --git a/test cases/unit/66 static archive stripping/lib/libA.h b/test cases/unit/66 static archive stripping/lib/libA.h new file mode 100644 index 0000000..e6450cd --- /dev/null +++ b/test cases/unit/66 static archive stripping/lib/libA.h @@ -0,0 +1 @@ +int libA_func(void); diff --git a/test cases/unit/66 static archive stripping/lib/libB.c b/test cases/unit/66 static archive stripping/lib/libB.c new file mode 100644 index 0000000..0200b1f --- /dev/null +++ b/test cases/unit/66 static archive stripping/lib/libB.c @@ -0,0 +1,5 @@ +#include + +static int libB_func_impl(void) { return 0; } + +int libB_func(void) { return libB_func_impl(); } diff --git a/test cases/unit/66 static archive stripping/lib/libB.h b/test cases/unit/66 static archive stripping/lib/libB.h new file mode 100644 index 0000000..065a4a4 --- /dev/null +++ b/test cases/unit/66 static archive stripping/lib/libB.h @@ -0,0 +1 @@ +int libB_func(void); diff --git a/test cases/unit/66 static archive stripping/lib/meson.build b/test cases/unit/66 static archive stripping/lib/meson.build new file mode 100644 index 0000000..ae50fa7 --- /dev/null +++ b/test cases/unit/66 static archive stripping/lib/meson.build @@ -0,0 +1,23 @@ +project('lib', ['c']) + +pkg = import('pkgconfig') + +a = library('test-a', files('libA.c'), install: true) +install_headers(files('libA.h'), subdir: 'libA') +pkg.generate( + a, + version: '0.0', + description: 'test library libA', + filebase: 'test-a', + name: 'test library libA', + subdirs: 'libA') + +b = static_library('test-b', files('libB.c'), install: true) +install_headers(files('libB.h'), subdir: 'libB') +pkg.generate( + b, + version: '0.0', + description: 'test library libB', + filebase: 'test-b', + name: 'test library libB', + subdirs: 'libB') diff --git a/test cases/unit/67 static archive stripping/app/appA.c b/test cases/unit/67 static archive stripping/app/appA.c deleted file mode 100644 index e44b54a..0000000 --- a/test cases/unit/67 static archive stripping/app/appA.c +++ /dev/null @@ -1,4 +0,0 @@ -#include -#include - -int main(void) { printf("The answer is: %d\n", libA_func()); } diff --git a/test cases/unit/67 static archive stripping/app/appB.c b/test cases/unit/67 static archive stripping/app/appB.c deleted file mode 100644 index 0ec0b62..0000000 --- a/test cases/unit/67 static archive stripping/app/appB.c +++ /dev/null @@ -1,4 +0,0 @@ -#include -#include - -int main(void) { printf("The answer is: %d\n", libB_func()); } diff --git a/test cases/unit/67 static archive stripping/app/meson.build b/test cases/unit/67 static archive stripping/app/meson.build deleted file mode 100644 index 118719d..0000000 --- a/test cases/unit/67 static archive stripping/app/meson.build +++ /dev/null @@ -1,7 +0,0 @@ -project('app', ['c']) - -a = dependency('test-a') -b = dependency('test-b') - -executable('appA', files('appA.c'), dependencies : a) -executable('appB', files('appB.c'), dependencies : b) diff --git a/test cases/unit/67 static archive stripping/lib/libA.c b/test cases/unit/67 static archive stripping/lib/libA.c deleted file mode 100644 index a97185e..0000000 --- a/test cases/unit/67 static archive stripping/lib/libA.c +++ /dev/null @@ -1,5 +0,0 @@ -#include - -static int libA_func_impl(void) { return 0; } - -int libA_func(void) { return libA_func_impl(); } diff --git a/test cases/unit/67 static archive stripping/lib/libA.h b/test cases/unit/67 static archive stripping/lib/libA.h deleted file mode 100644 index e6450cd..0000000 --- a/test cases/unit/67 static archive stripping/lib/libA.h +++ /dev/null @@ -1 +0,0 @@ -int libA_func(void); diff --git a/test cases/unit/67 static archive stripping/lib/libB.c b/test cases/unit/67 static archive stripping/lib/libB.c deleted file mode 100644 index 0200b1f..0000000 --- a/test cases/unit/67 static archive stripping/lib/libB.c +++ /dev/null @@ -1,5 +0,0 @@ -#include - -static int libB_func_impl(void) { return 0; } - -int libB_func(void) { return libB_func_impl(); } diff --git a/test cases/unit/67 static archive stripping/lib/libB.h b/test cases/unit/67 static archive stripping/lib/libB.h deleted file mode 100644 index 065a4a4..0000000 --- a/test cases/unit/67 static archive stripping/lib/libB.h +++ /dev/null @@ -1 +0,0 @@ -int libB_func(void); diff --git a/test cases/unit/67 static archive stripping/lib/meson.build b/test cases/unit/67 static archive stripping/lib/meson.build deleted file mode 100644 index ae50fa7..0000000 --- a/test cases/unit/67 static archive stripping/lib/meson.build +++ /dev/null @@ -1,23 +0,0 @@ -project('lib', ['c']) - -pkg = import('pkgconfig') - -a = library('test-a', files('libA.c'), install: true) -install_headers(files('libA.h'), subdir: 'libA') -pkg.generate( - a, - version: '0.0', - description: 'test library libA', - filebase: 'test-a', - name: 'test library libA', - subdirs: 'libA') - -b = static_library('test-b', files('libB.c'), install: true) -install_headers(files('libB.h'), subdir: 'libB') -pkg.generate( - b, - version: '0.0', - description: 'test library libB', - filebase: 'test-b', - name: 'test library libB', - subdirs: 'libB') diff --git a/test cases/unit/67 static link/lib/func1.c b/test cases/unit/67 static link/lib/func1.c new file mode 100644 index 0000000..cc934ad --- /dev/null +++ b/test cases/unit/67 static link/lib/func1.c @@ -0,0 +1,9 @@ +int func1() +{ + return 1; +} + +int func1b() +{ + return 1; +} diff --git a/test cases/unit/67 static link/lib/func10.c b/test cases/unit/67 static link/lib/func10.c new file mode 100644 index 0000000..75a911f --- /dev/null +++ b/test cases/unit/67 static link/lib/func10.c @@ -0,0 +1,4 @@ +int func10() +{ + return 1; +} diff --git a/test cases/unit/67 static link/lib/func11.c b/test cases/unit/67 static link/lib/func11.c new file mode 100644 index 0000000..1d5119b --- /dev/null +++ b/test cases/unit/67 static link/lib/func11.c @@ -0,0 +1,6 @@ +int func10(); + +int func11() +{ + return func10() + 1; +} diff --git a/test cases/unit/67 static link/lib/func12.c b/test cases/unit/67 static link/lib/func12.c new file mode 100644 index 0000000..73db5c0 --- /dev/null +++ b/test cases/unit/67 static link/lib/func12.c @@ -0,0 +1,7 @@ +int func10(); +int func11(); + +int func12() +{ + return func10() + func11(); +} diff --git a/test cases/unit/67 static link/lib/func14.c b/test cases/unit/67 static link/lib/func14.c new file mode 100644 index 0000000..0277319 --- /dev/null +++ b/test cases/unit/67 static link/lib/func14.c @@ -0,0 +1,4 @@ +int func14() +{ + return 1; +} diff --git a/test cases/unit/67 static link/lib/func15.c b/test cases/unit/67 static link/lib/func15.c new file mode 100644 index 0000000..78303cc --- /dev/null +++ b/test cases/unit/67 static link/lib/func15.c @@ -0,0 +1,6 @@ +int func14(); + +int func15() +{ + return func14() + 1; +} diff --git a/test cases/unit/67 static link/lib/func16.c b/test cases/unit/67 static link/lib/func16.c new file mode 100644 index 0000000..379b682 --- /dev/null +++ b/test cases/unit/67 static link/lib/func16.c @@ -0,0 +1,6 @@ +int func15(); + +int func16() +{ + return func15() + 1; +} diff --git a/test cases/unit/67 static link/lib/func17.c b/test cases/unit/67 static link/lib/func17.c new file mode 100644 index 0000000..d1d8ec4 --- /dev/null +++ b/test cases/unit/67 static link/lib/func17.c @@ -0,0 +1,4 @@ +int func17() +{ + return 1; +} diff --git a/test cases/unit/67 static link/lib/func18.c b/test cases/unit/67 static link/lib/func18.c new file mode 100644 index 0000000..c149085 --- /dev/null +++ b/test cases/unit/67 static link/lib/func18.c @@ -0,0 +1,6 @@ +int func17(); + +int func18() +{ + return func17() + 1; +} diff --git a/test cases/unit/67 static link/lib/func19.c b/test cases/unit/67 static link/lib/func19.c new file mode 100644 index 0000000..69120e4 --- /dev/null +++ b/test cases/unit/67 static link/lib/func19.c @@ -0,0 +1,7 @@ +int func17(); +int func18(); + +int func19() +{ + return func17() + func18(); +} diff --git a/test cases/unit/67 static link/lib/func2.c b/test cases/unit/67 static link/lib/func2.c new file mode 100644 index 0000000..6b8f539 --- /dev/null +++ b/test cases/unit/67 static link/lib/func2.c @@ -0,0 +1,6 @@ +int func1(); + +int func2() +{ + return func1() + 1; +} diff --git a/test cases/unit/67 static link/lib/func3.c b/test cases/unit/67 static link/lib/func3.c new file mode 100644 index 0000000..04f9f89 --- /dev/null +++ b/test cases/unit/67 static link/lib/func3.c @@ -0,0 +1,4 @@ +int func3() +{ + return 1; +} diff --git a/test cases/unit/67 static link/lib/func4.c b/test cases/unit/67 static link/lib/func4.c new file mode 100644 index 0000000..c44c990 --- /dev/null +++ b/test cases/unit/67 static link/lib/func4.c @@ -0,0 +1,6 @@ +int func3(); + +int func4() +{ + return func3() + 1; +} diff --git a/test cases/unit/67 static link/lib/func5.c b/test cases/unit/67 static link/lib/func5.c new file mode 100644 index 0000000..8e07864 --- /dev/null +++ b/test cases/unit/67 static link/lib/func5.c @@ -0,0 +1,4 @@ +int func5() +{ + return 1; +} diff --git a/test cases/unit/67 static link/lib/func6.c b/test cases/unit/67 static link/lib/func6.c new file mode 100644 index 0000000..276fe7d --- /dev/null +++ b/test cases/unit/67 static link/lib/func6.c @@ -0,0 +1,6 @@ +int func5(); + +int func6() +{ + return func5() + 1; +} diff --git a/test cases/unit/67 static link/lib/func7.c b/test cases/unit/67 static link/lib/func7.c new file mode 100644 index 0000000..8c1a536 --- /dev/null +++ b/test cases/unit/67 static link/lib/func7.c @@ -0,0 +1,4 @@ +int func7() +{ + return 1; +} diff --git a/test cases/unit/67 static link/lib/func8.c b/test cases/unit/67 static link/lib/func8.c new file mode 100644 index 0000000..b7b6cd5 --- /dev/null +++ b/test cases/unit/67 static link/lib/func8.c @@ -0,0 +1,6 @@ +int func7(); + +int func8() +{ + return func7() + 1; +} diff --git a/test cases/unit/67 static link/lib/func9.c b/test cases/unit/67 static link/lib/func9.c new file mode 100644 index 0000000..852252d --- /dev/null +++ b/test cases/unit/67 static link/lib/func9.c @@ -0,0 +1,6 @@ +int func8(); + +int func9() +{ + return func8() + 1; +} diff --git a/test cases/unit/67 static link/lib/meson.build b/test cases/unit/67 static link/lib/meson.build new file mode 100644 index 0000000..8f95fc4 --- /dev/null +++ b/test cases/unit/67 static link/lib/meson.build @@ -0,0 +1,80 @@ +project('test static link libs', 'c') + +pkg = import('pkgconfig') + +# libfunc2 should contain both func1() and func2() symbols +libfunc1 = static_library('func1', 'func1.c', + install : false) +libfunc2 = static_library('func2', 'func2.c', + link_whole : libfunc1, + install : true) + +# Same as above, but with link_with instead of link_whole, +# libfunc4 should contain both func3() and func4() symbols +libfunc3 = static_library('func3', 'func3.c', + install : false) +libfunc4 = static_library('func4', 'func4.c', + link_with : libfunc3, + install : true) + +# Same as above, but also generate an pkg-config file. Use both_libraries() to +# make sure a complete .pc file gets generated. libfunc5 should not be mentioned +# into the .pc file because it's not installed. +libfunc5 = static_library('func5', 'func5.c', + install : false) +libfunc6 = both_libraries('func6', 'func6.c', + link_with : libfunc5, + install : true) +pkg.generate(libfunc6) + +# libfunc9 should contain both func8() and func9() but not func7() because that +# one gets installed. Also test that link_with and link_whole works the same way +# because libfunc8 is uninstalled. +libfunc7 = static_library('func7', 'func7.c', + install : true) +libfunc8 = static_library('func8', 'func8.c', + link_with : libfunc7, + install : false) +libfunc9_linkwith = static_library('func9_linkwith', 'func9.c', + link_with : libfunc8, + install : true) +libfunc9_linkwhole = static_library('func9_linkwhole', 'func9.c', + link_whole : libfunc8, + install : true) + +# Pattern found in mesa: +# - libfunc11 uses func10() +# - libfunc12 uses both func10() and func11() +# When a shared library link_whole on libfunc12, we ensure we don't include +# func10.c.o twice which would fail to link. +libfunc10 = static_library('func10', 'func10.c', + install : false) +libfunc11 = static_library('func11', 'func11.c', + link_with : libfunc10, + install : false) +libfunc12 = static_library('func12', 'func12.c', + link_with : [libfunc10, libfunc11], + install : false) +libfunc13 = shared_library('func13', link_whole : libfunc12) + +# libfunc16 should contain func14(), func15() and func16() +libfunc14 = static_library('func14', 'func14.c', + install : false) +libfunc15 = static_library('func15', 'func15.c', + link_with : libfunc14, + install : false) +libfunc16 = static_library('func16', 'func16.c', + link_with : libfunc15, + install : true) + +# Verify func17.c.o gets included only once into libfunc19, otherwise +# func19-shared would failed with duplicated symbol. +libfunc17 = static_library('func17', 'func17.c', + install : false) +libfunc18 = static_library('func18', 'func18.c', + link_with : libfunc17, + install : false) +libfunc19 = static_library('func19', 'func19.c', + link_whole : [libfunc17, libfunc18], + install : false) +shared_library('func19-shared', link_whole : [libfunc19]) diff --git a/test cases/unit/67 static link/meson.build b/test cases/unit/67 static link/meson.build new file mode 100644 index 0000000..dac17f8 --- /dev/null +++ b/test cases/unit/67 static link/meson.build @@ -0,0 +1,32 @@ +project('test static link', 'c') + +cc = meson.get_compiler('c') + +# Verify that installed libfunc2.a is usable +func2_dep = cc.find_library('func2') +test('test1', executable('test1', 'test1.c', dependencies : func2_dep)) + +# Verify that installed libfunc4.a is usable +func4_dep = cc.find_library('func4') +test('test2', executable('test2', 'test2.c', dependencies : func4_dep)) + +# Verify that installed pkg-config file is usable for both shared and static link +func6_static_dep = dependency('func6', static : true) +test('test3-static', executable('test3-static', 'test3.c', + dependencies : func6_static_dep)) +func6_shared_dep = dependency('func6', static : false) +test('test3-shared', executable('test3-shared', 'test3.c', + dependencies : func6_shared_dep)) + +# Verify that installed libfunc9.a contains func8() and func8() but not func7() +func7_dep = cc.find_library('func7') +func9_linkwhole_dep = cc.find_library('func9_linkwhole') +test('test4-linkwhole', executable('test4-linkwhole', 'test4.c', + dependencies : [func7_dep, func9_linkwhole_dep])) +func9_linkwith_dep = cc.find_library('func9_linkwith') +test('test4-linkwith', executable('test4-linkwith', 'test4.c', + dependencies : [func7_dep, func9_linkwith_dep])) + +# Verify that installed libfunc16.a is usable +libfunc16_dep = cc.find_library('func16') +test('test5', executable('test5', 'test5.c', dependencies: libfunc16_dep)) diff --git a/test cases/unit/67 static link/test1.c b/test cases/unit/67 static link/test1.c new file mode 100644 index 0000000..ffc9b9e --- /dev/null +++ b/test cases/unit/67 static link/test1.c @@ -0,0 +1,7 @@ +int func1b(); +int func2(); + +int main(int argc, char *argv[]) +{ + return func2() + func1b() == 3 ? 0 : 1; +} diff --git a/test cases/unit/67 static link/test2.c b/test cases/unit/67 static link/test2.c new file mode 100644 index 0000000..561422a --- /dev/null +++ b/test cases/unit/67 static link/test2.c @@ -0,0 +1,6 @@ +int func4(); + +int main(int argc, char *argv[]) +{ + return func4() == 2 ? 0 : 1; +} diff --git a/test cases/unit/67 static link/test3.c b/test cases/unit/67 static link/test3.c new file mode 100644 index 0000000..1216064 --- /dev/null +++ b/test cases/unit/67 static link/test3.c @@ -0,0 +1,6 @@ +int func6(); + +int main(int argc, char *argv[]) +{ + return func6() == 2 ? 0 : 1; +} diff --git a/test cases/unit/67 static link/test4.c b/test cases/unit/67 static link/test4.c new file mode 100644 index 0000000..7c281e0 --- /dev/null +++ b/test cases/unit/67 static link/test4.c @@ -0,0 +1,6 @@ +int func9(); + +int main(int argc, char *argv[]) +{ + return func9() == 3 ? 0 : 1; +} diff --git a/test cases/unit/67 static link/test5.c b/test cases/unit/67 static link/test5.c new file mode 100644 index 0000000..6020f0e --- /dev/null +++ b/test cases/unit/67 static link/test5.c @@ -0,0 +1,6 @@ +int func16(); + +int main(int argc, char *argv[]) +{ + return func16() == 3 ? 0 : 1; +} diff --git a/test cases/unit/68 static link/lib/func1.c b/test cases/unit/68 static link/lib/func1.c deleted file mode 100644 index cc934ad..0000000 --- a/test cases/unit/68 static link/lib/func1.c +++ /dev/null @@ -1,9 +0,0 @@ -int func1() -{ - return 1; -} - -int func1b() -{ - return 1; -} diff --git a/test cases/unit/68 static link/lib/func10.c b/test cases/unit/68 static link/lib/func10.c deleted file mode 100644 index 75a911f..0000000 --- a/test cases/unit/68 static link/lib/func10.c +++ /dev/null @@ -1,4 +0,0 @@ -int func10() -{ - return 1; -} diff --git a/test cases/unit/68 static link/lib/func11.c b/test cases/unit/68 static link/lib/func11.c deleted file mode 100644 index 1d5119b..0000000 --- a/test cases/unit/68 static link/lib/func11.c +++ /dev/null @@ -1,6 +0,0 @@ -int func10(); - -int func11() -{ - return func10() + 1; -} diff --git a/test cases/unit/68 static link/lib/func12.c b/test cases/unit/68 static link/lib/func12.c deleted file mode 100644 index 73db5c0..0000000 --- a/test cases/unit/68 static link/lib/func12.c +++ /dev/null @@ -1,7 +0,0 @@ -int func10(); -int func11(); - -int func12() -{ - return func10() + func11(); -} diff --git a/test cases/unit/68 static link/lib/func14.c b/test cases/unit/68 static link/lib/func14.c deleted file mode 100644 index 0277319..0000000 --- a/test cases/unit/68 static link/lib/func14.c +++ /dev/null @@ -1,4 +0,0 @@ -int func14() -{ - return 1; -} diff --git a/test cases/unit/68 static link/lib/func15.c b/test cases/unit/68 static link/lib/func15.c deleted file mode 100644 index 78303cc..0000000 --- a/test cases/unit/68 static link/lib/func15.c +++ /dev/null @@ -1,6 +0,0 @@ -int func14(); - -int func15() -{ - return func14() + 1; -} diff --git a/test cases/unit/68 static link/lib/func16.c b/test cases/unit/68 static link/lib/func16.c deleted file mode 100644 index 379b682..0000000 --- a/test cases/unit/68 static link/lib/func16.c +++ /dev/null @@ -1,6 +0,0 @@ -int func15(); - -int func16() -{ - return func15() + 1; -} diff --git a/test cases/unit/68 static link/lib/func17.c b/test cases/unit/68 static link/lib/func17.c deleted file mode 100644 index d1d8ec4..0000000 --- a/test cases/unit/68 static link/lib/func17.c +++ /dev/null @@ -1,4 +0,0 @@ -int func17() -{ - return 1; -} diff --git a/test cases/unit/68 static link/lib/func18.c b/test cases/unit/68 static link/lib/func18.c deleted file mode 100644 index c149085..0000000 --- a/test cases/unit/68 static link/lib/func18.c +++ /dev/null @@ -1,6 +0,0 @@ -int func17(); - -int func18() -{ - return func17() + 1; -} diff --git a/test cases/unit/68 static link/lib/func19.c b/test cases/unit/68 static link/lib/func19.c deleted file mode 100644 index 69120e4..0000000 --- a/test cases/unit/68 static link/lib/func19.c +++ /dev/null @@ -1,7 +0,0 @@ -int func17(); -int func18(); - -int func19() -{ - return func17() + func18(); -} diff --git a/test cases/unit/68 static link/lib/func2.c b/test cases/unit/68 static link/lib/func2.c deleted file mode 100644 index 6b8f539..0000000 --- a/test cases/unit/68 static link/lib/func2.c +++ /dev/null @@ -1,6 +0,0 @@ -int func1(); - -int func2() -{ - return func1() + 1; -} diff --git a/test cases/unit/68 static link/lib/func3.c b/test cases/unit/68 static link/lib/func3.c deleted file mode 100644 index 04f9f89..0000000 --- a/test cases/unit/68 static link/lib/func3.c +++ /dev/null @@ -1,4 +0,0 @@ -int func3() -{ - return 1; -} diff --git a/test cases/unit/68 static link/lib/func4.c b/test cases/unit/68 static link/lib/func4.c deleted file mode 100644 index c44c990..0000000 --- a/test cases/unit/68 static link/lib/func4.c +++ /dev/null @@ -1,6 +0,0 @@ -int func3(); - -int func4() -{ - return func3() + 1; -} diff --git a/test cases/unit/68 static link/lib/func5.c b/test cases/unit/68 static link/lib/func5.c deleted file mode 100644 index 8e07864..0000000 --- a/test cases/unit/68 static link/lib/func5.c +++ /dev/null @@ -1,4 +0,0 @@ -int func5() -{ - return 1; -} diff --git a/test cases/unit/68 static link/lib/func6.c b/test cases/unit/68 static link/lib/func6.c deleted file mode 100644 index 276fe7d..0000000 --- a/test cases/unit/68 static link/lib/func6.c +++ /dev/null @@ -1,6 +0,0 @@ -int func5(); - -int func6() -{ - return func5() + 1; -} diff --git a/test cases/unit/68 static link/lib/func7.c b/test cases/unit/68 static link/lib/func7.c deleted file mode 100644 index 8c1a536..0000000 --- a/test cases/unit/68 static link/lib/func7.c +++ /dev/null @@ -1,4 +0,0 @@ -int func7() -{ - return 1; -} diff --git a/test cases/unit/68 static link/lib/func8.c b/test cases/unit/68 static link/lib/func8.c deleted file mode 100644 index b7b6cd5..0000000 --- a/test cases/unit/68 static link/lib/func8.c +++ /dev/null @@ -1,6 +0,0 @@ -int func7(); - -int func8() -{ - return func7() + 1; -} diff --git a/test cases/unit/68 static link/lib/func9.c b/test cases/unit/68 static link/lib/func9.c deleted file mode 100644 index 852252d..0000000 --- a/test cases/unit/68 static link/lib/func9.c +++ /dev/null @@ -1,6 +0,0 @@ -int func8(); - -int func9() -{ - return func8() + 1; -} diff --git a/test cases/unit/68 static link/lib/meson.build b/test cases/unit/68 static link/lib/meson.build deleted file mode 100644 index 8f95fc4..0000000 --- a/test cases/unit/68 static link/lib/meson.build +++ /dev/null @@ -1,80 +0,0 @@ -project('test static link libs', 'c') - -pkg = import('pkgconfig') - -# libfunc2 should contain both func1() and func2() symbols -libfunc1 = static_library('func1', 'func1.c', - install : false) -libfunc2 = static_library('func2', 'func2.c', - link_whole : libfunc1, - install : true) - -# Same as above, but with link_with instead of link_whole, -# libfunc4 should contain both func3() and func4() symbols -libfunc3 = static_library('func3', 'func3.c', - install : false) -libfunc4 = static_library('func4', 'func4.c', - link_with : libfunc3, - install : true) - -# Same as above, but also generate an pkg-config file. Use both_libraries() to -# make sure a complete .pc file gets generated. libfunc5 should not be mentioned -# into the .pc file because it's not installed. -libfunc5 = static_library('func5', 'func5.c', - install : false) -libfunc6 = both_libraries('func6', 'func6.c', - link_with : libfunc5, - install : true) -pkg.generate(libfunc6) - -# libfunc9 should contain both func8() and func9() but not func7() because that -# one gets installed. Also test that link_with and link_whole works the same way -# because libfunc8 is uninstalled. -libfunc7 = static_library('func7', 'func7.c', - install : true) -libfunc8 = static_library('func8', 'func8.c', - link_with : libfunc7, - install : false) -libfunc9_linkwith = static_library('func9_linkwith', 'func9.c', - link_with : libfunc8, - install : true) -libfunc9_linkwhole = static_library('func9_linkwhole', 'func9.c', - link_whole : libfunc8, - install : true) - -# Pattern found in mesa: -# - libfunc11 uses func10() -# - libfunc12 uses both func10() and func11() -# When a shared library link_whole on libfunc12, we ensure we don't include -# func10.c.o twice which would fail to link. -libfunc10 = static_library('func10', 'func10.c', - install : false) -libfunc11 = static_library('func11', 'func11.c', - link_with : libfunc10, - install : false) -libfunc12 = static_library('func12', 'func12.c', - link_with : [libfunc10, libfunc11], - install : false) -libfunc13 = shared_library('func13', link_whole : libfunc12) - -# libfunc16 should contain func14(), func15() and func16() -libfunc14 = static_library('func14', 'func14.c', - install : false) -libfunc15 = static_library('func15', 'func15.c', - link_with : libfunc14, - install : false) -libfunc16 = static_library('func16', 'func16.c', - link_with : libfunc15, - install : true) - -# Verify func17.c.o gets included only once into libfunc19, otherwise -# func19-shared would failed with duplicated symbol. -libfunc17 = static_library('func17', 'func17.c', - install : false) -libfunc18 = static_library('func18', 'func18.c', - link_with : libfunc17, - install : false) -libfunc19 = static_library('func19', 'func19.c', - link_whole : [libfunc17, libfunc18], - install : false) -shared_library('func19-shared', link_whole : [libfunc19]) diff --git a/test cases/unit/68 static link/meson.build b/test cases/unit/68 static link/meson.build deleted file mode 100644 index dac17f8..0000000 --- a/test cases/unit/68 static link/meson.build +++ /dev/null @@ -1,32 +0,0 @@ -project('test static link', 'c') - -cc = meson.get_compiler('c') - -# Verify that installed libfunc2.a is usable -func2_dep = cc.find_library('func2') -test('test1', executable('test1', 'test1.c', dependencies : func2_dep)) - -# Verify that installed libfunc4.a is usable -func4_dep = cc.find_library('func4') -test('test2', executable('test2', 'test2.c', dependencies : func4_dep)) - -# Verify that installed pkg-config file is usable for both shared and static link -func6_static_dep = dependency('func6', static : true) -test('test3-static', executable('test3-static', 'test3.c', - dependencies : func6_static_dep)) -func6_shared_dep = dependency('func6', static : false) -test('test3-shared', executable('test3-shared', 'test3.c', - dependencies : func6_shared_dep)) - -# Verify that installed libfunc9.a contains func8() and func8() but not func7() -func7_dep = cc.find_library('func7') -func9_linkwhole_dep = cc.find_library('func9_linkwhole') -test('test4-linkwhole', executable('test4-linkwhole', 'test4.c', - dependencies : [func7_dep, func9_linkwhole_dep])) -func9_linkwith_dep = cc.find_library('func9_linkwith') -test('test4-linkwith', executable('test4-linkwith', 'test4.c', - dependencies : [func7_dep, func9_linkwith_dep])) - -# Verify that installed libfunc16.a is usable -libfunc16_dep = cc.find_library('func16') -test('test5', executable('test5', 'test5.c', dependencies: libfunc16_dep)) diff --git a/test cases/unit/68 static link/test1.c b/test cases/unit/68 static link/test1.c deleted file mode 100644 index ffc9b9e..0000000 --- a/test cases/unit/68 static link/test1.c +++ /dev/null @@ -1,7 +0,0 @@ -int func1b(); -int func2(); - -int main(int argc, char *argv[]) -{ - return func2() + func1b() == 3 ? 0 : 1; -} diff --git a/test cases/unit/68 static link/test2.c b/test cases/unit/68 static link/test2.c deleted file mode 100644 index 561422a..0000000 --- a/test cases/unit/68 static link/test2.c +++ /dev/null @@ -1,6 +0,0 @@ -int func4(); - -int main(int argc, char *argv[]) -{ - return func4() == 2 ? 0 : 1; -} diff --git a/test cases/unit/68 static link/test3.c b/test cases/unit/68 static link/test3.c deleted file mode 100644 index 1216064..0000000 --- a/test cases/unit/68 static link/test3.c +++ /dev/null @@ -1,6 +0,0 @@ -int func6(); - -int main(int argc, char *argv[]) -{ - return func6() == 2 ? 0 : 1; -} diff --git a/test cases/unit/68 static link/test4.c b/test cases/unit/68 static link/test4.c deleted file mode 100644 index 7c281e0..0000000 --- a/test cases/unit/68 static link/test4.c +++ /dev/null @@ -1,6 +0,0 @@ -int func9(); - -int main(int argc, char *argv[]) -{ - return func9() == 3 ? 0 : 1; -} diff --git a/test cases/unit/68 static link/test5.c b/test cases/unit/68 static link/test5.c deleted file mode 100644 index 6020f0e..0000000 --- a/test cases/unit/68 static link/test5.c +++ /dev/null @@ -1,6 +0,0 @@ -int func16(); - -int main(int argc, char *argv[]) -{ - return func16() == 3 ? 0 : 1; -} diff --git a/test cases/unit/68 test env value/meson.build b/test cases/unit/68 test env value/meson.build new file mode 100644 index 0000000..aa3dbc3 --- /dev/null +++ b/test cases/unit/68 test env value/meson.build @@ -0,0 +1,10 @@ +project('test env value') + +testpy = find_program('test.py') + +val = ['1', '2', '3'] +foreach v: val + test('check env', testpy, args: [v], env: {'TEST_VAR': v}) +endforeach +test('check env', testpy, args: ['4'], env: environment({'TEST_VAR': '4'})) +test('check env', testpy, args: ['5'], env: environment(['TEST_VAR=5'])) diff --git a/test cases/unit/68 test env value/test.py b/test cases/unit/68 test env value/test.py new file mode 100755 index 0000000..0cc7645 --- /dev/null +++ b/test cases/unit/68 test env value/test.py @@ -0,0 +1,6 @@ +#!/usr/bin/env python3 + +import os +import sys + +assert(os.environ['TEST_VAR'] == sys.argv[1]) diff --git a/test cases/unit/69 clang-tidy/.clang-tidy b/test cases/unit/69 clang-tidy/.clang-tidy new file mode 100644 index 0000000..3935294 --- /dev/null +++ b/test cases/unit/69 clang-tidy/.clang-tidy @@ -0,0 +1 @@ +Checks: '-*,modernize-use-bool-literals' diff --git a/test cases/unit/69 clang-tidy/cttest.cpp b/test cases/unit/69 clang-tidy/cttest.cpp new file mode 100644 index 0000000..07b35a6 --- /dev/null +++ b/test cases/unit/69 clang-tidy/cttest.cpp @@ -0,0 +1,7 @@ +#include + +int main(int, char**) { + bool intbool = 1; + printf("Intbool is %d\n", (int)intbool); + return 0; +} diff --git a/test cases/unit/69 clang-tidy/dummydir.h/dummy.dat b/test cases/unit/69 clang-tidy/dummydir.h/dummy.dat new file mode 100644 index 0000000..80c6165 --- /dev/null +++ b/test cases/unit/69 clang-tidy/dummydir.h/dummy.dat @@ -0,0 +1 @@ +Placeholder to track enclosing directory in git. Not to be analyzed. diff --git a/test cases/unit/69 clang-tidy/meson.build b/test cases/unit/69 clang-tidy/meson.build new file mode 100644 index 0000000..737474b --- /dev/null +++ b/test cases/unit/69 clang-tidy/meson.build @@ -0,0 +1,3 @@ +project('clangtidytest', 'cpp', default_options: 'cpp_std=c++14') + +executable('cttest', 'cttest.cpp') diff --git a/test cases/unit/69 test env value/meson.build b/test cases/unit/69 test env value/meson.build deleted file mode 100644 index aa3dbc3..0000000 --- a/test cases/unit/69 test env value/meson.build +++ /dev/null @@ -1,10 +0,0 @@ -project('test env value') - -testpy = find_program('test.py') - -val = ['1', '2', '3'] -foreach v: val - test('check env', testpy, args: [v], env: {'TEST_VAR': v}) -endforeach -test('check env', testpy, args: ['4'], env: environment({'TEST_VAR': '4'})) -test('check env', testpy, args: ['5'], env: environment(['TEST_VAR=5'])) diff --git a/test cases/unit/69 test env value/test.py b/test cases/unit/69 test env value/test.py deleted file mode 100755 index 0cc7645..0000000 --- a/test cases/unit/69 test env value/test.py +++ /dev/null @@ -1,6 +0,0 @@ -#!/usr/bin/env python3 - -import os -import sys - -assert(os.environ['TEST_VAR'] == sys.argv[1]) diff --git a/test cases/unit/70 clang-tidy/.clang-tidy b/test cases/unit/70 clang-tidy/.clang-tidy deleted file mode 100644 index 3935294..0000000 --- a/test cases/unit/70 clang-tidy/.clang-tidy +++ /dev/null @@ -1 +0,0 @@ -Checks: '-*,modernize-use-bool-literals' diff --git a/test cases/unit/70 clang-tidy/cttest.cpp b/test cases/unit/70 clang-tidy/cttest.cpp deleted file mode 100644 index 07b35a6..0000000 --- a/test cases/unit/70 clang-tidy/cttest.cpp +++ /dev/null @@ -1,7 +0,0 @@ -#include - -int main(int, char**) { - bool intbool = 1; - printf("Intbool is %d\n", (int)intbool); - return 0; -} diff --git a/test cases/unit/70 clang-tidy/dummydir.h/dummy.dat b/test cases/unit/70 clang-tidy/dummydir.h/dummy.dat deleted file mode 100644 index 80c6165..0000000 --- a/test cases/unit/70 clang-tidy/dummydir.h/dummy.dat +++ /dev/null @@ -1 +0,0 @@ -Placeholder to track enclosing directory in git. Not to be analyzed. diff --git a/test cases/unit/70 clang-tidy/meson.build b/test cases/unit/70 clang-tidy/meson.build deleted file mode 100644 index 737474b..0000000 --- a/test cases/unit/70 clang-tidy/meson.build +++ /dev/null @@ -1,3 +0,0 @@ -project('clangtidytest', 'cpp', default_options: 'cpp_std=c++14') - -executable('cttest', 'cttest.cpp') diff --git a/test cases/unit/70 cross/crossfile.in b/test cases/unit/70 cross/crossfile.in new file mode 100644 index 0000000..678e8d3 --- /dev/null +++ b/test cases/unit/70 cross/crossfile.in @@ -0,0 +1,5 @@ +[host_machine] +system = '@system@' +cpu_family = '@cpu_family@' +cpu = '@cpu@' +endian = '@endian@' diff --git a/test cases/unit/70 cross/meson.build b/test cases/unit/70 cross/meson.build new file mode 100644 index 0000000..6c85cf7 --- /dev/null +++ b/test cases/unit/70 cross/meson.build @@ -0,0 +1,16 @@ +project('crosstest') + +if get_option('generate') + conf_data = configuration_data() + conf_data.set('system', build_machine.system()) + conf_data.set('cpu', build_machine.cpu()) + conf_data.set('cpu_family', build_machine.cpu_family()) + conf_data.set('endian', build_machine.endian()) + + configure_file(input: 'crossfile.in', + output: 'crossfile', + configuration: conf_data) + message('Written cross file') +else + assert(meson.is_cross_build(), 'not setup as cross build') +endif diff --git a/test cases/unit/70 cross/meson_options.txt b/test cases/unit/70 cross/meson_options.txt new file mode 100644 index 0000000..5896d63 --- /dev/null +++ b/test cases/unit/70 cross/meson_options.txt @@ -0,0 +1 @@ +option('generate', type : 'boolean', value : false) diff --git a/test cases/unit/71 cross test passed/exewrapper.py b/test cases/unit/71 cross test passed/exewrapper.py new file mode 100755 index 0000000..2c15ed6 --- /dev/null +++ b/test cases/unit/71 cross test passed/exewrapper.py @@ -0,0 +1,24 @@ +#!/usr/bin/env python3 +# Test that the MESON_EXE_WRAPPER environment variable is set + +import argparse +import os +import sys + + +def main(): + parser = argparse.ArgumentParser() + parser.add_argument('binary') # unused, but needed for test behavior + parser.add_argument('--expected', action='store_true') + args = parser.parse_args() + + defined = 'MESON_EXE_WRAPPER' in os.environ + + if args.expected != defined: + print(os.environ, file=sys.stderr) + return 1 + return 0 + + +if __name__ == "__main__": + sys.exit(main()) diff --git a/test cases/unit/71 cross test passed/meson.build b/test cases/unit/71 cross test passed/meson.build new file mode 100644 index 0000000..4deb74b --- /dev/null +++ b/test cases/unit/71 cross test passed/meson.build @@ -0,0 +1,19 @@ +project( + 'cross test passed', + 'c', + version : '>= 0.51' +) + +e = executable('exec', 'src/main.c') + +py = import('python').find_installation() + +test('root', e) +test('main', py, args : [meson.current_source_dir() / 'script.py', e]) + +wrapper_args = [] +if get_option('expect') + wrapper_args += '--expected' +endif + +test('exe_wrapper in env', py, args : [meson.current_source_dir() / 'exewrapper.py', e, wrapper_args]) diff --git a/test cases/unit/71 cross test passed/meson_options.txt b/test cases/unit/71 cross test passed/meson_options.txt new file mode 100644 index 0000000..084c776 --- /dev/null +++ b/test cases/unit/71 cross test passed/meson_options.txt @@ -0,0 +1,5 @@ +option( + 'expect', + type : 'boolean', + value : false, +) diff --git a/test cases/unit/71 cross test passed/script.py b/test cases/unit/71 cross test passed/script.py new file mode 100644 index 0000000..257cd30 --- /dev/null +++ b/test cases/unit/71 cross test passed/script.py @@ -0,0 +1,7 @@ +#!/usr/bin/env python3 + +import subprocess +import sys + +if __name__ == "__main__": + sys.exit(subprocess.run(sys.argv[1:]).returncode) diff --git a/test cases/unit/71 cross test passed/src/main.c b/test cases/unit/71 cross test passed/src/main.c new file mode 100644 index 0000000..490b4a6 --- /dev/null +++ b/test cases/unit/71 cross test passed/src/main.c @@ -0,0 +1,6 @@ +#include + +int main(int argc, char const *argv[]) +{ + return 0; +} diff --git a/test cases/unit/71 cross/crossfile.in b/test cases/unit/71 cross/crossfile.in deleted file mode 100644 index 678e8d3..0000000 --- a/test cases/unit/71 cross/crossfile.in +++ /dev/null @@ -1,5 +0,0 @@ -[host_machine] -system = '@system@' -cpu_family = '@cpu_family@' -cpu = '@cpu@' -endian = '@endian@' diff --git a/test cases/unit/71 cross/meson.build b/test cases/unit/71 cross/meson.build deleted file mode 100644 index 6c85cf7..0000000 --- a/test cases/unit/71 cross/meson.build +++ /dev/null @@ -1,16 +0,0 @@ -project('crosstest') - -if get_option('generate') - conf_data = configuration_data() - conf_data.set('system', build_machine.system()) - conf_data.set('cpu', build_machine.cpu()) - conf_data.set('cpu_family', build_machine.cpu_family()) - conf_data.set('endian', build_machine.endian()) - - configure_file(input: 'crossfile.in', - output: 'crossfile', - configuration: conf_data) - message('Written cross file') -else - assert(meson.is_cross_build(), 'not setup as cross build') -endif diff --git a/test cases/unit/71 cross/meson_options.txt b/test cases/unit/71 cross/meson_options.txt deleted file mode 100644 index 5896d63..0000000 --- a/test cases/unit/71 cross/meson_options.txt +++ /dev/null @@ -1 +0,0 @@ -option('generate', type : 'boolean', value : false) diff --git a/test cases/unit/72 cross test passed/exewrapper.py b/test cases/unit/72 cross test passed/exewrapper.py deleted file mode 100755 index 2c15ed6..0000000 --- a/test cases/unit/72 cross test passed/exewrapper.py +++ /dev/null @@ -1,24 +0,0 @@ -#!/usr/bin/env python3 -# Test that the MESON_EXE_WRAPPER environment variable is set - -import argparse -import os -import sys - - -def main(): - parser = argparse.ArgumentParser() - parser.add_argument('binary') # unused, but needed for test behavior - parser.add_argument('--expected', action='store_true') - args = parser.parse_args() - - defined = 'MESON_EXE_WRAPPER' in os.environ - - if args.expected != defined: - print(os.environ, file=sys.stderr) - return 1 - return 0 - - -if __name__ == "__main__": - sys.exit(main()) diff --git a/test cases/unit/72 cross test passed/meson.build b/test cases/unit/72 cross test passed/meson.build deleted file mode 100644 index 4deb74b..0000000 --- a/test cases/unit/72 cross test passed/meson.build +++ /dev/null @@ -1,19 +0,0 @@ -project( - 'cross test passed', - 'c', - version : '>= 0.51' -) - -e = executable('exec', 'src/main.c') - -py = import('python').find_installation() - -test('root', e) -test('main', py, args : [meson.current_source_dir() / 'script.py', e]) - -wrapper_args = [] -if get_option('expect') - wrapper_args += '--expected' -endif - -test('exe_wrapper in env', py, args : [meson.current_source_dir() / 'exewrapper.py', e, wrapper_args]) diff --git a/test cases/unit/72 cross test passed/meson_options.txt b/test cases/unit/72 cross test passed/meson_options.txt deleted file mode 100644 index 084c776..0000000 --- a/test cases/unit/72 cross test passed/meson_options.txt +++ /dev/null @@ -1,5 +0,0 @@ -option( - 'expect', - type : 'boolean', - value : false, -) diff --git a/test cases/unit/72 cross test passed/script.py b/test cases/unit/72 cross test passed/script.py deleted file mode 100644 index 257cd30..0000000 --- a/test cases/unit/72 cross test passed/script.py +++ /dev/null @@ -1,7 +0,0 @@ -#!/usr/bin/env python3 - -import subprocess -import sys - -if __name__ == "__main__": - sys.exit(subprocess.run(sys.argv[1:]).returncode) diff --git a/test cases/unit/72 cross test passed/src/main.c b/test cases/unit/72 cross test passed/src/main.c deleted file mode 100644 index 490b4a6..0000000 --- a/test cases/unit/72 cross test passed/src/main.c +++ /dev/null @@ -1,6 +0,0 @@ -#include - -int main(int argc, char const *argv[]) -{ - return 0; -} diff --git a/test cases/unit/72 summary/meson.build b/test cases/unit/72 summary/meson.build new file mode 100644 index 0000000..4205d6f --- /dev/null +++ b/test cases/unit/72 summary/meson.build @@ -0,0 +1,22 @@ +project('My Project', version : '1.0') + +subproject('sub') +subproject('sub2', required : false) + +summary({'Some boolean': false, + 'Another boolean': true, + 'Some string': 'Hello World', + 'A list': ['string', 1, true], + 'empty list': [], + 'enabled_opt': get_option('enabled_opt'), + }, section: 'Configuration') +summary({'missing prog': find_program('xyzzy', required: false), + 'existing prog': import('python').find_installation(), + 'missing dep': dependency('', required: false), + 'internal dep': declare_dependency(), + }, section: 'Stuff') +summary('A number', 1, section: 'Configuration') +summary('yes', true, bool_yn : true, section: 'Configuration') +summary('no', false, bool_yn : true, section: 'Configuration') +summary('coma list', ['a', 'b', 'c'], list_sep: ', ', section: 'Configuration') +summary('long coma list', ['alpha', 'alphacolor', 'apetag', 'audiofx', 'audioparsers', 'auparse', 'autodetect', 'avi'], list_sep: ', ', section: 'Plugins') diff --git a/test cases/unit/72 summary/meson_options.txt b/test cases/unit/72 summary/meson_options.txt new file mode 100644 index 0000000..f2c41f8 --- /dev/null +++ b/test cases/unit/72 summary/meson_options.txt @@ -0,0 +1 @@ +option('enabled_opt', type: 'feature', value: 'enabled') diff --git a/test cases/unit/72 summary/subprojects/sub/meson.build b/test cases/unit/72 summary/subprojects/sub/meson.build new file mode 100644 index 0000000..e7d7833 --- /dev/null +++ b/test cases/unit/72 summary/subprojects/sub/meson.build @@ -0,0 +1,4 @@ +project('Some Subproject', version : '2.0') + +summary('string', 'bar') +summary({'integer': 1, 'boolean': true}) diff --git a/test cases/unit/72 summary/subprojects/sub2/meson.build b/test cases/unit/72 summary/subprojects/sub2/meson.build new file mode 100644 index 0000000..86b9cfd --- /dev/null +++ b/test cases/unit/72 summary/subprojects/sub2/meson.build @@ -0,0 +1,5 @@ +project('sub2') + +error('This subproject failed') + +summary('Section', 'Should not be seen') diff --git a/test cases/unit/73 summary/meson.build b/test cases/unit/73 summary/meson.build deleted file mode 100644 index 4205d6f..0000000 --- a/test cases/unit/73 summary/meson.build +++ /dev/null @@ -1,22 +0,0 @@ -project('My Project', version : '1.0') - -subproject('sub') -subproject('sub2', required : false) - -summary({'Some boolean': false, - 'Another boolean': true, - 'Some string': 'Hello World', - 'A list': ['string', 1, true], - 'empty list': [], - 'enabled_opt': get_option('enabled_opt'), - }, section: 'Configuration') -summary({'missing prog': find_program('xyzzy', required: false), - 'existing prog': import('python').find_installation(), - 'missing dep': dependency('', required: false), - 'internal dep': declare_dependency(), - }, section: 'Stuff') -summary('A number', 1, section: 'Configuration') -summary('yes', true, bool_yn : true, section: 'Configuration') -summary('no', false, bool_yn : true, section: 'Configuration') -summary('coma list', ['a', 'b', 'c'], list_sep: ', ', section: 'Configuration') -summary('long coma list', ['alpha', 'alphacolor', 'apetag', 'audiofx', 'audioparsers', 'auparse', 'autodetect', 'avi'], list_sep: ', ', section: 'Plugins') diff --git a/test cases/unit/73 summary/meson_options.txt b/test cases/unit/73 summary/meson_options.txt deleted file mode 100644 index f2c41f8..0000000 --- a/test cases/unit/73 summary/meson_options.txt +++ /dev/null @@ -1 +0,0 @@ -option('enabled_opt', type: 'feature', value: 'enabled') diff --git a/test cases/unit/73 summary/subprojects/sub/meson.build b/test cases/unit/73 summary/subprojects/sub/meson.build deleted file mode 100644 index e7d7833..0000000 --- a/test cases/unit/73 summary/subprojects/sub/meson.build +++ /dev/null @@ -1,4 +0,0 @@ -project('Some Subproject', version : '2.0') - -summary('string', 'bar') -summary({'integer': 1, 'boolean': true}) diff --git a/test cases/unit/73 summary/subprojects/sub2/meson.build b/test cases/unit/73 summary/subprojects/sub2/meson.build deleted file mode 100644 index 86b9cfd..0000000 --- a/test cases/unit/73 summary/subprojects/sub2/meson.build +++ /dev/null @@ -1,5 +0,0 @@ -project('sub2') - -error('This subproject failed') - -summary('Section', 'Should not be seen') diff --git a/test cases/unit/73 wrap file url/meson.build b/test cases/unit/73 wrap file url/meson.build new file mode 100644 index 0000000..3bd3b25 --- /dev/null +++ b/test cases/unit/73 wrap file url/meson.build @@ -0,0 +1,4 @@ +project('test wrap with file url') + +exe = subproject('foo').get_variable('foo_exe') +test('test1', exe) diff --git a/test cases/unit/73 wrap file url/subprojects/foo-patch.tar.xz b/test cases/unit/73 wrap file url/subprojects/foo-patch.tar.xz new file mode 100644 index 0000000..fdb026c Binary files /dev/null and b/test cases/unit/73 wrap file url/subprojects/foo-patch.tar.xz differ diff --git a/test cases/unit/73 wrap file url/subprojects/foo.tar.xz b/test cases/unit/73 wrap file url/subprojects/foo.tar.xz new file mode 100644 index 0000000..2ed6ab4 Binary files /dev/null and b/test cases/unit/73 wrap file url/subprojects/foo.tar.xz differ diff --git a/test cases/unit/74 dep files/foo.c b/test cases/unit/74 dep files/foo.c new file mode 100644 index 0000000..e69de29 diff --git a/test cases/unit/74 dep files/meson.build b/test cases/unit/74 dep files/meson.build new file mode 100644 index 0000000..4829f56 --- /dev/null +++ b/test cases/unit/74 dep files/meson.build @@ -0,0 +1,16 @@ +project('test', 'c') + +python = import('python').find_installation() + +lib = library('foo', 'foo.c') + +# The library does not yet exist but we can already use its path during +# configuration. This should not trigger a reconfigure when the library is +# rebuilt. +configure_file( + output: 'out.txt', + capture: true, + command: [python, '-c', 'import sys; print(sys.argv[1])', lib.full_path()], +) + +message('Project configured') diff --git a/test cases/unit/74 wrap file url/meson.build b/test cases/unit/74 wrap file url/meson.build deleted file mode 100644 index 3bd3b25..0000000 --- a/test cases/unit/74 wrap file url/meson.build +++ /dev/null @@ -1,4 +0,0 @@ -project('test wrap with file url') - -exe = subproject('foo').get_variable('foo_exe') -test('test1', exe) diff --git a/test cases/unit/74 wrap file url/subprojects/foo-patch.tar.xz b/test cases/unit/74 wrap file url/subprojects/foo-patch.tar.xz deleted file mode 100644 index fdb026c..0000000 Binary files a/test cases/unit/74 wrap file url/subprojects/foo-patch.tar.xz and /dev/null differ diff --git a/test cases/unit/74 wrap file url/subprojects/foo.tar.xz b/test cases/unit/74 wrap file url/subprojects/foo.tar.xz deleted file mode 100644 index 2ed6ab4..0000000 Binary files a/test cases/unit/74 wrap file url/subprojects/foo.tar.xz and /dev/null differ diff --git a/test cases/unit/75 dep files/foo.c b/test cases/unit/75 dep files/foo.c deleted file mode 100644 index e69de29..0000000 diff --git a/test cases/unit/75 dep files/meson.build b/test cases/unit/75 dep files/meson.build deleted file mode 100644 index 4829f56..0000000 --- a/test cases/unit/75 dep files/meson.build +++ /dev/null @@ -1,16 +0,0 @@ -project('test', 'c') - -python = import('python').find_installation() - -lib = library('foo', 'foo.c') - -# The library does not yet exist but we can already use its path during -# configuration. This should not trigger a reconfigure when the library is -# rebuilt. -configure_file( - output: 'out.txt', - capture: true, - command: [python, '-c', 'import sys; print(sys.argv[1])', lib.full_path()], -) - -message('Project configured') diff --git a/test cases/unit/75 pkgconfig prefixes/client/client.c b/test cases/unit/75 pkgconfig prefixes/client/client.c new file mode 100644 index 0000000..be9bead --- /dev/null +++ b/test cases/unit/75 pkgconfig prefixes/client/client.c @@ -0,0 +1,8 @@ +#include +#include + +int main(int argc, char **argv) +{ + printf("%d\n", val2()); + return 0; +} diff --git a/test cases/unit/75 pkgconfig prefixes/client/meson.build b/test cases/unit/75 pkgconfig prefixes/client/meson.build new file mode 100644 index 0000000..491937b --- /dev/null +++ b/test cases/unit/75 pkgconfig prefixes/client/meson.build @@ -0,0 +1,3 @@ +project('client', 'c') +val2_dep = dependency('val2') +executable('client', 'client.c', dependencies : [val2_dep], install: true) diff --git a/test cases/unit/75 pkgconfig prefixes/val1/meson.build b/test cases/unit/75 pkgconfig prefixes/val1/meson.build new file mode 100644 index 0000000..cc63e31 --- /dev/null +++ b/test cases/unit/75 pkgconfig prefixes/val1/meson.build @@ -0,0 +1,5 @@ +project('val1', 'c') +val1 = shared_library('val1', 'val1.c', install: true) +install_headers('val1.h') +pkgconfig = import('pkgconfig') +pkgconfig.generate(val1, libraries : ['-Wl,-rpath,${libdir}']) diff --git a/test cases/unit/75 pkgconfig prefixes/val1/val1.c b/test cases/unit/75 pkgconfig prefixes/val1/val1.c new file mode 100644 index 0000000..591e521 --- /dev/null +++ b/test cases/unit/75 pkgconfig prefixes/val1/val1.c @@ -0,0 +1,3 @@ +#include "val1.h" + +int val1(void) { return 1; } diff --git a/test cases/unit/75 pkgconfig prefixes/val1/val1.h b/test cases/unit/75 pkgconfig prefixes/val1/val1.h new file mode 100644 index 0000000..6bd435e --- /dev/null +++ b/test cases/unit/75 pkgconfig prefixes/val1/val1.h @@ -0,0 +1 @@ +int val1(void); diff --git a/test cases/unit/75 pkgconfig prefixes/val2/meson.build b/test cases/unit/75 pkgconfig prefixes/val2/meson.build new file mode 100644 index 0000000..ce69481 --- /dev/null +++ b/test cases/unit/75 pkgconfig prefixes/val2/meson.build @@ -0,0 +1,8 @@ +project('val2', 'c') +val1_dep = dependency('val1') +val2 = shared_library('val2', 'val2.c', + dependencies : [val1_dep], + install: true) +install_headers('val2.h') +pkgconfig = import('pkgconfig') +pkgconfig.generate(val2, libraries : ['-Wl,-rpath,${libdir}']) diff --git a/test cases/unit/75 pkgconfig prefixes/val2/val2.c b/test cases/unit/75 pkgconfig prefixes/val2/val2.c new file mode 100644 index 0000000..d7d4857 --- /dev/null +++ b/test cases/unit/75 pkgconfig prefixes/val2/val2.c @@ -0,0 +1,4 @@ +#include "val1.h" +#include "val2.h" + +int val2(void) { return val1() + 2; } diff --git a/test cases/unit/75 pkgconfig prefixes/val2/val2.h b/test cases/unit/75 pkgconfig prefixes/val2/val2.h new file mode 100644 index 0000000..995023d --- /dev/null +++ b/test cases/unit/75 pkgconfig prefixes/val2/val2.h @@ -0,0 +1 @@ +int val2(void); diff --git a/test cases/unit/76 pkgconfig prefixes/client/client.c b/test cases/unit/76 pkgconfig prefixes/client/client.c deleted file mode 100644 index be9bead..0000000 --- a/test cases/unit/76 pkgconfig prefixes/client/client.c +++ /dev/null @@ -1,8 +0,0 @@ -#include -#include - -int main(int argc, char **argv) -{ - printf("%d\n", val2()); - return 0; -} diff --git a/test cases/unit/76 pkgconfig prefixes/client/meson.build b/test cases/unit/76 pkgconfig prefixes/client/meson.build deleted file mode 100644 index 491937b..0000000 --- a/test cases/unit/76 pkgconfig prefixes/client/meson.build +++ /dev/null @@ -1,3 +0,0 @@ -project('client', 'c') -val2_dep = dependency('val2') -executable('client', 'client.c', dependencies : [val2_dep], install: true) diff --git a/test cases/unit/76 pkgconfig prefixes/val1/meson.build b/test cases/unit/76 pkgconfig prefixes/val1/meson.build deleted file mode 100644 index cc63e31..0000000 --- a/test cases/unit/76 pkgconfig prefixes/val1/meson.build +++ /dev/null @@ -1,5 +0,0 @@ -project('val1', 'c') -val1 = shared_library('val1', 'val1.c', install: true) -install_headers('val1.h') -pkgconfig = import('pkgconfig') -pkgconfig.generate(val1, libraries : ['-Wl,-rpath,${libdir}']) diff --git a/test cases/unit/76 pkgconfig prefixes/val1/val1.c b/test cases/unit/76 pkgconfig prefixes/val1/val1.c deleted file mode 100644 index 591e521..0000000 --- a/test cases/unit/76 pkgconfig prefixes/val1/val1.c +++ /dev/null @@ -1,3 +0,0 @@ -#include "val1.h" - -int val1(void) { return 1; } diff --git a/test cases/unit/76 pkgconfig prefixes/val1/val1.h b/test cases/unit/76 pkgconfig prefixes/val1/val1.h deleted file mode 100644 index 6bd435e..0000000 --- a/test cases/unit/76 pkgconfig prefixes/val1/val1.h +++ /dev/null @@ -1 +0,0 @@ -int val1(void); diff --git a/test cases/unit/76 pkgconfig prefixes/val2/meson.build b/test cases/unit/76 pkgconfig prefixes/val2/meson.build deleted file mode 100644 index ce69481..0000000 --- a/test cases/unit/76 pkgconfig prefixes/val2/meson.build +++ /dev/null @@ -1,8 +0,0 @@ -project('val2', 'c') -val1_dep = dependency('val1') -val2 = shared_library('val2', 'val2.c', - dependencies : [val1_dep], - install: true) -install_headers('val2.h') -pkgconfig = import('pkgconfig') -pkgconfig.generate(val2, libraries : ['-Wl,-rpath,${libdir}']) diff --git a/test cases/unit/76 pkgconfig prefixes/val2/val2.c b/test cases/unit/76 pkgconfig prefixes/val2/val2.c deleted file mode 100644 index d7d4857..0000000 --- a/test cases/unit/76 pkgconfig prefixes/val2/val2.c +++ /dev/null @@ -1,4 +0,0 @@ -#include "val1.h" -#include "val2.h" - -int val2(void) { return val1() + 2; } diff --git a/test cases/unit/76 pkgconfig prefixes/val2/val2.h b/test cases/unit/76 pkgconfig prefixes/val2/val2.h deleted file mode 100644 index 995023d..0000000 --- a/test cases/unit/76 pkgconfig prefixes/val2/val2.h +++ /dev/null @@ -1 +0,0 @@ -int val2(void); diff --git a/test cases/unit/76 subdir libdir/meson.build b/test cases/unit/76 subdir libdir/meson.build new file mode 100644 index 0000000..5099c91 --- /dev/null +++ b/test cases/unit/76 subdir libdir/meson.build @@ -0,0 +1,2 @@ +project('toplevel', 'c') +subproject('flub') diff --git a/test cases/unit/76 subdir libdir/subprojects/flub/meson.build b/test cases/unit/76 subdir libdir/subprojects/flub/meson.build new file mode 100644 index 0000000..7bfd2c5 --- /dev/null +++ b/test cases/unit/76 subdir libdir/subprojects/flub/meson.build @@ -0,0 +1 @@ +project('subflub', 'c') diff --git a/test cases/unit/77 as link whole/bar.c b/test cases/unit/77 as link whole/bar.c new file mode 100644 index 0000000..79dea9d --- /dev/null +++ b/test cases/unit/77 as link whole/bar.c @@ -0,0 +1,6 @@ +int bar(void); + +int bar(void) +{ + return 0; +} diff --git a/test cases/unit/77 as link whole/foo.c b/test cases/unit/77 as link whole/foo.c new file mode 100644 index 0000000..ffeee82 --- /dev/null +++ b/test cases/unit/77 as link whole/foo.c @@ -0,0 +1,6 @@ +int foo(void); + +int foo(void) +{ + return 0; +} diff --git a/test cases/unit/77 as link whole/meson.build b/test cases/unit/77 as link whole/meson.build new file mode 100644 index 0000000..6bc208f --- /dev/null +++ b/test cases/unit/77 as link whole/meson.build @@ -0,0 +1,11 @@ +project('as-link-whole', 'c') + +foo = static_library('foo', 'foo.c', install: true) +dep = declare_dependency(link_with: foo) +bar1 = library('bar1', 'bar.c', dependencies: dep) +bar2 = library('bar2', 'bar.c', dependencies: dep.as_link_whole()) + +# bar1.pc should have -lfoo but not bar2.pc +pkg = import('pkgconfig') +pkg.generate(bar1) +pkg.generate(bar2) diff --git a/test cases/unit/77 subdir libdir/meson.build b/test cases/unit/77 subdir libdir/meson.build deleted file mode 100644 index 5099c91..0000000 --- a/test cases/unit/77 subdir libdir/meson.build +++ /dev/null @@ -1,2 +0,0 @@ -project('toplevel', 'c') -subproject('flub') diff --git a/test cases/unit/77 subdir libdir/subprojects/flub/meson.build b/test cases/unit/77 subdir libdir/subprojects/flub/meson.build deleted file mode 100644 index 7bfd2c5..0000000 --- a/test cases/unit/77 subdir libdir/subprojects/flub/meson.build +++ /dev/null @@ -1 +0,0 @@ -project('subflub', 'c') diff --git a/test cases/unit/78 as link whole/bar.c b/test cases/unit/78 as link whole/bar.c deleted file mode 100644 index 79dea9d..0000000 --- a/test cases/unit/78 as link whole/bar.c +++ /dev/null @@ -1,6 +0,0 @@ -int bar(void); - -int bar(void) -{ - return 0; -} diff --git a/test cases/unit/78 as link whole/foo.c b/test cases/unit/78 as link whole/foo.c deleted file mode 100644 index ffeee82..0000000 --- a/test cases/unit/78 as link whole/foo.c +++ /dev/null @@ -1,6 +0,0 @@ -int foo(void); - -int foo(void) -{ - return 0; -} diff --git a/test cases/unit/78 as link whole/meson.build b/test cases/unit/78 as link whole/meson.build deleted file mode 100644 index 6bc208f..0000000 --- a/test cases/unit/78 as link whole/meson.build +++ /dev/null @@ -1,11 +0,0 @@ -project('as-link-whole', 'c') - -foo = static_library('foo', 'foo.c', install: true) -dep = declare_dependency(link_with: foo) -bar1 = library('bar1', 'bar.c', dependencies: dep) -bar2 = library('bar2', 'bar.c', dependencies: dep.as_link_whole()) - -# bar1.pc should have -lfoo but not bar2.pc -pkg = import('pkgconfig') -pkg.generate(bar1) -pkg.generate(bar2) diff --git a/test cases/unit/78 nostdlib/meson.build b/test cases/unit/78 nostdlib/meson.build new file mode 100644 index 0000000..9c5f949 --- /dev/null +++ b/test cases/unit/78 nostdlib/meson.build @@ -0,0 +1,14 @@ +project('own libc', 'c') + +# Not related to this test, but could not find a better place for this test. +assert(meson.get_cross_property('nonexisting', 'defaultvalue') == 'defaultvalue', + 'Cross prop getting is broken.') + +# A simple project that uses its own libc. + +# Note that we don't need to specify anything, the flags to use +# stdlib come from the cross file. + +exe = executable('selfcontained', 'prog.c') + +test('standalone test', exe) diff --git a/test cases/unit/78 nostdlib/prog.c b/test cases/unit/78 nostdlib/prog.c new file mode 100644 index 0000000..b9216ee --- /dev/null +++ b/test cases/unit/78 nostdlib/prog.c @@ -0,0 +1,7 @@ + +#include + +int main(void) { + const char *message = "Hello without stdlib.\n"; + return simple_print(message, simple_strlen(message)); +} diff --git a/test cases/unit/78 nostdlib/subprojects/mylibc/libc.c b/test cases/unit/78 nostdlib/subprojects/mylibc/libc.c new file mode 100644 index 0000000..67261cb --- /dev/null +++ b/test cases/unit/78 nostdlib/subprojects/mylibc/libc.c @@ -0,0 +1,35 @@ +/* Do not use this as the basis of your own libc. + * The code is probably unoptimal or wonky, as I + * had no prior experience with this, but instead + * just fiddled with the code until it worked. + */ + +#include + +#define STDOUT 1 +#define SYS_WRITE 4 + +int simple_print(const char *msg, const long bufsize) { + int count; + long total_written = 0; + while(total_written < bufsize) { + asm( + "int $0x80\n\t" + : "=a"(count) + : "0"(SYS_WRITE), "b"(STDOUT), "c"(msg+total_written), "d"(bufsize-total_written) + :); + if(count == 0) { + return 1; + } + total_written += count; + } + return 0; +} + +int simple_strlen(const char *str) { + int len = 0; + while(str[len] != '\0') { + len++; + } + return len; +} diff --git a/test cases/unit/78 nostdlib/subprojects/mylibc/meson.build b/test cases/unit/78 nostdlib/subprojects/mylibc/meson.build new file mode 100644 index 0000000..ff4bdb2 --- /dev/null +++ b/test cases/unit/78 nostdlib/subprojects/mylibc/meson.build @@ -0,0 +1,13 @@ +project('own libc', 'c') + +# A very simple libc implementation + +# Do not specify -nostdlib & co. They come from cross specifications. + +libc = static_library('c', 'libc.c', 'stubstart.s') + +mylibc_dep = declare_dependency(link_with : libc, + include_directories : include_directories('.') +) + +meson.override_dependency('c_stdlib', mylibc_dep) diff --git a/test cases/unit/78 nostdlib/subprojects/mylibc/stdio.h b/test cases/unit/78 nostdlib/subprojects/mylibc/stdio.h new file mode 100644 index 0000000..c3f8f56 --- /dev/null +++ b/test cases/unit/78 nostdlib/subprojects/mylibc/stdio.h @@ -0,0 +1,5 @@ +#pragma once + +int simple_print(const char *msg, const long bufsize); + +int simple_strlen(const char *str); diff --git a/test cases/unit/78 nostdlib/subprojects/mylibc/stubstart.s b/test cases/unit/78 nostdlib/subprojects/mylibc/stubstart.s new file mode 100644 index 0000000..0a6d972 --- /dev/null +++ b/test cases/unit/78 nostdlib/subprojects/mylibc/stubstart.s @@ -0,0 +1,8 @@ +.globl _start + +_start: + + call main + movl %eax, %ebx + movl $1, %eax + int $0x80 diff --git a/test cases/unit/79 nostdlib/meson.build b/test cases/unit/79 nostdlib/meson.build deleted file mode 100644 index 9c5f949..0000000 --- a/test cases/unit/79 nostdlib/meson.build +++ /dev/null @@ -1,14 +0,0 @@ -project('own libc', 'c') - -# Not related to this test, but could not find a better place for this test. -assert(meson.get_cross_property('nonexisting', 'defaultvalue') == 'defaultvalue', - 'Cross prop getting is broken.') - -# A simple project that uses its own libc. - -# Note that we don't need to specify anything, the flags to use -# stdlib come from the cross file. - -exe = executable('selfcontained', 'prog.c') - -test('standalone test', exe) diff --git a/test cases/unit/79 nostdlib/prog.c b/test cases/unit/79 nostdlib/prog.c deleted file mode 100644 index b9216ee..0000000 --- a/test cases/unit/79 nostdlib/prog.c +++ /dev/null @@ -1,7 +0,0 @@ - -#include - -int main(void) { - const char *message = "Hello without stdlib.\n"; - return simple_print(message, simple_strlen(message)); -} diff --git a/test cases/unit/79 nostdlib/subprojects/mylibc/libc.c b/test cases/unit/79 nostdlib/subprojects/mylibc/libc.c deleted file mode 100644 index 67261cb..0000000 --- a/test cases/unit/79 nostdlib/subprojects/mylibc/libc.c +++ /dev/null @@ -1,35 +0,0 @@ -/* Do not use this as the basis of your own libc. - * The code is probably unoptimal or wonky, as I - * had no prior experience with this, but instead - * just fiddled with the code until it worked. - */ - -#include - -#define STDOUT 1 -#define SYS_WRITE 4 - -int simple_print(const char *msg, const long bufsize) { - int count; - long total_written = 0; - while(total_written < bufsize) { - asm( - "int $0x80\n\t" - : "=a"(count) - : "0"(SYS_WRITE), "b"(STDOUT), "c"(msg+total_written), "d"(bufsize-total_written) - :); - if(count == 0) { - return 1; - } - total_written += count; - } - return 0; -} - -int simple_strlen(const char *str) { - int len = 0; - while(str[len] != '\0') { - len++; - } - return len; -} diff --git a/test cases/unit/79 nostdlib/subprojects/mylibc/meson.build b/test cases/unit/79 nostdlib/subprojects/mylibc/meson.build deleted file mode 100644 index ff4bdb2..0000000 --- a/test cases/unit/79 nostdlib/subprojects/mylibc/meson.build +++ /dev/null @@ -1,13 +0,0 @@ -project('own libc', 'c') - -# A very simple libc implementation - -# Do not specify -nostdlib & co. They come from cross specifications. - -libc = static_library('c', 'libc.c', 'stubstart.s') - -mylibc_dep = declare_dependency(link_with : libc, - include_directories : include_directories('.') -) - -meson.override_dependency('c_stdlib', mylibc_dep) diff --git a/test cases/unit/79 nostdlib/subprojects/mylibc/stdio.h b/test cases/unit/79 nostdlib/subprojects/mylibc/stdio.h deleted file mode 100644 index c3f8f56..0000000 --- a/test cases/unit/79 nostdlib/subprojects/mylibc/stdio.h +++ /dev/null @@ -1,5 +0,0 @@ -#pragma once - -int simple_print(const char *msg, const long bufsize); - -int simple_strlen(const char *str); diff --git a/test cases/unit/79 nostdlib/subprojects/mylibc/stubstart.s b/test cases/unit/79 nostdlib/subprojects/mylibc/stubstart.s deleted file mode 100644 index 0a6d972..0000000 --- a/test cases/unit/79 nostdlib/subprojects/mylibc/stubstart.s +++ /dev/null @@ -1,8 +0,0 @@ -.globl _start - -_start: - - call main - movl %eax, %ebx - movl $1, %eax - int $0x80 diff --git a/test cases/unit/79 user options for subproject/.gitignore b/test cases/unit/79 user options for subproject/.gitignore new file mode 100644 index 0000000..0bec5ea --- /dev/null +++ b/test cases/unit/79 user options for subproject/.gitignore @@ -0,0 +1 @@ +/subprojects diff --git a/test cases/unit/79 user options for subproject/75 user options for subproject/.gitignore b/test cases/unit/79 user options for subproject/75 user options for subproject/.gitignore new file mode 100644 index 0000000..4976afc --- /dev/null +++ b/test cases/unit/79 user options for subproject/75 user options for subproject/.gitignore @@ -0,0 +1 @@ +subprojects/* diff --git a/test cases/unit/79 user options for subproject/75 user options for subproject/meson.build b/test cases/unit/79 user options for subproject/75 user options for subproject/meson.build new file mode 100644 index 0000000..0bc395b --- /dev/null +++ b/test cases/unit/79 user options for subproject/75 user options for subproject/meson.build @@ -0,0 +1,3 @@ +project('user option for subproject') + +p = subproject('sub') diff --git a/test cases/unit/80 global-rpath/meson.build b/test cases/unit/80 global-rpath/meson.build new file mode 100644 index 0000000..c67d9e0 --- /dev/null +++ b/test cases/unit/80 global-rpath/meson.build @@ -0,0 +1,3 @@ +project('global-rpath', 'cpp') +yonder_dep = dependency('yonder') +executable('rpathified', 'rpathified.cpp', dependencies: [yonder_dep], install: true) diff --git a/test cases/unit/80 global-rpath/rpathified.cpp b/test cases/unit/80 global-rpath/rpathified.cpp new file mode 100644 index 0000000..3788906 --- /dev/null +++ b/test cases/unit/80 global-rpath/rpathified.cpp @@ -0,0 +1,6 @@ +#include +#include +int main(int argc, char **argv) +{ + return strcmp(yonder(), "AB54 6BR"); +} diff --git a/test cases/unit/80 global-rpath/yonder/meson.build b/test cases/unit/80 global-rpath/yonder/meson.build new file mode 100644 index 0000000..e32f383 --- /dev/null +++ b/test cases/unit/80 global-rpath/yonder/meson.build @@ -0,0 +1,5 @@ +project('yonder', 'cpp') +yonder = shared_library('yonder', 'yonder.cpp', install: true) +install_headers('yonder.h') +pkgconfig = import('pkgconfig') +pkgconfig.generate(yonder) diff --git a/test cases/unit/80 global-rpath/yonder/yonder.cpp b/test cases/unit/80 global-rpath/yonder/yonder.cpp new file mode 100644 index 0000000..b182d34 --- /dev/null +++ b/test cases/unit/80 global-rpath/yonder/yonder.cpp @@ -0,0 +1,3 @@ +#include "yonder.h" + +char *yonder(void) { return "AB54 6BR"; } diff --git a/test cases/unit/80 global-rpath/yonder/yonder.h b/test cases/unit/80 global-rpath/yonder/yonder.h new file mode 100644 index 0000000..9d9ad16 --- /dev/null +++ b/test cases/unit/80 global-rpath/yonder/yonder.h @@ -0,0 +1 @@ +char *yonder(void); diff --git a/test cases/unit/80 user options for subproject/.gitignore b/test cases/unit/80 user options for subproject/.gitignore deleted file mode 100644 index 0bec5ea..0000000 --- a/test cases/unit/80 user options for subproject/.gitignore +++ /dev/null @@ -1 +0,0 @@ -/subprojects diff --git a/test cases/unit/80 user options for subproject/75 user options for subproject/.gitignore b/test cases/unit/80 user options for subproject/75 user options for subproject/.gitignore deleted file mode 100644 index 4976afc..0000000 --- a/test cases/unit/80 user options for subproject/75 user options for subproject/.gitignore +++ /dev/null @@ -1 +0,0 @@ -subprojects/* diff --git a/test cases/unit/80 user options for subproject/75 user options for subproject/meson.build b/test cases/unit/80 user options for subproject/75 user options for subproject/meson.build deleted file mode 100644 index 0bc395b..0000000 --- a/test cases/unit/80 user options for subproject/75 user options for subproject/meson.build +++ /dev/null @@ -1,3 +0,0 @@ -project('user option for subproject') - -p = subproject('sub') diff --git a/test cases/unit/81 global-rpath/meson.build b/test cases/unit/81 global-rpath/meson.build deleted file mode 100644 index c67d9e0..0000000 --- a/test cases/unit/81 global-rpath/meson.build +++ /dev/null @@ -1,3 +0,0 @@ -project('global-rpath', 'cpp') -yonder_dep = dependency('yonder') -executable('rpathified', 'rpathified.cpp', dependencies: [yonder_dep], install: true) diff --git a/test cases/unit/81 global-rpath/rpathified.cpp b/test cases/unit/81 global-rpath/rpathified.cpp deleted file mode 100644 index 3788906..0000000 --- a/test cases/unit/81 global-rpath/rpathified.cpp +++ /dev/null @@ -1,6 +0,0 @@ -#include -#include -int main(int argc, char **argv) -{ - return strcmp(yonder(), "AB54 6BR"); -} diff --git a/test cases/unit/81 global-rpath/yonder/meson.build b/test cases/unit/81 global-rpath/yonder/meson.build deleted file mode 100644 index e32f383..0000000 --- a/test cases/unit/81 global-rpath/yonder/meson.build +++ /dev/null @@ -1,5 +0,0 @@ -project('yonder', 'cpp') -yonder = shared_library('yonder', 'yonder.cpp', install: true) -install_headers('yonder.h') -pkgconfig = import('pkgconfig') -pkgconfig.generate(yonder) diff --git a/test cases/unit/81 global-rpath/yonder/yonder.cpp b/test cases/unit/81 global-rpath/yonder/yonder.cpp deleted file mode 100644 index b182d34..0000000 --- a/test cases/unit/81 global-rpath/yonder/yonder.cpp +++ /dev/null @@ -1,3 +0,0 @@ -#include "yonder.h" - -char *yonder(void) { return "AB54 6BR"; } diff --git a/test cases/unit/81 global-rpath/yonder/yonder.h b/test cases/unit/81 global-rpath/yonder/yonder.h deleted file mode 100644 index 9d9ad16..0000000 --- a/test cases/unit/81 global-rpath/yonder/yonder.h +++ /dev/null @@ -1 +0,0 @@ -char *yonder(void); diff --git a/test cases/unit/81 wrap-git/meson.build b/test cases/unit/81 wrap-git/meson.build new file mode 100644 index 0000000..b0af30a --- /dev/null +++ b/test cases/unit/81 wrap-git/meson.build @@ -0,0 +1,4 @@ +project('test-wrap-git') + +exe = subproject('wrap_git').get_variable('exe') +test('test1', exe) diff --git a/test cases/unit/81 wrap-git/subprojects/packagefiles/wrap_git_builddef/meson.build b/test cases/unit/81 wrap-git/subprojects/packagefiles/wrap_git_builddef/meson.build new file mode 100644 index 0000000..2570f77 --- /dev/null +++ b/test cases/unit/81 wrap-git/subprojects/packagefiles/wrap_git_builddef/meson.build @@ -0,0 +1,3 @@ +project('foo', 'c') + +exe = executable('app', 'main.c') diff --git a/test cases/unit/81 wrap-git/subprojects/wrap_git_upstream/main.c b/test cases/unit/81 wrap-git/subprojects/wrap_git_upstream/main.c new file mode 100644 index 0000000..8488f4e --- /dev/null +++ b/test cases/unit/81 wrap-git/subprojects/wrap_git_upstream/main.c @@ -0,0 +1,4 @@ +int main(void) +{ + return 0; +} diff --git a/test cases/unit/82 meson version compare/meson.build b/test cases/unit/82 meson version compare/meson.build new file mode 100644 index 0000000..ed69a8b --- /dev/null +++ b/test cases/unit/82 meson version compare/meson.build @@ -0,0 +1,17 @@ +project('version compare', meson_version: '>= 0.1') + +if meson.version().version_compare('>= 9999') + error('This should not be executed') +elif meson.version().version_compare('>= 0.55') and false + error('This should not be executed') +elif not meson.version().version_compare('>= 0.55') + error('This should not be executed') +elif meson.version().version_compare('>= 0.55') + # This Should not produce warning even when using function not available in + # meson 0.1. + foo_dep = declare_dependency() + meson.override_dependency('foo', foo_dep) +endif + +# This will error out if elif cause did not enter +assert(foo_dep.found(), 'meson.version_compare did not work') diff --git a/test cases/unit/82 wrap-git/meson.build b/test cases/unit/82 wrap-git/meson.build deleted file mode 100644 index b0af30a..0000000 --- a/test cases/unit/82 wrap-git/meson.build +++ /dev/null @@ -1,4 +0,0 @@ -project('test-wrap-git') - -exe = subproject('wrap_git').get_variable('exe') -test('test1', exe) diff --git a/test cases/unit/82 wrap-git/subprojects/packagefiles/wrap_git_builddef/meson.build b/test cases/unit/82 wrap-git/subprojects/packagefiles/wrap_git_builddef/meson.build deleted file mode 100644 index 2570f77..0000000 --- a/test cases/unit/82 wrap-git/subprojects/packagefiles/wrap_git_builddef/meson.build +++ /dev/null @@ -1,3 +0,0 @@ -project('foo', 'c') - -exe = executable('app', 'main.c') diff --git a/test cases/unit/82 wrap-git/subprojects/wrap_git_upstream/main.c b/test cases/unit/82 wrap-git/subprojects/wrap_git_upstream/main.c deleted file mode 100644 index 8488f4e..0000000 --- a/test cases/unit/82 wrap-git/subprojects/wrap_git_upstream/main.c +++ /dev/null @@ -1,4 +0,0 @@ -int main(void) -{ - return 0; -} diff --git a/test cases/unit/83 cross only introspect/meson.build b/test cases/unit/83 cross only introspect/meson.build new file mode 100644 index 0000000..ed25441 --- /dev/null +++ b/test cases/unit/83 cross only introspect/meson.build @@ -0,0 +1,2 @@ +project('cross only introspect') +add_languages('c', native: false) diff --git a/test cases/unit/83 meson version compare/meson.build b/test cases/unit/83 meson version compare/meson.build deleted file mode 100644 index ed69a8b..0000000 --- a/test cases/unit/83 meson version compare/meson.build +++ /dev/null @@ -1,17 +0,0 @@ -project('version compare', meson_version: '>= 0.1') - -if meson.version().version_compare('>= 9999') - error('This should not be executed') -elif meson.version().version_compare('>= 0.55') and false - error('This should not be executed') -elif not meson.version().version_compare('>= 0.55') - error('This should not be executed') -elif meson.version().version_compare('>= 0.55') - # This Should not produce warning even when using function not available in - # meson 0.1. - foo_dep = declare_dependency() - meson.override_dependency('foo', foo_dep) -endif - -# This will error out if elif cause did not enter -assert(foo_dep.found(), 'meson.version_compare did not work') diff --git a/test cases/unit/84 change option choices/meson.build b/test cases/unit/84 change option choices/meson.build new file mode 100644 index 0000000..d056d65 --- /dev/null +++ b/test cases/unit/84 change option choices/meson.build @@ -0,0 +1 @@ +project('change option choices') diff --git a/test cases/unit/84 change option choices/meson_options.1.txt b/test cases/unit/84 change option choices/meson_options.1.txt new file mode 100644 index 0000000..d0326a5 --- /dev/null +++ b/test cases/unit/84 change option choices/meson_options.1.txt @@ -0,0 +1,13 @@ +option( + 'combo', + type : 'combo', + choices : ['a', 'b', 'c'], + value : 'a', +) + +option( + 'array', + type : 'array', + choices : ['a', 'b', 'c'], + value : ['a'], +) diff --git a/test cases/unit/84 change option choices/meson_options.2.txt b/test cases/unit/84 change option choices/meson_options.2.txt new file mode 100644 index 0000000..4684673 --- /dev/null +++ b/test cases/unit/84 change option choices/meson_options.2.txt @@ -0,0 +1,13 @@ +option( + 'combo', + type : 'combo', + choices : ['b', 'c', 'd'], + value : 'b', +) + +option( + 'array', + type : 'array', + choices : ['b', 'c', 'd'], + value : ['b'], +) diff --git a/test cases/unit/84 cross only introspect/meson.build b/test cases/unit/84 cross only introspect/meson.build deleted file mode 100644 index ed25441..0000000 --- a/test cases/unit/84 cross only introspect/meson.build +++ /dev/null @@ -1,2 +0,0 @@ -project('cross only introspect') -add_languages('c', native: false) diff --git a/test cases/unit/85 change option choices/meson.build b/test cases/unit/85 change option choices/meson.build deleted file mode 100644 index d056d65..0000000 --- a/test cases/unit/85 change option choices/meson.build +++ /dev/null @@ -1 +0,0 @@ -project('change option choices') diff --git a/test cases/unit/85 change option choices/meson_options.1.txt b/test cases/unit/85 change option choices/meson_options.1.txt deleted file mode 100644 index d0326a5..0000000 --- a/test cases/unit/85 change option choices/meson_options.1.txt +++ /dev/null @@ -1,13 +0,0 @@ -option( - 'combo', - type : 'combo', - choices : ['a', 'b', 'c'], - value : 'a', -) - -option( - 'array', - type : 'array', - choices : ['a', 'b', 'c'], - value : ['a'], -) diff --git a/test cases/unit/85 change option choices/meson_options.2.txt b/test cases/unit/85 change option choices/meson_options.2.txt deleted file mode 100644 index 4684673..0000000 --- a/test cases/unit/85 change option choices/meson_options.2.txt +++ /dev/null @@ -1,13 +0,0 @@ -option( - 'combo', - type : 'combo', - choices : ['b', 'c', 'd'], - value : 'b', -) - -option( - 'array', - type : 'array', - choices : ['b', 'c', 'd'], - value : ['b'], -) diff --git a/test cases/unit/85 nested subproject regenerate depends/main.c b/test cases/unit/85 nested subproject regenerate depends/main.c new file mode 100644 index 0000000..9b6bdc2 --- /dev/null +++ b/test cases/unit/85 nested subproject regenerate depends/main.c @@ -0,0 +1,3 @@ +int main(void) { + return 0; +} diff --git a/test cases/unit/85 nested subproject regenerate depends/meson.build b/test cases/unit/85 nested subproject regenerate depends/meson.build new file mode 100644 index 0000000..5698881 --- /dev/null +++ b/test cases/unit/85 nested subproject regenerate depends/meson.build @@ -0,0 +1,6 @@ +project('nested subproject regenerate depends', 'c') + +s = subproject('sub1') + +# This is needed to make msbuild noop check work correctly +executable('exe', 'main.c') diff --git a/test cases/unit/85 nested subproject regenerate depends/subprojects/sub1/meson.build b/test cases/unit/85 nested subproject regenerate depends/subprojects/sub1/meson.build new file mode 100644 index 0000000..a31db4a --- /dev/null +++ b/test cases/unit/85 nested subproject regenerate depends/subprojects/sub1/meson.build @@ -0,0 +1,4 @@ +project('sub1') + +cmake = import('cmake') +cmake.subproject('sub2') diff --git a/test cases/unit/85 nested subproject regenerate depends/subprojects/sub2/CMakeLists.txt b/test cases/unit/85 nested subproject regenerate depends/subprojects/sub2/CMakeLists.txt new file mode 100644 index 0000000..f91473a --- /dev/null +++ b/test cases/unit/85 nested subproject regenerate depends/subprojects/sub2/CMakeLists.txt @@ -0,0 +1 @@ +project(sub2) diff --git a/test cases/unit/86 cpp modules/main.cpp b/test cases/unit/86 cpp modules/main.cpp new file mode 100644 index 0000000..d825c7d --- /dev/null +++ b/test cases/unit/86 cpp modules/main.cpp @@ -0,0 +1,7 @@ +import M0; +#include + +int main() { + printf("The value is %d", func0()); + return 0; +} diff --git a/test cases/unit/86 cpp modules/meson.build b/test cases/unit/86 cpp modules/meson.build new file mode 100644 index 0000000..cdc296f --- /dev/null +++ b/test cases/unit/86 cpp modules/meson.build @@ -0,0 +1,17 @@ +project('cppmodules', 'cpp', default_options: ['cpp_std=c++latest']) + +e = executable('modtest', + 'main.cpp', + 'src0.ixx', + 'src1.ixx', + 'src2.ixx', + 'src3.ixx', + 'src4.ixx', + 'src5.ixx', + 'src6.ixx', + 'src7.ixx', + 'src8.ixx', + 'src9.ixx', + ) + +test('modtest', e) diff --git a/test cases/unit/86 cpp modules/src0.ixx b/test cases/unit/86 cpp modules/src0.ixx new file mode 100644 index 0000000..3ca4d14 --- /dev/null +++ b/test cases/unit/86 cpp modules/src0.ixx @@ -0,0 +1,7 @@ +export module M0; + +import M1; + +export int func0() { + return func1(); +} diff --git a/test cases/unit/86 cpp modules/src1.ixx b/test cases/unit/86 cpp modules/src1.ixx new file mode 100644 index 0000000..cea6696 --- /dev/null +++ b/test cases/unit/86 cpp modules/src1.ixx @@ -0,0 +1,7 @@ +export module M1; + +import M2; + +export int func1() { + return func2(); +} diff --git a/test cases/unit/86 cpp modules/src2.ixx b/test cases/unit/86 cpp modules/src2.ixx new file mode 100644 index 0000000..415714c --- /dev/null +++ b/test cases/unit/86 cpp modules/src2.ixx @@ -0,0 +1,7 @@ +export module M2; + +import M3; + +export int func2() { + return func3(); +} diff --git a/test cases/unit/86 cpp modules/src3.ixx b/test cases/unit/86 cpp modules/src3.ixx new file mode 100644 index 0000000..96f135c --- /dev/null +++ b/test cases/unit/86 cpp modules/src3.ixx @@ -0,0 +1,7 @@ +export module M3; + +import M4; + +export int func3() { + return func4(); +} diff --git a/test cases/unit/86 cpp modules/src4.ixx b/test cases/unit/86 cpp modules/src4.ixx new file mode 100644 index 0000000..1ac1a6a --- /dev/null +++ b/test cases/unit/86 cpp modules/src4.ixx @@ -0,0 +1,7 @@ +export module M4; + +import M5; + +export int func4() { + return func5(); +} diff --git a/test cases/unit/86 cpp modules/src5.ixx b/test cases/unit/86 cpp modules/src5.ixx new file mode 100644 index 0000000..96cf707 --- /dev/null +++ b/test cases/unit/86 cpp modules/src5.ixx @@ -0,0 +1,7 @@ +export module M5; + +import M6; + +export int func5() { + return func6(); +} diff --git a/test cases/unit/86 cpp modules/src6.ixx b/test cases/unit/86 cpp modules/src6.ixx new file mode 100644 index 0000000..760b71c --- /dev/null +++ b/test cases/unit/86 cpp modules/src6.ixx @@ -0,0 +1,7 @@ +export module M6; + +import M7; + +export int func6() { + return func7(); +} diff --git a/test cases/unit/86 cpp modules/src7.ixx b/test cases/unit/86 cpp modules/src7.ixx new file mode 100644 index 0000000..8ce6608 --- /dev/null +++ b/test cases/unit/86 cpp modules/src7.ixx @@ -0,0 +1,7 @@ +export module M7; + +import M8; + +export int func7() { + return func8(); +} diff --git a/test cases/unit/86 cpp modules/src8.ixx b/test cases/unit/86 cpp modules/src8.ixx new file mode 100644 index 0000000..6a3ef96 --- /dev/null +++ b/test cases/unit/86 cpp modules/src8.ixx @@ -0,0 +1,7 @@ +export module M8; + +import M9; + +export int func8() { + return func9(); +} diff --git a/test cases/unit/86 cpp modules/src9.ixx b/test cases/unit/86 cpp modules/src9.ixx new file mode 100644 index 0000000..3ecb3be --- /dev/null +++ b/test cases/unit/86 cpp modules/src9.ixx @@ -0,0 +1,5 @@ +export module M9; + +export int func9() { + return 42; +} diff --git a/test cases/unit/86 nested subproject regenerate depends/main.c b/test cases/unit/86 nested subproject regenerate depends/main.c deleted file mode 100644 index 9b6bdc2..0000000 --- a/test cases/unit/86 nested subproject regenerate depends/main.c +++ /dev/null @@ -1,3 +0,0 @@ -int main(void) { - return 0; -} diff --git a/test cases/unit/86 nested subproject regenerate depends/meson.build b/test cases/unit/86 nested subproject regenerate depends/meson.build deleted file mode 100644 index 5698881..0000000 --- a/test cases/unit/86 nested subproject regenerate depends/meson.build +++ /dev/null @@ -1,6 +0,0 @@ -project('nested subproject regenerate depends', 'c') - -s = subproject('sub1') - -# This is needed to make msbuild noop check work correctly -executable('exe', 'main.c') diff --git a/test cases/unit/86 nested subproject regenerate depends/subprojects/sub1/meson.build b/test cases/unit/86 nested subproject regenerate depends/subprojects/sub1/meson.build deleted file mode 100644 index a31db4a..0000000 --- a/test cases/unit/86 nested subproject regenerate depends/subprojects/sub1/meson.build +++ /dev/null @@ -1,4 +0,0 @@ -project('sub1') - -cmake = import('cmake') -cmake.subproject('sub2') diff --git a/test cases/unit/86 nested subproject regenerate depends/subprojects/sub2/CMakeLists.txt b/test cases/unit/86 nested subproject regenerate depends/subprojects/sub2/CMakeLists.txt deleted file mode 100644 index f91473a..0000000 --- a/test cases/unit/86 nested subproject regenerate depends/subprojects/sub2/CMakeLists.txt +++ /dev/null @@ -1 +0,0 @@ -project(sub2) diff --git a/test cases/unit/87 cpp modules/main.cpp b/test cases/unit/87 cpp modules/main.cpp deleted file mode 100644 index d825c7d..0000000 --- a/test cases/unit/87 cpp modules/main.cpp +++ /dev/null @@ -1,7 +0,0 @@ -import M0; -#include - -int main() { - printf("The value is %d", func0()); - return 0; -} diff --git a/test cases/unit/87 cpp modules/meson.build b/test cases/unit/87 cpp modules/meson.build deleted file mode 100644 index cdc296f..0000000 --- a/test cases/unit/87 cpp modules/meson.build +++ /dev/null @@ -1,17 +0,0 @@ -project('cppmodules', 'cpp', default_options: ['cpp_std=c++latest']) - -e = executable('modtest', - 'main.cpp', - 'src0.ixx', - 'src1.ixx', - 'src2.ixx', - 'src3.ixx', - 'src4.ixx', - 'src5.ixx', - 'src6.ixx', - 'src7.ixx', - 'src8.ixx', - 'src9.ixx', - ) - -test('modtest', e) diff --git a/test cases/unit/87 cpp modules/src0.ixx b/test cases/unit/87 cpp modules/src0.ixx deleted file mode 100644 index 3ca4d14..0000000 --- a/test cases/unit/87 cpp modules/src0.ixx +++ /dev/null @@ -1,7 +0,0 @@ -export module M0; - -import M1; - -export int func0() { - return func1(); -} diff --git a/test cases/unit/87 cpp modules/src1.ixx b/test cases/unit/87 cpp modules/src1.ixx deleted file mode 100644 index cea6696..0000000 --- a/test cases/unit/87 cpp modules/src1.ixx +++ /dev/null @@ -1,7 +0,0 @@ -export module M1; - -import M2; - -export int func1() { - return func2(); -} diff --git a/test cases/unit/87 cpp modules/src2.ixx b/test cases/unit/87 cpp modules/src2.ixx deleted file mode 100644 index 415714c..0000000 --- a/test cases/unit/87 cpp modules/src2.ixx +++ /dev/null @@ -1,7 +0,0 @@ -export module M2; - -import M3; - -export int func2() { - return func3(); -} diff --git a/test cases/unit/87 cpp modules/src3.ixx b/test cases/unit/87 cpp modules/src3.ixx deleted file mode 100644 index 96f135c..0000000 --- a/test cases/unit/87 cpp modules/src3.ixx +++ /dev/null @@ -1,7 +0,0 @@ -export module M3; - -import M4; - -export int func3() { - return func4(); -} diff --git a/test cases/unit/87 cpp modules/src4.ixx b/test cases/unit/87 cpp modules/src4.ixx deleted file mode 100644 index 1ac1a6a..0000000 --- a/test cases/unit/87 cpp modules/src4.ixx +++ /dev/null @@ -1,7 +0,0 @@ -export module M4; - -import M5; - -export int func4() { - return func5(); -} diff --git a/test cases/unit/87 cpp modules/src5.ixx b/test cases/unit/87 cpp modules/src5.ixx deleted file mode 100644 index 96cf707..0000000 --- a/test cases/unit/87 cpp modules/src5.ixx +++ /dev/null @@ -1,7 +0,0 @@ -export module M5; - -import M6; - -export int func5() { - return func6(); -} diff --git a/test cases/unit/87 cpp modules/src6.ixx b/test cases/unit/87 cpp modules/src6.ixx deleted file mode 100644 index 760b71c..0000000 --- a/test cases/unit/87 cpp modules/src6.ixx +++ /dev/null @@ -1,7 +0,0 @@ -export module M6; - -import M7; - -export int func6() { - return func7(); -} diff --git a/test cases/unit/87 cpp modules/src7.ixx b/test cases/unit/87 cpp modules/src7.ixx deleted file mode 100644 index 8ce6608..0000000 --- a/test cases/unit/87 cpp modules/src7.ixx +++ /dev/null @@ -1,7 +0,0 @@ -export module M7; - -import M8; - -export int func7() { - return func8(); -} diff --git a/test cases/unit/87 cpp modules/src8.ixx b/test cases/unit/87 cpp modules/src8.ixx deleted file mode 100644 index 6a3ef96..0000000 --- a/test cases/unit/87 cpp modules/src8.ixx +++ /dev/null @@ -1,7 +0,0 @@ -export module M8; - -import M9; - -export int func8() { - return func9(); -} diff --git a/test cases/unit/87 cpp modules/src9.ixx b/test cases/unit/87 cpp modules/src9.ixx deleted file mode 100644 index 3ecb3be..0000000 --- a/test cases/unit/87 cpp modules/src9.ixx +++ /dev/null @@ -1,5 +0,0 @@ -export module M9; - -export int func9() { - return 42; -} diff --git a/test cases/unit/87 prelinking/file1.c b/test cases/unit/87 prelinking/file1.c new file mode 100644 index 0000000..9f0e265 --- /dev/null +++ b/test cases/unit/87 prelinking/file1.c @@ -0,0 +1,14 @@ +#include +#include + +int public_func() { + return round1_a(); +} + +int round1_a() { + return round1_b(); +} + +int round2_a() { + return round2_b(); +} diff --git a/test cases/unit/87 prelinking/file2.c b/test cases/unit/87 prelinking/file2.c new file mode 100644 index 0000000..ce3b115 --- /dev/null +++ b/test cases/unit/87 prelinking/file2.c @@ -0,0 +1,9 @@ +#include + +int round1_b() { + return round1_c(); +} + +int round2_b() { + return round2_c(); +} diff --git a/test cases/unit/87 prelinking/file3.c b/test cases/unit/87 prelinking/file3.c new file mode 100644 index 0000000..85052be --- /dev/null +++ b/test cases/unit/87 prelinking/file3.c @@ -0,0 +1,9 @@ +#include + +int round1_c() { + return round1_d(); +} + +int round2_c() { + return round2_d(); +} diff --git a/test cases/unit/87 prelinking/file4.c b/test cases/unit/87 prelinking/file4.c new file mode 100644 index 0000000..622364e --- /dev/null +++ b/test cases/unit/87 prelinking/file4.c @@ -0,0 +1,9 @@ +#include + +int round1_d() { + return round2_a(); +} + +int round2_d() { + return 42; +} diff --git a/test cases/unit/87 prelinking/main.c b/test cases/unit/87 prelinking/main.c new file mode 100644 index 0000000..09a2e5c --- /dev/null +++ b/test cases/unit/87 prelinking/main.c @@ -0,0 +1,10 @@ +#include +#include + +int main(int argc, char **argv) { + if(public_func() != 42) { + printf("Something failed.\n"); + return 1; + } + return 0; +} diff --git a/test cases/unit/87 prelinking/meson.build b/test cases/unit/87 prelinking/meson.build new file mode 100644 index 0000000..3dbf88e --- /dev/null +++ b/test cases/unit/87 prelinking/meson.build @@ -0,0 +1,8 @@ +project('prelinking', 'c') + +liba = static_library('prelinked', 'file1.c', 'file2.c', 'file3.c', 'file4.c', + prelink: true) +exe = executable('testprog', 'main.c', + link_with: liba) +test('prelinked', exe) + \ No newline at end of file diff --git a/test cases/unit/87 prelinking/private_header.h b/test cases/unit/87 prelinking/private_header.h new file mode 100644 index 0000000..f24b621 --- /dev/null +++ b/test cases/unit/87 prelinking/private_header.h @@ -0,0 +1,11 @@ +#pragma once + +int round1_a(); +int round1_b(); +int round1_c(); +int round1_d(); + +int round2_a(); +int round2_b(); +int round2_c(); +int round2_d(); diff --git a/test cases/unit/87 prelinking/public_header.h b/test cases/unit/87 prelinking/public_header.h new file mode 100644 index 0000000..0cd6786 --- /dev/null +++ b/test cases/unit/87 prelinking/public_header.h @@ -0,0 +1,3 @@ +#pragma once + +int public_func(); diff --git a/test cases/unit/88 prelinking/file1.c b/test cases/unit/88 prelinking/file1.c deleted file mode 100644 index 9f0e265..0000000 --- a/test cases/unit/88 prelinking/file1.c +++ /dev/null @@ -1,14 +0,0 @@ -#include -#include - -int public_func() { - return round1_a(); -} - -int round1_a() { - return round1_b(); -} - -int round2_a() { - return round2_b(); -} diff --git a/test cases/unit/88 prelinking/file2.c b/test cases/unit/88 prelinking/file2.c deleted file mode 100644 index ce3b115..0000000 --- a/test cases/unit/88 prelinking/file2.c +++ /dev/null @@ -1,9 +0,0 @@ -#include - -int round1_b() { - return round1_c(); -} - -int round2_b() { - return round2_c(); -} diff --git a/test cases/unit/88 prelinking/file3.c b/test cases/unit/88 prelinking/file3.c deleted file mode 100644 index 85052be..0000000 --- a/test cases/unit/88 prelinking/file3.c +++ /dev/null @@ -1,9 +0,0 @@ -#include - -int round1_c() { - return round1_d(); -} - -int round2_c() { - return round2_d(); -} diff --git a/test cases/unit/88 prelinking/file4.c b/test cases/unit/88 prelinking/file4.c deleted file mode 100644 index 622364e..0000000 --- a/test cases/unit/88 prelinking/file4.c +++ /dev/null @@ -1,9 +0,0 @@ -#include - -int round1_d() { - return round2_a(); -} - -int round2_d() { - return 42; -} diff --git a/test cases/unit/88 prelinking/main.c b/test cases/unit/88 prelinking/main.c deleted file mode 100644 index 09a2e5c..0000000 --- a/test cases/unit/88 prelinking/main.c +++ /dev/null @@ -1,10 +0,0 @@ -#include -#include - -int main(int argc, char **argv) { - if(public_func() != 42) { - printf("Something failed.\n"); - return 1; - } - return 0; -} diff --git a/test cases/unit/88 prelinking/meson.build b/test cases/unit/88 prelinking/meson.build deleted file mode 100644 index 3dbf88e..0000000 --- a/test cases/unit/88 prelinking/meson.build +++ /dev/null @@ -1,8 +0,0 @@ -project('prelinking', 'c') - -liba = static_library('prelinked', 'file1.c', 'file2.c', 'file3.c', 'file4.c', - prelink: true) -exe = executable('testprog', 'main.c', - link_with: liba) -test('prelinked', exe) - \ No newline at end of file diff --git a/test cases/unit/88 prelinking/private_header.h b/test cases/unit/88 prelinking/private_header.h deleted file mode 100644 index f24b621..0000000 --- a/test cases/unit/88 prelinking/private_header.h +++ /dev/null @@ -1,11 +0,0 @@ -#pragma once - -int round1_a(); -int round1_b(); -int round1_c(); -int round1_d(); - -int round2_a(); -int round2_b(); -int round2_c(); -int round2_d(); diff --git a/test cases/unit/88 prelinking/public_header.h b/test cases/unit/88 prelinking/public_header.h deleted file mode 100644 index 0cd6786..0000000 --- a/test cases/unit/88 prelinking/public_header.h +++ /dev/null @@ -1,3 +0,0 @@ -#pragma once - -int public_func(); diff --git a/test cases/unit/88 run native test/main.c b/test cases/unit/88 run native test/main.c new file mode 100644 index 0000000..3213780 --- /dev/null +++ b/test cases/unit/88 run native test/main.c @@ -0,0 +1,17 @@ +#include + +int main (int argc, char * argv[]) +{ + const char *out = "SUCCESS!"; + + if (argc != 2) { + printf ("%s\n", out); + } else { + int ret; + FILE *f = fopen (argv[1], "w"); + ret = fwrite (out, sizeof (out), 1, f); + if (ret != 1) + return -1; + } + return 0; +} diff --git a/test cases/unit/88 run native test/meson.build b/test cases/unit/88 run native test/meson.build new file mode 100644 index 0000000..3bf419c --- /dev/null +++ b/test cases/unit/88 run native test/meson.build @@ -0,0 +1,6 @@ +project('run native test', ['c']) + +executable('terget_exe', 'main.c') + +native_exe = executable('native_exe', 'main.c', native: true) +test('native_exe', native_exe, args: ['native_test_has_run.stamp']) diff --git a/test cases/unit/89 multiple envvars/meson.build b/test cases/unit/89 multiple envvars/meson.build new file mode 100644 index 0000000..ac57611 --- /dev/null +++ b/test cases/unit/89 multiple envvars/meson.build @@ -0,0 +1,4 @@ +project('multienv', 'c', 'cpp') + +executable('cexe', 'prog.c') +executable('cppexe', 'prog.cpp') diff --git a/test cases/unit/89 multiple envvars/prog.c b/test cases/unit/89 multiple envvars/prog.c new file mode 100644 index 0000000..38d3c12 --- /dev/null +++ b/test cases/unit/89 multiple envvars/prog.c @@ -0,0 +1,18 @@ +#include + +#ifndef CPPFLAG +#error CPPFLAG not set +#endif + +#ifndef CFLAG +#error CFLAGS not set +#endif + +#ifdef CXXFLAG +#error CXXFLAG is set +#endif + +int main(int argc, char **argv) { + printf("%d %s\n", argc, argv[0]); + return 0; +} diff --git a/test cases/unit/89 multiple envvars/prog.cpp b/test cases/unit/89 multiple envvars/prog.cpp new file mode 100644 index 0000000..61ccf3a --- /dev/null +++ b/test cases/unit/89 multiple envvars/prog.cpp @@ -0,0 +1,18 @@ +#include + +#ifndef CPPFLAG +#error CPPFLAG not set +#endif + +#ifdef CFLAG +#error CFLAG is set +#endif + +#ifndef CXXFLAG +#error CXXFLAG not set +#endif + +int main(int argc, char **argv) { + printf("%d %s\n", argc, argv[0]); + return 0; +} diff --git a/test cases/unit/89 run native test/main.c b/test cases/unit/89 run native test/main.c deleted file mode 100644 index 3213780..0000000 --- a/test cases/unit/89 run native test/main.c +++ /dev/null @@ -1,17 +0,0 @@ -#include - -int main (int argc, char * argv[]) -{ - const char *out = "SUCCESS!"; - - if (argc != 2) { - printf ("%s\n", out); - } else { - int ret; - FILE *f = fopen (argv[1], "w"); - ret = fwrite (out, sizeof (out), 1, f); - if (ret != 1) - return -1; - } - return 0; -} diff --git a/test cases/unit/89 run native test/meson.build b/test cases/unit/89 run native test/meson.build deleted file mode 100644 index 3bf419c..0000000 --- a/test cases/unit/89 run native test/meson.build +++ /dev/null @@ -1,6 +0,0 @@ -project('run native test', ['c']) - -executable('terget_exe', 'main.c') - -native_exe = executable('native_exe', 'main.c', native: true) -test('native_exe', native_exe, args: ['native_test_has_run.stamp']) diff --git a/test cases/unit/90 multiple envvars/meson.build b/test cases/unit/90 multiple envvars/meson.build deleted file mode 100644 index ac57611..0000000 --- a/test cases/unit/90 multiple envvars/meson.build +++ /dev/null @@ -1,4 +0,0 @@ -project('multienv', 'c', 'cpp') - -executable('cexe', 'prog.c') -executable('cppexe', 'prog.cpp') diff --git a/test cases/unit/90 multiple envvars/prog.c b/test cases/unit/90 multiple envvars/prog.c deleted file mode 100644 index 38d3c12..0000000 --- a/test cases/unit/90 multiple envvars/prog.c +++ /dev/null @@ -1,18 +0,0 @@ -#include - -#ifndef CPPFLAG -#error CPPFLAG not set -#endif - -#ifndef CFLAG -#error CFLAGS not set -#endif - -#ifdef CXXFLAG -#error CXXFLAG is set -#endif - -int main(int argc, char **argv) { - printf("%d %s\n", argc, argv[0]); - return 0; -} diff --git a/test cases/unit/90 multiple envvars/prog.cpp b/test cases/unit/90 multiple envvars/prog.cpp deleted file mode 100644 index 61ccf3a..0000000 --- a/test cases/unit/90 multiple envvars/prog.cpp +++ /dev/null @@ -1,18 +0,0 @@ -#include - -#ifndef CPPFLAG -#error CPPFLAG not set -#endif - -#ifdef CFLAG -#error CFLAG is set -#endif - -#ifndef CXXFLAG -#error CXXFLAG not set -#endif - -int main(int argc, char **argv) { - printf("%d %s\n", argc, argv[0]); - return 0; -} diff --git a/test cases/unit/91 install skip subprojects/foo.c b/test cases/unit/91 install skip subprojects/foo.c deleted file mode 100644 index 25927f5..0000000 --- a/test cases/unit/91 install skip subprojects/foo.c +++ /dev/null @@ -1,4 +0,0 @@ -int main(int argc, char *argv[]) -{ - return 0; -} diff --git a/test cases/unit/91 install skip subprojects/foo.dat b/test cases/unit/91 install skip subprojects/foo.dat deleted file mode 100644 index 421376d..0000000 --- a/test cases/unit/91 install skip subprojects/foo.dat +++ /dev/null @@ -1 +0,0 @@ -dummy diff --git a/test cases/unit/91 install skip subprojects/foo.h b/test cases/unit/91 install skip subprojects/foo.h deleted file mode 100644 index a7e26ac..0000000 --- a/test cases/unit/91 install skip subprojects/foo.h +++ /dev/null @@ -1 +0,0 @@ -#define FOO diff --git a/test cases/unit/91 install skip subprojects/foo/foofile b/test cases/unit/91 install skip subprojects/foo/foofile deleted file mode 100644 index e69de29..0000000 diff --git a/test cases/unit/91 install skip subprojects/meson.build b/test cases/unit/91 install skip subprojects/meson.build deleted file mode 100644 index cfbae94..0000000 --- a/test cases/unit/91 install skip subprojects/meson.build +++ /dev/null @@ -1,8 +0,0 @@ -project('foo', 'c') - -install_data('foo.dat') -install_headers('foo.h') -install_subdir('foo', install_dir: '') -executable('foo', 'foo.c', install: true) - -subproject('bar') diff --git a/test cases/unit/91 install skip subprojects/subprojects/bar/bar.c b/test cases/unit/91 install skip subprojects/subprojects/bar/bar.c deleted file mode 100644 index 25927f5..0000000 --- a/test cases/unit/91 install skip subprojects/subprojects/bar/bar.c +++ /dev/null @@ -1,4 +0,0 @@ -int main(int argc, char *argv[]) -{ - return 0; -} diff --git a/test cases/unit/91 install skip subprojects/subprojects/bar/bar.dat b/test cases/unit/91 install skip subprojects/subprojects/bar/bar.dat deleted file mode 100644 index 421376d..0000000 --- a/test cases/unit/91 install skip subprojects/subprojects/bar/bar.dat +++ /dev/null @@ -1 +0,0 @@ -dummy diff --git a/test cases/unit/91 install skip subprojects/subprojects/bar/bar.h b/test cases/unit/91 install skip subprojects/subprojects/bar/bar.h deleted file mode 100644 index a7e26ac..0000000 --- a/test cases/unit/91 install skip subprojects/subprojects/bar/bar.h +++ /dev/null @@ -1 +0,0 @@ -#define FOO diff --git a/test cases/unit/91 install skip subprojects/subprojects/bar/bar/barfile b/test cases/unit/91 install skip subprojects/subprojects/bar/bar/barfile deleted file mode 100644 index 421376d..0000000 --- a/test cases/unit/91 install skip subprojects/subprojects/bar/bar/barfile +++ /dev/null @@ -1 +0,0 @@ -dummy diff --git a/test cases/unit/91 install skip subprojects/subprojects/bar/meson.build b/test cases/unit/91 install skip subprojects/subprojects/bar/meson.build deleted file mode 100644 index b5b0734..0000000 --- a/test cases/unit/91 install skip subprojects/subprojects/bar/meson.build +++ /dev/null @@ -1,6 +0,0 @@ -project('bar', 'c') - -install_data('bar.dat') -install_headers('bar.h') -install_subdir('bar', install_dir: '') -executable('bar', 'bar.c', install: true) diff --git a/test cases/unit/92 install skip subprojects/foo.c b/test cases/unit/92 install skip subprojects/foo.c new file mode 100644 index 0000000..25927f5 --- /dev/null +++ b/test cases/unit/92 install skip subprojects/foo.c @@ -0,0 +1,4 @@ +int main(int argc, char *argv[]) +{ + return 0; +} diff --git a/test cases/unit/92 install skip subprojects/foo.dat b/test cases/unit/92 install skip subprojects/foo.dat new file mode 100644 index 0000000..421376d --- /dev/null +++ b/test cases/unit/92 install skip subprojects/foo.dat @@ -0,0 +1 @@ +dummy diff --git a/test cases/unit/92 install skip subprojects/foo.h b/test cases/unit/92 install skip subprojects/foo.h new file mode 100644 index 0000000..a7e26ac --- /dev/null +++ b/test cases/unit/92 install skip subprojects/foo.h @@ -0,0 +1 @@ +#define FOO diff --git a/test cases/unit/92 install skip subprojects/foo/foofile b/test cases/unit/92 install skip subprojects/foo/foofile new file mode 100644 index 0000000..e69de29 diff --git a/test cases/unit/92 install skip subprojects/meson.build b/test cases/unit/92 install skip subprojects/meson.build new file mode 100644 index 0000000..cfbae94 --- /dev/null +++ b/test cases/unit/92 install skip subprojects/meson.build @@ -0,0 +1,8 @@ +project('foo', 'c') + +install_data('foo.dat') +install_headers('foo.h') +install_subdir('foo', install_dir: '') +executable('foo', 'foo.c', install: true) + +subproject('bar') diff --git a/test cases/unit/92 install skip subprojects/subprojects/bar/bar.c b/test cases/unit/92 install skip subprojects/subprojects/bar/bar.c new file mode 100644 index 0000000..25927f5 --- /dev/null +++ b/test cases/unit/92 install skip subprojects/subprojects/bar/bar.c @@ -0,0 +1,4 @@ +int main(int argc, char *argv[]) +{ + return 0; +} diff --git a/test cases/unit/92 install skip subprojects/subprojects/bar/bar.dat b/test cases/unit/92 install skip subprojects/subprojects/bar/bar.dat new file mode 100644 index 0000000..421376d --- /dev/null +++ b/test cases/unit/92 install skip subprojects/subprojects/bar/bar.dat @@ -0,0 +1 @@ +dummy diff --git a/test cases/unit/92 install skip subprojects/subprojects/bar/bar.h b/test cases/unit/92 install skip subprojects/subprojects/bar/bar.h new file mode 100644 index 0000000..a7e26ac --- /dev/null +++ b/test cases/unit/92 install skip subprojects/subprojects/bar/bar.h @@ -0,0 +1 @@ +#define FOO diff --git a/test cases/unit/92 install skip subprojects/subprojects/bar/bar/barfile b/test cases/unit/92 install skip subprojects/subprojects/bar/bar/barfile new file mode 100644 index 0000000..421376d --- /dev/null +++ b/test cases/unit/92 install skip subprojects/subprojects/bar/bar/barfile @@ -0,0 +1 @@ +dummy diff --git a/test cases/unit/92 install skip subprojects/subprojects/bar/meson.build b/test cases/unit/92 install skip subprojects/subprojects/bar/meson.build new file mode 100644 index 0000000..b5b0734 --- /dev/null +++ b/test cases/unit/92 install skip subprojects/subprojects/bar/meson.build @@ -0,0 +1,6 @@ +project('bar', 'c') + +install_data('bar.dat') +install_headers('bar.h') +install_subdir('bar', install_dir: '') +executable('bar', 'bar.c', install: true) diff --git a/test cases/unit/92 new subproject in configured project/meson.build b/test cases/unit/92 new subproject in configured project/meson.build deleted file mode 100644 index b82aa41..0000000 --- a/test cases/unit/92 new subproject in configured project/meson.build +++ /dev/null @@ -1,7 +0,0 @@ -# SPDX-license-identifier: Apache-2.0 -# Copyright © 2021 Intel Corporation -project('existing project with new subproject', 'c') - -if get_option('use-sub') - dep = subproject('sub') -endif diff --git a/test cases/unit/92 new subproject in configured project/meson_options.txt b/test cases/unit/92 new subproject in configured project/meson_options.txt deleted file mode 100644 index 12d8395..0000000 --- a/test cases/unit/92 new subproject in configured project/meson_options.txt +++ /dev/null @@ -1,3 +0,0 @@ -# SPDX-license-identifier: Apache-2.0 -# Copyright © 2021 Intel Corporation -option('use-sub', type : 'boolean', value : false) diff --git a/test cases/unit/92 new subproject in configured project/subprojects/sub/foo.c b/test cases/unit/92 new subproject in configured project/subprojects/sub/foo.c deleted file mode 100644 index 9713d9f..0000000 --- a/test cases/unit/92 new subproject in configured project/subprojects/sub/foo.c +++ /dev/null @@ -1,6 +0,0 @@ -/* SPDX-license-identifier: Apache-2.0 */ -/* Copyright © 2021 Intel Corporation */ - -int func(void) { - return 1; -} diff --git a/test cases/unit/92 new subproject in configured project/subprojects/sub/meson.build b/test cases/unit/92 new subproject in configured project/subprojects/sub/meson.build deleted file mode 100644 index a833b0c..0000000 --- a/test cases/unit/92 new subproject in configured project/subprojects/sub/meson.build +++ /dev/null @@ -1,7 +0,0 @@ -# SPDX-license-identifier: Apache-2.0 -# Copyright © 2021 Intel Corporation -project('new subproject', 'c') - -l = library('foo', 'foo.c') - -dep = declare_dependency(link_with : l) diff --git a/test cases/unit/93 clangformat/.clang-format b/test cases/unit/93 clangformat/.clang-format deleted file mode 100644 index 689bc60..0000000 --- a/test cases/unit/93 clangformat/.clang-format +++ /dev/null @@ -1,4 +0,0 @@ ---- -BasedOnStyle: Google - -... diff --git a/test cases/unit/93 clangformat/.clang-format-ignore b/test cases/unit/93 clangformat/.clang-format-ignore deleted file mode 100644 index 7fc4d5a..0000000 --- a/test cases/unit/93 clangformat/.clang-format-ignore +++ /dev/null @@ -1,3 +0,0 @@ - -# Ignore C files -*.c diff --git a/test cases/unit/93 clangformat/.clang-format-include b/test cases/unit/93 clangformat/.clang-format-include deleted file mode 100644 index f057c00..0000000 --- a/test cases/unit/93 clangformat/.clang-format-include +++ /dev/null @@ -1,3 +0,0 @@ - -# Only reformat in src/ -src/**/* diff --git a/test cases/unit/93 clangformat/meson.build b/test cases/unit/93 clangformat/meson.build deleted file mode 100644 index 8f4af98..0000000 --- a/test cases/unit/93 clangformat/meson.build +++ /dev/null @@ -1 +0,0 @@ -project('dummy', 'c', 'cpp') diff --git a/test cases/unit/93 clangformat/not-included/badformat.cpp b/test cases/unit/93 clangformat/not-included/badformat.cpp deleted file mode 100644 index 99a0ea6..0000000 --- a/test cases/unit/93 clangformat/not-included/badformat.cpp +++ /dev/null @@ -1,2 +0,0 @@ -class { -}; diff --git a/test cases/unit/93 clangformat/src/badformat.c b/test cases/unit/93 clangformat/src/badformat.c deleted file mode 100644 index f1d18b7..0000000 --- a/test cases/unit/93 clangformat/src/badformat.c +++ /dev/null @@ -1,2 +0,0 @@ -struct { -}; diff --git a/test cases/unit/93 clangformat/src/badformat.cpp b/test cases/unit/93 clangformat/src/badformat.cpp deleted file mode 100644 index 99a0ea6..0000000 --- a/test cases/unit/93 clangformat/src/badformat.cpp +++ /dev/null @@ -1,2 +0,0 @@ -class { -}; diff --git a/test cases/unit/93 new subproject in configured project/meson.build b/test cases/unit/93 new subproject in configured project/meson.build new file mode 100644 index 0000000..b82aa41 --- /dev/null +++ b/test cases/unit/93 new subproject in configured project/meson.build @@ -0,0 +1,7 @@ +# SPDX-license-identifier: Apache-2.0 +# Copyright © 2021 Intel Corporation +project('existing project with new subproject', 'c') + +if get_option('use-sub') + dep = subproject('sub') +endif diff --git a/test cases/unit/93 new subproject in configured project/meson_options.txt b/test cases/unit/93 new subproject in configured project/meson_options.txt new file mode 100644 index 0000000..12d8395 --- /dev/null +++ b/test cases/unit/93 new subproject in configured project/meson_options.txt @@ -0,0 +1,3 @@ +# SPDX-license-identifier: Apache-2.0 +# Copyright © 2021 Intel Corporation +option('use-sub', type : 'boolean', value : false) diff --git a/test cases/unit/93 new subproject in configured project/subprojects/sub/foo.c b/test cases/unit/93 new subproject in configured project/subprojects/sub/foo.c new file mode 100644 index 0000000..9713d9f --- /dev/null +++ b/test cases/unit/93 new subproject in configured project/subprojects/sub/foo.c @@ -0,0 +1,6 @@ +/* SPDX-license-identifier: Apache-2.0 */ +/* Copyright © 2021 Intel Corporation */ + +int func(void) { + return 1; +} diff --git a/test cases/unit/93 new subproject in configured project/subprojects/sub/meson.build b/test cases/unit/93 new subproject in configured project/subprojects/sub/meson.build new file mode 100644 index 0000000..a833b0c --- /dev/null +++ b/test cases/unit/93 new subproject in configured project/subprojects/sub/meson.build @@ -0,0 +1,7 @@ +# SPDX-license-identifier: Apache-2.0 +# Copyright © 2021 Intel Corporation +project('new subproject', 'c') + +l = library('foo', 'foo.c') + +dep = declare_dependency(link_with : l) diff --git a/test cases/unit/94 clangformat/.clang-format b/test cases/unit/94 clangformat/.clang-format new file mode 100644 index 0000000..689bc60 --- /dev/null +++ b/test cases/unit/94 clangformat/.clang-format @@ -0,0 +1,4 @@ +--- +BasedOnStyle: Google + +... diff --git a/test cases/unit/94 clangformat/.clang-format-ignore b/test cases/unit/94 clangformat/.clang-format-ignore new file mode 100644 index 0000000..7fc4d5a --- /dev/null +++ b/test cases/unit/94 clangformat/.clang-format-ignore @@ -0,0 +1,3 @@ + +# Ignore C files +*.c diff --git a/test cases/unit/94 clangformat/.clang-format-include b/test cases/unit/94 clangformat/.clang-format-include new file mode 100644 index 0000000..f057c00 --- /dev/null +++ b/test cases/unit/94 clangformat/.clang-format-include @@ -0,0 +1,3 @@ + +# Only reformat in src/ +src/**/* diff --git a/test cases/unit/94 clangformat/meson.build b/test cases/unit/94 clangformat/meson.build new file mode 100644 index 0000000..8f4af98 --- /dev/null +++ b/test cases/unit/94 clangformat/meson.build @@ -0,0 +1 @@ +project('dummy', 'c', 'cpp') diff --git a/test cases/unit/94 clangformat/not-included/badformat.cpp b/test cases/unit/94 clangformat/not-included/badformat.cpp new file mode 100644 index 0000000..99a0ea6 --- /dev/null +++ b/test cases/unit/94 clangformat/not-included/badformat.cpp @@ -0,0 +1,2 @@ +class { +}; diff --git a/test cases/unit/94 clangformat/src/badformat.c b/test cases/unit/94 clangformat/src/badformat.c new file mode 100644 index 0000000..f1d18b7 --- /dev/null +++ b/test cases/unit/94 clangformat/src/badformat.c @@ -0,0 +1,2 @@ +struct { +}; diff --git a/test cases/unit/94 clangformat/src/badformat.cpp b/test cases/unit/94 clangformat/src/badformat.cpp new file mode 100644 index 0000000..99a0ea6 --- /dev/null +++ b/test cases/unit/94 clangformat/src/badformat.cpp @@ -0,0 +1,2 @@ +class { +}; diff --git a/test cases/unit/94 custominc/easytogrepfor/genh.py b/test cases/unit/94 custominc/easytogrepfor/genh.py deleted file mode 100644 index 48e033a..0000000 --- a/test cases/unit/94 custominc/easytogrepfor/genh.py +++ /dev/null @@ -1,7 +0,0 @@ -#!/usr/bin/env python3 - -import sys - -f = open(sys.argv[1], 'w') -f.write('#define RETURN_VALUE 0') -f.close() diff --git a/test cases/unit/94 custominc/easytogrepfor/meson.build b/test cases/unit/94 custominc/easytogrepfor/meson.build deleted file mode 100644 index e749753..0000000 --- a/test cases/unit/94 custominc/easytogrepfor/meson.build +++ /dev/null @@ -1,3 +0,0 @@ -genh = custom_target('header', - output: 'generated.h', - command: [find_program('genh.py'), '@OUTPUT@']) diff --git a/test cases/unit/94 custominc/helper.c b/test cases/unit/94 custominc/helper.c deleted file mode 100644 index 3237441..0000000 --- a/test cases/unit/94 custominc/helper.c +++ /dev/null @@ -1,5 +0,0 @@ -#include - -int func(void) { - return RETURN_VALUE; -} diff --git a/test cases/unit/94 custominc/meson.build b/test cases/unit/94 custominc/meson.build deleted file mode 100644 index bab1139..0000000 --- a/test cases/unit/94 custominc/meson.build +++ /dev/null @@ -1,9 +0,0 @@ -project('implicit custom dirs', 'c') - -subdir('easytogrepfor') - -l = static_library('helper', 'helper.c', genh) -d = declare_dependency(link_with: l, sources: genh) -executable('prog', 'prog.c', dependencies: d, implicit_include_directories: false) - -executable('prog2', 'prog2.c', dependencies: d) diff --git a/test cases/unit/94 custominc/prog.c b/test cases/unit/94 custominc/prog.c deleted file mode 100644 index db9df9d..0000000 --- a/test cases/unit/94 custominc/prog.c +++ /dev/null @@ -1,9 +0,0 @@ -#include - -int func(void); - -int main(int argc, char **argv) { - (void)argc; - (void)(argv); - return func(); -} diff --git a/test cases/unit/94 custominc/prog2.c b/test cases/unit/94 custominc/prog2.c deleted file mode 100644 index e64b229..0000000 --- a/test cases/unit/94 custominc/prog2.c +++ /dev/null @@ -1,10 +0,0 @@ -#include -#include - -int func(void); - -int main(int argc, char **argv) { - (void)argc; - (void)(argv); - return func() + RETURN_VALUE; -} diff --git a/test cases/unit/95 custominc/easytogrepfor/genh.py b/test cases/unit/95 custominc/easytogrepfor/genh.py new file mode 100644 index 0000000..48e033a --- /dev/null +++ b/test cases/unit/95 custominc/easytogrepfor/genh.py @@ -0,0 +1,7 @@ +#!/usr/bin/env python3 + +import sys + +f = open(sys.argv[1], 'w') +f.write('#define RETURN_VALUE 0') +f.close() diff --git a/test cases/unit/95 custominc/easytogrepfor/meson.build b/test cases/unit/95 custominc/easytogrepfor/meson.build new file mode 100644 index 0000000..e749753 --- /dev/null +++ b/test cases/unit/95 custominc/easytogrepfor/meson.build @@ -0,0 +1,3 @@ +genh = custom_target('header', + output: 'generated.h', + command: [find_program('genh.py'), '@OUTPUT@']) diff --git a/test cases/unit/95 custominc/helper.c b/test cases/unit/95 custominc/helper.c new file mode 100644 index 0000000..3237441 --- /dev/null +++ b/test cases/unit/95 custominc/helper.c @@ -0,0 +1,5 @@ +#include + +int func(void) { + return RETURN_VALUE; +} diff --git a/test cases/unit/95 custominc/meson.build b/test cases/unit/95 custominc/meson.build new file mode 100644 index 0000000..bab1139 --- /dev/null +++ b/test cases/unit/95 custominc/meson.build @@ -0,0 +1,9 @@ +project('implicit custom dirs', 'c') + +subdir('easytogrepfor') + +l = static_library('helper', 'helper.c', genh) +d = declare_dependency(link_with: l, sources: genh) +executable('prog', 'prog.c', dependencies: d, implicit_include_directories: false) + +executable('prog2', 'prog2.c', dependencies: d) diff --git a/test cases/unit/95 custominc/prog.c b/test cases/unit/95 custominc/prog.c new file mode 100644 index 0000000..db9df9d --- /dev/null +++ b/test cases/unit/95 custominc/prog.c @@ -0,0 +1,9 @@ +#include + +int func(void); + +int main(int argc, char **argv) { + (void)argc; + (void)(argv); + return func(); +} diff --git a/test cases/unit/95 custominc/prog2.c b/test cases/unit/95 custominc/prog2.c new file mode 100644 index 0000000..e64b229 --- /dev/null +++ b/test cases/unit/95 custominc/prog2.c @@ -0,0 +1,10 @@ +#include +#include + +int func(void); + +int main(int argc, char **argv) { + (void)argc; + (void)(argv); + return func() + RETURN_VALUE; +} -- cgit v1.1