Commit Graph

34 Commits

Author SHA1 Message Date
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 416a00308f cross: Use ExternalProgram for cross-file exe_wrapper
We already have code to fetch and find binaries specified in a cross
file, so use the same code for exe_wrapper. This allows us to handle
the same corner-cases that were fixed for other cross binaries.
2018-07-09 04:09:46 +05:30
Kurtis Rader 5290f41f31 Report exit status or signal that killed the test
When a test fails due to a signal (e.g., SIGSEGV) it can be somewhat
mysterious why the test failed. Also, even when a test fails due to a
non-zero exit status it would help if the exit status was reported. This
augments the result string to include the non-zero exit status or
signal number and name.

Resolves #3642
2018-06-17 21:22:42 +03:00
Nirbheek Chauhan efa9b75d5d Set WINEPATH when running serialized executables
When the exe runner is `wine` or `wine32` or `wine64`, etc.
This allows people to run tests with wine.

Note that you also have to set WINEPATH to point to your custom
prefix(es) if your tests use external dependencies.

Closes https://github.com/mesonbuild/meson/issues/3620
2018-06-05 10:50:22 +00:00
George Koehler 64906b0755 Don't call getpgid() when killing a test.
OpenBSD's getpgid(2) fails with EPERM (PermissionError) because the
test is in a different session: https://man.openbsd.org/getpgid

Use p.pid as the process group ID, because setsid() created a process
group with the same ID as the process.  See setsid(2) manuals:

 - FreeBSD: https://www.freebsd.org/cgi/man.cgi?query=setsid
 - illumos: https://illumos.org/man/setsid
 - Linux: http://man7.org/linux/man-pages/man2/setsid.2.html

This change fixes 'manual tests/8 timeout' on OpenBSD.  To verify this
change, one must run the manual test.  For example,

    $ cd 'manual tests/8 timeout'
    $ meson build
    $ ninja -C build test

It should report that the test timed out, and not show
PermissionError.

