diff options
author | John Ericson <git@JohnEricson.me> | 2020-08-03 11:48:27 -0400 |
---|---|---|
committer | John Ericson <git@JohnEricson.me> | 2020-08-03 11:48:27 -0400 |
commit | eaf6343c065842b9719793066e765b2e5f1c2f3b (patch) | |
tree | 1bfeac5297ba489721e704e63c28f33d0fb98990 /test cases | |
parent | 87aa98c1787d800145853a8e84654e4c54ee1078 (diff) | |
parent | 70edf82c6c77902cd64f44848302bbac92d611d8 (diff) | |
download | meson-lang-enum.zip meson-lang-enum.tar.gz meson-lang-enum.tar.bz2 |
Merge remote-tracking branch 'upstream/master' into lang-enumlang-enum
Diffstat (limited to 'test cases')
322 files changed, 2275 insertions, 172 deletions
diff --git a/test cases/cmake/1 basic/subprojects/cmMod/CMakeLists.txt b/test cases/cmake/1 basic/subprojects/cmMod/CMakeLists.txt index 9798209..9c95636 100644 --- a/test cases/cmake/1 basic/subprojects/cmMod/CMakeLists.txt +++ b/test cases/cmake/1 basic/subprojects/cmMod/CMakeLists.txt @@ -8,5 +8,7 @@ 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) 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 index d3141d5..f4cbea0 100644 --- a/test cases/cmake/1 basic/subprojects/cmMod/cmMod.cpp +++ b/test cases/cmake/1 basic/subprojects/cmMod/cmMod.cpp @@ -2,6 +2,10 @@ using namespace std; +#if MESON_MAGIC_FLAG != 21 +#error "Invalid MESON_MAGIC_FLAG (private)" +#endif + cmModClass::cmModClass(string foo) { str = foo + " World"; } diff --git a/test cases/cmake/1 basic/subprojects/cmMod/cmMod.hpp b/test cases/cmake/1 basic/subprojects/cmMod/cmMod.hpp index 0e6dc04..4445e1f 100644 --- a/test cases/cmake/1 basic/subprojects/cmMod/cmMod.hpp +++ b/test cases/cmake/1 basic/subprojects/cmMod/cmMod.hpp @@ -3,6 +3,10 @@ #include "cmmodlib++_export.h" #include <string> +#if MESON_MAGIC_FLAG != 42 && MESON_MAGIC_FLAG != 21 +#error "Invalid MESON_MAGIC_FLAG" +#endif + class CMMODLIB___EXPORT cmModClass { private: std::string str; diff --git a/test cases/cmake/10 header only/main.cpp b/test cases/cmake/10 header only/main.cpp index 9507961..1417881 100644 --- a/test cases/cmake/10 header only/main.cpp +++ b/test cases/cmake/10 header only/main.cpp @@ -3,8 +3,14 @@ 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/subprojects/cmMod/CMakeLists.txt b/test cases/cmake/10 header only/subprojects/cmMod/CMakeLists.txt index f5d9a47..e01b6e2 100644 --- a/test cases/cmake/10 header only/subprojects/cmMod/CMakeLists.txt +++ b/test cases/cmake/10 header only/subprojects/cmMod/CMakeLists.txt @@ -9,3 +9,4 @@ 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 index 7ea72f7..fe01040 100644 --- a/test cases/cmake/10 header only/subprojects/cmMod/include/cmMod.hpp +++ b/test cases/cmake/10 header only/subprojects/cmMod/include/cmMod.hpp @@ -6,6 +6,9 @@ #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; @@ -13,6 +16,8 @@ class cmModClass { 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/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 <iostream> +#include <cmMod.hpp> +#include <cmTest.hpp> + +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 <string> + +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 <iostream> +#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..e2d9c05 --- /dev/null +++ b/test cases/cmake/19 advanced options/test.json @@ -0,0 +1,8 @@ +{ + "installed": [ + {"type": "exe", "file": "usr/bin/cm_testEXE"} + ], + "tools": { + "cmake": ">=3.11" + } +} diff --git a/test cases/cmake/2 advanced/subprojects/cmMod/CMakeLists.txt b/test cases/cmake/2 advanced/subprojects/cmMod/CMakeLists.txt index 50b1049..c9b2a20 100644 --- a/test cases/cmake/2 advanced/subprojects/cmMod/CMakeLists.txt +++ b/test cases/cmake/2 advanced/subprojects/cmMod/CMakeLists.txt @@ -20,7 +20,7 @@ set_target_properties(cmModLib PROPERTIES VERSION 1.0.1) add_executable(testEXE main.cpp) target_link_libraries(cmModLib ZLIB::ZLIB) -target_link_libraries(cmModLibStatic ZLIB::ZLIB) +target_link_libraries(cmModLibStatic ;ZLIB::ZLIB;) target_link_libraries(testEXE cmModLib) target_compile_definitions(cmModLibStatic PUBLIC CMMODLIB_STATIC_DEFINE) diff --git a/test cases/cmake/2 advanced/test.json b/test cases/cmake/2 advanced/test.json index 11aad94..e12f530 100644 --- a/test cases/cmake/2 advanced/test.json +++ b/test cases/cmake/2 advanced/test.json @@ -4,5 +4,8 @@ {"type": "implib", "platform": "cygwin", "file": "usr/lib/libcm_cmModLib"}, {"type": "implib", "platform": "!cygwin", "file": "usr/bin/libcm_cmModLib"}, {"type": "exe", "file": "usr/bin/cm_testEXE"} - ] + ], + "tools": { + "cmake": ">=3.11" + } } 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..758bbee --- /dev/null +++ b/test cases/cmake/20 cmake file/meson.build @@ -0,0 +1,14 @@ +project( + 'cmake config file', +) + +cmake = import('cmake') + +cmake_conf = configuration_data() +cmake_conf.set_quoted('foo', 'bar') +cmake.configure_package_config_file( + name : 'foolib', + input : 'foolib.cmake.in', + install_dir : get_option('libdir') / 'cmake', + configuration : cmake_conf, +) 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/3 advanced no dep/test.json b/test cases/cmake/3 advanced no dep/test.json index 24c89c4..98a1719 100644 --- a/test cases/cmake/3 advanced no dep/test.json +++ b/test cases/cmake/3 advanced no dep/test.json @@ -8,5 +8,8 @@ {"type": "exe", "file": "usr/bin/cm_testEXE"}, {"type": "pdb", "file": "usr/bin/cm_testEXE2"}, {"type": "exe", "file": "usr/bin/cm_testEXE2"} - ] + ], + "tools": { + "cmake": ">=3.11" + } } diff --git a/test cases/cmake/7 cmake options/subprojects/cmOpts/CMakeLists.txt b/test cases/cmake/7 cmake options/subprojects/cmOpts/CMakeLists.txt index 62b5990..873b9b3 100644 --- a/test cases/cmake/7 cmake options/subprojects/cmOpts/CMakeLists.txt +++ b/test cases/cmake/7 cmake options/subprojects/cmOpts/CMakeLists.txt @@ -1,5 +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..046e2ee --- /dev/null +++ b/test cases/cmake/7 cmake options/test.json @@ -0,0 +1,9 @@ +{ + "matrix": { + "options": { + "cmake_prefix_path": [ + { "val": ["val1", "val2"] } + ] + } + } +} diff --git a/test cases/common/102 subproject subdir/meson.build b/test cases/common/102 subproject subdir/meson.build index 8299a37..a891ca9 100644 --- a/test cases/common/102 subproject subdir/meson.build +++ b/test cases/common/102 subproject subdir/meson.build @@ -25,3 +25,32 @@ dependency('sub-novar', fallback : 'sub_novar') # Verify a subproject can force a dependency to be not-found d = dependency('sub-notfound', fallback : 'sub_novar', required : false) assert(not d.found(), 'Dependency should be not-found') + +# Verify that implicit fallback works because subprojects/sub_implicit directory exists +d = dependency('sub_implicit') +assert(d.found(), 'Should implicitly fallback') + +# Verify that implicit fallback works because sub_implicit.wrap has +# `dependency_names=sub_implicit_provide1` and the subproject overrides sub_implicit_provide1. +d = dependency('sub_implicit_provide1') +assert(d.found(), 'Should implicitly fallback') + +# Verify that implicit fallback works because sub_implicit.wrap has +# `sub_implicit_provide2=sub_implicit_provide2_dep` and does not override +# sub_implicit_provide2. +d = dependency('sub_implicit_provide2') +assert(d.found(), 'Should implicitly fallback') + +# sub_implicit.wrap provides glib-2.0 and we already configured that subproject, +# so we must not return the system dependency here. Using glib-2.0 here because +# some CI runners have it installed. +d = dependency('glib-2.0', required : false) +assert(d.found()) +assert(d.type_name() == 'internal') + +# sub_implicit.wrap provides gobject-2.0 and we already configured that subproject, +# so we must not return the system dependency here. But since the subproject did +# not override that dependency and its not required, not-found should be returned. +# Using gobject-2.0 here because some CI runners have it installed. +d = dependency('gobject-2.0', required : false) +assert(not d.found()) diff --git a/test cases/common/102 subproject subdir/subprojects/sub_implicit.wrap b/test cases/common/102 subproject subdir/subprojects/sub_implicit.wrap new file mode 100644 index 0000000..a809c43 --- /dev/null +++ b/test cases/common/102 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/102 subproject subdir/subprojects/sub_implicit/meson.build b/test cases/common/102 subproject subdir/subprojects/sub_implicit/meson.build new file mode 100644 index 0000000..24609ae --- /dev/null +++ b/test cases/common/102 subproject subdir/subprojects/sub_implicit/meson.build @@ -0,0 +1,11 @@ +project('sub_implicit', 'c', version : '1.0') + +dep = declare_dependency() +meson.override_dependency('sub_implicit', dep) +meson.override_dependency('sub_implicit_provide1', dep) + +# This one is not overriden but the wrap file tells the variable name to use. +sub_implicit_provide2_dep = dep + +# This one is not overriden but the wrap file tells the variable name to use. +glib_dep = dep diff --git a/test cases/common/104 postconf with args/meson.build b/test cases/common/104 postconf with args/meson.build index 8510c5b..a34502c 100644 --- a/test cases/common/104 postconf with args/meson.build +++ b/test cases/common/104 postconf with args/meson.build @@ -1,5 +1,10 @@ project('postconf script', 'c') -meson.add_postconf_script('postconf.py', '5', '33') +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/109 generatorcustom/meson.build b/test cases/common/109 generatorcustom/meson.build index 17d27e5..b3f50bb 100644 --- a/test cases/common/109 generatorcustom/meson.build +++ b/test cases/common/109 generatorcustom/meson.build @@ -14,5 +14,7 @@ allinone = custom_target('alltogether', output : 'alltogether.h', command : [catter, '@INPUT@', '@OUTPUT@']) -executable('proggie', 'main.c', allinone) +proggie = executable('proggie', 'main.c', allinone) + +test('proggie', proggie) diff --git a/test cases/common/125 object only target/obj_generator.py b/test cases/common/125 object only target/obj_generator.py index a33872a..afdbc09 100755 --- a/test cases/common/125 object only target/obj_generator.py +++ b/test cases/common/125 object only target/obj_generator.py @@ -13,6 +13,8 @@ if __name__ == '__main__': 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/145 special characters/arg-char-test.c b/test cases/common/145 special characters/arg-char-test.c new file mode 100644 index 0000000..04e02f8 --- /dev/null +++ b/test cases/common/145 special characters/arg-char-test.c @@ -0,0 +1,10 @@ +#include <assert.h> +#include <stdio.h> + +int main(int argc, char **argv) { + char c = CHAR; + assert(argc == 2); + if (c != argv[1][0]) + fprintf(stderr, "Expected %x, got %x\n", (unsigned int) c, (unsigned int) argv[1][0]); + assert(c == argv[1][0]); +} diff --git a/test cases/common/145 special characters/arg-string-test.c b/test cases/common/145 special characters/arg-string-test.c new file mode 100644 index 0000000..199fd79 --- /dev/null +++ b/test cases/common/145 special characters/arg-string-test.c @@ -0,0 +1,12 @@ +#include <assert.h> +#include <stdio.h> +#include <string.h> + +int main(int argc, char **argv) { + const char *s = CHAR; + assert(argc == 2); + assert(strlen(s) == 1); + if (s[0] != argv[1][0]) + fprintf(stderr, "Expected %x, got %x\n", (unsigned int) s[0], (unsigned int) argv[1][0]); + assert(s[0] == argv[1][0]); +} diff --git a/test cases/common/145 special characters/arg-unquoted-test.c b/test cases/common/145 special characters/arg-unquoted-test.c new file mode 100644 index 0000000..7f679ca --- /dev/null +++ b/test cases/common/145 special characters/arg-unquoted-test.c @@ -0,0 +1,17 @@ +#include <assert.h> +#include <stdio.h> +#include <string.h> + +#define Q(x) #x +#define QUOTE(x) Q(x) + +int main(int argc, char **argv) { + const char *s = QUOTE(CHAR); + assert(argc == 2); + assert(strlen(s) == 1); + if (s[0] != argv[1][0]) + fprintf(stderr, "Expected %x, got %x\n", (unsigned int) s[0], (unsigned int) argv[1][0]); + assert(s[0] == argv[1][0]); + // There is no way to convert a macro argument into a character constant. + // Otherwise we'd test that as well +} diff --git a/test cases/common/145 special characters/meson.build b/test cases/common/145 special characters/meson.build index ecba650..579601e 100644 --- a/test cases/common/145 special characters/meson.build +++ b/test cases/common/145 special characters/meson.build @@ -35,3 +35,41 @@ gen2 = custom_target('gen2', 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/157 wrap file should not failed/meson.build b/test cases/common/157 wrap file should not failed/meson.build index f4ec2a8..48d1068 100644 --- a/test cases/common/157 wrap file should not failed/meson.build +++ b/test cases/common/157 wrap file should not failed/meson.build @@ -3,8 +3,14 @@ project('mainproj', 'c', ) subproject('zlib') -subproject('foo') +foo = subproject('foo') +bar = subproject('bar') + +libfoo = foo.get_variable('libfoo') +libbar = bar.get_variable('libbar') executable('grabprog', files('src/subprojects/prog.c')) executable('grabprog2', files('src/subprojects/foo/prog2.c')) subdir('src') + +subproject('patchdir') diff --git a/test cases/common/157 wrap file should not failed/src/meson.build b/test cases/common/157 wrap file should not failed/src/meson.build index 69f666d..0c82165 100644 --- a/test cases/common/157 wrap file should not failed/src/meson.build +++ b/test cases/common/157 wrap file should not failed/src/meson.build @@ -1,2 +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/157 wrap file should not failed/src/test.c b/test cases/common/157 wrap file should not failed/src/test.c new file mode 100644 index 0000000..34cf991 --- /dev/null +++ b/test cases/common/157 wrap file should not failed/src/test.c @@ -0,0 +1,9 @@ +#include <stdio.h> + +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/157 wrap file should not failed/subprojects/.gitignore b/test cases/common/157 wrap file should not failed/subprojects/.gitignore new file mode 100644 index 0000000..5550e2e --- /dev/null +++ b/test cases/common/157 wrap file should not failed/subprojects/.gitignore @@ -0,0 +1,2 @@ +/foo-1.0 +/bar-1.0 diff --git a/test cases/common/157 wrap file should not failed/subprojects/bar.wrap b/test cases/common/157 wrap file should not failed/subprojects/bar.wrap new file mode 100644 index 0000000..4e8f7e3 --- /dev/null +++ b/test cases/common/157 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/157 wrap file should not failed/subprojects/foo-1.0/foo.c b/test cases/common/157 wrap file should not failed/subprojects/foo-1.0/foo.c deleted file mode 100644 index 267b43a..0000000 --- a/test cases/common/157 wrap file should not failed/subprojects/foo-1.0/foo.c +++ /dev/null @@ -1,3 +0,0 @@ -int dummy_func(void) { - return 42; -} diff --git a/test cases/common/157 wrap file should not failed/subprojects/foo-1.0/meson.build b/test cases/common/157 wrap file should not failed/subprojects/foo-1.0/meson.build deleted file mode 100644 index 318e81d..0000000 --- a/test cases/common/157 wrap file should not failed/subprojects/foo-1.0/meson.build +++ /dev/null @@ -1,2 +0,0 @@ -project('shared lib', 'c') -libfoo = shared_library('foo', 'foo.c') diff --git a/test cases/common/157 wrap file should not failed/subprojects/foo.wrap b/test cases/common/157 wrap file should not failed/subprojects/foo.wrap index 90d6d40..c67c5e5 100644 --- a/test cases/common/157 wrap file should not failed/subprojects/foo.wrap +++ b/test cases/common/157 wrap file should not failed/subprojects/foo.wrap @@ -3,9 +3,9 @@ directory = foo-1.0 source_url = http://something.invalid source_filename = foo-1.0.tar.xz -source_hash = ae5fc03185654f76b459db16ca25809703f8821aeb39a433902244bb479c4b79 +source_hash = 9ed8f67d75e43d3be161efb6eddf30dd01995a958ca83951ea64234bac8908c1 lead_directory_missing = true patch_url = https://something.invalid/patch patch_filename = foo-1.0-patch.tar.xz -patch_hash = 8f2e286a4b190228d4e0c25ddc91195449cfb5e5c52006355838964b244037da +patch_hash = d0ddc5e60fdb27d808552f5ac8d0bb603ea2cba306538b4427b985535b26c9c5 diff --git a/test cases/common/157 wrap file should not failed/subprojects/packagecache/foo-1.0-patch.tar.xz b/test cases/common/157 wrap file should not failed/subprojects/packagecache/foo-1.0-patch.tar.xz Binary files differindex 26d2927..e26b8e0 100644 --- a/test cases/common/157 wrap file should not failed/subprojects/packagecache/foo-1.0-patch.tar.xz +++ b/test cases/common/157 wrap file should not failed/subprojects/packagecache/foo-1.0-patch.tar.xz diff --git a/test cases/common/157 wrap file should not failed/subprojects/packagecache/foo-1.0.tar.xz b/test cases/common/157 wrap file should not failed/subprojects/packagecache/foo-1.0.tar.xz Binary files differindex 2647ef9..37eb6cc 100644 --- a/test cases/common/157 wrap file should not failed/subprojects/packagecache/foo-1.0.tar.xz +++ b/test cases/common/157 wrap file should not failed/subprojects/packagecache/foo-1.0.tar.xz diff --git a/test cases/common/157 wrap file should not failed/subprojects/packagefiles/bar-1.0-patch.tar.xz b/test cases/common/157 wrap file should not failed/subprojects/packagefiles/bar-1.0-patch.tar.xz Binary files differnew file mode 100644 index 0000000..f257a19 --- /dev/null +++ b/test cases/common/157 wrap file should not failed/subprojects/packagefiles/bar-1.0-patch.tar.xz diff --git a/test cases/common/157 wrap file should not failed/subprojects/packagefiles/bar-1.0.tar.xz b/test cases/common/157 wrap file should not failed/subprojects/packagefiles/bar-1.0.tar.xz Binary files differnew file mode 100644 index 0000000..d90a9e8 --- /dev/null +++ b/test cases/common/157 wrap file should not failed/subprojects/packagefiles/bar-1.0.tar.xz diff --git a/test cases/common/157 wrap file should not failed/subprojects/packagefiles/foo-1.0/meson.build b/test cases/common/157 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/157 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/157 wrap file should not failed/subprojects/patchdir.wrap b/test cases/common/157 wrap file should not failed/subprojects/patchdir.wrap new file mode 100644 index 0000000..1a2134c --- /dev/null +++ b/test cases/common/157 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/163 disabler/meson.build b/test cases/common/163 disabler/meson.build index 5554f14..d132e2b 100644 --- a/test cases/common/163 disabler/meson.build +++ b/test cases/common/163 disabler/meson.build @@ -9,6 +9,7 @@ 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) @@ -23,12 +24,14 @@ assert(is_disabler(d2), 'Function laundered disabler was not identified correctl 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 @@ -80,6 +83,31 @@ else 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 diff --git a/test cases/common/187 find override/meson.build b/test cases/common/187 find override/meson.build index 3b8af80..b277459 100644 --- a/test cases/common/187 find override/meson.build +++ b/test cases/common/187 find override/meson.build @@ -10,3 +10,6 @@ if not gencodegen.found() endif subdir('otherdir') + +tool = find_program('sometool') +assert(tool.found()) diff --git a/test cases/common/187 find override/subprojects/sub.wrap b/test cases/common/187 find override/subprojects/sub.wrap new file mode 100644 index 0000000..17aa332 --- /dev/null +++ b/test cases/common/187 find override/subprojects/sub.wrap @@ -0,0 +1,5 @@ +[wrap-file] +directory = sub + +[provide] +program_names = sometool diff --git a/test cases/common/187 find override/subprojects/sub/meson.build b/test cases/common/187 find override/subprojects/sub/meson.build new file mode 100644 index 0000000..640f270 --- /dev/null +++ b/test cases/common/187 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/201 override with exe/meson.build b/test cases/common/201 override with exe/meson.build index 81f6c02..62d2f32 100644 --- a/test cases/common/201 override with exe/meson.build +++ b/test cases/common/201 override with exe/meson.build @@ -1,6 +1,10 @@ project('myexe', 'c') sub = subproject('sub') -prog = find_program('foobar') + +prog = find_program('foobar', version : '>= 2.0', required : false) +assert(not prog.found()) + +prog = find_program('foobar', version : '>= 1.0') custom1 = custom_target('custom1', build_by_default : true, input : [], @@ -11,5 +15,7 @@ gen = generator(prog, arguments : ['@OUTPUT@']) custom2 = gen.process('main2.input') +message(prog.full_path()) + executable('e1', custom1) executable('e2', custom2) diff --git a/test cases/common/201 override with exe/subprojects/sub/meson.build b/test cases/common/201 override with exe/subprojects/sub/meson.build index 1f186da..f0343b2 100644 --- a/test cases/common/201 override with exe/subprojects/sub/meson.build +++ b/test cases/common/201 override with exe/subprojects/sub/meson.build @@ -1,3 +1,3 @@ -project('sub', 'c') +project('sub', 'c', version : '1.0') foobar = executable('foobar', 'foobar.c', native : true) meson.override_find_program('foobar', foobar) diff --git a/test cases/common/222 source set realistic example/meson.build b/test cases/common/222 source set realistic example/meson.build index 5b0e495..d986b99 100644 --- a/test cases/common/222 source set realistic example/meson.build +++ b/test cases/common/222 source set realistic example/meson.build @@ -1,4 +1,4 @@ -# a sort-of realistic example that combines the sourceset and kconfig +# 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']) @@ -9,7 +9,7 @@ if cppid == 'pgi' endif ss = import('sourceset') -kconfig = import('unstable-kconfig') +keyval = import('keyval') zlib = declare_dependency(compile_args: '-DZLIB=1') another = declare_dependency(compile_args: '-DANOTHER=1') @@ -39,7 +39,7 @@ targets = [ 'arm', 'aarch64', 'x86' ] target_dirs = { 'arm' : 'arm', 'aarch64' : 'arm', 'x86': 'x86' } foreach x : targets - config = kconfig.load('config' / x) + 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() diff --git a/test cases/common/226 include_type dependency/main.cpp b/test cases/common/226 include_type dependency/main.cpp new file mode 100644 index 0000000..bf8c4a4 --- /dev/null +++ b/test cases/common/226 include_type dependency/main.cpp @@ -0,0 +1,8 @@ +#include <iostream> +#include <boost/graph/filtered_graph.hpp> + +using namespace std; + +int main(void) { + return 0; +} diff --git a/test cases/common/226 include_type dependency/meson.build b/test cases/common/226 include_type dependency/meson.build index fafceaf..d17e920 100644 --- a/test cases/common/226 include_type dependency/meson.build +++ b/test cases/common/226 include_type dependency/meson.build @@ -4,10 +4,16 @@ project( ) 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() @@ -26,3 +32,7 @@ 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') + +# 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/226 include_type dependency/pch/test.hpp b/test cases/common/226 include_type dependency/pch/test.hpp new file mode 100644 index 0000000..0d40fe1 --- /dev/null +++ b/test cases/common/226 include_type dependency/pch/test.hpp @@ -0,0 +1 @@ +#include <boost/graph/filtered_graph.hpp> diff --git a/test cases/common/230 persubproject options/meson.build b/test cases/common/230 persubproject options/meson.build index 20dff90..f76a70c 100644 --- a/test cases/common/230 persubproject options/meson.build +++ b/test cases/common/230 persubproject options/meson.build @@ -1,9 +1,11 @@ project('persubproject options', 'c', default_options : ['default_library=both', - 'werror=true']) + 'werror=true', + 'warning_level=3']) assert(get_option('default_library') == 'both', 'Parent default_library should be "both"') assert(get_option('werror')) +assert(get_option('warning_level') == '3') # Check it build both by calling a method only both_libraries target implement lib = library('lib1', 'foo.c') diff --git a/test cases/common/230 persubproject options/subprojects/sub1/foo.c b/test cases/common/230 persubproject options/subprojects/sub1/foo.c index 63e4de6..82ad2c2 100644 --- a/test cases/common/230 persubproject options/subprojects/sub1/foo.c +++ b/test cases/common/230 persubproject options/subprojects/sub1/foo.c @@ -1,5 +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/230 persubproject options/subprojects/sub1/meson.build b/test cases/common/230 persubproject options/subprojects/sub1/meson.build index 7afc934..4e4bc1b 100644 --- a/test cases/common/230 persubproject options/subprojects/sub1/meson.build +++ b/test cases/common/230 persubproject options/subprojects/sub1/meson.build @@ -1,6 +1,8 @@ -project('sub1', 'c') +project('sub1', 'c', + default_options : ['warning_level=0']) assert(get_option('default_library') == 'both', 'Should inherit parent project default_library') +assert(get_option('warning_level') == '0') # Check it build both by calling a method only both_libraries target implement lib = library('lib1', 'foo.c') diff --git a/test cases/common/232 link language/c_linkage.cpp b/test cases/common/232 link language/c_linkage.cpp new file mode 100644 index 0000000..dc006b9 --- /dev/null +++ b/test cases/common/232 link language/c_linkage.cpp @@ -0,0 +1,5 @@ +extern "C" { + int makeInt(void) { + return 0; + } +} diff --git a/test cases/common/232 link language/c_linkage.h b/test cases/common/232 link language/c_linkage.h new file mode 100644 index 0000000..1609f47 --- /dev/null +++ b/test cases/common/232 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/232 link language/lib.cpp b/test cases/common/232 link language/lib.cpp new file mode 100644 index 0000000..ab43828 --- /dev/null +++ b/test cases/common/232 link language/lib.cpp @@ -0,0 +1,5 @@ +extern "C" { + int makeInt(void) { + return 1; + } +} diff --git a/test cases/common/232 link language/main.c b/test cases/common/232 link language/main.c new file mode 100644 index 0000000..5a167e7 --- /dev/null +++ b/test cases/common/232 link language/main.c @@ -0,0 +1,5 @@ +#include "c_linkage.h" + +int main(void) { + return makeInt(); +} diff --git a/test cases/common/232 link language/meson.build b/test cases/common/232 link language/meson.build new file mode 100644 index 0000000..f9af6cd --- /dev/null +++ b/test cases/common/232 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/233 link depends indexed custom target/foo.c b/test cases/common/233 link depends indexed custom target/foo.c new file mode 100644 index 0000000..58c86a6 --- /dev/null +++ b/test cases/common/233 link depends indexed custom target/foo.c @@ -0,0 +1,15 @@ +#include <stdio.h> + +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/233 link depends indexed custom target/make_file.py b/test cases/common/233 link depends indexed custom target/make_file.py new file mode 100644 index 0000000..6a43b7d --- /dev/null +++ b/test cases/common/233 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/233 link depends indexed custom target/meson.build b/test cases/common/233 link depends indexed custom target/meson.build new file mode 100644 index 0000000..5c066e9 --- /dev/null +++ b/test cases/common/233 link depends indexed custom target/meson.build @@ -0,0 +1,19 @@ +project('link_depends_indexed_custom_target', 'c') + +if meson.backend().startswith('vs') + # FIXME: Broken on the VS backends + error('MESON_SKIP_TEST see https://github.com/mesonbuild/meson/issues/1799') +endif + +cmd = find_program('make_file.py') + +dep_files = custom_target('gen_dep', + command: [cmd, '@OUTPUT@'], + output: ['dep_file1', 'dep_file2']) + +exe = executable('foo', 'foo.c', + link_depends: dep_files[1], + c_args: ['-DDEPFILE="' + dep_files[0].full_path()+ '"']) + +# check that dep_file1 exists, which means that link_depends target ran +test('runtest', exe) diff --git a/test cases/common/234 very long commmand line/codegen.py b/test cases/common/234 very long commmand line/codegen.py new file mode 100755 index 0000000..4de78ce --- /dev/null +++ b/test cases/common/234 very long commmand line/codegen.py @@ -0,0 +1,6 @@ +#!/usr/bin/env python3 + +import sys + +with open(sys.argv[2], 'w') as f: + print('int func{n}(void) {{ return {n}; }}'.format(n=sys.argv[1]), file=f) diff --git a/test cases/common/234 very long commmand line/main.c b/test cases/common/234 very long commmand line/main.c new file mode 100644 index 0000000..dbb64a8 --- /dev/null +++ b/test cases/common/234 very long commmand line/main.c @@ -0,0 +1,5 @@ +int main(int argc, char **argv) { + (void) argc; + (void) argv; + return 0; +} diff --git a/test cases/common/234 very long commmand line/meson.build b/test cases/common/234 very long commmand line/meson.build new file mode 100644 index 0000000..fe47b5e --- /dev/null +++ b/test cases/common/234 very long commmand line/meson.build @@ -0,0 +1,44 @@ +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 +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. +name = 'ALongFilenameMuchLongerThanIsNormallySeenAndReallyHardToReadThroughToTheEndAMooseOnceBitMySisterSheNowWorksAtLLamaFreshFarmsThisHasToBeSoLongThatWeExceed128KBWithoutCompilingTooManyFiles' +namelen = 187 +nfiles = 50 + limit / namelen +message('Expected link commandline length is approximately ' + '@0@'.format((nfiles * (namelen+28)))) + +seq = run_command('seq.py', '1', '@0@'.format(nfiles)).stdout().strip().split('\n') + +sources = [] +codegen = find_program('codegen.py') + +foreach i : seq + sources += custom_target('codegen' + i, + command: [codegen, i, '@OUTPUT@'], + output: name + i + '.c') +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/234 very long commmand line/seq.py b/test cases/common/234 very long commmand line/seq.py new file mode 100755 index 0000000..637bf57 --- /dev/null +++ b/test cases/common/234 very long commmand line/seq.py @@ -0,0 +1,6 @@ +#!/usr/bin/env python3 + +import sys + +for i in range(int(sys.argv[1]), int(sys.argv[2])): + print(i) diff --git a/test cases/common/36 tryrun/meson.build b/test cases/common/36 tryrun/meson.build index 261adf2..5580974 100644 --- a/test cases/common/36 tryrun/meson.build +++ b/test cases/common/36 tryrun/meson.build @@ -2,7 +2,7 @@ project('tryrun', 'c', 'cpp') # Complex to exercise all code paths. if meson.is_cross_build() - if meson.has_exe_wrapper() + if meson.can_run_host_binaries() compilers = [meson.get_compiler('c', native : false), meson.get_compiler('cpp', native : false)] else compilers = [meson.get_compiler('c', native : true), meson.get_compiler('cpp', native : true)] diff --git a/test cases/common/38 string operations/meson.build b/test cases/common/38 string operations/meson.build index 6596142..8a06a82 100644 --- a/test cases/common/38 string operations/meson.build +++ b/test cases/common/38 string operations/meson.build @@ -101,3 +101,18 @@ 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/43 options/meson_options.txt b/test cases/common/43 options/meson_options.txt index c5986ba..db649de 100644 --- a/test cases/common/43 options/meson_options.txt +++ b/test cases/common/43 options/meson_options.txt @@ -1,7 +1,7 @@ -option('testoption', type : 'string', value : 'optval', description : 'An option to do something') +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 : 'combo', choices : ['one', 'two', 'combo'], value : 'combo') +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('neg' + '_' + 'int' + '_' + 'opt', type : 'integer', min : -5, max : 5, value : -3) diff --git a/test cases/common/47 pkgconfig-gen/dependencies/main.c b/test cases/common/47 pkgconfig-gen/dependencies/main.c index 61708d3..397d40c 100644 --- a/test cases/common/47 pkgconfig-gen/dependencies/main.c +++ b/test cases/common/47 pkgconfig-gen/dependencies/main.c @@ -1,5 +1,9 @@ #include <simple.h> +#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/47 pkgconfig-gen/meson.build b/test cases/common/47 pkgconfig-gen/meson.build index c251b9f..8c16cd5 100644 --- a/test cases/common/47 pkgconfig-gen/meson.build +++ b/test cases/common/47 pkgconfig-gen/meson.build @@ -1,5 +1,12 @@ project('pkgconfig-gen', 'c') +# Some CI runners does not have zlib, just skip them as we need some common +# external dependency. +cc = meson.get_compiler('c') +if not cc.find_library('z', required: false).found() + error('MESON_SKIP_TEST: zlib missing') +endif + # First check we have pkg-config >= 0.29 pkgconfig = find_program('pkg-config', required: false) if not pkgconfig.found() @@ -43,7 +50,8 @@ pkgg.generate( name : 'libfoo', version : libver, description : 'A foo library.', - variables : ['foo=bar', 'datadir=${prefix}/data'] + variables : ['foo=bar', 'datadir=${prefix}/data'], + extra_cflags : ['-DLIBFOO'], ) pkgg.generate( @@ -58,3 +66,32 @@ pkgg.generate( version : libver, dataonly: true ) + +# 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) diff --git a/test cases/common/47 pkgconfig-gen/simple5.c b/test cases/common/47 pkgconfig-gen/simple5.c new file mode 100644 index 0000000..9f924bd --- /dev/null +++ b/test cases/common/47 pkgconfig-gen/simple5.c @@ -0,0 +1,6 @@ +int simple5(void); + +int simple5(void) +{ + return 0; +} diff --git a/test cases/common/47 pkgconfig-gen/test.json b/test cases/common/47 pkgconfig-gen/test.json index 1c6a452..702e7fe 100644 --- a/test cases/common/47 pkgconfig-gen/test.json +++ b/test cases/common/47 pkgconfig-gen/test.json @@ -1,9 +1,13 @@ { "installed": [ {"type": "file", "file": "usr/include/simple.h"}, + {"type": "file", "file": "usr/lib/libstat2.a"}, {"type": "file", "file": "usr/lib/pkgconfig/simple.pc"}, {"type": "file", "file": "usr/lib/pkgconfig/libfoo.pc"}, {"type": "file", "file": "usr/lib/pkgconfig/libhello.pc"}, - {"type": "file", "file": "usr/lib/pkgconfig/libhello_nolib.pc"} + {"type": "file", "file": "usr/lib/pkgconfig/libhello_nolib.pc"}, + {"type": "file", "file": "usr/lib/pkgconfig/simple2.pc"}, + {"type": "file", "file": "usr/lib/pkgconfig/simple3.pc"}, + {"type": "file", "file": "usr/lib/pkgconfig/simple5.pc"} ] } diff --git a/test cases/common/56 install script/customtarget.py b/test cases/common/56 install script/customtarget.py new file mode 100755 index 0000000..e28373a --- /dev/null +++ b/test cases/common/56 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/56 install script/meson.build b/test cases/common/56 install script/meson.build index 6351518..e80e666 100644 --- a/test cases/common/56 install script/meson.build +++ b/test cases/common/56 install script/meson.build @@ -5,3 +5,29 @@ 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') + +meson.add_install_script(exe, 'generated.txt') +wrap = find_program('wrap.py') +# Yes, these are getting silly +meson.add_install_script(wrap, exe, 'wrapped.txt') +meson.add_install_script(wrap, wrap, exe, 'wrapped2.txt') diff --git a/test cases/common/56 install script/myinstall.py b/test cases/common/56 install script/myinstall.py index 812561e..a573342 100644 --- a/test cases/common/56 install script/myinstall.py +++ b/test cases/common/56 install script/myinstall.py @@ -1,12 +1,31 @@ #!/usr/bin/env python3 +import argparse import os -import sys +import shutil prefix = os.environ['MESON_INSTALL_DESTDIR_PREFIX'] -dirname = os.path.join(prefix, sys.argv[1]) -os.makedirs(dirname) -with open(os.path.join(dirname, sys.argv[2]), 'w') as f: - f.write('') +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/unit/74 dep files/foo.c b/test cases/common/56 install script/src/a file.txt index e69de29..e69de29 100644 --- a/test cases/unit/74 dep files/foo.c +++ b/test cases/common/56 install script/src/a file.txt diff --git a/test cases/common/56 install script/src/exe.c b/test cases/common/56 install script/src/exe.c new file mode 100644 index 0000000..b573b91 --- /dev/null +++ b/test cases/common/56 install script/src/exe.c @@ -0,0 +1,24 @@ +#include <stdio.h> +#include <stdlib.h> +#include <string.h> + +int main(int argc, char * argv[]) { + if (argc != 2) { + fprintf(stderr, "Takes exactly 2 arguments\n"); + return 1; + } + + char * dirname = getenv("MESON_INSTALL_DESTDIR_PREFIX"); + char * fullname = malloc(strlen(dirname) + 1 + strlen(argv[1]) + 1); + strcpy(fullname, dirname); + strcat(fullname, "/"); + strcat(fullname, argv[1]); + + FILE * fp = fopen(fullname, "w"); + fputs("Some text\n", fp); + fclose(fp); + + free(fullname); + + return 0; +} diff --git a/test cases/common/56 install script/src/meson.build b/test cases/common/56 install script/src/meson.build index b23574a..1db424f 100644 --- a/test cases/common/56 install script/src/meson.build +++ b/test cases/common/56 install script/src/meson.build @@ -1 +1,5 @@ meson.add_install_script('myinstall.py', 'this/does', 'something-different.dat') + +afile = files('a file.txt') + +exe = executable('exe', 'exe.c', install : false, native : true) diff --git a/test cases/common/56 install script/src/myinstall.py b/test cases/common/56 install script/src/myinstall.py index 3b7ce37..3a9d89b 100644 --- a/test cases/common/56 install script/src/myinstall.py +++ b/test cases/common/56 install script/src/myinstall.py @@ -7,6 +7,8 @@ prefix = os.environ['MESON_INSTALL_DESTDIR_PREFIX'] dirname = os.path.join(prefix, sys.argv[1]) -os.makedirs(dirname) +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/56 install script/test.json b/test cases/common/56 install script/test.json index d17625f..b2a5971 100644 --- a/test cases/common/56 install script/test.json +++ b/test cases/common/56 install script/test.json @@ -4,6 +4,14 @@ {"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/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/customtarget/1.txt"}, + {"type": "file", "file": "usr/customtarget/2.txt"}, + {"type": "file", "file": "usr/customtargetindex/1.txt"}, + {"type": "file", "file": "usr/generated.txt"}, + {"type": "file", "file": "usr/wrapped.txt"}, + {"type": "file", "file": "usr/wrapped2.txt"} ] } diff --git a/test cases/common/56 install script/wrap.py b/test cases/common/56 install script/wrap.py new file mode 100755 index 0000000..87508e0 --- /dev/null +++ b/test cases/common/56 install script/wrap.py @@ -0,0 +1,6 @@ +#!/usr/bin/env python3 + +import subprocess +import sys + +subprocess.run(sys.argv[1:]) diff --git a/test cases/common/93 selfbuilt custom/meson.build b/test cases/common/93 selfbuilt custom/meson.build index 3cc3906..b536352 100644 --- a/test cases/common/93 selfbuilt custom/meson.build +++ b/test cases/common/93 selfbuilt custom/meson.build @@ -26,7 +26,7 @@ ctlib = custom_target('ctlib', build_by_default : true, ) -if meson.is_cross_build() and meson.has_exe_wrapper() +if meson.is_cross_build() and meson.can_run_host_binaries() checkarg_host = executable('checkarg_host', 'checkarg.cpp') ctlib_host = custom_target( 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..70f3c41 --- /dev/null +++ b/test cases/failing/1 project not first/test.json @@ -0,0 +1,7 @@ +{ + "stdout": [ + { + "line": "ERROR: First statement must be a call to project" + } + ] +} 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 fallback consistency/test.json b/test cases/failing/100 fallback consistency/test.json new file mode 100644 index 0000000..a783d8c --- /dev/null +++ b/test cases/failing/100 fallback consistency/test.json @@ -0,0 +1,7 @@ +{ + "stdout": [ + { + "line": "test cases/failing/100 fallback consistency/meson.build:7:0: ERROR: Inconsistency: Subproject has overridden the dependency with another variable than 'dep2'" + } + ] +} diff --git a/test cases/failing/101 no native compiler/test.json b/test cases/failing/101 no native compiler/test.json new file mode 100644 index 0000000..c7b5d1c --- /dev/null +++ b/test cases/failing/101 no native compiler/test.json @@ -0,0 +1,7 @@ +{ + "stdout": [ + { + "line": "test cases/failing/101 no native compiler/meson.build:12:0: ERROR: No host machine compiler for \"main.c\"" + } + ] +} diff --git a/test cases/failing/102 subdir parse error/test.json b/test cases/failing/102 subdir parse error/test.json new file mode 100644 index 0000000..06fd4d3 --- /dev/null +++ b/test cases/failing/102 subdir parse error/test.json @@ -0,0 +1,7 @@ +{ + "stdout": [ + { + "line": "test cases/failing/102 subdir parse error/subdir/meson.build:1:0: ERROR: Plusassignment target must be an id." + } + ] +} diff --git a/test cases/failing/103 invalid option file/test.json b/test cases/failing/103 invalid option file/test.json new file mode 100644 index 0000000..20dbec3 --- /dev/null +++ b/test cases/failing/103 invalid option file/test.json @@ -0,0 +1,7 @@ +{ + "stdout": [ + { + "line": "test cases/failing/103 invalid option file/meson_options.txt:1:0: ERROR: lexer" + } + ] +} diff --git a/test cases/failing/104 no lang/test.json b/test cases/failing/104 no lang/test.json new file mode 100644 index 0000000..62999be --- /dev/null +++ b/test cases/failing/104 no lang/test.json @@ -0,0 +1,7 @@ +{ + "stdout": [ + { + "line": "test cases/failing/104 no lang/meson.build:2:0: ERROR: No host machine compiler for \"main.c\"" + } + ] +} diff --git a/test cases/failing/105 no glib-compile-resources/test.json b/test cases/failing/105 no glib-compile-resources/test.json new file mode 100644 index 0000000..67dc7e4 --- /dev/null +++ b/test cases/failing/105 no glib-compile-resources/test.json @@ -0,0 +1,7 @@ +{ + "stdout": [ + { + "line": "test cases/failing/105 no glib-compile-resources/meson.build:8:0: ERROR: Could not execute glib-compile-resources." + } + ] +} diff --git a/test cases/failing/106 fallback consistency/meson.build b/test cases/failing/106 fallback consistency/meson.build new file mode 100644 index 0000000..1b007f5 --- /dev/null +++ b/test cases/failing/106 fallback consistency/meson.build @@ -0,0 +1,3 @@ +project('fallback consistency') + +dependency('foo') diff --git a/test cases/failing/106 fallback consistency/subprojects/foo.wrap b/test cases/failing/106 fallback consistency/subprojects/foo.wrap new file mode 100644 index 0000000..28055d9 --- /dev/null +++ b/test cases/failing/106 fallback consistency/subprojects/foo.wrap @@ -0,0 +1,6 @@ +[wrap-file] +source_url = http://host.invalid/foo.tar.gz +source_filename = foo.tar.gz + +[provide] +foo = bar_dep diff --git a/test cases/failing/106 fallback consistency/subprojects/foo/meson.build b/test cases/failing/106 fallback consistency/subprojects/foo/meson.build new file mode 100644 index 0000000..fb58a4a --- /dev/null +++ b/test cases/failing/106 fallback consistency/subprojects/foo/meson.build @@ -0,0 +1,6 @@ +project('sub') + +foo_dep = declare_dependency() +meson.override_dependency('foo', foo_dep) + +bar_dep = declare_dependency() diff --git a/test cases/failing/106 fallback consistency/test.json b/test cases/failing/106 fallback consistency/test.json new file mode 100644 index 0000000..af1a429 --- /dev/null +++ b/test cases/failing/106 fallback consistency/test.json @@ -0,0 +1,7 @@ +{ + "stdout": [ + { + "line": "test cases/failing/106 fallback consistency/meson.build:3:0: ERROR: Inconsistency: Subproject has overridden the dependency with another variable than 'bar_dep'" + } + ] +} diff --git a/test cases/failing/107 number in combo/meson.build b/test cases/failing/107 number in combo/meson.build new file mode 100644 index 0000000..1a647df --- /dev/null +++ b/test cases/failing/107 number in combo/meson.build @@ -0,0 +1 @@ +project('number in combo') diff --git a/test cases/failing/107 number in combo/nativefile.ini b/test cases/failing/107 number in combo/nativefile.ini new file mode 100644 index 0000000..55f10fc --- /dev/null +++ b/test cases/failing/107 number in combo/nativefile.ini @@ -0,0 +1,2 @@ +[built-in options] +optimization = 1 diff --git a/test cases/failing/107 number in combo/test.json b/test cases/failing/107 number in combo/test.json new file mode 100644 index 0000000..f5aeb4e --- /dev/null +++ b/test cases/failing/107 number in combo/test.json @@ -0,0 +1,5 @@ +{ + "stdout": [ + { "line": "test cases/failing/107 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): \"0\", \"g\", \"1\", \"2\", \"3\", \"s\"." } + ] +} diff --git a/test cases/failing/108 bool in combo/meson.build b/test cases/failing/108 bool in combo/meson.build new file mode 100644 index 0000000..c5efd67 --- /dev/null +++ b/test cases/failing/108 bool in combo/meson.build @@ -0,0 +1 @@ +project('bool in combo') diff --git a/test cases/failing/108 bool in combo/meson_options.txt b/test cases/failing/108 bool in combo/meson_options.txt new file mode 100644 index 0000000..0c8f5de --- /dev/null +++ b/test cases/failing/108 bool in combo/meson_options.txt @@ -0,0 +1,5 @@ +option( + 'opt', + type : 'combo', + choices : ['true', 'false'] +) diff --git a/test cases/failing/108 bool in combo/nativefile.ini b/test cases/failing/108 bool in combo/nativefile.ini new file mode 100644 index 0000000..b423957 --- /dev/null +++ b/test cases/failing/108 bool in combo/nativefile.ini @@ -0,0 +1,2 @@ +[project options] +opt = true diff --git a/test cases/failing/108 bool in combo/test.json b/test cases/failing/108 bool in combo/test.json new file mode 100644 index 0000000..729ad3d --- /dev/null +++ b/test cases/failing/108 bool in combo/test.json @@ -0,0 +1,5 @@ +{ + "stdout": [ + { "line": "test cases/failing/108 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/11 object arithmetic/test.json b/test cases/failing/11 object arithmetic/test.json new file mode 100644 index 0000000..5339fac --- /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: Invalid use of addition: .*" + } + ] +} 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..476f9bb --- /dev/null +++ b/test cases/failing/12 string arithmetic/test.json @@ -0,0 +1,8 @@ +{ + "stdout": [ + { + "match": "re", + "line": "test cases/failing/12 string arithmetic/meson\\.build:3:0: ERROR: Invalid use of addition: .*" + } + ] +} 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..55056ce --- /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: Multiplication works only with integers." + } + ] +} 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/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/test.json b/test cases/failing/16 extract from subproject/test.json new file mode 100644 index 0000000..78d45a5 --- /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 subproject target." + } + ] +} 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/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/meson.build b/test cases/failing/19 target clash/meson.build index ca09fb5..4fd0934 100644 --- a/test cases/failing/19 target clash/meson.build +++ b/test cases/failing/19 target clash/meson.build @@ -8,7 +8,7 @@ project('clash', 'c') # output location is redirected. if host_machine.system() == 'windows' or host_machine.system() == 'cygwin' - error('This is expected.') + error('MESON_SKIP_TEST test only works on platforms where executables have no suffix.') endif executable('clash', 'clash.c') 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/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/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/test.json b/test cases/failing/21 subver/test.json new file mode 100644 index 0000000..f8cfd3a --- /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/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/test.json b/test cases/failing/23 rel testdir/test.json new file mode 100644 index 0000000..ba983ab --- /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: Workdir keyword argument must be an absolute path." + } + ] +} 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/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/test.json b/test cases/failing/26 output subdir/test.json new file mode 100644 index 0000000..796468d --- /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: Output file name must not contain a subdirectory." + } + ] +} 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/test.json b/test cases/failing/28 no crossprop/test.json new file mode 100644 index 0000000..a186a68 --- /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 cross property: nonexisting." + } + ] +} 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/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/test.json b/test cases/failing/30 invalid man extension/test.json new file mode 100644 index 0000000..3f77a04 --- /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 8" + } + ] +} 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..6e1f542 --- /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 8" + } + ] +} diff --git a/test cases/failing/32 exe static shared/meson.build b/test cases/failing/32 exe static shared/meson.build index b102764..2ae5125 100644 --- a/test cases/failing/32 exe static shared/meson.build +++ b/test cases/failing/32 exe static shared/meson.build @@ -2,7 +2,7 @@ project('statchain', 'c') host_system = host_machine.system() if host_system == 'windows' or host_system == 'darwin' - error('Test only fails on Linux and BSD') + error('MESON_SKIP_TEST test only fails on Linux and BSD') endif statlib = static_library('stat', 'stat.c', pic : false) 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/test.json b/test cases/failing/33 non-root subproject/test.json new file mode 100644 index 0000000..a14cece --- /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: Subproject directory not found and someproj.wrap file not found" + } + ] +} 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/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 index 54d434c..874b581 100644 --- a/test cases/failing/36 pkgconfig dependency impossible conditions/meson.build +++ b/test cases/failing/36 pkgconfig dependency impossible conditions/meson.build @@ -1,3 +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..2ce62ac --- /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' was already checked and was not found" + } + ] +} 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 libdir must be inside prefix/test.json b/test cases/failing/38 libdir must be inside prefix/test.json index 1cd893c..d9256d1 100644 --- a/test cases/failing/38 libdir must be inside prefix/test.json +++ b/test cases/failing/38 libdir must be inside prefix/test.json @@ -1,3 +1,10 @@ { - "do_not_set_opts": ["libdir"] + "do_not_set_opts": [ + "libdir" + ], + "stdout": [ + { + "line": "test cases/failing/38 libdir must be inside prefix/meson.build:1:0: ERROR: The value of the 'libdir' option is '/opt/lib' which must be a subdir of the prefix '/usr'." + } + ] } diff --git a/test cases/failing/39 prefix absolute/test.json b/test cases/failing/39 prefix absolute/test.json index 4e0f6cd..2770243 100644 --- a/test cases/failing/39 prefix absolute/test.json +++ b/test cases/failing/39 prefix absolute/test.json @@ -1,3 +1,11 @@ { - "do_not_set_opts": ["prefix"] + "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/39 prefix absolute/meson.build:1:0: ERROR: prefix value 'some/path/notabs' must be an absolute path" + } + ] } 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 kwarg assign/test.json b/test cases/failing/40 kwarg assign/test.json new file mode 100644 index 0000000..671eb3f --- /dev/null +++ b/test cases/failing/40 kwarg assign/test.json @@ -0,0 +1,7 @@ +{ + "stdout": [ + { + "line": "test cases/failing/40 kwarg assign/meson.build:3:0: ERROR: Tried to assign values inside an argument list." + } + ] +} diff --git a/test cases/failing/41 custom target plainname many inputs/test.json b/test cases/failing/41 custom target plainname many inputs/test.json new file mode 100644 index 0000000..8c15cda --- /dev/null +++ b/test cases/failing/41 custom target plainname many inputs/test.json @@ -0,0 +1,7 @@ +{ + "stdout": [ + { + "line": "test cases/failing/41 custom target plainname many inputs/meson.build:5:0: ERROR: 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/42 custom target outputs not matching install_dirs/meson.build b/test cases/failing/42 custom target outputs not matching install_dirs/meson.build index 45bd7b3..765e237 100644 --- a/test cases/failing/42 custom target outputs not matching install_dirs/meson.build +++ b/test cases/failing/42 custom target outputs not matching install_dirs/meson.build @@ -3,7 +3,7 @@ project('outputs not matching install_dirs', 'c') gen = find_program('generator.py') if meson.backend() != 'ninja' - error('Failing manually, test is only for the ninja backend') + error('MESON_SKIP_TEST test is only for the ninja backend') endif custom_target('too-few-install-dirs', diff --git a/test cases/failing/42 custom target outputs not matching install_dirs/test.json b/test cases/failing/42 custom target outputs not matching install_dirs/test.json index e59cb9f..f9e2ba7 100644 --- a/test cases/failing/42 custom target outputs not matching install_dirs/test.json +++ b/test cases/failing/42 custom target outputs not matching install_dirs/test.json @@ -1,10 +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"} + { + "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/43 project name colon/test.json b/test cases/failing/43 project name colon/test.json new file mode 100644 index 0000000..7a55574 --- /dev/null +++ b/test cases/failing/43 project name colon/test.json @@ -0,0 +1,7 @@ +{ + "stdout": [ + { + "line": "test cases/failing/43 project name colon/meson.build:1:0: ERROR: Project name 'name with :' must not contain ':'" + } + ] +} diff --git a/test cases/failing/44 abs subdir/test.json b/test cases/failing/44 abs subdir/test.json new file mode 100644 index 0000000..0aa56f6 --- /dev/null +++ b/test cases/failing/44 abs subdir/test.json @@ -0,0 +1,7 @@ +{ + "stdout": [ + { + "line": "test cases/failing/44 abs subdir/meson.build:5:0: ERROR: Subdir argument must be a relative path." + } + ] +} diff --git a/test cases/failing/45 abspath to srcdir/test.json b/test cases/failing/45 abspath to srcdir/test.json new file mode 100644 index 0000000..b6a87fe --- /dev/null +++ b/test cases/failing/45 abspath to srcdir/test.json @@ -0,0 +1,7 @@ +{ + "stdout": [ + { + "line": "test cases/failing/45 abspath to srcdir/meson.build:3:0: ERROR: Tried to form an absolute path to a source dir. You should not do that but use relative paths instead." + } + ] +} diff --git a/test cases/failing/46 pkgconfig variables reserved/test.json b/test cases/failing/46 pkgconfig variables reserved/test.json new file mode 100644 index 0000000..b92ee17 --- /dev/null +++ b/test cases/failing/46 pkgconfig variables reserved/test.json @@ -0,0 +1,7 @@ +{ + "stdout": [ + { + "line": "test cases/failing/46 pkgconfig variables reserved/meson.build:8:5: ERROR: Variable \"prefix\" is reserved" + } + ] +} diff --git a/test cases/failing/47 pkgconfig variables zero length/test.json b/test cases/failing/47 pkgconfig variables zero length/test.json new file mode 100644 index 0000000..097fee1 --- /dev/null +++ b/test cases/failing/47 pkgconfig variables zero length/test.json @@ -0,0 +1,7 @@ +{ + "stdout": [ + { + "line": "test cases/failing/47 pkgconfig variables zero length/meson.build:8:5: ERROR: Invalid variable \"=value\". Variables must be in 'name=value' format" + } + ] +} diff --git a/test cases/failing/48 pkgconfig variables zero length value/test.json b/test cases/failing/48 pkgconfig variables zero length value/test.json new file mode 100644 index 0000000..50a35ce --- /dev/null +++ b/test cases/failing/48 pkgconfig variables zero length value/test.json @@ -0,0 +1,7 @@ +{ + "stdout": [ + { + "line": "test cases/failing/48 pkgconfig variables zero length value/meson.build:8:5: ERROR: Invalid variable \"key=\". Variables must be in 'name=value' format" + } + ] +} diff --git a/test cases/failing/49 pkgconfig variables not key value/test.json b/test cases/failing/49 pkgconfig variables not key value/test.json new file mode 100644 index 0000000..cf07e62 --- /dev/null +++ b/test cases/failing/49 pkgconfig variables not key value/test.json @@ -0,0 +1,7 @@ +{ + "stdout": [ + { + "line": "test cases/failing/49 pkgconfig variables not key value/meson.build:8:5: ERROR: Invalid variable \"this_should_be_key_value\". Variables must be in 'name=value' format" + } + ] +} 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 executable comparison/test.json b/test cases/failing/50 executable comparison/test.json new file mode 100644 index 0000000..585b382 --- /dev/null +++ b/test cases/failing/50 executable comparison/test.json @@ -0,0 +1,7 @@ +{ + "stdout": [ + { + "line": "test cases/failing/50 executable comparison/meson.build:6:0: ERROR: exe1 can only be compared for equality." + } + ] +} diff --git a/test cases/failing/51 inconsistent comparison/test.json b/test cases/failing/51 inconsistent comparison/test.json new file mode 100644 index 0000000..5867f0a --- /dev/null +++ b/test cases/failing/51 inconsistent comparison/test.json @@ -0,0 +1,7 @@ +{ + "stdout": [ + { + "line": "test cases/failing/51 inconsistent comparison/meson.build:5:0: ERROR: Values of different types (list, str) cannot be compared using <." + } + ] +} diff --git a/test cases/failing/52 slashname/test.json b/test cases/failing/52 slashname/test.json new file mode 100644 index 0000000..180400a --- /dev/null +++ b/test cases/failing/52 slashname/test.json @@ -0,0 +1,7 @@ +{ + "stdout": [ + { + "line": "test cases/failing/52 slashname/meson.build:11:0: ERROR: Problem encountered: Re-enable me once slash in name is finally prohibited." + } + ] +} diff --git a/test cases/failing/53 reserved meson prefix/test.json b/test cases/failing/53 reserved meson prefix/test.json new file mode 100644 index 0000000..502d96a --- /dev/null +++ b/test cases/failing/53 reserved meson prefix/test.json @@ -0,0 +1,7 @@ +{ + "stdout": [ + { + "line": "test cases/failing/53 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/54 wrong shared crate type/meson.build b/test cases/failing/54 wrong shared crate type/meson.build index 69ac3da..b9fcad4 100644 --- a/test cases/failing/54 wrong shared crate type/meson.build +++ b/test cases/failing/54 wrong shared crate type/meson.build @@ -1,3 +1,7 @@ -project('test', 'rust') +project('test') + +if not add_languages('rust', required: false) + error('MESON_SKIP_TEST test requires rust compiler') +endif shared_library('test', 'foo.rs', rust_crate_type : 'staticlib') diff --git a/test cases/failing/54 wrong shared crate type/test.json b/test cases/failing/54 wrong shared crate type/test.json new file mode 100644 index 0000000..5cced6f --- /dev/null +++ b/test cases/failing/54 wrong shared crate type/test.json @@ -0,0 +1,7 @@ +{ + "stdout": [ + { + "line": "test cases/failing/54 wrong shared crate type/meson.build:7:0: ERROR: Crate type \"staticlib\" invalid for dynamic libraries; must be \"dylib\" or \"cdylib\"" + } + ] +} diff --git a/test cases/failing/55 wrong static crate type/meson.build b/test cases/failing/55 wrong static crate type/meson.build index c094613..109907f 100644 --- a/test cases/failing/55 wrong static crate type/meson.build +++ b/test cases/failing/55 wrong static crate type/meson.build @@ -1,3 +1,7 @@ -project('test', 'rust') +project('test') + +if not add_languages('rust', required: false) + error('MESON_SKIP_TEST test requires rust compiler') +endif static_library('test', 'foo.rs', rust_crate_type : 'cdylib') diff --git a/test cases/failing/55 wrong static crate type/test.json b/test cases/failing/55 wrong static crate type/test.json new file mode 100644 index 0000000..7073f7b --- /dev/null +++ b/test cases/failing/55 wrong static crate type/test.json @@ -0,0 +1,7 @@ +{ + "stdout": [ + { + "line": "test cases/failing/55 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/56 or on new line/test.json b/test cases/failing/56 or on new line/test.json new file mode 100644 index 0000000..c55cee6 --- /dev/null +++ b/test cases/failing/56 or on new line/test.json @@ -0,0 +1,7 @@ +{ + "stdout": [ + { + "line": "test cases/failing/56 or on new line/meson.build:4:8: ERROR: Invalid or clause." + } + ] +} diff --git a/test cases/failing/57 kwarg in module/test.json b/test cases/failing/57 kwarg in module/test.json new file mode 100644 index 0000000..cafb3ab --- /dev/null +++ b/test cases/failing/57 kwarg in module/test.json @@ -0,0 +1,7 @@ +{ + "stdout": [ + { + "line": "test cases/failing/57 kwarg in module/meson.build:3:0: ERROR: Function does not take keyword arguments." + } + ] +} diff --git a/test cases/failing/58 link with executable/test.json b/test cases/failing/58 link with executable/test.json new file mode 100644 index 0000000..d3975c1 --- /dev/null +++ b/test cases/failing/58 link with executable/test.json @@ -0,0 +1,7 @@ +{ + "stdout": [ + { + "line": "test cases/failing/58 link with executable/meson.build:4:0: ERROR: Link target 'prog' is not linkable." + } + ] +} diff --git a/test cases/failing/59 assign custom target index/test.json b/test cases/failing/59 assign custom target index/test.json new file mode 100644 index 0000000..07ecb91 --- /dev/null +++ b/test cases/failing/59 assign custom target index/test.json @@ -0,0 +1,7 @@ +{ + "stdout": [ + { + "line": "test cases/failing/59 assign custom target index/meson.build:24:0: ERROR: Assignment target must be an id." + } + ] +} 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 getoption prefix/test.json b/test cases/failing/60 getoption prefix/test.json new file mode 100644 index 0000000..03bf419 --- /dev/null +++ b/test cases/failing/60 getoption prefix/test.json @@ -0,0 +1,7 @@ +{ + "stdout": [ + { + "line": "test cases/failing/60 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/61 bad option argument/test.json b/test cases/failing/61 bad option argument/test.json new file mode 100644 index 0000000..4002005 --- /dev/null +++ b/test cases/failing/61 bad option argument/test.json @@ -0,0 +1,7 @@ +{ + "stdout": [ + { + "line": "test cases/failing/61 bad option argument/meson_options.txt:1:0: ERROR: Invalid kwargs for option \"name\": \"vaule\"" + } + ] +} diff --git a/test cases/failing/62 subproj filegrab/test.json b/test cases/failing/62 subproj filegrab/test.json new file mode 100644 index 0000000..dd0d7bb --- /dev/null +++ b/test cases/failing/62 subproj filegrab/test.json @@ -0,0 +1,7 @@ +{ + "stdout": [ + { + "line": "test cases/failing/62 subproj filegrab/subprojects/a/meson.build:3:0: ERROR: Sandbox violation: Tried to grab file prog.c from a different subproject." + } + ] +} diff --git a/test cases/failing/63 grab subproj/test.json b/test cases/failing/63 grab subproj/test.json new file mode 100644 index 0000000..8147905 --- /dev/null +++ b/test cases/failing/63 grab subproj/test.json @@ -0,0 +1,7 @@ +{ + "stdout": [ + { + "line": "test cases/failing/63 grab subproj/meson.build:7:0: ERROR: Sandbox violation: Tried to grab file sub.c from a different subproject." + } + ] +} diff --git a/test cases/failing/64 grab sibling/test.json b/test cases/failing/64 grab sibling/test.json new file mode 100644 index 0000000..1604d47 --- /dev/null +++ b/test cases/failing/64 grab sibling/test.json @@ -0,0 +1,7 @@ +{ + "stdout": [ + { + "line": "test cases/failing/64 grab sibling/subprojects/a/meson.build:3:0: ERROR: Sandbox violation: Tried to grab file sneaky.c from a different subproject." + } + ] +} diff --git a/test cases/failing/65 string as link target/test.json b/test cases/failing/65 string as link target/test.json new file mode 100644 index 0000000..e212482 --- /dev/null +++ b/test cases/failing/65 string as link target/test.json @@ -0,0 +1,7 @@ +{ + "stdout": [ + { + "line": "test cases/failing/65 string as link target/meson.build:2:0: ERROR: '' is not a target." + } + ] +} diff --git a/test cases/failing/66 dependency not-found and required/test.json b/test cases/failing/66 dependency not-found and required/test.json new file mode 100644 index 0000000..5b13316 --- /dev/null +++ b/test cases/failing/66 dependency not-found and required/test.json @@ -0,0 +1,7 @@ +{ + "stdout": [ + { + "line": "test cases/failing/66 dependency not-found and required/meson.build:2:0: ERROR: Dependency is both required and not-found" + } + ] +} diff --git a/test cases/failing/67 subproj different versions/test.json b/test cases/failing/67 subproj different versions/test.json new file mode 100644 index 0000000..d16daf9 --- /dev/null +++ b/test cases/failing/67 subproj different versions/test.json @@ -0,0 +1,7 @@ +{ + "stdout": [ + { + "line": "test cases/failing/67 subproj different versions/subprojects/b/meson.build:3:0: ERROR: Dependency 'c' was already checked and was not found" + } + ] +} diff --git a/test cases/failing/68 wrong boost module/meson.build b/test cases/failing/68 wrong boost module/meson.build index 7fb3a40..937e587 100644 --- a/test cases/failing/68 wrong boost module/meson.build +++ b/test cases/failing/68 wrong boost module/meson.build @@ -1,5 +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/68 wrong boost module/test.json b/test cases/failing/68 wrong boost module/test.json new file mode 100644 index 0000000..9ef1b0f --- /dev/null +++ b/test cases/failing/68 wrong boost module/test.json @@ -0,0 +1,7 @@ +{ + "stdout": [ + { + "line": "test cases/failing/68 wrong boost module/meson.build:9:0: ERROR: Dependency \"boost\" not found" + } + ] +} diff --git a/test cases/failing/69 install_data rename bad size/test.json b/test cases/failing/69 install_data rename bad size/test.json new file mode 100644 index 0000000..1329fec --- /dev/null +++ b/test cases/failing/69 install_data rename bad size/test.json @@ -0,0 +1,7 @@ +{ + "stdout": [ + { + "line": "test cases/failing/69 install_data rename bad size/meson.build:3:0: ERROR: Size of rename argument is different from number of sources" + } + ] +} 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 skip only subdir/test.json b/test cases/failing/70 skip only subdir/test.json new file mode 100644 index 0000000..3b40b66 --- /dev/null +++ b/test cases/failing/70 skip only subdir/test.json @@ -0,0 +1,7 @@ +{ + "stdout": [ + { + "line": "test cases/failing/70 skip only subdir/meson.build:8:0: ERROR: File main.cpp does not exist." + } + ] +} diff --git a/test cases/failing/71 dual override/test.json b/test cases/failing/71 dual override/test.json new file mode 100644 index 0000000..66409e6 --- /dev/null +++ b/test cases/failing/71 dual override/test.json @@ -0,0 +1,7 @@ +{ + "stdout": [ + { + "line": "test cases/failing/71 dual override/meson.build:5:6: ERROR: Tried to override executable \"override\" which has already been overridden." + } + ] +} diff --git a/test cases/failing/72 override used/test.json b/test cases/failing/72 override used/test.json new file mode 100644 index 0000000..29a58f1 --- /dev/null +++ b/test cases/failing/72 override used/test.json @@ -0,0 +1,7 @@ +{ + "stdout": [ + { + "line": "test cases/failing/72 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/73 run_command unclean exit/test.json b/test cases/failing/73 run_command unclean exit/test.json new file mode 100644 index 0000000..beda187 --- /dev/null +++ b/test cases/failing/73 run_command unclean exit/test.json @@ -0,0 +1,8 @@ +{ + "stdout": [ + { + "match": "re", + "line": "test cases/failing/73 run_command unclean exit/meson\\.build:4:0: ERROR: Command \".*[\\\\/]test cases[\\\\/]failing[\\\\/]73 run_command unclean exit[\\\\/]\\.[\\\\/]returncode\\.py 1\" failed with status 1\\." + } + ] +} diff --git a/test cases/failing/74 int literal leading zero/test.json b/test cases/failing/74 int literal leading zero/test.json new file mode 100644 index 0000000..78a735e --- /dev/null +++ b/test cases/failing/74 int literal leading zero/test.json @@ -0,0 +1,8 @@ +{ + "stdout": [ + { + "comment": "this error message is not very informative", + "line": "test cases/failing/74 int literal leading zero/meson.build:5:13: ERROR: Expecting eof got number." + } + ] +} diff --git a/test cases/failing/75 configuration immutable/test.json b/test cases/failing/75 configuration immutable/test.json new file mode 100644 index 0000000..3365aae --- /dev/null +++ b/test cases/failing/75 configuration immutable/test.json @@ -0,0 +1,7 @@ +{ + "stdout": [ + { + "line": "test cases/failing/75 configuration immutable/meson.build:12:16: ERROR: Can not set values on configuration object that has been used." + } + ] +} diff --git a/test cases/failing/76 link with shared module on osx/meson.build b/test cases/failing/76 link with shared module on osx/meson.build index 2c714f9..bf18b36 100644 --- a/test cases/failing/76 link with shared module on osx/meson.build +++ b/test cases/failing/76 link with shared module on osx/meson.build @@ -1,7 +1,7 @@ project('link with shared module', 'c') if host_machine.system() != 'darwin' - error('Test only fails on OSX') + error('MESON_SKIP_TEST test only fails on OSX') endif m = shared_module('mymodule', 'module.c') diff --git a/test cases/failing/76 link with shared module on osx/test.json b/test cases/failing/76 link with shared module on osx/test.json new file mode 100644 index 0000000..4e2856f --- /dev/null +++ b/test cases/failing/76 link with shared module on osx/test.json @@ -0,0 +1,7 @@ +{ + "stdout": [ + { + "line": "test cases/failing/76 link with shared module on osx/meson.build:8:0: ERROR: target links against shared modules." + } + ] +} diff --git a/test cases/failing/77 non ascii in ascii encoded configure file/test.json b/test cases/failing/77 non ascii in ascii encoded configure file/test.json new file mode 100644 index 0000000..e35b95b --- /dev/null +++ b/test cases/failing/77 non ascii in ascii encoded configure file/test.json @@ -0,0 +1,8 @@ +{ + "stdout": [ + { + "match": "re", + "line": "test cases/failing/77 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/78 subproj dependency not-found and required/test.json b/test cases/failing/78 subproj dependency not-found and required/test.json new file mode 100644 index 0000000..534b4f4 --- /dev/null +++ b/test cases/failing/78 subproj dependency not-found and required/test.json @@ -0,0 +1,7 @@ +{ + "stdout": [ + { + "line": "test cases/failing/78 subproj dependency not-found and required/meson.build:2:0: ERROR: Subproject directory not found and missing.wrap file not found" + } + ] +} diff --git a/test cases/failing/79 unfound run/test.json b/test cases/failing/79 unfound run/test.json new file mode 100644 index 0000000..6baafc0 --- /dev/null +++ b/test cases/failing/79 unfound run/test.json @@ -0,0 +1,7 @@ +{ + "stdout": [ + { + "line": "test cases/failing/79 unfound run/meson.build:4:0: ERROR: Tried to use non-existing executable 'nonexisting_prog'" + } + ] +} 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 framework dependency with version/meson.build b/test cases/failing/80 framework dependency with version/meson.build index 1ead388..b7e04ba 100644 --- a/test cases/failing/80 framework dependency with version/meson.build +++ b/test cases/failing/80 framework dependency with version/meson.build @@ -1,4 +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... -# otherwise we're not on OSX and this will definitely fail dep = dependency('appleframeworks', modules: 'foundation', version: '>0') diff --git a/test cases/failing/80 framework dependency with version/test.json b/test cases/failing/80 framework dependency with version/test.json new file mode 100644 index 0000000..5cbc129 --- /dev/null +++ b/test cases/failing/80 framework dependency with version/test.json @@ -0,0 +1,7 @@ +{ + "stdout": [ + { + "line": "test cases/failing/80 framework dependency with version/meson.build:8:0: ERROR: Unknown version of dependency 'appleframeworks', but need ['>0']." + } + ] +} diff --git a/test cases/failing/81 override exe config/test.json b/test cases/failing/81 override exe config/test.json new file mode 100644 index 0000000..f19785b --- /dev/null +++ b/test cases/failing/81 override exe config/test.json @@ -0,0 +1,7 @@ +{ + "stdout": [ + { + "line": "test cases/failing/81 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/82 gl dependency with version/meson.build b/test cases/failing/82 gl dependency with version/meson.build index 3014d43..0127093 100644 --- a/test cases/failing/82 gl dependency with version/meson.build +++ b/test cases/failing/82 gl dependency with version/meson.build @@ -2,7 +2,7 @@ project('gl dependency with version', 'c') host_system = host_machine.system() if host_system != 'windows' and host_system != 'darwin' - error('Test only fails on Windows and OSX') + 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 diff --git a/test cases/failing/82 gl dependency with version/test.json b/test cases/failing/82 gl dependency with version/test.json new file mode 100644 index 0000000..2c63a2c --- /dev/null +++ b/test cases/failing/82 gl dependency with version/test.json @@ -0,0 +1,7 @@ +{ + "stdout": [ + { + "line": "test cases/failing/82 gl dependency with version/meson.build:9:0: ERROR: Unknown version of dependency 'gl', but need ['>0']." + } + ] +} diff --git a/test cases/failing/83 threads dependency with version/test.json b/test cases/failing/83 threads dependency with version/test.json new file mode 100644 index 0000000..b131be4 --- /dev/null +++ b/test cases/failing/83 threads dependency with version/test.json @@ -0,0 +1,7 @@ +{ + "stdout": [ + { + "line": "test cases/failing/83 threads dependency with version/meson.build:3:0: ERROR: Unknown version of dependency 'threads', but need ['>0']." + } + ] +} diff --git a/test cases/failing/84 gtest dependency with version/meson.build b/test cases/failing/84 gtest dependency with version/meson.build index 3d90994..b43a047 100644 --- a/test cases/failing/84 gtest dependency with version/meson.build +++ b/test cases/failing/84 gtest dependency with version/meson.build @@ -1,3 +1,8 @@ project('gtest dependency with version', ['c', '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/84 gtest dependency with version/test.json b/test cases/failing/84 gtest dependency with version/test.json new file mode 100644 index 0000000..e1bbcac --- /dev/null +++ b/test cases/failing/84 gtest dependency with version/test.json @@ -0,0 +1,7 @@ +{ + "stdout": [ + { + "line": "test cases/failing/84 gtest dependency with version/meson.build:8:0: ERROR: Dependency 'gtest' was already checked and was not found" + } + ] +} diff --git a/test cases/failing/85 dub libray/meson.build b/test cases/failing/85 dub libray/meson.build index 5b0ccac..306d5b3 100644 --- a/test cases/failing/85 dub libray/meson.build +++ b/test cases/failing/85 dub libray/meson.build @@ -1,3 +1,11 @@ -project('dub', 'd') +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/85 dub libray/test.json b/test cases/failing/85 dub libray/test.json new file mode 100644 index 0000000..a8b3e28 --- /dev/null +++ b/test cases/failing/85 dub libray/test.json @@ -0,0 +1,7 @@ +{ + "stdout": [ + { + "line": "test cases/failing/85 dub libray/meson.build:11:0: ERROR: Dependency \"dubtestproject\" not found" + } + ] +} diff --git a/test cases/failing/86 dub executable/meson.build b/test cases/failing/86 dub executable/meson.build index 63fd631..9a134ea 100644 --- a/test cases/failing/86 dub executable/meson.build +++ b/test cases/failing/86 dub executable/meson.build @@ -1,3 +1,11 @@ -project('dub', 'd') +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/86 dub executable/test.json b/test cases/failing/86 dub executable/test.json new file mode 100644 index 0000000..f9944af --- /dev/null +++ b/test cases/failing/86 dub executable/test.json @@ -0,0 +1,7 @@ +{ + "stdout": [ + { + "line": "test cases/failing/86 dub executable/meson.build:11:0: ERROR: Dependency \"dubtestproject:test1\" not found" + } + ] +} diff --git a/test cases/failing/87 dub compiler/meson.build b/test cases/failing/87 dub compiler/meson.build index c93ccbc..36f1849 100644 --- a/test cases/failing/87 dub compiler/meson.build +++ b/test cases/failing/87 dub compiler/meson.build @@ -1,4 +1,8 @@ -project('dub', 'd') +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' @@ -6,4 +10,8 @@ if meson.get_compiler('d').get_id() == 'dmd' 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/87 dub compiler/test.json b/test cases/failing/87 dub compiler/test.json index acb7da8..f28312f 100644 --- a/test cases/failing/87 dub compiler/test.json +++ b/test cases/failing/87 dub compiler/test.json @@ -2,8 +2,18 @@ "matrix": { "options": { "warning_level": [ - { "val": "1", "skip_on_env": [ "SINGLE_DUB_COMPILER" ] } + { + "val": "1", + "skip_on_env": [ + "SINGLE_DUB_COMPILER" + ] + } ] } - } + }, + "stdout": [ + { + "line": "test cases/failing/87 dub compiler/meson.build:17:0: ERROR: Dependency \"dubtestproject:test2\" not found" + } + ] } diff --git a/test cases/failing/88 subproj not-found dep/test.json b/test cases/failing/88 subproj not-found dep/test.json new file mode 100644 index 0000000..a1c4231 --- /dev/null +++ b/test cases/failing/88 subproj not-found dep/test.json @@ -0,0 +1,7 @@ +{ + "stdout": [ + { + "line": "test cases/failing/88 subproj not-found dep/meson.build:2:0: ERROR: Could not find dependency notfound_dep in subproject somesubproj" + } + ] +} diff --git a/test cases/failing/89 invalid configure file/test.json b/test cases/failing/89 invalid configure file/test.json new file mode 100644 index 0000000..921ce61 --- /dev/null +++ b/test cases/failing/89 invalid configure file/test.json @@ -0,0 +1,7 @@ +{ + "stdout": [ + { + "line": "test cases/failing/89 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/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 kwarg dupe/test.json b/test cases/failing/90 kwarg dupe/test.json new file mode 100644 index 0000000..a8df75d --- /dev/null +++ b/test cases/failing/90 kwarg dupe/test.json @@ -0,0 +1,7 @@ +{ + "stdout": [ + { + "line": "test cases/failing/90 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/91 missing pch file/test.json b/test cases/failing/91 missing pch file/test.json new file mode 100644 index 0000000..166f627 --- /dev/null +++ b/test cases/failing/91 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/91 missing pch file/meson.build:2:0: ERROR: File pch/prog.h does not exist." + } + ] +} diff --git a/test cases/failing/92 pch source different folder/test.json b/test cases/failing/92 pch source different folder/test.json new file mode 100644 index 0000000..d94db50 --- /dev/null +++ b/test cases/failing/92 pch source different folder/test.json @@ -0,0 +1,7 @@ +{ + "stdout": [ + { + "line": "test cases/failing/92 pch source different folder/meson.build:4:0: ERROR: PCH files must be stored in the same folder." + } + ] +} diff --git a/test cases/failing/93 vala without c/test.json b/test cases/failing/93 vala without c/test.json new file mode 100644 index 0000000..6185b7e --- /dev/null +++ b/test cases/failing/93 vala without c/test.json @@ -0,0 +1,7 @@ +{ + "stdout": [ + { + "line": "test cases/failing/93 vala without c/meson.build:2:0: ERROR: Compiling Vala requires C. Add C to your project languages and rerun Meson." + } + ] +} diff --git a/test cases/failing/94 unknown config tool/test.json b/test cases/failing/94 unknown config tool/test.json new file mode 100644 index 0000000..a001152 --- /dev/null +++ b/test cases/failing/94 unknown config tool/test.json @@ -0,0 +1,7 @@ +{ + "stdout": [ + { + "line": "test cases/failing/94 unknown config tool/meson.build:2:0: ERROR: Dependency \"no-such-config-tool\" not found" + } + ] +} diff --git a/test cases/failing/95 custom target install data/test.json b/test cases/failing/95 custom target install data/test.json new file mode 100644 index 0000000..64ef530 --- /dev/null +++ b/test cases/failing/95 custom target install data/test.json @@ -0,0 +1,7 @@ +{ + "stdout": [ + { + "line": "test cases/failing/95 custom target install data/meson.build:11:0: ERROR: Argument must be string or file." + } + ] +} diff --git a/test cases/failing/96 add dict non string key/test.json b/test cases/failing/96 add dict non string key/test.json new file mode 100644 index 0000000..5fd4033 --- /dev/null +++ b/test cases/failing/96 add dict non string key/test.json @@ -0,0 +1,7 @@ +{ + "stdout": [ + { + "line": "test cases/failing/96 add dict non string key/meson.build:9:0: ERROR: Key must be a string" + } + ] +} diff --git a/test cases/failing/97 add dict duplicate keys/test.json b/test cases/failing/97 add dict duplicate keys/test.json new file mode 100644 index 0000000..9d01551 --- /dev/null +++ b/test cases/failing/97 add dict duplicate keys/test.json @@ -0,0 +1,7 @@ +{ + "stdout": [ + { + "line": "test cases/failing/97 add dict duplicate keys/meson.build:9:0: ERROR: Duplicate dictionary key: myKey" + } + ] +} diff --git a/test cases/failing/98 fallback consistency/test.json b/test cases/failing/98 fallback consistency/test.json new file mode 100644 index 0000000..fd77bad --- /dev/null +++ b/test cases/failing/98 fallback consistency/test.json @@ -0,0 +1,7 @@ +{ + "stdout": [ + { + "line": "test cases/failing/98 fallback consistency/meson.build:4:0: ERROR: Inconsistency: Subproject has overridden the dependency with another variable than 'dep2'" + } + ] +} diff --git a/test cases/failing/99 no native prop/test.json b/test cases/failing/99 no native prop/test.json new file mode 100644 index 0000000..8c320d9 --- /dev/null +++ b/test cases/failing/99 no native prop/test.json @@ -0,0 +1,7 @@ +{ + "stdout": [ + { + "line": "test cases/failing/99 no native prop/meson.build:3:0: ERROR: Unknown native property: nonexisting." + } + ] +} diff --git a/test cases/fortran/7 generated/meson.build b/test cases/fortran/7 generated/meson.build index c2efe34..b555b17 100644 --- a/test cases/fortran/7 generated/meson.build +++ b/test cases/fortran/7 generated/meson.build @@ -1,11 +1,18 @@ # Tests whether fortran sources files created during configuration are properly # scanned for dependency information -project('generated', 'fortran') +project('generated', 'fortran', + default_options : ['default_library=static']) conf_data = configuration_data() conf_data.set('ONE', 1) conf_data.set('TWO', 2) +conf_data.set('THREE', 3) + +configure_file(input : 'mod3.fpp', output : 'mod3.f90', configuration : conf_data) +# Manually build absolute path to source file to test +# https://github.com/mesonbuild/meson/issues/7265 +three = library('mod3', meson.current_build_dir() / 'mod3.f90') templates_basenames = ['mod2', 'mod1'] generated_sources = [] @@ -18,5 +25,5 @@ foreach template_basename : templates_basenames endforeach sources = ['prog.f90'] + generated_sources -exe = executable('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 index 42d1fde..c4decf6 100644 --- a/test cases/fortran/7 generated/mod1.fpp +++ b/test cases/fortran/7 generated/mod1.fpp @@ -1,6 +1,6 @@ module mod1 - implicit none +implicit none - integer, parameter :: modval1 = @ONE@ +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 index 594e9df..78ceae4 100644 --- a/test cases/fortran/7 generated/mod2.fpp +++ b/test cases/fortran/7 generated/mod2.fpp @@ -1,7 +1,7 @@ module mod2 - use mod1 - implicit none +use mod1, only : modval1 +implicit none - integer, parameter :: modval2 = @TWO@ +integer, parameter :: modval2 = @TWO@ end module mod2 diff --git a/test cases/fortran/7 generated/mod3.fpp b/test cases/fortran/7 generated/mod3.fpp new file mode 100644 index 0000000..ab3db65 --- /dev/null +++ b/test cases/fortran/7 generated/mod3.fpp @@ -0,0 +1,6 @@ +module mod3 +implicit none + +integer, parameter :: modval3 = @THREE@ + +end module mod3 diff --git a/test cases/fortran/7 generated/prog.f90 b/test cases/fortran/7 generated/prog.f90 index 8a102c0..6ee0bca 100644 --- a/test cases/fortran/7 generated/prog.f90 +++ b/test cases/fortran/7 generated/prog.f90 @@ -1,7 +1,8 @@ -program prog -use mod2 +program generated +use mod2, only : modval1, modval2 +use mod3, only : modval3 implicit none -if (modval1 + modval2 /= 3) stop 1 +if (modval1 + modval2 + modval3 /= 6) error stop -end program prog +end program generated diff --git a/test cases/frameworks/1 boost/meson.build b/test cases/frameworks/1 boost/meson.build index 501ed29..6c23360 100644 --- a/test cases/frameworks/1 boost/meson.build +++ b/test cases/frameworks/1 boost/meson.build @@ -13,7 +13,7 @@ endif # 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']) +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']) diff --git a/test cases/frameworks/2 gtest/meson.build b/test cases/frameworks/2 gtest/meson.build index 2d93b52..ea3ef48 100644 --- a/test cases/frameworks/2 gtest/meson.build +++ b/test cases/frameworks/2 gtest/meson.build @@ -8,7 +8,7 @@ endif gtest_nomain = dependency('gtest', main : false, method : 'system') e = executable('testprog', 'test.cc', dependencies : gtest) -test('gtest test', e) +test('gtest test', e, protocol : 'gtest') e = executable('testprog_nomain', 'test_nomain.cc', dependencies : gtest_nomain) -test('gtest nomain test', e) +test('gtest nomain test', e, protocol : 'gtest') diff --git a/test cases/frameworks/21 libwmf/meson.build b/test cases/frameworks/21 libwmf/meson.build index 6952bf7..9dbab6a 100644 --- a/test cases/frameworks/21 libwmf/meson.build +++ b/test cases/frameworks/21 libwmf/meson.build @@ -1,7 +1,7 @@ project('libwmf test', 'c') wm = find_program('libwmf-config', required : false) -if not wm.found() +if not wm.found() or meson.is_cross_build() error('MESON_SKIP_TEST: libwmf-config not installed') endif diff --git a/test cases/frameworks/23 hotdoc/test.json b/test cases/frameworks/23 hotdoc/test.json index e2d4992..8dd07e0 100644 --- a/test cases/frameworks/23 hotdoc/test.json +++ b/test cases/frameworks/23 hotdoc/test.json @@ -314,5 +314,8 @@ {"type": "file", "file": "usr/share/doc/foobar/html/assets/fonts/dumped.trie"}, {"type": "file", "file": "usr/share/doc/foobar/html/assets/images/home.svg"}, {"type": "file", "file": "usr/share/doc/foobar/html/assets/images/dumped.trie"} - ] + ], + "tools": { + "hotdoc": ">=0.1.0" + } } diff --git a/test cases/frameworks/32 boost root/boost/include/boost/version.hpp b/test cases/frameworks/32 boost root/boost/include/boost/version.hpp new file mode 100644 index 0000000..65e4fab --- /dev/null +++ b/test cases/frameworks/32 boost root/boost/include/boost/version.hpp @@ -0,0 +1,3 @@ +#define BOOST_VERSION 100 + +#error This is not a real version of boost diff --git a/test cases/frameworks/32 boost root/boost/lib/boost_regex-vc142-mt-gd-x32-0_1.lib b/test cases/frameworks/32 boost root/boost/lib/boost_regex-vc142-mt-gd-x32-0_1.lib new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/test cases/frameworks/32 boost root/boost/lib/boost_regex-vc142-mt-gd-x32-0_1.lib diff --git a/test cases/frameworks/32 boost root/boost/lib/boost_regex-vc142-mt-gd-x64-0_1.lib b/test cases/frameworks/32 boost root/boost/lib/boost_regex-vc142-mt-gd-x64-0_1.lib new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/test cases/frameworks/32 boost root/boost/lib/boost_regex-vc142-mt-gd-x64-0_1.lib diff --git a/test cases/frameworks/32 boost root/boost/lib/libboost_regex.so.0.1.0 b/test cases/frameworks/32 boost root/boost/lib/libboost_regex.so.0.1.0 new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/test cases/frameworks/32 boost root/boost/lib/libboost_regex.so.0.1.0 diff --git a/test cases/frameworks/32 boost root/meson.build b/test cases/frameworks/32 boost root/meson.build new file mode 100644 index 0000000..50d2f0d --- /dev/null +++ b/test cases/frameworks/32 boost root/meson.build @@ -0,0 +1,6 @@ +project('boosttest', 'cpp') + +dep = dependency('boost', modules : 'regex', required: false) + +assert(dep.found(), 'expected to find a fake version of boost') +assert(dep.version() == '0.1.0', 'expected to find version 0.1.0') diff --git a/test cases/frameworks/32 boost root/nativefile.ini.in b/test cases/frameworks/32 boost root/nativefile.ini.in new file mode 100644 index 0000000..54510d7 --- /dev/null +++ b/test cases/frameworks/32 boost root/nativefile.ini.in @@ -0,0 +1,2 @@ +[properties] +boost_root = '@MESON_TEST_ROOT@/boost' diff --git a/test cases/frameworks/33 boost split root/boost/extra-dir/include/boost/version.hpp b/test cases/frameworks/33 boost split root/boost/extra-dir/include/boost/version.hpp new file mode 100644 index 0000000..3ba19ee --- /dev/null +++ b/test cases/frameworks/33 boost split root/boost/extra-dir/include/boost/version.hpp @@ -0,0 +1,3 @@ +#define BOOST_VERSION 200 + +#error This is not a real version of boost diff --git a/test cases/frameworks/33 boost split root/boost/lib/boost_regex-vc142-mt-gd-x32-0_2.lib b/test cases/frameworks/33 boost split root/boost/lib/boost_regex-vc142-mt-gd-x32-0_2.lib new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/test cases/frameworks/33 boost split root/boost/lib/boost_regex-vc142-mt-gd-x32-0_2.lib diff --git a/test cases/frameworks/33 boost split root/boost/lib/boost_regex-vc142-mt-gd-x64-0_2.lib b/test cases/frameworks/33 boost split root/boost/lib/boost_regex-vc142-mt-gd-x64-0_2.lib new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/test cases/frameworks/33 boost split root/boost/lib/boost_regex-vc142-mt-gd-x64-0_2.lib diff --git a/test cases/frameworks/33 boost split root/boost/lib/libboost_regex.so.0.2.0 b/test cases/frameworks/33 boost split root/boost/lib/libboost_regex.so.0.2.0 new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/test cases/frameworks/33 boost split root/boost/lib/libboost_regex.so.0.2.0 diff --git a/test cases/frameworks/33 boost split root/meson.build b/test cases/frameworks/33 boost split root/meson.build new file mode 100644 index 0000000..a2353bb --- /dev/null +++ b/test cases/frameworks/33 boost split root/meson.build @@ -0,0 +1,6 @@ +project('boosttest', 'cpp') + +dep = dependency('boost', modules : 'regex', required: false) + +assert(dep.found(), 'expected to find a fake version of boost') +assert(dep.version() == '0.2.0', 'expected to find version 0.2.0') diff --git a/test cases/frameworks/33 boost split root/nativefile.ini.in b/test cases/frameworks/33 boost split root/nativefile.ini.in new file mode 100644 index 0000000..7bd5ac2 --- /dev/null +++ b/test cases/frameworks/33 boost split root/nativefile.ini.in @@ -0,0 +1,3 @@ +[properties] +boost_includedir = '@MESON_TEST_ROOT@/boost/extra-dir/include' +boost_librarydir = '@MESON_TEST_ROOT@/boost/lib' diff --git a/test cases/frameworks/7 gnome/gir/dep1/dep3/dep3.c b/test cases/frameworks/7 gnome/gir/dep1/dep3/dep3.c new file mode 100644 index 0000000..ee5c5e1 --- /dev/null +++ b/test cases/frameworks/7 gnome/gir/dep1/dep3/dep3.c @@ -0,0 +1,124 @@ +#include "dep3.h" + +struct _MesonDep3 +{ + GObject parent_instance; + + gchar *msg; +}; + +G_DEFINE_TYPE (MesonDep3, meson_dep3, G_TYPE_OBJECT) + +enum { + PROP_0, + PROP_MSG, + LAST_PROP +}; + +static GParamSpec *gParamSpecs [LAST_PROP]; + +/** + * meson_dep3_new: + * @msg: The message to set. + * + * Allocates a new #MesonDep3. + * + * Returns: (transfer full): a #MesonDep3. + */ +MesonDep3 * +meson_dep3_new (const gchar *msg) +{ + g_return_val_if_fail (msg != NULL, NULL); + + return g_object_new (MESON_TYPE_DEP3, + "message", msg, + NULL); +} + +static void +meson_dep3_finalize (GObject *object) +{ + MesonDep3 *self = (MesonDep3 *)object; + + g_clear_pointer (&self->msg, g_free); + + G_OBJECT_CLASS (meson_dep3_parent_class)->finalize (object); +} + +static void +meson_dep3_get_property (GObject *object, + guint prop_id, + GValue *value, + GParamSpec *pspec) +{ + MesonDep3 *self = MESON_DEP3 (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_dep3_set_property (GObject *object, + guint prop_id, + const GValue *value, + GParamSpec *pspec) +{ + MesonDep3 *self = MESON_DEP3 (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_dep3_class_init (MesonDep3Class *klass) +{ + GObjectClass *object_class = G_OBJECT_CLASS (klass); + + object_class->finalize = meson_dep3_finalize; + object_class->get_property = meson_dep3_get_property; + object_class->set_property = meson_dep3_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_dep3_init (MesonDep3 *self) +{ +} + +/** + * meson_dep3_return_message: + * @self: a #MesonDep3. + * + * Returns the message. + * + * Returns: (transfer none): a const gchar* + */ +const gchar* +meson_dep3_return_message (MesonDep3 *self) +{ + g_return_val_if_fail (MESON_IS_DEP3 (self), NULL); + + return (const gchar*) self->msg; +} diff --git a/test cases/frameworks/7 gnome/gir/dep1/dep3/dep3.h b/test cases/frameworks/7 gnome/gir/dep1/dep3/dep3.h new file mode 100644 index 0000000..9883d76 --- /dev/null +++ b/test cases/frameworks/7 gnome/gir/dep1/dep3/dep3.h @@ -0,0 +1,21 @@ +#ifndef MESON_DEP3_H +#define MESON_DEP3_H + +#if !defined (MESON_TEST) +#error "MESON_TEST not defined." +#endif + +#include <glib-object.h> + +G_BEGIN_DECLS + +#define MESON_TYPE_DEP3 (meson_dep3_get_type()) + +G_DECLARE_FINAL_TYPE (MesonDep3, meson_dep3, MESON, DEP3, GObject) + +MesonDep3 *meson_dep3_new (const gchar *msg); +const gchar *meson_dep3_return_message (MesonDep3 *self); + +G_END_DECLS + +#endif /* MESON_DEP3_H */ diff --git a/test cases/frameworks/7 gnome/gir/dep1/dep3/meson.build b/test cases/frameworks/7 gnome/gir/dep1/dep3/meson.build new file mode 100644 index 0000000..1ef7765 --- /dev/null +++ b/test cases/frameworks/7 gnome/gir/dep1/dep3/meson.build @@ -0,0 +1,22 @@ +dep3sources = ['dep3.c', 'dep3.h'] + +dep3lib = shared_library( + 'dep3lib', + sources : dep3sources, + dependencies : gobj, + install : true +) + +dep3gir = gnome.generate_gir( + dep3lib, + sources : dep3sources, + nsversion : '1.0', + namespace : 'MesonDep3', + symbol_prefix : 'meson', + identifier_prefix : 'Meson', + includes : ['GObject-2.0'], + install : true +) + +dep3_dep = declare_dependency(link_with : dep3lib, + sources : [dep3gir]) diff --git a/test cases/frameworks/7 gnome/gir/dep1/meson.build b/test cases/frameworks/7 gnome/gir/dep1/meson.build index baa0b1d..2f03ede 100644 --- a/test cases/frameworks/7 gnome/gir/dep1/meson.build +++ b/test cases/frameworks/7 gnome/gir/dep1/meson.build @@ -1,4 +1,5 @@ subdir('dep2') +subdir('dep3') dep1sources = ['dep1.c', 'dep1.h'] @@ -20,11 +21,11 @@ dep1gir = gnome.generate_gir( symbol_prefix : 'meson', identifier_prefix : 'Meson', header: 'dep1.h', - includes : ['GObject-2.0', 'MesonDep2-1.0'], + includes : ['GObject-2.0', 'MesonDep2-1.0', dep3gir[0]], dependencies : [dep2_dep], install : true ) dep1_dep = declare_dependency(link_with : dep1lib, - dependencies : [dep2_dep], + dependencies : [dep2_dep, dep3_dep], sources : [dep1gir]) diff --git a/test cases/frameworks/7 gnome/gir/meson.build b/test cases/frameworks/7 gnome/gir/meson.build index 36bd09c..b1e0fa1 100644 --- a/test cases/frameworks/7 gnome/gir/meson.build +++ b/test cases/frameworks/7 gnome/gir/meson.build @@ -45,7 +45,7 @@ gnome.generate_gir( ) test('gobject introspection/c', girexe) -gir_paths = ':'.join([girlib.outdir(), dep1lib.outdir(), dep2lib.outdir()]) +gir_paths = ':'.join([girlib.outdir(), dep1lib.outdir(), dep2lib.outdir(), dep3lib.outdir()]) envdata = environment() envdata.append('GI_TYPELIB_PATH', gir_paths, separator : ':') envdata.append('LD_LIBRARY_PATH', gir_paths) diff --git a/test cases/frameworks/7 gnome/mkenums/meson.build b/test cases/frameworks/7 gnome/mkenums/meson.build index af4a901..3d7adf0 100644 --- a/test cases/frameworks/7 gnome/mkenums/meson.build +++ b/test cases/frameworks/7 gnome/mkenums/meson.build @@ -126,6 +126,14 @@ enums5 = gnome.mkenums_simple('enums5', sources : 'meson-sample.h', install_header : true, decorator : 'MESON_EXPORT', header_prefix : '#include "meson-decls.h"') + +conf = configuration_data() +conf.set('ENUM_FILE', 'enums5.h') +main = configure_file( + input : 'main.c', + output : 'main5.c', + configuration : conf) + enumexe5 = executable('enumprog5', main, enums5, dependencies : gobj) # Generate template then use as input to mkenums diff --git a/test cases/frameworks/7 gnome/test.json b/test cases/frameworks/7 gnome/test.json index e69c9f0..badf410 100644 --- a/test cases/frameworks/7 gnome/test.json +++ b/test cases/frameworks/7 gnome/test.json @@ -13,12 +13,16 @@ {"type": "file", "platform": "cygwin", "file": "usr/lib/libdep1lib.dll.a"}, {"type": "expr", "file": "usr/lib/?libdep2lib.so"}, {"type": "file", "platform": "cygwin", "file": "usr/lib/libdep2lib.dll.a"}, + {"type": "expr", "file": "usr/lib/?libdep3lib.so"}, + {"type": "file", "platform": "cygwin", "file": "usr/lib/libdep3lib.dll.a"}, {"type": "file", "file": "usr/lib/girepository-1.0/Meson-1.0.typelib"}, {"type": "file", "file": "usr/lib/girepository-1.0/MesonDep1-1.0.typelib"}, {"type": "file", "file": "usr/lib/girepository-1.0/MesonDep2-1.0.typelib"}, + {"type": "file", "file": "usr/lib/girepository-1.0/MesonDep3-1.0.typelib"}, {"type": "file", "file": "usr/share/gir-1.0/Meson-1.0.gir"}, {"type": "file", "file": "usr/share/gir-1.0/MesonDep1-1.0.gir"}, {"type": "file", "file": "usr/share/gir-1.0/MesonDep2-1.0.gir"}, + {"type": "file", "file": "usr/share/gir-1.0/MesonDep3-1.0.gir"}, {"type": "file", "file": "usr/share/glib-2.0/schemas/com.github.meson.gschema.xml"}, {"type": "file", "file": "usr/share/simple-resources.gresource"}, {"type": "file", "file": "usr/include/enums6.h"}, diff --git a/test cases/java/3 args/meson.build b/test cases/java/3 args/meson.build index db9a35c..451e42d 100644 --- a/test cases/java/3 args/meson.build +++ b/test cases/java/3 args/meson.build @@ -1,9 +1,9 @@ project('simplejava', 'java') -add_project_arguments('-target', '1.8', language : 'java') +add_project_arguments('-target', '1.7', language : 'java') javaprog = jar('myprog', 'com/mesonbuild/Simple.java', main_class : 'com.mesonbuild.Simple', - java_args : ['-source', '1.8']) + java_args : ['-source', '1.7']) test('mytest', javaprog) diff --git a/test cases/kconfig/1 basic/.config b/test cases/keyval/1 basic/.config index 071d185..071d185 100644 --- a/test cases/kconfig/1 basic/.config +++ b/test cases/keyval/1 basic/.config diff --git a/test cases/kconfig/1 basic/meson.build b/test cases/keyval/1 basic/meson.build index 5dc8d19..4207b8e 100644 --- a/test cases/kconfig/1 basic/meson.build +++ b/test cases/keyval/1 basic/meson.build @@ -1,6 +1,6 @@ -project('kconfig basic test') +project('keyval basic test') -k = import('unstable-kconfig') +k = import('keyval') conf = k.load('.config') if not conf.has_key('CONFIG_VAL1') @@ -14,3 +14,5 @@ endif if conf.get('CONFIG_VAL_VAL').to_int() != 4 error('Expected CONFIG_VAL_VAL to be 4') endif + +k = import('unstable-keyval') diff --git a/test cases/keyval/1 basic/test.json b/test cases/keyval/1 basic/test.json new file mode 100644 index 0000000..dbdc5af --- /dev/null +++ b/test cases/keyval/1 basic/test.json @@ -0,0 +1,7 @@ +{ + "stdout": [ + { + "line": "WARNING: Module unstable-keyval is now stable, please use the keyval module instead." + } + ] +} diff --git a/test cases/kconfig/2 subdir/.config b/test cases/keyval/2 subdir/.config index 0599d46..0599d46 100644 --- a/test cases/kconfig/2 subdir/.config +++ b/test cases/keyval/2 subdir/.config diff --git a/test cases/kconfig/2 subdir/dir/meson.build b/test cases/keyval/2 subdir/dir/meson.build index 12f1502..291ad93 100644 --- a/test cases/kconfig/2 subdir/dir/meson.build +++ b/test cases/keyval/2 subdir/dir/meson.build @@ -1,5 +1,5 @@ -k = import('unstable-kconfig') +k = import('keyval') conf = k.load(meson.source_root() / '.config') diff --git a/test cases/kconfig/3 load_config files/meson.build b/test cases/keyval/2 subdir/meson.build index 1245b18..0651acf 100644 --- a/test cases/kconfig/3 load_config files/meson.build +++ b/test cases/keyval/2 subdir/meson.build @@ -1,4 +1,4 @@ -project('kconfig subdir test') +project('keyval subdir test') # Test into sub directory subdir('dir') diff --git a/test cases/kconfig/3 load_config files/dir/config b/test cases/keyval/3 load_config files/dir/config index 0599d46..0599d46 100644 --- a/test cases/kconfig/3 load_config files/dir/config +++ b/test cases/keyval/3 load_config files/dir/config diff --git a/test cases/kconfig/3 load_config files/dir/meson.build b/test cases/keyval/3 load_config files/dir/meson.build index d7b8d44..adc5289 100644 --- a/test cases/kconfig/3 load_config files/dir/meson.build +++ b/test cases/keyval/3 load_config files/dir/meson.build @@ -1,5 +1,5 @@ -k = import('unstable-kconfig') +k = import('keyval') conf = k.load(files('config')) diff --git a/test cases/kconfig/2 subdir/meson.build b/test cases/keyval/3 load_config files/meson.build index 1245b18..0651acf 100644 --- a/test cases/kconfig/2 subdir/meson.build +++ b/test cases/keyval/3 load_config files/meson.build @@ -1,4 +1,4 @@ -project('kconfig subdir test') +project('keyval subdir test') # Test into sub directory subdir('dir') diff --git a/test cases/kconfig/4 load_config builddir/config b/test cases/keyval/4 load_config builddir/config index 0599d46..0599d46 100644 --- a/test cases/kconfig/4 load_config builddir/config +++ b/test cases/keyval/4 load_config builddir/config diff --git a/test cases/kconfig/4 load_config builddir/meson.build b/test cases/keyval/4 load_config builddir/meson.build index 1924d23..6bd83db 100644 --- a/test cases/kconfig/4 load_config builddir/meson.build +++ b/test cases/keyval/4 load_config builddir/meson.build @@ -1,6 +1,6 @@ -project('kconfig builddir test') +project('keyval builddir test') -k = import('unstable-kconfig') +k = import('keyval') out_conf = configure_file(input: 'config', output: 'out-config', copy: true) conf = k.load(out_conf) diff --git a/test cases/linuxlike/13 cmake dependency/cmVers.sh b/test cases/linuxlike/13 cmake dependency/cmVers.sh new file mode 100755 index 0000000..70809de --- /dev/null +++ b/test cases/linuxlike/13 cmake dependency/cmVers.sh @@ -0,0 +1,6 @@ +#!/bin/bash + +VERS=$(cmake --version | grep "cmake version") +VERS=${VERS//cmake version/} + +echo -n $VERS diff --git a/test cases/linuxlike/13 cmake dependency/cmake_fake1/cmMesonTestF1Config.cmake b/test cases/linuxlike/13 cmake dependency/cmake_fake1/cmMesonTestF1Config.cmake new file mode 100644 index 0000000..e12aeb9 --- /dev/null +++ b/test cases/linuxlike/13 cmake dependency/cmake_fake1/cmMesonTestF1Config.cmake @@ -0,0 +1,9 @@ +find_package(ZLIB) + +if(ZLIB_FOUND OR ZLIB_Found) + set(cmMesonTestF1_FOUND ON) + set(cmMesonTestF1_LIBRARIES ${ZLIB_LIBRARY}) + set(cmMesonTestF1_INCLUDE_DIRS ${ZLIB_INCLUDE_DIR}) +else() + set(cmMesonTestF1_FOUND OFF) +endif() diff --git a/test cases/linuxlike/13 cmake dependency/cmake_fake2/cmMesonTestF2Config.cmake b/test cases/linuxlike/13 cmake dependency/cmake_fake2/cmMesonTestF2Config.cmake new file mode 100644 index 0000000..a7a55d8 --- /dev/null +++ b/test cases/linuxlike/13 cmake dependency/cmake_fake2/cmMesonTestF2Config.cmake @@ -0,0 +1,9 @@ +find_package(ZLIB) + +if(ZLIB_FOUND OR ZLIB_Found) + set(cmMesonTestF2_FOUND ON) + set(cmMesonTestF2_LIBRARIES ${ZLIB_LIBRARY}) + set(cmMesonTestF2_INCLUDE_DIRS ${ZLIB_INCLUDE_DIR}) +else() + set(cmMesonTestF2_FOUND OFF) +endif() diff --git a/test cases/linuxlike/13 cmake dependency/meson.build b/test cases/linuxlike/13 cmake dependency/meson.build index 79acc83..9918a71 100644 --- a/test cases/linuxlike/13 cmake dependency/meson.build +++ b/test cases/linuxlike/13 cmake dependency/meson.build @@ -6,6 +6,9 @@ if not find_program('cmake', required: false).found() error('MESON_SKIP_TEST cmake binary not available.') endif +# CMake version +cm_vers = run_command(find_program('./cmVers.sh')).stdout().strip() + # Zlib is probably on all dev machines. dep = dependency('ZLIB', version : '>=1.2', method : 'cmake') @@ -41,6 +44,8 @@ assert(depf2.found() == false, 'Invalid CMake targets should fail') # Try to find cmMesonTestDep in a custom prefix # setup_env.json is used by run_project_tests.py:_run_test to point to ./cmake_pref_env/ depPrefEnv = dependency('cmMesonTestDep', required : true, method : 'cmake') +depPrefEnv1 = dependency('cmMesonTestF1', required : true, method : 'cmake') +depPrefEnv2 = dependency('cmMesonTestF2', required : true, method : 'cmake') # Try to find a dependency with a custom CMake module @@ -48,14 +53,16 @@ depm1 = dependency('SomethingLikeZLIB', required : true, components : 'required_ depm2 = dependency('SomethingLikeZLIB', required : true, components : 'required_comp', method : 'cmake', cmake_module_path : ['cmake']) depm3 = dependency('SomethingLikeZLIB', required : true, components : ['required_comp'], cmake_module_path : 'cmake') -# Test some edge cases with spaces, etc. +# Test some edge cases with spaces, etc. (but only for CMake >= 3.15) -testDep1 = dependency('ImportedTarget', required : true, method : 'cmake', cmake_module_path : 'cmake', modules: 'mesonTestLibDefs') -testDep2 = dependency('ImportedTarget', required : true, method : 'cmake', cmake_module_path : 'cmake', modules : ['MesonTest::TestLibDefs']) -testFlagSet1 = executable('testFlagSet1', ['testFlagSet.c'], dependencies: [testDep1]) -testFlagSet2 = executable('testFlagSet2', ['testFlagSet.c'], dependencies: [testDep2]) -test('testFlagSetTest1', testFlagSet1) -test('testFlagSetTest2', testFlagSet2) +if cm_vers.version_compare('>=3.15') + testDep1 = dependency('ImportedTarget', required : true, method : 'cmake', cmake_module_path : 'cmake', modules: 'mesonTestLibDefs') + testDep2 = dependency('ImportedTarget', required : true, method : 'cmake', cmake_module_path : 'cmake', modules : ['MesonTest::TestLibDefs']) + testFlagSet1 = executable('testFlagSet1', ['testFlagSet.c'], dependencies: [testDep1]) + testFlagSet2 = executable('testFlagSet2', ['testFlagSet.c'], dependencies: [testDep2]) + test('testFlagSetTest1', testFlagSet1) + test('testFlagSetTest2', testFlagSet2) +endif # Try to compile a test that takes a dep and an include_directories diff --git a/test cases/linuxlike/13 cmake dependency/test.json b/test cases/linuxlike/13 cmake dependency/test.json index 565713e..fc29f72 100644 --- a/test cases/linuxlike/13 cmake dependency/test.json +++ b/test cases/linuxlike/13 cmake dependency/test.json @@ -1,5 +1,5 @@ { "env": { - "CMAKE_PREFIX_PATH": "@ROOT@/cmake_pref_env" + "CMAKE_PREFIX_PATH": "@ROOT@/cmake_fake1;@ROOT@/cmake_fake2:@ROOT@/cmake_pref_env" } } diff --git a/test cases/linuxlike/3 linker script/meson.build b/test cases/linuxlike/3 linker script/meson.build index 63765e7..5901bf7 100644 --- a/test cases/linuxlike/3 linker script/meson.build +++ b/test cases/linuxlike/3 linker script/meson.build @@ -1,5 +1,11 @@ project('linker script', 'c') +# Solaris 11.4 ld supports --version-script only when you also specify +# -z gnu-version-script-compat +if meson.get_compiler('c').get_linker_id() == 'ld.solaris' + add_project_link_arguments('-Wl,-z,gnu-version-script-compat', language: 'C') +endif + # Static map file mapfile = 'bob.map' vflag = '-Wl,--version-script,@0@/@1@'.format(meson.current_source_dir(), mapfile) diff --git a/test cases/linuxlike/5 dependency versions/meson.build b/test cases/linuxlike/5 dependency versions/meson.build index 94f424d..164e679 100644 --- a/test cases/linuxlike/5 dependency versions/meson.build +++ b/test cases/linuxlike/5 dependency versions/meson.build @@ -31,10 +31,10 @@ dependency('somebrokenlib', version : '>=1.0', required : false) # Search for an external dependency that won't be found, but must later be # found via fallbacks -somelibnotfound = dependency('somelib', required : false) +somelibnotfound = dependency('somelib1', required : false) assert(somelibnotfound.found() == false, 'somelibnotfound was found?') # Find internal dependency without version -somelibver = dependency('somelib', +somelibver = dependency('somelib1', fallback : ['somelibnover', 'some_dep']) assert(somelibver.type_name() == 'internal', 'somelibver should be of type "internal", not ' + somelibver.type_name()) # Find an internal dependency again with the same name and a specific version diff --git a/test cases/python/1 basic/meson.build b/test cases/python/1 basic/meson.build index 9c3af10..bd9a65c 100644 --- a/test cases/python/1 basic/meson.build +++ b/test cases/python/1 basic/meson.build @@ -1,4 +1,4 @@ -project('python sample', 'c') +project('python sample') py_mod = import('python') py = py_mod.find_installation('python3') @@ -12,6 +12,7 @@ py_purelib = py.get_path('purelib') if not py_purelib.endswith('site-packages') error('Python3 purelib path seems invalid? ' + py_purelib) endif +message('Python purelib path:', py_purelib) # could be 'lib64' or 'Lib' on some systems py_platlib = py.get_path('platlib') diff --git a/test cases/python/1 basic/prog.py b/test cases/python/1 basic/prog.py index 9d95aea..720fdb1 100755 --- a/test cases/python/1 basic/prog.py +++ b/test cases/python/1 basic/prog.py @@ -1,9 +1,8 @@ #!/usr/bin/env python3 from gluon import gluonator -import sys print('Running mainprog from root dir.') if gluonator.gluoninate() != 42: - sys.exit(1) + raise ValueError("!= 42") diff --git a/test cases/python/1 basic/subdir/subprog.py b/test cases/python/1 basic/subdir/subprog.py index 08652f0..54178e5 100755 --- a/test cases/python/1 basic/subdir/subprog.py +++ b/test cases/python/1 basic/subdir/subprog.py @@ -4,9 +4,8 @@ # point to source root. from gluon import gluonator -import sys print('Running mainprog from subdir.') if gluonator.gluoninate() != 42: - sys.exit(1) + raise ValueError("!= 42") diff --git a/test cases/python/2 extmodule/blaster.py b/test cases/python/2 extmodule/blaster.py index 7e1eae6..1f01876 100755 --- a/test cases/python/2 extmodule/blaster.py +++ b/test cases/python/2 extmodule/blaster.py @@ -1,14 +1,11 @@ #!/usr/bin/env python3 import tachyon -import sys result = tachyon.phaserize('shoot') if not isinstance(result, int): - print('Returned result not an integer.') - sys.exit(1) + raise SystemExit('Returned result not an integer.') if result != 1: - print('Returned result {} is not 1.'.format(result)) - sys.exit(1) + raise SystemExit('Returned result {} is not 1.'.format(result)) diff --git a/test cases/python/2 extmodule/meson.build b/test cases/python/2 extmodule/meson.build index b4eb960..18d70c8 100644 --- a/test cases/python/2 extmodule/meson.build +++ b/test cases/python/2 extmodule/meson.build @@ -3,26 +3,33 @@ project('Python extension module', 'c', # Because Windows Python ships only with optimized libs, # we must build this project the same way. +if meson.backend() != 'ninja' + error('MESON_SKIP_TEST: Ninja backend required') +endif + + py_mod = import('python') py = py_mod.find_installation() -py_dep = py.dependency() +py_dep = py.dependency(required: false) -if py_dep.found() - subdir('ext') +if not py_dep.found() + error('MESON_SKIP_TEST: Python libraries not found.') +endif - test('extmod', - py, - args : files('blaster.py'), - env : ['PYTHONPATH=' + pypathdir]) +subdir('ext') - # Check we can apply a version constraint - dependency('python3', version: '>=@0@'.format(py_dep.version())) +test('extmod', + py, + args : files('blaster.py'), + env : ['PYTHONPATH=' + pypathdir]) -else - error('MESON_SKIP_TEST: Python3 libraries not found, skipping test.') -endif py3_pkg_dep = dependency('python3', method: 'pkg-config', required : false) if py3_pkg_dep.found() python_lib_dir = py3_pkg_dep.get_pkgconfig_variable('libdir') + + # Check we can apply a version constraint + dependency('python3', version: '>=@0@'.format(py_dep.version())) +else + message('Skipped python3 pkg-config test') endif diff --git a/test cases/python/3 cython/cytest.py b/test cases/python/3 cython/cytest.py index 43443dc..c08ffee 100755 --- a/test cases/python/3 cython/cytest.py +++ b/test cases/python/3 cython/cytest.py @@ -1,23 +1,19 @@ #!/usr/bin/env python3 from storer import Storer -import sys s = Storer() if s.get_value() != 0: - print('Initial value incorrect.') - sys.exit(1) + raise SystemExit('Initial value incorrect.') s.set_value(42) if s.get_value() != 42: - print('Setting value failed.') - sys.exit(1) + raise SystemExit('Setting value failed.') try: s.set_value('not a number') - print('Using wrong argument type did not fail.') - sys.exit(1) + raise SystemExit('Using wrong argument type did not fail.') except TypeError: pass diff --git a/test cases/python/3 cython/meson.build b/test cases/python/3 cython/meson.build index 194920b..5fc07a8 100644 --- a/test cases/python/3 cython/meson.build +++ b/test cases/python/3 cython/meson.build @@ -1,20 +1,26 @@ project('cython', 'c', default_options : ['warning_level=3']) -cython = find_program('cython3', required : false) -py3_dep = dependency('python3', required : false) +if meson.backend() != 'ninja' + error('MESON_SKIP_TEST: Ninja backend required') +endif -if cython.found() and py3_dep.found() - py_mod = import('python') - py3 = py_mod.find_installation() - py3_dep = py3.dependency() - subdir('libdir') +cython = find_program('cython', required : false) +if not cython.found() + error('MESON_SKIP_TEST: Cython3 not found.') +endif - test('cython tester', - py3, - args : files('cytest.py'), - env : ['PYTHONPATH=' + pydir] - ) -else - error('MESON_SKIP_TEST: Cython3 or Python3 libraries not found, skipping test.') +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/python/4 custom target depends extmodule/blaster.py b/test cases/python/4 custom target depends extmodule/blaster.py index 6106f6b..09039cb 100644 --- a/test cases/python/4 custom target depends extmodule/blaster.py +++ b/test cases/python/4 custom target depends extmodule/blaster.py @@ -24,9 +24,7 @@ if options.output: f.write('success') if not isinstance(result, int): - print('Returned result not an integer.') - sys.exit(1) + raise SystemExit('Returned result not an integer.') if result != 1: - print('Returned result {} is not 1.'.format(result)) - sys.exit(1) + raise SystemExit('Returned result {} is not 1.'.format(result)) diff --git a/test cases/python/4 custom target depends extmodule/meson.build b/test cases/python/4 custom target depends extmodule/meson.build index 3835377..d8a62ed 100644 --- a/test cases/python/4 custom target depends extmodule/meson.build +++ b/test cases/python/4 custom target depends extmodule/meson.build @@ -3,11 +3,19 @@ project('Python extension module', 'c', # Because Windows Python ships only with optimized libs, # we must build this project the same way. +if meson.backend() != 'ninja' + error('MESON_SKIP_TEST: Ninja backend required') +endif + py_mod = import('python') py3 = py_mod.find_installation() py3_dep = py3.dependency(required : false) cc = meson.get_compiler('c') +if not py3_dep.found() + error('MESON_SKIP_TEST: Python3 libraries not found, skipping test.') +endif + # Copy to the builddir so that blaster.py can find the built tachyon module # FIXME: We should automatically detect this case and append the correct paths # to PYTHONLIBDIR @@ -20,21 +28,18 @@ import os, sys with open(sys.argv[1], 'rb') as f: assert(f.read() == b'success') ''' -if py3_dep.found() - message('Detected Python version: ' + py3_dep.version()) - if py3_dep.version().version_compare('>=3.8') and cc.get_id() == 'msvc' and cc.version().version_compare('<=19.00.24215.1') - error('MESON_SKIP_TEST: Python modules do not work with Python 3.8 and VS2015 or earlier.') - endif - subdir('ext') - - out_txt = custom_target('tachyon flux', - input : blaster_py, - output : 'out.txt', - command : [py3, '@INPUT@', '-o', '@OUTPUT@'], - depends : pylib, - build_by_default: true) - - test('flux', py3, args : ['-c', check_exists, out_txt]) -else - error('MESON_SKIP_TEST: Python3 libraries not found, skipping test.') + +message('Detected Python version: ' + py3_dep.version()) +if py3_dep.version().version_compare('>=3.8') and cc.get_id() == 'msvc' and cc.version().version_compare('<=19.00.24215.1') + error('MESON_SKIP_TEST: Python modules do not work with Python 3.8 and VS2015 or earlier.') endif +subdir('ext') + +out_txt = custom_target('tachyon flux', + input : blaster_py, + output : 'out.txt', + command : [py3, '@INPUT@', '-o', '@OUTPUT@'], + depends : pylib, + build_by_default: true) + +test('flux', py3, args : ['-c', check_exists, out_txt]) diff --git a/test cases/python/5 modules kwarg/meson.build b/test cases/python/5 modules kwarg/meson.build index 3c9d54f..9751ada 100644 --- a/test cases/python/5 modules kwarg/meson.build +++ b/test cases/python/5 modules kwarg/meson.build @@ -1,7 +1,7 @@ project('python kwarg') py = import('python') -prog_python = py.find_installation('python3', modules : ['setuptools']) +prog_python = py.find_installation('python3', modules : ['distutils']) assert(prog_python.found() == true, 'python not found when should be') prog_python = py.find_installation('python3', modules : ['thisbetternotexistmod'], required : false) assert(prog_python.found() == false, 'python not found but reported as found') diff --git a/test cases/unit/12 promote/subprojects/s2/subprojects/athing.wrap b/test cases/unit/12 promote/subprojects/s2/subprojects/athing.wrap index 09ba4e8..11b2178 100644 --- a/test cases/unit/12 promote/subprojects/s2/subprojects/athing.wrap +++ b/test cases/unit/12 promote/subprojects/s2/subprojects/athing.wrap @@ -1,2 +1 @@ -The contents of this wrap file are never evaluated so they -can be anything. +[wrap-file] diff --git a/test cases/unit/35 dist script/meson.build b/test cases/unit/35 dist script/meson.build index fd672a9..2ae9438 100644 --- a/test cases/unit/35 dist script/meson.build +++ b/test cases/unit/35 dist script/meson.build @@ -5,3 +5,4 @@ exe = executable('comparer', 'prog.c') test('compare', exe) meson.add_dist_script('replacer.py', '"incorrect"', '"correct"') +meson.add_dist_script(find_program('replacer.py'), '"incorrect"', '"correct"') diff --git a/test cases/unit/36 exe_wrapper behaviour/meson.build b/test cases/unit/36 exe_wrapper behaviour/meson.build index 16a44d5..d0817ba 100644 --- a/test cases/unit/36 exe_wrapper behaviour/meson.build +++ b/test cases/unit/36 exe_wrapper behaviour/meson.build @@ -1,7 +1,7 @@ project('exe wrapper behaviour', 'c') assert(meson.is_cross_build(), 'not setup as cross build') -assert(meson.has_exe_wrapper(), 'exe wrapper not defined?') +assert(meson.has_exe_wrapper(), 'exe wrapper not defined?') # intentionally not changed to can_run_host_binaries, exe = executable('prog', 'prog.c') diff --git a/test cases/unit/40 external, internal library rpath/built library/meson.build b/test cases/unit/40 external, internal library rpath/built library/meson.build index f633996..07fe7bb 100644 --- a/test cases/unit/40 external, internal library rpath/built library/meson.build +++ b/test cases/unit/40 external, internal library rpath/built library/meson.build @@ -18,4 +18,9 @@ l = shared_library('bar_built', 'bar.c', if host_machine.system() == 'darwin' e = executable('prog', 'prog.c', link_with: l, install: true) test('testprog', e) +elif host_machine.system() == 'linux' + e = executable('prog', 'prog.c', link_with: l, install: true, + install_rpath: '$ORIGIN/..' / get_option('libdir'), + ) + test('testprog', e) endif diff --git a/test cases/unit/40 external, internal library rpath/external library/meson.build b/test cases/unit/40 external, internal library rpath/external library/meson.build index 3c311f5..06ffa0f 100644 --- a/test cases/unit/40 external, internal library rpath/external library/meson.build +++ b/test cases/unit/40 external, internal library rpath/external library/meson.build @@ -4,16 +4,16 @@ shared_library('foo_in_system', 'foo.c', install : true) l = shared_library('faa_pkg', 'faa.c', install: true) if host_machine.system() == 'darwin' - frameworks = ['-framework', 'CoreFoundation', '-framework', 'CoreMedia'] + ldflags = ['-framework', 'CoreFoundation', '-framework', 'CoreMedia'] allow_undef_args = ['-Wl,-undefined,dynamic_lookup'] else - frameworks = [] + ldflags = ['-Wl,-rpath,${libdir}'] allow_undef_args = [] endif pkg = import('pkgconfig') pkg.generate(name: 'faa_pkg', - libraries: [l] + frameworks, + libraries: [l] + ldflags, description: 'FAA, a pkg-config test library') # cygwin DLLs can't have undefined symbols diff --git a/test cases/unit/57 introspection/meson.build b/test cases/unit/57 introspection/meson.build index 9716eae..5d4dd02 100644 --- a/test cases/unit/57 introspection/meson.build +++ b/test cases/unit/57 introspection/meson.build @@ -13,7 +13,7 @@ test_bool = not test_bool set_variable('list_test_plusassign', []) list_test_plusassign += ['bugs everywhere'] -if false +if not true vers_str = '<=99.9.9' dependency('somethingthatdoesnotexist', required: true, version: '>=1.2.3') dependency('look_i_have_a_fallback', version: ['>=1.0.0', vers_str], fallback: ['oh_no', 'the_subproject_does_not_exist']) @@ -26,7 +26,7 @@ var1 = '1' var2 = 2.to_string() var3 = 'test3' -t1 = executable('test' + var1, ['t1.cpp'], link_with: [sharedlib], install: true, build_by_default: get_option('test_opt2')) +t1 = executable('test' + var1, ['t1.cpp'], link_with: [sharedlib], install: not false, build_by_default: get_option('test_opt2')) t2 = executable('test@0@'.format('@0@'.format(var2)), sources: ['t2.cpp'], link_with: [staticlib]) t3 = executable(var3, 't3.cpp', link_with: [sharedlib, staticlib], dependencies: [dep1]) @@ -46,3 +46,16 @@ message(osmesa_lib_name) # Infinite recursion gets triggered here when the param test('test case 1', t1) test('test case 2', t2) benchmark('benchmark 1', t3) + +### Stuff to test the AST JSON printer +foreach x : ['a', 'b', 'c'] + if x == 'a' + message('a') + elif x == 'b' + message('a') + else + continue + endif + break + continue +endforeach diff --git a/test cases/unit/61 identity cross/build_wrapper.py b/test cases/unit/61 identity cross/build_wrapper.py index b5fe7bb..15d5c07 100755 --- a/test cases/unit/61 identity cross/build_wrapper.py +++ b/test cases/unit/61 identity cross/build_wrapper.py @@ -1,5 +1,11 @@ #!/usr/bin/env python3 -import subprocess, sys +import subprocess, sys, platform -subprocess.call(["cc", "-DEXTERNAL_BUILD"] + sys.argv[1:]) +# Meson does not yet support Studio cc on Solaris, only gcc or clang +if platform.system() == 'SunOS': + cc = 'gcc' +else: + cc = 'cc' + +subprocess.call([cc, "-DEXTERNAL_BUILD"] + sys.argv[1:]) diff --git a/test cases/unit/61 identity cross/host_wrapper.py b/test cases/unit/61 identity cross/host_wrapper.py index e88577c..a3a694a 100755 --- a/test cases/unit/61 identity cross/host_wrapper.py +++ b/test cases/unit/61 identity cross/host_wrapper.py @@ -1,5 +1,11 @@ #!/usr/bin/env python3 -import subprocess, sys +import subprocess, sys, platform -subprocess.call(["cc", "-DEXTERNAL_HOST"] + sys.argv[1:]) +# Meson does not yet support Studio cc on Solaris, only gcc or clang +if platform.system() == 'SunOS': + cc = 'gcc' +else: + cc = 'cc' + +subprocess.call([cc, "-DEXTERNAL_HOST"] + sys.argv[1:]) diff --git a/test cases/unit/72 cross test passed/exewrapper.py b/test cases/unit/72 cross test passed/exewrapper.py new file mode 100755 index 0000000..2c15ed6 --- /dev/null +++ b/test cases/unit/72 cross test passed/exewrapper.py @@ -0,0 +1,24 @@ +#!/usr/bin/env python3 +# Test that the MESON_EXE_WRAPPER environment variable is set + +import argparse +import os +import sys + + +def main(): + parser = argparse.ArgumentParser() + parser.add_argument('binary') # unused, but needed for test behavior + parser.add_argument('--expected', action='store_true') + args = parser.parse_args() + + defined = 'MESON_EXE_WRAPPER' in os.environ + + if args.expected != defined: + print(os.environ, file=sys.stderr) + return 1 + return 0 + + +if __name__ == "__main__": + sys.exit(main()) diff --git a/test cases/unit/72 cross test passed/meson.build b/test cases/unit/72 cross test passed/meson.build new file mode 100644 index 0000000..4deb74b --- /dev/null +++ b/test cases/unit/72 cross test passed/meson.build @@ -0,0 +1,19 @@ +project( + 'cross test passed', + 'c', + version : '>= 0.51' +) + +e = executable('exec', 'src/main.c') + +py = import('python').find_installation() + +test('root', e) +test('main', py, args : [meson.current_source_dir() / 'script.py', e]) + +wrapper_args = [] +if get_option('expect') + wrapper_args += '--expected' +endif + +test('exe_wrapper in env', py, args : [meson.current_source_dir() / 'exewrapper.py', e, wrapper_args]) diff --git a/test cases/unit/72 cross test passed/meson_options.txt b/test cases/unit/72 cross test passed/meson_options.txt new file mode 100644 index 0000000..084c776 --- /dev/null +++ b/test cases/unit/72 cross test passed/meson_options.txt @@ -0,0 +1,5 @@ +option( + 'expect', + type : 'boolean', + value : false, +) diff --git a/test cases/unit/72 cross test passed/script.py b/test cases/unit/72 cross test passed/script.py new file mode 100644 index 0000000..257cd30 --- /dev/null +++ b/test cases/unit/72 cross test passed/script.py @@ -0,0 +1,7 @@ +#!/usr/bin/env python3 + +import subprocess +import sys + +if __name__ == "__main__": + sys.exit(subprocess.run(sys.argv[1:]).returncode) diff --git a/test cases/unit/72 cross test passed/src/main.c b/test cases/unit/72 cross test passed/src/main.c new file mode 100644 index 0000000..490b4a6 --- /dev/null +++ b/test cases/unit/72 cross test passed/src/main.c @@ -0,0 +1,6 @@ +#include <stdio.h> + +int main(int argc, char const *argv[]) +{ + return 0; +} diff --git a/test cases/unit/72 summary/meson.build b/test cases/unit/73 summary/meson.build index df4540d..1bc05ca 100644 --- a/test cases/unit/72 summary/meson.build +++ b/test cases/unit/73 summary/meson.build @@ -13,3 +13,4 @@ summary('A number', 1, section: 'Configuration') summary('yes', true, bool_yn : true, section: 'Configuration') summary('no', false, bool_yn : true, section: 'Configuration') summary('coma list', ['a', 'b', 'c'], list_sep: ', ', section: 'Configuration') +summary('long coma list', ['alpha', 'alphacolor', 'apetag', 'audiofx', 'audioparsers', 'auparse', 'autodetect', 'avi'], list_sep: ', ', section: 'Plugins') diff --git a/test cases/unit/72 summary/subprojects/sub/meson.build b/test cases/unit/73 summary/subprojects/sub/meson.build index e7d7833..e7d7833 100644 --- a/test cases/unit/72 summary/subprojects/sub/meson.build +++ b/test cases/unit/73 summary/subprojects/sub/meson.build diff --git a/test cases/unit/72 summary/subprojects/sub2/meson.build b/test cases/unit/73 summary/subprojects/sub2/meson.build index 86b9cfd..86b9cfd 100644 --- a/test cases/unit/72 summary/subprojects/sub2/meson.build +++ b/test cases/unit/73 summary/subprojects/sub2/meson.build diff --git a/test cases/unit/73 wrap file url/meson.build b/test cases/unit/74 wrap file url/meson.build index 3bd3b25..3bd3b25 100644 --- a/test cases/unit/73 wrap file url/meson.build +++ b/test cases/unit/74 wrap file url/meson.build diff --git a/test cases/unit/73 wrap file url/subprojects/foo-patch.tar.xz b/test cases/unit/74 wrap file url/subprojects/foo-patch.tar.xz Binary files differindex fdb026c..fdb026c 100644 --- a/test cases/unit/73 wrap file url/subprojects/foo-patch.tar.xz +++ b/test cases/unit/74 wrap file url/subprojects/foo-patch.tar.xz diff --git a/test cases/unit/73 wrap file url/subprojects/foo.tar.xz b/test cases/unit/74 wrap file url/subprojects/foo.tar.xz Binary files differindex 2ed6ab4..2ed6ab4 100644 --- a/test cases/unit/73 wrap file url/subprojects/foo.tar.xz +++ b/test cases/unit/74 wrap file url/subprojects/foo.tar.xz diff --git a/test cases/unit/75 dep files/foo.c b/test cases/unit/75 dep files/foo.c new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/test cases/unit/75 dep files/foo.c diff --git a/test cases/unit/74 dep files/meson.build b/test cases/unit/75 dep files/meson.build index 4829f56..4829f56 100644 --- a/test cases/unit/74 dep files/meson.build +++ b/test cases/unit/75 dep files/meson.build diff --git a/test cases/unit/77 pkgconfig prefixes/client/client.c b/test cases/unit/77 pkgconfig prefixes/client/client.c new file mode 100644 index 0000000..be9bead --- /dev/null +++ b/test cases/unit/77 pkgconfig prefixes/client/client.c @@ -0,0 +1,8 @@ +#include <val2.h> +#include <stdio.h> + +int main(int argc, char **argv) +{ + printf("%d\n", val2()); + return 0; +} diff --git a/test cases/unit/77 pkgconfig prefixes/client/meson.build b/test cases/unit/77 pkgconfig prefixes/client/meson.build new file mode 100644 index 0000000..491937b --- /dev/null +++ b/test cases/unit/77 pkgconfig prefixes/client/meson.build @@ -0,0 +1,3 @@ +project('client', 'c') +val2_dep = dependency('val2') +executable('client', 'client.c', dependencies : [val2_dep], install: true) diff --git a/test cases/unit/77 pkgconfig prefixes/val1/meson.build b/test cases/unit/77 pkgconfig prefixes/val1/meson.build new file mode 100644 index 0000000..cc63e31 --- /dev/null +++ b/test cases/unit/77 pkgconfig prefixes/val1/meson.build @@ -0,0 +1,5 @@ +project('val1', 'c') +val1 = shared_library('val1', 'val1.c', install: true) +install_headers('val1.h') +pkgconfig = import('pkgconfig') +pkgconfig.generate(val1, libraries : ['-Wl,-rpath,${libdir}']) diff --git a/test cases/unit/77 pkgconfig prefixes/val1/val1.c b/test cases/unit/77 pkgconfig prefixes/val1/val1.c new file mode 100644 index 0000000..591e521 --- /dev/null +++ b/test cases/unit/77 pkgconfig prefixes/val1/val1.c @@ -0,0 +1,3 @@ +#include "val1.h" + +int val1(void) { return 1; } diff --git a/test cases/unit/77 pkgconfig prefixes/val1/val1.h b/test cases/unit/77 pkgconfig prefixes/val1/val1.h new file mode 100644 index 0000000..6bd435e --- /dev/null +++ b/test cases/unit/77 pkgconfig prefixes/val1/val1.h @@ -0,0 +1 @@ +int val1(void); diff --git a/test cases/unit/77 pkgconfig prefixes/val2/meson.build b/test cases/unit/77 pkgconfig prefixes/val2/meson.build new file mode 100644 index 0000000..ce69481 --- /dev/null +++ b/test cases/unit/77 pkgconfig prefixes/val2/meson.build @@ -0,0 +1,8 @@ +project('val2', 'c') +val1_dep = dependency('val1') +val2 = shared_library('val2', 'val2.c', + dependencies : [val1_dep], + install: true) +install_headers('val2.h') +pkgconfig = import('pkgconfig') +pkgconfig.generate(val2, libraries : ['-Wl,-rpath,${libdir}']) diff --git a/test cases/unit/77 pkgconfig prefixes/val2/val2.c b/test cases/unit/77 pkgconfig prefixes/val2/val2.c new file mode 100644 index 0000000..d7d4857 --- /dev/null +++ b/test cases/unit/77 pkgconfig prefixes/val2/val2.c @@ -0,0 +1,4 @@ +#include "val1.h" +#include "val2.h" + +int val2(void) { return val1() + 2; } diff --git a/test cases/unit/77 pkgconfig prefixes/val2/val2.h b/test cases/unit/77 pkgconfig prefixes/val2/val2.h new file mode 100644 index 0000000..995023d --- /dev/null +++ b/test cases/unit/77 pkgconfig prefixes/val2/val2.h @@ -0,0 +1 @@ +int val2(void); diff --git a/test cases/unit/78 subdir libdir/meson.build b/test cases/unit/78 subdir libdir/meson.build new file mode 100644 index 0000000..5099c91 --- /dev/null +++ b/test cases/unit/78 subdir libdir/meson.build @@ -0,0 +1,2 @@ +project('toplevel', 'c') +subproject('flub') diff --git a/test cases/unit/78 subdir libdir/subprojects/flub/meson.build b/test cases/unit/78 subdir libdir/subprojects/flub/meson.build new file mode 100644 index 0000000..7bfd2c5 --- /dev/null +++ b/test cases/unit/78 subdir libdir/subprojects/flub/meson.build @@ -0,0 +1 @@ +project('subflub', 'c') diff --git a/test cases/unit/79 user options for subproject/75 user options for subproject/.gitignore b/test cases/unit/79 user options for subproject/75 user options for subproject/.gitignore new file mode 100644 index 0000000..4976afc --- /dev/null +++ b/test cases/unit/79 user options for subproject/75 user options for subproject/.gitignore @@ -0,0 +1 @@ +subprojects/* diff --git a/test cases/unit/79 user options for subproject/75 user options for subproject/meson.build b/test cases/unit/79 user options for subproject/75 user options for subproject/meson.build new file mode 100644 index 0000000..0bc395b --- /dev/null +++ b/test cases/unit/79 user options for subproject/75 user options for subproject/meson.build @@ -0,0 +1,3 @@ +project('user option for subproject') + +p = subproject('sub') diff --git a/test cases/unit/80 global-rpath/meson.build b/test cases/unit/80 global-rpath/meson.build new file mode 100644 index 0000000..c67d9e0 --- /dev/null +++ b/test cases/unit/80 global-rpath/meson.build @@ -0,0 +1,3 @@ +project('global-rpath', 'cpp') +yonder_dep = dependency('yonder') +executable('rpathified', 'rpathified.cpp', dependencies: [yonder_dep], install: true) diff --git a/test cases/unit/80 global-rpath/rpathified.cpp b/test cases/unit/80 global-rpath/rpathified.cpp new file mode 100644 index 0000000..3788906 --- /dev/null +++ b/test cases/unit/80 global-rpath/rpathified.cpp @@ -0,0 +1,6 @@ +#include <yonder.h> +#include <string.h> +int main(int argc, char **argv) +{ + return strcmp(yonder(), "AB54 6BR"); +} diff --git a/test cases/unit/80 global-rpath/yonder/meson.build b/test cases/unit/80 global-rpath/yonder/meson.build new file mode 100644 index 0000000..e32f383 --- /dev/null +++ b/test cases/unit/80 global-rpath/yonder/meson.build @@ -0,0 +1,5 @@ +project('yonder', 'cpp') +yonder = shared_library('yonder', 'yonder.cpp', install: true) +install_headers('yonder.h') +pkgconfig = import('pkgconfig') +pkgconfig.generate(yonder) diff --git a/test cases/unit/80 global-rpath/yonder/yonder.cpp b/test cases/unit/80 global-rpath/yonder/yonder.cpp new file mode 100644 index 0000000..b182d34 --- /dev/null +++ b/test cases/unit/80 global-rpath/yonder/yonder.cpp @@ -0,0 +1,3 @@ +#include "yonder.h" + +char *yonder(void) { return "AB54 6BR"; } diff --git a/test cases/unit/80 global-rpath/yonder/yonder.h b/test cases/unit/80 global-rpath/yonder/yonder.h new file mode 100644 index 0000000..9d9ad16 --- /dev/null +++ b/test cases/unit/80 global-rpath/yonder/yonder.h @@ -0,0 +1 @@ +char *yonder(void); diff --git a/test cases/unit/81 wrap-git/meson.build b/test cases/unit/81 wrap-git/meson.build new file mode 100644 index 0000000..b0af30a --- /dev/null +++ b/test cases/unit/81 wrap-git/meson.build @@ -0,0 +1,4 @@ +project('test-wrap-git') + +exe = subproject('wrap_git').get_variable('exe') +test('test1', exe) diff --git a/test cases/unit/81 wrap-git/subprojects/packagefiles/wrap_git_builddef/meson.build b/test cases/unit/81 wrap-git/subprojects/packagefiles/wrap_git_builddef/meson.build new file mode 100644 index 0000000..2570f77 --- /dev/null +++ b/test cases/unit/81 wrap-git/subprojects/packagefiles/wrap_git_builddef/meson.build @@ -0,0 +1,3 @@ +project('foo', 'c') + +exe = executable('app', 'main.c') diff --git a/test cases/unit/81 wrap-git/subprojects/wrap_git_upstream/main.c b/test cases/unit/81 wrap-git/subprojects/wrap_git_upstream/main.c new file mode 100644 index 0000000..8488f4e --- /dev/null +++ b/test cases/unit/81 wrap-git/subprojects/wrap_git_upstream/main.c @@ -0,0 +1,4 @@ +int main(void) +{ + return 0; +} diff --git a/test cases/warning/1 version for string div/test.json b/test cases/warning/1 version for string div/test.json new file mode 100644 index 0000000..c37931a --- /dev/null +++ b/test cases/warning/1 version for string div/test.json @@ -0,0 +1,8 @@ +{ + "stdout": [ + { + "comment": "literal '/' appears in output, irrespective of os.path.sep, as that's the operator", + "line": "WARNING: Project targeting '>=0.48.0' but tried to use feature introduced in '0.49.0': / with string arguments." + } + ] +} diff --git a/test cases/warning/2 languages missing native/meson.build b/test cases/warning/2 languages missing native/meson.build index f4aa956..e204715 100644 --- a/test cases/warning/2 languages missing native/meson.build +++ b/test cases/warning/2 languages missing native/meson.build @@ -1,2 +1,3 @@ -project('languages missing native') +project('languages missing native', + meson_version : '>= 0.54') add_languages('c') diff --git a/test cases/warning/2 languages missing native/test.json b/test cases/warning/2 languages missing native/test.json new file mode 100644 index 0000000..f929654 --- /dev/null +++ b/test cases/warning/2 languages missing native/test.json @@ -0,0 +1,7 @@ +{ + "stdout": [ + { + "line": "test cases/warning/2 languages missing native/meson.build:3: WARNING: add_languages is missing native:, assuming languages are wanted for both host and build." + } + ] +} diff --git a/test cases/windows/17 msvc ndebug/main.cpp b/test cases/windows/17 msvc ndebug/main.cpp new file mode 100644 index 0000000..d647d71 --- /dev/null +++ b/test cases/windows/17 msvc ndebug/main.cpp @@ -0,0 +1,9 @@ +int main() { +#ifdef NDEBUG + // NDEBUG is defined + return 0; +#else + // NDEBUG is not defined + return 1; +#endif +}
\ No newline at end of file diff --git a/test cases/windows/17 msvc ndebug/meson.build b/test cases/windows/17 msvc ndebug/meson.build new file mode 100644 index 0000000..78eaf89 --- /dev/null +++ b/test cases/windows/17 msvc ndebug/meson.build @@ -0,0 +1,7 @@ +project('msvc_ndebug', 'cpp', + default_options : [ 'b_ndebug=true' ] +) + +exe = executable('exe', 'main.cpp') + +test('ndebug', exe) |