Commit Graph

13163 Commits

Author SHA1 Message Date
Eli Schwartz 50f35039e7
devenv: avoid overwriting internal variables of the global argparse
We already use options.command for the subcommand in use, in this case
devenv. We cannot reuse that variable name for the list of words to
execute inside the devenv.
2022-11-30 15:40:31 -05:00
Daniel Stone a0514a7c41 tests: Write out LD_LIBRARY_PATH for built shared libraries
When a test executable references a local shared library, make sure that
we apply the appropriate $LD_LIBRARY_PATH so that the linker can find it
at runtime.

The DT_RUNPATH entry does ensure that the binary references the path to
the shared library build, however the RUNPATH list is only searched
after $LD_LIBRARY_PATH. So if the user has a shared library of the same
name in their $LD_LIBRARY_PATH, this will be the version found and used
for running the test. This is bad if you're trying to use Meson to test
a shared library you're developing and have installed in a local prefix
which is under $LD_LIBRARY_PATH.

Fixes #1635
2022-11-30 11:44:47 -08:00
Dylan Baker 67da2ad0fb
pylint: enable simplifiable-if-statement 2022-11-30 07:01:22 -05:00
Dylan Baker 1502431fe9
pylint: enable use-implicit-booleaness-not-comparison 2022-11-30 07:01:22 -05:00
Dylan Baker d5e899c768
pylint: enable the bad_builtin checker
This finds uses of deny-listed functions, which defaults to map and
filter. These functions should be replaced by comprehensions in
idiomatic python because:
    1. comprehensions are more heavily optimized and are often faster
    2. They avoid the need for lambdas in some cases, which make them
       faster
    3. you can do the equivalent in one statement rather than two, which
       is faster
    4. They're easier to read
    5. if you need a concrete instance (ie, a list) then you don't have
       to convert the iterator to a list afterwards
2022-11-29 23:26:05 -05:00
Dylan Baker a5d547e0d9
pylint: enable useless-return 2022-11-29 23:26:05 -05:00
Dylan Baker 5794805f8e
pylint: enable used-before-assignment
The one case of this was a false-positive, but what we were doing
(checking locals()) is not idiomatic. I've replaced the call to
`locals()` with the obvious `var: T.Optional[str] = None` with check
instead.
2022-11-29 23:26:05 -05:00
Dylan Baker e8727fc857
pylint: enable implicit-str-concat
Which catches a very real bug. The zlib system dependency failed to work
on MSVC since initial implementation in commit
c1a3b37ab7 -- it looked for the wrong
name.
2022-11-29 22:00:12 -05:00
Olexa Bilaniuk 6190b6466e CUDA: Update minimum driver version table to include CUDA 11.8
Agrees with Release Notes, Section 1.1, Table 3.
https://docs.nvidia.com/cuda/cuda-toolkit-release-notes/index.html
2022-11-29 18:44:40 -05:00
Olexa Bilaniuk 5b5798310a CUDA: Bugfix to architectural limit checks.
The upper bound on the CUDA Compute Capability is not always known.
Avoid checking cuda_hi_limit_gpu_architecture if it remains undefined.
2022-11-29 18:44:40 -05:00
Olexa Bilaniuk c4f3589215 CUDA: Add Orin, Lovelace and Hopper architecture names for CUDA 11.8
Co-authored-by: David Seifert <soap@gentoo.org>
2022-11-29 18:44:40 -05:00
Eli Schwartz 1a6a014494
github workflows: upgrade actions/upload-artifact to version 3
This is a no-op change from v2 to v3, but github complains that nodejs
is outdated if you don't. It's not obvious why this required a major
version bump...