Fixes https://github.com/mesonbuild/meson/issues/3569
2018-05-29 02:14:52 +02:00
Alberto Sartori 717f7db67e improve suite of meson test (#3369) 2018-04-14 22:17:02 +03:00
Jussi Pakkanen be3387d937
Merge pull request #3322 from sarum9in/run_timeout 2018-03-29 21:48:09 +03:00
Aleksey Filippov ddc6f72507 Use consistent quotes 2018-03-28 21:31:04 +00:00
Aleksey Filippov 827d33c8b6 Split SingleTestRunner.run() 2018-03-28 18:57:50 +00:00
Aleksey Filippov 0e8c69b796 Split SingleTestRunner._get_cmd() out of run() 2018-03-28 18:34:02 +00:00
Aleksey Filippov 9596fd6c24 Move run_single_test() into separate class 2018-03-28 18:34:02 +00:00
Aleksey Filippov 3eebb1f83a Make run_single_test() method static
Closes #3318
2018-03-28 18:34:02 +00:00
Aleksey Filippov 9c01fc0e49 Do not access counters from parallel code 2018-03-28 18:34:02 +00:00
Aleksey Filippov 2aa1c3d575 Use enum instead of string constants 2018-03-28 18:33:50 +00:00
Aleksey Filippov 84e3cadc70 Use hermetic parameters in run_single_test(), initialize them before in the caller 2018-03-28 16:44:49 +00:00
Jussi Pakkanen 9b2e533d87 Always build parser objects anew to avoid leaking old data. 2018-03-27 00:39:45 +03:00
nyorain dd614015e0 Open mesontest logfiles in utf-8 mode
Otherwise unit tests fail on windows when they output some
non-utf8 data.
2018-03-20 22:28:59 +02:00
Alicia Boya García 70270d874d meson test: let gdb handle ^C instead of us
Fixes https://github.com/mesonbuild/meson/issues/3156
2018-03-05 00:04:28 +02:00
Hemmo Nieminen 275c737d57 Fix test setup's timeout_multiplier handling. 2018-03-03 21:23:33 +02:00
Hemmo Nieminen e0d0c0166a Avoid unnecessary unpickling of build data during testing. 2018-03-01 01:06:51 +02:00
Hemmo Nieminen 7fb8e518b2 Harmonize data pickling.
Try to be more consistent on using save() and load() methods to pickle
data.
2018-03-01 01:06:51 +02:00
Hemmo Nieminen 060560bf62 Use test setups from the active (sub)project by default.
Replace the logic where a test setup with no project specifier defaults to
the main project with one that takes the test setup from the same
(sub)project from where the to-be-executed test has been read from.
2018-02-25 21:44:59 +02:00
Hemmo Nieminen abcaf7c222 Namespace test setups.
Use $project_name:$test_setup namespace scheme for test setups. This
allows one to choose from which (sub)project a test setup is taken from
should there be several sharing the same name. Defaults to the main
project. E.g. "meson test --setup subproj:valgrind".
2018-02-25 21:44:59 +02:00
Alex Hirsch 3e8eab66a1 Do not set MALLOC_PERTURB_ for benchmarks
Setting MALLOC_PERTURB_ to a non-zero value is fine for regular test
cases. It helps catching bugs, but also comes with some runtime
overhead.

This overhead is noticeable for benchmarks when compared to running them
directly instead of through Meason.

Therefore, MALLOC_PERTURB_ is not touched for benchmarks.

closes #3034
2018-02-12 21:39:28 +02:00
Robert Doolittle 9b27f07002 don't use bare except 2018-01-30 10:17:45 -08:00
Robert Doolittle 60cfb87e69 mtest: catch ctrl-c and properly kill the child processes. Fixes #2281 2018-01-30 10:13:34 -08:00
Aleksey Filippov 2cf85ae16f Use os.path: basename() and dirname() instead of split()
According to Python documentation[1] dirname and basename
are defined as follows:
    os.path.dirname() = os.path.split()[0]
    os.path.basename() = os.path.split()[1]
For the purpose of better readability split() is replaced
by appropriate function if only one part of returned tuple
is used.

[1]: https://docs.python.org/3/library/os.path.html#os.path.split
2018-01-30 07:08:22 +11:00
Dylan Baker d573a29bda mtest: Chdir into the build directory before running tests with -C
When `ninja -C builddir/ test` is run, ninja will change into the build
dir before starting, but `meson test -C builddir/` does not. This is
important because meson does not use (for good reasons) absolute paths,
which means if a test case needs to be passed as an argument a file name
that is part of the build process, it will be relative builddir. Without
changing into the builddir the path will not exist (or worse, point at
the wrong thing), and test will not behave as intended.

To fix this mtest will change directory before starting tests, and will
change back after all tests have been finished.

Fixes #2710
2017-11-30 22:19:54 +02:00
Jussi Pakkanen 5cd8a7bbcc More defensive process killing. Closes #2629. 2017-11-19 18:20:41 +02:00
Eric Engestrom 5f7f5cdb05 Print correct command in help message
Taking mconf for instance:
before:
  $ meson configure --help
  usage: meson [-h] [-D SETS] [--clearcache] [directory [directory ...]]
after:
  $ meson configure --help
  usage: meson configure [-h] [-D SETS] [--clearcache] [directory [directory ...]]
2017-11-09 21:12:34 +02:00
Eric Engestrom 9b6214eb4d mtest: print correct name in error message 2017-10-31 10:11:05 +00:00
Jussi Pakkanen b63710863b Renamed test serialisation from is_cross to is_cross_built for clarity. 2017-09-12 20:32:07 +03:00
Jon Turney b04c4fa878 Add Windows extra_paths to beginning of PATH when running tests
Adding it to the end of PATH means that if an installed instance of a DLL
exists, that would be used instead of the built instance.

Compare with run_exe(), which already gets this right.
2017-09-12 20:28:42 +03:00
Jussi Pakkanen c2e40650e8 Turned mesontest into on internal module. 2017-08-02 22:00:09 +03:00