From 7b6e527f440cd7e6f8be2b07cee320ee6ca18786 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Mon, 29 Apr 2024 06:41:38 +0200 Subject: Adding upstream version 1.0.1. Signed-off-by: Daniel Baumann --- test cases/cmake/1 basic/main.cpp | 10 + test cases/cmake/1 basic/meson.build | 14 + .../cmake/1 basic/subprojects/cmMod/CMakeLists.txt | 20 + .../cmake/1 basic/subprojects/cmMod/cmMod.cpp | 15 + .../cmake/1 basic/subprojects/cmMod/cmMod.hpp | 18 + .../cmake/1 basic/subprojects/cmMod/cpp_pch.hpp | 2 + test cases/cmake/10 header only/main.cpp | 16 + test cases/cmake/10 header only/meson.build | 12 + .../subprojects/cmMod/CMakeLists.txt | 12 + .../subprojects/cmMod/include/cmMod.hpp | 24 + .../cmake/FindSomethingLikePython.cmake | 9 + test cases/cmake/11 cmake_module_path/meson.build | 25 + .../subprojects/cmMod/CMakeLists.txt | 15 + .../11 cmake_module_path/subprojects/cmMod/gen.py | 9 + test cases/cmake/12 generator expressions/main.cpp | 10 + .../cmake/12 generator expressions/meson.build | 12 + .../subprojects/cmMod/CMakeLists.txt | 32 + .../subprojects/cmMod/include/cmMod.hpp | 63 + .../cmake/12 generator expressions/test.json | 5 + test cases/cmake/13 system includes/main.cpp | 10 + test cases/cmake/13 system includes/meson.build | 18 + .../subprojects/cmMod/CMakeLists.txt | 15 + .../13 system includes/subprojects/cmMod/cmMod.cpp | 12 + .../13 system includes/subprojects/cmMod/cmMod.hpp | 13 + .../subprojects/cmMod/sysInc/triggerWarn.hpp | 14 + test cases/cmake/14 fortran threads/meson.build | 12 + .../cmake/15 object library advanced/main.cpp | 11 + .../cmake/15 object library advanced/meson.build | 17 + .../subprojects/cmObjLib/CMakeLists.txt | 18 + .../subprojects/cmObjLib/genC.cpp | 31 + .../subprojects/cmObjLib/libA.cpp | 9 + .../subprojects/cmObjLib/libA.hpp | 16 + .../subprojects/cmObjLib/libB.cpp | 6 + .../subprojects/cmObjLib/libB.hpp | 16 + test cases/cmake/16 threads/main.cpp | 9 + test cases/cmake/16 threads/meson.build | 12 + test cases/cmake/16 threads/meson_options.txt | 1 + .../16 threads/subprojects/cmMod/CMakeLists.txt | 15 + .../cmake/16 threads/subprojects/cmMod/cmMod.cpp | 15 + .../cmake/16 threads/subprojects/cmMod/cmMod.hpp | 21 + .../cmake/16 threads/subprojects/cmMod/main.cpp | 9 + test cases/cmake/16 threads/test.json | 11 + test cases/cmake/17 include path order/main.cpp | 10 + test cases/cmake/17 include path order/meson.build | 9 + .../subprojects/cmMod/CMakeLists.txt | 34 + .../subprojects/cmMod/cmMod.cpp | 11 + .../subprojects/cmMod/incA/cmMod.hpp | 4 + .../subprojects/cmMod/incB/cmMod.hpp | 4 + .../subprojects/cmMod/incC/cmMod.hpp | 4 + .../subprojects/cmMod/incD/cmMod.hpp | 4 + .../subprojects/cmMod/incE/cmMod.hpp | 4 + .../subprojects/cmMod/incF/cmMod.hpp | 4 + .../subprojects/cmMod/incG/cmMod.hpp | 14 + .../subprojects/cmMod/incH/cmMod.hpp | 4 + .../subprojects/cmMod/incI/cmMod.hpp | 4 + .../subprojects/cmMod/incJ/cmMod.hpp | 4 + .../subprojects/cmMod/incL/cmMod.hpp | 4 + .../subprojects/cmMod/incM/cmMod.hpp | 4 + .../subprojects/cmMod/incN/cmMod.hpp | 4 + .../subprojects/cmMod/incO/cmMod.hpp | 4 + .../subprojects/cmMod/incP/cmMod.hpp | 4 + test cases/cmake/18 skip include files/main.cpp | 10 + test cases/cmake/18 skip include files/meson.build | 9 + .../subprojects/cmMod/CMakeLists.txt | 15 + .../subprojects/cmMod/cmMod.cpp | 10 + .../subprojects/cmMod/cmMod.hpp | 16 + .../subprojects/cmMod/fakeInc/CMakeLists.txt | 30 + .../subprojects/cmMod/fakeInc/cmModInc1.cpp | 7 + .../subprojects/cmMod/fakeInc/cmModInc2.cpp | 7 + .../subprojects/cmMod/fakeInc/cmModInc3.cpp | 7 + .../subprojects/cmMod/fakeInc/cmModInc4.cpp | 7 + test cases/cmake/19 advanced options/main.cpp | 18 + test cases/cmake/19 advanced options/meson.build | 29 + .../subprojects/cmOpts/CMakeLists.txt | 18 + .../subprojects/cmOpts/cmMod.cpp | 31 + .../subprojects/cmOpts/cmMod.hpp | 14 + .../subprojects/cmOpts/cmTest.cpp | 25 + .../subprojects/cmOpts/cmTest.hpp | 3 + .../subprojects/cmOpts/main.cpp | 10 + test cases/cmake/19 advanced options/test.json | 5 + test cases/cmake/2 advanced/main.cpp | 15 + test cases/cmake/2 advanced/meson.build | 27 + .../2 advanced/subprojects/cmMod/CMakeLists.txt | 38 + .../cmake/2 advanced/subprojects/cmMod/config.h.in | 3 + .../2 advanced/subprojects/cmMod/lib/cmMod.cpp | 26 + .../2 advanced/subprojects/cmMod/lib/cmMod.hpp | 13 + .../cmake/2 advanced/subprojects/cmMod/main.cpp | 11 + test cases/cmake/2 advanced/test.json | 5 + test cases/cmake/20 cmake file/foolib.cmake.in | 1 + test cases/cmake/20 cmake file/meson.build | 12 + test cases/cmake/20 cmake file/test.json | 5 + test cases/cmake/21 shared module/meson.build | 13 + test cases/cmake/21 shared module/prog.c | 108 + test cases/cmake/21 shared module/runtime.c | 19 + .../subprojects/cmMod/CMakeLists.txt | 7 + .../subprojects/cmMod/module/module.c | 96 + .../subprojects/cmMod/module/module.h | 3 + .../22 cmake module/cmake_project/CMakeLists.txt | 4 + test cases/cmake/22 cmake module/meson.build | 31 + .../cmake/22 cmake module/projectConfig.cmake.in | 4 + test cases/cmake/22 cmake module/test.json | 6 + .../cmake/23 cmake toolchain/CMakeToolchain.cmake | 1 + test cases/cmake/23 cmake toolchain/meson.build | 13 + .../cmake/23 cmake toolchain/nativefile.ini.in | 9 + .../subprojects/cmMod/CMakeLists.txt | 15 + .../subprojects/cmModFortran/CMakeLists.txt | 19 + test cases/cmake/24 mixing languages/main.c | 5 + test cases/cmake/24 mixing languages/meson.build | 13 + .../subprojects/cmTest/CMakeLists.txt | 8 + .../subprojects/cmTest/cmTest.c | 13 + .../subprojects/cmTest/cmTest.h | 3 + .../subprojects/cmTest/cmTest.m | 7 + test cases/cmake/25 assembler/main.c | 18 + test cases/cmake/25 assembler/meson.build | 9 + .../25 assembler/subprojects/cmTest/CMakeLists.txt | 45 + .../cmake/25 assembler/subprojects/cmTest/cmTest.c | 8 + .../25 assembler/subprojects/cmTest/cmTestAsm.s | 4 + test cases/cmake/3 advanced no dep/main.cpp | 15 + test cases/cmake/3 advanced no dep/meson.build | 19 + .../subprojects/cmMod/CMakeLists.txt | 26 + .../subprojects/cmMod/config.h.in | 3 + .../subprojects/cmMod/lib/cmMod.cpp | 16 + .../subprojects/cmMod/lib/cmMod.hpp | 13 + .../3 advanced no dep/subprojects/cmMod/main.cpp | 10 + test cases/cmake/3 advanced no dep/test.json | 8 + test cases/cmake/4 code gen/main.cpp | 8 + test cases/cmake/4 code gen/meson.build | 24 + .../subprojects/cmCodeGen/CMakeLists.txt | 6 + .../4 code gen/subprojects/cmCodeGen/main.cpp | 21 + test cases/cmake/4 code gen/test.hpp | 5 + test cases/cmake/5 object library/main.cpp | 11 + test cases/cmake/5 object library/meson.build | 21 + .../subprojects/cmObjLib/CMakeLists.txt | 11 + .../5 object library/subprojects/cmObjLib/libA.cpp | 5 + .../5 object library/subprojects/cmObjLib/libA.hpp | 16 + .../5 object library/subprojects/cmObjLib/libB.cpp | 6 + .../5 object library/subprojects/cmObjLib/libB.hpp | 16 + test cases/cmake/6 object library no dep/main.cpp | 11 + .../cmake/6 object library no dep/meson.build | 13 + .../subprojects/cmObjLib/CMakeLists.txt | 6 + .../subprojects/cmObjLib/libA.cpp | 5 + .../subprojects/cmObjLib/libA.hpp | 16 + .../subprojects/cmObjLib/libB.cpp | 5 + .../subprojects/cmObjLib/libB.hpp | 16 + test cases/cmake/7 cmake options/meson.build | 3 + .../subprojects/cmOpts/CMakeLists.txt | 10 + test cases/cmake/7 cmake options/test.json | 12 + test cases/cmake/8 custom command/main.cpp | 11 + test cases/cmake/8 custom command/meson.build | 16 + .../subprojects/cmMod/CMakeLists.txt | 163 ++ .../subprojects/cmMod/args_test.cpp | 18 + .../8 custom command/subprojects/cmMod/cmMod.cpp | 24 + .../8 custom command/subprojects/cmMod/cmMod.hpp | 14 + .../8 custom command/subprojects/cmMod/cp.cpp | 22 + .../subprojects/cmMod/cpyBase.cpp.am | 5 + .../subprojects/cmMod/cpyBase.hpp.am | 5 + .../subprojects/cmMod/cpyInc.hpp.am | 3 + .../subprojects/cmMod/cpyNext.cpp.am | 5 + .../subprojects/cmMod/cpyNext.hpp.am | 5 + .../8 custom command/subprojects/cmMod/cpyTest.cpp | 9 + .../subprojects/cmMod/cpyTest/CMakeLists.txt | 7 + .../subprojects/cmMod/cpyTest/cpyTest.hpp | 5 + .../subprojects/cmMod/cpyTest/cpyTest2.hpp | 3 + .../subprojects/cmMod/cpyTest/cpyTest3.hpp | 3 + .../subprojects/cmMod/cpyTest/cpyTest4.hpp | 3 + .../subprojects/cmMod/cpyTest/cpyTest5.hpp | 3 + .../8 custom command/subprojects/cmMod/genMain.cpp | 40 + .../subprojects/cmMod/macro_name.cpp | 20 + .../subprojects/cmMod/mycpy/.gitkeep | 1 + test cases/cmake/9 disabled subproject/meson.build | 6 + test cases/common/1 trivial/meson.build | 29 + test cases/common/1 trivial/trivial.c | 6 + test cases/common/10 man install/bar.2 | 1 + test cases/common/10 man install/baz.1.in | 6 + test cases/common/10 man install/foo.1 | 1 + test cases/common/10 man install/foo.fr.1 | 1 + test cases/common/10 man install/meson.build | 14 + test cases/common/10 man install/test.json | 10 + .../common/10 man install/vanishing/meson.build | 1 + .../common/10 man install/vanishing/vanishing.1 | 1 + .../common/10 man install/vanishing/vanishing.2 | 1 + .../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 + .../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/103 has header symbol/meson.build | 40 + test cases/common/104 has arg/meson.build | 60 + test cases/common/105 generatorcustom/catter.py | 14 + test cases/common/105 generatorcustom/gen-resx.py | 9 + test cases/common/105 generatorcustom/gen.c | 35 + test cases/common/105 generatorcustom/gen.py | 13 + test cases/common/105 generatorcustom/host.c | 9 + test cases/common/105 generatorcustom/main.c | 8 + test cases/common/105 generatorcustom/meson.build | 44 + test cases/common/105 generatorcustom/res1.txt | 1 + test cases/common/105 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 spaces backslash/asm output/meson.build | 1 + .../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 + 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/11 subdir/meson.build | 2 + test cases/common/11 subdir/subdir/meson.build | 2 + test cases/common/11 subdir/subdir/prog.c | 1 + 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 + test cases/common/111 pathjoin/meson.build | 27 + .../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 | 19 + test cases/common/114 skip/meson.build | 3 + .../common/115 subproject project arguments/exe.c | 27 + .../115 subproject project arguments/exe.cpp | 27 + .../115 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/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/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/12 data/datafile.dat | 1 + test cases/common/12 data/etcfile.dat | 1 + test cases/common/12 data/fileobject_datafile.dat | 1 + test cases/common/12 data/meson.build | 24 + test cases/common/12 data/runscript.sh | 3 + test cases/common/12 data/somefile.txt | 0 test cases/common/12 data/test.json | 15 + test cases/common/12 data/to_be_renamed_1.txt | 0 test cases/common/12 data/to_be_renamed_3.txt | 0 test cases/common/12 data/to_be_renamed_4.txt | 0 test cases/common/12 data/vanishing/meson.build | 1 + .../common/12 data/vanishing/to_be_renamed_2.txt | 0 test cases/common/12 data/vanishing/vanishing.dat | 1 + test cases/common/12 data/vanishing/vanishing2.dat | 4 + .../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 | 15 + .../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 + .../common/121 object only target/meson.build | 51 + .../common/121 object only target/obj_generator.py | 20 + .../121 object only target/objdir/meson.build | 27 + .../common/121 object only target/objdir/source4.c | 3 + .../common/121 object only target/objdir/source5.c | 3 + .../common/121 object only target/objdir/source6.c | 3 + test cases/common/121 object only target/prog.c | 11 + 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 + .../123 custom target directory install/docgen.py | 15 + .../meson.build | 9 + .../123 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/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 | 66 + .../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 + .../128 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 | 44 + test cases/common/129 build by default/mygen.py | 8 + test cases/common/129 build by default/source.txt | 1 + test cases/common/13 pch/c/meson.build | 14 + test cases/common/13 pch/c/pch/prog.h | 6 + test cases/common/13 pch/c/prog.c | 9 + test cases/common/13 pch/cpp/meson.build | 1 + test cases/common/13 pch/cpp/pch/prog.hh | 1 + test cases/common/13 pch/cpp/prog.cc | 11 + test cases/common/13 pch/generated/gen_custom.py | 5 + .../common/13 pch/generated/gen_generator.py | 7 + .../common/13 pch/generated/generated_generator.in | 1 + test cases/common/13 pch/generated/meson.build | 22 + test cases/common/13 pch/generated/pch/prog.h | 2 + test cases/common/13 pch/generated/prog.c | 5 + test cases/common/13 pch/linkwhole/lib1.c | 4 + test cases/common/13 pch/linkwhole/lib2.c | 6 + test cases/common/13 pch/linkwhole/main.c | 9 + test cases/common/13 pch/linkwhole/meson.build | 8 + test cases/common/13 pch/linkwhole/pch1/pch_one.h | 4 + test cases/common/13 pch/linkwhole/pch2/pch_two.h | 4 + test cases/common/13 pch/meson.build | 26 + test cases/common/13 pch/mixed/func.c | 7 + test cases/common/13 pch/mixed/main.cc | 10 + test cases/common/13 pch/mixed/meson.build | 14 + test cases/common/13 pch/mixed/pch/func.h | 1 + test cases/common/13 pch/mixed/pch/main.h | 1 + test cases/common/13 pch/userDefined/meson.build | 10 + test cases/common/13 pch/userDefined/pch/pch.c | 5 + test cases/common/13 pch/userDefined/pch/pch.h | 1 + test cases/common/13 pch/userDefined/prog.c | 8 + .../withIncludeDirectories/include/lib/lib.h | 1 + .../13 pch/withIncludeDirectories/meson.build | 15 + .../13 pch/withIncludeDirectories/pch/prog.h | 1 + .../common/13 pch/withIncludeDirectories/prog.c | 9 + .../common/13 pch/withIncludeFile/meson.build | 18 + .../common/13 pch/withIncludeFile/pch/prog.h | 6 + test cases/common/13 pch/withIncludeFile/prog.c | 10 + .../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 + 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 | 111 + test cases/common/132 get define/meson_options.txt | 1 + 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/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 + .../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 + test cases/common/136 empty build file/meson.build | 2 + .../common/136 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 | 49 + 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 + .../139 mesonintrospect from scripts/check_env.py | 28 + .../check_introspection.py | 18 + .../139 mesonintrospect from scripts/meson.build | 14 + test cases/common/14 configure file/basename.py | 28 + test cases/common/14 configure file/check_file.py | 34 + .../common/14 configure file/check_inputs.py | 14 + test cases/common/14 configure file/config.h | 1 + test cases/common/14 configure file/config.h.in | 5 + test cases/common/14 configure file/config4a.h.in | 2 + test cases/common/14 configure file/config4b.h.in | 2 + test cases/common/14 configure file/config5.h.in | 1 + test cases/common/14 configure file/config6.h.in | 19 + test cases/common/14 configure file/config7.h.in | 16 + test cases/common/14 configure file/config8.h.in | 3 + test cases/common/14 configure file/depfile | 0 .../14 configure file/differentafterbasename1.in | 0 .../14 configure file/differentafterbasename2.in | 0 test cases/common/14 configure file/dummy.dat | 0 test cases/common/14 configure file/dumpprog.c | 52 + .../common/14 configure file/file_contains.py | 22 + .../common/14 configure file/generator-deps.py | 19 + .../generator-without-input-file.py | 14 + test cases/common/14 configure file/generator.py | 17 + .../common/14 configure file/invalid-utf8.bin.in | Bin 0 -> 10 bytes test cases/common/14 configure file/meson.build | 330 +++ .../14 configure file/nosubst-nocopy1.txt.in | 1 + .../14 configure file/nosubst-nocopy2.txt.in | 1 + test cases/common/14 configure file/prog.c | 17 + test cases/common/14 configure file/prog2.c | 5 + test cases/common/14 configure file/prog4.c | 6 + test cases/common/14 configure file/prog5.c | 6 + test cases/common/14 configure file/prog6.c | 11 + test cases/common/14 configure file/prog7.c | 10 + test cases/common/14 configure file/prog9.c | 18 + .../common/14 configure file/sameafterbasename.in | 0 .../common/14 configure file/sameafterbasename.in2 | 0 .../common/14 configure file/subdir/meson.build | 38 + test cases/common/14 configure file/test.json | 9 + test cases/common/14 configure file/test.py.in | 4 + test cases/common/14 configure file/touch.py | 16 + .../generator.py | 14 + .../140 custom target multiple outputs/meson.build | 44 + .../140 custom target multiple outputs/test.json | 10 + .../common/141 special characters/.editorconfig | 2 + .../common/141 special characters/arg-char-test.c | 11 + .../141 special characters/arg-string-test.c | 13 + .../141 special characters/arg-unquoted-test.c | 18 + .../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 + 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 + .../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 | 14 + .../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 + test cases/common/147 simd/fallback.c | 8 + test cases/common/147 simd/include/simdheader.h | 3 + test cases/common/147 simd/meson.build | 43 + 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 | 36 + 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 | 25 + .../module.c | 16 + .../prog.c | 61 + test cases/common/149 dotinclude/dotproc.c | 10 + test cases/common/149 dotinclude/meson.build | 4 + test cases/common/149 dotinclude/stdio.h | 6 + test cases/common/15 if/meson.build | 72 + test cases/common/15 if/prog.c | 1 + .../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 + .../coverage-sonarqube/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/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 + .../153 wrap file should not failed/meson.build | 23 + .../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-1.0/bar.c | 3 + .../subprojects/bar-1.0/meson.build | 2 + .../subprojects/bar.wrap | 8 + .../subprojects/foo-1.0-patchdir/foo.c | 3 + .../subprojects/foo-1.0-patchdir/meson.build | 2 + .../.meson-subproject-wrap-hash.txt | 1 + .../subprojects/foo-1.0-patchfile/foo.c | 7 + .../subprojects/foo-1.0-patchfile/meson.build | 2 + .../subprojects/foo-1.0/foo.c | 3 + .../subprojects/foo-1.0/meson.build | 2 + .../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 + .../patchfile/0001-Change-foo-to-executable.patch | 33 + .../patchfile/0001-Change-return-value-to-43.patch | 21 + .../patchfile/0002-Change-return-value-to-44.patch | 21 + .../subprojects/patchdir.wrap | 9 + .../subprojects/patchfile.wrap | 14 + .../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 + .../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 | 3 + .../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 + .../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/16 comparison/meson.build | 146 ++ test cases/common/16 comparison/prog.c | 1 + .../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 test cases/common/162 subdir if_found/meson.build | 11 + .../common/162 subdir if_found/subdir/meson.build | 1 + .../meson.build | 1 + .../common/164 dependency factory/meson.build | 66 + test cases/common/165 get project license/bar.c | 6 + .../common/165 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 | 14 + .../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/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 + 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 + .../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 | 62 + .../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/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 + .../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/176 subproject version/meson.build | 9 + .../subprojects/a/meson.build | 5 + test cases/common/177 subdir_done/meson.build | 11 + test cases/common/178 bothlibraries/dummy.py | 8 + test cases/common/178 bothlibraries/foo.cpp | 11 + test cases/common/178 bothlibraries/libfile.c | 7 + test cases/common/178 bothlibraries/main.c | 8 + test cases/common/178 bothlibraries/main2.c | 9 + test cases/common/178 bothlibraries/meson.build | 62 + test cases/common/178 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 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 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 | 25 + .../common/182 find override/otherdir/main.c | 5 + .../common/182 find override/otherdir/main2.c | 5 + .../common/182 find override/otherdir/meson.build | 30 + .../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 + .../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 + 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 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 | 25 + test cases/common/188 dict/meson.build | 82 + 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/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/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 | 60 + 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 | 22 + test cases/common/190 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 | 62 + .../common/192 feature option/meson_options.txt | 3 + .../common/193 feature option disabled/meson.build | 23 + .../193 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 + .../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 | 119 + .../197 function attributes/meson_options.txt | 7 + .../common/197 function attributes/test.json | 10 + .../common/198 broken subproject/meson.build | 2 + .../subprojects/broken/broken.c | 1 + .../subprojects/broken/meson.build | 4 + test cases/common/199 argument syntax/meson.build | 19 + test cases/common/2 cpp/VERSIONFILE | 1 + test cases/common/2 cpp/cpp.C | 6 + test cases/common/2 cpp/meson.build | 41 + test cases/common/2 cpp/something.txt | 1 + test cases/common/2 cpp/trivial.cc | 6 + 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 + .../200 install name_prefix name_suffix/libfile.c | 14 + .../meson.build | 13 + .../200 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 + .../common/203 find_library and headers/foo.h | 1 + .../203 find_library and headers/meson.build | 23 + .../common/204 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 + 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 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 + .../generate_conflicting_stlibs.py | 90 + .../meson.build | 42 + .../209 link custom_i single from multiple/prog.c | 5 + 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 + .../211 dependency get_variable method/meson.build | 67 + .../211 dependency get_variable method/test.json | 9 + .../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 + 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 + .../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/dummy.cpp | 0 .../215 source set realistic example/main.cc | 32 + .../215 source set realistic example/meson.build | 53 + .../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 | 17 + .../libdir/gen.py | 6 + .../libdir/meson.build | 21 + .../libdir/source.c | 3 + .../meson.build | 48 + 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 + .../common/219 include_type dependency/main.cpp | 8 + .../common/219 include_type dependency/meson.build | 44 + .../219 include_type dependency/pch/test.hpp | 1 + .../subprojects/subDep/meson.build | 3 + .../common/22 object extraction/check-obj.py | 21 + .../common/22 object extraction/create-source.py | 3 + test cases/common/22 object extraction/header.h | 1 + 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 | 50 + test cases/common/22 object extraction/src/lib.c | 3 + test cases/common/220 fs module/meson.build | 144 ++ test cases/common/220 fs module/subdir/meson.build | 6 + .../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 + 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/223 persubproject options/foo.c | 5 + .../common/223 persubproject options/main.cpp | 3 + .../common/223 persubproject options/meson.build | 20 + .../subprojects/sub1/foo.c | 8 + .../subprojects/sub1/meson.build | 10 + .../subprojects/sub2/foo.c | 9 + .../subprojects/sub2/foo.cpp | 10 + .../subprojects/sub2/meson.build | 16 + .../common/223 persubproject options/test.json | 7 + .../common/224 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 | 20 + .../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/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/230 external project/app.c | 6 + test cases/common/230 external project/func.c | 6 + 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 | 23 + test cases/common/230 external project/meson.build | 27 + test cases/common/230 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/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 .../235 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 + .../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 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 + .../meson.build | 18 + .../240 dependency native host == build/test.json | 14 + .../common/241 set and get variable/meson.build | 71 + .../common/241 set and get variable/test1.txt | 0 .../common/241 set and get variable/test2.txt | 0 .../common/242 custom target feed/data_source.txt | 1 + .../common/242 custom target feed/meson.build | 24 + .../common/242 custom target feed/my_compiler.py | 14 + test cases/common/242 custom target feed/test.json | 5 + test cases/common/243 escape++/meson.build | 4 + test cases/common/243 escape++/test.c | 3 + test cases/common/244 variable scope/meson.build | 15 + .../245 custom target index source/code_source.c | 6 + .../245 custom target index source/copyfile.py | 6 + .../245 custom target index source/copyfile2.py | 7 + .../245 custom target index source/header_source.h | 1 + .../common/245 custom target index source/main.c | 8 + .../245 custom target index source/meson.build | 51 + .../common/246 dependency fallbacks/meson.build | 10 + .../subprojects/png/meson.build | 3 + .../common/247 deprecated option/meson.build | 20 + .../common/247 deprecated option/meson_options.txt | 23 + test cases/common/247 deprecated option/test.json | 29 + test cases/common/248 install_emptydir/meson.build | 4 + test cases/common/248 install_emptydir/test.json | 7 + test cases/common/249 install_symlink/datafile.dat | 1 + test cases/common/249 install_symlink/meson.build | 9 + test cases/common/249 install_symlink/test.json | 7 + .../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 + .../common/250 system include dir/lib/lib.hpp | 4 + test cases/common/250 system include dir/main.cpp | 3 + .../common/250 system include dir/meson.build | 13 + .../common/251 add_project_dependencies/inc/lib.h | 2 + .../common/251 add_project_dependencies/lib.c | 14 + .../common/251 add_project_dependencies/main.c | 5 + .../251 add_project_dependencies/meson.build | 22 + .../common/252 install data structured/dir1/bad | 0 .../common/252 install data structured/dir1/file1 | 0 .../common/252 install data structured/dir1/file2 | 0 .../common/252 install data structured/dir1/file3 | 0 .../common/252 install data structured/dir2/bad | 0 .../common/252 install data structured/dir2/file1 | 0 .../common/252 install data structured/dir2/file2 | 0 .../common/252 install data structured/dir2/file3 | 0 .../common/252 install data structured/dir3/bad | 0 .../common/252 install data structured/dir3/file1 | 0 .../common/252 install data structured/dir3/file2 | 0 .../common/252 install data structured/dir3/file3 | 0 .../common/252 install data structured/meson.build | 16 + .../252 install data structured/pysrc/__init__.py | 1 + .../252 install data structured/pysrc/bad.py | 1 + .../252 install data structured/pysrc/bar.py | 1 + .../252 install data structured/pysrc/foo.py | 1 + .../252 install data structured/pysrc/meson.build | 11 + .../pysrc/submod/__init__.py | 1 + .../pysrc/submod/bad.py | 1 + .../pysrc/submod/baz.py | 1 + .../common/252 install data structured/test.json | 18 + .../meson.build | 18 + .../subprojects/subfiles/foo.c | 1 + .../subprojects/subfiles/meson.build | 29 + .../subprojects/subfiles/subdir/foo.c | 1 + .../subprojects/subfiles/subdir2/foo.c | 1 + .../253 subproject dependency variables/test.json | 8 + test cases/common/254 long output/dumper.c | 17 + test cases/common/254 long output/meson.build | 5 + test cases/common/255 module warnings/meson.build | 9 + test cases/common/255 module warnings/test.json | 16 + .../common/256 subproject extracted objects/foo.c | 11 + .../256 subproject extracted objects/meson.build | 5 + .../subprojects/myobjects/cpplib.cpp | 6 + .../subprojects/myobjects/cpplib.h | 12 + .../subprojects/myobjects/meson.build | 3 + .../256 subproject extracted objects/test.json | 5 + test cases/common/257 generated header dep/foo.c | 1 + .../common/257 generated header dep/meson.build | 22 + .../common/258 subsubproject inplace/meson.build | 3 + .../subprojects/sub/meson.build | 3 + .../sub/subprojects/subsub-1.0/meson.build | 1 + .../subprojects/sub/subprojects/subsub.wrap | 2 + .../subprojects/subsub.wrap | 2 + test cases/common/259 preprocess/bar.c | 3 + test cases/common/259 preprocess/foo.c | 1 + test cases/common/259 preprocess/foo.h | 2 + test cases/common/259 preprocess/meson.build | 15 + test cases/common/259 preprocess/src/file.map.in | 3 + test cases/common/259 preprocess/src/meson.build | 3 + test cases/common/26 find program/meson.build | 39 + .../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 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/3 static/libfile.c | 3 + test cases/common/3 static/libfile2.c | 3 + test cases/common/3 static/meson.build | 14 + test cases/common/3 static/meson_options.txt | 1 + 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/32 has header/meson.build | 54 + test cases/common/32 has header/ouagadougou.h | 1 + test cases/common/33 run program/check-env.py | 5 + 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/35 string operations/meson.build | 127 + test cases/common/36 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/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/4 shared/libfile.c | 14 + test cases/common/4 shared/meson.build | 13 + test cases/common/40 options/meson.build | 45 + test cases/common/40 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 | 11 + 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 + .../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/44 pkgconfig-gen/answer.c | 3 + .../common/44 pkgconfig-gen/dependencies/custom.c | 3 + .../common/44 pkgconfig-gen/dependencies/dummy.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/foo.c | 7 + test cases/common/44 pkgconfig-gen/meson.build | 178 ++ 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 | 33 + .../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/46 subproject subproject/meson.build | 11 + test cases/common/46 subproject subproject/prog.c | 5 + .../46 subproject subproject/subprojects/a/a.c | 14 + .../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 + 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/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 | 73 + test cases/common/49 custom target/my_compiler.py | 22 + test cases/common/49 custom target/test.json | 5 + test cases/common/5 linkstatic/libfile.c | 3 + test cases/common/5 linkstatic/libfile2.c | 3 + test cases/common/5 linkstatic/libfile3.c | 3 + test cases/common/5 linkstatic/libfile4.c | 3 + test cases/common/5 linkstatic/main.c | 5 + test cases/common/5 linkstatic/meson.build | 6 + .../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/51 run target/.clang-format | 1 + test cases/common/51 run target/.clang-tidy | 0 test cases/common/51 run target/check-env.py | 28 + 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 | 112 + .../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 + .../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 + .../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 + 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/a.txt | 0 test cases/common/56 array methods/b.txt | 0 test cases/common/56 array methods/c.txt | 0 test cases/common/56 array methods/meson.build | 70 + .../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 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/6 linkshared/cpplib.cpp | 6 + test cases/common/6 linkshared/cpplib.h | 12 + test cases/common/6 linkshared/cppmain.cpp | 5 + test cases/common/6 linkshared/libfile.c | 14 + test cases/common/6 linkshared/main.c | 11 + test cases/common/6 linkshared/meson.build | 12 + test cases/common/6 linkshared/test.json | 6 + 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/61 number arithmetic/meson.build | 76 + test cases/common/62 string arithmetic/meson.build | 49 + test cases/common/62 string arithmetic/test.json | 7 + test cases/common/63 array arithmetic/meson.build | 15 + test cases/common/64 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 vcstag/meson.build | 42 + test cases/common/66 vcstag/tagprog.c | 8 + test cases/common/66 vcstag/vcstag.c.in | 1 + test cases/common/66 vcstag/version.py | 3 + test cases/common/67 modules/meson.build | 14 + test cases/common/67 modules/meson_options.txt | 6 + 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/7 mixed/func.c | 4 + test cases/common/7 mixed/main.cc | 7 + test cases/common/7 mixed/meson.build | 3 + .../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 + 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 | 3 + 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 | 3 + test cases/common/74 file object/lib.c | 3 + test cases/common/74 file object/meson.build | 8 + 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/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 | 3 + .../common/75 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 + .../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 + 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 | 22 + 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/8 install/gendir.py | 8 + test cases/common/8 install/meson.build | 10 + test cases/common/8 install/prog.c | 3 + test cases/common/8 install/stat.c | 1 + test cases/common/8 install/test.json | 9 + 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/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 + .../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 + test cases/common/84 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/87 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 | 38 + .../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 | 18 + .../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 + .../common/9 header install/child/childdir.h | 3 + test cases/common/9 header install/meson.build | 12 + test cases/common/9 header install/rootdir.h | 3 + .../common/9 header install/sub/fileheader.h | 3 + test cases/common/9 header install/sub/meson.build | 1 + test cases/common/9 header install/subdir.h | 3 + test cases/common/9 header install/test.json | 10 + .../9 header install/vanishing_subdir/meson.build | 1 + .../9 header install/vanishing_subdir/vanished.h | 5 + 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/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/94 threads/meson.build | 21 + test cases/common/94 threads/threadprog.c | 46 + 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/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/98 subproject subdir/meson.build | 94 + 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 | 13 + .../subprojects/sub_implicit/meson_options.txt | 1 + .../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 + .../subprojects/sub_static/meson.build | 8 + 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/csharp/1 basic/meson.build | 4 + test cases/csharp/1 basic/prog.cs | 8 + test cases/csharp/1 basic/test.json | 6 + test cases/csharp/1 basic/text.cs | 7 + test cases/csharp/2 library/helper.cs | 7 + test cases/csharp/2 library/meson.build | 15 + test cases/csharp/2 library/prog.cs | 8 + test cases/csharp/2 library/test.json | 9 + test cases/csharp/3 resource/TestRes.resx | 31 + test cases/csharp/3 resource/meson.build | 6 + test cases/csharp/3 resource/resprog.cs | 13 + test cases/csharp/4 external dep/hello.txt | 1 + test cases/csharp/4 external dep/meson.build | 9 + test cases/csharp/4 external dep/prog.cs | 8 + test cases/csharp/4 external dep/test.json | 5 + test cases/cuda/1 simple/meson.build | 4 + test cases/cuda/1 simple/prog.cu | 29 + test cases/cuda/10 cuda dependency/c/meson.build | 2 + test cases/cuda/10 cuda dependency/c/prog.c | 19 + test cases/cuda/10 cuda dependency/cpp/meson.build | 2 + test cases/cuda/10 cuda dependency/cpp/prog.cc | 19 + test cases/cuda/10 cuda dependency/meson.build | 6 + .../cuda/10 cuda dependency/modules/meson.build | 2 + test cases/cuda/10 cuda dependency/modules/prog.cc | 33 + .../10 cuda dependency/version_reqs/meson.build | 2 + .../cuda/10 cuda dependency/version_reqs/prog.cc | 28 + .../cuda/11 cuda dependency (nvcc)/meson.build | 4 + .../11 cuda dependency (nvcc)/modules/meson.build | 2 + .../cuda/11 cuda dependency (nvcc)/modules/prog.cu | 33 + .../version_reqs/meson.build | 2 + .../11 cuda dependency (nvcc)/version_reqs/prog.cu | 29 + .../cuda/12 cuda dependency (mixed)/kernel.cu | 8 + .../cuda/12 cuda dependency (mixed)/meson.build | 4 + .../cuda/12 cuda dependency (mixed)/prog.cpp | 37 + .../cuda/13 cuda compiler setting/meson.build | 4 + .../cuda/13 cuda compiler setting/nativefile.ini | 3 + test cases/cuda/13 cuda compiler setting/prog.cu | 29 + .../cuda/14 cuda has header symbol/meson.build | 26 + test cases/cuda/15 sanitizer/meson.build | 4 + test cases/cuda/15 sanitizer/prog.cu | 29 + test cases/cuda/16 multistd/lib.cu | 3 + test cases/cuda/16 multistd/main.cu | 21 + test cases/cuda/16 multistd/meson.build | 13 + test cases/cuda/2 split/lib.cu | 12 + test cases/cuda/2 split/main.cpp | 7 + test cases/cuda/2 split/meson.build | 6 + test cases/cuda/2 split/static/lib.cu | 12 + test cases/cuda/2 split/static/libsta.cu | 12 + test cases/cuda/2 split/static/main_static.cpp | 7 + test cases/cuda/2 split/static/meson.build | 4 + test cases/cuda/3 cudamodule/meson.build | 69 + test cases/cuda/3 cudamodule/prog.cu | 29 + test cases/cuda/4 shared/main.cu | 20 + test cases/cuda/4 shared/meson.build | 6 + test cases/cuda/4 shared/shared/kernels.cu | 13 + test cases/cuda/4 shared/shared/kernels.h | 86 + test cases/cuda/4 shared/shared/meson.build | 7 + test cases/cuda/5 threads/main.cu | 20 + test cases/cuda/5 threads/meson.build | 7 + test cases/cuda/5 threads/shared/kernels.cu | 13 + test cases/cuda/5 threads/shared/kernels.h | 86 + test cases/cuda/5 threads/shared/meson.build | 5 + test cases/cuda/6 std/main.cu | 20 + test cases/cuda/6 std/meson.build | 4 + test cases/cuda/7 static vs runtime/main.cu | 20 + test cases/cuda/7 static vs runtime/meson.build | 4 + test cases/cuda/8 release/main.cu | 24 + test cases/cuda/8 release/meson.build | 10 + test cases/cuda/9 optimize for space/main.cu | 20 + test cases/cuda/9 optimize for space/meson.build | 4 + test cases/cython/1 basic/cytest.py | 19 + test cases/cython/1 basic/libdir/cstorer.pxd | 9 + test cases/cython/1 basic/libdir/meson.build | 8 + test cases/cython/1 basic/libdir/storer.c | 24 + test cases/cython/1 basic/libdir/storer.h | 16 + test cases/cython/1 basic/libdir/storer.pyx | 16 + test cases/cython/1 basic/meson.build | 20 + test cases/cython/1 basic/test.json | 10 + .../cython/2 generated sources/configure.pyx.in | 2 + test cases/cython/2 generated sources/g.in | 2 + test cases/cython/2 generated sources/gen.py | 14 + test cases/cython/2 generated sources/generator.py | 12 + .../cython/2 generated sources/includestuff.pyx | 1 + .../cython/2 generated sources/libdir/gen.py | 14 + .../cython/2 generated sources/libdir/meson.build | 10 + test cases/cython/2 generated sources/meson.build | 105 + .../cython/2 generated sources/simpleinclude.pyx | 1 + .../cython/2 generated sources/simplestuff.pxi | 2 + test cases/cython/2 generated sources/stuff.pxi.in | 2 + test cases/cython/2 generated sources/test.py | 13 + test cases/cython/3 cython_args/cythonargs.pyx | 5 + test cases/cython/3 cython_args/meson.build | 30 + test cases/cython/3 cython_args/test.py | 3 + test cases/d/1 simple/app.d | 8 + test cases/d/1 simple/meson.build | 4 + test cases/d/1 simple/test.json | 6 + test cases/d/1 simple/utils.d | 8 + test cases/d/10 d cpp/cppmain.cpp | 18 + test cases/d/10 d cpp/dmain.d | 5 + test cases/d/10 d cpp/libfile.cpp | 5 + test cases/d/10 d cpp/libfile.d | 5 + test cases/d/10 d cpp/meson.build | 13 + test cases/d/11 dub/.gitignore | 1 + test cases/d/11 dub/meson.build | 23 + test cases/d/11 dub/test.d | 14 + test cases/d/12 root include directory/meson.build | 7 + .../d/12 root include directory/some/dlang/code.d | 7 + .../some/dlang/meson.build | 8 + .../d/12 root include directory/some/meson.build | 1 + test cases/d/13 declare dep/meson.build | 13 + test cases/d/13 declare dep/test.d | 15 + test cases/d/13 declare dep/views/test.txt | 1 + test cases/d/14 dub with deps/meson.build | 34 + test cases/d/14 dub with deps/test.d | 59 + test cases/d/15 compiler run checks/meson.build | 50 + test cases/d/15 compiler run checks/test_sizeof.d | 17 + test cases/d/16 code generation/exe.d | 9 + test cases/d/16 code generation/generator.d | 13 + test cases/d/16 code generation/input.txt | 1 + test cases/d/16 code generation/meson.build | 18 + test cases/d/2 static library/app.d | 8 + test cases/d/2 static library/libstuff.d | 9 + test cases/d/2 static library/meson.build | 5 + test cases/d/2 static library/test.json | 7 + test cases/d/3 shared library/app.d | 8 + test cases/d/3 shared library/libstuff.d | 14 + test cases/d/3 shared library/libstuff.di | 3 + test cases/d/3 shared library/lld-test.py | 20 + test cases/d/3 shared library/meson.build | 26 + test cases/d/3 shared library/sub/libstuff.d | 14 + test cases/d/3 shared library/sub/meson.build | 1 + test cases/d/3 shared library/test.json | 11 + test cases/d/4 library versions/lib.d | 16 + test cases/d/4 library versions/meson.build | 25 + test cases/d/4 library versions/test.json | 25 + test cases/d/5 mixed/app.d | 8 + test cases/d/5 mixed/libstuff.c | 18 + test cases/d/5 mixed/meson.build | 9 + test cases/d/5 mixed/test.json | 13 + test cases/d/6 unittest/app.d | 38 + test cases/d/6 unittest/meson.build | 8 + test cases/d/6 unittest/second_unit.d | 10 + test cases/d/6 unittest/test.json | 6 + test cases/d/7 multilib/app.d | 9 + test cases/d/7 multilib/meson.build | 24 + test cases/d/7 multilib/say1.d | 15 + test cases/d/7 multilib/say1.di | 1 + test cases/d/7 multilib/say2.d | 15 + test cases/d/7 multilib/say2.di | 1 + test cases/d/7 multilib/test.json | 18 + test cases/d/8 has multi arguments/meson.build | 8 + test cases/d/9 features/app.d | 82 + test cases/d/9 features/data/food.txt | 6 + test cases/d/9 features/data/people.txt | 5 + test cases/d/9 features/extra.d | 9 + test cases/d/9 features/meson.build | 106 + .../failing build/1 vala c werror/meson.build | 10 + test cases/failing build/1 vala c werror/prog.vala | 7 + .../failing build/1 vala c werror/unused-var.c | 8 + test cases/failing build/2 hidden symbol/bob.c | 5 + test cases/failing build/2 hidden symbol/bob.h | 3 + test cases/failing build/2 hidden symbol/bobuser.c | 5 + .../failing build/2 hidden symbol/meson.build | 11 + .../failing build/3 pch disabled/c/meson.build | 2 + .../failing build/3 pch disabled/c/pch/prog.h | 1 + .../failing build/3 pch disabled/c/pch/prog_pch.c | 5 + test cases/failing build/3 pch disabled/c/prog.c | 9 + .../failing build/3 pch disabled/meson.build | 5 + .../4 cmake subproject isolation/incDir/fileA.hpp | 3 + .../4 cmake subproject isolation/main.cpp | 10 + .../4 cmake subproject isolation/meson.build | 17 + .../subprojects/cmMod/CMakeLists.txt | 10 + .../subprojects/cmMod/cmMod.cpp | 12 + .../subprojects/cmMod/cmMod.hpp | 14 + .../4 cmake subproject isolation/test.json | 5 + test cases/failing build/5 failed pickled/false.py | 4 + .../failing build/5 failed pickled/meson.build | 7 + test cases/failing test/1 trivial/main.c | 3 + test cases/failing test/1 trivial/meson.build | 3 + test cases/failing test/2 signal/main.c | 6 + test cases/failing test/2 signal/meson.build | 7 + test cases/failing test/3 ambiguous/main.c | 6 + test cases/failing test/3 ambiguous/meson.build | 10 + test cases/failing test/3 ambiguous/test_runner.sh | 7 + test cases/failing test/4 hard error/main.c | 3 + test cases/failing test/4 hard error/meson.build | 4 + test cases/failing test/5 tap tests/meson.build | 9 + test cases/failing test/5 tap tests/tester.c | 10 + .../failing test/5 tap tests/tester_with_status.c | 8 + test cases/failing test/6 xpass/meson.build | 4 + test cases/failing test/6 xpass/xpass.c | 1 + test cases/failing/1 project not first/meson.build | 4 + test cases/failing/1 project not first/prog.c | 1 + test cases/failing/1 project not first/test.json | 7 + test cases/failing/10 out of bounds/meson.build | 4 + test cases/failing/10 out of bounds/test.json | 7 + .../100 no glib-compile-resources/meson.build | 8 + .../100 no glib-compile-resources/test.json | 7 + .../trivial.gresource.xml | 3 + test cases/failing/101 number in combo/meson.build | 1 + .../failing/101 number in combo/nativefile.ini | 2 + test cases/failing/101 number in combo/test.json | 5 + test cases/failing/102 bool in combo/meson.build | 1 + .../failing/102 bool in combo/meson_options.txt | 5 + .../failing/102 bool in combo/nativefile.ini | 2 + test cases/failing/102 bool in combo/test.json | 5 + .../failing/103 compiler no lang/meson.build | 2 + test cases/failing/103 compiler no lang/test.json | 7 + test cases/failing/104 no fallback/meson.build | 2 + .../104 no fallback/subprojects/foob/meson.build | 2 + test cases/failing/104 no fallback/test.json | 8 + test cases/failing/105 feature require/meson.build | 2 + .../failing/105 feature require/meson_options.txt | 1 + test cases/failing/105 feature require/test.json | 8 + .../failing/106 feature require.bis/meson.build | 2 + .../106 feature require.bis/meson_options.txt | 1 + .../failing/106 feature require.bis/test.json | 8 + .../107 no build get_external_property/meson.build | 3 + .../107 no build get_external_property/test.json | 7 + .../failing/108 enter subdir twice/meson.build | 3 + .../failing/108 enter subdir twice/sub/meson.build | 1 + .../failing/108 enter subdir twice/test.json | 7 + .../109 invalid fstring/meson.build | 4 + .../109 invalid fstring/test.json | 7 + test cases/failing/109 invalid fstring/meson.build | 3 + test cases/failing/109 invalid fstring/test.json | 7 + .../failing/11 object arithmetic/meson.build | 3 + test cases/failing/11 object arithmetic/test.json | 8 + .../110 compiler argument checking/meson.build | 4 + .../110 compiler argument checking/test.json | 7 + test cases/failing/111 empty fallback/meson.build | 6 + .../111 empty fallback/subprojects/foo/meson.build | 3 + test cases/failing/111 empty fallback/test.json | 8 + .../112 cmake executable dependency/meson.build | 9 + .../subprojects/cmlib/CMakeLists.txt | 5 + .../subprojects/cmlib/main.c | 3 + .../112 cmake executable dependency/test.json | 10 + .../113 allow_fallback with fallback/meson.build | 3 + .../113 allow_fallback with fallback/test.json | 8 + .../failing/114 nonsensical bindgen/meson.build | 20 + .../failing/114 nonsensical bindgen/src/header.h | 8 + .../failing/114 nonsensical bindgen/src/source.c | 8 + .../failing/114 nonsensical bindgen/test.json | 8 + .../failing/115 run_target in test/meson.build | 7 + .../failing/115 run_target in test/test.json | 8 + .../failing/115 run_target in test/trivial.c | 6 + .../meson.build | 7 + .../116 run_target in add_install_script/test.json | 8 + .../116 run_target in add_install_script/trivial.c | 11 + .../117 pathsep in install_symlink/meson.build | 3 + .../117 pathsep in install_symlink/test.json | 7 + .../118 subproject version conflict/meson.build | 4 + .../subprojects/A/meson.build | 4 + .../subprojects/B/meson.build | 3 + .../118 subproject version conflict/test.json | 7 + .../119 structured source empty string/main.rs | 0 .../119 structured source empty string/meson.build | 13 + .../119 structured source empty string/test.json | 7 + .../failing/12 string arithmetic/meson.build | 3 + test cases/failing/12 string arithmetic/test.json | 7 + .../120 structured_sources conflicts/main.rs | 0 .../120 structured_sources conflicts/meson.build | 17 + .../120 structured_sources conflicts/test.json | 7 + .../failing/121 missing compiler/meson.build | 3 + .../121 missing compiler/subprojects/sub/main.c | 1 + .../subprojects/sub/meson.build | 4 + test cases/failing/121 missing compiler/test.json | 7 + .../failing/122 cmake subproject error/meson.build | 8 + .../subprojects/cmlib/CMakeLists.txt | 5 + .../failing/122 cmake subproject error/test.json | 10 + .../meson.build | 22 + .../test.json | 8 + .../124 subproject sandbox violation/meson.build | 34 + .../meson_options.txt | 1 + .../subprojects/subproj1/file.txt | 0 .../subprojects/subproj1/meson.build | 4 + .../subprojects/subproj1/nested/meson.build | 5 + .../subprojects/subproj2/file.txt | 0 .../subprojects/subproj2/meson.build | 7 + .../subprojects/subproj2/nested/meson.build | 0 .../subprojects/subproj3/file.txt | 0 .../subprojects/subproj3/meson.build | 3 + .../124 subproject sandbox violation/test.json | 16 + .../inc/lib.h | 2 + .../125 override and add_project_dependency/lib.c | 3 + .../meson.build | 8 + .../subprojects/a/meson.build | 10 + .../subprojects/a/prog.c | 6 + .../test.json | 7 + .../inc/lib.h | 2 + .../lib.c | 3 + .../meson.build | 5 + .../test.json | 7 + .../failing/127 extract from unity/meson.build | 4 + test cases/failing/127 extract from unity/src1.c | 3 + test cases/failing/127 extract from unity/src2.c | 3 + .../failing/127 extract from unity/test.json | 7 + .../128 subproject object as a dependency/main.c | 1 + .../meson.build | 4 + .../subprojects/sub/meson.build | 1 + .../test.json | 7 + test cases/failing/129 generator host binary/exe.c | 1 + .../failing/129 generator host binary/lib.in | 1 + .../failing/129 generator host binary/meson.build | 14 + .../failing/129 generator host binary/test.json | 5 + test cases/failing/13 array arithmetic/meson.build | 3 + test cases/failing/13 array arithmetic/test.json | 7 + .../failing/14 invalid option name/meson.build | 1 + .../14 invalid option name/meson_options.txt | 1 + .../failing/14 invalid option name/test.json | 7 + test cases/failing/15 kwarg before arg/meson.build | 3 + test cases/failing/15 kwarg before arg/prog.c | 1 + test cases/failing/15 kwarg before arg/test.json | 7 + .../failing/16 extract from subproject/main.c | 5 + .../failing/16 extract from subproject/meson.build | 9 + .../subprojects/sub_project/meson.build | 3 + .../subprojects/sub_project/sub_lib.c | 3 + .../failing/16 extract from subproject/test.json | 7 + test cases/failing/17 same target/file.c | 1 + test cases/failing/17 same target/meson.build | 4 + test cases/failing/17 same target/test.json | 7 + test cases/failing/18 wrong plusassign/meson.build | 3 + test cases/failing/18 wrong plusassign/test.json | 7 + test cases/failing/19 target clash/clash.c | 6 + test cases/failing/19 target clash/meson.build | 15 + test cases/failing/19 target clash/test.json | 7 + test cases/failing/2 missing file/meson.build | 3 + test cases/failing/2 missing file/test.json | 7 + test cases/failing/20 version/meson.build | 1 + test cases/failing/20 version/test.json | 8 + test cases/failing/21 subver/meson.build | 3 + .../failing/21 subver/subprojects/foo/meson.build | 1 + test cases/failing/21 subver/test.json | 7 + test cases/failing/22 assert/meson.build | 3 + test cases/failing/22 assert/test.json | 7 + test cases/failing/23 rel testdir/meson.build | 4 + test cases/failing/23 rel testdir/simple.c | 3 + test cases/failing/23 rel testdir/test.json | 7 + test cases/failing/24 int conversion/meson.build | 3 + test cases/failing/24 int conversion/test.json | 7 + test cases/failing/25 badlang/meson.build | 3 + test cases/failing/25 badlang/test.json | 7 + test cases/failing/26 output subdir/foo.in | 1 + test cases/failing/26 output subdir/meson.build | 5 + .../failing/26 output subdir/subdir/dummy.txt | 1 + test cases/failing/26 output subdir/test.json | 7 + test cases/failing/27 noprog use/meson.build | 9 + test cases/failing/27 noprog use/test.json | 7 + test cases/failing/28 no crossprop/meson.build | 3 + test cases/failing/28 no crossprop/test.json | 7 + test cases/failing/29 nested ternary/meson.build | 3 + test cases/failing/29 nested ternary/test.json | 7 + test cases/failing/3 missing subdir/meson.build | 3 + test cases/failing/3 missing subdir/test.json | 9 + test cases/failing/30 invalid man extension/foo.a1 | 0 .../failing/30 invalid man extension/meson.build | 2 + .../failing/30 invalid man extension/test.json | 7 + test cases/failing/31 no man extension/foo | 0 test cases/failing/31 no man extension/meson.build | 2 + test cases/failing/31 no man extension/test.json | 7 + .../failing/32 exe static shared/meson.build | 11 + test cases/failing/32 exe static shared/prog.c | 10 + test cases/failing/32 exe static shared/shlib2.c | 16 + test cases/failing/32 exe static shared/stat.c | 3 + test cases/failing/32 exe static shared/test.json | 7 + .../failing/33 non-root subproject/meson.build | 3 + .../33 non-root subproject/some/meson.build | 1 + .../failing/33 non-root subproject/test.json | 7 + .../meson.build | 4 + .../test.json | 8 + .../failing/35 project argument after target/exe.c | 3 + .../35 project argument after target/meson.build | 7 + .../35 project argument after target/test.json | 7 + .../meson.build | 7 + .../test.json | 7 + .../meson.build | 8 + .../37 has function external dependency/mylib.c | 1 + .../37 has function external dependency/test.json | 7 + test cases/failing/38 prefix absolute/meson.build | 2 + test cases/failing/38 prefix absolute/test.json | 11 + test cases/failing/39 kwarg assign/dummy.c | 3 + test cases/failing/39 kwarg assign/meson.build | 3 + test cases/failing/39 kwarg assign/prog.c | 3 + test cases/failing/39 kwarg assign/test.json | 7 + .../failing/4 missing meson.build/meson.build | 3 + .../failing/4 missing meson.build/subdir/dummy.txt | 1 + test cases/failing/4 missing meson.build/test.json | 9 + .../40 custom target plainname many inputs/1.txt | 1 + .../40 custom target plainname many inputs/2.txt | 1 + .../catfiles.py | 9 + .../meson.build | 8 + .../test.json | 7 + .../generator.py | 16 + .../meson.build | 13 + .../test.json | 33 + .../failing/42 project name colon/meson.build | 1 + test cases/failing/42 project name colon/test.json | 7 + test cases/failing/43 abs subdir/bob/meson.build | 2 + test cases/failing/43 abs subdir/meson.build | 5 + test cases/failing/43 abs subdir/test.json | 7 + .../failing/44 abspath to srcdir/meson.build | 3 + test cases/failing/44 abspath to srcdir/test.json | 7 + .../45 pkgconfig variables reserved/meson.build | 16 + .../45 pkgconfig variables reserved/simple.c | 5 + .../45 pkgconfig variables reserved/simple.h | 6 + .../45 pkgconfig variables reserved/test.json | 7 + .../46 pkgconfig variables zero length/meson.build | 16 + .../46 pkgconfig variables zero length/simple.c | 5 + .../46 pkgconfig variables zero length/simple.h | 6 + .../46 pkgconfig variables zero length/test.json | 7 + .../meson.build | 16 + .../simple.c | 5 + .../simple.h | 6 + .../test.json | 7 + .../meson.build | 16 + .../48 pkgconfig variables not key value/simple.c | 5 + .../48 pkgconfig variables not key value/simple.h | 6 + .../48 pkgconfig variables not key value/test.json | 7 + .../failing/49 executable comparison/meson.build | 6 + test cases/failing/49 executable comparison/prog.c | 1 + .../failing/49 executable comparison/test.json | 8 + test cases/failing/5 misplaced option/meson.build | 3 + test cases/failing/5 misplaced option/test.json | 7 + .../failing/50 inconsistent comparison/meson.build | 7 + .../failing/50 inconsistent comparison/test.json | 7 + test cases/failing/51 slashname/meson.build | 11 + test cases/failing/51 slashname/sub/meson.build | 1 + test cases/failing/51 slashname/sub/prog.c | 6 + test cases/failing/51 slashname/test.json | 7 + .../52 reserved meson prefix/meson-foo/meson.build | 0 .../failing/52 reserved meson prefix/meson.build | 3 + .../failing/52 reserved meson prefix/test.json | 7 + .../failing/53 wrong shared crate type/foo.rs | 0 .../failing/53 wrong shared crate type/meson.build | 7 + .../failing/53 wrong shared crate type/test.json | 7 + .../failing/54 wrong static crate type/foo.rs | 0 .../failing/54 wrong static crate type/meson.build | 7 + .../failing/54 wrong static crate type/test.json | 7 + test cases/failing/55 or on new line/meson.build | 7 + .../failing/55 or on new line/meson_options.txt | 1 + test cases/failing/55 or on new line/test.json | 7 + .../failing/56 link with executable/meson.build | 4 + .../failing/56 link with executable/module.c | 4 + test cases/failing/56 link with executable/prog.c | 5 + .../failing/56 link with executable/test.json | 7 + .../57 assign custom target index/meson.build | 24 + .../57 assign custom target index/test.json | 7 + test cases/failing/58 getoption prefix/meson.build | 5 + .../subprojects/abc/meson.build | 1 + .../subprojects/abc/meson_options.txt | 1 + test cases/failing/58 getoption prefix/test.json | 7 + .../failing/59 bad option argument/meson.build | 3 + .../59 bad option argument/meson_options.txt | 1 + .../failing/59 bad option argument/test.json | 7 + test cases/failing/6 missing incdir/meson.build | 3 + test cases/failing/6 missing incdir/test.json | 7 + test cases/failing/60 subproj filegrab/meson.build | 5 + test cases/failing/60 subproj filegrab/prog.c | 1 + .../60 subproj filegrab/subprojects/a/meson.build | 3 + test cases/failing/60 subproj filegrab/test.json | 7 + test cases/failing/61 grab subproj/meson.build | 7 + .../61 grab subproj/subprojects/foo/meson.build | 3 + .../failing/61 grab subproj/subprojects/foo/sub.c | 6 + test cases/failing/61 grab subproj/test.json | 7 + test cases/failing/62 grab sibling/meson.build | 3 + .../62 grab sibling/subprojects/a/meson.build | 3 + .../62 grab sibling/subprojects/b/meson.build | 3 + .../failing/62 grab sibling/subprojects/b/sneaky.c | 6 + test cases/failing/62 grab sibling/test.json | 7 + .../failing/63 string as link target/meson.build | 2 + test cases/failing/63 string as link target/prog.c | 1 + .../failing/63 string as link target/test.json | 7 + .../meson.build | 2 + .../64 dependency not-found and required/test.json | 7 + .../failing/65 subproj different versions/main.c | 9 + .../65 subproj different versions/meson.build | 9 + .../subprojects/a/a.c | 5 + .../subprojects/a/a.h | 1 + .../subprojects/a/meson.build | 11 + .../subprojects/b/b.c | 5 + .../subprojects/b/b.h | 1 + .../subprojects/b/meson.build | 11 + .../subprojects/c/c.h | 3 + .../subprojects/c/meson.build | 5 + .../65 subproj different versions/test.json | 7 + .../failing/66 wrong boost module/meson.build | 9 + test cases/failing/66 wrong boost module/test.json | 7 + .../67 install_data rename bad size/file1.txt | 0 .../67 install_data rename bad size/file2.txt | 0 .../67 install_data rename bad size/meson.build | 3 + .../67 install_data rename bad size/test.json | 7 + test cases/failing/68 skip only subdir/meson.build | 8 + .../failing/68 skip only subdir/subdir/meson.build | 3 + test cases/failing/68 skip only subdir/test.json | 7 + test cases/failing/69 dual override/meson.build | 5 + test cases/failing/69 dual override/overrides.py | 4 + test cases/failing/69 dual override/test.json | 7 + test cases/failing/7 go to subproject/meson.build | 3 + .../7 go to subproject/subprojects/meson.build | 1 + test cases/failing/7 go to subproject/test.json | 7 + test cases/failing/70 override used/meson.build | 5 + test cases/failing/70 override used/other.py | 3 + test cases/failing/70 override used/something.py | 3 + test cases/failing/70 override used/test.json | 7 + .../71 run_command unclean exit/meson.build | 4 + .../71 run_command unclean exit/returncode.py | 4 + .../failing/71 run_command unclean exit/test.json | 8 + .../72 int literal leading zero/meson.build | 5 + .../failing/72 int literal leading zero/test.json | 8 + .../failing/73 configuration immutable/input | 0 .../failing/73 configuration immutable/meson.build | 12 + .../failing/73 configuration immutable/test.json | 7 + .../74 link with shared module on osx/meson.build | 8 + .../74 link with shared module on osx/module.c | 3 + .../74 link with shared module on osx/prog.c | 4 + .../74 link with shared module on osx/test.json | 7 + .../config9.h.in | 1 + .../meson.build | 10 + .../test.json | 8 + .../meson.build | 2 + .../test.json | 7 + test cases/failing/77 unfound run/meson.build | 4 + test cases/failing/77 unfound run/test.json | 7 + .../meson.build | 8 + .../78 framework dependency with version/test.json | 7 + test cases/failing/79 override exe config/foo.c | 3 + .../failing/79 override exe config/meson.build | 6 + .../failing/79 override exe config/test.json | 7 + test cases/failing/8 recursive/meson.build | 3 + .../failing/8 recursive/subprojects/a/meson.build | 3 + .../failing/8 recursive/subprojects/b/meson.build | 3 + test cases/failing/8 recursive/test.json | 7 + .../80 gl dependency with version/meson.build | 9 + .../80 gl dependency with version/test.json | 7 + .../81 threads dependency with version/meson.build | 3 + .../81 threads dependency with version/test.json | 7 + .../82 gtest dependency with version/meson.build | 8 + .../82 gtest dependency with version/test.json | 7 + test cases/failing/83 dub libray/meson.build | 11 + test cases/failing/83 dub libray/test.json | 7 + test cases/failing/84 dub executable/meson.build | 11 + test cases/failing/84 dub executable/test.json | 7 + test cases/failing/85 dub compiler/meson.build | 17 + test cases/failing/85 dub compiler/test.json | 19 + .../failing/86 subproj not-found dep/meson.build | 2 + .../subprojects/somesubproj/meson.build | 3 + .../failing/86 subproj not-found dep/test.json | 7 + test cases/failing/87 invalid configure file/input | 0 .../failing/87 invalid configure file/meson.build | 9 + .../failing/87 invalid configure file/test.json | 7 + test cases/failing/88 kwarg dupe/meson.build | 6 + test cases/failing/88 kwarg dupe/prog.c | 6 + test cases/failing/88 kwarg dupe/test.json | 7 + test cases/failing/89 missing pch file/meson.build | 3 + test cases/failing/89 missing pch file/prog.c | 3 + test cases/failing/89 missing pch file/test.json | 8 + .../failing/9 missing extra file/meson.build | 3 + test cases/failing/9 missing extra file/prog.c | 3 + test cases/failing/9 missing extra file/test.json | 7 + .../90 pch source different folder/include/pch.h | 0 .../90 pch source different folder/meson.build | 5 + .../failing/90 pch source different folder/prog.c | 1 + .../90 pch source different folder/src/pch.c | 0 .../90 pch source different folder/test.json | 7 + .../failing/91 unknown config tool/meson.build | 2 + .../failing/91 unknown config tool/test.json | 7 + .../92 custom target install data/Info.plist.cpp | 1 + .../92 custom target install data/meson.build | 11 + .../92 custom target install data/preproc.py | 13 + .../92 custom target install data/test.json | 7 + .../failing/93 add dict non string key/meson.build | 9 + .../failing/93 add dict non string key/test.json | 7 + .../failing/94 add dict duplicate keys/meson.build | 9 + .../failing/94 add dict duplicate keys/test.json | 7 + .../95 no host get_external_property/meson.build | 3 + .../95 no host get_external_property/test.json | 7 + test cases/failing/96 no native compiler/main.c | 3 + .../failing/96 no native compiler/meson.build | 12 + test cases/failing/96 no native compiler/test.json | 7 + .../failing/97 subdir parse error/meson.build | 2 + .../97 subdir parse error/subdir/meson.build | 1 + test cases/failing/97 subdir parse error/test.json | 7 + .../failing/98 invalid option file/meson.build | 1 + .../98 invalid option file/meson_options.txt | 1 + .../failing/98 invalid option file/test.json | 7 + test cases/failing/99 no lang/main.c | 3 + test cases/failing/99 no lang/meson.build | 2 + test cases/failing/99 no lang/test.json | 7 + test cases/fortran/1 basic/meson.build | 13 + test cases/fortran/1 basic/simple.f90 | 3 + test cases/fortran/10 find library/gzip.f90 | 32 + test cases/fortran/10 find library/main.f90 | 38 + test cases/fortran/10 find library/meson.build | 13 + .../fortran/11 compiles links runs/meson.build | 17 + test cases/fortran/12 submodule/a1.f90 | 26 + test cases/fortran/12 submodule/a2.f90 | 10 + test cases/fortran/12 submodule/a3.f90 | 13 + test cases/fortran/12 submodule/child.f90 | 13 + test cases/fortran/12 submodule/meson.build | 13 + test cases/fortran/12 submodule/parent.f90 | 26 + test cases/fortran/13 coarray/main.f90 | 10 + test cases/fortran/13 coarray/meson.build | 24 + test cases/fortran/14 fortran links c/clib.c | 7 + test cases/fortran/14 fortran links c/clib.def | 2 + test cases/fortran/14 fortran links c/f_call_c.f90 | 11 + test cases/fortran/14 fortran links c/meson.build | 17 + test cases/fortran/15 include/inc1.f90 | 5 + test cases/fortran/15 include/inc2.f90 | 2 + .../fortran/15 include/include_hierarchy.f90 | 9 + test cases/fortran/15 include/include_syntax.f90 | 25 + test cases/fortran/15 include/meson.build | 19 + .../subprojects/cmake_inc/CMakeLists.txt | 4 + .../15 include/subprojects/cmake_inc/main.f90 | 9 + .../15 include/subprojects/cmake_inc/thousand.f90 | 1 + test cases/fortran/15 include/timestwo.f90 | 2 + test cases/fortran/16 openmp/main.f90 | 18 + test cases/fortran/16 openmp/meson.build | 34 + test cases/fortran/17 add_languages/meson.build | 5 + test cases/fortran/18 first_arg/main.f90 | 3 + test cases/fortran/18 first_arg/meson.build | 46 + test cases/fortran/19 fortran_std/legacy.f | 8 + test cases/fortran/19 fortran_std/meson.build | 27 + test cases/fortran/19 fortran_std/std2003.f90 | 37 + test cases/fortran/19 fortran_std/std2008.f90 | 33 + test cases/fortran/19 fortran_std/std2018.f90 | 35 + test cases/fortran/19 fortran_std/std95.f90 | 14 + test cases/fortran/2 modules/comment_mod.f90 | 6 + test cases/fortran/2 modules/meson.build | 9 + test cases/fortran/2 modules/mymod.F90 | 8 + test cases/fortran/2 modules/prog.f90 | 11 + test cases/fortran/20 buildtype/main.f90 | 2 + test cases/fortran/20 buildtype/meson.build | 5 + test cases/fortran/21 install static/main.f90 | 5 + test cases/fortran/21 install static/main_lib.f90 | 16 + test cases/fortran/21 install static/meson.build | 20 + .../subprojects/static_hello/meson.build | 12 + .../subprojects/static_hello/static_hello.f90 | 17 + test cases/fortran/21 install static/test.json | 10 + test cases/fortran/3 module procedure/meson.build | 5 + .../fortran/3 module procedure/use_syntax.f90 | 31 + test cases/fortran/4 self dependency/meson.build | 8 + test cases/fortran/4 self dependency/selfdep.f90 | 18 + .../fortran/4 self dependency/src/selfdep_mod.f90 | 6 + .../4 self dependency/subprojects/sub1/main.f90 | 6 + .../4 self dependency/subprojects/sub1/meson.build | 3 + test cases/fortran/5 static/main.f90 | 6 + test cases/fortran/5 static/meson.build | 6 + test cases/fortran/5 static/static_hello.f90 | 17 + test cases/fortran/6 dynamic/dynamic.f90 | 17 + test cases/fortran/6 dynamic/main.f90 | 6 + test cases/fortran/6 dynamic/meson.build | 13 + test cases/fortran/7 generated/meson.build | 39 + test cases/fortran/7 generated/mod1.fpp | 6 + test cases/fortran/7 generated/mod2.fpp | 7 + test cases/fortran/7 generated/mod3.f90 | 6 + test cases/fortran/7 generated/prog.f90 | 8 + test cases/fortran/8 module names/meson.build | 6 + test cases/fortran/8 module names/mod1.f90 | 6 + test cases/fortran/8 module names/mod2.f90 | 6 + test cases/fortran/8 module names/test.f90 | 9 + test cases/fortran/9 cpp/fortran.f | 11 + test cases/fortran/9 cpp/main.c | 8 + test cases/fortran/9 cpp/main.cpp | 8 + test cases/fortran/9 cpp/meson.build | 29 + test cases/fpga/1 simple/meson.build | 8 + test cases/fpga/1 simple/spin.pcf | 6 + test cases/fpga/1 simple/spin.v | 32 + test cases/frameworks/1 boost/extralib.cpp | 27 + test cases/frameworks/1 boost/linkexe.cc | 18 + test cases/frameworks/1 boost/meson.build | 74 + test cases/frameworks/1 boost/meson_options.txt | 1 + test cases/frameworks/1 boost/nomod.cpp | 18 + test cases/frameworks/1 boost/partial_dep/foo.cpp | 20 + test cases/frameworks/1 boost/partial_dep/foo.hpp | 27 + test cases/frameworks/1 boost/partial_dep/main.cpp | 27 + .../frameworks/1 boost/partial_dep/meson.build | 31 + test cases/frameworks/1 boost/python_module.cpp | 22 + test cases/frameworks/1 boost/test.json | 22 + .../frameworks/1 boost/test_python_module.py | 27 + test cases/frameworks/1 boost/unit_test.cpp | 9 + .../frameworks/10 gtk-doc/doc/foobar-docs.sgml | 41 + .../frameworks/10 gtk-doc/doc/foobar1/baz.jpg | 0 .../frameworks/10 gtk-doc/doc/foobar1/baz.png.in | 0 .../10 gtk-doc/doc/foobar1/foobar-docs.sgml | 41 + .../10 gtk-doc/doc/foobar1/foobar-sections.txt | 15 + .../frameworks/10 gtk-doc/doc/foobar1/foobar.types | 4 + .../frameworks/10 gtk-doc/doc/foobar1/meson.build | 15 + .../10 gtk-doc/doc/foobar2/foobar-docs.sgml | 41 + .../frameworks/10 gtk-doc/doc/foobar2/meson.build | 13 + .../10 gtk-doc/doc/foobar3/foobar-docs.sgml | 41 + .../frameworks/10 gtk-doc/doc/foobar3/meson.build | 6 + .../10 gtk-doc/doc/foobar4/foobar-docs.sgml | 41 + .../frameworks/10 gtk-doc/doc/foobar4/meson.build | 7 + test cases/frameworks/10 gtk-doc/doc/meson.build | 10 + .../frameworks/10 gtk-doc/doc/version.xml.in | 1 + test cases/frameworks/10 gtk-doc/foo.c | 30 + .../frameworks/10 gtk-doc/include/foo-version.h.in | 29 + test cases/frameworks/10 gtk-doc/include/foo.h | 33 + .../10 gtk-doc/include/generate-enums-docbook.py | 63 + .../frameworks/10 gtk-doc/include/meson.build | 17 + test cases/frameworks/10 gtk-doc/meson.build | 45 + test cases/frameworks/10 gtk-doc/test.json | 64 + .../11 gir subproject/gir/meson-subsample.c | 124 + .../11 gir subproject/gir/meson-subsample.h | 21 + .../frameworks/11 gir subproject/gir/meson.build | 40 + test cases/frameworks/11 gir subproject/gir/prog.c | 12 + .../frameworks/11 gir subproject/gir/prog.py | 6 + .../frameworks/11 gir subproject/meson.build | 20 + .../subprojects/mesongir/meson-sample.c | 127 + .../subprojects/mesongir/meson-sample.h | 26 + .../subprojects/mesongir/meson.build | 31 + test cases/frameworks/11 gir subproject/test.json | 13 + .../12 multiple gir/gir/meson-subsample.c | 124 + .../12 multiple gir/gir/meson-subsample.h | 17 + .../frameworks/12 multiple gir/gir/meson.build | 31 + test cases/frameworks/12 multiple gir/gir/prog.c | 12 + test cases/frameworks/12 multiple gir/meson.build | 12 + .../12 multiple gir/mesongir/meson-sample.c | 126 + .../12 multiple gir/mesongir/meson-sample.h.in | 22 + .../12 multiple gir/mesongir/meson.build | 39 + test cases/frameworks/12 multiple gir/test.json | 17 + test cases/frameworks/13 yelp/help/C/index.page | 8 + test cases/frameworks/13 yelp/help/C/index2.page | 8 + test cases/frameworks/13 yelp/help/C/index3.page | 8 + .../frameworks/13 yelp/help/C/media/test.txt | 1 + test cases/frameworks/13 yelp/help/LINGUAS | 2 + test cases/frameworks/13 yelp/help/de/de.po | 13 + test cases/frameworks/13 yelp/help/es/es.po | 13 + .../frameworks/13 yelp/help/es/media/test.txt | 1 + test cases/frameworks/13 yelp/help/meson.build | 21 + test cases/frameworks/13 yelp/meson.build | 8 + test cases/frameworks/13 yelp/test.json | 23 + test cases/frameworks/14 doxygen/doc/Doxyfile.in | 2473 ++++++++++++++++++++ test cases/frameworks/14 doxygen/doc/meson.build | 16 + .../frameworks/14 doxygen/include/comedian.h | 17 + test cases/frameworks/14 doxygen/include/spede.h | 35 + test cases/frameworks/14 doxygen/meson.build | 27 + test cases/frameworks/14 doxygen/src/spede.cpp | 49 + test cases/frameworks/14 doxygen/test.json | 6 + test cases/frameworks/15 llvm/meson.build | 51 + test cases/frameworks/15 llvm/meson_options.txt | 10 + test cases/frameworks/15 llvm/sum.c | 76 + test cases/frameworks/15 llvm/test.json | 18 + test cases/frameworks/16 sdl2/meson.build | 13 + test cases/frameworks/16 sdl2/meson_options.txt | 6 + test cases/frameworks/16 sdl2/sdl2prog.c | 33 + test cases/frameworks/16 sdl2/test.json | 14 + test cases/frameworks/17 mpi/main.c | 27 + test cases/frameworks/17 mpi/main.cpp | 12 + test cases/frameworks/17 mpi/main.f90 | 30 + test cases/frameworks/17 mpi/meson.build | 52 + test cases/frameworks/17 mpi/meson_options.txt | 6 + test cases/frameworks/17 mpi/test.json | 17 + test cases/frameworks/18 vulkan/meson.build | 13 + test cases/frameworks/18 vulkan/test.json | 3 + test cases/frameworks/18 vulkan/vulkanprog.c | 26 + test cases/frameworks/19 pcap/meson.build | 22 + test cases/frameworks/19 pcap/pcap_prog.c | 15 + test cases/frameworks/19 pcap/test.json | 3 + test cases/frameworks/2 gtest/meson.build | 14 + test cases/frameworks/2 gtest/test.cc | 9 + test cases/frameworks/2 gtest/test.json | 3 + test cases/frameworks/2 gtest/test_nomain.cc | 14 + test cases/frameworks/20 cups/cups_prog.c | 8 + test cases/frameworks/20 cups/meson.build | 21 + test cases/frameworks/20 cups/test.json | 3 + test cases/frameworks/21 libwmf/libwmf_prog.c | 8 + test cases/frameworks/21 libwmf/meson.build | 27 + test cases/frameworks/21 libwmf/test.json | 3 + .../22 gir link order/fake-gthread/fake-gthread.c | 6 + .../22 gir link order/fake-gthread/fake-gthread.h | 6 + .../22 gir link order/fake-gthread/meson.build | 12 + .../22 gir link order/get-prgname/get-prgname.c | 8 + .../22 gir link order/get-prgname/get-prgname.h | 6 + .../22 gir link order/get-prgname/meson.build | 13 + .../frameworks/22 gir link order/meson-sample.c | 48 + .../frameworks/22 gir link order/meson-sample.h | 17 + .../frameworks/22 gir link order/meson.build | 41 + test cases/frameworks/22 gir link order/test.json | 3 + test cases/frameworks/23 hotdoc/doc/index.md | 1 + test cases/frameworks/23 hotdoc/doc/meson.build | 19 + test cases/frameworks/23 hotdoc/doc/sitemap.txt | 2 + test cases/frameworks/23 hotdoc/meson.build | 14 + test cases/frameworks/23 hotdoc/test.json | 9 + .../frameworks/24 libgcrypt/libgcrypt_prog.c | 8 + test cases/frameworks/24 libgcrypt/meson.build | 23 + test cases/frameworks/24 libgcrypt/test.json | 3 + test cases/frameworks/25 hdf5/main.c | 30 + test cases/frameworks/25 hdf5/main.cpp | 29 + test cases/frameworks/25 hdf5/main.f90 | 17 + test cases/frameworks/25 hdf5/meson.build | 47 + test cases/frameworks/25 hdf5/meson_options.txt | 6 + test cases/frameworks/25 hdf5/test.json | 11 + test cases/frameworks/26 netcdf/main.c | 14 + test cases/frameworks/26 netcdf/main.cpp | 15 + test cases/frameworks/26 netcdf/main.f90 | 19 + test cases/frameworks/26 netcdf/meson.build | 36 + test cases/frameworks/26 netcdf/test.json | 3 + test cases/frameworks/27 gpgme/gpgme_prog.c | 8 + test cases/frameworks/27 gpgme/meson.build | 27 + test cases/frameworks/27 gpgme/test.json | 3 + .../frameworks/28 gir link order 2/meson-sample.c | 42 + .../frameworks/28 gir link order 2/meson-sample.h | 17 + .../frameworks/28 gir link order 2/meson.build | 35 + .../28 gir link order 2/samelibname/dummy.c | 0 .../28 gir link order 2/samelibname/meson.build | 5 + .../frameworks/28 gir link order 2/test.json | 3 + test cases/frameworks/29 blocks/main.c | 6 + test cases/frameworks/29 blocks/meson.build | 12 + test cases/frameworks/29 blocks/test.json | 3 + test cases/frameworks/3 gmock/gmocktest.cc | 27 + test cases/frameworks/3 gmock/meson.build | 16 + test cases/frameworks/3 gmock/test.json | 3 + .../30 scalapack/cmake/FindSCALAPACK.cmake | 220 ++ test cases/frameworks/30 scalapack/main.c | 34 + test cases/frameworks/30 scalapack/main.f90 | 25 + test cases/frameworks/30 scalapack/meson.build | 26 + test cases/frameworks/30 scalapack/test.json | 3 + test cases/frameworks/31 curses/main.c | 7 + test cases/frameworks/31 curses/meson.build | 13 + test cases/frameworks/31 curses/meson_options.txt | 6 + test cases/frameworks/31 curses/test.json | 12 + .../32 boost root/boost/include/boost/version.hpp | 3 + .../boost/lib/boost_regex-vc142-mt-gd-x32-0_1.lib | 0 .../boost/lib/boost_regex-vc142-mt-gd-x64-0_1.lib | 0 .../boost/lib/libboost_regex.so.0.1.0 | 0 test cases/frameworks/32 boost root/meson.build | 6 + .../frameworks/32 boost root/nativefile.ini.in | 2 + .../boost/extra-dir/include/boost/version.hpp | 3 + .../boost/lib/boost_regex-vc142-mt-gd-x32-0_2.lib | 0 .../boost/lib/boost_regex-vc142-mt-gd-x64-0_2.lib | 0 .../boost/lib/libboost_regex.so.0.2.0 | 0 .../frameworks/33 boost split root/meson.build | 6 + .../33 boost split root/nativefile.ini.in | 3 + .../frameworks/34 gir static lib/meson.build | 18 + .../34 gir static lib/statichelper/meson-sample.c | 126 + .../statichelper/meson-sample.h.in | 22 + .../34 gir static lib/statichelper/meson.build | 22 + .../34 gir static lib/subdir/gir/meson-subsample.c | 124 + .../34 gir static lib/subdir/gir/meson-subsample.h | 17 + .../34 gir static lib/subdir/gir/meson.build | 28 + .../frameworks/34 gir static lib/subdir/gir/prog.c | 12 + test cases/frameworks/34 gir static lib/test.json | 9 + .../0.3.0/lib/boost_python-vc142-mt-gd-x32-0_3.lib | 0 .../0.3.0/lib/boost_python-vc142-mt-gd-x64-0_3.lib | 0 .../0.3.0/lib/libboost_python.so.0.3.0 | 0 .../Cellar/boost/0.3.0/include/boost/version.hpp | 3 + .../0.3.0/lib/boost_regex-vc142-mt-gd-x32-0_3.lib | 0 .../0.3.0/lib/boost_regex-vc142-mt-gd-x64-0_3.lib | 0 .../Cellar/boost/0.3.0/lib/libboost_regex.so.0.3.0 | 0 .../boost/include/boost/version.hpp | 3 + .../boost/lib/boost_python-vc142-mt-gd-x32-0_3.lib | 0 .../boost/lib/boost_python-vc142-mt-gd-x64-0_3.lib | 0 .../boost/lib/boost_regex-vc142-mt-gd-x32-0_3.lib | 0 .../boost/lib/boost_regex-vc142-mt-gd-x64-0_3.lib | 0 .../boost/lib/libboost_python.so.0.3.0 | 0 .../boost/lib/libboost_regex.so.0.3.0 | 0 .../frameworks/35 boost symlinks/meson.build | 6 + .../frameworks/35 boost symlinks/nativefile.ini.in | 2 + test cases/frameworks/4 qt/main.cpp | 55 + test cases/frameworks/4 qt/mainWindow.cpp | 8 + test cases/frameworks/4 qt/mainWindow.h | 20 + test cases/frameworks/4 qt/mainWindow.ui | 54 + test cases/frameworks/4 qt/manualinclude.cpp | 26 + test cases/frameworks/4 qt/manualinclude.h | 22 + test cases/frameworks/4 qt/meson.build | 158 ++ test cases/frameworks/4 qt/meson_options.txt | 2 + test cases/frameworks/4 qt/plugin/plugin.cpp | 12 + test cases/frameworks/4 qt/plugin/plugin.h | 14 + test cases/frameworks/4 qt/plugin/plugin.json | 3 + .../frameworks/4 qt/pluginInterface/plugin_if.h | 21 + test cases/frameworks/4 qt/q5core.cpp | 28 + test cases/frameworks/4 qt/qt4_lang.qrc | 6 + test cases/frameworks/4 qt/qt4core_fr.ts | 12 + test cases/frameworks/4 qt/qt4embedded_fr.ts | 12 + test cases/frameworks/4 qt/qt5_lang.qrc | 6 + test cases/frameworks/4 qt/qt5core_fr.ts | 12 + test cases/frameworks/4 qt/qt5embedded_fr.ts | 12 + test cases/frameworks/4 qt/qt6_lang.qrc | 6 + test cases/frameworks/4 qt/qt6core_fr.ts | 12 + test cases/frameworks/4 qt/qt6embedded_fr.ts | 12 + test cases/frameworks/4 qt/qtinterface.cpp | 8 + test cases/frameworks/4 qt/stuff.qrc | 6 + test cases/frameworks/4 qt/stuff2.qrc | 6 + test cases/frameworks/4 qt/subfolder/generator.py | 6 + test cases/frameworks/4 qt/subfolder/main.cpp | 29 + test cases/frameworks/4 qt/subfolder/meson.build | 32 + .../frameworks/4 qt/subfolder/resources/stuff3.qrc | 6 + .../4 qt/subfolder/resources/stuff4.qrc.in | 8 + .../frameworks/4 qt/subfolder/resources/thing.png | Bin 0 -> 40303 bytes test cases/frameworks/4 qt/test.json | 12 + test cases/frameworks/4 qt/thing.png | Bin 0 -> 40303 bytes test cases/frameworks/4 qt/thing2.png | Bin 0 -> 40303 bytes .../5 protocol buffers/asubdir/defs.proto | 5 + .../frameworks/5 protocol buffers/asubdir/main.cpp | 9 + .../5 protocol buffers/asubdir/meson.build | 8 + .../frameworks/5 protocol buffers/defs.proto | 5 + test cases/frameworks/5 protocol buffers/main.cpp | 9 + .../frameworks/5 protocol buffers/meson.build | 22 + .../5 protocol buffers/sidedir/meson.build | 7 + .../5 protocol buffers/sidedir/sideprog.cpp | 16 + test cases/frameworks/5 protocol buffers/test.json | 3 + .../withpath/com/mesonbuild/simple.proto | 7 + .../withpath/com/mesonbuild/subsite/complex.proto | 10 + .../5 protocol buffers/withpath/meson.build | 13 + .../5 protocol buffers/withpath/pathprog.cpp | 16 + .../frameworks/6 gettext/data/data3/meson.build | 9 + .../6 gettext/data/data3/test.desktop.in | 5 + test cases/frameworks/6 gettext/data/meson.build | 59 + .../frameworks/6 gettext/data/test.desktop.in | 5 + .../frameworks/6 gettext/data/test2.desktop.in | 5 + .../frameworks/6 gettext/data/test5.desktop.in.in | 5 + .../frameworks/6 gettext/data/test6.desktop.in.in | 5 + test cases/frameworks/6 gettext/data2/meson.build | 10 + .../frameworks/6 gettext/data2/test.desktop.in | 5 + .../com.mesonbuild.test.intlprog.metainfo.xml | 33 + test cases/frameworks/6 gettext/data3/meson.build | 33 + test cases/frameworks/6 gettext/data3/metainfo.its | 33 + test cases/frameworks/6 gettext/data3/verify.py | 13 + .../6 gettext/generated/desktopgenerator.py | 13 + .../frameworks/6 gettext/generated/meson.build | 16 + .../6 gettext/generated/something.desktop.in.in | 15 + test cases/frameworks/6 gettext/meson.build | 27 + test cases/frameworks/6 gettext/meson_options.txt | 1 + test cases/frameworks/6 gettext/po/LINGUAS | 3 + test cases/frameworks/6 gettext/po/POTFILES | 2 + test cases/frameworks/6 gettext/po/de.po | 26 + test cases/frameworks/6 gettext/po/fi.po | 22 + test cases/frameworks/6 gettext/po/intltest.pot | 38 + test cases/frameworks/6 gettext/po/meson.build | 4 + test cases/frameworks/6 gettext/po/ru.po | 34 + test cases/frameworks/6 gettext/src/intlmain.c | 17 + test cases/frameworks/6 gettext/src/meson.build | 2 + test cases/frameworks/6 gettext/test.json | 26 + test cases/frameworks/7 gnome/copyfile.py | 6 + .../7 gnome/gdbus/data/com.example.Sample.xml | 14 + test cases/frameworks/7 gnome/gdbus/gdbusprog.c | 8 + test cases/frameworks/7 gnome/gdbus/meson.build | 95 + test cases/frameworks/7 gnome/genmarshal/main.c.in | 102 + .../frameworks/7 gnome/genmarshal/marshaller.list | 3 + .../frameworks/7 gnome/genmarshal/meson.build | 54 + test cases/frameworks/7 gnome/gir/copy.py | 18 + test cases/frameworks/7 gnome/gir/dep1/dep1.c | 56 + test cases/frameworks/7 gnome/gir/dep1/dep1.h | 23 + test cases/frameworks/7 gnome/gir/dep1/dep2/dep2.c | 124 + test cases/frameworks/7 gnome/gir/dep1/dep2/dep2.h | 21 + .../frameworks/7 gnome/gir/dep1/dep2/meson.build | 22 + test cases/frameworks/7 gnome/gir/dep1/dep3/dep3.c | 124 + test cases/frameworks/7 gnome/gir/dep1/dep3/dep3.h | 21 + .../frameworks/7 gnome/gir/dep1/dep3/meson.build | 22 + test cases/frameworks/7 gnome/gir/dep1/meson.build | 31 + test cases/frameworks/7 gnome/gir/meson-sample.c | 121 + test cases/frameworks/7 gnome/gir/meson-sample.h | 24 + test cases/frameworks/7 gnome/gir/meson-sample2.c | 45 + test cases/frameworks/7 gnome/gir/meson-sample2.h | 21 + test cases/frameworks/7 gnome/gir/meson.build | 60 + test cases/frameworks/7 gnome/gir/prog.c | 35 + test cases/frameworks/7 gnome/gir/prog.py | 11 + test cases/frameworks/7 gnome/meson.build | 63 + test cases/frameworks/7 gnome/mkenums/enums.c.in | 41 + test cases/frameworks/7 gnome/mkenums/enums.h.in | 24 + test cases/frameworks/7 gnome/mkenums/enums2.c.in | 41 + test cases/frameworks/7 gnome/mkenums/enums2.h.in | 24 + test cases/frameworks/7 gnome/mkenums/main.c | 30 + test cases/frameworks/7 gnome/mkenums/main4.c | 35 + test cases/frameworks/7 gnome/mkenums/main5.c | 35 + .../frameworks/7 gnome/mkenums/meson-decls.h | 2 + .../frameworks/7 gnome/mkenums/meson-sample.h | 20 + test cases/frameworks/7 gnome/mkenums/meson.build | 164 ++ .../frameworks/7 gnome/resources-data/meson.build | 18 + .../frameworks/7 gnome/resources-data/res1.txt | 1 + .../frameworks/7 gnome/resources-data/res3.txt.in | 1 + .../7 gnome/resources-data/subdir/meson.build | 8 + .../7 gnome/resources-data/subdir/res2.txt | 1 + .../7 gnome/resources-data/subdir/res4.txt.in | 1 + .../frameworks/7 gnome/resources/generated-main.c | 26 + .../7 gnome/resources/generated.gresource.xml | 9 + .../7 gnome/resources/generated/meson.build | 4 + .../frameworks/7 gnome/resources/meson.build | 72 + .../7 gnome/resources/myresource.gresource.xml | 9 + test cases/frameworks/7 gnome/resources/res3.txt | 1 + .../frameworks/7 gnome/resources/resources.py | 10 + .../frameworks/7 gnome/resources/simple-main.c | 27 + .../7 gnome/resources/simple.gresource.xml | 7 + .../7 gnome/schemas/com.github.meson.gschema.xml | 12 + test cases/frameworks/7 gnome/schemas/meson.build | 7 + test cases/frameworks/7 gnome/schemas/schemaprog.c | 47 + test cases/frameworks/7 gnome/test.json | 40 + test cases/frameworks/8 flex/lexer.l | 13 + test cases/frameworks/8 flex/meson.build | 36 + test cases/frameworks/8 flex/parser.y | 11 + test cases/frameworks/8 flex/prog.c | 30 + test cases/frameworks/8 flex/test.json | 3 + test cases/frameworks/8 flex/test.txt | 1 + test cases/frameworks/8 flex/testfile | 1 + test cases/frameworks/9 wxwidgets/mainwin.h | 23 + test cases/frameworks/9 wxwidgets/meson.build | 19 + test cases/frameworks/9 wxwidgets/wxprog.cpp | 56 + test cases/frameworks/9 wxwidgets/wxstc.cpp | 6 + test cases/java/1 basic/com/mesonbuild/Simple.java | 7 + test cases/java/1 basic/meson.build | 11 + test cases/java/1 basic/test.json | 5 + test cases/java/10 resources/meson.build | 7 + .../10 resources/src/com/mesonbuild/Resources.java | 26 + test cases/java/10 resources/src/meson.build | 13 + .../java/10 resources/src/resources/resource1.txt | 1 + .../src/resources/subdir/resource2.txt | 1 + test cases/java/2 subdir/meson.build | 3 + .../java/2 subdir/sub/com/mesonbuild/Simple.java | 8 + .../2 subdir/sub/com/mesonbuild/TextPrinter.java | 14 + test cases/java/2 subdir/sub/meson.build | 5 + test cases/java/3 args/com/mesonbuild/Simple.java | 7 + test cases/java/3 args/meson.build | 8 + .../java/4 inner class/com/mesonbuild/Simple.java | 15 + test cases/java/4 inner class/meson.build | 5 + .../java/5 includedirs/com/mesonbuild/Simple.java | 8 + .../5 includedirs/com/mesonbuild/TextPrinter.java | 14 + test cases/java/5 includedirs/meson.build | 14 + .../java/6 codegen/com/mesonbuild/Config.java.in | 5 + .../java/6 codegen/com/mesonbuild/Simple.java | 12 + .../java/6 codegen/com/mesonbuild/TextPrinter.java | 14 + .../java/6 codegen/com/mesonbuild/meson.build | 6 + test cases/java/6 codegen/meson.build | 15 + .../java/7 linking/com/mesonbuild/Linking.java | 9 + test cases/java/7 linking/meson.build | 8 + .../7 linking/sub/com/mesonbuild/SimpleLib.java | 7 + test cases/java/7 linking/sub/meson.build | 2 + .../com/mesonbuild/Config.java.in | 5 + .../com/mesonbuild/Simple.java | 12 + .../com/mesonbuild/TextPrinter.java | 14 + .../com/mesonbuild/meson.build | 8 + .../java/8 codegen custom target/meson.build | 15 + test cases/java/9 jni/lib/com_mesonbuild_JniTest.c | 9 + test cases/java/9 jni/lib/meson.build | 18 + test cases/java/9 jni/lib/native.c | 11 + test cases/java/9 jni/meson.build | 38 + .../9 jni/src/com/mesonbuild/Configured.java.in | 5 + .../java/9 jni/src/com/mesonbuild/JniTest.java | 15 + .../java/9 jni/src/com/mesonbuild/meson.build | 11 + test cases/java/9 jni/src/meson.build | 9 + test cases/keyval/1 basic/.config | 3 + test cases/keyval/1 basic/meson.build | 18 + test cases/keyval/1 basic/test.json | 7 + test cases/keyval/2 subdir/.config | 2 + test cases/keyval/2 subdir/dir/meson.build | 12 + test cases/keyval/2 subdir/meson.build | 4 + test cases/keyval/3 load_config files/dir/config | 2 + .../keyval/3 load_config files/dir/meson.build | 12 + test cases/keyval/3 load_config files/meson.build | 4 + test cases/keyval/4 load_config builddir/config | 2 + .../keyval/4 load_config builddir/meson.build | 14 + test cases/linuxlike/1 pkg-config/incdir/myinc.h | 3 + test cases/linuxlike/1 pkg-config/meson.build | 53 + test cases/linuxlike/1 pkg-config/prog-checkver.c | 15 + test cases/linuxlike/1 pkg-config/prog.c | 8 + .../linuxlike/10 large file support/meson.build | 16 + .../linuxlike/11 runpath rpath ldlibrarypath/lib.c | 3 + .../lib1/meson.build | 2 + .../lib2/meson.build | 3 + .../11 runpath rpath ldlibrarypath/main.c | 11 + .../11 runpath rpath ldlibrarypath/meson.build | 16 + .../linuxlike/12 subprojects in subprojects/main.c | 9 + .../12 subprojects in subprojects/meson.build | 9 + .../subprojects/a/a.c | 5 + .../subprojects/a/a.h | 1 + .../subprojects/a/meson.build | 11 + .../subprojects/b/b.c | 11 + .../subprojects/b/b.h | 1 + .../subprojects/b/meson.build | 17 + .../subprojects/c/c.h | 3 + .../subprojects/c/meson.build | 5 + .../cmake/FindImportedOldStyle.cmake | 5 + .../cmake/FindImportedTarget.cmake | 15 + .../cmake/FindSomethingLikeZLIB.cmake | 56 + .../cmake_fake1/cmMesonTestF1Config.cmake | 11 + .../cmake_fake2/cmMesonTestF2Config.cmake | 9 + .../13 cmake dependency/cmake_fake3/bin/.gitkeep | 0 .../cmake/cmMesonTestF3/cmMesonTestF3Config.cmake | 9 + .../cmMesonTestDep/cmMesonTestDepConfig.cmake | 9 + .../cmMesonVersionedTestDepConfig.cmake | 9 + .../cmMesonVersionedTestDepConfigVersion.cmake | 12 + .../linuxlike/13 cmake dependency/incdir/myinc.h | 3 + .../linuxlike/13 cmake dependency/meson.build | 101 + .../linuxlike/13 cmake dependency/prog-checkver.c | 15 + test cases/linuxlike/13 cmake dependency/prog.c | 8 + test cases/linuxlike/13 cmake dependency/test.json | 14 + .../linuxlike/13 cmake dependency/testFlagSet.c | 18 + .../linuxlike/14 static dynamic linkage/main.c | 7 + .../14 static dynamic linkage/meson.build | 36 + .../14 static dynamic linkage/verify_static.py | 29 + test cases/linuxlike/15 ld binary/meson.build | 4 + .../linuxlike/2 external library/meson.build | 43 + test cases/linuxlike/2 external library/prog.c | 8 + test cases/linuxlike/3 linker script/bob.c | 9 + test cases/linuxlike/3 linker script/bob.h | 6 + test cases/linuxlike/3 linker script/bob.map | 6 + test cases/linuxlike/3 linker script/bob.map.in | 6 + test cases/linuxlike/3 linker script/copy.py | 5 + test cases/linuxlike/3 linker script/meson.build | 62 + test cases/linuxlike/3 linker script/prog.c | 5 + test cases/linuxlike/3 linker script/sub/foo.map | 6 + .../linuxlike/3 linker script/sub/meson.build | 6 + test cases/linuxlike/4 extdep static lib/lib.c | 8 + .../linuxlike/4 extdep static lib/meson.build | 10 + test cases/linuxlike/4 extdep static lib/prog.c | 5 + .../linuxlike/5 dependency versions/meson.build | 122 + .../subprojects/fakezlib/meson.build | 3 + .../subprojects/somelib/lib.c | 0 .../subprojects/somelib/meson.build | 11 + .../subprojects/somelibnover/lib.c | 0 .../subprojects/somelibnover/meson.build | 8 + .../subprojects/somelibver/lib.c | 0 .../subprojects/somelibver/meson.build | 9 + .../linuxlike/6 subdir include order/meson.build | 12 + test cases/linuxlike/6 subdir include order/prog.c | 7 + .../linuxlike/6 subdir include order/subdir/glib.h | 1 + test cases/linuxlike/7 library versions/exe.orig.c | 8 + test cases/linuxlike/7 library versions/lib.c | 3 + .../linuxlike/7 library versions/meson.build | 55 + test cases/linuxlike/7 library versions/test.json | 14 + .../8 subproject library install/meson.build | 10 + .../subprojects/sublib/include/subdefs.h | 21 + .../subprojects/sublib/meson.build | 10 + .../subprojects/sublib/sublib.c | 5 + .../8 subproject library install/test.json | 7 + .../meson.build | 36 + test cases/nasm/1 configure file/hello.asm | 27 + test cases/nasm/1 configure file/meson.build | 55 + test cases/nasm/2 asm language/hello.asm | 31 + test cases/nasm/2 asm language/meson.build | 57 + test cases/native/1 trivial/meson.build | 9 + test cases/native/1 trivial/trivial.c | 6 + test cases/native/2 global arg/meson.build | 14 + test cases/native/2 global arg/prog.c | 43 + test cases/native/2 global arg/prog.cc | 15 + test cases/native/3 pipeline/depends/copyrunner.py | 7 + test cases/native/3 pipeline/depends/filecopier.c | 23 + test cases/native/3 pipeline/depends/libsrc.c.in | 3 + test cases/native/3 pipeline/depends/meson.build | 11 + test cases/native/3 pipeline/depends/prog.c | 5 + test cases/native/3 pipeline/input_src.dat | 1 + test cases/native/3 pipeline/meson.build | 23 + test cases/native/3 pipeline/prog.c | 5 + test cases/native/3 pipeline/src/input_src.dat | 1 + test cases/native/3 pipeline/src/meson.build | 12 + test cases/native/3 pipeline/src/prog.c | 9 + test cases/native/3 pipeline/src/srcgen.c | 40 + test cases/native/3 pipeline/srcgen.c | 69 + test cases/native/4 tryrun/error.c | 3 + test cases/native/4 tryrun/meson.build | 78 + test cases/native/4 tryrun/no_compile.c | 1 + test cases/native/4 tryrun/ok.c | 7 + test cases/native/5 install script/file.txt | 0 test cases/native/5 install script/meson.build | 12 + test cases/native/5 install script/src/exe.c | 27 + test cases/native/5 install script/src/meson.build | 1 + test cases/native/5 install script/test.json | 8 + test cases/native/5 install script/wrap.py | 6 + test cases/native/6 add language/meson.build | 3 + test cases/native/6 add language/prog.cc | 6 + test cases/native/7 selfbuilt custom/checkarg.cpp | 6 + test cases/native/7 selfbuilt custom/data.dat | 1 + test cases/native/7 selfbuilt custom/mainprog.cpp | 5 + test cases/native/7 selfbuilt custom/meson.build | 39 + test cases/native/7 selfbuilt custom/tool.cpp | 34 + .../8 external program shebang parsing/input.txt | 1 + .../8 external program shebang parsing/main.c | 72 + .../8 external program shebang parsing/meson.build | 21 + .../script.int.in | 2 + test cases/native/9 override with exe/main2.input | 0 test cases/native/9 override with exe/meson.build | 21 + .../9 override with exe/subprojects/sub/foobar.c | 13 + .../subprojects/sub/meson.build | 3 + test cases/objc/1 simple/meson.build | 4 + test cases/objc/1 simple/prog.m | 5 + test cases/objc/2 nsstring/meson.build | 20 + test cases/objc/2 nsstring/stringprog.m | 9 + test cases/objc/3 objc args/meson.build | 4 + test cases/objc/3 objc args/prog.m | 11 + .../objc/4 c++ project objc subproject/master.cpp | 11 + .../objc/4 c++ project objc subproject/meson.build | 6 + .../subprojects/foo/foo.m | 4 + .../subprojects/foo/meson.build | 5 + test cases/objcpp/1 simple/meson.build | 4 + test cases/objcpp/1 simple/prog.mm | 8 + test cases/objcpp/2 objc++ args/meson.build | 4 + test cases/objcpp/2 objc++ args/prog.mm | 16 + test cases/osx/1 basic/main.c | 5 + test cases/osx/1 basic/meson.build | 3 + test cases/osx/2 library versions/CMakeLists.txt | 29 + test cases/osx/2 library versions/exe.orig.c | 7 + test cases/osx/2 library versions/lib.c | 3 + test cases/osx/2 library versions/meson.build | 81 + .../osx/2 library versions/require_pkgconfig.py | 9 + test cases/osx/2 library versions/test.json | 12 + test cases/osx/3 has function xcode8/meson.build | 30 + test cases/osx/4 framework/meson.build | 32 + test cases/osx/4 framework/prog.c | 3 + test cases/osx/4 framework/stat.c | 1 + test cases/osx/4 framework/test.json | 6 + test cases/osx/4 framework/xcode-frameworks.png | Bin 0 -> 421385 bytes test cases/osx/5 extra frameworks/meson.build | 10 + test cases/osx/5 extra frameworks/prog.c | 3 + test cases/osx/5 extra frameworks/stat.c | 1 + test cases/osx/5 extra frameworks/test.json | 6 + test cases/osx/6 multiframework/main.m | 5 + test cases/osx/6 multiframework/meson.build | 13 + test cases/osx/7 bitcode/libbar.mm | 6 + test cases/osx/7 bitcode/libfile.c | 5 + test cases/osx/7 bitcode/libfoo.m | 6 + test cases/osx/7 bitcode/meson.build | 11 + test cases/osx/7 bitcode/vis.h | 6 + test cases/osx/8 pie/main.c | 5 + test cases/osx/8 pie/meson.build | 3 + test cases/python/1 basic/gluon/__init__.py | 0 test cases/python/1 basic/gluon/gluonator.py | 2 + test cases/python/1 basic/meson.build | 27 + test cases/python/1 basic/prog.py | 8 + test cases/python/1 basic/subdir/meson.build | 4 + test cases/python/1 basic/subdir/subprog.py | 11 + test cases/python/2 extmodule/blaster.py.in | 11 + test cases/python/2 extmodule/ext/meson.build | 9 + .../python/2 extmodule/ext/nested/meson.build | 15 + test cases/python/2 extmodule/ext/tachyon_module.c | 49 + .../python/2 extmodule/ext/wrongdir/meson.build | 6 + test cases/python/2 extmodule/meson.build | 50 + test cases/python/2 extmodule/test.json | 13 + test cases/python/3 cython/cytest.py | 19 + test cases/python/3 cython/libdir/cstorer.pxd | 9 + test cases/python/3 cython/libdir/meson.build | 11 + test cases/python/3 cython/libdir/storer.c | 24 + test cases/python/3 cython/libdir/storer.h | 8 + test cases/python/3 cython/libdir/storer.pyx | 16 + test cases/python/3 cython/meson.build | 26 + .../4 custom target depends extmodule/blaster.py | 30 + .../ext/lib/meson-tachyonlib.c | 8 + .../ext/lib/meson-tachyonlib.h | 6 + .../ext/lib/meson.build | 4 + .../ext/meson.build | 6 + .../ext/tachyon_module.c | 51 + .../4 custom target depends extmodule/meson.build | 45 + test cases/python/5 modules kwarg/meson.build | 7 + test cases/python/6 failing subproject/meson.build | 5 + .../subprojects/bar/meson.build | 4 + test cases/python/7 install path/meson.build | 20 + .../python/7 install path/structured/alpha/one.py | 0 .../7 install path/structured/alpha/three.py | 0 .../python/7 install path/structured/alpha/two.py | 0 .../python/7 install path/structured/beta/one.py | 0 .../python/7 install path/structured/meson.build | 9 + test cases/python/7 install path/structured/one.py | 0 test cases/python/7 install path/structured/two.py | 0 test cases/python/7 install path/test.json | 18 + test cases/python/7 install path/test.py | 0 .../python/8 different python versions/blaster.py | 14 + .../8 different python versions/ext/meson.build | 6 + .../ext/tachyon_module.c | 59 + .../python/8 different python versions/meson.build | 34 + .../8 different python versions/meson_options.txt | 4 + .../python/8 different python versions/test.json | 13 + test cases/python3/1 basic/gluon/__init__.py | 0 test cases/python3/1 basic/gluon/gluonator.py | 2 + test cases/python3/1 basic/meson.build | 34 + test cases/python3/1 basic/prog.py | 9 + test cases/python3/1 basic/subdir/meson.build | 4 + test cases/python3/1 basic/subdir/subprog.py | 12 + test cases/python3/2 extmodule/blaster.py | 14 + test cases/python3/2 extmodule/ext/meson.build | 6 + .../python3/2 extmodule/ext/tachyon_module.c | 49 + test cases/python3/2 extmodule/meson.build | 37 + test cases/python3/3 cython/cytest.py | 23 + test cases/python3/3 cython/libdir/cstorer.pxd | 9 + test cases/python3/3 cython/libdir/meson.build | 12 + test cases/python3/3 cython/libdir/storer.c | 24 + test cases/python3/3 cython/libdir/storer.h | 8 + test cases/python3/3 cython/libdir/storer.pyx | 16 + test cases/python3/3 cython/meson.build | 26 + .../4 custom target depends extmodule/blaster.py | 32 + .../ext/lib/meson-tachyonlib.c | 8 + .../ext/lib/meson-tachyonlib.h | 6 + .../ext/lib/meson.build | 4 + .../ext/meson.build | 6 + .../ext/tachyon_module.c | 51 + .../4 custom target depends extmodule/meson.build | 41 + test cases/rewrite/1 basic/addSrc.json | 94 + test cases/rewrite/1 basic/addTgt.json | 9 + test cases/rewrite/1 basic/info.json | 57 + test cases/rewrite/1 basic/meson.build | 19 + test cases/rewrite/1 basic/rmSrc.json | 88 + test cases/rewrite/1 basic/rmTgt.json | 17 + test cases/rewrite/2 subdirs/addSrc.json | 13 + test cases/rewrite/2 subdirs/addTgt.json | 10 + test cases/rewrite/2 subdirs/info.json | 12 + test cases/rewrite/2 subdirs/meson.build | 4 + test cases/rewrite/2 subdirs/rmTgt.json | 7 + test cases/rewrite/2 subdirs/sub1/meson.build | 1 + test cases/rewrite/2 subdirs/sub2/meson.build | 1 + test cases/rewrite/3 kwargs/add.json | 38 + test cases/rewrite/3 kwargs/defopts_delete.json | 18 + test cases/rewrite/3 kwargs/defopts_set.json | 24 + test cases/rewrite/3 kwargs/delete.json | 20 + test cases/rewrite/3 kwargs/info.json | 20 + test cases/rewrite/3 kwargs/meson.build | 7 + test cases/rewrite/3 kwargs/remove.json | 38 + test cases/rewrite/3 kwargs/remove_regex.json | 29 + test cases/rewrite/3 kwargs/set.json | 34 + test cases/rewrite/4 same name targets/addSrc.json | 8 + test cases/rewrite/4 same name targets/info.json | 12 + test cases/rewrite/4 same name targets/meson.build | 6 + .../rewrite/4 same name targets/sub1/meson.build | 3 + test cases/rewrite/5 sorting/meson.build | 33 + .../rewrite/6 extra_files/addExtraFiles.json | 111 + test cases/rewrite/6 extra_files/info.json | 57 + test cases/rewrite/6 extra_files/meson.build | 21 + test cases/rewrite/6 extra_files/rmExtraFiles.json | 93 + test cases/rust/1 basic/clippy.toml | 1 + test cases/rust/1 basic/meson.build | 9 + test cases/rust/1 basic/prog.rs | 4 + test cases/rust/1 basic/subdir/meson.build | 2 + test cases/rust/1 basic/subdir/prog.rs | 3 + test cases/rust/1 basic/test.json | 8 + test cases/rust/10 language stds/2015.rs | 3 + test cases/rust/10 language stds/2018.rs | 9 + test cases/rust/10 language stds/meson.build | 18 + test cases/rust/11 generated main/gen.py | 20 + .../rust/11 generated main/generated_lib_main.rs | 5 + test cases/rust/11 generated main/meson.build | 21 + test cases/rust/11 generated main/sub/meson.build | 13 + test cases/rust/12 bindgen/dependencies/clib2.c | 5 + .../rust/12 bindgen/dependencies/external_dep.h | 8 + .../rust/12 bindgen/dependencies/internal_dep.h | 6 + .../rust/12 bindgen/dependencies/internal_main.rs | 16 + .../rust/12 bindgen/dependencies/meson.build | 43 + test cases/rust/12 bindgen/include/other.h | 6 + test cases/rust/12 bindgen/meson.build | 83 + test cases/rust/12 bindgen/src/gen_header.py | 19 + test cases/rust/12 bindgen/src/header.h | 8 + test cases/rust/12 bindgen/src/main.rs | 14 + test cases/rust/12 bindgen/src/main2.rs | 15 + test cases/rust/12 bindgen/src/source.c | 8 + test cases/rust/12 bindgen/sub/meson.build | 39 + test cases/rust/12 bindgen/test.json | 7 + .../13 external c dependencies/c_accessing_zlib.c | 10 + .../rust/13 external c dependencies/meson.build | 23 + .../13 external c dependencies/meson_options.txt | 2 + test cases/rust/13 external c dependencies/prog.rs | 9 + .../rust/13 external c dependencies/test.json | 18 + test cases/rust/14 external libm/meson.build | 24 + test cases/rust/14 external libm/meson_options.txt | 2 + test cases/rust/14 external libm/prog.rs | 5 + test cases/rust/14 external libm/rs_math.rs | 12 + test cases/rust/14 external libm/test.json | 10 + test cases/rust/15 polyglot sharedlib/adder.c | 18 + test cases/rust/15 polyglot sharedlib/adder.h | 34 + test cases/rust/15 polyglot sharedlib/adder.rs | 9 + test cases/rust/15 polyglot sharedlib/addertest.c | 12 + test cases/rust/15 polyglot sharedlib/meson.build | 20 + test cases/rust/16 internal c dependencies/lib.c | 6 + test cases/rust/16 internal c dependencies/lib.h | 22 + test cases/rust/16 internal c dependencies/main.rs | 9 + .../rust/16 internal c dependencies/meson.build | 14 + test cases/rust/16 internal c dependencies/test.py | 25 + .../rust/17 staticlib link staticlib/branch.rs | 4 + .../rust/17 staticlib link staticlib/leaf.rs | 1 + .../rust/17 staticlib link staticlib/meson.build | 8 + test cases/rust/17 staticlib link staticlib/prog.c | 7 + .../rust/17 staticlib link staticlib/test.json | 7 + test cases/rust/18 proc-macro/meson.build | 19 + test cases/rust/18 proc-macro/proc.rs | 7 + test cases/rust/18 proc-macro/use.rs | 8 + test cases/rust/19 structured sources/gen.py | 20 + .../rust/19 structured sources/main-gen-copy.rs | 5 + test cases/rust/19 structured sources/meson.build | 58 + .../rust/19 structured sources/no_copy_test.py | 18 + test cases/rust/19 structured sources/priv.rs | 3 + .../rust/19 structured sources/src/foo.rs.in | 4 + test cases/rust/19 structured sources/src/main.rs | 5 + .../rust/19 structured sources/src2/foo/mod.rs | 4 + .../rust/19 structured sources/src2/main-unique.rs | 5 + .../rust/19 structured sources/src2/meson.build | 4 + test cases/rust/2 sharedlib/meson.build | 17 + test cases/rust/2 sharedlib/prog.rs | 3 + test cases/rust/2 sharedlib/stuff.rs | 11 + test cases/rust/2 sharedlib/test.json | 10 + test cases/rust/2 sharedlib/value.c | 3 + test cases/rust/3 staticlib/meson.build | 7 + test cases/rust/3 staticlib/other.rs | 5 + test cases/rust/3 staticlib/prog.rs | 5 + test cases/rust/3 staticlib/stuff.rs | 14 + test cases/rust/3 staticlib/test.json | 7 + test cases/rust/3 staticlib/value.c | 5 + test cases/rust/4 polyglot/meson.build | 9 + test cases/rust/4 polyglot/prog.c | 8 + test cases/rust/4 polyglot/stuff.rs | 6 + test cases/rust/4 polyglot/test.json | 10 + test cases/rust/5 polyglot static/clib.c | 12 + test cases/rust/5 polyglot static/meson.build | 18 + test cases/rust/5 polyglot static/prog.c | 7 + test cases/rust/5 polyglot static/stuff.rs | 6 + test cases/rust/5 polyglot static/test.json | 7 + test cases/rust/6 named staticlib/meson.build | 5 + test cases/rust/6 named staticlib/prog.rs | 3 + test cases/rust/6 named staticlib/stuff.rs | 1 + test cases/rust/6 named staticlib/test.json | 7 + .../rust/7 private crate collision/meson.build | 5 + test cases/rust/7 private crate collision/prog.rs | 3 + test cases/rust/7 private crate collision/rand.rs | 4 + .../rust/7 private crate collision/test.json | 7 + test cases/rust/8 many files/foo.rs | 3 + test cases/rust/8 many files/main.rs | 5 + test cases/rust/8 many files/meson.build | 3 + test cases/rust/9 unit tests/meson.build | 43 + test cases/rust/9 unit tests/test.rs | 24 + test cases/rust/9 unit tests/test2.rs | 11 + test cases/swift/1 exe/main.swift | 1 + test cases/swift/1 exe/meson.build | 3 + test cases/swift/2 multifile/libfile.swift | 3 + test cases/swift/2 multifile/main.swift | 5 + test cases/swift/2 multifile/meson.build | 3 + test cases/swift/3 library/exe/main.swift | 7 + test cases/swift/3 library/exe/meson.build | 2 + test cases/swift/3 library/lib/datasource.swift | 3 + test cases/swift/3 library/lib/meson.build | 1 + test cases/swift/3 library/lib/othersource.swift | 3 + test cases/swift/3 library/meson.build | 4 + test cases/swift/4 generate/gen/main.swift | 18 + test cases/swift/4 generate/gen/meson.build | 6 + test cases/swift/4 generate/meson.build | 4 + test cases/swift/4 generate/user/main.swift | 3 + test cases/swift/4 generate/user/meson.build | 2 + test cases/swift/5 mixed/main.swift | 3 + test cases/swift/5 mixed/meson.build | 6 + test cases/swift/5 mixed/mylib.c | 5 + test cases/swift/5 mixed/mylib.h | 3 + test cases/swift/6 modulemap/main.swift | 5 + test cases/swift/6 modulemap/meson.build | 8 + test cases/swift/6 modulemap/module.modulemap | 5 + test cases/swift/6 modulemap/mylib.c | 5 + test cases/swift/6 modulemap/mylib.h | 3 + test cases/swift/7 modulemap subdir/main.swift | 5 + test cases/swift/7 modulemap subdir/meson.build | 6 + .../swift/7 modulemap subdir/mylib/meson.build | 4 + .../7 modulemap subdir/mylib/module.modulemap | 5 + test cases/swift/7 modulemap subdir/mylib/mylib.c | 5 + test cases/swift/7 modulemap subdir/mylib/mylib.h | 3 + test cases/unit/1 soname/CMakeLists.txt | 26 + test cases/unit/1 soname/main.c | 5 + test cases/unit/1 soname/meson.build | 35 + test cases/unit/1 soname/versioned.c | 3 + test cases/unit/10 build_rpath/meson.build | 16 + test cases/unit/10 build_rpath/prog.c | 5 + test cases/unit/10 build_rpath/prog.cc | 8 + test cases/unit/10 build_rpath/sub/meson.build | 1 + test cases/unit/10 build_rpath/sub/stuff.c | 3 + test cases/unit/100 relative find program/foo.py | 3 + .../unit/100 relative find program/meson.build | 3 + .../100 relative find program/subdir/meson.build | 2 + test cases/unit/101 rlib linkage/lib2.rs | 5 + test cases/unit/101 rlib linkage/main.rs | 5 + test cases/unit/101 rlib linkage/meson.build | 22 + .../unit/102 python without pkgconfig/meson.build | 4 + test cases/unit/103 strip/lib.c | 3 + test cases/unit/103 strip/meson.build | 3 + test cases/unit/104 debug function/meson.build | 4 + .../meson.build | 15 + test cases/unit/106 subproject symlink/cp.py | 6 + test cases/unit/106 subproject symlink/main.c | 6 + test cases/unit/106 subproject symlink/meson.build | 15 + .../symlinked_subproject/datadir/datafile | 1 + .../symlinked_subproject/datadir/meson.build | 1 + .../symlinked_subproject/meson.build | 10 + .../symlinked_subproject/src.c | 4 + .../107 new subproject on reconfigure/meson.build | 3 + .../meson_options.txt | 1 + .../subprojects/foo/foo.c | 2 + .../subprojects/foo/meson.build | 8 + .../unit/108 configure same noop/meson.build | 1 + .../unit/108 configure same noop/meson_options.txt | 5 + test cases/unit/109 freeze/freeze.c | 21 + test cases/unit/109 freeze/meson.build | 4 + test cases/unit/11 cross prog/meson.build | 16 + test cases/unit/11 cross prog/some_cross_tool.py | 4 + test cases/unit/11 cross prog/sometool.py | 4 + .../unit/110 classpath/com/mesonbuild/Simple.java | 7 + test cases/unit/110 classpath/meson.build | 14 + test cases/unit/12 promote/meson.build | 4 + .../unit/12 promote/subprojects/s1/meson.build | 7 + test cases/unit/12 promote/subprojects/s1/s1.c | 6 + .../subprojects/s1/subprojects/s3/meson.build | 3 + .../12 promote/subprojects/s1/subprojects/s3/s3.c | 3 + .../subprojects/s1/subprojects/scommon/meson.build | 3 + .../s1/subprojects/scommon/scommon_broken.c | 1 + .../unit/12 promote/subprojects/s2/meson.build | 5 + test cases/unit/12 promote/subprojects/s2/s2.c | 6 + .../subprojects/s2/subprojects/athing.wrap | 1 + .../subprojects/s2/subprojects/scommon/meson.build | 3 + .../s2/subprojects/scommon/scommon_ok.c | 3 + test cases/unit/13 reconfigure/meson.build | 5 + test cases/unit/14 testsetup selection/main.c | 3 + test cases/unit/14 testsetup selection/meson.build | 10 + .../14 testsetup selection/subprojects/bar/bar.c | 3 + .../subprojects/bar/meson.build | 6 + .../14 testsetup selection/subprojects/foo/foo.c | 3 + .../subprojects/foo/meson.build | 4 + test cases/unit/15 prebuilt object/cp.py | 5 + test cases/unit/15 prebuilt object/main.c | 5 + test cases/unit/15 prebuilt object/meson.build | 40 + test cases/unit/15 prebuilt object/source.c | 8 + test cases/unit/16 prebuilt static/libdir/best.c | 3 + test cases/unit/16 prebuilt static/libdir/best.h | 3 + .../unit/16 prebuilt static/libdir/meson.build | 5 + test cases/unit/16 prebuilt static/main.c | 7 + test cases/unit/16 prebuilt static/meson.build | 5 + test cases/unit/17 prebuilt shared/alexandria.c | 6 + test cases/unit/17 prebuilt shared/alexandria.h | 20 + .../unit/17 prebuilt shared/another_visitor.c | 10 + test cases/unit/17 prebuilt shared/meson.build | 38 + .../unit/17 prebuilt shared/meson_options.txt | 1 + test cases/unit/17 prebuilt shared/patron.c | 9 + test cases/unit/17 prebuilt shared/rejected.c | 8 + test cases/unit/17 prebuilt shared/rejected.h | 6 + test cases/unit/17 prebuilt shared/rejected_main.c | 6 + test cases/unit/18 pkgconfig static/foo.c | 8 + test cases/unit/18 pkgconfig static/foo.pc.in | 11 + test cases/unit/18 pkgconfig static/include/foo.h | 3 + test cases/unit/18 pkgconfig static/main.c | 14 + test cases/unit/18 pkgconfig static/meson.build | 37 + test cases/unit/19 array option/meson.build | 15 + test cases/unit/19 array option/meson_options.txt | 20 + test cases/unit/2 testsetups/buggy.c | 14 + test cases/unit/2 testsetups/envcheck.py | 5 + test cases/unit/2 testsetups/impl.c | 5 + test cases/unit/2 testsetups/impl.h | 3 + test cases/unit/2 testsetups/meson.build | 33 + .../unit/20 subproj dep variables/meson.build | 16 + .../subprojects/failingsubproj/meson.build | 3 + .../subprojects/nestedsubproj/meson.build | 3 + .../nestedsubproj/subprojects/subsubproject.wrap | 1 + .../subprojects/somesubproj/meson.build | 3 + test cases/unit/21 exit status/meson.build | 2 + test cases/unit/22 warning location/a.c | 0 test cases/unit/22 warning location/b.c | 0 test cases/unit/22 warning location/conf.in | 1 + test cases/unit/22 warning location/main.c | 0 test cases/unit/22 warning location/meson.build | 11 + test cases/unit/22 warning location/sub/c.c | 0 test cases/unit/22 warning location/sub/d.c | 0 .../unit/22 warning location/sub/meson.build | 4 + test cases/unit/22 warning location/sub/sub.c | 0 test cases/unit/23 unfound pkgconfig/meson.build | 15 + test cases/unit/23 unfound pkgconfig/some.c | 3 + .../unit/24 compiler run_command/meson.build | 10 + .../unit/25 non-permitted kwargs/meson.build | 5 + test cases/unit/26 install umask/datafile.cat | 1 + test cases/unit/26 install umask/meson.build | 7 + test cases/unit/26 install umask/myinstall.py | 17 + test cases/unit/26 install umask/prog.1 | 1 + test cases/unit/26 install umask/prog.c | 3 + test cases/unit/26 install umask/sample.h | 6 + .../unit/26 install umask/subdir/datafile.dog | 1 + test cases/unit/26 install umask/subdir/sayhello | 2 + .../unit/27 pkgconfig usage/dependee/meson.build | 6 + .../unit/27 pkgconfig usage/dependee/pkguser.c | 6 + .../unit/27 pkgconfig usage/dependency/meson.build | 24 + .../unit/27 pkgconfig usage/dependency/pkgdep.c | 7 + .../unit/27 pkgconfig usage/dependency/pkgdep.h | 3 + .../27 pkgconfig usage/dependency/privatelib.c | 3 + test cases/unit/28 ndebug if-release/main.c | 11 + test cases/unit/28 ndebug if-release/meson.build | 3 + .../unit/29 guessed linker dependencies/exe/app.c | 6 + .../29 guessed linker dependencies/exe/meson.build | 7 + .../unit/29 guessed linker dependencies/lib/lib.c | 20 + .../29 guessed linker dependencies/lib/meson.build | 11 + .../lib/meson_options.txt | 1 + test cases/unit/3 subproject defaults/meson.build | 10 + .../unit/3 subproject defaults/meson_options.txt | 3 + .../subprojects/foob/meson.build | 11 + .../subprojects/foob/meson_options.txt | 5 + test cases/unit/30 shared_mod linking/libfile.c | 14 + test cases/unit/30 shared_mod linking/main.c | 11 + test cases/unit/30 shared_mod linking/meson.build | 5 + test cases/unit/31 forcefallback/meson.build | 9 + .../subprojects/notzlib/meson.build | 7 + .../31 forcefallback/subprojects/notzlib/notzlib.c | 6 + .../31 forcefallback/subprojects/notzlib/notzlib.h | 18 + test cases/unit/31 forcefallback/test_not_zlib.c | 8 + .../unit/32 pkgconfig use libraries/app/app.c | 6 + .../32 pkgconfig use libraries/app/meson.build | 5 + .../unit/32 pkgconfig use libraries/lib/liba.c | 2 + .../unit/32 pkgconfig use libraries/lib/libb.c | 5 + .../32 pkgconfig use libraries/lib/meson.build | 14 + .../meson.build | 3 + .../33 cross file overrides always args/test.c | 8 + .../ubuntu-armhf-overrides.txt | 19 + test cases/unit/34 command line/meson.build | 9 + test cases/unit/34 command line/meson_options.txt | 2 + .../34 command line/subprojects/subp/meson.build | 3 + .../subprojects/subp/meson_options.txt | 1 + test cases/unit/35 dist script/meson.build | 10 + test cases/unit/35 dist script/prog.c | 7 + test cases/unit/35 dist script/replacer.py | 16 + .../35 dist script/subprojects/sub/dist-script.py | 12 + .../35 dist script/subprojects/sub/meson.build | 11 + .../subprojects/sub/meson_options.txt | 1 + .../unit/35 dist script/subprojects/sub/prog.c | 1 + .../unit/36 exe_wrapper behaviour/broken-cross.txt | 20 + .../unit/36 exe_wrapper behaviour/meson.build | 19 + .../36 exe_wrapper behaviour/meson_options.txt | 2 + test cases/unit/36 exe_wrapper behaviour/prog.c | 17 + .../unit/37 mixed command line args/meson.build | 1 + .../37 mixed command line args/meson_options.txt | 10 + test cases/unit/38 pkgconfig format/meson.build | 18 + test cases/unit/38 pkgconfig format/somelib.c | 7 + test cases/unit/38 pkgconfig format/someret.c | 3 + .../built library/bar.c | 7 + .../built library/meson.build | 26 + .../built library/meson_options.txt | 1 + .../built library/prog.c | 7 + .../external library/bar.c | 6 + .../external library/faa.c | 4 + .../external library/foo.c | 4 + .../external library/meson.build | 22 + test cases/unit/4 suite selection/failing_test.c | 1 + test cases/unit/4 suite selection/meson.build | 17 + .../subprojects/subprjfail/failing_test.c | 1 + .../subprojects/subprjfail/meson.build | 9 + .../subprojects/subprjmix/failing_test.c | 1 + .../subprojects/subprjmix/meson.build | 9 + .../subprojects/subprjmix/successful_test.c | 1 + .../subprojects/subprjsucc/meson.build | 9 + .../subprojects/subprjsucc/successful_test.c | 1 + .../unit/4 suite selection/successful_test.c | 1 + .../unit/40 featurenew subprojects/meson.build | 7 + .../subprojects/bar/meson.build | 3 + .../subprojects/baz/meson.build | 3 + .../subprojects/foo/meson.build | 3 + test cases/unit/41 rpath order/meson.build | 11 + test cases/unit/41 rpath order/myexe.c | 3 + .../unit/41 rpath order/subprojects/sub1/lib.c | 0 .../41 rpath order/subprojects/sub1/meson.build | 5 + .../unit/41 rpath order/subprojects/sub2/lib.c | 0 .../41 rpath order/subprojects/sub2/meson.build | 5 + test cases/unit/42 dep order/lib1.c | 0 test cases/unit/42 dep order/lib2.c | 0 test cases/unit/42 dep order/meson.build | 8 + test cases/unit/42 dep order/myexe.c | 3 + test cases/unit/43 promote wrap/meson.build | 4 + .../43 promote wrap/subprojects/s1/meson.build | 1 + .../s1/subprojects/ambiguous/meson.build | 1 + .../43 promote wrap/subprojects/s2/meson.build | 1 + .../subprojects/s2/subprojects/ambiguous.wrap | 2 + test cases/unit/44 vscpp17/main.cpp | 29 + test cases/unit/44 vscpp17/meson.build | 4 + .../45 native dep pkgconfig var/cross_pkgconfig.py | 12 + .../cross_pkgconfig/dep_tester.pc | 5 + .../unit/45 native dep pkgconfig var/meson.build | 15 + .../45 native dep pkgconfig var/meson_options.txt | 6 + .../native_pkgconfig/dep_tester.pc | 5 + test cases/unit/46 native file binary/meson.build | 21 + .../unit/46 native file binary/meson_options.txt | 5 + test cases/unit/47 reconfigure/main.c | 4 + test cases/unit/47 reconfigure/meson.build | 11 + test cases/unit/47 reconfigure/meson_options.txt | 4 + .../47 reconfigure/subprojects/sub1/meson.build | 3 + test cases/unit/48 testsetup default/envcheck.py | 11 + test cases/unit/48 testsetup default/meson.build | 23 + .../unit/49 pkgconfig csharp library/meson.build | 10 + .../unit/49 pkgconfig csharp library/somelib.cs | 12 + .../unit/5 compiler detection/compiler wrapper.py | 6 + test cases/unit/5 compiler detection/meson.build | 8 + test cases/unit/5 compiler detection/trivial.c | 6 + test cases/unit/5 compiler detection/trivial.cc | 6 + test cases/unit/5 compiler detection/trivial.m | 5 + test cases/unit/5 compiler detection/trivial.mm | 8 + test cases/unit/50 noncross options/meson.build | 14 + test cases/unit/50 noncross options/prog.c | 1 + test cases/unit/50 noncross options/ylib.pc | 13 + test cases/unit/51 ldflagdedup/bob.c | 5 + test cases/unit/51 ldflagdedup/meson.build | 12 + test cases/unit/51 ldflagdedup/prog.c | 7 + .../unit/52 pkgconfig static link order/dummy.c | 0 .../52 pkgconfig static link order/meson.build | 11 + test cases/unit/53 clang-format/.clang-format | 5 + .../unit/53 clang-format/dummydir.h/dummy.dat | 1 + test cases/unit/53 clang-format/header_expected_h | 3 + test cases/unit/53 clang-format/header_orig_h | 9 + test cases/unit/53 clang-format/meson.build | 3 + test cases/unit/53 clang-format/prog_expected_c | 6 + test cases/unit/53 clang-format/prog_orig_c | 20 + .../subprojects/projectBad/meson.build | 9 + .../subprojects/projectBad/meson_options.txt | 1 + test cases/unit/55 dedup compiler libs/app/app.c | 13 + .../unit/55 dedup compiler libs/app/meson.build | 2 + test cases/unit/55 dedup compiler libs/liba/liba.c | 18 + test cases/unit/55 dedup compiler libs/liba/liba.h | 8 + .../unit/55 dedup compiler libs/liba/meson.build | 8 + test cases/unit/55 dedup compiler libs/libb/libb.c | 7 + test cases/unit/55 dedup compiler libs/libb/libb.h | 6 + .../unit/55 dedup compiler libs/libb/meson.build | 6 + test cases/unit/55 dedup compiler libs/meson.build | 7 + test cases/unit/56 introspection/cp.py | 5 + test cases/unit/56 introspection/meson.build | 72 + test cases/unit/56 introspection/meson_options.txt | 2 + .../unit/56 introspection/sharedlib/meson.build | 2 + .../unit/56 introspection/sharedlib/shared.cpp | 9 + .../unit/56 introspection/sharedlib/shared.hpp | 10 + .../unit/56 introspection/staticlib/meson.build | 3 + .../unit/56 introspection/staticlib/static.c | 5 + .../unit/56 introspection/staticlib/static.h | 11 + test cases/unit/56 introspection/t1.cpp | 13 + test cases/unit/56 introspection/t2.cpp | 8 + test cases/unit/56 introspection/t3.cpp | 16 + .../build_extra_path/totally_made_up_dep.pc | 7 + .../host_extra_path/totally_made_up_dep.pc | 7 + .../unit/57 pkg_config_path option/meson.build | 7 + .../unit/58 introspect buildoptions/c_compiler.py | 3 + test cases/unit/58 introspect buildoptions/main.c | 6 + .../unit/58 introspect buildoptions/meson.build | 18 + .../58 introspect buildoptions/meson_options.txt | 2 + .../subprojects/evilFile.txt | 0 .../subprojects/projectA/meson.build | 3 + .../subprojects/projectA/meson_options.txt | 1 + .../subprojects/projectBad/meson.build | 9 + .../subprojects/projectBad/meson_options.txt | 1 + test cases/unit/59 native file override/crossfile | 16 + test cases/unit/59 native file override/crossfile2 | 4 + .../unit/59 native file override/meson.build | 10 + .../unit/59 native file override/meson_options.txt | 13 + test cases/unit/59 native file override/nativefile | 16 + test cases/unit/6 std override/meson.build | 10 + test cases/unit/6 std override/prog11.cpp | 6 + test cases/unit/6 std override/prog98.cpp | 6 + test cases/unit/6 std override/progp.cpp | 6 + test cases/unit/60 identity cross/build_wrapper.py | 11 + test cases/unit/60 identity cross/host_wrapper.py | 11 + test cases/unit/60 identity cross/meson.build | 15 + test cases/unit/60 identity cross/stuff.h | 27 + .../pkgconfig/librelativepath.pc | 9 + test cases/unit/62 cmake_prefix_path/meson.build | 4 + .../lib/cmake/mesontest/mesontest-config.cmake | 4 + test cases/unit/63 cmake parser/meson.build | 19 + .../lib/cmake/mesontest/mesontest-config.cmake | 63 + test cases/unit/64 alias target/main.c | 3 + test cases/unit/64 alias target/meson.build | 17 + test cases/unit/64 alias target/subdir/meson.build | 6 + .../unit/65 static archive stripping/app/appA.c | 4 + .../unit/65 static archive stripping/app/appB.c | 4 + .../65 static archive stripping/app/meson.build | 7 + .../unit/65 static archive stripping/lib/libA.c | 5 + .../unit/65 static archive stripping/lib/libA.h | 1 + .../unit/65 static archive stripping/lib/libB.c | 5 + .../unit/65 static archive stripping/lib/libB.h | 1 + .../65 static archive stripping/lib/meson.build | 23 + test cases/unit/66 static link/lib/func1.c | 9 + test cases/unit/66 static link/lib/func10.c | 4 + test cases/unit/66 static link/lib/func11.c | 6 + test cases/unit/66 static link/lib/func12.c | 7 + test cases/unit/66 static link/lib/func14.c | 4 + test cases/unit/66 static link/lib/func15.c | 6 + test cases/unit/66 static link/lib/func16.c | 6 + test cases/unit/66 static link/lib/func17.c | 4 + test cases/unit/66 static link/lib/func18.c | 6 + test cases/unit/66 static link/lib/func19.c | 7 + test cases/unit/66 static link/lib/func2.c | 6 + test cases/unit/66 static link/lib/func3.c | 4 + test cases/unit/66 static link/lib/func4.c | 6 + test cases/unit/66 static link/lib/func5.c | 4 + test cases/unit/66 static link/lib/func6.c | 6 + test cases/unit/66 static link/lib/func7.c | 4 + test cases/unit/66 static link/lib/func8.c | 6 + test cases/unit/66 static link/lib/func9.c | 6 + test cases/unit/66 static link/lib/meson.build | 80 + test cases/unit/66 static link/meson.build | 32 + test cases/unit/66 static link/test1.c | 7 + test cases/unit/66 static link/test2.c | 6 + test cases/unit/66 static link/test3.c | 6 + test cases/unit/66 static link/test4.c | 6 + test cases/unit/66 static link/test5.c | 6 + test cases/unit/67 test env value/meson.build | 10 + test cases/unit/67 test env value/test.py | 6 + test cases/unit/68 clang-tidy/.clang-tidy | 1 + test cases/unit/68 clang-tidy/cttest.cpp | 7 + test cases/unit/68 clang-tidy/dummydir.h/dummy.dat | 1 + test cases/unit/68 clang-tidy/meson.build | 3 + test cases/unit/69 cross/crossfile.in | 5 + test cases/unit/69 cross/meson.build | 16 + test cases/unit/69 cross/meson_options.txt | 1 + test cases/unit/7 run installed/foo/foo.c | 3 + test cases/unit/7 run installed/foo/meson.build | 6 + test cases/unit/7 run installed/meson.build | 8 + test cases/unit/7 run installed/prog.c | 5 + test cases/unit/70 cross test passed/exewrapper.py | 24 + test cases/unit/70 cross test passed/meson.build | 19 + .../unit/70 cross test passed/meson_options.txt | 5 + test cases/unit/70 cross test passed/script.py | 7 + test cases/unit/70 cross test passed/src/main.c | 6 + test cases/unit/71 summary/meson.build | 24 + test cases/unit/71 summary/meson_options.txt | 1 + .../unit/71 summary/subprojects/sub/meson.build | 4 + .../unit/71 summary/subprojects/sub2/meson.build | 6 + .../sub2/subprojects/subsub/meson.build | 3 + test cases/unit/72 wrap file url/meson.build | 4 + .../72 wrap file url/subprojects/foo-patch.tar.xz | Bin 0 -> 228 bytes .../unit/72 wrap file url/subprojects/foo.tar.xz | Bin 0 -> 216 bytes test cases/unit/73 dep files/foo.c | 0 test cases/unit/73 dep files/meson.build | 16 + .../unit/74 pkgconfig prefixes/client/client.c | 8 + .../unit/74 pkgconfig prefixes/client/meson.build | 3 + .../unit/74 pkgconfig prefixes/val1/meson.build | 5 + test cases/unit/74 pkgconfig prefixes/val1/val1.c | 3 + test cases/unit/74 pkgconfig prefixes/val1/val1.h | 1 + .../unit/74 pkgconfig prefixes/val2/meson.build | 8 + test cases/unit/74 pkgconfig prefixes/val2/val2.c | 4 + test cases/unit/74 pkgconfig prefixes/val2/val2.h | 1 + test cases/unit/75 subdir libdir/meson.build | 2 + .../75 subdir libdir/subprojects/flub/meson.build | 1 + test cases/unit/76 as link whole/bar.c | 6 + test cases/unit/76 as link whole/foo.c | 6 + test cases/unit/76 as link whole/meson.build | 11 + test cases/unit/77 nostdlib/meson.build | 14 + test cases/unit/77 nostdlib/prog.c | 7 + .../unit/77 nostdlib/subprojects/mylibc/libc.c | 35 + .../77 nostdlib/subprojects/mylibc/meson.build | 13 + .../unit/77 nostdlib/subprojects/mylibc/stdio.h | 5 + .../77 nostdlib/subprojects/mylibc/stubstart.s | 8 + .../unit/78 user options for subproject/.gitignore | 1 + .../75 user options for subproject/.gitignore | 1 + .../75 user options for subproject/meson.build | 3 + .../subprojects/sub/meson.build | 45 + .../subprojects/sub/meson_options.txt | 9 + test cases/unit/79 global-rpath/meson.build | 3 + test cases/unit/79 global-rpath/rpathified.cpp | 6 + test cases/unit/79 global-rpath/yonder/meson.build | 5 + test cases/unit/79 global-rpath/yonder/yonder.cpp | 3 + test cases/unit/79 global-rpath/yonder/yonder.h | 1 + test cases/unit/8 -L -l order/first.pc | 13 + test cases/unit/8 -L -l order/meson.build | 6 + test cases/unit/8 -L -l order/prog.c | 5 + test cases/unit/8 -L -l order/second.pc | 13 + test cases/unit/80 wrap-git/meson.build | 4 + .../packagefiles/wrap_git_builddef/meson.build | 3 + .../subprojects/wrap_git_upstream/main.c | 4 + .../unit/81 meson version compare/meson.build | 19 + .../subprojects/foo/meson.build | 8 + .../unit/82 cross only introspect/meson.build | 2 + .../unit/83 change option choices/meson.build | 1 + .../83 change option choices/meson_options.1.txt | 13 + .../83 change option choices/meson_options.2.txt | 13 + .../84 nested subproject regenerate depends/main.c | 3 + .../meson.build | 10 + .../subprojects/sub1/meson.build | 4 + .../subprojects/sub2/CMakeLists.txt | 1 + test cases/unit/85 cpp modules/gcc/main.cpp | 7 + test cases/unit/85 cpp modules/gcc/meson.build | 19 + test cases/unit/85 cpp modules/gcc/src0.cxx | 7 + test cases/unit/85 cpp modules/gcc/src1.cxx | 7 + test cases/unit/85 cpp modules/gcc/src2.cxx | 7 + test cases/unit/85 cpp modules/gcc/src3.cxx | 7 + test cases/unit/85 cpp modules/gcc/src4.cxx | 7 + test cases/unit/85 cpp modules/gcc/src5.cxx | 7 + test cases/unit/85 cpp modules/gcc/src6.cxx | 7 + test cases/unit/85 cpp modules/gcc/src7.cxx | 7 + test cases/unit/85 cpp modules/gcc/src8.cxx | 7 + test cases/unit/85 cpp modules/gcc/src9.cxx | 5 + test cases/unit/85 cpp modules/meson.build | 11 + test cases/unit/85 cpp modules/vs/main.cpp | 7 + test cases/unit/85 cpp modules/vs/meson.build | 15 + test cases/unit/85 cpp modules/vs/src0.ixx | 7 + test cases/unit/85 cpp modules/vs/src1.ixx | 7 + test cases/unit/85 cpp modules/vs/src2.ixx | 7 + test cases/unit/85 cpp modules/vs/src3.ixx | 7 + test cases/unit/85 cpp modules/vs/src4.ixx | 7 + test cases/unit/85 cpp modules/vs/src5.ixx | 7 + test cases/unit/85 cpp modules/vs/src6.ixx | 7 + test cases/unit/85 cpp modules/vs/src7.ixx | 7 + test cases/unit/85 cpp modules/vs/src8.ixx | 7 + test cases/unit/85 cpp modules/vs/src9.ixx | 5 + test cases/unit/86 prelinking/file1.c | 14 + test cases/unit/86 prelinking/file2.c | 9 + test cases/unit/86 prelinking/file3.c | 9 + test cases/unit/86 prelinking/file4.c | 9 + test cases/unit/86 prelinking/main.c | 10 + test cases/unit/86 prelinking/meson.build | 7 + test cases/unit/86 prelinking/private_header.h | 11 + test cases/unit/86 prelinking/public_header.h | 3 + test cases/unit/87 run native test/main.c | 17 + test cases/unit/87 run native test/meson.build | 6 + test cases/unit/88 multiple envvars/meson.build | 4 + test cases/unit/88 multiple envvars/prog.c | 18 + test cases/unit/88 multiple envvars/prog.cpp | 18 + .../unit/89 pkgconfig build rpath order/dummy.pc | 7 + .../89 pkgconfig build rpath order/meson.build | 20 + .../unit/89 pkgconfig build rpath order/prog.c | 5 + .../unit/89 pkgconfig build rpath order/prog.cc | 8 + .../89 pkgconfig build rpath order/sub/meson.build | 1 + .../89 pkgconfig build rpath order/sub/stuff.c | 3 + test cases/unit/9 d dedup/meson.build | 5 + test cases/unit/9 d dedup/prog.c | 14 + test cases/unit/90 devenv/main.c | 14 + test cases/unit/90 devenv/meson.build | 17 + test cases/unit/90 devenv/subprojects/sub/foo.c | 10 + .../unit/90 devenv/subprojects/sub/meson.build | 6 + test cases/unit/90 devenv/test-devenv.py | 8 + 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 + .../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 + 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 + .../unit/95 implicit force fallback/meson.build | 8 + .../subprojects/something/meson.build | 3 + .../unit/96 compiler.links file arg/meson.build | 11 + test cases/unit/96 compiler.links file arg/test.c | 1 + test cases/unit/97 link full name/.gitignore | 5 + .../97 link full name/libtestprovider/meson.build | 20 + .../97 link full name/libtestprovider/provider.c | 12 + .../unit/97 link full name/proguser/meson.build | 11 + .../unit/97 link full name/proguser/receiver.c | 18 + .../unit/98 install all targets/bar-custom.txt | 0 test cases/unit/98 install all targets/bar-devel.h | 0 .../unit/98 install all targets/bar-notag.txt | 0 .../98 install all targets/custom_files/data.txt | 1 + test cases/unit/98 install all targets/foo.in | 0 .../unit/98 install all targets/foo1-devel.h | 0 test cases/unit/98 install all targets/lib.c | 9 + test cases/unit/98 install all targets/main.c | 3 + test cases/unit/98 install all targets/meson.build | 108 + test cases/unit/98 install all targets/script.py | 7 + .../98 install all targets/subdir/bar2-devel.h | 0 .../unit/98 install all targets/subdir/foo2.in | 0 .../98 install all targets/subdir/foo3-devel.h | 0 .../unit/98 install all targets/subdir/lib.c | 9 + .../unit/98 install all targets/subdir/main.c | 3 + .../unit/98 install all targets/subdir/meson.build | 21 + .../unit/98 install all targets/subdir/script.py | 7 + test cases/unit/99 custom target name/file.txt.in | 0 test cases/unit/99 custom target name/meson.build | 14 + .../unit/99 custom target name/subdir/meson.build | 9 + test cases/vala/1 basic/meson.build | 7 + test cases/vala/1 basic/prog.vala | 7 + test cases/vala/10 mixed sources/c/foo.c | 5 + test cases/vala/10 mixed sources/c/meson.build | 5 + test cases/vala/10 mixed sources/c/writec.py | 12 + test cases/vala/10 mixed sources/meson.build | 7 + test cases/vala/10 mixed sources/vala/bar.vala | 5 + test cases/vala/11 generated vapi/libbar/bar.c | 29 + test cases/vala/11 generated vapi/libbar/bar.h | 9 + .../vala/11 generated vapi/libbar/meson.build | 32 + test cases/vala/11 generated vapi/libfoo/foo.c | 28 + test cases/vala/11 generated vapi/libfoo/foo.h | 9 + .../vala/11 generated vapi/libfoo/foo.metadata | 1 + .../vala/11 generated vapi/libfoo/meson.build | 42 + test cases/vala/11 generated vapi/main.vala | 9 + test cases/vala/11 generated vapi/meson.build | 13 + test cases/vala/11 generated vapi/test.json | 13 + test cases/vala/12 custom output/bar.vala | 0 test cases/vala/12 custom output/foo.vala | 0 test cases/vala/12 custom output/meson.build | 13 + test cases/vala/13 find library/meson.build | 9 + test cases/vala/13 find library/test.vala | 6 + .../gres/meson.build | 3 + .../gres/test-resources.xml | 6 + .../gres/test.ui | 19 + .../meson.build | 12 + .../test.vala | 37 + .../vala/15 static vapi in source tree/meson.build | 13 + .../vala/15 static vapi in source tree/test.vala | 6 + .../15 static vapi in source tree/vapi/config.vapi | 4 + test cases/vala/16 mixed dependence/app.vala | 7 + test cases/vala/16 mixed dependence/meson.build | 16 + test cases/vala/16 mixed dependence/mixer-glue.c | 5 + test cases/vala/16 mixed dependence/mixer.vala | 3 + test cases/vala/17 plain consumer/app.c | 11 + test cases/vala/17 plain consumer/badger.vala | 10 + test cases/vala/17 plain consumer/meson.build | 12 + test cases/vala/18 vapi consumed twice/app.vala | 11 + test cases/vala/18 vapi consumed twice/beer.vala | 10 + test cases/vala/18 vapi consumed twice/meson.build | 15 + test cases/vala/18 vapi consumed twice/person.vala | 16 + test cases/vala/19 genie/meson.build | 6 + test cases/vala/19 genie/prog.gs | 2 + test cases/vala/2 multiple files/class1.vala | 7 + test cases/vala/2 multiple files/class2.vala | 6 + test cases/vala/2 multiple files/main.vala | 8 + test cases/vala/2 multiple files/meson.build | 10 + .../20 genie multiple mixed sources/c_test_one.c | 5 + .../20 genie multiple mixed sources/c_test_two.c | 5 + .../vala/20 genie multiple mixed sources/init.gs | 10 + .../20 genie multiple mixed sources/meson.build | 19 + .../20 genie multiple mixed sources/test_one.gs | 5 + .../20 genie multiple mixed sources/test_two.gs | 5 + .../vala_test_one.vala | 7 + .../vala_test_two.vala | 7 + test cases/vala/21 type module/foo.vala | 17 + test cases/vala/21 type module/meson.build | 20 + test cases/vala/21 type module/plugin-bar.vala | 11 + test cases/vala/21 type module/plugin-module.vala | 54 + test cases/vala/21 type module/plugin.vala | 4 + .../Subdir/Subdir2/Test.vala | 5 + .../22 same target in directories/Subdir/Test.vala | 5 + .../Subdir2/Test.vala | 5 + .../vala/22 same target in directories/Test.vala | 5 + .../vala/22 same target in directories/meson.build | 13 + .../vala/22 same target in directories/prog.vala | 8 + test cases/vala/23 thread flags/meson.build | 7 + test cases/vala/23 thread flags/prog.vala | 2 + .../vala/24 export dynamic shared module/app.vala | 21 + .../24 export dynamic shared module/meson.build | 20 + .../24 export dynamic shared module/module.vala | 3 + test cases/vala/25 extract_all_objects/meson.build | 11 + test cases/vala/25 extract_all_objects/prog.vala | 7 + test cases/vala/26 vala and asm/meson.build | 23 + test cases/vala/26 vala and asm/prog.vala | 9 + test cases/vala/26 vala and asm/retval-arm.S | 11 + test cases/vala/26 vala and asm/retval-x86.S | 12 + test cases/vala/26 vala and asm/retval-x86_64.S | 11 + .../vala/26 vala and asm/symbol-underscore.h | 5 + test cases/vala/3 dep/gioprog.vala | 8 + test cases/vala/3 dep/meson.build | 12 + test cases/vala/4 config/config.vapi | 1 + test cases/vala/4 config/meson-something-else.vapi | 1 + test cases/vala/4 config/meson.build | 15 + test cases/vala/4 config/prog.vala | 8 + test cases/vala/5 target glib/GLib.Thread.vala | 43 + test cases/vala/5 target glib/meson.build | 10 + test cases/vala/5 target glib/retcode.c | 5 + test cases/vala/6 static library/meson.build | 17 + test cases/vala/6 static library/mylib.vala | 5 + test cases/vala/6 static library/prog.vala | 7 + test cases/vala/6 static library/test.json | 5 + test cases/vala/7 shared library/lib/meson.build | 35 + test cases/vala/7 shared library/lib/mylib.vala | 5 + test cases/vala/7 shared library/meson.build | 10 + test cases/vala/7 shared library/prog/meson.build | 4 + test cases/vala/7 shared library/prog/prog.vala | 7 + test cases/vala/7 shared library/test.json | 14 + .../dependency-generated/enum-types.c.template | 43 + .../dependency-generated/enum-types.h.template | 26 + .../dependency-generated/enums.h | 15 + .../dependency-generated/lib.vala | 3 + .../dependency-generated/main.vala | 3 + .../dependency-generated/meson.build | 44 + .../dependency-generated/null.c | 1 + test cases/vala/8 generated sources/meson.build | 14 + .../vala/8 generated sources/onlygen/maingen.in | 3 + .../vala/8 generated sources/onlygen/meson.build | 7 + .../vala/8 generated sources/src/config.vala.in | 3 + .../vala/8 generated sources/src/copy_file.py | 6 + .../vala/8 generated sources/src/meson.build | 17 + .../vala/8 generated sources/src/returncode.in | 3 + test cases/vala/8 generated sources/src/test.vala | 4 + .../vala/8 generated sources/src/write_wrapper.py | 12 + test cases/vala/8 generated sources/test.json | 7 + .../vala/8 generated sources/tools/meson.build | 3 + test cases/vala/9 gir/foo.vala | 7 + test cases/vala/9 gir/meson.build | 17 + test cases/vala/9 gir/test.json | 7 + test cases/warning/1 version for string div/a/b.c | 3 + .../warning/1 version for string div/meson.build | 3 + .../warning/1 version for string div/test.json | 8 + .../warning/2 languages missing native/meson.build | 3 + .../warning/2 languages missing native/test.json | 7 + .../warning/3 fallback consistency/meson.build | 7 + .../subprojects/sub/meson.build | 5 + .../warning/3 fallback consistency/test.json | 10 + .../warning/4 fallback consistency/meson.build | 4 + .../subprojects/sub/meson.build | 5 + .../warning/4 fallback consistency/test.json | 10 + .../warning/5 fallback consistency/meson.build | 4 + .../5 fallback consistency/subprojects/foo.wrap | 6 + .../subprojects/foo/meson.build | 6 + .../warning/5 fallback consistency/test.json | 10 + test cases/warning/6 list add/meson.build | 7 + test cases/warning/6 list add/test.json | 7 + .../warning/7 module without unstable/meson.build | 3 + .../warning/7 module without unstable/test.json | 7 + .../warning/8 target with no sources/meson.build | 3 + .../warning/8 target with no sources/test.json | 7 + test cases/wasm/1 basic/hello.c | 6 + test cases/wasm/1 basic/hello.cpp | 6 + test cases/wasm/1 basic/hello.html | 8 + test cases/wasm/1 basic/meson.build | 4 + test cases/wasm/2 threads/meson.build | 10 + test cases/wasm/2 threads/threads.c | 21 + test cases/wasm/2 threads/threads.cpp | 13 + test cases/wasm/3 jslib/meson.build | 8 + test cases/wasm/3 jslib/prog.c | 10 + test cases/wasm/3 jslib/somefuncs.js | 6 + test cases/wayland/1 client/both.c | 11 + test cases/wayland/1 client/client.c | 9 + test cases/wayland/1 client/local.c | 9 + test cases/wayland/1 client/meson.build | 48 + test cases/wayland/1 client/server.c | 9 + test cases/wayland/1 client/test.xml | 6 + test cases/wayland/2 core only/core.c | 9 + test cases/wayland/2 core only/meson.build | 14 + test cases/windows/1 basic/meson.build | 4 + test cases/windows/1 basic/prog.c | 5 + test cases/windows/1 basic/test.json | 6 + .../meson.build | 5 + .../prog.c | 5 + .../subdir/make_def.py | 6 + .../subdir/meson.build | 7 + .../subdir/somedll.c | 3 + test cases/windows/11 exe implib/meson.build | 7 + test cases/windows/11 exe implib/prog.c | 6 + test cases/windows/11 exe implib/test.json | 12 + .../12 resources with custom targets/meson.build | 70 + .../12 resources with custom targets/prog.c | 19 + .../res/gen-res.py | 6 + .../res/meson.build | 19 + .../res/myres.rc.in | 4 + .../res/myres_static.rc | 3 + .../res/resource.h | 0 .../res/sample.ico | Bin 0 -> 9662 bytes .../13 test argument extra paths/exe/main.c | 5 + .../13 test argument extra paths/exe/meson.build | 3 + .../windows/13 test argument extra paths/lib/foo.c | 6 + .../windows/13 test argument extra paths/lib/foo.h | 14 + .../13 test argument extra paths/lib/meson.build | 3 + .../13 test argument extra paths/meson.build | 5 + .../13 test argument extra paths/test/meson.build | 3 + .../test/test_run_exe.py | 12 + .../ico/gen-ico.py | 6 + .../ico/meson.build | 8 + .../ico/sample.ico.in | Bin 0 -> 9662 bytes .../meson.build | 69 + .../prog.c | 19 + .../res/meson.build | 4 + .../res/myres.rc | 3 + .../a/meson.build | 1 + .../a/rsrc.rc | 1 + .../b/meson.build | 2 + .../b/rsrc.rc | 1 + .../c/meson.build | 2 + .../c/rsrc.rc | 1 + .../exe3/meson.build | 5 + .../exe3/src_dll/main.c | 10 + .../exe3/src_dll/version.rc | 11 + .../exe3/src_exe/main.c | 3 + .../exe3/src_exe/version.rc | 11 + .../exe4/meson.build | 5 + .../exe4/src_dll/main.c | 10 + .../exe4/src_dll/version.rc | 11 + .../exe4/src_exe/main.c | 3 + .../exe4/src_exe/version.rc | 11 + .../meson.build | 21 + .../rsrc.rc | 1 + .../verify.c | 25 + test cases/windows/16 gui app/console_prog.c | 3 + test cases/windows/16 gui app/dummy.c | 0 test cases/windows/16 gui app/gui_app_tester.py | 19 + test cases/windows/16 gui app/gui_prog.c | 11 + test cases/windows/16 gui app/meson.build | 26 + test cases/windows/17 msvc ndebug/main.cpp | 9 + test cases/windows/17 msvc ndebug/meson.build | 7 + test cases/windows/18 msvc charset/iso-8859-1.c | 7 + test cases/windows/18 msvc charset/meson.build | 15 + .../windows/18 msvc charset/meson_options.txt | 1 + test cases/windows/18 msvc charset/utf8.c | 7 + .../windows/19 msvc cplusplus define/main.cpp | 7 + .../windows/19 msvc cplusplus define/meson.build | 14 + test cases/windows/2 winmain/meson.build | 4 + test cases/windows/2 winmain/prog.c | 15 + .../both_lib_source.c | 7 + .../copyfile.py | 4 + .../generated_source.c | 4 + .../meson.build | 20 + .../static_lib_source.c | 6 + .../test.json | 13 + test cases/windows/21 masm/hello.masm | 33 + test cases/windows/21 masm/meson.build | 14 + test cases/windows/3 cpp/meson.build | 4 + test cases/windows/3 cpp/prog.cpp | 7 + test cases/windows/4 winmaincpp/meson.build | 4 + test cases/windows/4 winmaincpp/prog.cpp | 17 + test cases/windows/5 resources/inc/meson.build | 1 + .../windows/5 resources/inc/resource/resource.h | 1 + test cases/windows/5 resources/meson.build | 69 + test cases/windows/5 resources/prog.c | 21 + test cases/windows/5 resources/res/dummy.c | 0 test cases/windows/5 resources/res/meson.build | 10 + test cases/windows/5 resources/res/myres.rc | 4 + test cases/windows/5 resources/res/sample.ico | Bin 0 -> 9662 bytes test cases/windows/6 vs module defs/meson.build | 5 + test cases/windows/6 vs module defs/prog.c | 5 + .../windows/6 vs module defs/subdir/meson.build | 1 + .../windows/6 vs module defs/subdir/somedll.c | 3 + .../windows/6 vs module defs/subdir/somedll.def | 2 + test cases/windows/7 dll versioning/copyfile.py | 6 + test cases/windows/7 dll versioning/exe.orig.c | 8 + test cases/windows/7 dll versioning/lib.c | 6 + test cases/windows/7 dll versioning/meson.build | 54 + test cases/windows/7 dll versioning/test.json | 34 + test cases/windows/8 find program/meson.build | 12 + test cases/windows/8 find program/test-script | 3 + .../windows/8 find program/test-script-ext.py | 3 + .../windows/9 vs module defs generated/meson.build | 5 + .../windows/9 vs module defs generated/prog.c | 5 + .../9 vs module defs generated/subdir/meson.build | 10 + .../9 vs module defs generated/subdir/somedll.c | 3 + .../subdir/somedll.def.in | 2 + 3745 files changed, 47953 insertions(+) create mode 100644 test cases/cmake/1 basic/main.cpp create mode 100644 test cases/cmake/1 basic/meson.build create mode 100644 test cases/cmake/1 basic/subprojects/cmMod/CMakeLists.txt create mode 100644 test cases/cmake/1 basic/subprojects/cmMod/cmMod.cpp create mode 100644 test cases/cmake/1 basic/subprojects/cmMod/cmMod.hpp create mode 100644 test cases/cmake/1 basic/subprojects/cmMod/cpp_pch.hpp create mode 100644 test cases/cmake/10 header only/main.cpp create mode 100644 test cases/cmake/10 header only/meson.build create mode 100644 test cases/cmake/10 header only/subprojects/cmMod/CMakeLists.txt create mode 100644 test cases/cmake/10 header only/subprojects/cmMod/include/cmMod.hpp create mode 100644 test cases/cmake/11 cmake_module_path/cmake/FindSomethingLikePython.cmake create mode 100644 test cases/cmake/11 cmake_module_path/meson.build create mode 100644 test cases/cmake/11 cmake_module_path/subprojects/cmMod/CMakeLists.txt create mode 100644 test cases/cmake/11 cmake_module_path/subprojects/cmMod/gen.py create mode 100644 test cases/cmake/12 generator expressions/main.cpp create mode 100644 test cases/cmake/12 generator expressions/meson.build create mode 100644 test cases/cmake/12 generator expressions/subprojects/cmMod/CMakeLists.txt create mode 100644 test cases/cmake/12 generator expressions/subprojects/cmMod/include/cmMod.hpp create mode 100644 test cases/cmake/12 generator expressions/test.json create mode 100644 test cases/cmake/13 system includes/main.cpp create mode 100644 test cases/cmake/13 system includes/meson.build create mode 100644 test cases/cmake/13 system includes/subprojects/cmMod/CMakeLists.txt create mode 100644 test cases/cmake/13 system includes/subprojects/cmMod/cmMod.cpp create mode 100644 test cases/cmake/13 system includes/subprojects/cmMod/cmMod.hpp create mode 100644 test cases/cmake/13 system includes/subprojects/cmMod/sysInc/triggerWarn.hpp create mode 100644 test cases/cmake/14 fortran threads/meson.build create mode 100644 test cases/cmake/15 object library advanced/main.cpp create mode 100644 test cases/cmake/15 object library advanced/meson.build create mode 100644 test cases/cmake/15 object library advanced/subprojects/cmObjLib/CMakeLists.txt create mode 100644 test cases/cmake/15 object library advanced/subprojects/cmObjLib/genC.cpp create mode 100644 test cases/cmake/15 object library advanced/subprojects/cmObjLib/libA.cpp create mode 100644 test cases/cmake/15 object library advanced/subprojects/cmObjLib/libA.hpp create mode 100644 test cases/cmake/15 object library advanced/subprojects/cmObjLib/libB.cpp create mode 100644 test cases/cmake/15 object library advanced/subprojects/cmObjLib/libB.hpp create mode 100644 test cases/cmake/16 threads/main.cpp create mode 100644 test cases/cmake/16 threads/meson.build create mode 100644 test cases/cmake/16 threads/meson_options.txt create mode 100644 test cases/cmake/16 threads/subprojects/cmMod/CMakeLists.txt create mode 100644 test cases/cmake/16 threads/subprojects/cmMod/cmMod.cpp create mode 100644 test cases/cmake/16 threads/subprojects/cmMod/cmMod.hpp create mode 100644 test cases/cmake/16 threads/subprojects/cmMod/main.cpp create mode 100644 test cases/cmake/16 threads/test.json create mode 100644 test cases/cmake/17 include path order/main.cpp create mode 100644 test cases/cmake/17 include path order/meson.build create mode 100644 test cases/cmake/17 include path order/subprojects/cmMod/CMakeLists.txt create mode 100644 test cases/cmake/17 include path order/subprojects/cmMod/cmMod.cpp create mode 100644 test cases/cmake/17 include path order/subprojects/cmMod/incA/cmMod.hpp create mode 100644 test cases/cmake/17 include path order/subprojects/cmMod/incB/cmMod.hpp create mode 100644 test cases/cmake/17 include path order/subprojects/cmMod/incC/cmMod.hpp create mode 100644 test cases/cmake/17 include path order/subprojects/cmMod/incD/cmMod.hpp create mode 100644 test cases/cmake/17 include path order/subprojects/cmMod/incE/cmMod.hpp create mode 100644 test cases/cmake/17 include path order/subprojects/cmMod/incF/cmMod.hpp create mode 100644 test cases/cmake/17 include path order/subprojects/cmMod/incG/cmMod.hpp create mode 100644 test cases/cmake/17 include path order/subprojects/cmMod/incH/cmMod.hpp create mode 100644 test cases/cmake/17 include path order/subprojects/cmMod/incI/cmMod.hpp create mode 100644 test cases/cmake/17 include path order/subprojects/cmMod/incJ/cmMod.hpp create mode 100644 test cases/cmake/17 include path order/subprojects/cmMod/incL/cmMod.hpp create mode 100644 test cases/cmake/17 include path order/subprojects/cmMod/incM/cmMod.hpp create mode 100644 test cases/cmake/17 include path order/subprojects/cmMod/incN/cmMod.hpp create mode 100644 test cases/cmake/17 include path order/subprojects/cmMod/incO/cmMod.hpp create mode 100644 test cases/cmake/17 include path order/subprojects/cmMod/incP/cmMod.hpp create mode 100644 test cases/cmake/18 skip include files/main.cpp create mode 100644 test cases/cmake/18 skip include files/meson.build create mode 100644 test cases/cmake/18 skip include files/subprojects/cmMod/CMakeLists.txt create mode 100644 test cases/cmake/18 skip include files/subprojects/cmMod/cmMod.cpp create mode 100644 test cases/cmake/18 skip include files/subprojects/cmMod/cmMod.hpp create mode 100644 test cases/cmake/18 skip include files/subprojects/cmMod/fakeInc/CMakeLists.txt create mode 100644 test cases/cmake/18 skip include files/subprojects/cmMod/fakeInc/cmModInc1.cpp create mode 100644 test cases/cmake/18 skip include files/subprojects/cmMod/fakeInc/cmModInc2.cpp create mode 100644 test cases/cmake/18 skip include files/subprojects/cmMod/fakeInc/cmModInc3.cpp create mode 100644 test cases/cmake/18 skip include files/subprojects/cmMod/fakeInc/cmModInc4.cpp create mode 100644 test cases/cmake/19 advanced options/main.cpp create mode 100644 test cases/cmake/19 advanced options/meson.build create mode 100644 test cases/cmake/19 advanced options/subprojects/cmOpts/CMakeLists.txt create mode 100644 test cases/cmake/19 advanced options/subprojects/cmOpts/cmMod.cpp create mode 100644 test cases/cmake/19 advanced options/subprojects/cmOpts/cmMod.hpp create mode 100644 test cases/cmake/19 advanced options/subprojects/cmOpts/cmTest.cpp create mode 100644 test cases/cmake/19 advanced options/subprojects/cmOpts/cmTest.hpp create mode 100644 test cases/cmake/19 advanced options/subprojects/cmOpts/main.cpp create mode 100644 test cases/cmake/19 advanced options/test.json create mode 100644 test cases/cmake/2 advanced/main.cpp create mode 100644 test cases/cmake/2 advanced/meson.build create mode 100644 test cases/cmake/2 advanced/subprojects/cmMod/CMakeLists.txt create mode 100644 test cases/cmake/2 advanced/subprojects/cmMod/config.h.in create mode 100644 test cases/cmake/2 advanced/subprojects/cmMod/lib/cmMod.cpp create mode 100644 test cases/cmake/2 advanced/subprojects/cmMod/lib/cmMod.hpp create mode 100644 test cases/cmake/2 advanced/subprojects/cmMod/main.cpp create mode 100644 test cases/cmake/2 advanced/test.json create mode 100644 test cases/cmake/20 cmake file/foolib.cmake.in create mode 100644 test cases/cmake/20 cmake file/meson.build create mode 100644 test cases/cmake/20 cmake file/test.json create mode 100644 test cases/cmake/21 shared module/meson.build create mode 100644 test cases/cmake/21 shared module/prog.c create mode 100644 test cases/cmake/21 shared module/runtime.c create mode 100644 test cases/cmake/21 shared module/subprojects/cmMod/CMakeLists.txt create mode 100644 test cases/cmake/21 shared module/subprojects/cmMod/module/module.c create mode 100644 test cases/cmake/21 shared module/subprojects/cmMod/module/module.h create mode 100644 test cases/cmake/22 cmake module/cmake_project/CMakeLists.txt create mode 100644 test cases/cmake/22 cmake module/meson.build create mode 100644 test cases/cmake/22 cmake module/projectConfig.cmake.in create mode 100644 test cases/cmake/22 cmake module/test.json create mode 100644 test cases/cmake/23 cmake toolchain/CMakeToolchain.cmake create mode 100644 test cases/cmake/23 cmake toolchain/meson.build create mode 100644 test cases/cmake/23 cmake toolchain/nativefile.ini.in create mode 100644 test cases/cmake/23 cmake toolchain/subprojects/cmMod/CMakeLists.txt create mode 100644 test cases/cmake/23 cmake toolchain/subprojects/cmModFortran/CMakeLists.txt create mode 100644 test cases/cmake/24 mixing languages/main.c create mode 100644 test cases/cmake/24 mixing languages/meson.build create mode 100644 test cases/cmake/24 mixing languages/subprojects/cmTest/CMakeLists.txt create mode 100644 test cases/cmake/24 mixing languages/subprojects/cmTest/cmTest.c create mode 100644 test cases/cmake/24 mixing languages/subprojects/cmTest/cmTest.h create mode 100644 test cases/cmake/24 mixing languages/subprojects/cmTest/cmTest.m create mode 100644 test cases/cmake/25 assembler/main.c create mode 100644 test cases/cmake/25 assembler/meson.build create mode 100644 test cases/cmake/25 assembler/subprojects/cmTest/CMakeLists.txt create mode 100644 test cases/cmake/25 assembler/subprojects/cmTest/cmTest.c create mode 100644 test cases/cmake/25 assembler/subprojects/cmTest/cmTestAsm.s create mode 100644 test cases/cmake/3 advanced no dep/main.cpp create mode 100644 test cases/cmake/3 advanced no dep/meson.build create mode 100644 test cases/cmake/3 advanced no dep/subprojects/cmMod/CMakeLists.txt create mode 100644 test cases/cmake/3 advanced no dep/subprojects/cmMod/config.h.in create mode 100644 test cases/cmake/3 advanced no dep/subprojects/cmMod/lib/cmMod.cpp create mode 100644 test cases/cmake/3 advanced no dep/subprojects/cmMod/lib/cmMod.hpp create mode 100644 test cases/cmake/3 advanced no dep/subprojects/cmMod/main.cpp create mode 100644 test cases/cmake/3 advanced no dep/test.json create mode 100644 test cases/cmake/4 code gen/main.cpp create mode 100644 test cases/cmake/4 code gen/meson.build create mode 100644 test cases/cmake/4 code gen/subprojects/cmCodeGen/CMakeLists.txt create mode 100644 test cases/cmake/4 code gen/subprojects/cmCodeGen/main.cpp create mode 100644 test cases/cmake/4 code gen/test.hpp create mode 100644 test cases/cmake/5 object library/main.cpp create mode 100644 test cases/cmake/5 object library/meson.build create mode 100644 test cases/cmake/5 object library/subprojects/cmObjLib/CMakeLists.txt create mode 100644 test cases/cmake/5 object library/subprojects/cmObjLib/libA.cpp create mode 100644 test cases/cmake/5 object library/subprojects/cmObjLib/libA.hpp create mode 100644 test cases/cmake/5 object library/subprojects/cmObjLib/libB.cpp create mode 100644 test cases/cmake/5 object library/subprojects/cmObjLib/libB.hpp create mode 100644 test cases/cmake/6 object library no dep/main.cpp create mode 100644 test cases/cmake/6 object library no dep/meson.build create mode 100644 test cases/cmake/6 object library no dep/subprojects/cmObjLib/CMakeLists.txt create mode 100644 test cases/cmake/6 object library no dep/subprojects/cmObjLib/libA.cpp create mode 100644 test cases/cmake/6 object library no dep/subprojects/cmObjLib/libA.hpp create mode 100644 test cases/cmake/6 object library no dep/subprojects/cmObjLib/libB.cpp create mode 100644 test cases/cmake/6 object library no dep/subprojects/cmObjLib/libB.hpp create mode 100644 test cases/cmake/7 cmake options/meson.build create mode 100644 test cases/cmake/7 cmake options/subprojects/cmOpts/CMakeLists.txt create mode 100644 test cases/cmake/7 cmake options/test.json create mode 100644 test cases/cmake/8 custom command/main.cpp create mode 100644 test cases/cmake/8 custom command/meson.build create mode 100644 test cases/cmake/8 custom command/subprojects/cmMod/CMakeLists.txt create mode 100644 test cases/cmake/8 custom command/subprojects/cmMod/args_test.cpp create mode 100644 test cases/cmake/8 custom command/subprojects/cmMod/cmMod.cpp create mode 100644 test cases/cmake/8 custom command/subprojects/cmMod/cmMod.hpp create mode 100644 test cases/cmake/8 custom command/subprojects/cmMod/cp.cpp create mode 100644 test cases/cmake/8 custom command/subprojects/cmMod/cpyBase.cpp.am create mode 100644 test cases/cmake/8 custom command/subprojects/cmMod/cpyBase.hpp.am create mode 100644 test cases/cmake/8 custom command/subprojects/cmMod/cpyInc.hpp.am create mode 100644 test cases/cmake/8 custom command/subprojects/cmMod/cpyNext.cpp.am create mode 100644 test cases/cmake/8 custom command/subprojects/cmMod/cpyNext.hpp.am create mode 100644 test cases/cmake/8 custom command/subprojects/cmMod/cpyTest.cpp create mode 100644 test cases/cmake/8 custom command/subprojects/cmMod/cpyTest/CMakeLists.txt create mode 100644 test cases/cmake/8 custom command/subprojects/cmMod/cpyTest/cpyTest.hpp create mode 100644 test cases/cmake/8 custom command/subprojects/cmMod/cpyTest/cpyTest2.hpp create mode 100644 test cases/cmake/8 custom command/subprojects/cmMod/cpyTest/cpyTest3.hpp create mode 100644 test cases/cmake/8 custom command/subprojects/cmMod/cpyTest/cpyTest4.hpp create mode 100644 test cases/cmake/8 custom command/subprojects/cmMod/cpyTest/cpyTest5.hpp create mode 100644 test cases/cmake/8 custom command/subprojects/cmMod/genMain.cpp create mode 100644 test cases/cmake/8 custom command/subprojects/cmMod/macro_name.cpp create mode 100644 test cases/cmake/8 custom command/subprojects/cmMod/mycpy/.gitkeep create mode 100644 test cases/cmake/9 disabled subproject/meson.build create mode 100644 test cases/common/1 trivial/meson.build create mode 100644 test cases/common/1 trivial/trivial.c create mode 100644 test cases/common/10 man install/bar.2 create mode 100644 test cases/common/10 man install/baz.1.in create mode 100644 test cases/common/10 man install/foo.1 create mode 100644 test cases/common/10 man install/foo.fr.1 create mode 100644 test cases/common/10 man install/meson.build create mode 100644 test cases/common/10 man install/test.json create mode 100644 test cases/common/10 man install/vanishing/meson.build create mode 100644 test cases/common/10 man install/vanishing/vanishing.1 create mode 100644 test cases/common/10 man install/vanishing/vanishing.2 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 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 create mode 100644 test cases/common/103 has header symbol/meson.build create mode 100644 test cases/common/104 has arg/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 100644 test cases/common/105 generatorcustom/gen.c create mode 100755 test cases/common/105 generatorcustom/gen.py create mode 100644 test cases/common/105 generatorcustom/host.c 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 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 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 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 create mode 100644 test cases/common/11 subdir/meson.build create mode 100644 test cases/common/11 subdir/subdir/meson.build create mode 100644 test cases/common/11 subdir/subdir/prog.c 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 create mode 100644 test cases/common/111 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 create mode 100644 test cases/common/114 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 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 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 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 create mode 100644 test cases/common/12 data/datafile.dat create mode 100644 test cases/common/12 data/etcfile.dat create mode 100644 test cases/common/12 data/fileobject_datafile.dat create mode 100644 test cases/common/12 data/meson.build create mode 100644 test cases/common/12 data/runscript.sh create mode 100644 test cases/common/12 data/somefile.txt create mode 100644 test cases/common/12 data/test.json create mode 100644 test cases/common/12 data/to_be_renamed_1.txt create mode 100644 test cases/common/12 data/to_be_renamed_3.txt create mode 100644 test cases/common/12 data/to_be_renamed_4.txt create mode 100644 test cases/common/12 data/vanishing/meson.build create mode 100644 test cases/common/12 data/vanishing/to_be_renamed_2.txt create mode 100644 test cases/common/12 data/vanishing/vanishing.dat create mode 100644 test cases/common/12 data/vanishing/vanishing2.dat 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 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/objdir/meson.build create mode 100644 test cases/common/121 object only target/objdir/source4.c create mode 100644 test cases/common/121 object only target/objdir/source5.c create mode 100644 test cases/common/121 object only target/objdir/source6.c 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 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 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 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 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 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 create mode 100644 test cases/common/13 pch/c/meson.build create mode 100644 test cases/common/13 pch/c/pch/prog.h create mode 100644 test cases/common/13 pch/c/prog.c create mode 100644 test cases/common/13 pch/cpp/meson.build create mode 100644 test cases/common/13 pch/cpp/pch/prog.hh create mode 100644 test cases/common/13 pch/cpp/prog.cc create mode 100644 test cases/common/13 pch/generated/gen_custom.py create mode 100644 test cases/common/13 pch/generated/gen_generator.py create mode 100644 test cases/common/13 pch/generated/generated_generator.in create mode 100644 test cases/common/13 pch/generated/meson.build create mode 100644 test cases/common/13 pch/generated/pch/prog.h create mode 100644 test cases/common/13 pch/generated/prog.c create mode 100644 test cases/common/13 pch/linkwhole/lib1.c create mode 100644 test cases/common/13 pch/linkwhole/lib2.c create mode 100644 test cases/common/13 pch/linkwhole/main.c create mode 100644 test cases/common/13 pch/linkwhole/meson.build create mode 100644 test cases/common/13 pch/linkwhole/pch1/pch_one.h create mode 100644 test cases/common/13 pch/linkwhole/pch2/pch_two.h create mode 100644 test cases/common/13 pch/meson.build create mode 100644 test cases/common/13 pch/mixed/func.c create mode 100644 test cases/common/13 pch/mixed/main.cc create mode 100644 test cases/common/13 pch/mixed/meson.build create mode 100644 test cases/common/13 pch/mixed/pch/func.h create mode 100644 test cases/common/13 pch/mixed/pch/main.h create mode 100644 test cases/common/13 pch/userDefined/meson.build create mode 100644 test cases/common/13 pch/userDefined/pch/pch.c create mode 100644 test cases/common/13 pch/userDefined/pch/pch.h create mode 100644 test cases/common/13 pch/userDefined/prog.c create mode 100644 test cases/common/13 pch/withIncludeDirectories/include/lib/lib.h create mode 100644 test cases/common/13 pch/withIncludeDirectories/meson.build create mode 100644 test cases/common/13 pch/withIncludeDirectories/pch/prog.h create mode 100644 test cases/common/13 pch/withIncludeDirectories/prog.c create mode 100644 test cases/common/13 pch/withIncludeFile/meson.build create mode 100644 test cases/common/13 pch/withIncludeFile/pch/prog.h create mode 100644 test cases/common/13 pch/withIncludeFile/prog.c 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 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 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 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 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 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 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 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 100644 test cases/common/14 configure file/basename.py create mode 100644 test cases/common/14 configure file/check_file.py create mode 100644 test cases/common/14 configure file/check_inputs.py create mode 100644 test cases/common/14 configure file/config.h create mode 100644 test cases/common/14 configure file/config.h.in create mode 100644 test cases/common/14 configure file/config4a.h.in create mode 100644 test cases/common/14 configure file/config4b.h.in create mode 100644 test cases/common/14 configure file/config5.h.in create mode 100644 test cases/common/14 configure file/config6.h.in create mode 100644 test cases/common/14 configure file/config7.h.in create mode 100644 test cases/common/14 configure file/config8.h.in create mode 100644 test cases/common/14 configure file/depfile create mode 100644 test cases/common/14 configure file/differentafterbasename1.in create mode 100644 test cases/common/14 configure file/differentafterbasename2.in create mode 100644 test cases/common/14 configure file/dummy.dat create mode 100644 test cases/common/14 configure file/dumpprog.c create mode 100644 test cases/common/14 configure file/file_contains.py create mode 100755 test cases/common/14 configure file/generator-deps.py create mode 100755 test cases/common/14 configure file/generator-without-input-file.py create mode 100755 test cases/common/14 configure file/generator.py create mode 100644 test cases/common/14 configure file/invalid-utf8.bin.in create mode 100644 test cases/common/14 configure file/meson.build create mode 100644 test cases/common/14 configure file/nosubst-nocopy1.txt.in create mode 100644 test cases/common/14 configure file/nosubst-nocopy2.txt.in create mode 100644 test cases/common/14 configure file/prog.c create mode 100644 test cases/common/14 configure file/prog2.c create mode 100644 test cases/common/14 configure file/prog4.c create mode 100644 test cases/common/14 configure file/prog5.c create mode 100644 test cases/common/14 configure file/prog6.c create mode 100644 test cases/common/14 configure file/prog7.c create mode 100644 test cases/common/14 configure file/prog9.c create mode 100644 test cases/common/14 configure file/sameafterbasename.in create mode 100644 test cases/common/14 configure file/sameafterbasename.in2 create mode 100644 test cases/common/14 configure file/subdir/meson.build create mode 100644 test cases/common/14 configure file/test.json create mode 100644 test cases/common/14 configure file/test.py.in create mode 100644 test cases/common/14 configure file/touch.py 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 create mode 100644 test cases/common/141 special characters/.editorconfig 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 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 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 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 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 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 create mode 100644 test cases/common/15 if/meson.build create mode 100644 test cases/common/15 if/prog.c 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-sonarqube/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 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 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-1.0/bar.c create mode 100644 test cases/common/153 wrap file should not failed/subprojects/bar-1.0/meson.build 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-1.0-patchdir/foo.c create mode 100644 test cases/common/153 wrap file should not failed/subprojects/foo-1.0-patchdir/meson.build create mode 100644 test cases/common/153 wrap file should not failed/subprojects/foo-1.0-patchfile/.meson-subproject-wrap-hash.txt create mode 100644 test cases/common/153 wrap file should not failed/subprojects/foo-1.0-patchfile/foo.c create mode 100644 test cases/common/153 wrap file should not failed/subprojects/foo-1.0-patchfile/meson.build create mode 100644 test cases/common/153 wrap file should not failed/subprojects/foo-1.0/foo.c create mode 100644 test cases/common/153 wrap file should not failed/subprojects/foo-1.0/meson.build 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/packagefiles/patchfile/0001-Change-foo-to-executable.patch create mode 100644 test cases/common/153 wrap file should not failed/subprojects/packagefiles/patchfile/0001-Change-return-value-to-43.patch create mode 100644 test cases/common/153 wrap file should not failed/subprojects/packagefiles/patchfile/0002-Change-return-value-to-44.patch 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/patchfile.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 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 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 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 create mode 100644 test cases/common/16 comparison/meson.build create mode 100644 test cases/common/16 comparison/prog.c 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 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 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 create mode 100644 test cases/common/164 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 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 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 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 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 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 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 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 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 create mode 100644 test cases/common/178 bothlibraries/dummy.py create mode 100644 test cases/common/178 bothlibraries/foo.cpp 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/main2.c create mode 100644 test cases/common/178 bothlibraries/meson.build create mode 100644 test cases/common/178 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 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 create mode 100644 test cases/common/180 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 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 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 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 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 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 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 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 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 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 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 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 create mode 100644 test cases/common/199 argument syntax/meson.build create mode 100644 test cases/common/2 cpp/VERSIONFILE create mode 100644 test cases/common/2 cpp/cpp.C create mode 100644 test cases/common/2 cpp/meson.build create mode 100644 test cases/common/2 cpp/something.txt create mode 100644 test cases/common/2 cpp/trivial.cc 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 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 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 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 create mode 100644 test cases/common/204 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 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 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 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 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 create mode 100644 test cases/common/211 dependency get_variable method/meson.build create mode 100644 test cases/common/211 dependency get_variable method/test.json 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 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 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/dummy.cpp 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/gen.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 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 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/check-obj.py create mode 100644 test cases/common/22 object extraction/create-source.py create mode 100644 test cases/common/22 object extraction/header.h 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 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 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 create mode 100644 test cases/common/223 persubproject options/foo.c create mode 100644 test cases/common/223 persubproject options/main.cpp 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/foo.cpp create mode 100644 test cases/common/223 persubproject options/subprojects/sub2/meson.build create mode 100644 test cases/common/223 persubproject options/test.json create mode 100644 test cases/common/224 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 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 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 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 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 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 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 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 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 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 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 create mode 100644 test cases/common/240 dependency native host == build/meson.build create mode 100644 test cases/common/240 dependency native host == build/test.json create mode 100644 test cases/common/241 set and get variable/meson.build create mode 100644 test cases/common/241 set and get variable/test1.txt create mode 100644 test cases/common/241 set and get variable/test2.txt create mode 100644 test cases/common/242 custom target feed/data_source.txt create mode 100644 test cases/common/242 custom target feed/meson.build create mode 100755 test cases/common/242 custom target feed/my_compiler.py create mode 100644 test cases/common/242 custom target feed/test.json create mode 100644 test cases/common/243 escape++/meson.build create mode 100644 test cases/common/243 escape++/test.c create mode 100644 test cases/common/244 variable scope/meson.build create mode 100644 test cases/common/245 custom target index source/code_source.c create mode 100644 test cases/common/245 custom target index source/copyfile.py create mode 100644 test cases/common/245 custom target index source/copyfile2.py create mode 100644 test cases/common/245 custom target index source/header_source.h create mode 100644 test cases/common/245 custom target index source/main.c create mode 100644 test cases/common/245 custom target index source/meson.build create mode 100644 test cases/common/246 dependency fallbacks/meson.build create mode 100644 test cases/common/246 dependency fallbacks/subprojects/png/meson.build create mode 100644 test cases/common/247 deprecated option/meson.build create mode 100644 test cases/common/247 deprecated option/meson_options.txt create mode 100644 test cases/common/247 deprecated option/test.json create mode 100644 test cases/common/248 install_emptydir/meson.build create mode 100644 test cases/common/248 install_emptydir/test.json create mode 100644 test cases/common/249 install_symlink/datafile.dat create mode 100644 test cases/common/249 install_symlink/meson.build create mode 100644 test cases/common/249 install_symlink/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 create mode 100644 test cases/common/250 system include dir/lib/lib.hpp create mode 100644 test cases/common/250 system include dir/main.cpp create mode 100644 test cases/common/250 system include dir/meson.build create mode 100644 test cases/common/251 add_project_dependencies/inc/lib.h create mode 100644 test cases/common/251 add_project_dependencies/lib.c create mode 100644 test cases/common/251 add_project_dependencies/main.c create mode 100644 test cases/common/251 add_project_dependencies/meson.build create mode 100644 test cases/common/252 install data structured/dir1/bad create mode 100644 test cases/common/252 install data structured/dir1/file1 create mode 100644 test cases/common/252 install data structured/dir1/file2 create mode 100644 test cases/common/252 install data structured/dir1/file3 create mode 100644 test cases/common/252 install data structured/dir2/bad create mode 100644 test cases/common/252 install data structured/dir2/file1 create mode 100644 test cases/common/252 install data structured/dir2/file2 create mode 100644 test cases/common/252 install data structured/dir2/file3 create mode 100644 test cases/common/252 install data structured/dir3/bad create mode 100644 test cases/common/252 install data structured/dir3/file1 create mode 100644 test cases/common/252 install data structured/dir3/file2 create mode 100644 test cases/common/252 install data structured/dir3/file3 create mode 100644 test cases/common/252 install data structured/meson.build create mode 100644 test cases/common/252 install data structured/pysrc/__init__.py create mode 100644 test cases/common/252 install data structured/pysrc/bad.py create mode 100644 test cases/common/252 install data structured/pysrc/bar.py create mode 100644 test cases/common/252 install data structured/pysrc/foo.py create mode 100644 test cases/common/252 install data structured/pysrc/meson.build create mode 100644 test cases/common/252 install data structured/pysrc/submod/__init__.py create mode 100644 test cases/common/252 install data structured/pysrc/submod/bad.py create mode 100644 test cases/common/252 install data structured/pysrc/submod/baz.py create mode 100644 test cases/common/252 install data structured/test.json create mode 100644 test cases/common/253 subproject dependency variables/meson.build create mode 100644 test cases/common/253 subproject dependency variables/subprojects/subfiles/foo.c create mode 100644 test cases/common/253 subproject dependency variables/subprojects/subfiles/meson.build create mode 100644 test cases/common/253 subproject dependency variables/subprojects/subfiles/subdir/foo.c create mode 100644 test cases/common/253 subproject dependency variables/subprojects/subfiles/subdir2/foo.c create mode 100644 test cases/common/253 subproject dependency variables/test.json create mode 100644 test cases/common/254 long output/dumper.c create mode 100644 test cases/common/254 long output/meson.build create mode 100644 test cases/common/255 module warnings/meson.build create mode 100644 test cases/common/255 module warnings/test.json create mode 100644 test cases/common/256 subproject extracted objects/foo.c create mode 100644 test cases/common/256 subproject extracted objects/meson.build create mode 100644 test cases/common/256 subproject extracted objects/subprojects/myobjects/cpplib.cpp create mode 100644 test cases/common/256 subproject extracted objects/subprojects/myobjects/cpplib.h create mode 100644 test cases/common/256 subproject extracted objects/subprojects/myobjects/meson.build create mode 100644 test cases/common/256 subproject extracted objects/test.json create mode 100644 test cases/common/257 generated header dep/foo.c create mode 100644 test cases/common/257 generated header dep/meson.build create mode 100644 test cases/common/258 subsubproject inplace/meson.build create mode 100644 test cases/common/258 subsubproject inplace/subprojects/sub/meson.build create mode 100644 test cases/common/258 subsubproject inplace/subprojects/sub/subprojects/subsub-1.0/meson.build create mode 100644 test cases/common/258 subsubproject inplace/subprojects/sub/subprojects/subsub.wrap create mode 100644 test cases/common/258 subsubproject inplace/subprojects/subsub.wrap create mode 100644 test cases/common/259 preprocess/bar.c create mode 100644 test cases/common/259 preprocess/foo.c create mode 100644 test cases/common/259 preprocess/foo.h create mode 100644 test cases/common/259 preprocess/meson.build create mode 100644 test cases/common/259 preprocess/src/file.map.in create mode 100644 test cases/common/259 preprocess/src/meson.build 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 create mode 100644 test cases/common/27 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 create mode 100644 test cases/common/3 static/libfile.c create mode 100644 test cases/common/3 static/libfile2.c create mode 100644 test cases/common/3 static/meson.build create mode 100644 test cases/common/3 static/meson_options.txt 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 create mode 100644 test cases/common/32 has header/meson.build create mode 100644 test cases/common/32 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 create mode 100644 test cases/common/35 string operations/meson.build create mode 100644 test cases/common/36 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 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 create mode 100644 test cases/common/4 shared/libfile.c create mode 100644 test cases/common/4 shared/meson.build create mode 100644 test cases/common/40 options/meson.build create mode 100644 test cases/common/40 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 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 create mode 100644 test cases/common/44 pkgconfig-gen/answer.c create mode 100644 test cases/common/44 pkgconfig-gen/dependencies/custom.c create mode 100644 test cases/common/44 pkgconfig-gen/dependencies/dummy.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/foo.c 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 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 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 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 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 create mode 100644 test cases/common/5 linkstatic/libfile.c create mode 100644 test cases/common/5 linkstatic/libfile2.c create mode 100644 test cases/common/5 linkstatic/libfile3.c create mode 100644 test cases/common/5 linkstatic/libfile4.c create mode 100644 test cases/common/5 linkstatic/main.c create mode 100644 test cases/common/5 linkstatic/meson.build 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 create mode 100644 test cases/common/51 run target/.clang-format create mode 100644 test cases/common/51 run target/.clang-tidy 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 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 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 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/a.txt create mode 100644 test cases/common/56 array methods/b.txt create mode 100644 test cases/common/56 array methods/c.txt create mode 100644 test cases/common/56 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 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 create mode 100644 test cases/common/6 linkshared/cpplib.cpp create mode 100644 test cases/common/6 linkshared/cpplib.h create mode 100644 test cases/common/6 linkshared/cppmain.cpp create mode 100644 test cases/common/6 linkshared/libfile.c create mode 100644 test cases/common/6 linkshared/main.c create mode 100644 test cases/common/6 linkshared/meson.build create mode 100644 test cases/common/6 linkshared/test.json 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 create mode 100644 test cases/common/61 number arithmetic/meson.build create mode 100644 test cases/common/62 string arithmetic/meson.build create mode 100644 test cases/common/62 string arithmetic/test.json create mode 100644 test cases/common/63 array arithmetic/meson.build create mode 100644 test cases/common/64 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 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 100755 test cases/common/66 vcstag/version.py create mode 100644 test cases/common/67 modules/meson.build create mode 100644 test cases/common/67 modules/meson_options.txt 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 create mode 100644 test cases/common/7 mixed/func.c create mode 100644 test cases/common/7 mixed/main.cc create mode 100644 test cases/common/7 mixed/meson.build 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 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 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 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 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 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 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 100755 test cases/common/8 install/gendir.py create mode 100644 test cases/common/8 install/meson.build create mode 100644 test cases/common/8 install/prog.c create mode 100644 test cases/common/8 install/stat.c create mode 100644 test cases/common/8 install/test.json 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 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 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 create mode 100644 test cases/common/84 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 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 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 create mode 100644 test cases/common/9 header install/child/childdir.h create mode 100644 test cases/common/9 header install/meson.build create mode 100644 test cases/common/9 header install/rootdir.h create mode 100644 test cases/common/9 header install/sub/fileheader.h create mode 100644 test cases/common/9 header install/sub/meson.build create mode 100644 test cases/common/9 header install/subdir.h create mode 100644 test cases/common/9 header install/test.json create mode 100644 test cases/common/9 header install/vanishing_subdir/meson.build create mode 100644 test cases/common/9 header install/vanishing_subdir/vanished.h 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 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 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 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 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/meson_options.txt 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/subprojects/sub_static/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 create mode 100644 test cases/csharp/1 basic/meson.build create mode 100644 test cases/csharp/1 basic/prog.cs create mode 100644 test cases/csharp/1 basic/test.json create mode 100644 test cases/csharp/1 basic/text.cs create mode 100644 test cases/csharp/2 library/helper.cs create mode 100644 test cases/csharp/2 library/meson.build create mode 100644 test cases/csharp/2 library/prog.cs create mode 100644 test cases/csharp/2 library/test.json create mode 100644 test cases/csharp/3 resource/TestRes.resx create mode 100644 test cases/csharp/3 resource/meson.build create mode 100644 test cases/csharp/3 resource/resprog.cs create mode 100644 test cases/csharp/4 external dep/hello.txt create mode 100644 test cases/csharp/4 external dep/meson.build create mode 100644 test cases/csharp/4 external dep/prog.cs create mode 100644 test cases/csharp/4 external dep/test.json create mode 100644 test cases/cuda/1 simple/meson.build create mode 100644 test cases/cuda/1 simple/prog.cu create mode 100644 test cases/cuda/10 cuda dependency/c/meson.build create mode 100644 test cases/cuda/10 cuda dependency/c/prog.c create mode 100644 test cases/cuda/10 cuda dependency/cpp/meson.build create mode 100644 test cases/cuda/10 cuda dependency/cpp/prog.cc create mode 100644 test cases/cuda/10 cuda dependency/meson.build create mode 100644 test cases/cuda/10 cuda dependency/modules/meson.build create mode 100644 test cases/cuda/10 cuda dependency/modules/prog.cc create mode 100644 test cases/cuda/10 cuda dependency/version_reqs/meson.build create mode 100644 test cases/cuda/10 cuda dependency/version_reqs/prog.cc create mode 100644 test cases/cuda/11 cuda dependency (nvcc)/meson.build create mode 100644 test cases/cuda/11 cuda dependency (nvcc)/modules/meson.build create mode 100644 test cases/cuda/11 cuda dependency (nvcc)/modules/prog.cu create mode 100644 test cases/cuda/11 cuda dependency (nvcc)/version_reqs/meson.build create mode 100644 test cases/cuda/11 cuda dependency (nvcc)/version_reqs/prog.cu create mode 100644 test cases/cuda/12 cuda dependency (mixed)/kernel.cu create mode 100644 test cases/cuda/12 cuda dependency (mixed)/meson.build create mode 100644 test cases/cuda/12 cuda dependency (mixed)/prog.cpp create mode 100644 test cases/cuda/13 cuda compiler setting/meson.build create mode 100644 test cases/cuda/13 cuda compiler setting/nativefile.ini create mode 100644 test cases/cuda/13 cuda compiler setting/prog.cu create mode 100644 test cases/cuda/14 cuda has header symbol/meson.build create mode 100644 test cases/cuda/15 sanitizer/meson.build create mode 100644 test cases/cuda/15 sanitizer/prog.cu create mode 100644 test cases/cuda/16 multistd/lib.cu create mode 100644 test cases/cuda/16 multistd/main.cu create mode 100644 test cases/cuda/16 multistd/meson.build create mode 100644 test cases/cuda/2 split/lib.cu create mode 100644 test cases/cuda/2 split/main.cpp create mode 100644 test cases/cuda/2 split/meson.build create mode 100644 test cases/cuda/2 split/static/lib.cu create mode 100644 test cases/cuda/2 split/static/libsta.cu create mode 100644 test cases/cuda/2 split/static/main_static.cpp create mode 100644 test cases/cuda/2 split/static/meson.build create mode 100644 test cases/cuda/3 cudamodule/meson.build create mode 100644 test cases/cuda/3 cudamodule/prog.cu create mode 100644 test cases/cuda/4 shared/main.cu create mode 100644 test cases/cuda/4 shared/meson.build create mode 100644 test cases/cuda/4 shared/shared/kernels.cu create mode 100644 test cases/cuda/4 shared/shared/kernels.h create mode 100644 test cases/cuda/4 shared/shared/meson.build create mode 100644 test cases/cuda/5 threads/main.cu create mode 100644 test cases/cuda/5 threads/meson.build create mode 100644 test cases/cuda/5 threads/shared/kernels.cu create mode 100644 test cases/cuda/5 threads/shared/kernels.h create mode 100644 test cases/cuda/5 threads/shared/meson.build create mode 100644 test cases/cuda/6 std/main.cu create mode 100644 test cases/cuda/6 std/meson.build create mode 100644 test cases/cuda/7 static vs runtime/main.cu create mode 100644 test cases/cuda/7 static vs runtime/meson.build create mode 100644 test cases/cuda/8 release/main.cu create mode 100644 test cases/cuda/8 release/meson.build create mode 100644 test cases/cuda/9 optimize for space/main.cu create mode 100644 test cases/cuda/9 optimize for space/meson.build create mode 100755 test cases/cython/1 basic/cytest.py create mode 100644 test cases/cython/1 basic/libdir/cstorer.pxd create mode 100644 test cases/cython/1 basic/libdir/meson.build create mode 100644 test cases/cython/1 basic/libdir/storer.c create mode 100644 test cases/cython/1 basic/libdir/storer.h create mode 100644 test cases/cython/1 basic/libdir/storer.pyx create mode 100644 test cases/cython/1 basic/meson.build create mode 100644 test cases/cython/1 basic/test.json create mode 100644 test cases/cython/2 generated sources/configure.pyx.in create mode 100644 test cases/cython/2 generated sources/g.in create mode 100644 test cases/cython/2 generated sources/gen.py create mode 100755 test cases/cython/2 generated sources/generator.py create mode 100644 test cases/cython/2 generated sources/includestuff.pyx create mode 100644 test cases/cython/2 generated sources/libdir/gen.py create mode 100644 test cases/cython/2 generated sources/libdir/meson.build create mode 100644 test cases/cython/2 generated sources/meson.build create mode 100644 test cases/cython/2 generated sources/simpleinclude.pyx create mode 100644 test cases/cython/2 generated sources/simplestuff.pxi create mode 100644 test cases/cython/2 generated sources/stuff.pxi.in create mode 100644 test cases/cython/2 generated sources/test.py create mode 100644 test cases/cython/3 cython_args/cythonargs.pyx create mode 100644 test cases/cython/3 cython_args/meson.build create mode 100644 test cases/cython/3 cython_args/test.py create mode 100644 test cases/d/1 simple/app.d create mode 100644 test cases/d/1 simple/meson.build create mode 100644 test cases/d/1 simple/test.json create mode 100644 test cases/d/1 simple/utils.d create mode 100644 test cases/d/10 d cpp/cppmain.cpp create mode 100644 test cases/d/10 d cpp/dmain.d create mode 100644 test cases/d/10 d cpp/libfile.cpp create mode 100644 test cases/d/10 d cpp/libfile.d create mode 100644 test cases/d/10 d cpp/meson.build create mode 100644 test cases/d/11 dub/.gitignore create mode 100644 test cases/d/11 dub/meson.build create mode 100644 test cases/d/11 dub/test.d create mode 100644 test cases/d/12 root include directory/meson.build create mode 100644 test cases/d/12 root include directory/some/dlang/code.d create mode 100644 test cases/d/12 root include directory/some/dlang/meson.build create mode 100644 test cases/d/12 root include directory/some/meson.build create mode 100644 test cases/d/13 declare dep/meson.build create mode 100644 test cases/d/13 declare dep/test.d create mode 100644 test cases/d/13 declare dep/views/test.txt create mode 100644 test cases/d/14 dub with deps/meson.build create mode 100644 test cases/d/14 dub with deps/test.d create mode 100644 test cases/d/15 compiler run checks/meson.build create mode 100644 test cases/d/15 compiler run checks/test_sizeof.d create mode 100644 test cases/d/16 code generation/exe.d create mode 100644 test cases/d/16 code generation/generator.d create mode 100644 test cases/d/16 code generation/input.txt create mode 100644 test cases/d/16 code generation/meson.build create mode 100644 test cases/d/2 static library/app.d create mode 100644 test cases/d/2 static library/libstuff.d create mode 100644 test cases/d/2 static library/meson.build create mode 100644 test cases/d/2 static library/test.json create mode 100644 test cases/d/3 shared library/app.d create mode 100644 test cases/d/3 shared library/libstuff.d create mode 100644 test cases/d/3 shared library/libstuff.di create mode 100644 test cases/d/3 shared library/lld-test.py create mode 100644 test cases/d/3 shared library/meson.build create mode 100644 test cases/d/3 shared library/sub/libstuff.d create mode 100644 test cases/d/3 shared library/sub/meson.build create mode 100644 test cases/d/3 shared library/test.json create mode 100644 test cases/d/4 library versions/lib.d create mode 100644 test cases/d/4 library versions/meson.build create mode 100644 test cases/d/4 library versions/test.json create mode 100644 test cases/d/5 mixed/app.d create mode 100644 test cases/d/5 mixed/libstuff.c create mode 100644 test cases/d/5 mixed/meson.build create mode 100644 test cases/d/5 mixed/test.json create mode 100644 test cases/d/6 unittest/app.d create mode 100644 test cases/d/6 unittest/meson.build create mode 100644 test cases/d/6 unittest/second_unit.d create mode 100644 test cases/d/6 unittest/test.json create mode 100644 test cases/d/7 multilib/app.d create mode 100644 test cases/d/7 multilib/meson.build create mode 100644 test cases/d/7 multilib/say1.d create mode 100644 test cases/d/7 multilib/say1.di create mode 100644 test cases/d/7 multilib/say2.d create mode 100644 test cases/d/7 multilib/say2.di create mode 100644 test cases/d/7 multilib/test.json create mode 100644 test cases/d/8 has multi arguments/meson.build create mode 100644 test cases/d/9 features/app.d create mode 100644 test cases/d/9 features/data/food.txt create mode 100644 test cases/d/9 features/data/people.txt create mode 100644 test cases/d/9 features/extra.d create mode 100644 test cases/d/9 features/meson.build create mode 100644 test cases/failing build/1 vala c werror/meson.build create mode 100644 test cases/failing build/1 vala c werror/prog.vala create mode 100644 test cases/failing build/1 vala c werror/unused-var.c create mode 100644 test cases/failing build/2 hidden symbol/bob.c create mode 100644 test cases/failing build/2 hidden symbol/bob.h create mode 100644 test cases/failing build/2 hidden symbol/bobuser.c create mode 100644 test cases/failing build/2 hidden symbol/meson.build create mode 100644 test cases/failing build/3 pch disabled/c/meson.build create mode 100644 test cases/failing build/3 pch disabled/c/pch/prog.h create mode 100644 test cases/failing build/3 pch disabled/c/pch/prog_pch.c create mode 100644 test cases/failing build/3 pch disabled/c/prog.c create mode 100644 test cases/failing build/3 pch disabled/meson.build create mode 100644 test cases/failing build/4 cmake subproject isolation/incDir/fileA.hpp create mode 100644 test cases/failing build/4 cmake subproject isolation/main.cpp create mode 100644 test cases/failing build/4 cmake subproject isolation/meson.build create mode 100644 test cases/failing build/4 cmake subproject isolation/subprojects/cmMod/CMakeLists.txt create mode 100644 test cases/failing build/4 cmake subproject isolation/subprojects/cmMod/cmMod.cpp create mode 100644 test cases/failing build/4 cmake subproject isolation/subprojects/cmMod/cmMod.hpp create mode 100644 test cases/failing build/4 cmake subproject isolation/test.json create mode 100644 test cases/failing build/5 failed pickled/false.py create mode 100644 test cases/failing build/5 failed pickled/meson.build create mode 100644 test cases/failing test/1 trivial/main.c create mode 100644 test cases/failing test/1 trivial/meson.build create mode 100644 test cases/failing test/2 signal/main.c create mode 100644 test cases/failing test/2 signal/meson.build create mode 100644 test cases/failing test/3 ambiguous/main.c create mode 100644 test cases/failing test/3 ambiguous/meson.build create mode 100755 test cases/failing test/3 ambiguous/test_runner.sh create mode 100644 test cases/failing test/4 hard error/main.c create mode 100644 test cases/failing test/4 hard error/meson.build create mode 100644 test cases/failing test/5 tap tests/meson.build create mode 100644 test cases/failing test/5 tap tests/tester.c create mode 100644 test cases/failing test/5 tap tests/tester_with_status.c create mode 100644 test cases/failing test/6 xpass/meson.build create mode 100644 test cases/failing test/6 xpass/xpass.c create mode 100644 test cases/failing/1 project not first/meson.build create mode 100644 test cases/failing/1 project not first/prog.c create mode 100644 test cases/failing/1 project not first/test.json create mode 100644 test cases/failing/10 out of bounds/meson.build create mode 100644 test cases/failing/10 out of bounds/test.json create mode 100644 test cases/failing/100 no glib-compile-resources/meson.build create mode 100644 test cases/failing/100 no glib-compile-resources/test.json create mode 100644 test cases/failing/100 no glib-compile-resources/trivial.gresource.xml create mode 100644 test cases/failing/101 number in combo/meson.build create mode 100644 test cases/failing/101 number in combo/nativefile.ini create mode 100644 test cases/failing/101 number in combo/test.json create mode 100644 test cases/failing/102 bool in combo/meson.build create mode 100644 test cases/failing/102 bool in combo/meson_options.txt create mode 100644 test cases/failing/102 bool in combo/nativefile.ini create mode 100644 test cases/failing/102 bool in combo/test.json create mode 100644 test cases/failing/103 compiler no lang/meson.build create mode 100644 test cases/failing/103 compiler no lang/test.json create mode 100644 test cases/failing/104 no fallback/meson.build create mode 100644 test cases/failing/104 no fallback/subprojects/foob/meson.build create mode 100644 test cases/failing/104 no fallback/test.json create mode 100644 test cases/failing/105 feature require/meson.build create mode 100644 test cases/failing/105 feature require/meson_options.txt create mode 100644 test cases/failing/105 feature require/test.json create mode 100644 test cases/failing/106 feature require.bis/meson.build create mode 100644 test cases/failing/106 feature require.bis/meson_options.txt create mode 100644 test cases/failing/106 feature require.bis/test.json create mode 100644 test cases/failing/107 no build get_external_property/meson.build create mode 100644 test cases/failing/107 no build get_external_property/test.json create mode 100644 test cases/failing/108 enter subdir twice/meson.build create mode 100644 test cases/failing/108 enter subdir twice/sub/meson.build create mode 100644 test cases/failing/108 enter subdir twice/test.json create mode 100644 test cases/failing/109 invalid fstring/109 invalid fstring/meson.build create mode 100644 test cases/failing/109 invalid fstring/109 invalid fstring/test.json create mode 100644 test cases/failing/109 invalid fstring/meson.build create mode 100644 test cases/failing/109 invalid fstring/test.json create mode 100644 test cases/failing/11 object arithmetic/meson.build create mode 100644 test cases/failing/11 object arithmetic/test.json create mode 100644 test cases/failing/110 compiler argument checking/meson.build create mode 100644 test cases/failing/110 compiler argument checking/test.json create mode 100644 test cases/failing/111 empty fallback/meson.build create mode 100644 test cases/failing/111 empty fallback/subprojects/foo/meson.build create mode 100644 test cases/failing/111 empty fallback/test.json create mode 100644 test cases/failing/112 cmake executable dependency/meson.build create mode 100644 test cases/failing/112 cmake executable dependency/subprojects/cmlib/CMakeLists.txt create mode 100644 test cases/failing/112 cmake executable dependency/subprojects/cmlib/main.c create mode 100644 test cases/failing/112 cmake executable dependency/test.json create mode 100644 test cases/failing/113 allow_fallback with fallback/meson.build create mode 100644 test cases/failing/113 allow_fallback with fallback/test.json create mode 100644 test cases/failing/114 nonsensical bindgen/meson.build create mode 100644 test cases/failing/114 nonsensical bindgen/src/header.h create mode 100644 test cases/failing/114 nonsensical bindgen/src/source.c create mode 100644 test cases/failing/114 nonsensical bindgen/test.json create mode 100644 test cases/failing/115 run_target in test/meson.build create mode 100644 test cases/failing/115 run_target in test/test.json create mode 100644 test cases/failing/115 run_target in test/trivial.c create mode 100644 test cases/failing/116 run_target in add_install_script/meson.build create mode 100644 test cases/failing/116 run_target in add_install_script/test.json create mode 100644 test cases/failing/116 run_target in add_install_script/trivial.c create mode 100644 test cases/failing/117 pathsep in install_symlink/meson.build create mode 100644 test cases/failing/117 pathsep in install_symlink/test.json create mode 100644 test cases/failing/118 subproject version conflict/meson.build create mode 100644 test cases/failing/118 subproject version conflict/subprojects/A/meson.build create mode 100644 test cases/failing/118 subproject version conflict/subprojects/B/meson.build create mode 100644 test cases/failing/118 subproject version conflict/test.json create mode 100644 test cases/failing/119 structured source empty string/main.rs create mode 100644 test cases/failing/119 structured source empty string/meson.build create mode 100644 test cases/failing/119 structured source empty string/test.json create mode 100644 test cases/failing/12 string arithmetic/meson.build create mode 100644 test cases/failing/12 string arithmetic/test.json create mode 100644 test cases/failing/120 structured_sources conflicts/main.rs create mode 100644 test cases/failing/120 structured_sources conflicts/meson.build create mode 100644 test cases/failing/120 structured_sources conflicts/test.json create mode 100644 test cases/failing/121 missing compiler/meson.build create mode 100644 test cases/failing/121 missing compiler/subprojects/sub/main.c create mode 100644 test cases/failing/121 missing compiler/subprojects/sub/meson.build create mode 100644 test cases/failing/121 missing compiler/test.json create mode 100644 test cases/failing/122 cmake subproject error/meson.build create mode 100644 test cases/failing/122 cmake subproject error/subprojects/cmlib/CMakeLists.txt create mode 100644 test cases/failing/122 cmake subproject error/test.json create mode 100644 test cases/failing/123 pkgconfig not relocatable outside prefix/meson.build create mode 100644 test cases/failing/123 pkgconfig not relocatable outside prefix/test.json create mode 100644 test cases/failing/124 subproject sandbox violation/meson.build create mode 100644 test cases/failing/124 subproject sandbox violation/meson_options.txt create mode 100644 test cases/failing/124 subproject sandbox violation/subprojects/subproj1/file.txt create mode 100644 test cases/failing/124 subproject sandbox violation/subprojects/subproj1/meson.build create mode 100644 test cases/failing/124 subproject sandbox violation/subprojects/subproj1/nested/meson.build create mode 100644 test cases/failing/124 subproject sandbox violation/subprojects/subproj2/file.txt create mode 100644 test cases/failing/124 subproject sandbox violation/subprojects/subproj2/meson.build create mode 100644 test cases/failing/124 subproject sandbox violation/subprojects/subproj2/nested/meson.build create mode 100644 test cases/failing/124 subproject sandbox violation/subprojects/subproj3/file.txt create mode 100644 test cases/failing/124 subproject sandbox violation/subprojects/subproj3/meson.build create mode 100644 test cases/failing/124 subproject sandbox violation/test.json create mode 100644 test cases/failing/125 override and add_project_dependency/inc/lib.h create mode 100644 test cases/failing/125 override and add_project_dependency/lib.c create mode 100644 test cases/failing/125 override and add_project_dependency/meson.build create mode 100644 test cases/failing/125 override and add_project_dependency/subprojects/a/meson.build create mode 100644 test cases/failing/125 override and add_project_dependency/subprojects/a/prog.c create mode 100644 test cases/failing/125 override and add_project_dependency/test.json create mode 100644 test cases/failing/126 targets before add_project_dependency/inc/lib.h create mode 100644 test cases/failing/126 targets before add_project_dependency/lib.c create mode 100644 test cases/failing/126 targets before add_project_dependency/meson.build create mode 100644 test cases/failing/126 targets before add_project_dependency/test.json create mode 100644 test cases/failing/127 extract from unity/meson.build create mode 100644 test cases/failing/127 extract from unity/src1.c create mode 100644 test cases/failing/127 extract from unity/src2.c create mode 100644 test cases/failing/127 extract from unity/test.json create mode 100644 test cases/failing/128 subproject object as a dependency/main.c create mode 100644 test cases/failing/128 subproject object as a dependency/meson.build create mode 100644 test cases/failing/128 subproject object as a dependency/subprojects/sub/meson.build create mode 100644 test cases/failing/128 subproject object as a dependency/test.json create mode 100644 test cases/failing/129 generator host binary/exe.c create mode 100644 test cases/failing/129 generator host binary/lib.in create mode 100644 test cases/failing/129 generator host binary/meson.build create mode 100644 test cases/failing/129 generator host binary/test.json create mode 100644 test cases/failing/13 array arithmetic/meson.build create mode 100644 test cases/failing/13 array arithmetic/test.json create mode 100644 test cases/failing/14 invalid option name/meson.build create mode 100644 test cases/failing/14 invalid option name/meson_options.txt create mode 100644 test cases/failing/14 invalid option name/test.json create mode 100644 test cases/failing/15 kwarg before arg/meson.build create mode 100644 test cases/failing/15 kwarg before arg/prog.c create mode 100644 test cases/failing/15 kwarg before arg/test.json create mode 100644 test cases/failing/16 extract from subproject/main.c create mode 100644 test cases/failing/16 extract from subproject/meson.build create mode 100644 test cases/failing/16 extract from subproject/subprojects/sub_project/meson.build create mode 100644 test cases/failing/16 extract from subproject/subprojects/sub_project/sub_lib.c create mode 100644 test cases/failing/16 extract from subproject/test.json create mode 100644 test cases/failing/17 same target/file.c create mode 100644 test cases/failing/17 same target/meson.build create mode 100644 test cases/failing/17 same target/test.json create mode 100644 test cases/failing/18 wrong plusassign/meson.build create mode 100644 test cases/failing/18 wrong plusassign/test.json create mode 100644 test cases/failing/19 target clash/clash.c create mode 100644 test cases/failing/19 target clash/meson.build create mode 100644 test cases/failing/19 target clash/test.json create mode 100644 test cases/failing/2 missing file/meson.build create mode 100644 test cases/failing/2 missing file/test.json create mode 100644 test cases/failing/20 version/meson.build create mode 100644 test cases/failing/20 version/test.json create mode 100644 test cases/failing/21 subver/meson.build create mode 100644 test cases/failing/21 subver/subprojects/foo/meson.build create mode 100644 test cases/failing/21 subver/test.json create mode 100644 test cases/failing/22 assert/meson.build create mode 100644 test cases/failing/22 assert/test.json create mode 100644 test cases/failing/23 rel testdir/meson.build create mode 100644 test cases/failing/23 rel testdir/simple.c create mode 100644 test cases/failing/23 rel testdir/test.json create mode 100644 test cases/failing/24 int conversion/meson.build create mode 100644 test cases/failing/24 int conversion/test.json create mode 100644 test cases/failing/25 badlang/meson.build create mode 100644 test cases/failing/25 badlang/test.json create mode 100644 test cases/failing/26 output subdir/foo.in create mode 100644 test cases/failing/26 output subdir/meson.build create mode 100644 test cases/failing/26 output subdir/subdir/dummy.txt create mode 100644 test cases/failing/26 output subdir/test.json create mode 100644 test cases/failing/27 noprog use/meson.build create mode 100644 test cases/failing/27 noprog use/test.json create mode 100644 test cases/failing/28 no crossprop/meson.build create mode 100644 test cases/failing/28 no crossprop/test.json create mode 100644 test cases/failing/29 nested ternary/meson.build create mode 100644 test cases/failing/29 nested ternary/test.json create mode 100644 test cases/failing/3 missing subdir/meson.build create mode 100644 test cases/failing/3 missing subdir/test.json create mode 100644 test cases/failing/30 invalid man extension/foo.a1 create mode 100644 test cases/failing/30 invalid man extension/meson.build create mode 100644 test cases/failing/30 invalid man extension/test.json create mode 100644 test cases/failing/31 no man extension/foo create mode 100644 test cases/failing/31 no man extension/meson.build create mode 100644 test cases/failing/31 no man extension/test.json create mode 100644 test cases/failing/32 exe static shared/meson.build create mode 100644 test cases/failing/32 exe static shared/prog.c create mode 100644 test cases/failing/32 exe static shared/shlib2.c create mode 100644 test cases/failing/32 exe static shared/stat.c create mode 100644 test cases/failing/32 exe static shared/test.json create mode 100644 test cases/failing/33 non-root subproject/meson.build create mode 100644 test cases/failing/33 non-root subproject/some/meson.build create mode 100644 test cases/failing/33 non-root subproject/test.json create mode 100644 test cases/failing/34 dependency not-required then required/meson.build create mode 100644 test cases/failing/34 dependency not-required then required/test.json create mode 100644 test cases/failing/35 project argument after target/exe.c create mode 100644 test cases/failing/35 project argument after target/meson.build create mode 100644 test cases/failing/35 project argument after target/test.json create mode 100644 test cases/failing/36 pkgconfig dependency impossible conditions/meson.build create mode 100644 test cases/failing/36 pkgconfig dependency impossible conditions/test.json create mode 100644 test cases/failing/37 has function external dependency/meson.build create mode 100644 test cases/failing/37 has function external dependency/mylib.c create mode 100644 test cases/failing/37 has function external dependency/test.json create mode 100644 test cases/failing/38 prefix absolute/meson.build create mode 100644 test cases/failing/38 prefix absolute/test.json create mode 100644 test cases/failing/39 kwarg assign/dummy.c create mode 100644 test cases/failing/39 kwarg assign/meson.build create mode 100644 test cases/failing/39 kwarg assign/prog.c create mode 100644 test cases/failing/39 kwarg assign/test.json create mode 100644 test cases/failing/4 missing meson.build/meson.build create mode 100644 test cases/failing/4 missing meson.build/subdir/dummy.txt create mode 100644 test cases/failing/4 missing meson.build/test.json create mode 100644 test cases/failing/40 custom target plainname many inputs/1.txt create mode 100644 test cases/failing/40 custom target plainname many inputs/2.txt create mode 100644 test cases/failing/40 custom target plainname many inputs/catfiles.py create mode 100644 test cases/failing/40 custom target plainname many inputs/meson.build create mode 100644 test cases/failing/40 custom target plainname many inputs/test.json create mode 100755 test cases/failing/41 custom target outputs not matching install_dirs/generator.py create mode 100644 test cases/failing/41 custom target outputs not matching install_dirs/meson.build create mode 100644 test cases/failing/41 custom target outputs not matching install_dirs/test.json create mode 100644 test cases/failing/42 project name colon/meson.build create mode 100644 test cases/failing/42 project name colon/test.json create mode 100644 test cases/failing/43 abs subdir/bob/meson.build create mode 100644 test cases/failing/43 abs subdir/meson.build create mode 100644 test cases/failing/43 abs subdir/test.json create mode 100644 test cases/failing/44 abspath to srcdir/meson.build create mode 100644 test cases/failing/44 abspath to srcdir/test.json create mode 100644 test cases/failing/45 pkgconfig variables reserved/meson.build create mode 100644 test cases/failing/45 pkgconfig variables reserved/simple.c create mode 100644 test cases/failing/45 pkgconfig variables reserved/simple.h create mode 100644 test cases/failing/45 pkgconfig variables reserved/test.json create mode 100644 test cases/failing/46 pkgconfig variables zero length/meson.build create mode 100644 test cases/failing/46 pkgconfig variables zero length/simple.c create mode 100644 test cases/failing/46 pkgconfig variables zero length/simple.h create mode 100644 test cases/failing/46 pkgconfig variables zero length/test.json create mode 100644 test cases/failing/47 pkgconfig variables zero length value/meson.build create mode 100644 test cases/failing/47 pkgconfig variables zero length value/simple.c create mode 100644 test cases/failing/47 pkgconfig variables zero length value/simple.h create mode 100644 test cases/failing/47 pkgconfig variables zero length value/test.json create mode 100644 test cases/failing/48 pkgconfig variables not key value/meson.build create mode 100644 test cases/failing/48 pkgconfig variables not key value/simple.c create mode 100644 test cases/failing/48 pkgconfig variables not key value/simple.h create mode 100644 test cases/failing/48 pkgconfig variables not key value/test.json create mode 100644 test cases/failing/49 executable comparison/meson.build create mode 100644 test cases/failing/49 executable comparison/prog.c create mode 100644 test cases/failing/49 executable comparison/test.json create mode 100644 test cases/failing/5 misplaced option/meson.build create mode 100644 test cases/failing/5 misplaced option/test.json create mode 100644 test cases/failing/50 inconsistent comparison/meson.build create mode 100644 test cases/failing/50 inconsistent comparison/test.json create mode 100644 test cases/failing/51 slashname/meson.build create mode 100644 test cases/failing/51 slashname/sub/meson.build create mode 100644 test cases/failing/51 slashname/sub/prog.c create mode 100644 test cases/failing/51 slashname/test.json create mode 100644 test cases/failing/52 reserved meson prefix/meson-foo/meson.build create mode 100644 test cases/failing/52 reserved meson prefix/meson.build create mode 100644 test cases/failing/52 reserved meson prefix/test.json create mode 100644 test cases/failing/53 wrong shared crate type/foo.rs create mode 100644 test cases/failing/53 wrong shared crate type/meson.build create mode 100644 test cases/failing/53 wrong shared crate type/test.json create mode 100644 test cases/failing/54 wrong static crate type/foo.rs create mode 100644 test cases/failing/54 wrong static crate type/meson.build create mode 100644 test cases/failing/54 wrong static crate type/test.json create mode 100644 test cases/failing/55 or on new line/meson.build create mode 100644 test cases/failing/55 or on new line/meson_options.txt create mode 100644 test cases/failing/55 or on new line/test.json create mode 100644 test cases/failing/56 link with executable/meson.build create mode 100644 test cases/failing/56 link with executable/module.c create mode 100644 test cases/failing/56 link with executable/prog.c create mode 100644 test cases/failing/56 link with executable/test.json create mode 100644 test cases/failing/57 assign custom target index/meson.build create mode 100644 test cases/failing/57 assign custom target index/test.json create mode 100644 test cases/failing/58 getoption prefix/meson.build create mode 100644 test cases/failing/58 getoption prefix/subprojects/abc/meson.build create mode 100644 test cases/failing/58 getoption prefix/subprojects/abc/meson_options.txt create mode 100644 test cases/failing/58 getoption prefix/test.json create mode 100644 test cases/failing/59 bad option argument/meson.build create mode 100644 test cases/failing/59 bad option argument/meson_options.txt create mode 100644 test cases/failing/59 bad option argument/test.json create mode 100644 test cases/failing/6 missing incdir/meson.build create mode 100644 test cases/failing/6 missing incdir/test.json create mode 100644 test cases/failing/60 subproj filegrab/meson.build create mode 100644 test cases/failing/60 subproj filegrab/prog.c create mode 100644 test cases/failing/60 subproj filegrab/subprojects/a/meson.build create mode 100644 test cases/failing/60 subproj filegrab/test.json create mode 100644 test cases/failing/61 grab subproj/meson.build create mode 100644 test cases/failing/61 grab subproj/subprojects/foo/meson.build create mode 100644 test cases/failing/61 grab subproj/subprojects/foo/sub.c create mode 100644 test cases/failing/61 grab subproj/test.json create mode 100644 test cases/failing/62 grab sibling/meson.build create mode 100644 test cases/failing/62 grab sibling/subprojects/a/meson.build create mode 100644 test cases/failing/62 grab sibling/subprojects/b/meson.build create mode 100644 test cases/failing/62 grab sibling/subprojects/b/sneaky.c create mode 100644 test cases/failing/62 grab sibling/test.json create mode 100644 test cases/failing/63 string as link target/meson.build create mode 100644 test cases/failing/63 string as link target/prog.c create mode 100644 test cases/failing/63 string as link target/test.json create mode 100644 test cases/failing/64 dependency not-found and required/meson.build create mode 100644 test cases/failing/64 dependency not-found and required/test.json create mode 100644 test cases/failing/65 subproj different versions/main.c create mode 100644 test cases/failing/65 subproj different versions/meson.build create mode 100644 test cases/failing/65 subproj different versions/subprojects/a/a.c create mode 100644 test cases/failing/65 subproj different versions/subprojects/a/a.h create mode 100644 test cases/failing/65 subproj different versions/subprojects/a/meson.build create mode 100644 test cases/failing/65 subproj different versions/subprojects/b/b.c create mode 100644 test cases/failing/65 subproj different versions/subprojects/b/b.h create mode 100644 test cases/failing/65 subproj different versions/subprojects/b/meson.build create mode 100644 test cases/failing/65 subproj different versions/subprojects/c/c.h create mode 100644 test cases/failing/65 subproj different versions/subprojects/c/meson.build create mode 100644 test cases/failing/65 subproj different versions/test.json create mode 100644 test cases/failing/66 wrong boost module/meson.build create mode 100644 test cases/failing/66 wrong boost module/test.json create mode 100644 test cases/failing/67 install_data rename bad size/file1.txt create mode 100644 test cases/failing/67 install_data rename bad size/file2.txt create mode 100644 test cases/failing/67 install_data rename bad size/meson.build create mode 100644 test cases/failing/67 install_data rename bad size/test.json create mode 100644 test cases/failing/68 skip only subdir/meson.build create mode 100644 test cases/failing/68 skip only subdir/subdir/meson.build create mode 100644 test cases/failing/68 skip only subdir/test.json create mode 100644 test cases/failing/69 dual override/meson.build create mode 100644 test cases/failing/69 dual override/overrides.py create mode 100644 test cases/failing/69 dual override/test.json create mode 100644 test cases/failing/7 go to subproject/meson.build create mode 100644 test cases/failing/7 go to subproject/subprojects/meson.build create mode 100644 test cases/failing/7 go to subproject/test.json create mode 100644 test cases/failing/70 override used/meson.build create mode 100755 test cases/failing/70 override used/other.py create mode 100755 test cases/failing/70 override used/something.py create mode 100644 test cases/failing/70 override used/test.json create mode 100644 test cases/failing/71 run_command unclean exit/meson.build create mode 100755 test cases/failing/71 run_command unclean exit/returncode.py create mode 100644 test cases/failing/71 run_command unclean exit/test.json create mode 100644 test cases/failing/72 int literal leading zero/meson.build create mode 100644 test cases/failing/72 int literal leading zero/test.json create mode 100644 test cases/failing/73 configuration immutable/input create mode 100644 test cases/failing/73 configuration immutable/meson.build create mode 100644 test cases/failing/73 configuration immutable/test.json create mode 100644 test cases/failing/74 link with shared module on osx/meson.build create mode 100644 test cases/failing/74 link with shared module on osx/module.c create mode 100644 test cases/failing/74 link with shared module on osx/prog.c create mode 100644 test cases/failing/74 link with shared module on osx/test.json create mode 100644 test cases/failing/75 non ascii in ascii encoded configure file/config9.h.in create mode 100644 test cases/failing/75 non ascii in ascii encoded configure file/meson.build create mode 100644 test cases/failing/75 non ascii in ascii encoded configure file/test.json create mode 100644 test cases/failing/76 subproj dependency not-found and required/meson.build create mode 100644 test cases/failing/76 subproj dependency not-found and required/test.json create mode 100644 test cases/failing/77 unfound run/meson.build create mode 100644 test cases/failing/77 unfound run/test.json create mode 100644 test cases/failing/78 framework dependency with version/meson.build create mode 100644 test cases/failing/78 framework dependency with version/test.json create mode 100644 test cases/failing/79 override exe config/foo.c create mode 100644 test cases/failing/79 override exe config/meson.build create mode 100644 test cases/failing/79 override exe config/test.json create mode 100644 test cases/failing/8 recursive/meson.build create mode 100644 test cases/failing/8 recursive/subprojects/a/meson.build create mode 100644 test cases/failing/8 recursive/subprojects/b/meson.build create mode 100644 test cases/failing/8 recursive/test.json create mode 100644 test cases/failing/80 gl dependency with version/meson.build create mode 100644 test cases/failing/80 gl dependency with version/test.json create mode 100644 test cases/failing/81 threads dependency with version/meson.build create mode 100644 test cases/failing/81 threads dependency with version/test.json create mode 100644 test cases/failing/82 gtest dependency with version/meson.build create mode 100644 test cases/failing/82 gtest dependency with version/test.json create mode 100644 test cases/failing/83 dub libray/meson.build create mode 100644 test cases/failing/83 dub libray/test.json create mode 100644 test cases/failing/84 dub executable/meson.build create mode 100644 test cases/failing/84 dub executable/test.json create mode 100644 test cases/failing/85 dub compiler/meson.build create mode 100644 test cases/failing/85 dub compiler/test.json create mode 100644 test cases/failing/86 subproj not-found dep/meson.build create mode 100644 test cases/failing/86 subproj not-found dep/subprojects/somesubproj/meson.build create mode 100644 test cases/failing/86 subproj not-found dep/test.json create mode 100644 test cases/failing/87 invalid configure file/input create mode 100644 test cases/failing/87 invalid configure file/meson.build create mode 100644 test cases/failing/87 invalid configure file/test.json create mode 100644 test cases/failing/88 kwarg dupe/meson.build create mode 100644 test cases/failing/88 kwarg dupe/prog.c create mode 100644 test cases/failing/88 kwarg dupe/test.json create mode 100644 test cases/failing/89 missing pch file/meson.build create mode 100644 test cases/failing/89 missing pch file/prog.c create mode 100644 test cases/failing/89 missing pch file/test.json create mode 100644 test cases/failing/9 missing extra file/meson.build create mode 100644 test cases/failing/9 missing extra file/prog.c create mode 100644 test cases/failing/9 missing extra file/test.json create mode 100644 test cases/failing/90 pch source different folder/include/pch.h create mode 100644 test cases/failing/90 pch source different folder/meson.build create mode 100644 test cases/failing/90 pch source different folder/prog.c create mode 100644 test cases/failing/90 pch source different folder/src/pch.c create mode 100644 test cases/failing/90 pch source different folder/test.json create mode 100644 test cases/failing/91 unknown config tool/meson.build create mode 100644 test cases/failing/91 unknown config tool/test.json create mode 100644 test cases/failing/92 custom target install data/Info.plist.cpp create mode 100644 test cases/failing/92 custom target install data/meson.build create mode 100644 test cases/failing/92 custom target install data/preproc.py create mode 100644 test cases/failing/92 custom target install data/test.json create mode 100644 test cases/failing/93 add dict non string key/meson.build create mode 100644 test cases/failing/93 add dict non string key/test.json create mode 100644 test cases/failing/94 add dict duplicate keys/meson.build create mode 100644 test cases/failing/94 add dict duplicate keys/test.json create mode 100644 test cases/failing/95 no host get_external_property/meson.build create mode 100644 test cases/failing/95 no host get_external_property/test.json create mode 100644 test cases/failing/96 no native compiler/main.c create mode 100644 test cases/failing/96 no native compiler/meson.build create mode 100644 test cases/failing/96 no native compiler/test.json create mode 100644 test cases/failing/97 subdir parse error/meson.build create mode 100644 test cases/failing/97 subdir parse error/subdir/meson.build create mode 100644 test cases/failing/97 subdir parse error/test.json create mode 100644 test cases/failing/98 invalid option file/meson.build create mode 100644 test cases/failing/98 invalid option file/meson_options.txt create mode 100644 test cases/failing/98 invalid option file/test.json create mode 100644 test cases/failing/99 no lang/main.c create mode 100644 test cases/failing/99 no lang/meson.build create mode 100644 test cases/failing/99 no lang/test.json create mode 100644 test cases/fortran/1 basic/meson.build create mode 100644 test cases/fortran/1 basic/simple.f90 create mode 100644 test cases/fortran/10 find library/gzip.f90 create mode 100644 test cases/fortran/10 find library/main.f90 create mode 100644 test cases/fortran/10 find library/meson.build create mode 100644 test cases/fortran/11 compiles links runs/meson.build create mode 100644 test cases/fortran/12 submodule/a1.f90 create mode 100644 test cases/fortran/12 submodule/a2.f90 create mode 100644 test cases/fortran/12 submodule/a3.f90 create mode 100644 test cases/fortran/12 submodule/child.f90 create mode 100644 test cases/fortran/12 submodule/meson.build create mode 100644 test cases/fortran/12 submodule/parent.f90 create mode 100644 test cases/fortran/13 coarray/main.f90 create mode 100644 test cases/fortran/13 coarray/meson.build create mode 100644 test cases/fortran/14 fortran links c/clib.c create mode 100644 test cases/fortran/14 fortran links c/clib.def create mode 100644 test cases/fortran/14 fortran links c/f_call_c.f90 create mode 100644 test cases/fortran/14 fortran links c/meson.build create mode 100644 test cases/fortran/15 include/inc1.f90 create mode 100644 test cases/fortran/15 include/inc2.f90 create mode 100644 test cases/fortran/15 include/include_hierarchy.f90 create mode 100644 test cases/fortran/15 include/include_syntax.f90 create mode 100644 test cases/fortran/15 include/meson.build create mode 100644 test cases/fortran/15 include/subprojects/cmake_inc/CMakeLists.txt create mode 100644 test cases/fortran/15 include/subprojects/cmake_inc/main.f90 create mode 100644 test cases/fortran/15 include/subprojects/cmake_inc/thousand.f90 create mode 100644 test cases/fortran/15 include/timestwo.f90 create mode 100644 test cases/fortran/16 openmp/main.f90 create mode 100644 test cases/fortran/16 openmp/meson.build create mode 100644 test cases/fortran/17 add_languages/meson.build create mode 100644 test cases/fortran/18 first_arg/main.f90 create mode 100644 test cases/fortran/18 first_arg/meson.build create mode 100644 test cases/fortran/19 fortran_std/legacy.f create mode 100644 test cases/fortran/19 fortran_std/meson.build create mode 100644 test cases/fortran/19 fortran_std/std2003.f90 create mode 100644 test cases/fortran/19 fortran_std/std2008.f90 create mode 100644 test cases/fortran/19 fortran_std/std2018.f90 create mode 100644 test cases/fortran/19 fortran_std/std95.f90 create mode 100644 test cases/fortran/2 modules/comment_mod.f90 create mode 100644 test cases/fortran/2 modules/meson.build create mode 100644 test cases/fortran/2 modules/mymod.F90 create mode 100644 test cases/fortran/2 modules/prog.f90 create mode 100644 test cases/fortran/20 buildtype/main.f90 create mode 100644 test cases/fortran/20 buildtype/meson.build create mode 100644 test cases/fortran/21 install static/main.f90 create mode 100644 test cases/fortran/21 install static/main_lib.f90 create mode 100644 test cases/fortran/21 install static/meson.build create mode 100644 test cases/fortran/21 install static/subprojects/static_hello/meson.build create mode 100644 test cases/fortran/21 install static/subprojects/static_hello/static_hello.f90 create mode 100644 test cases/fortran/21 install static/test.json create mode 100644 test cases/fortran/3 module procedure/meson.build create mode 100644 test cases/fortran/3 module procedure/use_syntax.f90 create mode 100644 test cases/fortran/4 self dependency/meson.build create mode 100644 test cases/fortran/4 self dependency/selfdep.f90 create mode 100644 test cases/fortran/4 self dependency/src/selfdep_mod.f90 create mode 100644 test cases/fortran/4 self dependency/subprojects/sub1/main.f90 create mode 100644 test cases/fortran/4 self dependency/subprojects/sub1/meson.build create mode 100644 test cases/fortran/5 static/main.f90 create mode 100644 test cases/fortran/5 static/meson.build create mode 100644 test cases/fortran/5 static/static_hello.f90 create mode 100644 test cases/fortran/6 dynamic/dynamic.f90 create mode 100644 test cases/fortran/6 dynamic/main.f90 create mode 100644 test cases/fortran/6 dynamic/meson.build create mode 100644 test cases/fortran/7 generated/meson.build create mode 100644 test cases/fortran/7 generated/mod1.fpp create mode 100644 test cases/fortran/7 generated/mod2.fpp create mode 100644 test cases/fortran/7 generated/mod3.f90 create mode 100644 test cases/fortran/7 generated/prog.f90 create mode 100644 test cases/fortran/8 module names/meson.build create mode 100644 test cases/fortran/8 module names/mod1.f90 create mode 100644 test cases/fortran/8 module names/mod2.f90 create mode 100644 test cases/fortran/8 module names/test.f90 create mode 100644 test cases/fortran/9 cpp/fortran.f create mode 100644 test cases/fortran/9 cpp/main.c create mode 100644 test cases/fortran/9 cpp/main.cpp create mode 100644 test cases/fortran/9 cpp/meson.build create mode 100644 test cases/fpga/1 simple/meson.build create mode 100644 test cases/fpga/1 simple/spin.pcf create mode 100644 test cases/fpga/1 simple/spin.v create mode 100644 test cases/frameworks/1 boost/extralib.cpp create mode 100644 test cases/frameworks/1 boost/linkexe.cc create mode 100644 test cases/frameworks/1 boost/meson.build create mode 100644 test cases/frameworks/1 boost/meson_options.txt create mode 100644 test cases/frameworks/1 boost/nomod.cpp create mode 100644 test cases/frameworks/1 boost/partial_dep/foo.cpp create mode 100644 test cases/frameworks/1 boost/partial_dep/foo.hpp create mode 100644 test cases/frameworks/1 boost/partial_dep/main.cpp create mode 100644 test cases/frameworks/1 boost/partial_dep/meson.build create mode 100644 test cases/frameworks/1 boost/python_module.cpp create mode 100644 test cases/frameworks/1 boost/test.json create mode 100644 test cases/frameworks/1 boost/test_python_module.py create mode 100644 test cases/frameworks/1 boost/unit_test.cpp create mode 100644 test cases/frameworks/10 gtk-doc/doc/foobar-docs.sgml create mode 100644 test cases/frameworks/10 gtk-doc/doc/foobar1/baz.jpg create mode 100644 test cases/frameworks/10 gtk-doc/doc/foobar1/baz.png.in create mode 100644 test cases/frameworks/10 gtk-doc/doc/foobar1/foobar-docs.sgml create mode 100644 test cases/frameworks/10 gtk-doc/doc/foobar1/foobar-sections.txt create mode 100644 test cases/frameworks/10 gtk-doc/doc/foobar1/foobar.types create mode 100644 test cases/frameworks/10 gtk-doc/doc/foobar1/meson.build create mode 100644 test cases/frameworks/10 gtk-doc/doc/foobar2/foobar-docs.sgml create mode 100644 test cases/frameworks/10 gtk-doc/doc/foobar2/meson.build create mode 100644 test cases/frameworks/10 gtk-doc/doc/foobar3/foobar-docs.sgml create mode 100644 test cases/frameworks/10 gtk-doc/doc/foobar3/meson.build create mode 100644 test cases/frameworks/10 gtk-doc/doc/foobar4/foobar-docs.sgml create mode 100644 test cases/frameworks/10 gtk-doc/doc/foobar4/meson.build create mode 100644 test cases/frameworks/10 gtk-doc/doc/meson.build create mode 100644 test cases/frameworks/10 gtk-doc/doc/version.xml.in create mode 100644 test cases/frameworks/10 gtk-doc/foo.c create mode 100644 test cases/frameworks/10 gtk-doc/include/foo-version.h.in create mode 100644 test cases/frameworks/10 gtk-doc/include/foo.h create mode 100644 test cases/frameworks/10 gtk-doc/include/generate-enums-docbook.py create mode 100644 test cases/frameworks/10 gtk-doc/include/meson.build create mode 100644 test cases/frameworks/10 gtk-doc/meson.build create mode 100644 test cases/frameworks/10 gtk-doc/test.json create mode 100644 test cases/frameworks/11 gir subproject/gir/meson-subsample.c create mode 100644 test cases/frameworks/11 gir subproject/gir/meson-subsample.h create mode 100644 test cases/frameworks/11 gir subproject/gir/meson.build create mode 100644 test cases/frameworks/11 gir subproject/gir/prog.c create mode 100755 test cases/frameworks/11 gir subproject/gir/prog.py create mode 100644 test cases/frameworks/11 gir subproject/meson.build create mode 100644 test cases/frameworks/11 gir subproject/subprojects/mesongir/meson-sample.c create mode 100644 test cases/frameworks/11 gir subproject/subprojects/mesongir/meson-sample.h create mode 100644 test cases/frameworks/11 gir subproject/subprojects/mesongir/meson.build create mode 100644 test cases/frameworks/11 gir subproject/test.json create mode 100644 test cases/frameworks/12 multiple gir/gir/meson-subsample.c create mode 100644 test cases/frameworks/12 multiple gir/gir/meson-subsample.h create mode 100644 test cases/frameworks/12 multiple gir/gir/meson.build create mode 100644 test cases/frameworks/12 multiple gir/gir/prog.c create mode 100644 test cases/frameworks/12 multiple gir/meson.build create mode 100644 test cases/frameworks/12 multiple gir/mesongir/meson-sample.c create mode 100644 test cases/frameworks/12 multiple gir/mesongir/meson-sample.h.in create mode 100644 test cases/frameworks/12 multiple gir/mesongir/meson.build create mode 100644 test cases/frameworks/12 multiple gir/test.json create mode 100644 test cases/frameworks/13 yelp/help/C/index.page create mode 100644 test cases/frameworks/13 yelp/help/C/index2.page create mode 100644 test cases/frameworks/13 yelp/help/C/index3.page create mode 100644 test cases/frameworks/13 yelp/help/C/media/test.txt create mode 100644 test cases/frameworks/13 yelp/help/LINGUAS create mode 100644 test cases/frameworks/13 yelp/help/de/de.po create mode 100644 test cases/frameworks/13 yelp/help/es/es.po create mode 100644 test cases/frameworks/13 yelp/help/es/media/test.txt create mode 100644 test cases/frameworks/13 yelp/help/meson.build create mode 100644 test cases/frameworks/13 yelp/meson.build create mode 100644 test cases/frameworks/13 yelp/test.json create mode 100644 test cases/frameworks/14 doxygen/doc/Doxyfile.in create mode 100644 test cases/frameworks/14 doxygen/doc/meson.build create mode 100644 test cases/frameworks/14 doxygen/include/comedian.h create mode 100644 test cases/frameworks/14 doxygen/include/spede.h create mode 100644 test cases/frameworks/14 doxygen/meson.build create mode 100644 test cases/frameworks/14 doxygen/src/spede.cpp create mode 100644 test cases/frameworks/14 doxygen/test.json create mode 100644 test cases/frameworks/15 llvm/meson.build create mode 100644 test cases/frameworks/15 llvm/meson_options.txt create mode 100644 test cases/frameworks/15 llvm/sum.c create mode 100644 test cases/frameworks/15 llvm/test.json create mode 100644 test cases/frameworks/16 sdl2/meson.build create mode 100644 test cases/frameworks/16 sdl2/meson_options.txt create mode 100644 test cases/frameworks/16 sdl2/sdl2prog.c create mode 100644 test cases/frameworks/16 sdl2/test.json create mode 100644 test cases/frameworks/17 mpi/main.c create mode 100644 test cases/frameworks/17 mpi/main.cpp create mode 100644 test cases/frameworks/17 mpi/main.f90 create mode 100644 test cases/frameworks/17 mpi/meson.build create mode 100644 test cases/frameworks/17 mpi/meson_options.txt create mode 100644 test cases/frameworks/17 mpi/test.json create mode 100644 test cases/frameworks/18 vulkan/meson.build create mode 100644 test cases/frameworks/18 vulkan/test.json create mode 100644 test cases/frameworks/18 vulkan/vulkanprog.c create mode 100644 test cases/frameworks/19 pcap/meson.build create mode 100644 test cases/frameworks/19 pcap/pcap_prog.c create mode 100644 test cases/frameworks/19 pcap/test.json create mode 100644 test cases/frameworks/2 gtest/meson.build create mode 100644 test cases/frameworks/2 gtest/test.cc create mode 100644 test cases/frameworks/2 gtest/test.json create mode 100644 test cases/frameworks/2 gtest/test_nomain.cc create mode 100644 test cases/frameworks/20 cups/cups_prog.c create mode 100644 test cases/frameworks/20 cups/meson.build create mode 100644 test cases/frameworks/20 cups/test.json create mode 100644 test cases/frameworks/21 libwmf/libwmf_prog.c create mode 100644 test cases/frameworks/21 libwmf/meson.build create mode 100644 test cases/frameworks/21 libwmf/test.json create mode 100644 test cases/frameworks/22 gir link order/fake-gthread/fake-gthread.c create mode 100644 test cases/frameworks/22 gir link order/fake-gthread/fake-gthread.h create mode 100644 test cases/frameworks/22 gir link order/fake-gthread/meson.build create mode 100644 test cases/frameworks/22 gir link order/get-prgname/get-prgname.c create mode 100644 test cases/frameworks/22 gir link order/get-prgname/get-prgname.h create mode 100644 test cases/frameworks/22 gir link order/get-prgname/meson.build create mode 100644 test cases/frameworks/22 gir link order/meson-sample.c create mode 100644 test cases/frameworks/22 gir link order/meson-sample.h create mode 100644 test cases/frameworks/22 gir link order/meson.build create mode 100644 test cases/frameworks/22 gir link order/test.json create mode 100644 test cases/frameworks/23 hotdoc/doc/index.md create mode 100644 test cases/frameworks/23 hotdoc/doc/meson.build create mode 100644 test cases/frameworks/23 hotdoc/doc/sitemap.txt create mode 100644 test cases/frameworks/23 hotdoc/meson.build create mode 100644 test cases/frameworks/23 hotdoc/test.json create mode 100644 test cases/frameworks/24 libgcrypt/libgcrypt_prog.c create mode 100644 test cases/frameworks/24 libgcrypt/meson.build create mode 100644 test cases/frameworks/24 libgcrypt/test.json create mode 100644 test cases/frameworks/25 hdf5/main.c create mode 100644 test cases/frameworks/25 hdf5/main.cpp create mode 100644 test cases/frameworks/25 hdf5/main.f90 create mode 100644 test cases/frameworks/25 hdf5/meson.build create mode 100644 test cases/frameworks/25 hdf5/meson_options.txt create mode 100644 test cases/frameworks/25 hdf5/test.json create mode 100644 test cases/frameworks/26 netcdf/main.c create mode 100644 test cases/frameworks/26 netcdf/main.cpp create mode 100644 test cases/frameworks/26 netcdf/main.f90 create mode 100644 test cases/frameworks/26 netcdf/meson.build create mode 100644 test cases/frameworks/26 netcdf/test.json create mode 100644 test cases/frameworks/27 gpgme/gpgme_prog.c create mode 100644 test cases/frameworks/27 gpgme/meson.build create mode 100644 test cases/frameworks/27 gpgme/test.json create mode 100644 test cases/frameworks/28 gir link order 2/meson-sample.c create mode 100644 test cases/frameworks/28 gir link order 2/meson-sample.h create mode 100644 test cases/frameworks/28 gir link order 2/meson.build create mode 100644 test cases/frameworks/28 gir link order 2/samelibname/dummy.c create mode 100644 test cases/frameworks/28 gir link order 2/samelibname/meson.build create mode 100644 test cases/frameworks/28 gir link order 2/test.json create mode 100644 test cases/frameworks/29 blocks/main.c create mode 100644 test cases/frameworks/29 blocks/meson.build create mode 100644 test cases/frameworks/29 blocks/test.json create mode 100644 test cases/frameworks/3 gmock/gmocktest.cc create mode 100644 test cases/frameworks/3 gmock/meson.build create mode 100644 test cases/frameworks/3 gmock/test.json create mode 100644 test cases/frameworks/30 scalapack/cmake/FindSCALAPACK.cmake create mode 100644 test cases/frameworks/30 scalapack/main.c create mode 100644 test cases/frameworks/30 scalapack/main.f90 create mode 100644 test cases/frameworks/30 scalapack/meson.build create mode 100644 test cases/frameworks/30 scalapack/test.json create mode 100644 test cases/frameworks/31 curses/main.c create mode 100644 test cases/frameworks/31 curses/meson.build create mode 100644 test cases/frameworks/31 curses/meson_options.txt create mode 100644 test cases/frameworks/31 curses/test.json create mode 100644 test cases/frameworks/32 boost root/boost/include/boost/version.hpp create mode 100644 test cases/frameworks/32 boost root/boost/lib/boost_regex-vc142-mt-gd-x32-0_1.lib create mode 100644 test cases/frameworks/32 boost root/boost/lib/boost_regex-vc142-mt-gd-x64-0_1.lib create mode 100644 test cases/frameworks/32 boost root/boost/lib/libboost_regex.so.0.1.0 create mode 100644 test cases/frameworks/32 boost root/meson.build create mode 100644 test cases/frameworks/32 boost root/nativefile.ini.in create mode 100644 test cases/frameworks/33 boost split root/boost/extra-dir/include/boost/version.hpp create mode 100644 test cases/frameworks/33 boost split root/boost/lib/boost_regex-vc142-mt-gd-x32-0_2.lib create mode 100644 test cases/frameworks/33 boost split root/boost/lib/boost_regex-vc142-mt-gd-x64-0_2.lib create mode 100644 test cases/frameworks/33 boost split root/boost/lib/libboost_regex.so.0.2.0 create mode 100644 test cases/frameworks/33 boost split root/meson.build create mode 100644 test cases/frameworks/33 boost split root/nativefile.ini.in create mode 100644 test cases/frameworks/34 gir static lib/meson.build create mode 100644 test cases/frameworks/34 gir static lib/statichelper/meson-sample.c create mode 100644 test cases/frameworks/34 gir static lib/statichelper/meson-sample.h.in create mode 100644 test cases/frameworks/34 gir static lib/statichelper/meson.build create mode 100644 test cases/frameworks/34 gir static lib/subdir/gir/meson-subsample.c create mode 100644 test cases/frameworks/34 gir static lib/subdir/gir/meson-subsample.h create mode 100644 test cases/frameworks/34 gir static lib/subdir/gir/meson.build create mode 100644 test cases/frameworks/34 gir static lib/subdir/gir/prog.c create mode 100644 test cases/frameworks/34 gir static lib/test.json create mode 100644 test cases/frameworks/35 boost symlinks/boost/Cellar/boost-python/0.3.0/lib/boost_python-vc142-mt-gd-x32-0_3.lib create mode 100644 test cases/frameworks/35 boost symlinks/boost/Cellar/boost-python/0.3.0/lib/boost_python-vc142-mt-gd-x64-0_3.lib create mode 100644 test cases/frameworks/35 boost symlinks/boost/Cellar/boost-python/0.3.0/lib/libboost_python.so.0.3.0 create mode 100644 test cases/frameworks/35 boost symlinks/boost/Cellar/boost/0.3.0/include/boost/version.hpp create mode 100644 test cases/frameworks/35 boost symlinks/boost/Cellar/boost/0.3.0/lib/boost_regex-vc142-mt-gd-x32-0_3.lib create mode 100644 test cases/frameworks/35 boost symlinks/boost/Cellar/boost/0.3.0/lib/boost_regex-vc142-mt-gd-x64-0_3.lib create mode 100644 test cases/frameworks/35 boost symlinks/boost/Cellar/boost/0.3.0/lib/libboost_regex.so.0.3.0 create mode 100644 test cases/frameworks/35 boost symlinks/boost/include/boost/version.hpp create mode 100644 test cases/frameworks/35 boost symlinks/boost/lib/boost_python-vc142-mt-gd-x32-0_3.lib create mode 100644 test cases/frameworks/35 boost symlinks/boost/lib/boost_python-vc142-mt-gd-x64-0_3.lib create mode 100644 test cases/frameworks/35 boost symlinks/boost/lib/boost_regex-vc142-mt-gd-x32-0_3.lib create mode 100644 test cases/frameworks/35 boost symlinks/boost/lib/boost_regex-vc142-mt-gd-x64-0_3.lib create mode 100644 test cases/frameworks/35 boost symlinks/boost/lib/libboost_python.so.0.3.0 create mode 100644 test cases/frameworks/35 boost symlinks/boost/lib/libboost_regex.so.0.3.0 create mode 100644 test cases/frameworks/35 boost symlinks/meson.build create mode 100644 test cases/frameworks/35 boost symlinks/nativefile.ini.in create mode 100644 test cases/frameworks/4 qt/main.cpp create mode 100644 test cases/frameworks/4 qt/mainWindow.cpp create mode 100644 test cases/frameworks/4 qt/mainWindow.h create mode 100644 test cases/frameworks/4 qt/mainWindow.ui create mode 100644 test cases/frameworks/4 qt/manualinclude.cpp create mode 100644 test cases/frameworks/4 qt/manualinclude.h create mode 100644 test cases/frameworks/4 qt/meson.build create mode 100644 test cases/frameworks/4 qt/meson_options.txt create mode 100644 test cases/frameworks/4 qt/plugin/plugin.cpp create mode 100644 test cases/frameworks/4 qt/plugin/plugin.h create mode 100644 test cases/frameworks/4 qt/plugin/plugin.json create mode 100644 test cases/frameworks/4 qt/pluginInterface/plugin_if.h create mode 100644 test cases/frameworks/4 qt/q5core.cpp create mode 100644 test cases/frameworks/4 qt/qt4_lang.qrc create mode 100644 test cases/frameworks/4 qt/qt4core_fr.ts create mode 100644 test cases/frameworks/4 qt/qt4embedded_fr.ts create mode 100644 test cases/frameworks/4 qt/qt5_lang.qrc create mode 100644 test cases/frameworks/4 qt/qt5core_fr.ts create mode 100644 test cases/frameworks/4 qt/qt5embedded_fr.ts create mode 100644 test cases/frameworks/4 qt/qt6_lang.qrc create mode 100644 test cases/frameworks/4 qt/qt6core_fr.ts create mode 100644 test cases/frameworks/4 qt/qt6embedded_fr.ts create mode 100644 test cases/frameworks/4 qt/qtinterface.cpp create mode 100644 test cases/frameworks/4 qt/stuff.qrc create mode 100644 test cases/frameworks/4 qt/stuff2.qrc create mode 100644 test cases/frameworks/4 qt/subfolder/generator.py create mode 100644 test cases/frameworks/4 qt/subfolder/main.cpp create mode 100644 test cases/frameworks/4 qt/subfolder/meson.build create mode 100644 test cases/frameworks/4 qt/subfolder/resources/stuff3.qrc create mode 100644 test cases/frameworks/4 qt/subfolder/resources/stuff4.qrc.in create mode 100644 test cases/frameworks/4 qt/subfolder/resources/thing.png create mode 100644 test cases/frameworks/4 qt/test.json create mode 100644 test cases/frameworks/4 qt/thing.png create mode 100644 test cases/frameworks/4 qt/thing2.png create mode 100644 test cases/frameworks/5 protocol buffers/asubdir/defs.proto create mode 100644 test cases/frameworks/5 protocol buffers/asubdir/main.cpp create mode 100644 test cases/frameworks/5 protocol buffers/asubdir/meson.build create mode 100644 test cases/frameworks/5 protocol buffers/defs.proto create mode 100644 test cases/frameworks/5 protocol buffers/main.cpp create mode 100644 test cases/frameworks/5 protocol buffers/meson.build create mode 100644 test cases/frameworks/5 protocol buffers/sidedir/meson.build create mode 100644 test cases/frameworks/5 protocol buffers/sidedir/sideprog.cpp create mode 100644 test cases/frameworks/5 protocol buffers/test.json create mode 100644 test cases/frameworks/5 protocol buffers/withpath/com/mesonbuild/simple.proto create mode 100644 test cases/frameworks/5 protocol buffers/withpath/com/mesonbuild/subsite/complex.proto create mode 100644 test cases/frameworks/5 protocol buffers/withpath/meson.build create mode 100644 test cases/frameworks/5 protocol buffers/withpath/pathprog.cpp create mode 100644 test cases/frameworks/6 gettext/data/data3/meson.build create mode 100644 test cases/frameworks/6 gettext/data/data3/test.desktop.in create mode 100644 test cases/frameworks/6 gettext/data/meson.build create mode 100644 test cases/frameworks/6 gettext/data/test.desktop.in create mode 100644 test cases/frameworks/6 gettext/data/test2.desktop.in create mode 100644 test cases/frameworks/6 gettext/data/test5.desktop.in.in create mode 100644 test cases/frameworks/6 gettext/data/test6.desktop.in.in create mode 100644 test cases/frameworks/6 gettext/data2/meson.build create mode 100644 test cases/frameworks/6 gettext/data2/test.desktop.in create mode 100644 test cases/frameworks/6 gettext/data3/com.mesonbuild.test.intlprog.metainfo.xml create mode 100644 test cases/frameworks/6 gettext/data3/meson.build create mode 100644 test cases/frameworks/6 gettext/data3/metainfo.its create mode 100755 test cases/frameworks/6 gettext/data3/verify.py create mode 100644 test cases/frameworks/6 gettext/generated/desktopgenerator.py create mode 100644 test cases/frameworks/6 gettext/generated/meson.build create mode 100644 test cases/frameworks/6 gettext/generated/something.desktop.in.in create mode 100644 test cases/frameworks/6 gettext/meson.build create mode 100644 test cases/frameworks/6 gettext/meson_options.txt create mode 100644 test cases/frameworks/6 gettext/po/LINGUAS create mode 100644 test cases/frameworks/6 gettext/po/POTFILES create mode 100644 test cases/frameworks/6 gettext/po/de.po create mode 100644 test cases/frameworks/6 gettext/po/fi.po create mode 100644 test cases/frameworks/6 gettext/po/intltest.pot create mode 100644 test cases/frameworks/6 gettext/po/meson.build create mode 100644 test cases/frameworks/6 gettext/po/ru.po create mode 100644 test cases/frameworks/6 gettext/src/intlmain.c create mode 100644 test cases/frameworks/6 gettext/src/meson.build create mode 100644 test cases/frameworks/6 gettext/test.json create mode 100644 test cases/frameworks/7 gnome/copyfile.py create mode 100644 test cases/frameworks/7 gnome/gdbus/data/com.example.Sample.xml create mode 100644 test cases/frameworks/7 gnome/gdbus/gdbusprog.c create mode 100644 test cases/frameworks/7 gnome/gdbus/meson.build create mode 100644 test cases/frameworks/7 gnome/genmarshal/main.c.in create mode 100644 test cases/frameworks/7 gnome/genmarshal/marshaller.list create mode 100644 test cases/frameworks/7 gnome/genmarshal/meson.build create mode 100755 test cases/frameworks/7 gnome/gir/copy.py create mode 100644 test cases/frameworks/7 gnome/gir/dep1/dep1.c create mode 100644 test cases/frameworks/7 gnome/gir/dep1/dep1.h create mode 100644 test cases/frameworks/7 gnome/gir/dep1/dep2/dep2.c create mode 100644 test cases/frameworks/7 gnome/gir/dep1/dep2/dep2.h create mode 100644 test cases/frameworks/7 gnome/gir/dep1/dep2/meson.build create mode 100644 test cases/frameworks/7 gnome/gir/dep1/dep3/dep3.c create mode 100644 test cases/frameworks/7 gnome/gir/dep1/dep3/dep3.h create mode 100644 test cases/frameworks/7 gnome/gir/dep1/dep3/meson.build create mode 100644 test cases/frameworks/7 gnome/gir/dep1/meson.build create mode 100644 test cases/frameworks/7 gnome/gir/meson-sample.c create mode 100644 test cases/frameworks/7 gnome/gir/meson-sample.h create mode 100644 test cases/frameworks/7 gnome/gir/meson-sample2.c create mode 100644 test cases/frameworks/7 gnome/gir/meson-sample2.h create mode 100644 test cases/frameworks/7 gnome/gir/meson.build create mode 100644 test cases/frameworks/7 gnome/gir/prog.c create mode 100755 test cases/frameworks/7 gnome/gir/prog.py create mode 100644 test cases/frameworks/7 gnome/meson.build create mode 100644 test cases/frameworks/7 gnome/mkenums/enums.c.in create mode 100644 test cases/frameworks/7 gnome/mkenums/enums.h.in create mode 100644 test cases/frameworks/7 gnome/mkenums/enums2.c.in create mode 100644 test cases/frameworks/7 gnome/mkenums/enums2.h.in create mode 100644 test cases/frameworks/7 gnome/mkenums/main.c create mode 100644 test cases/frameworks/7 gnome/mkenums/main4.c create mode 100644 test cases/frameworks/7 gnome/mkenums/main5.c create mode 100644 test cases/frameworks/7 gnome/mkenums/meson-decls.h create mode 100644 test cases/frameworks/7 gnome/mkenums/meson-sample.h create mode 100644 test cases/frameworks/7 gnome/mkenums/meson.build create mode 100644 test cases/frameworks/7 gnome/resources-data/meson.build create mode 100644 test cases/frameworks/7 gnome/resources-data/res1.txt create mode 100644 test cases/frameworks/7 gnome/resources-data/res3.txt.in create mode 100644 test cases/frameworks/7 gnome/resources-data/subdir/meson.build create mode 100644 test cases/frameworks/7 gnome/resources-data/subdir/res2.txt create mode 100644 test cases/frameworks/7 gnome/resources-data/subdir/res4.txt.in create mode 100644 test cases/frameworks/7 gnome/resources/generated-main.c create mode 100644 test cases/frameworks/7 gnome/resources/generated.gresource.xml create mode 100644 test cases/frameworks/7 gnome/resources/generated/meson.build create mode 100644 test cases/frameworks/7 gnome/resources/meson.build create mode 100644 test cases/frameworks/7 gnome/resources/myresource.gresource.xml create mode 100644 test cases/frameworks/7 gnome/resources/res3.txt create mode 100644 test cases/frameworks/7 gnome/resources/resources.py create mode 100644 test cases/frameworks/7 gnome/resources/simple-main.c create mode 100644 test cases/frameworks/7 gnome/resources/simple.gresource.xml create mode 100644 test cases/frameworks/7 gnome/schemas/com.github.meson.gschema.xml create mode 100644 test cases/frameworks/7 gnome/schemas/meson.build create mode 100644 test cases/frameworks/7 gnome/schemas/schemaprog.c create mode 100644 test cases/frameworks/7 gnome/test.json create mode 100644 test cases/frameworks/8 flex/lexer.l create mode 100644 test cases/frameworks/8 flex/meson.build create mode 100644 test cases/frameworks/8 flex/parser.y create mode 100644 test cases/frameworks/8 flex/prog.c create mode 100644 test cases/frameworks/8 flex/test.json create mode 100644 test cases/frameworks/8 flex/test.txt create mode 100644 test cases/frameworks/8 flex/testfile create mode 100644 test cases/frameworks/9 wxwidgets/mainwin.h create mode 100644 test cases/frameworks/9 wxwidgets/meson.build create mode 100644 test cases/frameworks/9 wxwidgets/wxprog.cpp create mode 100644 test cases/frameworks/9 wxwidgets/wxstc.cpp create mode 100644 test cases/java/1 basic/com/mesonbuild/Simple.java create mode 100644 test cases/java/1 basic/meson.build create mode 100644 test cases/java/1 basic/test.json create mode 100644 test cases/java/10 resources/meson.build create mode 100644 test cases/java/10 resources/src/com/mesonbuild/Resources.java create mode 100644 test cases/java/10 resources/src/meson.build create mode 100644 test cases/java/10 resources/src/resources/resource1.txt create mode 100644 test cases/java/10 resources/src/resources/subdir/resource2.txt create mode 100644 test cases/java/2 subdir/meson.build create mode 100644 test cases/java/2 subdir/sub/com/mesonbuild/Simple.java create mode 100644 test cases/java/2 subdir/sub/com/mesonbuild/TextPrinter.java create mode 100644 test cases/java/2 subdir/sub/meson.build create mode 100644 test cases/java/3 args/com/mesonbuild/Simple.java create mode 100644 test cases/java/3 args/meson.build create mode 100644 test cases/java/4 inner class/com/mesonbuild/Simple.java create mode 100644 test cases/java/4 inner class/meson.build create mode 100644 test cases/java/5 includedirs/com/mesonbuild/Simple.java create mode 100644 test cases/java/5 includedirs/com/mesonbuild/TextPrinter.java create mode 100644 test cases/java/5 includedirs/meson.build create mode 100644 test cases/java/6 codegen/com/mesonbuild/Config.java.in create mode 100644 test cases/java/6 codegen/com/mesonbuild/Simple.java create mode 100644 test cases/java/6 codegen/com/mesonbuild/TextPrinter.java create mode 100644 test cases/java/6 codegen/com/mesonbuild/meson.build create mode 100644 test cases/java/6 codegen/meson.build create mode 100644 test cases/java/7 linking/com/mesonbuild/Linking.java create mode 100644 test cases/java/7 linking/meson.build create mode 100644 test cases/java/7 linking/sub/com/mesonbuild/SimpleLib.java create mode 100644 test cases/java/7 linking/sub/meson.build create mode 100644 test cases/java/8 codegen custom target/com/mesonbuild/Config.java.in create mode 100644 test cases/java/8 codegen custom target/com/mesonbuild/Simple.java create mode 100644 test cases/java/8 codegen custom target/com/mesonbuild/TextPrinter.java create mode 100644 test cases/java/8 codegen custom target/com/mesonbuild/meson.build create mode 100644 test cases/java/8 codegen custom target/meson.build create mode 100644 test cases/java/9 jni/lib/com_mesonbuild_JniTest.c create mode 100644 test cases/java/9 jni/lib/meson.build create mode 100644 test cases/java/9 jni/lib/native.c create mode 100644 test cases/java/9 jni/meson.build create mode 100644 test cases/java/9 jni/src/com/mesonbuild/Configured.java.in create mode 100644 test cases/java/9 jni/src/com/mesonbuild/JniTest.java create mode 100644 test cases/java/9 jni/src/com/mesonbuild/meson.build create mode 100644 test cases/java/9 jni/src/meson.build create mode 100644 test cases/keyval/1 basic/.config create mode 100644 test cases/keyval/1 basic/meson.build create mode 100644 test cases/keyval/1 basic/test.json create mode 100644 test cases/keyval/2 subdir/.config create mode 100644 test cases/keyval/2 subdir/dir/meson.build create mode 100644 test cases/keyval/2 subdir/meson.build create mode 100644 test cases/keyval/3 load_config files/dir/config create mode 100644 test cases/keyval/3 load_config files/dir/meson.build create mode 100644 test cases/keyval/3 load_config files/meson.build create mode 100644 test cases/keyval/4 load_config builddir/config create mode 100644 test cases/keyval/4 load_config builddir/meson.build create mode 100644 test cases/linuxlike/1 pkg-config/incdir/myinc.h create mode 100644 test cases/linuxlike/1 pkg-config/meson.build create mode 100644 test cases/linuxlike/1 pkg-config/prog-checkver.c create mode 100644 test cases/linuxlike/1 pkg-config/prog.c create mode 100644 test cases/linuxlike/10 large file support/meson.build create mode 100644 test cases/linuxlike/11 runpath rpath ldlibrarypath/lib.c create mode 100644 test cases/linuxlike/11 runpath rpath ldlibrarypath/lib1/meson.build create mode 100644 test cases/linuxlike/11 runpath rpath ldlibrarypath/lib2/meson.build create mode 100644 test cases/linuxlike/11 runpath rpath ldlibrarypath/main.c create mode 100644 test cases/linuxlike/11 runpath rpath ldlibrarypath/meson.build create mode 100644 test cases/linuxlike/12 subprojects in subprojects/main.c create mode 100644 test cases/linuxlike/12 subprojects in subprojects/meson.build create mode 100644 test cases/linuxlike/12 subprojects in subprojects/subprojects/a/a.c create mode 100644 test cases/linuxlike/12 subprojects in subprojects/subprojects/a/a.h create mode 100644 test cases/linuxlike/12 subprojects in subprojects/subprojects/a/meson.build create mode 100644 test cases/linuxlike/12 subprojects in subprojects/subprojects/b/b.c create mode 100644 test cases/linuxlike/12 subprojects in subprojects/subprojects/b/b.h create mode 100644 test cases/linuxlike/12 subprojects in subprojects/subprojects/b/meson.build create mode 100644 test cases/linuxlike/12 subprojects in subprojects/subprojects/c/c.h create mode 100644 test cases/linuxlike/12 subprojects in subprojects/subprojects/c/meson.build create mode 100644 test cases/linuxlike/13 cmake dependency/cmake/FindImportedOldStyle.cmake create mode 100644 test cases/linuxlike/13 cmake dependency/cmake/FindImportedTarget.cmake create mode 100644 test cases/linuxlike/13 cmake dependency/cmake/FindSomethingLikeZLIB.cmake create mode 100644 test cases/linuxlike/13 cmake dependency/cmake_fake1/cmMesonTestF1Config.cmake create mode 100644 test cases/linuxlike/13 cmake dependency/cmake_fake2/cmMesonTestF2Config.cmake create mode 100644 test cases/linuxlike/13 cmake dependency/cmake_fake3/bin/.gitkeep create mode 100644 test cases/linuxlike/13 cmake dependency/cmake_fake3/lib/cmake/cmMesonTestF3/cmMesonTestF3Config.cmake create mode 100644 test cases/linuxlike/13 cmake dependency/cmake_pref_env/lib/cmake/cmMesonTestDep/cmMesonTestDepConfig.cmake create mode 100644 test cases/linuxlike/13 cmake dependency/cmake_pref_env/lib/cmake/cmMesonVersionedTestDep/cmMesonVersionedTestDepConfig.cmake create mode 100644 test cases/linuxlike/13 cmake dependency/cmake_pref_env/lib/cmake/cmMesonVersionedTestDep/cmMesonVersionedTestDepConfigVersion.cmake create mode 100644 test cases/linuxlike/13 cmake dependency/incdir/myinc.h create mode 100644 test cases/linuxlike/13 cmake dependency/meson.build create mode 100644 test cases/linuxlike/13 cmake dependency/prog-checkver.c create mode 100644 test cases/linuxlike/13 cmake dependency/prog.c create mode 100644 test cases/linuxlike/13 cmake dependency/test.json create mode 100644 test cases/linuxlike/13 cmake dependency/testFlagSet.c create mode 100644 test cases/linuxlike/14 static dynamic linkage/main.c create mode 100644 test cases/linuxlike/14 static dynamic linkage/meson.build create mode 100755 test cases/linuxlike/14 static dynamic linkage/verify_static.py create mode 100644 test cases/linuxlike/15 ld binary/meson.build create mode 100644 test cases/linuxlike/2 external library/meson.build create mode 100644 test cases/linuxlike/2 external library/prog.c create mode 100644 test cases/linuxlike/3 linker script/bob.c create mode 100644 test cases/linuxlike/3 linker script/bob.h create mode 100644 test cases/linuxlike/3 linker script/bob.map create mode 100644 test cases/linuxlike/3 linker script/bob.map.in create mode 100644 test cases/linuxlike/3 linker script/copy.py create mode 100644 test cases/linuxlike/3 linker script/meson.build create mode 100644 test cases/linuxlike/3 linker script/prog.c create mode 100644 test cases/linuxlike/3 linker script/sub/foo.map create mode 100644 test cases/linuxlike/3 linker script/sub/meson.build create mode 100644 test cases/linuxlike/4 extdep static lib/lib.c create mode 100644 test cases/linuxlike/4 extdep static lib/meson.build create mode 100644 test cases/linuxlike/4 extdep static lib/prog.c create mode 100644 test cases/linuxlike/5 dependency versions/meson.build create mode 100644 test cases/linuxlike/5 dependency versions/subprojects/fakezlib/meson.build create mode 100644 test cases/linuxlike/5 dependency versions/subprojects/somelib/lib.c create mode 100644 test cases/linuxlike/5 dependency versions/subprojects/somelib/meson.build create mode 100644 test cases/linuxlike/5 dependency versions/subprojects/somelibnover/lib.c create mode 100644 test cases/linuxlike/5 dependency versions/subprojects/somelibnover/meson.build create mode 100644 test cases/linuxlike/5 dependency versions/subprojects/somelibver/lib.c create mode 100644 test cases/linuxlike/5 dependency versions/subprojects/somelibver/meson.build create mode 100644 test cases/linuxlike/6 subdir include order/meson.build create mode 100644 test cases/linuxlike/6 subdir include order/prog.c create mode 100644 test cases/linuxlike/6 subdir include order/subdir/glib.h create mode 100644 test cases/linuxlike/7 library versions/exe.orig.c create mode 100644 test cases/linuxlike/7 library versions/lib.c create mode 100644 test cases/linuxlike/7 library versions/meson.build create mode 100644 test cases/linuxlike/7 library versions/test.json create mode 100644 test cases/linuxlike/8 subproject library install/meson.build create mode 100644 test cases/linuxlike/8 subproject library install/subprojects/sublib/include/subdefs.h create mode 100644 test cases/linuxlike/8 subproject library install/subprojects/sublib/meson.build create mode 100644 test cases/linuxlike/8 subproject library install/subprojects/sublib/sublib.c create mode 100644 test cases/linuxlike/8 subproject library install/test.json create mode 100644 test cases/linuxlike/9 compiler checks with dependencies/meson.build create mode 100644 test cases/nasm/1 configure file/hello.asm create mode 100644 test cases/nasm/1 configure file/meson.build create mode 100644 test cases/nasm/2 asm language/hello.asm create mode 100644 test cases/nasm/2 asm language/meson.build create mode 100644 test cases/native/1 trivial/meson.build create mode 100644 test cases/native/1 trivial/trivial.c create mode 100644 test cases/native/2 global arg/meson.build create mode 100644 test cases/native/2 global arg/prog.c create mode 100644 test cases/native/2 global arg/prog.cc create mode 100755 test cases/native/3 pipeline/depends/copyrunner.py create mode 100644 test cases/native/3 pipeline/depends/filecopier.c create mode 100644 test cases/native/3 pipeline/depends/libsrc.c.in create mode 100644 test cases/native/3 pipeline/depends/meson.build create mode 100644 test cases/native/3 pipeline/depends/prog.c create mode 100644 test cases/native/3 pipeline/input_src.dat create mode 100644 test cases/native/3 pipeline/meson.build create mode 100644 test cases/native/3 pipeline/prog.c create mode 100644 test cases/native/3 pipeline/src/input_src.dat create mode 100644 test cases/native/3 pipeline/src/meson.build create mode 100644 test cases/native/3 pipeline/src/prog.c create mode 100644 test cases/native/3 pipeline/src/srcgen.c create mode 100644 test cases/native/3 pipeline/srcgen.c create mode 100644 test cases/native/4 tryrun/error.c create mode 100644 test cases/native/4 tryrun/meson.build create mode 100644 test cases/native/4 tryrun/no_compile.c create mode 100644 test cases/native/4 tryrun/ok.c create mode 100644 test cases/native/5 install script/file.txt create mode 100644 test cases/native/5 install script/meson.build create mode 100644 test cases/native/5 install script/src/exe.c create mode 100644 test cases/native/5 install script/src/meson.build create mode 100644 test cases/native/5 install script/test.json create mode 100755 test cases/native/5 install script/wrap.py create mode 100644 test cases/native/6 add language/meson.build create mode 100644 test cases/native/6 add language/prog.cc create mode 100644 test cases/native/7 selfbuilt custom/checkarg.cpp create mode 100644 test cases/native/7 selfbuilt custom/data.dat create mode 100644 test cases/native/7 selfbuilt custom/mainprog.cpp create mode 100644 test cases/native/7 selfbuilt custom/meson.build create mode 100644 test cases/native/7 selfbuilt custom/tool.cpp create mode 100644 test cases/native/8 external program shebang parsing/input.txt create mode 100644 test cases/native/8 external program shebang parsing/main.c create mode 100644 test cases/native/8 external program shebang parsing/meson.build create mode 100644 test cases/native/8 external program shebang parsing/script.int.in create mode 100644 test cases/native/9 override with exe/main2.input create mode 100644 test cases/native/9 override with exe/meson.build create mode 100644 test cases/native/9 override with exe/subprojects/sub/foobar.c create mode 100644 test cases/native/9 override with exe/subprojects/sub/meson.build create mode 100644 test cases/objc/1 simple/meson.build create mode 100644 test cases/objc/1 simple/prog.m create mode 100644 test cases/objc/2 nsstring/meson.build create mode 100644 test cases/objc/2 nsstring/stringprog.m create mode 100644 test cases/objc/3 objc args/meson.build create mode 100644 test cases/objc/3 objc args/prog.m create mode 100644 test cases/objc/4 c++ project objc subproject/master.cpp create mode 100644 test cases/objc/4 c++ project objc subproject/meson.build create mode 100644 test cases/objc/4 c++ project objc subproject/subprojects/foo/foo.m create mode 100644 test cases/objc/4 c++ project objc subproject/subprojects/foo/meson.build create mode 100644 test cases/objcpp/1 simple/meson.build create mode 100644 test cases/objcpp/1 simple/prog.mm create mode 100644 test cases/objcpp/2 objc++ args/meson.build create mode 100644 test cases/objcpp/2 objc++ args/prog.mm create mode 100644 test cases/osx/1 basic/main.c create mode 100644 test cases/osx/1 basic/meson.build create mode 100644 test cases/osx/2 library versions/CMakeLists.txt create mode 100644 test cases/osx/2 library versions/exe.orig.c create mode 100644 test cases/osx/2 library versions/lib.c create mode 100644 test cases/osx/2 library versions/meson.build create mode 100644 test cases/osx/2 library versions/require_pkgconfig.py create mode 100644 test cases/osx/2 library versions/test.json create mode 100644 test cases/osx/3 has function xcode8/meson.build create mode 100644 test cases/osx/4 framework/meson.build create mode 100644 test cases/osx/4 framework/prog.c create mode 100644 test cases/osx/4 framework/stat.c create mode 100644 test cases/osx/4 framework/test.json create mode 100644 test cases/osx/4 framework/xcode-frameworks.png create mode 100644 test cases/osx/5 extra frameworks/meson.build create mode 100644 test cases/osx/5 extra frameworks/prog.c create mode 100644 test cases/osx/5 extra frameworks/stat.c create mode 100644 test cases/osx/5 extra frameworks/test.json create mode 100644 test cases/osx/6 multiframework/main.m create mode 100644 test cases/osx/6 multiframework/meson.build create mode 100644 test cases/osx/7 bitcode/libbar.mm create mode 100644 test cases/osx/7 bitcode/libfile.c create mode 100644 test cases/osx/7 bitcode/libfoo.m create mode 100644 test cases/osx/7 bitcode/meson.build create mode 100644 test cases/osx/7 bitcode/vis.h create mode 100644 test cases/osx/8 pie/main.c create mode 100644 test cases/osx/8 pie/meson.build create mode 100644 test cases/python/1 basic/gluon/__init__.py create mode 100644 test cases/python/1 basic/gluon/gluonator.py create mode 100644 test cases/python/1 basic/meson.build create mode 100755 test cases/python/1 basic/prog.py create mode 100644 test cases/python/1 basic/subdir/meson.build create mode 100755 test cases/python/1 basic/subdir/subprog.py create mode 100755 test cases/python/2 extmodule/blaster.py.in create mode 100644 test cases/python/2 extmodule/ext/meson.build create mode 100644 test cases/python/2 extmodule/ext/nested/meson.build create mode 100644 test cases/python/2 extmodule/ext/tachyon_module.c create mode 100644 test cases/python/2 extmodule/ext/wrongdir/meson.build create mode 100644 test cases/python/2 extmodule/meson.build create mode 100644 test cases/python/2 extmodule/test.json create mode 100755 test cases/python/3 cython/cytest.py create mode 100644 test cases/python/3 cython/libdir/cstorer.pxd create mode 100644 test cases/python/3 cython/libdir/meson.build create mode 100644 test cases/python/3 cython/libdir/storer.c create mode 100644 test cases/python/3 cython/libdir/storer.h create mode 100644 test cases/python/3 cython/libdir/storer.pyx create mode 100644 test cases/python/3 cython/meson.build create mode 100644 test cases/python/4 custom target depends extmodule/blaster.py create mode 100644 test cases/python/4 custom target depends extmodule/ext/lib/meson-tachyonlib.c create mode 100644 test cases/python/4 custom target depends extmodule/ext/lib/meson-tachyonlib.h create mode 100644 test cases/python/4 custom target depends extmodule/ext/lib/meson.build create mode 100644 test cases/python/4 custom target depends extmodule/ext/meson.build create mode 100644 test cases/python/4 custom target depends extmodule/ext/tachyon_module.c create mode 100644 test cases/python/4 custom target depends extmodule/meson.build create mode 100644 test cases/python/5 modules kwarg/meson.build create mode 100644 test cases/python/6 failing subproject/meson.build create mode 100644 test cases/python/6 failing subproject/subprojects/bar/meson.build create mode 100644 test cases/python/7 install path/meson.build create mode 100644 test cases/python/7 install path/structured/alpha/one.py create mode 100644 test cases/python/7 install path/structured/alpha/three.py create mode 100644 test cases/python/7 install path/structured/alpha/two.py create mode 100644 test cases/python/7 install path/structured/beta/one.py create mode 100644 test cases/python/7 install path/structured/meson.build create mode 100644 test cases/python/7 install path/structured/one.py create mode 100644 test cases/python/7 install path/structured/two.py create mode 100644 test cases/python/7 install path/test.json create mode 100644 test cases/python/7 install path/test.py create mode 100755 test cases/python/8 different python versions/blaster.py create mode 100644 test cases/python/8 different python versions/ext/meson.build create mode 100644 test cases/python/8 different python versions/ext/tachyon_module.c create mode 100644 test cases/python/8 different python versions/meson.build create mode 100644 test cases/python/8 different python versions/meson_options.txt create mode 100644 test cases/python/8 different python versions/test.json create mode 100644 test cases/python3/1 basic/gluon/__init__.py create mode 100644 test cases/python3/1 basic/gluon/gluonator.py create mode 100644 test cases/python3/1 basic/meson.build create mode 100755 test cases/python3/1 basic/prog.py create mode 100644 test cases/python3/1 basic/subdir/meson.build create mode 100755 test cases/python3/1 basic/subdir/subprog.py create mode 100755 test cases/python3/2 extmodule/blaster.py create mode 100644 test cases/python3/2 extmodule/ext/meson.build create mode 100644 test cases/python3/2 extmodule/ext/tachyon_module.c create mode 100644 test cases/python3/2 extmodule/meson.build create mode 100755 test cases/python3/3 cython/cytest.py create mode 100644 test cases/python3/3 cython/libdir/cstorer.pxd create mode 100644 test cases/python3/3 cython/libdir/meson.build create mode 100644 test cases/python3/3 cython/libdir/storer.c create mode 100644 test cases/python3/3 cython/libdir/storer.h create mode 100644 test cases/python3/3 cython/libdir/storer.pyx create mode 100644 test cases/python3/3 cython/meson.build create mode 100644 test cases/python3/4 custom target depends extmodule/blaster.py create mode 100644 test cases/python3/4 custom target depends extmodule/ext/lib/meson-tachyonlib.c create mode 100644 test cases/python3/4 custom target depends extmodule/ext/lib/meson-tachyonlib.h create mode 100644 test cases/python3/4 custom target depends extmodule/ext/lib/meson.build create mode 100644 test cases/python3/4 custom target depends extmodule/ext/meson.build create mode 100644 test cases/python3/4 custom target depends extmodule/ext/tachyon_module.c create mode 100644 test cases/python3/4 custom target depends extmodule/meson.build create mode 100644 test cases/rewrite/1 basic/addSrc.json create mode 100644 test cases/rewrite/1 basic/addTgt.json create mode 100644 test cases/rewrite/1 basic/info.json create mode 100644 test cases/rewrite/1 basic/meson.build create mode 100644 test cases/rewrite/1 basic/rmSrc.json create mode 100644 test cases/rewrite/1 basic/rmTgt.json create mode 100644 test cases/rewrite/2 subdirs/addSrc.json create mode 100644 test cases/rewrite/2 subdirs/addTgt.json create mode 100644 test cases/rewrite/2 subdirs/info.json create mode 100644 test cases/rewrite/2 subdirs/meson.build create mode 100644 test cases/rewrite/2 subdirs/rmTgt.json create mode 100644 test cases/rewrite/2 subdirs/sub1/meson.build create mode 100644 test cases/rewrite/2 subdirs/sub2/meson.build create mode 100644 test cases/rewrite/3 kwargs/add.json create mode 100644 test cases/rewrite/3 kwargs/defopts_delete.json create mode 100644 test cases/rewrite/3 kwargs/defopts_set.json create mode 100644 test cases/rewrite/3 kwargs/delete.json create mode 100644 test cases/rewrite/3 kwargs/info.json create mode 100644 test cases/rewrite/3 kwargs/meson.build create mode 100644 test cases/rewrite/3 kwargs/remove.json create mode 100644 test cases/rewrite/3 kwargs/remove_regex.json create mode 100644 test cases/rewrite/3 kwargs/set.json create mode 100644 test cases/rewrite/4 same name targets/addSrc.json create mode 100644 test cases/rewrite/4 same name targets/info.json create mode 100644 test cases/rewrite/4 same name targets/meson.build create mode 100644 test cases/rewrite/4 same name targets/sub1/meson.build create mode 100644 test cases/rewrite/5 sorting/meson.build create mode 100644 test cases/rewrite/6 extra_files/addExtraFiles.json create mode 100644 test cases/rewrite/6 extra_files/info.json create mode 100644 test cases/rewrite/6 extra_files/meson.build create mode 100644 test cases/rewrite/6 extra_files/rmExtraFiles.json create mode 100644 test cases/rust/1 basic/clippy.toml create mode 100644 test cases/rust/1 basic/meson.build create mode 100644 test cases/rust/1 basic/prog.rs create mode 100644 test cases/rust/1 basic/subdir/meson.build create mode 100644 test cases/rust/1 basic/subdir/prog.rs create mode 100644 test cases/rust/1 basic/test.json create mode 100644 test cases/rust/10 language stds/2015.rs create mode 100644 test cases/rust/10 language stds/2018.rs create mode 100644 test cases/rust/10 language stds/meson.build create mode 100644 test cases/rust/11 generated main/gen.py create mode 100644 test cases/rust/11 generated main/generated_lib_main.rs create mode 100644 test cases/rust/11 generated main/meson.build create mode 100644 test cases/rust/11 generated main/sub/meson.build create mode 100644 test cases/rust/12 bindgen/dependencies/clib2.c create mode 100644 test cases/rust/12 bindgen/dependencies/external_dep.h create mode 100644 test cases/rust/12 bindgen/dependencies/internal_dep.h create mode 100644 test cases/rust/12 bindgen/dependencies/internal_main.rs create mode 100644 test cases/rust/12 bindgen/dependencies/meson.build create mode 100644 test cases/rust/12 bindgen/include/other.h create mode 100644 test cases/rust/12 bindgen/meson.build create mode 100644 test cases/rust/12 bindgen/src/gen_header.py create mode 100644 test cases/rust/12 bindgen/src/header.h create mode 100644 test cases/rust/12 bindgen/src/main.rs create mode 100644 test cases/rust/12 bindgen/src/main2.rs create mode 100644 test cases/rust/12 bindgen/src/source.c create mode 100644 test cases/rust/12 bindgen/sub/meson.build create mode 100644 test cases/rust/12 bindgen/test.json create mode 100644 test cases/rust/13 external c dependencies/c_accessing_zlib.c create mode 100644 test cases/rust/13 external c dependencies/meson.build create mode 100644 test cases/rust/13 external c dependencies/meson_options.txt create mode 100644 test cases/rust/13 external c dependencies/prog.rs create mode 100644 test cases/rust/13 external c dependencies/test.json create mode 100644 test cases/rust/14 external libm/meson.build create mode 100644 test cases/rust/14 external libm/meson_options.txt create mode 100644 test cases/rust/14 external libm/prog.rs create mode 100644 test cases/rust/14 external libm/rs_math.rs create mode 100644 test cases/rust/14 external libm/test.json create mode 100644 test cases/rust/15 polyglot sharedlib/adder.c create mode 100644 test cases/rust/15 polyglot sharedlib/adder.h create mode 100644 test cases/rust/15 polyglot sharedlib/adder.rs create mode 100644 test cases/rust/15 polyglot sharedlib/addertest.c create mode 100644 test cases/rust/15 polyglot sharedlib/meson.build create mode 100644 test cases/rust/16 internal c dependencies/lib.c create mode 100644 test cases/rust/16 internal c dependencies/lib.h create mode 100644 test cases/rust/16 internal c dependencies/main.rs create mode 100644 test cases/rust/16 internal c dependencies/meson.build create mode 100755 test cases/rust/16 internal c dependencies/test.py create mode 100644 test cases/rust/17 staticlib link staticlib/branch.rs create mode 100644 test cases/rust/17 staticlib link staticlib/leaf.rs create mode 100644 test cases/rust/17 staticlib link staticlib/meson.build create mode 100644 test cases/rust/17 staticlib link staticlib/prog.c create mode 100644 test cases/rust/17 staticlib link staticlib/test.json create mode 100644 test cases/rust/18 proc-macro/meson.build create mode 100644 test cases/rust/18 proc-macro/proc.rs create mode 100644 test cases/rust/18 proc-macro/use.rs create mode 100755 test cases/rust/19 structured sources/gen.py create mode 100644 test cases/rust/19 structured sources/main-gen-copy.rs create mode 100644 test cases/rust/19 structured sources/meson.build create mode 100755 test cases/rust/19 structured sources/no_copy_test.py create mode 100644 test cases/rust/19 structured sources/priv.rs create mode 100644 test cases/rust/19 structured sources/src/foo.rs.in create mode 100644 test cases/rust/19 structured sources/src/main.rs create mode 100644 test cases/rust/19 structured sources/src2/foo/mod.rs create mode 100644 test cases/rust/19 structured sources/src2/main-unique.rs create mode 100644 test cases/rust/19 structured sources/src2/meson.build create mode 100644 test cases/rust/2 sharedlib/meson.build create mode 100644 test cases/rust/2 sharedlib/prog.rs create mode 100644 test cases/rust/2 sharedlib/stuff.rs create mode 100644 test cases/rust/2 sharedlib/test.json create mode 100644 test cases/rust/2 sharedlib/value.c create mode 100644 test cases/rust/3 staticlib/meson.build create mode 100644 test cases/rust/3 staticlib/other.rs create mode 100644 test cases/rust/3 staticlib/prog.rs create mode 100644 test cases/rust/3 staticlib/stuff.rs create mode 100644 test cases/rust/3 staticlib/test.json create mode 100644 test cases/rust/3 staticlib/value.c create mode 100644 test cases/rust/4 polyglot/meson.build create mode 100644 test cases/rust/4 polyglot/prog.c create mode 100644 test cases/rust/4 polyglot/stuff.rs create mode 100644 test cases/rust/4 polyglot/test.json create mode 100644 test cases/rust/5 polyglot static/clib.c create mode 100644 test cases/rust/5 polyglot static/meson.build create mode 100644 test cases/rust/5 polyglot static/prog.c create mode 100644 test cases/rust/5 polyglot static/stuff.rs create mode 100644 test cases/rust/5 polyglot static/test.json create mode 100644 test cases/rust/6 named staticlib/meson.build create mode 100644 test cases/rust/6 named staticlib/prog.rs create mode 100644 test cases/rust/6 named staticlib/stuff.rs create mode 100644 test cases/rust/6 named staticlib/test.json create mode 100644 test cases/rust/7 private crate collision/meson.build create mode 100644 test cases/rust/7 private crate collision/prog.rs create mode 100644 test cases/rust/7 private crate collision/rand.rs create mode 100644 test cases/rust/7 private crate collision/test.json create mode 100644 test cases/rust/8 many files/foo.rs create mode 100644 test cases/rust/8 many files/main.rs create mode 100644 test cases/rust/8 many files/meson.build create mode 100644 test cases/rust/9 unit tests/meson.build create mode 100644 test cases/rust/9 unit tests/test.rs create mode 100644 test cases/rust/9 unit tests/test2.rs create mode 100644 test cases/swift/1 exe/main.swift create mode 100644 test cases/swift/1 exe/meson.build create mode 100644 test cases/swift/2 multifile/libfile.swift create mode 100644 test cases/swift/2 multifile/main.swift create mode 100644 test cases/swift/2 multifile/meson.build create mode 100644 test cases/swift/3 library/exe/main.swift create mode 100644 test cases/swift/3 library/exe/meson.build create mode 100644 test cases/swift/3 library/lib/datasource.swift create mode 100644 test cases/swift/3 library/lib/meson.build create mode 100644 test cases/swift/3 library/lib/othersource.swift create mode 100644 test cases/swift/3 library/meson.build create mode 100644 test cases/swift/4 generate/gen/main.swift create mode 100644 test cases/swift/4 generate/gen/meson.build create mode 100644 test cases/swift/4 generate/meson.build create mode 100644 test cases/swift/4 generate/user/main.swift create mode 100644 test cases/swift/4 generate/user/meson.build create mode 100644 test cases/swift/5 mixed/main.swift create mode 100644 test cases/swift/5 mixed/meson.build create mode 100644 test cases/swift/5 mixed/mylib.c create mode 100644 test cases/swift/5 mixed/mylib.h create mode 100644 test cases/swift/6 modulemap/main.swift create mode 100644 test cases/swift/6 modulemap/meson.build create mode 100644 test cases/swift/6 modulemap/module.modulemap create mode 100644 test cases/swift/6 modulemap/mylib.c create mode 100644 test cases/swift/6 modulemap/mylib.h create mode 100644 test cases/swift/7 modulemap subdir/main.swift create mode 100644 test cases/swift/7 modulemap subdir/meson.build create mode 100644 test cases/swift/7 modulemap subdir/mylib/meson.build create mode 100644 test cases/swift/7 modulemap subdir/mylib/module.modulemap create mode 100644 test cases/swift/7 modulemap subdir/mylib/mylib.c create mode 100644 test cases/swift/7 modulemap subdir/mylib/mylib.h create mode 100644 test cases/unit/1 soname/CMakeLists.txt create mode 100644 test cases/unit/1 soname/main.c create mode 100644 test cases/unit/1 soname/meson.build create mode 100644 test cases/unit/1 soname/versioned.c create mode 100644 test cases/unit/10 build_rpath/meson.build create mode 100644 test cases/unit/10 build_rpath/prog.c create mode 100644 test cases/unit/10 build_rpath/prog.cc create mode 100644 test cases/unit/10 build_rpath/sub/meson.build create mode 100644 test cases/unit/10 build_rpath/sub/stuff.c create mode 100755 test cases/unit/100 relative find program/foo.py create mode 100644 test cases/unit/100 relative find program/meson.build create mode 100644 test cases/unit/100 relative find program/subdir/meson.build create mode 100644 test cases/unit/101 rlib linkage/lib2.rs create mode 100644 test cases/unit/101 rlib linkage/main.rs create mode 100644 test cases/unit/101 rlib linkage/meson.build create mode 100644 test cases/unit/102 python without pkgconfig/meson.build create mode 100644 test cases/unit/103 strip/lib.c create mode 100644 test cases/unit/103 strip/meson.build create mode 100644 test cases/unit/104 debug function/meson.build create mode 100644 test cases/unit/105 pkgconfig relocatable with absolute path/meson.build create mode 100644 test cases/unit/106 subproject symlink/cp.py create mode 100644 test cases/unit/106 subproject symlink/main.c create mode 100644 test cases/unit/106 subproject symlink/meson.build create mode 100644 test cases/unit/106 subproject symlink/symlinked_subproject/datadir/datafile create mode 100644 test cases/unit/106 subproject symlink/symlinked_subproject/datadir/meson.build create mode 100644 test cases/unit/106 subproject symlink/symlinked_subproject/meson.build create mode 100644 test cases/unit/106 subproject symlink/symlinked_subproject/src.c create mode 100644 test cases/unit/107 new subproject on reconfigure/meson.build create mode 100644 test cases/unit/107 new subproject on reconfigure/meson_options.txt create mode 100644 test cases/unit/107 new subproject on reconfigure/subprojects/foo/foo.c create mode 100644 test cases/unit/107 new subproject on reconfigure/subprojects/foo/meson.build create mode 100644 test cases/unit/108 configure same noop/meson.build create mode 100644 test cases/unit/108 configure same noop/meson_options.txt create mode 100644 test cases/unit/109 freeze/freeze.c create mode 100644 test cases/unit/109 freeze/meson.build create mode 100644 test cases/unit/11 cross prog/meson.build create mode 100755 test cases/unit/11 cross prog/some_cross_tool.py create mode 100755 test cases/unit/11 cross prog/sometool.py create mode 100644 test cases/unit/110 classpath/com/mesonbuild/Simple.java create mode 100644 test cases/unit/110 classpath/meson.build create mode 100644 test cases/unit/12 promote/meson.build create mode 100644 test cases/unit/12 promote/subprojects/s1/meson.build create mode 100644 test cases/unit/12 promote/subprojects/s1/s1.c create mode 100644 test cases/unit/12 promote/subprojects/s1/subprojects/s3/meson.build create mode 100644 test cases/unit/12 promote/subprojects/s1/subprojects/s3/s3.c create mode 100644 test cases/unit/12 promote/subprojects/s1/subprojects/scommon/meson.build create mode 100644 test cases/unit/12 promote/subprojects/s1/subprojects/scommon/scommon_broken.c create mode 100644 test cases/unit/12 promote/subprojects/s2/meson.build create mode 100644 test cases/unit/12 promote/subprojects/s2/s2.c create mode 100644 test cases/unit/12 promote/subprojects/s2/subprojects/athing.wrap create mode 100644 test cases/unit/12 promote/subprojects/s2/subprojects/scommon/meson.build create mode 100644 test cases/unit/12 promote/subprojects/s2/subprojects/scommon/scommon_ok.c create mode 100644 test cases/unit/13 reconfigure/meson.build create mode 100644 test cases/unit/14 testsetup selection/main.c create mode 100644 test cases/unit/14 testsetup selection/meson.build create mode 100644 test cases/unit/14 testsetup selection/subprojects/bar/bar.c create mode 100644 test cases/unit/14 testsetup selection/subprojects/bar/meson.build create mode 100644 test cases/unit/14 testsetup selection/subprojects/foo/foo.c create mode 100644 test cases/unit/14 testsetup selection/subprojects/foo/meson.build create mode 100644 test cases/unit/15 prebuilt object/cp.py create mode 100644 test cases/unit/15 prebuilt object/main.c create mode 100644 test cases/unit/15 prebuilt object/meson.build create mode 100644 test cases/unit/15 prebuilt object/source.c create mode 100644 test cases/unit/16 prebuilt static/libdir/best.c create mode 100644 test cases/unit/16 prebuilt static/libdir/best.h create mode 100644 test cases/unit/16 prebuilt static/libdir/meson.build create mode 100644 test cases/unit/16 prebuilt static/main.c create mode 100644 test cases/unit/16 prebuilt static/meson.build create mode 100644 test cases/unit/17 prebuilt shared/alexandria.c create mode 100644 test cases/unit/17 prebuilt shared/alexandria.h create mode 100644 test cases/unit/17 prebuilt shared/another_visitor.c create mode 100644 test cases/unit/17 prebuilt shared/meson.build create mode 100644 test cases/unit/17 prebuilt shared/meson_options.txt create mode 100644 test cases/unit/17 prebuilt shared/patron.c create mode 100644 test cases/unit/17 prebuilt shared/rejected.c create mode 100644 test cases/unit/17 prebuilt shared/rejected.h create mode 100644 test cases/unit/17 prebuilt shared/rejected_main.c create mode 100644 test cases/unit/18 pkgconfig static/foo.c create mode 100644 test cases/unit/18 pkgconfig static/foo.pc.in create mode 100644 test cases/unit/18 pkgconfig static/include/foo.h create mode 100644 test cases/unit/18 pkgconfig static/main.c create mode 100644 test cases/unit/18 pkgconfig static/meson.build create mode 100644 test cases/unit/19 array option/meson.build create mode 100644 test cases/unit/19 array option/meson_options.txt create mode 100644 test cases/unit/2 testsetups/buggy.c create mode 100755 test cases/unit/2 testsetups/envcheck.py create mode 100644 test cases/unit/2 testsetups/impl.c create mode 100644 test cases/unit/2 testsetups/impl.h create mode 100644 test cases/unit/2 testsetups/meson.build create mode 100644 test cases/unit/20 subproj dep variables/meson.build create mode 100644 test cases/unit/20 subproj dep variables/subprojects/failingsubproj/meson.build create mode 100644 test cases/unit/20 subproj dep variables/subprojects/nestedsubproj/meson.build create mode 100644 test cases/unit/20 subproj dep variables/subprojects/nestedsubproj/subprojects/subsubproject.wrap create mode 100644 test cases/unit/20 subproj dep variables/subprojects/somesubproj/meson.build create mode 100644 test cases/unit/21 exit status/meson.build create mode 100644 test cases/unit/22 warning location/a.c create mode 100644 test cases/unit/22 warning location/b.c create mode 100644 test cases/unit/22 warning location/conf.in create mode 100644 test cases/unit/22 warning location/main.c create mode 100644 test cases/unit/22 warning location/meson.build create mode 100644 test cases/unit/22 warning location/sub/c.c create mode 100644 test cases/unit/22 warning location/sub/d.c create mode 100644 test cases/unit/22 warning location/sub/meson.build create mode 100644 test cases/unit/22 warning location/sub/sub.c create mode 100644 test cases/unit/23 unfound pkgconfig/meson.build create mode 100644 test cases/unit/23 unfound pkgconfig/some.c create mode 100644 test cases/unit/24 compiler run_command/meson.build create mode 100644 test cases/unit/25 non-permitted kwargs/meson.build create mode 100644 test cases/unit/26 install umask/datafile.cat create mode 100644 test cases/unit/26 install umask/meson.build create mode 100644 test cases/unit/26 install umask/myinstall.py create mode 100644 test cases/unit/26 install umask/prog.1 create mode 100644 test cases/unit/26 install umask/prog.c create mode 100644 test cases/unit/26 install umask/sample.h create mode 100644 test cases/unit/26 install umask/subdir/datafile.dog create mode 100755 test cases/unit/26 install umask/subdir/sayhello create mode 100644 test cases/unit/27 pkgconfig usage/dependee/meson.build create mode 100644 test cases/unit/27 pkgconfig usage/dependee/pkguser.c create mode 100644 test cases/unit/27 pkgconfig usage/dependency/meson.build create mode 100644 test cases/unit/27 pkgconfig usage/dependency/pkgdep.c create mode 100644 test cases/unit/27 pkgconfig usage/dependency/pkgdep.h create mode 100644 test cases/unit/27 pkgconfig usage/dependency/privatelib.c create mode 100644 test cases/unit/28 ndebug if-release/main.c create mode 100644 test cases/unit/28 ndebug if-release/meson.build create mode 100644 test cases/unit/29 guessed linker dependencies/exe/app.c create mode 100644 test cases/unit/29 guessed linker dependencies/exe/meson.build create mode 100644 test cases/unit/29 guessed linker dependencies/lib/lib.c create mode 100644 test cases/unit/29 guessed linker dependencies/lib/meson.build create mode 100644 test cases/unit/29 guessed linker dependencies/lib/meson_options.txt create mode 100644 test cases/unit/3 subproject defaults/meson.build create mode 100644 test cases/unit/3 subproject defaults/meson_options.txt create mode 100644 test cases/unit/3 subproject defaults/subprojects/foob/meson.build create mode 100644 test cases/unit/3 subproject defaults/subprojects/foob/meson_options.txt create mode 100644 test cases/unit/30 shared_mod linking/libfile.c create mode 100644 test cases/unit/30 shared_mod linking/main.c create mode 100644 test cases/unit/30 shared_mod linking/meson.build create mode 100644 test cases/unit/31 forcefallback/meson.build create mode 100644 test cases/unit/31 forcefallback/subprojects/notzlib/meson.build create mode 100644 test cases/unit/31 forcefallback/subprojects/notzlib/notzlib.c create mode 100644 test cases/unit/31 forcefallback/subprojects/notzlib/notzlib.h create mode 100644 test cases/unit/31 forcefallback/test_not_zlib.c create mode 100644 test cases/unit/32 pkgconfig use libraries/app/app.c create mode 100644 test cases/unit/32 pkgconfig use libraries/app/meson.build create mode 100644 test cases/unit/32 pkgconfig use libraries/lib/liba.c create mode 100644 test cases/unit/32 pkgconfig use libraries/lib/libb.c create mode 100644 test cases/unit/32 pkgconfig use libraries/lib/meson.build create mode 100644 test cases/unit/33 cross file overrides always args/meson.build create mode 100644 test cases/unit/33 cross file overrides always args/test.c create mode 100644 test cases/unit/33 cross file overrides always args/ubuntu-armhf-overrides.txt create mode 100644 test cases/unit/34 command line/meson.build create mode 100644 test cases/unit/34 command line/meson_options.txt create mode 100644 test cases/unit/34 command line/subprojects/subp/meson.build create mode 100644 test cases/unit/34 command line/subprojects/subp/meson_options.txt create mode 100644 test cases/unit/35 dist script/meson.build create mode 100644 test cases/unit/35 dist script/prog.c create mode 100755 test cases/unit/35 dist script/replacer.py create mode 100644 test cases/unit/35 dist script/subprojects/sub/dist-script.py create mode 100644 test cases/unit/35 dist script/subprojects/sub/meson.build create mode 100644 test cases/unit/35 dist script/subprojects/sub/meson_options.txt create mode 100644 test cases/unit/35 dist script/subprojects/sub/prog.c create mode 100644 test cases/unit/36 exe_wrapper behaviour/broken-cross.txt create mode 100644 test cases/unit/36 exe_wrapper behaviour/meson.build create mode 100644 test cases/unit/36 exe_wrapper behaviour/meson_options.txt create mode 100644 test cases/unit/36 exe_wrapper behaviour/prog.c create mode 100644 test cases/unit/37 mixed command line args/meson.build create mode 100644 test cases/unit/37 mixed command line args/meson_options.txt create mode 100644 test cases/unit/38 pkgconfig format/meson.build create mode 100644 test cases/unit/38 pkgconfig format/somelib.c create mode 100644 test cases/unit/38 pkgconfig format/someret.c create mode 100644 test cases/unit/39 external, internal library rpath/built library/bar.c create mode 100644 test cases/unit/39 external, internal library rpath/built library/meson.build create mode 100644 test cases/unit/39 external, internal library rpath/built library/meson_options.txt create mode 100644 test cases/unit/39 external, internal library rpath/built library/prog.c create mode 100644 test cases/unit/39 external, internal library rpath/external library/bar.c create mode 100644 test cases/unit/39 external, internal library rpath/external library/faa.c create mode 100644 test cases/unit/39 external, internal library rpath/external library/foo.c create mode 100644 test cases/unit/39 external, internal library rpath/external library/meson.build create mode 100644 test cases/unit/4 suite selection/failing_test.c create mode 100644 test cases/unit/4 suite selection/meson.build create mode 100644 test cases/unit/4 suite selection/subprojects/subprjfail/failing_test.c create mode 100644 test cases/unit/4 suite selection/subprojects/subprjfail/meson.build create mode 100644 test cases/unit/4 suite selection/subprojects/subprjmix/failing_test.c create mode 100644 test cases/unit/4 suite selection/subprojects/subprjmix/meson.build create mode 100644 test cases/unit/4 suite selection/subprojects/subprjmix/successful_test.c create mode 100644 test cases/unit/4 suite selection/subprojects/subprjsucc/meson.build create mode 100644 test cases/unit/4 suite selection/subprojects/subprjsucc/successful_test.c create mode 100644 test cases/unit/4 suite selection/successful_test.c create mode 100644 test cases/unit/40 featurenew subprojects/meson.build create mode 100644 test cases/unit/40 featurenew subprojects/subprojects/bar/meson.build create mode 100644 test cases/unit/40 featurenew subprojects/subprojects/baz/meson.build create mode 100644 test cases/unit/40 featurenew subprojects/subprojects/foo/meson.build create mode 100644 test cases/unit/41 rpath order/meson.build create mode 100644 test cases/unit/41 rpath order/myexe.c create mode 100644 test cases/unit/41 rpath order/subprojects/sub1/lib.c create mode 100644 test cases/unit/41 rpath order/subprojects/sub1/meson.build create mode 100644 test cases/unit/41 rpath order/subprojects/sub2/lib.c create mode 100644 test cases/unit/41 rpath order/subprojects/sub2/meson.build create mode 100644 test cases/unit/42 dep order/lib1.c create mode 100644 test cases/unit/42 dep order/lib2.c create mode 100644 test cases/unit/42 dep order/meson.build create mode 100644 test cases/unit/42 dep order/myexe.c create mode 100644 test cases/unit/43 promote wrap/meson.build create mode 100644 test cases/unit/43 promote wrap/subprojects/s1/meson.build create mode 100644 test cases/unit/43 promote wrap/subprojects/s1/subprojects/ambiguous/meson.build create mode 100644 test cases/unit/43 promote wrap/subprojects/s2/meson.build create mode 100644 test cases/unit/43 promote wrap/subprojects/s2/subprojects/ambiguous.wrap create mode 100644 test cases/unit/44 vscpp17/main.cpp create mode 100644 test cases/unit/44 vscpp17/meson.build create mode 100755 test cases/unit/45 native dep pkgconfig var/cross_pkgconfig.py create mode 100644 test cases/unit/45 native dep pkgconfig var/cross_pkgconfig/dep_tester.pc create mode 100644 test cases/unit/45 native dep pkgconfig var/meson.build create mode 100644 test cases/unit/45 native dep pkgconfig var/meson_options.txt create mode 100644 test cases/unit/45 native dep pkgconfig var/native_pkgconfig/dep_tester.pc create mode 100644 test cases/unit/46 native file binary/meson.build create mode 100644 test cases/unit/46 native file binary/meson_options.txt create mode 100644 test cases/unit/47 reconfigure/main.c create mode 100644 test cases/unit/47 reconfigure/meson.build create mode 100644 test cases/unit/47 reconfigure/meson_options.txt create mode 100644 test cases/unit/47 reconfigure/subprojects/sub1/meson.build create mode 100644 test cases/unit/48 testsetup default/envcheck.py create mode 100644 test cases/unit/48 testsetup default/meson.build create mode 100644 test cases/unit/49 pkgconfig csharp library/meson.build create mode 100644 test cases/unit/49 pkgconfig csharp library/somelib.cs create mode 100644 test cases/unit/5 compiler detection/compiler wrapper.py create mode 100644 test cases/unit/5 compiler detection/meson.build create mode 100644 test cases/unit/5 compiler detection/trivial.c create mode 100644 test cases/unit/5 compiler detection/trivial.cc create mode 100644 test cases/unit/5 compiler detection/trivial.m create mode 100644 test cases/unit/5 compiler detection/trivial.mm create mode 100644 test cases/unit/50 noncross options/meson.build create mode 100644 test cases/unit/50 noncross options/prog.c create mode 100644 test cases/unit/50 noncross options/ylib.pc create mode 100644 test cases/unit/51 ldflagdedup/bob.c create mode 100644 test cases/unit/51 ldflagdedup/meson.build create mode 100644 test cases/unit/51 ldflagdedup/prog.c create mode 100644 test cases/unit/52 pkgconfig static link order/dummy.c create mode 100644 test cases/unit/52 pkgconfig static link order/meson.build create mode 100644 test cases/unit/53 clang-format/.clang-format create mode 100644 test cases/unit/53 clang-format/dummydir.h/dummy.dat create mode 100644 test cases/unit/53 clang-format/header_expected_h create mode 100644 test cases/unit/53 clang-format/header_orig_h create mode 100644 test cases/unit/53 clang-format/meson.build create mode 100644 test cases/unit/53 clang-format/prog_expected_c create mode 100644 test cases/unit/53 clang-format/prog_orig_c create mode 100644 test cases/unit/54 introspect buildoptions/subprojects/projectBad/meson.build create mode 100644 test cases/unit/54 introspect buildoptions/subprojects/projectBad/meson_options.txt create mode 100644 test cases/unit/55 dedup compiler libs/app/app.c create mode 100644 test cases/unit/55 dedup compiler libs/app/meson.build create mode 100644 test cases/unit/55 dedup compiler libs/liba/liba.c create mode 100644 test cases/unit/55 dedup compiler libs/liba/liba.h create mode 100644 test cases/unit/55 dedup compiler libs/liba/meson.build create mode 100644 test cases/unit/55 dedup compiler libs/libb/libb.c create mode 100644 test cases/unit/55 dedup compiler libs/libb/libb.h create mode 100644 test cases/unit/55 dedup compiler libs/libb/meson.build create mode 100644 test cases/unit/55 dedup compiler libs/meson.build create mode 100644 test cases/unit/56 introspection/cp.py create mode 100644 test cases/unit/56 introspection/meson.build create mode 100644 test cases/unit/56 introspection/meson_options.txt create mode 100644 test cases/unit/56 introspection/sharedlib/meson.build create mode 100644 test cases/unit/56 introspection/sharedlib/shared.cpp create mode 100644 test cases/unit/56 introspection/sharedlib/shared.hpp create mode 100644 test cases/unit/56 introspection/staticlib/meson.build create mode 100644 test cases/unit/56 introspection/staticlib/static.c create mode 100644 test cases/unit/56 introspection/staticlib/static.h create mode 100644 test cases/unit/56 introspection/t1.cpp create mode 100644 test cases/unit/56 introspection/t2.cpp create mode 100644 test cases/unit/56 introspection/t3.cpp create mode 100644 test cases/unit/57 pkg_config_path option/build_extra_path/totally_made_up_dep.pc create mode 100644 test cases/unit/57 pkg_config_path option/host_extra_path/totally_made_up_dep.pc create mode 100644 test cases/unit/57 pkg_config_path option/meson.build create mode 100644 test cases/unit/58 introspect buildoptions/c_compiler.py create mode 100644 test cases/unit/58 introspect buildoptions/main.c create mode 100644 test cases/unit/58 introspect buildoptions/meson.build create mode 100644 test cases/unit/58 introspect buildoptions/meson_options.txt create mode 100644 test cases/unit/58 introspect buildoptions/subprojects/evilFile.txt create mode 100644 test cases/unit/58 introspect buildoptions/subprojects/projectA/meson.build create mode 100644 test cases/unit/58 introspect buildoptions/subprojects/projectA/meson_options.txt create mode 100644 test cases/unit/58 introspect buildoptions/subprojects/projectBad/meson.build create mode 100644 test cases/unit/58 introspect buildoptions/subprojects/projectBad/meson_options.txt create mode 100644 test cases/unit/59 native file override/crossfile create mode 100644 test cases/unit/59 native file override/crossfile2 create mode 100644 test cases/unit/59 native file override/meson.build create mode 100644 test cases/unit/59 native file override/meson_options.txt create mode 100644 test cases/unit/59 native file override/nativefile create mode 100644 test cases/unit/6 std override/meson.build create mode 100644 test cases/unit/6 std override/prog11.cpp create mode 100644 test cases/unit/6 std override/prog98.cpp create mode 100644 test cases/unit/6 std override/progp.cpp create mode 100755 test cases/unit/60 identity cross/build_wrapper.py create mode 100755 test cases/unit/60 identity cross/host_wrapper.py create mode 100644 test cases/unit/60 identity cross/meson.build create mode 100644 test cases/unit/60 identity cross/stuff.h create mode 100644 test cases/unit/61 pkgconfig relative paths/pkgconfig/librelativepath.pc create mode 100644 test cases/unit/62 cmake_prefix_path/meson.build create mode 100644 test cases/unit/62 cmake_prefix_path/prefix/lib/cmake/mesontest/mesontest-config.cmake create mode 100644 test cases/unit/63 cmake parser/meson.build create mode 100644 test cases/unit/63 cmake parser/prefix/lib/cmake/mesontest/mesontest-config.cmake create mode 100644 test cases/unit/64 alias target/main.c create mode 100644 test cases/unit/64 alias target/meson.build create mode 100644 test cases/unit/64 alias target/subdir/meson.build create mode 100644 test cases/unit/65 static archive stripping/app/appA.c create mode 100644 test cases/unit/65 static archive stripping/app/appB.c create mode 100644 test cases/unit/65 static archive stripping/app/meson.build create mode 100644 test cases/unit/65 static archive stripping/lib/libA.c create mode 100644 test cases/unit/65 static archive stripping/lib/libA.h create mode 100644 test cases/unit/65 static archive stripping/lib/libB.c create mode 100644 test cases/unit/65 static archive stripping/lib/libB.h create mode 100644 test cases/unit/65 static archive stripping/lib/meson.build create mode 100644 test cases/unit/66 static link/lib/func1.c create mode 100644 test cases/unit/66 static link/lib/func10.c create mode 100644 test cases/unit/66 static link/lib/func11.c create mode 100644 test cases/unit/66 static link/lib/func12.c create mode 100644 test cases/unit/66 static link/lib/func14.c create mode 100644 test cases/unit/66 static link/lib/func15.c create mode 100644 test cases/unit/66 static link/lib/func16.c create mode 100644 test cases/unit/66 static link/lib/func17.c create mode 100644 test cases/unit/66 static link/lib/func18.c create mode 100644 test cases/unit/66 static link/lib/func19.c create mode 100644 test cases/unit/66 static link/lib/func2.c create mode 100644 test cases/unit/66 static link/lib/func3.c create mode 100644 test cases/unit/66 static link/lib/func4.c create mode 100644 test cases/unit/66 static link/lib/func5.c create mode 100644 test cases/unit/66 static link/lib/func6.c create mode 100644 test cases/unit/66 static link/lib/func7.c create mode 100644 test cases/unit/66 static link/lib/func8.c create mode 100644 test cases/unit/66 static link/lib/func9.c create mode 100644 test cases/unit/66 static link/lib/meson.build create mode 100644 test cases/unit/66 static link/meson.build create mode 100644 test cases/unit/66 static link/test1.c create mode 100644 test cases/unit/66 static link/test2.c create mode 100644 test cases/unit/66 static link/test3.c create mode 100644 test cases/unit/66 static link/test4.c create mode 100644 test cases/unit/66 static link/test5.c create mode 100644 test cases/unit/67 test env value/meson.build create mode 100755 test cases/unit/67 test env value/test.py create mode 100644 test cases/unit/68 clang-tidy/.clang-tidy create mode 100644 test cases/unit/68 clang-tidy/cttest.cpp create mode 100644 test cases/unit/68 clang-tidy/dummydir.h/dummy.dat create mode 100644 test cases/unit/68 clang-tidy/meson.build create mode 100644 test cases/unit/69 cross/crossfile.in create mode 100644 test cases/unit/69 cross/meson.build create mode 100644 test cases/unit/69 cross/meson_options.txt create mode 100644 test cases/unit/7 run installed/foo/foo.c create mode 100644 test cases/unit/7 run installed/foo/meson.build create mode 100644 test cases/unit/7 run installed/meson.build create mode 100644 test cases/unit/7 run installed/prog.c create mode 100755 test cases/unit/70 cross test passed/exewrapper.py create mode 100644 test cases/unit/70 cross test passed/meson.build create mode 100644 test cases/unit/70 cross test passed/meson_options.txt create mode 100644 test cases/unit/70 cross test passed/script.py create mode 100644 test cases/unit/70 cross test passed/src/main.c create mode 100644 test cases/unit/71 summary/meson.build create mode 100644 test cases/unit/71 summary/meson_options.txt create mode 100644 test cases/unit/71 summary/subprojects/sub/meson.build create mode 100644 test cases/unit/71 summary/subprojects/sub2/meson.build create mode 100644 test cases/unit/71 summary/subprojects/sub2/subprojects/subsub/meson.build create mode 100644 test cases/unit/72 wrap file url/meson.build create mode 100644 test cases/unit/72 wrap file url/subprojects/foo-patch.tar.xz create mode 100644 test cases/unit/72 wrap file url/subprojects/foo.tar.xz create mode 100644 test cases/unit/73 dep files/foo.c create mode 100644 test cases/unit/73 dep files/meson.build create mode 100644 test cases/unit/74 pkgconfig prefixes/client/client.c create mode 100644 test cases/unit/74 pkgconfig prefixes/client/meson.build create mode 100644 test cases/unit/74 pkgconfig prefixes/val1/meson.build create mode 100644 test cases/unit/74 pkgconfig prefixes/val1/val1.c create mode 100644 test cases/unit/74 pkgconfig prefixes/val1/val1.h create mode 100644 test cases/unit/74 pkgconfig prefixes/val2/meson.build create mode 100644 test cases/unit/74 pkgconfig prefixes/val2/val2.c create mode 100644 test cases/unit/74 pkgconfig prefixes/val2/val2.h create mode 100644 test cases/unit/75 subdir libdir/meson.build create mode 100644 test cases/unit/75 subdir libdir/subprojects/flub/meson.build create mode 100644 test cases/unit/76 as link whole/bar.c create mode 100644 test cases/unit/76 as link whole/foo.c create mode 100644 test cases/unit/76 as link whole/meson.build create mode 100644 test cases/unit/77 nostdlib/meson.build create mode 100644 test cases/unit/77 nostdlib/prog.c create mode 100644 test cases/unit/77 nostdlib/subprojects/mylibc/libc.c create mode 100644 test cases/unit/77 nostdlib/subprojects/mylibc/meson.build create mode 100644 test cases/unit/77 nostdlib/subprojects/mylibc/stdio.h create mode 100644 test cases/unit/77 nostdlib/subprojects/mylibc/stubstart.s create mode 100644 test cases/unit/78 user options for subproject/.gitignore create mode 100644 test cases/unit/78 user options for subproject/75 user options for subproject/.gitignore create mode 100644 test cases/unit/78 user options for subproject/75 user options for subproject/meson.build create mode 100644 test cases/unit/78 user options for subproject/subprojects/sub/meson.build create mode 100644 test cases/unit/78 user options for subproject/subprojects/sub/meson_options.txt create mode 100644 test cases/unit/79 global-rpath/meson.build create mode 100644 test cases/unit/79 global-rpath/rpathified.cpp create mode 100644 test cases/unit/79 global-rpath/yonder/meson.build create mode 100644 test cases/unit/79 global-rpath/yonder/yonder.cpp create mode 100644 test cases/unit/79 global-rpath/yonder/yonder.h create mode 100644 test cases/unit/8 -L -l order/first.pc create mode 100644 test cases/unit/8 -L -l order/meson.build create mode 100644 test cases/unit/8 -L -l order/prog.c create mode 100644 test cases/unit/8 -L -l order/second.pc create mode 100644 test cases/unit/80 wrap-git/meson.build create mode 100644 test cases/unit/80 wrap-git/subprojects/packagefiles/wrap_git_builddef/meson.build create mode 100644 test cases/unit/80 wrap-git/subprojects/wrap_git_upstream/main.c create mode 100644 test cases/unit/81 meson version compare/meson.build create mode 100644 test cases/unit/81 meson version compare/subprojects/foo/meson.build create mode 100644 test cases/unit/82 cross only introspect/meson.build create mode 100644 test cases/unit/83 change option choices/meson.build create mode 100644 test cases/unit/83 change option choices/meson_options.1.txt create mode 100644 test cases/unit/83 change option choices/meson_options.2.txt create mode 100644 test cases/unit/84 nested subproject regenerate depends/main.c create mode 100644 test cases/unit/84 nested subproject regenerate depends/meson.build create mode 100644 test cases/unit/84 nested subproject regenerate depends/subprojects/sub1/meson.build create mode 100644 test cases/unit/84 nested subproject regenerate depends/subprojects/sub2/CMakeLists.txt create mode 100644 test cases/unit/85 cpp modules/gcc/main.cpp create mode 100644 test cases/unit/85 cpp modules/gcc/meson.build create mode 100644 test cases/unit/85 cpp modules/gcc/src0.cxx create mode 100644 test cases/unit/85 cpp modules/gcc/src1.cxx create mode 100644 test cases/unit/85 cpp modules/gcc/src2.cxx create mode 100644 test cases/unit/85 cpp modules/gcc/src3.cxx create mode 100644 test cases/unit/85 cpp modules/gcc/src4.cxx create mode 100644 test cases/unit/85 cpp modules/gcc/src5.cxx create mode 100644 test cases/unit/85 cpp modules/gcc/src6.cxx create mode 100644 test cases/unit/85 cpp modules/gcc/src7.cxx create mode 100644 test cases/unit/85 cpp modules/gcc/src8.cxx create mode 100644 test cases/unit/85 cpp modules/gcc/src9.cxx create mode 100644 test cases/unit/85 cpp modules/meson.build create mode 100644 test cases/unit/85 cpp modules/vs/main.cpp create mode 100644 test cases/unit/85 cpp modules/vs/meson.build create mode 100644 test cases/unit/85 cpp modules/vs/src0.ixx create mode 100644 test cases/unit/85 cpp modules/vs/src1.ixx create mode 100644 test cases/unit/85 cpp modules/vs/src2.ixx create mode 100644 test cases/unit/85 cpp modules/vs/src3.ixx create mode 100644 test cases/unit/85 cpp modules/vs/src4.ixx create mode 100644 test cases/unit/85 cpp modules/vs/src5.ixx create mode 100644 test cases/unit/85 cpp modules/vs/src6.ixx create mode 100644 test cases/unit/85 cpp modules/vs/src7.ixx create mode 100644 test cases/unit/85 cpp modules/vs/src8.ixx create mode 100644 test cases/unit/85 cpp modules/vs/src9.ixx create mode 100644 test cases/unit/86 prelinking/file1.c create mode 100644 test cases/unit/86 prelinking/file2.c create mode 100644 test cases/unit/86 prelinking/file3.c create mode 100644 test cases/unit/86 prelinking/file4.c create mode 100644 test cases/unit/86 prelinking/main.c create mode 100644 test cases/unit/86 prelinking/meson.build create mode 100644 test cases/unit/86 prelinking/private_header.h create mode 100644 test cases/unit/86 prelinking/public_header.h create mode 100644 test cases/unit/87 run native test/main.c create mode 100644 test cases/unit/87 run native test/meson.build create mode 100644 test cases/unit/88 multiple envvars/meson.build create mode 100644 test cases/unit/88 multiple envvars/prog.c create mode 100644 test cases/unit/88 multiple envvars/prog.cpp create mode 100644 test cases/unit/89 pkgconfig build rpath order/dummy.pc create mode 100644 test cases/unit/89 pkgconfig build rpath order/meson.build create mode 100644 test cases/unit/89 pkgconfig build rpath order/prog.c create mode 100644 test cases/unit/89 pkgconfig build rpath order/prog.cc create mode 100644 test cases/unit/89 pkgconfig build rpath order/sub/meson.build create mode 100644 test cases/unit/89 pkgconfig build rpath order/sub/stuff.c create mode 100644 test cases/unit/9 d dedup/meson.build create mode 100644 test cases/unit/9 d dedup/prog.c create mode 100644 test cases/unit/90 devenv/main.c create mode 100644 test cases/unit/90 devenv/meson.build create mode 100644 test cases/unit/90 devenv/subprojects/sub/foo.c create mode 100644 test cases/unit/90 devenv/subprojects/sub/meson.build create mode 100755 test cases/unit/90 devenv/test-devenv.py create mode 100644 test cases/unit/91 install skip subprojects/foo.c create mode 100644 test cases/unit/91 install skip subprojects/foo.dat create mode 100644 test cases/unit/91 install skip subprojects/foo.h create mode 100644 test cases/unit/91 install skip subprojects/foo/foofile create mode 100644 test cases/unit/91 install skip subprojects/meson.build create mode 100644 test cases/unit/91 install skip subprojects/subprojects/bar/bar.c create mode 100644 test cases/unit/91 install skip subprojects/subprojects/bar/bar.dat create mode 100644 test cases/unit/91 install skip subprojects/subprojects/bar/bar.h create mode 100644 test cases/unit/91 install skip subprojects/subprojects/bar/bar/barfile create mode 100644 test cases/unit/91 install skip subprojects/subprojects/bar/meson.build create mode 100644 test cases/unit/92 new subproject in configured project/meson.build create mode 100644 test cases/unit/92 new subproject in configured project/meson_options.txt create mode 100644 test cases/unit/92 new subproject in configured project/subprojects/sub/foo.c create mode 100644 test cases/unit/92 new subproject in configured project/subprojects/sub/meson.build create mode 100644 test cases/unit/93 clangformat/.clang-format create mode 100644 test cases/unit/93 clangformat/.clang-format-ignore create mode 100644 test cases/unit/93 clangformat/.clang-format-include create mode 100644 test cases/unit/93 clangformat/meson.build create mode 100644 test cases/unit/93 clangformat/not-included/badformat.cpp create mode 100644 test cases/unit/93 clangformat/src/badformat.c create mode 100644 test cases/unit/93 clangformat/src/badformat.cpp create mode 100644 test cases/unit/94 custominc/easytogrepfor/genh.py create mode 100644 test cases/unit/94 custominc/easytogrepfor/meson.build create mode 100644 test cases/unit/94 custominc/helper.c create mode 100644 test cases/unit/94 custominc/meson.build create mode 100644 test cases/unit/94 custominc/prog.c create mode 100644 test cases/unit/94 custominc/prog2.c create mode 100644 test cases/unit/95 implicit force fallback/meson.build create mode 100644 test cases/unit/95 implicit force fallback/subprojects/something/meson.build create mode 100644 test cases/unit/96 compiler.links file arg/meson.build create mode 100644 test cases/unit/96 compiler.links file arg/test.c create mode 100644 test cases/unit/97 link full name/.gitignore create mode 100644 test cases/unit/97 link full name/libtestprovider/meson.build create mode 100644 test cases/unit/97 link full name/libtestprovider/provider.c create mode 100644 test cases/unit/97 link full name/proguser/meson.build create mode 100644 test cases/unit/97 link full name/proguser/receiver.c create mode 100644 test cases/unit/98 install all targets/bar-custom.txt create mode 100644 test cases/unit/98 install all targets/bar-devel.h create mode 100644 test cases/unit/98 install all targets/bar-notag.txt create mode 100644 test cases/unit/98 install all targets/custom_files/data.txt create mode 100644 test cases/unit/98 install all targets/foo.in create mode 100644 test cases/unit/98 install all targets/foo1-devel.h create mode 100644 test cases/unit/98 install all targets/lib.c create mode 100644 test cases/unit/98 install all targets/main.c create mode 100644 test cases/unit/98 install all targets/meson.build create mode 100644 test cases/unit/98 install all targets/script.py create mode 100644 test cases/unit/98 install all targets/subdir/bar2-devel.h create mode 100644 test cases/unit/98 install all targets/subdir/foo2.in create mode 100644 test cases/unit/98 install all targets/subdir/foo3-devel.h create mode 100644 test cases/unit/98 install all targets/subdir/lib.c create mode 100644 test cases/unit/98 install all targets/subdir/main.c create mode 100644 test cases/unit/98 install all targets/subdir/meson.build create mode 100644 test cases/unit/98 install all targets/subdir/script.py create mode 100644 test cases/unit/99 custom target name/file.txt.in create mode 100644 test cases/unit/99 custom target name/meson.build create mode 100644 test cases/unit/99 custom target name/subdir/meson.build create mode 100644 test cases/vala/1 basic/meson.build create mode 100644 test cases/vala/1 basic/prog.vala create mode 100644 test cases/vala/10 mixed sources/c/foo.c create mode 100644 test cases/vala/10 mixed sources/c/meson.build create mode 100644 test cases/vala/10 mixed sources/c/writec.py create mode 100644 test cases/vala/10 mixed sources/meson.build create mode 100644 test cases/vala/10 mixed sources/vala/bar.vala create mode 100644 test cases/vala/11 generated vapi/libbar/bar.c create mode 100644 test cases/vala/11 generated vapi/libbar/bar.h create mode 100644 test cases/vala/11 generated vapi/libbar/meson.build create mode 100644 test cases/vala/11 generated vapi/libfoo/foo.c create mode 100644 test cases/vala/11 generated vapi/libfoo/foo.h create mode 100644 test cases/vala/11 generated vapi/libfoo/foo.metadata create mode 100644 test cases/vala/11 generated vapi/libfoo/meson.build create mode 100644 test cases/vala/11 generated vapi/main.vala create mode 100644 test cases/vala/11 generated vapi/meson.build create mode 100644 test cases/vala/11 generated vapi/test.json create mode 100644 test cases/vala/12 custom output/bar.vala create mode 100644 test cases/vala/12 custom output/foo.vala create mode 100644 test cases/vala/12 custom output/meson.build create mode 100644 test cases/vala/13 find library/meson.build create mode 100644 test cases/vala/13 find library/test.vala create mode 100644 test cases/vala/14 target glib version and gresources/gres/meson.build create mode 100644 test cases/vala/14 target glib version and gresources/gres/test-resources.xml create mode 100644 test cases/vala/14 target glib version and gresources/gres/test.ui create mode 100644 test cases/vala/14 target glib version and gresources/meson.build create mode 100644 test cases/vala/14 target glib version and gresources/test.vala create mode 100644 test cases/vala/15 static vapi in source tree/meson.build create mode 100644 test cases/vala/15 static vapi in source tree/test.vala create mode 100644 test cases/vala/15 static vapi in source tree/vapi/config.vapi create mode 100644 test cases/vala/16 mixed dependence/app.vala create mode 100644 test cases/vala/16 mixed dependence/meson.build create mode 100644 test cases/vala/16 mixed dependence/mixer-glue.c create mode 100644 test cases/vala/16 mixed dependence/mixer.vala create mode 100644 test cases/vala/17 plain consumer/app.c create mode 100644 test cases/vala/17 plain consumer/badger.vala create mode 100644 test cases/vala/17 plain consumer/meson.build create mode 100644 test cases/vala/18 vapi consumed twice/app.vala create mode 100644 test cases/vala/18 vapi consumed twice/beer.vala create mode 100644 test cases/vala/18 vapi consumed twice/meson.build create mode 100644 test cases/vala/18 vapi consumed twice/person.vala create mode 100644 test cases/vala/19 genie/meson.build create mode 100644 test cases/vala/19 genie/prog.gs create mode 100644 test cases/vala/2 multiple files/class1.vala create mode 100644 test cases/vala/2 multiple files/class2.vala create mode 100644 test cases/vala/2 multiple files/main.vala create mode 100644 test cases/vala/2 multiple files/meson.build create mode 100644 test cases/vala/20 genie multiple mixed sources/c_test_one.c create mode 100644 test cases/vala/20 genie multiple mixed sources/c_test_two.c create mode 100644 test cases/vala/20 genie multiple mixed sources/init.gs create mode 100644 test cases/vala/20 genie multiple mixed sources/meson.build create mode 100644 test cases/vala/20 genie multiple mixed sources/test_one.gs create mode 100644 test cases/vala/20 genie multiple mixed sources/test_two.gs create mode 100644 test cases/vala/20 genie multiple mixed sources/vala_test_one.vala create mode 100644 test cases/vala/20 genie multiple mixed sources/vala_test_two.vala create mode 100644 test cases/vala/21 type module/foo.vala create mode 100644 test cases/vala/21 type module/meson.build create mode 100644 test cases/vala/21 type module/plugin-bar.vala create mode 100644 test cases/vala/21 type module/plugin-module.vala create mode 100644 test cases/vala/21 type module/plugin.vala create mode 100644 test cases/vala/22 same target in directories/Subdir/Subdir2/Test.vala create mode 100644 test cases/vala/22 same target in directories/Subdir/Test.vala create mode 100644 test cases/vala/22 same target in directories/Subdir2/Test.vala create mode 100644 test cases/vala/22 same target in directories/Test.vala create mode 100644 test cases/vala/22 same target in directories/meson.build create mode 100644 test cases/vala/22 same target in directories/prog.vala create mode 100644 test cases/vala/23 thread flags/meson.build create mode 100644 test cases/vala/23 thread flags/prog.vala create mode 100644 test cases/vala/24 export dynamic shared module/app.vala create mode 100644 test cases/vala/24 export dynamic shared module/meson.build create mode 100644 test cases/vala/24 export dynamic shared module/module.vala create mode 100644 test cases/vala/25 extract_all_objects/meson.build create mode 100644 test cases/vala/25 extract_all_objects/prog.vala create mode 100644 test cases/vala/26 vala and asm/meson.build create mode 100644 test cases/vala/26 vala and asm/prog.vala create mode 100644 test cases/vala/26 vala and asm/retval-arm.S create mode 100644 test cases/vala/26 vala and asm/retval-x86.S create mode 100644 test cases/vala/26 vala and asm/retval-x86_64.S create mode 100644 test cases/vala/26 vala and asm/symbol-underscore.h create mode 100644 test cases/vala/3 dep/gioprog.vala create mode 100644 test cases/vala/3 dep/meson.build create mode 100644 test cases/vala/4 config/config.vapi create mode 100644 test cases/vala/4 config/meson-something-else.vapi create mode 100644 test cases/vala/4 config/meson.build create mode 100644 test cases/vala/4 config/prog.vala create mode 100644 test cases/vala/5 target glib/GLib.Thread.vala create mode 100644 test cases/vala/5 target glib/meson.build create mode 100644 test cases/vala/5 target glib/retcode.c create mode 100644 test cases/vala/6 static library/meson.build create mode 100644 test cases/vala/6 static library/mylib.vala create mode 100644 test cases/vala/6 static library/prog.vala create mode 100644 test cases/vala/6 static library/test.json create mode 100644 test cases/vala/7 shared library/lib/meson.build create mode 100644 test cases/vala/7 shared library/lib/mylib.vala create mode 100644 test cases/vala/7 shared library/meson.build create mode 100644 test cases/vala/7 shared library/prog/meson.build create mode 100644 test cases/vala/7 shared library/prog/prog.vala create mode 100644 test cases/vala/7 shared library/test.json create mode 100644 test cases/vala/8 generated sources/dependency-generated/enum-types.c.template create mode 100644 test cases/vala/8 generated sources/dependency-generated/enum-types.h.template create mode 100644 test cases/vala/8 generated sources/dependency-generated/enums.h create mode 100644 test cases/vala/8 generated sources/dependency-generated/lib.vala create mode 100644 test cases/vala/8 generated sources/dependency-generated/main.vala create mode 100644 test cases/vala/8 generated sources/dependency-generated/meson.build create mode 100644 test cases/vala/8 generated sources/dependency-generated/null.c create mode 100644 test cases/vala/8 generated sources/meson.build create mode 100644 test cases/vala/8 generated sources/onlygen/maingen.in create mode 100644 test cases/vala/8 generated sources/onlygen/meson.build create mode 100644 test cases/vala/8 generated sources/src/config.vala.in create mode 100644 test cases/vala/8 generated sources/src/copy_file.py create mode 100644 test cases/vala/8 generated sources/src/meson.build create mode 100644 test cases/vala/8 generated sources/src/returncode.in create mode 100644 test cases/vala/8 generated sources/src/test.vala create mode 100644 test cases/vala/8 generated sources/src/write_wrapper.py create mode 100644 test cases/vala/8 generated sources/test.json create mode 100644 test cases/vala/8 generated sources/tools/meson.build create mode 100644 test cases/vala/9 gir/foo.vala create mode 100644 test cases/vala/9 gir/meson.build create mode 100644 test cases/vala/9 gir/test.json create mode 100644 test cases/warning/1 version for string div/a/b.c create mode 100644 test cases/warning/1 version for string div/meson.build create mode 100644 test cases/warning/1 version for string div/test.json create mode 100644 test cases/warning/2 languages missing native/meson.build create mode 100644 test cases/warning/2 languages missing native/test.json create mode 100644 test cases/warning/3 fallback consistency/meson.build create mode 100644 test cases/warning/3 fallback consistency/subprojects/sub/meson.build create mode 100644 test cases/warning/3 fallback consistency/test.json create mode 100644 test cases/warning/4 fallback consistency/meson.build create mode 100644 test cases/warning/4 fallback consistency/subprojects/sub/meson.build create mode 100644 test cases/warning/4 fallback consistency/test.json create mode 100644 test cases/warning/5 fallback consistency/meson.build create mode 100644 test cases/warning/5 fallback consistency/subprojects/foo.wrap create mode 100644 test cases/warning/5 fallback consistency/subprojects/foo/meson.build create mode 100644 test cases/warning/5 fallback consistency/test.json create mode 100644 test cases/warning/6 list add/meson.build create mode 100644 test cases/warning/6 list add/test.json create mode 100644 test cases/warning/7 module without unstable/meson.build create mode 100644 test cases/warning/7 module without unstable/test.json create mode 100644 test cases/warning/8 target with no sources/meson.build create mode 100644 test cases/warning/8 target with no sources/test.json create mode 100644 test cases/wasm/1 basic/hello.c create mode 100644 test cases/wasm/1 basic/hello.cpp create mode 100644 test cases/wasm/1 basic/hello.html create mode 100644 test cases/wasm/1 basic/meson.build create mode 100644 test cases/wasm/2 threads/meson.build create mode 100644 test cases/wasm/2 threads/threads.c create mode 100644 test cases/wasm/2 threads/threads.cpp create mode 100644 test cases/wasm/3 jslib/meson.build create mode 100644 test cases/wasm/3 jslib/prog.c create mode 100644 test cases/wasm/3 jslib/somefuncs.js create mode 100644 test cases/wayland/1 client/both.c create mode 100644 test cases/wayland/1 client/client.c create mode 100644 test cases/wayland/1 client/local.c create mode 100644 test cases/wayland/1 client/meson.build create mode 100644 test cases/wayland/1 client/server.c create mode 100644 test cases/wayland/1 client/test.xml create mode 100644 test cases/wayland/2 core only/core.c create mode 100644 test cases/wayland/2 core only/meson.build create mode 100644 test cases/windows/1 basic/meson.build create mode 100644 test cases/windows/1 basic/prog.c create mode 100644 test cases/windows/1 basic/test.json create mode 100644 test cases/windows/10 vs module defs generated custom target/meson.build create mode 100644 test cases/windows/10 vs module defs generated custom target/prog.c create mode 100755 test cases/windows/10 vs module defs generated custom target/subdir/make_def.py create mode 100644 test cases/windows/10 vs module defs generated custom target/subdir/meson.build create mode 100644 test cases/windows/10 vs module defs generated custom target/subdir/somedll.c create mode 100644 test cases/windows/11 exe implib/meson.build create mode 100644 test cases/windows/11 exe implib/prog.c create mode 100644 test cases/windows/11 exe implib/test.json create mode 100644 test cases/windows/12 resources with custom targets/meson.build create mode 100644 test cases/windows/12 resources with custom targets/prog.c create mode 100755 test cases/windows/12 resources with custom targets/res/gen-res.py create mode 100644 test cases/windows/12 resources with custom targets/res/meson.build create mode 100644 test cases/windows/12 resources with custom targets/res/myres.rc.in create mode 100644 test cases/windows/12 resources with custom targets/res/myres_static.rc create mode 100644 test cases/windows/12 resources with custom targets/res/resource.h create mode 100644 test cases/windows/12 resources with custom targets/res/sample.ico create mode 100644 test cases/windows/13 test argument extra paths/exe/main.c create mode 100644 test cases/windows/13 test argument extra paths/exe/meson.build create mode 100644 test cases/windows/13 test argument extra paths/lib/foo.c create mode 100644 test cases/windows/13 test argument extra paths/lib/foo.h create mode 100644 test cases/windows/13 test argument extra paths/lib/meson.build create mode 100644 test cases/windows/13 test argument extra paths/meson.build create mode 100644 test cases/windows/13 test argument extra paths/test/meson.build create mode 100644 test cases/windows/13 test argument extra paths/test/test_run_exe.py create mode 100755 test cases/windows/14 resources with custom target depend_files/ico/gen-ico.py create mode 100644 test cases/windows/14 resources with custom target depend_files/ico/meson.build create mode 100644 test cases/windows/14 resources with custom target depend_files/ico/sample.ico.in create mode 100644 test cases/windows/14 resources with custom target depend_files/meson.build create mode 100644 test cases/windows/14 resources with custom target depend_files/prog.c create mode 100644 test cases/windows/14 resources with custom target depend_files/res/meson.build create mode 100644 test cases/windows/14 resources with custom target depend_files/res/myres.rc create mode 100644 test cases/windows/15 resource scripts with duplicate filenames/a/meson.build create mode 100644 test cases/windows/15 resource scripts with duplicate filenames/a/rsrc.rc create mode 100644 test cases/windows/15 resource scripts with duplicate filenames/b/meson.build create mode 100644 test cases/windows/15 resource scripts with duplicate filenames/b/rsrc.rc create mode 100644 test cases/windows/15 resource scripts with duplicate filenames/c/meson.build create mode 100644 test cases/windows/15 resource scripts with duplicate filenames/c/rsrc.rc create mode 100644 test cases/windows/15 resource scripts with duplicate filenames/exe3/meson.build create mode 100644 test cases/windows/15 resource scripts with duplicate filenames/exe3/src_dll/main.c create mode 100644 test cases/windows/15 resource scripts with duplicate filenames/exe3/src_dll/version.rc create mode 100644 test cases/windows/15 resource scripts with duplicate filenames/exe3/src_exe/main.c create mode 100644 test cases/windows/15 resource scripts with duplicate filenames/exe3/src_exe/version.rc create mode 100644 test cases/windows/15 resource scripts with duplicate filenames/exe4/meson.build create mode 100644 test cases/windows/15 resource scripts with duplicate filenames/exe4/src_dll/main.c create mode 100644 test cases/windows/15 resource scripts with duplicate filenames/exe4/src_dll/version.rc create mode 100644 test cases/windows/15 resource scripts with duplicate filenames/exe4/src_exe/main.c create mode 100644 test cases/windows/15 resource scripts with duplicate filenames/exe4/src_exe/version.rc create mode 100644 test cases/windows/15 resource scripts with duplicate filenames/meson.build create mode 100644 test cases/windows/15 resource scripts with duplicate filenames/rsrc.rc create mode 100644 test cases/windows/15 resource scripts with duplicate filenames/verify.c create mode 100644 test cases/windows/16 gui app/console_prog.c create mode 100644 test cases/windows/16 gui app/dummy.c create mode 100644 test cases/windows/16 gui app/gui_app_tester.py create mode 100644 test cases/windows/16 gui app/gui_prog.c create mode 100644 test cases/windows/16 gui app/meson.build create mode 100644 test cases/windows/17 msvc ndebug/main.cpp create mode 100644 test cases/windows/17 msvc ndebug/meson.build create mode 100644 test cases/windows/18 msvc charset/iso-8859-1.c create mode 100644 test cases/windows/18 msvc charset/meson.build create mode 100644 test cases/windows/18 msvc charset/meson_options.txt create mode 100644 test cases/windows/18 msvc charset/utf8.c create mode 100644 test cases/windows/19 msvc cplusplus define/main.cpp create mode 100644 test cases/windows/19 msvc cplusplus define/meson.build create mode 100644 test cases/windows/2 winmain/meson.build create mode 100644 test cases/windows/2 winmain/prog.c create mode 100644 test cases/windows/20 vs install static lib with generated obj deps/both_lib_source.c create mode 100644 test cases/windows/20 vs install static lib with generated obj deps/copyfile.py create mode 100644 test cases/windows/20 vs install static lib with generated obj deps/generated_source.c create mode 100644 test cases/windows/20 vs install static lib with generated obj deps/meson.build create mode 100644 test cases/windows/20 vs install static lib with generated obj deps/static_lib_source.c create mode 100644 test cases/windows/20 vs install static lib with generated obj deps/test.json create mode 100644 test cases/windows/21 masm/hello.masm create mode 100644 test cases/windows/21 masm/meson.build create mode 100644 test cases/windows/3 cpp/meson.build create mode 100644 test cases/windows/3 cpp/prog.cpp create mode 100644 test cases/windows/4 winmaincpp/meson.build create mode 100644 test cases/windows/4 winmaincpp/prog.cpp create mode 100644 test cases/windows/5 resources/inc/meson.build create mode 100644 test cases/windows/5 resources/inc/resource/resource.h create mode 100644 test cases/windows/5 resources/meson.build create mode 100644 test cases/windows/5 resources/prog.c create mode 100644 test cases/windows/5 resources/res/dummy.c create mode 100644 test cases/windows/5 resources/res/meson.build create mode 100644 test cases/windows/5 resources/res/myres.rc create mode 100644 test cases/windows/5 resources/res/sample.ico create mode 100644 test cases/windows/6 vs module defs/meson.build create mode 100644 test cases/windows/6 vs module defs/prog.c create mode 100644 test cases/windows/6 vs module defs/subdir/meson.build create mode 100644 test cases/windows/6 vs module defs/subdir/somedll.c create mode 100644 test cases/windows/6 vs module defs/subdir/somedll.def create mode 100644 test cases/windows/7 dll versioning/copyfile.py create mode 100644 test cases/windows/7 dll versioning/exe.orig.c create mode 100644 test cases/windows/7 dll versioning/lib.c create mode 100644 test cases/windows/7 dll versioning/meson.build create mode 100644 test cases/windows/7 dll versioning/test.json create mode 100644 test cases/windows/8 find program/meson.build create mode 100644 test cases/windows/8 find program/test-script create mode 100644 test cases/windows/8 find program/test-script-ext.py create mode 100644 test cases/windows/9 vs module defs generated/meson.build create mode 100644 test cases/windows/9 vs module defs generated/prog.c create mode 100644 test cases/windows/9 vs module defs generated/subdir/meson.build create mode 100644 test cases/windows/9 vs module defs generated/subdir/somedll.c create mode 100644 test cases/windows/9 vs module defs generated/subdir/somedll.def.in (limited to 'test cases') diff --git a/test cases/cmake/1 basic/main.cpp b/test cases/cmake/1 basic/main.cpp new file mode 100644 index 0000000..9507961 --- /dev/null +++ b/test cases/cmake/1 basic/main.cpp @@ -0,0 +1,10 @@ +#include +#include + +using namespace std; + +int main(void) { + cmModClass obj("Hello"); + cout << obj.getStr() << endl; + return 0; +} diff --git a/test cases/cmake/1 basic/meson.build b/test cases/cmake/1 basic/meson.build new file mode 100644 index 0000000..2464739 --- /dev/null +++ b/test cases/cmake/1 basic/meson.build @@ -0,0 +1,14 @@ +project('cmakeSubTest', ['c', 'cpp']) + +cm = import('cmake') + +sub_pro = cm.subproject('cmMod') +sub_dep = sub_pro.dependency('cmModLib++', include_type: 'system') + +assert(sub_pro.found(), 'found() method reports not found, but should be found') +assert(sub_pro.target_list() == ['cmModLib++'], 'There should be exactly one target') +assert(sub_pro.target_type('cmModLib++') == 'shared_library', 'Target type should be shared_library') +assert(sub_dep.include_type() == 'system', 'the include_type kwarg of dependency() works') + +exe1 = executable('main', ['main.cpp'], dependencies: [sub_dep]) +test('test1', exe1) diff --git a/test cases/cmake/1 basic/subprojects/cmMod/CMakeLists.txt b/test cases/cmake/1 basic/subprojects/cmMod/CMakeLists.txt new file mode 100644 index 0000000..2197667 --- /dev/null +++ b/test cases/cmake/1 basic/subprojects/cmMod/CMakeLists.txt @@ -0,0 +1,20 @@ +cmake_minimum_required(VERSION 3.5) + +project(cmMod) +set (CMAKE_CXX_STANDARD 14) + +include_directories(${CMAKE_CURRENT_BINARY_DIR}) + +add_definitions("-DDO_NOTHING_JUST_A_FLAG=1") + +add_library(cmModLib++ SHARED cmMod.cpp) +target_compile_definitions(cmModLib++ PRIVATE MESON_MAGIC_FLAG=21) +target_compile_definitions(cmModLib++ INTERFACE MESON_MAGIC_FLAG=42) + +# Test PCH support +if(${CMAKE_VERSION} VERSION_GREATER_EQUAL "3.16.0") + target_precompile_headers(cmModLib++ PRIVATE "cpp_pch.hpp") +endif() + +include(GenerateExportHeader) +generate_export_header(cmModLib++) diff --git a/test cases/cmake/1 basic/subprojects/cmMod/cmMod.cpp b/test cases/cmake/1 basic/subprojects/cmMod/cmMod.cpp new file mode 100644 index 0000000..f4cbea0 --- /dev/null +++ b/test cases/cmake/1 basic/subprojects/cmMod/cmMod.cpp @@ -0,0 +1,15 @@ +#include "cmMod.hpp" + +using namespace std; + +#if MESON_MAGIC_FLAG != 21 +#error "Invalid MESON_MAGIC_FLAG (private)" +#endif + +cmModClass::cmModClass(string foo) { + str = foo + " World"; +} + +string cmModClass::getStr() const { + return str; +} diff --git a/test cases/cmake/1 basic/subprojects/cmMod/cmMod.hpp b/test cases/cmake/1 basic/subprojects/cmMod/cmMod.hpp new file mode 100644 index 0000000..4445e1f --- /dev/null +++ b/test cases/cmake/1 basic/subprojects/cmMod/cmMod.hpp @@ -0,0 +1,18 @@ +#pragma once + +#include "cmmodlib++_export.h" +#include + +#if MESON_MAGIC_FLAG != 42 && MESON_MAGIC_FLAG != 21 +#error "Invalid MESON_MAGIC_FLAG" +#endif + +class CMMODLIB___EXPORT cmModClass { +private: + std::string str; + +public: + cmModClass(std::string foo); + + std::string getStr() const; +}; diff --git a/test cases/cmake/1 basic/subprojects/cmMod/cpp_pch.hpp b/test cases/cmake/1 basic/subprojects/cmMod/cpp_pch.hpp new file mode 100644 index 0000000..aa7ceb3 --- /dev/null +++ b/test cases/cmake/1 basic/subprojects/cmMod/cpp_pch.hpp @@ -0,0 +1,2 @@ +#include +#include diff --git a/test cases/cmake/10 header only/main.cpp b/test cases/cmake/10 header only/main.cpp new file mode 100644 index 0000000..1417881 --- /dev/null +++ b/test cases/cmake/10 header only/main.cpp @@ -0,0 +1,16 @@ +#include +#include + +using namespace std; + +#define EXPECTED "Hello World compDef 42" + +int main(void) { + cmModClass obj("Hello"); + cout << obj.getStr() << endl; + if (obj.getStr() != EXPECTED) { + cerr << "Expected: '" << EXPECTED << "'" << endl; + return 1; + } + return 0; +} diff --git a/test cases/cmake/10 header only/meson.build b/test cases/cmake/10 header only/meson.build new file mode 100644 index 0000000..ca08a3f --- /dev/null +++ b/test cases/cmake/10 header only/meson.build @@ -0,0 +1,12 @@ +project('cmakeSubTest', ['c', 'cpp']) + +cm = import('cmake') + +sub_pro = cm.subproject('cmMod') +sub_dep = sub_pro.dependency('cmModLib') + +assert(sub_pro.target_list() == ['cmModLib'], 'There should be exactly one target') +assert(sub_pro.target_type('cmModLib') == 'header_only', 'Target type should be header_only') + +exe1 = executable('main', ['main.cpp'], dependencies: [sub_dep]) +test('test1', exe1) diff --git a/test cases/cmake/10 header only/subprojects/cmMod/CMakeLists.txt b/test cases/cmake/10 header only/subprojects/cmMod/CMakeLists.txt new file mode 100644 index 0000000..e01b6e2 --- /dev/null +++ b/test cases/cmake/10 header only/subprojects/cmMod/CMakeLists.txt @@ -0,0 +1,12 @@ +cmake_minimum_required(VERSION 3.5) + +project(cmMod) +set (CMAKE_CXX_STANDARD 14) + +add_definitions("-DDO_NOTHING_JUST_A_FLAG=1") + +add_library(cmModLib INTERFACE) +set_target_properties(cmModLib PROPERTIES INTERFACE_COMPILE_OPTIONS "-DCMAKE_FLAG_MUST_BE_PRESENT") +target_include_directories(cmModLib INTERFACE "${CMAKE_CURRENT_SOURCE_DIR}" "${CMAKE_CURRENT_SOURCE_DIR}/include") +target_compile_definitions(cmModLib INTERFACE -DCMAKE_COMPILER_DEFINE_STR="compDef") +target_compile_definitions(cmModLib INTERFACE MESON_MAGIC_FLAG=42) diff --git a/test cases/cmake/10 header only/subprojects/cmMod/include/cmMod.hpp b/test cases/cmake/10 header only/subprojects/cmMod/include/cmMod.hpp new file mode 100644 index 0000000..fe01040 --- /dev/null +++ b/test cases/cmake/10 header only/subprojects/cmMod/include/cmMod.hpp @@ -0,0 +1,24 @@ +#pragma once + +#include + +#ifndef CMAKE_FLAG_MUST_BE_PRESENT +#error "The flag CMAKE_FLAG_MUST_BE_PRESENT was not set" +#endif + +#define xstr(s) str(s) +#define str(s) #s + +class cmModClass { + private: + std::string str; + public: + cmModClass(std::string foo) { + str = foo + " World "; + str += CMAKE_COMPILER_DEFINE_STR; + str += ' '; + str += xstr(MESON_MAGIC_FLAG); + } + + inline std::string getStr() const { return str; } +}; diff --git a/test cases/cmake/11 cmake_module_path/cmake/FindSomethingLikePython.cmake b/test cases/cmake/11 cmake_module_path/cmake/FindSomethingLikePython.cmake new file mode 100644 index 0000000..0c663f4 --- /dev/null +++ b/test cases/cmake/11 cmake_module_path/cmake/FindSomethingLikePython.cmake @@ -0,0 +1,9 @@ +cmake_policy(VERSION 3.7) + +find_package(Python COMPONENTS Interpreter) +if(Python_FOUND OR PYTHONINTERP_FOUND) + set(SomethingLikePython_FOUND ON) + set(SomethingLikePython_EXECUTABLE ${Python_EXECUTABLE}) +else() + set(SomethingLikePython_FOUND OFF) +endif() diff --git a/test cases/cmake/11 cmake_module_path/meson.build b/test cases/cmake/11 cmake_module_path/meson.build new file mode 100644 index 0000000..e201936 --- /dev/null +++ b/test cases/cmake/11 cmake_module_path/meson.build @@ -0,0 +1,25 @@ +# We use Python3 as it's the only thing guaranteed to be available on any platform Meson can run on (unlike Zlib in linuxlike/13 cmake dependency). + +project('user CMake find_package module using cmake_module_path', ['c', 'cpp'], + meson_version: '>= 0.55.0') + +if not find_program('cmake', required: false).found() + error('MESON_SKIP_TEST cmake binary not available.') +endif + +# NOTE: can't request Python3 via dependency('Python3', method: 'cmake') +# Meson intercepts and wants "method: auto" + +# Try to find a dependency with a custom CMake module + +dependency('SomethingLikePython', required : true, method : 'cmake', cmake_module_path : 'cmake', modules: 'Python::Interpreter') + +dependency('SomethingLikePython', method : 'cmake', cmake_module_path : ['doesNotExist', 'cmake'], modules: 'Python::Interpreter') + +# Test a custom target with Python::Interpreter in COMMAND +cm = import('cmake') +op = cm.subproject_options() +op.add_cmake_defines({'CMAKE_MODULE_PATH': meson.source_root() / 'cmake'}) +sp = cm.subproject('cmMod', options: op) +main = sp.target('main') +test('main', main) diff --git a/test cases/cmake/11 cmake_module_path/subprojects/cmMod/CMakeLists.txt b/test cases/cmake/11 cmake_module_path/subprojects/cmMod/CMakeLists.txt new file mode 100644 index 0000000..88ba9bc --- /dev/null +++ b/test cases/cmake/11 cmake_module_path/subprojects/cmMod/CMakeLists.txt @@ -0,0 +1,15 @@ +cmake_minimum_required(VERSION 3.5) + +project(cmMod) + +message(STATUS "CMAKE_MODULE_PATH: '${CMAKE_MODULE_PATH}'") + +find_package(SomethingLikePython REQUIRED) + +add_custom_command( + OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/main.c" + COMMAND Python::Interpreter "${CMAKE_CURRENT_SOURCE_DIR}/gen.py" + WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}" +) + +add_executable(main "${CMAKE_CURRENT_BINARY_DIR}/main.c") diff --git a/test cases/cmake/11 cmake_module_path/subprojects/cmMod/gen.py b/test cases/cmake/11 cmake_module_path/subprojects/cmMod/gen.py new file mode 100644 index 0000000..5c71646 --- /dev/null +++ b/test cases/cmake/11 cmake_module_path/subprojects/cmMod/gen.py @@ -0,0 +1,9 @@ +with open('main.c', 'w') as fp: + print(''' +#include + +int main(void) { + printf(\"Hello World\"); + return 0; +} +''', file=fp) diff --git a/test cases/cmake/12 generator expressions/main.cpp b/test cases/cmake/12 generator expressions/main.cpp new file mode 100644 index 0000000..9507961 --- /dev/null +++ b/test cases/cmake/12 generator expressions/main.cpp @@ -0,0 +1,10 @@ +#include +#include + +using namespace std; + +int main(void) { + cmModClass obj("Hello"); + cout << obj.getStr() << endl; + return 0; +} diff --git a/test cases/cmake/12 generator expressions/meson.build b/test cases/cmake/12 generator expressions/meson.build new file mode 100644 index 0000000..ca08a3f --- /dev/null +++ b/test cases/cmake/12 generator expressions/meson.build @@ -0,0 +1,12 @@ +project('cmakeSubTest', ['c', 'cpp']) + +cm = import('cmake') + +sub_pro = cm.subproject('cmMod') +sub_dep = sub_pro.dependency('cmModLib') + +assert(sub_pro.target_list() == ['cmModLib'], 'There should be exactly one target') +assert(sub_pro.target_type('cmModLib') == 'header_only', 'Target type should be header_only') + +exe1 = executable('main', ['main.cpp'], dependencies: [sub_dep]) +test('test1', exe1) diff --git a/test cases/cmake/12 generator expressions/subprojects/cmMod/CMakeLists.txt b/test cases/cmake/12 generator expressions/subprojects/cmMod/CMakeLists.txt new file mode 100644 index 0000000..27b3721 --- /dev/null +++ b/test cases/cmake/12 generator expressions/subprojects/cmMod/CMakeLists.txt @@ -0,0 +1,32 @@ +cmake_minimum_required(VERSION 3.5) + +project(cmMod) +set (CMAKE_CXX_STANDARD 14) + +include(GNUInstallDirs) + +add_library(cmModLib INTERFACE) + +target_compile_options(cmModLib + INTERFACE $<$,$>:-DCMAKE_FLAG_ERROR_A> # Check discard = false + INTERFACE "-DCMAKE_FLAG_REQUIRED_A" + INTERFACE $<$>,$>>:-DCMAKE_FLAG_REQUIRED_B> + INTERFACE $<$:-DCMAKE_FLAG_REQUIRED_C> + INTERFACE $>,-DCMAKE_TRUE_FLAG,-DCMAKE_FALSE_FLAG> + INTERFACE $,-DCMAKE_TGT_EXISTS,-DCMAKE_TGT_NEXISTS> + INTERFACE $,-DCMAKE_PROP1_OK,-DCMAKE_PROP1_ERROR> + INTERFACE $,-DCMAKE_PROP2_ERROR,-DCMAKE_PROP2_OK> +) + +target_include_directories(cmModLib INTERFACE + $ + $ +) + +set_target_properties(cmModLib + PROPERTIES + IMPORTED_NO_SONAME 1 + IMPORT_SUFFIX 0 +) + +target_compile_definitions(cmModLib INTERFACE -DCMAKE_COMPILER_DEFINE_STR="compDef") diff --git a/test cases/cmake/12 generator expressions/subprojects/cmMod/include/cmMod.hpp b/test cases/cmake/12 generator expressions/subprojects/cmMod/include/cmMod.hpp new file mode 100644 index 0000000..416e5bb --- /dev/null +++ b/test cases/cmake/12 generator expressions/subprojects/cmMod/include/cmMod.hpp @@ -0,0 +1,63 @@ +#pragma once + +#include + +#ifndef CMAKE_FLAG_REQUIRED_A +#error "The flag CMAKE_FLAG_REQUIRED_A was not set" +#endif + +#ifndef CMAKE_FLAG_REQUIRED_B +#error "The flag CMAKE_FLAG_REQUIRED_B was not set" +#endif + +#ifndef CMAKE_FLAG_REQUIRED_C +#error "The flag CMAKE_FLAG_REQUIRED_C was not set" +#endif + +#ifdef CMAKE_FLAG_ERROR_A +#error "The flag CMAKE_FLAG_ERROR_A was set" +#endif + +#ifndef CMAKE_TRUE_FLAG +#error "The flag CMAKE_TRUE_FLAG was not set" +#endif + +#ifdef CMAKE_FALSE_FLAG +#error "The flag CMAKE_FALSE_FLAG was set" +#endif + +#ifndef CMAKE_TGT_EXISTS +#error "The flag CMAKE_TGT_EXISTS was not set" +#endif + +#ifdef CMAKE_TGT_NEXISTS +#error "The flag CMAKE_TGT_NEXISTS was set" +#endif + +#ifndef CMAKE_PROP1_OK +#error "The flag CMAKE_PROP1_OK was not set" +#endif + +#ifdef CMAKE_PROP1_ERROR +#error "The flag CMAKE_PROP1_ERROR was set" +#endif + +#ifndef CMAKE_PROP2_OK +#error "The flag CMAKE_PROP2_OK was not set" +#endif + +#ifdef CMAKE_PROP2_ERROR +#error "The flag CMAKE_PROP2_ERROR was set" +#endif + +class cmModClass { + private: + std::string str; + public: + cmModClass(std::string foo) { + str = foo + " World "; + str += CMAKE_COMPILER_DEFINE_STR; + } + + inline std::string getStr() const { return str; } +}; diff --git a/test cases/cmake/12 generator expressions/test.json b/test cases/cmake/12 generator expressions/test.json new file mode 100644 index 0000000..faf1ff8 --- /dev/null +++ b/test cases/cmake/12 generator expressions/test.json @@ -0,0 +1,5 @@ +{ + "tools": { + "cmake": ">=3.19" + } +} diff --git a/test cases/cmake/13 system includes/main.cpp b/test cases/cmake/13 system includes/main.cpp new file mode 100644 index 0000000..9507961 --- /dev/null +++ b/test cases/cmake/13 system includes/main.cpp @@ -0,0 +1,10 @@ +#include +#include + +using namespace std; + +int main(void) { + cmModClass obj("Hello"); + cout << obj.getStr() << endl; + return 0; +} diff --git a/test cases/cmake/13 system includes/meson.build b/test cases/cmake/13 system includes/meson.build new file mode 100644 index 0000000..1265d46 --- /dev/null +++ b/test cases/cmake/13 system includes/meson.build @@ -0,0 +1,18 @@ +project( + 'meson_cmake_system_include_bug', ['c', 'cpp'], + default_options: [ + 'warning_level=3', + 'werror=true', + ], +) + +if meson.get_compiler('cpp').get_argument_syntax() == 'msvc' + error('MESON_SKIP_TEST: Skip with msvc due to missing -system support') +endif + +cm = import('cmake') +sub_pro = cm.subproject('cmMod') +sub_dep = sub_pro.dependency('cmModLib') + +exe1 = executable('main1', ['main.cpp'], dependencies: [sub_dep]) +test('test1', exe1) diff --git a/test cases/cmake/13 system includes/subprojects/cmMod/CMakeLists.txt b/test cases/cmake/13 system includes/subprojects/cmMod/CMakeLists.txt new file mode 100644 index 0000000..a6b0ba4 --- /dev/null +++ b/test cases/cmake/13 system includes/subprojects/cmMod/CMakeLists.txt @@ -0,0 +1,15 @@ +cmake_minimum_required(VERSION 3.5) + +project(cmMod) +set (CMAKE_CXX_STANDARD 14) + +include_directories(${CMAKE_CURRENT_BINARY_DIR}) + +add_definitions("-DDO_NOTHING_JUST_A_FLAG=1") + +add_library(cmModLib SHARED cmMod.cpp) +include(GenerateExportHeader) +generate_export_header(cmModLib) + +target_compile_options(cmModLib PRIVATE "-Wall" "-Werror") +target_include_directories(cmModLib SYSTEM PRIVATE "sysInc") diff --git a/test cases/cmake/13 system includes/subprojects/cmMod/cmMod.cpp b/test cases/cmake/13 system includes/subprojects/cmMod/cmMod.cpp new file mode 100644 index 0000000..1eaf0cf --- /dev/null +++ b/test cases/cmake/13 system includes/subprojects/cmMod/cmMod.cpp @@ -0,0 +1,12 @@ +#include "cmMod.hpp" +#include "triggerWarn.hpp" + +using namespace std; + +cmModClass::cmModClass(string foo) { + str = foo + " World " + to_string(bar(World)); +} + +string cmModClass::getStr() const { + return str; +} diff --git a/test cases/cmake/13 system includes/subprojects/cmMod/cmMod.hpp b/test cases/cmake/13 system includes/subprojects/cmMod/cmMod.hpp new file mode 100644 index 0000000..52f576b --- /dev/null +++ b/test cases/cmake/13 system includes/subprojects/cmMod/cmMod.hpp @@ -0,0 +1,13 @@ +#pragma once + +#include +#include "cmmodlib_export.h" + +class CMMODLIB_EXPORT cmModClass { + private: + std::string str; + public: + cmModClass(std::string foo); + + std::string getStr() const; +}; diff --git a/test cases/cmake/13 system includes/subprojects/cmMod/sysInc/triggerWarn.hpp b/test cases/cmake/13 system includes/subprojects/cmMod/sysInc/triggerWarn.hpp new file mode 100644 index 0000000..3b00f2d --- /dev/null +++ b/test cases/cmake/13 system includes/subprojects/cmMod/sysInc/triggerWarn.hpp @@ -0,0 +1,14 @@ +#pragma once + +enum Foo { + Hello, + World +}; + +inline int bar( Foo foo ) { + switch(foo) { + case Hello: return 0; + // Warn because of missung case for World + } + return 1; +} diff --git a/test cases/cmake/14 fortran threads/meson.build b/test cases/cmake/14 fortran threads/meson.build new file mode 100644 index 0000000..2d2f892 --- /dev/null +++ b/test cases/cmake/14 fortran threads/meson.build @@ -0,0 +1,12 @@ +project('FortranThreads') + +if not add_languages('fortran', required: false) + error('MESON_SKIP_TEST: Fortran language not available.') +endif + +# want to be sure that CMake can find dependencies where even if the +# project isn't C, the C language is required to find the library. +threads = dependency('threads', method: 'cmake', required: false) +if not threads.found() + error('MESON_SKIP_TEST: CMake backend not working for Fortran / threads') +endif diff --git a/test cases/cmake/15 object library advanced/main.cpp b/test cases/cmake/15 object library advanced/main.cpp new file mode 100644 index 0000000..4cc01a8 --- /dev/null +++ b/test cases/cmake/15 object library advanced/main.cpp @@ -0,0 +1,11 @@ +#include +#include "libA.hpp" +#include "libB.hpp" + +using namespace std; + +int main(void) { + cout << getLibStr() << endl; + cout << getZlibVers() << endl; + return EXIT_SUCCESS; +} diff --git a/test cases/cmake/15 object library advanced/meson.build b/test cases/cmake/15 object library advanced/meson.build new file mode 100644 index 0000000..4009a0d --- /dev/null +++ b/test cases/cmake/15 object library advanced/meson.build @@ -0,0 +1,17 @@ +project('cmake_object_lib_test', 'cpp', default_options: ['cpp_std=c++11']) + +if meson.is_cross_build() + error('MESON_SKIP_TEST this test does not cross compile correctly.') +endif + +cm = import('cmake') + +sub_pro = cm.subproject('cmObjLib') +sub_sha = sub_pro.dependency('lib_sha') +sub_sta = sub_pro.dependency('lib_sta') + +exe_sha = executable('shared', ['main.cpp'], dependencies: [sub_sha]) +exe_sta = executable('static', ['main.cpp'], dependencies: [sub_sta]) + +test('test1', exe_sha) +test('test1', exe_sta) diff --git a/test cases/cmake/15 object library advanced/subprojects/cmObjLib/CMakeLists.txt b/test cases/cmake/15 object library advanced/subprojects/cmObjLib/CMakeLists.txt new file mode 100644 index 0000000..47f1ad3 --- /dev/null +++ b/test cases/cmake/15 object library advanced/subprojects/cmObjLib/CMakeLists.txt @@ -0,0 +1,18 @@ +cmake_minimum_required(VERSION 3.7) +project(cmObject CXX) + +add_executable(genC genC.cpp) + +add_custom_command( + OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/libC.cpp" "${CMAKE_CURRENT_BINARY_DIR}/libC.hpp" + COMMAND genC + WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}" +) + +include_directories("${CMAKE_CURRENT_BINARY_DIR}") + +add_library(lib_obj OBJECT libA.cpp libB.cpp "${CMAKE_CURRENT_BINARY_DIR}/libC.cpp" "${CMAKE_CURRENT_BINARY_DIR}/libC.hpp") +add_library(lib_sha SHARED $) +add_library(lib_sta STATIC $) + +target_compile_definitions(lib_obj PRIVATE "-DBUILD_AS_OBJ=1") diff --git a/test cases/cmake/15 object library advanced/subprojects/cmObjLib/genC.cpp b/test cases/cmake/15 object library advanced/subprojects/cmObjLib/genC.cpp new file mode 100644 index 0000000..a9e4b5e --- /dev/null +++ b/test cases/cmake/15 object library advanced/subprojects/cmObjLib/genC.cpp @@ -0,0 +1,31 @@ +#include +#include + +using namespace std; + +int main() { + ofstream hpp("libC.hpp"); + ofstream cpp("libC.cpp"); + if (!hpp.is_open() || !cpp.is_open()) { + cerr << "Failed to open 'libC.hpp' or 'libC.cpp' for writing" << endl; + return 1; + } + + hpp << R"cpp( +#pragma once + +#include + +std::string getGenStr(); +)cpp"; + + cpp << R"cpp( +#include "libC.hpp" + +std::string getGenStr(void) { + return "GEN STR"; +} +)cpp"; + + return 0; +} \ No newline at end of file diff --git a/test cases/cmake/15 object library advanced/subprojects/cmObjLib/libA.cpp b/test cases/cmake/15 object library advanced/subprojects/cmObjLib/libA.cpp new file mode 100644 index 0000000..fd5aa48 --- /dev/null +++ b/test cases/cmake/15 object library advanced/subprojects/cmObjLib/libA.cpp @@ -0,0 +1,9 @@ +#include "libA.hpp" + +#if not BUILD_AS_OBJ +#error "BUILD_AS_OBJ was not defined" +#endif + +std::string getLibStr(void) { + return "Hello World"; +} diff --git a/test cases/cmake/15 object library advanced/subprojects/cmObjLib/libA.hpp b/test cases/cmake/15 object library advanced/subprojects/cmObjLib/libA.hpp new file mode 100644 index 0000000..84b7bc7 --- /dev/null +++ b/test cases/cmake/15 object library advanced/subprojects/cmObjLib/libA.hpp @@ -0,0 +1,16 @@ +#pragma once + +#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 + +std::string DLL_PUBLIC getLibStr(); diff --git a/test cases/cmake/15 object library advanced/subprojects/cmObjLib/libB.cpp b/test cases/cmake/15 object library advanced/subprojects/cmObjLib/libB.cpp new file mode 100644 index 0000000..4b832ec --- /dev/null +++ b/test cases/cmake/15 object library advanced/subprojects/cmObjLib/libB.cpp @@ -0,0 +1,6 @@ +#include "libB.hpp" +#include "libC.hpp" + +std::string getZlibVers(void) { + return getGenStr(); +} diff --git a/test cases/cmake/15 object library advanced/subprojects/cmObjLib/libB.hpp b/test cases/cmake/15 object library advanced/subprojects/cmObjLib/libB.hpp new file mode 100644 index 0000000..52ccc16 --- /dev/null +++ b/test cases/cmake/15 object library advanced/subprojects/cmObjLib/libB.hpp @@ -0,0 +1,16 @@ +#pragma once + +#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 + +std::string DLL_PUBLIC getZlibVers(); diff --git a/test cases/cmake/16 threads/main.cpp b/test cases/cmake/16 threads/main.cpp new file mode 100644 index 0000000..67ee110 --- /dev/null +++ b/test cases/cmake/16 threads/main.cpp @@ -0,0 +1,9 @@ +#include "cmMod.hpp" + +#include + +int main() { + CmMod cc; + cc.asyncIncrement(); + return cc.getNum() == 1 ? EXIT_SUCCESS : EXIT_FAILURE; +} diff --git a/test cases/cmake/16 threads/meson.build b/test cases/cmake/16 threads/meson.build new file mode 100644 index 0000000..5efd73e --- /dev/null +++ b/test cases/cmake/16 threads/meson.build @@ -0,0 +1,12 @@ +project('cmMod', ['c', 'cpp']) + +cm = import('cmake') +cmOpts = ['-DUSE_PTHREAD=@0@'.format(get_option('use_pthread'))] +cmMod = cm.subproject('cmMod', cmake_options: cmOpts) +cmModDep1 = cmMod.dependency('cmModLib') +cmModDep2 = cmMod.dependency('cmModLib_shared') + +exe1 = executable('exe1', ['main.cpp'], dependencies: [cmModDep1]) +exe2 = executable('exe2', ['main.cpp'], dependencies: [cmModDep2]) +test('exe1_OK', exe1) +test('exe2_OK', exe2) diff --git a/test cases/cmake/16 threads/meson_options.txt b/test cases/cmake/16 threads/meson_options.txt new file mode 100644 index 0000000..1fd9068 --- /dev/null +++ b/test cases/cmake/16 threads/meson_options.txt @@ -0,0 +1 @@ +option('use_pthread', type: 'combo', choices: ['ON', 'OFF', 'NOT_SET'], value: 'ON') diff --git a/test cases/cmake/16 threads/subprojects/cmMod/CMakeLists.txt b/test cases/cmake/16 threads/subprojects/cmMod/CMakeLists.txt new file mode 100644 index 0000000..4d61b0c --- /dev/null +++ b/test cases/cmake/16 threads/subprojects/cmMod/CMakeLists.txt @@ -0,0 +1,15 @@ +cmake_minimum_required(VERSION 3.5) + +project(cmMod C CXX) +set (CMAKE_CXX_STANDARD 14) + +if(NOT USE_PTHREAD STREQUAL NOT_SET) + set(THREADS_PREFER_PTHREAD_FLAG ${USE_PTHREAD}) +endif() +find_package(Threads) + +add_library(cmModLib STATIC cmMod.cpp) +target_link_libraries(cmModLib PRIVATE Threads::Threads) + +add_library(cmModLib_shared SHARED cmMod.cpp) +target_link_libraries(cmModLib_shared PUBLIC Threads::Threads) diff --git a/test cases/cmake/16 threads/subprojects/cmMod/cmMod.cpp b/test cases/cmake/16 threads/subprojects/cmMod/cmMod.cpp new file mode 100644 index 0000000..f971eeb --- /dev/null +++ b/test cases/cmake/16 threads/subprojects/cmMod/cmMod.cpp @@ -0,0 +1,15 @@ +#include "cmMod.hpp" + +#include +#include + +using namespace std::chrono_literals; + +void CmMod::asyncIncrement() { + std::thread t1([this]() { + std::this_thread::sleep_for(100ms); + num += 1; + }); + + t1.join(); +} diff --git a/test cases/cmake/16 threads/subprojects/cmMod/cmMod.hpp b/test cases/cmake/16 threads/subprojects/cmMod/cmMod.hpp new file mode 100644 index 0000000..81c5ec8 --- /dev/null +++ b/test cases/cmake/16 threads/subprojects/cmMod/cmMod.hpp @@ -0,0 +1,21 @@ +#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 DLL_PUBLIC CmMod { +private: + int num = 0; + +public: + inline int getNum() const { return num; } + void asyncIncrement(); +}; diff --git a/test cases/cmake/16 threads/subprojects/cmMod/main.cpp b/test cases/cmake/16 threads/subprojects/cmMod/main.cpp new file mode 100644 index 0000000..67ee110 --- /dev/null +++ b/test cases/cmake/16 threads/subprojects/cmMod/main.cpp @@ -0,0 +1,9 @@ +#include "cmMod.hpp" + +#include + +int main() { + CmMod cc; + cc.asyncIncrement(); + return cc.getNum() == 1 ? EXIT_SUCCESS : EXIT_FAILURE; +} diff --git a/test cases/cmake/16 threads/test.json b/test cases/cmake/16 threads/test.json new file mode 100644 index 0000000..db788b1 --- /dev/null +++ b/test cases/cmake/16 threads/test.json @@ -0,0 +1,11 @@ +{ + "matrix": { + "options": { + "use_pthread": [ + { "val": "ON" }, + { "val": "OFF" }, + { "val": "NOT_SET" } + ] + } + } +} diff --git a/test cases/cmake/17 include path order/main.cpp b/test cases/cmake/17 include path order/main.cpp new file mode 100644 index 0000000..9507961 --- /dev/null +++ b/test cases/cmake/17 include path order/main.cpp @@ -0,0 +1,10 @@ +#include +#include + +using namespace std; + +int main(void) { + cmModClass obj("Hello"); + cout << obj.getStr() << endl; + return 0; +} diff --git a/test cases/cmake/17 include path order/meson.build b/test cases/cmake/17 include path order/meson.build new file mode 100644 index 0000000..cf3ec96 --- /dev/null +++ b/test cases/cmake/17 include path order/meson.build @@ -0,0 +1,9 @@ +project('include_path_order', ['c', 'cpp']) + +cm = import('cmake') + +sub_pro = cm.subproject('cmMod') +sub_dep = sub_pro.dependency('cmModLib++') + +exe1 = executable('main', ['main.cpp'], dependencies: [sub_dep]) +test('test1', exe1) diff --git a/test cases/cmake/17 include path order/subprojects/cmMod/CMakeLists.txt b/test cases/cmake/17 include path order/subprojects/cmMod/CMakeLists.txt new file mode 100644 index 0000000..9a252df --- /dev/null +++ b/test cases/cmake/17 include path order/subprojects/cmMod/CMakeLists.txt @@ -0,0 +1,34 @@ +cmake_minimum_required(VERSION 3.5) + +project(cmMod) +set (CMAKE_CXX_STANDARD 14) + +include_directories( + ${CMAKE_CURRENT_BINARY_DIR} + + # The one and only correct include dir + ${CMAKE_CURRENT_SOURCE_DIR}/incG + + # All of these are traps + ${CMAKE_CURRENT_SOURCE_DIR}/incL + ${CMAKE_CURRENT_SOURCE_DIR}/incM + ${CMAKE_CURRENT_SOURCE_DIR}/incO + ${CMAKE_CURRENT_SOURCE_DIR}/incF + ${CMAKE_CURRENT_SOURCE_DIR}/incI + ${CMAKE_CURRENT_SOURCE_DIR}/incE + ${CMAKE_CURRENT_SOURCE_DIR}/incD + ${CMAKE_CURRENT_SOURCE_DIR}/incH + ${CMAKE_CURRENT_SOURCE_DIR}/incN + ${CMAKE_CURRENT_SOURCE_DIR}/incA + ${CMAKE_CURRENT_SOURCE_DIR}/incB + ${CMAKE_CURRENT_SOURCE_DIR}/incJ + ${CMAKE_CURRENT_SOURCE_DIR}/incP + ${CMAKE_CURRENT_SOURCE_DIR}/incC + ${CMAKE_CURRENT_SOURCE_DIR}/incK +) + +add_definitions("-DDO_NOTHING_JUST_A_FLAG=1") + +add_library(cmModLib++ SHARED cmMod.cpp) +include(GenerateExportHeader) +generate_export_header(cmModLib++) diff --git a/test cases/cmake/17 include path order/subprojects/cmMod/cmMod.cpp b/test cases/cmake/17 include path order/subprojects/cmMod/cmMod.cpp new file mode 100644 index 0000000..d3141d5 --- /dev/null +++ b/test cases/cmake/17 include path order/subprojects/cmMod/cmMod.cpp @@ -0,0 +1,11 @@ +#include "cmMod.hpp" + +using namespace std; + +cmModClass::cmModClass(string foo) { + str = foo + " World"; +} + +string cmModClass::getStr() const { + return str; +} diff --git a/test cases/cmake/17 include path order/subprojects/cmMod/incA/cmMod.hpp b/test cases/cmake/17 include path order/subprojects/cmMod/incA/cmMod.hpp new file mode 100644 index 0000000..6228a31 --- /dev/null +++ b/test cases/cmake/17 include path order/subprojects/cmMod/incA/cmMod.hpp @@ -0,0 +1,4 @@ +// cmMod.hpp (A) +#pragma once + +#error "cmMod.hpp in incA must not be included" diff --git a/test cases/cmake/17 include path order/subprojects/cmMod/incB/cmMod.hpp b/test cases/cmake/17 include path order/subprojects/cmMod/incB/cmMod.hpp new file mode 100644 index 0000000..60bf14c --- /dev/null +++ b/test cases/cmake/17 include path order/subprojects/cmMod/incB/cmMod.hpp @@ -0,0 +1,4 @@ +// cmMod.hpp (B) +#pragma once + +#error "cmMod.hpp in incB must not be included" diff --git a/test cases/cmake/17 include path order/subprojects/cmMod/incC/cmMod.hpp b/test cases/cmake/17 include path order/subprojects/cmMod/incC/cmMod.hpp new file mode 100644 index 0000000..3229e07 --- /dev/null +++ b/test cases/cmake/17 include path order/subprojects/cmMod/incC/cmMod.hpp @@ -0,0 +1,4 @@ +// cmMod.hpp (C) +#pragma once + +#error "cmMod.hpp in incC must not be included" diff --git a/test cases/cmake/17 include path order/subprojects/cmMod/incD/cmMod.hpp b/test cases/cmake/17 include path order/subprojects/cmMod/incD/cmMod.hpp new file mode 100644 index 0000000..b958093 --- /dev/null +++ b/test cases/cmake/17 include path order/subprojects/cmMod/incD/cmMod.hpp @@ -0,0 +1,4 @@ +// cmMod.hpp (D) +#pragma once + +#error "cmMod.hpp in incD must not be included" diff --git a/test cases/cmake/17 include path order/subprojects/cmMod/incE/cmMod.hpp b/test cases/cmake/17 include path order/subprojects/cmMod/incE/cmMod.hpp new file mode 100644 index 0000000..aea5b6d --- /dev/null +++ b/test cases/cmake/17 include path order/subprojects/cmMod/incE/cmMod.hpp @@ -0,0 +1,4 @@ +// cmMod.hpp (E) +#pragma once + +#error "cmMod.hpp in incE must not be included" diff --git a/test cases/cmake/17 include path order/subprojects/cmMod/incF/cmMod.hpp b/test cases/cmake/17 include path order/subprojects/cmMod/incF/cmMod.hpp new file mode 100644 index 0000000..1e1e2cb --- /dev/null +++ b/test cases/cmake/17 include path order/subprojects/cmMod/incF/cmMod.hpp @@ -0,0 +1,4 @@ +// cmMod.hpp (F) +#pragma once + +#error "cmMod.hpp in incF must not be included" diff --git a/test cases/cmake/17 include path order/subprojects/cmMod/incG/cmMod.hpp b/test cases/cmake/17 include path order/subprojects/cmMod/incG/cmMod.hpp new file mode 100644 index 0000000..0e6dc04 --- /dev/null +++ b/test cases/cmake/17 include path order/subprojects/cmMod/incG/cmMod.hpp @@ -0,0 +1,14 @@ +#pragma once + +#include "cmmodlib++_export.h" +#include + +class CMMODLIB___EXPORT cmModClass { +private: + std::string str; + +public: + cmModClass(std::string foo); + + std::string getStr() const; +}; diff --git a/test cases/cmake/17 include path order/subprojects/cmMod/incH/cmMod.hpp b/test cases/cmake/17 include path order/subprojects/cmMod/incH/cmMod.hpp new file mode 100644 index 0000000..263e701 --- /dev/null +++ b/test cases/cmake/17 include path order/subprojects/cmMod/incH/cmMod.hpp @@ -0,0 +1,4 @@ +// cmMod.hpp (H) +#pragma once + +#error "cmMod.hpp in incH must not be included" diff --git a/test cases/cmake/17 include path order/subprojects/cmMod/incI/cmMod.hpp b/test cases/cmake/17 include path order/subprojects/cmMod/incI/cmMod.hpp new file mode 100644 index 0000000..a44a89a --- /dev/null +++ b/test cases/cmake/17 include path order/subprojects/cmMod/incI/cmMod.hpp @@ -0,0 +1,4 @@ +// cmMod.hpp (I) +#pragma once + +#error "cmMod.hpp in incI must not be included" diff --git a/test cases/cmake/17 include path order/subprojects/cmMod/incJ/cmMod.hpp b/test cases/cmake/17 include path order/subprojects/cmMod/incJ/cmMod.hpp new file mode 100644 index 0000000..118a809 --- /dev/null +++ b/test cases/cmake/17 include path order/subprojects/cmMod/incJ/cmMod.hpp @@ -0,0 +1,4 @@ +// cmMod.hpp (J) +#pragma once + +#error "cmMod.hpp in incJ must not be included" diff --git a/test cases/cmake/17 include path order/subprojects/cmMod/incL/cmMod.hpp b/test cases/cmake/17 include path order/subprojects/cmMod/incL/cmMod.hpp new file mode 100644 index 0000000..8294104 --- /dev/null +++ b/test cases/cmake/17 include path order/subprojects/cmMod/incL/cmMod.hpp @@ -0,0 +1,4 @@ +// cmMod.hpp (L) +#pragma once + +#error "cmMod.hpp in incL must not be included" diff --git a/test cases/cmake/17 include path order/subprojects/cmMod/incM/cmMod.hpp b/test cases/cmake/17 include path order/subprojects/cmMod/incM/cmMod.hpp new file mode 100644 index 0000000..031c5e9 --- /dev/null +++ b/test cases/cmake/17 include path order/subprojects/cmMod/incM/cmMod.hpp @@ -0,0 +1,4 @@ +// cmMod.hpp (M) +#pragma once + +#error "cmMod.hpp in incM must not be included" diff --git a/test cases/cmake/17 include path order/subprojects/cmMod/incN/cmMod.hpp b/test cases/cmake/17 include path order/subprojects/cmMod/incN/cmMod.hpp new file mode 100644 index 0000000..9dba6da --- /dev/null +++ b/test cases/cmake/17 include path order/subprojects/cmMod/incN/cmMod.hpp @@ -0,0 +1,4 @@ +// cmMod.hpp (N) +#pragma once + +#error "cmMod.hpp in incN must not be included" diff --git a/test cases/cmake/17 include path order/subprojects/cmMod/incO/cmMod.hpp b/test cases/cmake/17 include path order/subprojects/cmMod/incO/cmMod.hpp new file mode 100644 index 0000000..233add9 --- /dev/null +++ b/test cases/cmake/17 include path order/subprojects/cmMod/incO/cmMod.hpp @@ -0,0 +1,4 @@ +// cmMod.hpp (O) +#pragma once + +#error "cmMod.hpp in incO must not be included" diff --git a/test cases/cmake/17 include path order/subprojects/cmMod/incP/cmMod.hpp b/test cases/cmake/17 include path order/subprojects/cmMod/incP/cmMod.hpp new file mode 100644 index 0000000..9578745 --- /dev/null +++ b/test cases/cmake/17 include path order/subprojects/cmMod/incP/cmMod.hpp @@ -0,0 +1,4 @@ +// cmMod.hpp (P) +#pragma once + +#error "cmMod.hpp in incP must not be included" diff --git a/test cases/cmake/18 skip include files/main.cpp b/test cases/cmake/18 skip include files/main.cpp new file mode 100644 index 0000000..9507961 --- /dev/null +++ b/test cases/cmake/18 skip include files/main.cpp @@ -0,0 +1,10 @@ +#include +#include + +using namespace std; + +int main(void) { + cmModClass obj("Hello"); + cout << obj.getStr() << endl; + return 0; +} diff --git a/test cases/cmake/18 skip include files/meson.build b/test cases/cmake/18 skip include files/meson.build new file mode 100644 index 0000000..b9a300c --- /dev/null +++ b/test cases/cmake/18 skip include files/meson.build @@ -0,0 +1,9 @@ +project('cmakeSubTest', ['c', 'cpp']) + +cm = import('cmake') + +sub_pro = cm.subproject('cmMod') +sub_dep = sub_pro.dependency('cmModLib++') + +exe1 = executable('main', ['main.cpp'], dependencies: [sub_dep]) +test('test1', exe1) diff --git a/test cases/cmake/18 skip include files/subprojects/cmMod/CMakeLists.txt b/test cases/cmake/18 skip include files/subprojects/cmMod/CMakeLists.txt new file mode 100644 index 0000000..4db01b3 --- /dev/null +++ b/test cases/cmake/18 skip include files/subprojects/cmMod/CMakeLists.txt @@ -0,0 +1,15 @@ +cmake_minimum_required(VERSION 3.5) + +project(cmMod) +set (CMAKE_CXX_STANDARD 14) + +include_directories(${CMAKE_CURRENT_BINARY_DIR}) + +add_definitions("-DDO_NOTHING_JUST_A_FLAG=1") + +set(SRCS + ${CMAKE_CURRENT_LIST_DIR}/cmMod.hpp + ${CMAKE_CURRENT_LIST_DIR}/cmMod.cpp +) + +add_subdirectory(fakeInc) diff --git a/test cases/cmake/18 skip include files/subprojects/cmMod/cmMod.cpp b/test cases/cmake/18 skip include files/subprojects/cmMod/cmMod.cpp new file mode 100644 index 0000000..7551b75 --- /dev/null +++ b/test cases/cmake/18 skip include files/subprojects/cmMod/cmMod.cpp @@ -0,0 +1,10 @@ +#include "cmMod.hpp" + +using namespace std; + +#define MESON_INCLUDE_IMPL +#include "fakeInc/cmModInc1.cpp" +#include "fakeInc/cmModInc2.cpp" +#include "fakeInc/cmModInc3.cpp" +#include "fakeInc/cmModInc4.cpp" +#undef MESON_INCLUDE_IMPL diff --git a/test cases/cmake/18 skip include files/subprojects/cmMod/cmMod.hpp b/test cases/cmake/18 skip include files/subprojects/cmMod/cmMod.hpp new file mode 100644 index 0000000..f7b780f --- /dev/null +++ b/test cases/cmake/18 skip include files/subprojects/cmMod/cmMod.hpp @@ -0,0 +1,16 @@ +#pragma once + +#include "cmmodlib++_export.h" +#include + +class CMMODLIB___EXPORT cmModClass { +private: + std::string str; + + std::string getStr1() const; + std::string getStr2() const; +public: + cmModClass(std::string foo); + + std::string getStr() const; +}; diff --git a/test cases/cmake/18 skip include files/subprojects/cmMod/fakeInc/CMakeLists.txt b/test cases/cmake/18 skip include files/subprojects/cmMod/fakeInc/CMakeLists.txt new file mode 100644 index 0000000..39cd080 --- /dev/null +++ b/test cases/cmake/18 skip include files/subprojects/cmMod/fakeInc/CMakeLists.txt @@ -0,0 +1,30 @@ +list(APPEND SRCS + cmModInc1.cpp + cmModInc2.cpp + cmModInc3.cpp + cmModInc4.cpp +) + +set(SRC_A + cmModInc1.cpp + ${CMAKE_CURRENT_LIST_DIR}/cmModInc2.cpp +) + +set_property( + SOURCE ${SRC_A} + PROPERTY + HEADER_FILE_ONLY ON +) + +set_source_files_properties( + cmModInc3.cpp + ${CMAKE_CURRENT_LIST_DIR}/cmModInc4.cpp + PROPERTIES + LABELS "CMake;Lists;are;fun" + HEADER_FILE_ONLY ON +) + +include_directories(${CMAKE_CURRENT_BINARY_DIR}) +add_library(cmModLib++ SHARED ${SRCS}) +include(GenerateExportHeader) +generate_export_header(cmModLib++) diff --git a/test cases/cmake/18 skip include files/subprojects/cmMod/fakeInc/cmModInc1.cpp b/test cases/cmake/18 skip include files/subprojects/cmMod/fakeInc/cmModInc1.cpp new file mode 100644 index 0000000..b637755 --- /dev/null +++ b/test cases/cmake/18 skip include files/subprojects/cmMod/fakeInc/cmModInc1.cpp @@ -0,0 +1,7 @@ +#ifndef MESON_INCLUDE_IMPL +#error "MESON_INCLUDE_IMPL is not defined" +#endif // !MESON_INCLUDE_IMPL + +cmModClass::cmModClass(string foo) { + str = foo + " World"; +} diff --git a/test cases/cmake/18 skip include files/subprojects/cmMod/fakeInc/cmModInc2.cpp b/test cases/cmake/18 skip include files/subprojects/cmMod/fakeInc/cmModInc2.cpp new file mode 100644 index 0000000..8a53567 --- /dev/null +++ b/test cases/cmake/18 skip include files/subprojects/cmMod/fakeInc/cmModInc2.cpp @@ -0,0 +1,7 @@ +#ifndef MESON_INCLUDE_IMPL +#error "MESON_INCLUDE_IMPL is not defined" +#endif // !MESON_INCLUDE_IMPL + +string cmModClass::getStr() const { + return getStr2(); +} diff --git a/test cases/cmake/18 skip include files/subprojects/cmMod/fakeInc/cmModInc3.cpp b/test cases/cmake/18 skip include files/subprojects/cmMod/fakeInc/cmModInc3.cpp new file mode 100644 index 0000000..2c8ad12 --- /dev/null +++ b/test cases/cmake/18 skip include files/subprojects/cmMod/fakeInc/cmModInc3.cpp @@ -0,0 +1,7 @@ +#ifndef MESON_INCLUDE_IMPL +#error "MESON_INCLUDE_IMPL is not defined" +#endif // !MESON_INCLUDE_IMPL + +string cmModClass::getStr1() const { + return getStr2(); +} diff --git a/test cases/cmake/18 skip include files/subprojects/cmMod/fakeInc/cmModInc4.cpp b/test cases/cmake/18 skip include files/subprojects/cmMod/fakeInc/cmModInc4.cpp new file mode 100644 index 0000000..78a0673 --- /dev/null +++ b/test cases/cmake/18 skip include files/subprojects/cmMod/fakeInc/cmModInc4.cpp @@ -0,0 +1,7 @@ +#ifndef MESON_INCLUDE_IMPL +#error "MESON_INCLUDE_IMPL is not defined" +#endif // !MESON_INCLUDE_IMPL + +string cmModClass::getStr2() const { + return str; +} diff --git a/test cases/cmake/19 advanced options/main.cpp b/test cases/cmake/19 advanced options/main.cpp new file mode 100644 index 0000000..6a071cc --- /dev/null +++ b/test cases/cmake/19 advanced options/main.cpp @@ -0,0 +1,18 @@ +#include +#include +#include + +using namespace std; + +int main(void) { + cmModClass obj("Hello"); + cout << obj.getStr() << endl; + + int v1 = obj.getInt(); + int v2 = getTestInt(); + if (v1 != ((1 + v2) * 2)) { + cerr << "Number test failed" << endl; + return 1; + } + return 0; +} diff --git a/test cases/cmake/19 advanced options/meson.build b/test cases/cmake/19 advanced options/meson.build new file mode 100644 index 0000000..6332ca4 --- /dev/null +++ b/test cases/cmake/19 advanced options/meson.build @@ -0,0 +1,29 @@ +project('cmake_set_opt', ['c', 'cpp']) + +comp = meson.get_compiler('cpp') +if comp.get_argument_syntax() == 'msvc' + error('MESON_SKIP_TEST: MSVC is not supported because it does not support C++11') +endif + +cm = import('cmake') +opts = cm.subproject_options() + +opts.add_cmake_defines({'SOME_CMAKE_VAR': 'something', 'SOME_OTHER_VAR': true}) + +opts.set_override_option('cpp_std', 'c++11') # Global is C++11 +opts.set_override_option('cpp_std', 'c++14', target: 'cmModLib++') # Override it with C++14 for cmModLib++ + +opts.append_compile_args('cpp', '-DMESON_GLOBAL_FLAG=1') +opts.append_compile_args('cpp', ['-DMESON_SPECIAL_FLAG1=1', ['-DMESON_SPECIAL_FLAG2=1']], target: 'cmModLib++') +opts.append_compile_args('cpp', '-DMESON_MAGIC_INT=42', target: 'cmModLib++') +opts.append_compile_args('cpp', [[[['-DMESON_MAGIC_INT=20']]]], target: 'cmTestLib') + +opts.set_install(false) +opts.set_install(true, target: 'testEXE') + +sp = cm.subproject('cmOpts', options: opts) +dep1 = sp.dependency('cmModLib++') +dep2 = sp.dependency('cmTestLib') + +exe1 = executable('main', ['main.cpp'], dependencies: [dep1, dep2]) +test('test1', exe1) diff --git a/test cases/cmake/19 advanced options/subprojects/cmOpts/CMakeLists.txt b/test cases/cmake/19 advanced options/subprojects/cmOpts/CMakeLists.txt new file mode 100644 index 0000000..584841e --- /dev/null +++ b/test cases/cmake/19 advanced options/subprojects/cmOpts/CMakeLists.txt @@ -0,0 +1,18 @@ +cmake_minimum_required(VERSION 3.7) + +project(CmOpts) + +set(CMAKE_CXX_STANDARD 98) +set(CMAKE_CXX_STANDARD_REQUIRED ON) + +if(NOT "${SOME_CMAKE_VAR}" STREQUAL "something") + message(FATAL_ERROR "Setting the CMake var failed") +endif() + +add_library(cmModLib++ STATIC cmMod.cpp) +add_library(cmTestLib STATIC cmTest.cpp) +add_executable(testEXE main.cpp) + +target_link_libraries(testEXE cmModLib++) + +install(TARGETS cmTestLib ARCHIVE DESTINATION lib RUNTIME DESTINATION bin) diff --git a/test cases/cmake/19 advanced options/subprojects/cmOpts/cmMod.cpp b/test cases/cmake/19 advanced options/subprojects/cmOpts/cmMod.cpp new file mode 100644 index 0000000..7651b60 --- /dev/null +++ b/test cases/cmake/19 advanced options/subprojects/cmOpts/cmMod.cpp @@ -0,0 +1,31 @@ +#include "cmMod.hpp" + +using namespace std; + +#if __cplusplus < 201402L +#error "At least C++14 is required" +#endif + +#ifndef MESON_GLOBAL_FLAG +#error "MESON_GLOBAL_FLAG was not set" +#endif + +#ifndef MESON_SPECIAL_FLAG1 +#error "MESON_SPECIAL_FLAG1 was not set" +#endif + +#ifndef MESON_SPECIAL_FLAG2 +#error "MESON_SPECIAL_FLAG2 was not set" +#endif + +cmModClass::cmModClass(string foo) { + str = foo + " World"; +} + +string cmModClass::getStr() const { + return str; +} + +int cmModClass::getInt() const { + return MESON_MAGIC_INT; +} diff --git a/test cases/cmake/19 advanced options/subprojects/cmOpts/cmMod.hpp b/test cases/cmake/19 advanced options/subprojects/cmOpts/cmMod.hpp new file mode 100644 index 0000000..0748936 --- /dev/null +++ b/test cases/cmake/19 advanced options/subprojects/cmOpts/cmMod.hpp @@ -0,0 +1,14 @@ +#pragma once + +#include + +class cmModClass { +private: + std::string str; + +public: + cmModClass(std::string foo); + + std::string getStr() const; + int getInt() const; +}; diff --git a/test cases/cmake/19 advanced options/subprojects/cmOpts/cmTest.cpp b/test cases/cmake/19 advanced options/subprojects/cmOpts/cmTest.cpp new file mode 100644 index 0000000..a00cdcd --- /dev/null +++ b/test cases/cmake/19 advanced options/subprojects/cmOpts/cmTest.cpp @@ -0,0 +1,25 @@ +#include "cmTest.hpp" + +#if __cplusplus < 201103L +#error "At least C++11 is required" +#endif + +#if __cplusplus >= 201402L +#error "At most C++11 is required" +#endif + +#ifndef MESON_GLOBAL_FLAG +#error "MESON_GLOBAL_FLAG was not set" +#endif + +#ifdef MESON_SPECIAL_FLAG1 +#error "MESON_SPECIAL_FLAG1 *was* set" +#endif + +#ifdef MESON_SPECIAL_FLAG2 +#error "MESON_SPECIAL_FLAG2 *was* set" +#endif + +int getTestInt() { + return MESON_MAGIC_INT; +} diff --git a/test cases/cmake/19 advanced options/subprojects/cmOpts/cmTest.hpp b/test cases/cmake/19 advanced options/subprojects/cmOpts/cmTest.hpp new file mode 100644 index 0000000..5a3bf7b --- /dev/null +++ b/test cases/cmake/19 advanced options/subprojects/cmOpts/cmTest.hpp @@ -0,0 +1,3 @@ +#pragma once + +int getTestInt(); diff --git a/test cases/cmake/19 advanced options/subprojects/cmOpts/main.cpp b/test cases/cmake/19 advanced options/subprojects/cmOpts/main.cpp new file mode 100644 index 0000000..497d1ce --- /dev/null +++ b/test cases/cmake/19 advanced options/subprojects/cmOpts/main.cpp @@ -0,0 +1,10 @@ +#include +#include "cmMod.hpp" + +using namespace std; + +int main(void) { + cmModClass obj("Hello (LIB TEST)"); + cout << obj.getStr() << endl; + return 0; +} diff --git a/test cases/cmake/19 advanced options/test.json b/test cases/cmake/19 advanced options/test.json new file mode 100644 index 0000000..29888ea --- /dev/null +++ b/test cases/cmake/19 advanced options/test.json @@ -0,0 +1,5 @@ +{ + "installed": [ + {"type": "exe", "file": "usr/bin/testEXE"} + ] +} diff --git a/test cases/cmake/2 advanced/main.cpp b/test cases/cmake/2 advanced/main.cpp new file mode 100644 index 0000000..d823e29 --- /dev/null +++ b/test cases/cmake/2 advanced/main.cpp @@ -0,0 +1,15 @@ +#include +#include +#include "config.h" + +#if CONFIG_OPT != 42 +#error "Invalid value of CONFIG_OPT" +#endif + +using namespace std; + +int main(void) { + cmModClass obj("Hello"); + cout << obj.getStr() << endl; + return 0; +} diff --git a/test cases/cmake/2 advanced/meson.build b/test cases/cmake/2 advanced/meson.build new file mode 100644 index 0000000..b301bfe --- /dev/null +++ b/test cases/cmake/2 advanced/meson.build @@ -0,0 +1,27 @@ +project('cmakeSubTest_advanced', ['c', 'cpp']) + +dep_test = dependency('ZLIB', method: 'cmake', required: false) +if not dep_test.found() + error('MESON_SKIP_TEST: zlib is not installed') +endif + +cm = import('cmake') + +# Test the "normal" subproject call +sub_pro = cm.subproject('cmMod') +sub_dep = sub_pro.dependency('cmModLib') +sub_sta = sub_pro.dependency('cmModLibStatic') + +# Build some files +exe1 = executable('main1', ['main.cpp'], dependencies: [sub_dep]) +exe2 = executable('main2', ['main.cpp'], dependencies: [sub_sta]) +test('test1', exe1) +test('test2', exe2) + +# Test if we can also extract executables +assert(sub_pro.target_type('testEXE') == 'executable', 'The type must be executable for obvious reasons') +test('test3', sub_pro.target('testEXE')) + +# Test that we can add a new target with the same name as the CMake subproject +exe4 = executable('testEXE', ['main.cpp'], dependencies: [sub_sta]) +test('test4', exe4) diff --git a/test cases/cmake/2 advanced/subprojects/cmMod/CMakeLists.txt b/test cases/cmake/2 advanced/subprojects/cmMod/CMakeLists.txt new file mode 100644 index 0000000..0750117 --- /dev/null +++ b/test cases/cmake/2 advanced/subprojects/cmMod/CMakeLists.txt @@ -0,0 +1,38 @@ +cmake_minimum_required(VERSION 3.5) + +project(cmMod) +set(CMAKE_CXX_STANDARD 14) + +find_package(ZLIB REQUIRED) + +include_directories(${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/lib) + +set(CONFIG_OPT 42) +configure_file("config.h.in" "${CMAKE_CURRENT_BINARY_DIR}/config.h" @ONLY) + +add_library(cmModLib SHARED lib/cmMod.cpp) +add_library(cmModLibStatic STATIC lib/cmMod.cpp) +include(GenerateExportHeader) +generate_export_header(cmModLib) + +set_target_properties(cmModLib PROPERTIES VERSION 1.0.1) + +add_executable(testEXE main.cpp "${CMAKE_CURRENT_BINARY_DIR}/config.h") + +target_link_libraries(cmModLib ZLIB::ZLIB) +target_link_libraries(cmModLibStatic ;ZLIB::ZLIB;) +target_link_libraries(testEXE cmModLib) + +if(APPLE) + find_library(COREFOUNDATION_FRAMEWORK "CoreFoundation") + if(NOT COREFOUNDATION_FRAMEWORK) + message(FATAL_ERROR "CoreFoundation framework not found") + endif() + + target_link_libraries(cmModLibStatic "${COREFOUNDATION_FRAMEWORK}") + target_compile_definitions(cmModLibStatic PUBLIC USE_FRAMEWORK) +endif() + +target_compile_definitions(cmModLibStatic PUBLIC CMMODLIB_STATIC_DEFINE) + +install(TARGETS testEXE LIBRARY DESTINATION lib RUNTIME DESTINATION bin) diff --git a/test cases/cmake/2 advanced/subprojects/cmMod/config.h.in b/test cases/cmake/2 advanced/subprojects/cmMod/config.h.in new file mode 100644 index 0000000..f538ac9 --- /dev/null +++ b/test cases/cmake/2 advanced/subprojects/cmMod/config.h.in @@ -0,0 +1,3 @@ +#pragma once + +#define CONFIG_OPT @CONFIG_OPT@ diff --git a/test cases/cmake/2 advanced/subprojects/cmMod/lib/cmMod.cpp b/test cases/cmake/2 advanced/subprojects/cmMod/lib/cmMod.cpp new file mode 100644 index 0000000..eb41438 --- /dev/null +++ b/test cases/cmake/2 advanced/subprojects/cmMod/lib/cmMod.cpp @@ -0,0 +1,26 @@ +#include "cmMod.hpp" +#include +#include "config.h" + +#if CONFIG_OPT != 42 +#error "Invalid value of CONFIG_OPT" +#endif + +#ifdef USE_FRAMEWORK +#include +#endif + +using namespace std; + +cmModClass::cmModClass(string foo) { + str = foo + " World " + zlibVersion(); + +#ifdef USE_FRAMEWORK + CFStringRef ref = CFStringCreateWithCString(NULL, str.c_str(), kCFStringEncodingUTF8); + CFRelease(ref); +#endif +} + +string cmModClass::getStr() const { + return str; +} diff --git a/test cases/cmake/2 advanced/subprojects/cmMod/lib/cmMod.hpp b/test cases/cmake/2 advanced/subprojects/cmMod/lib/cmMod.hpp new file mode 100644 index 0000000..52f576b --- /dev/null +++ b/test cases/cmake/2 advanced/subprojects/cmMod/lib/cmMod.hpp @@ -0,0 +1,13 @@ +#pragma once + +#include +#include "cmmodlib_export.h" + +class CMMODLIB_EXPORT cmModClass { + private: + std::string str; + public: + cmModClass(std::string foo); + + std::string getStr() const; +}; diff --git a/test cases/cmake/2 advanced/subprojects/cmMod/main.cpp b/test cases/cmake/2 advanced/subprojects/cmMod/main.cpp new file mode 100644 index 0000000..77fab68 --- /dev/null +++ b/test cases/cmake/2 advanced/subprojects/cmMod/main.cpp @@ -0,0 +1,11 @@ +#include +#include +#include "lib/cmMod.hpp" + +using namespace std; + +int main(void) { + cmModClass obj("Hello (LIB TEST)"); + cout << obj.getStr() << " ZLIB: " << zlibVersion() << endl; + return 0; +} diff --git a/test cases/cmake/2 advanced/test.json b/test cases/cmake/2 advanced/test.json new file mode 100644 index 0000000..29888ea --- /dev/null +++ b/test cases/cmake/2 advanced/test.json @@ -0,0 +1,5 @@ +{ + "installed": [ + {"type": "exe", "file": "usr/bin/testEXE"} + ] +} diff --git a/test cases/cmake/20 cmake file/foolib.cmake.in b/test cases/cmake/20 cmake file/foolib.cmake.in new file mode 100644 index 0000000..16e992b --- /dev/null +++ b/test cases/cmake/20 cmake file/foolib.cmake.in @@ -0,0 +1 @@ +@foo@ diff --git a/test cases/cmake/20 cmake file/meson.build b/test cases/cmake/20 cmake file/meson.build new file mode 100644 index 0000000..5c45d66 --- /dev/null +++ b/test cases/cmake/20 cmake file/meson.build @@ -0,0 +1,12 @@ +project( + 'cmake config file', +) + +cmake = import('cmake') + +cmake.configure_package_config_file( + name : 'foolib', + input : 'foolib.cmake.in', + install_dir : get_option('libdir') / 'cmake', + configuration : {'foo': '"bar"'}, +) diff --git a/test cases/cmake/20 cmake file/test.json b/test cases/cmake/20 cmake file/test.json new file mode 100644 index 0000000..a8c4ba3 --- /dev/null +++ b/test cases/cmake/20 cmake file/test.json @@ -0,0 +1,5 @@ +{ + "installed": [ + {"file": "usr/lib/cmake/foolibConfig.cmake", "type": "file"} + ] +} diff --git a/test cases/cmake/21 shared module/meson.build b/test cases/cmake/21 shared module/meson.build new file mode 100644 index 0000000..c6ff957 --- /dev/null +++ b/test cases/cmake/21 shared module/meson.build @@ -0,0 +1,13 @@ +project('cmakeSharedModule', ['c', 'cpp']) + +cm = import('cmake') + +sub_pro = cm.subproject('cmMod') +sub_dep = sub_pro.dependency('myMod') + +dl = meson.get_compiler('c').find_library('dl', required: false) + +l = shared_library('runtime', 'runtime.c') +e = executable('prog', ['prog.c'], link_with: l, dependencies: [sub_dep, dl]) +m = sub_pro.target('myMod') +test('test1', e, args : m) diff --git a/test cases/cmake/21 shared module/prog.c b/test cases/cmake/21 shared module/prog.c new file mode 100644 index 0000000..228a976 --- /dev/null +++ b/test cases/cmake/21 shared module/prog.c @@ -0,0 +1,108 @@ + +#include +#include "module.h" + +#if SPECIAL_MAGIC_DEFINE != 42 +#error "SPECIAL_MAGIC_DEFINE is not defined" +#endif + +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/cmake/21 shared module/runtime.c b/test cases/cmake/21 shared module/runtime.c new file mode 100644 index 0000000..03bde86 --- /dev/null +++ b/test cases/cmake/21 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/cmake/21 shared module/subprojects/cmMod/CMakeLists.txt b/test cases/cmake/21 shared module/subprojects/cmMod/CMakeLists.txt new file mode 100644 index 0000000..d2fcfe3 --- /dev/null +++ b/test cases/cmake/21 shared module/subprojects/cmMod/CMakeLists.txt @@ -0,0 +1,7 @@ +cmake_minimum_required(VERSION 3.5) + +project(cmModule) + +include_directories("${CMAKE_CURRENT_SOURCE_DIR}/module") + +add_library(myMod MODULE "${CMAKE_CURRENT_SOURCE_DIR}/module/module.c") diff --git a/test cases/cmake/21 shared module/subprojects/cmMod/module/module.c b/test cases/cmake/21 shared module/subprojects/cmMod/module/module.c new file mode 100644 index 0000000..5dd26d7 --- /dev/null +++ b/test cases/cmake/21 shared module/subprojects/cmMod/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/cmake/21 shared module/subprojects/cmMod/module/module.h b/test cases/cmake/21 shared module/subprojects/cmMod/module/module.h new file mode 100644 index 0000000..e1d9c13 --- /dev/null +++ b/test cases/cmake/21 shared module/subprojects/cmMod/module/module.h @@ -0,0 +1,3 @@ +#pragma once + +#define SPECIAL_MAGIC_DEFINE 42 diff --git a/test cases/cmake/22 cmake module/cmake_project/CMakeLists.txt b/test cases/cmake/22 cmake module/cmake_project/CMakeLists.txt new file mode 100644 index 0000000..cd91584 --- /dev/null +++ b/test cases/cmake/22 cmake module/cmake_project/CMakeLists.txt @@ -0,0 +1,4 @@ +cmake_minimum_required(VERSION 2.8) +project(cmakeMeson C) + +find_package(cmakeModule REQUIRED) \ No newline at end of file diff --git a/test cases/cmake/22 cmake module/meson.build b/test cases/cmake/22 cmake module/meson.build new file mode 100644 index 0000000..68f9993 --- /dev/null +++ b/test cases/cmake/22 cmake module/meson.build @@ -0,0 +1,31 @@ +project('cmakeModule', 'c', version: '1.0.0') + +if build_machine.system() == 'cygwin' + error('MESON_SKIP_TEST CMake is broken on Cygwin.') +endif + +cmake_bin = find_program('cmake', required: false) +if not cmake_bin.found() + error('MESON_SKIP_TEST CMake not installed.') +endif + +cc = meson.get_compiler('c') +if cc.get_id() == 'clang-cl' and meson.backend() == 'ninja' and build_machine.system() == 'windows' + error('MESON_SKIP_TEST CMake installation nor operational for vs2017 clangclx64ninja') +endif + +cmake = import('cmake') + +cmake.write_basic_package_version_file(version: '0.0.1', + name: 'cmakeModule', +) + +conf = configuration_data() +conf.set('MYVAR', 'my variable value') +conf.set_quoted('MYQUOTEDVAR', 'my quoted variable value') + +cmake.configure_package_config_file( + input: 'projectConfig.cmake.in', + name: 'cmakeModule', + configuration: conf, +) diff --git a/test cases/cmake/22 cmake module/projectConfig.cmake.in b/test cases/cmake/22 cmake module/projectConfig.cmake.in new file mode 100644 index 0000000..fa3dfca --- /dev/null +++ b/test cases/cmake/22 cmake module/projectConfig.cmake.in @@ -0,0 +1,4 @@ +@PACKAGE_INIT@ + +set(MYVAR "@MYVAR@") +set(MYQUOTEDVAR @MYQUOTEDVAR@) diff --git a/test cases/cmake/22 cmake module/test.json b/test cases/cmake/22 cmake module/test.json new file mode 100644 index 0000000..2a5625a --- /dev/null +++ b/test cases/cmake/22 cmake module/test.json @@ -0,0 +1,6 @@ +{ + "installed": [ + {"type": "file", "file": "usr/lib/cmake/cmakeModule/cmakeModuleConfig.cmake"}, + {"type": "file", "file": "usr/lib/cmake/cmakeModule/cmakeModuleConfigVersion.cmake"} + ] +} diff --git a/test cases/cmake/23 cmake toolchain/CMakeToolchain.cmake b/test cases/cmake/23 cmake toolchain/CMakeToolchain.cmake new file mode 100644 index 0000000..ab5fbac --- /dev/null +++ b/test cases/cmake/23 cmake toolchain/CMakeToolchain.cmake @@ -0,0 +1 @@ +set(MESON_TEST_VAR2 VAR2) diff --git a/test cases/cmake/23 cmake toolchain/meson.build b/test cases/cmake/23 cmake toolchain/meson.build new file mode 100644 index 0000000..8399597 --- /dev/null +++ b/test cases/cmake/23 cmake toolchain/meson.build @@ -0,0 +1,13 @@ +project('cmake toolchain test', ['c']) + +if meson.is_cross_build() + error('MESON_SKIP_TEST: skip this on cross builds') +endif + +cm = import('cmake') + +sub_pro = cm.subproject('cmMod') + +add_languages('cpp') + +sub_pro = cm.subproject('cmModFortran') diff --git a/test cases/cmake/23 cmake toolchain/nativefile.ini.in b/test cases/cmake/23 cmake toolchain/nativefile.ini.in new file mode 100644 index 0000000..1f4037d --- /dev/null +++ b/test cases/cmake/23 cmake toolchain/nativefile.ini.in @@ -0,0 +1,9 @@ +[properties] + +cmake_toolchain_file = '@MESON_TEST_ROOT@/CMakeToolchain.cmake' +cmake_skip_compiler_test = 'always' + +[cmake] + +MESON_TEST_VAR1 = 'VAR1 space' +MESON_TEST_VAR2 = 'VAR2 error' diff --git a/test cases/cmake/23 cmake toolchain/subprojects/cmMod/CMakeLists.txt b/test cases/cmake/23 cmake toolchain/subprojects/cmMod/CMakeLists.txt new file mode 100644 index 0000000..a00affa --- /dev/null +++ b/test cases/cmake/23 cmake toolchain/subprojects/cmMod/CMakeLists.txt @@ -0,0 +1,15 @@ +cmake_minimum_required(VERSION 3.5) + +project(cmMod NONE) + +if(NOT "${MESON_TEST_VAR1}" STREQUAL "VAR1 space") + message(FATAL_ERROR "MESON_TEST_VAR1 -- '${MESON_TEST_VAR1}' != 'VAR1 space'") +endif() + +if(NOT "${MESON_TEST_VAR2}" STREQUAL "VAR2") + message(FATAL_ERROR "MESON_TEST_VAR2 -- '${MESON_TEST_VAR2}' != 'VAR2'") +endif() + +if(NOT DEFINED CMAKE_C_COMPILER_VERSION) + message(FATAL_ERROR "CMAKE_C_COMPILER_VERSION was not defined") +endif() diff --git a/test cases/cmake/23 cmake toolchain/subprojects/cmModFortran/CMakeLists.txt b/test cases/cmake/23 cmake toolchain/subprojects/cmModFortran/CMakeLists.txt new file mode 100644 index 0000000..ecf1737 --- /dev/null +++ b/test cases/cmake/23 cmake toolchain/subprojects/cmModFortran/CMakeLists.txt @@ -0,0 +1,19 @@ +cmake_minimum_required(VERSION 3.5) + +project(cmMod NONE) + +if(NOT "${MESON_TEST_VAR1}" STREQUAL "VAR1 space") + message(FATAL_ERROR "MESON_TEST_VAR1 -- '${MESON_TEST_VAR1}' != 'VAR1 space'") +endif() + +if(NOT "${MESON_TEST_VAR2}" STREQUAL "VAR2") + message(FATAL_ERROR "MESON_TEST_VAR2 -- '${MESON_TEST_VAR2}' != 'VAR2'") +endif() + +if(NOT DEFINED CMAKE_C_COMPILER_VERSION) + message(FATAL_ERROR "CMAKE_C_COMPILER_VERSION was not defined") +endif() + +if(NOT DEFINED CMAKE_CXX_COMPILER_VERSION) + message(FATAL_ERROR "CMAKE_CXX_COMPILER_VERSION was not defined") +endif() diff --git a/test cases/cmake/24 mixing languages/main.c b/test cases/cmake/24 mixing languages/main.c new file mode 100644 index 0000000..028a78e --- /dev/null +++ b/test cases/cmake/24 mixing languages/main.c @@ -0,0 +1,5 @@ +#include + +int main(void) { + return doStuff(); +} diff --git a/test cases/cmake/24 mixing languages/meson.build b/test cases/cmake/24 mixing languages/meson.build new file mode 100644 index 0000000..4ab1d85 --- /dev/null +++ b/test cases/cmake/24 mixing languages/meson.build @@ -0,0 +1,13 @@ +project('CMake mix', ['c', 'cpp']) + +if not add_languages('objc', required : false) + error('MESON_SKIP_TEST: No ObjC compiler') +endif + +cm = import('cmake') + +sub_pro = cm.subproject('cmTest') +sub_dep = sub_pro.dependency('cmTest', include_type: 'system') + +exe1 = executable('exe1', ['main.c'], dependencies: [sub_dep]) +test('test1', exe1) diff --git a/test cases/cmake/24 mixing languages/subprojects/cmTest/CMakeLists.txt b/test cases/cmake/24 mixing languages/subprojects/cmTest/CMakeLists.txt new file mode 100644 index 0000000..80a256f --- /dev/null +++ b/test cases/cmake/24 mixing languages/subprojects/cmTest/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.5) + +project(cmTest) + +include_directories(${CMAKE_CURRENT_BINARY_DIR}) + +add_library(cmTest STATIC cmTest.c cmTest.m) +target_compile_definitions(cmTest PUBLIC SOME_MAGIC_DEFINE=42) diff --git a/test cases/cmake/24 mixing languages/subprojects/cmTest/cmTest.c b/test cases/cmake/24 mixing languages/subprojects/cmTest/cmTest.c new file mode 100644 index 0000000..066d676 --- /dev/null +++ b/test cases/cmake/24 mixing languages/subprojects/cmTest/cmTest.c @@ -0,0 +1,13 @@ +#include "cmTest.h" +#include + +#if SOME_MAGIC_DEFINE != 42 +#error "SOME_MAGIC_DEFINE != 42" +#endif + +int foo(int x); + +int doStuff(void) { + printf("Hello World\n"); + return foo(42); +} diff --git a/test cases/cmake/24 mixing languages/subprojects/cmTest/cmTest.h b/test cases/cmake/24 mixing languages/subprojects/cmTest/cmTest.h new file mode 100644 index 0000000..a6a5c24 --- /dev/null +++ b/test cases/cmake/24 mixing languages/subprojects/cmTest/cmTest.h @@ -0,0 +1,3 @@ +#pragma once + +int doStuff(void); diff --git a/test cases/cmake/24 mixing languages/subprojects/cmTest/cmTest.m b/test cases/cmake/24 mixing languages/subprojects/cmTest/cmTest.m new file mode 100644 index 0000000..16ec805 --- /dev/null +++ b/test cases/cmake/24 mixing languages/subprojects/cmTest/cmTest.m @@ -0,0 +1,7 @@ +#if SOME_MAGIC_DEFINE != 42 +#error "SOME_MAGIC_DEFINE != 42" +#endif + +int foo(int x) { + return 42 - x; +} diff --git a/test cases/cmake/25 assembler/main.c b/test cases/cmake/25 assembler/main.c new file mode 100644 index 0000000..5aef967 --- /dev/null +++ b/test cases/cmake/25 assembler/main.c @@ -0,0 +1,18 @@ +#include +#include + +int32_t cmTestFunc(void); + +int main(void) +{ + if (cmTestFunc() > 4200) + { + printf("Test success.\n"); + return 0; + } + else + { + printf("Test failure.\n"); + return 1; + } +} diff --git a/test cases/cmake/25 assembler/meson.build b/test cases/cmake/25 assembler/meson.build new file mode 100644 index 0000000..7180356 --- /dev/null +++ b/test cases/cmake/25 assembler/meson.build @@ -0,0 +1,9 @@ +project('assembler test', ['c', 'cpp']) + +cm = import('cmake') + +sub_pro = cm.subproject('cmTest') +sub_dep = sub_pro.dependency('cmTest') + +exe1 = executable('exe1', ['main.c'], dependencies: [sub_dep]) +test('test1', exe1) diff --git a/test cases/cmake/25 assembler/subprojects/cmTest/CMakeLists.txt b/test cases/cmake/25 assembler/subprojects/cmTest/CMakeLists.txt new file mode 100644 index 0000000..bb8834d --- /dev/null +++ b/test cases/cmake/25 assembler/subprojects/cmTest/CMakeLists.txt @@ -0,0 +1,45 @@ +cmake_minimum_required(VERSION 3.5) + +project(cmTest) + +#Detect processor +if ("${CMAKE_SYSTEM_PROCESSOR}" MATCHES "amd64") + SET(TEST_PROCESSOR "x86_64") +elseif ("${CMAKE_SYSTEM_PROCESSOR}" MATCHES "x86_64") + SET(TEST_PROCESSOR "x86_64") +elseif ("${CMAKE_SYSTEM_PROCESSOR}" MATCHES "i386") + SET(TEST_PROCESSOR "x86") +elseif ("${CMAKE_SYSTEM_PROCESSOR}" MATCHES "i686") + SET(TEST_PROCESSOR "x86") +elseif ("${CMAKE_SYSTEM_PROCESSOR}" MATCHES "arm") + SET(TEST_PROCESSOR "arm") +elseif ("${CMAKE_SYSTEM_PROCESSOR}" MATCHES "aarch64") + SET(TEST_PROCESSOR "arm") +else () + message(FATAL_ERROR "MESON_SKIP_TEST: Unsupported Assembler Platform") +endif () + +#Detect ABI +if ("${CMAKE_SYSTEM_NAME}" MATCHES "Linux") + SET(TEST_ABI "sysv") +elseif ("${CMAKE_SYSTEM_NAME}" MATCHES "FreeBSD") + SET(TEST_ABI "sysv") +elseif ("${CMAKE_SYSTEM_NAME}" MATCHES "NetBSD") + SET(TEST_ABI "sysv") +elseif ("${CMAKE_SYSTEM_NAME}" MATCHES "OpenBSD") + SET(TEST_ABI "sysv") +else () + message(FATAL_ERROR "MESON_SKIP_TEST: Unsupported Assembler Platform") +endif () + +SET(TEST_PLATFORM "${TEST_PROCESSOR}-${TEST_ABI}") + +if ( ("${TEST_PLATFORM}" MATCHES "x86_64-sysv") + OR ("${TEST_PLATFORM}" MATCHES "x86-sysv") + OR ("${TEST_PLATFORM}" MATCHES "arm-sysv")) + SET(CMAKE_ASM_COMPILER ${CMAKE_C_COMPILER}) + enable_language(ASM) + SET(TEST_SOURCE "cmTestAsm.s") +endif () + +add_library(cmTest STATIC cmTest.c ${TEST_SOURCE}) diff --git a/test cases/cmake/25 assembler/subprojects/cmTest/cmTest.c b/test cases/cmake/25 assembler/subprojects/cmTest/cmTest.c new file mode 100644 index 0000000..e32415c --- /dev/null +++ b/test cases/cmake/25 assembler/subprojects/cmTest/cmTest.c @@ -0,0 +1,8 @@ +#include + +extern const int32_t cmTestArea; + +int32_t cmTestFunc(void) +{ + return cmTestArea; +} diff --git a/test cases/cmake/25 assembler/subprojects/cmTest/cmTestAsm.s b/test cases/cmake/25 assembler/subprojects/cmTest/cmTestAsm.s new file mode 100644 index 0000000..8aa83a6 --- /dev/null +++ b/test cases/cmake/25 assembler/subprojects/cmTest/cmTestAsm.s @@ -0,0 +1,4 @@ +.text +.globl cmTestArea +cmTestArea: + .long 4242 diff --git a/test cases/cmake/3 advanced no dep/main.cpp b/test cases/cmake/3 advanced no dep/main.cpp new file mode 100644 index 0000000..d823e29 --- /dev/null +++ b/test cases/cmake/3 advanced no dep/main.cpp @@ -0,0 +1,15 @@ +#include +#include +#include "config.h" + +#if CONFIG_OPT != 42 +#error "Invalid value of CONFIG_OPT" +#endif + +using namespace std; + +int main(void) { + cmModClass obj("Hello"); + cout << obj.getStr() << endl; + return 0; +} diff --git a/test cases/cmake/3 advanced no dep/meson.build b/test cases/cmake/3 advanced no dep/meson.build new file mode 100644 index 0000000..f8f1836 --- /dev/null +++ b/test cases/cmake/3 advanced no dep/meson.build @@ -0,0 +1,19 @@ +project('cmakeSubTest_advanced', ['c', 'cpp']) + +cm = import('cmake') + +# Test the "normal" subproject call +sub_pro = cm.subproject('cmMod') +sub_dep = sub_pro.dependency('cmModLib') +sub_sta = sub_pro.dependency('cmModLibStatic') + +# Build some files +exe1 = executable('main1', ['main.cpp'], dependencies: [sub_dep]) +exe2 = executable('main2', ['main.cpp'], dependencies: [sub_sta]) +test('test1', exe1) +test('test2', exe2) + +# Test if we can also extract executables +assert(sub_pro.target_type('meson-testEXE') == 'executable', 'The type must be executable for obvious reasons') +test('test3', sub_pro.target('meson-testEXE')) +test('test4', sub_pro.target('benchmark')) diff --git a/test cases/cmake/3 advanced no dep/subprojects/cmMod/CMakeLists.txt b/test cases/cmake/3 advanced no dep/subprojects/cmMod/CMakeLists.txt new file mode 100644 index 0000000..d738d45 --- /dev/null +++ b/test cases/cmake/3 advanced no dep/subprojects/cmMod/CMakeLists.txt @@ -0,0 +1,26 @@ +cmake_minimum_required(VERSION 3.5) + +project(cmMod) +set(CMAKE_CXX_STANDARD 14) + +include_directories(${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/lib) + +set(CONFIG_OPT 42) +configure_file("config.h.in" "${CMAKE_CURRENT_BINARY_DIR}/config.h" @ONLY) + +add_library(cmModLib SHARED lib/cmMod.cpp) +add_library(cmModLibStatic STATIC lib/cmMod.cpp) +include(GenerateExportHeader) +generate_export_header(cmModLib) + +set_target_properties(cmModLib PROPERTIES VERSION 1.0.1) + +add_executable(meson-testEXE main.cpp) +add_executable(benchmark main.cpp) + +target_link_libraries(meson-testEXE cmModLib) +target_link_libraries(benchmark cmModLib) + +target_compile_definitions(cmModLibStatic PUBLIC CMMODLIB_STATIC_DEFINE) + +install(TARGETS meson-testEXE benchmark LIBRARY DESTINATION lib RUNTIME DESTINATION bin) diff --git a/test cases/cmake/3 advanced no dep/subprojects/cmMod/config.h.in b/test cases/cmake/3 advanced no dep/subprojects/cmMod/config.h.in new file mode 100644 index 0000000..f538ac9 --- /dev/null +++ b/test cases/cmake/3 advanced no dep/subprojects/cmMod/config.h.in @@ -0,0 +1,3 @@ +#pragma once + +#define CONFIG_OPT @CONFIG_OPT@ diff --git a/test cases/cmake/3 advanced no dep/subprojects/cmMod/lib/cmMod.cpp b/test cases/cmake/3 advanced no dep/subprojects/cmMod/lib/cmMod.cpp new file mode 100644 index 0000000..741e8df --- /dev/null +++ b/test cases/cmake/3 advanced no dep/subprojects/cmMod/lib/cmMod.cpp @@ -0,0 +1,16 @@ +#include "cmMod.hpp" +#include "config.h" + +#if CONFIG_OPT != 42 +#error "Invalid value of CONFIG_OPT" +#endif + +using namespace std; + +cmModClass::cmModClass(string foo) { + str = foo + " World"; +} + +string cmModClass::getStr() const { + return str; +} diff --git a/test cases/cmake/3 advanced no dep/subprojects/cmMod/lib/cmMod.hpp b/test cases/cmake/3 advanced no dep/subprojects/cmMod/lib/cmMod.hpp new file mode 100644 index 0000000..52f576b --- /dev/null +++ b/test cases/cmake/3 advanced no dep/subprojects/cmMod/lib/cmMod.hpp @@ -0,0 +1,13 @@ +#pragma once + +#include +#include "cmmodlib_export.h" + +class CMMODLIB_EXPORT cmModClass { + private: + std::string str; + public: + cmModClass(std::string foo); + + std::string getStr() const; +}; diff --git a/test cases/cmake/3 advanced no dep/subprojects/cmMod/main.cpp b/test cases/cmake/3 advanced no dep/subprojects/cmMod/main.cpp new file mode 100644 index 0000000..d3e67ca --- /dev/null +++ b/test cases/cmake/3 advanced no dep/subprojects/cmMod/main.cpp @@ -0,0 +1,10 @@ +#include +#include "lib/cmMod.hpp" + +using namespace std; + +int main(void) { + cmModClass obj("Hello (LIB TEST)"); + cout << obj.getStr() << endl; + return 0; +} diff --git a/test cases/cmake/3 advanced no dep/test.json b/test cases/cmake/3 advanced no dep/test.json new file mode 100644 index 0000000..e75e54a --- /dev/null +++ b/test cases/cmake/3 advanced no dep/test.json @@ -0,0 +1,8 @@ +{ + "installed": [ + {"type": "pdb", "file": "usr/bin/cm_meson_testEXE"}, + {"type": "exe", "file": "usr/bin/cm_meson_testEXE"}, + {"type": "pdb", "file": "usr/bin/cm_benchmark"}, + {"type": "exe", "file": "usr/bin/cm_benchmark"} + ] +} diff --git a/test cases/cmake/4 code gen/main.cpp b/test cases/cmake/4 code gen/main.cpp new file mode 100644 index 0000000..a41204b --- /dev/null +++ b/test cases/cmake/4 code gen/main.cpp @@ -0,0 +1,8 @@ +#include +#include "test.hpp" + +using namespace std; + +int main(void) { + cout << getStr() << endl; +} diff --git a/test cases/cmake/4 code gen/meson.build b/test cases/cmake/4 code gen/meson.build new file mode 100644 index 0000000..80c801f --- /dev/null +++ b/test cases/cmake/4 code gen/meson.build @@ -0,0 +1,24 @@ +project('cmake_code_gen', ['c', 'cpp']) + +if meson.is_cross_build() + error('MESON_SKIP_TEST this test does not cross compile correctly.') +endif + +cm = import('cmake') + +# Subproject with the "code generator" +sub_pro = cm.subproject('cmCodeGen') +sub_exe = sub_pro.target('genA') + +# Generate the source +generated = custom_target( + 'cmake-generated', + input: [], + output: ['test.cpp'], + command: [sub_exe, '@OUTPUT@'] +) + +# Build the exe +exe1 = executable('main1', ['main.cpp', generated]) + +test('test1', exe1) diff --git a/test cases/cmake/4 code gen/subprojects/cmCodeGen/CMakeLists.txt b/test cases/cmake/4 code gen/subprojects/cmCodeGen/CMakeLists.txt new file mode 100644 index 0000000..ff50e54 --- /dev/null +++ b/test cases/cmake/4 code gen/subprojects/cmCodeGen/CMakeLists.txt @@ -0,0 +1,6 @@ +cmake_minimum_required(VERSION 3.7) + +project(CMCodeGen) +set(CMAKE_CXX_STANDARD 14) + +add_executable(genA main.cpp) diff --git a/test cases/cmake/4 code gen/subprojects/cmCodeGen/main.cpp b/test cases/cmake/4 code gen/subprojects/cmCodeGen/main.cpp new file mode 100644 index 0000000..5b7fed2 --- /dev/null +++ b/test cases/cmake/4 code gen/subprojects/cmCodeGen/main.cpp @@ -0,0 +1,21 @@ +#include +#include + +using namespace std; + +int main(int argc, const char *argv[]) { + if(argc < 2) { + cerr << argv[0] << " requires an output file!" << endl; + return 1; + } + ofstream out(argv[1]); + out << R"( +#include "test.hpp" + +std::string getStr() { + return "Hello World"; +} +)"; + + return 0; +} diff --git a/test cases/cmake/4 code gen/test.hpp b/test cases/cmake/4 code gen/test.hpp new file mode 100644 index 0000000..8e25a0a --- /dev/null +++ b/test cases/cmake/4 code gen/test.hpp @@ -0,0 +1,5 @@ +#pragma once + +#include + +std::string getStr(); diff --git a/test cases/cmake/5 object library/main.cpp b/test cases/cmake/5 object library/main.cpp new file mode 100644 index 0000000..9933ab4 --- /dev/null +++ b/test cases/cmake/5 object library/main.cpp @@ -0,0 +1,11 @@ +#include +#include +#include "libA.hpp" +#include "libB.hpp" + +using namespace std; + +int main(void) { + cout << getLibStr() << " -- " << getZlibVers() << endl; + return EXIT_SUCCESS; +} diff --git a/test cases/cmake/5 object library/meson.build b/test cases/cmake/5 object library/meson.build new file mode 100644 index 0000000..f38a2dd --- /dev/null +++ b/test cases/cmake/5 object library/meson.build @@ -0,0 +1,21 @@ +project('cmake_object_lib_test', ['c', 'cpp']) + +dep_test = dependency('ZLIB', method: 'cmake', required: false) +if not dep_test.found() + error('MESON_SKIP_TEST: zlib is not installed') +endif + +cm = import('cmake') + +sub_pro = cm.subproject('cmObjLib') +sub_sha = sub_pro.dependency('lib_sha') +sub_sta = sub_pro.dependency('lib_sta') + +# Required for the static library +zlib_dep = dependency('zlib') + +exe_sha = executable('shared', ['main.cpp'], dependencies: [sub_sha]) +exe_sta = executable('static', ['main.cpp'], dependencies: [sub_sta, zlib_dep]) + +test('test1', exe_sha) +test('test1', exe_sta) diff --git a/test cases/cmake/5 object library/subprojects/cmObjLib/CMakeLists.txt b/test cases/cmake/5 object library/subprojects/cmObjLib/CMakeLists.txt new file mode 100644 index 0000000..062496e --- /dev/null +++ b/test cases/cmake/5 object library/subprojects/cmObjLib/CMakeLists.txt @@ -0,0 +1,11 @@ +cmake_minimum_required(VERSION 3.7) +project(cmObject CXX) + +find_package(ZLIB REQUIRED) + +add_library(lib_obj OBJECT libA.cpp libB.cpp) +add_library(lib_sha SHARED $) +add_library(lib_sta STATIC $) + +target_link_libraries(lib_sha ZLIB::ZLIB) +target_link_libraries(lib_sta ZLIB::ZLIB) diff --git a/test cases/cmake/5 object library/subprojects/cmObjLib/libA.cpp b/test cases/cmake/5 object library/subprojects/cmObjLib/libA.cpp new file mode 100644 index 0000000..1d579cf --- /dev/null +++ b/test cases/cmake/5 object library/subprojects/cmObjLib/libA.cpp @@ -0,0 +1,5 @@ +#include "libA.hpp" + +std::string getLibStr(void) { + return "Hello World"; +} diff --git a/test cases/cmake/5 object library/subprojects/cmObjLib/libA.hpp b/test cases/cmake/5 object library/subprojects/cmObjLib/libA.hpp new file mode 100644 index 0000000..84b7bc7 --- /dev/null +++ b/test cases/cmake/5 object library/subprojects/cmObjLib/libA.hpp @@ -0,0 +1,16 @@ +#pragma once + +#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 + +std::string DLL_PUBLIC getLibStr(); diff --git a/test cases/cmake/5 object library/subprojects/cmObjLib/libB.cpp b/test cases/cmake/5 object library/subprojects/cmObjLib/libB.cpp new file mode 100644 index 0000000..22fe7c2 --- /dev/null +++ b/test cases/cmake/5 object library/subprojects/cmObjLib/libB.cpp @@ -0,0 +1,6 @@ +#include "libB.hpp" +#include + +std::string getZlibVers(void) { + return zlibVersion(); +} diff --git a/test cases/cmake/5 object library/subprojects/cmObjLib/libB.hpp b/test cases/cmake/5 object library/subprojects/cmObjLib/libB.hpp new file mode 100644 index 0000000..52ccc16 --- /dev/null +++ b/test cases/cmake/5 object library/subprojects/cmObjLib/libB.hpp @@ -0,0 +1,16 @@ +#pragma once + +#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 + +std::string DLL_PUBLIC getZlibVers(); diff --git a/test cases/cmake/6 object library no dep/main.cpp b/test cases/cmake/6 object library no dep/main.cpp new file mode 100644 index 0000000..9933ab4 --- /dev/null +++ b/test cases/cmake/6 object library no dep/main.cpp @@ -0,0 +1,11 @@ +#include +#include +#include "libA.hpp" +#include "libB.hpp" + +using namespace std; + +int main(void) { + cout << getLibStr() << " -- " << getZlibVers() << endl; + return EXIT_SUCCESS; +} diff --git a/test cases/cmake/6 object library no dep/meson.build b/test cases/cmake/6 object library no dep/meson.build new file mode 100644 index 0000000..65b8700 --- /dev/null +++ b/test cases/cmake/6 object library no dep/meson.build @@ -0,0 +1,13 @@ +project('cmake_object_lib_test', 'cpp') + +cm = import('cmake') + +sub_pro = cm.subproject('cmObjLib') +sub_sha = sub_pro.dependency('lib_sha') +sub_sta = sub_pro.dependency('lib_sta') + +exe_sha = executable('shared', ['main.cpp'], dependencies: [sub_sha]) +exe_sta = executable('static', ['main.cpp'], dependencies: [sub_sta]) + +test('test1', exe_sha) +test('test1', exe_sta) diff --git a/test cases/cmake/6 object library no dep/subprojects/cmObjLib/CMakeLists.txt b/test cases/cmake/6 object library no dep/subprojects/cmObjLib/CMakeLists.txt new file mode 100644 index 0000000..9e136af --- /dev/null +++ b/test cases/cmake/6 object library no dep/subprojects/cmObjLib/CMakeLists.txt @@ -0,0 +1,6 @@ +cmake_minimum_required(VERSION 3.7) +project(cmObject CXX) + +add_library(lib_obj OBJECT libA.cpp libB.cpp) +add_library(lib_sha SHARED $) +add_library(lib_sta STATIC $) diff --git a/test cases/cmake/6 object library no dep/subprojects/cmObjLib/libA.cpp b/test cases/cmake/6 object library no dep/subprojects/cmObjLib/libA.cpp new file mode 100644 index 0000000..1d579cf --- /dev/null +++ b/test cases/cmake/6 object library no dep/subprojects/cmObjLib/libA.cpp @@ -0,0 +1,5 @@ +#include "libA.hpp" + +std::string getLibStr(void) { + return "Hello World"; +} diff --git a/test cases/cmake/6 object library no dep/subprojects/cmObjLib/libA.hpp b/test cases/cmake/6 object library no dep/subprojects/cmObjLib/libA.hpp new file mode 100644 index 0000000..84b7bc7 --- /dev/null +++ b/test cases/cmake/6 object library no dep/subprojects/cmObjLib/libA.hpp @@ -0,0 +1,16 @@ +#pragma once + +#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 + +std::string DLL_PUBLIC getLibStr(); diff --git a/test cases/cmake/6 object library no dep/subprojects/cmObjLib/libB.cpp b/test cases/cmake/6 object library no dep/subprojects/cmObjLib/libB.cpp new file mode 100644 index 0000000..aa44816 --- /dev/null +++ b/test cases/cmake/6 object library no dep/subprojects/cmObjLib/libB.cpp @@ -0,0 +1,5 @@ +#include "libB.hpp" + +std::string getZlibVers(void) { + return "STUB"; +} diff --git a/test cases/cmake/6 object library no dep/subprojects/cmObjLib/libB.hpp b/test cases/cmake/6 object library no dep/subprojects/cmObjLib/libB.hpp new file mode 100644 index 0000000..52ccc16 --- /dev/null +++ b/test cases/cmake/6 object library no dep/subprojects/cmObjLib/libB.hpp @@ -0,0 +1,16 @@ +#pragma once + +#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 + +std::string DLL_PUBLIC getZlibVers(); diff --git a/test cases/cmake/7 cmake options/meson.build b/test cases/cmake/7 cmake options/meson.build new file mode 100644 index 0000000..8bb6d1d --- /dev/null +++ b/test cases/cmake/7 cmake options/meson.build @@ -0,0 +1,3 @@ +project('cmake_set_opt', ['c', 'cpp']) + +import('cmake').subproject('cmOpts', cmake_options: '-DSOME_CMAKE_VAR=something') diff --git a/test cases/cmake/7 cmake options/subprojects/cmOpts/CMakeLists.txt b/test cases/cmake/7 cmake options/subprojects/cmOpts/CMakeLists.txt new file mode 100644 index 0000000..873b9b3 --- /dev/null +++ b/test cases/cmake/7 cmake options/subprojects/cmOpts/CMakeLists.txt @@ -0,0 +1,10 @@ +cmake_minimum_required(VERSION 3.7) +project(testPro) + +if(NOT "${SOME_CMAKE_VAR}" STREQUAL "something") + message(FATAL_ERROR "Setting the CMake var failed") +endif() + +if(NOT "${CMAKE_PREFIX_PATH}" STREQUAL "val1;val2") + message(FATAL_ERROR "Setting the CMAKE_PREFIX_PATH failed '${CMAKE_PREFIX_PATH}'") +endif() diff --git a/test cases/cmake/7 cmake options/test.json b/test cases/cmake/7 cmake options/test.json new file mode 100644 index 0000000..f9f0b05 --- /dev/null +++ b/test cases/cmake/7 cmake options/test.json @@ -0,0 +1,12 @@ +{ + "matrix": { + "options": { + "cmake_prefix_path": [ + { "val": ["val1", "val2"] } + ], + "build.cmake_prefix_path": [ + { "val": ["val1", "val2"] } + ] + } + } +} diff --git a/test cases/cmake/8 custom command/main.cpp b/test cases/cmake/8 custom command/main.cpp new file mode 100644 index 0000000..7558d60 --- /dev/null +++ b/test cases/cmake/8 custom command/main.cpp @@ -0,0 +1,11 @@ +#include +#include + +using namespace std; + +int main(void) { + cmModClass obj("Hello"); + cout << obj.getStr() << endl; + cout << obj.getOther() << endl; + return 0; +} diff --git a/test cases/cmake/8 custom command/meson.build b/test cases/cmake/8 custom command/meson.build new file mode 100644 index 0000000..a262252 --- /dev/null +++ b/test cases/cmake/8 custom command/meson.build @@ -0,0 +1,16 @@ +project('cmakeSubTest', ['c', 'cpp']) + +if meson.is_cross_build() + error('MESON_SKIP_TEST this test does not cross compile correctly.') +endif + +cm = import('cmake') + +sub_pro = cm.subproject('cmMod') +sub_dep = sub_pro.dependency('cmModLib') + +assert(sub_pro.target_type('cmModLib') == 'shared_library', 'Target type should be shared_library') +assert(sub_pro.target_type('gen') == 'executable', 'Target type should be executable') + +exe1 = executable('main', ['main.cpp'], dependencies: [sub_dep]) +test('test1', exe1) diff --git a/test cases/cmake/8 custom command/subprojects/cmMod/CMakeLists.txt b/test cases/cmake/8 custom command/subprojects/cmMod/CMakeLists.txt new file mode 100644 index 0000000..0185ddc --- /dev/null +++ b/test cases/cmake/8 custom command/subprojects/cmMod/CMakeLists.txt @@ -0,0 +1,163 @@ +cmake_minimum_required(VERSION 3.5) + +project(cmMod) +set (CMAKE_CXX_STANDARD 14) +set (CMAKE_CXX_STANDARD_REQUIRED ON) + +include_directories(${CMAKE_CURRENT_BINARY_DIR}) +add_definitions("-DDO_NOTHING_JUST_A_FLAG=1") + +add_executable(genMain genMain.cpp) +add_custom_command(OUTPUT main.cpp COMMAND genMain > main.cpp) + +add_executable(gen main.cpp) +add_executable(mycpy cp.cpp) + +# cpyBase +add_custom_command( + OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/genTest.cpp" "${CMAKE_CURRENT_BINARY_DIR}/genTest.hpp" + COMMAND gen ARGS genTest +) + +set(CMD_PART) +list(APPEND CMD_PART COMMAND mycpy cpyBase.cpp.in cpyBase.cpp.in.gen) +list(APPEND CMD_PART COMMAND mycpy cpyBase.cpp.in.gen cpyBase.cpp.out) +list(APPEND CMD_PART COMMAND mycpy cpyBase.cpp.out cpyBase.cpp.something) + +add_custom_command( + OUTPUT cpyBase.cpp + COMMAND mycpy "${CMAKE_CURRENT_SOURCE_DIR}/cpyBase.cpp.am" cpyBase.cpp.in + ${CMD_PART} + COMMAND mycpy cpyBase.cpp.in cpyBase.cpp.something + COMMAND mycpy cpyBase.cpp.something cpyBase.cpp.IAmRunningOutOfIdeas + COMMAND mycpy cpyBase.cpp.IAmRunningOutOfIdeas cpyBase.cpp + DEPENDS cpyBase.cpp.am;gen +) + +add_custom_command( + OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/cpyBase.hpp.in" + COMMAND mycpy "${CMAKE_CURRENT_SOURCE_DIR}/cpyBase.hpp.am" cpyBase.hpp.in + DEPENDS cpyBase.hpp.am +) + +add_custom_command( + OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/cpyBase.hpp.something" + COMMAND mycpy cpyBase.hpp.in cpyBase.hpp.something + DEPENDS "${CMAKE_CURRENT_BINARY_DIR}/cpyBase.hpp.in" +) + +add_custom_command( + OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/cpyBase.hpp" + COMMAND mycpy cpyBase.hpp.something cpyBase.hpp + DEPENDS "${CMAKE_CURRENT_BINARY_DIR}/cpyBase.hpp.something" +) + +# cpyNext (out of order is on purpose) +# -- first copy round +add_custom_command( + OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/s1_a_hpp/file.txt" + COMMAND mycpy "${CMAKE_CURRENT_SOURCE_DIR}/cpyNext.hpp.am" file.txt + DEPENDS "${CMAKE_CURRENT_SOURCE_DIR}/cpyNext.hpp.am" + WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/s1_a_hpp" +) + +add_custom_command( + OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/s1_b_cpp/file.txt" + COMMAND mycpy "${CMAKE_CURRENT_SOURCE_DIR}/cpyNext.cpp.am" file.txt + DEPENDS "${CMAKE_CURRENT_SOURCE_DIR}/cpyNext.cpp.am" + WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/s1_b_cpp" +) + +# -- final cpy round +add_custom_command( + OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/cpyNext.hpp" + COMMAND mycpy "${CMAKE_CURRENT_BINARY_DIR}/s2_b_hpp/file.txt" cpyNext.hpp + DEPENDS "${CMAKE_CURRENT_BINARY_DIR}/s2_b_hpp/file.txt" + WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}" +) + +add_custom_command( + OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/cpyNext.cpp" + COMMAND mycpy "${CMAKE_CURRENT_BINARY_DIR}/s2_a_cpp/file.txt" cpyNext.cpp + DEPENDS "${CMAKE_CURRENT_BINARY_DIR}/s2_a_cpp/file.txt" + WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}" +) + +# -- second copy round +add_custom_command( + OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/s2_b_hpp/file.txt" + COMMAND mycpy "${CMAKE_CURRENT_BINARY_DIR}/s1_a_hpp/file.txt" file.txt + DEPENDS "${CMAKE_CURRENT_BINARY_DIR}/s1_a_hpp/file.txt" + WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/s2_b_hpp" +) + +add_custom_command( + OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/s2_a_cpp/file.txt" + COMMAND mycpy "${CMAKE_CURRENT_BINARY_DIR}/s1_b_cpp/file.txt" file.txt + DEPENDS "${CMAKE_CURRENT_BINARY_DIR}/s1_b_cpp/file.txt" + WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/s2_a_cpp" +) + +# cpyTest (copy file without renaming) +add_custom_command( + OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/cpyTest.hpp" + COMMAND mycpy "${CMAKE_CURRENT_SOURCE_DIR}/cpyTest/cpyTest.hpp" "${CMAKE_CURRENT_BINARY_DIR}/cpyTest.hpp" + DEPENDS "cpyTest/cpyTest.hpp" +) + +add_custom_command( + OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/cpyTest2.hpp" + COMMAND mycpy "${CMAKE_CURRENT_SOURCE_DIR}/cpyTest/cpyTest2.hpp" "${CMAKE_CURRENT_BINARY_DIR}/cpyTest2.hpp" + DEPENDS "${CMAKE_CURRENT_SOURCE_DIR}/cpyTest/cpyTest2.hpp" +) + +add_custom_command( + OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/cpyTest3.hpp" + COMMAND mycpy cpyTest3.hpp "${CMAKE_CURRENT_BINARY_DIR}/cpyTest3.hpp" + DEPENDS "${CMAKE_CURRENT_SOURCE_DIR}/cpyTest/cpyTest3.hpp" + WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/cpyTest" +) + +add_subdirectory(cpyTest ccppyyTTeesstt) + +add_custom_command( + OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/cpyTest/some/directory/cpyTest5.hpp" + COMMAND ${CMAKE_COMMAND} -E copy "${CMAKE_CURRENT_SOURCE_DIR}/cpyTest/cpyTest5.hpp" "${CMAKE_CURRENT_BINARY_DIR}/cpyTest/some/directory/cpyTest5.hpp" + DEPENDS "${CMAKE_CURRENT_SOURCE_DIR}/cpyTest/cpyTest5.hpp" +) +include_directories("${CMAKE_CURRENT_BINARY_DIR}/cpyTest/some") + +add_library(cmModLib SHARED cmMod.cpp genTest.cpp cpyBase.cpp cpyBase.hpp cpyNext.cpp cpyNext.hpp cpyTest.cpp cpyTest.hpp cpyTest2.hpp cpyTest3.hpp cpyTest/some/directory/cpyTest5.hpp) +include(GenerateExportHeader) +generate_export_header(cmModLib) + +set(ARGS_TEST arg1) +set(ARGS_TEST ${ARGS_TEST} arg2) + +add_executable(macro_name macro_name.cpp) +add_executable(args_test args_test.cpp) +add_custom_target(args_test_cmd + COMMAND args_test ${ARGS_TEST} +) +add_custom_target(macro_name_cmd COMMAND macro_name) + +if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU") + message(STATUS "Running the -include test case on macro_name") + add_custom_command( + OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/cpyInc.hpp" + COMMAND mycpy "${CMAKE_CURRENT_SOURCE_DIR}/cpyInc.hpp.am" "${CMAKE_CURRENT_BINARY_DIR}/cpyInc.hpp" + DEPENDS "${CMAKE_CURRENT_SOURCE_DIR}/cpyInc.hpp.am" + ) + target_compile_options(macro_name PUBLIC -DTEST_CMD_INCLUDE -include "${CMAKE_CURRENT_BINARY_DIR}/cpyInc.hpp") +endif() + +# Only executable targets are replaced in the command +# all other target names are kept as is +add_custom_target(clang-format COMMAND clang-format -i cmMod.cpp) + +add_dependencies(cmModLib args_test_cmd tgtCpyTest4) +add_dependencies(args_test_cmd macro_name_cmd;gen;mycpy) + +# Reproduce https://github.com/mesonbuild/meson/issues/10244 +add_custom_target(mycpy.all) +add_dependencies(mycpy.all mycpy) diff --git a/test cases/cmake/8 custom command/subprojects/cmMod/args_test.cpp b/test cases/cmake/8 custom command/subprojects/cmMod/args_test.cpp new file mode 100644 index 0000000..abb8a42 --- /dev/null +++ b/test cases/cmake/8 custom command/subprojects/cmMod/args_test.cpp @@ -0,0 +1,18 @@ +#include +#include + +using namespace std; + +int main(int argc, const char *argv[]) { + if(argc != 3 || string(argv[1]) != "arg1" || string(argv[2]) != "arg2") { + cerr << argv[0] << " requires 2 args" << endl; + return 1; + } + + ifstream in1("macro_name.txt"); + ofstream out1("cmModLib.hpp"); + out1 << "#define " << in1.rdbuf() << " = \"plop\""; + + + return 0; +} diff --git a/test cases/cmake/8 custom command/subprojects/cmMod/cmMod.cpp b/test cases/cmake/8 custom command/subprojects/cmMod/cmMod.cpp new file mode 100644 index 0000000..a466399 --- /dev/null +++ b/test cases/cmake/8 custom command/subprojects/cmMod/cmMod.cpp @@ -0,0 +1,24 @@ +#include "cmMod.hpp" +#include "genTest.hpp" +#include "cpyBase.hpp" +#include "cpyNext.hpp" +#include "cpyTest.hpp" +#include "cmModLib.hpp" + +#ifndef FOO +#error FOO not declared +#endif + +using namespace std; + +cmModClass::cmModClass(string foo) { + str = foo + " World"; +} + +string cmModClass::getStr() const { + return str; +} + +string cmModClass::getOther() const { + return "Strings:\n - " + getStrCpy() + "\n - " + getStrNext() + "\n - " + getStrCpyTest(); +} diff --git a/test cases/cmake/8 custom command/subprojects/cmMod/cmMod.hpp b/test cases/cmake/8 custom command/subprojects/cmMod/cmMod.hpp new file mode 100644 index 0000000..cfdbe88 --- /dev/null +++ b/test cases/cmake/8 custom command/subprojects/cmMod/cmMod.hpp @@ -0,0 +1,14 @@ +#pragma once + +#include +#include "cmmodlib_export.h" + +class CMMODLIB_EXPORT cmModClass { + private: + std::string str; + public: + cmModClass(std::string foo); + + std::string getStr() const; + std::string getOther() const; +}; diff --git a/test cases/cmake/8 custom command/subprojects/cmMod/cp.cpp b/test cases/cmake/8 custom command/subprojects/cmMod/cp.cpp new file mode 100644 index 0000000..09433f2 --- /dev/null +++ b/test cases/cmake/8 custom command/subprojects/cmMod/cp.cpp @@ -0,0 +1,22 @@ +#include +#include + +using namespace std; + +int main(int argc, char *argv[]) { + if(argc < 3) { + cerr << argv[0] << " requires an input and an output file!" << endl; + return 1; + } + + ifstream src(argv[1]); + ofstream dst(argv[2]); + + if(!src.is_open()) { + cerr << "Failed to open " << argv[1] << endl; + return 2; + } + + dst << src.rdbuf(); + return 0; +} diff --git a/test cases/cmake/8 custom command/subprojects/cmMod/cpyBase.cpp.am b/test cases/cmake/8 custom command/subprojects/cmMod/cpyBase.cpp.am new file mode 100644 index 0000000..98dd09c --- /dev/null +++ b/test cases/cmake/8 custom command/subprojects/cmMod/cpyBase.cpp.am @@ -0,0 +1,5 @@ +#include "cpyBase.hpp" + +std::string getStrCpy() { + return "Hello Copied File"; +} diff --git a/test cases/cmake/8 custom command/subprojects/cmMod/cpyBase.hpp.am b/test cases/cmake/8 custom command/subprojects/cmMod/cpyBase.hpp.am new file mode 100644 index 0000000..c255fb1 --- /dev/null +++ b/test cases/cmake/8 custom command/subprojects/cmMod/cpyBase.hpp.am @@ -0,0 +1,5 @@ +#pragma once + +#include + +std::string getStrCpy(); diff --git a/test cases/cmake/8 custom command/subprojects/cmMod/cpyInc.hpp.am b/test cases/cmake/8 custom command/subprojects/cmMod/cpyInc.hpp.am new file mode 100644 index 0000000..07c8ff7 --- /dev/null +++ b/test cases/cmake/8 custom command/subprojects/cmMod/cpyInc.hpp.am @@ -0,0 +1,3 @@ +#pragma once + +#define CPY_INC_WAS_INCLUDED 1 diff --git a/test cases/cmake/8 custom command/subprojects/cmMod/cpyNext.cpp.am b/test cases/cmake/8 custom command/subprojects/cmMod/cpyNext.cpp.am new file mode 100644 index 0000000..20a8815 --- /dev/null +++ b/test cases/cmake/8 custom command/subprojects/cmMod/cpyNext.cpp.am @@ -0,0 +1,5 @@ +#include "cpyNext.hpp" + +std::string getStrNext() { + return "Hello Copied File -- now even more convoluted!"; +} diff --git a/test cases/cmake/8 custom command/subprojects/cmMod/cpyNext.hpp.am b/test cases/cmake/8 custom command/subprojects/cmMod/cpyNext.hpp.am new file mode 100644 index 0000000..41919d8 --- /dev/null +++ b/test cases/cmake/8 custom command/subprojects/cmMod/cpyNext.hpp.am @@ -0,0 +1,5 @@ +#pragma once + +#include + +std::string getStrNext(); diff --git a/test cases/cmake/8 custom command/subprojects/cmMod/cpyTest.cpp b/test cases/cmake/8 custom command/subprojects/cmMod/cpyTest.cpp new file mode 100644 index 0000000..627b8f9 --- /dev/null +++ b/test cases/cmake/8 custom command/subprojects/cmMod/cpyTest.cpp @@ -0,0 +1,9 @@ +#include "cpyTest.hpp" +#include "cpyTest2.hpp" +#include "cpyTest3.hpp" +#include "ccppyyTTeesstt/cpyTest4.hpp" +#include "directory/cpyTest5.hpp" + +std::string getStrCpyTest() { + return CPY_TEST_STR_2 CPY_TEST_STR_3 CPY_TEST_STR_4 CPY_TEST_STR_5; +} diff --git a/test cases/cmake/8 custom command/subprojects/cmMod/cpyTest/CMakeLists.txt b/test cases/cmake/8 custom command/subprojects/cmMod/cpyTest/CMakeLists.txt new file mode 100644 index 0000000..f577dcf --- /dev/null +++ b/test cases/cmake/8 custom command/subprojects/cmMod/cpyTest/CMakeLists.txt @@ -0,0 +1,7 @@ +add_custom_command( + OUTPUT cpyTest4.hpp + COMMAND mycpy "${CMAKE_CURRENT_SOURCE_DIR}/cpyTest4.hpp" cpyTest4.hpp + DEPENDS cpyTest4.hpp +) + +add_custom_target(tgtCpyTest4 DEPENDS "${CMAKE_CURRENT_BINARY_DIR}/cpyTest4.hpp") diff --git a/test cases/cmake/8 custom command/subprojects/cmMod/cpyTest/cpyTest.hpp b/test cases/cmake/8 custom command/subprojects/cmMod/cpyTest/cpyTest.hpp new file mode 100644 index 0000000..e8dec13 --- /dev/null +++ b/test cases/cmake/8 custom command/subprojects/cmMod/cpyTest/cpyTest.hpp @@ -0,0 +1,5 @@ +#pragma once + +#include + +std::string getStrCpyTest(); diff --git a/test cases/cmake/8 custom command/subprojects/cmMod/cpyTest/cpyTest2.hpp b/test cases/cmake/8 custom command/subprojects/cmMod/cpyTest/cpyTest2.hpp new file mode 100644 index 0000000..bdbcc56 --- /dev/null +++ b/test cases/cmake/8 custom command/subprojects/cmMod/cpyTest/cpyTest2.hpp @@ -0,0 +1,3 @@ +#pragma once + +#define CPY_TEST_STR_2 "Hello " diff --git a/test cases/cmake/8 custom command/subprojects/cmMod/cpyTest/cpyTest3.hpp b/test cases/cmake/8 custom command/subprojects/cmMod/cpyTest/cpyTest3.hpp new file mode 100644 index 0000000..2d13376 --- /dev/null +++ b/test cases/cmake/8 custom command/subprojects/cmMod/cpyTest/cpyTest3.hpp @@ -0,0 +1,3 @@ +#pragma once + +#define CPY_TEST_STR_3 "CopyFile" diff --git a/test cases/cmake/8 custom command/subprojects/cmMod/cpyTest/cpyTest4.hpp b/test cases/cmake/8 custom command/subprojects/cmMod/cpyTest/cpyTest4.hpp new file mode 100644 index 0000000..4124c43 --- /dev/null +++ b/test cases/cmake/8 custom command/subprojects/cmMod/cpyTest/cpyTest4.hpp @@ -0,0 +1,3 @@ +#pragma once + +#define CPY_TEST_STR_4 " test" diff --git a/test cases/cmake/8 custom command/subprojects/cmMod/cpyTest/cpyTest5.hpp b/test cases/cmake/8 custom command/subprojects/cmMod/cpyTest/cpyTest5.hpp new file mode 100644 index 0000000..3669f00 --- /dev/null +++ b/test cases/cmake/8 custom command/subprojects/cmMod/cpyTest/cpyTest5.hpp @@ -0,0 +1,3 @@ +#pragma once + +#define CPY_TEST_STR_5 " test" diff --git a/test cases/cmake/8 custom command/subprojects/cmMod/genMain.cpp b/test cases/cmake/8 custom command/subprojects/cmMod/genMain.cpp new file mode 100644 index 0000000..33f0201 --- /dev/null +++ b/test cases/cmake/8 custom command/subprojects/cmMod/genMain.cpp @@ -0,0 +1,40 @@ +#include + +using namespace std; + +int main() { + cout << R"asd( +#include +#include + +using namespace std; + +int main(int argc, const char *argv[]) { + if(argc < 2) { + cerr << argv[0] << " requires an output file!" << endl; + return 1; + } + ofstream out1(string(argv[1]) + ".hpp"); + ofstream out2(string(argv[1]) + ".cpp"); + out1 << R"( +#pragma once + +#include + +std::string getStr(); +)"; + + out2 << R"( +#include ")" << argv[1] << R"(.hpp" + +std::string getStr() { + return "Hello World"; +} +)"; + + return 0; +} +)asd"; + + return 0; +} diff --git a/test cases/cmake/8 custom command/subprojects/cmMod/macro_name.cpp b/test cases/cmake/8 custom command/subprojects/cmMod/macro_name.cpp new file mode 100644 index 0000000..964062f --- /dev/null +++ b/test cases/cmake/8 custom command/subprojects/cmMod/macro_name.cpp @@ -0,0 +1,20 @@ +#include +#include +#include +#include + +using namespace std; + +#ifdef TEST_CMD_INCLUDE +#if CPY_INC_WAS_INCLUDED != 1 +#error "cpyInc.hpp was not included" +#endif +#endif + +int main() { + this_thread::sleep_for(chrono::seconds(1)); + ofstream out1("macro_name.txt"); + out1 << "FOO"; + + return 0; +} diff --git a/test cases/cmake/8 custom command/subprojects/cmMod/mycpy/.gitkeep b/test cases/cmake/8 custom command/subprojects/cmMod/mycpy/.gitkeep new file mode 100644 index 0000000..22c19ce --- /dev/null +++ b/test cases/cmake/8 custom command/subprojects/cmMod/mycpy/.gitkeep @@ -0,0 +1 @@ +# Required to reproduce https://github.com/mesonbuild/meson/issues/10244 diff --git a/test cases/cmake/9 disabled subproject/meson.build b/test cases/cmake/9 disabled subproject/meson.build new file mode 100644 index 0000000..c153fa3 --- /dev/null +++ b/test cases/cmake/9 disabled subproject/meson.build @@ -0,0 +1,6 @@ +project('cmakeSubTest', ['c', 'cpp']) + +cm = import('cmake') + +sub_pro = cm.subproject('nothinig', required: false) +assert(not sub_pro.found(), 'subproject found() reports wrong value') diff --git a/test cases/common/1 trivial/meson.build b/test cases/common/1 trivial/meson.build new file mode 100644 index 0000000..2e424d5 --- /dev/null +++ b/test cases/common/1 trivial/meson.build @@ -0,0 +1,29 @@ +# Comment on the first line +project('trivial test', + # Comment inside a function call + array for language list + ['c'], default_options: ['buildtype=debug'], + meson_version : '>=0.52.0') +#this is a comment +sources = 'trivial.c' + +cc = meson.get_compiler('c') +if cc.get_id() == 'intel' + # Error out if the -std=xxx option is incorrect + add_project_arguments('-diag-error', '10159', language : 'c') +elif cc.get_id() == 'intel-cl' + add_project_arguments('/Qdiag-error:10159', language : 'c') +endif + +exe = executable('trivialprog', sources : sources) +assert(exe.name() == 'trivialprog') +test('runtest', exe) # This is a comment + +has_not_changed = false +if is_disabler(exe) + has_not_changed = true +else + has_not_changed = true +endif +assert(has_not_changed, 'Executable has changed.') + +assert(not is_disabler(exe), 'Executable is a disabler.') diff --git a/test cases/common/1 trivial/trivial.c b/test cases/common/1 trivial/trivial.c new file mode 100644 index 0000000..96612d4 --- /dev/null +++ b/test cases/common/1 trivial/trivial.c @@ -0,0 +1,6 @@ +#include + +int main(void) { + printf("Trivial test is working.\n"); + return 0; +} diff --git a/test cases/common/10 man install/bar.2 b/test cases/common/10 man install/bar.2 new file mode 100644 index 0000000..9d82d7e --- /dev/null +++ b/test cases/common/10 man install/bar.2 @@ -0,0 +1 @@ +this is a man page of bar.2, its contents are irrelevant \ No newline at end of file diff --git a/test cases/common/10 man install/baz.1.in b/test cases/common/10 man install/baz.1.in new file mode 100644 index 0000000..d0b79b4 --- /dev/null +++ b/test cases/common/10 man install/baz.1.in @@ -0,0 +1,6 @@ +This is a man page of baz.1 it was generated @TODAY@. + +You should not put generation timestamps in real world projects +because they break reproducible builds. This manpage is written +by professionals or under the supervision of professionals. Do +not try this at home. diff --git a/test cases/common/10 man install/foo.1 b/test cases/common/10 man install/foo.1 new file mode 100644 index 0000000..647c097 --- /dev/null +++ b/test cases/common/10 man install/foo.1 @@ -0,0 +1 @@ +this is a man page of foo.1 its contents are irrelevant diff --git a/test cases/common/10 man install/foo.fr.1 b/test cases/common/10 man install/foo.fr.1 new file mode 100644 index 0000000..647c097 --- /dev/null +++ b/test cases/common/10 man install/foo.fr.1 @@ -0,0 +1 @@ +this is a man page of foo.1 its contents are irrelevant diff --git a/test cases/common/10 man install/meson.build b/test cases/common/10 man install/meson.build new file mode 100644 index 0000000..d0f3be8 --- /dev/null +++ b/test cases/common/10 man install/meson.build @@ -0,0 +1,14 @@ +project('man install') +m1 = install_man('foo.1') +m2 = install_man('bar.2') +m3 = install_man('foo.fr.1', locale: 'fr') +install_man('vanishing/vanishing.2') +subdir('vanishing') + +cdata = configuration_data() +cdata.set('TODAY', '$this_day') +b1 = configure_file(input : 'baz.1.in', + output : 'baz.1', + configuration : cdata) + +install_man(b1) diff --git a/test cases/common/10 man install/test.json b/test cases/common/10 man install/test.json new file mode 100644 index 0000000..5ef673a --- /dev/null +++ b/test cases/common/10 man install/test.json @@ -0,0 +1,10 @@ +{ + "installed": [ + { "type": "file", "file": "usr/share/man/man1/foo.1" }, + { "type": "file", "file": "usr/share/man/fr/man1/foo.1" }, + { "type": "file", "file": "usr/share/man/man2/bar.2" }, + { "type": "file", "file": "usr/share/man/man1/vanishing.1" }, + { "type": "file", "file": "usr/share/man/man2/vanishing.2" }, + { "type": "file", "file": "usr/share/man/man1/baz.1" } + ] +} diff --git a/test cases/common/10 man install/vanishing/meson.build b/test cases/common/10 man install/vanishing/meson.build new file mode 100644 index 0000000..1015450 --- /dev/null +++ b/test cases/common/10 man install/vanishing/meson.build @@ -0,0 +1 @@ +install_man('vanishing.1') diff --git a/test cases/common/10 man install/vanishing/vanishing.1 b/test cases/common/10 man install/vanishing/vanishing.1 new file mode 100644 index 0000000..532608e --- /dev/null +++ b/test cases/common/10 man install/vanishing/vanishing.1 @@ -0,0 +1 @@ +This is a man page of the vanishing subdirectory. diff --git a/test cases/common/10 man install/vanishing/vanishing.2 b/test cases/common/10 man install/vanishing/vanishing.2 new file mode 100644 index 0000000..d12f76a --- /dev/null +++ b/test cases/common/10 man install/vanishing/vanishing.2 @@ -0,0 +1 @@ +This is a second man page of the vanishing subdirectory. 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/101 testframework options/meson.build b/test cases/common/101 testframework options/meson.build new file mode 100644 index 0000000..4621b30 --- /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') + +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..08daa5b --- /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 = 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/103 has header symbol/meson.build b/test cases/common/103 has header symbol/meson.build new file mode 100644 index 0000000..4590491 --- /dev/null +++ b/test cases/common/103 has header symbol/meson.build @@ -0,0 +1,40 @@ +project( + 'has header symbol', + 'c', 'cpp', + default_options : ['cpp_std=c++11'], +) + +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/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.c b/test cases/common/105 generatorcustom/gen.c new file mode 100644 index 0000000..59518c0 --- /dev/null +++ b/test cases/common/105 generatorcustom/gen.c @@ -0,0 +1,35 @@ +/* SPDX-License-Identifier: Apache-2.0 */ +/* Copyright © 2023 Intel Corporation */ + +#include +#include + +int main(int argc, const char ** argv) { + if (argc != 3) { + fprintf(stderr, "%s %i %s\n", "Got incorrect number of arguments, got ", argc - 1, ", but expected 2"); + exit(1); + } + + FILE * input, * output; + + if ((input = fopen(argv[1], "rb")) == NULL) { + exit(1); + } + if ((output = fopen(argv[2], "wb")) == NULL) { + exit(1); + } + + fprintf(output, "#pragma once\n"); + fprintf(output, "#define "); + + char c; + while((c = fgetc(input)) != EOF) { + fputc(c, output); + } + fputc('\n', output); + + fclose(input); + fclose(output); + + return 0; +} 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/host.c b/test cases/common/105 generatorcustom/host.c new file mode 100644 index 0000000..1ddfa88 --- /dev/null +++ b/test cases/common/105 generatorcustom/host.c @@ -0,0 +1,9 @@ +#include "res1-cpp.h" + +int main(void) { + #ifdef res1 + return 0; + #else + return 1; + #endif +} 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..dab55de --- /dev/null +++ b/test cases/common/105 generatorcustom/meson.build @@ -0,0 +1,44 @@ +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) + +# specifically testing that cross binaries are run with an exe_wrapper +if meson.can_run_host_binaries() + gen_tool = executable('generator', 'gen.c', native : false) + + c_gen = generator( + gen_tool, + output : '@BASENAME@-cpp.h', + arguments : ['@INPUT@', '@OUTPUT@'] + ) + + hs2 = c_gen.process('res1.txt') + + host_exe = executable('host_test', 'host.c', hs2, native : false) + test('compiled generator', host_exe) +endif 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/106 multiple dir configure file/meson.build b/test cases/common/106 multiple dir configure file/meson.build new file mode 100644 index 0000000..18408fb --- /dev/null +++ b/test cases/common/106 multiple dir configure file/meson.build @@ -0,0 +1,11 @@ +project('multiple dir configure file') + +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 spaces backslash/asm output/meson.build b/test cases/common/107 spaces backslash/asm output/meson.build new file mode 100644 index 0000000..43f61f0 --- /dev/null +++ b/test cases/common/107 spaces backslash/asm output/meson.build @@ -0,0 +1 @@ +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 ternary/meson.build b/test cases/common/108 ternary/meson.build new file mode 100644 index 0000000..0073a1e --- /dev/null +++ b/test cases/common/108 ternary/meson.build @@ -0,0 +1,12 @@ +project('ternary operator') + +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..b762201 --- /dev/null +++ b/test cases/common/109 custom target capture/meson.build @@ -0,0 +1,24 @@ +project('custom target') + +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/11 subdir/meson.build b/test cases/common/11 subdir/meson.build new file mode 100644 index 0000000..bda1f90 --- /dev/null +++ b/test cases/common/11 subdir/meson.build @@ -0,0 +1,2 @@ +project('subdir test', 'c') +subdir('subdir') diff --git a/test cases/common/11 subdir/subdir/meson.build b/test cases/common/11 subdir/subdir/meson.build new file mode 100644 index 0000000..d84ec13 --- /dev/null +++ b/test cases/common/11 subdir/subdir/meson.build @@ -0,0 +1,2 @@ +prog = executable('prog', 'prog.c') +test('subdirprog', prog) diff --git a/test cases/common/11 subdir/subdir/prog.c b/test cases/common/11 subdir/subdir/prog.c new file mode 100644 index 0000000..78f2de1 --- /dev/null +++ b/test cases/common/11 subdir/subdir/prog.c @@ -0,0 +1 @@ +int main(void) { return 0; } 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/111 pathjoin/meson.build b/test cases/common/111 pathjoin/meson.build new file mode 100644 index 0000000..64aa338 --- /dev/null +++ b/test cases/common/111 pathjoin/meson.build @@ -0,0 +1,27 @@ +project('pathjoin') + +# 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') +assert(join_paths('/foo', '') == '/foo/', 'Trailing / on path') + +# 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') +assert(join_paths(['/foo', '']) == '/foo/', 'Trailing / on path') + +# 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') +assert('/foo' / '' == '/foo/', 'Trailing / on path') 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..d414bfc --- /dev/null +++ b/test cases/common/113 interpreter copy mutable var on assignment/meson.build @@ -0,0 +1,19 @@ +project('foo') + +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..ead955f --- /dev/null +++ b/test cases/common/114 skip/meson.build @@ -0,0 +1,3 @@ +project('skip') + +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..a8f5dff --- /dev/null +++ b/test cases/common/115 subproject project arguments/exe.cpp @@ -0,0 +1,27 @@ +#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 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/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..8bc3f43 --- /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 input 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/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/12 data/datafile.dat b/test cases/common/12 data/datafile.dat new file mode 100644 index 0000000..ff3104b --- /dev/null +++ b/test cases/common/12 data/datafile.dat @@ -0,0 +1 @@ +this is a data file diff --git a/test cases/common/12 data/etcfile.dat b/test cases/common/12 data/etcfile.dat new file mode 100644 index 0000000..93db8cb --- /dev/null +++ b/test cases/common/12 data/etcfile.dat @@ -0,0 +1 @@ +This goes into /etc/etcfile.dat diff --git a/test cases/common/12 data/fileobject_datafile.dat b/test cases/common/12 data/fileobject_datafile.dat new file mode 100644 index 0000000..872aa5a --- /dev/null +++ b/test cases/common/12 data/fileobject_datafile.dat @@ -0,0 +1 @@ +This is a data file that is installed via a File object. diff --git a/test cases/common/12 data/meson.build b/test cases/common/12 data/meson.build new file mode 100644 index 0000000..d318633 --- /dev/null +++ b/test cases/common/12 data/meson.build @@ -0,0 +1,24 @@ +project('data install test', + default_options : ['install_umask=preserve']) +install_data(sources : 'datafile.dat', install_dir : 'share/progname') +# Some file in /etc that is only read-write by root; add a sticky bit for testing +install_data(sources : 'etcfile.dat', install_dir : '/etc', install_mode : 'rw------T') +# Some script that needs to be executable by the group +install_data('runscript.sh', + install_dir : get_option('bindir'), + install_mode : ['rwxr-sr-x', 'root', 0]) +install_data(files('fileobject_datafile.dat'), + install_dir : 'share/progname', + install_mode : [false, false, 0]) + +install_data(files('somefile.txt')) + +subdir('vanishing') + +install_data(sources : 'vanishing/vanishing2.dat', install_dir : 'share/progname') + +install_data(sources : 'to_be_renamed_1.txt', rename : 'renamed file.txt') +install_data(sources : ['vanishing/to_be_renamed_2.txt', 'to_be_renamed_3.txt'], + install_dir : 'share/renamed', + rename : ['renamed 2.txt', 'renamed 3.txt']) +install_data(sources : 'to_be_renamed_4.txt', rename : 'some/nested/path.txt') diff --git a/test cases/common/12 data/runscript.sh b/test cases/common/12 data/runscript.sh new file mode 100644 index 0000000..8bc5ca6 --- /dev/null +++ b/test cases/common/12 data/runscript.sh @@ -0,0 +1,3 @@ +#!/bin/sh + +echo "Runscript" diff --git a/test cases/common/12 data/somefile.txt b/test cases/common/12 data/somefile.txt new file mode 100644 index 0000000..e69de29 diff --git a/test cases/common/12 data/test.json b/test cases/common/12 data/test.json new file mode 100644 index 0000000..f392e9a --- /dev/null +++ b/test cases/common/12 data/test.json @@ -0,0 +1,15 @@ +{ + "installed": [ + {"type": "file", "file": "usr/share/progname/datafile.dat"}, + {"type": "file", "file": "usr/share/progname/fileobject_datafile.dat"}, + {"type": "file", "file": "usr/share/progname/vanishing.dat"}, + {"type": "file", "file": "usr/share/progname/vanishing2.dat"}, + {"type": "file", "file": "usr/share/data install test/renamed file.txt"}, + {"type": "file", "file": "usr/share/data install test/somefile.txt"}, + {"type": "file", "file": "usr/share/data install test/some/nested/path.txt"}, + {"type": "file", "file": "usr/share/renamed/renamed 2.txt"}, + {"type": "file", "file": "usr/share/renamed/renamed 3.txt"}, + {"type": "file", "file": "etc/etcfile.dat"}, + {"type": "file", "file": "usr/bin/runscript.sh"} + ] +} diff --git a/test cases/common/12 data/to_be_renamed_1.txt b/test cases/common/12 data/to_be_renamed_1.txt new file mode 100644 index 0000000..e69de29 diff --git a/test cases/common/12 data/to_be_renamed_3.txt b/test cases/common/12 data/to_be_renamed_3.txt new file mode 100644 index 0000000..e69de29 diff --git a/test cases/common/12 data/to_be_renamed_4.txt b/test cases/common/12 data/to_be_renamed_4.txt new file mode 100644 index 0000000..e69de29 diff --git a/test cases/common/12 data/vanishing/meson.build b/test cases/common/12 data/vanishing/meson.build new file mode 100644 index 0000000..1a27137 --- /dev/null +++ b/test cases/common/12 data/vanishing/meson.build @@ -0,0 +1 @@ +install_data(sources : 'vanishing.dat', install_dir : 'share/progname') diff --git a/test cases/common/12 data/vanishing/to_be_renamed_2.txt b/test cases/common/12 data/vanishing/to_be_renamed_2.txt new file mode 100644 index 0000000..e69de29 diff --git a/test cases/common/12 data/vanishing/vanishing.dat b/test cases/common/12 data/vanishing/vanishing.dat new file mode 100644 index 0000000..b7d0609 --- /dev/null +++ b/test cases/common/12 data/vanishing/vanishing.dat @@ -0,0 +1 @@ +This is a data file to be installed in a subdirectory. diff --git a/test cases/common/12 data/vanishing/vanishing2.dat b/test cases/common/12 data/vanishing/vanishing2.dat new file mode 100644 index 0000000..99c923b --- /dev/null +++ b/test cases/common/12 data/vanishing/vanishing2.dat @@ -0,0 +1,4 @@ +This is a data file to be installed in a subdirectory. + +It is installed from a different subdir to test that the +installer strips the source tree dir prefix. 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..e7c5809 --- /dev/null +++ b/test cases/common/120 extract all shared library/meson.build @@ -0,0 +1,15 @@ +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') +# libc.so cannot be used, it already exists as a reserved name +c = shared_library('cee', + 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 object only target/meson.build b/test cases/common/121 object only target/meson.build new file mode 100644 index 0000000..c3c4e52 --- /dev/null +++ b/test cases/common/121 object only target/meson.build @@ -0,0 +1,51 @@ +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) + +subdir('objdir') + +e = executable('prog', 'prog.c', link_with : [obj, shr, stc, subdirfilebuilt_obj, subdirfile_obj, subdirstr_obj], + 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/objdir/meson.build b/test cases/common/121 object only target/objdir/meson.build new file mode 100644 index 0000000..631c1a1 --- /dev/null +++ b/test cases/common/121 object only target/objdir/meson.build @@ -0,0 +1,27 @@ + +#mesonlib.File built +source4 = configure_file(input : 'source4.c', + output : 'source4' + ext, + command : [comp, cc, files('source4.c'), + join_paths(meson.current_build_dir(), 'source4' + ext)]) + +subdirfilebuilt_obj = static_library('subdirfilebuilt_obj', objects : source4) + + +#mesonlib.File not built +configure_file(input : 'source5.c', + output : 'source5' + ext, + command : [comp, cc, files('source5.c'), + join_paths(meson.current_build_dir(), 'source5' + ext)]) + +subdirfile_obj = static_library('subdirfile_obj', objects : files(meson.current_build_dir()/'source5' + ext)) + + +#str +configure_file(input : 'source6.c', + output : 'source6' + ext, + command : [comp, cc, files('source6.c'), + join_paths(meson.current_build_dir(), 'source6' + ext)]) + + +subdirstr_obj = static_library('subdirstr_obj', objects : meson.current_build_dir()/'source6' + ext) diff --git a/test cases/common/121 object only target/objdir/source4.c b/test cases/common/121 object only target/objdir/source4.c new file mode 100644 index 0000000..83f4fab --- /dev/null +++ b/test cases/common/121 object only target/objdir/source4.c @@ -0,0 +1,3 @@ +int func4_in_obj(void) { + return 0; +} diff --git a/test cases/common/121 object only target/objdir/source5.c b/test cases/common/121 object only target/objdir/source5.c new file mode 100644 index 0000000..c512fc3 --- /dev/null +++ b/test cases/common/121 object only target/objdir/source5.c @@ -0,0 +1,3 @@ +int func5_in_obj(void) { + return 0; +} diff --git a/test cases/common/121 object only target/objdir/source6.c b/test cases/common/121 object only target/objdir/source6.c new file mode 100644 index 0000000..adcf2cd --- /dev/null +++ b/test cases/common/121 object only target/objdir/source6.c @@ -0,0 +1,3 @@ +int func6_in_obj(void) { + return 0; +} 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..a27663b --- /dev/null +++ b/test cases/common/121 object only target/prog.c @@ -0,0 +1,11 @@ +int func1_in_obj(void); +int func2_in_obj(void); +int func3_in_obj(void); +int func4_in_obj(void); +int func5_in_obj(void); +int func6_in_obj(void); + +int main(void) { + return func1_in_obj() + func2_in_obj() + func3_in_obj() + + func4_in_obj() + func5_in_obj() + func6_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/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..c3bfa20 --- /dev/null +++ b/test cases/common/123 custom target directory install/meson.build @@ -0,0 +1,9 @@ +project('custom-target-dir-install') + +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/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/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..fddee2b --- /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: LLVM ir not supported with the Xcode backend. Patches welcome.') +endif + +copy = find_program('copyfile.py') + +copygen = generator(copy, + arguments : ['@INPUT@', '@OUTPUT@'], + output : '@BASENAME@') + +l = 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 = 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..31a5f17 --- /dev/null +++ b/test cases/common/127 generated assembly/meson.build @@ -0,0 +1,66 @@ +project('generated assembly', 'c') + +cc = meson.get_compiler('c') + +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 = 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 = 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/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/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..b797f76 --- /dev/null +++ b/test cases/common/129 build by default/meson.build @@ -0,0 +1,44 @@ +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, +) + +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/13 pch/c/meson.build b/test cases/common/13 pch/c/meson.build new file mode 100644 index 0000000..6fba15b --- /dev/null +++ b/test cases/common/13 pch/c/meson.build @@ -0,0 +1,14 @@ +cc = meson.get_compiler('c') +cc_id = cc.get_id() + +if cc_id == 'lcc' + error('MESON_SKIP_TEST: Elbrus compiler does not support PCH.') +endif + +# PGI compiler only supports PCH for C++ +if cc_id == 'pgi' + subdir_done() +endif + +exe = executable('prog', 'prog.c', +c_pch : 'pch/prog.h') diff --git a/test cases/common/13 pch/c/pch/prog.h b/test cases/common/13 pch/c/pch/prog.h new file mode 100644 index 0000000..c89890a --- /dev/null +++ b/test cases/common/13 pch/c/pch/prog.h @@ -0,0 +1,6 @@ +#ifndef PROG_H +// Header guards for PCH confuse msvc in some situations. +// Using them here makes sure we handle this correctly. +#define PROG_H +#include +#endif diff --git a/test cases/common/13 pch/c/prog.c b/test cases/common/13 pch/c/prog.c new file mode 100644 index 0000000..4ef2fd8 --- /dev/null +++ b/test cases/common/13 pch/c/prog.c @@ -0,0 +1,9 @@ +// No includes here, they need to come from the PCH + +void func(void) { + fprintf(stdout, "This is a function that fails if stdio is not #included.\n"); +} + +int main(void) { + return 0; +} diff --git a/test cases/common/13 pch/cpp/meson.build b/test cases/common/13 pch/cpp/meson.build new file mode 100644 index 0000000..b01cd58 --- /dev/null +++ b/test cases/common/13 pch/cpp/meson.build @@ -0,0 +1 @@ +exe = executable('prog', 'prog.cc', cpp_pch : 'pch/prog.hh') diff --git a/test cases/common/13 pch/cpp/pch/prog.hh b/test cases/common/13 pch/cpp/pch/prog.hh new file mode 100644 index 0000000..751cc4a --- /dev/null +++ b/test cases/common/13 pch/cpp/pch/prog.hh @@ -0,0 +1 @@ +#include diff --git a/test cases/common/13 pch/cpp/prog.cc b/test cases/common/13 pch/cpp/prog.cc new file mode 100644 index 0000000..0ba8519 --- /dev/null +++ b/test cases/common/13 pch/cpp/prog.cc @@ -0,0 +1,11 @@ +// Note: if using PGI compilers, you will need to add #include "prog.hh" +// even though you're using precompiled headers. +void func(void) { + std::cout << "This is a function that fails to compile if iostream is not included." + << std::endl; +} + +int main(void) { + func(); + return 0; +} diff --git a/test cases/common/13 pch/generated/gen_custom.py b/test cases/common/13 pch/generated/gen_custom.py new file mode 100644 index 0000000..650e03c --- /dev/null +++ b/test cases/common/13 pch/generated/gen_custom.py @@ -0,0 +1,5 @@ +#!/usr/bin/env python3 +import sys + +with open(sys.argv[1], 'w') as f: + f.write("#define FOO 0") diff --git a/test cases/common/13 pch/generated/gen_generator.py b/test cases/common/13 pch/generated/gen_generator.py new file mode 100644 index 0000000..a245e7a --- /dev/null +++ b/test cases/common/13 pch/generated/gen_generator.py @@ -0,0 +1,7 @@ +#!/usr/bin/env python3 +import sys + +with open(sys.argv[1]) as f: + content = f.read() +with open(sys.argv[2], 'w') as f: + f.write(content) diff --git a/test cases/common/13 pch/generated/generated_generator.in b/test cases/common/13 pch/generated/generated_generator.in new file mode 100644 index 0000000..1a00ebd --- /dev/null +++ b/test cases/common/13 pch/generated/generated_generator.in @@ -0,0 +1 @@ +#define BAR 0 diff --git a/test cases/common/13 pch/generated/meson.build b/test cases/common/13 pch/generated/meson.build new file mode 100644 index 0000000..ba06bce --- /dev/null +++ b/test cases/common/13 pch/generated/meson.build @@ -0,0 +1,22 @@ +cc = meson.get_compiler('c') +cc_id = cc.get_id() + +if cc_id == 'lcc' + error('MESON_SKIP_TEST: Elbrus compiler does not support PCH.') +endif + +# PGI compiler only supports PCH for C++ +if cc_id == 'pgi' + subdir_done() +endif + +generated_customTarget = custom_target('makeheader', + output: 'generated_customTarget.h', + command : [find_program('gen_custom.py'), '@OUTPUT0@']) + +generated_generator = generator(find_program('gen_generator.py'), + output: '@BASENAME@.h', + arguments: ['@INPUT@', '@OUTPUT@']) + +exe = executable('prog', 'prog.c', generated_customTarget, generated_generator.process('generated_generator.in'), + c_pch: 'pch/prog.h') diff --git a/test cases/common/13 pch/generated/pch/prog.h b/test cases/common/13 pch/generated/pch/prog.h new file mode 100644 index 0000000..15fec38 --- /dev/null +++ b/test cases/common/13 pch/generated/pch/prog.h @@ -0,0 +1,2 @@ +#include "generated_customTarget.h" +#include "generated_generator.h" diff --git a/test cases/common/13 pch/generated/prog.c b/test cases/common/13 pch/generated/prog.c new file mode 100644 index 0000000..a75c2d2 --- /dev/null +++ b/test cases/common/13 pch/generated/prog.c @@ -0,0 +1,5 @@ +// No includes here, they need to come from the PCH + +int main(void) { + return FOO + BAR; +} diff --git a/test cases/common/13 pch/linkwhole/lib1.c b/test cases/common/13 pch/linkwhole/lib1.c new file mode 100644 index 0000000..b56c17b --- /dev/null +++ b/test cases/common/13 pch/linkwhole/lib1.c @@ -0,0 +1,4 @@ +void func1() { + printf("Calling func2."); + func2(); +} diff --git a/test cases/common/13 pch/linkwhole/lib2.c b/test cases/common/13 pch/linkwhole/lib2.c new file mode 100644 index 0000000..0a13f60 --- /dev/null +++ b/test cases/common/13 pch/linkwhole/lib2.c @@ -0,0 +1,6 @@ +#include + +void func2() { + const char *cl = GetCommandLineA(); + printf("Command line was: %s\n", cl); +} diff --git a/test cases/common/13 pch/linkwhole/main.c b/test cases/common/13 pch/linkwhole/main.c new file mode 100644 index 0000000..6615a8b --- /dev/null +++ b/test cases/common/13 pch/linkwhole/main.c @@ -0,0 +1,9 @@ +#include + +void func1(); + +int main(int argc, char **argv) { + printf("Calling func1\n"); + func1(); + return 0; +} diff --git a/test cases/common/13 pch/linkwhole/meson.build b/test cases/common/13 pch/linkwhole/meson.build new file mode 100644 index 0000000..dec76ba --- /dev/null +++ b/test cases/common/13 pch/linkwhole/meson.build @@ -0,0 +1,8 @@ +# https://github.com/mesonbuild/meson/issues/10745 + +l2 = static_library('two', 'lib2.c', c_pch: 'pch2/pch_two.h') +l1 = static_library('one', 'lib1.c', c_pch: 'pch1/pch_one.h', + link_whole: l2) + +executable('linkprog', 'main.c', + link_with: l1) diff --git a/test cases/common/13 pch/linkwhole/pch1/pch_one.h b/test cases/common/13 pch/linkwhole/pch1/pch_one.h new file mode 100644 index 0000000..757c206 --- /dev/null +++ b/test cases/common/13 pch/linkwhole/pch1/pch_one.h @@ -0,0 +1,4 @@ +#ifndef PCH_ONE +#define PCH_ONE +#include +#endif diff --git a/test cases/common/13 pch/linkwhole/pch2/pch_two.h b/test cases/common/13 pch/linkwhole/pch2/pch_two.h new file mode 100644 index 0000000..1be0a20 --- /dev/null +++ b/test cases/common/13 pch/linkwhole/pch2/pch_two.h @@ -0,0 +1,4 @@ +#ifndef PCH_TWO +#define PCH_TWO +#include +#endif diff --git a/test cases/common/13 pch/meson.build b/test cases/common/13 pch/meson.build new file mode 100644 index 0000000..4bb3e1f --- /dev/null +++ b/test cases/common/13 pch/meson.build @@ -0,0 +1,26 @@ +project('pch test', 'c', 'cpp', + meson_version: '>= 0.46.0') + +cc = meson.get_compiler('c') +cc_id = cc.get_id() + +if cc_id == 'pgi' + error('MESON_SKIP_TEST: PGI compiler does support PCH, however, PGI cannot tolerate spaces in the --pch_dir path and Meson run_project_tests.py uses spaces in temporary build path names. If this test is run individually with no spaces in build path, it will pass.') +endif + +subdir('c') +subdir('cpp') +subdir('generated') +subdir('userDefined') +subdir('withIncludeDirectories') +subdir('withIncludeFile') + +if meson.backend() == 'xcode' + warning('Xcode backend only supports one precompiled header per target. Skipping "mixed" which has various precompiled headers.') +else + subdir('mixed') +endif + +if cc_id == 'msvc' + subdir('linkwhole') +endif diff --git a/test cases/common/13 pch/mixed/func.c b/test cases/common/13 pch/mixed/func.c new file mode 100644 index 0000000..620eca1 --- /dev/null +++ b/test cases/common/13 pch/mixed/func.c @@ -0,0 +1,7 @@ +void tmp_func(void) { + fprintf(stdout, "This is a function that fails if stdio is not #included.\n"); +} + +int cfunc(void) { + return 0; +} diff --git a/test cases/common/13 pch/mixed/main.cc b/test cases/common/13 pch/mixed/main.cc new file mode 100644 index 0000000..4321203 --- /dev/null +++ b/test cases/common/13 pch/mixed/main.cc @@ -0,0 +1,10 @@ +extern "C" int cfunc(); + +void func(void) { + std::cout << "This is a function that fails to compile if iostream is not included." + << std::endl; +} + +int main(void) { + return cfunc(); +} diff --git a/test cases/common/13 pch/mixed/meson.build b/test cases/common/13 pch/mixed/meson.build new file mode 100644 index 0000000..266e7a5 --- /dev/null +++ b/test cases/common/13 pch/mixed/meson.build @@ -0,0 +1,14 @@ +cc = meson.get_compiler('c') +cc_id = cc.get_id() + +# PGI compiler only supports PCH for C++ +if cc_id == 'pgi' + subdir_done() +endif + +exe = executable( + 'prog', + files('main.cc', 'func.c'), + c_pch : ['pch/func.h'], + cpp_pch : ['pch/main.h'], +) diff --git a/test cases/common/13 pch/mixed/pch/func.h b/test cases/common/13 pch/mixed/pch/func.h new file mode 100644 index 0000000..354499a --- /dev/null +++ b/test cases/common/13 pch/mixed/pch/func.h @@ -0,0 +1 @@ +#include diff --git a/test cases/common/13 pch/mixed/pch/main.h b/test cases/common/13 pch/mixed/pch/main.h new file mode 100644 index 0000000..751cc4a --- /dev/null +++ b/test cases/common/13 pch/mixed/pch/main.h @@ -0,0 +1 @@ +#include diff --git a/test cases/common/13 pch/userDefined/meson.build b/test cases/common/13 pch/userDefined/meson.build new file mode 100644 index 0000000..9b60572 --- /dev/null +++ b/test cases/common/13 pch/userDefined/meson.build @@ -0,0 +1,10 @@ +cc = meson.get_compiler('c') +cc_id = cc.get_id() + +# User supplied PCH implementation should override the auto +# generated one. PCH implementations are only supported for +# msvc and generally should not be used at all. Support for +# them is only kept for backwards compatibility. +if cc_id == 'msvc' + exe = executable('prog', 'prog.c', c_pch : ['pch/pch.h', 'pch/pch.c']) +endif diff --git a/test cases/common/13 pch/userDefined/pch/pch.c b/test cases/common/13 pch/userDefined/pch/pch.c new file mode 100644 index 0000000..6a97140 --- /dev/null +++ b/test cases/common/13 pch/userDefined/pch/pch.c @@ -0,0 +1,5 @@ +#include "pch.h" + +int foo(void) { + return 0; +} diff --git a/test cases/common/13 pch/userDefined/pch/pch.h b/test cases/common/13 pch/userDefined/pch/pch.h new file mode 100644 index 0000000..5d5f8f0 --- /dev/null +++ b/test cases/common/13 pch/userDefined/pch/pch.h @@ -0,0 +1 @@ +int foo(); diff --git a/test cases/common/13 pch/userDefined/prog.c b/test cases/common/13 pch/userDefined/prog.c new file mode 100644 index 0000000..475131b --- /dev/null +++ b/test cases/common/13 pch/userDefined/prog.c @@ -0,0 +1,8 @@ +// No includes here, they need to come from the PCH + +int main(void) { + // Method is implemented in pch.c. + // This makes sure that we can properly handle user defined + // pch implementation files and not only auto-generated ones. + return foo(); +} diff --git a/test cases/common/13 pch/withIncludeDirectories/include/lib/lib.h b/test cases/common/13 pch/withIncludeDirectories/include/lib/lib.h new file mode 100644 index 0000000..53c5fdf --- /dev/null +++ b/test cases/common/13 pch/withIncludeDirectories/include/lib/lib.h @@ -0,0 +1 @@ +#include diff --git a/test cases/common/13 pch/withIncludeDirectories/meson.build b/test cases/common/13 pch/withIncludeDirectories/meson.build new file mode 100644 index 0000000..95f7888 --- /dev/null +++ b/test cases/common/13 pch/withIncludeDirectories/meson.build @@ -0,0 +1,15 @@ +cc = meson.get_compiler('c') +cc_id = cc.get_id() + +if cc_id == 'lcc' + error('MESON_SKIP_TEST: Elbrus compiler does not support PCH.') +endif + +# PGI compiler only supports PCH for C++ +if cc_id == 'pgi' + subdir_done() +endif + +exe = executable('prog', 'prog.c', + include_directories: 'include', + c_pch : 'pch/prog.h') diff --git a/test cases/common/13 pch/withIncludeDirectories/pch/prog.h b/test cases/common/13 pch/withIncludeDirectories/pch/prog.h new file mode 100644 index 0000000..383b2c5 --- /dev/null +++ b/test cases/common/13 pch/withIncludeDirectories/pch/prog.h @@ -0,0 +1 @@ +#include diff --git a/test cases/common/13 pch/withIncludeDirectories/prog.c b/test cases/common/13 pch/withIncludeDirectories/prog.c new file mode 100644 index 0000000..4ef2fd8 --- /dev/null +++ b/test cases/common/13 pch/withIncludeDirectories/prog.c @@ -0,0 +1,9 @@ +// No includes here, they need to come from the PCH + +void func(void) { + fprintf(stdout, "This is a function that fails if stdio is not #included.\n"); +} + +int main(void) { + return 0; +} diff --git a/test cases/common/13 pch/withIncludeFile/meson.build b/test cases/common/13 pch/withIncludeFile/meson.build new file mode 100644 index 0000000..4fd2322 --- /dev/null +++ b/test cases/common/13 pch/withIncludeFile/meson.build @@ -0,0 +1,18 @@ +cc = meson.get_compiler('c') +cc_id = cc.get_id() + +if cc_id == 'lcc' + error('MESON_SKIP_TEST: Elbrus compiler does not support PCH.') +endif + +if cc.get_argument_syntax() == 'gcc' + c_args = ['-include', 'locale.h'] +elif cc.get_argument_syntax() == 'msvc' + c_args = ['/FI' + 'locale.h'] +else + subdir_done() +endif + +exe = executable('prog', 'prog.c', +c_args: c_args, +c_pch : 'pch/prog.h') diff --git a/test cases/common/13 pch/withIncludeFile/pch/prog.h b/test cases/common/13 pch/withIncludeFile/pch/prog.h new file mode 100644 index 0000000..c89890a --- /dev/null +++ b/test cases/common/13 pch/withIncludeFile/pch/prog.h @@ -0,0 +1,6 @@ +#ifndef PROG_H +// Header guards for PCH confuse msvc in some situations. +// Using them here makes sure we handle this correctly. +#define PROG_H +#include +#endif diff --git a/test cases/common/13 pch/withIncludeFile/prog.c b/test cases/common/13 pch/withIncludeFile/prog.c new file mode 100644 index 0000000..9d495f6 --- /dev/null +++ b/test cases/common/13 pch/withIncludeFile/prog.c @@ -0,0 +1,10 @@ +// No includes here, they need to come from the PCH or explicit inclusion + +void func(void) { + fprintf(stdout, "This is a function that fails if stdio is not #included.\n"); + setlocale(LC_ALL, ""); /* This will fail if locale.h is not included */ +} + +int main(void) { + return 0; +} 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 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..02e5a0c --- /dev/null +++ b/test cases/common/132 get define/meson.build @@ -0,0 +1,111 @@ +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)) + + # Check if prefix array works properly and has the expected order + have = cc.get_define('MESON_FAIL_VALUE', prefix: ['#define MESON_FAIL_VALUE 1', '#undef MESON_FAIL_VALUE']) + assert(have == '', 'MESON_FAIL_VALUE value is "@0@" instead of ""'.format(have)) + + have = cc.get_define('MESON_SUCCESS_VALUE', prefix: ['#undef MESON_SUCCESS_VALUE', '#define MESON_SUCCESS_VALUE 1']) + assert(have == '1', 'MESON_SUCCESS_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/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/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 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 empty build file/meson.build b/test cases/common/136 empty build file/meson.build new file mode 100644 index 0000000..807c401 --- /dev/null +++ b/test cases/common/136 empty build file/meson.build @@ -0,0 +1,2 @@ +project('subdir with empty meson.build test') +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 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..d4cbb83 --- /dev/null +++ b/test cases/common/137 whole archive/meson.build @@ -0,0 +1,49 @@ +project('whole archive', 'c') + +if meson.backend() == 'xcode' or \ + meson.backend() == 'vs2010' or \ + meson.backend() == 'vs2012' or \ + meson.backend() == 'vs2013' + error('MESON_SKIP_TEST: whole-archive not supported in Xcode nor pre-VS2015 IDE. Patches welcome.') +endif + +add_project_arguments('-I' + meson.source_root(), language : 'c') + +# 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/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..7db4be4 --- /dev/null +++ b/test cases/common/139 mesonintrospect from scripts/meson.build @@ -0,0 +1,14 @@ +project('mesonintrospect from scripts') + +python = import('python3').find_python() + +ret = run_command(python, ['check_env.py', '1'], check: false) +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/14 configure file/basename.py b/test cases/common/14 configure file/basename.py new file mode 100644 index 0000000..d2c8662 --- /dev/null +++ b/test cases/common/14 configure file/basename.py @@ -0,0 +1,28 @@ +#!/usr/bin/env python3 + +import sys +import argparse +import os + +def main(): + parser = argparse.ArgumentParser() + parser.add_argument('text', nargs='*', type=str) + args = parser.parse_args() + + text = args.text if isinstance(args.text, list) else [args.text] + + output = '' + for t in text: + t = os.path.basename(t) + + if not output: + output += t + else: + output += ' ' + t + + output += '\n' + + sys.stdout.write(output) + +if __name__ == '__main__': + sys.exit(main()) diff --git a/test cases/common/14 configure file/check_file.py b/test cases/common/14 configure file/check_file.py new file mode 100644 index 0000000..7d96b2a --- /dev/null +++ b/test cases/common/14 configure file/check_file.py @@ -0,0 +1,34 @@ +#!/usr/bin/env python3 + +import os +import sys + +def permit_osx_workaround(m1, m2): + import platform + if platform.system().lower() != 'darwin': + return False + if m2 % 10000 != 0: + return False + if m1//10000 != m2//10000: + return False + return True + +if len(sys.argv) == 2: + assert os.path.exists(sys.argv[1]) +elif len(sys.argv) == 3: + f1 = sys.argv[1] + f2 = sys.argv[2] + m1 = os.stat(f1).st_mtime_ns + m2 = os.stat(f2).st_mtime_ns + # Compare only os.stat() + if m1 != m2: + # Under macOS the lower four digits sometimes get assigned + # zero, even though shutil.copy2 should preserve metadata. + # Just have to accept it, I guess. + if not permit_osx_workaround(m1, m2): + raise RuntimeError(f'mtime of {f1!r} ({m1!r}) != mtime of {f2!r} ({m2!r})') + import filecmp + if not filecmp.cmp(f1, f2): + raise RuntimeError(f'{f1!r} != {f2!r}') +else: + raise AssertionError diff --git a/test cases/common/14 configure file/check_inputs.py b/test cases/common/14 configure file/check_inputs.py new file mode 100644 index 0000000..1faa8ba --- /dev/null +++ b/test cases/common/14 configure file/check_inputs.py @@ -0,0 +1,14 @@ +#!/usr/bin/env python3 + +import sys +from pathlib import Path + +files = [Path(f) for f in sys.argv[1:]] +names = [f.name for f in files] + +assert names == ['check_inputs.txt', 'prog.c', 'prog.c', 'prog2.c', 'prog4.c', 'prog5.c'] +for f in files[1:]: + assert f.exists() + +with files[0].open('w') as ofile: + ofile.write("#define ZERO_RESULT 0\n") diff --git a/test cases/common/14 configure file/config.h b/test cases/common/14 configure file/config.h new file mode 100644 index 0000000..e85b634 --- /dev/null +++ b/test cases/common/14 configure file/config.h @@ -0,0 +1 @@ +#error "This file should not be included. Build dir must become before source dir in search order" diff --git a/test cases/common/14 configure file/config.h.in b/test cases/common/14 configure file/config.h.in new file mode 100644 index 0000000..14a1558 --- /dev/null +++ b/test cases/common/14 configure file/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/14 configure file/config4a.h.in b/test cases/common/14 configure file/config4a.h.in new file mode 100644 index 0000000..aafd195 --- /dev/null +++ b/test cases/common/14 configure file/config4a.h.in @@ -0,0 +1,2 @@ +/* Dummy file */ +#define RESULTA @ZERO@ diff --git a/test cases/common/14 configure file/config4b.h.in b/test cases/common/14 configure file/config4b.h.in new file mode 100644 index 0000000..3408bab --- /dev/null +++ b/test cases/common/14 configure file/config4b.h.in @@ -0,0 +1,2 @@ +/* Dummy file */ +#define RESULTB @ZERO@ diff --git a/test cases/common/14 configure file/config5.h.in b/test cases/common/14 configure file/config5.h.in new file mode 100644 index 0000000..323bec6 --- /dev/null +++ b/test cases/common/14 configure file/config5.h.in @@ -0,0 +1 @@ +#define MESSAGE "@var@" diff --git a/test cases/common/14 configure file/config6.h.in b/test cases/common/14 configure file/config6.h.in new file mode 100644 index 0000000..9719f87 --- /dev/null +++ b/test cases/common/14 configure file/config6.h.in @@ -0,0 +1,19 @@ +/* No escape */ +#define MESSAGE1 "@var1@" + +/* Single escape means no replace */ +#define MESSAGE2 "\@var1@" + +/* Replace pairs of escapes before '@' or '\@' with escape characters + * (note we have to double number of pairs due to C string escaping) + */ +#define MESSAGE3 "\\\\@var1@" + +/* Pairs of escapes and then single escape to avoid replace */ +#define MESSAGE4 "\\\\\@var1@" + +/* Check escaped variable does not overlap following variable */ +#define MESSAGE5 "\@var1@var2@" + +/* Check escape character outside variables */ +#define MESSAGE6 "\\ @ \@ \\\\@ \\\\\@" diff --git a/test cases/common/14 configure file/config7.h.in b/test cases/common/14 configure file/config7.h.in new file mode 100644 index 0000000..edd0bb3 --- /dev/null +++ b/test cases/common/14 configure file/config7.h.in @@ -0,0 +1,16 @@ +/* No escape */ +#define MESSAGE1 "${var1}" + +/* Single escape means no replace */ +#define MESSAGE2 "\${var1}" + +/* Replace pairs of escapes before '@' or '\@' with escape characters + * (note we have to double number of pairs due to C string escaping) + */ +#define MESSAGE3 "\\\\${var1}" + +/* Pairs of escapes and then single escape to avoid replace */ +#define MESSAGE4 "\\\\\${var1}" + +/* Check escape character outside variables */ +#define MESSAGE5 "\\ ${ \${ \\\\${ \\\\\${" diff --git a/test cases/common/14 configure file/config8.h.in b/test cases/common/14 configure file/config8.h.in new file mode 100644 index 0000000..b854ea0 --- /dev/null +++ b/test cases/common/14 configure file/config8.h.in @@ -0,0 +1,3 @@ +#define MESSAGE "@var@" + +#define "non isolatin1 char Ä fails decode with utf-8" diff --git a/test cases/common/14 configure file/depfile b/test cases/common/14 configure file/depfile new file mode 100644 index 0000000..e69de29 diff --git a/test cases/common/14 configure file/differentafterbasename1.in b/test cases/common/14 configure file/differentafterbasename1.in new file mode 100644 index 0000000..e69de29 diff --git a/test cases/common/14 configure file/differentafterbasename2.in b/test cases/common/14 configure file/differentafterbasename2.in new file mode 100644 index 0000000..e69de29 diff --git a/test cases/common/14 configure file/dummy.dat b/test cases/common/14 configure file/dummy.dat new file mode 100644 index 0000000..e69de29 diff --git a/test cases/common/14 configure file/dumpprog.c b/test cases/common/14 configure file/dumpprog.c new file mode 100644 index 0000000..9f63b23 --- /dev/null +++ b/test cases/common/14 configure file/dumpprog.c @@ -0,0 +1,52 @@ +#define SHOULD_BE_UNDEFINED 1 + +#include"config3.h" +#include +#include + +#ifdef SHOULD_BE_UNDEFINED +#error Token did not get undefined. +#endif + +#ifndef SHOULD_BE_DEFINED +#error Token did not get defined +#endif + +#define stringify(s) str(s) +#define str(s) #s + +int main(void) { +#if !(SHOULD_BE_UNQUOTED_STRING == string) + printf("String token (unquoted) defined wrong.\n"); + return 1; +#endif + if(strcmp(SHOULD_BE_STRING, "string") != 0) { + printf("String token defined wrong.\n"); + return 1; + } + if(strcmp(SHOULD_BE_STRING2, "A \"B\" C") != 0) { + printf("String token 2 defined wrong.\n"); + return 1; + } + if(strcmp(SHOULD_BE_STRING3, "A \"\" C") != 0) { + printf("String token 3 defined wrong.\n"); + return 1; + } + if(strcmp(SHOULD_BE_STRING4, "A \" C") != 0) { + printf("String token 4 defined wrong.\n"); + return 1; + } + if(SHOULD_BE_ONE != 1) { + printf("One defined incorrectly.\n"); + return 1; + } + if(SHOULD_BE_ZERO != 0) { + printf("Zero defined incorrectly.\n"); + return 1; + } + if(strcmp(SHOULD_BE_QUOTED_ONE, "1") != 0) { + printf("Quoted number defined incorrectly.\n"); + return 1; + } + SHOULD_BE_RETURN 0; +} diff --git a/test cases/common/14 configure file/file_contains.py b/test cases/common/14 configure file/file_contains.py new file mode 100644 index 0000000..409f09c --- /dev/null +++ b/test cases/common/14 configure file/file_contains.py @@ -0,0 +1,22 @@ +#!/usr/bin/env python3 + +import sys +import argparse + +def main(): + parser = argparse.ArgumentParser() + parser.add_argument('file', nargs=1, type=str) + parser.add_argument('text', nargs=1, type=str) + args = parser.parse_args() + + text = args.text[0] + + with open(args.file[0], encoding='utf-8') as f: + for line in f: + if line.strip() == text: + return 0 + + return 1 + +if __name__ == '__main__': + sys.exit(main()) diff --git a/test cases/common/14 configure file/generator-deps.py b/test cases/common/14 configure file/generator-deps.py new file mode 100755 index 0000000..cca253c --- /dev/null +++ b/test cases/common/14 configure file/generator-deps.py @@ -0,0 +1,19 @@ +#!/usr/bin/env python3 + +import sys, os +from pathlib import Path + +if len(sys.argv) != 3: + print("Wrong amount of parameters.") + +build_dir = Path(os.environ['MESON_BUILD_ROOT']) +subdir = Path(os.environ['MESON_SUBDIR']) +outputf = Path(sys.argv[1]) + +with outputf.open('w') as ofile: + ofile.write("#define ZERO_RESULT 0\n") + +depf = Path(sys.argv[2]) +if not depf.exists(): + with depf.open('w') as ofile: + ofile.write(f"{outputf.name}: depfile\n") diff --git a/test cases/common/14 configure file/generator-without-input-file.py b/test cases/common/14 configure file/generator-without-input-file.py new file mode 100755 index 0000000..2ee059e --- /dev/null +++ b/test cases/common/14 configure file/generator-without-input-file.py @@ -0,0 +1,14 @@ +#!/usr/bin/env python3 + +import sys, os +from pathlib import Path + +if len(sys.argv) != 2: + print("Wrong amount of parameters.") + +build_dir = Path(os.environ['MESON_BUILD_ROOT']) +subdir = Path(os.environ['MESON_SUBDIR']) +outputf = Path(sys.argv[1]) + +with outputf.open('w') as ofile: + ofile.write("#define ZERO_RESULT 0\n") diff --git a/test cases/common/14 configure file/generator.py b/test cases/common/14 configure file/generator.py new file mode 100755 index 0000000..832a7b8 --- /dev/null +++ b/test cases/common/14 configure file/generator.py @@ -0,0 +1,17 @@ +#!/usr/bin/env python3 + +import sys, os +from pathlib import Path + +if len(sys.argv) != 3: + print("Wrong amount of parameters.") + +build_dir = Path(os.environ['MESON_BUILD_ROOT']) +subdir = Path(os.environ['MESON_SUBDIR']) +inputf = Path(sys.argv[1]) +outputf = Path(sys.argv[2]) + +assert inputf.exists() + +with outputf.open('w') as ofile: + ofile.write("#define ZERO_RESULT 0\n") diff --git a/test cases/common/14 configure file/invalid-utf8.bin.in b/test cases/common/14 configure file/invalid-utf8.bin.in new file mode 100644 index 0000000..98e9ed9 Binary files /dev/null and b/test cases/common/14 configure file/invalid-utf8.bin.in differ diff --git a/test cases/common/14 configure file/meson.build b/test cases/common/14 configure file/meson.build new file mode 100644 index 0000000..569dd09 --- /dev/null +++ b/test cases/common/14 configure file/meson.build @@ -0,0 +1,330 @@ +project('configure file test', 'c', meson_version: '>=0.63.0') + +fs = import('fs') + +conf = configuration_data() + +conf.set('var', 'mystring') +conf.set('other', 'string 2') +conf.set('second', ' bonus') +conf.set('BE_TRUE', true) + +assert(conf.get('var') == 'mystring', 'Get function is not working.') +assert(conf.get('var', 'default') == 'mystring', 'Get function is not working.') +assert(conf.get('notthere', 'default') == 'default', 'Default value getting is not working.') +assert(conf.keys() == ['BE_TRUE', 'other', 'second', 'var'], 'Keys function is not working') + +cfile = configure_file(input : 'config.h.in', + output : 'config.h', + configuration : conf) + +e = executable('inctest', 'prog.c', +# Note that you should NOT do this. Don't add generated headers here +# This tests that we do the right thing even if people add in conf files +# to their sources. + cfile) +test('inctest', e) + +# Test if we can also pass files() as input +configure_file(input : files('config.h.in'), + output : 'config2.h', + configuration : conf) + +# Now generate a header file with an external script. +genprog = import('python3').find_python() +scriptfile = '@0@/generator.py'.format(meson.current_source_dir()) +ifile = '@0@/dummy.dat'.format(meson.current_source_dir()) +ofile = '@0@/config2.h'.format(meson.current_build_dir()) + +check_file = find_program('check_file.py') +# Configure in source root with command and absolute paths +outf = configure_file(input : 'dummy.dat', + output : 'config2.h', + command : [genprog, scriptfile, ifile, ofile], + install_dir : 'share/appdir') +ret = run_command(check_file, outf, check: false) +if ret.returncode() != 0 + error('Error running command: @0@\n@1@'.format(ret.stdout(), ret.stderr())) +endif + +# Same again as before, but an input file should not be required in +# this case where we use a command/script to generate the output file. +genscript2b = '@0@/generator-without-input-file.py'.format(meson.current_source_dir()) +ofile2b = '@0@/config2b.h'.format(meson.current_build_dir()) +outf = configure_file( + output : 'config2b.h', + command : [genprog, genscript2b, ofile2b], + install_dir : 'share/appdir') +ret = run_command(check_file, outf, check: false) +if ret.returncode() != 0 + error('Error running command: @0@\n@1@'.format(ret.stdout(), ret.stderr())) +endif + +genscript2deps = '@0@/generator-deps.py'.format(meson.current_source_dir()) +ofile2deps = '@0@/config2deps.h'.format(meson.current_build_dir()) +outf = configure_file( + output : 'config2deps.h', + depfile : 'depfile.d', + command : [genprog, genscript2deps, ofile2deps, '@DEPFILE@']) +ret = run_command(check_file, outf, check: false) +if ret.returncode() != 0 + error('Error running command: @0@\n@1@'.format(ret.stdout(), ret.stderr())) +endif + +found_script = find_program('generator.py') +# More configure_file tests in here +subdir('subdir') + +test('inctest2', executable('prog2', 'prog2.c')) + +# Generate a conf file without an input file. + +dump = configuration_data() +dump.set_quoted('SHOULD_BE_STRING', 'string', description : 'A string') +dump.set_quoted('SHOULD_BE_STRING2', 'A "B" C') +dump.set_quoted('SHOULD_BE_STRING3', 'A "" C') +dump.set_quoted('SHOULD_BE_STRING4', 'A " C') +dump.set('SHOULD_BE_RETURN', 'return') +dump.set('SHOULD_BE_DEFINED', true) +dump.set('SHOULD_BE_UNDEFINED', false) +dump.set('SHOULD_BE_ONE', 1) +dump.set('SHOULD_BE_ZERO', 0, description : 'Absolutely zero') +dump.set('SHOULD_BE_QUOTED_ONE', '"1"') + +dump.set_quoted('INTEGER_AS_STRING', '12') +if dump.get_unquoted('INTEGER_AS_STRING').to_int() == 12 + dump.set('SHOULD_BE_UNQUOTED_STRING', dump.get_unquoted('SHOULD_BE_STRING')) +endif + +configure_file(output : 'config3.h', + configuration : dump) + +test('Configless.', executable('dumpprog', 'dumpprog.c')) + + +# Config file generation in a loop with @BASENAME@ substitution +dump = configuration_data() +dump.set('ZERO', 0) +config_templates = files(['config4a.h.in', 'config4b.h.in']) +foreach config_template : config_templates + configure_file(input : config_template, output : '@BASENAME@', configuration : dump) +endforeach + +test('Substituted', executable('prog4', 'prog4.c')) + +# Test `capture` keyword + +basename_py = find_program('basename.py') +file_contains_py = find_program('file_contains.py') +test_string = 'hello world' +test_input_file = join_paths(meson.current_build_dir(), test_string) +run_command(find_program('touch.py'), test_input_file, check: true) +configs = [ + # no input + configure_file(command: [ basename_py, test_string ], capture: true, output: 'capture test 1'), + # with input + configure_file(input: test_input_file, command: [ basename_py, '@INPUT@' ], capture: true, output: 'capture test 2'), +] +foreach c : configs + test('@0@'.format(c), file_contains_py, args: [ c, test_string ]) +endforeach + +# Test variable is substituted only once +conf5 = configuration_data() +conf5.set('var', '@var2@') +conf5.set('var2', 'error') +configure_file( + input : 'config5.h.in', + output : '@BASENAME@', + configuration : conf5) +test('test5', executable('prog5', 'prog5.c')) + +# Test escaping +conf6 = configuration_data() +conf6.set('var1', 'foo') +conf6.set('var2', 'bar') +configure_file( + input : 'config6.h.in', + output : '@BASENAME@', + configuration : conf6) +test('test6', executable('prog6', 'prog6.c')) + +# test empty install dir string +cfile = configure_file(input : 'config.h.in', + output : 'do_not_get_installed.h', + install_dir : '', + configuration : conf) + +# test install_dir : false (deprecated) +cfile = configure_file(input : 'config.h.in', + output : 'do_not_get_installed_please.h', + install_dir : false, + configuration : conf) + +# test intsall_dir with install: false +cfile = configure_file(input : 'config.h.in', + output : 'do_not_get_installed_in_install_dir.h', + install : false, + install_dir : 'share/appdir', + configuration : conf) + +# Test escaping with cmake format +conf7 = configuration_data() +conf7.set('var1', 'foo') +conf7.set('var2', 'bar') +configure_file( + input : 'config7.h.in', + output : '@BASENAME@', + format : 'cmake', + configuration : conf7) +test('test7', executable('prog7', 'prog7.c')) + +# Test copying of an empty configuration data object +inf = 'invalid-utf8.bin.in' +outf = configure_file(input : inf, + output : 'invalid-utf8.bin', + copy: true) +ret = run_command(check_file, inf, outf, check: false) +if ret.returncode() != 0 + error('Error running command: @0@\n@1@'.format(ret.stdout(), ret.stderr())) +endif +# Now the same, but using a File object as an argument. +inf2 = files('invalid-utf8.bin.in')[0] +outf = configure_file(input : inf2, + output : 'invalid-utf8.bin', + copy: true) +ret = run_command(check_file, inf2, outf, check: false) +if ret.returncode() != 0 + error('Error running command: @0@\n@1@'.format(ret.stdout(), ret.stderr())) +endif + +# Test copy of a binary file +outf = configure_file(input : inf, + output : 'somebinary.bin', + copy : true) +ret = run_command(check_file, inf, outf, check: false) +if ret.returncode() != 0 + error('Error running command: @0@\n@1@'.format(ret.stdout(), ret.stderr())) +endif + +# Test the fs replacement +# Test copying of an empty configuration data object +inf = 'invalid-utf8.bin.in' +outf = fs.copyfile(inf, 'invalid-utf8-1.bin', + install: true, + install_dir: get_option('datadir') / meson.project_name(), + install_tag: 'copyfile', +) +test('fs.copyfile string', check_file, args: [files(inf), outf]) + +# Test with default outname of string +outf = fs.copyfile(inf) +test('fs.copyfile default name', check_file, args: [files(inf), outf]) + +# Now the same, but using a File object as an argument. +inf2 = files('invalid-utf8.bin.in')[0] +outf = fs.copyfile(inf2, 'invalid-utf8-2.bin') +test('fs.copyfile file', check_file, args: [inf2, outf]) + +# Test non isolatin1 encoded input file which fails to decode with utf-8 +conf8 = configuration_data() +conf8.set('var', 'foo') +configure_file( + input : 'config8.h.in', + output : '@BASENAME@', + encoding : 'koi8-r', + configuration : conf8) + +# Test that passing an empty configuration_data() object to a file with +# #mesondefine substitutions does not print the warning. +configure_file( + input: 'nosubst-nocopy1.txt.in', + output: 'nosubst-nocopy1.txt', + configuration : configuration_data()) + +# test that passing an empty configuration_data() object to a file with +# @foo@ substitutions does not print the warning. +configure_file( + input: 'nosubst-nocopy2.txt.in', + output: 'nosubst-nocopy2.txt', + configuration : configuration_data()) + +# test that passing a configured file object to test() works, and that passing +# an empty configuration_data() object to a file that leads to no substitutions +# prints a warning (see unit tests) +test_file = configure_file( + input: 'test.py.in', + output: 'test.py', + configuration: configuration_data()) + +# Test that overwriting an existing file creates a warning. +configure_file( + input: 'test.py.in', + output: 'double_output.txt', + configuration: conf) +configure_file( + input: 'test.py.in', + output: 'double_output.txt', + configuration: conf) + +# Test that the same file name in a different subdir will not create a warning +configure_file( + input: 'test.py.in', + output: 'no_write_conflict.txt', + configuration: conf) + +# Test that @BASENAME@ is substituted before checking and does not create a warning. +configure_file( + input: 'differentafterbasename1.in', + output: '@BASENAME@', + configuration: conf +) +configure_file( + input: 'differentafterbasename2.in', + output: '@BASENAME@', + configuration: conf +) + +# Test that @BASENAME@ is substituted before checking and does create a warning on conflict. +configure_file( + input: 'sameafterbasename.in', + output: '@BASENAME@', + configuration: conf +) +configure_file( + input: 'sameafterbasename.in2', + output: '@BASENAME@', + configuration: conf +) + +test('configure-file', test_file) + +# Dictionaries + +cdata = configuration_data({ + 'A_STRING' : '"foo"', + 'A_INT' : 42, + 'A_DEFINED' : true, + 'A_UNDEFINED' : false, +}) + +configure_file(output : 'config9a.h', + configuration : cdata, +) + +configure_file(output : 'config9b.h', + configuration : { + 'B_STRING' : '"foo"', + 'B_INT' : 42, + 'B_DEFINED' : true, + 'B_UNDEFINED' : false, + } +) + +test('test9', executable('prog9', 'prog9.c')) + +check_inputs = find_program('check_inputs.py') +configure_file(output : 'check_inputs.txt', + input : ['prog.c', files('prog2.c', 'prog4.c')], + command : [check_inputs, '@OUTPUT@', '@INPUT0@', '@INPUT@', files('prog5.c')] +) diff --git a/test cases/common/14 configure file/nosubst-nocopy1.txt.in b/test cases/common/14 configure file/nosubst-nocopy1.txt.in new file mode 100644 index 0000000..6e893a1 --- /dev/null +++ b/test cases/common/14 configure file/nosubst-nocopy1.txt.in @@ -0,0 +1 @@ +#mesondefine FOO_BAR diff --git a/test cases/common/14 configure file/nosubst-nocopy2.txt.in b/test cases/common/14 configure file/nosubst-nocopy2.txt.in new file mode 100644 index 0000000..a6a7cca --- /dev/null +++ b/test cases/common/14 configure file/nosubst-nocopy2.txt.in @@ -0,0 +1 @@ +@FOO_BAR@ diff --git a/test cases/common/14 configure file/prog.c b/test cases/common/14 configure file/prog.c new file mode 100644 index 0000000..85e66b9 --- /dev/null +++ b/test cases/common/14 configure file/prog.c @@ -0,0 +1,17 @@ +#include +/* config.h must not be in quotes: + * https://gcc.gnu.org/onlinedocs/cpp/Search-Path.html + */ +#include + +#ifdef SHOULD_BE_UNDEF +#error "FAIL!" +#endif + +int main(void) { +#ifndef BE_TRUE + return 1; +#else + return strcmp(MESSAGE, "mystring"); +#endif +} diff --git a/test cases/common/14 configure file/prog2.c b/test cases/common/14 configure file/prog2.c new file mode 100644 index 0000000..8b90bfb --- /dev/null +++ b/test cases/common/14 configure file/prog2.c @@ -0,0 +1,5 @@ +#include + +int main(void) { + return ZERO_RESULT; +} diff --git a/test cases/common/14 configure file/prog4.c b/test cases/common/14 configure file/prog4.c new file mode 100644 index 0000000..1e32a31 --- /dev/null +++ b/test cases/common/14 configure file/prog4.c @@ -0,0 +1,6 @@ +#include +#include + +int main(void) { + return RESULTA + RESULTB; +} diff --git a/test cases/common/14 configure file/prog5.c b/test cases/common/14 configure file/prog5.c new file mode 100644 index 0000000..1a8f785 --- /dev/null +++ b/test cases/common/14 configure file/prog5.c @@ -0,0 +1,6 @@ +#include +#include + +int main(void) { + return strcmp(MESSAGE, "@var2@"); +} diff --git a/test cases/common/14 configure file/prog6.c b/test cases/common/14 configure file/prog6.c new file mode 100644 index 0000000..57f5586 --- /dev/null +++ b/test cases/common/14 configure file/prog6.c @@ -0,0 +1,11 @@ +#include +#include + +int main(void) { + return strcmp(MESSAGE1, "foo") + || strcmp(MESSAGE2, "@var1@") + || strcmp(MESSAGE3, "\\foo") + || strcmp(MESSAGE4, "\\@var1@") + || strcmp(MESSAGE5, "@var1bar") + || strcmp(MESSAGE6, "\\ @ @ \\@ \\@"); +} diff --git a/test cases/common/14 configure file/prog7.c b/test cases/common/14 configure file/prog7.c new file mode 100644 index 0000000..802bc46 --- /dev/null +++ b/test cases/common/14 configure file/prog7.c @@ -0,0 +1,10 @@ +#include +#include + +int main(void) { + return strcmp(MESSAGE1, "foo") + || strcmp(MESSAGE2, "${var1}") + || strcmp(MESSAGE3, "\\foo") + || strcmp(MESSAGE4, "\\${var1}") + || strcmp(MESSAGE5, "\\ ${ ${ \\${ \\${"); +} diff --git a/test cases/common/14 configure file/prog9.c b/test cases/common/14 configure file/prog9.c new file mode 100644 index 0000000..3f77601 --- /dev/null +++ b/test cases/common/14 configure file/prog9.c @@ -0,0 +1,18 @@ +#include +#include +#include + +#if defined(A_UNDEFINED) || defined(B_UNDEFINED) +#error "Should not be defined" +#endif + +#if !defined(A_DEFINED) || !defined(B_DEFINED) +#error "Should be defined" +#endif + +int main(void) { + return strcmp(A_STRING, "foo") + || strcmp(B_STRING, "foo") + || A_INT != 42 + || B_INT != 42; +} diff --git a/test cases/common/14 configure file/sameafterbasename.in b/test cases/common/14 configure file/sameafterbasename.in new file mode 100644 index 0000000..e69de29 diff --git a/test cases/common/14 configure file/sameafterbasename.in2 b/test cases/common/14 configure file/sameafterbasename.in2 new file mode 100644 index 0000000..e69de29 diff --git a/test cases/common/14 configure file/subdir/meson.build b/test cases/common/14 configure file/subdir/meson.build new file mode 100644 index 0000000..98b672c --- /dev/null +++ b/test cases/common/14 configure file/subdir/meson.build @@ -0,0 +1,38 @@ +# Configure in subdir with absolute paths for input and relative for output +configure_file(input : '../dummy.dat', + output : 'config2-1.h', + command : [genprog, scriptfile, ifile, 'config2-1.h'], + install_dir : 'share/appdireh') +run_command(check_file, join_paths(meson.current_build_dir(), 'config2-1.h'), check: true) + +# Configure in subdir with files() for input and relative for output +configure_file(input : '../dummy.dat', + output : 'config2-2.h', + command : [genprog, scriptfile, files('../dummy.dat'), 'config2-2.h'], + install_dir : 'share/appdirok') +run_command(check_file, join_paths(meson.current_build_dir(), 'config2-2.h'), check: true) + +# Configure in subdir with string templates for input and output +configure_file(input : '../dummy.dat', + output : 'config2-3.h', + command : [found_script, '@INPUT@', '@OUTPUT@']) +run_command(check_file, join_paths(meson.current_build_dir(), 'config2-3.h'), check: true) + +# Test that overwriting an existing file creates a warning. +configure_file( + input: '../test.py.in', + output: 'double_output2.txt', + configuration: conf +) +configure_file( + input: '../test.py.in', + output: 'double_output2.txt', + configuration: conf +) + +# Test that the same file name in a different subdir will not create a warning +configure_file( + input: '../test.py.in', + output: 'no_write_conflict.txt', + configuration: conf +) diff --git a/test cases/common/14 configure file/test.json b/test cases/common/14 configure file/test.json new file mode 100644 index 0000000..5a6ccd5 --- /dev/null +++ b/test cases/common/14 configure file/test.json @@ -0,0 +1,9 @@ +{ + "installed": [ + {"type": "file", "file": "usr/share/appdir/config2.h"}, + {"type": "file", "file": "usr/share/appdir/config2b.h"}, + {"type": "file", "file": "usr/share/appdireh/config2-1.h"}, + {"type": "file", "file": "usr/share/appdirok/config2-2.h"}, + {"type": "file", "file": "usr/share/configure file test/invalid-utf8-1.bin"} + ] +} diff --git a/test cases/common/14 configure file/test.py.in b/test cases/common/14 configure file/test.py.in new file mode 100644 index 0000000..15a61f5 --- /dev/null +++ b/test cases/common/14 configure file/test.py.in @@ -0,0 +1,4 @@ +#!/usr/bin/env python3 + +import sys +sys.exit(0) diff --git a/test cases/common/14 configure file/touch.py b/test cases/common/14 configure file/touch.py new file mode 100644 index 0000000..b48f481 --- /dev/null +++ b/test cases/common/14 configure file/touch.py @@ -0,0 +1,16 @@ +#!/usr/bin/env python3 + +import sys +import argparse +from pathlib import Path + +def main(): + parser = argparse.ArgumentParser() + parser.add_argument('files', nargs='*', type=str) + args = parser.parse_args() + + for filepath in args.files: + Path(filepath).touch() + +if __name__ == '__main__': + sys.exit(main()) 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..abc5728 --- /dev/null +++ b/test cases/common/140 custom target multiple outputs/meson.build @@ -0,0 +1,44 @@ +project('multiple outputs install') + +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/141 special characters/.editorconfig b/test cases/common/141 special characters/.editorconfig new file mode 100644 index 0000000..6c026f8 --- /dev/null +++ b/test cases/common/141 special characters/.editorconfig @@ -0,0 +1,2 @@ +[meson.build] +trim_trailing_whitespace = false 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..044857e --- /dev/null +++ b/test cases/common/141 special characters/arg-char-test.c @@ -0,0 +1,11 @@ +#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]); + return 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..1d93f45 --- /dev/null +++ b/test cases/common/141 special characters/arg-string-test.c @@ -0,0 +1,13 @@ +#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]); + return 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..9c51bff --- /dev/null +++ b/test cases/common/141 special characters/arg-unquoted-test.c @@ -0,0 +1,18 @@ +#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 + return 0; +} 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/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..40c1b8c --- /dev/null +++ b/test cases/common/143 list of file sources/meson.build @@ -0,0 +1,12 @@ +project('test') + +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/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..babd58a --- /dev/null +++ b/test cases/common/144 link depends custom target/meson.build @@ -0,0 +1,14 @@ +project('link_depends_custom_target', 'c') + +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..e652671 --- /dev/null +++ b/test cases/common/146 library at root/meson.build @@ -0,0 +1,3 @@ +project('lib@root', 'c') +lib = 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..101fdb8 --- /dev/null +++ b/test cases/common/147 simd/meson.build @@ -0,0 +1,43 @@ +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..3a57a5b --- /dev/null +++ b/test cases/common/147 simd/simd_sse2.c @@ -0,0 +1,36 @@ +#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..bbc7453 --- /dev/null +++ b/test cases/common/148 shared module resolving symbol in executable/meson.build @@ -0,0 +1,25 @@ +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) +e_dep = declare_dependency(link_with: e) + +m = shared_module('module', 'module.c', link_with: e) +m2 = shared_module('module2', 'module.c', dependencies: e_dep) + +test('test', e, args: m.full_path()) +test('test2', e, args: m2.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/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..f094ba1 --- /dev/null +++ b/test cases/common/149 dotinclude/meson.build @@ -0,0 +1,4 @@ +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/15 if/meson.build b/test cases/common/15 if/meson.build new file mode 100644 index 0000000..f8d8295 --- /dev/null +++ b/test cases/common/15 if/meson.build @@ -0,0 +1,72 @@ +project('if test', 'c') + +var1 = true +set_variable('var2', false) + +if var1 + exe = executable('prog', 'prog.c') +endif + +if var2 + exe = executable('breakbreakbreak', 'crashing.c') +endif + +test('iftest', exe) + +if not is_variable('var1') + error('Is_variable fail.') +endif + +if is_variable('nonexisting') + error('Is_variable fail 2.') +endif + +if not get_variable('var1', false) + error('Get_variable fail.') +endif + +if get_variable('nonexisting', false) + error('Get_variable fail.') +endif + + +# Now test elseif + +t = true +f = false + +if true + message('Ok.') +elif true + error('Error') +else + error('Error') +endif + +if f + error('Error.') +elif t + message('Ok') +else + error('Error') +endif + +if f + error('Error.') +elif false + error('Error') +else + message('Ok') +endif + +# Test plain else + +var = false + +if var + exe = executable('break', 'break.c') +else + exe = executable('eprog', 'prog.c') +endif + +test('elsetest', exe) diff --git a/test cases/common/15 if/prog.c b/test cases/common/15 if/prog.c new file mode 100644 index 0000000..78f2de1 --- /dev/null +++ b/test cases/common/15 if/prog.c @@ -0,0 +1 @@ +int main(void) { return 0; } 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-sonarqube/meson.build b/test cases/common/150 reserved targets/coverage-sonarqube/meson.build new file mode 100644 index 0000000..ac4c0d2 --- /dev/null +++ b/test cases/common/150 reserved targets/coverage-sonarqube/meson.build @@ -0,0 +1 @@ +executable('test-coverage-sonarqube', '../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/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 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..5448502 --- /dev/null +++ b/test cases/common/153 wrap file should not failed/meson.build @@ -0,0 +1,23 @@ +project('mainproj', 'c', + default_options : ['wrap_mode=nodownload'], +) + +if not find_program('patch', required : false).found() and not find_program('git', required : false).found() + error('MESON_SKIP_TEST: patch/git not found.') +endif + +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') + +exe = subproject('patchfile').get_variable('foo_exe') +test('test_foo', exe) 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-1.0/bar.c b/test cases/common/153 wrap file should not failed/subprojects/bar-1.0/bar.c new file mode 100644 index 0000000..36dcff0 --- /dev/null +++ b/test cases/common/153 wrap file should not failed/subprojects/bar-1.0/bar.c @@ -0,0 +1,3 @@ +int bar_dummy_func(void) { + return 42; +} diff --git a/test cases/common/153 wrap file should not failed/subprojects/bar-1.0/meson.build b/test cases/common/153 wrap file should not failed/subprojects/bar-1.0/meson.build new file mode 100644 index 0000000..c3d9fee --- /dev/null +++ b/test cases/common/153 wrap file should not failed/subprojects/bar-1.0/meson.build @@ -0,0 +1,2 @@ +project('static lib bar', 'c') +libbar = static_library('bar', 'bar.c') 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-1.0-patchdir/foo.c b/test cases/common/153 wrap file should not failed/subprojects/foo-1.0-patchdir/foo.c new file mode 100644 index 0000000..267b43a --- /dev/null +++ b/test cases/common/153 wrap file should not failed/subprojects/foo-1.0-patchdir/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/foo-1.0-patchdir/meson.build b/test cases/common/153 wrap file should not failed/subprojects/foo-1.0-patchdir/meson.build new file mode 100644 index 0000000..dbaf91f --- /dev/null +++ b/test cases/common/153 wrap file should not failed/subprojects/foo-1.0-patchdir/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/foo-1.0-patchfile/.meson-subproject-wrap-hash.txt b/test cases/common/153 wrap file should not failed/subprojects/foo-1.0-patchfile/.meson-subproject-wrap-hash.txt new file mode 100644 index 0000000..81b251f --- /dev/null +++ b/test cases/common/153 wrap file should not failed/subprojects/foo-1.0-patchfile/.meson-subproject-wrap-hash.txt @@ -0,0 +1 @@ +0af7983865d151deb48307cc86e9631767501d73016dcf6193523e306caa5485 diff --git a/test cases/common/153 wrap file should not failed/subprojects/foo-1.0-patchfile/foo.c b/test cases/common/153 wrap file should not failed/subprojects/foo-1.0-patchfile/foo.c new file mode 100644 index 0000000..d78f25c --- /dev/null +++ b/test cases/common/153 wrap file should not failed/subprojects/foo-1.0-patchfile/foo.c @@ -0,0 +1,7 @@ +int dummy_func(void) { + return 44; +} + +int main(void) { + return dummy_func() == 44 ? 0 : 1; +} diff --git a/test cases/common/153 wrap file should not failed/subprojects/foo-1.0-patchfile/meson.build b/test cases/common/153 wrap file should not failed/subprojects/foo-1.0-patchfile/meson.build new file mode 100644 index 0000000..ae5d800 --- /dev/null +++ b/test cases/common/153 wrap file should not failed/subprojects/foo-1.0-patchfile/meson.build @@ -0,0 +1,2 @@ +project('static lib patchdir', 'c') +foo_exe = executable('foo', 'foo.c') diff --git a/test cases/common/153 wrap file should not failed/subprojects/foo-1.0/foo.c b/test cases/common/153 wrap file should not failed/subprojects/foo-1.0/foo.c new file mode 100644 index 0000000..267b43a --- /dev/null +++ b/test cases/common/153 wrap file should not failed/subprojects/foo-1.0/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/foo-1.0/meson.build b/test cases/common/153 wrap file should not failed/subprojects/foo-1.0/meson.build new file mode 100644 index 0000000..bcb8bf7 --- /dev/null +++ b/test cases/common/153 wrap file should not failed/subprojects/foo-1.0/meson.build @@ -0,0 +1,2 @@ +project('static lib', 'c') +libfoo = static_library('foo', 'foo.c') 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/packagefiles/patchfile/0001-Change-foo-to-executable.patch b/test cases/common/153 wrap file should not failed/subprojects/packagefiles/patchfile/0001-Change-foo-to-executable.patch new file mode 100644 index 0000000..a29fb6c --- /dev/null +++ b/test cases/common/153 wrap file should not failed/subprojects/packagefiles/patchfile/0001-Change-foo-to-executable.patch @@ -0,0 +1,33 @@ +From b79f6cc4a096f6c2888f73b947b652491885896a Mon Sep 17 00:00:00 2001 +From: Xavier Claessens +Date: Fri, 30 Nov 2018 14:13:47 -0500 +Subject: [PATCH] Change foo to executable + +--- + foo.c | 4 ++++ + meson.build | 2 +- + 2 files changed, 5 insertions(+), 1 deletion(-) + +diff --git a/foo.c b/foo.c +index 54f9119..468f033 100644 +--- a/foo.c ++++ b/foo.c +@@ -1,3 +1,7 @@ + int dummy_func(void) { + return 44; + } ++ ++int main(void) { ++ return dummy_func() == 44 ? 0 : 1; ++} +diff --git a/meson.build b/meson.build +index 318e81d..4a281d9 100644 +--- a/meson.build ++++ b/meson.build +@@ -1,2 +1,2 @@ + project('static lib patchdir', 'c') +-libfoo = static_library('foo', 'foo.c') ++foo_exe = executable('foo', 'foo.c') +-- +2.17.1 + diff --git a/test cases/common/153 wrap file should not failed/subprojects/packagefiles/patchfile/0001-Change-return-value-to-43.patch b/test cases/common/153 wrap file should not failed/subprojects/packagefiles/patchfile/0001-Change-return-value-to-43.patch new file mode 100644 index 0000000..49cf1e9 --- /dev/null +++ b/test cases/common/153 wrap file should not failed/subprojects/packagefiles/patchfile/0001-Change-return-value-to-43.patch @@ -0,0 +1,21 @@ +From 7001dcc738e5ae7dfa8af20ed582b9a985804f72 Mon Sep 17 00:00:00 2001 +From: Xavier Claessens +Date: Fri, 30 Nov 2018 10:15:33 -0500 +Subject: [PATCH 1/2] Change return value to 43 + +--- + foo.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/foo.c b/foo.c +index 019f2ba..e4577b8 100644 +--- a/foo.c ++++ b/foo.c +@@ -1,3 +1,3 @@ + int dummy_func(void) { +- return 42; ++ return 43; + } +-- +2.17.1 + diff --git a/test cases/common/153 wrap file should not failed/subprojects/packagefiles/patchfile/0002-Change-return-value-to-44.patch b/test cases/common/153 wrap file should not failed/subprojects/packagefiles/patchfile/0002-Change-return-value-to-44.patch new file mode 100644 index 0000000..4794cea --- /dev/null +++ b/test cases/common/153 wrap file should not failed/subprojects/packagefiles/patchfile/0002-Change-return-value-to-44.patch @@ -0,0 +1,21 @@ +From c2da2e490b09f2e251c7f4ef7c1240acee215fec Mon Sep 17 00:00:00 2001 +From: Xavier Claessens +Date: Fri, 30 Nov 2018 10:15:47 -0500 +Subject: [PATCH 2/2] Change return value to 44 + +--- + foo.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/foo.c b/foo.c +index e4577b8..54f9119 100644 +--- a/foo.c ++++ b/foo.c +@@ -1,3 +1,3 @@ + int dummy_func(void) { +- return 43; ++ return 44; + } +-- +2.17.1 + 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/patchfile.wrap b/test cases/common/153 wrap file should not failed/subprojects/patchfile.wrap new file mode 100644 index 0000000..3d446fe --- /dev/null +++ b/test cases/common/153 wrap file should not failed/subprojects/patchfile.wrap @@ -0,0 +1,14 @@ +[wrap-file] +directory = foo-1.0-patchfile + +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_files = + patchfile/0001-Change-return-value-to-43.patch, + patchfile/0002-Change-return-value-to-44.patch, + patchfile/0001-Change-foo-to-executable.patch 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..70d493f --- /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') +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/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..8f4cb02 --- /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 = 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..1f05f9e --- /dev/null +++ b/test cases/common/155 subproject dir name collision/custom_subproject_dir/C/meson.build @@ -0,0 +1,3 @@ +project('C', 'c') +# libc.so cannot be used, it already exists as a reserved name +c = library('cee', '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..37cb623 --- /dev/null +++ b/test cases/common/155 subproject dir name collision/other_subdir/meson.build @@ -0,0 +1 @@ +other = 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..fc80594 --- /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], check: false) +else + cmd = run_command(['ls', includedir], check: false) +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 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/16 comparison/meson.build b/test cases/common/16 comparison/meson.build new file mode 100644 index 0000000..97cf2ca --- /dev/null +++ b/test cases/common/16 comparison/meson.build @@ -0,0 +1,146 @@ +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) + +# "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'}''') + +assert('a' in 'abc') +assert('b' not in 'def') 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 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 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 subdir if_found/meson.build b/test cases/common/162 subdir if_found/meson.build new file mode 100644 index 0000000..05be94f --- /dev/null +++ b/test cases/common/162 subdir if_found/meson.build @@ -0,0 +1,11 @@ +project('subdir if found') + +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..ee80192 --- /dev/null +++ b/test cases/common/163 default options prefix dependent defaults/meson.build @@ -0,0 +1 @@ +project('default options prefix dependent defaults ', 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..9488cd4 --- /dev/null +++ b/test cases/common/164 dependency factory/meson.build @@ -0,0 +1,66 @@ +project('dependency factory', 'c', meson_version : '>=0.53') + +dep = dependency('gl', method: 'pkg-config', required: false) +if dep.found() + assert(dep.type_name() == 'pkgconfig') + dep.get_pkgconfig_variable('prefix') +endif + +dep = dependency('SDL2', method: 'pkg-config', required: false) +if dep.found() + assert(dep.type_name() == 'pkgconfig') + dep.get_pkgconfig_variable('prefix') +endif + +dep = dependency('SDL2', method: 'config-tool', required: false) +if dep.found() + assert(dep.type_name() == 'config-tool') + dep.get_configtool_variable('prefix') +endif + +dep = dependency('Vulkan', method: 'pkg-config', required: false) +if dep.found() + assert(dep.type_name() == 'pkgconfig') + dep.get_pkgconfig_variable('prefix') +endif + +dep = dependency('pcap', method: 'pkg-config', required: false) +if dep.found() + assert(dep.type_name() == 'pkgconfig') + dep.get_pkgconfig_variable('prefix') +endif + +dep = dependency('pcap', method: 'config-tool', required: false) +if dep.found() + assert(dep.type_name() == 'config-tool') + dep.get_configtool_variable('prefix') +endif + +dep = dependency('cups', method: 'pkg-config', required: false) +if dep.found() + assert(dep.type_name() == 'pkgconfig') + dep.get_pkgconfig_variable('prefix') +endif + +dep = dependency('cups', method: 'config-tool', required: false) +if dep.found() + assert(dep.type_name() == 'config-tool') + dep.get_configtool_variable('prefix') +endif + +dep = dependency('libwmf', method: 'pkg-config', required: false) +if dep.found() + assert(dep.type_name() == 'pkgconfig') + dep.get_pkgconfig_variable('prefix') +endif + +dep = dependency('libwmf', method: 'config-tool', required: false) +if dep.found() + assert(dep.type_name() == 'config-tool') + dep.get_configtool_variable('prefix') +endif + +dep = dependency('boost', method: 'system', required: false) +if dep.found() + assert(dep.type_name() == 'system') +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 yield/meson.build b/test cases/common/166 yield/meson.build new file mode 100644 index 0000000..e8f2106 --- /dev/null +++ b/test cases/common/166 yield/meson.build @@ -0,0 +1,7 @@ +project('yield_options') + +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..1c29d86 --- /dev/null +++ b/test cases/common/166 yield/subprojects/sub/meson.build @@ -0,0 +1,5 @@ +project('subbie') + +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..102041e --- /dev/null +++ b/test cases/common/167 subproject nested subproject dirs/contrib/subprojects/alpha/a.c @@ -0,0 +1,14 @@ +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..1014db1 --- /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 = 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..8b13789 --- /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/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/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..fade382 --- /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/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..f5d3e58 --- /dev/null +++ b/test cases/common/170 generator link whole/meson.build @@ -0,0 +1,62 @@ +project('generator link_whole', 'c') + +if meson.backend() == 'xcode' + error('MESON_SKIP_TEST: whole-archive not supported in Xcode. Patches welcome.') +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/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/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/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/176 subproject version/meson.build b/test cases/common/176 subproject version/meson.build new file mode 100644 index 0000000..b98f0cb --- /dev/null +++ b/test cases/common/176 subproject version/meson.build @@ -0,0 +1,9 @@ +project('subproject version', + 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..aeb85af --- /dev/null +++ b/test cases/common/176 subproject version/subprojects/a/meson.build @@ -0,0 +1,5 @@ +project('mysubproject', + 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..62346a2 --- /dev/null +++ b/test cases/common/177 subdir_done/meson.build @@ -0,0 +1,11 @@ +# 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') + +if true + subdir_done() +endif + +executable('main', 'main.cpp') +error('Unreachable') diff --git a/test cases/common/178 bothlibraries/dummy.py b/test cases/common/178 bothlibraries/dummy.py new file mode 100644 index 0000000..9e838ba --- /dev/null +++ b/test cases/common/178 bothlibraries/dummy.py @@ -0,0 +1,8 @@ +#!/usr/bin/env python3 + +from pathlib import Path +import sys + +if __name__ == '__main__': + Path(sys.argv[1]).write_text('Hello World\n') + raise SystemExit(0) diff --git a/test cases/common/178 bothlibraries/foo.cpp b/test cases/common/178 bothlibraries/foo.cpp new file mode 100644 index 0000000..a705cbc --- /dev/null +++ b/test cases/common/178 bothlibraries/foo.cpp @@ -0,0 +1,11 @@ +#include +#include "mylib.h" + +extern "C" { + DO_EXPORT int foo(void); +} + +int foo(void) { + auto bptr = std::make_shared(0); + return *bptr; +} 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/main2.c b/test cases/common/178 bothlibraries/main2.c new file mode 100644 index 0000000..e1f4bf8 --- /dev/null +++ b/test cases/common/178 bothlibraries/main2.c @@ -0,0 +1,9 @@ +#include "mylib.h" + +DO_IMPORT int func(void); +DO_IMPORT int foo(void); +DO_IMPORT int retval; + +int main(void) { + return func() + foo() == 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..bb3a2bc --- /dev/null +++ b/test cases/common/178 bothlibraries/meson.build @@ -0,0 +1,62 @@ +project('both libraries linking test', 'c', 'cpp') + +both_libs = both_libraries('mylib', 'libfile.c') +dep = declare_dependency(link_with: both_libs) +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) +exe_dep = executable('prog-dep', 'main.c', dependencies : [dep]) + +# Try using it in a custom_target +custom_target('tgt_a', + command: [ + find_program('./dummy.py'), + '@OUTPUT@', + both_libs, + ], + output: ['hello1.txt'], + input: [both_libs], +) + +test('runtest-shared', exe_shared) +test('runtest-static', exe_static) +test('runtest-both', exe_both) +test('runtest-dep', exe_dep) + +# 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 {set,get}_variable +set_variable('both_libs2', both_libs) +both_libs3 = get_variable('both_libs') + +# Ensure that calling the build target methods also works +assert(both_libs.name() == 'mylib') +assert(both_libs2.name() == 'mylib') +assert(both_libs3.name() == 'mylib') +assert(both_libs2.get_shared_lib().name() == 'mylib') +assert(both_libs3.get_static_lib().name() == 'mylib') + +test('runtest-shared-2', exe_shared2) +test('runtest-static-2', exe_static2) +test('runtest-both-2', exe_both2) + +# Regression test: libccpp has both C and C++ sources. The executable only has +# C sources. It should still link using the C++ compiler. When using +# both_libraries the static has no sources and thus no compilers, resulting in +# the executable linking using the C compiler. +# https://github.com/Netflix/vmaf/issues/1107 +libccpp = both_libraries('ccpp', 'foo.cpp', 'libfile.c') +exe = executable('prog-ccpp', 'main2.c', + link_with: libccpp.get_static_lib(), + c_args : ['-DSTATIC_COMPILATION'], +) +test('runtest-ccpp', exe) 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/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..46c99d3 --- /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'), check: true) +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 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 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 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..8dcbac7 --- /dev/null +++ b/test cases/common/182 find override/meson.build @@ -0,0 +1,25 @@ +project('find program override', 'c') + +gencodegen = find_program('gencodegen', required : false) +six_prog = find_program('six_meson_exe', required : false) + +assert(not gencodegen.found(), 'gencodegen is an internal program, should not be found') +assert(not six_prog.found(), 'six_meson_exe 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()) +assert(tool.full_path() != '') +assert(tool.full_path() == tool.path()) + +# six_meson_exe is an overritten project executable +six_prog = find_program('six_meson_exe') +assert(six_prog.found()) +assert(six_prog.full_path() != '') +assert(six_prog.full_path() == six_prog.path()) 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..7deff40 --- /dev/null +++ b/test cases/common/182 find override/otherdir/meson.build @@ -0,0 +1,30 @@ +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) + +# Override stuff with an executables +meson.override_find_program('six_meson_exe', 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/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/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 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..61d77e4 --- /dev/null +++ b/test cases/common/187 args flattening/meson.build @@ -0,0 +1,25 @@ +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') + +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 = configuration_data() +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..2f4c4c9 --- /dev/null +++ b/test cases/common/188 dict/meson.build @@ -0,0 +1,82 @@ +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') + +# Complex types +d = { + 'sanity': 1, + 'host': host_machine, + 'meson': meson, +} + +assert(d['sanity'] == 1) +assert(not is_disabler(d['meson'])) +assert(not is_disabler(d['host'])) 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/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/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..e877ba7 --- /dev/null +++ b/test cases/common/190 install_mode/meson.build @@ -0,0 +1,60 @@ +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, + build_rpath: meson.current_build_dir(), + 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..a58caa1 --- /dev/null +++ b/test cases/common/190 install_mode/test.json @@ -0,0 +1,22 @@ +{ + "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"], + "stdout": [ + { + "line": ".* DEPRECATION: install_mode with the sticky bit on a file", + "match": "re", + "count": 3 + } + ] +} 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 subproject array version/meson.build b/test cases/common/191 subproject array version/meson.build new file mode 100644 index 0000000..4e5aebf --- /dev/null +++ b/test cases/common/191 subproject array version/meson.build @@ -0,0 +1,3 @@ +project('master') + +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..615ee92 --- /dev/null +++ b/test cases/common/191 subproject array version/subprojects/foo/meson.build @@ -0,0 +1 @@ +project('foo', 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..b5e26fa --- /dev/null +++ b/test cases/common/192 feature option/meson.build @@ -0,0 +1,62 @@ +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(feature_opts.allowed(), '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(required_opt.allowed(), 'Should be enabled option') +assert(required_opt.require(true, error_message: 'xyz').enabled(), 'Should be enabled option') +assert(required_opt.disable_auto_if(true).enabled(), 'Should be enabled option') +assert(required_opt.disable_auto_if(false).enabled(), '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(optional_opt.allowed(), 'Should be auto option') +assert(optional_opt.require(true).auto(), 'Should be auto option') +assert(optional_opt.require(false, error_message: 'xyz').disabled(), 'Should be disabled auto option') +assert(optional_opt.disable_auto_if(true).disabled(), 'Should be disabled auto option') +assert(optional_opt.disable_auto_if(false).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') +assert(not disabled_opt.allowed(), 'Should be disabled option') +assert(disabled_opt.require(true).disabled(), 'Should be disabled option') +assert(disabled_opt.require(false, error_message: 'xyz').disabled(), 'Should be disabled option') +assert(disabled_opt.disable_auto_if(true).disabled(), 'Should be disabled option') +assert(disabled_opt.disable_auto_if(false).disabled(), '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/193 feature option disabled/meson.build b/test cases/common/193 feature option disabled/meson.build new file mode 100644 index 0000000..65d4d71 --- /dev/null +++ b/test cases/common/193 feature option disabled/meson.build @@ -0,0 +1,23 @@ +project('feature user option', + 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/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/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..4d43ecd --- /dev/null +++ b/test cases/common/197 function attributes/meson.build @@ -0,0 +1,119 @@ +# 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', + 'section', + 'sentinel', + '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 + + # XXX(arsen): limited to clang 13+ even though gcc 11 has it, since gcc + # detects support for it at compile time based on binutils version + if c.get_id() == 'clang' and c.version().version_compare('>= 13.0.0') + attributes += 'retain' + 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/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/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/2 cpp/VERSIONFILE b/test cases/common/2 cpp/VERSIONFILE new file mode 100644 index 0000000..3eefcb9 --- /dev/null +++ b/test cases/common/2 cpp/VERSIONFILE @@ -0,0 +1 @@ +1.0.0 diff --git a/test cases/common/2 cpp/cpp.C b/test cases/common/2 cpp/cpp.C new file mode 100644 index 0000000..d3df476 --- /dev/null +++ b/test cases/common/2 cpp/cpp.C @@ -0,0 +1,6 @@ +#include + +int main(void) { + std::cout << "C++ seems to be working." << std::endl; + return 0; +} diff --git a/test cases/common/2 cpp/meson.build b/test cases/common/2 cpp/meson.build new file mode 100644 index 0000000..2962681 --- /dev/null +++ b/test cases/common/2 cpp/meson.build @@ -0,0 +1,41 @@ +project('c++ test', 'cpp', version: files('VERSIONFILE')) + +cpp = meson.get_compiler('cpp') +if cpp.get_id() == 'intel' + # Error out if the -std=xxx option is incorrect + add_project_arguments('-diag-error', '10159', language : 'cpp') +elif cpp.get_id() == 'intel-cl' + add_project_arguments('/Qdiag-error:10159', language : 'cpp') +endif + +exe = executable('trivialprog', 'trivial.cc', extra_files : 'something.txt') +test('runtest', exe) + +has_not_changed = false +if is_disabler(exe) + has_not_changed = true +else + has_not_changed = true +endif +assert(has_not_changed, 'Executable has changed.') + +assert(not is_disabler(exe), 'Executable is a disabler.') + +exe = executable('trivialprog', 'trivial.cc', extra_files : disabler()) + +assert(is_disabler(exe), 'Executable is not a disabler.') + +if exe.found() + exe_disabled = false +else + exe_disabled = true +endif + +assert(exe_disabled, 'Executable was not disabled.') + +if cpp.get_id() == 'msvc' + exe = executable('cppprog', 'cpp.C', cpp_args : '/TP') +else + exe = executable('cppprog', 'cpp.C') +endif +test('cpptest', exe) diff --git a/test cases/common/2 cpp/something.txt b/test cases/common/2 cpp/something.txt new file mode 100644 index 0000000..9f6cc91 --- /dev/null +++ b/test cases/common/2 cpp/something.txt @@ -0,0 +1 @@ +This file is only here so it shows up in IDEs as part of this target. diff --git a/test cases/common/2 cpp/trivial.cc b/test cases/common/2 cpp/trivial.cc new file mode 100644 index 0000000..d3df476 --- /dev/null +++ b/test cases/common/2 cpp/trivial.cc @@ -0,0 +1,6 @@ +#include + +int main(void) { + std::cout << "C++ seems to be working." << std::endl; + return 0; +} 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/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 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..53f0fe6 --- /dev/null +++ b/test cases/common/202 custom target build by default/meson.build @@ -0,0 +1,10 @@ +project('custom-target-dir-install') + +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/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 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 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 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..54f4e41 --- /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'], suite: ['verbose'], protocol: 'tap', verbose: true) +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 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/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 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/211 dependency get_variable method/meson.build b/test cases/common/211 dependency get_variable method/meson.build new file mode 100644 index 0000000..b7e7035 --- /dev/null +++ b/test cases/common/211 dependency get_variable method/meson.build @@ -0,0 +1,67 @@ +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.') + assert(dep.get_variable(pkgconfig : 'pkgvarnotfound', default_value : '') == '') +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 dependency get_variable method/test.json b/test cases/common/211 dependency get_variable method/test.json new file mode 100644 index 0000000..5281618 --- /dev/null +++ b/test cases/common/211 dependency get_variable method/test.json @@ -0,0 +1,9 @@ +{ + "stdout": [ + { + "line": ".*pkgvarnotfound.*", + "match": "re", + "count": 0 + } + ] + } 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..9aacbc4 --- /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'), not_found]) +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'), not_found]) + +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 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/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/dummy.cpp b/test cases/common/215 source set realistic example/dummy.cpp new file mode 100644 index 0000000..e69de29 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..3ff8f12 --- /dev/null +++ b/test cases/common/215 source set realistic example/meson.build @@ -0,0 +1,53 @@ +# 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, method : 'pkg-config') + +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() + common.add(files('dummy.cpp')) +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..d521b43 --- /dev/null +++ b/test cases/common/216 custom target input extracted objects/check_object.py @@ -0,0 +1,17 @@ +#!/usr/bin/env python3 + +import sys, os + +if __name__ == '__main__': + if len(sys.argv) < 4: + print(sys.argv[0], 'n output objects...') + sys.exit(1) + if len(sys.argv) != int(sys.argv[1]) + 3: + print(f'expected {sys.argv[1]} objects, got {len(sys.argv) - 3}') + sys.exit(1) + for i in sys.argv[3:]: + print('testing', i) + if not os.path.exists(i): + sys.exit(1) + with open(sys.argv[2], 'wb') as out: + pass diff --git a/test cases/common/216 custom target input extracted objects/libdir/gen.py b/test cases/common/216 custom target input extracted objects/libdir/gen.py new file mode 100644 index 0000000..095fffd --- /dev/null +++ b/test cases/common/216 custom target input extracted objects/libdir/gen.py @@ -0,0 +1,6 @@ +#! /usr/bin/env python3 +import sys +with open(sys.argv[1], 'r') as f: + for l in f: + l = l.rstrip() + print(l.replace(sys.argv[2], sys.argv[3])) 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..93a7bcc --- /dev/null +++ b/test cases/common/216 custom target input extracted objects/libdir/meson.build @@ -0,0 +1,21 @@ +gen_py = find_program('gen.py') +ctsrc = custom_target('custom_target sources', + output: 'ct-source.c', + input: 'source.c', + command: [ gen_py, '@INPUT@', 'func1', 'func2' ], capture: true) + +gen = generator(gen_py, arguments: ['@INPUT@', 'func1', 'func3'], + output: 'gen-@PLAINNAME@', + capture: true) +gensrc = gen.process('source.c') + + +gen = generator(gen_py, arguments: ['@INPUT@', 'func1', 'func4'], + output: 'gen-@PLAINNAME@', + capture: true) +sublibsrc = gen.process('source.c') +subobjlib = static_library('subobject', sublibsrc) + +objlib = static_library('object', 'source.c', ctsrc, gensrc, + objects: subobjlib.extract_all_objects(recursive: false), + 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..654b76d --- /dev/null +++ b/test cases/common/216 custom target input extracted objects/meson.build @@ -0,0 +1,48 @@ +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, '1', '@OUTPUT@', '@INPUT@'], + build_by_default: true) + +custom_target('checkct', + input: objlib.extract_objects(ctsrc), + output: 'objcheck-ct', + command: [checker, '1', '@OUTPUT@', '@INPUT@'], + build_by_default: true) + +custom_target('checkcti', + input: objlib.extract_objects(ctsrc[0]), + output: 'objcheck-cti', + command: [checker, '1', '@OUTPUT@', '@INPUT@'], + build_by_default: true) + +custom_target('checkgen', + input: objlib.extract_objects(gensrc), + output: 'objcheck-gen', + command: [checker, '1', '@OUTPUT@', '@INPUT@'], + build_by_default: true) + +custom_target('checkall', + input: objlib.extract_all_objects(recursive: false), + output: 'objcheck-all', + command: [checker, '3', '@OUTPUT@', '@INPUT@'], + build_by_default: true) + +custom_target('checkall-recursive', + input: objlib.extract_all_objects(recursive: true), + output: 'objcheck-all-recursive', + command: [checker, '4', '@OUTPUT@', '@INPUT@'], + 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..159d56f --- /dev/null +++ b/test cases/common/217 test priorities/meson.build @@ -0,0 +1,22 @@ +project('test priorities') + +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/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..678fb4e --- /dev/null +++ b/test cases/common/219 include_type dependency/meson.build @@ -0,0 +1,44 @@ +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') + +fallback_empty = dependency('', include_type: 'system', fallback: ['subDep', 'subDep_dep']) +assert(fallback_empty.include_type() == 'system', 'include_type works with empty name 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/check-obj.py b/test cases/common/22 object extraction/check-obj.py new file mode 100644 index 0000000..d6afbcc --- /dev/null +++ b/test cases/common/22 object extraction/check-obj.py @@ -0,0 +1,21 @@ +#! /usr/bin/env python3 + +import json +import sys +import os + +cc = None +output = None + +# Only the ninja backend produces compile_commands.json +if sys.argv[1] == 'ninja': + with open('compile_commands.json') as f: + cc = json.load(f) + output = {x['output'] for x in cc} + +for obj in sys.argv[2:]: + if not os.path.exists(obj): + sys.exit(f'File {obj} not found.') + if sys.argv[1] == 'ninja' and obj not in output: + sys.exit(1) + print('Verified', obj) diff --git a/test cases/common/22 object extraction/create-source.py b/test cases/common/22 object extraction/create-source.py new file mode 100644 index 0000000..d2e8e8b --- /dev/null +++ b/test cases/common/22 object extraction/create-source.py @@ -0,0 +1,3 @@ +#! /usr/bin/env python3 +import sys +print(f'#include "{sys.argv[1]}"') diff --git a/test cases/common/22 object extraction/header.h b/test cases/common/22 object extraction/header.h new file mode 100644 index 0000000..50403ce --- /dev/null +++ b/test cases/common/22 object extraction/header.h @@ -0,0 +1 @@ +/* Check that extract_all_objects works with headers. */ 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..37ac66d --- /dev/null +++ b/test cases/common/22 object extraction/meson.build @@ -0,0 +1,50 @@ +project('object extraction', 'c') + +if meson.is_unity() + message('Skipping extraction test because this is a Unity build.') +else + lib1 = library('somelib', 'src/lib.c') + lib2 = library('somelib2', 'lib.c', 'header.h', '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']) + obj5 = lib2.extract_objects(['lib.c', 'header.h']) + obj6 = lib2.extract_all_objects(recursive: true) + + 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) + e5 = executable('main5', 'main.c', objects : obj5) + e6 = executable('main6', 'main.c', objects : obj6) + + ct_src = custom_target('lib3.c', output: 'lib3.c', capture: true, + command: [find_program('create-source.py'), 'lib.c']) + lib3 = library('somelib3', ct_src) + e7 = executable('main7', 'main.c', objects: lib3.extract_objects(ct_src[0])) + e8 = executable('main8', 'main.c', objects: lib3.extract_objects(ct_src)) + + gen = generator(find_program('create-source.py'), arguments: ['@INPUT@'], + output: '@BASENAME@4.c', capture: true) + gen_src = gen.process('lib.c') + lib4 = library('somelib4', gen_src) + e9 = executable('main9', 'main.c', objects: lib4.extract_objects(gen_src)) + + custom_target('custom_target with object inputs', output: 'objs', + input: [obj1, obj2, obj3, obj5, obj6], + build_by_default: true, + command: [find_program('check-obj.py'), meson.backend(), '@INPUT@'], + capture: true) + + test('extraction test 1', e1) + test('extraction test 2', e2) + test('extraction test 3', e3) + test('extraction test 4', e4) + test('extraction test 5', e5) + test('extraction test 6', e6) + test('extraction test 7', e7) + test('extraction test 8', e8) + test('extraction test 9', e9) +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/220 fs module/meson.build b/test cases/common/220 fs module/meson.build new file mode 100644 index 0000000..d38c872 --- /dev/null +++ b/test cases/common/220 fs module/meson.build @@ -0,0 +1,144 @@ +project('fs module test') + +is_windows = build_machine.system() == 'windows' + +fs = import('fs') + +f = files('meson.build') + +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', '-f', meson.current_source_dir() / 'meson.build', symlink, check: true) + assert(fs.is_symlink(symlink), 'Symlink not detected.') + assert(not fs.is_symlink('meson.build'), 'Regular file detected as symlink.') + assert(not fs.is_symlink(f[0]), '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') +assert(fs.replace_suffix(f[0], '') == 'meson', 'replace_suffix trim') + +original = 'foo.txt' +new = fs.replace_suffix(original, '.ini') +assert(new == 'foo.ini', 'replace_suffix failed') + +new = fs.replace_suffix(f[0], '.ini') +assert(new == 'meson.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') + +f = files('subdir/subdirfile.txt') +md5 = fs.hash(f[0], 'md5') +assert(md5 == 'd0795db41614d25affdd548314b30b3b', 'md5sum did not match') +sha256 = fs.hash(f[0], 'sha256') +assert(sha256 == 'be2170b0dae535b73f6775694fffa3fd726a43b5fabea11b7342f0605917a42a', 'sha256sum did not match') + +# -- size + +size = fs.size('subdir/subdirfile.txt') +assert(size == 19, 'file size not found correctly') + +size = fs.size(f[0]) +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 detecting 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') + +f = files('meson.build', 'subdir/../meson.build') +assert(fs.is_samepath(f[0], f[1]), 'is_samepath not detercting same files') + +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') +if not is_windows +assert(fs.parent(f[1]) == 'subdir/..', 'failed to get dirname') +else +assert(fs.parent(f[1]) == 'subdir\..', 'failed to get dirname') +endif +assert(fs.name('foo/bar') == 'bar', 'failed to get basename') +assert(fs.name(f[1]) == 'meson.build', '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..0cd2475 --- /dev/null +++ b/test cases/common/220 fs module/subdir/meson.build @@ -0,0 +1,6 @@ +subdirfiles = files('subdirfile.txt') +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') + +assert(fs.is_samepath(subdirfiles[0], 'subdirfile.txt'), 'is_samepath not detecting same directory when using File and str') 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/221 zlib/meson.build b/test cases/common/221 zlib/meson.build new file mode 100644 index 0000000..b5b813c --- /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', 'android'].contains(host_machine.system()) + error('MESON_SKIP_TEST only applicable on macOS, FreeBSD, DragonflyBSD, Windows, and Android.') +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/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/main.cpp b/test cases/common/223 persubproject options/main.cpp new file mode 100644 index 0000000..214f02b --- /dev/null +++ b/test cases/common/223 persubproject options/main.cpp @@ -0,0 +1,3 @@ +int foo(); + +int main(void) { return foo(); } 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..25a0100 --- /dev/null +++ b/test cases/common/223 persubproject options/meson.build @@ -0,0 +1,20 @@ +project('persubproject options', 'c', 'cpp', + default_options : ['werror=true', + 'warning_level=3', + 'cpp_std=c++11']) + +assert(get_option('default_library') == 'both', 'Parent default_library should be "both"') +assert(get_option('werror')) +assert(get_option('warning_level') == '3') +assert(get_option('cpp_std') == 'c++11') + + +# Check it build both by calling a method only both_libraries target implement +lib = library('lib1', 'foo.c') +lib.get_static_lib() + +subproject('sub1') + +libcpp14_dep = dependency('libcpp14', fallback: 'sub2', default_options : ['default_library=static']) +exe = executable('test1', 'main.cpp', dependencies : libcpp14_dep) +test('mixing-cpp-version', exe) 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..fb72837 --- /dev/null +++ b/test cases/common/223 persubproject options/subprojects/sub1/meson.build @@ -0,0 +1,10 @@ +project('sub1', 'c', 'cpp', + default_options : ['warning_level=0']) + +assert(get_option('default_library') == 'both', 'Should inherit parent project default_library') +assert(get_option('warning_level') == '0') +assert(get_option('cpp_std') == 'c++11') + +# 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/foo.cpp b/test cases/common/223 persubproject options/subprojects/sub2/foo.cpp new file mode 100644 index 0000000..27d1720 --- /dev/null +++ b/test cases/common/223 persubproject options/subprojects/sub2/foo.cpp @@ -0,0 +1,10 @@ +#include + +class Dummy { + int x; +}; + +int foo() { + auto obj = std::make_unique(); + 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..cf1435a --- /dev/null +++ b/test cases/common/223 persubproject options/subprojects/sub2/meson.build @@ -0,0 +1,16 @@ +project('sub2', 'c', 'cpp', + default_options : ['default_library=shared', + 'werror=false', + 'cpp_std=c++14']) + +assert(get_option('default_library') == 'static', 'Parent should override default_library') +assert(not get_option('werror')) +assert(get_option('cpp_std') == 'c++14') + +# If it doesn't build only a static library, it would make target name clash. +library('lib1', 'foo.c') +shared_library('lib1', 'foo.c') + +# Parent project is c++11 but this one uses c++14 to build. +libcpp14 = library('lib2', 'foo.cpp') +meson.override_dependency('libcpp14', declare_dependency(link_with: libcpp14)) diff --git a/test cases/common/223 persubproject options/test.json b/test cases/common/223 persubproject options/test.json new file mode 100644 index 0000000..ccfa9ff --- /dev/null +++ b/test cases/common/223 persubproject options/test.json @@ -0,0 +1,7 @@ +{ + "matrix": { + "options": { + "default_library": [ { "val": "both" } ] + } + } +} 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/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..27f3a3f --- /dev/null +++ b/test cases/common/226 link depends indexed custom target/meson.build @@ -0,0 +1,20 @@ +project('link_depends_indexed_custom_target', 'c') + +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..f8df311 --- /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(), check: true).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/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/230 external project/app.c b/test cases/common/230 external project/app.c new file mode 100644 index 0000000..a8266e7 --- /dev/null +++ b/test cases/common/230 external project/app.c @@ -0,0 +1,6 @@ +#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..31393fd --- /dev/null +++ b/test cases/common/230 external project/func.c @@ -0,0 +1,6 @@ +#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..a2512aa --- /dev/null +++ b/test cases/common/230 external project/libfoo/meson.build @@ -0,0 +1,23 @@ +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, + ], + depends: somelib, +) + +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 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..32d225f --- /dev/null +++ b/test cases/common/232 dependency allow_fallback/meson.build @@ -0,0 +1,12 @@ +project('subproject fallback') + +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/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/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..6dc3201 --- /dev/null +++ b/test cases/common/235 invalid standard overriden to valid/meson.build @@ -0,0 +1,8 @@ +project( + 'invalid C standard overridden 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 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..d686f6b --- /dev/null +++ b/test cases/common/237 fstrings/meson.build @@ -0,0 +1,7 @@ +project('meson-test') + +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/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..69b5d19 --- /dev/null +++ b/test cases/common/238 dependency include_type inconsistency/meson.build @@ -0,0 +1,5 @@ +project('test') + +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..4f454e6 --- /dev/null +++ b/test cases/common/238 dependency include_type inconsistency/subprojects/baz/meson.build @@ -0,0 +1,3 @@ +project('baz') + +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..1ed7011 --- /dev/null +++ b/test cases/common/238 dependency include_type inconsistency/subprojects/foo/meson.build @@ -0,0 +1,9 @@ +project('foo') + +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..b84fdf2 --- /dev/null +++ b/test cases/common/239 includedir violation/meson.build @@ -0,0 +1,11 @@ +project('foo') + +# 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..06f45d6 --- /dev/null +++ b/test cases/common/239 includedir violation/subprojects/sub/meson.build @@ -0,0 +1,3 @@ +project('subproj') + +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 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 dependency native host == build/meson.build b/test cases/common/240 dependency native host == build/meson.build new file mode 100644 index 0000000..347b1f6 --- /dev/null +++ b/test cases/common/240 dependency native host == build/meson.build @@ -0,0 +1,18 @@ +project('foo') + +if meson.is_cross_build() + error('MESON_SKIP_TEST Test does not make sense for cross builds') +endif + +dep_zlib = dependency('zlib', required : false) +if not dep_zlib.found() + error('MESON_SKIP_TEST Test requires zlib') +endif +dependency('zlib', native : true, required : false) +dependency('zlib', native : false) + +# `native: true` should not make a difference when doing a native build. +meson.override_dependency('expat', declare_dependency()) +dependency('expat') +dependency('expat', native : true) +dependency('expat', native : false) diff --git a/test cases/common/240 dependency native host == build/test.json b/test cases/common/240 dependency native host == build/test.json new file mode 100644 index 0000000..5e2a715 --- /dev/null +++ b/test cases/common/240 dependency native host == build/test.json @@ -0,0 +1,14 @@ +{ + "stdout": [ + { + "line": "Dependency zlib found: YES .* \\(cached\\)", + "match": "re", + "count": 2 + }, + { + "line": "Dependency expat found: YES .* \\(overridden\\)", + "match": "re", + "count": 3 + } + ] +} diff --git a/test cases/common/241 set and get variable/meson.build b/test cases/common/241 set and get variable/meson.build new file mode 100644 index 0000000..4ecdb35 --- /dev/null +++ b/test cases/common/241 set and get variable/meson.build @@ -0,0 +1,71 @@ +project('set and get') + +var1 = 'test1.txt' +var2 = files('test1.txt')[0] + +# Use is_disabler for accessing variables +assert(var1 == 'test1.txt') +assert(not is_disabler(var2)) + +# Ensure that set variables behave correctly +set_variable('var3', 'test2.txt') +set_variable('var4', files('test2.txt')[0]) + +assert(var3 == 'test2.txt') +assert(not is_disabler(var4)) + +# Test Equality +assert(var1 == get_variable('var1')) +assert(var2 == get_variable('var2')) + +# Test get_variable directly +assert(get_variable('var1') == 'test1.txt') +assert(not is_disabler(get_variable('var2'))) +assert(get_variable('var3') == 'test2.txt') +assert(not is_disabler(get_variable('var4'))) + +# Test get_variable indirectly + +var5 = get_variable('var1') +var6 = get_variable('var2') +var7 = get_variable('var3') +var8 = get_variable('var4') +set_variable('var9', get_variable('var7')) +set_variable('var0', get_variable('var8')) + +assert(var5 == 'test1.txt') +assert(not is_disabler(var6)) +assert(var7 == 'test2.txt') +assert(not is_disabler(var8)) +assert(get_variable('var9') == 'test2.txt') +assert(not is_disabler(get_variable('var0'))) +assert(not is_disabler(get_variable('var0', var8))) +assert(not is_disabler(get_variable('----', var8))) +assert(not is_disabler(get_variable('----', [var8]))) +assert(not is_disabler(get_variable('----', {'asd': var8}))) + +# test dict get +dict = {'a': var2} + +dict_t1 = dict['a'] +dict_t2 = dict.get('a') +dict_t3 = dict.get('a', var2) +dict_t4 = dict.get('b', var2) + +assert(not is_disabler(dict_t1)) +assert(not is_disabler(dict_t2)) +assert(not is_disabler(dict_t3)) +assert(not is_disabler(dict_t4)) + +# test lists +list = [var2] + +list_t1 = list[0] +list_t2 = list.get(0) +list_t3 = list.get(0, var2) +list_t4 = list.get(1, var2) + +assert(not is_disabler(list_t1)) +assert(not is_disabler(list_t2)) +assert(not is_disabler(list_t3)) +assert(not is_disabler(list_t4)) diff --git a/test cases/common/241 set and get variable/test1.txt b/test cases/common/241 set and get variable/test1.txt new file mode 100644 index 0000000..e69de29 diff --git a/test cases/common/241 set and get variable/test2.txt b/test cases/common/241 set and get variable/test2.txt new file mode 100644 index 0000000..e69de29 diff --git a/test cases/common/242 custom target feed/data_source.txt b/test cases/common/242 custom target feed/data_source.txt new file mode 100644 index 0000000..0c23cc0 --- /dev/null +++ b/test cases/common/242 custom target feed/data_source.txt @@ -0,0 +1 @@ +This is a text only input file. diff --git a/test cases/common/242 custom target feed/meson.build b/test cases/common/242 custom target feed/meson.build new file mode 100644 index 0000000..73351ae --- /dev/null +++ b/test cases/common/242 custom target feed/meson.build @@ -0,0 +1,24 @@ +project('custom target feed') + +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', + feed : true, + command : [python3, comp, '@OUTPUT@'], + 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/242 custom target feed/my_compiler.py b/test cases/common/242 custom target feed/my_compiler.py new file mode 100755 index 0000000..97d4208 --- /dev/null +++ b/test cases/common/242 custom target feed/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], 'output_file') + sys.exit(1) + ifile = sys.stdin.read() + if ifile != 'This is a text only input file.\n': + print('Malformed input') + sys.exit(1) + with open(sys.argv[1], 'w+') as f: + f.write('This is a binary output file.') diff --git a/test cases/common/242 custom target feed/test.json b/test cases/common/242 custom target feed/test.json new file mode 100644 index 0000000..ba66b02 --- /dev/null +++ b/test cases/common/242 custom target feed/test.json @@ -0,0 +1,5 @@ +{ + "installed": [ + {"type": "file", "file": "usr/subdir/data.dat"} + ] +} diff --git a/test cases/common/243 escape++/meson.build b/test cases/common/243 escape++/meson.build new file mode 100644 index 0000000..5fcc00f --- /dev/null +++ b/test cases/common/243 escape++/meson.build @@ -0,0 +1,4 @@ +project('regex escape test', 'c') + +exe = executable('testprog', 'test.c') +test('runtest', exe) diff --git a/test cases/common/243 escape++/test.c b/test cases/common/243 escape++/test.c new file mode 100644 index 0000000..9b6bdc2 --- /dev/null +++ b/test cases/common/243 escape++/test.c @@ -0,0 +1,3 @@ +int main(void) { + return 0; +} diff --git a/test cases/common/244 variable scope/meson.build b/test cases/common/244 variable scope/meson.build new file mode 100644 index 0000000..e5e7973 --- /dev/null +++ b/test cases/common/244 variable scope/meson.build @@ -0,0 +1,15 @@ +project('variable scope') + +x = 1 + +assert(is_variable('x')) + +assert(get_variable('x') == 1) + +set_variable('x', 10) + +assert(get_variable('x') == 10) + +unset_variable('x') + +assert(not is_variable('x')) diff --git a/test cases/common/245 custom target index source/code_source.c b/test cases/common/245 custom target index source/code_source.c new file mode 100644 index 0000000..484955b --- /dev/null +++ b/test cases/common/245 custom target index source/code_source.c @@ -0,0 +1,6 @@ +extern int genfunc(void); + +int genfunc(void) +{ + return 0; +} diff --git a/test cases/common/245 custom target index source/copyfile.py b/test cases/common/245 custom target index source/copyfile.py new file mode 100644 index 0000000..ff42ac3 --- /dev/null +++ b/test cases/common/245 custom target index source/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/245 custom target index source/copyfile2.py b/test cases/common/245 custom target index source/copyfile2.py new file mode 100644 index 0000000..efbfc28 --- /dev/null +++ b/test cases/common/245 custom target index source/copyfile2.py @@ -0,0 +1,7 @@ +#!/usr/bin/env python3 + +import sys +import shutil + +shutil.copyfile(sys.argv[1], sys.argv[2]) +shutil.copyfile(sys.argv[3], sys.argv[4]) diff --git a/test cases/common/245 custom target index source/header_source.h b/test cases/common/245 custom target index source/header_source.h new file mode 100644 index 0000000..e06c9de --- /dev/null +++ b/test cases/common/245 custom target index source/header_source.h @@ -0,0 +1 @@ +extern int genfunc(void); diff --git a/test cases/common/245 custom target index source/main.c b/test cases/common/245 custom target index source/main.c new file mode 100644 index 0000000..48af141 --- /dev/null +++ b/test cases/common/245 custom target index source/main.c @@ -0,0 +1,8 @@ +#include +#include "gen.h" + +int main(int argc) +{ + assert(argc == 3); + return genfunc(); +} diff --git a/test cases/common/245 custom target index source/meson.build b/test cases/common/245 custom target index source/meson.build new file mode 100644 index 0000000..c8087dd --- /dev/null +++ b/test cases/common/245 custom target index source/meson.build @@ -0,0 +1,51 @@ +project('custom target index source', 'c') + +# Test that using a custom target index as a sourcefile works correctly + +copy1 = find_program('copyfile.py') +copy2 = find_program('copyfile2.py') + +step_1 = custom_target('step_1', + input: ['code_source.c', files('header_source.h')], + output: ['step_1.c', 'step_1.h'], + command: [copy2, '@INPUT0@', '@OUTPUT0@', '@INPUT1@', '@OUTPUT1@'], + build_by_default: false) + +# test custom target with a single CustomTargetIndex input +step_2_c = custom_target('step_2_c', + input: step_1[0], + output: 'step_2.c', + command: [copy1, '@INPUT0@', '@OUTPUT0@'], + build_by_default: false) + +step_2_h = custom_target('step_2_h', + input: step_1[1], + output: 'step_2.h', + command: [copy1, '@INPUT0@', '@OUTPUT0@'], + build_by_default: false, +) + +# test custom target with multiple CustomTargetIndex inputs +gen = custom_target('step_3', + input: [step_2_c, step_2_h], + output: ['gen.c', 'gen.h'], + command: [copy2, '@INPUT0@', '@OUTPUT0@', '@INPUT1@', '@OUTPUT1@'], + build_by_default: false) +gen_c = gen[0] +gen_h = gen[1] + +exe_separate = executable('exe_separate', + ['main.c', gen_c, gen_h], + build_by_default: false, + install: false, +) + +exe_together = executable('exe_together', + ['main.c', gen], + build_by_default: false, + install: false, +) + +# also cover passing custom target to tests as arguments +test('exe_separate', exe_separate, args: [gen_c, gen_h]) +test('exe_together', exe_together, args: gen) diff --git a/test cases/common/246 dependency fallbacks/meson.build b/test cases/common/246 dependency fallbacks/meson.build new file mode 100644 index 0000000..b418088 --- /dev/null +++ b/test cases/common/246 dependency fallbacks/meson.build @@ -0,0 +1,10 @@ +project('dependency fallbacks') + +# pkg-config has 'libpng' but cmake has 'png' and we have a 'png' subproject +# for platforms that have neither. +d = dependency('libpng', 'png', 'foo') +assert(d.found()) + +# Check that dependency 'foo' has been implicitly overridden. +d = dependency('foo') +assert(d.found()) diff --git a/test cases/common/246 dependency fallbacks/subprojects/png/meson.build b/test cases/common/246 dependency fallbacks/subprojects/png/meson.build new file mode 100644 index 0000000..5efc60a --- /dev/null +++ b/test cases/common/246 dependency fallbacks/subprojects/png/meson.build @@ -0,0 +1,3 @@ +project('png') + +meson.override_dependency('libpng', declare_dependency()) diff --git a/test cases/common/247 deprecated option/meson.build b/test cases/common/247 deprecated option/meson.build new file mode 100644 index 0000000..4c734ee --- /dev/null +++ b/test cases/common/247 deprecated option/meson.build @@ -0,0 +1,20 @@ +project('deprecated options', + default_options: [ + 'o1=false', + 'o2=a,b', + 'o3=a,b', + 'o4=true', + 'o5=auto', + 'o6=false', + 'o8=/foo', + ] +) + +assert(get_option('o1') == false) +assert(get_option('o2') == ['a', 'b']) +assert(get_option('o3') == ['c', 'b']) +assert(get_option('o4').enabled()) +assert(get_option('o5') == false) +assert(get_option('o6') == false) +assert(get_option('o7').disabled()) +assert(get_option('python.platlibdir') == '/foo') diff --git a/test cases/common/247 deprecated option/meson_options.txt b/test cases/common/247 deprecated option/meson_options.txt new file mode 100644 index 0000000..9665501 --- /dev/null +++ b/test cases/common/247 deprecated option/meson_options.txt @@ -0,0 +1,23 @@ +# Option fully deprecated, it warns when any value is set. +option('o1', type: 'boolean', deprecated: true) + +# One of the choices is deprecated, it warns only when 'a' is in the list of values. +option('o2', type: 'array', choices: ['a', 'b'], deprecated: ['a']) + +# One of the choices is deprecated, it warns only when 'a' is in the list of values +# and replace it by 'c'. +option('o3', type: 'array', choices: ['a', 'b', 'c'], deprecated: {'a': 'c'}) + +# A boolean option has been replaced by a feature, old true/false values are remapped. +option('o4', type: 'feature', deprecated: {'true': 'enabled', 'false': 'disabled'}) + +# A feature option has been replaced by a boolean, enabled/disabled/auto values are remapped. +option('o5', type: 'boolean', deprecated: {'enabled': 'true', 'disabled': 'false', 'auto': 'false'}) + +# A boolean option has been replaced by a feature with another name, old true/false values +# are accepted by the new option for backward compatibility. +option('o6', type: 'boolean', value: 'true', deprecated: 'o7') +option('o7', type: 'feature', value: 'enabled', deprecated: {'true': 'enabled', 'false': 'disabled'}) + +# A project option is replaced by a module option +option('o8', type: 'string', value: '', deprecated: 'python.platlibdir') diff --git a/test cases/common/247 deprecated option/test.json b/test cases/common/247 deprecated option/test.json new file mode 100644 index 0000000..c2f2ca3 --- /dev/null +++ b/test cases/common/247 deprecated option/test.json @@ -0,0 +1,29 @@ +{ + "stdout": [ + { + "line": ".*DEPRECATION: Option 'o1' is deprecated", + "match": "re", + "count": 1 + }, + { + "line": ".*DEPRECATION: Option 'o2' value 'a' is deprecated", + "match": "re", + "count": 1 + }, + { + "line": ".*DEPRECATION: Option 'o3' value 'a' is replaced by 'c'", + "match": "re", + "count": 1 + }, + { + "line": ".*DEPRECATION: Option 'o4' value 'true' is replaced by 'enabled'", + "match": "re", + "count": 1 + }, + { + "line": ".*DEPRECATION: Option 'o5' value 'auto' is replaced by 'false'", + "match": "re", + "count": 1 + } + ] +} diff --git a/test cases/common/248 install_emptydir/meson.build b/test cases/common/248 install_emptydir/meson.build new file mode 100644 index 0000000..a5eb046 --- /dev/null +++ b/test cases/common/248 install_emptydir/meson.build @@ -0,0 +1,4 @@ +project('install_emptydir') + +install_emptydir(get_option('datadir')/'new_directory', install_mode: 'rwx------') +install_emptydir(get_option('datadir')/'new_directory/subdir', install_mode: 'rwxr-----') diff --git a/test cases/common/248 install_emptydir/test.json b/test cases/common/248 install_emptydir/test.json new file mode 100644 index 0000000..17abe74 --- /dev/null +++ b/test cases/common/248 install_emptydir/test.json @@ -0,0 +1,7 @@ +{ + "installed": [ + { "type": "dir", "file": "usr/share/new_directory" }, + { "type": "dir", "file": "usr/share/new_directory/subdir" } + ] +} + diff --git a/test cases/common/249 install_symlink/datafile.dat b/test cases/common/249 install_symlink/datafile.dat new file mode 100644 index 0000000..ff3104b --- /dev/null +++ b/test cases/common/249 install_symlink/datafile.dat @@ -0,0 +1 @@ +this is a data file diff --git a/test cases/common/249 install_symlink/meson.build b/test cases/common/249 install_symlink/meson.build new file mode 100644 index 0000000..ae30382 --- /dev/null +++ b/test cases/common/249 install_symlink/meson.build @@ -0,0 +1,9 @@ +project('install_emptydir') + +if build_machine.system() == 'windows' and meson.backend() == 'ninja' + error('MESON_SKIP_TEST windows does not support symlinks unless root or in development mode') +endif + +install_data('datafile.dat', install_dir: 'share/progname/C') +install_symlink('datafile.dat', pointing_to: '../C/datafile.dat', install_dir: 'share/progname/es') +install_symlink('rename_datafile.dat', pointing_to: '../C/datafile.dat', install_dir: 'share/progname/fr') diff --git a/test cases/common/249 install_symlink/test.json b/test cases/common/249 install_symlink/test.json new file mode 100644 index 0000000..33aa76e --- /dev/null +++ b/test cases/common/249 install_symlink/test.json @@ -0,0 +1,7 @@ +{ + "installed": [ + {"type": "file", "file": "usr/share/progname/C/datafile.dat"}, + {"type": "file", "file": "usr/share/progname/es/datafile.dat"}, + {"type": "file", "file": "usr/share/progname/fr/rename_datafile.dat"} + ] +} 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/250 system include dir/lib/lib.hpp b/test cases/common/250 system include dir/lib/lib.hpp new file mode 100644 index 0000000..a1fbf85 --- /dev/null +++ b/test cases/common/250 system include dir/lib/lib.hpp @@ -0,0 +1,4 @@ +#pragma once + +// This will trigger -Wsign-conversion +inline unsigned convert_to_unsigned(int i) { return i; } diff --git a/test cases/common/250 system include dir/main.cpp b/test cases/common/250 system include dir/main.cpp new file mode 100644 index 0000000..9f83297 --- /dev/null +++ b/test cases/common/250 system include dir/main.cpp @@ -0,0 +1,3 @@ +#include + +int main() { return 0; } diff --git a/test cases/common/250 system include dir/meson.build b/test cases/common/250 system include dir/meson.build new file mode 100644 index 0000000..724a8e4 --- /dev/null +++ b/test cases/common/250 system include dir/meson.build @@ -0,0 +1,13 @@ +project('system_include_dir', 'cpp', + version : '0.1', + default_options : 'werror=true', +) + +compiler_id = meson.get_compiler('cpp').get_id() +if not ['gcc', 'clang', 'clang-cl'].contains(compiler_id) + error('MESON_SKIP_TEST: compiler @0@ either doesn\'t support is_system includes or needs to have support for this test added'.format(compiler_id)) +endif + +lib_include_directories = include_directories('lib', is_system: true) +add_project_arguments('-Wsign-conversion', language: 'cpp') +executable('system_include_dir_test', sources: 'main.cpp', include_directories: lib_include_directories) diff --git a/test cases/common/251 add_project_dependencies/inc/lib.h b/test cases/common/251 add_project_dependencies/inc/lib.h new file mode 100644 index 0000000..ceca99f --- /dev/null +++ b/test cases/common/251 add_project_dependencies/inc/lib.h @@ -0,0 +1,2 @@ +#pragma once +extern int ok(void); diff --git a/test cases/common/251 add_project_dependencies/lib.c b/test cases/common/251 add_project_dependencies/lib.c new file mode 100644 index 0000000..ac46bfc --- /dev/null +++ b/test cases/common/251 add_project_dependencies/lib.c @@ -0,0 +1,14 @@ +#include +#include + +#ifndef DEFINED +#error expected compile_arg not found +#endif + +double zero; +int ok(void) { + void * something = deflate; + if(something != 0) + return 0; + return (int)cos(zero); +} diff --git a/test cases/common/251 add_project_dependencies/main.c b/test cases/common/251 add_project_dependencies/main.c new file mode 100644 index 0000000..93b7f72 --- /dev/null +++ b/test cases/common/251 add_project_dependencies/main.c @@ -0,0 +1,5 @@ +#include "lib.h" + +int main(void) { + return ok(); +} diff --git a/test cases/common/251 add_project_dependencies/meson.build b/test cases/common/251 add_project_dependencies/meson.build new file mode 100644 index 0000000..4047e6d --- /dev/null +++ b/test cases/common/251 add_project_dependencies/meson.build @@ -0,0 +1,22 @@ +project('zlib system dependency', 'c') + +cc = meson.get_compiler('c') + +m = cc.find_library('m', required: false) +add_project_dependencies(m, language: ['c']) + +z = dependency('zlib', method: 'system', required: false) +if not z.found() + error('MESON_SKIP_TEST zlib not present') +endif + +z_c_args = z.partial_dependency(compile_args: true, includes: true) +add_project_dependencies(z_c_args, language: 'c', native: false) + +global_dep = declare_dependency(include_directories: include_directories('inc'), + compile_args: '-DDEFINED') +add_project_dependencies(global_dep, language: 'c', native: false) + +lib = static_library('rary', 'lib.c') +exe = executable('prog', 'main.c', link_with: lib, dependencies: z) +test('test', exe) diff --git a/test cases/common/252 install data structured/dir1/bad b/test cases/common/252 install data structured/dir1/bad new file mode 100644 index 0000000..e69de29 diff --git a/test cases/common/252 install data structured/dir1/file1 b/test cases/common/252 install data structured/dir1/file1 new file mode 100644 index 0000000..e69de29 diff --git a/test cases/common/252 install data structured/dir1/file2 b/test cases/common/252 install data structured/dir1/file2 new file mode 100644 index 0000000..e69de29 diff --git a/test cases/common/252 install data structured/dir1/file3 b/test cases/common/252 install data structured/dir1/file3 new file mode 100644 index 0000000..e69de29 diff --git a/test cases/common/252 install data structured/dir2/bad b/test cases/common/252 install data structured/dir2/bad new file mode 100644 index 0000000..e69de29 diff --git a/test cases/common/252 install data structured/dir2/file1 b/test cases/common/252 install data structured/dir2/file1 new file mode 100644 index 0000000..e69de29 diff --git a/test cases/common/252 install data structured/dir2/file2 b/test cases/common/252 install data structured/dir2/file2 new file mode 100644 index 0000000..e69de29 diff --git a/test cases/common/252 install data structured/dir2/file3 b/test cases/common/252 install data structured/dir2/file3 new file mode 100644 index 0000000..e69de29 diff --git a/test cases/common/252 install data structured/dir3/bad b/test cases/common/252 install data structured/dir3/bad new file mode 100644 index 0000000..e69de29 diff --git a/test cases/common/252 install data structured/dir3/file1 b/test cases/common/252 install data structured/dir3/file1 new file mode 100644 index 0000000..e69de29 diff --git a/test cases/common/252 install data structured/dir3/file2 b/test cases/common/252 install data structured/dir3/file2 new file mode 100644 index 0000000..e69de29 diff --git a/test cases/common/252 install data structured/dir3/file3 b/test cases/common/252 install data structured/dir3/file3 new file mode 100644 index 0000000..e69de29 diff --git a/test cases/common/252 install data structured/meson.build b/test cases/common/252 install data structured/meson.build new file mode 100644 index 0000000..9d29794 --- /dev/null +++ b/test cases/common/252 install data structured/meson.build @@ -0,0 +1,16 @@ +project('install structured data') + +install_data( + 'dir1/file1', + 'dir1/file2', + 'dir1/file3', + 'dir2/file1', + 'dir2/file2', + 'dir2/file3', + 'dir3/file1', + 'dir3/file2', + 'dir3/file3', + install_dir: get_option('datadir'), + preserve_path: true, +) +subdir('pysrc') diff --git a/test cases/common/252 install data structured/pysrc/__init__.py b/test cases/common/252 install data structured/pysrc/__init__.py new file mode 100644 index 0000000..cb831ca --- /dev/null +++ b/test cases/common/252 install data structured/pysrc/__init__.py @@ -0,0 +1 @@ +'''init for mod''' diff --git a/test cases/common/252 install data structured/pysrc/bad.py b/test cases/common/252 install data structured/pysrc/bad.py new file mode 100644 index 0000000..d2f862e --- /dev/null +++ b/test cases/common/252 install data structured/pysrc/bad.py @@ -0,0 +1 @@ +'''mod.bad should not be installed''' diff --git a/test cases/common/252 install data structured/pysrc/bar.py b/test cases/common/252 install data structured/pysrc/bar.py new file mode 100644 index 0000000..1ac5d08 --- /dev/null +++ b/test cases/common/252 install data structured/pysrc/bar.py @@ -0,0 +1 @@ +'''mod.bar module''' diff --git a/test cases/common/252 install data structured/pysrc/foo.py b/test cases/common/252 install data structured/pysrc/foo.py new file mode 100644 index 0000000..eff906b --- /dev/null +++ b/test cases/common/252 install data structured/pysrc/foo.py @@ -0,0 +1 @@ +'''mod.foo module''' diff --git a/test cases/common/252 install data structured/pysrc/meson.build b/test cases/common/252 install data structured/pysrc/meson.build new file mode 100644 index 0000000..64c0f4d --- /dev/null +++ b/test cases/common/252 install data structured/pysrc/meson.build @@ -0,0 +1,11 @@ +py_inst = import('python').find_installation() + +py_inst.install_sources( + '__init__.py', + 'foo.py', + 'bar.py', + 'submod/__init__.py', + 'submod/baz.py', + subdir: 'mod', + preserve_path: true, +) diff --git a/test cases/common/252 install data structured/pysrc/submod/__init__.py b/test cases/common/252 install data structured/pysrc/submod/__init__.py new file mode 100644 index 0000000..65a3500 --- /dev/null +++ b/test cases/common/252 install data structured/pysrc/submod/__init__.py @@ -0,0 +1 @@ +'''init for submod''' diff --git a/test cases/common/252 install data structured/pysrc/submod/bad.py b/test cases/common/252 install data structured/pysrc/submod/bad.py new file mode 100644 index 0000000..6661a6d --- /dev/null +++ b/test cases/common/252 install data structured/pysrc/submod/bad.py @@ -0,0 +1 @@ +'''mod.submod.bad should not be installed''' diff --git a/test cases/common/252 install data structured/pysrc/submod/baz.py b/test cases/common/252 install data structured/pysrc/submod/baz.py new file mode 100644 index 0000000..d0b2904 --- /dev/null +++ b/test cases/common/252 install data structured/pysrc/submod/baz.py @@ -0,0 +1 @@ +'''mod.submod.baz module''' diff --git a/test cases/common/252 install data structured/test.json b/test cases/common/252 install data structured/test.json new file mode 100644 index 0000000..f4dc2df --- /dev/null +++ b/test cases/common/252 install data structured/test.json @@ -0,0 +1,18 @@ +{ + "installed": [ + {"type": "python_file", "file": "usr/@PYTHON_PURELIB@/mod/__init__.py"}, + {"type": "python_file", "file": "usr/@PYTHON_PURELIB@/mod/foo.py"}, + {"type": "python_file", "file": "usr/@PYTHON_PURELIB@/mod/bar.py"}, + {"type": "python_file", "file": "usr/@PYTHON_PURELIB@/mod/submod/__init__.py"}, + {"type": "python_file", "file": "usr/@PYTHON_PURELIB@/mod/submod/baz.py"}, + {"type": "file", "file": "usr/share/dir1/file1"}, + {"type": "file", "file": "usr/share/dir1/file2"}, + {"type": "file", "file": "usr/share/dir1/file3"}, + {"type": "file", "file": "usr/share/dir2/file1"}, + {"type": "file", "file": "usr/share/dir2/file2"}, + {"type": "file", "file": "usr/share/dir2/file3"}, + {"type": "file", "file": "usr/share/dir3/file1"}, + {"type": "file", "file": "usr/share/dir3/file2"}, + {"type": "file", "file": "usr/share/dir3/file3"} + ] +} diff --git a/test cases/common/253 subproject dependency variables/meson.build b/test cases/common/253 subproject dependency variables/meson.build new file mode 100644 index 0000000..403b6f1 --- /dev/null +++ b/test cases/common/253 subproject dependency variables/meson.build @@ -0,0 +1,18 @@ +project('subproject dependency variables', 'c') + +subfiles_dep = subproject('subfiles').get_variable('files_dep') + +executable( + 'foo', + join_paths(subfiles_dep.get_variable('pkgdatadir'), 'foo.c') +) + +executable( + 'foo2', + subfiles_dep.get_variable('pkgdatadir2') / 'foo.c' +) + +executable( + 'foor32', + subfiles_dep.get_variable('pkgdatadir3') / 'foo.c' +) diff --git a/test cases/common/253 subproject dependency variables/subprojects/subfiles/foo.c b/test cases/common/253 subproject dependency variables/subprojects/subfiles/foo.c new file mode 100644 index 0000000..78f2de1 --- /dev/null +++ b/test cases/common/253 subproject dependency variables/subprojects/subfiles/foo.c @@ -0,0 +1 @@ +int main(void) { return 0; } diff --git a/test cases/common/253 subproject dependency variables/subprojects/subfiles/meson.build b/test cases/common/253 subproject dependency variables/subprojects/subfiles/meson.build new file mode 100644 index 0000000..f5ad0f2 --- /dev/null +++ b/test cases/common/253 subproject dependency variables/subprojects/subfiles/meson.build @@ -0,0 +1,29 @@ +project('dependency variable resource') + +files_dep = declare_dependency( + variables: [ + 'pkgdatadir=@0@/subdir'.format(meson.current_source_dir()), + 'pkgdatadir2=@0@/subdir2'.format(meson.current_source_dir()), + 'pkgdatadir3=@0@'.format(meson.current_source_dir()), + ] +) + +install_data('subdir/foo.c', install_dir: get_option('datadir') / 'subdir') +install_subdir('subdir2', install_dir: get_option('datadir')) +install_data('foo.c', install_dir: get_option('datadir')) + +import('pkgconfig').generate( + name: 'depvar_resource', + description: 'Get a resource file from pkgconfig or a subproject', + version: '0.1', + variables: [ + 'pkgdatadir=${datadir}/subdir', + 'pkgdatadir2=${datadir}/subdir2', + ], + uninstalled_variables: [ + 'pkgdatadir=@0@/subdir'.format(meson.current_source_dir()), + 'pkgdatadir2=@0@/subdir2'.format(meson.current_source_dir()), + 'pkgdatadir3=@0@'.format(meson.current_source_dir()), + ], + dataonly: true, +) diff --git a/test cases/common/253 subproject dependency variables/subprojects/subfiles/subdir/foo.c b/test cases/common/253 subproject dependency variables/subprojects/subfiles/subdir/foo.c new file mode 100644 index 0000000..78f2de1 --- /dev/null +++ b/test cases/common/253 subproject dependency variables/subprojects/subfiles/subdir/foo.c @@ -0,0 +1 @@ +int main(void) { return 0; } diff --git a/test cases/common/253 subproject dependency variables/subprojects/subfiles/subdir2/foo.c b/test cases/common/253 subproject dependency variables/subprojects/subfiles/subdir2/foo.c new file mode 100644 index 0000000..78f2de1 --- /dev/null +++ b/test cases/common/253 subproject dependency variables/subprojects/subfiles/subdir2/foo.c @@ -0,0 +1 @@ +int main(void) { return 0; } diff --git a/test cases/common/253 subproject dependency variables/test.json b/test cases/common/253 subproject dependency variables/test.json new file mode 100644 index 0000000..c345bbe --- /dev/null +++ b/test cases/common/253 subproject dependency variables/test.json @@ -0,0 +1,8 @@ +{ + "installed": [ + { "type": "file", "file": "usr/share/pkgconfig/depvar_resource.pc" }, + { "type": "file", "file": "usr/share/foo.c" }, + { "type": "file", "file": "usr/share/subdir/foo.c" }, + { "type": "file", "file": "usr/share/subdir2/foo.c" } + ] +} diff --git a/test cases/common/254 long output/dumper.c b/test cases/common/254 long output/dumper.c new file mode 100644 index 0000000..d479e08 --- /dev/null +++ b/test cases/common/254 long output/dumper.c @@ -0,0 +1,17 @@ +#include + +int main(void) +{ + for (int i = 0 ; i < 100000 ; i++) + fprintf(stderr, "# Iteration %d to stderr\n", i + 1); + + printf("ok 1 - dumper to stderr\n"); + + for (int i = 0 ; i < 100000 ; i++) + fprintf(stdout, "# Iteration %d to stdout\n", i + 1); + + printf("ok 2 - dumper to stdout\n1..2\n"); + + return 0; +} + diff --git a/test cases/common/254 long output/meson.build b/test cases/common/254 long output/meson.build new file mode 100644 index 0000000..6d8d62b --- /dev/null +++ b/test cases/common/254 long output/meson.build @@ -0,0 +1,5 @@ +project('long-stderr', 'c') + +dumper = executable('dumper', 'dumper.c') +test('dump-test', dumper) +test('dump-test-TAP', dumper, protocol : 'tap') diff --git a/test cases/common/255 module warnings/meson.build b/test cases/common/255 module warnings/meson.build new file mode 100644 index 0000000..56e2055 --- /dev/null +++ b/test cases/common/255 module warnings/meson.build @@ -0,0 +1,9 @@ +project('module warnings', meson_version : '>= 0.56') + +import('python3') # deprecated module +import('java') # new module +import('unstable-keyval') # module that has been stabilized, import with unstable- +import('unstable_simd') # A module with the deprecated `unstable_foo` instead of `unstable-foo` + +ice = import('icestorm', required : false) +assert(not ice.found(), 'unstable-icestorm module should not be importable as `simd`') diff --git a/test cases/common/255 module warnings/test.json b/test cases/common/255 module warnings/test.json new file mode 100644 index 0000000..5556b90 --- /dev/null +++ b/test cases/common/255 module warnings/test.json @@ -0,0 +1,16 @@ +{ + "stdout": [ + { + "line": "test cases/common/255 module warnings/meson.build:3: WARNING: Project targets '>= 0.56' but uses feature deprecated since '0.48.0': module python3." + }, + { + "line": "test cases/common/255 module warnings/meson.build:4: WARNING: Project targets '>= 0.56' but uses feature introduced in '0.60.0': module java." + }, + { + "line": "test cases/common/255 module warnings/meson.build:5: WARNING: Project targets '>= 0.56' but uses feature deprecated since '0.56.0': module keyval has been stabilized. drop \"unstable-\" prefix from the module name" + }, + { + "line": "test cases/common/255 module warnings/meson.build:6: DEPRECATION: Importing unstable modules as \"unstable_simd\" instead of \"unstable-simd\"" + } + ] +} diff --git a/test cases/common/256 subproject extracted objects/foo.c b/test cases/common/256 subproject extracted objects/foo.c new file mode 100644 index 0000000..f6c7aeb --- /dev/null +++ b/test cases/common/256 subproject extracted objects/foo.c @@ -0,0 +1,11 @@ +#if defined _WIN32 || defined __CYGWIN__ + #define DLL_IMPORT __declspec(dllimport) +#else + #define DLL_IMPORT +#endif + +int DLL_IMPORT cppfunc(void); + +int otherfunc(void) { + return cppfunc() != 42; +} diff --git a/test cases/common/256 subproject extracted objects/meson.build b/test cases/common/256 subproject extracted objects/meson.build new file mode 100644 index 0000000..bad450f --- /dev/null +++ b/test cases/common/256 subproject extracted objects/meson.build @@ -0,0 +1,5 @@ +project('link to extracted objects', 'c') + +sublib = subproject('myobjects').get_variable('sublib') + +mainlib = static_library('foo', 'foo.c', install: true, link_with: sublib) diff --git a/test cases/common/256 subproject extracted objects/subprojects/myobjects/cpplib.cpp b/test cases/common/256 subproject extracted objects/subprojects/myobjects/cpplib.cpp new file mode 100644 index 0000000..12ef756 --- /dev/null +++ b/test cases/common/256 subproject extracted objects/subprojects/myobjects/cpplib.cpp @@ -0,0 +1,6 @@ +#define BUILDING_DLL +#include "cpplib.h" + +extern "C" int DLL_PUBLIC cppfunc(void) { + return 42; +} diff --git a/test cases/common/256 subproject extracted objects/subprojects/myobjects/cpplib.h b/test cases/common/256 subproject extracted objects/subprojects/myobjects/cpplib.h new file mode 100644 index 0000000..a1c38b3 --- /dev/null +++ b/test cases/common/256 subproject extracted objects/subprojects/myobjects/cpplib.h @@ -0,0 +1,12 @@ +/* See http://gcc.gnu.org/wiki/Visibility#How_to_use_the_new_C.2B-.2B-_visibility_support */ +#if defined(_WIN32) || defined(__CYGWIN__) + #ifdef BUILDING_DLL + #define DLL_PUBLIC __declspec(dllexport) + #else + #define DLL_PUBLIC __declspec(dllimport) + #endif +#else + #define DLL_PUBLIC __attribute__ ((visibility ("default"))) +#endif + +extern "C" int DLL_PUBLIC cppfunc(void); diff --git a/test cases/common/256 subproject extracted objects/subprojects/myobjects/meson.build b/test cases/common/256 subproject extracted objects/subprojects/myobjects/meson.build new file mode 100644 index 0000000..1c2729b --- /dev/null +++ b/test cases/common/256 subproject extracted objects/subprojects/myobjects/meson.build @@ -0,0 +1,3 @@ +project('myobjects', 'cpp') + +sublib = static_library('sublib', 'cpplib.cpp') diff --git a/test cases/common/256 subproject extracted objects/test.json b/test cases/common/256 subproject extracted objects/test.json new file mode 100644 index 0000000..baa5dfb --- /dev/null +++ b/test cases/common/256 subproject extracted objects/test.json @@ -0,0 +1,5 @@ +{ + "installed": [ + { "type": "file", "file": "usr/lib/libfoo.a" } + ] +} diff --git a/test cases/common/257 generated header dep/foo.c b/test cases/common/257 generated header dep/foo.c new file mode 100644 index 0000000..f4de601 --- /dev/null +++ b/test cases/common/257 generated header dep/foo.c @@ -0,0 +1 @@ +#include "foo.h" diff --git a/test cases/common/257 generated header dep/meson.build b/test cases/common/257 generated header dep/meson.build new file mode 100644 index 0000000..195d082 --- /dev/null +++ b/test cases/common/257 generated header dep/meson.build @@ -0,0 +1,22 @@ +project('generated header dep', 'c') + +# Regression test case for a very specific case: +# - Uses both_libraries(), or library() with default_library=both. +# - A header file is generated by a custom_target() and passed as source. +# - A C file that uses that header is passed as a declare_dependency() source. +# Under those specific conditions, the static library used to miss an order +# dependency on the header file. This happened in GLib: +# https://gitlab.gnome.org/GNOME/glib/-/merge_requests/2917. + +python = import('python').find_installation() +header = custom_target( + output: 'foo.h', + capture: true, + command: [python, '-c', 'print("#define FOO")'], +) + +sources_dep = declare_dependency(sources: files('foo.c')) + +both_libraries('foo', header, + dependencies: sources_dep, +) diff --git a/test cases/common/258 subsubproject inplace/meson.build b/test cases/common/258 subsubproject inplace/meson.build new file mode 100644 index 0000000..26a421b --- /dev/null +++ b/test cases/common/258 subsubproject inplace/meson.build @@ -0,0 +1,3 @@ +project('main') + +subproject('sub') diff --git a/test cases/common/258 subsubproject inplace/subprojects/sub/meson.build b/test cases/common/258 subsubproject inplace/subprojects/sub/meson.build new file mode 100644 index 0000000..5e33d21 --- /dev/null +++ b/test cases/common/258 subsubproject inplace/subprojects/sub/meson.build @@ -0,0 +1,3 @@ +project('sub') + +subproject('subsub') diff --git a/test cases/common/258 subsubproject inplace/subprojects/sub/subprojects/subsub-1.0/meson.build b/test cases/common/258 subsubproject inplace/subprojects/sub/subprojects/subsub-1.0/meson.build new file mode 100644 index 0000000..7807a1b --- /dev/null +++ b/test cases/common/258 subsubproject inplace/subprojects/sub/subprojects/subsub-1.0/meson.build @@ -0,0 +1 @@ +project('subsub') diff --git a/test cases/common/258 subsubproject inplace/subprojects/sub/subprojects/subsub.wrap b/test cases/common/258 subsubproject inplace/subprojects/sub/subprojects/subsub.wrap new file mode 100644 index 0000000..bf39852 --- /dev/null +++ b/test cases/common/258 subsubproject inplace/subprojects/sub/subprojects/subsub.wrap @@ -0,0 +1,2 @@ +[wrap-file] +directory = subsub-1.0 diff --git a/test cases/common/258 subsubproject inplace/subprojects/subsub.wrap b/test cases/common/258 subsubproject inplace/subprojects/subsub.wrap new file mode 100644 index 0000000..30faa64 --- /dev/null +++ b/test cases/common/258 subsubproject inplace/subprojects/subsub.wrap @@ -0,0 +1,2 @@ +[wrap-redirect] +filename = sub/subprojects/subsub.wrap diff --git a/test cases/common/259 preprocess/bar.c b/test cases/common/259 preprocess/bar.c new file mode 100644 index 0000000..43737b9 --- /dev/null +++ b/test cases/common/259 preprocess/bar.c @@ -0,0 +1,3 @@ +int bar(void) { + return BAR; +} diff --git a/test cases/common/259 preprocess/foo.c b/test cases/common/259 preprocess/foo.c new file mode 100644 index 0000000..c9d16c5 --- /dev/null +++ b/test cases/common/259 preprocess/foo.c @@ -0,0 +1 @@ +#include diff --git a/test cases/common/259 preprocess/foo.h b/test cases/common/259 preprocess/foo.h new file mode 100644 index 0000000..ba60bf3 --- /dev/null +++ b/test cases/common/259 preprocess/foo.h @@ -0,0 +1,2 @@ +int bar(void); +int main(void) { return FOO + bar(); } diff --git a/test cases/common/259 preprocess/meson.build b/test cases/common/259 preprocess/meson.build new file mode 100644 index 0000000..4824598 --- /dev/null +++ b/test cases/common/259 preprocess/meson.build @@ -0,0 +1,15 @@ +project('preprocess', 'c') + +cc = meson.get_compiler('c') + +add_project_arguments(['-DFOO=0', '-DBAR=0'], language: 'c') + +pp_files = cc.preprocess('foo.c', 'bar.c', output: '@PLAINNAME@') + +foreach f : pp_files + message(f.full_path()) +endforeach + +subdir('src') + +test('test-foo', executable('app', pp_files, link_depends: file_map)) diff --git a/test cases/common/259 preprocess/src/file.map.in b/test cases/common/259 preprocess/src/file.map.in new file mode 100644 index 0000000..152fb65 --- /dev/null +++ b/test cases/common/259 preprocess/src/file.map.in @@ -0,0 +1,3 @@ +#if 1 +Hello World +#endif diff --git a/test cases/common/259 preprocess/src/meson.build b/test cases/common/259 preprocess/src/meson.build new file mode 100644 index 0000000..4cd9554 --- /dev/null +++ b/test cases/common/259 preprocess/src/meson.build @@ -0,0 +1,3 @@ +file_map = cc.preprocess('file.map.in', + output: '@BASENAME@', +) 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..5d38d0b --- /dev/null +++ b/test cases/common/26 find program/meson.build @@ -0,0 +1,39 @@ +project('find program') + +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') + add_languages('c', required: true) + 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.py') +assert(prog.version() == '1.0', 'Program version should be detectable') + +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 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 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/3 static/libfile.c b/test cases/common/3 static/libfile.c new file mode 100644 index 0000000..846485e --- /dev/null +++ b/test cases/common/3 static/libfile.c @@ -0,0 +1,3 @@ +int libfunc(void) { + return 3; +} diff --git a/test cases/common/3 static/libfile2.c b/test cases/common/3 static/libfile2.c new file mode 100644 index 0000000..4df60c5 --- /dev/null +++ b/test cases/common/3 static/libfile2.c @@ -0,0 +1,3 @@ +int libfunc2(void) { + return 4; +} diff --git a/test cases/common/3 static/meson.build b/test cases/common/3 static/meson.build new file mode 100644 index 0000000..04ff2f6 --- /dev/null +++ b/test cases/common/3 static/meson.build @@ -0,0 +1,14 @@ +project('static library test', 'c') + +lib = static_library('mylib', get_option('source'), + link_args : '-THISMUSTNOBEUSED') # Static linker needs to ignore all link args. +assert(lib.name() == 'mylib') +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.') diff --git a/test cases/common/3 static/meson_options.txt b/test cases/common/3 static/meson_options.txt new file mode 100644 index 0000000..7261a19 --- /dev/null +++ b/test cases/common/3 static/meson_options.txt @@ -0,0 +1 @@ +option('source', type : 'combo', choices : ['libfile.c', 'libfile2.c'], value : 'libfile.c') 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/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 run program/check-env.py b/test cases/common/33 run program/check-env.py new file mode 100644 index 0000000..ef04433 --- /dev/null +++ b/test cases/common/33 run program/check-env.py @@ -0,0 +1,5 @@ +#!/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..aa0a1d6 --- /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', check: false) +else + c = run_command('echo', 'hello', check: false) +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', check: false) +else + cs = run_command('scripts/hello.sh', check: false) +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, check: false) +else + c = run_command('echo', f, check: false) +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")', check: false) +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")', check: false, 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, check: false) +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', check: false, 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..656fd18 --- /dev/null +++ b/test cases/common/34 logic ops/meson.build @@ -0,0 +1,95 @@ +project('logicopts') + +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..116fe0b --- /dev/null +++ b/test cases/common/35 string operations/meson.build @@ -0,0 +1,127 @@ +project('string formatting') + +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[0] == 'a') +assert(long[2] == 'c') + +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('@0@'.format(['one', 'two']) == '[\'one\', \'two\']', 'list 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') +assert(' '.join(['a'], ['b', ['c']], 'd') == 'a b c d', 'varargs 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/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/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/4 shared/libfile.c b/test cases/common/4 shared/libfile.c new file mode 100644 index 0000000..0797eec --- /dev/null +++ b/test cases/common/4 shared/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 libfunc(void) { + return 3; +} diff --git a/test cases/common/4 shared/meson.build b/test cases/common/4 shared/meson.build new file mode 100644 index 0000000..1c88bc5 --- /dev/null +++ b/test cases/common/4 shared/meson.build @@ -0,0 +1,13 @@ +project('shared library test', 'c') +lib = shared_library('mylib', 'libfile.c') +build_target('mylib2', 'libfile.c', target_type: 'shared_library') + +has_not_changed = false +if is_disabler(lib) + has_not_changed = true +else + has_not_changed = true +endif +assert(has_not_changed, 'Shared library has changed.') + +assert(not is_disabler(lib), 'Shared library is a disabler.') 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 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..b21f1ad --- /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, 'TEST_LIST_FLATTENING=1']) + +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..b5884cc --- /dev/null +++ b/test cases/common/41 test args/tester.py @@ -0,0 +1,11 @@ +#!/usr/bin/env python3 + +import sys +import os + +assert os.environ['MESONTESTING'] == 'picklerror' +assert os.environ['TEST_LIST_FLATTENING'] == '1' + +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..7f322bc --- /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..3a620fe --- /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/43 subproject options/meson.build b/test cases/common/43 subproject options/meson.build new file mode 100644 index 0000000..a905272 --- /dev/null +++ b/test cases/common/43 subproject options/meson.build @@ -0,0 +1,7 @@ +project('suboptions') + +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..d00a024 --- /dev/null +++ b/test cases/common/43 subproject options/subprojects/subproject/meson.build @@ -0,0 +1,5 @@ +project('subproject') + +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/44 pkgconfig-gen/answer.c b/test cases/common/44 pkgconfig-gen/answer.c new file mode 100644 index 0000000..df5f54f --- /dev/null +++ b/test cases/common/44 pkgconfig-gen/answer.c @@ -0,0 +1,3 @@ +int answer_to_life_the_universe_and_everything(void) { + return 42; +} 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/dummy.c b/test cases/common/44 pkgconfig-gen/dependencies/dummy.c new file mode 100644 index 0000000..ef7be51 --- /dev/null +++ b/test cases/common/44 pkgconfig-gen/dependencies/dummy.c @@ -0,0 +1,3 @@ +int dummy(void) { + return 0; +} 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..6e27ae8 --- /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', 'dummy.c', 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', 'dummy.c', link_with : internal_lib) +pkgg.generate(main_lib2, + libraries : internal_lib, + filebase : 'pub-lib-order', +) diff --git a/test cases/common/44 pkgconfig-gen/foo.c b/test cases/common/44 pkgconfig-gen/foo.c new file mode 100644 index 0000000..83bb06a --- /dev/null +++ b/test cases/common/44 pkgconfig-gen/foo.c @@ -0,0 +1,7 @@ +#include"simple.h" + +int answer_to_life_the_universe_and_everything (void); + +int simple_function(void) { + return answer_to_life_the_universe_and_everything(); +} 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..12a110e --- /dev/null +++ b/test cases/common/44 pkgconfig-gen/meson.build @@ -0,0 +1,178 @@ +project('pkgconfig-gen', 'c', meson_version: '>=0.60.0') + +# 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', check: true).stdout().strip() +if v.version_compare('<0.29') + error('MESON_SKIP_TEST: pkg-config version \'' + v + '\' too old') +endif + +python = import('python').find_installation() +fs = import('fs') +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'], +) + +env = environment() +env.prepend('PKG_CONFIG_PATH', meson.current_build_dir() / 'meson-private') + +test( + 'pkgconfig-validation', + pkgconfig, + args: ['--validate', 'simple'], + env : env, +) + +answerlib = shared_library('answer', 'answer.c') + +pkgg.generate(answerlib, + name : 'libanswer', + description : 'An answer library.', + extra_cflags : ['-DLIBFOO'], +) + +# Test that name_prefix='' and name='libfoo' results in '-lfoo' +lib2 = shared_library('libfoo', 'foo.c', + link_with: answerlib, + name_prefix : '', + version : libver) + +pkgg.generate(lib2, + libraries : [lib2, answerlib], + 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'), + 'escaped_var': 'hello world', + }, + unescaped_variables: { + 'unescaped_var': 'hello world', + } +) + +# 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 + +# Regression test: A library linking to an uninstalled custom_target static +# library used to crash when generating its pkgconfig file. +# Copy libstat2.a to libstat3.a to have a static library as custom target. +infile = stat2.full_path() +outfile = meson.current_build_dir() / 'libstat3.a' +script = 'import shutil ; shutil.copyfile("@0@", "@1@")'.format(infile, outfile) +ct = custom_target('stat3', + input: stat2, + output: fs.name(outfile), + command: [python, '-c', script], +) +simple6 = library('simple6', 'dependencies/dummy.c', link_with: ct) +pkgg.generate(simple6) + +# implicit variables +pkgg.generate( + name : 'libvartest', + description : 'Check that implicit vars are created', + version : libver, + variables: ['datadir=${prefix}/data', 'foo=${datadir}/foo', 'bar=${bindir}/bar'] +) +pkgg.generate( + name : 'libvartest2', + description : 'Check that libdir is not an implicit var', + version : libver, + variables: ['bar=${libdir}/bar'] +) + +# Regression test: variables kwarg should listify single string value +pkgg.generate( + name : 'libvartest3', + description : 'Check that variables can be single string', + variables: 'foo=bar', +) 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..4d9f4c8 --- /dev/null +++ b/test cases/common/44 pkgconfig-gen/test.json @@ -0,0 +1,33 @@ +{ + "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/libanswer.pc"}, + {"type": "file", "file": "usr/lib/pkgconfig/libfoo.pc"}, + {"type": "file", "file": "usr/lib/pkgconfig/libhello.pc"}, + {"type": "file", "file": "usr/lib/pkgconfig/libvartest.pc"}, + {"type": "file", "file": "usr/lib/pkgconfig/libvartest2.pc"}, + {"type": "file", "file": "usr/lib/pkgconfig/libvartest3.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/simple6.pc"}, + {"type": "file", "file": "usr/lib/pkgconfig/ct.pc"}, + {"type": "file", "file": "usr/lib/pkgconfig/ct0.pc"}, + {"type": "file", "file": "usr/share/pkgconfig/libhello_nolib.pc"} + ], + "stdout": [ + { + "line": "test cases/common/44 pkgconfig-gen/meson.build:164: WARNING: Project targets '>=0.60.0' but uses feature introduced in '0.62.0': pkgconfig.generate implicit variable for builtin directories." + }, + { + "line": "test cases/common/44 pkgconfig-gen/meson.build:170: WARNING: Project targets '>=0.60.0' but uses feature introduced in '0.62.0': pkgconfig.generate implicit variable for builtin directories.", + "count": 0 + }, + { + "comment": "This will either match in the future-deprecated notice summary, or match the warning summary", + "line": " * 0.62.0: {'pkgconfig.generate variable for builtin directories'}" + } + ] +} 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/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..102041e --- /dev/null +++ b/test cases/common/46 subproject subproject/subprojects/a/a.c @@ -0,0 +1,14 @@ +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/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..a042b23 --- /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', check: false) + grabber = find_program('grabber2.bat') +else + c = run_command('grabber.sh', check: false) + 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..9990e30 --- /dev/null +++ b/test cases/common/48 file grabber/subdir/meson.build @@ -0,0 +1,5 @@ +sc = run_command(grabber, check: true) +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/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..a51e526 --- /dev/null +++ b/test cases/common/49 custom target/meson.build @@ -0,0 +1,73 @@ +project('custom target') + +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_ci = custom_target('bindat_ci', +output : 'data_ci.dat', +input : 'data_source.txt', +command : [python, comp, '--input=@INPUT@', '--output=@OUTPUT@', mytarget.to_list()], +) + +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..a32cbdb --- /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/5 linkstatic/libfile.c b/test cases/common/5 linkstatic/libfile.c new file mode 100644 index 0000000..9180030 --- /dev/null +++ b/test cases/common/5 linkstatic/libfile.c @@ -0,0 +1,3 @@ +int func(void) { + return 0; +} diff --git a/test cases/common/5 linkstatic/libfile2.c b/test cases/common/5 linkstatic/libfile2.c new file mode 100644 index 0000000..5badf23 --- /dev/null +++ b/test cases/common/5 linkstatic/libfile2.c @@ -0,0 +1,3 @@ +int func2(void) { + return 2; +} diff --git a/test cases/common/5 linkstatic/libfile3.c b/test cases/common/5 linkstatic/libfile3.c new file mode 100644 index 0000000..4bfe52a --- /dev/null +++ b/test cases/common/5 linkstatic/libfile3.c @@ -0,0 +1,3 @@ +int func3(void) { + return 3; +} diff --git a/test cases/common/5 linkstatic/libfile4.c b/test cases/common/5 linkstatic/libfile4.c new file mode 100644 index 0000000..ce1fe68 --- /dev/null +++ b/test cases/common/5 linkstatic/libfile4.c @@ -0,0 +1,3 @@ +int func4(void) { + return 4; +} diff --git a/test cases/common/5 linkstatic/main.c b/test cases/common/5 linkstatic/main.c new file mode 100644 index 0000000..128f2bb --- /dev/null +++ b/test cases/common/5 linkstatic/main.c @@ -0,0 +1,5 @@ +int func(void); + +int main(void) { + return func(); +} diff --git a/test cases/common/5 linkstatic/meson.build b/test cases/common/5 linkstatic/meson.build new file mode 100644 index 0000000..1f02a5c --- /dev/null +++ b/test cases/common/5 linkstatic/meson.build @@ -0,0 +1,6 @@ +project('static library linking test', 'c') + +lib = build_target('mylib', 'libfile.c', 'libfile2.c', 'libfile3.c', 'libfile4.c', target_type : 'static_library') +exe = executable('prog', 'main.c', link_with : lib) + +test('runtest', exe) 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/51 run target/.clang-format b/test cases/common/51 run target/.clang-format new file mode 100644 index 0000000..9b3aa8b --- /dev/null +++ b/test cases/common/51 run target/.clang-format @@ -0,0 +1 @@ +BasedOnStyle: LLVM diff --git a/test cases/common/51 run target/.clang-tidy b/test cases/common/51 run target/.clang-tidy new file mode 100644 index 0000000..e69de29 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..1c66ffa --- /dev/null +++ b/test cases/common/51 run target/check-env.py @@ -0,0 +1,28 @@ +#!/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() + +print(sys.argv) +argv_paths = [Path(i).resolve() for i in sys.argv[1:]] +source_root, build_root, current_source_dir = argv_paths + +print(f'{source_root} == {env_source_root}') +assert source_root == env_source_root +print(f'{build_root} == {env_build_root}') +assert build_root == env_build_root +print(f'{current_source_dir} == {env_current_source_dir}') +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..dbb6732 --- /dev/null +++ b/test cases/common/51 run target/meson.build @@ -0,0 +1,112 @@ +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) + +clangf = run_target('clang-format', + command : [converter, files('.clang-format'), meson.current_build_dir() / 'clang-format']) +custom_target('clang-tidy', + input: '.clang-tidy', + output: 'clang-tidy', + command : [converter, '@INPUT@', '@OUTPUT@']) +alias_target('clang-format-check', clangf) + +# 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/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/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/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/a.txt b/test cases/common/56 array methods/a.txt new file mode 100644 index 0000000..e69de29 diff --git a/test cases/common/56 array methods/b.txt b/test cases/common/56 array methods/b.txt new file mode 100644 index 0000000..e69de29 diff --git a/test cases/common/56 array methods/c.txt b/test cases/common/56 array methods/c.txt new file mode 100644 index 0000000..e69de29 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..d323db8 --- /dev/null +++ b/test cases/common/56 array methods/meson.build @@ -0,0 +1,70 @@ +project('array methods') + +empty = [] +one = ['abc'] +two = ['def', 'ghi'] +combined = [empty, one, two] + +file_list = files('a.txt', 'b.txt') +file_a = files('a.txt') +file_c = files('c.txt') + +if file_a[0] != file_list[0] + error('Files are not equal') +endif + +if not file_list.contains(file_a[0]) + error('Contains with ObjectHolder lists does not work') +endif + +if file_list.contains(file_c[0]) + error('Contains with ObjectHolder lists found non existent object') +endif + +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(one) + error('Combined claims not to contain [abc].') +endif + +if not combined.contains(two) + error('Combined claims not to contain [def, ghi].') +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 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..13d41be --- /dev/null +++ b/test cases/common/59 install subdir/meson.build @@ -0,0 +1,21 @@ +project('install a whole subdir', + 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/6 linkshared/cpplib.cpp b/test cases/common/6 linkshared/cpplib.cpp new file mode 100644 index 0000000..247f820 --- /dev/null +++ b/test cases/common/6 linkshared/cpplib.cpp @@ -0,0 +1,6 @@ +#define BUILDING_DLL +#include "cpplib.h" + +int DLL_PUBLIC cppfunc(void) { + return 42; +} diff --git a/test cases/common/6 linkshared/cpplib.h b/test cases/common/6 linkshared/cpplib.h new file mode 100644 index 0000000..e2b0206 --- /dev/null +++ b/test cases/common/6 linkshared/cpplib.h @@ -0,0 +1,12 @@ +/* See http://gcc.gnu.org/wiki/Visibility#How_to_use_the_new_C.2B-.2B-_visibility_support */ +#if defined(_WIN32) || defined(__CYGWIN__) + #ifdef BUILDING_DLL + #define DLL_PUBLIC __declspec(dllexport) + #else + #define DLL_PUBLIC __declspec(dllimport) + #endif +#else + #define DLL_PUBLIC __attribute__ ((visibility ("default"))) +#endif + +int DLL_PUBLIC cppfunc(void); diff --git a/test cases/common/6 linkshared/cppmain.cpp b/test cases/common/6 linkshared/cppmain.cpp new file mode 100644 index 0000000..29e9a44 --- /dev/null +++ b/test cases/common/6 linkshared/cppmain.cpp @@ -0,0 +1,5 @@ +#include "cpplib.h" + +int main(void) { + return cppfunc() != 42; +} diff --git a/test cases/common/6 linkshared/libfile.c b/test cases/common/6 linkshared/libfile.c new file mode 100644 index 0000000..91489b2 --- /dev/null +++ b/test cases/common/6 linkshared/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/6 linkshared/main.c b/test cases/common/6 linkshared/main.c new file mode 100644 index 0000000..7777327 --- /dev/null +++ b/test cases/common/6 linkshared/main.c @@ -0,0 +1,11 @@ +#if defined _WIN32 || defined __CYGWIN__ + #define DLL_IMPORT __declspec(dllimport) +#else + #define DLL_IMPORT +#endif + +int DLL_IMPORT func(void); + +int main(void) { + return func(); +} diff --git a/test cases/common/6 linkshared/meson.build b/test cases/common/6 linkshared/meson.build new file mode 100644 index 0000000..846b4a0 --- /dev/null +++ b/test cases/common/6 linkshared/meson.build @@ -0,0 +1,12 @@ +project('shared library linking test', 'c', 'cpp') + +lib = shared_library('mylib', + 'libfile.c' # Split to different lines before and after the comma to test parser. + , install : false) # Don't install libraries in common tests; the path is platform-specific +exe = executable('prog', 'main.c', link_with : lib, install : true) + +test('runtest', exe) + +cpplib = shared_library('mycpplib', 'cpplib.cpp') +cppexe = executable('cppprog', 'cppmain.cpp', link_with : cpplib) +test('cpptest', cppexe) diff --git a/test cases/common/6 linkshared/test.json b/test cases/common/6 linkshared/test.json new file mode 100644 index 0000000..067bca7 --- /dev/null +++ b/test cases/common/6 linkshared/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/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/61 number arithmetic/meson.build b/test cases/common/61 number arithmetic/meson.build new file mode 100644 index 0000000..f8ab81b --- /dev/null +++ b/test cases/common/61 number arithmetic/meson.build @@ -0,0 +1,76 @@ +project('number arithmetic') + +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..acfac0b --- /dev/null +++ b/test cases/common/62 string arithmetic/meson.build @@ -0,0 +1,49 @@ +project('string arithmetic', meson_version: '>=0.62.0') + +assert('foo' + 'bar' == 'foobar') +assert('foo' + 'bar' + 'baz' == 'foobarbaz') + +a = 'a' +b = 'b' +assert(a + b + 'c' == 'abc') + +# ------------------------------------------------------------------------------ +# format strings: +# ------------------------------------------------------------------------------ +sub1 = 'the' +sub2 = ' quick\n' +sub3 = ' brown' +sub4 = '\nfox' +x = f'@sub1@@sub2@@sub3@@sub4@' + +assert(x == sub1 + sub2 + sub3 + sub4) +assert(x == 'the quick\n brown\nfox') + +# ------------------------------------------------------------------------------ +# multi-line format strings +# ------------------------------------------------------------------------------ +y_actual = f'''This is a multi-line comment with string substitution: + "@sub1@@sub2@@sub3@@sub4@" + +And I can even substitute the entry multiple times! + +@sub1@ +@sub2@ +@sub3@ +''' + +y_expect = '''This is a multi-line comment with string substitution: + "the quick + brown +fox" + +And I can even substitute the entry multiple times! + +the + quick + + brown +''' +message('actual=' + y_actual) +message('expect=' + y_expect) +assert(y_actual == y_expect) diff --git a/test cases/common/62 string arithmetic/test.json b/test cases/common/62 string arithmetic/test.json new file mode 100644 index 0000000..5a11650 --- /dev/null +++ b/test cases/common/62 string arithmetic/test.json @@ -0,0 +1,7 @@ +{ + "stdout": [ + { + "line": "test cases/common/62 string arithmetic/meson.build:25: WARNING: Project targets '>=0.62.0' but uses feature introduced in '0.63.0': multiline format strings." + } + ] +} 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..7d5f54f --- /dev/null +++ b/test cases/common/63 array arithmetic/meson.build @@ -0,0 +1,15 @@ +project('array arithmetic') + +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/64 arithmetic bidmas/meson.build b/test cases/common/64 arithmetic bidmas/meson.build new file mode 100644 index 0000000..548294b --- /dev/null +++ b/test cases/common/64 arithmetic bidmas/meson.build @@ -0,0 +1,15 @@ +project('arithmetic bidmas') + +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 vcstag/meson.build b/test cases/common/66 vcstag/meson.build new file mode 100644 index 0000000..38fa590 --- /dev/null +++ b/test cases/common/66 vcstag/meson.build @@ -0,0 +1,42 @@ +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_notfound_fallback = vcs_tag(input : 'vcstag.c.in', +output : 'vcstag-notfound-fallback.c', +command : ['git-but-not-found-sorry', 'show-ref', '-s', 'refs/heads/master'], +fallback : '1.0.0') + +version_src_fallback = vcs_tag(input : 'vcstag.c.in', +output : 'vcstag-fallback.c') + +git = find_program('git') + +version_src_git_program = vcs_tag(input : 'vcstag.c.in', +output : 'vcstag-git-program.c', +command : [git, 'rev-parse', 'HEAD'], +fallback : '1.0.0') + +version_src_file = vcs_tag(input : 'vcstag.c.in', +output : 'vcstag-file.c', +command : files('version.py')) + +tagprog = executable('tagprog', 'tagprog.c', version_src) + +version_src_executable = vcs_tag(input : 'vcstag.c.in', +output : 'vcstag-executable.c', +command : [tagprog]) + +executable('tagprog-custom', 'tagprog.c', version_src_custom) +executable('tagprog-fallback', 'tagprog.c', version_src_fallback) +executable('tagprog-notfound-fallback', 'tagprog.c', version_src_notfound_fallback) +executable('tagprog-git-program', 'tagprog.c', version_src_git_program) +executable('tagprog-executable', 'tagprog.c', version_src_executable) +executable('tagprog-file', 'tagprog.c', version_src_file) diff --git a/test cases/common/66 vcstag/tagprog.c b/test cases/common/66 vcstag/tagprog.c new file mode 100644 index 0000000..5546802 --- /dev/null +++ b/test cases/common/66 vcstag/tagprog.c @@ -0,0 +1,8 @@ +#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..6e6f7c5 --- /dev/null +++ b/test cases/common/66 vcstag/vcstag.c.in @@ -0,0 +1 @@ +const char *vcstag = "@VCS_TAG@"; diff --git a/test cases/common/66 vcstag/version.py b/test cases/common/66 vcstag/version.py new file mode 100755 index 0000000..0e0185e --- /dev/null +++ b/test cases/common/66 vcstag/version.py @@ -0,0 +1,3 @@ +#!/usr/bin/env python3 + +print('3.14') diff --git a/test cases/common/67 modules/meson.build b/test cases/common/67 modules/meson.build new file mode 100644 index 0000000..1cb42c4 --- /dev/null +++ b/test cases/common/67 modules/meson.build @@ -0,0 +1,14 @@ +project('module test') + +modtest = import('modtest') +modtest.print_hello() +assert(modtest.found()) + +modtest = import('modtest', required : get_option('disabled')) +assert(not modtest.found()) + +notfound = import('not-found', required : false) +assert(not notfound.found()) + +disabled = import('not-found', required : false, disabler : true) +assert(is_disabler(disabled)) diff --git a/test cases/common/67 modules/meson_options.txt b/test cases/common/67 modules/meson_options.txt new file mode 100644 index 0000000..0671144 --- /dev/null +++ b/test cases/common/67 modules/meson_options.txt @@ -0,0 +1,6 @@ +option( + 'disabled', + type : 'feature', + value : 'disabled', + description : 'test disabled' +) 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..562013d --- /dev/null +++ b/test cases/common/69 configure file in custom target/meson.build @@ -0,0 +1,4 @@ +project('conf file in custom target') + +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/7 mixed/func.c b/test cases/common/7 mixed/func.c new file mode 100644 index 0000000..c76c23d --- /dev/null +++ b/test cases/common/7 mixed/func.c @@ -0,0 +1,4 @@ +int func(void) { + int class = 0; + return class; +} diff --git a/test cases/common/7 mixed/main.cc b/test cases/common/7 mixed/main.cc new file mode 100644 index 0000000..9a7a7a6 --- /dev/null +++ b/test cases/common/7 mixed/main.cc @@ -0,0 +1,7 @@ +extern "C" int func(); + +class BreakPlainCCompiler; + +int main(void) { + return func(); +} diff --git a/test cases/common/7 mixed/meson.build b/test cases/common/7 mixed/meson.build new file mode 100644 index 0000000..af88a1e --- /dev/null +++ b/test cases/common/7 mixed/meson.build @@ -0,0 +1,3 @@ +project('mixed C and C++', 'c', 'cpp') +exe = executable('prog', 'main.cc', 'func.c') +test('mixtest', exe) 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..811f497 --- /dev/null +++ b/test cases/common/70 external test program/meson.build @@ -0,0 +1,3 @@ +project('test is external') + +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..6fde556 --- /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..40f7398 --- /dev/null +++ b/test cases/common/71 ctarget dependency/meson.build @@ -0,0 +1,20 @@ +project('custom target dependency') + +# 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..8f4cb02 --- /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 = 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..1f05f9e --- /dev/null +++ b/test cases/common/72 shared subproject/subprojects/C/meson.build @@ -0,0 +1,3 @@ +project('C', 'c') +# libc.so cannot be used, it already exists as a reserved name +c = library('cee', '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..8f4cb02 --- /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 = 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..1f05f9e --- /dev/null +++ b/test cases/common/73 shared subproject 2/subprojects/C/meson.build @@ -0,0 +1,3 @@ +project('C', 'c') +# libc.so cannot be used, it already exists as a reserved name +c = library('cee', '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..fc01bfe --- /dev/null +++ b/test cases/common/74 file object/meson.build @@ -0,0 +1,8 @@ +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/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..3ac6217 --- /dev/null +++ b/test cases/common/75 custom subproject dir/custom_subproject_dir/C/meson.build @@ -0,0 +1,3 @@ +project('C', 'c') +# libc.so cannot be used, it already exists as a reserved name +c = shared_library('cee', '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/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/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 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..5b9122b --- /dev/null +++ b/test cases/common/79 same basename/lib.c @@ -0,0 +1,22 @@ +#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/8 install/gendir.py b/test cases/common/8 install/gendir.py new file mode 100755 index 0000000..b42327d --- /dev/null +++ b/test cases/common/8 install/gendir.py @@ -0,0 +1,8 @@ +#!/usr/bin/env python3 + +import sys, os + +dirname = sys.argv[1] +fname = os.path.join(dirname, 'file.txt') +os.makedirs(dirname, exist_ok=True) +open(fname, 'w').close() diff --git a/test cases/common/8 install/meson.build b/test cases/common/8 install/meson.build new file mode 100644 index 0000000..6eb5ba5 --- /dev/null +++ b/test cases/common/8 install/meson.build @@ -0,0 +1,10 @@ +project('install test', 'c', default_options : ['libdir=libtest']) + +stlib = static_library('stat', 'stat.c', install : true) +exe = executable('prog', 'prog.c', install : true) + +dirtarget = custom_target('dirtarget', + output: ['dir'], + install: true, + command: [find_program('gendir.py'), '@OUTPUT@'], + install_dir: get_option('datadir')) diff --git a/test cases/common/8 install/prog.c b/test cases/common/8 install/prog.c new file mode 100644 index 0000000..9b6bdc2 --- /dev/null +++ b/test cases/common/8 install/prog.c @@ -0,0 +1,3 @@ +int main(void) { + return 0; +} diff --git a/test cases/common/8 install/stat.c b/test cases/common/8 install/stat.c new file mode 100644 index 0000000..4825cef --- /dev/null +++ b/test cases/common/8 install/stat.c @@ -0,0 +1 @@ +int func(void) { return 933; } diff --git a/test cases/common/8 install/test.json b/test cases/common/8 install/test.json new file mode 100644 index 0000000..b31f287 --- /dev/null +++ b/test cases/common/8 install/test.json @@ -0,0 +1,9 @@ +{ + "installed": [ + { "type": "exe", "file": "usr/bin/prog" }, + { "type": "pdb", "file": "usr/bin/prog" }, + { "type": "file", "file": "usr/share/dir/file.txt" }, + { "type": "file", "file": "usr/libtest/libstat.a" } + ], + "do_not_set_opts": ["libdir"] +} 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/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/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 plusassign/meson.build b/test cases/common/84 plusassign/meson.build new file mode 100644 index 0000000..b419c6d --- /dev/null +++ b/test cases/common/84 plusassign/meson.build @@ -0,0 +1,70 @@ +project('plusassign') + +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..e503038 --- /dev/null +++ b/test cases/common/85 skip subdir/meson.build @@ -0,0 +1,3 @@ +project('foo') + +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..7a2effa --- /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/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/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..2e962f6 --- /dev/null +++ b/test cases/common/88 dep fallback/meson.build @@ -0,0 +1,38 @@ +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 bobinc is not a dependency variable +sita = dependency('sitalib', fallback : ['boblib', 'bobinc'], required: false) +assert(not sita.found()) +# boblib subproject exists, but sita_dep doesn't exist +sita = dependency('sitalib', fallback : ['boblib', 'sita_dep'], required: false) +assert(not sita.found()) +# boblib has been configured so zlib cannot be searched on the system +zlib = dependency('zlib', fallback : ['boblib', 'notfound_dep'], required: false) +assert(not zlib.found()) +# boblib has been configured so zlib cannot be searched on the system. +# Not variable name provided and the subproject does not override zlib. +zlib = dependency('zlib', fallback : 'boblib', required: false) +assert(not zlib.found()) + +# 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..0a72a82 --- /dev/null +++ b/test cases/common/88 dep fallback/subprojects/boblib/meson.build @@ -0,0 +1,18 @@ +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) + +notfound_dep = dependency('', required: false) 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/9 header install/child/childdir.h b/test cases/common/9 header install/child/childdir.h new file mode 100644 index 0000000..5788511 --- /dev/null +++ b/test cases/common/9 header install/child/childdir.h @@ -0,0 +1,3 @@ +/* This file goes, depending on the state of `preserve_path` into subdirectory of include root or into the `child` dir of the subdirectory of include root. */ + +int childdir_func(); diff --git a/test cases/common/9 header install/meson.build b/test cases/common/9 header install/meson.build new file mode 100644 index 0000000..8c83be6 --- /dev/null +++ b/test cases/common/9 header install/meson.build @@ -0,0 +1,12 @@ +project('header install') + +as_array = ['subdir.h', 'child/childdir.h'] + +subdir('vanishing_subdir') +subdir('sub') + +h1 = install_headers('rootdir.h') +h2 = install_headers(as_array, subdir : 'subdir') +h3 = install_headers(as_array, subdir : 'subdir', preserve_path : true) +h4 = install_headers(subheader) +h5 = install_headers(disabler()) diff --git a/test cases/common/9 header install/rootdir.h b/test cases/common/9 header install/rootdir.h new file mode 100644 index 0000000..72fb132 --- /dev/null +++ b/test cases/common/9 header install/rootdir.h @@ -0,0 +1,3 @@ +/* This header goes to include dir root. */ + +int root_func(); diff --git a/test cases/common/9 header install/sub/fileheader.h b/test cases/common/9 header install/sub/fileheader.h new file mode 100644 index 0000000..28e5c8d --- /dev/null +++ b/test cases/common/9 header install/sub/fileheader.h @@ -0,0 +1,3 @@ +#pragma once + +#define LIFE "Is life! Na naa, naa-na na." diff --git a/test cases/common/9 header install/sub/meson.build b/test cases/common/9 header install/sub/meson.build new file mode 100644 index 0000000..1cff4b2 --- /dev/null +++ b/test cases/common/9 header install/sub/meson.build @@ -0,0 +1 @@ +subheader = files('fileheader.h') diff --git a/test cases/common/9 header install/subdir.h b/test cases/common/9 header install/subdir.h new file mode 100644 index 0000000..17f768e --- /dev/null +++ b/test cases/common/9 header install/subdir.h @@ -0,0 +1,3 @@ +/* This file goes to subdirectory of include root. */ + +int subdir_func(); diff --git a/test cases/common/9 header install/test.json b/test cases/common/9 header install/test.json new file mode 100644 index 0000000..8514c90 --- /dev/null +++ b/test cases/common/9 header install/test.json @@ -0,0 +1,10 @@ +{ + "installed": [ + { "type": "file", "file": "usr/include/rootdir.h" }, + { "type": "file", "file": "usr/include/subdir/subdir.h" }, + { "type": "file", "file": "usr/include/subdir/childdir.h" }, + { "type": "file", "file": "usr/include/subdir/child/childdir.h" }, + { "type": "file", "file": "usr/include/vanished.h" }, + { "type": "file", "file": "usr/include/fileheader.h" } + ] +} diff --git a/test cases/common/9 header install/vanishing_subdir/meson.build b/test cases/common/9 header install/vanishing_subdir/meson.build new file mode 100644 index 0000000..a81626c --- /dev/null +++ b/test cases/common/9 header install/vanishing_subdir/meson.build @@ -0,0 +1 @@ +install_headers('vanished.h') diff --git a/test cases/common/9 header install/vanishing_subdir/vanished.h b/test cases/common/9 header install/vanishing_subdir/vanished.h new file mode 100644 index 0000000..ed7971b --- /dev/null +++ b/test cases/common/9 header install/vanishing_subdir/vanished.h @@ -0,0 +1,5 @@ +#pragma once + +/* This is a header in a subdirectory. Make sure it installs into + * /prefix/include and not /prefix/include/vanishing_subdir. + */ 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/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..2346b5b --- /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/94 threads/meson.build b/test cases/common/94 threads/meson.build new file mode 100644 index 0000000..6a939ff --- /dev/null +++ b/test cases/common/94 threads/meson.build @@ -0,0 +1,21 @@ +project('threads', 'cpp', 'c', + default_options : ['cpp_std=c++11']) + +cc = meson.get_compiler('c') +if cc.has_function_attribute('unused') + add_project_arguments('-DHAVE_UNUSED', language: 'c') +endif + +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..19130d5 --- /dev/null +++ b/test cases/common/94 threads/threadprog.c @@ -0,0 +1,46 @@ +#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 + +#ifdef HAVE_UNUSED + #define UNUSED_ATTR __attribute__((unused)) +#else + #define UNUSED_ATTR +#endif + +void* main_func(void UNUSED_ATTR *arg) { + 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/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..23cf956 --- /dev/null +++ b/test cases/common/97 find program path/meson.build @@ -0,0 +1,22 @@ +project('find program') + +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, check: false) + 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, check: false) + 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/98 subproject subdir/meson.build b/test cases/common/98 subproject subdir/meson.build new file mode 100644 index 0000000..3053b3b --- /dev/null +++ b/test cases/common/98 subproject subdir/meson.build @@ -0,0 +1,94 @@ +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', default_options: 'opt=overriden') +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') + +# Verify that `static: true` implies 'default_library=static'. +d = dependency('sub_static', static: true) +assert(d.found()) +# Verify that when not specifying static kwarg we can still get fallback dep. +d = dependency('sub_static') +assert(d.found()) +# But when asking for shared library explicitly, it is not found. +d = dependency('sub_static', static: false, required: false) +assert(not d.found()) +# The subproject also overrides sub_static2 with `static: true` +d = dependency('sub_static2') +assert(d.found()) +d = dependency('sub_static2', static: true) +assert(d.found()) +d = dependency('sub_static2', static: false, required: false) +assert(not d.found()) +# sub_static3 is overridden twice with `static: true` and `static: false` +d = dependency('sub_static3') +assert(d.found()) +assert(d.get_variable('static') == 'true') +d = dependency('sub_static3', static: true) +assert(d.found()) +assert(d.get_variable('static') == 'true') +d = dependency('sub_static3', static: false) +assert(d.found()) +assert(d.get_variable('static') == 'false') 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..9f43604 --- /dev/null +++ b/test cases/common/98 subproject subdir/subprojects/sub_implicit/meson.build @@ -0,0 +1,13 @@ +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 + +assert(get_option('opt') == 'overriden') \ No newline at end of file diff --git a/test cases/common/98 subproject subdir/subprojects/sub_implicit/meson_options.txt b/test cases/common/98 subproject subdir/subprojects/sub_implicit/meson_options.txt new file mode 100644 index 0000000..770178c --- /dev/null +++ b/test cases/common/98 subproject subdir/subprojects/sub_implicit/meson_options.txt @@ -0,0 +1 @@ +option('opt', type: 'string', value: 'default') \ No newline at end of file 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/subprojects/sub_static/meson.build b/test cases/common/98 subproject subdir/subprojects/sub_static/meson.build new file mode 100644 index 0000000..6c00623 --- /dev/null +++ b/test cases/common/98 subproject subdir/subprojects/sub_static/meson.build @@ -0,0 +1,8 @@ +project('sub_static') + +assert(get_option('default_library') == 'static') +meson.override_dependency('sub_static', declare_dependency()) +meson.override_dependency('sub_static2', declare_dependency(), static: true) +meson.override_dependency('sub_static3', declare_dependency(variables: {'static': 'true'}), static: true) +meson.override_dependency('sub_static3', declare_dependency(variables: {'static': 'false'}), static: 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/csharp/1 basic/meson.build b/test cases/csharp/1 basic/meson.build new file mode 100644 index 0000000..09e46c2 --- /dev/null +++ b/test cases/csharp/1 basic/meson.build @@ -0,0 +1,4 @@ +project('simple c#', 'cs') + +e = executable('prog', 'prog.cs', 'text.cs', install : true) +test('basic', e) diff --git a/test cases/csharp/1 basic/prog.cs b/test cases/csharp/1 basic/prog.cs new file mode 100644 index 0000000..6ee47b0 --- /dev/null +++ b/test cases/csharp/1 basic/prog.cs @@ -0,0 +1,8 @@ +using System; + +public class Prog { + static public void Main () { + TextGetter tg = new TextGetter(); + Console.WriteLine(tg.getText()); + } +} diff --git a/test cases/csharp/1 basic/test.json b/test cases/csharp/1 basic/test.json new file mode 100644 index 0000000..650a6e2 --- /dev/null +++ b/test cases/csharp/1 basic/test.json @@ -0,0 +1,6 @@ +{ + "installed": [ + {"type": "file", "file": "usr/bin/prog.exe"}, + {"type": "pdb", "file": "usr/bin/prog"} + ] +} diff --git a/test cases/csharp/1 basic/text.cs b/test cases/csharp/1 basic/text.cs new file mode 100644 index 0000000..c83c424 --- /dev/null +++ b/test cases/csharp/1 basic/text.cs @@ -0,0 +1,7 @@ +using System; + +public class TextGetter { + public String getText() { + return "C# is working."; + } +} diff --git a/test cases/csharp/2 library/helper.cs b/test cases/csharp/2 library/helper.cs new file mode 100644 index 0000000..266e379 --- /dev/null +++ b/test cases/csharp/2 library/helper.cs @@ -0,0 +1,7 @@ +using System; + +public class Helper { + public void print() { + Console.WriteLine("Library class called."); + } +} diff --git a/test cases/csharp/2 library/meson.build b/test cases/csharp/2 library/meson.build new file mode 100644 index 0000000..6b246a4 --- /dev/null +++ b/test cases/csharp/2 library/meson.build @@ -0,0 +1,15 @@ +project('C# library', 'cs') + +python3 = import('python3').find_python() +generated_sources = custom_target('gen_sources', + input: 'helper.cs', + output: 'helper.cs', + command: [python3, '-c', + 'import shutil, sys; shutil.copyfile(sys.argv[1], sys.argv[2])', + '@INPUT@', '@OUTPUT@'] +) + +l = shared_library('helper', generated_sources, install : true) + +e = executable('prog', 'prog.cs', link_with : l, install : true) +test('libtest', e) diff --git a/test cases/csharp/2 library/prog.cs b/test cases/csharp/2 library/prog.cs new file mode 100644 index 0000000..8bf6a31 --- /dev/null +++ b/test cases/csharp/2 library/prog.cs @@ -0,0 +1,8 @@ +using System; + +public class Prog { + static public void Main () { + Helper h = new Helper(); + h.print(); + } +} diff --git a/test cases/csharp/2 library/test.json b/test cases/csharp/2 library/test.json new file mode 100644 index 0000000..0523f45 --- /dev/null +++ b/test cases/csharp/2 library/test.json @@ -0,0 +1,9 @@ +{ + "installed": [ + {"type": "file", "file": "usr/bin/prog.exe"}, + {"type": "pdb", "file": "usr/bin/prog"}, + {"type": "file", "platform": "msvc", "file": "usr/bin/helper.dll"}, + {"type": "pdb", "file": "usr/bin/helper"}, + {"type": "file", "platform": "gcc", "file": "usr/lib/helper.dll"} + ] +} diff --git a/test cases/csharp/3 resource/TestRes.resx b/test cases/csharp/3 resource/TestRes.resx new file mode 100644 index 0000000..c85f85c --- /dev/null +++ b/test cases/csharp/3 resource/TestRes.resx @@ -0,0 +1,31 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +text/microsoft-resx1.3System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089Hello from resources! + \ No newline at end of file diff --git a/test cases/csharp/3 resource/meson.build b/test cases/csharp/3 resource/meson.build new file mode 100644 index 0000000..25b273d --- /dev/null +++ b/test cases/csharp/3 resource/meson.build @@ -0,0 +1,6 @@ +project('C# resource', 'cs') + +e = executable('resprog', 'resprog.cs', +resources : 'TestRes.resx') + +test('restest', e) diff --git a/test cases/csharp/3 resource/resprog.cs b/test cases/csharp/3 resource/resprog.cs new file mode 100644 index 0000000..177201c --- /dev/null +++ b/test cases/csharp/3 resource/resprog.cs @@ -0,0 +1,13 @@ +using System; +using System.Resources; + +public class Prog { + + static public void Main () { + ResourceManager res = new ResourceManager(typeof(TestRes)); + Console.WriteLine(res.GetString("message")); + } + + internal class TestRes { + } +} diff --git a/test cases/csharp/4 external dep/hello.txt b/test cases/csharp/4 external dep/hello.txt new file mode 100644 index 0000000..980a0d5 --- /dev/null +++ b/test cases/csharp/4 external dep/hello.txt @@ -0,0 +1 @@ +Hello World! diff --git a/test cases/csharp/4 external dep/meson.build b/test cases/csharp/4 external dep/meson.build new file mode 100644 index 0000000..019d618 --- /dev/null +++ b/test cases/csharp/4 external dep/meson.build @@ -0,0 +1,9 @@ +project('C# external library', 'cs') +glib_sharp_2 = dependency('glib-sharp-2.0', required : false) + +if not glib_sharp_2.found() + error('MESON_SKIP_TEST glib# not found.') +endif + +e = executable('prog', 'prog.cs', dependencies: glib_sharp_2, install : true) +test('libtest', e, args: [join_paths(meson.current_source_dir(), 'hello.txt')]) diff --git a/test cases/csharp/4 external dep/prog.cs b/test cases/csharp/4 external dep/prog.cs new file mode 100644 index 0000000..9393fef --- /dev/null +++ b/test cases/csharp/4 external dep/prog.cs @@ -0,0 +1,8 @@ +using System; +using GLib; + +public class Prog { + static public void Main (string[] args) { + Console.WriteLine(GLib.FileUtils.GetFileContents(args[0])); + } +} diff --git a/test cases/csharp/4 external dep/test.json b/test cases/csharp/4 external dep/test.json new file mode 100644 index 0000000..a94303f --- /dev/null +++ b/test cases/csharp/4 external dep/test.json @@ -0,0 +1,5 @@ +{ + "installed": [ + {"type": "file", "file": "usr/bin/prog.exe"} + ] +} diff --git a/test cases/cuda/1 simple/meson.build b/test cases/cuda/1 simple/meson.build new file mode 100644 index 0000000..4f111d1 --- /dev/null +++ b/test cases/cuda/1 simple/meson.build @@ -0,0 +1,4 @@ +project('simple', 'cuda', version : '1.0.0') + +exe = executable('prog', 'prog.cu') +test('cudatest', exe) diff --git a/test cases/cuda/1 simple/prog.cu b/test cases/cuda/1 simple/prog.cu new file mode 100644 index 0000000..06521b2 --- /dev/null +++ b/test cases/cuda/1 simple/prog.cu @@ -0,0 +1,29 @@ +#include + +int main(void) { + int cuda_devices = 0; + std::cout << "CUDA version: " << CUDART_VERSION << "\n"; + cudaGetDeviceCount(&cuda_devices); + if(cuda_devices == 0) { + std::cout << "No Cuda hardware found. Exiting.\n"; + return 0; + } + std::cout << "This computer has " << cuda_devices << " Cuda device(s).\n"; + cudaDeviceProp props; + cudaGetDeviceProperties(&props, 0); + std::cout << "Properties of device 0.\n\n"; + + std::cout << " Name: " << props.name << "\n"; + std::cout << " Global memory: " << props.totalGlobalMem << "\n"; + std::cout << " Shared memory: " << props.sharedMemPerBlock << "\n"; + std::cout << " Constant memory: " << props.totalConstMem << "\n"; + std::cout << " Block registers: " << props.regsPerBlock << "\n"; + + std::cout << " Warp size: " << props.warpSize << "\n"; + std::cout << " Threads per block: " << props.maxThreadsPerBlock << "\n"; + std::cout << " Max block dimensions: [ " << props.maxThreadsDim[0] << ", " << props.maxThreadsDim[1] << ", " << props.maxThreadsDim[2] << " ]" << "\n"; + std::cout << " Max grid dimensions: [ " << props.maxGridSize[0] << ", " << props.maxGridSize[1] << ", " << props.maxGridSize[2] << " ]" << "\n"; + std::cout << "\n"; + + return 0; +} diff --git a/test cases/cuda/10 cuda dependency/c/meson.build b/test cases/cuda/10 cuda dependency/c/meson.build new file mode 100644 index 0000000..921bc43 --- /dev/null +++ b/test cases/cuda/10 cuda dependency/c/meson.build @@ -0,0 +1,2 @@ +exe = executable('prog', 'prog.c', dependencies: dependency('cuda')) +test('cudatest', exe) diff --git a/test cases/cuda/10 cuda dependency/c/prog.c b/test cases/cuda/10 cuda dependency/c/prog.c new file mode 100644 index 0000000..ed9333e --- /dev/null +++ b/test cases/cuda/10 cuda dependency/c/prog.c @@ -0,0 +1,19 @@ +#include +#include + +int cuda_devices(void) { + int result = 0; + cudaGetDeviceCount(&result); + return result; +} + +int main(void) { + int n = cuda_devices(); + if (n == 0) { + printf("No CUDA hardware found. Exiting.\n"); + return 0; + } + + printf("Found %i CUDA devices.\n", n); + return 0; +} diff --git a/test cases/cuda/10 cuda dependency/cpp/meson.build b/test cases/cuda/10 cuda dependency/cpp/meson.build new file mode 100644 index 0000000..a661b88 --- /dev/null +++ b/test cases/cuda/10 cuda dependency/cpp/meson.build @@ -0,0 +1,2 @@ +exe = executable('prog', 'prog.cc', dependencies: dependency('cuda')) +test('cudatest', exe) diff --git a/test cases/cuda/10 cuda dependency/cpp/prog.cc b/test cases/cuda/10 cuda dependency/cpp/prog.cc new file mode 100644 index 0000000..4832afa --- /dev/null +++ b/test cases/cuda/10 cuda dependency/cpp/prog.cc @@ -0,0 +1,19 @@ +#include +#include + +int cuda_devices(void) { + int result = 0; + cudaGetDeviceCount(&result); + return result; +} + +int main(void) { + int n = cuda_devices(); + if (n == 0) { + std::cout << "No CUDA hardware found. Exiting.\n"; + return 0; + } + + std::cout << "Found " << n << " CUDA devices.\n"; + return 0; +} diff --git a/test cases/cuda/10 cuda dependency/meson.build b/test cases/cuda/10 cuda dependency/meson.build new file mode 100644 index 0000000..3e602b6 --- /dev/null +++ b/test cases/cuda/10 cuda dependency/meson.build @@ -0,0 +1,6 @@ +project('cuda dependency', 'c', 'cpp') + +subdir('c') +subdir('cpp') +subdir('modules') +subdir('version_reqs') diff --git a/test cases/cuda/10 cuda dependency/modules/meson.build b/test cases/cuda/10 cuda dependency/modules/meson.build new file mode 100644 index 0000000..0da43f2 --- /dev/null +++ b/test cases/cuda/10 cuda dependency/modules/meson.build @@ -0,0 +1,2 @@ +exe = executable('prog', 'prog.cc', dependencies: dependency('cuda', modules: ['cublas'])) +test('cudatest', exe) diff --git a/test cases/cuda/10 cuda dependency/modules/prog.cc b/test cases/cuda/10 cuda dependency/modules/prog.cc new file mode 100644 index 0000000..b4af4d4 --- /dev/null +++ b/test cases/cuda/10 cuda dependency/modules/prog.cc @@ -0,0 +1,33 @@ +#include +#include +#include + +int cuda_devices(void) { + int result = 0; + cudaGetDeviceCount(&result); + return result; +} + +int main(void) { + int n = cuda_devices(); + if (n == 0) { + std::cout << "No CUDA hardware found. Exiting.\n"; + return 0; + } + + std::cout << "Found " << n << " CUDA devices.\n"; + + cublasHandle_t handle; + if (cublasCreate(&handle) != CUBLAS_STATUS_SUCCESS) { + std::cout << "cuBLAS initialization failed. Exiting.\n"; + return -1; + } + + std::cout << "Initialized cuBLAS\n"; + if (cublasDestroy(handle) != CUBLAS_STATUS_SUCCESS) { + std::cout << "cuBLAS de-initialization failed. Exiting.\n"; + return -1; + } + + return 0; +} diff --git a/test cases/cuda/10 cuda dependency/version_reqs/meson.build b/test cases/cuda/10 cuda dependency/version_reqs/meson.build new file mode 100644 index 0000000..45b5daa --- /dev/null +++ b/test cases/cuda/10 cuda dependency/version_reqs/meson.build @@ -0,0 +1,2 @@ +exe = executable('prog', 'prog.cc', dependencies: dependency('cuda', version: ['>=8.5', '<10'], required: false, disabler: true)) +test('cudatest', exe) diff --git a/test cases/cuda/10 cuda dependency/version_reqs/prog.cc b/test cases/cuda/10 cuda dependency/version_reqs/prog.cc new file mode 100644 index 0000000..5668830 --- /dev/null +++ b/test cases/cuda/10 cuda dependency/version_reqs/prog.cc @@ -0,0 +1,28 @@ +#include +#include + +int cuda_devices(void) { + int result = 0; + cudaGetDeviceCount(&result); + return result; +} + +int main(void) { + std::cout << "Compiled against CUDA version: " << CUDART_VERSION << "\n"; + int runtime_version = 0; + cudaError_t r = cudaRuntimeGetVersion(&runtime_version); + if (r != cudaSuccess) { + std::cout << "Couldn't obtain CUDA runtime version (error " << r << "). Exiting.\n"; + return -1; + } + std::cout << "CUDA runtime version: " << runtime_version << "\n"; + + int n = cuda_devices(); + if (n == 0) { + std::cout << "No CUDA hardware found. Exiting.\n"; + return 0; + } + + std::cout << "Found " << n << " CUDA devices.\n"; + return 0; +} diff --git a/test cases/cuda/11 cuda dependency (nvcc)/meson.build b/test cases/cuda/11 cuda dependency (nvcc)/meson.build new file mode 100644 index 0000000..67b6568 --- /dev/null +++ b/test cases/cuda/11 cuda dependency (nvcc)/meson.build @@ -0,0 +1,4 @@ +project('cuda dependency', 'cuda') + +subdir('modules') +subdir('version_reqs') diff --git a/test cases/cuda/11 cuda dependency (nvcc)/modules/meson.build b/test cases/cuda/11 cuda dependency (nvcc)/modules/meson.build new file mode 100644 index 0000000..c0fed83 --- /dev/null +++ b/test cases/cuda/11 cuda dependency (nvcc)/modules/meson.build @@ -0,0 +1,2 @@ +exe = executable('prog', 'prog.cu', dependencies: dependency('cuda', modules: ['cublas'])) +test('cudatest', exe) diff --git a/test cases/cuda/11 cuda dependency (nvcc)/modules/prog.cu b/test cases/cuda/11 cuda dependency (nvcc)/modules/prog.cu new file mode 100644 index 0000000..b4af4d4 --- /dev/null +++ b/test cases/cuda/11 cuda dependency (nvcc)/modules/prog.cu @@ -0,0 +1,33 @@ +#include +#include +#include + +int cuda_devices(void) { + int result = 0; + cudaGetDeviceCount(&result); + return result; +} + +int main(void) { + int n = cuda_devices(); + if (n == 0) { + std::cout << "No CUDA hardware found. Exiting.\n"; + return 0; + } + + std::cout << "Found " << n << " CUDA devices.\n"; + + cublasHandle_t handle; + if (cublasCreate(&handle) != CUBLAS_STATUS_SUCCESS) { + std::cout << "cuBLAS initialization failed. Exiting.\n"; + return -1; + } + + std::cout << "Initialized cuBLAS\n"; + if (cublasDestroy(handle) != CUBLAS_STATUS_SUCCESS) { + std::cout << "cuBLAS de-initialization failed. Exiting.\n"; + return -1; + } + + return 0; +} diff --git a/test cases/cuda/11 cuda dependency (nvcc)/version_reqs/meson.build b/test cases/cuda/11 cuda dependency (nvcc)/version_reqs/meson.build new file mode 100644 index 0000000..6644c9e --- /dev/null +++ b/test cases/cuda/11 cuda dependency (nvcc)/version_reqs/meson.build @@ -0,0 +1,2 @@ +exe = executable('prog', 'prog.cu', dependencies: dependency('cuda', version: ['>=10.1'], required: false, disabler: true)) +test('cudatest', exe) diff --git a/test cases/cuda/11 cuda dependency (nvcc)/version_reqs/prog.cu b/test cases/cuda/11 cuda dependency (nvcc)/version_reqs/prog.cu new file mode 100644 index 0000000..bc90081 --- /dev/null +++ b/test cases/cuda/11 cuda dependency (nvcc)/version_reqs/prog.cu @@ -0,0 +1,29 @@ +#include +#include + +int cuda_devices(void) { + int result = 0; + cudaGetDeviceCount(&result); + return result; +} + +int main(void) { + std::cout << "Compiled against CUDA version: " << CUDART_VERSION << "\n"; + + int runtime_version = 0; + switch (cudaError_t r = cudaRuntimeGetVersion(&runtime_version)) { + case cudaSuccess: + std::cout << "CUDA runtime version: " << runtime_version << "\n"; + break; + case cudaErrorNoDevice: + std::cout << "No CUDA hardware found. Exiting.\n"; + return 0; + default: + std::cout << "Couldn't obtain CUDA runtime version (error " << r << "). Exiting.\n"; + return -1; + } + + int n = cuda_devices(); + std::cout << "Found " << n << " CUDA devices.\n"; + return 0; +} diff --git a/test cases/cuda/12 cuda dependency (mixed)/kernel.cu b/test cases/cuda/12 cuda dependency (mixed)/kernel.cu new file mode 100644 index 0000000..7daaa68 --- /dev/null +++ b/test cases/cuda/12 cuda dependency (mixed)/kernel.cu @@ -0,0 +1,8 @@ +#include + +__global__ void kernel (void){ +} + +void do_cuda_stuff(void) { + kernel<<<1,1>>>(); +} diff --git a/test cases/cuda/12 cuda dependency (mixed)/meson.build b/test cases/cuda/12 cuda dependency (mixed)/meson.build new file mode 100644 index 0000000..5df4f84 --- /dev/null +++ b/test cases/cuda/12 cuda dependency (mixed)/meson.build @@ -0,0 +1,4 @@ +project('cuda dependency', 'cpp', 'cuda') + +exe = executable('prog', 'prog.cpp', 'kernel.cu', dependencies: dependency('cuda', modules: ['cublas'])) +test('cudatest', exe) diff --git a/test cases/cuda/12 cuda dependency (mixed)/prog.cpp b/test cases/cuda/12 cuda dependency (mixed)/prog.cpp new file mode 100644 index 0000000..50bb156 --- /dev/null +++ b/test cases/cuda/12 cuda dependency (mixed)/prog.cpp @@ -0,0 +1,37 @@ +#include +#include +#include + +void do_cuda_stuff(void); + +int cuda_devices(void) { + int result = 0; + cudaGetDeviceCount(&result); + return result; +} + +int main(void) { + int n = cuda_devices(); + if (n == 0) { + std::cout << "No CUDA hardware found. Exiting.\n"; + return 0; + } + + std::cout << "Found " << n << " CUDA devices.\n"; + + do_cuda_stuff(); + + cublasHandle_t handle; + if (cublasCreate(&handle) != CUBLAS_STATUS_SUCCESS) { + std::cout << "cuBLAS initialization failed. Exiting.\n"; + return -1; + } + + std::cout << "Initialized cuBLAS\n"; + if (cublasDestroy(handle) != CUBLAS_STATUS_SUCCESS) { + std::cout << "cuBLAS de-initialization failed. Exiting.\n"; + return -1; + } + + return 0; +} diff --git a/test cases/cuda/13 cuda compiler setting/meson.build b/test cases/cuda/13 cuda compiler setting/meson.build new file mode 100644 index 0000000..4f111d1 --- /dev/null +++ b/test cases/cuda/13 cuda compiler setting/meson.build @@ -0,0 +1,4 @@ +project('simple', 'cuda', version : '1.0.0') + +exe = executable('prog', 'prog.cu') +test('cudatest', exe) diff --git a/test cases/cuda/13 cuda compiler setting/nativefile.ini b/test cases/cuda/13 cuda compiler setting/nativefile.ini new file mode 100644 index 0000000..fb52e0d --- /dev/null +++ b/test cases/cuda/13 cuda compiler setting/nativefile.ini @@ -0,0 +1,3 @@ +[binaries] + +cuda = 'nvcc' diff --git a/test cases/cuda/13 cuda compiler setting/prog.cu b/test cases/cuda/13 cuda compiler setting/prog.cu new file mode 100644 index 0000000..06521b2 --- /dev/null +++ b/test cases/cuda/13 cuda compiler setting/prog.cu @@ -0,0 +1,29 @@ +#include + +int main(void) { + int cuda_devices = 0; + std::cout << "CUDA version: " << CUDART_VERSION << "\n"; + cudaGetDeviceCount(&cuda_devices); + if(cuda_devices == 0) { + std::cout << "No Cuda hardware found. Exiting.\n"; + return 0; + } + std::cout << "This computer has " << cuda_devices << " Cuda device(s).\n"; + cudaDeviceProp props; + cudaGetDeviceProperties(&props, 0); + std::cout << "Properties of device 0.\n\n"; + + std::cout << " Name: " << props.name << "\n"; + std::cout << " Global memory: " << props.totalGlobalMem << "\n"; + std::cout << " Shared memory: " << props.sharedMemPerBlock << "\n"; + std::cout << " Constant memory: " << props.totalConstMem << "\n"; + std::cout << " Block registers: " << props.regsPerBlock << "\n"; + + std::cout << " Warp size: " << props.warpSize << "\n"; + std::cout << " Threads per block: " << props.maxThreadsPerBlock << "\n"; + std::cout << " Max block dimensions: [ " << props.maxThreadsDim[0] << ", " << props.maxThreadsDim[1] << ", " << props.maxThreadsDim[2] << " ]" << "\n"; + std::cout << " Max grid dimensions: [ " << props.maxGridSize[0] << ", " << props.maxGridSize[1] << ", " << props.maxGridSize[2] << " ]" << "\n"; + std::cout << "\n"; + + return 0; +} diff --git a/test cases/cuda/14 cuda has header symbol/meson.build b/test cases/cuda/14 cuda has header symbol/meson.build new file mode 100644 index 0000000..a23892d --- /dev/null +++ b/test cases/cuda/14 cuda has header symbol/meson.build @@ -0,0 +1,26 @@ +project('cuda has header symbol', 'cuda') + +cuda = meson.get_compiler('cuda') + +# C checks +assert (cuda.has_header_symbol('stdio.h', 'int'), 'base types should always be available') +assert (cuda.has_header_symbol('stdio.h', 'printf'), 'printf function not found') +assert (cuda.has_header_symbol('stdio.h', 'FILE'), 'FILE structure not found') +assert (cuda.has_header_symbol('limits.h', 'INT_MAX'), 'INT_MAX define not found') +assert (not cuda.has_header_symbol('limits.h', 'guint64'), 'guint64 is not defined in limits.h') +assert (not cuda.has_header_symbol('stdlib.h', 'FILE'), 'FILE structure is defined in stdio.h, not stdlib.h') +assert (not cuda.has_header_symbol('stdlol.h', 'printf'), 'stdlol.h shouldn\'t exist') +assert (not cuda.has_header_symbol('stdlol.h', 'int'), 'shouldn\'t be able to find "int" with invalid header') + +# C++ checks +assert (cuda.has_header_symbol('iostream', 'std::iostream'), 'iostream not found in iostream.h') +assert (cuda.has_header_symbol('vector', 'std::vector'), 'vector not found in vector.h') +assert (not cuda.has_header_symbol('limits.h', 'std::iostream'), 'iostream should not be defined in limits.h') + +# CUDA checks +assert (cuda.has_header_symbol('cuda.h', 'CUDA_VERSION'), 'CUDA_VERSION not found in cuda.h') +assert (not cuda.has_header_symbol('cuda.h', 'cublasSaxpy'), 'cublasSaxpy is defined in cublas.h, not cuda.h') +if cuda.version().version_compare('>=4.0') + assert (cuda.has_header_symbol('thrust/device_vector.h', 'thrust::device_vector'), 'thrust::device_vector not found') + assert (not cuda.has_header_symbol('thrust/fill.h', 'thrust::sort'), 'thrust::sort should not be defined in thrust/fill.h') +endif diff --git a/test cases/cuda/15 sanitizer/meson.build b/test cases/cuda/15 sanitizer/meson.build new file mode 100644 index 0000000..367a4e2 --- /dev/null +++ b/test cases/cuda/15 sanitizer/meson.build @@ -0,0 +1,4 @@ +project('simple', 'cuda', version : '1.0.0', + default_options: ['b_sanitize=address,undefined']) + +libtests = shared_library('tests', 'prog.cu') diff --git a/test cases/cuda/15 sanitizer/prog.cu b/test cases/cuda/15 sanitizer/prog.cu new file mode 100644 index 0000000..5816809 --- /dev/null +++ b/test cases/cuda/15 sanitizer/prog.cu @@ -0,0 +1,29 @@ +#include + +int run_tests(void) { + int cuda_devices = 0; + std::cout << "CUDA version: " << CUDART_VERSION << "\n"; + cudaGetDeviceCount(&cuda_devices); + if(cuda_devices == 0) { + std::cout << "No Cuda hardware found. Exiting.\n"; + return 0; + } + std::cout << "This computer has " << cuda_devices << " Cuda device(s).\n"; + cudaDeviceProp props; + cudaGetDeviceProperties(&props, 0); + std::cout << "Properties of device 0.\n\n"; + + std::cout << " Name: " << props.name << "\n"; + std::cout << " Global memory: " << props.totalGlobalMem << "\n"; + std::cout << " Shared memory: " << props.sharedMemPerBlock << "\n"; + std::cout << " Constant memory: " << props.totalConstMem << "\n"; + std::cout << " Block registers: " << props.regsPerBlock << "\n"; + + std::cout << " Warp size: " << props.warpSize << "\n"; + std::cout << " Threads per block: " << props.maxThreadsPerBlock << "\n"; + std::cout << " Max block dimensions: [ " << props.maxThreadsDim[0] << ", " << props.maxThreadsDim[1] << ", " << props.maxThreadsDim[2] << " ]" << "\n"; + std::cout << " Max grid dimensions: [ " << props.maxGridSize[0] << ", " << props.maxGridSize[1] << ", " << props.maxGridSize[2] << " ]" << "\n"; + std::cout << "\n"; + + return 0; +} diff --git a/test cases/cuda/16 multistd/lib.cu b/test cases/cuda/16 multistd/lib.cu new file mode 100644 index 0000000..8b5d5a7 --- /dev/null +++ b/test cases/cuda/16 multistd/lib.cu @@ -0,0 +1,3 @@ +int do_cuda_stuff() { + return 0; +} diff --git a/test cases/cuda/16 multistd/main.cu b/test cases/cuda/16 multistd/main.cu new file mode 100644 index 0000000..7b06570 --- /dev/null +++ b/test cases/cuda/16 multistd/main.cu @@ -0,0 +1,21 @@ +#include +#include + +auto cuda_devices(void) { + int result = 0; + cudaGetDeviceCount(&result); + return result; +} + +int do_cuda_stuff(); + +int main(void) { + int n = cuda_devices(); + if (n == 0) { + std::cout << "No Cuda hardware found. Exiting.\n"; + return 0; + } + + std::cout << "Found " << n << "Cuda devices.\n"; + return do_cuda_stuff(); +} diff --git a/test cases/cuda/16 multistd/meson.build b/test cases/cuda/16 multistd/meson.build new file mode 100644 index 0000000..36709d8 --- /dev/null +++ b/test cases/cuda/16 multistd/meson.build @@ -0,0 +1,13 @@ +project('C++-CUDA multi-std', 'cpp', 'cuda', + version : '1.0.0', + default_options : ['cpp_std=c++17', 'cuda_std=c++14']) + +# Regression test: Passing override_options used to cause a crash. +# See https://github.com/mesonbuild/meson/issues/9448. +libcpp11 = static_library('testcpp11', 'lib.cu', + override_options: ['cpp_std=c++11'] +) + +exe = executable('prog', 'main.cu', link_with: libcpp11) +# The runtimes leak memory, so ignore it. +test('cudatest', exe, env: ['ASAN_OPTIONS=detect_leaks=0']) diff --git a/test cases/cuda/2 split/lib.cu b/test cases/cuda/2 split/lib.cu new file mode 100644 index 0000000..e891933 --- /dev/null +++ b/test cases/cuda/2 split/lib.cu @@ -0,0 +1,12 @@ +#include +#include + +__global__ void kernel (void){ +} + +int do_cuda_stuff(void) { + kernel<<<1,1>>>(); + + printf("Hello, World!\n"); + return 0; +} diff --git a/test cases/cuda/2 split/main.cpp b/test cases/cuda/2 split/main.cpp new file mode 100644 index 0000000..ce79003 --- /dev/null +++ b/test cases/cuda/2 split/main.cpp @@ -0,0 +1,7 @@ +#include + +int do_cuda_stuff(void); + +int main(void) { + return do_cuda_stuff(); +} diff --git a/test cases/cuda/2 split/meson.build b/test cases/cuda/2 split/meson.build new file mode 100644 index 0000000..2e2bec1 --- /dev/null +++ b/test cases/cuda/2 split/meson.build @@ -0,0 +1,6 @@ +project('simple', 'cuda', 'cpp') + +exe = executable('prog', 'main.cpp', 'lib.cu') +test('cudatest', exe) + +subdir('static') diff --git a/test cases/cuda/2 split/static/lib.cu b/test cases/cuda/2 split/static/lib.cu new file mode 100644 index 0000000..757c9b5 --- /dev/null +++ b/test cases/cuda/2 split/static/lib.cu @@ -0,0 +1,12 @@ +#include +#include + +__global__ void kernel (void){ +} + +int do_cuda_stuff() { + kernel<<<1,1>>>(); + + printf("Hello, World!\n"); + return 0; +} diff --git a/test cases/cuda/2 split/static/libsta.cu b/test cases/cuda/2 split/static/libsta.cu new file mode 100644 index 0000000..757c9b5 --- /dev/null +++ b/test cases/cuda/2 split/static/libsta.cu @@ -0,0 +1,12 @@ +#include +#include + +__global__ void kernel (void){ +} + +int do_cuda_stuff() { + kernel<<<1,1>>>(); + + printf("Hello, World!\n"); + return 0; +} diff --git a/test cases/cuda/2 split/static/main_static.cpp b/test cases/cuda/2 split/static/main_static.cpp new file mode 100644 index 0000000..ce79003 --- /dev/null +++ b/test cases/cuda/2 split/static/main_static.cpp @@ -0,0 +1,7 @@ +#include + +int do_cuda_stuff(void); + +int main(void) { + return do_cuda_stuff(); +} diff --git a/test cases/cuda/2 split/static/meson.build b/test cases/cuda/2 split/static/meson.build new file mode 100644 index 0000000..9078198 --- /dev/null +++ b/test cases/cuda/2 split/static/meson.build @@ -0,0 +1,4 @@ +l = static_library('clib', 'lib.cu') +exe = executable('staexe', 'main_static.cpp', + link_with : l) +test('static Cuda test', exe) diff --git a/test cases/cuda/3 cudamodule/meson.build b/test cases/cuda/3 cudamodule/meson.build new file mode 100644 index 0000000..5c3ed60 --- /dev/null +++ b/test cases/cuda/3 cudamodule/meson.build @@ -0,0 +1,69 @@ +project('cudamodule', 'cuda', version : '1.0.0') + +nvcc = meson.get_compiler('cuda') +cuda = import('unstable-cuda') + +arch_flags = cuda.nvcc_arch_flags(nvcc.version(), 'Auto', detected: ['6.0']) +arch_readable = cuda.nvcc_arch_readable(nvcc.version(), 'Auto', detected: ['6.0']) +driver_version = cuda.min_driver_version(nvcc.version()) + +message('NVCC version: ' + nvcc.version()) +message('NVCC flags: ' + ' '.join(arch_flags)) +message('NVCC readable: ' + ' '.join(arch_readable)) +message('Driver version: >=' + driver_version) + +exe = executable('prog', 'prog.cu', cuda_args: arch_flags) +test('cudatest', exe) + + +# +# Assert Series +# + +# Sanity test. +assert(' '.join(cuda.nvcc_arch_flags('11.1', '8.6')) == + '-gencode arch=compute_86,code=sm_86') + +# CUDA Toolkit too old, flag filtered out. +assert(' '.join(cuda.nvcc_arch_flags('11.0', '8.6')) == + '') + +# Named architectures. +assert(' '.join(cuda.nvcc_arch_flags('11.0', 'Ampere')) == + '-gencode arch=compute_80,code=sm_80') + +# Splitting & deduplication. +assert(' '.join(cuda.nvcc_arch_flags('11.0', 'Ampere;8.0,8.0')) == + '-gencode arch=compute_80,code=sm_80') + +# Same, but list supplied as list. +assert(' '.join(cuda.nvcc_arch_flags('11.0', ['Ampere', '8.0', '8.0'])) == + '-gencode arch=compute_80,code=sm_80') + +# Same, but mode set to Auto with detected set to a string with a variety of separators. +assert(' '.join(cuda.nvcc_arch_flags('11.0', 'Auto', detected: 'Ampere;8.0,8.0')) == + '-gencode arch=compute_80,code=sm_80') + +# Same, but detected set to a list. +assert(' '.join(cuda.nvcc_arch_flags('11.0', 'Auto', detected: ['Ampere', '8.0', '8.0'])) == + '-gencode arch=compute_80,code=sm_80') + +# Ask for 8.6 binary with 8.0-level PTX. +assert(' '.join(cuda.nvcc_arch_flags('11.1', '8.6(8.0)')) == + '-gencode arch=compute_80,code=sm_86') + +# Same, but keep the 8.0 PTX. +assert(' '.join(cuda.nvcc_arch_flags('11.1', '8.6(8.0)+PTX')) == + '-gencode arch=compute_80,code=sm_86 -gencode arch=compute_80,code=compute_80') + +# Detected Ampere RTX 3090 on CUDA 10.2, saturate to 7.5+PTX +assert(' '.join(cuda.nvcc_arch_flags('10.2', 'Auto', detected: ['8.0'])) == + '-gencode arch=compute_75,code=sm_75 -gencode arch=compute_75,code=compute_75') + +# Failed to auto-detect with CUDA 10.2, default to common GPUs (3.0;3.5;5.0;5.2;6.0;6.1;7.0;7.5+PTX) +assert(' '.join(cuda.nvcc_arch_flags('10.2', 'Auto', detected: [])) == + '-gencode arch=compute_30,code=sm_30 -gencode arch=compute_35,code=sm_35 '+ + '-gencode arch=compute_50,code=sm_50 -gencode arch=compute_52,code=sm_52 '+ + '-gencode arch=compute_60,code=sm_60 -gencode arch=compute_61,code=sm_61 '+ + '-gencode arch=compute_70,code=sm_70 -gencode arch=compute_75,code=sm_75 '+ + '-gencode arch=compute_75,code=compute_75') diff --git a/test cases/cuda/3 cudamodule/prog.cu b/test cases/cuda/3 cudamodule/prog.cu new file mode 100644 index 0000000..06521b2 --- /dev/null +++ b/test cases/cuda/3 cudamodule/prog.cu @@ -0,0 +1,29 @@ +#include + +int main(void) { + int cuda_devices = 0; + std::cout << "CUDA version: " << CUDART_VERSION << "\n"; + cudaGetDeviceCount(&cuda_devices); + if(cuda_devices == 0) { + std::cout << "No Cuda hardware found. Exiting.\n"; + return 0; + } + std::cout << "This computer has " << cuda_devices << " Cuda device(s).\n"; + cudaDeviceProp props; + cudaGetDeviceProperties(&props, 0); + std::cout << "Properties of device 0.\n\n"; + + std::cout << " Name: " << props.name << "\n"; + std::cout << " Global memory: " << props.totalGlobalMem << "\n"; + std::cout << " Shared memory: " << props.sharedMemPerBlock << "\n"; + std::cout << " Constant memory: " << props.totalConstMem << "\n"; + std::cout << " Block registers: " << props.regsPerBlock << "\n"; + + std::cout << " Warp size: " << props.warpSize << "\n"; + std::cout << " Threads per block: " << props.maxThreadsPerBlock << "\n"; + std::cout << " Max block dimensions: [ " << props.maxThreadsDim[0] << ", " << props.maxThreadsDim[1] << ", " << props.maxThreadsDim[2] << " ]" << "\n"; + std::cout << " Max grid dimensions: [ " << props.maxGridSize[0] << ", " << props.maxGridSize[1] << ", " << props.maxGridSize[2] << " ]" << "\n"; + std::cout << "\n"; + + return 0; +} diff --git a/test cases/cuda/4 shared/main.cu b/test cases/cuda/4 shared/main.cu new file mode 100644 index 0000000..1235914 --- /dev/null +++ b/test cases/cuda/4 shared/main.cu @@ -0,0 +1,20 @@ +#include +#include +#include "shared/kernels.h" + + +int main(void) { + int cuda_devices = 0; + cudaGetDeviceCount(&cuda_devices); + if(cuda_devices == 0) { + printf("No Cuda hardware found. Exiting.\n"); + return 0; + } + + if(run_tests() != 0){ + printf("CUDA tests failed! Exiting.\n"); + return 0; + } + + return 0; +} diff --git a/test cases/cuda/4 shared/meson.build b/test cases/cuda/4 shared/meson.build new file mode 100644 index 0000000..532aaeb --- /dev/null +++ b/test cases/cuda/4 shared/meson.build @@ -0,0 +1,6 @@ +project('simple', 'cuda', version : '1.0.0') + +subdir('shared') + +exe = executable('prog', 'main.cu', dependencies: libkernels) +test('cudatest', exe) diff --git a/test cases/cuda/4 shared/shared/kernels.cu b/test cases/cuda/4 shared/shared/kernels.cu new file mode 100644 index 0000000..5cda629 --- /dev/null +++ b/test cases/cuda/4 shared/shared/kernels.cu @@ -0,0 +1,13 @@ +#include +#include +#include "kernels.h" + + +TAG_HIDDEN __global__ void kernel (void){ +} + +TAG_PUBLIC int run_tests(void) { + kernel<<<1,1>>>(); + + return (int)cudaDeviceSynchronize(); +} diff --git a/test cases/cuda/4 shared/shared/kernels.h b/test cases/cuda/4 shared/shared/kernels.h new file mode 100644 index 0000000..dbcb99d --- /dev/null +++ b/test cases/cuda/4 shared/shared/kernels.h @@ -0,0 +1,86 @@ +/* Include Guard */ +#ifndef SHARED_KERNELS_H +#define SHARED_KERNELS_H + +/** + * Includes + */ + +#include + + +/** + * Defines + */ + +/** + * When building a library, it is a good idea to expose as few as possible + * internal symbols (functions, objects, data structures). Not only does it + * prevent users from relying on private portions of the library that are + * subject to change without any notice, but it can have performance + * advantages: + * + * - It can make shared libraries link faster at dynamic-load time. + * - It can make internal function calls faster by bypassing the PLT. + * + * Thus, the compilation should by default hide all symbols, while the API + * headers will explicitly mark public the few symbols the users are permitted + * to use with a PUBLIC tag. We also define a HIDDEN tag, since it may be + * required to explicitly tag certain C++ types as visible in order for + * exceptions to function correctly. + * + * Additional complexity comes from non-POSIX-compliant systems, which + * artificially impose a requirement on knowing whether we are building or + * using a DLL. + * + * The above commentary and below code is inspired from + * 'https://gcc.gnu.org/wiki/Visibility' + */ + +#if defined(_WIN32) || defined(__CYGWIN__) +# define TAG_ATTRIBUTE_EXPORT __declspec(dllexport) +# define TAG_ATTRIBUTE_IMPORT __declspec(dllimport) +# define TAG_ATTRIBUTE_HIDDEN +#elif __GNUC__ >= 4 +# define TAG_ATTRIBUTE_EXPORT __attribute__((visibility("default"))) +# define TAG_ATTRIBUTE_IMPORT __attribute__((visibility("default"))) +# define TAG_ATTRIBUTE_HIDDEN __attribute__((visibility("hidden"))) +#else +# define TAG_ATTRIBUTE_EXPORT +# define TAG_ATTRIBUTE_IMPORT +# define TAG_ATTRIBUTE_HIDDEN +#endif + +#if TAG_IS_SHARED +# if TAG_IS_BUILDING +# define TAG_PUBLIC TAG_ATTRIBUTE_EXPORT +# else +# define TAG_PUBLIC TAG_ATTRIBUTE_IMPORT +# endif +# define TAG_HIDDEN TAG_ATTRIBUTE_HIDDEN +#else +# define TAG_PUBLIC +# define TAG_HIDDEN +#endif +#define TAG_STATIC static + + + + +/* Extern "C" Guard */ +#ifdef __cplusplus +extern "C" { +#endif + + + +/* Function Prototypes */ +TAG_PUBLIC int run_tests(void); + + + +/* End Extern "C" and Include Guard */ +#ifdef __cplusplus +} +#endif +#endif diff --git a/test cases/cuda/4 shared/shared/meson.build b/test cases/cuda/4 shared/shared/meson.build new file mode 100644 index 0000000..61cf1d3 --- /dev/null +++ b/test cases/cuda/4 shared/shared/meson.build @@ -0,0 +1,7 @@ +libkernels = shared_library('kernels', 'kernels.cu', + cuda_args: ['-DTAG_IS_SHARED=1', '-DTAG_IS_BUILDING=1'], + gnu_symbol_visibility: 'hidden', + soversion : 1, + version : '1.2.3') +libkernels = declare_dependency(compile_args: ['-DTAG_IS_SHARED=1'], + link_with: libkernels) diff --git a/test cases/cuda/5 threads/main.cu b/test cases/cuda/5 threads/main.cu new file mode 100644 index 0000000..1235914 --- /dev/null +++ b/test cases/cuda/5 threads/main.cu @@ -0,0 +1,20 @@ +#include +#include +#include "shared/kernels.h" + + +int main(void) { + int cuda_devices = 0; + cudaGetDeviceCount(&cuda_devices); + if(cuda_devices == 0) { + printf("No Cuda hardware found. Exiting.\n"); + return 0; + } + + if(run_tests() != 0){ + printf("CUDA tests failed! Exiting.\n"); + return 0; + } + + return 0; +} diff --git a/test cases/cuda/5 threads/meson.build b/test cases/cuda/5 threads/meson.build new file mode 100644 index 0000000..2a804a3 --- /dev/null +++ b/test cases/cuda/5 threads/meson.build @@ -0,0 +1,7 @@ +project('simple', 'cuda', version : '1.0.0') + +subdir('shared') + +thread_dep = dependency('threads') +exe = executable('prog', 'main.cu', dependencies: [libkernels, thread_dep]) +test('cudatest', exe) diff --git a/test cases/cuda/5 threads/shared/kernels.cu b/test cases/cuda/5 threads/shared/kernels.cu new file mode 100644 index 0000000..5cda629 --- /dev/null +++ b/test cases/cuda/5 threads/shared/kernels.cu @@ -0,0 +1,13 @@ +#include +#include +#include "kernels.h" + + +TAG_HIDDEN __global__ void kernel (void){ +} + +TAG_PUBLIC int run_tests(void) { + kernel<<<1,1>>>(); + + return (int)cudaDeviceSynchronize(); +} diff --git a/test cases/cuda/5 threads/shared/kernels.h b/test cases/cuda/5 threads/shared/kernels.h new file mode 100644 index 0000000..dbcb99d --- /dev/null +++ b/test cases/cuda/5 threads/shared/kernels.h @@ -0,0 +1,86 @@ +/* Include Guard */ +#ifndef SHARED_KERNELS_H +#define SHARED_KERNELS_H + +/** + * Includes + */ + +#include + + +/** + * Defines + */ + +/** + * When building a library, it is a good idea to expose as few as possible + * internal symbols (functions, objects, data structures). Not only does it + * prevent users from relying on private portions of the library that are + * subject to change without any notice, but it can have performance + * advantages: + * + * - It can make shared libraries link faster at dynamic-load time. + * - It can make internal function calls faster by bypassing the PLT. + * + * Thus, the compilation should by default hide all symbols, while the API + * headers will explicitly mark public the few symbols the users are permitted + * to use with a PUBLIC tag. We also define a HIDDEN tag, since it may be + * required to explicitly tag certain C++ types as visible in order for + * exceptions to function correctly. + * + * Additional complexity comes from non-POSIX-compliant systems, which + * artificially impose a requirement on knowing whether we are building or + * using a DLL. + * + * The above commentary and below code is inspired from + * 'https://gcc.gnu.org/wiki/Visibility' + */ + +#if defined(_WIN32) || defined(__CYGWIN__) +# define TAG_ATTRIBUTE_EXPORT __declspec(dllexport) +# define TAG_ATTRIBUTE_IMPORT __declspec(dllimport) +# define TAG_ATTRIBUTE_HIDDEN +#elif __GNUC__ >= 4 +# define TAG_ATTRIBUTE_EXPORT __attribute__((visibility("default"))) +# define TAG_ATTRIBUTE_IMPORT __attribute__((visibility("default"))) +# define TAG_ATTRIBUTE_HIDDEN __attribute__((visibility("hidden"))) +#else +# define TAG_ATTRIBUTE_EXPORT +# define TAG_ATTRIBUTE_IMPORT +# define TAG_ATTRIBUTE_HIDDEN +#endif + +#if TAG_IS_SHARED +# if TAG_IS_BUILDING +# define TAG_PUBLIC TAG_ATTRIBUTE_EXPORT +# else +# define TAG_PUBLIC TAG_ATTRIBUTE_IMPORT +# endif +# define TAG_HIDDEN TAG_ATTRIBUTE_HIDDEN +#else +# define TAG_PUBLIC +# define TAG_HIDDEN +#endif +#define TAG_STATIC static + + + + +/* Extern "C" Guard */ +#ifdef __cplusplus +extern "C" { +#endif + + + +/* Function Prototypes */ +TAG_PUBLIC int run_tests(void); + + + +/* End Extern "C" and Include Guard */ +#ifdef __cplusplus +} +#endif +#endif diff --git a/test cases/cuda/5 threads/shared/meson.build b/test cases/cuda/5 threads/shared/meson.build new file mode 100644 index 0000000..5987916 --- /dev/null +++ b/test cases/cuda/5 threads/shared/meson.build @@ -0,0 +1,5 @@ +libkernels = shared_library('kernels', 'kernels.cu', + cuda_args: ['-DTAG_IS_SHARED=1', '-DTAG_IS_BUILDING=1'], + gnu_symbol_visibility: 'hidden') +libkernels = declare_dependency(compile_args: ['-DTAG_IS_SHARED=1'], + link_with: libkernels) diff --git a/test cases/cuda/6 std/main.cu b/test cases/cuda/6 std/main.cu new file mode 100644 index 0000000..a2ffba4 --- /dev/null +++ b/test cases/cuda/6 std/main.cu @@ -0,0 +1,20 @@ +#include +#include + +auto cuda_devices(void) { + int result = 0; + cudaGetDeviceCount(&result); + return result; +} + + +int main(void) { + int n = cuda_devices(); + if (n == 0) { + std::cout << "No Cuda hardware found. Exiting.\n"; + return 0; + } + + std::cout << "Found " << n << "Cuda devices.\n"; + return 0; +} diff --git a/test cases/cuda/6 std/meson.build b/test cases/cuda/6 std/meson.build new file mode 100644 index 0000000..69a6868 --- /dev/null +++ b/test cases/cuda/6 std/meson.build @@ -0,0 +1,4 @@ +project('C++ std', 'cuda', version : '1.0.0', default_options : ['cuda_std=c++14']) + +exe = executable('prog', 'main.cu') +test('cudatest', exe) diff --git a/test cases/cuda/7 static vs runtime/main.cu b/test cases/cuda/7 static vs runtime/main.cu new file mode 100644 index 0000000..bd1dbc4 --- /dev/null +++ b/test cases/cuda/7 static vs runtime/main.cu @@ -0,0 +1,20 @@ +#include +#include + +int cuda_devices(void) { + int result = 0; + cudaGetDeviceCount(&result); + return result; +} + + +int main(void) { + int n = cuda_devices(); + if (n == 0) { + std::cout << "No Cuda hardware found. Exiting.\n"; + return 0; + } + + std::cout << "Found " << n << "Cuda devices.\n"; + return 0; +} diff --git a/test cases/cuda/7 static vs runtime/meson.build b/test cases/cuda/7 static vs runtime/meson.build new file mode 100644 index 0000000..ab13304 --- /dev/null +++ b/test cases/cuda/7 static vs runtime/meson.build @@ -0,0 +1,4 @@ +project('static msvc runtime', 'cuda', version : '1.0.0', default_options : ['b_vscrt=mtd']) + +exe = executable('prog', 'main.cu') +test('cudatest', exe) diff --git a/test cases/cuda/8 release/main.cu b/test cases/cuda/8 release/main.cu new file mode 100644 index 0000000..2a98874 --- /dev/null +++ b/test cases/cuda/8 release/main.cu @@ -0,0 +1,24 @@ +#include +#include + +#ifndef NDEBUG +#error "NDEBUG not defined, this is a Meson bug" +#endif + +int cuda_devices(void) { + int result = 0; + cudaGetDeviceCount(&result); + return result; +} + + +int main(void) { + int n = cuda_devices(); + if (n == 0) { + std::cout << "No Cuda hardware found. Exiting.\n"; + return 0; + } + + std::cout << "Found " << n << "Cuda devices.\n"; + return 0; +} diff --git a/test cases/cuda/8 release/meson.build b/test cases/cuda/8 release/meson.build new file mode 100644 index 0000000..c5cad32 --- /dev/null +++ b/test cases/cuda/8 release/meson.build @@ -0,0 +1,10 @@ +project('release', 'cpp', 'cuda', version : '1.0.0', default_options : ['buildtype=release', 'b_ndebug=if-release']) + +# We don't actually need boost, but it serves as a common dependency +# that has the potential to add "-isystem/usr/include" to the compile +# line. By making it optional, we test that system search paths get +# removed without unnecessarily failing the test if boost is absent. +boost_dep = dependency('boost', include_type : 'system', required : false) + +exe = executable('prog', 'main.cu', dependencies : boost_dep) +test('cudatest', exe) diff --git a/test cases/cuda/9 optimize for space/main.cu b/test cases/cuda/9 optimize for space/main.cu new file mode 100644 index 0000000..bd1dbc4 --- /dev/null +++ b/test cases/cuda/9 optimize for space/main.cu @@ -0,0 +1,20 @@ +#include +#include + +int cuda_devices(void) { + int result = 0; + cudaGetDeviceCount(&result); + return result; +} + + +int main(void) { + int n = cuda_devices(); + if (n == 0) { + std::cout << "No Cuda hardware found. Exiting.\n"; + return 0; + } + + std::cout << "Found " << n << "Cuda devices.\n"; + return 0; +} diff --git a/test cases/cuda/9 optimize for space/meson.build b/test cases/cuda/9 optimize for space/meson.build new file mode 100644 index 0000000..cd6ac05 --- /dev/null +++ b/test cases/cuda/9 optimize for space/meson.build @@ -0,0 +1,4 @@ +project('optimize for space', 'cuda', version : '1.0.0', default_options : ['optimization=s']) + +exe = executable('prog', 'main.cu') +test('cudatest', exe) diff --git a/test cases/cython/1 basic/cytest.py b/test cases/cython/1 basic/cytest.py new file mode 100755 index 0000000..c08ffee --- /dev/null +++ b/test cases/cython/1 basic/cytest.py @@ -0,0 +1,19 @@ +#!/usr/bin/env python3 + +from storer import Storer + +s = Storer() + +if s.get_value() != 0: + raise SystemExit('Initial value incorrect.') + +s.set_value(42) + +if s.get_value() != 42: + raise SystemExit('Setting value failed.') + +try: + s.set_value('not a number') + raise SystemExit('Using wrong argument type did not fail.') +except TypeError: + pass diff --git a/test cases/cython/1 basic/libdir/cstorer.pxd b/test cases/cython/1 basic/libdir/cstorer.pxd new file mode 100644 index 0000000..7b730fc --- /dev/null +++ b/test cases/cython/1 basic/libdir/cstorer.pxd @@ -0,0 +1,9 @@ + +cdef extern from "storer.h": + ctypedef struct Storer: + pass + + Storer* storer_new(); + void storer_destroy(Storer *s); + int storer_get_value(Storer *s); + void storer_set_value(Storer *s, int v); diff --git a/test cases/cython/1 basic/libdir/meson.build b/test cases/cython/1 basic/libdir/meson.build new file mode 100644 index 0000000..144bb1f --- /dev/null +++ b/test cases/cython/1 basic/libdir/meson.build @@ -0,0 +1,8 @@ +slib = py3.extension_module( + 'storer', + 'storer.pyx', + 'storer.c', + dependencies : py3_dep +) + +pydir = meson.current_build_dir() diff --git a/test cases/cython/1 basic/libdir/storer.c b/test cases/cython/1 basic/libdir/storer.c new file mode 100644 index 0000000..0199bb8 --- /dev/null +++ b/test cases/cython/1 basic/libdir/storer.c @@ -0,0 +1,24 @@ +#include"storer.h" +#include + +struct _Storer { + int value; +}; + +Storer* storer_new() { + Storer *s = malloc(sizeof(struct _Storer)); + s->value = 0; + return s; +} + +void storer_destroy(Storer *s) { + free(s); +} + +int storer_get_value(Storer *s) { + return s->value; +} + +void storer_set_value(Storer *s, int v) { + s->value = v; +} diff --git a/test cases/cython/1 basic/libdir/storer.h b/test cases/cython/1 basic/libdir/storer.h new file mode 100644 index 0000000..6f5bc6f --- /dev/null +++ b/test cases/cython/1 basic/libdir/storer.h @@ -0,0 +1,16 @@ +#pragma once + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct _Storer Storer; + +Storer* storer_new(); +void storer_destroy(Storer *s); +int storer_get_value(Storer *s); +void storer_set_value(Storer *s, int v); + +#ifdef __cplusplus +} +#endif diff --git a/test cases/cython/1 basic/libdir/storer.pyx b/test cases/cython/1 basic/libdir/storer.pyx new file mode 100644 index 0000000..ed551dc --- /dev/null +++ b/test cases/cython/1 basic/libdir/storer.pyx @@ -0,0 +1,16 @@ +cimport cstorer + +cdef class Storer: + cdef cstorer.Storer* _c_storer + + def __cinit__(self): + self._c_storer = cstorer.storer_new() + + def __dealloc__(self): + cstorer.storer_destroy(self._c_storer) + + cpdef int get_value(self): + return cstorer.storer_get_value(self._c_storer) + + cpdef set_value(self, int value): + cstorer.storer_set_value(self._c_storer, value) diff --git a/test cases/cython/1 basic/meson.build b/test cases/cython/1 basic/meson.build new file mode 100644 index 0000000..8c24e23 --- /dev/null +++ b/test cases/cython/1 basic/meson.build @@ -0,0 +1,20 @@ +project( + 'basic cython project', + ['cython', 'c'], + default_options : ['warning_level=3'] +) + +py_mod = import('python') +py3 = py_mod.find_installation() +py3_dep = py3.dependency(required : false) +if not py3_dep.found() + error('MESON_SKIP_TEST: Python library not found.') +endif + +subdir('libdir') + +test('cython tester', + py3, + args : files('cytest.py'), + env : ['PYTHONPATH=' + pydir] +) diff --git a/test cases/cython/1 basic/test.json b/test cases/cython/1 basic/test.json new file mode 100644 index 0000000..ed7ac2b --- /dev/null +++ b/test cases/cython/1 basic/test.json @@ -0,0 +1,10 @@ +{ + "matrix": { + "options": { + "cython_language": [ + { "val": "c" }, + { "val": "cpp" } + ] + } + } +} diff --git a/test cases/cython/2 generated sources/configure.pyx.in b/test cases/cython/2 generated sources/configure.pyx.in new file mode 100644 index 0000000..1c44f6d --- /dev/null +++ b/test cases/cython/2 generated sources/configure.pyx.in @@ -0,0 +1,2 @@ +cpdef func(): + return "Hello, World!" diff --git a/test cases/cython/2 generated sources/g.in b/test cases/cython/2 generated sources/g.in new file mode 100644 index 0000000..1c44f6d --- /dev/null +++ b/test cases/cython/2 generated sources/g.in @@ -0,0 +1,2 @@ +cpdef func(): + return "Hello, World!" diff --git a/test cases/cython/2 generated sources/gen.py b/test cases/cython/2 generated sources/gen.py new file mode 100644 index 0000000..5c0a82d --- /dev/null +++ b/test cases/cython/2 generated sources/gen.py @@ -0,0 +1,14 @@ +# SPDX-License-Identifier: Apache-2.0 + +import argparse +import textwrap + +parser = argparse.ArgumentParser() +parser.add_argument('output') +args = parser.parse_args() + +with open(args.output, 'w') as f: + f.write(textwrap.dedent('''\ + cpdef func(): + return "Hello, World!" + ''')) diff --git a/test cases/cython/2 generated sources/generator.py b/test cases/cython/2 generated sources/generator.py new file mode 100755 index 0000000..9b0d94a --- /dev/null +++ b/test cases/cython/2 generated sources/generator.py @@ -0,0 +1,12 @@ +#!/usr/bin/env python3 +# SPDX-License-Identifier: Apache-2.0 + +import argparse + +parser = argparse.ArgumentParser() +parser.add_argument('input') +parser.add_argument('output') +args = parser.parse_args() + +with open(args.input) as i, open(args.output, 'w') as o: + o.write(i.read()) diff --git a/test cases/cython/2 generated sources/includestuff.pyx b/test cases/cython/2 generated sources/includestuff.pyx new file mode 100644 index 0000000..83f881b --- /dev/null +++ b/test cases/cython/2 generated sources/includestuff.pyx @@ -0,0 +1 @@ +include "stuff.pxi" diff --git a/test cases/cython/2 generated sources/libdir/gen.py b/test cases/cython/2 generated sources/libdir/gen.py new file mode 100644 index 0000000..5c0a82d --- /dev/null +++ b/test cases/cython/2 generated sources/libdir/gen.py @@ -0,0 +1,14 @@ +# SPDX-License-Identifier: Apache-2.0 + +import argparse +import textwrap + +parser = argparse.ArgumentParser() +parser.add_argument('output') +args = parser.parse_args() + +with open(args.output, 'w') as f: + f.write(textwrap.dedent('''\ + cpdef func(): + return "Hello, World!" + ''')) diff --git a/test cases/cython/2 generated sources/libdir/meson.build b/test cases/cython/2 generated sources/libdir/meson.build new file mode 100644 index 0000000..e9259bd --- /dev/null +++ b/test cases/cython/2 generated sources/libdir/meson.build @@ -0,0 +1,10 @@ +ct2 = custom_target( + 'ct2', + input : 'gen.py', + output : 'ct2.pyx', + command : [py3, '@INPUT@', '@OUTPUT@'], +) + +ct2_ext = py3.extension_module('ct2', ct2, dependencies : py3_dep) + +pydir = meson.current_build_dir() diff --git a/test cases/cython/2 generated sources/meson.build b/test cases/cython/2 generated sources/meson.build new file mode 100644 index 0000000..498e319 --- /dev/null +++ b/test cases/cython/2 generated sources/meson.build @@ -0,0 +1,105 @@ +project( + 'generated cython sources', + ['cython'], +) + +py_mod = import('python') +py3 = py_mod.find_installation('python3') +py3_dep = py3.dependency(required : false) +fs = import('fs') +if not py3_dep.found() + error('MESON_SKIP_TEST: Python library not found.') +endif + +ct = custom_target( + 'ct', + input : 'gen.py', + output : 'ct.pyx', + command : [py3, '@INPUT@', '@OUTPUT@'], +) + +ct_ext = py3.extension_module('ct', ct, dependencies : py3_dep) + +test( + 'custom target', + py3, + args : [files('test.py'), 'ct'], + env : ['PYTHONPATH=' + meson.current_build_dir()] +) + +# Test a CustomTargetIndex +cti = custom_target( + 'cti', + input : 'gen.py', + output : 'cti.pyx', + command : [py3, '@INPUT@', '@OUTPUT@'], +) + +cti_ext = py3.extension_module('cti', cti[0], dependencies : py3_dep) + +cf = configure_file( + input : 'configure.pyx.in', + output : 'cf.pyx', + copy : true, +) + +cf_ext = py3.extension_module('cf', cf, dependencies : py3_dep) + +test( + 'configure file', + py3, + args : [files('test.py'), 'cf'], + env : ['PYTHONPATH=' + meson.current_build_dir()] +) + +gen = generator( + find_program('generator.py'), + arguments : ['@INPUT@', '@OUTPUT@'], + output : '@BASENAME@.pyx', +) + +g_ext = py3.extension_module( + 'g', + gen.process('g.in'), + dependencies : py3_dep, +) + +test( + 'generator', + py3, + args : [files('test.py'), 'g'], + env : ['PYTHONPATH=' + meson.current_build_dir()] +) + +stuff_pxi = fs.copyfile( + 'stuff.pxi.in', + 'stuff.pxi' +) + +# Need to copy the cython source to the build directory +# since meson can only generate the .pxi there +includestuff_pyx = fs.copyfile( + 'includestuff.pyx' +) + +stuff_pxi_dep = declare_dependency(sources: stuff_pxi) + +includestuff_ext = py3.extension_module( + 'includestuff', + includestuff_pyx, + dependencies: stuff_pxi_dep +) + +simpleinclude_ext = py3.extension_module( + 'simpleinclude', + 'simpleinclude.pyx', +) + +subdir('libdir') + +test( + 'custom target in subdir', + py3, + args : [files('test.py'), 'ct2'], + env : ['PYTHONPATH=' + pydir] +) diff --git a/test cases/cython/2 generated sources/simpleinclude.pyx b/test cases/cython/2 generated sources/simpleinclude.pyx new file mode 100644 index 0000000..c110f75 --- /dev/null +++ b/test cases/cython/2 generated sources/simpleinclude.pyx @@ -0,0 +1 @@ +include "simplestuff.pxi" diff --git a/test cases/cython/2 generated sources/simplestuff.pxi b/test cases/cython/2 generated sources/simplestuff.pxi new file mode 100644 index 0000000..2645216 --- /dev/null +++ b/test cases/cython/2 generated sources/simplestuff.pxi @@ -0,0 +1,2 @@ +def func2(): + print("Hello world") diff --git a/test cases/cython/2 generated sources/stuff.pxi.in b/test cases/cython/2 generated sources/stuff.pxi.in new file mode 100644 index 0000000..6417cbc --- /dev/null +++ b/test cases/cython/2 generated sources/stuff.pxi.in @@ -0,0 +1,2 @@ +def func(): + print("Hello world") diff --git a/test cases/cython/2 generated sources/test.py b/test cases/cython/2 generated sources/test.py new file mode 100644 index 0000000..307283f --- /dev/null +++ b/test cases/cython/2 generated sources/test.py @@ -0,0 +1,13 @@ +#!/usr/bin/env python3 +# SPDX-License-Identifier: Apache-2.0 + +import argparse +import importlib + +parser = argparse.ArgumentParser() +parser.add_argument('mod') +args = parser.parse_args() + +mod = importlib.import_module(args.mod) + +assert mod.func() == 'Hello, World!' diff --git a/test cases/cython/3 cython_args/cythonargs.pyx b/test cases/cython/3 cython_args/cythonargs.pyx new file mode 100644 index 0000000..2b220a7 --- /dev/null +++ b/test cases/cython/3 cython_args/cythonargs.pyx @@ -0,0 +1,5 @@ +def test(): + IF VALUE: + return 1 + ELSE: + return 0 diff --git a/test cases/cython/3 cython_args/meson.build b/test cases/cython/3 cython_args/meson.build new file mode 100644 index 0000000..e41d1b7 --- /dev/null +++ b/test cases/cython/3 cython_args/meson.build @@ -0,0 +1,30 @@ +project('cython_args', ['cython', 'c']) + +pymod = import('python') +python = pymod.find_installation('python3') +python_dep = python.dependency() +if not python_dep.found() + error('MESON_SKIP_TEST: Python library not found.') +endif + +mod = python.extension_module( + 'cythonargs', + files('cythonargs.pyx'), + cython_args: [ + '--compile-time-env', + 'VALUE=1' + ], + dependencies: [python_dep] +) + +test( + 'test', + python, + args: [ + 'test.py' + ], + workdir: meson.current_source_dir(), + env: environment({ + 'PYTHONPATH': meson.current_build_dir(), + }) +) diff --git a/test cases/cython/3 cython_args/test.py b/test cases/cython/3 cython_args/test.py new file mode 100644 index 0000000..bd8a152 --- /dev/null +++ b/test cases/cython/3 cython_args/test.py @@ -0,0 +1,3 @@ +import cythonargs + +assert cythonargs.test() == 1 diff --git a/test cases/d/1 simple/app.d b/test cases/d/1 simple/app.d new file mode 100644 index 0000000..0be1d2c --- /dev/null +++ b/test cases/d/1 simple/app.d @@ -0,0 +1,8 @@ + +import std.stdio; +import utils; + +void main () +{ + printGreeting ("a Meson D test"); +} diff --git a/test cases/d/1 simple/meson.build b/test cases/d/1 simple/meson.build new file mode 100644 index 0000000..a10b67b --- /dev/null +++ b/test cases/d/1 simple/meson.build @@ -0,0 +1,4 @@ +project('D Simple Test', 'd') + +e = executable('dsimpleapp', ['app.d', 'utils.d'], install : true) +test('apptest', e) diff --git a/test cases/d/1 simple/test.json b/test cases/d/1 simple/test.json new file mode 100644 index 0000000..62f907a --- /dev/null +++ b/test cases/d/1 simple/test.json @@ -0,0 +1,6 @@ +{ + "installed": [ + {"type": "exe", "file": "usr/bin/dsimpleapp"}, + {"type": "pdb", "file": "usr/bin/dsimpleapp", "language": "d"} + ] +} diff --git a/test cases/d/1 simple/utils.d b/test cases/d/1 simple/utils.d new file mode 100644 index 0000000..8645548 --- /dev/null +++ b/test cases/d/1 simple/utils.d @@ -0,0 +1,8 @@ + +import std.stdio; +import std.string : format; + +void printGreeting (string name) +{ + writeln ("Hello, I am %s.".format (name)); +} diff --git a/test cases/d/10 d cpp/cppmain.cpp b/test cases/d/10 d cpp/cppmain.cpp new file mode 100644 index 0000000..bcd8c7a --- /dev/null +++ b/test cases/d/10 d cpp/cppmain.cpp @@ -0,0 +1,18 @@ +extern "C" int rt_init(); +extern "C" int rt_term(); +extern void print_hello(int i); + +int main(int, char**) { + // initialize D runtime + if (!rt_init()) + return 1; + + print_hello(1); + + // terminate D runtime, each initialize call + // must be paired with a terminate call. + if (!rt_term()) + return 1; + + return 0; +} diff --git a/test cases/d/10 d cpp/dmain.d b/test cases/d/10 d cpp/dmain.d new file mode 100644 index 0000000..bece25f --- /dev/null +++ b/test cases/d/10 d cpp/dmain.d @@ -0,0 +1,5 @@ +extern (C++) void print_hello(int i); + +void main() { + print_hello(1); +} diff --git a/test cases/d/10 d cpp/libfile.cpp b/test cases/d/10 d cpp/libfile.cpp new file mode 100644 index 0000000..2ea67fc --- /dev/null +++ b/test cases/d/10 d cpp/libfile.cpp @@ -0,0 +1,5 @@ +#include + +void print_hello(int i) { + std::cout << "Hello. Here is a number printed with C++: " << i << ".\n"; +} diff --git a/test cases/d/10 d cpp/libfile.d b/test cases/d/10 d cpp/libfile.d new file mode 100644 index 0000000..88cb53e --- /dev/null +++ b/test cases/d/10 d cpp/libfile.d @@ -0,0 +1,5 @@ +import std.stdio; + +extern (C++) void print_hello(int i) { + writefln("Hello. Here is a number printed with D: %d", i); +} diff --git a/test cases/d/10 d cpp/meson.build b/test cases/d/10 d cpp/meson.build new file mode 100644 index 0000000..eecb151 --- /dev/null +++ b/test cases/d/10 d cpp/meson.build @@ -0,0 +1,13 @@ +project('d and c++', 'd', 'cpp') + +cpp = meson.get_compiler('cpp') + +if cpp.get_id() == 'clang' + error('MESON_SKIP_TEST combining Clang C++ with GDC produces broken executables.') +endif + +e1 = executable('dcpp', 'dmain.d', 'libfile.cpp') +test('dcpp', e1) + +e2 = executable('cppd', 'cppmain.cpp', 'libfile.d') +test('cppd', e2) diff --git a/test cases/d/11 dub/.gitignore b/test cases/d/11 dub/.gitignore new file mode 100644 index 0000000..da3feeb --- /dev/null +++ b/test cases/d/11 dub/.gitignore @@ -0,0 +1 @@ +dub.json diff --git a/test cases/d/11 dub/meson.build b/test cases/d/11 dub/meson.build new file mode 100644 index 0000000..d852ca0 --- /dev/null +++ b/test cases/d/11 dub/meson.build @@ -0,0 +1,23 @@ +project('dub-example', 'd') + +dub_exe = find_program('dub', required : false) +if not dub_exe.found() + error('MESON_SKIP_TEST: Dub not found') +endif + +urld_dep = dependency('urld', method: 'dub') + +test_exe = executable('test-urld', 'test.d', dependencies: urld_dep) +test('test urld', test_exe) + +# If you want meson to generate/update a dub.json file +dlang = import('dlang') +dlang.generate_dub_file(meson.project_name().to_lower(), meson.source_root(), + authors: 'Meson Team', + description: 'Test executable', + copyright: 'Copyright © 2018, Meson Team', + license: 'MIT', + sourceFiles: 'test.d', + targetType: 'executable', + dependencies: urld_dep +) \ No newline at end of file diff --git a/test cases/d/11 dub/test.d b/test cases/d/11 dub/test.d new file mode 100644 index 0000000..7cf7a1d --- /dev/null +++ b/test cases/d/11 dub/test.d @@ -0,0 +1,14 @@ +import std.stdio; +import url; + +void main() { + URL url; + with (url) { + scheme = "soap.beep"; + host = "beep.example.net"; + port = 1772; + path = "/serverinfo/info"; + queryParams.add("token", "my-api-token"); + } + writeln(url); +} \ No newline at end of file diff --git a/test cases/d/12 root include directory/meson.build b/test cases/d/12 root include directory/meson.build new file mode 100644 index 0000000..9501615 --- /dev/null +++ b/test cases/d/12 root include directory/meson.build @@ -0,0 +1,7 @@ +project('some', 'd') + +project_dep = declare_dependency( + include_directories: ['.'], +) +subdir('some') + diff --git a/test cases/d/12 root include directory/some/dlang/code.d b/test cases/d/12 root include directory/some/dlang/code.d new file mode 100644 index 0000000..0dd82a4 --- /dev/null +++ b/test cases/d/12 root include directory/some/dlang/code.d @@ -0,0 +1,7 @@ +void foo() {} + +version (Windows) +{ + import core.sys.windows.dll; + mixin SimpleDllMain; +} diff --git a/test cases/d/12 root include directory/some/dlang/meson.build b/test cases/d/12 root include directory/some/dlang/meson.build new file mode 100644 index 0000000..3f958b1 --- /dev/null +++ b/test cases/d/12 root include directory/some/dlang/meson.build @@ -0,0 +1,8 @@ +code_lib = library('code', + ['code.d'], + dependencies: [project_dep]) + +code_dep = declare_dependency( + link_with: code_lib, + dependencies: project_dep +) \ No newline at end of file diff --git a/test cases/d/12 root include directory/some/meson.build b/test cases/d/12 root include directory/some/meson.build new file mode 100644 index 0000000..a549c09 --- /dev/null +++ b/test cases/d/12 root include directory/some/meson.build @@ -0,0 +1 @@ +subdir('dlang') \ No newline at end of file diff --git a/test cases/d/13 declare dep/meson.build b/test cases/d/13 declare dep/meson.build new file mode 100644 index 0000000..eef9816 --- /dev/null +++ b/test cases/d/13 declare dep/meson.build @@ -0,0 +1,13 @@ +project('meson-d-sample', 'd', + version: '0.1.0', +) + +my_dep = declare_dependency( + d_module_versions: ['TestVersion', 1], + d_import_dirs: include_directories('views'), +) + +test_exe = executable('test-dep', 'test.d', + dependencies: my_dep, +) +test('test d features in declare_dependency', test_exe) diff --git a/test cases/d/13 declare dep/test.d b/test cases/d/13 declare dep/test.d new file mode 100644 index 0000000..3a89921 --- /dev/null +++ b/test cases/d/13 declare dep/test.d @@ -0,0 +1,15 @@ +module test; + + +int main() +{ + version(TestVersion) + { + enum testPhrase = import("test.txt"); + return testPhrase == "TEST PHRASE" ? 0 : 1; + } + else + { + return 1; + } +} diff --git a/test cases/d/13 declare dep/views/test.txt b/test cases/d/13 declare dep/views/test.txt new file mode 100644 index 0000000..19046d0 --- /dev/null +++ b/test cases/d/13 declare dep/views/test.txt @@ -0,0 +1 @@ +TEST PHRASE \ No newline at end of file diff --git a/test cases/d/14 dub with deps/meson.build b/test cases/d/14 dub with deps/meson.build new file mode 100644 index 0000000..08f3080 --- /dev/null +++ b/test cases/d/14 dub with deps/meson.build @@ -0,0 +1,34 @@ +project('dub-with-deps-example', ['d']) + +dub_exe = find_program('dub', required : false) +if not dub_exe.found() + error('MESON_SKIP_TEST: Dub not found') +endif + +if meson.get_compiler('d').get_id() == 'gcc' + error('MESON_SKIP_TEST: can\'t build dependencies with GDC') +elif meson.get_compiler('d').get_id() == 'llvm' + dc = 'ldc2' +elif meson.get_compiler('d').get_id() == 'dmd' + dc = 'dmd' +endif + +arch = host_machine.cpu_family() + +if host_machine.system() == 'windows' + # check if toolchain is 32bits + sz = meson.get_compiler('d').sizeof('void*') + if arch == 'x86' or sz == 4 + arch = 'x86_mscoff' + endif +endif + +run_command('dub', 'run', 'dub-build-deep', '--yes', '--', 'xlsx', '--compiler', dc, '--arch', arch, + check: true, +) + +xlsx_dep = dependency('xlsx', method: 'dub') + +test_exe = executable('test-test6', 'test.d', dependencies: xlsx_dep) + +test('test dub with deps', test_exe) diff --git a/test cases/d/14 dub with deps/test.d b/test cases/d/14 dub with deps/test.d new file mode 100644 index 0000000..61b5bda --- /dev/null +++ b/test cases/d/14 dub with deps/test.d @@ -0,0 +1,59 @@ +module test; + +// testing import dirs +import xlsx; + +// dependency of xlsx +import dxml.dom; + +const xml = "\n" ~ + "\n" ~ + " some text\n" ~ + " \n" ~ + " \n" ~ + ""; + +int main() +{ + // testing versions + version (Have_dxml) + { + import std.range.primitives : empty; + + auto dom = parseDOM(xml); + assert(dom.type == EntityType.elementStart); + assert(dom.name.empty); + assert(dom.children.length == 2); + + assert(dom.children[0].type == EntityType.comment); + assert(dom.children[0].text == " comment "); + + auto root = dom.children[1]; + assert(root.type == EntityType.elementStart); + assert(root.name == "root"); + assert(root.children.length == 3); + + auto foo = root.children[0]; + assert(foo.type == EntityType.elementStart); + assert(foo.name == "foo"); + assert(foo.children.length == 2); + + assert(foo.children[0].type == EntityType.text); + assert(foo.children[0].text == "some text"); + + assert(foo.children[1].type == EntityType.elementEmpty); + assert(foo.children[1].name == "whatever"); + + assert(root.children[1].type == EntityType.elementEmpty); + assert(root.children[1].name == "bar"); + + assert(root.children[2].type == EntityType.elementStart); + assert(root.children[2].name == "baz"); + assert(root.children[2].children.length == 0); + return 0; + } + else + { + return 1; + } +} diff --git a/test cases/d/15 compiler run checks/meson.build b/test cases/d/15 compiler run checks/meson.build new file mode 100644 index 0000000..a80e528 --- /dev/null +++ b/test cases/d/15 compiler run checks/meson.build @@ -0,0 +1,50 @@ +project('test-d-run-checks', 'd') + +dc = meson.get_compiler('d') + +run_sizeof = dc.run('int main() { return (void*).sizeof; }') +if run_sizeof.returncode() == 8 + run_versions = ['Is64bits'] +elif run_sizeof.returncode() == 4 + run_versions = ['Is32bits'] +endif +run_sizeof_exe = executable('run_sizeof', 'test_sizeof.d', + d_module_versions: run_versions, +) +test('test D compiler run', run_sizeof_exe) + +sizeof_sizeof = dc.sizeof('void*') +if sizeof_sizeof == 8 + run_versions = ['Is64bits'] +elif sizeof_sizeof == 4 + run_versions = ['Is32bits'] +endif +sizeof_sizeof_exe = executable('sizeof_sizeof', 'test_sizeof.d', + d_module_versions: run_versions, +) +test('test D compiler sizeof', sizeof_sizeof_exe) + +if not dc.has_header('std.stdio') + error('Could not find std.stdio import') +endif + +if dc.has_header('not_a_d_module') + error('has_header inconsistent result') +endif + +# same checks as C/C++ alignments (D has same alignment requirements as C) + +# These tests should return the same value on all +# platforms. If (and when) they don't, fix 'em up. +if dc.alignment('char') != 1 +error('Alignment of char misdetected.') +endif + +dbl_alignment = dc.alignment('double') + +if dbl_alignment == 8 or dbl_alignment == 4 +message('Alignment of double ok.') +else +error('Alignment of double misdetected.') +endif + diff --git a/test cases/d/15 compiler run checks/test_sizeof.d b/test cases/d/15 compiler run checks/test_sizeof.d new file mode 100644 index 0000000..c7099d0 --- /dev/null +++ b/test cases/d/15 compiler run checks/test_sizeof.d @@ -0,0 +1,17 @@ +module test_sizeof; + +alias voidp = void*; + +int main() +{ + version(Is64bits) { + enum expectedSz = 8; + } + else version(Is32bits) { + enum expectedSz = 4; + } + else { + assert(false, "No version set!"); + } + return expectedSz == voidp.sizeof ? 0 : 1; +} diff --git a/test cases/d/16 code generation/exe.d b/test cases/d/16 code generation/exe.d new file mode 100644 index 0000000..0e24d6d --- /dev/null +++ b/test cases/d/16 code generation/exe.d @@ -0,0 +1,9 @@ +module exe; + +import generated; +import std.stdio; + +int main() +{ + return generatedString() == "Some text to be returned by generated code" ? 0 : 1; +} diff --git a/test cases/d/16 code generation/generator.d b/test cases/d/16 code generation/generator.d new file mode 100644 index 0000000..f944dd3 --- /dev/null +++ b/test cases/d/16 code generation/generator.d @@ -0,0 +1,13 @@ +module generator; + +import std.file; +import std.stdio; +import std.string; + +void main(string[] args) +{ + const text = cast(string)read(args[1]); + + writeln("module generated;"); + writefln!`string generatedString() { return "%s"; }`(text.strip()); +} diff --git a/test cases/d/16 code generation/input.txt b/test cases/d/16 code generation/input.txt new file mode 100644 index 0000000..aebcda8 --- /dev/null +++ b/test cases/d/16 code generation/input.txt @@ -0,0 +1 @@ +Some text to be returned by generated code diff --git a/test cases/d/16 code generation/meson.build b/test cases/d/16 code generation/meson.build new file mode 100644 index 0000000..2418aca --- /dev/null +++ b/test cases/d/16 code generation/meson.build @@ -0,0 +1,18 @@ +project('meson-dep-test', 'd') + +generator = executable('generator', 'generator.d') + +generated = custom_target('generated', + capture: true, + output: 'generated.d', + input: 'input.txt', + command: [ + generator, '@INPUT@' + ] +) + +exe = executable('exe', generated, 'exe.d', + include_directories: include_directories('.'), +) + +test('test exe', exe) diff --git a/test cases/d/2 static library/app.d b/test cases/d/2 static library/app.d new file mode 100644 index 0000000..5d84a69 --- /dev/null +++ b/test cases/d/2 static library/app.d @@ -0,0 +1,8 @@ + +import libstuff; + +void main () +{ + immutable ret = printLibraryString ("foo"); + assert (ret == 4); +} diff --git a/test cases/d/2 static library/libstuff.d b/test cases/d/2 static library/libstuff.d new file mode 100644 index 0000000..fd3b4d0 --- /dev/null +++ b/test cases/d/2 static library/libstuff.d @@ -0,0 +1,9 @@ + +import std.stdio; +import std.string : format; + +int printLibraryString (string str) +{ + writeln ("Static Library says: %s".format (str)); + return 4; +} diff --git a/test cases/d/2 static library/meson.build b/test cases/d/2 static library/meson.build new file mode 100644 index 0000000..88ed2cb --- /dev/null +++ b/test cases/d/2 static library/meson.build @@ -0,0 +1,5 @@ +project('D Static Library', 'd') + +lstatic = static_library('stuff', 'libstuff.d', install : true) +es = executable('app_s', 'app.d', link_with : lstatic, install : true) +test('linktest_static', es) diff --git a/test cases/d/2 static library/test.json b/test cases/d/2 static library/test.json new file mode 100644 index 0000000..6abb934 --- /dev/null +++ b/test cases/d/2 static library/test.json @@ -0,0 +1,7 @@ +{ + "installed": [ + {"type": "exe", "file": "usr/bin/app_s"}, + {"type": "pdb", "file": "usr/bin/app_s", "language": "d"}, + {"type": "file", "file": "usr/lib/libstuff.a"} + ] +} diff --git a/test cases/d/3 shared library/app.d b/test cases/d/3 shared library/app.d new file mode 100644 index 0000000..5d84a69 --- /dev/null +++ b/test cases/d/3 shared library/app.d @@ -0,0 +1,8 @@ + +import libstuff; + +void main () +{ + immutable ret = printLibraryString ("foo"); + assert (ret == 4); +} diff --git a/test cases/d/3 shared library/libstuff.d b/test cases/d/3 shared library/libstuff.d new file mode 100644 index 0000000..8205490 --- /dev/null +++ b/test cases/d/3 shared library/libstuff.d @@ -0,0 +1,14 @@ +import std.stdio; +import std.string : format; + +export int printLibraryString (string str) +{ + writeln ("Library says: %s".format (str)); + return 4; +} + +version (Windows) +{ + import core.sys.windows.dll; + mixin SimpleDllMain; +} diff --git a/test cases/d/3 shared library/libstuff.di b/test cases/d/3 shared library/libstuff.di new file mode 100644 index 0000000..b6454b1 --- /dev/null +++ b/test cases/d/3 shared library/libstuff.di @@ -0,0 +1,3 @@ +module libstuff; + +int printLibraryString (string str); diff --git a/test cases/d/3 shared library/lld-test.py b/test cases/d/3 shared library/lld-test.py new file mode 100644 index 0000000..3f32f59 --- /dev/null +++ b/test cases/d/3 shared library/lld-test.py @@ -0,0 +1,20 @@ +#!/usr/bin/env python3 + +import argparse +import subprocess + +def main(): + parser = argparse.ArgumentParser() + parser.add_argument('ldd') + parser.add_argument('bin') + args = parser.parse_args() + + p, o, _ = subprocess.run([args.ldd, args.bin], stdout=subprocess.PIPE) + assert p == 0 + o = o.decode() + assert 'libstuff.so =>' in o, 'libstuff so not in linker path.' + assert 'libstuff.so => not found' not in o, 'libstuff.so not found correctly' + + +if __name__ == '__main__': + main() diff --git a/test cases/d/3 shared library/meson.build b/test cases/d/3 shared library/meson.build new file mode 100644 index 0000000..fa41779 --- /dev/null +++ b/test cases/d/3 shared library/meson.build @@ -0,0 +1,26 @@ +project('D Shared Library', 'd') + +dc = meson.get_compiler('d') +if dc.get_id() == 'gcc' + if dc.version().version_compare('< 8') + error('MESON_SKIP_TEST: GDC < 8.0 can not build shared libraries') + endif +endif + +subdir('sub') +ed = executable('app_d', 'app.d', link_with : ldyn, install : true) +test('linktest_dyn', ed) + +# test D attributes for pkg-config +pkgc = import('pkgconfig') +pkgc.generate(name: 'test', + libraries: ldyn, + subdirs: 'd/stuff', + description: 'A test of D attributes to pkgconfig.generate.', + d_module_versions: ['Use_Static'] +) + +ldd = find_program('ldd', required : false) +if ldd.found() + test('ldd-test.py', ed) +endif diff --git a/test cases/d/3 shared library/sub/libstuff.d b/test cases/d/3 shared library/sub/libstuff.d new file mode 100644 index 0000000..8205490 --- /dev/null +++ b/test cases/d/3 shared library/sub/libstuff.d @@ -0,0 +1,14 @@ +import std.stdio; +import std.string : format; + +export int printLibraryString (string str) +{ + writeln ("Library says: %s".format (str)); + return 4; +} + +version (Windows) +{ + import core.sys.windows.dll; + mixin SimpleDllMain; +} diff --git a/test cases/d/3 shared library/sub/meson.build b/test cases/d/3 shared library/sub/meson.build new file mode 100644 index 0000000..1599a33 --- /dev/null +++ b/test cases/d/3 shared library/sub/meson.build @@ -0,0 +1 @@ +ldyn = shared_library('stuff', 'libstuff.d', install : true) diff --git a/test cases/d/3 shared library/test.json b/test cases/d/3 shared library/test.json new file mode 100644 index 0000000..50eb9cb --- /dev/null +++ b/test cases/d/3 shared library/test.json @@ -0,0 +1,11 @@ +{ + "installed": [ + {"type": "exe", "file": "usr/bin/app_d"}, + {"type": "pdb", "file": "usr/bin/app_d", "language": "d"}, + {"type": "shared_lib", "platform": "msvc", "file": "usr/bin/stuff"}, + {"type": "pdb", "file": "usr/bin/stuff", "language": "d"}, + {"type": "shared_lib", "platform": "gcc", "file": "usr/lib/stuff"}, + {"type": "file", "platform": "msvc", "file": "usr/lib/stuff.lib"}, + {"type": "file", "file": "usr/lib/pkgconfig/test.pc"} + ] +} diff --git a/test cases/d/4 library versions/lib.d b/test cases/d/4 library versions/lib.d new file mode 100644 index 0000000..f1e177d --- /dev/null +++ b/test cases/d/4 library versions/lib.d @@ -0,0 +1,16 @@ + +import std.stdio; +import std.string : format; + +@safe +export int printLibraryString (string str) +{ + writeln ("Library says: %s".format (str)); + return 4; +} + +version (Windows) +{ + import core.sys.windows.dll; + mixin SimpleDllMain; +} diff --git a/test cases/d/4 library versions/meson.build b/test cases/d/4 library versions/meson.build new file mode 100644 index 0000000..c745b92 --- /dev/null +++ b/test cases/d/4 library versions/meson.build @@ -0,0 +1,25 @@ +project('D library versions', 'd') + +dc = meson.get_compiler('d') +if dc.get_id() == 'gcc' + if dc.version().version_compare('< 8') + error('MESON_SKIP_TEST: GDC < 8.0 can not build shared libraries') + endif +endif + +shared_library('some', 'lib.d', + version : '1.2.3', + soversion : '0', + install : true) + +shared_library('noversion', 'lib.d', + install : true) + +shared_library('onlyversion', 'lib.d', + version : '1.4.5', + install : true) + +shared_library('onlysoversion', 'lib.d', + # Also test that int soversion is acceptable + soversion : 5, + install : true) diff --git a/test cases/d/4 library versions/test.json b/test cases/d/4 library versions/test.json new file mode 100644 index 0000000..23c95dd --- /dev/null +++ b/test cases/d/4 library versions/test.json @@ -0,0 +1,25 @@ +{ + "installed": [ + {"type": "shared_lib", "platform": "gcc", "file": "usr/lib/some"}, + {"type": "shared_lib", "platform": "gcc", "file": "usr/lib/some", "version": "0"}, + {"type": "shared_lib", "platform": "gcc", "file": "usr/lib/some", "version": "1.2.3"}, + {"type": "shared_lib", "platform": "gcc", "file": "usr/lib/noversion"}, + {"type": "shared_lib", "platform": "gcc", "file": "usr/lib/onlyversion"}, + {"type": "shared_lib", "platform": "gcc", "file": "usr/lib/onlyversion", "version": "1"}, + {"type": "shared_lib", "platform": "gcc", "file": "usr/lib/onlyversion", "version": "1.4.5"}, + {"type": "shared_lib", "platform": "gcc", "file": "usr/lib/onlysoversion"}, + {"type": "shared_lib", "platform": "gcc", "file": "usr/lib/onlysoversion", "version": "5"}, + {"type": "shared_lib", "platform": "msvc", "file": "usr/bin/noversion"}, + {"type": "pdb", "file": "usr/bin/noversion", "language": "d"}, + {"type": "shared_lib", "platform": "msvc", "file": "usr/bin/onlysoversion", "version": "5"}, + {"type": "pdb", "file": "usr/bin/onlysoversion", "version": "5", "language": "d"}, + {"type": "shared_lib", "platform": "msvc", "file": "usr/bin/onlyversion", "version": "1"}, + {"type": "pdb", "file": "usr/bin/onlyversion", "version": "1", "language": "d"}, + {"type": "shared_lib", "platform": "msvc", "file": "usr/bin/some", "version": "0"}, + {"type": "pdb", "file": "usr/bin/some", "version": "0", "language": "d"}, + {"type": "implib", "file": "usr/lib/noversion"}, + {"type": "implib", "file": "usr/lib/onlysoversion"}, + {"type": "implib", "file": "usr/lib/onlyversion"}, + {"type": "implib", "file": "usr/lib/some"} + ] +} diff --git a/test cases/d/5 mixed/app.d b/test cases/d/5 mixed/app.d new file mode 100644 index 0000000..6ab5d97 --- /dev/null +++ b/test cases/d/5 mixed/app.d @@ -0,0 +1,8 @@ + +extern(C) int printLibraryString(const char *str); + +void main () +{ + immutable ret = printLibraryString ("C foo"); + assert (ret == 3); +} diff --git a/test cases/d/5 mixed/libstuff.c b/test cases/d/5 mixed/libstuff.c new file mode 100644 index 0000000..92d6600 --- /dev/null +++ b/test cases/d/5 mixed/libstuff.c @@ -0,0 +1,18 @@ +#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 + +#include + +int DLL_PUBLIC printLibraryString(const char *str) +{ + printf("C library says: %s", str); + return 3; +} diff --git a/test cases/d/5 mixed/meson.build b/test cases/d/5 mixed/meson.build new file mode 100644 index 0000000..3dad66d --- /dev/null +++ b/test cases/d/5 mixed/meson.build @@ -0,0 +1,9 @@ +project('Mixing C and D', 'd', 'c') + +ldyn = shared_library('stuff', 'libstuff.c', install : true) +ed = executable('appdc_d', 'app.d', link_with : ldyn, install : true) +test('linktest_cdyn', ed) + +lstatic = static_library('stuff', 'libstuff.c', install : true) +es = executable('appdc_s', 'app.d', link_with : lstatic, install : true) +test('linktest_cstatic', es) diff --git a/test cases/d/5 mixed/test.json b/test cases/d/5 mixed/test.json new file mode 100644 index 0000000..c95d0ca --- /dev/null +++ b/test cases/d/5 mixed/test.json @@ -0,0 +1,13 @@ +{ + "installed": [ + {"type": "exe", "file": "usr/bin/appdc_d"}, + {"type": "pdb", "file": "usr/bin/appdc_d", "language": "d"}, + {"type": "exe", "file": "usr/bin/appdc_s"}, + {"type": "pdb", "file": "usr/bin/appdc_s", "language": "d"}, + {"type": "file", "file": "usr/lib/libstuff.a"}, + {"type": "shared_lib", "platform": "gcc", "file": "usr/lib/stuff"}, + {"type": "shared_lib", "platform": "msvc", "file": "usr/bin/stuff"}, + {"type": "pdb", "file": "usr/bin/stuff", "language": "c"}, + {"type": "file", "platform": "msvc", "file": "usr/lib/stuff.lib"} + ] +} diff --git a/test cases/d/6 unittest/app.d b/test cases/d/6 unittest/app.d new file mode 100644 index 0000000..71c6414 --- /dev/null +++ b/test cases/d/6 unittest/app.d @@ -0,0 +1,38 @@ + +import std.stdio; + +uint getFour () +{ + auto getTwo () + { + return 1 + 1; + } + + return getTwo () + getTwo (); +} + +void main () +{ + import core.stdc.stdlib : exit; + + writeln ("Four: ", getFour ()); + exit (4); +} + +unittest +{ + writeln ("TEST"); + import core.stdc.stdlib : exit; + import second_unit; + + assert (getFour () > 2); + assert (getFour () == 4); + + // this is a regression test for https://github.com/mesonbuild/meson/issues/3337 + secondModuleTestFunc (); + + // we explicitly terminate here to give the unittest program a different exit + // code than the main application has. + // (this prevents the regular main() from being executed) + exit (0); +} diff --git a/test cases/d/6 unittest/meson.build b/test cases/d/6 unittest/meson.build new file mode 100644 index 0000000..49a0700 --- /dev/null +++ b/test cases/d/6 unittest/meson.build @@ -0,0 +1,8 @@ +project('D Unittests', 'd') + +e = executable('dapp', ['app.d', 'second_unit.d'], install : true) +test('dapp_run', e, should_fail: true) + +e_test = executable('dapp_test', ['app.d', 'second_unit.d'], + d_unittest: true) +test('dapp_test', e_test) diff --git a/test cases/d/6 unittest/second_unit.d b/test cases/d/6 unittest/second_unit.d new file mode 100644 index 0000000..fdb62a9 --- /dev/null +++ b/test cases/d/6 unittest/second_unit.d @@ -0,0 +1,10 @@ + +void secondModuleTestFunc () +{ + import std.stdio : writeln; + + version (unittest) + writeln ("Hello!"); + else + assert (0); +} diff --git a/test cases/d/6 unittest/test.json b/test cases/d/6 unittest/test.json new file mode 100644 index 0000000..adc4d75 --- /dev/null +++ b/test cases/d/6 unittest/test.json @@ -0,0 +1,6 @@ +{ + "installed": [ + {"type": "exe", "file": "usr/bin/dapp"}, + {"type": "pdb", "file": "usr/bin/dapp", "language": "d"} + ] +} diff --git a/test cases/d/7 multilib/app.d b/test cases/d/7 multilib/app.d new file mode 100644 index 0000000..892596a --- /dev/null +++ b/test cases/d/7 multilib/app.d @@ -0,0 +1,9 @@ + +import say1; +import say2; + +void main () +{ + assert (sayHello1 ("Dave") == 4); + assert (sayHello2 ("HAL 9000") == 8); +} diff --git a/test cases/d/7 multilib/meson.build b/test cases/d/7 multilib/meson.build new file mode 100644 index 0000000..1879c08 --- /dev/null +++ b/test cases/d/7 multilib/meson.build @@ -0,0 +1,24 @@ +project('D Multiple Versioned Shared Libraries', 'd') + +dc = meson.get_compiler('d') +if dc.get_id() == 'gcc' + if dc.version().version_compare('< 8') + error('MESON_SKIP_TEST: GDC < 8.0 can not build shared libraries') + endif +endif + +ldyn1 = shared_library('say1', + 'say1.d', + install: true, + version : '1.2.3', + soversion : '0' +) +ldyn2 = shared_library('say2', + 'say2.d', + install: true, + version : '1.2.4', + soversion : '1' +) + +ed = executable('app_d', 'app.d', link_with: [ldyn1, ldyn2], install: true) +test('multilink_test', ed) diff --git a/test cases/d/7 multilib/say1.d b/test cases/d/7 multilib/say1.d new file mode 100644 index 0000000..605fd23 --- /dev/null +++ b/test cases/d/7 multilib/say1.d @@ -0,0 +1,15 @@ + +import std.stdio; +import std.string : format; + +export int sayHello1 (string str) +{ + writeln ("Hello %s from library 1.".format (str)); + return 4; +} + +version (Windows) +{ + import core.sys.windows.dll; + mixin SimpleDllMain; +} diff --git a/test cases/d/7 multilib/say1.di b/test cases/d/7 multilib/say1.di new file mode 100644 index 0000000..8a9ff02 --- /dev/null +++ b/test cases/d/7 multilib/say1.di @@ -0,0 +1 @@ +int sayHello1 (string str); diff --git a/test cases/d/7 multilib/say2.d b/test cases/d/7 multilib/say2.d new file mode 100644 index 0000000..7270ebd --- /dev/null +++ b/test cases/d/7 multilib/say2.d @@ -0,0 +1,15 @@ + +import std.stdio; +import std.string : format; + +export int sayHello2 (string str) +{ + writeln ("Hello %s from library 2.".format (str)); + return 8; +} + +version (Windows) +{ + import core.sys.windows.dll; + mixin SimpleDllMain; +} diff --git a/test cases/d/7 multilib/say2.di b/test cases/d/7 multilib/say2.di new file mode 100644 index 0000000..da712f0 --- /dev/null +++ b/test cases/d/7 multilib/say2.di @@ -0,0 +1 @@ +int sayHello2 (string str); diff --git a/test cases/d/7 multilib/test.json b/test cases/d/7 multilib/test.json new file mode 100644 index 0000000..5944ae0 --- /dev/null +++ b/test cases/d/7 multilib/test.json @@ -0,0 +1,18 @@ +{ + "installed": [ + {"type": "exe", "file": "usr/bin/app_d"}, + {"type": "pdb", "file": "usr/bin/app_d", "language": "d"}, + {"type": "shared_lib", "platform": "gcc", "file": "usr/lib/say1"}, + {"type": "shared_lib", "platform": "gcc", "file": "usr/lib/say1", "version": "0"}, + {"type": "shared_lib", "platform": "gcc", "file": "usr/lib/say1", "version": "1.2.3"}, + {"type": "shared_lib", "platform": "gcc", "file": "usr/lib/say2"}, + {"type": "shared_lib", "platform": "gcc", "file": "usr/lib/say2", "version": "1"}, + {"type": "shared_lib", "platform": "gcc", "file": "usr/lib/say2", "version": "1.2.4"}, + {"type": "shared_lib", "platform": "msvc", "file": "usr/bin/say1", "version": "0"}, + {"type": "pdb", "file": "usr/bin/say1", "version": "0", "language": "d"}, + {"type": "shared_lib", "platform": "msvc", "file": "usr/bin/say2", "version": "1"}, + {"type": "pdb", "file": "usr/bin/say2", "version": "1", "language": "d"}, + {"type": "implib", "file": "usr/lib/say1"}, + {"type": "implib", "file": "usr/lib/say2"} + ] +} diff --git a/test cases/d/8 has multi arguments/meson.build b/test cases/d/8 has multi arguments/meson.build new file mode 100644 index 0000000..0897057 --- /dev/null +++ b/test cases/d/8 has multi arguments/meson.build @@ -0,0 +1,8 @@ +project('D has arguments test', 'd') + +compiler = meson.get_compiler('d') + +assert(compiler.compiles('int i;'), 'Basic code test does not compile: ' + compiler.get_id()) +assert(compiler.has_multi_arguments(['-I.', '-J.']), 'Multi argument test does not work: ' + compiler.get_id()) +assert(compiler.has_argument('-I.'), 'Basic argument test does not work: ' + compiler.get_id()) +assert(compiler.has_argument('-flag_a_d_compiler_definitely_does_not_have') == false, 'Basic argument test does not work: ' + compiler.get_id()) diff --git a/test cases/d/9 features/app.d b/test cases/d/9 features/app.d new file mode 100644 index 0000000..ae59be1 --- /dev/null +++ b/test cases/d/9 features/app.d @@ -0,0 +1,82 @@ + +import std.stdio; +import std.array : split; +import std.string : strip; + +import extra; + +auto getMenu () +{ + auto foods = import ("food.txt").strip.split ("\n"); + return foods; +} + +auto getPeople () +{ + return import ("people.txt").strip.split ("\n"); +} + +void main (string[] args) +{ + import std.array : join; + import core.stdc.stdlib : exit; + + immutable request = args[1]; + if (request == "menu") { + version (No_Menu) { + } else { + writeln ("On the menu: ", getMenu.join (", ")); + exit (0); + } + } + + version (With_People) { + if (request == "people") { + writeln ("People: ", getPeople.join (", ")); + + // only exit successfully if the second module also had its module version set. + // this checks for issue https://github.com/mesonbuild/meson/issues/3337 + if (secondModulePeopleVersionSet ()) + exit (0); + exit (1); + } + } + + version (With_VersionInteger) + version(3) exit(0); + + version (With_Debug) + debug exit(0); + + version (With_DebugInteger) + debug(3) exit(0); + + version (With_DebugIdentifier) + debug(DebugIdentifier) exit(0); + + version (With_DebugAll) { + int dbg = 0; + debug dbg++; + debug(2) dbg++; + debug(3) dbg++; + debug(4) dbg++; + debug(DebugIdentifier) dbg++; + + if (dbg == 5) + exit(0); + } + + // we fail here + exit (1); +} + +unittest +{ + writeln ("TEST"); + import core.stdc.stdlib : exit; + + writeln(getMenu); + assert (getMenu () == ["Spam", "Eggs", "Spam", "Baked Beans", "Spam", "Spam"]); + + exit (0); +} diff --git a/test cases/d/9 features/data/food.txt b/test cases/d/9 features/data/food.txt new file mode 100644 index 0000000..8275dd0 --- /dev/null +++ b/test cases/d/9 features/data/food.txt @@ -0,0 +1,6 @@ +Spam +Eggs +Spam +Baked Beans +Spam +Spam diff --git a/test cases/d/9 features/data/people.txt b/test cases/d/9 features/data/people.txt new file mode 100644 index 0000000..abbae06 --- /dev/null +++ b/test cases/d/9 features/data/people.txt @@ -0,0 +1,5 @@ +Rick +Morty +Summer +Beth +Jerry diff --git a/test cases/d/9 features/extra.d b/test cases/d/9 features/extra.d new file mode 100644 index 0000000..832b292 --- /dev/null +++ b/test cases/d/9 features/extra.d @@ -0,0 +1,9 @@ + +auto secondModulePeopleVersionSet () +{ + version (With_People) { + return true; + } else { + return false; + } +} diff --git a/test cases/d/9 features/meson.build b/test cases/d/9 features/meson.build new file mode 100644 index 0000000..06f0341 --- /dev/null +++ b/test cases/d/9 features/meson.build @@ -0,0 +1,106 @@ +project('D Features', 'd', default_options : ['debug=false']) + +# ONLY FOR BACKWARDS COMPATIBILITY. +# DO NOT DO THIS IN NEW CODE! +# USE include_directories() INSTEAD OF BUILDING +# STRINGS TO PATHS MANUALLY! +data_dir = join_paths(meson.current_source_dir(), 'data') + +test_src = ['app.d', 'extra.d'] + +e_plain_bcompat = executable('dapp_menu_bcompat', + test_src, + d_import_dirs: [data_dir] +) +test('dapp_menu_t_fail_bcompat', e_plain_bcompat, should_fail: true) +test('dapp_menu_t_bcompat', e_plain_bcompat, args: ['menu']) + +# directory for data +# This is the correct way to do this. +data_dir = include_directories('data') + +e_plain = executable('dapp_menu', + test_src, + d_import_dirs: [data_dir] +) +test('dapp_menu_t_fail', e_plain, should_fail: true) +test('dapp_menu_t', e_plain, args: ['menu']) + + +# test feature versions and string imports +e_versions = executable('dapp_versions', + test_src, + d_import_dirs: [data_dir], + d_module_versions: ['No_Menu', 'With_People'] +) +test('dapp_versions_t_fail', e_versions, args: ['menu'], should_fail: true) +test('dapp_versions_t', e_versions, args: ['people']) + +# test everything and unittests +e_test = executable('dapp_test', + test_src, + d_import_dirs: [data_dir], + d_module_versions: ['No_Menu', 'With_People'], + d_unittest: true +) +test('dapp_test', e_test) + +# test version level +e_version_int = executable('dapp_version_int', + test_src, + d_import_dirs: [data_dir], + d_module_versions: ['With_VersionInteger', 3], +) +test('dapp_version_int_t', e_version_int, args: ['debug']) + +# test version level failure +e_version_int_fail = executable('dapp_version_int_fail', + test_src, + d_import_dirs: [data_dir], + d_module_versions: ['With_VersionInteger', 2], +) +test('dapp_version_int_t_fail', e_version_int_fail, args: ['debug'], should_fail: true) + +# test debug conditions: disabled +e_no_debug = executable('dapp_no_debug', + test_src, + d_import_dirs: [data_dir], + d_module_versions: ['With_Debug'], +) +test('dapp_no_debug_t_fail', e_no_debug, args: ['debug'], should_fail: true) + +# test debug conditions: enabled +e_debug = executable('dapp_debug', + test_src, + d_import_dirs: [data_dir], + d_module_versions: ['With_Debug'], + d_debug: 1, +) +test('dapp_debug_t', e_debug, args: ['debug']) + +# test debug conditions: integer +e_debug_int = executable('dapp_debug_int', + test_src, + d_import_dirs: [data_dir], + d_module_versions: ['With_DebugInteger'], + d_debug: 3, +) +test('dapp_debug_int_t', e_debug_int, args: ['debug']) + +# test debug conditions: identifier +e_debug_ident = executable('dapp_debug_ident', + test_src, + d_import_dirs: [data_dir], + d_module_versions: ['With_DebugIdentifier'], + d_debug: 'DebugIdentifier', +) +test('dapp_debug_ident_t', e_debug_ident, args: ['debug']) + +# test with all debug conditions at once, and with redundant values +e_debug_all = executable('dapp_debug_all', + test_src, + d_import_dirs: [data_dir], + d_module_versions: ['With_DebugAll'], + d_debug: ['4', 'DebugIdentifier', 2, 'DebugIdentifierUnused'], +) +test('dapp_debug_all_t', e_debug_all, args: ['debug']) diff --git a/test cases/failing build/1 vala c werror/meson.build b/test cases/failing build/1 vala c werror/meson.build new file mode 100644 index 0000000..736d7aa --- /dev/null +++ b/test cases/failing build/1 vala c werror/meson.build @@ -0,0 +1,10 @@ +project('valatest', 'c', default_options : 'werror=true') + +if find_program('valac', required : false).found() + add_languages('vala') + valadeps = [dependency('glib-2.0'), dependency('gobject-2.0')] + # Must fail due to -Werror and unused variable in C file + executable('valaprog', 'prog.vala', 'unused-var.c', dependencies : valadeps) +else + executable('failprog', 'unused-var.c') +endif diff --git a/test cases/failing build/1 vala c werror/prog.vala b/test cases/failing build/1 vala c werror/prog.vala new file mode 100644 index 0000000..638e776 --- /dev/null +++ b/test cases/failing build/1 vala c werror/prog.vala @@ -0,0 +1,7 @@ +class MainProg : GLib.Object { + + public static int main(string[] args) { + stdout.printf("Vala is working.\n"); + return 0; + } +} diff --git a/test cases/failing build/1 vala c werror/unused-var.c b/test cases/failing build/1 vala c werror/unused-var.c new file mode 100644 index 0000000..6b85078 --- /dev/null +++ b/test cases/failing build/1 vala c werror/unused-var.c @@ -0,0 +1,8 @@ +#warning "something" + +int +somelib(void) +{ + int unused_var; + return 33; +} diff --git a/test cases/failing build/2 hidden symbol/bob.c b/test cases/failing build/2 hidden symbol/bob.c new file mode 100644 index 0000000..9a3325a --- /dev/null +++ b/test cases/failing build/2 hidden symbol/bob.c @@ -0,0 +1,5 @@ +#include"bob.h" + +int hidden_function() { + return 7; +} diff --git a/test cases/failing build/2 hidden symbol/bob.h b/test cases/failing build/2 hidden symbol/bob.h new file mode 100644 index 0000000..947f6ee --- /dev/null +++ b/test cases/failing build/2 hidden symbol/bob.h @@ -0,0 +1,3 @@ +#pragma once + +int hidden_function(); diff --git a/test cases/failing build/2 hidden symbol/bobuser.c b/test cases/failing build/2 hidden symbol/bobuser.c new file mode 100644 index 0000000..89272ed --- /dev/null +++ b/test cases/failing build/2 hidden symbol/bobuser.c @@ -0,0 +1,5 @@ +#include"bob.h" + +int main(int argc, char **argv) { + return hidden_function(); +} diff --git a/test cases/failing build/2 hidden symbol/meson.build b/test cases/failing build/2 hidden symbol/meson.build new file mode 100644 index 0000000..f7c38e3 --- /dev/null +++ b/test cases/failing build/2 hidden symbol/meson.build @@ -0,0 +1,11 @@ +project('hidden symbol', 'c') + +if host_machine.system() == 'windows' or host_machine.system() == 'cygwin' + error('MESON_SKIP_TEST -fvisibility=hidden does not work for PE files.') +endif + +l = shared_library('bob', 'bob.c', + gnu_symbol_visibility: 'hidden') + +executable('bobuser', 'bobuser.c', + link_with: l) diff --git a/test cases/failing build/3 pch disabled/c/meson.build b/test cases/failing build/3 pch disabled/c/meson.build new file mode 100644 index 0000000..1739126 --- /dev/null +++ b/test cases/failing build/3 pch disabled/c/meson.build @@ -0,0 +1,2 @@ +exe = executable('prog', 'prog.c', +c_pch : ['pch/prog_pch.c', 'pch/prog.h']) diff --git a/test cases/failing build/3 pch disabled/c/pch/prog.h b/test cases/failing build/3 pch disabled/c/pch/prog.h new file mode 100644 index 0000000..354499a --- /dev/null +++ b/test cases/failing build/3 pch disabled/c/pch/prog.h @@ -0,0 +1 @@ +#include diff --git a/test cases/failing build/3 pch disabled/c/pch/prog_pch.c b/test cases/failing build/3 pch disabled/c/pch/prog_pch.c new file mode 100644 index 0000000..4960505 --- /dev/null +++ b/test cases/failing build/3 pch disabled/c/pch/prog_pch.c @@ -0,0 +1,5 @@ +#if !defined(_MSC_VER) +#error "This file is only for use with MSVC." +#endif + +#include "prog.h" diff --git a/test cases/failing build/3 pch disabled/c/prog.c b/test cases/failing build/3 pch disabled/c/prog.c new file mode 100644 index 0000000..f17bc9e --- /dev/null +++ b/test cases/failing build/3 pch disabled/c/prog.c @@ -0,0 +1,9 @@ +// No includes here, they need to come from the PCH + +void func() { + fprintf(stdout, "This is a function that fails if stdio is not #included.\n"); +} + +int main(int argc, char **argv) { + return 0; +} diff --git a/test cases/failing build/3 pch disabled/meson.build b/test cases/failing build/3 pch disabled/meson.build new file mode 100644 index 0000000..0a8fa67 --- /dev/null +++ b/test cases/failing build/3 pch disabled/meson.build @@ -0,0 +1,5 @@ +# Disable PCH usage to make sure backends respect this setting. +# Since the .c file requires PCH usage (it does not include necessary +# headers itself), the build should fail. +project('pch test', 'c', default_options: ['b_pch=false']) +subdir('c') diff --git a/test cases/failing build/4 cmake subproject isolation/incDir/fileA.hpp b/test cases/failing build/4 cmake subproject isolation/incDir/fileA.hpp new file mode 100644 index 0000000..a5f09be --- /dev/null +++ b/test cases/failing build/4 cmake subproject isolation/incDir/fileA.hpp @@ -0,0 +1,3 @@ +#pragma once + +#define SOME_DEFINE " World" diff --git a/test cases/failing build/4 cmake subproject isolation/main.cpp b/test cases/failing build/4 cmake subproject isolation/main.cpp new file mode 100644 index 0000000..9507961 --- /dev/null +++ b/test cases/failing build/4 cmake subproject isolation/main.cpp @@ -0,0 +1,10 @@ +#include +#include + +using namespace std; + +int main(void) { + cmModClass obj("Hello"); + cout << obj.getStr() << endl; + return 0; +} diff --git a/test cases/failing build/4 cmake subproject isolation/meson.build b/test cases/failing build/4 cmake subproject isolation/meson.build new file mode 100644 index 0000000..e606335 --- /dev/null +++ b/test cases/failing build/4 cmake subproject isolation/meson.build @@ -0,0 +1,17 @@ +project('subproject isolation', ['c', 'cpp']) + +if not find_program('cmake', required: false).found() + error('MESON_SKIP_TEST CMake is not installed') +endif + +incdir = meson.source_root() / 'incDir' + +cm = import('cmake') + +# This should generate a warning and the include dir should be skipped. +sub_pro = cm.subproject('cmMod', cmake_options : [ '-DMESON_INC_DIR=' + incdir ]) +sub_dep = sub_pro.dependency('cmModLib++') + +# Since the include dir is skipped, the compilation of this project should fail. +exe1 = executable('main', ['main.cpp'], dependencies: [sub_dep]) +test('test1', exe1) diff --git a/test cases/failing build/4 cmake subproject isolation/subprojects/cmMod/CMakeLists.txt b/test cases/failing build/4 cmake subproject isolation/subprojects/cmMod/CMakeLists.txt new file mode 100644 index 0000000..852dd09 --- /dev/null +++ b/test cases/failing build/4 cmake subproject isolation/subprojects/cmMod/CMakeLists.txt @@ -0,0 +1,10 @@ +cmake_minimum_required(VERSION 3.5) + +project(cmMod) +set (CMAKE_CXX_STANDARD 14) + +include_directories(${CMAKE_CURRENT_BINARY_DIR} ${MESON_INC_DIR}) + +add_library(cmModLib++ SHARED cmMod.cpp) +include(GenerateExportHeader) +generate_export_header(cmModLib++) diff --git a/test cases/failing build/4 cmake subproject isolation/subprojects/cmMod/cmMod.cpp b/test cases/failing build/4 cmake subproject isolation/subprojects/cmMod/cmMod.cpp new file mode 100644 index 0000000..a668203 --- /dev/null +++ b/test cases/failing build/4 cmake subproject isolation/subprojects/cmMod/cmMod.cpp @@ -0,0 +1,12 @@ +#include "cmMod.hpp" +#include "fileA.hpp" + +using namespace std; + +cmModClass::cmModClass(string foo) { + str = foo + SOME_DEFINE; +} + +string cmModClass::getStr() const { + return str; +} diff --git a/test cases/failing build/4 cmake subproject isolation/subprojects/cmMod/cmMod.hpp b/test cases/failing build/4 cmake subproject isolation/subprojects/cmMod/cmMod.hpp new file mode 100644 index 0000000..0e6dc04 --- /dev/null +++ b/test cases/failing build/4 cmake subproject isolation/subprojects/cmMod/cmMod.hpp @@ -0,0 +1,14 @@ +#pragma once + +#include "cmmodlib++_export.h" +#include + +class CMMODLIB___EXPORT cmModClass { +private: + std::string str; + +public: + cmModClass(std::string foo); + + std::string getStr() const; +}; diff --git a/test cases/failing build/4 cmake subproject isolation/test.json b/test cases/failing build/4 cmake subproject isolation/test.json new file mode 100644 index 0000000..b48d78a --- /dev/null +++ b/test cases/failing build/4 cmake subproject isolation/test.json @@ -0,0 +1,5 @@ +{ + "tools": { + "cmake": ">=3.14" + } +} diff --git a/test cases/failing build/5 failed pickled/false.py b/test cases/failing build/5 failed pickled/false.py new file mode 100644 index 0000000..865aeb9 --- /dev/null +++ b/test cases/failing build/5 failed pickled/false.py @@ -0,0 +1,4 @@ +#!/usr/bin/env python3 + +import sys +sys.exit(1) diff --git a/test cases/failing build/5 failed pickled/meson.build b/test cases/failing build/5 failed pickled/meson.build new file mode 100644 index 0000000..9245020 --- /dev/null +++ b/test cases/failing build/5 failed pickled/meson.build @@ -0,0 +1,7 @@ +project('failed pickled command') + +custom_target('failure', + command: [find_program('false.py'), '\n'], + output: 'output.txt', + build_by_default: true, +) diff --git a/test cases/failing test/1 trivial/main.c b/test cases/failing test/1 trivial/main.c new file mode 100644 index 0000000..3e70e50 --- /dev/null +++ b/test cases/failing test/1 trivial/main.c @@ -0,0 +1,3 @@ +int main(void) { + return 1; +} diff --git a/test cases/failing test/1 trivial/meson.build b/test cases/failing test/1 trivial/meson.build new file mode 100644 index 0000000..ed5a3d2 --- /dev/null +++ b/test cases/failing test/1 trivial/meson.build @@ -0,0 +1,3 @@ +project('trivial', 'c') + +test('My Test', executable('main', 'main.c')) diff --git a/test cases/failing test/2 signal/main.c b/test cases/failing test/2 signal/main.c new file mode 100644 index 0000000..2ee1d80 --- /dev/null +++ b/test cases/failing test/2 signal/main.c @@ -0,0 +1,6 @@ +#include +#include + +int main(void) { + kill(getpid(), SIGSEGV); +} diff --git a/test cases/failing test/2 signal/meson.build b/test cases/failing test/2 signal/meson.build new file mode 100644 index 0000000..9d84c26 --- /dev/null +++ b/test cases/failing test/2 signal/meson.build @@ -0,0 +1,7 @@ +project('signal', 'c') + +if build_machine.system() == 'windows' + error('MESON_SKIP_TEST test is not compatible with MS Windows.') +else + test('My Signal Test', executable('main', 'main.c')) +endif diff --git a/test cases/failing test/3 ambiguous/main.c b/test cases/failing test/3 ambiguous/main.c new file mode 100644 index 0000000..2ee1d80 --- /dev/null +++ b/test cases/failing test/3 ambiguous/main.c @@ -0,0 +1,6 @@ +#include +#include + +int main(void) { + kill(getpid(), SIGSEGV); +} diff --git a/test cases/failing test/3 ambiguous/meson.build b/test cases/failing test/3 ambiguous/meson.build new file mode 100644 index 0000000..58f0de0 --- /dev/null +++ b/test cases/failing test/3 ambiguous/meson.build @@ -0,0 +1,10 @@ +project('ambiguous', 'c') + +if build_machine.system() == 'windows' + error('MESON_SKIP_TEST test is not compatible with MS Windows.') +else + exe = executable('main', 'main.c') + test_runner = find_program('test_runner.sh') + + test('My Ambiguous Status Test', test_runner, args : [exe.full_path()]) +endif diff --git a/test cases/failing test/3 ambiguous/test_runner.sh b/test cases/failing test/3 ambiguous/test_runner.sh new file mode 100755 index 0000000..08873ce --- /dev/null +++ b/test cases/failing test/3 ambiguous/test_runner.sh @@ -0,0 +1,7 @@ +#!/bin/sh +# +# This tests that using a shell as an intermediary between Meson and the +# actual unit test which dies due to a signal is still recorded correctly. +# +# The quotes are because the path may contain spaces. +"$1" diff --git a/test cases/failing test/4 hard error/main.c b/test cases/failing test/4 hard error/main.c new file mode 100644 index 0000000..a1e705a --- /dev/null +++ b/test cases/failing test/4 hard error/main.c @@ -0,0 +1,3 @@ +int main(void) { + return 99; +} diff --git a/test cases/failing test/4 hard error/meson.build b/test cases/failing test/4 hard error/meson.build new file mode 100644 index 0000000..6979b04 --- /dev/null +++ b/test cases/failing test/4 hard error/meson.build @@ -0,0 +1,4 @@ +project('trivial', 'c') + +# Exit code 99 even overrides should_fail +test('My Test', executable('main', 'main.c'), should_fail: true) diff --git a/test cases/failing test/5 tap tests/meson.build b/test cases/failing test/5 tap tests/meson.build new file mode 100644 index 0000000..664ac34 --- /dev/null +++ b/test cases/failing test/5 tap tests/meson.build @@ -0,0 +1,9 @@ +project('test features', 'c') + +tester = executable('tester', 'tester.c') +test_with_status = executable('test-with-status', 'tester_with_status.c') +test('nonzero return code no tests', tester, args : [], protocol: 'tap') +test('nonzero return code with tests', test_with_status, protocol: 'tap') +test('missing test', tester, args : ['1..1'], protocol: 'tap') +test('incorrect skip', tester, args : ['1..1 # skip\nok 1'], protocol: 'tap') +test('partially skipped', tester, args : ['not ok 1\nok 2 # skip'], protocol: 'tap') diff --git a/test cases/failing test/5 tap tests/tester.c b/test cases/failing test/5 tap tests/tester.c new file mode 100644 index 0000000..ac582e7 --- /dev/null +++ b/test cases/failing test/5 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/failing test/5 tap tests/tester_with_status.c b/test cases/failing test/5 tap tests/tester_with_status.c new file mode 100644 index 0000000..7613afe --- /dev/null +++ b/test cases/failing test/5 tap tests/tester_with_status.c @@ -0,0 +1,8 @@ +#include +#include + +int main(int argc, char **argv) { + puts("1..1"); + puts("not ok 1 - some test"); + return 2; +} diff --git a/test cases/failing test/6 xpass/meson.build b/test cases/failing test/6 xpass/meson.build new file mode 100644 index 0000000..7649dde --- /dev/null +++ b/test cases/failing test/6 xpass/meson.build @@ -0,0 +1,4 @@ +project('unexpected pass', 'c') + +test('should_fail_but_does_not', executable('xpass', 'xpass.c'), + should_fail: true) diff --git a/test cases/failing test/6 xpass/xpass.c b/test cases/failing test/6 xpass/xpass.c new file mode 100644 index 0000000..0314ff1 --- /dev/null +++ b/test cases/failing test/6 xpass/xpass.c @@ -0,0 +1 @@ +int main(int argc, char **argv) { return 0; } diff --git a/test cases/failing/1 project not first/meson.build b/test cases/failing/1 project not first/meson.build new file mode 100644 index 0000000..f30e155 --- /dev/null +++ b/test cases/failing/1 project not first/meson.build @@ -0,0 +1,4 @@ +var = 'assignment before project() call' +project('no worky', 'c') + +test('not run', executable('prog', 'prog.c')) diff --git a/test cases/failing/1 project not first/prog.c b/test cases/failing/1 project not first/prog.c new file mode 100644 index 0000000..0314ff1 --- /dev/null +++ b/test cases/failing/1 project not first/prog.c @@ -0,0 +1 @@ +int main(int argc, char **argv) { return 0; } diff --git a/test cases/failing/1 project not first/test.json b/test cases/failing/1 project not first/test.json new file mode 100644 index 0000000..27bae02 --- /dev/null +++ b/test cases/failing/1 project not first/test.json @@ -0,0 +1,7 @@ +{ + "stdout": [ + { + "line": "ERROR: Invalid source tree: first statement must be a call to project()" + } + ] +} diff --git a/test cases/failing/10 out of bounds/meson.build b/test cases/failing/10 out of bounds/meson.build new file mode 100644 index 0000000..6917f7a --- /dev/null +++ b/test cases/failing/10 out of bounds/meson.build @@ -0,0 +1,4 @@ +project('out of bounds') + +x = [] +y = x[0] diff --git a/test cases/failing/10 out of bounds/test.json b/test cases/failing/10 out of bounds/test.json new file mode 100644 index 0000000..e27d990 --- /dev/null +++ b/test cases/failing/10 out of bounds/test.json @@ -0,0 +1,7 @@ +{ + "stdout": [ + { + "line": "test cases/failing/10 out of bounds/meson.build:4:0: ERROR: Index 0 out of bounds of array of size 0." + } + ] +} diff --git a/test cases/failing/100 no glib-compile-resources/meson.build b/test cases/failing/100 no glib-compile-resources/meson.build new file mode 100644 index 0000000..aae0569 --- /dev/null +++ b/test cases/failing/100 no glib-compile-resources/meson.build @@ -0,0 +1,8 @@ +project('no glib-compile-resources') + +if find_program('glib-compile-resources', required: false).found() + error('MESON_SKIP_TEST test only applicable when glib-compile-resources is missing.') +endif + +gnome = import('gnome') +res = gnome.compile_resources('resources', 'trivial.gresource.xml') diff --git a/test cases/failing/100 no glib-compile-resources/test.json b/test cases/failing/100 no glib-compile-resources/test.json new file mode 100644 index 0000000..ad9ba29 --- /dev/null +++ b/test cases/failing/100 no glib-compile-resources/test.json @@ -0,0 +1,7 @@ +{ + "stdout": [ + { + "line": "test cases/failing/100 no glib-compile-resources/meson.build:8:0: ERROR: Program 'glib-compile-resources' not found or not executable" + } + ] +} diff --git a/test cases/failing/100 no glib-compile-resources/trivial.gresource.xml b/test cases/failing/100 no glib-compile-resources/trivial.gresource.xml new file mode 100644 index 0000000..1447b98 --- /dev/null +++ b/test cases/failing/100 no glib-compile-resources/trivial.gresource.xml @@ -0,0 +1,3 @@ + + + diff --git a/test cases/failing/101 number in combo/meson.build b/test cases/failing/101 number in combo/meson.build new file mode 100644 index 0000000..1a647df --- /dev/null +++ b/test cases/failing/101 number in combo/meson.build @@ -0,0 +1 @@ +project('number in combo') diff --git a/test cases/failing/101 number in combo/nativefile.ini b/test cases/failing/101 number in combo/nativefile.ini new file mode 100644 index 0000000..55f10fc --- /dev/null +++ b/test cases/failing/101 number in combo/nativefile.ini @@ -0,0 +1,2 @@ +[built-in options] +optimization = 1 diff --git a/test cases/failing/101 number in combo/test.json b/test cases/failing/101 number in combo/test.json new file mode 100644 index 0000000..4c30f98 --- /dev/null +++ b/test cases/failing/101 number in combo/test.json @@ -0,0 +1,5 @@ +{ + "stdout": [ + { "line": "test cases/failing/101 number in combo/meson.build:1:0: ERROR: Value \"1\" (of type \"number\") for combo option \"Optimization level\" is not one of the choices. Possible choices are (as string): \"plain\", \"0\", \"g\", \"1\", \"2\", \"3\", \"s\"." } + ] +} diff --git a/test cases/failing/102 bool in combo/meson.build b/test cases/failing/102 bool in combo/meson.build new file mode 100644 index 0000000..c5efd67 --- /dev/null +++ b/test cases/failing/102 bool in combo/meson.build @@ -0,0 +1 @@ +project('bool in combo') diff --git a/test cases/failing/102 bool in combo/meson_options.txt b/test cases/failing/102 bool in combo/meson_options.txt new file mode 100644 index 0000000..0c8f5de --- /dev/null +++ b/test cases/failing/102 bool in combo/meson_options.txt @@ -0,0 +1,5 @@ +option( + 'opt', + type : 'combo', + choices : ['true', 'false'] +) diff --git a/test cases/failing/102 bool in combo/nativefile.ini b/test cases/failing/102 bool in combo/nativefile.ini new file mode 100644 index 0000000..b423957 --- /dev/null +++ b/test cases/failing/102 bool in combo/nativefile.ini @@ -0,0 +1,2 @@ +[project options] +opt = true diff --git a/test cases/failing/102 bool in combo/test.json b/test cases/failing/102 bool in combo/test.json new file mode 100644 index 0000000..c0041af --- /dev/null +++ b/test cases/failing/102 bool in combo/test.json @@ -0,0 +1,5 @@ +{ + "stdout": [ + { "line": "test cases/failing/102 bool in combo/meson.build:1:0: ERROR: Value \"True\" (of type \"boolean\") for combo option \"opt\" is not one of the choices. Possible choices are (as string): \"true\", \"false\"." } + ] +} diff --git a/test cases/failing/103 compiler no lang/meson.build b/test cases/failing/103 compiler no lang/meson.build new file mode 100644 index 0000000..366bbdd --- /dev/null +++ b/test cases/failing/103 compiler no lang/meson.build @@ -0,0 +1,2 @@ +project('compiler without lang') +meson.get_compiler('c') diff --git a/test cases/failing/103 compiler no lang/test.json b/test cases/failing/103 compiler no lang/test.json new file mode 100644 index 0000000..123dcb9 --- /dev/null +++ b/test cases/failing/103 compiler no lang/test.json @@ -0,0 +1,7 @@ +{ + "stdout": [ + { + "line": "test cases/failing/103 compiler no lang/meson.build:2:6: ERROR: Tried to access compiler for language \"c\", not specified for host machine." + } + ] +} diff --git a/test cases/failing/104 no fallback/meson.build b/test cases/failing/104 no fallback/meson.build new file mode 100644 index 0000000..91d6b93 --- /dev/null +++ b/test cases/failing/104 no fallback/meson.build @@ -0,0 +1,2 @@ +project('no fallback') +foob_dep = dependency('foob', allow_fallback: false, required: true) diff --git a/test cases/failing/104 no fallback/subprojects/foob/meson.build b/test cases/failing/104 no fallback/subprojects/foob/meson.build new file mode 100644 index 0000000..b2c4814 --- /dev/null +++ b/test cases/failing/104 no fallback/subprojects/foob/meson.build @@ -0,0 +1,2 @@ +project('foob', 'c') +meson.override_dependency('foob', declare_dependency()) diff --git a/test cases/failing/104 no fallback/test.json b/test cases/failing/104 no fallback/test.json new file mode 100644 index 0000000..e034061 --- /dev/null +++ b/test cases/failing/104 no fallback/test.json @@ -0,0 +1,8 @@ +{ + "stdout": [ + { + "match": "re", + "line": ".*/meson\\.build:2:0: ERROR: (Pkg-config binary for machine MachineChoice\\.HOST not found\\. Giving up\\.|Dependency \"foob\" not found, tried .*)" + } + ] +} diff --git a/test cases/failing/105 feature require/meson.build b/test cases/failing/105 feature require/meson.build new file mode 100644 index 0000000..8c47e37 --- /dev/null +++ b/test cases/failing/105 feature require/meson.build @@ -0,0 +1,2 @@ +project('no fallback') +foo = get_option('reqfeature').require(false, error_message: 'frobnicator not available') diff --git a/test cases/failing/105 feature require/meson_options.txt b/test cases/failing/105 feature require/meson_options.txt new file mode 100644 index 0000000..5910a87 --- /dev/null +++ b/test cases/failing/105 feature require/meson_options.txt @@ -0,0 +1 @@ +option('reqfeature', type : 'feature', value : 'enabled', description : 'A required feature') diff --git a/test cases/failing/105 feature require/test.json b/test cases/failing/105 feature require/test.json new file mode 100644 index 0000000..7c4640d --- /dev/null +++ b/test cases/failing/105 feature require/test.json @@ -0,0 +1,8 @@ +{ + "stdout": [ + { + "match": "re", + "line": ".*/meson\\.build:2:0: ERROR: Feature reqfeature cannot be enabled: frobnicator not available" + } + ] +} diff --git a/test cases/failing/106 feature require.bis/meson.build b/test cases/failing/106 feature require.bis/meson.build new file mode 100644 index 0000000..4ea65e5 --- /dev/null +++ b/test cases/failing/106 feature require.bis/meson.build @@ -0,0 +1,2 @@ +project('no fallback') +foo = get_option('reqfeature').require(false) diff --git a/test cases/failing/106 feature require.bis/meson_options.txt b/test cases/failing/106 feature require.bis/meson_options.txt new file mode 100644 index 0000000..5910a87 --- /dev/null +++ b/test cases/failing/106 feature require.bis/meson_options.txt @@ -0,0 +1 @@ +option('reqfeature', type : 'feature', value : 'enabled', description : 'A required feature') diff --git a/test cases/failing/106 feature require.bis/test.json b/test cases/failing/106 feature require.bis/test.json new file mode 100644 index 0000000..2583990 --- /dev/null +++ b/test cases/failing/106 feature require.bis/test.json @@ -0,0 +1,8 @@ +{ + "stdout": [ + { + "match": "re", + "line": ".*/meson\\.build:2:0: ERROR: Feature reqfeature cannot be enabled" + } + ] +} diff --git a/test cases/failing/107 no build get_external_property/meson.build b/test cases/failing/107 no build get_external_property/meson.build new file mode 100644 index 0000000..8a4215c --- /dev/null +++ b/test cases/failing/107 no build get_external_property/meson.build @@ -0,0 +1,3 @@ +project('missing property') + +message(meson.get_external_property('nonexisting', native : true)) diff --git a/test cases/failing/107 no build get_external_property/test.json b/test cases/failing/107 no build get_external_property/test.json new file mode 100644 index 0000000..b95427e --- /dev/null +++ b/test cases/failing/107 no build get_external_property/test.json @@ -0,0 +1,7 @@ +{ + "stdout": [ + { + "line": "test cases/failing/107 no build get_external_property/meson.build:3:0: ERROR: Unknown property for build machine: nonexisting" + } + ] +} diff --git a/test cases/failing/108 enter subdir twice/meson.build b/test cases/failing/108 enter subdir twice/meson.build new file mode 100644 index 0000000..d9bf9f5 --- /dev/null +++ b/test cases/failing/108 enter subdir twice/meson.build @@ -0,0 +1,3 @@ +project('subdir2') +subdir('sub') +subdir('sub') diff --git a/test cases/failing/108 enter subdir twice/sub/meson.build b/test cases/failing/108 enter subdir twice/sub/meson.build new file mode 100644 index 0000000..d036a3f --- /dev/null +++ b/test cases/failing/108 enter subdir twice/sub/meson.build @@ -0,0 +1 @@ +message('Now in subdir') diff --git a/test cases/failing/108 enter subdir twice/test.json b/test cases/failing/108 enter subdir twice/test.json new file mode 100644 index 0000000..0a8e127 --- /dev/null +++ b/test cases/failing/108 enter subdir twice/test.json @@ -0,0 +1,7 @@ +{ + "stdout": [ + { + "line": "test cases/failing/108 enter subdir twice/meson.build:3:0: ERROR: Tried to enter directory \"sub\", which has already been visited." + } + ] +} diff --git a/test cases/failing/109 invalid fstring/109 invalid fstring/meson.build b/test cases/failing/109 invalid fstring/109 invalid fstring/meson.build new file mode 100644 index 0000000..dd22f56 --- /dev/null +++ b/test cases/failing/109 invalid fstring/109 invalid fstring/meson.build @@ -0,0 +1,4 @@ +project('invalid-fstring', 'c') + +dict = {'key': true} +s = f'invalid fstring: @dict@' diff --git a/test cases/failing/109 invalid fstring/109 invalid fstring/test.json b/test cases/failing/109 invalid fstring/109 invalid fstring/test.json new file mode 100644 index 0000000..71d8f59 --- /dev/null +++ b/test cases/failing/109 invalid fstring/109 invalid fstring/test.json @@ -0,0 +1,7 @@ +{ + "stdout": [ + { + "line": "test cases/failing/109 invalid fstring/meson.build:4:0: ERROR: Identifier \"dict\" does not name a formattable variable (has to be an integer, a string, a floating point number or a boolean)." + } + ] +} diff --git a/test cases/failing/109 invalid fstring/meson.build b/test cases/failing/109 invalid fstring/meson.build new file mode 100644 index 0000000..7eb3ccf --- /dev/null +++ b/test cases/failing/109 invalid fstring/meson.build @@ -0,0 +1,3 @@ +project('invalid-fstring') + +z = f'invalid fstring: @foo@' diff --git a/test cases/failing/109 invalid fstring/test.json b/test cases/failing/109 invalid fstring/test.json new file mode 100644 index 0000000..a095d62 --- /dev/null +++ b/test cases/failing/109 invalid fstring/test.json @@ -0,0 +1,7 @@ +{ + "stdout": [ + { + "line": "test cases/failing/109 invalid fstring/meson.build:3:0: ERROR: Identifier \"foo\" does not name a variable." + } + ] +} diff --git a/test cases/failing/11 object arithmetic/meson.build b/test cases/failing/11 object arithmetic/meson.build new file mode 100644 index 0000000..34e3a7a --- /dev/null +++ b/test cases/failing/11 object arithmetic/meson.build @@ -0,0 +1,3 @@ +project('object arithmetic') + +foo = '5' + meson diff --git a/test cases/failing/11 object arithmetic/test.json b/test cases/failing/11 object arithmetic/test.json new file mode 100644 index 0000000..822e504 --- /dev/null +++ b/test cases/failing/11 object arithmetic/test.json @@ -0,0 +1,8 @@ +{ + "stdout": [ + { + "match": "re", + "line": "test cases/failing/11 object arithmetic/meson\\.build:3:0: ERROR: The `\\+` operator of str does not accept objects of type MesonMain .*" + } + ] +} diff --git a/test cases/failing/110 compiler argument checking/meson.build b/test cases/failing/110 compiler argument checking/meson.build new file mode 100644 index 0000000..bb1f447 --- /dev/null +++ b/test cases/failing/110 compiler argument checking/meson.build @@ -0,0 +1,4 @@ +project('compiler argument checking test', 'c') + +cc = meson.get_compiler('c') +add_project_arguments(cc.get_supported_arguments('-meson-goober-arg-for-testing', checked : 'require'), language : 'c') diff --git a/test cases/failing/110 compiler argument checking/test.json b/test cases/failing/110 compiler argument checking/test.json new file mode 100644 index 0000000..3de6acb --- /dev/null +++ b/test cases/failing/110 compiler argument checking/test.json @@ -0,0 +1,7 @@ +{ + "stdout": [ + { + "line": "test cases/failing/110 compiler argument checking/meson.build:4:0: ERROR: Compiler for C does not support \"-meson-goober-arg-for-testing\"" + } + ] +} diff --git a/test cases/failing/111 empty fallback/meson.build b/test cases/failing/111 empty fallback/meson.build new file mode 100644 index 0000000..f4eb5fe --- /dev/null +++ b/test cases/failing/111 empty fallback/meson.build @@ -0,0 +1,6 @@ +project('empty fallback') + +# There is a subproject named 'foo' that overrides that dependency, +# but `fallback: []` should not allow to use it. Same behaviour than with +# `allow_fallback: false` +dependency('foo', fallback: []) diff --git a/test cases/failing/111 empty fallback/subprojects/foo/meson.build b/test cases/failing/111 empty fallback/subprojects/foo/meson.build new file mode 100644 index 0000000..c9e134b --- /dev/null +++ b/test cases/failing/111 empty fallback/subprojects/foo/meson.build @@ -0,0 +1,3 @@ +project('foo') + +meson.override_dependency('foo', declare_dependency()) diff --git a/test cases/failing/111 empty fallback/test.json b/test cases/failing/111 empty fallback/test.json new file mode 100644 index 0000000..022e747 --- /dev/null +++ b/test cases/failing/111 empty fallback/test.json @@ -0,0 +1,8 @@ +{ + "stdout": [ + { + "match": "re", + "line": "test cases/failing/111 empty fallback/meson.build:6:0: ERROR: Dependency \"foo\" not found.*" + } + ] +} diff --git a/test cases/failing/112 cmake executable dependency/meson.build b/test cases/failing/112 cmake executable dependency/meson.build new file mode 100644 index 0000000..48d8fcb --- /dev/null +++ b/test cases/failing/112 cmake executable dependency/meson.build @@ -0,0 +1,9 @@ +project('cmake-executable-dependency', 'c') + +if not find_program('cmake', required: false).found() + error('MESON_SKIP_TEST CMake is not installed') +endif + +cmake = import('cmake') +cmlib = cmake.subproject('cmlib') +maind = cmlib.dependency('main') diff --git a/test cases/failing/112 cmake executable dependency/subprojects/cmlib/CMakeLists.txt b/test cases/failing/112 cmake executable dependency/subprojects/cmlib/CMakeLists.txt new file mode 100644 index 0000000..0067879 --- /dev/null +++ b/test cases/failing/112 cmake executable dependency/subprojects/cmlib/CMakeLists.txt @@ -0,0 +1,5 @@ +cmake_minimum_required(VERSION 3.5) + +project(cmlib) + +add_executable(main main.c) diff --git a/test cases/failing/112 cmake executable dependency/subprojects/cmlib/main.c b/test cases/failing/112 cmake executable dependency/subprojects/cmlib/main.c new file mode 100644 index 0000000..9b6bdc2 --- /dev/null +++ b/test cases/failing/112 cmake executable dependency/subprojects/cmlib/main.c @@ -0,0 +1,3 @@ +int main(void) { + return 0; +} diff --git a/test cases/failing/112 cmake executable dependency/test.json b/test cases/failing/112 cmake executable dependency/test.json new file mode 100644 index 0000000..c1ccf6c --- /dev/null +++ b/test cases/failing/112 cmake executable dependency/test.json @@ -0,0 +1,10 @@ +{ + "stdout": [ + { + "line": "test cases/failing/112 cmake executable dependency/meson.build:9:0: ERROR: main is an executable and does not support the dependency() method. Use target() instead." + } + ], + "tools": { + "cmake": ">=3.14" + } +} diff --git a/test cases/failing/113 allow_fallback with fallback/meson.build b/test cases/failing/113 allow_fallback with fallback/meson.build new file mode 100644 index 0000000..2874e42 --- /dev/null +++ b/test cases/failing/113 allow_fallback with fallback/meson.build @@ -0,0 +1,3 @@ +project('fallback and allow_fallback') + +dependency('foo', fallback: 'foo', allow_fallback: false) diff --git a/test cases/failing/113 allow_fallback with fallback/test.json b/test cases/failing/113 allow_fallback with fallback/test.json new file mode 100644 index 0000000..58ed475 --- /dev/null +++ b/test cases/failing/113 allow_fallback with fallback/test.json @@ -0,0 +1,8 @@ +{ + "stdout": [ + { + "line": "test cases/failing/113 allow_fallback with fallback/meson.build:3:0: ERROR: \"fallback\" and \"allow_fallback\" arguments are mutually exclusive" + } + ] +} + diff --git a/test cases/failing/114 nonsensical bindgen/meson.build b/test cases/failing/114 nonsensical bindgen/meson.build new file mode 100644 index 0000000..6995f67 --- /dev/null +++ b/test cases/failing/114 nonsensical bindgen/meson.build @@ -0,0 +1,20 @@ +# SPDX-license-identifer: Apache-2.0 +# Copyright © 2021 Intel Corporation + +project('rustmod bindgen', 'c') + +if not add_languages('rust', required: false) + error('MESON_SKIP_TEST test requires rust compiler') +endif + +prog_bindgen = find_program('bindgen', required : false) +if not prog_bindgen.found() + error('MESON_SKIP_TEST bindgen not found') +endif + +c_lib = static_library('clib', 'src/source.c') + +import('unstable-rust').bindgen( + input : c_lib, + output : 'header.rs', +) diff --git a/test cases/failing/114 nonsensical bindgen/src/header.h b/test cases/failing/114 nonsensical bindgen/src/header.h new file mode 100644 index 0000000..750621f --- /dev/null +++ b/test cases/failing/114 nonsensical bindgen/src/header.h @@ -0,0 +1,8 @@ +// SPDX-license-identifer: Apache-2.0 +// Copyright © 2021 Intel Corporation + +#pragma once + +#include + +int32_t add(const int32_t, const int32_t); diff --git a/test cases/failing/114 nonsensical bindgen/src/source.c b/test cases/failing/114 nonsensical bindgen/src/source.c new file mode 100644 index 0000000..d652d28 --- /dev/null +++ b/test cases/failing/114 nonsensical bindgen/src/source.c @@ -0,0 +1,8 @@ +// SPDX-license-identifer: Apache-2.0 +// Copyright © 2021 Intel Corporation + +#include "header.h" + +int32_t add(const int32_t first, const int32_t second) { + return first + second; +} diff --git a/test cases/failing/114 nonsensical bindgen/test.json b/test cases/failing/114 nonsensical bindgen/test.json new file mode 100644 index 0000000..bc85311 --- /dev/null +++ b/test cases/failing/114 nonsensical bindgen/test.json @@ -0,0 +1,8 @@ +{ + "stdout": [ + { + "line": "test cases/failing/114 nonsensical bindgen/meson.build:17:24: ERROR: bindgen source file must be a C header, not an object or build target" + } + ] +} + diff --git a/test cases/failing/115 run_target in test/meson.build b/test cases/failing/115 run_target in test/meson.build new file mode 100644 index 0000000..1d448ec --- /dev/null +++ b/test cases/failing/115 run_target in test/meson.build @@ -0,0 +1,7 @@ +project('trivial test', 'c') + +py_inst = import('python').find_installation() + +exe = executable('trivialprog', 'trivial.c') +runt = run_target('invalid', command: [py_inst, '--version']) +test('runtest', exe, args: runt) diff --git a/test cases/failing/115 run_target in test/test.json b/test cases/failing/115 run_target in test/test.json new file mode 100644 index 0000000..6eddb7c --- /dev/null +++ b/test cases/failing/115 run_target in test/test.json @@ -0,0 +1,8 @@ +{ + "stdout": [ + { + "line": "test cases/failing/115 run_target in test/meson.build:7:0: ERROR: test keyword argument 'args' was of type array[RunTarget] but should have been array[str | File | BuildTarget | CustomTarget | CustomTargetIndex]" + } + ] +} + diff --git a/test cases/failing/115 run_target in test/trivial.c b/test cases/failing/115 run_target in test/trivial.c new file mode 100644 index 0000000..96612d4 --- /dev/null +++ b/test cases/failing/115 run_target in test/trivial.c @@ -0,0 +1,6 @@ +#include + +int main(void) { + printf("Trivial test is working.\n"); + return 0; +} diff --git a/test cases/failing/116 run_target in add_install_script/meson.build b/test cases/failing/116 run_target in add_install_script/meson.build new file mode 100644 index 0000000..f8ae3a1 --- /dev/null +++ b/test cases/failing/116 run_target in add_install_script/meson.build @@ -0,0 +1,7 @@ +project('trivial test', 'c') + +py_inst = import('python').find_installation() + +exe = executable('trivialprog', 'trivial.c') +runt = run_target('invalid', command: [py_inst, '--version']) +meson.add_install_script(exe, runt) diff --git a/test cases/failing/116 run_target in add_install_script/test.json b/test cases/failing/116 run_target in add_install_script/test.json new file mode 100644 index 0000000..03027e4 --- /dev/null +++ b/test cases/failing/116 run_target in add_install_script/test.json @@ -0,0 +1,8 @@ +{ + "stdout": [ + { + "line": "test cases/failing/116 run_target in add_install_script/meson.build:7:6: ERROR: meson.add_install_script argument 2 was of type \"RunTarget\" but should have been one of: \"str\", \"File\", \"BuildTarget\", \"CustomTarget\", \"CustomTargetIndex\", \"ExternalProgram\"" + } + ] +} + diff --git a/test cases/failing/116 run_target in add_install_script/trivial.c b/test cases/failing/116 run_target in add_install_script/trivial.c new file mode 100644 index 0000000..1b14571 --- /dev/null +++ b/test cases/failing/116 run_target in add_install_script/trivial.c @@ -0,0 +1,11 @@ +#include + +int main(int argc, char **argv) { + FILE *fp = fopen(argv[1], "r"); + if (fp == NULL) { + perror("fopen"); + return 1; + } else { + return 0; + } +} diff --git a/test cases/failing/117 pathsep in install_symlink/meson.build b/test cases/failing/117 pathsep in install_symlink/meson.build new file mode 100644 index 0000000..cce82c2 --- /dev/null +++ b/test cases/failing/117 pathsep in install_symlink/meson.build @@ -0,0 +1,3 @@ +project('symlink_pathsep') + +install_symlink('foo/bar', pointing_to: '/usr/baz/bar', install_dir: '/usr') diff --git a/test cases/failing/117 pathsep in install_symlink/test.json b/test cases/failing/117 pathsep in install_symlink/test.json new file mode 100644 index 0000000..aa35619 --- /dev/null +++ b/test cases/failing/117 pathsep in install_symlink/test.json @@ -0,0 +1,7 @@ +{ + "stdout": [ + { + "line": "test cases/failing/117 pathsep in install_symlink/meson.build:3:0: ERROR: Link name is \"foo/bar\", but link names cannot contain path separators. The dir part should be in install_dir." + } + ] +} diff --git a/test cases/failing/118 subproject version conflict/meson.build b/test cases/failing/118 subproject version conflict/meson.build new file mode 100644 index 0000000..ffbcc13 --- /dev/null +++ b/test cases/failing/118 subproject version conflict/meson.build @@ -0,0 +1,4 @@ +project('120 subproject version conflict') + +A_dep = subproject('A').get_variable('A_dep') +B_dep = subproject('B', version: '1').get_variable('B_dep') diff --git a/test cases/failing/118 subproject version conflict/subprojects/A/meson.build b/test cases/failing/118 subproject version conflict/subprojects/A/meson.build new file mode 100644 index 0000000..7da4df0 --- /dev/null +++ b/test cases/failing/118 subproject version conflict/subprojects/A/meson.build @@ -0,0 +1,4 @@ +project('A') + +B_dep = subproject('B').get_variable('B_dep') +A_dep = declare_dependency(dependencies: B_dep) diff --git a/test cases/failing/118 subproject version conflict/subprojects/B/meson.build b/test cases/failing/118 subproject version conflict/subprojects/B/meson.build new file mode 100644 index 0000000..0ead934 --- /dev/null +++ b/test cases/failing/118 subproject version conflict/subprojects/B/meson.build @@ -0,0 +1,3 @@ +project('B', version: '100') + +B_dep = declare_dependency() diff --git a/test cases/failing/118 subproject version conflict/test.json b/test cases/failing/118 subproject version conflict/test.json new file mode 100644 index 0000000..a31511c --- /dev/null +++ b/test cases/failing/118 subproject version conflict/test.json @@ -0,0 +1,7 @@ +{ + "stdout": [ + { + "line": "test cases/failing/118 subproject version conflict/meson.build:4:0: ERROR: Subproject B version is 100 but ['1'] required." + } + ] +} diff --git a/test cases/failing/119 structured source empty string/main.rs b/test cases/failing/119 structured source empty string/main.rs new file mode 100644 index 0000000..e69de29 diff --git a/test cases/failing/119 structured source empty string/meson.build b/test cases/failing/119 structured source empty string/meson.build new file mode 100644 index 0000000..0715991 --- /dev/null +++ b/test cases/failing/119 structured source empty string/meson.build @@ -0,0 +1,13 @@ +project('structured_source with empty string key') + +if not add_languages(['rust'], required : false, native : false) + error('MESON_SKIP_TEST: Rust is required but not found.') +endif + +executable( + 'main', + structured_sources( + 'main.rs', + {'' : 'main.rs'}, + ) +) diff --git a/test cases/failing/119 structured source empty string/test.json b/test cases/failing/119 structured source empty string/test.json new file mode 100644 index 0000000..3d41fc2 --- /dev/null +++ b/test cases/failing/119 structured source empty string/test.json @@ -0,0 +1,7 @@ +{ + "stdout": [ + { + "line": "test cases/failing/119 structured source empty string/meson.build:7:0: ERROR: structured_sources: keys to dictionary argument may not be an empty string." + } + ] +} diff --git a/test cases/failing/12 string arithmetic/meson.build b/test cases/failing/12 string arithmetic/meson.build new file mode 100644 index 0000000..8bdd451 --- /dev/null +++ b/test cases/failing/12 string arithmetic/meson.build @@ -0,0 +1,3 @@ +project('string arithmetic') + +foo = 'a' + 3 diff --git a/test cases/failing/12 string arithmetic/test.json b/test cases/failing/12 string arithmetic/test.json new file mode 100644 index 0000000..96595c8 --- /dev/null +++ b/test cases/failing/12 string arithmetic/test.json @@ -0,0 +1,7 @@ +{ + "stdout": [ + { + "line": "test cases/failing/12 string arithmetic/meson.build:3:0: ERROR: The `+` operator of str does not accept objects of type int (3)" + } + ] +} diff --git a/test cases/failing/120 structured_sources conflicts/main.rs b/test cases/failing/120 structured_sources conflicts/main.rs new file mode 100644 index 0000000..e69de29 diff --git a/test cases/failing/120 structured_sources conflicts/meson.build b/test cases/failing/120 structured_sources conflicts/meson.build new file mode 100644 index 0000000..561ad86 --- /dev/null +++ b/test cases/failing/120 structured_sources conflicts/meson.build @@ -0,0 +1,17 @@ +project('structured_source with empty string key') + +if not add_languages(['rust'], required : false, native : false) + error('MESON_SKIP_TEST: Rust is required but not found.') +endif + +executable( + 'main', + [ + structured_sources( + 'main.rs', + ), + structured_sources( + 'main.rs', + ), + ], +) diff --git a/test cases/failing/120 structured_sources conflicts/test.json b/test cases/failing/120 structured_sources conflicts/test.json new file mode 100644 index 0000000..2f3d1ef --- /dev/null +++ b/test cases/failing/120 structured_sources conflicts/test.json @@ -0,0 +1,7 @@ +{ + "stdout": [ + { + "line": "test cases/failing/120 structured_sources conflicts/meson.build:7:0: ERROR: Conflicting sources in structured sources: main.rs" + } + ] +} diff --git a/test cases/failing/121 missing compiler/meson.build b/test cases/failing/121 missing compiler/meson.build new file mode 100644 index 0000000..19bdd0c --- /dev/null +++ b/test cases/failing/121 missing compiler/meson.build @@ -0,0 +1,3 @@ +project('main project', 'c') + +subproject('sub') diff --git a/test cases/failing/121 missing compiler/subprojects/sub/main.c b/test cases/failing/121 missing compiler/subprojects/sub/main.c new file mode 100644 index 0000000..44e82e2 --- /dev/null +++ b/test cases/failing/121 missing compiler/subprojects/sub/main.c @@ -0,0 +1 @@ +int main(int argc, char *argv[]) { return 0; } diff --git a/test cases/failing/121 missing compiler/subprojects/sub/meson.build b/test cases/failing/121 missing compiler/subprojects/sub/meson.build new file mode 100644 index 0000000..b60850c --- /dev/null +++ b/test cases/failing/121 missing compiler/subprojects/sub/meson.build @@ -0,0 +1,4 @@ +project('sub') + +# Should fail because we did not add C language, even if parent project did. +executable('app', 'main.c') diff --git a/test cases/failing/121 missing compiler/test.json b/test cases/failing/121 missing compiler/test.json new file mode 100644 index 0000000..442e331 --- /dev/null +++ b/test cases/failing/121 missing compiler/test.json @@ -0,0 +1,7 @@ +{ + "stdout": [ + { + "line": "test cases/failing/121 missing compiler/subprojects/sub/meson.build:4:0: ERROR: No host machine compiler for 'subprojects/sub/main.c'" + } + ] +} diff --git a/test cases/failing/122 cmake subproject error/meson.build b/test cases/failing/122 cmake subproject error/meson.build new file mode 100644 index 0000000..a308239 --- /dev/null +++ b/test cases/failing/122 cmake subproject error/meson.build @@ -0,0 +1,8 @@ +project('cmake-executable-dependency') + +if not find_program('cmake', required: false).found() + error('MESON_SKIP_TEST CMake is not installed') +endif + +cmake = import('cmake') +cmlib = cmake.subproject('cmlib') diff --git a/test cases/failing/122 cmake subproject error/subprojects/cmlib/CMakeLists.txt b/test cases/failing/122 cmake subproject error/subprojects/cmlib/CMakeLists.txt new file mode 100644 index 0000000..edbe395 --- /dev/null +++ b/test cases/failing/122 cmake subproject error/subprojects/cmlib/CMakeLists.txt @@ -0,0 +1,5 @@ +cmake_minimum_required(VERSION 3.5) + +project(cmlib) + +message(FATAL_ERROR "Fancy error message") diff --git a/test cases/failing/122 cmake subproject error/test.json b/test cases/failing/122 cmake subproject error/test.json new file mode 100644 index 0000000..1201da2 --- /dev/null +++ b/test cases/failing/122 cmake subproject error/test.json @@ -0,0 +1,10 @@ +{ + "stdout": [ + { + "line": "test cases/failing/122 cmake subproject error/meson.build:8:0: ERROR: Failed to configure the CMake subproject: Fancy error message" + } + ], + "tools": { + "cmake": ">=3.14" + } +} diff --git a/test cases/failing/123 pkgconfig not relocatable outside prefix/meson.build b/test cases/failing/123 pkgconfig not relocatable outside prefix/meson.build new file mode 100644 index 0000000..7ebdfc3 --- /dev/null +++ b/test cases/failing/123 pkgconfig not relocatable outside prefix/meson.build @@ -0,0 +1,22 @@ +project( + 'pkgconfig-not-relocatable-outside-prefix', + version : '1.0', + default_options: [ + 'pkgconfig.relocatable=true', + ]) + +pkgg = import('pkgconfig') + +# A drive letter is needed on windows for this to be an absolute path. +if host_machine.system() == 'windows' + install_dir = 'C:/opt/lib/pkgconfig' +else + install_dir = '/opt/lib/pkgconfig' +endif + +pkgg.generate( + name : 'libsimple', + version : '1.0', + description : 'A simple pkgconfig file.', + install_dir: install_dir, +) diff --git a/test cases/failing/123 pkgconfig not relocatable outside prefix/test.json b/test cases/failing/123 pkgconfig not relocatable outside prefix/test.json new file mode 100644 index 0000000..2ca1320 --- /dev/null +++ b/test cases/failing/123 pkgconfig not relocatable outside prefix/test.json @@ -0,0 +1,8 @@ +{ + "stdout": [ + { + "line": "test cases/failing/123 pkgconfig not relocatable outside prefix/meson\\.build:17:5: ERROR: Pkgconfig prefix cannot be outside of the prefix when pkgconfig\\.relocatable=true. Pkgconfig prefix is (C:)?/opt/lib/pkgconfig.", + "match": "re" + } + ] +} diff --git a/test cases/failing/124 subproject sandbox violation/meson.build b/test cases/failing/124 subproject sandbox violation/meson.build new file mode 100644 index 0000000..d41994c --- /dev/null +++ b/test cases/failing/124 subproject sandbox violation/meson.build @@ -0,0 +1,34 @@ +project('subproject-sandbox-violation') + +sub1_d = subproject('subproj1').get_variable('d') +sub1_mustfail = sub1_d.get_variable('dir') / '..' / 'file.txt' + +sub2_d = subproject('subproj2').get_variable('d') +sub2_mustfail = sub2_d.get_variable('dir') / 'file.txt' + +main_d = declare_dependency( + variables: [ + 'dir=@0@'.format(meson.current_source_dir()), + ] +) +main_mustfail = main_d.get_variable('dir') / 'subprojects/subproj3/file.txt' + +if get_option('failmode') == 'parent-dir' + mustfail = sub1_mustfail +elif get_option('failmode') == 'not-installed' + mustfail = sub2_mustfail +elif get_option('failmode') == 'root-subdir' + mustfail = main_mustfail +endif + +custom_target( + 'mustfail', + input: mustfail, + output: 'file.txt', + command: [ + 'python3', '-c', + 'import os; shutil.copy(sys.argv[1], sys.argv[2])', + '@INPUT@', + '@OUTPUT@' + ], +) diff --git a/test cases/failing/124 subproject sandbox violation/meson_options.txt b/test cases/failing/124 subproject sandbox violation/meson_options.txt new file mode 100644 index 0000000..e7b782d --- /dev/null +++ b/test cases/failing/124 subproject sandbox violation/meson_options.txt @@ -0,0 +1 @@ +option('failmode', type: 'combo', choices: ['parent-dir', 'not-installed', 'root-subdir']) diff --git a/test cases/failing/124 subproject sandbox violation/subprojects/subproj1/file.txt b/test cases/failing/124 subproject sandbox violation/subprojects/subproj1/file.txt new file mode 100644 index 0000000..e69de29 diff --git a/test cases/failing/124 subproject sandbox violation/subprojects/subproj1/meson.build b/test cases/failing/124 subproject sandbox violation/subprojects/subproj1/meson.build new file mode 100644 index 0000000..bd33bf3 --- /dev/null +++ b/test cases/failing/124 subproject sandbox violation/subprojects/subproj1/meson.build @@ -0,0 +1,4 @@ +project('subproj1') + +install_data('file.txt') +subdir('nested') diff --git a/test cases/failing/124 subproject sandbox violation/subprojects/subproj1/nested/meson.build b/test cases/failing/124 subproject sandbox violation/subprojects/subproj1/nested/meson.build new file mode 100644 index 0000000..038c139 --- /dev/null +++ b/test cases/failing/124 subproject sandbox violation/subprojects/subproj1/nested/meson.build @@ -0,0 +1,5 @@ +d = declare_dependency( + variables: [ + 'dir=@0@'.format(meson.current_source_dir()), + ] +) diff --git a/test cases/failing/124 subproject sandbox violation/subprojects/subproj2/file.txt b/test cases/failing/124 subproject sandbox violation/subprojects/subproj2/file.txt new file mode 100644 index 0000000..e69de29 diff --git a/test cases/failing/124 subproject sandbox violation/subprojects/subproj2/meson.build b/test cases/failing/124 subproject sandbox violation/subprojects/subproj2/meson.build new file mode 100644 index 0000000..a6032aa --- /dev/null +++ b/test cases/failing/124 subproject sandbox violation/subprojects/subproj2/meson.build @@ -0,0 +1,7 @@ +project('subproj1') + +d = declare_dependency( + variables: [ + 'dir=@0@'.format(meson.current_source_dir()), + ] +) diff --git a/test cases/failing/124 subproject sandbox violation/subprojects/subproj2/nested/meson.build b/test cases/failing/124 subproject sandbox violation/subprojects/subproj2/nested/meson.build new file mode 100644 index 0000000..e69de29 diff --git a/test cases/failing/124 subproject sandbox violation/subprojects/subproj3/file.txt b/test cases/failing/124 subproject sandbox violation/subprojects/subproj3/file.txt new file mode 100644 index 0000000..e69de29 diff --git a/test cases/failing/124 subproject sandbox violation/subprojects/subproj3/meson.build b/test cases/failing/124 subproject sandbox violation/subprojects/subproj3/meson.build new file mode 100644 index 0000000..c4fa64c --- /dev/null +++ b/test cases/failing/124 subproject sandbox violation/subprojects/subproj3/meson.build @@ -0,0 +1,3 @@ +project('subproj2') + +install_data('file.txt') diff --git a/test cases/failing/124 subproject sandbox violation/test.json b/test cases/failing/124 subproject sandbox violation/test.json new file mode 100644 index 0000000..ca3d142 --- /dev/null +++ b/test cases/failing/124 subproject sandbox violation/test.json @@ -0,0 +1,16 @@ +{ + "matrix": { + "options": { + "failmode": [ + { "val": "not-installed" }, + { "val": "parent-dir" }, + { "val": "root-subdir" } + ] + } + }, + "stdout": [ + { + "line": "test cases/failing/124 subproject sandbox violation/meson.build:24:0: ERROR: Sandbox violation: Tried to grab file file.txt from a nested subproject." + } + ] +} diff --git a/test cases/failing/125 override and add_project_dependency/inc/lib.h b/test cases/failing/125 override and add_project_dependency/inc/lib.h new file mode 100644 index 0000000..4cfc47e --- /dev/null +++ b/test cases/failing/125 override and add_project_dependency/inc/lib.h @@ -0,0 +1,2 @@ +#pragma once +void f(void); diff --git a/test cases/failing/125 override and add_project_dependency/lib.c b/test cases/failing/125 override and add_project_dependency/lib.c new file mode 100644 index 0000000..b8b22a3 --- /dev/null +++ b/test cases/failing/125 override and add_project_dependency/lib.c @@ -0,0 +1,3 @@ +#include +#include "lib.h" +void f() {puts("hello");} diff --git a/test cases/failing/125 override and add_project_dependency/meson.build b/test cases/failing/125 override and add_project_dependency/meson.build new file mode 100644 index 0000000..c878b01 --- /dev/null +++ b/test cases/failing/125 override and add_project_dependency/meson.build @@ -0,0 +1,8 @@ +project('super', 'c') + +inc = include_directories('inc') +lib = static_library('sneaky', 'lib.c', include_directories: inc) +meson.override_dependency('sneaky', + declare_dependency(link_with: lib, include_directories: inc)) + +subproject('a') diff --git a/test cases/failing/125 override and add_project_dependency/subprojects/a/meson.build b/test cases/failing/125 override and add_project_dependency/subprojects/a/meson.build new file mode 100644 index 0000000..4f6f070 --- /dev/null +++ b/test cases/failing/125 override and add_project_dependency/subprojects/a/meson.build @@ -0,0 +1,10 @@ +project('a', 'c') + +dep = dependency('sneaky') + +# does not work +add_project_dependencies(dep, language: 'c') +executable('prog', 'prog.c') + +# this would work instead: +# executable('prog', 'prog.c', dependencies: dep) diff --git a/test cases/failing/125 override and add_project_dependency/subprojects/a/prog.c b/test cases/failing/125 override and add_project_dependency/subprojects/a/prog.c new file mode 100644 index 0000000..ce60f81 --- /dev/null +++ b/test cases/failing/125 override and add_project_dependency/subprojects/a/prog.c @@ -0,0 +1,6 @@ +#include "lib.h" + +int main() { + f(); + return 0; +} diff --git a/test cases/failing/125 override and add_project_dependency/test.json b/test cases/failing/125 override and add_project_dependency/test.json new file mode 100644 index 0000000..df749ec --- /dev/null +++ b/test cases/failing/125 override and add_project_dependency/test.json @@ -0,0 +1,7 @@ +{ + "stdout": [ + { + "line": "test cases/failing/125 override and add_project_dependency/subprojects/a/meson.build:6:0: ERROR: Dependencies must be external dependencies" + } + ] +} diff --git a/test cases/failing/126 targets before add_project_dependency/inc/lib.h b/test cases/failing/126 targets before add_project_dependency/inc/lib.h new file mode 100644 index 0000000..4cfc47e --- /dev/null +++ b/test cases/failing/126 targets before add_project_dependency/inc/lib.h @@ -0,0 +1,2 @@ +#pragma once +void f(void); diff --git a/test cases/failing/126 targets before add_project_dependency/lib.c b/test cases/failing/126 targets before add_project_dependency/lib.c new file mode 100644 index 0000000..b8b22a3 --- /dev/null +++ b/test cases/failing/126 targets before add_project_dependency/lib.c @@ -0,0 +1,3 @@ +#include +#include "lib.h" +void f() {puts("hello");} diff --git a/test cases/failing/126 targets before add_project_dependency/meson.build b/test cases/failing/126 targets before add_project_dependency/meson.build new file mode 100644 index 0000000..38fe102 --- /dev/null +++ b/test cases/failing/126 targets before add_project_dependency/meson.build @@ -0,0 +1,5 @@ +project('test', 'c') + +static_library('lib', 'lib.c') +inc = include_directories('inc') +add_project_dependencies(declare_dependency(include_directories: inc), language: 'c') diff --git a/test cases/failing/126 targets before add_project_dependency/test.json b/test cases/failing/126 targets before add_project_dependency/test.json new file mode 100644 index 0000000..d467914 --- /dev/null +++ b/test cases/failing/126 targets before add_project_dependency/test.json @@ -0,0 +1,7 @@ +{ + "stdout": [ + { + "line": "test cases/failing/126 targets before add_project_dependency/meson.build:5:0: ERROR: Tried to use 'add_project_dependencies' after a build target has been declared." + } + ] +} diff --git a/test cases/failing/127 extract from unity/meson.build b/test cases/failing/127 extract from unity/meson.build new file mode 100644 index 0000000..9e3e65f --- /dev/null +++ b/test cases/failing/127 extract from unity/meson.build @@ -0,0 +1,4 @@ +project('extract nonexisting gen', 'c') + +lib1 = library('lib1', 'src1.c', 'src2.c', override_options: ['unity=on']) +lib2 = library('lib2', objects: lib1.extract_objects('src1.c')) diff --git a/test cases/failing/127 extract from unity/src1.c b/test cases/failing/127 extract from unity/src1.c new file mode 100644 index 0000000..da971bb --- /dev/null +++ b/test cases/failing/127 extract from unity/src1.c @@ -0,0 +1,3 @@ +int sub_lib_method1() { + return 1337; +} diff --git a/test cases/failing/127 extract from unity/src2.c b/test cases/failing/127 extract from unity/src2.c new file mode 100644 index 0000000..a461669 --- /dev/null +++ b/test cases/failing/127 extract from unity/src2.c @@ -0,0 +1,3 @@ +int sub_lib_method2() { + return 1337; +} diff --git a/test cases/failing/127 extract from unity/test.json b/test cases/failing/127 extract from unity/test.json new file mode 100644 index 0000000..e27599d --- /dev/null +++ b/test cases/failing/127 extract from unity/test.json @@ -0,0 +1,7 @@ +{ + "stdout": [ + { + "line": "test cases/failing/127 extract from unity/meson.build:4:0: ERROR: Single object files can not be extracted in Unity builds. You can only extract all the object files for each compiler at once." + } + ] +} diff --git a/test cases/failing/128 subproject object as a dependency/main.c b/test cases/failing/128 subproject object as a dependency/main.c new file mode 100644 index 0000000..78f2de1 --- /dev/null +++ b/test cases/failing/128 subproject object as a dependency/main.c @@ -0,0 +1 @@ +int main(void) { return 0; } diff --git a/test cases/failing/128 subproject object as a dependency/meson.build b/test cases/failing/128 subproject object as a dependency/meson.build new file mode 100644 index 0000000..0114b9a --- /dev/null +++ b/test cases/failing/128 subproject object as a dependency/meson.build @@ -0,0 +1,4 @@ +project('test', 'c') + +executable( + 'main', 'main.c', dependencies: subproject('sub')) diff --git a/test cases/failing/128 subproject object as a dependency/subprojects/sub/meson.build b/test cases/failing/128 subproject object as a dependency/subprojects/sub/meson.build new file mode 100644 index 0000000..0adfd6a --- /dev/null +++ b/test cases/failing/128 subproject object as a dependency/subprojects/sub/meson.build @@ -0,0 +1 @@ +project('sub') diff --git a/test cases/failing/128 subproject object as a dependency/test.json b/test cases/failing/128 subproject object as a dependency/test.json new file mode 100644 index 0000000..b04bf37 --- /dev/null +++ b/test cases/failing/128 subproject object as a dependency/test.json @@ -0,0 +1,7 @@ +{ + "stdout": [ + { + "line": "test cases/failing/128 subproject object as a dependency/meson.build:3:0: ERROR: Tried to use subproject object as a dependency." + } + ] +} diff --git a/test cases/failing/129 generator host binary/exe.c b/test cases/failing/129 generator host binary/exe.c new file mode 100644 index 0000000..78f2de1 --- /dev/null +++ b/test cases/failing/129 generator host binary/exe.c @@ -0,0 +1 @@ +int main(void) { return 0; } diff --git a/test cases/failing/129 generator host binary/lib.in b/test cases/failing/129 generator host binary/lib.in new file mode 100644 index 0000000..d0b6ab7 --- /dev/null +++ b/test cases/failing/129 generator host binary/lib.in @@ -0,0 +1 @@ +int foo(void) { return 7; } diff --git a/test cases/failing/129 generator host binary/meson.build b/test cases/failing/129 generator host binary/meson.build new file mode 100644 index 0000000..fc1f9be --- /dev/null +++ b/test cases/failing/129 generator host binary/meson.build @@ -0,0 +1,14 @@ +project('generator host binary no exe_wrapper') + +if meson.can_run_host_binaries() + error('MESON_SKIP_TEST: test requires that build machine cannot run host binaries') +endif + +add_languages('c', native : false) + +exe = executable('exe', 'exe.c', native : false) + +gen = generator(exe, output : '@BASENAME@.c', arguments : ['@INPUT@', '@OUTPU@']) +foo = gen.process('lib.in') + +library('foo', foo) diff --git a/test cases/failing/129 generator host binary/test.json b/test cases/failing/129 generator host binary/test.json new file mode 100644 index 0000000..7e354d6 --- /dev/null +++ b/test cases/failing/129 generator host binary/test.json @@ -0,0 +1,5 @@ +{ + "stdout": [ + { "line": "ERROR: An exe_wrapper is needed but was not found. Please define one in cross file and check the command and/or add it to PATH." } + ] +} diff --git a/test cases/failing/13 array arithmetic/meson.build b/test cases/failing/13 array arithmetic/meson.build new file mode 100644 index 0000000..f43f81c --- /dev/null +++ b/test cases/failing/13 array arithmetic/meson.build @@ -0,0 +1,3 @@ +project('array arithmetic') + +foo = ['a', 'b'] * 3 diff --git a/test cases/failing/13 array arithmetic/test.json b/test cases/failing/13 array arithmetic/test.json new file mode 100644 index 0000000..8904775 --- /dev/null +++ b/test cases/failing/13 array arithmetic/test.json @@ -0,0 +1,7 @@ +{ + "stdout": [ + { + "line": "test cases/failing/13 array arithmetic/meson.build:3:0: ERROR: Object <[ArrayHolder] holds [list]: ['a', 'b']> of type array does not support the `*` operator." + } + ] +} diff --git a/test cases/failing/14 invalid option name/meson.build b/test cases/failing/14 invalid option name/meson.build new file mode 100644 index 0000000..6312312 --- /dev/null +++ b/test cases/failing/14 invalid option name/meson.build @@ -0,0 +1 @@ +project('foo') diff --git a/test cases/failing/14 invalid option name/meson_options.txt b/test cases/failing/14 invalid option name/meson_options.txt new file mode 100644 index 0000000..aab6ae8 --- /dev/null +++ b/test cases/failing/14 invalid option name/meson_options.txt @@ -0,0 +1 @@ +option('invalid:name', type : 'boolean', value : false) diff --git a/test cases/failing/14 invalid option name/test.json b/test cases/failing/14 invalid option name/test.json new file mode 100644 index 0000000..71e685d --- /dev/null +++ b/test cases/failing/14 invalid option name/test.json @@ -0,0 +1,7 @@ +{ + "stdout": [ + { + "line": "test cases/failing/14 invalid option name/meson_options.txt:1:0: ERROR: Option names can only contain letters, numbers or dashes." + } + ] +} diff --git a/test cases/failing/15 kwarg before arg/meson.build b/test cases/failing/15 kwarg before arg/meson.build new file mode 100644 index 0000000..f07d950 --- /dev/null +++ b/test cases/failing/15 kwarg before arg/meson.build @@ -0,0 +1,3 @@ +project('kwarg before arg', 'c') + +executable(sources : 'prog.c', 'prog') diff --git a/test cases/failing/15 kwarg before arg/prog.c b/test cases/failing/15 kwarg before arg/prog.c new file mode 100644 index 0000000..0314ff1 --- /dev/null +++ b/test cases/failing/15 kwarg before arg/prog.c @@ -0,0 +1 @@ +int main(int argc, char **argv) { return 0; } diff --git a/test cases/failing/15 kwarg before arg/test.json b/test cases/failing/15 kwarg before arg/test.json new file mode 100644 index 0000000..c7f72c3 --- /dev/null +++ b/test cases/failing/15 kwarg before arg/test.json @@ -0,0 +1,7 @@ +{ + "stdout": [ + { + "line": "test cases/failing/15 kwarg before arg/meson.build:3:0: ERROR: All keyword arguments must be after positional arguments." + } + ] +} diff --git a/test cases/failing/16 extract from subproject/main.c b/test cases/failing/16 extract from subproject/main.c new file mode 100644 index 0000000..6c8ecae --- /dev/null +++ b/test cases/failing/16 extract from subproject/main.c @@ -0,0 +1,5 @@ +int sub_lib_method(void); + +int main(void) { + return 1337 - sub_lib_method(); +} diff --git a/test cases/failing/16 extract from subproject/meson.build b/test cases/failing/16 extract from subproject/meson.build new file mode 100644 index 0000000..286aaa1 --- /dev/null +++ b/test cases/failing/16 extract from subproject/meson.build @@ -0,0 +1,9 @@ +project('extract subproject object', 'c') + +sub = subproject('sub_project') +lib = sub.get_variable('lib') + +exe = executable('exe', 'main.c', + objects : lib.extract_objects('sub_lib.c')) + +test('extraction test', exe) diff --git a/test cases/failing/16 extract from subproject/subprojects/sub_project/meson.build b/test cases/failing/16 extract from subproject/subprojects/sub_project/meson.build new file mode 100644 index 0000000..0810df5 --- /dev/null +++ b/test cases/failing/16 extract from subproject/subprojects/sub_project/meson.build @@ -0,0 +1,3 @@ +project('extract subproject object -- subproject', 'c') + +lib = library('sub_lib', 'sub_lib.c') diff --git a/test cases/failing/16 extract from subproject/subprojects/sub_project/sub_lib.c b/test cases/failing/16 extract from subproject/subprojects/sub_project/sub_lib.c new file mode 100644 index 0000000..be3c9aa --- /dev/null +++ b/test cases/failing/16 extract from subproject/subprojects/sub_project/sub_lib.c @@ -0,0 +1,3 @@ +int sub_lib_method() { + return 1337; +} diff --git a/test cases/failing/16 extract from subproject/test.json b/test cases/failing/16 extract from subproject/test.json new file mode 100644 index 0000000..2e32904 --- /dev/null +++ b/test cases/failing/16 extract from subproject/test.json @@ -0,0 +1,7 @@ +{ + "stdout": [ + { + "line": "test cases/failing/16 extract from subproject/meson.build:6:0: ERROR: Tried to extract objects from a different subproject." + } + ] +} diff --git a/test cases/failing/17 same target/file.c b/test cases/failing/17 same target/file.c new file mode 100644 index 0000000..7412372 --- /dev/null +++ b/test cases/failing/17 same target/file.c @@ -0,0 +1 @@ +int func() { return 0; } diff --git a/test cases/failing/17 same target/meson.build b/test cases/failing/17 same target/meson.build new file mode 100644 index 0000000..ee586d0 --- /dev/null +++ b/test cases/failing/17 same target/meson.build @@ -0,0 +1,4 @@ +project('same target', 'c') + +static_library('foo', 'file.c') +static_library('foo', 'file.c') diff --git a/test cases/failing/17 same target/test.json b/test cases/failing/17 same target/test.json new file mode 100644 index 0000000..0005ba4 --- /dev/null +++ b/test cases/failing/17 same target/test.json @@ -0,0 +1,7 @@ +{ + "stdout": [ + { + "line": "test cases/failing/17 same target/meson.build:4:0: ERROR: Tried to create target \"foo\", but a target of that name already exists." + } + ] +} diff --git a/test cases/failing/18 wrong plusassign/meson.build b/test cases/failing/18 wrong plusassign/meson.build new file mode 100644 index 0000000..af7727a --- /dev/null +++ b/test cases/failing/18 wrong plusassign/meson.build @@ -0,0 +1,3 @@ +project('false plusassign') + +3 += 4 diff --git a/test cases/failing/18 wrong plusassign/test.json b/test cases/failing/18 wrong plusassign/test.json new file mode 100644 index 0000000..c698f85 --- /dev/null +++ b/test cases/failing/18 wrong plusassign/test.json @@ -0,0 +1,7 @@ +{ + "stdout": [ + { + "line": "test cases/failing/18 wrong plusassign/meson.build:3:0: ERROR: Plusassignment target must be an id." + } + ] +} diff --git a/test cases/failing/19 target clash/clash.c b/test cases/failing/19 target clash/clash.c new file mode 100644 index 0000000..2daa06c --- /dev/null +++ b/test cases/failing/19 target clash/clash.c @@ -0,0 +1,6 @@ +#include + +int main(int argc, char **argv) { + printf("Clash 2.\n"); + return 0; +} diff --git a/test cases/failing/19 target clash/meson.build b/test cases/failing/19 target clash/meson.build new file mode 100644 index 0000000..4fd0934 --- /dev/null +++ b/test cases/failing/19 target clash/meson.build @@ -0,0 +1,15 @@ +project('clash', 'c') + +# This setup causes a namespace clash when two Meson targets would +# produce a Ninja targets with the same name. It only works on +# unix, because on Windows the target has a '.exe' suffix. +# +# This test might fail to work on different backends or when +# output location is redirected. + +if host_machine.system() == 'windows' or host_machine.system() == 'cygwin' + error('MESON_SKIP_TEST test only works on platforms where executables have no suffix.') +endif + +executable('clash', 'clash.c') +run_target('clash', command: ['echo', 'clash 1']) diff --git a/test cases/failing/19 target clash/test.json b/test cases/failing/19 target clash/test.json new file mode 100644 index 0000000..d22b894 --- /dev/null +++ b/test cases/failing/19 target clash/test.json @@ -0,0 +1,7 @@ +{ + "stdout": [ + { + "line": "ERROR: Multiple producers for Ninja target \"clash\". Please rename your targets." + } + ] +} diff --git a/test cases/failing/2 missing file/meson.build b/test cases/failing/2 missing file/meson.build new file mode 100644 index 0000000..6b9133d --- /dev/null +++ b/test cases/failing/2 missing file/meson.build @@ -0,0 +1,3 @@ +project('missing file', 'c') + +executable('prog', 'missing.c') diff --git a/test cases/failing/2 missing file/test.json b/test cases/failing/2 missing file/test.json new file mode 100644 index 0000000..b95b8b0 --- /dev/null +++ b/test cases/failing/2 missing file/test.json @@ -0,0 +1,7 @@ +{ + "stdout": [ + { + "line": "test cases/failing/2 missing file/meson.build:3:0: ERROR: File missing.c does not exist." + } + ] +} diff --git a/test cases/failing/20 version/meson.build b/test cases/failing/20 version/meson.build new file mode 100644 index 0000000..d25a395 --- /dev/null +++ b/test cases/failing/20 version/meson.build @@ -0,0 +1 @@ +project('version mismatch', meson_version : '>100.0.0') diff --git a/test cases/failing/20 version/test.json b/test cases/failing/20 version/test.json new file mode 100644 index 0000000..f330624 --- /dev/null +++ b/test cases/failing/20 version/test.json @@ -0,0 +1,8 @@ +{ + "stdout": [ + { + "match": "re", + "line": "test cases/failing/20 version/meson\\.build:1:0: ERROR: Meson version is .* but project requires >100\\.0\\.0" + } + ] +} diff --git a/test cases/failing/21 subver/meson.build b/test cases/failing/21 subver/meson.build new file mode 100644 index 0000000..ea0f914 --- /dev/null +++ b/test cases/failing/21 subver/meson.build @@ -0,0 +1,3 @@ +project('master') + +x = subproject('foo', version : '>1.0.0') diff --git a/test cases/failing/21 subver/subprojects/foo/meson.build b/test cases/failing/21 subver/subprojects/foo/meson.build new file mode 100644 index 0000000..615ee92 --- /dev/null +++ b/test cases/failing/21 subver/subprojects/foo/meson.build @@ -0,0 +1 @@ +project('foo', version : '1.0.0') diff --git a/test cases/failing/21 subver/test.json b/test cases/failing/21 subver/test.json new file mode 100644 index 0000000..a197b36 --- /dev/null +++ b/test cases/failing/21 subver/test.json @@ -0,0 +1,7 @@ +{ + "stdout": [ + { + "line": "test cases/failing/21 subver/meson.build:3:0: ERROR: Subproject foo version is 1.0.0 but ['>1.0.0'] required." + } + ] +} diff --git a/test cases/failing/22 assert/meson.build b/test cases/failing/22 assert/meson.build new file mode 100644 index 0000000..45cff07 --- /dev/null +++ b/test cases/failing/22 assert/meson.build @@ -0,0 +1,3 @@ +project('failing assert') + +assert(false, 'I am fail.') diff --git a/test cases/failing/22 assert/test.json b/test cases/failing/22 assert/test.json new file mode 100644 index 0000000..edae999 --- /dev/null +++ b/test cases/failing/22 assert/test.json @@ -0,0 +1,7 @@ +{ + "stdout": [ + { + "line": "test cases/failing/22 assert/meson.build:3:0: ERROR: Assert failed: I am fail." + } + ] +} diff --git a/test cases/failing/23 rel testdir/meson.build b/test cases/failing/23 rel testdir/meson.build new file mode 100644 index 0000000..c10558b --- /dev/null +++ b/test cases/failing/23 rel testdir/meson.build @@ -0,0 +1,4 @@ +project('nonabs workdir', 'c') + +exe = executable('simple', 'simple.c') +test('simple', exe, workdir : '.') diff --git a/test cases/failing/23 rel testdir/simple.c b/test cases/failing/23 rel testdir/simple.c new file mode 100644 index 0000000..11b7fad --- /dev/null +++ b/test cases/failing/23 rel testdir/simple.c @@ -0,0 +1,3 @@ +int main(int argc, char **argv) { + return 0; +} diff --git a/test cases/failing/23 rel testdir/test.json b/test cases/failing/23 rel testdir/test.json new file mode 100644 index 0000000..bc80bc6 --- /dev/null +++ b/test cases/failing/23 rel testdir/test.json @@ -0,0 +1,7 @@ +{ + "stdout": [ + { + "line": "test cases/failing/23 rel testdir/meson.build:4:0: ERROR: test keyword argument \"workdir\" must be an absolute path" + } + ] +} diff --git a/test cases/failing/24 int conversion/meson.build b/test cases/failing/24 int conversion/meson.build new file mode 100644 index 0000000..8db72f3 --- /dev/null +++ b/test cases/failing/24 int conversion/meson.build @@ -0,0 +1,3 @@ +project('int conversion') + +'notanumber'.to_int() diff --git a/test cases/failing/24 int conversion/test.json b/test cases/failing/24 int conversion/test.json new file mode 100644 index 0000000..e749928 --- /dev/null +++ b/test cases/failing/24 int conversion/test.json @@ -0,0 +1,7 @@ +{ + "stdout": [ + { + "line": "test cases/failing/24 int conversion/meson.build:3:13: ERROR: String 'notanumber' cannot be converted to int" + } + ] +} diff --git a/test cases/failing/25 badlang/meson.build b/test cases/failing/25 badlang/meson.build new file mode 100644 index 0000000..a31059b --- /dev/null +++ b/test cases/failing/25 badlang/meson.build @@ -0,0 +1,3 @@ +project('badlang') + +add_languages('nonexisting') diff --git a/test cases/failing/25 badlang/test.json b/test cases/failing/25 badlang/test.json new file mode 100644 index 0000000..0b23fd7 --- /dev/null +++ b/test cases/failing/25 badlang/test.json @@ -0,0 +1,7 @@ +{ + "stdout": [ + { + "line": "test cases/failing/25 badlang/meson.build:3:0: ERROR: Tried to use unknown language \"nonexisting\"." + } + ] +} diff --git a/test cases/failing/26 output subdir/foo.in b/test cases/failing/26 output subdir/foo.in new file mode 100644 index 0000000..3d1bf19 --- /dev/null +++ b/test cases/failing/26 output subdir/foo.in @@ -0,0 +1 @@ +Nothing here. diff --git a/test cases/failing/26 output subdir/meson.build b/test cases/failing/26 output subdir/meson.build new file mode 100644 index 0000000..c4bd806 --- /dev/null +++ b/test cases/failing/26 output subdir/meson.build @@ -0,0 +1,5 @@ +project('outdir path') + +configure_file(input : 'foo.in', + output : 'subdir/foo', + copy: true) diff --git a/test cases/failing/26 output subdir/subdir/dummy.txt b/test cases/failing/26 output subdir/subdir/dummy.txt new file mode 100644 index 0000000..7e907f1 --- /dev/null +++ b/test cases/failing/26 output subdir/subdir/dummy.txt @@ -0,0 +1 @@ +I'm only here because Git is stupid about empty dirs. diff --git a/test cases/failing/26 output subdir/test.json b/test cases/failing/26 output subdir/test.json new file mode 100644 index 0000000..df09726 --- /dev/null +++ b/test cases/failing/26 output subdir/test.json @@ -0,0 +1,7 @@ +{ + "stdout": [ + { + "line": "test cases/failing/26 output subdir/meson.build:3:0: ERROR: configure_file keyword argument \"output\" Output 'subdir/foo' must not contain a path segment." + } + ] +} diff --git a/test cases/failing/27 noprog use/meson.build b/test cases/failing/27 noprog use/meson.build new file mode 100644 index 0000000..af31ece --- /dev/null +++ b/test cases/failing/27 noprog use/meson.build @@ -0,0 +1,9 @@ +project('using not found exe') + +nope = find_program('nonexisting', required : false) + +custom_target( 'aa', + input: 'meson.build', + output: 'foobar', + command: [nope, '@INPUT@', '@OUTPUT@'] +) diff --git a/test cases/failing/27 noprog use/test.json b/test cases/failing/27 noprog use/test.json new file mode 100644 index 0000000..b84562e --- /dev/null +++ b/test cases/failing/27 noprog use/test.json @@ -0,0 +1,7 @@ +{ + "stdout": [ + { + "line": "test cases/failing/27 noprog use/meson.build:5:0: ERROR: Tried to use not-found external program in \"command\"" + } + ] +} diff --git a/test cases/failing/28 no crossprop/meson.build b/test cases/failing/28 no crossprop/meson.build new file mode 100644 index 0000000..9152077 --- /dev/null +++ b/test cases/failing/28 no crossprop/meson.build @@ -0,0 +1,3 @@ +project('no crossprop') + +message(meson.get_cross_property('nonexisting')) diff --git a/test cases/failing/28 no crossprop/test.json b/test cases/failing/28 no crossprop/test.json new file mode 100644 index 0000000..6fb9dce --- /dev/null +++ b/test cases/failing/28 no crossprop/test.json @@ -0,0 +1,7 @@ +{ + "stdout": [ + { + "line": "test cases/failing/28 no crossprop/meson.build:3:0: ERROR: Unknown property for host machine: nonexisting" + } + ] +} diff --git a/test cases/failing/29 nested ternary/meson.build b/test cases/failing/29 nested ternary/meson.build new file mode 100644 index 0000000..76364ce --- /dev/null +++ b/test cases/failing/29 nested ternary/meson.build @@ -0,0 +1,3 @@ +project('nested ternary') + +x = true ? (false ? 1 : 0) : 2 diff --git a/test cases/failing/29 nested ternary/test.json b/test cases/failing/29 nested ternary/test.json new file mode 100644 index 0000000..ba05013 --- /dev/null +++ b/test cases/failing/29 nested ternary/test.json @@ -0,0 +1,7 @@ +{ + "stdout": [ + { + "line": "test cases/failing/29 nested ternary/meson.build:3:12: ERROR: Nested ternary operators are not allowed." + } + ] +} diff --git a/test cases/failing/3 missing subdir/meson.build b/test cases/failing/3 missing subdir/meson.build new file mode 100644 index 0000000..9301c1e --- /dev/null +++ b/test cases/failing/3 missing subdir/meson.build @@ -0,0 +1,3 @@ +project('subdir') + +subdir('missing') diff --git a/test cases/failing/3 missing subdir/test.json b/test cases/failing/3 missing subdir/test.json new file mode 100644 index 0000000..562de25 --- /dev/null +++ b/test cases/failing/3 missing subdir/test.json @@ -0,0 +1,9 @@ +{ + "stdout": [ + { + "comment": "'missing/meson.build' gets transformed with os.path.sep separators", + "match": "re", + "line": "test cases/failing/3 missing subdir/meson\\.build:3:0: ERROR: Non\\-existent build file 'missing[\\\\/]meson\\.build'" + } + ] +} diff --git a/test cases/failing/30 invalid man extension/foo.a1 b/test cases/failing/30 invalid man extension/foo.a1 new file mode 100644 index 0000000..e69de29 diff --git a/test cases/failing/30 invalid man extension/meson.build b/test cases/failing/30 invalid man extension/meson.build new file mode 100644 index 0000000..b3694d5 --- /dev/null +++ b/test cases/failing/30 invalid man extension/meson.build @@ -0,0 +1,2 @@ +project('man install') +m1 = install_man('foo.a1') diff --git a/test cases/failing/30 invalid man extension/test.json b/test cases/failing/30 invalid man extension/test.json new file mode 100644 index 0000000..3e5f45d --- /dev/null +++ b/test cases/failing/30 invalid man extension/test.json @@ -0,0 +1,7 @@ +{ + "stdout": [ + { + "line": "test cases/failing/30 invalid man extension/meson.build:2:0: ERROR: Man file must have a file extension of a number between 1 and 9" + } + ] +} diff --git a/test cases/failing/31 no man extension/foo b/test cases/failing/31 no man extension/foo new file mode 100644 index 0000000..e69de29 diff --git a/test cases/failing/31 no man extension/meson.build b/test cases/failing/31 no man extension/meson.build new file mode 100644 index 0000000..33fdd3e --- /dev/null +++ b/test cases/failing/31 no man extension/meson.build @@ -0,0 +1,2 @@ +project('man install') +m1 = install_man('foo') diff --git a/test cases/failing/31 no man extension/test.json b/test cases/failing/31 no man extension/test.json new file mode 100644 index 0000000..0972da1 --- /dev/null +++ b/test cases/failing/31 no man extension/test.json @@ -0,0 +1,7 @@ +{ + "stdout": [ + { + "line": "test cases/failing/31 no man extension/meson.build:2:0: ERROR: Man file must have a file extension of a number between 1 and 9" + } + ] +} diff --git a/test cases/failing/32 exe static shared/meson.build b/test cases/failing/32 exe static shared/meson.build new file mode 100644 index 0000000..2ae5125 --- /dev/null +++ b/test cases/failing/32 exe static shared/meson.build @@ -0,0 +1,11 @@ +project('statchain', 'c') + +host_system = host_machine.system() +if host_system == 'windows' or host_system == 'darwin' + error('MESON_SKIP_TEST test only fails on Linux and BSD') +endif + +statlib = static_library('stat', 'stat.c', pic : false) +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/failing/32 exe static shared/prog.c b/test cases/failing/32 exe static shared/prog.c new file mode 100644 index 0000000..26603b6 --- /dev/null +++ b/test cases/failing/32 exe static shared/prog.c @@ -0,0 +1,10 @@ +int shlibfunc2(); +int statlibfunc(); + +int main(int argc, char **argv) { + if (statlibfunc() != 42) + return 1; + if (shlibfunc2() != 24) + return 1; + return 0; +} diff --git a/test cases/failing/32 exe static shared/shlib2.c b/test cases/failing/32 exe static shared/shlib2.c new file mode 100644 index 0000000..5b68843 --- /dev/null +++ b/test cases/failing/32 exe static shared/shlib2.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 + +int statlibfunc(void); + +int DLL_PUBLIC shlibfunc2(void) { + return 24; +} diff --git a/test cases/failing/32 exe static shared/stat.c b/test cases/failing/32 exe static shared/stat.c new file mode 100644 index 0000000..56ec66c --- /dev/null +++ b/test cases/failing/32 exe static shared/stat.c @@ -0,0 +1,3 @@ +int statlibfunc() { + return 42; +} diff --git a/test cases/failing/32 exe static shared/test.json b/test cases/failing/32 exe static shared/test.json new file mode 100644 index 0000000..51d3804 --- /dev/null +++ b/test cases/failing/32 exe static shared/test.json @@ -0,0 +1,7 @@ +{ + "stdout": [ + { + "line": "test cases/failing/32 exe static shared/meson.build:9:0: ERROR: Can't link non-PIC static library 'stat' into shared library 'shr2'. Use the 'pic' option to static_library to build with PIC." + } + ] +} diff --git a/test cases/failing/33 non-root subproject/meson.build b/test cases/failing/33 non-root subproject/meson.build new file mode 100644 index 0000000..65b1d23 --- /dev/null +++ b/test cases/failing/33 non-root subproject/meson.build @@ -0,0 +1,3 @@ +project('non-root subproject') + +subdir('some') diff --git a/test cases/failing/33 non-root subproject/some/meson.build b/test cases/failing/33 non-root subproject/some/meson.build new file mode 100644 index 0000000..d82f451 --- /dev/null +++ b/test cases/failing/33 non-root subproject/some/meson.build @@ -0,0 +1 @@ +dependency('definitely-doesnt-exist', fallback : ['someproj', 'some_dep']) diff --git a/test cases/failing/33 non-root subproject/test.json b/test cases/failing/33 non-root subproject/test.json new file mode 100644 index 0000000..52baf6a --- /dev/null +++ b/test cases/failing/33 non-root subproject/test.json @@ -0,0 +1,7 @@ +{ + "stdout": [ + { + "line": "test cases/failing/33 non-root subproject/some/meson.build:1:0: ERROR: Neither a subproject directory nor a someproj.wrap file was found." + } + ] +} diff --git a/test cases/failing/34 dependency not-required then required/meson.build b/test cases/failing/34 dependency not-required then required/meson.build new file mode 100644 index 0000000..54f5a58 --- /dev/null +++ b/test cases/failing/34 dependency not-required then required/meson.build @@ -0,0 +1,4 @@ +project('dep-test', version : '1.0') + +foo_dep = dependency('foo-bar-xyz-12.3', required : false) +bar_dep = dependency('foo-bar-xyz-12.3') diff --git a/test cases/failing/34 dependency not-required then required/test.json b/test cases/failing/34 dependency not-required then required/test.json new file mode 100644 index 0000000..3cf35f5 --- /dev/null +++ b/test cases/failing/34 dependency not-required then required/test.json @@ -0,0 +1,8 @@ +{ + "stdout": [ + { + "match": "re", + "line": ".*/meson\\.build:4:0: ERROR: (Pkg-config binary for machine MachineChoice\\.HOST not found\\. Giving up\\.|Dependency \"foo\\-bar\\-xyz\\-12\\.3\" not found, tried .*)" + } + ] +} diff --git a/test cases/failing/35 project argument after target/exe.c b/test cases/failing/35 project argument after target/exe.c new file mode 100644 index 0000000..11b7fad --- /dev/null +++ b/test cases/failing/35 project argument after target/exe.c @@ -0,0 +1,3 @@ +int main(int argc, char **argv) { + return 0; +} diff --git a/test cases/failing/35 project argument after target/meson.build b/test cases/failing/35 project argument after target/meson.build new file mode 100644 index 0000000..5402c67 --- /dev/null +++ b/test cases/failing/35 project argument after target/meson.build @@ -0,0 +1,7 @@ +project('project argument after target failing', 'c', + version : '2.3.4', + license : 'mylicense') + +add_project_arguments('-DPROJECT_OPTION', language: 'c') +e = executable('exe', 'exe.c') +add_project_arguments('-DPROJECT_OPTION1', language: 'c') diff --git a/test cases/failing/35 project argument after target/test.json b/test cases/failing/35 project argument after target/test.json new file mode 100644 index 0000000..f5efd9b --- /dev/null +++ b/test cases/failing/35 project argument after target/test.json @@ -0,0 +1,7 @@ +{ + "stdout": [ + { + "line": "test cases/failing/35 project argument after target/meson.build:7:0: ERROR: Tried to use 'add_project_arguments' after a build target has been declared." + } + ] +} diff --git a/test cases/failing/36 pkgconfig dependency impossible conditions/meson.build b/test cases/failing/36 pkgconfig dependency impossible conditions/meson.build new file mode 100644 index 0000000..874b581 --- /dev/null +++ b/test cases/failing/36 pkgconfig dependency impossible conditions/meson.build @@ -0,0 +1,7 @@ +project('impossible-dep-test', 'c', version : '1.0') + +if not dependency('zlib', required: false).found() + error('MESON_SKIP_TEST test requires zlib') +endif + +dependency('zlib', version : ['>=1.0', '<1.0']) diff --git a/test cases/failing/36 pkgconfig dependency impossible conditions/test.json b/test cases/failing/36 pkgconfig dependency impossible conditions/test.json new file mode 100644 index 0000000..6deddbe --- /dev/null +++ b/test cases/failing/36 pkgconfig dependency impossible conditions/test.json @@ -0,0 +1,7 @@ +{ + "stdout": [ + { + "line": "test cases/failing/36 pkgconfig dependency impossible conditions/meson.build:7:0: ERROR: Dependency 'zlib' is required but not found." + } + ] +} diff --git a/test cases/failing/37 has function external dependency/meson.build b/test cases/failing/37 has function external dependency/meson.build new file mode 100644 index 0000000..45a3bc2 --- /dev/null +++ b/test cases/failing/37 has function external dependency/meson.build @@ -0,0 +1,8 @@ +project('has function ext dep', 'c') + +cc = meson.get_compiler('c') + +mylib = shared_library('mylib', 'mylib.c') +mylib_dep = declare_dependency(link_with : mylib) +# Only external dependencies can work here +cc.has_function('malloc', dependencies : mylib_dep) diff --git a/test cases/failing/37 has function external dependency/mylib.c b/test cases/failing/37 has function external dependency/mylib.c new file mode 100644 index 0000000..d9fbd34 --- /dev/null +++ b/test cases/failing/37 has function external dependency/mylib.c @@ -0,0 +1 @@ +int testfunc(void) { return 0; } diff --git a/test cases/failing/37 has function external dependency/test.json b/test cases/failing/37 has function external dependency/test.json new file mode 100644 index 0000000..81d6f91 --- /dev/null +++ b/test cases/failing/37 has function external dependency/test.json @@ -0,0 +1,7 @@ +{ + "stdout": [ + { + "line": "test cases/failing/37 has function external dependency/meson.build:8:3: ERROR: Dependencies must be external dependencies" + } + ] +} diff --git a/test cases/failing/38 prefix absolute/meson.build b/test cases/failing/38 prefix absolute/meson.build new file mode 100644 index 0000000..6d0114b --- /dev/null +++ b/test cases/failing/38 prefix absolute/meson.build @@ -0,0 +1,2 @@ +project('prefix-abs', + default_options : ['prefix=some/path/notabs']) diff --git a/test cases/failing/38 prefix absolute/test.json b/test cases/failing/38 prefix absolute/test.json new file mode 100644 index 0000000..859906c --- /dev/null +++ b/test cases/failing/38 prefix absolute/test.json @@ -0,0 +1,11 @@ +{ + "do_not_set_opts": [ + "prefix" + ], + "stdout": [ + { + "comment": "literal 'some/path/notabs' appears in output, irrespective of os.path.sep, as that's the prefix", + "line": "test cases/failing/38 prefix absolute/meson.build:1:0: ERROR: prefix value 'some/path/notabs' must be an absolute path" + } + ] +} diff --git a/test cases/failing/39 kwarg assign/dummy.c b/test cases/failing/39 kwarg assign/dummy.c new file mode 100644 index 0000000..16fcdd9 --- /dev/null +++ b/test cases/failing/39 kwarg assign/dummy.c @@ -0,0 +1,3 @@ +const char* dummy() { + return "I do nothing."; +} diff --git a/test cases/failing/39 kwarg assign/meson.build b/test cases/failing/39 kwarg assign/meson.build new file mode 100644 index 0000000..7d42521 --- /dev/null +++ b/test cases/failing/39 kwarg assign/meson.build @@ -0,0 +1,3 @@ +project('assign in kwarg', 'c') + +executable('prog', 'dummy.c', args = 'prog.c') diff --git a/test cases/failing/39 kwarg assign/prog.c b/test cases/failing/39 kwarg assign/prog.c new file mode 100644 index 0000000..11b7fad --- /dev/null +++ b/test cases/failing/39 kwarg assign/prog.c @@ -0,0 +1,3 @@ +int main(int argc, char **argv) { + return 0; +} diff --git a/test cases/failing/39 kwarg assign/test.json b/test cases/failing/39 kwarg assign/test.json new file mode 100644 index 0000000..8fd9d0f --- /dev/null +++ b/test cases/failing/39 kwarg assign/test.json @@ -0,0 +1,7 @@ +{ + "stdout": [ + { + "line": "test cases/failing/39 kwarg assign/meson.build:3:0: ERROR: Tried to assign values inside an argument list." + } + ] +} diff --git a/test cases/failing/4 missing meson.build/meson.build b/test cases/failing/4 missing meson.build/meson.build new file mode 100644 index 0000000..20f754c --- /dev/null +++ b/test cases/failing/4 missing meson.build/meson.build @@ -0,0 +1,3 @@ +project('missing meson.build') + +subdir('subdir') diff --git a/test cases/failing/4 missing meson.build/subdir/dummy.txt b/test cases/failing/4 missing meson.build/subdir/dummy.txt new file mode 100644 index 0000000..03327bd --- /dev/null +++ b/test cases/failing/4 missing meson.build/subdir/dummy.txt @@ -0,0 +1 @@ +This needs to be here because Git can't handle empty dirs. diff --git a/test cases/failing/4 missing meson.build/test.json b/test cases/failing/4 missing meson.build/test.json new file mode 100644 index 0000000..3857090 --- /dev/null +++ b/test cases/failing/4 missing meson.build/test.json @@ -0,0 +1,9 @@ +{ + "stdout": [ + { + "match": "re", + "comment": "'subdir/meson.build' gets transformed with os.path.sep separators", + "line": "test cases/failing/4 missing meson\\.build/meson\\.build:3:0: ERROR: Non\\-existent build file 'subdir[\\\\/]meson\\.build'" + } + ] +} diff --git a/test cases/failing/40 custom target plainname many inputs/1.txt b/test cases/failing/40 custom target plainname many inputs/1.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/test cases/failing/40 custom target plainname many inputs/1.txt @@ -0,0 +1 @@ +1 diff --git a/test cases/failing/40 custom target plainname many inputs/2.txt b/test cases/failing/40 custom target plainname many inputs/2.txt new file mode 100644 index 0000000..0cfbf08 --- /dev/null +++ b/test cases/failing/40 custom target plainname many inputs/2.txt @@ -0,0 +1 @@ +2 diff --git a/test cases/failing/40 custom target plainname many inputs/catfiles.py b/test cases/failing/40 custom target plainname many inputs/catfiles.py new file mode 100644 index 0000000..1c53e24 --- /dev/null +++ b/test cases/failing/40 custom target plainname many inputs/catfiles.py @@ -0,0 +1,9 @@ +#!/usr/bin/env python3 + +import sys + +out = sys.argv[-1] +with open(out, 'wb') as o: + for infile in sys.argv[1:-1]: + with open(infile, 'rb') as f: + o.write(f.read()) diff --git a/test cases/failing/40 custom target plainname many inputs/meson.build b/test cases/failing/40 custom target plainname many inputs/meson.build new file mode 100644 index 0000000..8513bf8 --- /dev/null +++ b/test cases/failing/40 custom target plainname many inputs/meson.build @@ -0,0 +1,8 @@ +project('plain name many inputs') + +catfiles = find_program('catfiles.py') + +custom_target('plainname-inputs', + input : ['1.txt', '2.txt'], + output : '@PLAINNAME@.dat', + command : [catfiles, '@INPUT@', '@OUTPUT@']) diff --git a/test cases/failing/40 custom target plainname many inputs/test.json b/test cases/failing/40 custom target plainname many inputs/test.json new file mode 100644 index 0000000..f5c3abf --- /dev/null +++ b/test cases/failing/40 custom target plainname many inputs/test.json @@ -0,0 +1,7 @@ +{ + "stdout": [ + { + "line": "test cases/failing/40 custom target plainname many inputs/meson.build:5:0: ERROR: custom_target: output cannot contain \"@PLAINNAME@\" or \"@BASENAME@\" when there is more than one input (we can't know which to use)" + } + ] +} diff --git a/test cases/failing/41 custom target outputs not matching install_dirs/generator.py b/test cases/failing/41 custom target outputs not matching install_dirs/generator.py new file mode 100755 index 0000000..4ac6179 --- /dev/null +++ b/test cases/failing/41 custom target outputs not matching install_dirs/generator.py @@ -0,0 +1,16 @@ +#!/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 + '.c'), 'w') as f: + f.write('int main(int argc, char *argv[]) { return 0; }') +with open(os.path.join(odir, name + '.sh'), 'w') as f: + f.write('#!/bin/bash') diff --git a/test cases/failing/41 custom target outputs not matching install_dirs/meson.build b/test cases/failing/41 custom target outputs not matching install_dirs/meson.build new file mode 100644 index 0000000..ed99dba --- /dev/null +++ b/test cases/failing/41 custom target outputs not matching install_dirs/meson.build @@ -0,0 +1,13 @@ +project('outputs not matching install_dirs') + +gen = find_program('generator.py') + +if meson.backend() != 'ninja' + error('MESON_SKIP_TEST test is only for the ninja backend') +endif + +custom_target('too-few-install-dirs', + output : ['toofew.h', 'toofew.c', 'toofew.sh'], + command : [gen, 'toofew', '@OUTDIR@'], + install : true, + install_dir : [join_paths(get_option('prefix'), get_option('includedir')), false]) diff --git a/test cases/failing/41 custom target outputs not matching install_dirs/test.json b/test cases/failing/41 custom target outputs not matching install_dirs/test.json new file mode 100644 index 0000000..f9e2ba7 --- /dev/null +++ b/test cases/failing/41 custom target outputs not matching install_dirs/test.json @@ -0,0 +1,33 @@ +{ + "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" + } + ], + "stdout": [ + { + "line": "ERROR: Target 'too-few-install-dirs' has 3 outputs: ['toofew.h', 'toofew.c', 'toofew.sh'], but only 2 \"install_dir\"s were found." + } + ] +} diff --git a/test cases/failing/42 project name colon/meson.build b/test cases/failing/42 project name colon/meson.build new file mode 100644 index 0000000..53e947e --- /dev/null +++ b/test cases/failing/42 project name colon/meson.build @@ -0,0 +1 @@ +project('name with :') diff --git a/test cases/failing/42 project name colon/test.json b/test cases/failing/42 project name colon/test.json new file mode 100644 index 0000000..c3b880e --- /dev/null +++ b/test cases/failing/42 project name colon/test.json @@ -0,0 +1,7 @@ +{ + "stdout": [ + { + "line": "test cases/failing/42 project name colon/meson.build:1:0: ERROR: Project name 'name with :' must not contain ':'" + } + ] +} diff --git a/test cases/failing/43 abs subdir/bob/meson.build b/test cases/failing/43 abs subdir/bob/meson.build new file mode 100644 index 0000000..7bbf4b2 --- /dev/null +++ b/test cases/failing/43 abs subdir/bob/meson.build @@ -0,0 +1,2 @@ +# This file is never reached. +x = 3 diff --git a/test cases/failing/43 abs subdir/meson.build b/test cases/failing/43 abs subdir/meson.build new file mode 100644 index 0000000..a8534d0 --- /dev/null +++ b/test cases/failing/43 abs subdir/meson.build @@ -0,0 +1,5 @@ +project('abs subdir') + +# For some reason people insist on doing this, probably +# because Make has taught them to never rely on anything. +subdir(join_paths(meson.source_root(), 'bob')) diff --git a/test cases/failing/43 abs subdir/test.json b/test cases/failing/43 abs subdir/test.json new file mode 100644 index 0000000..201ed44 --- /dev/null +++ b/test cases/failing/43 abs subdir/test.json @@ -0,0 +1,7 @@ +{ + "stdout": [ + { + "line": "test cases/failing/43 abs subdir/meson.build:5:0: ERROR: Subdir argument must be a relative path." + } + ] +} diff --git a/test cases/failing/44 abspath to srcdir/meson.build b/test cases/failing/44 abspath to srcdir/meson.build new file mode 100644 index 0000000..78c6124 --- /dev/null +++ b/test cases/failing/44 abspath to srcdir/meson.build @@ -0,0 +1,3 @@ +project('meson') + +include_directories(meson.current_source_dir()) diff --git a/test cases/failing/44 abspath to srcdir/test.json b/test cases/failing/44 abspath to srcdir/test.json new file mode 100644 index 0000000..c64ecfb --- /dev/null +++ b/test cases/failing/44 abspath to srcdir/test.json @@ -0,0 +1,7 @@ +{ + "stdout": [ + { + "line": "test cases/failing/44 abspath to srcdir/meson.build:3:0: ERROR: Tried to form an absolute path to a dir in the source tree." + } + ] +} diff --git a/test cases/failing/45 pkgconfig variables reserved/meson.build b/test cases/failing/45 pkgconfig variables reserved/meson.build new file mode 100644 index 0000000..82ae995 --- /dev/null +++ b/test cases/failing/45 pkgconfig variables reserved/meson.build @@ -0,0 +1,16 @@ +project('variables-reserved-test', 'c', version : '1.0') + +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.', + variables : [ 'prefix=/tmp/' ] +) diff --git a/test cases/failing/45 pkgconfig variables reserved/simple.c b/test cases/failing/45 pkgconfig variables reserved/simple.c new file mode 100644 index 0000000..e8a6d83 --- /dev/null +++ b/test cases/failing/45 pkgconfig variables reserved/simple.c @@ -0,0 +1,5 @@ +#include"simple.h" + +int simple_function() { + return 42; +} diff --git a/test cases/failing/45 pkgconfig variables reserved/simple.h b/test cases/failing/45 pkgconfig variables reserved/simple.h new file mode 100644 index 0000000..bb52e6d --- /dev/null +++ b/test cases/failing/45 pkgconfig variables reserved/simple.h @@ -0,0 +1,6 @@ +#ifndef SIMPLE_H_ +#define SIMPLE_H_ + +int simple_function(); + +#endif diff --git a/test cases/failing/45 pkgconfig variables reserved/test.json b/test cases/failing/45 pkgconfig variables reserved/test.json new file mode 100644 index 0000000..853eb82 --- /dev/null +++ b/test cases/failing/45 pkgconfig variables reserved/test.json @@ -0,0 +1,7 @@ +{ + "stdout": [ + { + "line": "test cases/failing/45 pkgconfig variables reserved/meson.build:8:5: ERROR: Variable \"prefix\" is reserved" + } + ] +} diff --git a/test cases/failing/46 pkgconfig variables zero length/meson.build b/test cases/failing/46 pkgconfig variables zero length/meson.build new file mode 100644 index 0000000..65d3344 --- /dev/null +++ b/test cases/failing/46 pkgconfig variables zero length/meson.build @@ -0,0 +1,16 @@ +project('variables-zero-length-test', 'c', version : '1.0') + +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.', + variables : [ '=value' ] +) diff --git a/test cases/failing/46 pkgconfig variables zero length/simple.c b/test cases/failing/46 pkgconfig variables zero length/simple.c new file mode 100644 index 0000000..e8a6d83 --- /dev/null +++ b/test cases/failing/46 pkgconfig variables zero length/simple.c @@ -0,0 +1,5 @@ +#include"simple.h" + +int simple_function() { + return 42; +} diff --git a/test cases/failing/46 pkgconfig variables zero length/simple.h b/test cases/failing/46 pkgconfig variables zero length/simple.h new file mode 100644 index 0000000..bb52e6d --- /dev/null +++ b/test cases/failing/46 pkgconfig variables zero length/simple.h @@ -0,0 +1,6 @@ +#ifndef SIMPLE_H_ +#define SIMPLE_H_ + +int simple_function(); + +#endif diff --git a/test cases/failing/46 pkgconfig variables zero length/test.json b/test cases/failing/46 pkgconfig variables zero length/test.json new file mode 100644 index 0000000..b174065 --- /dev/null +++ b/test cases/failing/46 pkgconfig variables zero length/test.json @@ -0,0 +1,7 @@ +{ + "stdout": [ + { + "line": "test cases/failing/46 pkgconfig variables zero length/meson.build:8:5: ERROR: pkgconfig.generate keyword argument \"variables\" empty variable name" + } + ] +} diff --git a/test cases/failing/47 pkgconfig variables zero length value/meson.build b/test cases/failing/47 pkgconfig variables zero length value/meson.build new file mode 100644 index 0000000..33977b2 --- /dev/null +++ b/test cases/failing/47 pkgconfig variables zero length value/meson.build @@ -0,0 +1,16 @@ +project('variables-zero-length-value-test', 'c', version : '1.0') + +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.', + variables : [ 'key=' ] +) diff --git a/test cases/failing/47 pkgconfig variables zero length value/simple.c b/test cases/failing/47 pkgconfig variables zero length value/simple.c new file mode 100644 index 0000000..e8a6d83 --- /dev/null +++ b/test cases/failing/47 pkgconfig variables zero length value/simple.c @@ -0,0 +1,5 @@ +#include"simple.h" + +int simple_function() { + return 42; +} diff --git a/test cases/failing/47 pkgconfig variables zero length value/simple.h b/test cases/failing/47 pkgconfig variables zero length value/simple.h new file mode 100644 index 0000000..bb52e6d --- /dev/null +++ b/test cases/failing/47 pkgconfig variables zero length value/simple.h @@ -0,0 +1,6 @@ +#ifndef SIMPLE_H_ +#define SIMPLE_H_ + +int simple_function(); + +#endif diff --git a/test cases/failing/47 pkgconfig variables zero length value/test.json b/test cases/failing/47 pkgconfig variables zero length value/test.json new file mode 100644 index 0000000..0be5725 --- /dev/null +++ b/test cases/failing/47 pkgconfig variables zero length value/test.json @@ -0,0 +1,7 @@ +{ + "stdout": [ + { + "line": "test cases/failing/47 pkgconfig variables zero length value/meson.build:8:5: ERROR: pkgconfig.generate keyword argument \"variables\" empty variable value" + } + ] +} diff --git a/test cases/failing/48 pkgconfig variables not key value/meson.build b/test cases/failing/48 pkgconfig variables not key value/meson.build new file mode 100644 index 0000000..02fa737 --- /dev/null +++ b/test cases/failing/48 pkgconfig variables not key value/meson.build @@ -0,0 +1,16 @@ +project('variables-not-key-value-test', 'c', version : '1.0') + +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.', + variables : [ 'this_should_be_key_value' ] +) diff --git a/test cases/failing/48 pkgconfig variables not key value/simple.c b/test cases/failing/48 pkgconfig variables not key value/simple.c new file mode 100644 index 0000000..e8a6d83 --- /dev/null +++ b/test cases/failing/48 pkgconfig variables not key value/simple.c @@ -0,0 +1,5 @@ +#include"simple.h" + +int simple_function() { + return 42; +} diff --git a/test cases/failing/48 pkgconfig variables not key value/simple.h b/test cases/failing/48 pkgconfig variables not key value/simple.h new file mode 100644 index 0000000..bb52e6d --- /dev/null +++ b/test cases/failing/48 pkgconfig variables not key value/simple.h @@ -0,0 +1,6 @@ +#ifndef SIMPLE_H_ +#define SIMPLE_H_ + +int simple_function(); + +#endif diff --git a/test cases/failing/48 pkgconfig variables not key value/test.json b/test cases/failing/48 pkgconfig variables not key value/test.json new file mode 100644 index 0000000..96422a9 --- /dev/null +++ b/test cases/failing/48 pkgconfig variables not key value/test.json @@ -0,0 +1,7 @@ +{ + "stdout": [ + { + "line": "test cases/failing/48 pkgconfig variables not key value/meson.build:8:5: ERROR: pkgconfig.generate keyword argument \"variables\" variable 'this_should_be_key_value' must have a value separated by equals sign." + } + ] +} diff --git a/test cases/failing/49 executable comparison/meson.build b/test cases/failing/49 executable comparison/meson.build new file mode 100644 index 0000000..041bcf3 --- /dev/null +++ b/test cases/failing/49 executable comparison/meson.build @@ -0,0 +1,6 @@ +project('executable comparison', 'c') + +exe1 = executable('prog1', sources : 'prog.c') +exe2 = executable('prog2', sources : 'prog.c') + +assert(exe1 < exe2, 'should fail') diff --git a/test cases/failing/49 executable comparison/prog.c b/test cases/failing/49 executable comparison/prog.c new file mode 100644 index 0000000..0314ff1 --- /dev/null +++ b/test cases/failing/49 executable comparison/prog.c @@ -0,0 +1 @@ +int main(int argc, char **argv) { return 0; } diff --git a/test cases/failing/49 executable comparison/test.json b/test cases/failing/49 executable comparison/test.json new file mode 100644 index 0000000..a37002e --- /dev/null +++ b/test cases/failing/49 executable comparison/test.json @@ -0,0 +1,8 @@ +{ + "stdout": [ + { + "match": "re", + "line": "test cases/failing/49 executable comparison/meson.build:6:0: ERROR: Object of type Executable does not support the `<` operator." + } + ] +} diff --git a/test cases/failing/5 misplaced option/meson.build b/test cases/failing/5 misplaced option/meson.build new file mode 100644 index 0000000..a992de5 --- /dev/null +++ b/test cases/failing/5 misplaced option/meson.build @@ -0,0 +1,3 @@ +project('misplaced option') + +option('dummy', type : 'string') diff --git a/test cases/failing/5 misplaced option/test.json b/test cases/failing/5 misplaced option/test.json new file mode 100644 index 0000000..12afdf0 --- /dev/null +++ b/test cases/failing/5 misplaced option/test.json @@ -0,0 +1,7 @@ +{ + "stdout": [ + { + "line": "test cases/failing/5 misplaced option/meson.build:3:0: ERROR: Tried to call option() in build description file. All options must be in the option file." + } + ] +} diff --git a/test cases/failing/50 inconsistent comparison/meson.build b/test cases/failing/50 inconsistent comparison/meson.build new file mode 100644 index 0000000..237a157 --- /dev/null +++ b/test cases/failing/50 inconsistent comparison/meson.build @@ -0,0 +1,7 @@ +project('kwarg before arg') + +# All of these should fail, though only the first one will error out if +# everything's working correctly. +assert([] < 'st', 'should fail') +assert([] < 1, 'should fail') +assert(2 < 'st', 'should fail') diff --git a/test cases/failing/50 inconsistent comparison/test.json b/test cases/failing/50 inconsistent comparison/test.json new file mode 100644 index 0000000..171bfa6 --- /dev/null +++ b/test cases/failing/50 inconsistent comparison/test.json @@ -0,0 +1,7 @@ +{ + "stdout": [ + { + "line": "test cases/failing/50 inconsistent comparison/meson.build:5:0: ERROR: Object <[ArrayHolder] holds [list]: []> of type array does not support the `<` operator." + } + ] +} diff --git a/test cases/failing/51 slashname/meson.build b/test cases/failing/51 slashname/meson.build new file mode 100644 index 0000000..29fe1fc --- /dev/null +++ b/test cases/failing/51 slashname/meson.build @@ -0,0 +1,11 @@ +project('slashname', 'c') + +# Traverse this subdir so the corresponding dir +# is created inside the build dir. +subdir('sub') + +# Try to create an executable that would go in the "sub" dir +# inside the build dir. This is prohibited. +executable('sub/prog', pf) + +error('Re-enable me once slash in name is finally prohibited.') diff --git a/test cases/failing/51 slashname/sub/meson.build b/test cases/failing/51 slashname/sub/meson.build new file mode 100644 index 0000000..3baacf6 --- /dev/null +++ b/test cases/failing/51 slashname/sub/meson.build @@ -0,0 +1 @@ +pf = files('prog.c') diff --git a/test cases/failing/51 slashname/sub/prog.c b/test cases/failing/51 slashname/sub/prog.c new file mode 100644 index 0000000..722de0a --- /dev/null +++ b/test cases/failing/51 slashname/sub/prog.c @@ -0,0 +1,6 @@ +#include + +int main(int argc, char **argv) { + printf("I should not be run ever.\n"); + return 1; +} diff --git a/test cases/failing/51 slashname/test.json b/test cases/failing/51 slashname/test.json new file mode 100644 index 0000000..39346a9 --- /dev/null +++ b/test cases/failing/51 slashname/test.json @@ -0,0 +1,7 @@ +{ + "stdout": [ + { + "line": "test cases/failing/51 slashname/meson.build:9:0: ERROR: Target \"sub/prog\" has a path segment pointing to directory \"sub\". This is an error." + } + ] +} diff --git a/test cases/failing/52 reserved meson prefix/meson-foo/meson.build b/test cases/failing/52 reserved meson prefix/meson-foo/meson.build new file mode 100644 index 0000000..e69de29 diff --git a/test cases/failing/52 reserved meson prefix/meson.build b/test cases/failing/52 reserved meson prefix/meson.build new file mode 100644 index 0000000..1339035 --- /dev/null +++ b/test cases/failing/52 reserved meson prefix/meson.build @@ -0,0 +1,3 @@ +project('test') + +subdir('meson-foo') diff --git a/test cases/failing/52 reserved meson prefix/test.json b/test cases/failing/52 reserved meson prefix/test.json new file mode 100644 index 0000000..707cd73 --- /dev/null +++ b/test cases/failing/52 reserved meson prefix/test.json @@ -0,0 +1,7 @@ +{ + "stdout": [ + { + "line": "test cases/failing/52 reserved meson prefix/meson.build:3:0: ERROR: The \"meson-\" prefix is reserved and cannot be used for top-level subdir()." + } + ] +} diff --git a/test cases/failing/53 wrong shared crate type/foo.rs b/test cases/failing/53 wrong shared crate type/foo.rs new file mode 100644 index 0000000..e69de29 diff --git a/test cases/failing/53 wrong shared crate type/meson.build b/test cases/failing/53 wrong shared crate type/meson.build new file mode 100644 index 0000000..90020fa --- /dev/null +++ b/test cases/failing/53 wrong shared crate type/meson.build @@ -0,0 +1,7 @@ +project('test') + +if not add_languages('rust', required: false) + error('MESON_SKIP_TEST test requires rust compiler') +endif + +shared_library('mytest', 'foo.rs', rust_crate_type : 'staticlib') diff --git a/test cases/failing/53 wrong shared crate type/test.json b/test cases/failing/53 wrong shared crate type/test.json new file mode 100644 index 0000000..5faaece --- /dev/null +++ b/test cases/failing/53 wrong shared crate type/test.json @@ -0,0 +1,7 @@ +{ + "stdout": [ + { + "line": "test cases/failing/53 wrong shared crate type/meson.build:7:0: ERROR: Crate type \"staticlib\" invalid for dynamic libraries; must be \"dylib\", \"cdylib\", or \"proc-macro\"" + } + ] +} diff --git a/test cases/failing/54 wrong static crate type/foo.rs b/test cases/failing/54 wrong static crate type/foo.rs new file mode 100644 index 0000000..e69de29 diff --git a/test cases/failing/54 wrong static crate type/meson.build b/test cases/failing/54 wrong static crate type/meson.build new file mode 100644 index 0000000..179d7cd --- /dev/null +++ b/test cases/failing/54 wrong static crate type/meson.build @@ -0,0 +1,7 @@ +project('test') + +if not add_languages('rust', required: false) + error('MESON_SKIP_TEST test requires rust compiler') +endif + +static_library('mytest', 'foo.rs', rust_crate_type : 'cdylib') diff --git a/test cases/failing/54 wrong static crate type/test.json b/test cases/failing/54 wrong static crate type/test.json new file mode 100644 index 0000000..83ae5e1 --- /dev/null +++ b/test cases/failing/54 wrong static crate type/test.json @@ -0,0 +1,7 @@ +{ + "stdout": [ + { + "line": "test cases/failing/54 wrong static crate type/meson.build:7:0: ERROR: Crate type \"cdylib\" invalid for static libraries; must be \"rlib\" or \"staticlib\"" + } + ] +} diff --git a/test cases/failing/55 or on new line/meson.build b/test cases/failing/55 or on new line/meson.build new file mode 100644 index 0000000..b0bd08e --- /dev/null +++ b/test cases/failing/55 or on new line/meson.build @@ -0,0 +1,7 @@ +project('silent_or') + +if get_option('foo') == 'true' + or get_option('foo') == 'auto' +else + message('If this message is printed then something is wrong. The or above should give a syntax error.') +endif diff --git a/test cases/failing/55 or on new line/meson_options.txt b/test cases/failing/55 or on new line/meson_options.txt new file mode 100644 index 0000000..3302cf4 --- /dev/null +++ b/test cases/failing/55 or on new line/meson_options.txt @@ -0,0 +1 @@ +option('foo', type: 'combo', choices: ['true', 'false', 'auto'], value: 'auto') diff --git a/test cases/failing/55 or on new line/test.json b/test cases/failing/55 or on new line/test.json new file mode 100644 index 0000000..f1b8a67 --- /dev/null +++ b/test cases/failing/55 or on new line/test.json @@ -0,0 +1,7 @@ +{ + "stdout": [ + { + "line": "test cases/failing/55 or on new line/meson.build:4:8: ERROR: Invalid or clause." + } + ] +} diff --git a/test cases/failing/56 link with executable/meson.build b/test cases/failing/56 link with executable/meson.build new file mode 100644 index 0000000..186b3e5 --- /dev/null +++ b/test cases/failing/56 link with executable/meson.build @@ -0,0 +1,4 @@ +project('link with exe', 'c') + +e = executable('prog', 'prog.c') +m = shared_module('module', 'module.c', link_with: e) diff --git a/test cases/failing/56 link with executable/module.c b/test cases/failing/56 link with executable/module.c new file mode 100644 index 0000000..dc0124a --- /dev/null +++ b/test cases/failing/56 link with executable/module.c @@ -0,0 +1,4 @@ + +int func(void) { + return 42; +} diff --git a/test cases/failing/56 link with executable/prog.c b/test cases/failing/56 link with executable/prog.c new file mode 100644 index 0000000..f3836d7 --- /dev/null +++ b/test cases/failing/56 link with executable/prog.c @@ -0,0 +1,5 @@ +int +main (int argc, char **argv) +{ + return 0; +} diff --git a/test cases/failing/56 link with executable/test.json b/test cases/failing/56 link with executable/test.json new file mode 100644 index 0000000..2288783 --- /dev/null +++ b/test cases/failing/56 link with executable/test.json @@ -0,0 +1,7 @@ +{ + "stdout": [ + { + "line": "test cases/failing/56 link with executable/meson.build:4:0: ERROR: Link target 'prog' is not linkable." + } + ] +} diff --git a/test cases/failing/57 assign custom target index/meson.build b/test cases/failing/57 assign custom target index/meson.build new file mode 100644 index 0000000..7f2a820 --- /dev/null +++ b/test cases/failing/57 assign custom target index/meson.build @@ -0,0 +1,24 @@ +# 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. + +prog_python = import('python3').find_python() + +target = custom_target( + 'target', + output : ['1', '2'], + command : [prog_python, '-c', + 'with open("1", "w") as f: f.write("foo"); with open("2", "w") as f: f.write("foo")'], +) + +target[0] = 'foo' diff --git a/test cases/failing/57 assign custom target index/test.json b/test cases/failing/57 assign custom target index/test.json new file mode 100644 index 0000000..392137a --- /dev/null +++ b/test cases/failing/57 assign custom target index/test.json @@ -0,0 +1,7 @@ +{ + "stdout": [ + { + "line": "test cases/failing/57 assign custom target index/meson.build:24:0: ERROR: Assignment target must be an id." + } + ] +} diff --git a/test cases/failing/58 getoption prefix/meson.build b/test cases/failing/58 getoption prefix/meson.build new file mode 100644 index 0000000..8f85cff --- /dev/null +++ b/test cases/failing/58 getoption prefix/meson.build @@ -0,0 +1,5 @@ +project('getopt prefix') + +subproject('abc') + +get_option('abc:foo') diff --git a/test cases/failing/58 getoption prefix/subprojects/abc/meson.build b/test cases/failing/58 getoption prefix/subprojects/abc/meson.build new file mode 100644 index 0000000..aa9c3df --- /dev/null +++ b/test cases/failing/58 getoption prefix/subprojects/abc/meson.build @@ -0,0 +1 @@ +project('abc', 'c') diff --git a/test cases/failing/58 getoption prefix/subprojects/abc/meson_options.txt b/test cases/failing/58 getoption prefix/subprojects/abc/meson_options.txt new file mode 100644 index 0000000..89e624e --- /dev/null +++ b/test cases/failing/58 getoption prefix/subprojects/abc/meson_options.txt @@ -0,0 +1 @@ +option('foo', type : 'boolean') diff --git a/test cases/failing/58 getoption prefix/test.json b/test cases/failing/58 getoption prefix/test.json new file mode 100644 index 0000000..630dcd9 --- /dev/null +++ b/test cases/failing/58 getoption prefix/test.json @@ -0,0 +1,7 @@ +{ + "stdout": [ + { + "line": "test cases/failing/58 getoption prefix/meson.build:5:0: ERROR: Having a colon in option name is forbidden, projects are not allowed to directly access options of other subprojects." + } + ] +} diff --git a/test cases/failing/59 bad option argument/meson.build b/test cases/failing/59 bad option argument/meson.build new file mode 100644 index 0000000..5219cfb --- /dev/null +++ b/test cases/failing/59 bad option argument/meson.build @@ -0,0 +1,3 @@ +project('bad option') + +get_option('name') diff --git a/test cases/failing/59 bad option argument/meson_options.txt b/test cases/failing/59 bad option argument/meson_options.txt new file mode 100644 index 0000000..de1fff6 --- /dev/null +++ b/test cases/failing/59 bad option argument/meson_options.txt @@ -0,0 +1 @@ +option('name', type : 'string', vaule : 'foo') diff --git a/test cases/failing/59 bad option argument/test.json b/test cases/failing/59 bad option argument/test.json new file mode 100644 index 0000000..3c5df1b --- /dev/null +++ b/test cases/failing/59 bad option argument/test.json @@ -0,0 +1,7 @@ +{ + "stdout": [ + { + "line": "test cases/failing/59 bad option argument/meson_options.txt:1:0: ERROR: option got unknown keyword arguments \"vaule\"" + } + ] +} diff --git a/test cases/failing/6 missing incdir/meson.build b/test cases/failing/6 missing incdir/meson.build new file mode 100644 index 0000000..eb5ba2a --- /dev/null +++ b/test cases/failing/6 missing incdir/meson.build @@ -0,0 +1,3 @@ +project('missing incdir') + +inc = include_directories('nosuchdir') diff --git a/test cases/failing/6 missing incdir/test.json b/test cases/failing/6 missing incdir/test.json new file mode 100644 index 0000000..172d8a9 --- /dev/null +++ b/test cases/failing/6 missing incdir/test.json @@ -0,0 +1,7 @@ +{ + "stdout": [ + { + "line": "test cases/failing/6 missing incdir/meson.build:3:0: ERROR: Include dir nosuchdir does not exist." + } + ] +} diff --git a/test cases/failing/60 subproj filegrab/meson.build b/test cases/failing/60 subproj filegrab/meson.build new file mode 100644 index 0000000..b5c484c --- /dev/null +++ b/test cases/failing/60 subproj filegrab/meson.build @@ -0,0 +1,5 @@ +project('mainproj') + +# Try to grab a file from a parent project. + +subproject('a') diff --git a/test cases/failing/60 subproj filegrab/prog.c b/test cases/failing/60 subproj filegrab/prog.c new file mode 100644 index 0000000..0314ff1 --- /dev/null +++ b/test cases/failing/60 subproj filegrab/prog.c @@ -0,0 +1 @@ +int main(int argc, char **argv) { return 0; } diff --git a/test cases/failing/60 subproj filegrab/subprojects/a/meson.build b/test cases/failing/60 subproj filegrab/subprojects/a/meson.build new file mode 100644 index 0000000..80b9888 --- /dev/null +++ b/test cases/failing/60 subproj filegrab/subprojects/a/meson.build @@ -0,0 +1,3 @@ +project('a', 'c') + +executable('prog', '../../prog.c') diff --git a/test cases/failing/60 subproj filegrab/test.json b/test cases/failing/60 subproj filegrab/test.json new file mode 100644 index 0000000..04a6dbb --- /dev/null +++ b/test cases/failing/60 subproj filegrab/test.json @@ -0,0 +1,7 @@ +{ + "stdout": [ + { + "line": "test cases/failing/60 subproj filegrab/subprojects/a/meson.build:3:0: ERROR: Sandbox violation: Tried to grab file prog.c outside current (sub)project." + } + ] +} diff --git a/test cases/failing/61 grab subproj/meson.build b/test cases/failing/61 grab subproj/meson.build new file mode 100644 index 0000000..30fc690 --- /dev/null +++ b/test cases/failing/61 grab subproj/meson.build @@ -0,0 +1,7 @@ +project('grabber', 'c') + +# Try to grab a file from a child subproject. + +subproject('foo') + +executable('foo', 'subprojects/foo/sub.c') diff --git a/test cases/failing/61 grab subproj/subprojects/foo/meson.build b/test cases/failing/61 grab subproj/subprojects/foo/meson.build new file mode 100644 index 0000000..b346f6d --- /dev/null +++ b/test cases/failing/61 grab subproj/subprojects/foo/meson.build @@ -0,0 +1,3 @@ +project('foo', 'c') + +message('I do nothing.') diff --git a/test cases/failing/61 grab subproj/subprojects/foo/sub.c b/test cases/failing/61 grab subproj/subprojects/foo/sub.c new file mode 100644 index 0000000..a94b1f5 --- /dev/null +++ b/test cases/failing/61 grab subproj/subprojects/foo/sub.c @@ -0,0 +1,6 @@ +#include + +int main(int argc, char **argv) { + printf("I am a subproject executable file.\n"); + return 0; +} diff --git a/test cases/failing/61 grab subproj/test.json b/test cases/failing/61 grab subproj/test.json new file mode 100644 index 0000000..873ec6c --- /dev/null +++ b/test cases/failing/61 grab subproj/test.json @@ -0,0 +1,7 @@ +{ + "stdout": [ + { + "line": "test cases/failing/61 grab subproj/meson.build:7:0: ERROR: Sandbox violation: Tried to grab file sub.c from a nested subproject." + } + ] +} diff --git a/test cases/failing/62 grab sibling/meson.build b/test cases/failing/62 grab sibling/meson.build new file mode 100644 index 0000000..5ddc295 --- /dev/null +++ b/test cases/failing/62 grab sibling/meson.build @@ -0,0 +1,3 @@ +project('master') + +subproject('a') diff --git a/test cases/failing/62 grab sibling/subprojects/a/meson.build b/test cases/failing/62 grab sibling/subprojects/a/meson.build new file mode 100644 index 0000000..6dd9f61 --- /dev/null +++ b/test cases/failing/62 grab sibling/subprojects/a/meson.build @@ -0,0 +1,3 @@ +project('a', 'c') + +executable('sneaky', '../b/sneaky.c') diff --git a/test cases/failing/62 grab sibling/subprojects/b/meson.build b/test cases/failing/62 grab sibling/subprojects/b/meson.build new file mode 100644 index 0000000..57f261a --- /dev/null +++ b/test cases/failing/62 grab sibling/subprojects/b/meson.build @@ -0,0 +1,3 @@ +projecT('b') + +message('I do nothing.') diff --git a/test cases/failing/62 grab sibling/subprojects/b/sneaky.c b/test cases/failing/62 grab sibling/subprojects/b/sneaky.c new file mode 100644 index 0000000..46718c6 --- /dev/null +++ b/test cases/failing/62 grab sibling/subprojects/b/sneaky.c @@ -0,0 +1,6 @@ +#include + +int main(int argc, char **argv) { + printf("I can only come into existence via trickery.\n"); + return 0; +} diff --git a/test cases/failing/62 grab sibling/test.json b/test cases/failing/62 grab sibling/test.json new file mode 100644 index 0000000..9e7c4bb --- /dev/null +++ b/test cases/failing/62 grab sibling/test.json @@ -0,0 +1,7 @@ +{ + "stdout": [ + { + "line": "test cases/failing/62 grab sibling/subprojects/a/meson.build:3:0: ERROR: Sandbox violation: Tried to grab file sneaky.c outside current (sub)project." + } + ] +} diff --git a/test cases/failing/63 string as link target/meson.build b/test cases/failing/63 string as link target/meson.build new file mode 100644 index 0000000..cb83fff --- /dev/null +++ b/test cases/failing/63 string as link target/meson.build @@ -0,0 +1,2 @@ +project('string as link argument', 'c') +executable('myprog', 'prog.c', link_with: [ '' ]) diff --git a/test cases/failing/63 string as link target/prog.c b/test cases/failing/63 string as link target/prog.c new file mode 100644 index 0000000..0314ff1 --- /dev/null +++ b/test cases/failing/63 string as link target/prog.c @@ -0,0 +1 @@ +int main(int argc, char **argv) { return 0; } diff --git a/test cases/failing/63 string as link target/test.json b/test cases/failing/63 string as link target/test.json new file mode 100644 index 0000000..a531d64 --- /dev/null +++ b/test cases/failing/63 string as link target/test.json @@ -0,0 +1,7 @@ +{ + "stdout": [ + { + "line": "test cases/failing/63 string as link target/meson.build:2:0: ERROR: '' is not a target." + } + ] +} diff --git a/test cases/failing/64 dependency not-found and required/meson.build b/test cases/failing/64 dependency not-found and required/meson.build new file mode 100644 index 0000000..1ce5747 --- /dev/null +++ b/test cases/failing/64 dependency not-found and required/meson.build @@ -0,0 +1,2 @@ +project('dep-test') +dep = dependency('', required:true) diff --git a/test cases/failing/64 dependency not-found and required/test.json b/test cases/failing/64 dependency not-found and required/test.json new file mode 100644 index 0000000..84d14b4 --- /dev/null +++ b/test cases/failing/64 dependency not-found and required/test.json @@ -0,0 +1,7 @@ +{ + "stdout": [ + { + "line": "test cases/failing/64 dependency not-found and required/meson.build:2:0: ERROR: Dependency is required but has no candidates." + } + ] +} diff --git a/test cases/failing/65 subproj different versions/main.c b/test cases/failing/65 subproj different versions/main.c new file mode 100644 index 0000000..8793c62 --- /dev/null +++ b/test cases/failing/65 subproj different versions/main.c @@ -0,0 +1,9 @@ +#include +#include "a.h" +#include "b.h" + +int main(int argc, char **argv) { + int life = a_fun() + b_fun(); + printf("%d\n", life); + return 0; +} diff --git a/test cases/failing/65 subproj different versions/meson.build b/test cases/failing/65 subproj different versions/meson.build new file mode 100644 index 0000000..e964e42 --- /dev/null +++ b/test cases/failing/65 subproj different versions/meson.build @@ -0,0 +1,9 @@ +project('super', 'c') + +# A will use version 1 of C +a_dep = dependency('a', fallback: ['a', 'a_dep']) + +# B will fail because it requests version 2 of C +b_dep = dependency('b', fallback: ['b', 'b_dep']) + +main = executable('main', files('main.c'), dependencies: [a_dep, b_dep]) diff --git a/test cases/failing/65 subproj different versions/subprojects/a/a.c b/test cases/failing/65 subproj different versions/subprojects/a/a.c new file mode 100644 index 0000000..cd41a65 --- /dev/null +++ b/test cases/failing/65 subproj different versions/subprojects/a/a.c @@ -0,0 +1,5 @@ +#include "c.h" + +int a_fun() { + return c_fun(); +} diff --git a/test cases/failing/65 subproj different versions/subprojects/a/a.h b/test cases/failing/65 subproj different versions/subprojects/a/a.h new file mode 100644 index 0000000..8f1d49e --- /dev/null +++ b/test cases/failing/65 subproj different versions/subprojects/a/a.h @@ -0,0 +1 @@ +int a_fun(); diff --git a/test cases/failing/65 subproj different versions/subprojects/a/meson.build b/test cases/failing/65 subproj different versions/subprojects/a/meson.build new file mode 100644 index 0000000..e84182a --- /dev/null +++ b/test cases/failing/65 subproj different versions/subprojects/a/meson.build @@ -0,0 +1,11 @@ +project('a', 'c') + +c_dep = dependency('c', version:'1', fallback: ['c', 'c_dep']) + +alib = library('a', 'a.c', + dependencies: c_dep) + +a_dep = declare_dependency( + link_with: alib, + include_directories: include_directories('.'), +) diff --git a/test cases/failing/65 subproj different versions/subprojects/b/b.c b/test cases/failing/65 subproj different versions/subprojects/b/b.c new file mode 100644 index 0000000..f85f8c3 --- /dev/null +++ b/test cases/failing/65 subproj different versions/subprojects/b/b.c @@ -0,0 +1,5 @@ +#include "c.h" + +int b_fun(){ +return c_fun(); +} diff --git a/test cases/failing/65 subproj different versions/subprojects/b/b.h b/test cases/failing/65 subproj different versions/subprojects/b/b.h new file mode 100644 index 0000000..eced786 --- /dev/null +++ b/test cases/failing/65 subproj different versions/subprojects/b/b.h @@ -0,0 +1 @@ +int b_fun(); diff --git a/test cases/failing/65 subproj different versions/subprojects/b/meson.build b/test cases/failing/65 subproj different versions/subprojects/b/meson.build new file mode 100644 index 0000000..0398340 --- /dev/null +++ b/test cases/failing/65 subproj different versions/subprojects/b/meson.build @@ -0,0 +1,11 @@ +project('b', 'c') + +c_dep = dependency('c', version:'2', fallback: ['c', 'c_dep']) + +blib = library('b', 'b.c', + dependencies: c_dep) + +b_dep = declare_dependency( + link_with: blib, + include_directories: include_directories('.'), +) diff --git a/test cases/failing/65 subproj different versions/subprojects/c/c.h b/test cases/failing/65 subproj different versions/subprojects/c/c.h new file mode 100644 index 0000000..2b15f60 --- /dev/null +++ b/test cases/failing/65 subproj different versions/subprojects/c/c.h @@ -0,0 +1,3 @@ +static int c_fun(){ + return 3; +} diff --git a/test cases/failing/65 subproj different versions/subprojects/c/meson.build b/test cases/failing/65 subproj different versions/subprojects/c/meson.build new file mode 100644 index 0000000..7184933 --- /dev/null +++ b/test cases/failing/65 subproj different versions/subprojects/c/meson.build @@ -0,0 +1,5 @@ +project('c', 'c', version:'1') + +c_dep = declare_dependency( + include_directories: include_directories('.') +) diff --git a/test cases/failing/65 subproj different versions/test.json b/test cases/failing/65 subproj different versions/test.json new file mode 100644 index 0000000..2f9f70d --- /dev/null +++ b/test cases/failing/65 subproj different versions/test.json @@ -0,0 +1,7 @@ +{ + "stdout": [ + { + "line": "test cases/failing/65 subproj different versions/subprojects/b/meson.build:3:0: ERROR: Dependency 'c' is required but not found." + } + ] +} diff --git a/test cases/failing/66 wrong boost module/meson.build b/test cases/failing/66 wrong boost module/meson.build new file mode 100644 index 0000000..937e587 --- /dev/null +++ b/test cases/failing/66 wrong boost module/meson.build @@ -0,0 +1,9 @@ +project('boosttest', 'cpp', + default_options : ['cpp_std=c++11']) + +if not dependency('boost', required: false).found() + error('MESON_SKIP_TEST test requires boost') +endif + +# abc doesn't exist +linkdep = dependency('boost', modules : ['thread', 'system', 'test', 'abc']) diff --git a/test cases/failing/66 wrong boost module/test.json b/test cases/failing/66 wrong boost module/test.json new file mode 100644 index 0000000..c65a78c --- /dev/null +++ b/test cases/failing/66 wrong boost module/test.json @@ -0,0 +1,7 @@ +{ + "stdout": [ + { + "line": "test cases/failing/66 wrong boost module/meson.build:9:0: ERROR: Dependency \"boost\" not found, tried system" + } + ] +} diff --git a/test cases/failing/67 install_data rename bad size/file1.txt b/test cases/failing/67 install_data rename bad size/file1.txt new file mode 100644 index 0000000..e69de29 diff --git a/test cases/failing/67 install_data rename bad size/file2.txt b/test cases/failing/67 install_data rename bad size/file2.txt new file mode 100644 index 0000000..e69de29 diff --git a/test cases/failing/67 install_data rename bad size/meson.build b/test cases/failing/67 install_data rename bad size/meson.build new file mode 100644 index 0000000..849bb9a --- /dev/null +++ b/test cases/failing/67 install_data rename bad size/meson.build @@ -0,0 +1,3 @@ +project('data install test') + +install_data(['file1.txt', 'file2.txt'], rename : 'just one name') diff --git a/test cases/failing/67 install_data rename bad size/test.json b/test cases/failing/67 install_data rename bad size/test.json new file mode 100644 index 0000000..af1f0d9 --- /dev/null +++ b/test cases/failing/67 install_data rename bad size/test.json @@ -0,0 +1,7 @@ +{ + "stdout": [ + { + "line": "test cases/failing/67 install_data rename bad size/meson.build:3:0: ERROR: \"rename\" and \"sources\" argument lists must be the same length if \"rename\" is given. Rename has 1 elements and sources has 2." + } + ] +} diff --git a/test cases/failing/68 skip only subdir/meson.build b/test cases/failing/68 skip only subdir/meson.build new file mode 100644 index 0000000..4832bd4 --- /dev/null +++ b/test cases/failing/68 skip only subdir/meson.build @@ -0,0 +1,8 @@ +# Check that skip_rest only exits subdir, not the whole script. +# Should create an error because main.cpp does not exists. +project('example exit', 'cpp') + +subdir('subdir') + +message('Good') +executable('main', 'main.cpp') diff --git a/test cases/failing/68 skip only subdir/subdir/meson.build b/test cases/failing/68 skip only subdir/subdir/meson.build new file mode 100644 index 0000000..1ba447b --- /dev/null +++ b/test cases/failing/68 skip only subdir/subdir/meson.build @@ -0,0 +1,3 @@ +subdir_done() + +error('Unreachable') diff --git a/test cases/failing/68 skip only subdir/test.json b/test cases/failing/68 skip only subdir/test.json new file mode 100644 index 0000000..4558847 --- /dev/null +++ b/test cases/failing/68 skip only subdir/test.json @@ -0,0 +1,7 @@ +{ + "stdout": [ + { + "line": "test cases/failing/68 skip only subdir/meson.build:8:0: ERROR: File main.cpp does not exist." + } + ] +} diff --git a/test cases/failing/69 dual override/meson.build b/test cases/failing/69 dual override/meson.build new file mode 100644 index 0000000..999b8bc --- /dev/null +++ b/test cases/failing/69 dual override/meson.build @@ -0,0 +1,5 @@ +project('yo dawg') + +p = find_program('overrides.py') +meson.override_find_program('override', p) +meson.override_find_program('override', p) diff --git a/test cases/failing/69 dual override/overrides.py b/test cases/failing/69 dual override/overrides.py new file mode 100644 index 0000000..49e9b7a --- /dev/null +++ b/test cases/failing/69 dual override/overrides.py @@ -0,0 +1,4 @@ +#!/usr/bin/env python3 + +print('Yo dawg, we put overrides in your overrides,') +print('so now you can override when you override.') diff --git a/test cases/failing/69 dual override/test.json b/test cases/failing/69 dual override/test.json new file mode 100644 index 0000000..784d6b2 --- /dev/null +++ b/test cases/failing/69 dual override/test.json @@ -0,0 +1,7 @@ +{ + "stdout": [ + { + "line": "test cases/failing/69 dual override/meson.build:5:6: ERROR: Tried to override executable \"override\" which has already been overridden." + } + ] +} diff --git a/test cases/failing/7 go to subproject/meson.build b/test cases/failing/7 go to subproject/meson.build new file mode 100644 index 0000000..0354ce0 --- /dev/null +++ b/test cases/failing/7 go to subproject/meson.build @@ -0,0 +1,3 @@ +project('fff') + +subdir('subprojects') diff --git a/test cases/failing/7 go to subproject/subprojects/meson.build b/test cases/failing/7 go to subproject/subprojects/meson.build new file mode 100644 index 0000000..120344f --- /dev/null +++ b/test cases/failing/7 go to subproject/subprojects/meson.build @@ -0,0 +1 @@ +x = 'x' diff --git a/test cases/failing/7 go to subproject/test.json b/test cases/failing/7 go to subproject/test.json new file mode 100644 index 0000000..c254757 --- /dev/null +++ b/test cases/failing/7 go to subproject/test.json @@ -0,0 +1,7 @@ +{ + "stdout": [ + { + "line": "test cases/failing/7 go to subproject/meson.build:3:0: ERROR: Must not go into subprojects dir with subdir(), use subproject() instead." + } + ] +} diff --git a/test cases/failing/70 override used/meson.build b/test cases/failing/70 override used/meson.build new file mode 100644 index 0000000..128108e --- /dev/null +++ b/test cases/failing/70 override used/meson.build @@ -0,0 +1,5 @@ +project('overridde an already found exe') + +old = find_program('something.py') +replacement = find_program('other.py') +meson.override_find_program('something.py', replacement) diff --git a/test cases/failing/70 override used/other.py b/test cases/failing/70 override used/other.py new file mode 100755 index 0000000..f62ba96 --- /dev/null +++ b/test cases/failing/70 override used/other.py @@ -0,0 +1,3 @@ +#!/usr/bin/env python3 + +print('Doing something else.') diff --git a/test cases/failing/70 override used/something.py b/test cases/failing/70 override used/something.py new file mode 100755 index 0000000..64c9454 --- /dev/null +++ b/test cases/failing/70 override used/something.py @@ -0,0 +1,3 @@ +#!/usr/bin/env python3 + +print('Doing something.') diff --git a/test cases/failing/70 override used/test.json b/test cases/failing/70 override used/test.json new file mode 100644 index 0000000..adb60aa --- /dev/null +++ b/test cases/failing/70 override used/test.json @@ -0,0 +1,7 @@ +{ + "stdout": [ + { + "line": "test cases/failing/70 override used/meson.build:5:6: ERROR: Tried to override finding of executable \"something.py\" which has already been found." + } + ] +} diff --git a/test cases/failing/71 run_command unclean exit/meson.build b/test cases/failing/71 run_command unclean exit/meson.build new file mode 100644 index 0000000..f6bf895 --- /dev/null +++ b/test cases/failing/71 run_command unclean exit/meson.build @@ -0,0 +1,4 @@ +project('run_command unclean exit') + +rcprog = find_program('./returncode.py') +run_command(rcprog, '1', check : true) diff --git a/test cases/failing/71 run_command unclean exit/returncode.py b/test cases/failing/71 run_command unclean exit/returncode.py new file mode 100755 index 0000000..84dbc5d --- /dev/null +++ b/test cases/failing/71 run_command unclean exit/returncode.py @@ -0,0 +1,4 @@ +#!/usr/bin/env python3 + +import sys +exit(int(sys.argv[1])) diff --git a/test cases/failing/71 run_command unclean exit/test.json b/test cases/failing/71 run_command unclean exit/test.json new file mode 100644 index 0000000..ca5fcba --- /dev/null +++ b/test cases/failing/71 run_command unclean exit/test.json @@ -0,0 +1,8 @@ +{ + "stdout": [ + { + "match": "re", + "line": "test cases/failing/71 run_command unclean exit/meson\\.build:4:0: ERROR: Command `.*['\"].*[\\\\/]test cases[\\\\/]failing[\\\\/]71 run_command unclean exit[\\\\/]\\.[\\\\/]returncode\\.py['\"] 1` failed with status 1\\." + } + ] +} diff --git a/test cases/failing/72 int literal leading zero/meson.build b/test cases/failing/72 int literal leading zero/meson.build new file mode 100644 index 0000000..87c776f --- /dev/null +++ b/test cases/failing/72 int literal leading zero/meson.build @@ -0,0 +1,5 @@ + +# This should fail. +# Decimal syntax is 123. +# Octal syntax is 0o123. +fail_0123 = 0123 diff --git a/test cases/failing/72 int literal leading zero/test.json b/test cases/failing/72 int literal leading zero/test.json new file mode 100644 index 0000000..556e492 --- /dev/null +++ b/test cases/failing/72 int literal leading zero/test.json @@ -0,0 +1,8 @@ +{ + "stdout": [ + { + "comment": "this error message is not very informative", + "line": "test cases/failing/72 int literal leading zero/meson.build:5:13: ERROR: Expecting eof got number." + } + ] +} diff --git a/test cases/failing/73 configuration immutable/input b/test cases/failing/73 configuration immutable/input new file mode 100644 index 0000000..e69de29 diff --git a/test cases/failing/73 configuration immutable/meson.build b/test cases/failing/73 configuration immutable/meson.build new file mode 100644 index 0000000..b6cac41 --- /dev/null +++ b/test cases/failing/73 configuration immutable/meson.build @@ -0,0 +1,12 @@ +project('configuration_data is immutable') + +a = configuration_data() + +configure_file( + configuration : a, + input : 'input', + output : 'output', +) + +still_immutable = a +still_immutable.set('hello', 'world') diff --git a/test cases/failing/73 configuration immutable/test.json b/test cases/failing/73 configuration immutable/test.json new file mode 100644 index 0000000..32d9427 --- /dev/null +++ b/test cases/failing/73 configuration immutable/test.json @@ -0,0 +1,7 @@ +{ + "stdout": [ + { + "line": "test cases/failing/73 configuration immutable/meson.build:12:16: ERROR: Can not set values on configuration object that has been used." + } + ] +} diff --git a/test cases/failing/74 link with shared module on osx/meson.build b/test cases/failing/74 link with shared module on osx/meson.build new file mode 100644 index 0000000..bf18b36 --- /dev/null +++ b/test cases/failing/74 link with shared module on osx/meson.build @@ -0,0 +1,8 @@ +project('link with shared module', 'c') + +if host_machine.system() != 'darwin' + error('MESON_SKIP_TEST test only fails on OSX') +endif + +m = shared_module('mymodule', 'module.c') +e = executable('prog', 'prog.c', link_with : m) diff --git a/test cases/failing/74 link with shared module on osx/module.c b/test cases/failing/74 link with shared module on osx/module.c new file mode 100644 index 0000000..81b0d5a --- /dev/null +++ b/test cases/failing/74 link with shared module on osx/module.c @@ -0,0 +1,3 @@ +int func(void) { + return 1496; +} diff --git a/test cases/failing/74 link with shared module on osx/prog.c b/test cases/failing/74 link with shared module on osx/prog.c new file mode 100644 index 0000000..8164d8d --- /dev/null +++ b/test cases/failing/74 link with shared module on osx/prog.c @@ -0,0 +1,4 @@ + +int main(int argc, char **argv) { + return func(); +} diff --git a/test cases/failing/74 link with shared module on osx/test.json b/test cases/failing/74 link with shared module on osx/test.json new file mode 100644 index 0000000..9ca1b9d --- /dev/null +++ b/test cases/failing/74 link with shared module on osx/test.json @@ -0,0 +1,7 @@ +{ + "stdout": [ + { + "line": "test cases/failing/74 link with shared module on osx/meson.build:8:0: ERROR: target prog links against shared module mymodule. This is not permitted on OSX" + } + ] +} diff --git a/test cases/failing/75 non ascii in ascii encoded configure file/config9.h.in b/test cases/failing/75 non ascii in ascii encoded configure file/config9.h.in new file mode 100644 index 0000000..323bec6 --- /dev/null +++ b/test cases/failing/75 non ascii in ascii encoded configure file/config9.h.in @@ -0,0 +1 @@ +#define MESSAGE "@var@" diff --git a/test cases/failing/75 non ascii in ascii encoded configure file/meson.build b/test cases/failing/75 non ascii in ascii encoded configure file/meson.build new file mode 100644 index 0000000..26da80e --- /dev/null +++ b/test cases/failing/75 non ascii in ascii encoded configure file/meson.build @@ -0,0 +1,10 @@ +project('non acsii to ascii encoding') +# Writing a non ASCII character with a ASCII encoding should fail +conf9 = configuration_data() +conf9.set('var', 'д') +configure_file( + input : 'config9.h.in', + output : '@BASENAME@', + encoding : 'ascii', + configuration : conf9 +) diff --git a/test cases/failing/75 non ascii in ascii encoded configure file/test.json b/test cases/failing/75 non ascii in ascii encoded configure file/test.json new file mode 100644 index 0000000..27cb0ab --- /dev/null +++ b/test cases/failing/75 non ascii in ascii encoded configure file/test.json @@ -0,0 +1,8 @@ +{ + "stdout": [ + { + "match": "re", + "line": "test cases/failing/75 non ascii in ascii encoded configure file/meson\\.build:5:0: ERROR: Could not write output file .*[\\\\/]config9\\.h: 'ascii' codec can't encode character '\\\\u0434' in position 17: ordinal not in range\\(128\\)" + } + ] +} diff --git a/test cases/failing/76 subproj dependency not-found and required/meson.build b/test cases/failing/76 subproj dependency not-found and required/meson.build new file mode 100644 index 0000000..c5a2961 --- /dev/null +++ b/test cases/failing/76 subproj dependency not-found and required/meson.build @@ -0,0 +1,2 @@ +project('dep-test') +missing = dependency('', fallback: ['missing', 'missing_dep'], required: true) diff --git a/test cases/failing/76 subproj dependency not-found and required/test.json b/test cases/failing/76 subproj dependency not-found and required/test.json new file mode 100644 index 0000000..3b98436 --- /dev/null +++ b/test cases/failing/76 subproj dependency not-found and required/test.json @@ -0,0 +1,7 @@ +{ + "stdout": [ + { + "line": "test cases/failing/76 subproj dependency not-found and required/meson.build:2:0: ERROR: Neither a subproject directory nor a missing.wrap file was found." + } + ] +} diff --git a/test cases/failing/77 unfound run/meson.build b/test cases/failing/77 unfound run/meson.build new file mode 100644 index 0000000..3f37e9a --- /dev/null +++ b/test cases/failing/77 unfound run/meson.build @@ -0,0 +1,4 @@ +project('unfound runtarget') + +exe = find_program('nonexisting_prog', required : false) +run_target('invoke_fail', command : [exe]) diff --git a/test cases/failing/77 unfound run/test.json b/test cases/failing/77 unfound run/test.json new file mode 100644 index 0000000..99464bd --- /dev/null +++ b/test cases/failing/77 unfound run/test.json @@ -0,0 +1,7 @@ +{ + "stdout": [ + { + "line": "test cases/failing/77 unfound run/meson.build:4:0: ERROR: Tried to use non-existing executable 'nonexisting_prog'" + } + ] +} diff --git a/test cases/failing/78 framework dependency with version/meson.build b/test cases/failing/78 framework dependency with version/meson.build new file mode 100644 index 0000000..b7e04ba --- /dev/null +++ b/test cases/failing/78 framework dependency with version/meson.build @@ -0,0 +1,8 @@ +project('framework dependency with version', 'c') + +if host_machine.system() != 'darwin' + error('MESON_SKIP_TEST test only applicable on darwin') +endif + +# do individual frameworks have a meaningful version to test? And multiple frameworks might be listed... +dep = dependency('appleframeworks', modules: 'foundation', version: '>0') diff --git a/test cases/failing/78 framework dependency with version/test.json b/test cases/failing/78 framework dependency with version/test.json new file mode 100644 index 0000000..d43a498 --- /dev/null +++ b/test cases/failing/78 framework dependency with version/test.json @@ -0,0 +1,7 @@ +{ + "stdout": [ + { + "line": "test cases/failing/78 framework dependency with version/meson.build:8:0: ERROR: Dependency lookup for appleframeworks with method 'framework' failed: Unknown version, but need ['>0']." + } + ] +} diff --git a/test cases/failing/79 override exe config/foo.c b/test cases/failing/79 override exe config/foo.c new file mode 100644 index 0000000..03b2213 --- /dev/null +++ b/test cases/failing/79 override exe config/foo.c @@ -0,0 +1,3 @@ +int main(void) { + return 0; +} diff --git a/test cases/failing/79 override exe config/meson.build b/test cases/failing/79 override exe config/meson.build new file mode 100644 index 0000000..a5d0924 --- /dev/null +++ b/test cases/failing/79 override exe config/meson.build @@ -0,0 +1,6 @@ +project('myexe', 'c') + +foo = executable('foo', 'foo.c') +meson.override_find_program('bar', foo) +bar = find_program('bar') +run_command(bar, check: true) diff --git a/test cases/failing/79 override exe config/test.json b/test cases/failing/79 override exe config/test.json new file mode 100644 index 0000000..1a671a3 --- /dev/null +++ b/test cases/failing/79 override exe config/test.json @@ -0,0 +1,7 @@ +{ + "stdout": [ + { + "line": "test cases/failing/79 override exe config/meson.build:6:0: ERROR: Program 'bar' was overridden with the compiled executable 'foo' and therefore cannot be used during configuration" + } + ] +} diff --git a/test cases/failing/8 recursive/meson.build b/test cases/failing/8 recursive/meson.build new file mode 100644 index 0000000..0cf9c47 --- /dev/null +++ b/test cases/failing/8 recursive/meson.build @@ -0,0 +1,3 @@ +project('recursive') + +a = subproject('a') diff --git a/test cases/failing/8 recursive/subprojects/a/meson.build b/test cases/failing/8 recursive/subprojects/a/meson.build new file mode 100644 index 0000000..c368b5c --- /dev/null +++ b/test cases/failing/8 recursive/subprojects/a/meson.build @@ -0,0 +1,3 @@ +project('a') + +b = subproject('b') diff --git a/test cases/failing/8 recursive/subprojects/b/meson.build b/test cases/failing/8 recursive/subprojects/b/meson.build new file mode 100644 index 0000000..93b46c0 --- /dev/null +++ b/test cases/failing/8 recursive/subprojects/b/meson.build @@ -0,0 +1,3 @@ +project('b') + +a = subproject('a') diff --git a/test cases/failing/8 recursive/test.json b/test cases/failing/8 recursive/test.json new file mode 100644 index 0000000..b4c964c --- /dev/null +++ b/test cases/failing/8 recursive/test.json @@ -0,0 +1,7 @@ +{ + "stdout": [ + { + "line": "test cases/failing/8 recursive/subprojects/b/meson.build:3:0: ERROR: Recursive include of subprojects: a => b => a." + } + ] +} diff --git a/test cases/failing/80 gl dependency with version/meson.build b/test cases/failing/80 gl dependency with version/meson.build new file mode 100644 index 0000000..0127093 --- /dev/null +++ b/test cases/failing/80 gl dependency with version/meson.build @@ -0,0 +1,9 @@ +project('gl dependency with version', 'c') + +host_system = host_machine.system() +if host_system != 'windows' and host_system != 'darwin' + error('MESON_SKIP_TEST: test only fails on Windows and OSX') +endif + +# gl dependency found via system method doesn't have a meaningful version to check +dep = dependency('gl', method: 'system', version: '>0') diff --git a/test cases/failing/80 gl dependency with version/test.json b/test cases/failing/80 gl dependency with version/test.json new file mode 100644 index 0000000..3d39bc3 --- /dev/null +++ b/test cases/failing/80 gl dependency with version/test.json @@ -0,0 +1,7 @@ +{ + "stdout": [ + { + "line": "test cases/failing/80 gl dependency with version/meson.build:9:0: ERROR: Dependency lookup for gl with method 'system' failed: Unknown version, but need ['>0']." + } + ] +} diff --git a/test cases/failing/81 threads dependency with version/meson.build b/test cases/failing/81 threads dependency with version/meson.build new file mode 100644 index 0000000..6023fae --- /dev/null +++ b/test cases/failing/81 threads dependency with version/meson.build @@ -0,0 +1,3 @@ +project('threads dependency with version', 'c') +# threads dependency doesn't have a meaningful version to check +dep = dependency('threads', version: '>0') diff --git a/test cases/failing/81 threads dependency with version/test.json b/test cases/failing/81 threads dependency with version/test.json new file mode 100644 index 0000000..308ac66 --- /dev/null +++ b/test cases/failing/81 threads dependency with version/test.json @@ -0,0 +1,7 @@ +{ + "stdout": [ + { + "line": "test cases/failing/81 threads dependency with version/meson.build:3:0: ERROR: Dependency lookup for threads with method 'system' failed: Unknown version, but need ['>0']." + } + ] +} diff --git a/test cases/failing/82 gtest dependency with version/meson.build b/test cases/failing/82 gtest dependency with version/meson.build new file mode 100644 index 0000000..efbffe1 --- /dev/null +++ b/test cases/failing/82 gtest dependency with version/meson.build @@ -0,0 +1,8 @@ +project('gtest dependency with version', 'cpp') + +if not dependency('gtest', method: 'system', required: false).found() + error('MESON_SKIP_TEST test requires gtest') +endif + +# discovering gtest version is not yet implemented +dep = dependency('gtest', method: 'system', version: '>0') diff --git a/test cases/failing/82 gtest dependency with version/test.json b/test cases/failing/82 gtest dependency with version/test.json new file mode 100644 index 0000000..7cf397b --- /dev/null +++ b/test cases/failing/82 gtest dependency with version/test.json @@ -0,0 +1,7 @@ +{ + "stdout": [ + { + "line": "test cases/failing/82 gtest dependency with version/meson.build:8:0: ERROR: Dependency 'gtest' is required but not found." + } + ] +} diff --git a/test cases/failing/83 dub libray/meson.build b/test cases/failing/83 dub libray/meson.build new file mode 100644 index 0000000..306d5b3 --- /dev/null +++ b/test cases/failing/83 dub libray/meson.build @@ -0,0 +1,11 @@ +project('dub') + +if not add_languages('d', required: false) + error('MESON_SKIP_TEST test requires D compiler') +endif + +if not find_program('dub', required: false).found() + error('MESON_SKIP_TEST test requires dub') +endif + +dependency('dubtestproject', method: 'dub') # Not library (none) diff --git a/test cases/failing/83 dub libray/test.json b/test cases/failing/83 dub libray/test.json new file mode 100644 index 0000000..4dcbbed --- /dev/null +++ b/test cases/failing/83 dub libray/test.json @@ -0,0 +1,7 @@ +{ + "stdout": [ + { + "line": "test cases/failing/83 dub libray/meson.build:11:0: ERROR: Dependency \"dubtestproject\" not found" + } + ] +} diff --git a/test cases/failing/84 dub executable/meson.build b/test cases/failing/84 dub executable/meson.build new file mode 100644 index 0000000..9a134ea --- /dev/null +++ b/test cases/failing/84 dub executable/meson.build @@ -0,0 +1,11 @@ +project('dub') + +if not add_languages('d', required: false) + error('MESON_SKIP_TEST test requires D compiler') +endif + +if not find_program('dub', required: false).found() + error('MESON_SKIP_TEST test requires dub') +endif + +dependency('dubtestproject:test1', method: 'dub') # Not library (executable) diff --git a/test cases/failing/84 dub executable/test.json b/test cases/failing/84 dub executable/test.json new file mode 100644 index 0000000..6dfff62 --- /dev/null +++ b/test cases/failing/84 dub executable/test.json @@ -0,0 +1,7 @@ +{ + "stdout": [ + { + "line": "test cases/failing/84 dub executable/meson.build:11:0: ERROR: Dependency \"dubtestproject:test1\" not found" + } + ] +} diff --git a/test cases/failing/85 dub compiler/meson.build b/test cases/failing/85 dub compiler/meson.build new file mode 100644 index 0000000..36f1849 --- /dev/null +++ b/test cases/failing/85 dub compiler/meson.build @@ -0,0 +1,17 @@ +project('dub') + +if not add_languages('d', required: false) + error('MESON_SKIP_TEST test requires D compiler') +endif + +if meson.get_compiler('d').get_id() == 'dmd' + if host_machine.system() == 'windows' or host_machine.system() == 'cygwin' + error('MESON_SKIP_TEST Windows test environment lacks multiple D compilers.') + endif +endif + +if not find_program('dub', required: false).found() + error('MESON_SKIP_TEST test requires dub') +endif + +dependency('dubtestproject:test2', method: 'dub') # Compiler mismatch diff --git a/test cases/failing/85 dub compiler/test.json b/test cases/failing/85 dub compiler/test.json new file mode 100644 index 0000000..50ee39b --- /dev/null +++ b/test cases/failing/85 dub compiler/test.json @@ -0,0 +1,19 @@ +{ + "matrix": { + "options": { + "warning_level": [ + { + "val": "1", + "skip_on_env": [ + "SINGLE_DUB_COMPILER" + ] + } + ] + } + }, + "stdout": [ + { + "line": "test cases/failing/85 dub compiler/meson.build:17:0: ERROR: Dependency \"dubtestproject:test2\" not found" + } + ] +} diff --git a/test cases/failing/86 subproj not-found dep/meson.build b/test cases/failing/86 subproj not-found dep/meson.build new file mode 100644 index 0000000..2b17df1 --- /dev/null +++ b/test cases/failing/86 subproj not-found dep/meson.build @@ -0,0 +1,2 @@ +project('dep-test') +missing = dependency('', fallback: ['somesubproj', 'notfound_dep'], required: true) diff --git a/test cases/failing/86 subproj not-found dep/subprojects/somesubproj/meson.build b/test cases/failing/86 subproj not-found dep/subprojects/somesubproj/meson.build new file mode 100644 index 0000000..5f451f4 --- /dev/null +++ b/test cases/failing/86 subproj not-found dep/subprojects/somesubproj/meson.build @@ -0,0 +1,3 @@ +project('dep', 'c') + +notfound_dep = dependency('', required : false) diff --git a/test cases/failing/86 subproj not-found dep/test.json b/test cases/failing/86 subproj not-found dep/test.json new file mode 100644 index 0000000..b662643 --- /dev/null +++ b/test cases/failing/86 subproj not-found dep/test.json @@ -0,0 +1,7 @@ +{ + "stdout": [ + { + "line": "test cases/failing/86 subproj not-found dep/meson.build:2:0: ERROR: Dependency '(anonymous)' is required but not found." + } + ] +} diff --git a/test cases/failing/87 invalid configure file/input b/test cases/failing/87 invalid configure file/input new file mode 100644 index 0000000..e69de29 diff --git a/test cases/failing/87 invalid configure file/meson.build b/test cases/failing/87 invalid configure file/meson.build new file mode 100644 index 0000000..08eca2b --- /dev/null +++ b/test cases/failing/87 invalid configure file/meson.build @@ -0,0 +1,9 @@ +project('invalid configura file') + +configure_file( + configuration : configuration_data(), + input : 'input', + output : 'output', + install_dir : '', + install : true, +) diff --git a/test cases/failing/87 invalid configure file/test.json b/test cases/failing/87 invalid configure file/test.json new file mode 100644 index 0000000..d8ea73d --- /dev/null +++ b/test cases/failing/87 invalid configure file/test.json @@ -0,0 +1,7 @@ +{ + "stdout": [ + { + "line": "test cases/failing/87 invalid configure file/meson.build:3:0: ERROR: \"install_dir\" must be specified when \"install\" in a configure_file is true" + } + ] +} diff --git a/test cases/failing/88 kwarg dupe/meson.build b/test cases/failing/88 kwarg dupe/meson.build new file mode 100644 index 0000000..06821a2 --- /dev/null +++ b/test cases/failing/88 kwarg dupe/meson.build @@ -0,0 +1,6 @@ +project('dupe kwarg', 'c') + +dupedict = {'install': true} + +executable('prog', 'prog.c', install: true, + kwargs: dupedict) diff --git a/test cases/failing/88 kwarg dupe/prog.c b/test cases/failing/88 kwarg dupe/prog.c new file mode 100644 index 0000000..5f3fbe6 --- /dev/null +++ b/test cases/failing/88 kwarg dupe/prog.c @@ -0,0 +1,6 @@ +#include + +int main(int argc, char **argv) { + printf("I don't get built. It makes me saaaaaad. :(\n"); + return 0; +} diff --git a/test cases/failing/88 kwarg dupe/test.json b/test cases/failing/88 kwarg dupe/test.json new file mode 100644 index 0000000..cfd68eb --- /dev/null +++ b/test cases/failing/88 kwarg dupe/test.json @@ -0,0 +1,7 @@ +{ + "stdout": [ + { + "line": "test cases/failing/88 kwarg dupe/meson.build:5:0: ERROR: Entry \"install\" defined both as a keyword argument and in a \"kwarg\" entry." + } + ] +} diff --git a/test cases/failing/89 missing pch file/meson.build b/test cases/failing/89 missing pch file/meson.build new file mode 100644 index 0000000..a67b798 --- /dev/null +++ b/test cases/failing/89 missing pch file/meson.build @@ -0,0 +1,3 @@ +project('pch test', 'c') +exe = executable('prog', 'prog.c', +c_pch : ['pch/prog_pch.c', 'pch/prog.h']) diff --git a/test cases/failing/89 missing pch file/prog.c b/test cases/failing/89 missing pch file/prog.c new file mode 100644 index 0000000..11b7fad --- /dev/null +++ b/test cases/failing/89 missing pch file/prog.c @@ -0,0 +1,3 @@ +int main(int argc, char **argv) { + return 0; +} diff --git a/test cases/failing/89 missing pch file/test.json b/test cases/failing/89 missing pch file/test.json new file mode 100644 index 0000000..638d2e7 --- /dev/null +++ b/test cases/failing/89 missing pch file/test.json @@ -0,0 +1,8 @@ +{ + "stdout": [ + { + "comment": "literal 'pch/prog.h' from meson.build appears in output, irrespective of os.path.sep", + "line": "test cases/failing/89 missing pch file/meson.build:2:0: ERROR: File pch/prog.h does not exist." + } + ] +} diff --git a/test cases/failing/9 missing extra file/meson.build b/test cases/failing/9 missing extra file/meson.build new file mode 100644 index 0000000..725bec8 --- /dev/null +++ b/test cases/failing/9 missing extra file/meson.build @@ -0,0 +1,3 @@ +project('missing extra file', 'c') + +executable('myprog', 'prog.c', extra_files : 'missing.txt') diff --git a/test cases/failing/9 missing extra file/prog.c b/test cases/failing/9 missing extra file/prog.c new file mode 100644 index 0000000..11b7fad --- /dev/null +++ b/test cases/failing/9 missing extra file/prog.c @@ -0,0 +1,3 @@ +int main(int argc, char **argv) { + return 0; +} diff --git a/test cases/failing/9 missing extra file/test.json b/test cases/failing/9 missing extra file/test.json new file mode 100644 index 0000000..188b6a6 --- /dev/null +++ b/test cases/failing/9 missing extra file/test.json @@ -0,0 +1,7 @@ +{ + "stdout": [ + { + "line": "test cases/failing/9 missing extra file/meson.build:3:0: ERROR: File missing.txt does not exist." + } + ] +} diff --git a/test cases/failing/90 pch source different folder/include/pch.h b/test cases/failing/90 pch source different folder/include/pch.h new file mode 100644 index 0000000..e69de29 diff --git a/test cases/failing/90 pch source different folder/meson.build b/test cases/failing/90 pch source different folder/meson.build new file mode 100644 index 0000000..d320717 --- /dev/null +++ b/test cases/failing/90 pch source different folder/meson.build @@ -0,0 +1,5 @@ +project('pch', 'c') +# It is not allowed to have the PCH implementation in a different +# folder than the header. +exe = executable('prog', 'prog.c', + c_pch : ['include/pch.h', 'src/pch.c']) diff --git a/test cases/failing/90 pch source different folder/prog.c b/test cases/failing/90 pch source different folder/prog.c new file mode 100644 index 0000000..3fb1295 --- /dev/null +++ b/test cases/failing/90 pch source different folder/prog.c @@ -0,0 +1 @@ +int main(void) {} \ No newline at end of file diff --git a/test cases/failing/90 pch source different folder/src/pch.c b/test cases/failing/90 pch source different folder/src/pch.c new file mode 100644 index 0000000..e69de29 diff --git a/test cases/failing/90 pch source different folder/test.json b/test cases/failing/90 pch source different folder/test.json new file mode 100644 index 0000000..cbbac3d --- /dev/null +++ b/test cases/failing/90 pch source different folder/test.json @@ -0,0 +1,7 @@ +{ + "stdout": [ + { + "line": "test cases/failing/90 pch source different folder/meson.build:4:0: ERROR: PCH files must be stored in the same folder." + } + ] +} diff --git a/test cases/failing/91 unknown config tool/meson.build b/test cases/failing/91 unknown config tool/meson.build new file mode 100644 index 0000000..536976e --- /dev/null +++ b/test cases/failing/91 unknown config tool/meson.build @@ -0,0 +1,2 @@ +project('no-such-config-tool') +dependency('no-such-config-tool', method:'config-tool') diff --git a/test cases/failing/91 unknown config tool/test.json b/test cases/failing/91 unknown config tool/test.json new file mode 100644 index 0000000..e225167 --- /dev/null +++ b/test cases/failing/91 unknown config tool/test.json @@ -0,0 +1,7 @@ +{ + "stdout": [ + { + "line": "test cases/failing/91 unknown config tool/meson.build:2:0: ERROR: Dependency \"no-such-config-tool\" not found" + } + ] +} diff --git a/test cases/failing/92 custom target install data/Info.plist.cpp b/test cases/failing/92 custom target install data/Info.plist.cpp new file mode 100644 index 0000000..9ca2fcb --- /dev/null +++ b/test cases/failing/92 custom target install data/Info.plist.cpp @@ -0,0 +1 @@ +Some data which gets processed before installation diff --git a/test cases/failing/92 custom target install data/meson.build b/test cases/failing/92 custom target install data/meson.build new file mode 100644 index 0000000..00d348c --- /dev/null +++ b/test cases/failing/92 custom target install data/meson.build @@ -0,0 +1,11 @@ +project('custom target install data') + +preproc = find_program('preproc.py') + +t = custom_target('Info.plist', + command: [preproc, '@INPUT@', '@OUTPUT@'], + input: 'Info.plist.cpp', + output: 'Info.plist', +) + +install_data(t) diff --git a/test cases/failing/92 custom target install data/preproc.py b/test cases/failing/92 custom target install data/preproc.py new file mode 100644 index 0000000..e6eba4c --- /dev/null +++ b/test cases/failing/92 custom target install data/preproc.py @@ -0,0 +1,13 @@ +#!/usr/bin/env python3 + +import sys + +if len(sys.argv) != 3: + print(sys.argv[0], '', '') + +inf = sys.argv[1] +outf = sys.argv[2] + +with open(outf, 'wb') as o: + with open(inf, 'rb') as i: + o.write(i.read()) diff --git a/test cases/failing/92 custom target install data/test.json b/test cases/failing/92 custom target install data/test.json new file mode 100644 index 0000000..46ab013 --- /dev/null +++ b/test cases/failing/92 custom target install data/test.json @@ -0,0 +1,7 @@ +{ + "stdout": [ + { + "line": "test cases/failing/92 custom target install data/meson.build:11:0: ERROR: install_data argument 1 was of type \"CustomTarget\" but should have been one of: \"str\", \"File\"" + } + ] +} diff --git a/test cases/failing/93 add dict non string key/meson.build b/test cases/failing/93 add dict non string key/meson.build new file mode 100644 index 0000000..c81a3f7 --- /dev/null +++ b/test cases/failing/93 add dict non string key/meson.build @@ -0,0 +1,9 @@ +project('add dictionary entry using non-string key') + +dict = {} + +# An integer variable to be used as a key +key = 1 + +# Add new entry using integer variable as key should fail +dict += {key : 'myValue'} \ No newline at end of file diff --git a/test cases/failing/93 add dict non string key/test.json b/test cases/failing/93 add dict non string key/test.json new file mode 100644 index 0000000..3ef2dde --- /dev/null +++ b/test cases/failing/93 add dict non string key/test.json @@ -0,0 +1,7 @@ +{ + "stdout": [ + { + "line": "test cases/failing/93 add dict non string key/meson.build:9:0: ERROR: Key must be a string" + } + ] +} diff --git a/test cases/failing/94 add dict duplicate keys/meson.build b/test cases/failing/94 add dict duplicate keys/meson.build new file mode 100644 index 0000000..7a9b523 --- /dev/null +++ b/test cases/failing/94 add dict duplicate keys/meson.build @@ -0,0 +1,9 @@ +project('add dictionary entries with duplicate keys') + +dict = {} + +# A variable to be used as a key +key = 'myKey' + +# Add two entries with duplicate keys should fail +dict += {key : 'myValue1', key : 'myValue2'} \ No newline at end of file diff --git a/test cases/failing/94 add dict duplicate keys/test.json b/test cases/failing/94 add dict duplicate keys/test.json new file mode 100644 index 0000000..5b2d7d6 --- /dev/null +++ b/test cases/failing/94 add dict duplicate keys/test.json @@ -0,0 +1,7 @@ +{ + "stdout": [ + { + "line": "test cases/failing/94 add dict duplicate keys/meson.build:9:0: ERROR: Duplicate dictionary key: myKey" + } + ] +} diff --git a/test cases/failing/95 no host get_external_property/meson.build b/test cases/failing/95 no host get_external_property/meson.build new file mode 100644 index 0000000..c956754 --- /dev/null +++ b/test cases/failing/95 no host get_external_property/meson.build @@ -0,0 +1,3 @@ +project('missing property') + +message(meson.get_external_property('nonexisting')) diff --git a/test cases/failing/95 no host get_external_property/test.json b/test cases/failing/95 no host get_external_property/test.json new file mode 100644 index 0000000..0ef6dd2 --- /dev/null +++ b/test cases/failing/95 no host get_external_property/test.json @@ -0,0 +1,7 @@ +{ + "stdout": [ + { + "line": "test cases/failing/95 no host get_external_property/meson.build:3:0: ERROR: Unknown property for host machine: nonexisting" + } + ] +} diff --git a/test cases/failing/96 no native compiler/main.c b/test cases/failing/96 no native compiler/main.c new file mode 100644 index 0000000..9b6bdc2 --- /dev/null +++ b/test cases/failing/96 no native compiler/main.c @@ -0,0 +1,3 @@ +int main(void) { + return 0; +} diff --git a/test cases/failing/96 no native compiler/meson.build b/test cases/failing/96 no native compiler/meson.build new file mode 100644 index 0000000..f0126ac --- /dev/null +++ b/test cases/failing/96 no native compiler/meson.build @@ -0,0 +1,12 @@ +project('no native compiler') + +if not meson.is_cross_build() + error('MESON_SKIP_TEST test only applicable when cross building.') +endif + +if add_languages('c', required: false, native: true) + error('MESON_SKIP_TEST test only applicable when native compiler not available.') +endif + +add_languages('c') +executable('main', 'main.c', native: true) diff --git a/test cases/failing/96 no native compiler/test.json b/test cases/failing/96 no native compiler/test.json new file mode 100644 index 0000000..0107727 --- /dev/null +++ b/test cases/failing/96 no native compiler/test.json @@ -0,0 +1,7 @@ +{ + "stdout": [ + { + "line": "test cases/failing/96 no native compiler/meson.build:12:0: ERROR: No host machine compiler for \"main.c\"" + } + ] +} diff --git a/test cases/failing/97 subdir parse error/meson.build b/test cases/failing/97 subdir parse error/meson.build new file mode 100644 index 0000000..a744396 --- /dev/null +++ b/test cases/failing/97 subdir parse error/meson.build @@ -0,0 +1,2 @@ +project('subdir false plusassign') +subdir('subdir') diff --git a/test cases/failing/97 subdir parse error/subdir/meson.build b/test cases/failing/97 subdir parse error/subdir/meson.build new file mode 100644 index 0000000..3ac5ef9 --- /dev/null +++ b/test cases/failing/97 subdir parse error/subdir/meson.build @@ -0,0 +1 @@ +3 += 4 diff --git a/test cases/failing/97 subdir parse error/test.json b/test cases/failing/97 subdir parse error/test.json new file mode 100644 index 0000000..414789e --- /dev/null +++ b/test cases/failing/97 subdir parse error/test.json @@ -0,0 +1,7 @@ +{ + "stdout": [ + { + "line": "test cases/failing/97 subdir parse error/subdir/meson.build:1:0: ERROR: Plusassignment target must be an id." + } + ] +} diff --git a/test cases/failing/98 invalid option file/meson.build b/test cases/failing/98 invalid option file/meson.build new file mode 100644 index 0000000..b0347c3 --- /dev/null +++ b/test cases/failing/98 invalid option file/meson.build @@ -0,0 +1 @@ +project('invalid option file') diff --git a/test cases/failing/98 invalid option file/meson_options.txt b/test cases/failing/98 invalid option file/meson_options.txt new file mode 100644 index 0000000..eef843b --- /dev/null +++ b/test cases/failing/98 invalid option file/meson_options.txt @@ -0,0 +1 @@ +' diff --git a/test cases/failing/98 invalid option file/test.json b/test cases/failing/98 invalid option file/test.json new file mode 100644 index 0000000..6ab5393 --- /dev/null +++ b/test cases/failing/98 invalid option file/test.json @@ -0,0 +1,7 @@ +{ + "stdout": [ + { + "line": "test cases/failing/98 invalid option file/meson_options.txt:1:0: ERROR: lexer" + } + ] +} diff --git a/test cases/failing/99 no lang/main.c b/test cases/failing/99 no lang/main.c new file mode 100644 index 0000000..9b6bdc2 --- /dev/null +++ b/test cases/failing/99 no lang/main.c @@ -0,0 +1,3 @@ +int main(void) { + return 0; +} diff --git a/test cases/failing/99 no lang/meson.build b/test cases/failing/99 no lang/meson.build new file mode 100644 index 0000000..85c5db8 --- /dev/null +++ b/test cases/failing/99 no lang/meson.build @@ -0,0 +1,2 @@ +project('target without lang') +executable('main', 'main.c') diff --git a/test cases/failing/99 no lang/test.json b/test cases/failing/99 no lang/test.json new file mode 100644 index 0000000..48c6dd7 --- /dev/null +++ b/test cases/failing/99 no lang/test.json @@ -0,0 +1,7 @@ +{ + "stdout": [ + { + "line": "test cases/failing/99 no lang/meson.build:2:0: ERROR: No host machine compiler for 'main.c'" + } + ] +} diff --git a/test cases/fortran/1 basic/meson.build b/test cases/fortran/1 basic/meson.build new file mode 100644 index 0000000..52e2d6f --- /dev/null +++ b/test cases/fortran/1 basic/meson.build @@ -0,0 +1,13 @@ +project('simple fortran', 'fortran') + +fc = meson.get_compiler('fortran') +if fc.get_id() == 'gcc' + add_global_arguments('-fbounds-check', language : 'fortran') +endif + +args = fc.first_supported_argument(['-ffree-form', '-free', '/free']) +assert(args != [], 'No arguments found?') + +e = executable('simple', 'simple.f90', + fortran_args : args) +test('Simple Fortran', e) diff --git a/test cases/fortran/1 basic/simple.f90 b/test cases/fortran/1 basic/simple.f90 new file mode 100644 index 0000000..2160d56 --- /dev/null +++ b/test cases/fortran/1 basic/simple.f90 @@ -0,0 +1,3 @@ +program main +print *, "Fortran compilation is working." +end program diff --git a/test cases/fortran/10 find library/gzip.f90 b/test cases/fortran/10 find library/gzip.f90 new file mode 100644 index 0000000..32f21d7 --- /dev/null +++ b/test cases/fortran/10 find library/gzip.f90 @@ -0,0 +1,32 @@ +module gzip + +use iso_c_binding, only: c_char, c_ptr, c_int +implicit none + +interface +type(c_ptr) function gzopen(path, mode) bind(C) +import c_char, c_ptr + +character(kind=c_char), intent(in) :: path(*), mode(*) +end function gzopen +end interface + +interface +integer(c_int) function gzwrite(file, buf, len) bind(C) +import c_int, c_ptr, c_char + +type(c_ptr), value, intent(in) :: file +character(kind=c_char), intent(in) :: buf +integer(c_int), value, intent(in) :: len +end function gzwrite +end interface + +interface +integer(c_int) function gzclose(file) bind(C) +import c_int, c_ptr + +type(c_ptr), value, intent(in) :: file +end function gzclose +end interface + +end module gzip diff --git a/test cases/fortran/10 find library/main.f90 b/test cases/fortran/10 find library/main.f90 new file mode 100644 index 0000000..e885d30 --- /dev/null +++ b/test cases/fortran/10 find library/main.f90 @@ -0,0 +1,38 @@ +program main +use iso_fortran_env, only: stderr=>error_unit +use iso_c_binding, only: c_int, c_char, c_null_char, c_ptr +use gzip, only: gzopen, gzwrite, gzclose + +implicit none + +character(kind=c_char,len=*), parameter :: path = c_char_"test.gz"//c_null_char +character(kind=c_char,len=*), parameter :: mode = c_char_"wb9"//c_null_char +integer(c_int), parameter :: buffer_size = 512 + +type(c_ptr) :: file +character(kind=c_char, len=buffer_size) :: buffer +integer(c_int) :: ret +integer :: i + +! open file +file = gzopen(path, mode) + +! fill buffer with data +do i=1,buffer_size/4 + write(buffer(4*(i-1)+1:4*i), '(i3.3, a)') i, new_line('') +end do +ret = gzwrite(file, buffer, buffer_size) +if (ret /= buffer_size) then + write(stderr,'(a, i3, a, i3, a)') 'Error: ', ret, ' / ', buffer_size, & + ' bytes written.' + stop 1 +end if + +! close file +ret = gzclose(file) +if (ret /= 0) then + write(stderr,*) 'Error: failure to close file with error code ', ret + stop 1 +end if + +end program diff --git a/test cases/fortran/10 find library/meson.build b/test cases/fortran/10 find library/meson.build new file mode 100644 index 0000000..2a2ef31 --- /dev/null +++ b/test cases/fortran/10 find library/meson.build @@ -0,0 +1,13 @@ +project('find fortran library', 'fortran') + +fc = meson.get_compiler('fortran') + +sources = ['main.f90', 'gzip.f90'] +zlib = fc.find_library('z', required: false) + +if not zlib.found() + error('MESON_SKIP_TEST: Z library not available.') +endif + +exe = executable('zlibtest', sources, dependencies : zlib) +test('testzlib', exe) diff --git a/test cases/fortran/11 compiles links runs/meson.build b/test cases/fortran/11 compiles links runs/meson.build new file mode 100644 index 0000000..150c1a4 --- /dev/null +++ b/test cases/fortran/11 compiles links runs/meson.build @@ -0,0 +1,17 @@ +project('compiles_links_runs', 'fortran') + +fc = meson.get_compiler('fortran') + +code = '''error stop 123; end''' + +if not fc.compiles(code) + error('Fortran 2008 code failed to compile') +endif + +if not fc.links(code) + error('Fortran 2008 code failed to link') +endif + +if fc.run(code).returncode() != 123 + error('Fortran 2008 code failed to run') +endif diff --git a/test cases/fortran/12 submodule/a1.f90 b/test cases/fortran/12 submodule/a1.f90 new file mode 100644 index 0000000..c4b4555 --- /dev/null +++ b/test cases/fortran/12 submodule/a1.f90 @@ -0,0 +1,26 @@ +module a1 +implicit none + +interface +module elemental real function pi2tau(pi) + real, intent(in) :: pi +end function pi2tau + +module real function get_pi() +end function get_pi +end interface + +end module a1 + +program hierN + +use a1 +real :: tau, pi + +pi = get_pi() + +tau = pi2tau(pi) + +print *,'pi=',pi,'tau=',tau + +end program diff --git a/test cases/fortran/12 submodule/a2.f90 b/test cases/fortran/12 submodule/a2.f90 new file mode 100644 index 0000000..ba8a0dd --- /dev/null +++ b/test cases/fortran/12 submodule/a2.f90 @@ -0,0 +1,10 @@ +! testing no space between submodule() +submodule(a1) a2 + +contains + +module procedure pi2tau + pi2tau = 2*pi +end procedure pi2tau + +end submodule a2 diff --git a/test cases/fortran/12 submodule/a3.f90 b/test cases/fortran/12 submodule/a3.f90 new file mode 100644 index 0000000..3881675 --- /dev/null +++ b/test cases/fortran/12 submodule/a3.f90 @@ -0,0 +1,13 @@ +! submodule (bogus) foo +! testing don't detect commented submodule + +submodule (a1:a2) a3 ! testing inline comment + +contains + +module procedure get_pi + get_pi = 4.*atan(1.) +end procedure get_pi + + +end submodule a3 diff --git a/test cases/fortran/12 submodule/child.f90 b/test cases/fortran/12 submodule/child.f90 new file mode 100644 index 0000000..baf1fef --- /dev/null +++ b/test cases/fortran/12 submodule/child.f90 @@ -0,0 +1,13 @@ +submodule (parent) child + +contains + +module procedure pi2tau + pi2tau = 2*pi +end procedure pi2tau + +module procedure good +print *, 'Good!' +end procedure good + +end submodule child diff --git a/test cases/fortran/12 submodule/meson.build b/test cases/fortran/12 submodule/meson.build new file mode 100644 index 0000000..204a36b --- /dev/null +++ b/test cases/fortran/12 submodule/meson.build @@ -0,0 +1,13 @@ +project('submodule single level', 'fortran', + meson_version: '>= 0.50.0') + +fortc = meson.get_compiler('fortran') +if fortc.get_id() == 'gcc' and fortc.version().version_compare('<6.0') + error('MESON_SKIP_TEST need gfortran >= 6.0 for submodule support') +endif + +hier2 = executable('single', 'parent.f90', 'child.f90') +test('single-level hierarchy', hier2) + +hierN = executable('multi', 'a1.f90', 'a2.f90', 'a3.f90') +test('multi-level hierarchy', hierN) diff --git a/test cases/fortran/12 submodule/parent.f90 b/test cases/fortran/12 submodule/parent.f90 new file mode 100644 index 0000000..efc7cf6 --- /dev/null +++ b/test cases/fortran/12 submodule/parent.f90 @@ -0,0 +1,26 @@ +module parent +real, parameter :: pi = 4.*atan(1.) +real :: tau + +interface +module elemental real function pi2tau(pi) + real, intent(in) :: pi +end function pi2tau + +module subroutine good() +end subroutine good +end interface + +end module parent + +program main + +use parent + +tau = pi2tau(pi) + +print *,'pi=',pi, 'tau=', tau + +call good() + +end program diff --git a/test cases/fortran/13 coarray/main.f90 b/test cases/fortran/13 coarray/main.f90 new file mode 100644 index 0000000..eee03ea --- /dev/null +++ b/test cases/fortran/13 coarray/main.f90 @@ -0,0 +1,10 @@ +program main +implicit none + +if (this_image() == 1) print *, 'number of Fortran coarray images:', num_images() + +sync all ! semaphore, ensures message above is printed at top. + +print *, 'Process ', this_image() + +end program diff --git a/test cases/fortran/13 coarray/meson.build b/test cases/fortran/13 coarray/meson.build new file mode 100644 index 0000000..893cec9 --- /dev/null +++ b/test cases/fortran/13 coarray/meson.build @@ -0,0 +1,24 @@ +project('Fortran coarray', 'fortran', + meson_version: '>=0.50') + +fc = meson.get_compiler('fortran') + +if ['pgi', 'flang'].contains(fc.get_id()) + error('MESON_SKIP_TEST: At least through PGI 19.10 and Flang 7.1 do not support Fortran Coarrays.') +endif + +# coarray is required because single-image fallback is an intrinsic feature +coarray = dependency('coarray') + +# check coarray, because user might not have all the library stack installed correctly +# for example, conflicting library/compiler versions on PATH +# this has to invoke a run of "sync all" to verify the MPI stack is functioning, +# particularly for dynamic linking +if fc.run('sync all; end', dependencies: coarray, name: 'Coarray link & run').returncode() != 0 + error('MESON_SKIP_TEST: coarray stack (including MPI) did not link correctly so that a simple test could run.') +endif + +exe = executable('hello', 'main.f90', + dependencies : coarray) + +test('Coarray hello world', exe, timeout: 10) diff --git a/test cases/fortran/14 fortran links c/clib.c b/test cases/fortran/14 fortran links c/clib.c new file mode 100644 index 0000000..81b2e0c --- /dev/null +++ b/test cases/fortran/14 fortran links c/clib.c @@ -0,0 +1,7 @@ +#include + +void hello(void){ + + printf("hello from C\n"); + +} diff --git a/test cases/fortran/14 fortran links c/clib.def b/test cases/fortran/14 fortran links c/clib.def new file mode 100644 index 0000000..4caeb24 --- /dev/null +++ b/test cases/fortran/14 fortran links c/clib.def @@ -0,0 +1,2 @@ +EXPORTS + hello diff --git a/test cases/fortran/14 fortran links c/f_call_c.f90 b/test cases/fortran/14 fortran links c/f_call_c.f90 new file mode 100644 index 0000000..b3f70a7 --- /dev/null +++ b/test cases/fortran/14 fortran links c/f_call_c.f90 @@ -0,0 +1,11 @@ +program main +implicit none + +interface +subroutine hello() bind (c) +end subroutine hello +end interface + +call hello() + +end program diff --git a/test cases/fortran/14 fortran links c/meson.build b/test cases/fortran/14 fortran links c/meson.build new file mode 100644 index 0000000..380a85a --- /dev/null +++ b/test cases/fortran/14 fortran links c/meson.build @@ -0,0 +1,17 @@ +project('Fortran calling C', 'fortran', 'c', + meson_version: '>= 0.51.0', + default_options : ['default_library=static']) + +ccid = meson.get_compiler('c').get_id() +fcid = meson.get_compiler('fortran').get_id() + +if fcid == 'gcc' and ccid in ['msvc', 'clang-cl'] + error('MESON_SKIP_TEST: MSVC and GCC do not interoperate like this.') +endif + +c_lib = library('clib', 'clib.c', vs_module_defs : 'clib.def') + +f_call_c = executable('f_call_c', 'f_call_c.f90', + link_with: c_lib, + link_language: 'fortran') +test('Fortran calling C', f_call_c) diff --git a/test cases/fortran/15 include/inc1.f90 b/test cases/fortran/15 include/inc1.f90 new file mode 100644 index 0000000..163f586 --- /dev/null +++ b/test cases/fortran/15 include/inc1.f90 @@ -0,0 +1,5 @@ + +real :: pi = 4.*atan(1.) +real :: tau + +include "inc2.f90" ! testing inline comment diff --git a/test cases/fortran/15 include/inc2.f90 b/test cases/fortran/15 include/inc2.f90 new file mode 100644 index 0000000..065b990 --- /dev/null +++ b/test cases/fortran/15 include/inc2.f90 @@ -0,0 +1,2 @@ + +tau = 2*pi diff --git a/test cases/fortran/15 include/include_hierarchy.f90 b/test cases/fortran/15 include/include_hierarchy.f90 new file mode 100644 index 0000000..0598d87 --- /dev/null +++ b/test cases/fortran/15 include/include_hierarchy.f90 @@ -0,0 +1,9 @@ +program test_include_hier + +implicit none + +include "inc1.f90" + +print *, '2*pi:', tau + +end program diff --git a/test cases/fortran/15 include/include_syntax.f90 b/test cases/fortran/15 include/include_syntax.f90 new file mode 100644 index 0000000..5f7eb9f --- /dev/null +++ b/test cases/fortran/15 include/include_syntax.f90 @@ -0,0 +1,25 @@ +program test_include_syntax + +implicit none + +integer :: x, y + +x = 1 +y = 0 + +! include "timestwo.f90" + +include "timestwo.f90" ! inline comment check +if (x/=2) error stop 'failed on first include' + +! leading space check + include 'timestwo.f90' +if (x/=4) error stop 'failed on second include' + +! Most Fortran compilers can't handle the non-standard #include, +! including (ha!) Flang, Gfortran, Ifort and PGI. +! #include "timestwo.f90" + +print *, 'OK: Fortran include tests: x=',x + +end program diff --git a/test cases/fortran/15 include/meson.build b/test cases/fortran/15 include/meson.build new file mode 100644 index 0000000..e19c47f --- /dev/null +++ b/test cases/fortran/15 include/meson.build @@ -0,0 +1,19 @@ +project('Inclusive', 'fortran', + meson_version: '>= 0.51.1') + +cm = import('cmake') + +hier_exe = executable('include_hierarchy', 'include_hierarchy.f90') +test('Fortran include file hierarchy', hier_exe) + +syntax_exe = executable('include_syntax', 'include_syntax.f90') +test('Fortran include file syntax', syntax_exe) + +# older CI runs into problems with too-old Ninja and CMake and Fortran +ninja_version = run_command('ninja', '--version', check: true).stdout().strip() +cmake_version = run_command('cmake', '--version', check: true).stdout().split()[2] +if ninja_version.version_compare('>=1.10.0') and cmake_version.version_compare('>=3.17.0') + cm.subproject('cmake_inc') +else + message('SKIP: CMake Fortran subproject with include. Ninja >= 1.10 and CMake >= 3.17 needed. You have Ninja ' + ninja_version + ' and CMake ' + cmake_version) +endif diff --git a/test cases/fortran/15 include/subprojects/cmake_inc/CMakeLists.txt b/test cases/fortran/15 include/subprojects/cmake_inc/CMakeLists.txt new file mode 100644 index 0000000..1ffe882 --- /dev/null +++ b/test cases/fortran/15 include/subprojects/cmake_inc/CMakeLists.txt @@ -0,0 +1,4 @@ +cmake_minimum_required(VERSION 3.17) +project(cmake_inc LANGUAGES Fortran) + +add_executable(main main.f90) diff --git a/test cases/fortran/15 include/subprojects/cmake_inc/main.f90 b/test cases/fortran/15 include/subprojects/cmake_inc/main.f90 new file mode 100644 index 0000000..dd2991d --- /dev/null +++ b/test cases/fortran/15 include/subprojects/cmake_inc/main.f90 @@ -0,0 +1,9 @@ +program test_subproject_inc + +implicit none + +include 'thousand.f90' + +if (thousand /= 1000) error stop 'did not include properly' + +end program diff --git a/test cases/fortran/15 include/subprojects/cmake_inc/thousand.f90 b/test cases/fortran/15 include/subprojects/cmake_inc/thousand.f90 new file mode 100644 index 0000000..08a4048 --- /dev/null +++ b/test cases/fortran/15 include/subprojects/cmake_inc/thousand.f90 @@ -0,0 +1 @@ +integer, parameter :: thousand = 1000 diff --git a/test cases/fortran/15 include/timestwo.f90 b/test cases/fortran/15 include/timestwo.f90 new file mode 100644 index 0000000..0e2d5ac --- /dev/null +++ b/test cases/fortran/15 include/timestwo.f90 @@ -0,0 +1,2 @@ +x = 2*x +y = y+1 \ No newline at end of file diff --git a/test cases/fortran/16 openmp/main.f90 b/test cases/fortran/16 openmp/main.f90 new file mode 100644 index 0000000..26b792f --- /dev/null +++ b/test cases/fortran/16 openmp/main.f90 @@ -0,0 +1,18 @@ +program main +use, intrinsic :: iso_fortran_env, only: stderr=>error_unit +use omp_lib, only: omp_get_max_threads +implicit none + +integer :: N, ierr +character(80) :: buf ! can't be allocatable in this use case. Just set arbitrarily large. + +call get_environment_variable('OMP_NUM_THREADS', buf, status=ierr) +if (ierr/=0) error stop 'environment variable OMP_NUM_THREADS could not be read' +read(buf,*) N + +if (omp_get_max_threads() /= N) then + write(stderr, *) 'Max Fortran threads: ', omp_get_max_threads(), '!=', N + error stop +endif + +end program diff --git a/test cases/fortran/16 openmp/meson.build b/test cases/fortran/16 openmp/meson.build new file mode 100644 index 0000000..f021ce2 --- /dev/null +++ b/test cases/fortran/16 openmp/meson.build @@ -0,0 +1,34 @@ +# This test is complementary to and extends "common/190 openmp" so that +# we can examine more compilers and options than would be warranted in +# the common test where C/C++ must also be handled. +project('openmp', 'fortran', + meson_version: '>= 0.46') + + +fc = meson.get_compiler('fortran') +if fc.get_id() == 'gcc' and fc.version().version_compare('<4.2.0') + error('MESON_SKIP_TEST gcc is too old to 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') + +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) + + +# Check we can apply a version constraint +dependency('openmp', version: '>=@0@'.format(openmp.version())) diff --git a/test cases/fortran/17 add_languages/meson.build b/test cases/fortran/17 add_languages/meson.build new file mode 100644 index 0000000..e7de180 --- /dev/null +++ b/test cases/fortran/17 add_languages/meson.build @@ -0,0 +1,5 @@ +project('add_lang_fortran') + +# catch bug where Fortran compiler is found with project('foo', 'fortran') but +# not by add_languages('fortran') +assert(add_languages('fortran'), 'these tests assume Fortran compiler can be found') \ No newline at end of file diff --git a/test cases/fortran/18 first_arg/main.f90 b/test cases/fortran/18 first_arg/main.f90 new file mode 100644 index 0000000..6ea28b1 --- /dev/null +++ b/test cases/fortran/18 first_arg/main.f90 @@ -0,0 +1,3 @@ +program main +i = 3 +end program diff --git a/test cases/fortran/18 first_arg/meson.build b/test cases/fortran/18 first_arg/meson.build new file mode 100644 index 0000000..63021f2 --- /dev/null +++ b/test cases/fortran/18 first_arg/meson.build @@ -0,0 +1,46 @@ +project('fortran_args', 'fortran') + +fc = meson.get_compiler('fortran') + +if fc.get_id() == 'intel-cl' + is_arg = '/O2' + useless = '/DFOO' +else + is_arg = '-O2' + useless = '-DFOO' +endif + +isnt_arg = '-fiambroken' + +assert(fc.has_argument(is_arg), 'Arg that should have worked does not work.') +assert(not fc.has_argument(isnt_arg), 'Arg that should be broken is not.') + +assert(fc.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 = fc.first_supported_argument([isnt_arg, is_arg, isnt_arg, useless]) +l2 = fc.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.') + +# --- test with an actual program, here for implicit none + +in0 = fc.first_supported_argument('-fimplicit-none', '-Mdclchk', '/warn:declarations', '-warn').get(0, '') +impnone = { +'intel-cl': '/warn:declarations', +'intel': '-warn', +'gcc': '-fimplicit-none', +'pgi': '-Mdclchk', +} + +arg = impnone.get(fc.get_id(), '') +if arg != '' + assert(in0 == arg, 'implicit none argument ' + arg + ' not matching ' + in0) +endif + +in1 = fc.get_supported_arguments('-fimplicit-none', '/warn:declarations', '/warn:errors', '-Mdclchk') +if in1.length() > 0 + assert(not fc.compiles(files('main.f90'), args: in1, name:'will fail implicit none'), 'implicit none should have failed') +endif diff --git a/test cases/fortran/19 fortran_std/legacy.f b/test cases/fortran/19 fortran_std/legacy.f new file mode 100644 index 0000000..014bcc1 --- /dev/null +++ b/test cases/fortran/19 fortran_std/legacy.f @@ -0,0 +1,8 @@ + program main + ! non-integer loop indices are deleted in Fortran 95 standard + real a + + do 10 a=0,0.5,0.1 +10 continue + + end program diff --git a/test cases/fortran/19 fortran_std/meson.build b/test cases/fortran/19 fortran_std/meson.build new file mode 100644 index 0000000..f46f8ff --- /dev/null +++ b/test cases/fortran/19 fortran_std/meson.build @@ -0,0 +1,27 @@ +project('FortranStd', 'fortran', + default_options: ['warning_level=0']) +# As with C and C++, each Fortran compiler + version has a subset of supported Fortran standards +# Additionally, a necessary option for non-standard Fortran projects is the "legacy" +# option, which allows non-standard syntax and behavior quirks. +# Thus "legacy" is a necessity for some old but important Fortran projects. +# By default, popular Fortran compilers disallow these quirks without "legacy" option. + +fc = meson.get_compiler('fortran') + +executable('stdnone', 'std95.f90') + +executable('std_legacy', 'legacy.f', override_options : ['fortran_std=legacy']) + +executable('std_95', 'std95.f90', override_options : ['fortran_std=f95']) + +executable('std_f2003', 'std2003.f90', override_options : ['fortran_std=f2003']) + +executable('std_f2008', 'std2008.f90', override_options : ['fortran_std=f2008']) + +if fc.get_id() == 'gcc' + if fc.version().version_compare('>=8.0') + executable('std_f2018', 'std2018.f90', override_options : ['fortran_std=f2018']) + endif +else + executable('std_f2018', 'std2018.f90', override_options : ['fortran_std=f2018']) +endif \ No newline at end of file diff --git a/test cases/fortran/19 fortran_std/std2003.f90 b/test cases/fortran/19 fortran_std/std2003.f90 new file mode 100644 index 0000000..0382192 --- /dev/null +++ b/test cases/fortran/19 fortran_std/std2003.f90 @@ -0,0 +1,37 @@ +program main +use, intrinsic :: iso_fortran_env, only : error_unit +implicit none + +! http://fortranwiki.org/fortran/show/Real+precision +integer, parameter :: sp = selected_real_kind(6, 37) +integer, parameter :: dp = selected_real_kind(15, 307) + +real(sp) :: a32 +real(dp) :: a64 + +real(sp), parameter :: pi32 = 4*atan(1._sp) +real(dp), parameter :: pi64 = 4*atan(1._dp) + +if (pi32 == pi64) stop 1 + +call timestwo(a32) +call timestwo(a64) + +contains + +elemental subroutine timestwo(a) + +class(*), intent(inout) :: a + +select type (a) + type is (real(sp)) + a = 2*a + type is (real(dp)) + a = 2*a + type is (integer) + a = 2*a +end select + +end subroutine timestwo + +end program diff --git a/test cases/fortran/19 fortran_std/std2008.f90 b/test cases/fortran/19 fortran_std/std2008.f90 new file mode 100644 index 0000000..750173e --- /dev/null +++ b/test cases/fortran/19 fortran_std/std2008.f90 @@ -0,0 +1,33 @@ +program main +use, intrinsic :: iso_fortran_env, only : error_unit, sp=>real32, dp=>real64 +implicit none + +real(sp) :: a32 +real(dp) :: a64 + +real(sp), parameter :: pi32 = 4*atan(1._sp) +real(dp), parameter :: pi64 = 4*atan(1._dp) + +if (pi32 == pi64) error stop 'real32 values generally do not exactly equal real64 values' + +call timestwo(a32) +call timestwo(a64) + +contains + +elemental subroutine timestwo(a) + +class(*), intent(inout) :: a + +select type (a) + type is (real(sp)) + a = 2*a + type is (real(dp)) + a = 2*a + type is (integer) + a = 2*a +end select + +end subroutine timestwo + +end program diff --git a/test cases/fortran/19 fortran_std/std2018.f90 b/test cases/fortran/19 fortran_std/std2018.f90 new file mode 100644 index 0000000..34fad50 --- /dev/null +++ b/test cases/fortran/19 fortran_std/std2018.f90 @@ -0,0 +1,35 @@ +program main +use, intrinsic :: iso_fortran_env, only : error_unit, sp=>real32, dp=>real64 +implicit none + +real(sp) :: a32 +real(dp) :: a64 + +real(sp), parameter :: pi32 = 4*atan(1._sp) +real(dp), parameter :: pi64 = 4*atan(1._dp) + +if (pi32 == pi64) error stop 'real32 values generally do not exactly equal real64 values' + +call timestwo(a32) +call timestwo(a64) + +contains + +elemental subroutine timestwo(a) + +class(*), intent(inout) :: a + +select type (a) + type is (real(sp)) + a = 2*a + type is (real(dp)) + a = 2*a + type is (integer) + a = 2*a + class default + error stop 'requires real32, real64 or integer' +end select + +end subroutine timestwo + +end program diff --git a/test cases/fortran/19 fortran_std/std95.f90 b/test cases/fortran/19 fortran_std/std95.f90 new file mode 100644 index 0000000..2837da8 --- /dev/null +++ b/test cases/fortran/19 fortran_std/std95.f90 @@ -0,0 +1,14 @@ +program main +implicit none + +integer :: i, j +integer, parameter :: N=3 +real :: A(N,N) + +A = 0 + +forall (i=1:N, j=1:N) + A(i,j) = 1 +end forall + +end program diff --git a/test cases/fortran/2 modules/comment_mod.f90 b/test cases/fortran/2 modules/comment_mod.f90 new file mode 100644 index 0000000..917f6be --- /dev/null +++ b/test cases/fortran/2 modules/comment_mod.f90 @@ -0,0 +1,6 @@ +module line ! inline comment +implicit none + +real :: length + +end module line diff --git a/test cases/fortran/2 modules/meson.build b/test cases/fortran/2 modules/meson.build new file mode 100644 index 0000000..c9bfd8d --- /dev/null +++ b/test cases/fortran/2 modules/meson.build @@ -0,0 +1,9 @@ +project('modules', 'fortran', + default_options : ['default_library=static']) + +commented = library('commented', 'comment_mod.f90') + +# Have one file with an upper case file extension. +e = executable('modprog', 'mymod.F90', 'prog.f90', + link_with: commented) +test('moduletest', e) diff --git a/test cases/fortran/2 modules/mymod.F90 b/test cases/fortran/2 modules/mymod.F90 new file mode 100644 index 0000000..a45f5c9 --- /dev/null +++ b/test cases/fortran/2 modules/mymod.F90 @@ -0,0 +1,8 @@ +! module circle to be sure module regex doesn't allow commented modules + +module circle +implicit none + +real, parameter :: pi = 4.*atan(1.) +real :: radius +end module circle diff --git a/test cases/fortran/2 modules/prog.f90 b/test cases/fortran/2 modules/prog.f90 new file mode 100644 index 0000000..ef72d11 --- /dev/null +++ b/test cases/fortran/2 modules/prog.f90 @@ -0,0 +1,11 @@ +program main +use circle, only: pi +use line, only: length +implicit none + +print *,'pi=',pi + +length = pi +print *, length + +end program diff --git a/test cases/fortran/20 buildtype/main.f90 b/test cases/fortran/20 buildtype/main.f90 new file mode 100644 index 0000000..ecc7d61 --- /dev/null +++ b/test cases/fortran/20 buildtype/main.f90 @@ -0,0 +1,2 @@ +program main +end program diff --git a/test cases/fortran/20 buildtype/meson.build b/test cases/fortran/20 buildtype/meson.build new file mode 100644 index 0000000..2be6337 --- /dev/null +++ b/test cases/fortran/20 buildtype/meson.build @@ -0,0 +1,5 @@ +# checks for unexpected behavior on non-default buildtype and warning_level +project('build type Fortran', 'fortran', + default_options: ['buildtype=release', 'warning_level=3']) + +executable('main', 'main.f90') diff --git a/test cases/fortran/21 install static/main.f90 b/test cases/fortran/21 install static/main.f90 new file mode 100644 index 0000000..d0c67fe --- /dev/null +++ b/test cases/fortran/21 install static/main.f90 @@ -0,0 +1,5 @@ +program main +use main_lib +implicit none +call main_hello() +end program diff --git a/test cases/fortran/21 install static/main_lib.f90 b/test cases/fortran/21 install static/main_lib.f90 new file mode 100644 index 0000000..874584d --- /dev/null +++ b/test cases/fortran/21 install static/main_lib.f90 @@ -0,0 +1,16 @@ +module main_lib + + use static_hello + implicit none + + private + public :: main_hello + + contains + + subroutine main_hello + call static_say_hello() + print *, "Main hello routine finished." + end subroutine main_hello + +end module main_lib diff --git a/test cases/fortran/21 install static/meson.build b/test cases/fortran/21 install static/meson.build new file mode 100644 index 0000000..b4d3e40 --- /dev/null +++ b/test cases/fortran/21 install static/meson.build @@ -0,0 +1,20 @@ +# Based on 'fortran/5 static', but: +# - Uses a subproject dependency +# - Is an install:true static library to trigger certain codepath (promotion to link_whole) +# - Does fortran code 'generation' with configure_file +# - Uses .F90 ext (capital F typically denotes a dependence on preprocessor treatment, which however is not used) +project('try-static-subproject-dependency', 'fortran') + +static_dep = dependency('static_hello', fallback: ['static_hello', 'static_hello_dep']) + +mainsrc = 'main_lib.f90' +mainsrc = configure_file( + copy: true, + input: mainsrc, + output: 'main_lib_output.F90' +) +main_lib = library('mainstatic', mainsrc, dependencies: static_dep, install: true) +main_dep = declare_dependency(link_with: main_lib) + +main_exe = executable('main_exe', 'main.f90', dependencies: main_dep) +test('static_subproject_test', main_exe) diff --git a/test cases/fortran/21 install static/subprojects/static_hello/meson.build b/test cases/fortran/21 install static/subprojects/static_hello/meson.build new file mode 100644 index 0000000..5e13bae --- /dev/null +++ b/test cases/fortran/21 install static/subprojects/static_hello/meson.build @@ -0,0 +1,12 @@ +project('static-hello', 'fortran') + +# staticlibsource = 'static_hello.f90' +staticlibsource = configure_file( + copy: true, + input: 'static_hello.f90', + output: 'static_hello_output.F90' +) + +static_hello_lib = static_library('static_hello', staticlibsource, install: false) + +static_hello_dep = declare_dependency(link_with: static_hello_lib) diff --git a/test cases/fortran/21 install static/subprojects/static_hello/static_hello.f90 b/test cases/fortran/21 install static/subprojects/static_hello/static_hello.f90 new file mode 100644 index 0000000..5407560 --- /dev/null +++ b/test cases/fortran/21 install static/subprojects/static_hello/static_hello.f90 @@ -0,0 +1,17 @@ +module static_hello +implicit none + +private +public :: static_say_hello + +interface static_say_hello + module procedure say_hello +end interface static_say_hello + +contains + +subroutine say_hello + print *, "Static library called." +end subroutine say_hello + +end module static_hello diff --git a/test cases/fortran/21 install static/test.json b/test cases/fortran/21 install static/test.json new file mode 100644 index 0000000..aff7147 --- /dev/null +++ b/test cases/fortran/21 install static/test.json @@ -0,0 +1,10 @@ +{ + "installed": [ + {"file": "usr/lib/libmainstatic.a", "type": "file"} + ], + "matrix": { + "options": { + "default_library": [ { "val": "static" } ] + } + } +} diff --git a/test cases/fortran/3 module procedure/meson.build b/test cases/fortran/3 module procedure/meson.build new file mode 100644 index 0000000..a590015 --- /dev/null +++ b/test cases/fortran/3 module procedure/meson.build @@ -0,0 +1,5 @@ +project('Fortran 2003 use statement, in same file', 'fortran', + meson_version: '>= 0.50.0') + +e = executable('use_syntax', 'use_syntax.f90') +test('Fortran 2003 use syntax', e) diff --git a/test cases/fortran/3 module procedure/use_syntax.f90 b/test cases/fortran/3 module procedure/use_syntax.f90 new file mode 100644 index 0000000..2f3a9e6 --- /dev/null +++ b/test cases/fortran/3 module procedure/use_syntax.f90 @@ -0,0 +1,31 @@ +module circle +implicit none + +integer :: x +real :: radius + +interface default + module procedure timestwo +end interface + +contains + +elemental integer function timestwo(x) result(y) + integer, intent(in) :: x + y = 2*x +end function +end module circle + +program prog + +use, non_intrinsic :: circle, only: timestwo, x + +implicit none + +x = 3 + +if (timestwo(x) /= 6) error stop 'fortran module procedure problem' + +print *,'OK: Fortran module procedure' + +end program prog diff --git a/test cases/fortran/4 self dependency/meson.build b/test cases/fortran/4 self dependency/meson.build new file mode 100644 index 0000000..e791284 --- /dev/null +++ b/test cases/fortran/4 self dependency/meson.build @@ -0,0 +1,8 @@ +project('selfdep', 'fortran') + +e = executable('selfdep', 'selfdep.f90') +test('selfdep', e) + +library('selfmod', 'src/selfdep_mod.f90') + +subproject('sub1') diff --git a/test cases/fortran/4 self dependency/selfdep.f90 b/test cases/fortran/4 self dependency/selfdep.f90 new file mode 100644 index 0000000..1a71353 --- /dev/null +++ b/test cases/fortran/4 self dependency/selfdep.f90 @@ -0,0 +1,18 @@ +MODULE geom + +type :: circle + REAL :: Pi = 4.*atan(1.) + REAL :: radius +end type circle +END MODULE geom + +PROGRAM prog + +use geom, only : circle +IMPLICIT NONE + +type(circle) :: ell + +ell%radius = 3. + +END PROGRAM prog diff --git a/test cases/fortran/4 self dependency/src/selfdep_mod.f90 b/test cases/fortran/4 self dependency/src/selfdep_mod.f90 new file mode 100644 index 0000000..4aa0057 --- /dev/null +++ b/test cases/fortran/4 self dependency/src/selfdep_mod.f90 @@ -0,0 +1,6 @@ +module a +end module a + +module b +use a +end module b diff --git a/test cases/fortran/4 self dependency/subprojects/sub1/main.f90 b/test cases/fortran/4 self dependency/subprojects/sub1/main.f90 new file mode 100644 index 0000000..873427d --- /dev/null +++ b/test cases/fortran/4 self dependency/subprojects/sub1/main.f90 @@ -0,0 +1,6 @@ +module a +end + +program b + use a +end diff --git a/test cases/fortran/4 self dependency/subprojects/sub1/meson.build b/test cases/fortran/4 self dependency/subprojects/sub1/meson.build new file mode 100644 index 0000000..606f338 --- /dev/null +++ b/test cases/fortran/4 self dependency/subprojects/sub1/meson.build @@ -0,0 +1,3 @@ +project('subproject self-def', 'fortran') + +library('subself', 'main.f90') diff --git a/test cases/fortran/5 static/main.f90 b/test cases/fortran/5 static/main.f90 new file mode 100644 index 0000000..4db2861 --- /dev/null +++ b/test cases/fortran/5 static/main.f90 @@ -0,0 +1,6 @@ +program main +use static_hello +implicit none + +call static_say_hello() +end program diff --git a/test cases/fortran/5 static/meson.build b/test cases/fortran/5 static/meson.build new file mode 100644 index 0000000..ab9d3c4 --- /dev/null +++ b/test cases/fortran/5 static/meson.build @@ -0,0 +1,6 @@ +project('try-static-library', 'fortran') + +static_hello = static_library('static_hello', 'static_hello.f90') + +exe = executable('test_exe', 'main.f90', link_with : static_hello) +test('static-fortran', exe) diff --git a/test cases/fortran/5 static/static_hello.f90 b/test cases/fortran/5 static/static_hello.f90 new file mode 100644 index 0000000..5407560 --- /dev/null +++ b/test cases/fortran/5 static/static_hello.f90 @@ -0,0 +1,17 @@ +module static_hello +implicit none + +private +public :: static_say_hello + +interface static_say_hello + module procedure say_hello +end interface static_say_hello + +contains + +subroutine say_hello + print *, "Static library called." +end subroutine say_hello + +end module static_hello diff --git a/test cases/fortran/6 dynamic/dynamic.f90 b/test cases/fortran/6 dynamic/dynamic.f90 new file mode 100644 index 0000000..6a1f359 --- /dev/null +++ b/test cases/fortran/6 dynamic/dynamic.f90 @@ -0,0 +1,17 @@ +module dynamic +implicit none + +private +public :: hello + +interface hello + module procedure say +end interface hello + +contains + +subroutine say + print *, "Hello from shared library." +end subroutine say + +end module dynamic diff --git a/test cases/fortran/6 dynamic/main.f90 b/test cases/fortran/6 dynamic/main.f90 new file mode 100644 index 0000000..ba2e2d2 --- /dev/null +++ b/test cases/fortran/6 dynamic/main.f90 @@ -0,0 +1,6 @@ +program main +use dynamic, only: hello +implicit none + +call hello() +end program diff --git a/test cases/fortran/6 dynamic/meson.build b/test cases/fortran/6 dynamic/meson.build new file mode 100644 index 0000000..413223b --- /dev/null +++ b/test cases/fortran/6 dynamic/meson.build @@ -0,0 +1,13 @@ +project('dynamic_fortran', 'fortran') + +fcid = meson.get_compiler('fortran').get_id() +if fcid == 'intel-cl' or (host_machine.system() == 'windows' and fcid == 'pgi') + error('MESON_SKIP_TEST: non-Gfortran Windows Fortran compilers do not do shared libraries in a Fortran standard way') + # !DEC$ ATTRIBUTES DLLEXPORT must be used! + # https://software.intel.com/en-us/node/535306 + # https://www.pgroup.com/resources/docs/19.4/x86/pgi-user-guide/index.htm#lib-dynlnk-bld-dll-fort +endif + +dynamic = shared_library('dynamic', 'dynamic.f90') +exe = executable('test_exe', 'main.f90', link_with : dynamic) +test('dynamic-fortran', exe) diff --git a/test cases/fortran/7 generated/meson.build b/test cases/fortran/7 generated/meson.build new file mode 100644 index 0000000..f021309 --- /dev/null +++ b/test cases/fortran/7 generated/meson.build @@ -0,0 +1,39 @@ +# Tests whether fortran sources files created during configuration are properly +# scanned for dependency information + +project('generated', 'fortran', + default_options : ['default_library=static']) + +conf_data = configuration_data() +conf_data.set('ONE', 1) +conf_data.set('TWO', 2) + +mod3_f = custom_target( + 'mod3.f', + input : 'mod3.f90', + output : 'mod3.f90', + # We need a platform agnostic way to do a copy a file, using a custom_target + # and we need to use the @OUTDIR@, not @OUTPUT@ in order to exercise + # https://github.com/mesonbuild/meson/issues/9258 + command : [ + find_program('python', 'python3'), '-c', + 'import sys, shutil; shutil.copy(sys.argv[1], sys.argv[2])', + '@INPUT@', '@OUTDIR@', + ], +) + +three = library('mod3', mod3_f) + +templates_basenames = ['mod2', 'mod1'] +generated_sources = [] +foreach template_basename : templates_basenames + infilename = '@0@.fpp'.format(template_basename) + outfilename = '@0@.f90'.format(template_basename) + outfile = configure_file( + input : infilename, output : outfilename, configuration : conf_data) + generated_sources += [outfile] +endforeach + +sources = ['prog.f90'] + generated_sources +exe = executable('generated', sources, link_with: three) +test('generated', exe) diff --git a/test cases/fortran/7 generated/mod1.fpp b/test cases/fortran/7 generated/mod1.fpp new file mode 100644 index 0000000..c4decf6 --- /dev/null +++ b/test cases/fortran/7 generated/mod1.fpp @@ -0,0 +1,6 @@ +module mod1 +implicit none + +integer, parameter :: modval1 = @ONE@ + +end module mod1 diff --git a/test cases/fortran/7 generated/mod2.fpp b/test cases/fortran/7 generated/mod2.fpp new file mode 100644 index 0000000..78ceae4 --- /dev/null +++ b/test cases/fortran/7 generated/mod2.fpp @@ -0,0 +1,7 @@ +module mod2 +use mod1, only : modval1 +implicit none + +integer, parameter :: modval2 = @TWO@ + +end module mod2 diff --git a/test cases/fortran/7 generated/mod3.f90 b/test cases/fortran/7 generated/mod3.f90 new file mode 100644 index 0000000..5e4b417 --- /dev/null +++ b/test cases/fortran/7 generated/mod3.f90 @@ -0,0 +1,6 @@ +module mod3 +implicit none + +integer, parameter :: modval3 = 3 + +end module mod3 diff --git a/test cases/fortran/7 generated/prog.f90 b/test cases/fortran/7 generated/prog.f90 new file mode 100644 index 0000000..6ee0bca --- /dev/null +++ b/test cases/fortran/7 generated/prog.f90 @@ -0,0 +1,8 @@ +program generated +use mod2, only : modval1, modval2 +use mod3, only : modval3 +implicit none + +if (modval1 + modval2 + modval3 /= 6) error stop + +end program generated diff --git a/test cases/fortran/8 module names/meson.build b/test cases/fortran/8 module names/meson.build new file mode 100644 index 0000000..632c597 --- /dev/null +++ b/test cases/fortran/8 module names/meson.build @@ -0,0 +1,6 @@ +project('mod_name_case', 'fortran') + +sources = ['test.f90', 'mod1.f90', 'mod2.f90'] + +exe = executable('mod_name_case', sources) +test('mod_name_case', exe) diff --git a/test cases/fortran/8 module names/mod1.f90 b/test cases/fortran/8 module names/mod1.f90 new file mode 100644 index 0000000..29cd9f4 --- /dev/null +++ b/test cases/fortran/8 module names/mod1.f90 @@ -0,0 +1,6 @@ +module MyMod1 +implicit none + +integer, parameter :: myModVal1 = 1 + +end module MyMod1 diff --git a/test cases/fortran/8 module names/mod2.f90 b/test cases/fortran/8 module names/mod2.f90 new file mode 100644 index 0000000..2087750 --- /dev/null +++ b/test cases/fortran/8 module names/mod2.f90 @@ -0,0 +1,6 @@ +module mymod2 +implicit none + +integer, parameter :: myModVal2 = 2 + +end module mymod2 diff --git a/test cases/fortran/8 module names/test.f90 b/test cases/fortran/8 module names/test.f90 new file mode 100644 index 0000000..60ff16e --- /dev/null +++ b/test cases/fortran/8 module names/test.f90 @@ -0,0 +1,9 @@ +program main +use mymod1 +use MyMod2 ! test inline comment + +implicit none + +integer, parameter :: testVar = myModVal1 + myModVal2 + +end program diff --git a/test cases/fortran/9 cpp/fortran.f b/test cases/fortran/9 cpp/fortran.f new file mode 100644 index 0000000..255872c --- /dev/null +++ b/test cases/fortran/9 cpp/fortran.f @@ -0,0 +1,11 @@ + function fortran() bind(C) + use, intrinsic :: iso_c_binding, only: dp=>c_double + implicit none + + real(dp) :: r, fortran + + call random_number(r) + + fortran = 2._dp**r + + end function fortran diff --git a/test cases/fortran/9 cpp/main.c b/test cases/fortran/9 cpp/main.c new file mode 100644 index 0000000..c1750ad --- /dev/null +++ b/test cases/fortran/9 cpp/main.c @@ -0,0 +1,8 @@ +#include + +double fortran(void); + +int main(void) { + printf("FORTRAN gave us this number: %lf.\n", fortran()); + return 0; +} diff --git a/test cases/fortran/9 cpp/main.cpp b/test cases/fortran/9 cpp/main.cpp new file mode 100644 index 0000000..534a23a --- /dev/null +++ b/test cases/fortran/9 cpp/main.cpp @@ -0,0 +1,8 @@ +#include + +extern "C" double fortran(); + +int main(void) { + std::cout << "FORTRAN gave us this number: " << fortran() << '\n'; + return 0; +} diff --git a/test cases/fortran/9 cpp/meson.build b/test cases/fortran/9 cpp/meson.build new file mode 100644 index 0000000..2afa864 --- /dev/null +++ b/test cases/fortran/9 cpp/meson.build @@ -0,0 +1,29 @@ +project('C, C++ and Fortran', 'c', 'cpp', 'fortran') + +cpp = meson.get_compiler('cpp') +fc = meson.get_compiler('fortran') + +if build_machine.system() == 'windows' and fc.get_id() == 'gcc' and cpp.get_id() != 'gcc' + error('MESON_SKIP_TEST mixing gfortran with non-GNU C++ does not work.') +endif + +link_with = [] +if fc.get_id() == 'intel' + link_with += fc.find_library('ifport') +endif + +e = executable( + 'cfort', + ['main.c', 'fortran.f'], + dependencies : link_with, +) + +test('C and Fortran', e) + +e2 = executable( + 'cppfort', + ['main.cpp', 'fortran.f'], + dependencies : link_with, +) + +test('C++ and Fortran', e2) diff --git a/test cases/fpga/1 simple/meson.build b/test cases/fpga/1 simple/meson.build new file mode 100644 index 0000000..536244e --- /dev/null +++ b/test cases/fpga/1 simple/meson.build @@ -0,0 +1,8 @@ +project('lattice', 'c') + +is = import('unstable-icestorm') + +is.project('spin', + 'spin.v', + constraint_file : 'spin.pcf', +) diff --git a/test cases/fpga/1 simple/spin.pcf b/test cases/fpga/1 simple/spin.pcf new file mode 100644 index 0000000..de06f5d --- /dev/null +++ b/test cases/fpga/1 simple/spin.pcf @@ -0,0 +1,6 @@ +set_io LED1 99 +set_io LED2 98 +set_io LED3 97 +set_io LED4 96 +set_io LED5 95 +set_io clk 21 diff --git a/test cases/fpga/1 simple/spin.v b/test cases/fpga/1 simple/spin.v new file mode 100644 index 0000000..2143d30 --- /dev/null +++ b/test cases/fpga/1 simple/spin.v @@ -0,0 +1,32 @@ + +module top(input clk, output LED1, output LED2, output LED3, output LED4, output LED5); + + reg ready = 0; + reg [23:0] divider; + reg [3:0] spin; + + always @(posedge clk) begin + if (ready) + begin + if (divider == 6000000) + begin + divider <= 0; + spin <= {spin[2], spin[3], spin[0], spin[1]}; + end + else + divider <= divider + 1; + end + else + begin + ready <= 1; + spin <= 4'b1010; + divider <= 0; + end + end + + assign LED1 = spin[0]; + assign LED2 = spin[1]; + assign LED3 = spin[2]; + assign LED4 = spin[3]; + assign LED5 = 1; +endmodule diff --git a/test cases/frameworks/1 boost/extralib.cpp b/test cases/frameworks/1 boost/extralib.cpp new file mode 100644 index 0000000..e5ab1b0 --- /dev/null +++ b/test cases/frameworks/1 boost/extralib.cpp @@ -0,0 +1,27 @@ +#define _XOPEN_SOURCE 500 + +#include +#include +#include +#include +#include + +using namespace std; +namespace logging = boost::log; + +void InitLogger() { + logging::add_common_attributes(); + logging::register_simple_formatter_factory("Severity"); + string log_format = "%TimeStamp% [%Severity%] - %Message%"; + + logging::add_console_log( + cout, + logging::keywords::format = log_format + ); +} + +int main(int argc, char **argv) { + InitLogger(); + BOOST_LOG_TRIVIAL(trace) << "SOMETHING"; + return 0; +} diff --git a/test cases/frameworks/1 boost/linkexe.cc b/test cases/frameworks/1 boost/linkexe.cc new file mode 100644 index 0000000..e00edee --- /dev/null +++ b/test cases/frameworks/1 boost/linkexe.cc @@ -0,0 +1,18 @@ +#define _XOPEN_SOURCE 500 + +#include + +boost::recursive_mutex m; + +struct callable { + void operator()() { + boost::recursive_mutex::scoped_lock l(m); + }; +}; + +int main(int argc, char **argv) { + callable x; + boost::thread thr(x); + thr.join(); + return 0; +} diff --git a/test cases/frameworks/1 boost/meson.build b/test cases/frameworks/1 boost/meson.build new file mode 100644 index 0000000..821bb62 --- /dev/null +++ b/test cases/frameworks/1 boost/meson.build @@ -0,0 +1,74 @@ +# this test requires the following on Ubuntu: libboost-{system,python,log,thread,test}-dev +project('boosttest', 'cpp', + default_options : ['cpp_std=c++14']) + +s = get_option('static') + +dep = dependency('boost', static: s, required: false) +if not dep.found() + error('MESON_SKIP_TEST boost not found.') +endif + +# We want to have multiple separate configurations of Boost +# within one project. The need to be independent of each other. +# Use one without a library dependency and one with it. + +linkdep = dependency('boost', static: s, modules : ['thread', 'system', 'date_time']) +testdep = dependency('boost', static: s, modules : ['unit_test_framework']) +nomoddep = dependency('boost', static: s) +extralibdep = dependency('boost', static: s, modules : ['thread', 'system', 'date_time', 'log_setup', 'log', 'filesystem', 'regex']) +notfound = dependency('boost', static: s, modules : ['this_should_not_exist_on_any_systen'], required: false) + +assert(not notfound.found()) + +require_bp = host_machine.system() in ['linux', 'darwin'] +pymod = import('python') +python2 = pymod.find_installation('python2', required: false , disabler: true) +python3 = pymod.find_installation('python3', required: require_bp , disabler: true) +python2dep = python2.dependency(required: false , embed: true, disabler: true) +python3dep = python3.dependency(required: require_bp, embed: true, disabler: true) + +# compile python 2/3 modules only if we found a corresponding python version +if(python2dep.found() and require_bp and not s) + bpython2dep = dependency('boost', static: s, modules : ['python'], required: false, disabler: true) +else + python2dep = disabler() + bpython2dep = disabler() +endif + +if(python3dep.found() and require_bp and not s) + bpython3dep = dependency('boost', static: s, modules : ['python3']) +else + python3dep = disabler() + bpython3dep = disabler() +endif + +linkexe = executable('linkedexe', 'linkexe.cc', dependencies : linkdep) +unitexe = executable('utf', 'unit_test.cpp', dependencies: testdep) +nomodexe = executable('nomod', 'nomod.cpp', dependencies : nomoddep) +extralibexe = executable('extralibexe', 'extralib.cpp', dependencies : extralibdep) + +# python modules are shared libraries +python2module = python2.extension_module('python2_module', ['python_module.cpp'], dependencies: [python2dep, bpython2dep], cpp_args: ['-DMOD_NAME=python2_module']) +python3module = python3.extension_module('python3_module', ['python_module.cpp'], dependencies: [python3dep, bpython3dep], cpp_args: ['-DMOD_NAME=python3_module']) + + +test('Boost linktest', linkexe, timeout: 60) +test('Boost UTF test', unitexe, timeout: 60) +test('Boost nomod', nomodexe) +if host_machine.system() != 'darwin' or s + # Segfaults on macOS with dynamic linking since Boost 1.73 + # https://github.com/mesonbuild/meson/issues/7535 + test('Boost extralib test', extralibexe) +endif + +# explicitly use the correct python interpreter so that we don't have to provide two different python scripts that have different shebang lines +python2interpreter = find_program(python2.path(), required: false, disabler: true) +test('Boost Python2', python2interpreter, args: ['./test_python_module.py', meson.current_build_dir()], workdir: meson.current_source_dir(), depends: python2module) +python3interpreter = find_program(python3.path(), required: false, disabler: true) +test('Boost Python3', python3interpreter, args: ['./test_python_module.py', meson.current_build_dir()], workdir: meson.current_source_dir(), depends: python3module) + +subdir('partial_dep') + +# check we can apply a version constraint +dependency('boost', static: s, version: '>=@0@'.format(dep.version())) diff --git a/test cases/frameworks/1 boost/meson_options.txt b/test cases/frameworks/1 boost/meson_options.txt new file mode 100644 index 0000000..019feaf --- /dev/null +++ b/test cases/frameworks/1 boost/meson_options.txt @@ -0,0 +1 @@ +option('static', type: 'boolean', value: false) diff --git a/test cases/frameworks/1 boost/nomod.cpp b/test cases/frameworks/1 boost/nomod.cpp new file mode 100644 index 0000000..55c95b2 --- /dev/null +++ b/test cases/frameworks/1 boost/nomod.cpp @@ -0,0 +1,18 @@ +#include +#include + +boost::any get_any() { + boost::any foobar = 3; + return foobar; +} + +int main(int argc, char **argv) { + boost::any result = get_any(); + if(boost::any_cast(result) == 3) { + std::cout << "Everything is fine in the world.\n"; + return 0; + } else { + std::cout << "Mathematics stopped working.\n"; + return 1; + } +} diff --git a/test cases/frameworks/1 boost/partial_dep/foo.cpp b/test cases/frameworks/1 boost/partial_dep/foo.cpp new file mode 100644 index 0000000..da58703 --- /dev/null +++ b/test cases/frameworks/1 boost/partial_dep/foo.cpp @@ -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.hpp" + +vec Foo::vector() { + return myvec; +} diff --git a/test cases/frameworks/1 boost/partial_dep/foo.hpp b/test cases/frameworks/1 boost/partial_dep/foo.hpp new file mode 100644 index 0000000..393d3f6 --- /dev/null +++ b/test cases/frameworks/1 boost/partial_dep/foo.hpp @@ -0,0 +1,27 @@ +/* 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 + +typedef boost::fusion::vector vec; + + +class Foo { + public: + Foo() {}; + vec vector(); + private: + const vec myvec = vec(4); +}; diff --git a/test cases/frameworks/1 boost/partial_dep/main.cpp b/test cases/frameworks/1 boost/partial_dep/main.cpp new file mode 100644 index 0000000..b22ce3a --- /dev/null +++ b/test cases/frameworks/1 boost/partial_dep/main.cpp @@ -0,0 +1,27 @@ +/* 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 +#include +#include "foo.hpp" + + +int main(void) { + auto foo = Foo(); + vec v = foo.vector(); + std::cout << boost::fusion::at_c<0>(v) << std::endl; + + return 0; +} diff --git a/test cases/frameworks/1 boost/partial_dep/meson.build b/test cases/frameworks/1 boost/partial_dep/meson.build new file mode 100644 index 0000000..9d481bb --- /dev/null +++ b/test cases/frameworks/1 boost/partial_dep/meson.build @@ -0,0 +1,31 @@ +# 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. + +dep_boost = dependency('boost') +dep_boost_headers = dep_boost.partial_dependency(compile_args : true) + +libfoo = static_library( + 'foo', + 'foo.cpp', + dependencies : dep_boost_headers, +) + +exe_external_dep = executable( + 'external_dep', + 'main.cpp', + dependencies : dep_boost, + link_with : libfoo +) + +test('External Dependency', exe_external_dep) diff --git a/test cases/frameworks/1 boost/python_module.cpp b/test cases/frameworks/1 boost/python_module.cpp new file mode 100644 index 0000000..a0f010b --- /dev/null +++ b/test cases/frameworks/1 boost/python_module.cpp @@ -0,0 +1,22 @@ +#define PY_SSIZE_T_CLEAN +#include +#include + +struct World +{ + void set(std::string msg) { this->msg = msg; } + std::string greet() { return msg; } + std::string version() { return std::to_string(PY_MAJOR_VERSION) + "." + std::to_string(PY_MINOR_VERSION); } + std::string msg; +}; + + +BOOST_PYTHON_MODULE(MOD_NAME) +{ + using namespace boost::python; + class_("World") + .def("greet", &World::greet) + .def("set", &World::set) + .def("version", &World::version) + ; +} diff --git a/test cases/frameworks/1 boost/test.json b/test cases/frameworks/1 boost/test.json new file mode 100644 index 0000000..2c5b857 --- /dev/null +++ b/test cases/frameworks/1 boost/test.json @@ -0,0 +1,22 @@ +{ + "matrix": { + "options": { + "static": [ + { "val": "true", "skip_on_env": [ "SKIP_STATIC_BOOST" ] }, + { "val": "false" } + ], + "b_vscrt": [ + { "val": null }, + { "val": "md", "compilers": { "cpp": "msvc" } }, + { "val": "mdd", "compilers": { "cpp": "msvc" } }, + { "val": "mt", "compilers": { "cpp": "msvc" } }, + { "val": "mtd", "compilers": { "cpp": "msvc" } } + ] + }, + "exclude": [ + { "static": "false", "b_vscrt": "mt" }, + { "static": "false", "b_vscrt": "mtd" } + ] + }, + "skip_on_jobname": ["azure", "msys2"] +} diff --git a/test cases/frameworks/1 boost/test_python_module.py b/test cases/frameworks/1 boost/test_python_module.py new file mode 100644 index 0000000..8ef96d2 --- /dev/null +++ b/test cases/frameworks/1 boost/test_python_module.py @@ -0,0 +1,27 @@ +import sys +sys.path.append(sys.argv[1]) + +# import compiled python module depending on version of python we are running with +if sys.version_info[0] == 2: + import python2_module + +if sys.version_info[0] == 3: + import python3_module + + +def run(): + msg = 'howdy' + if sys.version_info[0] == 2: + w = python2_module.World() + + if sys.version_info[0] == 3: + w = python3_module.World() + + w.set(msg) + + assert msg == w.greet() + version_string = str(sys.version_info[0]) + "." + str(sys.version_info[1]) + assert version_string == w.version() + +if __name__ == '__main__': + run() diff --git a/test cases/frameworks/1 boost/unit_test.cpp b/test cases/frameworks/1 boost/unit_test.cpp new file mode 100644 index 0000000..fa1fbaa --- /dev/null +++ b/test cases/frameworks/1 boost/unit_test.cpp @@ -0,0 +1,9 @@ +#define BOOST_TEST_MODULE "MesonTest" +#define BOOST_TEST_MAIN +#include + +BOOST_AUTO_TEST_CASE(m_test) { + int x = 2+2; + BOOST_CHECK(true); + BOOST_CHECK_EQUAL(x, 4); +} diff --git a/test cases/frameworks/10 gtk-doc/doc/foobar-docs.sgml b/test cases/frameworks/10 gtk-doc/doc/foobar-docs.sgml new file mode 100644 index 0000000..3894317 --- /dev/null +++ b/test cases/frameworks/10 gtk-doc/doc/foobar-docs.sgml @@ -0,0 +1,41 @@ + + +]> + + + Foolib Reference Manual + + for Foobar &version; + + + + Jonny + Example + +
+ unknown@example.com +
+
+
+
+ + 2015 + Foobar corporation holdings ltd + +
+ + + Foobar library + + + This part documents Foobar libs. + + + + + + + +
diff --git a/test cases/frameworks/10 gtk-doc/doc/foobar1/baz.jpg b/test cases/frameworks/10 gtk-doc/doc/foobar1/baz.jpg new file mode 100644 index 0000000..e69de29 diff --git a/test cases/frameworks/10 gtk-doc/doc/foobar1/baz.png.in b/test cases/frameworks/10 gtk-doc/doc/foobar1/baz.png.in new file mode 100644 index 0000000..e69de29 diff --git a/test cases/frameworks/10 gtk-doc/doc/foobar1/foobar-docs.sgml b/test cases/frameworks/10 gtk-doc/doc/foobar1/foobar-docs.sgml new file mode 100644 index 0000000..6ccd087 --- /dev/null +++ b/test cases/frameworks/10 gtk-doc/doc/foobar1/foobar-docs.sgml @@ -0,0 +1,41 @@ + + +]> + + + Foolib Reference Manual + + for Foobar &version; + + + + Jonny + Example + +
+ unknown@example.com +
+
+
+
+ + 2015 + Foobar corporation holdings ltd + +
+ + + Foobar library + + + This part documents Foobar libs. + + + + + + + +
diff --git a/test cases/frameworks/10 gtk-doc/doc/foobar1/foobar-sections.txt b/test cases/frameworks/10 gtk-doc/doc/foobar1/foobar-sections.txt new file mode 100644 index 0000000..e9ca2d6 --- /dev/null +++ b/test cases/frameworks/10 gtk-doc/doc/foobar1/foobar-sections.txt @@ -0,0 +1,15 @@ +
+foo +FooObj +FooObj +FooObjClass +foo_do_something +
+ +
+version +version +FOO_MAJOR_VERSION +FOO_MINOR_VERSION +FOO_MICRO_VERSION +
diff --git a/test cases/frameworks/10 gtk-doc/doc/foobar1/foobar.types b/test cases/frameworks/10 gtk-doc/doc/foobar1/foobar.types new file mode 100644 index 0000000..0a9c046 --- /dev/null +++ b/test cases/frameworks/10 gtk-doc/doc/foobar1/foobar.types @@ -0,0 +1,4 @@ +% This include is useless it's a regression test for https://github.com/mesonbuild/meson/issues/8744 +#include + +foo_obj_get_type diff --git a/test cases/frameworks/10 gtk-doc/doc/foobar1/meson.build b/test cases/frameworks/10 gtk-doc/doc/foobar1/meson.build new file mode 100644 index 0000000..2af9670 --- /dev/null +++ b/test cases/frameworks/10 gtk-doc/doc/foobar1/meson.build @@ -0,0 +1,15 @@ +png = configure_file(input: 'baz.png.in', + output: 'baz.png', + copy: true) + +gnome.gtkdoc('foobar', + src_dir : [inc, '.'], + main_sgml : 'foobar-docs.sgml', + content_files : [docbook, version_xml], + dependencies: foo_dep, + html_assets: ['baz.jpg', png], + # Manually written types file for regression test: + # https://github.com/mesonbuild/meson/issues/8744 + gobject_typesfile: 'foobar.types', + install : true, + check: false) diff --git a/test cases/frameworks/10 gtk-doc/doc/foobar2/foobar-docs.sgml b/test cases/frameworks/10 gtk-doc/doc/foobar2/foobar-docs.sgml new file mode 100644 index 0000000..95f73ef --- /dev/null +++ b/test cases/frameworks/10 gtk-doc/doc/foobar2/foobar-docs.sgml @@ -0,0 +1,41 @@ + + +]> + + + Foolib Reference Manual + + for Foobar &version; + + + + Jonny + Example + +
+ unknown@example.com +
+
+
+
+ + 2015 + Foobar corporation holdings ltd + +
+ + + Foobar library + + + This part documents Foobar libs. + + + + + + + +
diff --git a/test cases/frameworks/10 gtk-doc/doc/foobar2/meson.build b/test cases/frameworks/10 gtk-doc/doc/foobar2/meson.build new file mode 100644 index 0000000..5f860ef --- /dev/null +++ b/test cases/frameworks/10 gtk-doc/doc/foobar2/meson.build @@ -0,0 +1,13 @@ +types = configure_file(input: '../foobar1/foobar.types', + output: 'foobar.types', + copy: true +) + +gnome.gtkdoc('foobar2', + src_dir : inc, + main_sgml : 'foobar-docs.sgml', + content_files : [docbook, version_xml], + gobject_typesfile: types, + dependencies: foo_dep, + install : true, + install_dir : 'foobar2') diff --git a/test cases/frameworks/10 gtk-doc/doc/foobar3/foobar-docs.sgml b/test cases/frameworks/10 gtk-doc/doc/foobar3/foobar-docs.sgml new file mode 100644 index 0000000..95f73ef --- /dev/null +++ b/test cases/frameworks/10 gtk-doc/doc/foobar3/foobar-docs.sgml @@ -0,0 +1,41 @@ + + +]> + + + Foolib Reference Manual + + for Foobar &version; + + + + Jonny + Example + +
+ unknown@example.com +
+
+
+
+ + 2015 + Foobar corporation holdings ltd + +
+ + + Foobar library + + + This part documents Foobar libs. + + + + + + + +
diff --git a/test cases/frameworks/10 gtk-doc/doc/foobar3/meson.build b/test cases/frameworks/10 gtk-doc/doc/foobar3/meson.build new file mode 100644 index 0000000..0dce2f8 --- /dev/null +++ b/test cases/frameworks/10 gtk-doc/doc/foobar3/meson.build @@ -0,0 +1,6 @@ +gnome.gtkdoc('foobar', + module_version : '3.0', + src_dir : inc, + main_sgml : 'foobar-docs.sgml', + content_files : [docbook, version_xml], + install : true) diff --git a/test cases/frameworks/10 gtk-doc/doc/foobar4/foobar-docs.sgml b/test cases/frameworks/10 gtk-doc/doc/foobar4/foobar-docs.sgml new file mode 100644 index 0000000..95f73ef --- /dev/null +++ b/test cases/frameworks/10 gtk-doc/doc/foobar4/foobar-docs.sgml @@ -0,0 +1,41 @@ + + +]> + + + Foolib Reference Manual + + for Foobar &version; + + + + Jonny + Example + +
+ unknown@example.com +
+
+
+
+ + 2015 + Foobar corporation holdings ltd + +
+ + + Foobar library + + + This part documents Foobar libs. + + + + + + + +
diff --git a/test cases/frameworks/10 gtk-doc/doc/foobar4/meson.build b/test cases/frameworks/10 gtk-doc/doc/foobar4/meson.build new file mode 100644 index 0000000..959e507 --- /dev/null +++ b/test cases/frameworks/10 gtk-doc/doc/foobar4/meson.build @@ -0,0 +1,7 @@ +gnome.gtkdoc('foobar2', + module_version : '3.0', + src_dir : inc, + main_sgml : 'foobar-docs.sgml', + content_files : [docbook, version_xml], + install : true, + install_dir : 'foobar3') diff --git a/test cases/frameworks/10 gtk-doc/doc/meson.build b/test cases/frameworks/10 gtk-doc/doc/meson.build new file mode 100644 index 0000000..c001f89 --- /dev/null +++ b/test cases/frameworks/10 gtk-doc/doc/meson.build @@ -0,0 +1,10 @@ +cdata = configuration_data() +cdata.set('VERSION', '1.0') +version_xml = configure_file(input : 'version.xml.in', + output : 'version.xml', + configuration : cdata) + +subdir('foobar1') +subdir('foobar2') +subdir('foobar3') +subdir('foobar4') diff --git a/test cases/frameworks/10 gtk-doc/doc/version.xml.in b/test cases/frameworks/10 gtk-doc/doc/version.xml.in new file mode 100644 index 0000000..d78bda9 --- /dev/null +++ b/test cases/frameworks/10 gtk-doc/doc/version.xml.in @@ -0,0 +1 @@ +@VERSION@ diff --git a/test cases/frameworks/10 gtk-doc/foo.c b/test cases/frameworks/10 gtk-doc/foo.c new file mode 100644 index 0000000..36c0639 --- /dev/null +++ b/test cases/frameworks/10 gtk-doc/foo.c @@ -0,0 +1,30 @@ +#include + + +struct _FooObj { + GObject parent; + int dummy; +}; + +G_DEFINE_TYPE(FooObj, foo_obj, G_TYPE_OBJECT) + +static void foo_obj_init (FooObj *self) +{ +} + +static void foo_obj_class_init (FooObjClass *klass) +{ +} + +/** + * foo_do_something: + * @self: self + * + * Useless function. + * + * Returns: 0. + */ +int foo_do_something(FooObj *self) +{ + return 0; +} diff --git a/test cases/frameworks/10 gtk-doc/include/foo-version.h.in b/test cases/frameworks/10 gtk-doc/include/foo-version.h.in new file mode 100644 index 0000000..30751cd --- /dev/null +++ b/test cases/frameworks/10 gtk-doc/include/foo-version.h.in @@ -0,0 +1,29 @@ +#pragma once + +/** + * SECTION:version + * @section_id: foo-version + * @short_description: foo-version.h + * @title: Foo Versioning + */ + +/** + * FOO_MAJOR_VERSION: + * + * The major version of foo. + */ +#define FOO_MAJOR_VERSION (@FOO_MAJOR_VERSION@) + +/** + * FOO_MINOR_VERSION: + * + * The minor version of foo. + */ +#define FOO_MINOR_VERSION (@FOO_MINOR_VERSION@) + +/** + * FOO_MICRO_VERSION: + * + * The micro version of foo. + */ +#define FOO_MICRO_VERSION (@FOO_MICRO_VERSION@) diff --git a/test cases/frameworks/10 gtk-doc/include/foo.h b/test cases/frameworks/10 gtk-doc/include/foo.h new file mode 100644 index 0000000..510f3d1 --- /dev/null +++ b/test cases/frameworks/10 gtk-doc/include/foo.h @@ -0,0 +1,33 @@ +#pragma once + +#include + +/** + * FooIndecision: + * @FOO_MAYBE: Something maybe + * @FOO_POSSIBLY: Something possible + * + * The indecision type. + **/ + +typedef enum { + FOO_MAYBE, + FOO_POSSIBLY, +} FooIndecision; + +/** + * FooObjClass: + * + * The class + */ + +/** + * FooObj: + * + * The instance + */ + +#define FOO_TYPE_OBJ foo_obj_get_type() +G_DECLARE_FINAL_TYPE(FooObj, foo_obj, FOO, OBJ, GObject) + +int foo_do_something(FooObj *self); diff --git a/test cases/frameworks/10 gtk-doc/include/generate-enums-docbook.py b/test cases/frameworks/10 gtk-doc/include/generate-enums-docbook.py new file mode 100644 index 0000000..41c6121 --- /dev/null +++ b/test cases/frameworks/10 gtk-doc/include/generate-enums-docbook.py @@ -0,0 +1,63 @@ +#!/usr/bin/env python3 + +import sys + +DOC_HEADER = ''' + + + + + + {0} + {0} + + + {0} + + + + + enum {1} + + {1} + + {1} + + Values + + + + + + +''' + +DOC_ENUM = ''' + {0} + = {1} + + ''' + +DOC_FOOTER = ''' + + + + + + +''' + +if __name__ == '__main__': + if len(sys.argv) >= 4: + with open(sys.argv[1], 'w') as doc_out: + enum_name = sys.argv[2] + enum_type = sys.argv[3] + + doc_out.write(DOC_HEADER.format(enum_name, enum_type)) + for i, enum in enumerate(sys.argv[4:]): + doc_out.write(DOC_ENUM.format(enum, i)) + doc_out.write(DOC_FOOTER) + else: + print('Use: ' + sys.argv[0] + ' out name type [enums]') + + sys.exit(0) diff --git a/test cases/frameworks/10 gtk-doc/include/meson.build b/test cases/frameworks/10 gtk-doc/include/meson.build new file mode 100644 index 0000000..aa32885 --- /dev/null +++ b/test cases/frameworks/10 gtk-doc/include/meson.build @@ -0,0 +1,17 @@ +cdata = configuration_data() +parts = meson.project_version().split('.') +cdata.set('FOO_MAJOR_VERSION', parts[0]) +cdata.set('FOO_MINOR_VERSION', parts[1]) +cdata.set('FOO_MICRO_VERSION', parts[2]) +configure_file(input : 'foo-version.h.in', + output : 'foo-version.h', + configuration : cdata, + install : true, + install_dir : get_option('includedir')) + +generate_enums_docbook = find_program('generate-enums-docbook.py') + +docbook = custom_target('enum-docbook', + output : 'bar.xml', + command : [generate_enums_docbook, '@OUTPUT@', 'BAR', 'BAR_TYPE', 'BAR_FOO'], + build_by_default : true) diff --git a/test cases/frameworks/10 gtk-doc/meson.build b/test cases/frameworks/10 gtk-doc/meson.build new file mode 100644 index 0000000..b49efc0 --- /dev/null +++ b/test cases/frameworks/10 gtk-doc/meson.build @@ -0,0 +1,45 @@ +project('gtkdoctest', 'c', version : '1.0.0') + +gtkdoc = find_program('gtkdoc-scan', required: false) +if not gtkdoc.found() + error('MESON_SKIP_TEST gtkdoc not found.') +endif + +gnome = import('gnome') + +assert(gnome.gtkdoc_html_dir('foobar') == 'share/gtk-doc/html/foobar', 'Gtkdoc install dir is incorrect.') + +inc = include_directories('include') + +subdir('include') + +# disable this test unless a bug fix for spaces in pathnames is present +# https://bugzilla.gnome.org/show_bug.cgi?id=753145 +result = run_command(gtkdoc, ['--version'], check: true) +gtkdoc_ver = result.stdout().strip() +if gtkdoc_ver == '' + gtkdoc_ver = result.stderr().strip() +endif +if gtkdoc_ver.version_compare('<1.26') + error('MESON_SKIP_TEST gtk-doc test requires gtkdoc >= 1.26.') +endif + +gobject = dependency('gobject-2.0') + +libfoo = shared_library('foo', 'foo.c', + include_directories: inc, + dependencies: gobject, +) + +deps = [] +if host_machine.system() == 'darwin' + deps += dependency('appleframeworks', modules : ['Foundation', 'CoreFoundation']) +endif + +foo_dep = declare_dependency( + link_with: libfoo, + include_directories: inc, + dependencies: deps, +) + +subdir('doc') diff --git a/test cases/frameworks/10 gtk-doc/test.json b/test cases/frameworks/10 gtk-doc/test.json new file mode 100644 index 0000000..1085b55 --- /dev/null +++ b/test cases/frameworks/10 gtk-doc/test.json @@ -0,0 +1,64 @@ +{ + "installed": [ + {"type": "file", "file": "usr/include/foo-version.h"}, + {"type": "file", "file": "usr/share/gtk-doc/html/foobar/BAR.html"}, + {"type": "file", "file": "usr/share/gtk-doc/html/foobar/baz.jpg"}, + {"type": "file", "file": "usr/share/gtk-doc/html/foobar/baz.png"}, + {"type": "file", "file": "usr/share/gtk-doc/html/foobar/foobar.devhelp2"}, + {"type": "file", "file": "usr/share/gtk-doc/html/foobar/foobar.html"}, + {"type": "file", "file": "usr/share/gtk-doc/html/foobar/FooObj.html"}, + {"type": "file", "file": "usr/share/gtk-doc/html/foobar/foo-version.html"}, + {"type": "file", "file": "usr/share/gtk-doc/html/foobar/home.png"}, + {"type": "file", "file": "usr/share/gtk-doc/html/foobar/index.html"}, + {"type": "file", "file": "usr/share/gtk-doc/html/foobar/left.png"}, + {"type": "file", "file": "usr/share/gtk-doc/html/foobar/left-insensitive.png"}, + {"type": "file", "file": "usr/share/gtk-doc/html/foobar/right.png"}, + {"type": "file", "file": "usr/share/gtk-doc/html/foobar/right-insensitive.png"}, + {"type": "file", "file": "usr/share/gtk-doc/html/foobar/style.css"}, + {"type": "file", "file": "usr/share/gtk-doc/html/foobar/up.png"}, + {"type": "file", "file": "usr/share/gtk-doc/html/foobar/up-insensitive.png"}, + {"type": "file", "file": "usr/share/gtk-doc/html/foobar2/BAR.html"}, + {"type": "file", "file": "usr/share/gtk-doc/html/foobar2/foobar2.devhelp2"}, + {"type": "file", "file": "usr/share/gtk-doc/html/foobar2/foobar.html"}, + {"type": "file", "file": "usr/share/gtk-doc/html/foobar2/foobar2-foo.html"}, + {"type": "file", "file": "usr/share/gtk-doc/html/foobar2/foobar2-foo-version.html"}, + {"type": "file", "file": "usr/share/gtk-doc/html/foobar2/home.png"}, + {"type": "file", "file": "usr/share/gtk-doc/html/foobar2/index.html"}, + {"type": "file", "file": "usr/share/gtk-doc/html/foobar2/left.png"}, + {"type": "file", "file": "usr/share/gtk-doc/html/foobar2/left-insensitive.png"}, + {"type": "file", "file": "usr/share/gtk-doc/html/foobar2/right.png"}, + {"type": "file", "file": "usr/share/gtk-doc/html/foobar2/right-insensitive.png"}, + {"type": "file", "file": "usr/share/gtk-doc/html/foobar2/style.css"}, + {"type": "file", "file": "usr/share/gtk-doc/html/foobar2/up.png"}, + {"type": "file", "file": "usr/share/gtk-doc/html/foobar2/up-insensitive.png"}, + {"type": "file", "file": "usr/share/gtk-doc/html/foobar-3.0/BAR.html"}, + {"type": "file", "file": "usr/share/gtk-doc/html/foobar-3.0/foobar-3.0.devhelp2"}, + {"type": "file", "file": "usr/share/gtk-doc/html/foobar-3.0/foobar.html"}, + {"type": "file", "file": "usr/share/gtk-doc/html/foobar-3.0/foobar-foo.html"}, + {"type": "file", "file": "usr/share/gtk-doc/html/foobar-3.0/foobar-foo-version.html"}, + {"type": "file", "file": "usr/share/gtk-doc/html/foobar-3.0/home.png"}, + {"type": "file", "file": "usr/share/gtk-doc/html/foobar-3.0/index.html"}, + {"type": "file", "file": "usr/share/gtk-doc/html/foobar-3.0/left.png"}, + {"type": "file", "file": "usr/share/gtk-doc/html/foobar-3.0/left-insensitive.png"}, + {"type": "file", "file": "usr/share/gtk-doc/html/foobar-3.0/right.png"}, + {"type": "file", "file": "usr/share/gtk-doc/html/foobar-3.0/right-insensitive.png"}, + {"type": "file", "file": "usr/share/gtk-doc/html/foobar-3.0/style.css"}, + {"type": "file", "file": "usr/share/gtk-doc/html/foobar-3.0/up.png"}, + {"type": "file", "file": "usr/share/gtk-doc/html/foobar-3.0/up-insensitive.png"}, + {"type": "file", "file": "usr/share/gtk-doc/html/foobar3/BAR.html"}, + {"type": "file", "file": "usr/share/gtk-doc/html/foobar3/foobar2-3.0.devhelp2"}, + {"type": "file", "file": "usr/share/gtk-doc/html/foobar3/foobar.html"}, + {"type": "file", "file": "usr/share/gtk-doc/html/foobar3/foobar2-foo.html"}, + {"type": "file", "file": "usr/share/gtk-doc/html/foobar3/foobar2-foo-version.html"}, + {"type": "file", "file": "usr/share/gtk-doc/html/foobar3/home.png"}, + {"type": "file", "file": "usr/share/gtk-doc/html/foobar3/index.html"}, + {"type": "file", "file": "usr/share/gtk-doc/html/foobar3/left.png"}, + {"type": "file", "file": "usr/share/gtk-doc/html/foobar3/left-insensitive.png"}, + {"type": "file", "file": "usr/share/gtk-doc/html/foobar3/right.png"}, + {"type": "file", "file": "usr/share/gtk-doc/html/foobar3/right-insensitive.png"}, + {"type": "file", "file": "usr/share/gtk-doc/html/foobar3/style.css"}, + {"type": "file", "file": "usr/share/gtk-doc/html/foobar3/up.png"}, + {"type": "file", "file": "usr/share/gtk-doc/html/foobar3/up-insensitive.png"} + ], + "skip_on_jobname": ["azure", "msys2"] +} diff --git a/test cases/frameworks/11 gir subproject/gir/meson-subsample.c b/test cases/frameworks/11 gir subproject/gir/meson-subsample.c new file mode 100644 index 0000000..2d58a10 --- /dev/null +++ b/test cases/frameworks/11 gir subproject/gir/meson-subsample.c @@ -0,0 +1,124 @@ +#include "meson-subsample.h" + +struct _MesonSubSample +{ + MesonSample parent_instance; + + gchar *msg; +}; + +G_DEFINE_TYPE (MesonSubSample, meson_sub_sample, MESON_TYPE_SAMPLE) + +enum { + PROP_0, + PROP_MSG, + LAST_PROP +}; + +static GParamSpec *gParamSpecs [LAST_PROP]; + +/** + * meson_sub_sample_new: + * @msg: The message to set. + * + * Allocates a new #MesonSubSample. + * + * Returns: (transfer full): a #MesonSubSample. + */ +MesonSubSample * +meson_sub_sample_new (const gchar *msg) +{ + g_return_val_if_fail (msg != NULL, NULL); + + return g_object_new (MESON_TYPE_SUB_SAMPLE, + "message", msg, + NULL); +} + +static void +meson_sub_sample_finalize (GObject *object) +{ + MesonSubSample *self = (MesonSubSample *)object; + + g_clear_pointer (&self->msg, g_free); + + G_OBJECT_CLASS (meson_sub_sample_parent_class)->finalize (object); +} + +static void +meson_sub_sample_get_property (GObject *object, + guint prop_id, + GValue *value, + GParamSpec *pspec) +{ + MesonSubSample *self = MESON_SUB_SAMPLE (object); + + switch (prop_id) + { + case PROP_MSG: + g_value_set_string (value, self->msg); + break; + default: + G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); + } +} + +static void +meson_sub_sample_set_property (GObject *object, + guint prop_id, + const GValue *value, + GParamSpec *pspec) +{ + MesonSubSample *self = MESON_SUB_SAMPLE (object); + + switch (prop_id) + { + case PROP_MSG: + self->msg = g_value_dup_string (value); + break; + default: + G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); + } +} + +static void +meson_sub_sample_class_init (MesonSubSampleClass *klass) +{ + GObjectClass *object_class = G_OBJECT_CLASS (klass); + + object_class->finalize = meson_sub_sample_finalize; + object_class->get_property = meson_sub_sample_get_property; + object_class->set_property = meson_sub_sample_set_property; + + gParamSpecs [PROP_MSG] = + g_param_spec_string ("message", + "Message", + "The message to print.", + NULL, + (G_PARAM_READWRITE | + G_PARAM_CONSTRUCT_ONLY | + G_PARAM_STATIC_STRINGS)); + + g_object_class_install_properties (object_class, LAST_PROP, gParamSpecs); +} + +static void +meson_sub_sample_init (MesonSubSample *self) +{ +} + +/** + * meson_sub_sample_print_message: + * @self: a #MesonSubSample. + * + * Prints the message. + * + * Returns: Nothing. + */ +void +meson_sub_sample_print_message (MesonSubSample *self) +{ + g_return_if_fail (MESON_IS_SUB_SAMPLE (self)); + + g_print ("Message: %s\n", self->msg); +} diff --git a/test cases/frameworks/11 gir subproject/gir/meson-subsample.h b/test cases/frameworks/11 gir subproject/gir/meson-subsample.h new file mode 100644 index 0000000..666d59f --- /dev/null +++ b/test cases/frameworks/11 gir subproject/gir/meson-subsample.h @@ -0,0 +1,21 @@ +#ifndef MESON_SUB_SAMPLE_H +#define MESON_SUB_SAMPLE_H + +#if !defined (MESON_TEST) +#error "MESON_TEST not defined." +#endif + +#include +#include + +G_BEGIN_DECLS + +#define MESON_TYPE_SUB_SAMPLE (meson_sub_sample_get_type()) + +G_DECLARE_FINAL_TYPE (MesonSubSample, meson_sub_sample, MESON, SUB_SAMPLE, MesonSample) + +MesonSubSample *meson_sub_sample_new (const gchar *msg); + +G_END_DECLS + +#endif /* MESON_SUB_SAMPLE_H */ diff --git a/test cases/frameworks/11 gir subproject/gir/meson.build b/test cases/frameworks/11 gir subproject/gir/meson.build new file mode 100644 index 0000000..fe40dc6 --- /dev/null +++ b/test cases/frameworks/11 gir subproject/gir/meson.build @@ -0,0 +1,40 @@ +libsources = ['meson-subsample.c', 'meson-subsample.h'] + +girsubproject = shared_library( + 'girsubproject', + sources : libsources, + dependencies : [gobj, meson_gir], + install : true +) + +girexe = executable( + 'girprog', + sources : 'prog.c', + dependencies : [gobj, meson_gir], + link_with : girsubproject +) + +gnome.generate_gir( + girsubproject, + sources : libsources, + dependencies : [gobj, meson_gir], + nsversion : '1.0', + namespace : 'MesonSub', + symbol_prefix : 'meson_sub_', + identifier_prefix : 'MesonSub', + includes : ['GObject-2.0', 'Meson-1.0'], + install : true +) + +message('TEST: ' + girsubproject.outdir()) + +envdata = environment() +envdata.append('GI_TYPELIB_PATH', girsubproject.outdir(), 'subprojects/mesongir', separator : ':') +envdata.append('LD_LIBRARY_PATH', girsubproject.outdir(), 'subprojects/mesongir') +if ['windows', 'cygwin'].contains(host_machine.system()) + envdata.append('PATH', girsubproject.outdir(), 'subprojects/mesongir') +endif + +test('gobject introspection/subproject/c', girexe) +test('gobject introspection/subproject/py', find_program('prog.py'), + env : envdata) diff --git a/test cases/frameworks/11 gir subproject/gir/prog.c b/test cases/frameworks/11 gir subproject/gir/prog.c new file mode 100644 index 0000000..f25c9d8 --- /dev/null +++ b/test cases/frameworks/11 gir subproject/gir/prog.c @@ -0,0 +1,12 @@ +#include "meson-subsample.h" + +gint +main (gint argc, + gchar *argv[]) +{ + MesonSample * i = (MesonSample*) meson_sub_sample_new ("Hello, sub/meson/c!"); + meson_sample_print_message (i); + g_object_unref (i); + + return 0; +} diff --git a/test cases/frameworks/11 gir subproject/gir/prog.py b/test cases/frameworks/11 gir subproject/gir/prog.py new file mode 100755 index 0000000..ea4da5b --- /dev/null +++ b/test cases/frameworks/11 gir subproject/gir/prog.py @@ -0,0 +1,6 @@ +#!/usr/bin/env python3 +from gi.repository import MesonSub + +if __name__ == "__main__": + s = MesonSub.Sample.new("Hello, sub/meson/py!") + s.print_message() diff --git a/test cases/frameworks/11 gir subproject/meson.build b/test cases/frameworks/11 gir subproject/meson.build new file mode 100644 index 0000000..3714daa --- /dev/null +++ b/test cases/frameworks/11 gir subproject/meson.build @@ -0,0 +1,20 @@ +project('gobject-introspection-with-subproject', 'c') + +gir = find_program('g-ir-scanner', required: false) +if not gir.found() + error('MESON_SKIP_TEST g-ir-scanner not found.') +endif + +python3 = import('python3') +py3 = python3.find_python() +if run_command(py3, '-c', 'import gi;', check: false).returncode() != 0 + error('MESON_SKIP_TEST python3-gi not found') +endif + +gnome = import('gnome') +gobj = dependency('gobject-2.0') + +add_global_arguments('-DMESON_TEST', language : 'c') +meson_gir = dependency('meson-gir', fallback : ['mesongir', 'meson_gir']) + +subdir('gir') diff --git a/test cases/frameworks/11 gir subproject/subprojects/mesongir/meson-sample.c b/test cases/frameworks/11 gir subproject/subprojects/mesongir/meson-sample.c new file mode 100644 index 0000000..2e78b07 --- /dev/null +++ b/test cases/frameworks/11 gir subproject/subprojects/mesongir/meson-sample.c @@ -0,0 +1,127 @@ +#include "meson-sample.h" + +typedef struct _MesonSamplePrivate +{ + gchar *msg; +} MesonSamplePrivate; + + +G_DEFINE_TYPE_WITH_PRIVATE (MesonSample, meson_sample, G_TYPE_OBJECT) + +enum { + PROP_0, + PROP_MSG, + LAST_PROP +}; + +static GParamSpec *gParamSpecs [LAST_PROP]; + +/** + * meson_sample_new: + * @msg: The message to set. + * + * Allocates a new #MesonSample. + * + * Returns: (transfer full): a #MesonSample. + */ +MesonSample * +meson_sample_new (const gchar *msg) +{ + g_return_val_if_fail (msg != NULL, NULL); + + return g_object_new (MESON_TYPE_SAMPLE, + "message", msg, + NULL); +} + +static void +meson_sample_finalize (GObject *object) +{ + MesonSamplePrivate *priv = meson_sample_get_instance_private ((MesonSample *) object); + + g_clear_pointer (&priv->msg, g_free); + + G_OBJECT_CLASS (meson_sample_parent_class)->finalize (object); +} + +static void +meson_sample_get_property (GObject *object, + guint prop_id, + GValue *value, + GParamSpec *pspec) +{ + MesonSamplePrivate *priv = meson_sample_get_instance_private ((MesonSample *) object); + + switch (prop_id) + { + case PROP_MSG: + g_value_set_string (value, priv->msg); + break; + default: + G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); + } +} + +static void +meson_sample_set_property (GObject *object, + guint prop_id, + const GValue *value, + GParamSpec *pspec) +{ + MesonSamplePrivate *priv = meson_sample_get_instance_private ((MesonSample *) object); + + switch (prop_id) + { + case PROP_MSG: + priv->msg = g_value_dup_string (value); + break; + default: + G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); + } +} + +static void +meson_sample_class_init (MesonSampleClass *klass) +{ + GObjectClass *object_class = G_OBJECT_CLASS (klass); + + object_class->finalize = meson_sample_finalize; + object_class->get_property = meson_sample_get_property; + object_class->set_property = meson_sample_set_property; + + gParamSpecs [PROP_MSG] = + g_param_spec_string ("message", + "Message", + "The message to print.", + NULL, + (G_PARAM_READWRITE | + G_PARAM_CONSTRUCT_ONLY | + G_PARAM_STATIC_STRINGS)); + + g_object_class_install_properties (object_class, LAST_PROP, gParamSpecs); +} + +static void +meson_sample_init (MesonSample *self) +{ +} + +/** + * meson_sample_print_message: + * @self: a #MesonSample. + * + * Prints the message. + * + * Returns: Nothing. + */ +void +meson_sample_print_message (MesonSample *self) +{ + MesonSamplePrivate *priv; + + g_return_if_fail (MESON_IS_SAMPLE (self)); + + priv = meson_sample_get_instance_private (self); + + g_print ("Message: %s\n", priv->msg); +} diff --git a/test cases/frameworks/11 gir subproject/subprojects/mesongir/meson-sample.h b/test cases/frameworks/11 gir subproject/subprojects/mesongir/meson-sample.h new file mode 100644 index 0000000..e4c07a8 --- /dev/null +++ b/test cases/frameworks/11 gir subproject/subprojects/mesongir/meson-sample.h @@ -0,0 +1,26 @@ +#ifndef MESON_SAMPLE_H +#define MESON_SAMPLE_H + +#if !defined (MESON_TEST) +#error "MESON_TEST not defined." +#endif + +#include + +G_BEGIN_DECLS + +#define MESON_TYPE_SAMPLE (meson_sample_get_type()) + +G_DECLARE_DERIVABLE_TYPE (MesonSample, meson_sample, MESON, SAMPLE, GObject) + +struct _MesonSampleClass { + GObjectClass parent_class; +}; + + +MesonSample *meson_sample_new (const gchar *msg); +void meson_sample_print_message (MesonSample *self); + +G_END_DECLS + +#endif /* MESON_SAMPLE_H */ diff --git a/test cases/frameworks/11 gir subproject/subprojects/mesongir/meson.build b/test cases/frameworks/11 gir subproject/subprojects/mesongir/meson.build new file mode 100644 index 0000000..027b4ee --- /dev/null +++ b/test cases/frameworks/11 gir subproject/subprojects/mesongir/meson.build @@ -0,0 +1,31 @@ +project('gobject-introspection-subproject', 'c') + +gnome = import('gnome') +gobj = dependency('gobject-2.0') + +libsources = ['meson-sample.c', 'meson-sample.h'] + +girlib = shared_library( + 'girlib', + sources : libsources, + dependencies : gobj, + install : true +) + +girtarget = gnome.generate_gir( + girlib, + sources : libsources, + nsversion : '1.0', + namespace : 'Meson', + symbol_prefix : 'meson_', + identifier_prefix : 'Meson', + includes : ['GObject-2.0'], + install : true +) + +meson_gir = declare_dependency(link_with : girlib, + include_directories : [include_directories('.')], + dependencies : [gobj], + # Everything that uses libgst needs this built to compile + sources : girtarget, +) diff --git a/test cases/frameworks/11 gir subproject/test.json b/test cases/frameworks/11 gir subproject/test.json new file mode 100644 index 0000000..aed0a1c --- /dev/null +++ b/test cases/frameworks/11 gir subproject/test.json @@ -0,0 +1,13 @@ +{ + "installed": [ + {"type": "file", "file": "usr/lib/girepository-1.0/Meson-1.0.typelib"}, + {"type": "file", "file": "usr/lib/girepository-1.0/MesonSub-1.0.typelib"}, + {"type": "file", "file": "usr/share/gir-1.0/Meson-1.0.gir"}, + {"type": "file", "file": "usr/share/gir-1.0/MesonSub-1.0.gir"}, + {"type": "expr", "file": "usr/lib/?libgirsubproject.so"}, + {"type": "file", "platform": "cygwin", "file": "usr/lib/libgirlib.dll.a"}, + {"type": "expr", "file": "usr/lib/?libgirlib.so"}, + {"type": "file", "platform": "cygwin", "file": "usr/lib/libgirsubproject.dll.a"} + ], + "skip_on_jobname": ["azure", "cygwin", "macos", "msys2", "pypy"] +} diff --git a/test cases/frameworks/12 multiple gir/gir/meson-subsample.c b/test cases/frameworks/12 multiple gir/gir/meson-subsample.c new file mode 100644 index 0000000..2d58a10 --- /dev/null +++ b/test cases/frameworks/12 multiple gir/gir/meson-subsample.c @@ -0,0 +1,124 @@ +#include "meson-subsample.h" + +struct _MesonSubSample +{ + MesonSample parent_instance; + + gchar *msg; +}; + +G_DEFINE_TYPE (MesonSubSample, meson_sub_sample, MESON_TYPE_SAMPLE) + +enum { + PROP_0, + PROP_MSG, + LAST_PROP +}; + +static GParamSpec *gParamSpecs [LAST_PROP]; + +/** + * meson_sub_sample_new: + * @msg: The message to set. + * + * Allocates a new #MesonSubSample. + * + * Returns: (transfer full): a #MesonSubSample. + */ +MesonSubSample * +meson_sub_sample_new (const gchar *msg) +{ + g_return_val_if_fail (msg != NULL, NULL); + + return g_object_new (MESON_TYPE_SUB_SAMPLE, + "message", msg, + NULL); +} + +static void +meson_sub_sample_finalize (GObject *object) +{ + MesonSubSample *self = (MesonSubSample *)object; + + g_clear_pointer (&self->msg, g_free); + + G_OBJECT_CLASS (meson_sub_sample_parent_class)->finalize (object); +} + +static void +meson_sub_sample_get_property (GObject *object, + guint prop_id, + GValue *value, + GParamSpec *pspec) +{ + MesonSubSample *self = MESON_SUB_SAMPLE (object); + + switch (prop_id) + { + case PROP_MSG: + g_value_set_string (value, self->msg); + break; + default: + G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); + } +} + +static void +meson_sub_sample_set_property (GObject *object, + guint prop_id, + const GValue *value, + GParamSpec *pspec) +{ + MesonSubSample *self = MESON_SUB_SAMPLE (object); + + switch (prop_id) + { + case PROP_MSG: + self->msg = g_value_dup_string (value); + break; + default: + G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); + } +} + +static void +meson_sub_sample_class_init (MesonSubSampleClass *klass) +{ + GObjectClass *object_class = G_OBJECT_CLASS (klass); + + object_class->finalize = meson_sub_sample_finalize; + object_class->get_property = meson_sub_sample_get_property; + object_class->set_property = meson_sub_sample_set_property; + + gParamSpecs [PROP_MSG] = + g_param_spec_string ("message", + "Message", + "The message to print.", + NULL, + (G_PARAM_READWRITE | + G_PARAM_CONSTRUCT_ONLY | + G_PARAM_STATIC_STRINGS)); + + g_object_class_install_properties (object_class, LAST_PROP, gParamSpecs); +} + +static void +meson_sub_sample_init (MesonSubSample *self) +{ +} + +/** + * meson_sub_sample_print_message: + * @self: a #MesonSubSample. + * + * Prints the message. + * + * Returns: Nothing. + */ +void +meson_sub_sample_print_message (MesonSubSample *self) +{ + g_return_if_fail (MESON_IS_SUB_SAMPLE (self)); + + g_print ("Message: %s\n", self->msg); +} diff --git a/test cases/frameworks/12 multiple gir/gir/meson-subsample.h b/test cases/frameworks/12 multiple gir/gir/meson-subsample.h new file mode 100644 index 0000000..9d34a08 --- /dev/null +++ b/test cases/frameworks/12 multiple gir/gir/meson-subsample.h @@ -0,0 +1,17 @@ +#ifndef MESON_SUB_SAMPLE_H +#define MESON_SUB_SAMPLE_H + +#include +#include + +G_BEGIN_DECLS + +#define MESON_TYPE_SUB_SAMPLE (meson_sub_sample_get_type()) + +G_DECLARE_FINAL_TYPE (MesonSubSample, meson_sub_sample, MESON, SUB_SAMPLE, MesonSample) + +MesonSubSample *meson_sub_sample_new (const gchar *msg); + +G_END_DECLS + +#endif /* MESON_SUB_SAMPLE_H */ diff --git a/test cases/frameworks/12 multiple gir/gir/meson.build b/test cases/frameworks/12 multiple gir/gir/meson.build new file mode 100644 index 0000000..5a52c9c --- /dev/null +++ b/test cases/frameworks/12 multiple gir/gir/meson.build @@ -0,0 +1,31 @@ +libsources = ['meson-subsample.c', 'meson-subsample.h'] + +girsubproject = shared_library( + 'girsubproject', + sources : libsources, + dependencies : [gobj, girlib_dep], + install : true +) + +girexe = executable( + 'girprog', + sources : 'prog.c', + dependencies : [gobj, girlib_dep], + link_with : girsubproject +) + +gnome.generate_gir( + girsubproject, + sources : libsources, + nsversion : '1.0', + namespace : 'MesonSub', + symbol_prefix : 'meson_sub_', + identifier_prefix : 'MesonSub', + includes : ['GObject-2.0', meson_gir], + install : true, + install_dir_gir: false, +) + +message('TEST: ' + girsubproject.outdir()) + +test('gobject introspection/subproject/c', girexe) diff --git a/test cases/frameworks/12 multiple gir/gir/prog.c b/test cases/frameworks/12 multiple gir/gir/prog.c new file mode 100644 index 0000000..f25c9d8 --- /dev/null +++ b/test cases/frameworks/12 multiple gir/gir/prog.c @@ -0,0 +1,12 @@ +#include "meson-subsample.h" + +gint +main (gint argc, + gchar *argv[]) +{ + MesonSample * i = (MesonSample*) meson_sub_sample_new ("Hello, sub/meson/c!"); + meson_sample_print_message (i); + g_object_unref (i); + + return 0; +} diff --git a/test cases/frameworks/12 multiple gir/meson.build b/test cases/frameworks/12 multiple gir/meson.build new file mode 100644 index 0000000..6391937 --- /dev/null +++ b/test cases/frameworks/12 multiple gir/meson.build @@ -0,0 +1,12 @@ +project('multiple-gobject-introspection', 'c', meson_version: '>=0.50.0') + +gir = find_program('g-ir-scanner', required: false) +if not gir.found() + error('MESON_SKIP_TEST g-ir-scanner not found.') +endif + +gnome = import('gnome') +gobj = dependency('gobject-2.0') + +subdir('mesongir') +subdir('gir') diff --git a/test cases/frameworks/12 multiple gir/mesongir/meson-sample.c b/test cases/frameworks/12 multiple gir/mesongir/meson-sample.c new file mode 100644 index 0000000..2ed9cdf --- /dev/null +++ b/test cases/frameworks/12 multiple gir/mesongir/meson-sample.c @@ -0,0 +1,126 @@ +#include "meson-sample.h" + +typedef struct _MesonSamplePrivate +{ + gchar *msg; +} MesonSamplePrivate; + + +G_DEFINE_TYPE_WITH_PRIVATE (MesonSample, meson_sample, G_TYPE_OBJECT) + +enum { + PROP_0, + PROP_MSG, + LAST_PROP +}; + +static GParamSpec *gParamSpecs [LAST_PROP]; + +/** + * meson_sample_new: + * @msg: The message to set. + * + * Allocates a new #MesonSample. + * + * Returns: (transfer full): a #MesonSample. + */ +MesonSample * +meson_sample_new (const gchar *msg) +{ + g_return_val_if_fail (msg != NULL, NULL); + + return g_object_new (MESON_TYPE_SAMPLE, + "message", msg, + NULL); +} + +static void +meson_sample_finalize (GObject *object) +{ + MesonSamplePrivate *priv = meson_sample_get_instance_private ((MesonSample *) object); + + g_clear_pointer (&priv->msg, g_free); + + G_OBJECT_CLASS (meson_sample_parent_class)->finalize (object); +} + +static void +meson_sample_get_property (GObject *object, + guint prop_id, + GValue *value, + GParamSpec *pspec) +{ + MesonSamplePrivate *priv = meson_sample_get_instance_private ((MesonSample *) object); + + switch (prop_id) + { + case PROP_MSG: + g_value_set_string (value, priv->msg); + break; + default: + G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); + } +} + +static void +meson_sample_set_property (GObject *object, + guint prop_id, + const GValue *value, + GParamSpec *pspec) +{ + MesonSamplePrivate *priv = meson_sample_get_instance_private ((MesonSample *) object); + + switch (prop_id) + { + case PROP_MSG: + priv->msg = g_value_dup_string (value); + break; + default: + G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); + } +} + +static void +meson_sample_class_init (MesonSampleClass *klass) +{ + GObjectClass *object_class = G_OBJECT_CLASS (klass); + + object_class->finalize = meson_sample_finalize; + object_class->get_property = meson_sample_get_property; + object_class->set_property = meson_sample_set_property; + + gParamSpecs [PROP_MSG] = + g_param_spec_string ("message", + "Message", + "The message to print.", + NULL, + (G_PARAM_READWRITE | + G_PARAM_CONSTRUCT_ONLY | + G_PARAM_STATIC_STRINGS)); + + g_object_class_install_properties (object_class, LAST_PROP, gParamSpecs); +} + +static void +meson_sample_init (MesonSample *self) +{ +} + +/** + * meson_sample_print_message: + * @self: a #MesonSample. + * + * Prints the message. + * + */ +void +meson_sample_print_message (MesonSample *self) +{ + MesonSamplePrivate *priv; + + g_return_if_fail (MESON_IS_SAMPLE (self)); + + priv = meson_sample_get_instance_private (self); + + g_print ("Message: %s\n", priv->msg); +} diff --git a/test cases/frameworks/12 multiple gir/mesongir/meson-sample.h.in b/test cases/frameworks/12 multiple gir/mesongir/meson-sample.h.in new file mode 100644 index 0000000..d0ab29e --- /dev/null +++ b/test cases/frameworks/12 multiple gir/mesongir/meson-sample.h.in @@ -0,0 +1,22 @@ +#ifndef MESON_SAMPLE_H +#define MESON_SAMPLE_H + +#include <@HEADER@> + +G_BEGIN_DECLS + +#define MESON_TYPE_SAMPLE (meson_sample_get_type()) + +G_DECLARE_DERIVABLE_TYPE (MesonSample, meson_sample, MESON, SAMPLE, GObject) + +struct _MesonSampleClass { + GObjectClass parent_class; +}; + + +MesonSample *meson_sample_new (const gchar *msg); +void meson_sample_print_message (MesonSample *self); + +G_END_DECLS + +#endif /* MESON_SAMPLE_H */ diff --git a/test cases/frameworks/12 multiple gir/mesongir/meson.build b/test cases/frameworks/12 multiple gir/mesongir/meson.build new file mode 100644 index 0000000..1ae3f03 --- /dev/null +++ b/test cases/frameworks/12 multiple gir/mesongir/meson.build @@ -0,0 +1,39 @@ +conf = configuration_data() +conf.set('HEADER', 'glib-object.h') + +meson_sample_header = configure_file( + input : 'meson-sample.h.in', + output : 'meson-sample.h', + configuration : conf) + +libsources = ['meson-sample.c', meson_sample_header] + +girlib = shared_library( + 'girlib', + sources : libsources, + dependencies : gobj, + install : true +) + +girtarget = gnome.generate_gir( + girlib, + sources : libsources, + nsversion : '1.0', + namespace : 'Meson', + symbol_prefix : 'meson_', + identifier_prefix : 'Meson', + includes : ['GObject-2.0'], + export_packages : 'meson', + install : true, + install_gir: false, +) +meson_gir = girtarget[0] +meson_typelib = girtarget[1] + +girlib_inc = include_directories('.') +girlib_dep = declare_dependency(link_with : girlib, + include_directories : [girlib_inc], + dependencies : [gobj], + # Everything that uses libgst needs this built to compile + sources : girtarget, +) diff --git a/test cases/frameworks/12 multiple gir/test.json b/test cases/frameworks/12 multiple gir/test.json new file mode 100644 index 0000000..e59c3e6 --- /dev/null +++ b/test cases/frameworks/12 multiple gir/test.json @@ -0,0 +1,17 @@ +{ + "installed": [ + {"type": "file", "file": "usr/lib/girepository-1.0/Meson-1.0.typelib"}, + {"type": "file", "file": "usr/lib/girepository-1.0/MesonSub-1.0.typelib"}, + {"type": "expr", "file": "usr/lib/?libgirlib.so"}, + {"type": "file", "platform": "cygwin", "file": "usr/lib/libgirlib.dll.a"}, + {"type": "expr", "file": "usr/lib/?libgirsubproject.so"}, + {"type": "file", "platform": "cygwin", "file": "usr/lib/libgirsubproject.dll.a"} + ], + "skip_on_jobname": ["azure", "macos", "msys2"], + "stdout": [ + { + "comment": "This will either match in the future-deprecated notice summary, or match the warning summary", + "line": " * 0.61.0: {'\"gnome.generate_gir\" keyword argument \"install_dir_gir\" value \"False\"'}" + } + ] +} diff --git a/test cases/frameworks/13 yelp/help/C/index.page b/test cases/frameworks/13 yelp/help/C/index.page new file mode 100644 index 0000000..1b367e6 --- /dev/null +++ b/test cases/frameworks/13 yelp/help/C/index.page @@ -0,0 +1,8 @@ + + + Hello! + + diff --git a/test cases/frameworks/13 yelp/help/C/index2.page b/test cases/frameworks/13 yelp/help/C/index2.page new file mode 100644 index 0000000..14b6b51 --- /dev/null +++ b/test cases/frameworks/13 yelp/help/C/index2.page @@ -0,0 +1,8 @@ + + + Hello! + + diff --git a/test cases/frameworks/13 yelp/help/C/index3.page b/test cases/frameworks/13 yelp/help/C/index3.page new file mode 100644 index 0000000..c0c21c1 --- /dev/null +++ b/test cases/frameworks/13 yelp/help/C/index3.page @@ -0,0 +1,8 @@ + + + Hello! + + diff --git a/test cases/frameworks/13 yelp/help/C/media/test.txt b/test cases/frameworks/13 yelp/help/C/media/test.txt new file mode 100644 index 0000000..ce01362 --- /dev/null +++ b/test cases/frameworks/13 yelp/help/C/media/test.txt @@ -0,0 +1 @@ +hello diff --git a/test cases/frameworks/13 yelp/help/LINGUAS b/test cases/frameworks/13 yelp/help/LINGUAS new file mode 100644 index 0000000..173f978 --- /dev/null +++ b/test cases/frameworks/13 yelp/help/LINGUAS @@ -0,0 +1,2 @@ +de +es diff --git a/test cases/frameworks/13 yelp/help/de/de.po b/test cases/frameworks/13 yelp/help/de/de.po new file mode 100644 index 0000000..a54ce7f --- /dev/null +++ b/test cases/frameworks/13 yelp/help/de/de.po @@ -0,0 +1,13 @@ +msgid "" +msgstr "" +"Project-Id-Version: meson master\n" +"Language: de\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Plural-Forms: nplurals=2; plural=(n != 1);\n" + +#. (itstool) path: page/title +#: C/index.page:5 +msgid "Hello!" +msgstr "Hallo!" diff --git a/test cases/frameworks/13 yelp/help/es/es.po b/test cases/frameworks/13 yelp/help/es/es.po new file mode 100644 index 0000000..b69ce7f --- /dev/null +++ b/test cases/frameworks/13 yelp/help/es/es.po @@ -0,0 +1,13 @@ +msgid "" +msgstr "" +"Project-Id-Version: meson master\n" +"Language: es\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Plural-Forms: nplurals=2; plural=(n != 1);\n" + +#. (itstool) path: page/title +#: C/index.page:5 +msgid "Hello!" +msgstr "¡Hola!" diff --git a/test cases/frameworks/13 yelp/help/es/media/test.txt b/test cases/frameworks/13 yelp/help/es/media/test.txt new file mode 100644 index 0000000..3453b00 --- /dev/null +++ b/test cases/frameworks/13 yelp/help/es/media/test.txt @@ -0,0 +1 @@ +Hola. diff --git a/test cases/frameworks/13 yelp/help/meson.build b/test cases/frameworks/13 yelp/help/meson.build new file mode 100644 index 0000000..d6dbe10 --- /dev/null +++ b/test cases/frameworks/13 yelp/help/meson.build @@ -0,0 +1,21 @@ +gnome = import('gnome') + +gnome.yelp('meson', + sources: 'index.page', + media: 'media/test.txt', + symlink_media: false, + languages: ['de', 'es'], +) + +gnome.yelp('meson-symlink', + sources: 'index2.page', + media: 'media/test.txt', + symlink_media: true, + languages: ['de', 'es'], +) + +gnome.yelp('meson-linguas', + sources: 'index3.page', + media: 'media/test.txt', + symlink_media: false, +) diff --git a/test cases/frameworks/13 yelp/meson.build b/test cases/frameworks/13 yelp/meson.build new file mode 100644 index 0000000..9fdde25 --- /dev/null +++ b/test cases/frameworks/13 yelp/meson.build @@ -0,0 +1,8 @@ +project('yelp', 'c') + +itstool = find_program('itstool', required: false) +if not itstool.found() + error('MESON_SKIP_TEST itstool not found.') +endif + +subdir('help') diff --git a/test cases/frameworks/13 yelp/test.json b/test cases/frameworks/13 yelp/test.json new file mode 100644 index 0000000..22e34d2 --- /dev/null +++ b/test cases/frameworks/13 yelp/test.json @@ -0,0 +1,23 @@ +{ + "installed": [ + {"type": "file", "file": "usr/share/help/C/meson/index.page"}, + {"type": "file", "file": "usr/share/help/C/meson/media/test.txt"}, + {"type": "file", "file": "usr/share/help/es/meson/index.page"}, + {"type": "file", "file": "usr/share/help/es/meson/media/test.txt"}, + {"type": "file", "file": "usr/share/help/de/meson/index.page"}, + {"type": "file", "file": "usr/share/help/de/meson/media/test.txt"}, + {"type": "file", "file": "usr/share/help/C/meson-symlink/index2.page"}, + {"type": "file", "file": "usr/share/help/C/meson-symlink/media/test.txt"}, + {"type": "file", "file": "usr/share/help/es/meson-symlink/index2.page"}, + {"type": "file", "file": "usr/share/help/es/meson-symlink/media/test.txt"}, + {"type": "file", "file": "usr/share/help/de/meson-symlink/index2.page"}, + {"type": "file", "file": "usr/share/help/de/meson-symlink/media/test.txt"}, + {"type": "file", "file": "usr/share/help/C/meson-linguas/index3.page"}, + {"type": "file", "file": "usr/share/help/C/meson-linguas/media/test.txt"}, + {"type": "file", "file": "usr/share/help/es/meson-linguas/index3.page"}, + {"type": "file", "file": "usr/share/help/es/meson-linguas/media/test.txt"}, + {"type": "file", "file": "usr/share/help/de/meson-linguas/index3.page"}, + {"type": "file", "file": "usr/share/help/de/meson-linguas/media/test.txt"} + ], + "skip_on_jobname": ["azure", "cygwin", "macos", "msys2"] +} diff --git a/test cases/frameworks/14 doxygen/doc/Doxyfile.in b/test cases/frameworks/14 doxygen/doc/Doxyfile.in new file mode 100644 index 0000000..69fb4aa --- /dev/null +++ b/test cases/frameworks/14 doxygen/doc/Doxyfile.in @@ -0,0 +1,2473 @@ +# Doxyfile 1.8.13 + +# This file describes the settings to be used by the documentation system +# doxygen (www.doxygen.org) for a project. +# +# All text after a double hash (##) is considered a comment and is placed in +# front of the TAG it is preceding. +# +# All text after a single hash (#) is considered a comment and will be ignored. +# The format is: +# TAG = value [value, ...] +# For lists, items can also be appended using: +# TAG += value [value, ...] +# Values that contain spaces should be placed between quotes (\" \"). + +#--------------------------------------------------------------------------- +# Project related configuration options +#--------------------------------------------------------------------------- + +# This tag specifies the encoding used for all characters in the config file +# that follow. The default is UTF-8 which is also the encoding used for all text +# before the first occurrence of this tag. Doxygen uses libiconv (or the iconv +# built into libc) for the transcoding. See http://www.gnu.org/software/libiconv +# for the list of possible encodings. +# The default value is: UTF-8. + +DOXYFILE_ENCODING = UTF-8 + +# The PROJECT_NAME tag is a single word (or a sequence of words surrounded by +# double-quotes, unless you are using Doxywizard) that should identify the +# project for which the documentation is generated. This name is used in the +# title of most generated pages and in a few other places. +# The default value is: My Project. + +PROJECT_NAME = "The Vast Comedian Project" + +# The PROJECT_NUMBER tag can be used to enter a project or revision number. This +# could be handy for archiving the generated documentation or if some version +# control system is used. + +PROJECT_NUMBER = @VERSION@ + +# Using the PROJECT_BRIEF tag one can provide an optional one line description +# for a project that appears at the top of each page and should give viewer a +# quick idea about the purpose of the project. Keep the description short. + +PROJECT_BRIEF = Comedy generator + +# With the PROJECT_LOGO tag one can specify a logo or an icon that is included +# in the documentation. The maximum height of the logo should not exceed 55 +# pixels and the maximum width should not exceed 200 pixels. Doxygen will copy +# the logo to the output directory. + +PROJECT_LOGO = + +# The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute) path +# into which the generated documentation will be written. If a relative path is +# entered, it will be relative to the location where doxygen was started. If +# left blank the current directory will be used. + +OUTPUT_DIRECTORY = doc + +# If the CREATE_SUBDIRS tag is set to YES then doxygen will create 4096 sub- +# directories (in 2 levels) under the output directory of each output format and +# will distribute the generated files over these directories. Enabling this +# option can be useful when feeding doxygen a huge amount of source files, where +# putting all generated files in the same directory would otherwise causes +# performance problems for the file system. +# The default value is: NO. + +CREATE_SUBDIRS = NO + +# If the ALLOW_UNICODE_NAMES tag is set to YES, doxygen will allow non-ASCII +# characters to appear in the names of generated files. If set to NO, non-ASCII +# characters will be escaped, for example _xE3_x81_x84 will be used for Unicode +# U+3044. +# The default value is: NO. + +ALLOW_UNICODE_NAMES = YES + +# The OUTPUT_LANGUAGE tag is used to specify the language in which all +# documentation generated by doxygen is written. Doxygen will use this +# information to generate all constant output in the proper language. +# Possible values are: Afrikaans, Arabic, Armenian, Brazilian, Catalan, Chinese, +# Chinese-Traditional, Croatian, Czech, Danish, Dutch, English (United States), +# Esperanto, Farsi (Persian), Finnish, French, German, Greek, Hungarian, +# Indonesian, Italian, Japanese, Japanese-en (Japanese with English messages), +# Korean, Korean-en (Korean with English messages), Latvian, Lithuanian, +# Macedonian, Norwegian, Persian (Farsi), Polish, Portuguese, Romanian, Russian, +# Serbian, Serbian-Cyrillic, Slovak, Slovene, Spanish, Swedish, Turkish, +# Ukrainian and Vietnamese. +# The default value is: English. + +OUTPUT_LANGUAGE = English + +# If the BRIEF_MEMBER_DESC tag is set to YES, doxygen will include brief member +# descriptions after the members that are listed in the file and class +# documentation (similar to Javadoc). Set to NO to disable this. +# The default value is: YES. + +BRIEF_MEMBER_DESC = YES + +# If the REPEAT_BRIEF tag is set to YES, doxygen will prepend the brief +# description of a member or function before the detailed description +# +# Note: If both HIDE_UNDOC_MEMBERS and BRIEF_MEMBER_DESC are set to NO, the +# brief descriptions will be completely suppressed. +# The default value is: YES. + +REPEAT_BRIEF = YES + +# This tag implements a quasi-intelligent brief description abbreviator that is +# used to form the text in various listings. Each string in this list, if found +# as the leading text of the brief description, will be stripped from the text +# and the result, after processing the whole list, is used as the annotated +# text. Otherwise, the brief description is used as-is. If left blank, the +# following values are used ($name is automatically replaced with the name of +# the entity):The $name class, The $name widget, The $name file, is, provides, +# specifies, contains, represents, a, an and the. + +ABBREVIATE_BRIEF = "The $name class" \ + "The $name widget" \ + "The $name file" \ + is \ + provides \ + specifies \ + contains \ + represents \ + a \ + an \ + the + +# If the ALWAYS_DETAILED_SEC and REPEAT_BRIEF tags are both set to YES then +# doxygen will generate a detailed section even if there is only a brief +# description. +# The default value is: NO. + +ALWAYS_DETAILED_SEC = NO + +# If the INLINE_INHERITED_MEMB tag is set to YES, doxygen will show all +# inherited members of a class in the documentation of that class as if those +# members were ordinary class members. Constructors, destructors and assignment +# operators of the base classes will not be shown. +# The default value is: NO. + +INLINE_INHERITED_MEMB = NO + +# If the FULL_PATH_NAMES tag is set to YES, doxygen will prepend the full path +# before files name in the file list and in the header files. If set to NO the +# shortest path that makes the file name unique will be used +# The default value is: YES. + +FULL_PATH_NAMES = YES + +# The STRIP_FROM_PATH tag can be used to strip a user-defined part of the path. +# Stripping is only done if one of the specified strings matches the left-hand +# part of the path. The tag can be used to show relative paths in the file list. +# If left blank the directory from which doxygen is run is used as the path to +# strip. +# +# Note that you can specify absolute paths here, but also relative paths, which +# will be relative from the directory where doxygen is started. +# This tag requires that the tag FULL_PATH_NAMES is set to YES. + +STRIP_FROM_PATH = + +# The STRIP_FROM_INC_PATH tag can be used to strip a user-defined part of the +# path mentioned in the documentation of a class, which tells the reader which +# header file to include in order to use a class. If left blank only the name of +# the header file containing the class definition is used. Otherwise one should +# specify the list of include paths that are normally passed to the compiler +# using the -I flag. + +STRIP_FROM_INC_PATH = + +# If the SHORT_NAMES tag is set to YES, doxygen will generate much shorter (but +# less readable) file names. This can be useful is your file systems doesn't +# support long names like on DOS, Mac, or CD-ROM. +# The default value is: NO. + +SHORT_NAMES = NO + +# If the JAVADOC_AUTOBRIEF tag is set to YES then doxygen will interpret the +# first line (until the first dot) of a Javadoc-style comment as the brief +# description. If set to NO, the Javadoc-style will behave just like regular Qt- +# style comments (thus requiring an explicit @brief command for a brief +# description.) +# The default value is: NO. + +JAVADOC_AUTOBRIEF = NO + +# If the QT_AUTOBRIEF tag is set to YES then doxygen will interpret the first +# line (until the first dot) of a Qt-style comment as the brief description. If +# set to NO, the Qt-style will behave just like regular Qt-style comments (thus +# requiring an explicit \brief command for a brief description.) +# The default value is: NO. + +QT_AUTOBRIEF = NO + +# The MULTILINE_CPP_IS_BRIEF tag can be set to YES to make doxygen treat a +# multi-line C++ special comment block (i.e. a block of //! or /// comments) as +# a brief description. This used to be the default behavior. The new default is +# to treat a multi-line C++ comment block as a detailed description. Set this +# tag to YES if you prefer the old behavior instead. +# +# Note that setting this tag to YES also means that rational rose comments are +# not recognized any more. +# The default value is: NO. + +MULTILINE_CPP_IS_BRIEF = NO + +# If the INHERIT_DOCS tag is set to YES then an undocumented member inherits the +# documentation from any documented member that it re-implements. +# The default value is: YES. + +INHERIT_DOCS = YES + +# If the SEPARATE_MEMBER_PAGES tag is set to YES then doxygen will produce a new +# page for each member. If set to NO, the documentation of a member will be part +# of the file/class/namespace that contains it. +# The default value is: NO. + +SEPARATE_MEMBER_PAGES = NO + +# The TAB_SIZE tag can be used to set the number of spaces in a tab. Doxygen +# uses this value to replace tabs by spaces in code fragments. +# Minimum value: 1, maximum value: 16, default value: 4. + +TAB_SIZE = 4 + +# This tag can be used to specify a number of aliases that act as commands in +# the documentation. An alias has the form: +# name=value +# For example adding +# "sideeffect=@par Side Effects:\n" +# will allow you to put the command \sideeffect (or @sideeffect) in the +# documentation, which will result in a user-defined paragraph with heading +# "Side Effects:". You can put \n's in the value part of an alias to insert +# newlines. + +ALIASES = + +# This tag can be used to specify a number of word-keyword mappings (TCL only). +# A mapping has the form "name=value". For example adding "class=itcl::class" +# will allow you to use the command class in the itcl::class meaning. + +TCL_SUBST = + +# Set the OPTIMIZE_OUTPUT_FOR_C tag to YES if your project consists of C sources +# only. Doxygen will then generate output that is more tailored for C. For +# instance, some of the names that are used will be different. The list of all +# members will be omitted, etc. +# The default value is: NO. + +OPTIMIZE_OUTPUT_FOR_C = NO + +# Set the OPTIMIZE_OUTPUT_JAVA tag to YES if your project consists of Java or +# Python sources only. Doxygen will then generate output that is more tailored +# for that language. For instance, namespaces will be presented as packages, +# qualified scopes will look different, etc. +# The default value is: NO. + +OPTIMIZE_OUTPUT_JAVA = NO + +# Set the OPTIMIZE_FOR_FORTRAN tag to YES if your project consists of Fortran +# sources. Doxygen will then generate output that is tailored for Fortran. +# The default value is: NO. + +OPTIMIZE_FOR_FORTRAN = NO + +# Set the OPTIMIZE_OUTPUT_VHDL tag to YES if your project consists of VHDL +# sources. Doxygen will then generate output that is tailored for VHDL. +# The default value is: NO. + +OPTIMIZE_OUTPUT_VHDL = NO + +# Doxygen selects the parser to use depending on the extension of the files it +# parses. With this tag you can assign which parser to use for a given +# extension. Doxygen has a built-in mapping, but you can override or extend it +# using this tag. The format is ext=language, where ext is a file extension, and +# language is one of the parsers supported by doxygen: IDL, Java, Javascript, +# C#, C, C++, D, PHP, Objective-C, Python, Fortran (fixed format Fortran: +# FortranFixed, free formatted Fortran: FortranFree, unknown formatted Fortran: +# Fortran. In the later case the parser tries to guess whether the code is fixed +# or free formatted code, this is the default for Fortran type files), VHDL. For +# instance to make doxygen treat .inc files as Fortran files (default is PHP), +# and .f files as C (default is Fortran), use: inc=Fortran f=C. +# +# Note: For files without extension you can use no_extension as a placeholder. +# +# Note that for custom extensions you also need to set FILE_PATTERNS otherwise +# the files are not read by doxygen. + +EXTENSION_MAPPING = + +# If the MARKDOWN_SUPPORT tag is enabled then doxygen pre-processes all comments +# according to the Markdown format, which allows for more readable +# documentation. See http://daringfireball.net/projects/markdown/ for details. +# The output of markdown processing is further processed by doxygen, so you can +# mix doxygen, HTML, and XML commands with Markdown formatting. Disable only in +# case of backward compatibilities issues. +# The default value is: YES. + +MARKDOWN_SUPPORT = YES + +# When the TOC_INCLUDE_HEADINGS tag is set to a non-zero value, all headings up +# to that level are automatically included in the table of contents, even if +# they do not have an id attribute. +# Note: This feature currently applies only to Markdown headings. +# Minimum value: 0, maximum value: 99, default value: 0. +# This tag requires that the tag MARKDOWN_SUPPORT is set to YES. + +TOC_INCLUDE_HEADINGS = 0 + +# When enabled doxygen tries to link words that correspond to documented +# classes, or namespaces to their corresponding documentation. Such a link can +# be prevented in individual cases by putting a % sign in front of the word or +# globally by setting AUTOLINK_SUPPORT to NO. +# The default value is: YES. + +AUTOLINK_SUPPORT = YES + +# If you use STL classes (i.e. std::string, std::vector, etc.) but do not want +# to include (a tag file for) the STL sources as input, then you should set this +# tag to YES in order to let doxygen match functions declarations and +# definitions whose arguments contain STL classes (e.g. func(std::string); +# versus func(std::string) {}). This also make the inheritance and collaboration +# diagrams that involve STL classes more complete and accurate. +# The default value is: NO. + +BUILTIN_STL_SUPPORT = NO + +# If you use Microsoft's C++/CLI language, you should set this option to YES to +# enable parsing support. +# The default value is: NO. + +CPP_CLI_SUPPORT = NO + +# Set the SIP_SUPPORT tag to YES if your project consists of sip (see: +# http://www.riverbankcomputing.co.uk/software/sip/intro) sources only. Doxygen +# will parse them like normal C++ but will assume all classes use public instead +# of private inheritance when no explicit protection keyword is present. +# The default value is: NO. + +SIP_SUPPORT = NO + +# For Microsoft's IDL there are propget and propput attributes to indicate +# getter and setter methods for a property. Setting this option to YES will make +# doxygen to replace the get and set methods by a property in the documentation. +# This will only work if the methods are indeed getting or setting a simple +# type. If this is not the case, or you want to show the methods anyway, you +# should set this option to NO. +# The default value is: YES. + +IDL_PROPERTY_SUPPORT = YES + +# If member grouping is used in the documentation and the DISTRIBUTE_GROUP_DOC +# tag is set to YES then doxygen will reuse the documentation of the first +# member in the group (if any) for the other members of the group. By default +# all members of a group must be documented explicitly. +# The default value is: NO. + +DISTRIBUTE_GROUP_DOC = NO + +# If one adds a struct or class to a group and this option is enabled, then also +# any nested class or struct is added to the same group. By default this option +# is disabled and one has to add nested compounds explicitly via \ingroup. +# The default value is: NO. + +GROUP_NESTED_COMPOUNDS = NO + +# Set the SUBGROUPING tag to YES to allow class member groups of the same type +# (for instance a group of public functions) to be put as a subgroup of that +# type (e.g. under the Public Functions section). Set it to NO to prevent +# subgrouping. Alternatively, this can be done per class using the +# \nosubgrouping command. +# The default value is: YES. + +SUBGROUPING = YES + +# When the INLINE_GROUPED_CLASSES tag is set to YES, classes, structs and unions +# are shown inside the group in which they are included (e.g. using \ingroup) +# instead of on a separate page (for HTML and Man pages) or section (for LaTeX +# and RTF). +# +# Note that this feature does not work in combination with +# SEPARATE_MEMBER_PAGES. +# The default value is: NO. + +INLINE_GROUPED_CLASSES = NO + +# When the INLINE_SIMPLE_STRUCTS tag is set to YES, structs, classes, and unions +# with only public data fields or simple typedef fields will be shown inline in +# the documentation of the scope in which they are defined (i.e. file, +# namespace, or group documentation), provided this scope is documented. If set +# to NO, structs, classes, and unions are shown on a separate page (for HTML and +# Man pages) or section (for LaTeX and RTF). +# The default value is: NO. + +INLINE_SIMPLE_STRUCTS = NO + +# When TYPEDEF_HIDES_STRUCT tag is enabled, a typedef of a struct, union, or +# enum is documented as struct, union, or enum with the name of the typedef. So +# typedef struct TypeS {} TypeT, will appear in the documentation as a struct +# with name TypeT. When disabled the typedef will appear as a member of a file, +# namespace, or class. And the struct will be named TypeS. This can typically be +# useful for C code in case the coding convention dictates that all compound +# types are typedef'ed and only the typedef is referenced, never the tag name. +# The default value is: NO. + +TYPEDEF_HIDES_STRUCT = NO + +# The size of the symbol lookup cache can be set using LOOKUP_CACHE_SIZE. This +# cache is used to resolve symbols given their name and scope. Since this can be +# an expensive process and often the same symbol appears multiple times in the +# code, doxygen keeps a cache of pre-resolved symbols. If the cache is too small +# doxygen will become slower. If the cache is too large, memory is wasted. The +# cache size is given by this formula: 2^(16+LOOKUP_CACHE_SIZE). The valid range +# is 0..9, the default is 0, corresponding to a cache size of 2^16=65536 +# symbols. At the end of a run doxygen will report the cache usage and suggest +# the optimal cache size from a speed point of view. +# Minimum value: 0, maximum value: 9, default value: 0. + +LOOKUP_CACHE_SIZE = 0 + +#--------------------------------------------------------------------------- +# Build related configuration options +#--------------------------------------------------------------------------- + +# If the EXTRACT_ALL tag is set to YES, doxygen will assume all entities in +# documentation are documented, even if no documentation was available. Private +# class members and static file members will be hidden unless the +# EXTRACT_PRIVATE respectively EXTRACT_STATIC tags are set to YES. +# Note: This will also disable the warnings about undocumented members that are +# normally produced when WARNINGS is set to YES. +# The default value is: NO. + +EXTRACT_ALL = NO + +# If the EXTRACT_PRIVATE tag is set to YES, all private members of a class will +# be included in the documentation. +# The default value is: NO. + +EXTRACT_PRIVATE = NO + +# If the EXTRACT_PACKAGE tag is set to YES, all members with package or internal +# scope will be included in the documentation. +# The default value is: NO. + +EXTRACT_PACKAGE = NO + +# If the EXTRACT_STATIC tag is set to YES, all static members of a file will be +# included in the documentation. +# The default value is: NO. + +EXTRACT_STATIC = NO + +# If the EXTRACT_LOCAL_CLASSES tag is set to YES, classes (and structs) defined +# locally in source files will be included in the documentation. If set to NO, +# only classes defined in header files are included. Does not have any effect +# for Java sources. +# The default value is: YES. + +EXTRACT_LOCAL_CLASSES = YES + +# This flag is only useful for Objective-C code. If set to YES, local methods, +# which are defined in the implementation section but not in the interface are +# included in the documentation. If set to NO, only methods in the interface are +# included. +# The default value is: NO. + +EXTRACT_LOCAL_METHODS = NO + +# If this flag is set to YES, the members of anonymous namespaces will be +# extracted and appear in the documentation as a namespace called +# 'anonymous_namespace{file}', where file will be replaced with the base name of +# the file that contains the anonymous namespace. By default anonymous namespace +# are hidden. +# The default value is: NO. + +EXTRACT_ANON_NSPACES = NO + +# If the HIDE_UNDOC_MEMBERS tag is set to YES, doxygen will hide all +# undocumented members inside documented classes or files. If set to NO these +# members will be included in the various overviews, but no documentation +# section is generated. This option has no effect if EXTRACT_ALL is enabled. +# The default value is: NO. + +HIDE_UNDOC_MEMBERS = NO + +# If the HIDE_UNDOC_CLASSES tag is set to YES, doxygen will hide all +# undocumented classes that are normally visible in the class hierarchy. If set +# to NO, these classes will be included in the various overviews. This option +# has no effect if EXTRACT_ALL is enabled. +# The default value is: NO. + +HIDE_UNDOC_CLASSES = NO + +# If the HIDE_FRIEND_COMPOUNDS tag is set to YES, doxygen will hide all friend +# (class|struct|union) declarations. If set to NO, these declarations will be +# included in the documentation. +# The default value is: NO. + +HIDE_FRIEND_COMPOUNDS = NO + +# If the HIDE_IN_BODY_DOCS tag is set to YES, doxygen will hide any +# documentation blocks found inside the body of a function. If set to NO, these +# blocks will be appended to the function's detailed documentation block. +# The default value is: NO. + +HIDE_IN_BODY_DOCS = NO + +# The INTERNAL_DOCS tag determines if documentation that is typed after a +# \internal command is included. If the tag is set to NO then the documentation +# will be excluded. Set it to YES to include the internal documentation. +# The default value is: NO. + +INTERNAL_DOCS = NO + +# If the CASE_SENSE_NAMES tag is set to NO then doxygen will only generate file +# names in lower-case letters. If set to YES, upper-case letters are also +# allowed. This is useful if you have classes or files whose names only differ +# in case and if your file system supports case sensitive file names. Windows +# and Mac users are advised to set this option to NO. +# The default value is: system dependent. + +CASE_SENSE_NAMES = YES + +# If the HIDE_SCOPE_NAMES tag is set to NO then doxygen will show members with +# their full class and namespace scopes in the documentation. If set to YES, the +# scope will be hidden. +# The default value is: NO. + +HIDE_SCOPE_NAMES = NO + +# If the HIDE_COMPOUND_REFERENCE tag is set to NO (default) then doxygen will +# append additional text to a page's title, such as Class Reference. If set to +# YES the compound reference will be hidden. +# The default value is: NO. + +HIDE_COMPOUND_REFERENCE= NO + +# If the SHOW_INCLUDE_FILES tag is set to YES then doxygen will put a list of +# the files that are included by a file in the documentation of that file. +# The default value is: YES. + +SHOW_INCLUDE_FILES = YES + +# If the SHOW_GROUPED_MEMB_INC tag is set to YES then Doxygen will add for each +# grouped member an include statement to the documentation, telling the reader +# which file to include in order to use the member. +# The default value is: NO. + +SHOW_GROUPED_MEMB_INC = NO + +# If the FORCE_LOCAL_INCLUDES tag is set to YES then doxygen will list include +# files with double quotes in the documentation rather than with sharp brackets. +# The default value is: NO. + +FORCE_LOCAL_INCLUDES = NO + +# If the INLINE_INFO tag is set to YES then a tag [inline] is inserted in the +# documentation for inline members. +# The default value is: YES. + +INLINE_INFO = YES + +# If the SORT_MEMBER_DOCS tag is set to YES then doxygen will sort the +# (detailed) documentation of file and class members alphabetically by member +# name. If set to NO, the members will appear in declaration order. +# The default value is: YES. + +SORT_MEMBER_DOCS = YES + +# If the SORT_BRIEF_DOCS tag is set to YES then doxygen will sort the brief +# descriptions of file, namespace and class members alphabetically by member +# name. If set to NO, the members will appear in declaration order. Note that +# this will also influence the order of the classes in the class list. +# The default value is: NO. + +SORT_BRIEF_DOCS = NO + +# If the SORT_MEMBERS_CTORS_1ST tag is set to YES then doxygen will sort the +# (brief and detailed) documentation of class members so that constructors and +# destructors are listed first. If set to NO the constructors will appear in the +# respective orders defined by SORT_BRIEF_DOCS and SORT_MEMBER_DOCS. +# Note: If SORT_BRIEF_DOCS is set to NO this option is ignored for sorting brief +# member documentation. +# Note: If SORT_MEMBER_DOCS is set to NO this option is ignored for sorting +# detailed member documentation. +# The default value is: NO. + +SORT_MEMBERS_CTORS_1ST = NO + +# If the SORT_GROUP_NAMES tag is set to YES then doxygen will sort the hierarchy +# of group names into alphabetical order. If set to NO the group names will +# appear in their defined order. +# The default value is: NO. + +SORT_GROUP_NAMES = NO + +# If the SORT_BY_SCOPE_NAME tag is set to YES, the class list will be sorted by +# fully-qualified names, including namespaces. If set to NO, the class list will +# be sorted only by class name, not including the namespace part. +# Note: This option is not very useful if HIDE_SCOPE_NAMES is set to YES. +# Note: This option applies only to the class list, not to the alphabetical +# list. +# The default value is: NO. + +SORT_BY_SCOPE_NAME = NO + +# If the STRICT_PROTO_MATCHING option is enabled and doxygen fails to do proper +# type resolution of all parameters of a function it will reject a match between +# the prototype and the implementation of a member function even if there is +# only one candidate or it is obvious which candidate to choose by doing a +# simple string match. By disabling STRICT_PROTO_MATCHING doxygen will still +# accept a match between prototype and implementation in such cases. +# The default value is: NO. + +STRICT_PROTO_MATCHING = NO + +# The GENERATE_TODOLIST tag can be used to enable (YES) or disable (NO) the todo +# list. This list is created by putting \todo commands in the documentation. +# The default value is: YES. + +GENERATE_TODOLIST = YES + +# The GENERATE_TESTLIST tag can be used to enable (YES) or disable (NO) the test +# list. This list is created by putting \test commands in the documentation. +# The default value is: YES. + +GENERATE_TESTLIST = YES + +# The GENERATE_BUGLIST tag can be used to enable (YES) or disable (NO) the bug +# list. This list is created by putting \bug commands in the documentation. +# The default value is: YES. + +GENERATE_BUGLIST = YES + +# The GENERATE_DEPRECATEDLIST tag can be used to enable (YES) or disable (NO) +# the deprecated list. This list is created by putting \deprecated commands in +# the documentation. +# The default value is: YES. + +GENERATE_DEPRECATEDLIST= YES + +# The ENABLED_SECTIONS tag can be used to enable conditional documentation +# sections, marked by \if ... \endif and \cond +# ... \endcond blocks. + +ENABLED_SECTIONS = + +# The MAX_INITIALIZER_LINES tag determines the maximum number of lines that the +# initial value of a variable or macro / define can have for it to appear in the +# documentation. If the initializer consists of more lines than specified here +# it will be hidden. Use a value of 0 to hide initializers completely. The +# appearance of the value of individual variables and macros / defines can be +# controlled using \showinitializer or \hideinitializer command in the +# documentation regardless of this setting. +# Minimum value: 0, maximum value: 10000, default value: 30. + +MAX_INITIALIZER_LINES = 30 + +# Set the SHOW_USED_FILES tag to NO to disable the list of files generated at +# the bottom of the documentation of classes and structs. If set to YES, the +# list will mention the files that were used to generate the documentation. +# The default value is: YES. + +SHOW_USED_FILES = YES + +# Set the SHOW_FILES tag to NO to disable the generation of the Files page. This +# will remove the Files entry from the Quick Index and from the Folder Tree View +# (if specified). +# The default value is: YES. + +SHOW_FILES = YES + +# Set the SHOW_NAMESPACES tag to NO to disable the generation of the Namespaces +# page. This will remove the Namespaces entry from the Quick Index and from the +# Folder Tree View (if specified). +# The default value is: YES. + +SHOW_NAMESPACES = YES + +# The FILE_VERSION_FILTER tag can be used to specify a program or script that +# doxygen should invoke to get the current version for each file (typically from +# the version control system). Doxygen will invoke the program by executing (via +# popen()) the command command input-file, where command is the value of the +# FILE_VERSION_FILTER tag, and input-file is the name of an input file provided +# by doxygen. Whatever the program writes to standard output is used as the file +# version. For an example see the documentation. + +FILE_VERSION_FILTER = + +# The LAYOUT_FILE tag can be used to specify a layout file which will be parsed +# by doxygen. The layout file controls the global structure of the generated +# output files in an output format independent way. To create the layout file +# that represents doxygen's defaults, run doxygen with the -l option. You can +# optionally specify a file name after the option, if omitted DoxygenLayout.xml +# will be used as the name of the layout file. +# +# Note that if you run doxygen from a directory containing a file called +# DoxygenLayout.xml, doxygen will parse it automatically even if the LAYOUT_FILE +# tag is left empty. + +LAYOUT_FILE = + +# The CITE_BIB_FILES tag can be used to specify one or more bib files containing +# the reference definitions. This must be a list of .bib files. The .bib +# extension is automatically appended if omitted. This requires the bibtex tool +# to be installed. See also http://en.wikipedia.org/wiki/BibTeX for more info. +# For LaTeX the style of the bibliography can be controlled using +# LATEX_BIB_STYLE. To use this feature you need bibtex and perl available in the +# search path. See also \cite for info how to create references. + +CITE_BIB_FILES = + +#--------------------------------------------------------------------------- +# Configuration options related to warning and progress messages +#--------------------------------------------------------------------------- + +# The QUIET tag can be used to turn on/off the messages that are generated to +# standard output by doxygen. If QUIET is set to YES this implies that the +# messages are off. +# The default value is: NO. + +QUIET = NO + +# The WARNINGS tag can be used to turn on/off the warning messages that are +# generated to standard error (stderr) by doxygen. If WARNINGS is set to YES +# this implies that the warnings are on. +# +# Tip: Turn warnings on while writing the documentation. +# The default value is: YES. + +WARNINGS = YES + +# If the WARN_IF_UNDOCUMENTED tag is set to YES then doxygen will generate +# warnings for undocumented members. If EXTRACT_ALL is set to YES then this flag +# will automatically be disabled. +# The default value is: YES. + +WARN_IF_UNDOCUMENTED = YES + +# If the WARN_IF_DOC_ERROR tag is set to YES, doxygen will generate warnings for +# potential errors in the documentation, such as not documenting some parameters +# in a documented function, or documenting parameters that don't exist or using +# markup commands wrongly. +# The default value is: YES. + +WARN_IF_DOC_ERROR = YES + +# This WARN_NO_PARAMDOC option can be enabled to get warnings for functions that +# are documented, but have no documentation for their parameters or return +# value. If set to NO, doxygen will only warn about wrong or incomplete +# parameter documentation, but not about the absence of documentation. +# The default value is: NO. + +WARN_NO_PARAMDOC = NO + +# If the WARN_AS_ERROR tag is set to YES then doxygen will immediately stop when +# a warning is encountered. +# The default value is: NO. + +WARN_AS_ERROR = NO + +# The WARN_FORMAT tag determines the format of the warning messages that doxygen +# can produce. The string should contain the $file, $line, and $text tags, which +# will be replaced by the file and line number from which the warning originated +# and the warning text. Optionally the format may contain $version, which will +# be replaced by the version of the file (if it could be obtained via +# FILE_VERSION_FILTER) +# The default value is: $file:$line: $text. + +WARN_FORMAT = "$file:$line: $text" + +# The WARN_LOGFILE tag can be used to specify a file to which warning and error +# messages should be written. If left blank the output is written to standard +# error (stderr). + +WARN_LOGFILE = + +#--------------------------------------------------------------------------- +# Configuration options related to the input files +#--------------------------------------------------------------------------- + +# The INPUT tag is used to specify the files and/or directories that contain +# documented source files. You may enter file names like myfile.cpp or +# directories like /usr/src/myproject. Separate the files or directories with +# spaces. See also FILE_PATTERNS and EXTENSION_MAPPING +# Note: If this tag is empty the current directory is searched. + +INPUT = "@TOP_SRCDIR@/include" "@TOP_SRCDIR@/src" + +# This tag can be used to specify the character encoding of the source files +# that doxygen parses. Internally doxygen uses the UTF-8 encoding. Doxygen uses +# libiconv (or the iconv built into libc) for the transcoding. See the libiconv +# documentation (see: http://www.gnu.org/software/libiconv) for the list of +# possible encodings. +# The default value is: UTF-8. + +INPUT_ENCODING = UTF-8 + +# If the value of the INPUT tag contains directories, you can use the +# FILE_PATTERNS tag to specify one or more wildcard patterns (like *.cpp and +# *.h) to filter out the source-files in the directories. +# +# Note that for custom extensions or not directly supported extensions you also +# need to set EXTENSION_MAPPING for the extension otherwise the files are not +# read by doxygen. +# +# If left blank the following patterns are tested:*.c, *.cc, *.cxx, *.cpp, +# *.c++, *.java, *.ii, *.ixx, *.ipp, *.i++, *.inl, *.idl, *.ddl, *.odl, *.h, +# *.hh, *.hxx, *.hpp, *.h++, *.cs, *.d, *.php, *.php4, *.php5, *.phtml, *.inc, +# *.m, *.markdown, *.md, *.mm, *.dox, *.py, *.pyw, *.f90, *.f95, *.f03, *.f08, +# *.f, *.for, *.tcl, *.vhd, *.vhdl, *.ucf and *.qsf. + +FILE_PATTERNS = *.c \ + *.cc \ + *.cxx \ + *.cpp \ + *.c++ \ + *.java \ + *.ii \ + *.ixx \ + *.ipp \ + *.i++ \ + *.inl \ + *.idl \ + *.ddl \ + *.odl \ + *.h \ + *.hh \ + *.hxx \ + *.hpp \ + *.h++ \ + *.cs \ + *.d \ + *.php \ + *.php4 \ + *.php5 \ + *.phtml \ + *.inc \ + *.m \ + *.markdown \ + *.md \ + *.mm \ + *.dox \ + *.py \ + *.pyw \ + *.f90 \ + *.f95 \ + *.f03 \ + *.f08 \ + *.f \ + *.for \ + *.tcl \ + *.vhd \ + *.vhdl \ + *.ucf \ + *.qsf + +# The RECURSIVE tag can be used to specify whether or not subdirectories should +# be searched for input files as well. +# The default value is: NO. + +RECURSIVE = NO + +# The EXCLUDE tag can be used to specify files and/or directories that should be +# excluded from the INPUT source files. This way you can easily exclude a +# subdirectory from a directory tree whose root is specified with the INPUT tag. +# +# Note that relative paths are relative to the directory from which doxygen is +# run. + +EXCLUDE = + +# The EXCLUDE_SYMLINKS tag can be used to select whether or not files or +# directories that are symbolic links (a Unix file system feature) are excluded +# from the input. +# The default value is: NO. + +EXCLUDE_SYMLINKS = NO + +# If the value of the INPUT tag contains directories, you can use the +# EXCLUDE_PATTERNS tag to specify one or more wildcard patterns to exclude +# certain files from those directories. +# +# Note that the wildcards are matched against the file with absolute path, so to +# exclude all test directories for example use the pattern */test/* + +EXCLUDE_PATTERNS = + +# The EXCLUDE_SYMBOLS tag can be used to specify one or more symbol names +# (namespaces, classes, functions, etc.) that should be excluded from the +# output. The symbol name can be a fully qualified name, a word, or if the +# wildcard * is used, a substring. Examples: ANamespace, AClass, +# AClass::ANamespace, ANamespace::*Test +# +# Note that the wildcards are matched against the file with absolute path, so to +# exclude all test directories use the pattern */test/* + +EXCLUDE_SYMBOLS = + +# The EXAMPLE_PATH tag can be used to specify one or more files or directories +# that contain example code fragments that are included (see the \include +# command). + +EXAMPLE_PATH = + +# If the value of the EXAMPLE_PATH tag contains directories, you can use the +# EXAMPLE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp and +# *.h) to filter out the source-files in the directories. If left blank all +# files are included. + +EXAMPLE_PATTERNS = * + +# If the EXAMPLE_RECURSIVE tag is set to YES then subdirectories will be +# searched for input files to be used with the \include or \dontinclude commands +# irrespective of the value of the RECURSIVE tag. +# The default value is: NO. + +EXAMPLE_RECURSIVE = NO + +# The IMAGE_PATH tag can be used to specify one or more files or directories +# that contain images that are to be included in the documentation (see the +# \image command). + +IMAGE_PATH = + +# The INPUT_FILTER tag can be used to specify a program that doxygen should +# invoke to filter for each input file. Doxygen will invoke the filter program +# by executing (via popen()) the command: +# +# +# +# where is the value of the INPUT_FILTER tag, and is the +# name of an input file. Doxygen will then use the output that the filter +# program writes to standard output. If FILTER_PATTERNS is specified, this tag +# will be ignored. +# +# Note that the filter must not add or remove lines; it is applied before the +# code is scanned, but not when the output code is generated. If lines are added +# or removed, the anchors will not be placed correctly. +# +# Note that for custom extensions or not directly supported extensions you also +# need to set EXTENSION_MAPPING for the extension otherwise the files are not +# properly processed by doxygen. + +INPUT_FILTER = + +# The FILTER_PATTERNS tag can be used to specify filters on a per file pattern +# basis. Doxygen will compare the file name with each pattern and apply the +# filter if there is a match. The filters are a list of the form: pattern=filter +# (like *.cpp=my_cpp_filter). See INPUT_FILTER for further information on how +# filters are used. If the FILTER_PATTERNS tag is empty or if none of the +# patterns match the file name, INPUT_FILTER is applied. +# +# Note that for custom extensions or not directly supported extensions you also +# need to set EXTENSION_MAPPING for the extension otherwise the files are not +# properly processed by doxygen. + +FILTER_PATTERNS = + +# If the FILTER_SOURCE_FILES tag is set to YES, the input filter (if set using +# INPUT_FILTER) will also be used to filter the input files that are used for +# producing the source files to browse (i.e. when SOURCE_BROWSER is set to YES). +# The default value is: NO. + +FILTER_SOURCE_FILES = NO + +# The FILTER_SOURCE_PATTERNS tag can be used to specify source filters per file +# pattern. A pattern will override the setting for FILTER_PATTERN (if any) and +# it is also possible to disable source filtering for a specific pattern using +# *.ext= (so without naming a filter). +# This tag requires that the tag FILTER_SOURCE_FILES is set to YES. + +FILTER_SOURCE_PATTERNS = + +# If the USE_MDFILE_AS_MAINPAGE tag refers to the name of a markdown file that +# is part of the input, its contents will be placed on the main page +# (index.html). This can be useful if you have a project on for instance GitHub +# and want to reuse the introduction page also for the doxygen output. + +USE_MDFILE_AS_MAINPAGE = + +#--------------------------------------------------------------------------- +# Configuration options related to source browsing +#--------------------------------------------------------------------------- + +# If the SOURCE_BROWSER tag is set to YES then a list of source files will be +# generated. Documented entities will be cross-referenced with these sources. +# +# Note: To get rid of all source code in the generated output, make sure that +# also VERBATIM_HEADERS is set to NO. +# The default value is: NO. + +SOURCE_BROWSER = NO + +# Setting the INLINE_SOURCES tag to YES will include the body of functions, +# classes and enums directly into the documentation. +# The default value is: NO. + +INLINE_SOURCES = NO + +# Setting the STRIP_CODE_COMMENTS tag to YES will instruct doxygen to hide any +# special comment blocks from generated source code fragments. Normal C, C++ and +# Fortran comments will always remain visible. +# The default value is: YES. + +STRIP_CODE_COMMENTS = YES + +# If the REFERENCED_BY_RELATION tag is set to YES then for each documented +# function all documented functions referencing it will be listed. +# The default value is: NO. + +REFERENCED_BY_RELATION = NO + +# If the REFERENCES_RELATION tag is set to YES then for each documented function +# all documented entities called/used by that function will be listed. +# The default value is: NO. + +REFERENCES_RELATION = NO + +# If the REFERENCES_LINK_SOURCE tag is set to YES and SOURCE_BROWSER tag is set +# to YES then the hyperlinks from functions in REFERENCES_RELATION and +# REFERENCED_BY_RELATION lists will link to the source code. Otherwise they will +# link to the documentation. +# The default value is: YES. + +REFERENCES_LINK_SOURCE = YES + +# If SOURCE_TOOLTIPS is enabled (the default) then hovering a hyperlink in the +# source code will show a tooltip with additional information such as prototype, +# brief description and links to the definition and documentation. Since this +# will make the HTML file larger and loading of large files a bit slower, you +# can opt to disable this feature. +# The default value is: YES. +# This tag requires that the tag SOURCE_BROWSER is set to YES. + +SOURCE_TOOLTIPS = YES + +# If the USE_HTAGS tag is set to YES then the references to source code will +# point to the HTML generated by the htags(1) tool instead of doxygen built-in +# source browser. The htags tool is part of GNU's global source tagging system +# (see http://www.gnu.org/software/global/global.html). You will need version +# 4.8.6 or higher. +# +# To use it do the following: +# - Install the latest version of global +# - Enable SOURCE_BROWSER and USE_HTAGS in the config file +# - Make sure the INPUT points to the root of the source tree +# - Run doxygen as normal +# +# Doxygen will invoke htags (and that will in turn invoke gtags), so these +# tools must be available from the command line (i.e. in the search path). +# +# The result: instead of the source browser generated by doxygen, the links to +# source code will now point to the output of htags. +# The default value is: NO. +# This tag requires that the tag SOURCE_BROWSER is set to YES. + +USE_HTAGS = NO + +# If the VERBATIM_HEADERS tag is set the YES then doxygen will generate a +# verbatim copy of the header file for each class for which an include is +# specified. Set to NO to disable this. +# See also: Section \class. +# The default value is: YES. + +VERBATIM_HEADERS = YES + +#--------------------------------------------------------------------------- +# Configuration options related to the alphabetical class index +#--------------------------------------------------------------------------- + +# If the ALPHABETICAL_INDEX tag is set to YES, an alphabetical index of all +# compounds will be generated. Enable this if the project contains a lot of +# classes, structs, unions or interfaces. +# The default value is: YES. + +ALPHABETICAL_INDEX = YES + +# The COLS_IN_ALPHA_INDEX tag can be used to specify the number of columns in +# which the alphabetical index list will be split. +# Minimum value: 1, maximum value: 20, default value: 5. +# This tag requires that the tag ALPHABETICAL_INDEX is set to YES. + +COLS_IN_ALPHA_INDEX = 5 + +# In case all classes in a project start with a common prefix, all classes will +# be put under the same header in the alphabetical index. The IGNORE_PREFIX tag +# can be used to specify a prefix (or a list of prefixes) that should be ignored +# while generating the index headers. +# This tag requires that the tag ALPHABETICAL_INDEX is set to YES. + +IGNORE_PREFIX = + +#--------------------------------------------------------------------------- +# Configuration options related to the HTML output +#--------------------------------------------------------------------------- + +# If the GENERATE_HTML tag is set to YES, doxygen will generate HTML output +# The default value is: YES. + +GENERATE_HTML = YES + +# The HTML_OUTPUT tag is used to specify where the HTML docs will be put. If a +# relative path is entered the value of OUTPUT_DIRECTORY will be put in front of +# it. +# The default directory is: html. +# This tag requires that the tag GENERATE_HTML is set to YES. + +HTML_OUTPUT = html + +# The HTML_FILE_EXTENSION tag can be used to specify the file extension for each +# generated HTML page (for example: .htm, .php, .asp). +# The default value is: .html. +# This tag requires that the tag GENERATE_HTML is set to YES. + +HTML_FILE_EXTENSION = .html + +# The HTML_HEADER tag can be used to specify a user-defined HTML header file for +# each generated HTML page. If the tag is left blank doxygen will generate a +# standard header. +# +# To get valid HTML the header file that includes any scripts and style sheets +# that doxygen needs, which is dependent on the configuration options used (e.g. +# the setting GENERATE_TREEVIEW). It is highly recommended to start with a +# default header using +# doxygen -w html new_header.html new_footer.html new_stylesheet.css +# YourConfigFile +# and then modify the file new_header.html. See also section "Doxygen usage" +# for information on how to generate the default header that doxygen normally +# uses. +# Note: The header is subject to change so you typically have to regenerate the +# default header when upgrading to a newer version of doxygen. For a description +# of the possible markers and block names see the documentation. +# This tag requires that the tag GENERATE_HTML is set to YES. + +HTML_HEADER = + +# The HTML_FOOTER tag can be used to specify a user-defined HTML footer for each +# generated HTML page. If the tag is left blank doxygen will generate a standard +# footer. See HTML_HEADER for more information on how to generate a default +# footer and what special commands can be used inside the footer. See also +# section "Doxygen usage" for information on how to generate the default footer +# that doxygen normally uses. +# This tag requires that the tag GENERATE_HTML is set to YES. + +HTML_FOOTER = + +# The HTML_STYLESHEET tag can be used to specify a user-defined cascading style +# sheet that is used by each HTML page. It can be used to fine-tune the look of +# the HTML output. If left blank doxygen will generate a default style sheet. +# See also section "Doxygen usage" for information on how to generate the style +# sheet that doxygen normally uses. +# Note: It is recommended to use HTML_EXTRA_STYLESHEET instead of this tag, as +# it is more robust and this tag (HTML_STYLESHEET) will in the future become +# obsolete. +# This tag requires that the tag GENERATE_HTML is set to YES. + +HTML_STYLESHEET = + +# The HTML_EXTRA_STYLESHEET tag can be used to specify additional user-defined +# cascading style sheets that are included after the standard style sheets +# created by doxygen. Using this option one can overrule certain style aspects. +# This is preferred over using HTML_STYLESHEET since it does not replace the +# standard style sheet and is therefore more robust against future updates. +# Doxygen will copy the style sheet files to the output directory. +# Note: The order of the extra style sheet files is of importance (e.g. the last +# style sheet in the list overrules the setting of the previous ones in the +# list). For an example see the documentation. +# This tag requires that the tag GENERATE_HTML is set to YES. + +HTML_EXTRA_STYLESHEET = + +# The HTML_EXTRA_FILES tag can be used to specify one or more extra images or +# other source files which should be copied to the HTML output directory. Note +# that these files will be copied to the base HTML output directory. Use the +# $relpath^ marker in the HTML_HEADER and/or HTML_FOOTER files to load these +# files. In the HTML_STYLESHEET file, use the file name only. Also note that the +# files will be copied as-is; there are no commands or markers available. +# This tag requires that the tag GENERATE_HTML is set to YES. + +HTML_EXTRA_FILES = + +# The HTML_COLORSTYLE_HUE tag controls the color of the HTML output. Doxygen +# will adjust the colors in the style sheet and background images according to +# this color. Hue is specified as an angle on a colorwheel, see +# http://en.wikipedia.org/wiki/Hue for more information. For instance the value +# 0 represents red, 60 is yellow, 120 is green, 180 is cyan, 240 is blue, 300 +# purple, and 360 is red again. +# Minimum value: 0, maximum value: 359, default value: 220. +# This tag requires that the tag GENERATE_HTML is set to YES. + +HTML_COLORSTYLE_HUE = 220 + +# The HTML_COLORSTYLE_SAT tag controls the purity (or saturation) of the colors +# in the HTML output. For a value of 0 the output will use grayscales only. A +# value of 255 will produce the most vivid colors. +# Minimum value: 0, maximum value: 255, default value: 100. +# This tag requires that the tag GENERATE_HTML is set to YES. + +HTML_COLORSTYLE_SAT = 100 + +# The HTML_COLORSTYLE_GAMMA tag controls the gamma correction applied to the +# luminance component of the colors in the HTML output. Values below 100 +# gradually make the output lighter, whereas values above 100 make the output +# darker. The value divided by 100 is the actual gamma applied, so 80 represents +# a gamma of 0.8, The value 220 represents a gamma of 2.2, and 100 does not +# change the gamma. +# Minimum value: 40, maximum value: 240, default value: 80. +# This tag requires that the tag GENERATE_HTML is set to YES. + +HTML_COLORSTYLE_GAMMA = 80 + +# If the HTML_TIMESTAMP tag is set to YES then the footer of each generated HTML +# page will contain the date and time when the page was generated. Setting this +# to YES can help to show when doxygen was last run and thus if the +# documentation is up to date. +# The default value is: NO. +# This tag requires that the tag GENERATE_HTML is set to YES. + +HTML_TIMESTAMP = NO + +# If the HTML_DYNAMIC_SECTIONS tag is set to YES then the generated HTML +# documentation will contain sections that can be hidden and shown after the +# page has loaded. +# The default value is: NO. +# This tag requires that the tag GENERATE_HTML is set to YES. + +HTML_DYNAMIC_SECTIONS = NO + +# With HTML_INDEX_NUM_ENTRIES one can control the preferred number of entries +# shown in the various tree structured indices initially; the user can expand +# and collapse entries dynamically later on. Doxygen will expand the tree to +# such a level that at most the specified number of entries are visible (unless +# a fully collapsed tree already exceeds this amount). So setting the number of +# entries 1 will produce a full collapsed tree by default. 0 is a special value +# representing an infinite number of entries and will result in a full expanded +# tree by default. +# Minimum value: 0, maximum value: 9999, default value: 100. +# This tag requires that the tag GENERATE_HTML is set to YES. + +HTML_INDEX_NUM_ENTRIES = 100 + +# If the GENERATE_DOCSET tag is set to YES, additional index files will be +# generated that can be used as input for Apple's Xcode 3 integrated development +# environment (see: http://developer.apple.com/tools/xcode/), introduced with +# OSX 10.5 (Leopard). To create a documentation set, doxygen will generate a +# Makefile in the HTML output directory. Running make will produce the docset in +# that directory and running make install will install the docset in +# ~/Library/Developer/Shared/Documentation/DocSets so that Xcode will find it at +# startup. See http://developer.apple.com/tools/creatingdocsetswithdoxygen.html +# for more information. +# The default value is: NO. +# This tag requires that the tag GENERATE_HTML is set to YES. + +GENERATE_DOCSET = NO + +# This tag determines the name of the docset feed. A documentation feed provides +# an umbrella under which multiple documentation sets from a single provider +# (such as a company or product suite) can be grouped. +# The default value is: Doxygen generated docs. +# This tag requires that the tag GENERATE_DOCSET is set to YES. + +DOCSET_FEEDNAME = "Doxygen generated docs" + +# This tag specifies a string that should uniquely identify the documentation +# set bundle. This should be a reverse domain-name style string, e.g. +# com.mycompany.MyDocSet. Doxygen will append .docset to the name. +# The default value is: org.doxygen.Project. +# This tag requires that the tag GENERATE_DOCSET is set to YES. + +DOCSET_BUNDLE_ID = org.doxygen.Project + +# The DOCSET_PUBLISHER_ID tag specifies a string that should uniquely identify +# the documentation publisher. This should be a reverse domain-name style +# string, e.g. com.mycompany.MyDocSet.documentation. +# The default value is: org.doxygen.Publisher. +# This tag requires that the tag GENERATE_DOCSET is set to YES. + +DOCSET_PUBLISHER_ID = org.doxygen.Publisher + +# The DOCSET_PUBLISHER_NAME tag identifies the documentation publisher. +# The default value is: Publisher. +# This tag requires that the tag GENERATE_DOCSET is set to YES. + +DOCSET_PUBLISHER_NAME = Publisher + +# If the GENERATE_HTMLHELP tag is set to YES then doxygen generates three +# additional HTML index files: index.hhp, index.hhc, and index.hhk. The +# index.hhp is a project file that can be read by Microsoft's HTML Help Workshop +# (see: http://www.microsoft.com/en-us/download/details.aspx?id=21138) on +# Windows. +# +# The HTML Help Workshop contains a compiler that can convert all HTML output +# generated by doxygen into a single compiled HTML file (.chm). Compiled HTML +# files are now used as the Windows 98 help format, and will replace the old +# Windows help format (.hlp) on all Windows platforms in the future. Compressed +# HTML files also contain an index, a table of contents, and you can search for +# words in the documentation. The HTML workshop also contains a viewer for +# compressed HTML files. +# The default value is: NO. +# This tag requires that the tag GENERATE_HTML is set to YES. + +GENERATE_HTMLHELP = NO + +# The CHM_FILE tag can be used to specify the file name of the resulting .chm +# file. You can add a path in front of the file if the result should not be +# written to the html output directory. +# This tag requires that the tag GENERATE_HTMLHELP is set to YES. + +CHM_FILE = + +# The HHC_LOCATION tag can be used to specify the location (absolute path +# including file name) of the HTML help compiler (hhc.exe). If non-empty, +# doxygen will try to run the HTML help compiler on the generated index.hhp. +# The file has to be specified with full path. +# This tag requires that the tag GENERATE_HTMLHELP is set to YES. + +HHC_LOCATION = + +# The GENERATE_CHI flag controls if a separate .chi index file is generated +# (YES) or that it should be included in the master .chm file (NO). +# The default value is: NO. +# This tag requires that the tag GENERATE_HTMLHELP is set to YES. + +GENERATE_CHI = NO + +# The CHM_INDEX_ENCODING is used to encode HtmlHelp index (hhk), content (hhc) +# and project file content. +# This tag requires that the tag GENERATE_HTMLHELP is set to YES. + +CHM_INDEX_ENCODING = + +# The BINARY_TOC flag controls whether a binary table of contents is generated +# (YES) or a normal table of contents (NO) in the .chm file. Furthermore it +# enables the Previous and Next buttons. +# The default value is: NO. +# This tag requires that the tag GENERATE_HTMLHELP is set to YES. + +BINARY_TOC = NO + +# The TOC_EXPAND flag can be set to YES to add extra items for group members to +# the table of contents of the HTML help documentation and to the tree view. +# The default value is: NO. +# This tag requires that the tag GENERATE_HTMLHELP is set to YES. + +TOC_EXPAND = NO + +# If the GENERATE_QHP tag is set to YES and both QHP_NAMESPACE and +# QHP_VIRTUAL_FOLDER are set, an additional index file will be generated that +# can be used as input for Qt's qhelpgenerator to generate a Qt Compressed Help +# (.qch) of the generated HTML documentation. +# The default value is: NO. +# This tag requires that the tag GENERATE_HTML is set to YES. + +GENERATE_QHP = NO + +# If the QHG_LOCATION tag is specified, the QCH_FILE tag can be used to specify +# the file name of the resulting .qch file. The path specified is relative to +# the HTML output folder. +# This tag requires that the tag GENERATE_QHP is set to YES. + +QCH_FILE = + +# The QHP_NAMESPACE tag specifies the namespace to use when generating Qt Help +# Project output. For more information please see Qt Help Project / Namespace +# (see: http://qt-project.org/doc/qt-4.8/qthelpproject.html#namespace). +# The default value is: org.doxygen.Project. +# This tag requires that the tag GENERATE_QHP is set to YES. + +QHP_NAMESPACE = org.doxygen.Project + +# The QHP_VIRTUAL_FOLDER tag specifies the namespace to use when generating Qt +# Help Project output. For more information please see Qt Help Project / Virtual +# Folders (see: http://qt-project.org/doc/qt-4.8/qthelpproject.html#virtual- +# folders). +# The default value is: doc. +# This tag requires that the tag GENERATE_QHP is set to YES. + +QHP_VIRTUAL_FOLDER = doc + +# If the QHP_CUST_FILTER_NAME tag is set, it specifies the name of a custom +# filter to add. For more information please see Qt Help Project / Custom +# Filters (see: http://qt-project.org/doc/qt-4.8/qthelpproject.html#custom- +# filters). +# This tag requires that the tag GENERATE_QHP is set to YES. + +QHP_CUST_FILTER_NAME = + +# The QHP_CUST_FILTER_ATTRS tag specifies the list of the attributes of the +# custom filter to add. For more information please see Qt Help Project / Custom +# Filters (see: http://qt-project.org/doc/qt-4.8/qthelpproject.html#custom- +# filters). +# This tag requires that the tag GENERATE_QHP is set to YES. + +QHP_CUST_FILTER_ATTRS = + +# The QHP_SECT_FILTER_ATTRS tag specifies the list of the attributes this +# project's filter section matches. Qt Help Project / Filter Attributes (see: +# http://qt-project.org/doc/qt-4.8/qthelpproject.html#filter-attributes). +# This tag requires that the tag GENERATE_QHP is set to YES. + +QHP_SECT_FILTER_ATTRS = + +# The QHG_LOCATION tag can be used to specify the location of Qt's +# qhelpgenerator. If non-empty doxygen will try to run qhelpgenerator on the +# generated .qhp file. +# This tag requires that the tag GENERATE_QHP is set to YES. + +QHG_LOCATION = + +# If the GENERATE_ECLIPSEHELP tag is set to YES, additional index files will be +# generated, together with the HTML files, they form an Eclipse help plugin. To +# install this plugin and make it available under the help contents menu in +# Eclipse, the contents of the directory containing the HTML and XML files needs +# to be copied into the plugins directory of eclipse. The name of the directory +# within the plugins directory should be the same as the ECLIPSE_DOC_ID value. +# After copying Eclipse needs to be restarted before the help appears. +# The default value is: NO. +# This tag requires that the tag GENERATE_HTML is set to YES. + +GENERATE_ECLIPSEHELP = NO + +# A unique identifier for the Eclipse help plugin. When installing the plugin +# the directory name containing the HTML and XML files should also have this +# name. Each documentation set should have its own identifier. +# The default value is: org.doxygen.Project. +# This tag requires that the tag GENERATE_ECLIPSEHELP is set to YES. + +ECLIPSE_DOC_ID = org.doxygen.Project + +# If you want full control over the layout of the generated HTML pages it might +# be necessary to disable the index and replace it with your own. The +# DISABLE_INDEX tag can be used to turn on/off the condensed index (tabs) at top +# of each HTML page. A value of NO enables the index and the value YES disables +# it. Since the tabs in the index contain the same information as the navigation +# tree, you can set this option to YES if you also set GENERATE_TREEVIEW to YES. +# The default value is: NO. +# This tag requires that the tag GENERATE_HTML is set to YES. + +DISABLE_INDEX = NO + +# The GENERATE_TREEVIEW tag is used to specify whether a tree-like index +# structure should be generated to display hierarchical information. If the tag +# value is set to YES, a side panel will be generated containing a tree-like +# index structure (just like the one that is generated for HTML Help). For this +# to work a browser that supports JavaScript, DHTML, CSS and frames is required +# (i.e. any modern browser). Windows users are probably better off using the +# HTML help feature. Via custom style sheets (see HTML_EXTRA_STYLESHEET) one can +# further fine-tune the look of the index. As an example, the default style +# sheet generated by doxygen has an example that shows how to put an image at +# the root of the tree instead of the PROJECT_NAME. Since the tree basically has +# the same information as the tab index, you could consider setting +# DISABLE_INDEX to YES when enabling this option. +# The default value is: NO. +# This tag requires that the tag GENERATE_HTML is set to YES. + +GENERATE_TREEVIEW = NO + +# The ENUM_VALUES_PER_LINE tag can be used to set the number of enum values that +# doxygen will group on one line in the generated HTML documentation. +# +# Note that a value of 0 will completely suppress the enum values from appearing +# in the overview section. +# Minimum value: 0, maximum value: 20, default value: 4. +# This tag requires that the tag GENERATE_HTML is set to YES. + +ENUM_VALUES_PER_LINE = 4 + +# If the treeview is enabled (see GENERATE_TREEVIEW) then this tag can be used +# to set the initial width (in pixels) of the frame in which the tree is shown. +# Minimum value: 0, maximum value: 1500, default value: 250. +# This tag requires that the tag GENERATE_HTML is set to YES. + +TREEVIEW_WIDTH = 250 + +# If the EXT_LINKS_IN_WINDOW option is set to YES, doxygen will open links to +# external symbols imported via tag files in a separate window. +# The default value is: NO. +# This tag requires that the tag GENERATE_HTML is set to YES. + +EXT_LINKS_IN_WINDOW = NO + +# Use this tag to change the font size of LaTeX formulas included as images in +# the HTML documentation. When you change the font size after a successful +# doxygen run you need to manually remove any form_*.png images from the HTML +# output directory to force them to be regenerated. +# Minimum value: 8, maximum value: 50, default value: 10. +# This tag requires that the tag GENERATE_HTML is set to YES. + +FORMULA_FONTSIZE = 10 + +# Use the FORMULA_TRANPARENT tag to determine whether or not the images +# generated for formulas are transparent PNGs. Transparent PNGs are not +# supported properly for IE 6.0, but are supported on all modern browsers. +# +# Note that when changing this option you need to delete any form_*.png files in +# the HTML output directory before the changes have effect. +# The default value is: YES. +# This tag requires that the tag GENERATE_HTML is set to YES. + +FORMULA_TRANSPARENT = YES + +# Enable the USE_MATHJAX option to render LaTeX formulas using MathJax (see +# http://www.mathjax.org) which uses client side Javascript for the rendering +# instead of using pre-rendered bitmaps. Use this if you do not have LaTeX +# installed or if you want to formulas look prettier in the HTML output. When +# enabled you may also need to install MathJax separately and configure the path +# to it using the MATHJAX_RELPATH option. +# The default value is: NO. +# This tag requires that the tag GENERATE_HTML is set to YES. + +USE_MATHJAX = NO + +# When MathJax is enabled you can set the default output format to be used for +# the MathJax output. See the MathJax site (see: +# http://docs.mathjax.org/en/latest/output.html) for more details. +# Possible values are: HTML-CSS (which is slower, but has the best +# compatibility), NativeMML (i.e. MathML) and SVG. +# The default value is: HTML-CSS. +# This tag requires that the tag USE_MATHJAX is set to YES. + +MATHJAX_FORMAT = HTML-CSS + +# When MathJax is enabled you need to specify the location relative to the HTML +# output directory using the MATHJAX_RELPATH option. The destination directory +# should contain the MathJax.js script. For instance, if the mathjax directory +# is located at the same level as the HTML output directory, then +# MATHJAX_RELPATH should be ../mathjax. The default value points to the MathJax +# Content Delivery Network so you can quickly see the result without installing +# MathJax. However, it is strongly recommended to install a local copy of +# MathJax from http://www.mathjax.org before deployment. +# The default value is: http://cdn.mathjax.org/mathjax/latest. +# This tag requires that the tag USE_MATHJAX is set to YES. + +MATHJAX_RELPATH = http://cdn.mathjax.org/mathjax/latest + +# The MATHJAX_EXTENSIONS tag can be used to specify one or more MathJax +# extension names that should be enabled during MathJax rendering. For example +# MATHJAX_EXTENSIONS = TeX/AMSmath TeX/AMSsymbols +# This tag requires that the tag USE_MATHJAX is set to YES. + +MATHJAX_EXTENSIONS = + +# The MATHJAX_CODEFILE tag can be used to specify a file with javascript pieces +# of code that will be used on startup of the MathJax code. See the MathJax site +# (see: http://docs.mathjax.org/en/latest/output.html) for more details. For an +# example see the documentation. +# This tag requires that the tag USE_MATHJAX is set to YES. + +MATHJAX_CODEFILE = + +# When the SEARCHENGINE tag is enabled doxygen will generate a search box for +# the HTML output. The underlying search engine uses javascript and DHTML and +# should work on any modern browser. Note that when using HTML help +# (GENERATE_HTMLHELP), Qt help (GENERATE_QHP), or docsets (GENERATE_DOCSET) +# there is already a search function so this one should typically be disabled. +# For large projects the javascript based search engine can be slow, then +# enabling SERVER_BASED_SEARCH may provide a better solution. It is possible to +# search using the keyboard; to jump to the search box use + S +# (what the is depends on the OS and browser, but it is typically +# , /