However, half of our uses are on v1, which has a decent fix: failure to
upload artifacts constitutes a step failure.
2022-11-28 23:29:49 -05:00
Eli Schwartz 01c8205864
github workflows: upgrade actions/checkout to version 3
This is a no-op change, but github complains that nodejs is outdated if
you don't. It's not obvious why this required a major version bump...
2022-11-28 23:29:49 -05:00
Eli Schwartz bf1fbfd590
github workflows: upgrade setup-python to version 4
Not much changes, really, other than it now sets PKG_CONFIG_PATH to
point to the python it just installed. This should generally not be a
problem (Meson's python module sets that anyway based on the
executable's introspection data).
2022-11-28 23:29:49 -05:00
SmallWood-D d32ee583ad Fix crash when toolchain is missing
Add a MissingCompiler class returned by compiler detecting methods
intead of None - accessing such an object raises a DependencyException

Fixes #10586

Co-authored-by: duckflyer <duckflyer@gmail.com>
2022-11-29 01:48:27 +02:00
Axel Ricard 23fcea16e5 Don't ignore documentation-related flags for D compilers
Fixes #11085
2022-11-29 01:45:23 +02:00
Marvin Scholz 7c48cb513a utils: Popen_safe: Handle ENOEXEC to fail with an error message
This is much cleaner than to show a stack trace, where it is hard to
figure out what is going wrong.
2022-11-28 12:09:30 -08:00
Eli Schwartz 5022fd30e1 Add github's CodeQL scanner to CI.
lgtm.com was acquired by github. It is deprecated and on its way out,
because they've integrated the functionality itself into github. Take a
look at what its official replacement can do.

This does run as yet another Actions slot, which is already fairly
excessive, but the average runtime seems about 5 minutes so that's not
too bad...
2022-11-28 12:02:17 -08:00
David Robillard 81d7c24a59 Add warning_level=everything
Adds a new maximum warning level that is roughly equivalent to "all warnings".
This adds a way to use `/Wall` with MSVC (without the previous broken warning),
`-Weverything` with clang, and almost all general warnings in GCC with
strictness roughly equivalent to clang's `-Weverything`.

The GCC case must be implemented by meson since GCC doesn't provide a similar
option.  To avoid maintenance headaches for meson, this warning level is
defined objectively: all warnings are included except those that require
specific values or are specific to particular language revisions.  This warning
level is mainly intended for new code, and it is expected (nearly guaranteed)
that projects will need to add some suppressions to build cleanly with it.

More commonly, it's just a handy way to occasionally take a look at what
warnings are present with some compiler, in case anything interesting shows up
you might want to enable in general.

Since the warnings enabled at this level are inherently unstable with respect
to compiler versions, it is intended for use by developers and not to be set as
the default.
2022-11-27 16:50:48 -05:00
Eli Schwartz 9751c1fe61
add missing documentation for python installation default pure kwarg 2022-11-26 19:56:00 -05:00
Loïc Yhuel 11fe8f1157 Ignore unused compiler options for "meson configure"
"meson setup" ignores unused compiler options, like "cpp_args" on a project without C++.

"meson configure" doesn't have the filtering from "set_default_options", so it fails with :
ERROR: Unknown options: "cpp_args"

So now unused compiler options (ie not in coredata.options) are no longer marked unknown.

Fixes: #11060
2022-11-24 21:38:44 -05:00
David Robillard e85138fcc8 Fix various spelling errors
Found with codespell.
2022-11-24 15:17:23 -05:00
Eli Schwartz 9d1b59fa7f
migrate some type comments to modern type annotations
flake8 6 upgrades to pyflakes 3, and in turn this means that support for
parsing `# type: ` style annotations has been removed.

https://github.com/PyCQA/pyflakes/pull/684

This caused one file to fail linting, because it had a typing import
which was only used by a type comment.

```
mesonbuild/cmake/interpreter.py:55:5: F401 '.common.CMakeConfiguration' imported but unused
```

Updating it to actual annotations allows pyflakes to detect its usage
again, and flake8 passes. Do the whole file while we are here.
2022-11-24 11:50:20 -05:00
Eli Schwartz f645bcf68d
remove a couple of unneeded type annotations
These are trivially inferred based on their initialized values.
2022-11-24 11:50:20 -05:00
Eli Schwartz bf83274344
python module: fix broken non-embed dependency
The `py.dependency(embed: false)` method is supposed to consistently
provide a distutils-like `python.pc` / `python-embed.pc` interface
regardless of Python version. It handles both pkg-config and sysconfig
scraping. For the latter, we respect the value of self.link_libpython
as determined by distutils, and construct a fully custom dependency. For
the former, we blindly assume pkg-config is correct.

It isn't correct, not until Python 3.8 when embed was added. Before
then, we need to process the pkg-config dependency based on
link_libpython. We did this, but only inside the extension_module
method, which is obviously wrong.

Delete the special casing from extension_module, and handle it inside
the dependency.

Fixes #11097
2022-11-24 11:50:20 -05:00
David Robillard c05b2ba231 Fix broken link in release notes 2022-11-24 16:01:33 +02:00
Daniele Nicolodi 235f32f1a6 python: Use correct extension filename suffix on Python < 3.8.7
On Windows, in Python version prior to 3.8.7, the `sysconfig` modules
provides an extension filename suffix that disagrees the one returned
by `distutils.sysconfig`. Get the more awesome suffix from the latter
when building for a Python version known to present this issue.

Simplify the extension module filename suffix lookup to use the same
method used by `setuptools`.

Adjust project tests accordingly.

Fixes #10960.
2022-11-23 07:29:23 -05:00
Eli Schwartz 0404ad5601
compilers: remove opinionated c++ warning flag
-Wnon-virtual-dtor is not what people think of as a standard warning
flag. It was previously removed from -Wall in
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=16190 on the grounds that
people didn't like it and were refusing to use -Wall at all because it
forced this warning. Instead, it is enabled by -Weffc++ which is
typically not enabled and even comes with GCC documentation warnings
stating that the standard library doesn't obey it, and you might need to
`grep -v` and filter out warnings. (!!!)

It doesn't fit into the typical semantics of Meson's warning_level
option, which usually aligns with compiler standard warning levels
rather than a niche ideological warning level.

It was originally added in commit 22af56e05a,
but without any specific rationale included, and has gone unquestioned
since then -- except by the Meson users who see it, assume there is a
finely crafted design behind it, and quietly opt out by rolling their own
warning options with `add_project_arguments('-Wall', ...)`.

Furthermore a GCC component maintainer for the C++ standard library
opened a Meson bug report specially to tell us that this warning flag is
a "dumb option" and "broken by design" and "doesn't warn about the right
thing anyway", thus it should not be used. This is a reasonably
authoritative source that maybe, just maybe, this flag... is too
opinionated to force upon Meson users without recourse. It's gone beyond
opinionated and into the realm of compiler vendors seem to think that
the state of the language would be better if the flag did not exist at
all, whether default or not.

Fixes #11096
2022-11-22 23:27:33 -05:00
Marvin Scholz 7cbc15b812 unittests: add and use get_meson_log_raw function
This is like get_meson_log but returns the whole contents
not split into individual lines.
2022-11-22 22:53:07 -05:00
Marvin Scholz 49cd97c434 unittests: add and use _open_meson_log function
Factors out opening the meson log into its own function so that
it can be used in the places where with was done before.

Additionally instead of checking if the file exists before opening it,
try to open it and handle the exception when it is not found.
2022-11-22 22:53:07 -05:00
Marvin Scholz 08262c3102 test runner: fix excluding null options
It was impossible to specify null arguments in the exclude array,
while they were passed properly in the code, they were stringified
while the entries in the options array were just completely removed.

To fix this, do not early stringify the argument name and option
together as that would make it impossible to properly match it to
None without introducing a new special case for the string "None".
So instead they are now kept as tuples and only stringified when
its actually needed.
2022-11-22 20:22:04 -05:00
Jussi Pakkanen fd43842041 Fix writing single strings in env2mfile. 2022-11-22 02:19:59 +02:00
Jussi Pakkanen 3ae89a7150 Handle freezing tests. Fixes #10752. 2022-11-21 16:44:24 +02:00
Eli Schwartz e5ce7f0770 hotdoc module: fix broken include paths
Since commit 32b14b1bb5, hotdoc is run
during configure as an external program. It turns out though, that in
some cases we passed NoneType in the cmd array, previously to
hotdoc.run_hotdoc.run() and now via subprocesses. The former "worked"
due to ignoring unknown arguments (?) but the latter was broken because
command line interfaces don't accept python NoneType objects, naturally.

End result: when for example building Meson's own documentation, this
fails with a python traceback.

The reason this happens to begin with turns out to be, once again,
because of the legacy debt of homebrewed kwargs parsing. We have a
function for `process_known_args` that handles args and ignores them if
they are NoneType, and then include_paths is handled via a custom
processor that internally adds them, then returns a *list* of NoneType
which then gets appended to the global cmd, because the logic ends up as
`[None, None] is None` which is a failed check, so we go ahead and add
it.

It's odd that we ever attempted to process it twice to begin with, so
let's simply not do that.
2022-11-20 23:08:44 +02:00
Eli Schwartz e0240515a6 hotdoc module: remove homebrew function-proxied OrderedSet
We are just using this dictionary to get keys, and we could also just
set it ourselves but with None values. But we have a code abstraction
for this already; use it.
2022-11-20 23:08:44 +02:00
Dylan Baker c642a7693e modules/rust: stabilize
Mesa is using the rust module in production, so we should stabilize
it.
2022-11-19 23:00:53 +02:00
Eli Schwartz b40e4de3c6
tests: fix potential failure to verify pkg-config generation
We use a dummy project with a vague name and try to find flags for it
based on the installable pkg-config files. This sort of works,
generally, because it attempts to match `-lct` which doesn't exist
because the test case isn't installed, and that link argument is passed
directly through.

Except, sometimes that library does exist. It is provided by the
"freetds" project, which may be a dependency other tools. In that case,
Meson finds a library, and the `dependency()` resolves to
`/usr/lib/libct.so` and the test fails.

Fortunately, we do have an API to say that we really want to get back
the same flags pkg-config returned. Use this.
2022-11-17 19:10:51 -05:00
Eli Schwartz 908a78dbc2
tests: make the command tests work when python is not the one in the shebang
We test a couple ways of running the meson command, and double check
that the debug logs record the meson command used (including python).
But when running the meson command as an executable instead of as a
python script, we see whichever version `env` in the shebang sees.

Fix this by mocking the python command as well.
2022-11-17 19:10:51 -05:00
Eli Schwartz 174e05d0f6
tests: fix qt project test when running with qt4
*.qrc files converted to C++ sources could make use of Qt headers, and
in practice for qt4 they seem to. Since this is Qt code to begin with,
it makes sense to depend on the Qt being targeted regardless of version.
2022-11-17 19:10:51 -05:00
Eli Schwartz 193092e26b
fix deprecated use of meson builddir/ in testsuite 2022-11-17 19:10:51 -05:00
Dylan Baker 9e9a9ac4de backend/ninja: replace ` ` with `_` in rust crate-names
Because spaces aren't allowed and result in compilation failures
2022-11-17 19:07:15 -05:00
Dylan Baker 8526b8c1a9 modules/rust: Also include generated sources for tests
When we create a test from a non-executable, we weren't copying the
generated sources, just the static ones.
2022-11-17 19:07:15 -05:00
Dylan Baker e45367169f build: fix annotations of BuildTarget derived classes
Which thinks `sources` should be `List[File]`, but they should be
`List[SourceOutputs]`
2022-11-17 19:07:15 -05:00
Eli Schwartz 32b14b1bb5
hotdoc module: run hotdoc as an external command during configure
We need to run it as an external command at build time anyway, and we
detect it by looking it up as an ExternalProgram. It seems odd to then
import it into Meson's python interpreter and run the main function.

Moreover, this errors out when you are running two different pythons,
one for Meson and one for hotdoc. For example, when hotdoc is installed
normally, but you're testing Meson against a nondefault newer version of
python.
2022-11-17 16:17:40 -05:00
Eli Schwartz 0d3be23377 build: use the unified pickle loader to handle more edge cases
We have divergent implementations of loading a pickled *.dat file. The
Build class loader has a better error message. But the generic loader
handles TypeError and ModuleNotFoundError. Merge the implementations,
and use it for Build as well.

Fixes #11051
2022-11-17 12:56:04 -08:00
Zihua Wu 3a4aa109b4 Fix a typo in the CUDA template
The original version will output something like `xtakes no arguments`, and the modified version will correctly output `x takes no arguments`.
2022-11-17 10:25:29 -08:00
Eli Schwartz 134e299eda mdist: fix error when running tests with a cross file
Since commit 1420d0dace we use coredata's
cmd_line.txt handler to get the right setup arguments. But there's a bug
in that -- it mishandles cross/native files, producing invalid
descriptions of the command line. The only other place this was used,
though, is when generating meson-log.txt.

Fix it to produce correctly formatted arguments.

Fixes #10980
2022-11-17 10:08:58 -08:00
Eli Schwartz 68a84f6535
fix confusing azure pipelines status for coverage
The coverage report was always the final section of the main test run.
This made it hard to scroll around and find exactly what went wrong --
particularly as not everyone realizes that coverage isn't part of the
test run, but also because the output from coverage is... excessively
long.

This mirrors what we do in our other workflows.
2022-11-16 19:28:24 -05:00
Xeonacid 47d1a55e78 Fix test_rust_clippy for rust 1.65
clippy changed output message
fix #11004
2022-11-16 13:16:47 -05:00
Xavier Claessens 8232665849 Fix deprecation message, the function name is fs.copyfile() 2022-11-16 11:58:16 -05:00