aboutsummaryrefslogtreecommitdiff
path: root/test cases
AgeCommit message (Collapse)AuthorFilesLines
2023-09-09gnome.mkenum_simple(): Fix include path when header is in subdirXavier Claessens4-0/+22
It was generating #include with the basename of every header file. That assumes that every directory where there are headers are also included into search path when compiling the .c file. Change to use path relative to current subdir, which can be both in build or source directory. That means that we assume that when the .c file is compiled, the target has a include_directories pointing to the directory where gnome.mkenum_simple() has been called, which is generally '.' and added automatically. Also fix type annotation to only allow str and File sources, other types have never been working, it would require to iterate over custom target outputs, etc. Fixes: #7582
2023-09-09Add support for padding zeroes in int.to_string() methodNomura1-0/+9
2023-09-09Add macro_name option to configure_fileNicholas Vinson2-0/+32
Allow macro_name to be speficied as a parameter to configure_file(). This allows C macro-style include guards to be added to configure_file()'s output when a template file is not given. This change simplifies the creation of configure files that define macros with dynamic names and want the C-style include guards.
2023-09-08Override config-tool get_variable args for qmakeNirbheek Chauhan1-0/+3
2023-09-07Fix include_directories test for relative pathCharles Brunet2-0/+29
- On Windows, it was not detected if include directory was an absolute path to source directory, because of the mis of path separators. - In the edgecase the include directory begins with the exact same string as the source directory, but is a different directory, it was falsely reported as an error. Fixes #12217.
2023-09-07Fix crash when installing a vala library and python sourcesXavier Claessens3-1/+8
Installing python sources causes the python module to call create_install_data() before Ninja backends adds extra outputs to Vala targets. Target objects are supposed to be immutable, adding outputs that late is totally wrong. Add extra vala outputs immediately, but be careful because the main output is only added later in post_init(). Luckily the base class already puts a placeholder item in self.outputs for the main filename so we can just replace self.outputs[0] instead of replacing the whole list which would contain vala outputs at that stage. This is surprisingly what SharedLibrary was already doing.
2023-09-07Compiler checks must use per-subproject optionsXavier Claessens1-0/+4
Fixes: #12202
2023-09-07Add compiler.has_defineMarvin Scholz1-40/+49
Adds a new method to the compiler object, has_define. This makes it possible to check if a preprocessor macro/define is set or not. This is especially helpful if the define in question is empty, for example: #define MESON_EMPTY_DEFINE This would yield the same results as a missing define with the existing get_define method, as it would return an empty string for both cases. Therefore this additional method is needed.
2023-09-06tests: Test extern'd globals on MacOS with the Apple ArchiverAilin Nemui5-0/+31
This forces the use of the Apple archiver, since that archiver doesn't add extern'd variables to the symbol table automatically, and instead requires that ranlib be used. A native file is used to ensure that Apple's ar is used even in the presence of llvm or gcc in the path with their superior archivers. Co-authored-by: Dylan Baker <dylan@pnwbakers.com>
2023-09-06qt module: add include_directories to moc compileCharles Brunet4-3/+15
Fixes #12182
2023-09-05wrap: Use MESON_PACKAGE_CACHE_DIR as default packagecache pathXavier Claessens5-0/+13
Allow packagecache to contain already extracted directory to match what some distro does with Cargo source packages in /usr/share/cargo/registry. Note that there is no need to lock the cache directory because we download into a temporary name and atomically rename afterward. It means we could be downloading the same file twice, but at least integrity is guaranteed. Fixes: #12211
2023-08-31add json output format to configure fileCharles Brunet5-0/+82
2023-08-30Re-enable "11 runpath rpath ldlibrarypath"Tristan Partin2-3/+1
The bug it was blocked on was fixed in a0514a7c4183a9e42d436865087d2f887d658d54.
2023-08-30Disable failing test on cygwin due to broken cmakeCharles Brunet1-1/+8
See https://gitlab.kitware.com/cmake/cmake/-/issues/25200.
2023-08-30ci: Skip gir test on cygwinXavier Claessens2-1/+7
2023-08-30Merge pull request #10332 from xclaesse/std-optJussi Pakkanen1-0/+6
c_std, cpp_std: Change to a list of desired versions in preference order
2023-08-29gnome: Fix crash in gtkdoc and generate_gir in C++ projectsXavier Claessens9-0/+77
gtkdoc() and generate_gir() methods assumes there is a C compiler, but pure C++ projects might not add it explicitly. Fixes: #12162
2023-08-28include_directories: Always add both source and build dirsXavier Claessens2-0/+13
Compiler checks were not adding build dir side, which prevents using headers generated with configure_file().
2023-08-24find_program: Fallback if version mismatchXavier Claessens5-0/+21
Fixes: #11797
2023-08-22compilers: fix checks handling of internal dependenciesBenoit Pierre2-0/+8
The include directories were not passed to the compiler.
2023-08-18Revert "Revert "Add fs.relative_to()""Tristan Partin3-1/+59
This reverts commit 84c8905d527893bedc673e8a036b8b2ec89368b4. Fixed the cygwin failure...
2023-08-17Revert "Add fs.relative_to()"Eli Schwartz3-63/+1
This reverts commit f52bcaa27fc125ab9ae583af466ba99c164169f3. It did not pass CI, and was merged anyway because there were two CI errors in the same cygwin job. The other error was not the fault of this commit, and since cygwin errors were glossed over because they were "expected", the presence of a new error *added* by this commit was overlooked. Per the meson development policy, PRs which result in CI errors can/should be reverted at will, no questions asked.
2023-08-17skip test on pkgconf 2.0.1 that is broken there due to a reported bugEli Schwartz1-0/+4
2023-08-17Remove hacky setup for CustomTargetIndex tests in fs.relative_to()Tristan Partin1-21/+5
2023-08-17Remove XML filter from testlog.{json,txt} and std streamsTristan Partin1-1/+1
This was an unintended consequence of the original patch in #11977. Co-authored-by: Benoit Pierre <benoit.pierre@gmail.com>
2023-08-17Add fs.relative_to()Tristan Partin3-1/+79
Returns a relative path from arg 2 to arg 1 similar to os.path.relpath().
2023-08-16fs.read(): Catch FileNotFoundErrorXavier Claessens1-0/+4
2023-08-14Python: Add 'limited_api' kwarg to extension_moduleAndrew McNulty6-0/+129
This commit adds a new keyword arg to extension_module() that enables a user to target the Python Limited API, declaring the version of the limited API that they wish to target. Two new unittests have been added to test this functionality.
2023-08-08tests: fix "4 custom target depends extmodule" with Python 3.8+ on WindowsChristoph Reiter2-0/+6
Since CPython 3.8 .pyd files no longer look in PATH for loading libraries, but require the DLL directory to be explicitely added via os.add_dll_directory(). This resulted in those tests failing with 3.8+ on Windows. Add the DLL build directory with os.add_dll_directory() to fix them. This was never noticed in CI because it only uses Python 3.7 and the MSYS2 CPython still used the old behaviour until now.
2023-08-07Error when an installed static library links to internal custom targetXavier Claessens2-1/+52
When an installed static library A links to an internal static library B built using a custom_target(), raise an error instead of a warning. This is because to be usable, A needs to contain B which would require to extract the archive to get its objects files. This used to work, but was printing a warning and was installing a broken static library, because we used to overlink in many cases, and that got fixed in Meson 1.2.0. It now fails at link time with symbols from the custom target not being defined. It's better to turn the warning into a hard error at configure time. While at it, noticed this situation can happen for any internal custom or rust target we link to, recursively. get_internal_static_libraries_recurse() could be called on CustomTarget objects which do not implement it, and even if we did not call that method, it would still fail when trying to call extract_all_objects() on it. Fixes: #12006
2023-08-07c_std, cpp_std: Change to a list of desired versions in preference orderXavier Claessens1-0/+6
Projects that prefer GNU C but can fallback to ISO C can now set for example `default_options: 'c_std=gnu11,c11'` and it will use gnu11 when available, fallback to c11 otherwise. It is an error only if none of the values are supported by the current compiler. This allows to deprecate gnuXX values from MSVC compiler, that means that `default_options: 'c_std=gnu11'` will now print warning with MSVC but still fallback to 'c11' value. No warning is printed if at least one of the values is valid, i.e. `default_options: 'c_std=gnu11,c11'`. In the future that deprecation warning will become an hard error because `c_std=gnu11` should mean GNU is required, for projects that cannot be built with MSVC for example.
2023-08-07Compiler: Add werror kwarg to compiles(), links() and run() methodsXavier Claessens1-0/+23
Fixes: #5399
2023-08-05compiler: Add required keyword to has_* methodsXavier Claessens2-0/+68
add the "required" keyword to the functions has_function has_type has_member has_members has_argument has_multi_arguments has_link_argument has_multi_link_argument has_function_attribute Co-authored-by: Milan Hauth <milahu@gmail.com>
2023-08-04Add default_options argument to find_program()Nomura5-0/+20
2023-08-02Unify message(), format() and fstring formattingXavier Claessens3-0/+49
Share a common function to convert objects to display strings for consistency. While at it, also add support for formatting user options.
2023-08-02treewide: internally avoid deprecated machine file uses of "pkgconfig"Eli Schwartz3-3/+3
We support this in a machine file: ``` [binaries] pkgconfig = 'pkg-config' pkg-config = 'pkg-config' ``` and you can use either one, because internally we look up both. If you only set *one* of them, this plays awkwardly with setting $PKG_CONFIG, since we don't know which one you set in the machine file and the *other* one will be initialized from the environment instead. In commit 22df45a31981874310a78dde0df59a6a7c5ebb29 we changed program lookup of config-tool style dependencies to use the regular tool names and only fall back on the strange internal names. This affected the pkg-config class too. The result is that instead of preferring `pkgconfig =` followed by $PKG_CONFIG followed by `pkg-config =`, we inverted the lookup order. This is a good idea anyway, because now it behaves consistently with `find_program('pkg-config')`. Unfortunately, we documented the wrong name in a bunch of places, and also used the wrong name in various testsuite bits, which meant that if you set $PKG_CONFIG and then ran the testsuite, it would fail. Correct these references, because they are buggy. One test case expected to find_program() a native copy for convenience of testing against natively installed glib. Force it to resolve a native copy.
2023-07-26Fix install_data() default install pathDaniele Nicolodi5-1/+11
This fixes two issues in constructing the default installation path when install_dir is not specified: - inside a subproject, install_data() would construct the destination path using the parent project name instead than the current project name, - when specifying preserve_path, install_data() would construct the destination path omitting the project name. Fixes #11910.
2023-07-25modules/pkgconfig: Don't insert None into devenv listDylan Baker1-0/+3
When the pkgconfig module is imported, but not used, it will insert None on the end of the devenv list. This list is not expected to contain None, and causes Meson to crash. This can happen in complex build setups (reported from mesa), where pkgconfig is only used in some configurations Fixes: #12032
2023-07-23hdf5 tests: make cpp test actually use cpp HDF5George Sedov1-19/+9
the previous version didn't even link to libhdf5_cpp.so
2023-07-18tests: bump the C++ std for protobuf testsEli Schwartz1-1/+1
Based on https://opensource.google/documentation/policies/cplusplus-support Google no longer supports C++11, and protobuf spawns an `#error` if you don't have at least 14. So, perform our currently scheduled automatic bump.
2023-07-18tests: mark gpgme test skippable on Ubuntu rollingEli Schwartz1-1/+1
It has been rebuilt to no longer provide the deprecated gpgme-config tool.
2023-07-18ci: Skip test_generate_gir_with_address_sanitizerXavier Claessens1-0/+9
It fails with glib >= 2.76 and gobject-introspection <= 1.76.1. Fixes: #11754
2023-07-16Fix build using GDC 13Jussi Pakkanen2-32/+47
Do not run tests that use integers in versions with compiler that do not support them. Old versions of GDC supported plain integers in version and debug strings but they are deprecated and GDC 13 hard errors on them.
2023-07-15rust: disable overflow-checks by defaultDylan Baker4-6/+42
These result in very large binaries when linked, and are not generally useful. A user can turn them back on by passing `-C overflow-checks=yes` manually via `-Drust_args` or the `RUSTFLAGS` environment variable fixes: #11785
2023-07-14compiler.compiles/links: fix failure when compiling a built File objectEli Schwartz1-5/+12
In order to pass a File object down into the compiler impl and compile it, we cannot pass a string with the filename, and we cannot either pass the File object as-is, since it relies on being given Environment attributes to calculate the relative location. So we build a fresh File object as an absolute path. But the code to do this was totally broken. Instead of using the File method to get an absolute path, we used one that expected to create builddir-relative paths... and then gave it the absolute source dir as the "relative path portion" prefix. This worked by accident as long as it wasn't a built File, but if it was a built file then we intentionally didn't include that prefix -- which was wrong anyway, since we need the build directory! Use the correct method to get an absolute path in all cases, and emit a warning if it was a built file. This never worked. Sometimes it crashed, sometimes it silently returned false. Fixes #11983
2023-07-13cmake: fix directory separators in generated packageConfig.cmake filesMatthieu Rogez3-0/+25
On windows, meson would mix posix and windows dir separators in the computed PACKAGE_RELATIVE_PATH. Here we force posix directory separator even on Windows. This matches the CMake behavior and fixes interpretation of the resulting path. Fixes #6955 Fixes #9702
2023-07-13Silence some encoding warningsTristan Partin2-4/+4
By specifiying explicit encodings, we can silence warnings like: /__w/meson/meson/test cases/common/100 postconf with args/postconf.py:15: EncodingWarning: 'encoding' argument not specified with open(input_file) as f: in CI.
2023-07-13mtest: fix unencodable XML charsNazir Bilal Yavuz2-0/+41
Replace unencodable XML chars with their printable representation, so that, xmllint can parse test outputs without error. Closes #9894 Co-authored-by: Tristan Partin <tristan@partin.io>
2023-07-10build: dependencies should come after link_with on link commandXavier Claessens1-0/+11
This fixes regression caused by https://github.com/mesonbuild/meson/commit/3162b901cab46d66a30c66a4406195523714ecdc that changes the order in which libraries are put on the link command. In addition, that commit was wrong because libraries from dependencies were processed before process_compiler() is called, which that commit wanted to avoid.
2023-07-10build: Fix linking multiple libraries and some are promotedXavier Claessens1-0/+9
When a link() is promoted to link_whole() we still have to handle the rest of the list. Fixes: #11956