Commit Graph

185 Commits

Author SHA1 Message Date
Dylan Baker 3c4417f381 backend/ninja: Fortran targets need to -I transitive deps private dirs
Otherwise they won't be able to find their module outputs.

This requires a new method to look at dependencies, as the existing ones
wont find static libraries that were linked statically into previous
targets (this links with A which link_whole's B). We still need to have
B in that case because we need it's BMI outputs.
2025-04-03 12:27:07 -07:00
Dylan Baker 3996272ca7 tests: our fortran order deps are wrong if a new module is introduced
Because we don't set the appropriate dependencies
2025-04-03 12:27:07 -07:00
Dylan Baker 2b2d075b95 tests: demonstrate that our scanner cannot handle cross target modules 2025-04-03 12:27:07 -07:00
Paolo Bonzini 6cc848dafd rust: new target rustdoc
Another rust tool, another rough copy of the code to run clippy.
Apart from the slightly different command lines, the output is in a
directory and test targets are skipped.

Knowing the output directory can be useful, so print that on successful
execution of rustdoc.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2025-04-02 15:43:15 +03:00
Charles Brunet e14983026c Add subTests to test_introspect_json_dump 2025-03-14 12:58:28 -07:00
Patrick Steinhardt 43ea11ea49 compilers: convert `b_sanitize` to a free-form array option
In the preceding commit we have started to perform compiler checks for
the value of `b_sanitize`, which allows us to detect sanitizers that
aren't supported by the compiler toolchain. But we haven't yet loosened
the option itself to accept arbitrary values, so until now it's still
only possible to pass sanitizer combinations known by Meson, which is
quite restrictive.

Lift that restriction by adapting the `b_sanitize` option to become a
free-form array. Like this, users can pass whatever combination of
comma-separated sanitizers to Meson, which will then figure out whether
that combination is supported via the compiler checks. This lifts a
couple of restrictions and makes the supporting infrastructure way more
future proof.

A couple of notes regarding backwards compatibility:

  - All previous values of `b_sanitize` will remain valid as the syntax
    for free-form array values and valid combo choices is the same. We
    also treat 'none' specially so that we know to convert it into an
    empty array.

  - Even though the option has been converted into a free-form array,
    callers of `get_option('b_sanitize')` continue to get a string as
    value. We may eventually want to introduce a kwarg to alter this
    behaviour, but for now it is expected to be good enough for most use
    cases.

Fixes #8283
Fixes #7761
Fixes #5154
Fixes #1582

Co-authored-by: Dylan Baker <dylan@pnwbakers.com>
Signed-off-by: Patrick Steinhardt <ps@pks.im>
2025-03-09 18:06:14 -04:00
Charles Brunet 88fbd177c4 Add cache to coredata.get_external_link_args 2025-03-09 15:29:42 -04:00
Dylan Baker fbed6e9bd6 unittests: use subtests for test_Builtin_options_documented 2025-03-05 18:06:11 +02:00
Patrick Steinhardt de7d8f9e48 test: fix hang when running tests that need parsing with `--interactive`
When running tests with `--interactive` we don't redirect stdin, stdout
or stderr and instead pass them on to the user's console. This redirect
causes us to hang in case the test in question needs parsing, like it is
the case for TAP output, because we cannot read the process's stdout.

Fix this hang by not parsing output when running in interactive mode.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
2025-02-27 15:25:57 -05:00
Patrick Steinhardt d3c8639975 mtest: add option to slice tests
Executing tests can take a very long time. As an example, the Git test
suite on Windows takes around 4 hours to execute. The Git project has
been working around the issue by splitting up CI jobs into multiple
slices: one job creates the build artifacts, and then we spawn N test
jobs with those artifacts, where each test job executes 1/Nth of the
tests.

This can be scripted rather easily by using `meson test --list`,
selecting every Nth line, but there may be other projects that have a
similar need. Wire up a new option "--slice i/n" to `meson test` that
does implements this logic.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
2025-02-27 15:25:05 -05:00
Jussi Pakkanen d995cbce0f Fix reconfiguration on --wipe.
Closes #14279.
2025-02-20 23:10:17 +02:00
Jussi Pakkanen 7f8bef1ad7 Permit more missing b options. Closes #14254. 2025-02-15 16:16:15 +02:00
Jussi Pakkanen d37d649b08 Make all Meson level options overridable per subproject. 2025-02-13 23:57:48 +02:00
Dylan Baker d6e54b499c unit tests: Test ObjC and ObjC++ as well as C and C++
This tests ObjC and ObjC++ both with and without C enabled. I did this
because I ran into issues where ObjC only worked when C was enabled, and
then a later bug where C was disabled, due to the fact that C and ObjC
both use `c_std` and not `objc_std`.
2025-01-27 09:38:53 -08:00
Dylan Baker 18331db7c1 unit tests: make the test_c_cpp_stds test more robust
Check clang-cl as well as cl, and clang as well as gcc.
2025-01-27 09:38:53 -08:00
Jussi Pakkanen 0279acbfe5 Condensed directory names for release. 2025-01-09 16:52:16 +02:00
Jan Alexander Steffens (heftig) 29a26ea817 tests: Avoid modifying '17 prebuild shared' test dir
Tests can tread on each other's toes when parallelism is high enough.

In this case, `test_prebuilt_shared_lib` creates an object file in the
`17 prebuilt shared` test dir.

`test_prebuilt_shared_lib_rpath_same_prefix` uses `shutil.copytree` to
copy that same test dir to a temporary location.

If the former test cleans up its object file while `copytree` is
running, the copy can fail with a fatal ENOENT `shutil.Error`.

Use `copy_srcdir` to prevent this from happening.
2025-01-07 21:44:33 +02:00
Paolo Bonzini 5768ccba6e ninjabackend: add support for "ninja clippy"
Add a target that builds all crates that could be extern to others,
and then reruns clippy.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2024-12-19 09:25:20 -08:00
Paolo Bonzini 15c2c98114 introspect: add machine to target_sources
Even though the "targets" introspection info already includes the
command line arguments used to invoke the compiler, this is not
enough to correlated with the "compilers" introspection info and
get extra information from there.

Together with the existing "language" key, adding a "machine" key
is enough to identify completely an entry in the compilers info.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2024-12-19 09:25:20 -08:00
Paolo Bonzini 110e2de4fa rust: avoid warnings from rust.test
Any argument from the base target is copied to the test target, but some
keyword arguments for libraries are not available in executable.
Remove them.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2024-11-19 12:08:57 -08:00
David Robillard 5402d38dbd backend/ninja: Fix inconsistent rule descriptions
Remove some trailing periods and always use present continuous tense (since
these appear as status messages).
2024-10-21 20:26:32 +03:00
Jussi Pakkanen fbeedf4b14 Condense test directories. 2024-10-20 21:20:13 +03:00
Daniele Nicolodi ec7a81ad86 mintro: Add license and license_files to project introspection data 2024-10-13 19:35:58 +03:00
Alan Coopersmith b7ce7c2d39 linkers: Fix linker detection with clang on Solaris
Fixes: #13711
2024-09-27 14:12:54 -04:00
Daniele Nicolodi d299add709 intro: add install_rpath to intro-install_plan.json 2024-09-03 11:13:11 -07:00
Eli Schwartz 19847ba24a
update various deprecation notices to call out meson 2.0 2024-08-30 15:44:13 -04:00
Dylan Baker 5eb4d7336b
unittests: use mock.patch.dict to deal with os.environ 2024-08-15 14:14:56 -04:00
Benoit Pierre 8ef4e34cae linkers: fix LLD linker response file handling
Correct base classes so GNU-like linkers all default to supporting response files.
2024-08-09 11:35:18 -07:00
Jon Turney 2f49804cc2
Revert "CI: skip LTO tests on cygwin"
This reverts commit 0c93149f09.
2024-08-04 09:57:03 +01:00
Eli Schwartz 0c93149f09
CI: skip LTO tests on cygwin
A GCC update broke this and is being investigated

Bug: #13465
2024-07-23 21:15:31 -04:00
Jussi Pakkanen 61c742fae9 Remove language (AKA compiler) type from OptionKey. 2024-07-17 18:37:51 +03:00
Jussi Pakkanen de8e3d65e0 Remove option type from OptionKey and get it from OptionStore instead. 2024-07-17 18:37:51 +03:00
Jussi Pakkanen 0d7bb776e2 Move OptionKey in the option source file. 2024-07-11 11:53:39 +03:00
Xavier Claessens c0de2e1264 wrap: Clarify PackageDefinition API
This will simplify creating PackageDefinition objects from Cargo.lock
file. It contains basically the same information.
2024-06-14 15:01:30 -04:00
Jussi Pakkanen 9a6fcd4d9a Replace direct indexing with named methods. 2024-06-14 17:19:53 +03:00
Jussi Pakkanen c0d86024f5 Rename option variable to optstore to make it unique. 2024-06-14 17:19:53 +03:00
Jussi Pakkanen 4cc2e2171a Create a directory for machine files used in unit tests. 2024-06-02 17:43:50 +03:00
Benjamin Gilbert c9aa4aff66 mdist: gracefully handle stale Git index
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-27 21:58:41 -04:00
Tristan Partin 2d3954efac Add bztar support to meson dist
Some projects, like Postgres, distribute code in this format.
2024-04-15 16:17:44 -04:00
Charles Brunet 2b37101998 meson format command 2024-04-08 10:43:57 -07:00
Charles Brunet bd4fd90730 parser: revert to single StringNode type
this will allow transforming string types in the formater
2024-04-08 10:43:57 -07:00
Charles Brunet f9479787a0 fix reconfigure subproject base options 2024-03-10 13:09:32 -07:00
Jussi Pakkanen ac1d0aea58 Condense test dirs for rc2. 2024-03-03 23:33:15 +02:00
Charles Brunet cc4cfbcad9 Fix unknown base options not detected in commandline arguments 2024-03-01 12:09:22 -08:00
Charles Brunet 4ed6d75d96 Set PYTHONIOENCODING when running tests
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-03-01 12:09:22 -08:00
Jonathon Anderson 3a846ff409 tests: Also test implicit rpaths from dependencies
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.
2024-01-17 08:42:09 -08:00
Dylan Baker e991c4d454 Use SPDX-License-Identifier consistently
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-13 15:19:21 -05:00
Jussi Pakkanen 97dc8801a6 Renumber test dirs for rc3. 2023-11-12 19:18:06 +02:00
Jussi Pakkanen 3bbe66e971 Condense test directories for RC1. 2023-10-27 17:43:03 +03:00
Dylan Baker 450b3db378 modules/rust: Add a test that bindgen drops arguments it shouldn't use
This does require hacking up the test pretty badly, since we need to not
ever pass GCC these invalid values. But it's preferable to writing
another project test I think.

Co-Authored-by: Nirbheek Chauhan <nirbheek@centricular.com>
2023-10-20 20:21:08 +05:30