Commit Graph

222 Commits

Author SHA1 Message Date
Jon Turney 26d1c2a52d
Specify crossfile use in CI job configuration
Pull the crossfile specification out of run_test.py so it can be
specified in the CI job configuration.

Also make some fixes to output ordering in run_test.py.
2020-01-28 21:41:22 +00:00
Nirbheek Chauhan b9d0c7a169 run_tests: Fix detection of ninja 1.9
`get_backend_commands()` doesn't get called when we run tests as
subprocesses, so detect ninja on import. This should speed up CI.

Fixes https://github.com/mesonbuild/meson/issues/5888
2020-01-15 12:14:30 +05:30
Dylan Baker 31bb6eae45 run_tests.py: use mlog.log_once to avoid spamming ninja < 1.9 warnings 2019-12-13 09:57:05 -05:00
Daniel Mensinger 286b9f0921 lgtm: Fix Module imported with `import` and `import from` 2019-12-05 00:22:10 +02:00
Daniel Mensinger 80ec5e9d28 Fix all flake8 warnings 2019-10-20 17:44:43 +03:00
Aleksey Gurtovoy 75daed27bc mesonlib.split_args/quote_arg/join_args 2019-09-05 23:42:47 +03:00
Nirbheek Chauhan 35732dfaa1 tests: Require ninja 1.9 on CI
Also, print messages when we have to enable the timestamp resolution
workaround.
2019-09-01 22:58:33 +03:00
Nirbheek Chauhan 48f3495178 tests: Upgrade to ninja v1.9 for Linux
Also use the upstream release. This eliminates Meson CI's dependence
on my server.
2019-09-01 22:58:33 +03:00
Nirbheek Chauhan 96088d3e51 tests: Detect ninja v1.9 and disable timestamp hack
The high-res timestamp PR by QuLogic was merged in v1.9, so we can
switch back to upstream ninja.
2019-09-01 22:58:33 +03:00
Michael Hirsch, Ph.D e3b21de563 Intel-Cl tests: increase robustness of Windows Intel compilers detection (#5828)
* intel-cl tests: more rigorous detection of intent to use Intel Windows compilers

* fortran coarray test: make skipping more robust in that underlying MPI stack is .run()

This is useful for any Fortran coarray work, and especially for intel-cl where multiple Intel compiler
versions are often installed, and the wrong underlying MPI library may be dynamically linked,
and so a runtime check is needed to exercise the MPI stack underlying Fortran coarray.
This is done by

fc.run('sync all; end', dependencies: coarray)

* pep8
2019-08-24 02:33:54 +03:00
John Ericson d8335fb032 Put native file before cross file in options list
I think this makes more sense by matching how build comes before host.
Native builds are also more common than cross builds.
2019-08-12 01:21:32 +03:00
Michael Hirsch, Ph.D b5e9ab8ed0
fortran tests: non-gfortran compilers on Windows are best static libs
collapsed get_relative_files_list_from_dir to a one-liner via pathlib.Path
2019-07-30 03:17:14 -04:00
Michael Hirsch, Ph.D 667cc80f72
run_tests: ifort / intel-cl must have ninja backend 2019-07-30 03:14:25 -04:00
Daniel Mensinger 3b2126531a cmake: added test case for environment variables 2019-07-23 05:50:55 +00:00
Jussi Pakkanen 4b1ab96795 Add command line argument to skip unit tests. 2019-07-09 22:03:58 +03:00
John Ericson 957d8e051c Make `PerMachine` and `MachineChoice` have just `build` and `host`
Meson itself *almost* only cares about the build and host platforms. The
exception is it takes a `target_machine` in the cross file and exposes
it to the user; but it doesn't do anything else with it. It's therefore
overkill to put target in `PerMachine` and `MachineChoice`. Instead, we
make a `PerThreeMachine` only for the machine infos.

Additionally fix a few other things that were bugging me in the process:

 - Get rid of `MachineInfos` class. Since `envconfig.py` was created, it
   has no methods that couldn't just got on `PerMachine`

 - Make `default_missing` and `miss_defaulting` work functionally. That
   means we can just locally bind rather than bind as class vars the
   "unfrozen" configuration. This helps prevent bugs where one forgets
   to freeze a configuration.
2019-05-16 00:27:57 +03:00
Daniel Mensinger 3581839f4c
Fix unused variables warnings 2019-04-29 12:22:50 +02:00
Jon Turney 10749494c8
Flush run_tests output so it appears before the test subprocesses it runs
This makes 'System information', 'Running unittests', etc. appear before
any test output.
2019-04-15 12:07:17 +01:00
John Ericson 19f81d3e33 Never access environment.properties downstream
Instead use coredata.compiler_options.<machine>. This brings the cross
and native code paths closer together, since both now use that.

Command line options are interpreted just as before, for backwards
compatibility. This does introduce some funny conditionals. In the
future, I'd like to change the interpretation of command line options so

 - The logic is cross-agnostic, i.e. there are no conditions affected by
   `is_cross_build()`.

 - Compiler args for both the build and host machines can always be
   controlled by the command line.

 - Compiler args for both machines can always be controlled separately.
2019-02-02 13:59:14 -05:00
Nirbheek Chauhan 50b863032e find_library: Check arch of libraries on Darwin
macOS provides the tool `lipo` to check the archs supported by an
object (executable, static library, dylib, etc). This is especially
useful for fat archives, but it also helps with thin archives.

Without this, the linker will fail to link to the library we mistakenly
'found' like so:

ld: warning: ignoring file /path/to/libfoo.a, missing required architecture armv7 in file /path/to/libfoo.a
2019-01-31 20:36:49 +00:00
Nirbheek Chauhan c0166355ce Rewrite appleframework and extraframework dependency classes
Instead of only doing a naive filesystem search, also run the linker
so that it can tell us whether the -F path specified actually contains
the framework we're looking for.

Unfortunately, `extraframework` searching is still not 100% correct in
the case when since we want to search in either /Library/Frameworks or
in /System/Library/Frameworks but not in both. The -Z flag disables
searching in those prefixes and would in theory allow this, but then
you cannot force the linker to look in those by manually adding -F
args, so that doesn't work.
2019-02-01 00:14:09 +05:30
Nirbheek Chauhan 3997e8762e unit tests: Fix sdl2 failure test on macOS
Also ensure that the test's no-pkg-config codepath will always be run,
even on the CI where we always have pkg-config available.

This counts as a test case for #4728
2019-01-31 20:12:21 +05:30
Nirbheek Chauhan 58852e6290 unit tests: Simplify get_fake_env()
Almost every test already uses '' for the srcdir/builddir/etc.
Make it official.
2019-01-31 20:12:21 +05:30
John Ericson 2b22576fb6 Remove cross_info; cross file is parsed up front and discarded 2019-01-02 16:22:47 -05:00
Daniel Mensinger 194adc828f Only autodetect 'vs' backend on windows 2018-12-11 20:54:17 +02:00
Dylan Baker 3af4407a16 Get basic native config file loading working 2018-11-14 15:57:37 -08:00
Jussi Pakkanen 252bf6c52e
Merge pull request #4340 from jon-turney/azure-pipelines
Add Azure pipelines CI
2018-10-14 23:16:46 +03:00
Jon Turney 459b81de46
Use 'CI' environment variable to detect CI environment
Use the 'CI' environment variable to detect CI environment, rather than a
collection of CI-specific ones.
2018-10-14 16:01:36 +01:00
Niklas Claesson d964da79e7 tests: Merge backend guessing into one function 2018-10-10 21:32:02 +02:00
Niklas Claesson fb1f0b9694 Fix type-bug cannot add str to list 2018-10-10 21:19:06 +02:00
Niklas Claesson 4911a51aa2 Add option to fail fast in tests 2018-10-10 21:19:06 +02:00
Niklas Claesson 4ef4edee2f tests runners: Refactor out global variables and add argparse 2018-10-10 21:19:06 +02:00
Xavier Claessens 37067a53c4 Use a single ArgumentParser for all subcommands
This has the adventage that "meson --help" shows a list of all commands,
making them discoverable. This also reduce the manual parsing of
arguments to the strict minimum needed for backward compatibility.
2018-10-04 09:40:21 -04:00
Guillermo Ignacio Enriquez Gutierrez 13c0705263 Add flag to NOT use new build system in xcode because it fails in Xcode9 when using custom build directories 2018-09-23 00:42:33 +09:00
Nirbheek Chauhan 5e93393cd9 Test that system shlibs with undefined symbols can be found 2018-08-22 12:24:43 -07:00
Nirbheek Chauhan e8dae2b966 cross: Be more permissive about not-found exe_wrapper
We used to immediately try to use whatever exe_wrapper was defined in
the cross file, but some people generate the cross file once and use
it for several projects, most of which do not even need an exe wrapper
to build.

Now we're a bit more resilient. We quietly fall back to using
non-exe-wrapper paths for compiler checks and skip the sanity check.
However, if some code needs the exe wrapper, f.ex., if you run a built
executable using custom_target() or run_target(), we will error out
during setup.

Tests will, of course, continue to error out when you run them if the
exe wrapper was not found. We don't want people's tests to silently
"pass" (aka skip) because of a bad CI setup.

Closes https://github.com/mesonbuild/meson/issues/3562

This commit also adds a test for the behaviour of exe_wrapper in these
cases, and refactors the unit tests a bit for it.
2018-07-09 05:39:40 +05:30
Nirbheek Chauhan 2d1fc25599 run_tests: Run all cross tests together
There is a lot of overhead for each travis job, because docker pull
takes 3 minutes. Each cross test takes 3-4 minutes.

To make things worse, sometimes Dockerhub is slow and docker pull takes
longer than 3 minutes.
2018-06-10 01:52:57 +00:00
Xavier Claessens 7c4736d27f Convert args.projectoptions into a dict
This simplifies a lot of code, and centralize "key=value" parsing in a
single place.

Unknown command line options becomes an hard error instead of
merely printing warning message. It has been warning it would become an
hard error for a while now. This has exceptions though, any
unknown option starting with "<lang>_" or "b_" are ignored because they
depend on which languages gets added and which compiler gets selected.
Also any option for unknown subproject are ignored because they depend
on which subproject actually gets built.

Also write more command line parsing tests. "19 bad command line
options" is removed because bad cmd line option became hard error and
it's covered with new tests in "30 command line".
2018-06-06 20:02:37 +00:00
Nirbheek Chauhan bc4dd5e201 .travis.yml: Add CI for armhf and mingw
Also split them out to their own jobs. Travis gives us 5 parallel jobs
now, so we can parallelize it a bit more.
2018-06-05 10:50:22 +00:00
Nirbheek Chauhan 21dc45dbbb Add MinGW-w64 64-bit to the Travis CI
Includes new cross files for MinGW-w64
2018-06-05 10:50:22 +00:00
Nirbheek Chauhan 0a035dea6d Set the meson command to use when we know what it is
Instead of using fragile guessing to figure out how to invoke meson,
set the value when meson is run. Also rework how we pass of
meson_script_launcher to regenchecker.py -- it wasn't even being used

With this change, we only need to guess the meson path when running
the tests, and in that case:

1. If MESON_EXE is set in the env, we know how to run meson
   for project tests.
2. MESON_EXE is not set, which means we run the configure in-process
   for project tests and need to guess what meson to run, so either
   - meson.py is found next to run_tests.py, or
   - meson, meson.py, or meson.exe is in PATH

Otherwise, you can invoke meson in the following ways:

1. meson is installed, and mesonbuild is available in PYTHONPATH:
   - meson, meson.py, meson.exe from PATH
   - python3 -m mesonbuild.mesonmain
   - python3 /path/to/meson.py
   - meson is a shell wrapper to meson.real
2. meson is not installed, and is run from git:
   - Absolute path to meson.py
   - Relative path to meson.py
   - Symlink to meson.py

All these are tested in test_meson_commands.py, except meson.exe since
that involves building the meson msi and installing it.
2018-06-01 19:20:04 +00:00
Nirbheek Chauhan f56b402a5b Revert "mesonlib: handle meson exe wrappers"
This reverts commit 0627e9d616.

Breaks installation: https://github.com/mesonbuild/meson/issues/3647

Will be restored once that can be fixed.
2018-05-31 15:40:10 +05:30
Martin Kelly 0627e9d616 mesonlib: handle meson exe wrappers
There are cases when it is useful to wrap the main meson executable with
a script that sets up environment variables, passes --cross-file, etc.
For example, in a Yocto SDK, we need to point to the right meson.cross
so that everything "just works", and we need to alter CC, CXX, etc. In
such cases, it can happen that the "meson" found in the path is actually
a wrapper script that invokes the real meson, which may be in another
location (e.g. "meson.real" or similar).

Currently, in such a situation, meson gets confused because it tries to
invoke itself using the "meson" executable (which points to the wrapper
script) instead of the actual meson (which may be called "meson.real" or
similar). In fact, the wrapper script is not necessarily even Python, so
the whole thing fails.

Fix this by using Python imports to directly find mesonmain.py instead
of trying to detect it heuristically. In addition to fixing the wrapper
issue, this should make the detection logic much more robust.
2018-05-30 18:29:16 +00:00
Jussi Pakkanen c72b4e1b9c Imported Debian fixes by Matthias Klose. 2018-04-02 14:12:34 +03:00
Nirbheek Chauhan b2feae9833 unit tests: Remove all instances of FakeEnvironment
We don't need to use that, and it causes build failures when code
actually uses the environment.
2017-12-03 10:06:11 +05:30
Jussi Pakkanen 5d51bc79c7 Replaced sys.executable use with the mesonlib equivalent. 2017-11-20 23:08:17 +02:00
Jussi Pakkanen b3dfb80c15 Tests can be run with an external Meson command. 2017-11-20 23:08:17 +02:00
Jussi Pakkanen a4db467669 Use GCC 7 for cross compilation tests. 2017-10-28 21:38:09 +03:00
Nirbheek Chauhan 7c4f0f97d3 tests: Always run ninja with -d explain
Will help us figure out the occasional ninja loops we see in our CI:

https://github.com/mesonbuild/meson/pull/2394#issuecomment-333340112
https://travis-ci.org/mesonbuild/meson/jobs/281637736
2017-10-01 15:38:34 +03:00
Nirbheek Chauhan 7c2ae55fab Revert "Revert "Merge pull request #1931 from centricular/use-patched-ninja""
This reverts commit 5eb64a6f3e.

Let's try again, with a fixed Ninja by QuLogic.
2017-09-18 18:40:24 +03:00