aboutsummaryrefslogtreecommitdiff
path: root/unittests
AgeCommit message (Collapse)AuthorFilesLines
2024-07-30unittests: fix EncodingWarnings. minus 123 warnings collected by pytestEli Schwartz5-6/+6
2024-07-23CI: skip LTO tests on cygwinEli Schwartz1-0/+2
A GCC update broke this and is being investigated Bug: #13465
2024-07-21Remove the exe_exists functionMads Andreasen1-4/+0
This function is no longer used since shutil.which() is used instead.
2024-07-17Remove module type from OptionKey.Jussi Pakkanen1-2/+2
2024-07-17Remove language (AKA compiler) type from OptionKey.Jussi Pakkanen3-8/+8
2024-07-17Remove option type from OptionKey and get it from OptionStore instead.Jussi Pakkanen2-8/+8
2024-07-16unittests: Add type annotations to the helpers moduleDylan Baker1-31/+52
2024-07-11Move OptionKey in the option source file.Jussi Pakkanen6-9/+12
2024-07-11Move project option detection into OptionStore.Jussi Pakkanen1-2/+5
2024-07-10Replace exe_exists function with shutil.which()Mads Andreasen1-0/+5
The documentation for subprocess.run at https://docs.python.org/3/library/subprocess.html#popen-constructor has a warning, pointing to using shutil.which() instead of subprocess.run for detecting if exe files exists on the path. shutil.which() is used in many places already.
2024-06-29linkers: Fix AppleDynamicLinker not returning any rpaths to removePiotr BrzeziƄski2-0/+19
Fixes regression from commit 78e9009ff9d36925e04f329f9082841002ddd848. The above commit relied on rpath_dirs_to_remove being present and correctly filled, which was never the case for the AppleDynamicLinker. The result was that all the build-dir-only RPATHs were being carried over to the installed files. This commit implements returning the list of RPATHs to remove in AppleDynamicLinker, doing pretty much the same thing as what's in the GnuLikeDynamicLinkerMixin. Thanks to that, depfixer now correctly removes build-time Meson-created RPATHs, as it used to before 1.4.1.
2024-06-14cargo: Load Cargo.lockXavier Claessens1-1/+35
Cargo.lock is essentially identical to subprojects/*.wrap files. When a (sub)project has a Cargo.lock file this allows automatic fallback for its cargo dependencies.
2024-06-14wrap: Clarify PackageDefinition APIXavier Claessens1-4/+4
This will simplify creating PackageDefinition objects from Cargo.lock file. It contains basically the same information.
2024-06-14Merge pull request #13307 from mesonbuild/optstorerefactorJussi Pakkanen4-35/+35
Convert OptionStore from a dict to a full class with named methods
2024-06-14Replace direct indexing with named methods.Jussi Pakkanen4-35/+35
2024-06-14Rename option variable to optstore to make it unique.Jussi Pakkanen4-35/+35
2024-06-11unittests: Add Python unittest for limited APIAndrew McNulty1-1/+30
This new unittest runs the existing Python limited API test case, and checks that the resulting library was linked to the correct library.
2024-06-05Add -export_dynamic flag for AppleDynamicLinkerWolfgang Walther1-0/+12
The apple linker uses -export_dynamic instead of --export-dynamic [1]. This should be set when setting export_dynamic: true. Resolves #13290 [1]: https://opensource.apple.com/source/ld64/ld64-609/doc/man/man1/ld.1.auto.html
2024-06-04Extract native file parser to machinefile source file.Jussi Pakkanen2-2/+2
2024-06-02Create a directory for machine files used in unit tests.Jussi Pakkanen3-34/+31
2024-06-02Start moving machine files to their own store.Jussi Pakkanen1-1/+12
2024-05-23Refactor option classes to their own file.Jussi Pakkanen2-3/+4
2024-05-09implement @PLAINNAME0@ and @BASENAME0@Stas Sergeev1-1/+10
@PLAINNAME@ and @BASENAME@ cannot be used in custom_target() with multiple inputs. For those, similar macros are needed with an index. Fixes #13164
2024-04-27mdist: gracefully handle stale Git indexBenjamin Gilbert1-1/+4
Running `touch` on a tracked file in Git, to update its timestamp, and then running `meson dist` would cause dist to fail: ERROR: Repository has uncommitted changes that will not be included in the dist tarball Use --allow-dirty to ignore the warning and proceed anyway Unlike `git status` and `git diff`, `git diff-index` doesn't refresh the index before comparing, so stat changes are assumed to imply content changes. Run `git update-index -q --refresh` first to refresh the index. Fixes: #12985
2024-04-15Add bztar support to meson distTristan Partin1-1/+13
Some projects, like Postgres, distribute code in this format.
2024-04-14Fix builds with Ninja 12 and remove a 5 year old workaround.Jussi Pakkanen1-4/+1
2024-04-09modules: rename qt.py -> _qt.pyDylan Baker1-1/+1
Since it's an implementation detail, and shouldn't be exposed. This also helps give better error messages when a user writes `import('qt')`, since otherwise you get an error about `qt doesn't have an initialize method`, and now you get `qt module doesn't exist`.
2024-04-08meson format commandCharles Brunet2-0/+44
2024-04-08parser: revert to single StringNode typeCharles Brunet1-1/+0
this will allow transforming string types in the formater
2024-03-18mconf: Reload the options files if they have changedDylan Baker1-9/+1
This fixes issues where a new option is added, an option is removed, the constraints of an option are changed, an option file is added where one didn't previously exist, an option file is deleted, or it is renamed between meson_options.txt and meson.options There is one case that is known to not work, but it's probably a less common case, which is setting options for an unconfigured subproject. We could probably make that work in some cases, but I don't think it makes sense to download a wrap during meson configure.
2024-03-18tests: Add tests for configure on changed optionsDylan Baker1-1/+102
This demonstrates a limitation of Meson that can happen in the following situation: `meson setup builddir` <update to meson.options> (such as git pull) `meson configure -Dnew_option=value builddir` <Error> Since Meson is unaware of the updates to the meson.options file. The purposes of these tests is to fix this behavior.
2024-03-18unittests: annotate BasePlatformTests.setconfDylan Baker1-2/+4
2024-03-15tests: Fix unit tests with high parallelismJan Alexander Steffens (heftig)1-12/+9
On Arch's shiny new 48-core/96-thread build server, the `test_install_log_content` test fails because of an unexpected `invalid-symlink.txt` file. Apparently the test runs in parallel with `test_install_subdir_symlinks`, which modifies the `59 install subdir` source directory. To fix this, make `install_subdir_invalid_symlinks` copy the entire test into a tmpdir before modifying it.
2024-03-15unittests: Add a helper for copying source treesDylan Baker1-0/+23
This is a useful thing to do when a test needs to modify the source tree, as it prevents races between tests.
2024-03-15Improve error messages for invalid option valuesCharles Brunet1-1/+22
By adding the option name to UserOption object, it is now possible to display the name of the affected option when the given option value is not valid. Fixes #12635
2024-03-10fix reconfigure subproject base optionsCharles Brunet2-8/+10
2024-03-10Fix detection of unknown base options in subprojCharles Brunet1-1/+1
cc4cfbcad92945a1629c80664e1eb755c68905dd added detection for unknown base options, but it was not working for subproject base options. This should fix it.
2024-03-03Condense test dirs for rc2.Jussi Pakkanen1-3/+3
2024-03-03compilers: only wrap multiple input libraries with start/end groupEli Schwartz1-3/+3
When only a single input file shows up in an arglist, it makes no sense to inject `-W,--start-group -lone -Wl,--end-group`, since there is nothing being grouped together. It's just longer command lines for nothing.
2024-03-01Fix unknown base options not detected in commandline argumentsCharles Brunet2-1/+8
2024-03-01Fix base and compiler options not reconfigurable.Charles Brunet1-0/+10
Fixes #12920.
2024-03-01Set PYTHONIOENCODING when running testsCharles Brunet2-1/+2
For instance, on Windows, if the terminal is in cp65001, the subprocess output is not encoded correctly and it results in error when running unit test.
2024-01-25interpreter: replace mock keyword argument with unittest.mockDylan Baker2-5/+15
Python provides some nifty tools for mocking, without relying on altering running code. We should use these to simplify the actual run paths and move the complicated logic into tests.
2024-01-17tests: Also test implicit rpaths from dependenciesJonathon Anderson1-0/+92
Meson will implicit rpaths when *.so/*.dll/etc. files are injected onto the link line from pkg-config and (now) cmake dependencies. Extend the "prebuilt shared" tests to test that these are added.
2023-12-17Skip pkg-config-dependent tests if it's missingAlyssa Ross2-3/+7
2023-12-13Use SPDX-License-Identifier consistentlyDylan Baker15-182/+17
This replaces all of the Apache blurbs at the start of each file with an `# SPDX-License-Identifier: Apache-2.0` string. It also fixes existing uses to be consistent in capitalization, and to be placed above any copyright notices. This removes nearly 3000 lines of boilerplate from the project (only python files), which no developer cares to look at. SPDX is in common use, particularly in the Linux kernel, and is the recommended format for Meson's own `project(license: )` field
2023-12-13macos: Fix test_pkgconfig_parse_libs() test on armAndres Freund1-1/+2
The unit test infrastructure hardcodes the architecture as x86_64. On macos, the test_pkgconfig_parse_libs() test creates a few libraries for testing using clang. This leads to the test failing on arm based macs, as darwin_get_object_archs() will skip over these libraries, which then leads to the test failing because of using -l instead of referencing the libraries by their full path. I am not at all sure this is the best approach. I am also somewhat confused why nobody else has encountered this? CI apparently just runs on x86_64 macs? CC: @tristan957
2023-12-10unittests: migrate from jsonschema to fastjsonschemaEli Schwartz1-8/+19
The former has rust dependencies, which lead to max capping on Cygwin since there is no rust compiler there. But it turns out there are other disadvantages of jsonschema: - it involves installing 5 wheels, instead of just 1 - it is much slower To give some perspective to the latter issue, this is what it looks like when I test with jsonschema: ``` ===== 1 passed, 509 deselected in 3.07s ===== Total time: 3.341 seconds ``` And here's what it looks like when I test with fastjsonschema: ``` ===== 1 passed, 509 deselected, 1 warning in 0.28s ===== Total time: 0.550 seconds ``` I cannot think of a good reason to use the former. Although in order to work on old CI images, we'll support it as a fallback mechanism
2023-12-05ninja backend: don't hide all compiler warnings for transpiled languagesEli Schwartz1-37/+0
This was originally added for vala only, with the rationale that vala generates bad code that has warnings. Unfortunately, the rationale was fatally flawed. The compiler warns about a number of things, which the user can control depending on their code (or their code generator's code), but some of those things are absolutely critical to warn about. In particular, GCC 14 and clang 17 are updating their defaults to warn -- and error by default for -- invalid C code that breaks the standard, but has been silently accepted for over 20 years "because lots of people do it". The code in question is UB, and compilers will generate faulty machine code that behaves erroneously and probably has a mass of CVEs waiting to happen. Compiler warnings are NOT safe to just... universally turn off. Compiler warnings could be either: - coding style lints - threatening statements that the code is factually and behaviorally wrong There is no magic bullet to ignore the former while respecting the latter. And the very last thing we should ever do is pass `-w`, since that causes ALL warnings to be disabled, even the manually added `-Werror=XXX`. If vala generated code creates warnings, then the vala compiler can decrease the log level by generating better code, or by adding warning suppression pragmas for *specific* issues, such as unused functions.
2023-12-03macos: Fix path in test to be Sonoma compatibleAndres Freund1-1/+1
The path tested prior does not exist anymore in Sonoma. It seems less likely that 'cat' will be removed, so use that.