Commit Graph

98 Commits

Author SHA1 Message Date
Filipe Brandenburger 862e1dd838 Add test case for 'install_mode'
This is a simple test case, checking for installed_files.txt, which just
makes sure the syntax is accepted.

Manual tests confirmed the permissions were set correctly.

A follow up commit adds a unit test based on this directory.
2018-06-02 04:50:32 +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
Mathieu Duponchelle 14750b50ea configure_file: Add output_format kwarg (#3636)
* configure_file: Add output_format kwarg

* docs: Reference-manual.md output_format was added in 0.47 [skip ci]
2018-06-01 17:53:07 +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
Niklas Claesson ecbeae565b Enable running tests that fail at 'meson test' 2018-05-23 23:30:07 +03:00
Niklas Claesson ceeae58225 Prettifying some output with pathlib 2018-04-26 23:14:58 +03:00
Jussi Pakkanen 824650411e Final encoding fix.
I sincerely hope sufficient amounts of goats have now been sacrificed
at the altar of Debian Locales so things will actually work and I
can get to sleep.
2018-04-23 01:40:20 +03:00
Jussi Pakkanen c7e2549e59 If printing debug printing fails, try again in pure ASCII. 2018-04-23 00:02:17 +03:00
Jussi Pakkanen 166ed40097 Explicitly open log files in utf-8. 2018-04-22 21:53:22 +03:00
Elliott Sales de Andrade 8dd6b8c7ed Fix install checks when cross-compiling.
It checks the build machine for the correct extensions of resulting
binaries, but it should be checking the host machine.
2018-04-21 16:58:55 +03:00
Jukka Laurila 31df4ae164 Default run_project_tests backend to ninja instead of xcode on OS X.
The xcode backend is still incomplete and fails many tests.
2018-03-09 00:26:14 +02:00
Jon Turney 16f80b4c50 Enable 'test cases/frameworks/10 gtk-doc' for gtkdoc >= 1.26
Enable 'test cases/frameworks/10 gtk-doc' if gtkdoc version is 1.26 or
later.

Old versions of gtkdoc-scan also output the version to stdout rather than
stderr, so be sure to handle that...
2018-02-27 20:43:51 +02:00
Jussi Pakkanen 67f3f80362 Determining whether to run C# tests is so difficult it deserves its own function. 2018-02-25 12:15:59 +02:00
Thibault Saunier c48b9594ff Add support for Visual Studio csc c# compiler 2018-02-25 01:10:52 +02:00
Jon Turney 0097ce4c4e Always run all framework tests on all platforms
Always run all framework tests on all platforms, but allow them to be
skipped when not running under CI for linux.
2018-02-21 17:11:25 +00:00
Jussi Pakkanen 15358ecc9f Run FPGA tests. 2018-02-20 00:16:04 +02:00
Jon Turney 2a64ed855e Verify that failing tests are failing with an error, not a python exception
PR #2527 suggests "making failing tests more strict about failing
gracefully".

To achive this, make meson exit with distinct exit statuses for meson errors
and python exceptions, and check the exit status is as expected for failing
tests.

I can't see how to write a test for this, within the current framework.

You can test this change by reverting the fix (but not the test) from commit
1a159db8 and verifying that 'test cases/failing/66 string as link target'
fails.
2018-02-15 12:51:24 +00:00
Christoph Reiter 4e5ad57161 run_project_tests: Remove workaround for missing concurrent.futures.ProcessPoolExecutor support
This removes the workaround code added in
    https://github.com/mesonbuild/meson/commit/52e1b0a3c909

The bug in the MSYS2 Python3 build has been fixed for some time now, see
    https://github.com/Alexpux/MINGW-packages/pull/2619

The original commit noted that this might be helpful for OpenBSD, but
that has sem_open support since version 5.5 released 4 years ago:
    https://www.openbsd.org/55.html
2018-01-30 07:06:51 +11:00
Jussi Pakkanen dfd368d405
Merge pull request #2803 from dcbaker/wip/freebsd-fixes
various BSD fixes
2018-01-09 22:08:00 +02:00
Jussi Pakkanen 70902cefc3 Only run Boost tests on osx if it is actually installed. 2018-01-09 00:07:17 +02:00
Dylan Baker 0ec7dd5ac5 tests: Split objc and objc++ tests
This allows platforms that can compile one or the other (but not both)
to run the tests that they can.
2018-01-06 13:49:34 -08:00
Dylan Baker 87742fd9f0 run_project_tests: correctly search for objcpp compiler
Instead of looking for an objc compiler. Fixes objc++ tests on
DragonFlyBSD (which has an objc but not an objc++ compiler)

Really though, the objc and objc++ tests need to be untangled so that
the objc tests can run even if an objc++ compiler is unavilable.
2018-01-06 13:49:34 -08:00
Jon Turney b616abafd8 Fix installed files check for gobject-introspection tests on Cygwin
g-ir-scanner --no-libtool needed some fixes similar to [1] for Cygwin, as
well.  Now that is done, it's possible to make these tests run and pass on
Cygwin.

[1] https://bugzilla.gnome.org/show_bug.cgi?id=781525
2018-01-06 14:23:53 +00:00
Jon Turney fd683a2b81 CI: Run boost test for Cygwin
Also, use '^' to escape newlines in appveyor-install.bat to avoid an
absurdly long line, remove some unnecessary quotation, and alphabetically
sort packages

Also, define the _XOPEN_SOURCE feature test macro in the boost test to avoid
'not declared in this scope' warnings for pthread_rwlock_init(), etc.
2018-01-04 22:51:57 +00:00
Benjamin Redelings b260d5a465 Run the boost test on osx on travis. 2018-01-01 22:43:28 -08:00
Jussi Pakkanen b1c25ccde0 Use deterministic builddir so CCache works across invocations. 2017-12-18 19:44:01 +02:00
Jussi Pakkanen 105ea1e597 Make the full test suite runnable with an external command. 2017-11-20 23:14:45 +02:00
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 ac79eebc2f Moved prebuilt static library under unit tests. 2017-09-30 16:34:30 +03:00
Jussi Pakkanen b9c4fc728c Moved prebuilt object test under unittests. 2017-09-30 16:08:41 +03:00
Nirbheek Chauhan ef0501fc7d tests: Only error for lines starting with tabs
Otherwise we can't even use tabs for testing.
2017-09-20 13:36:42 +05:30
Jussi Pakkanen c20ca0ad3d Try to use 2x the number of cores. 2017-08-31 21:55:35 +03:00
Jussi Pakkanen c2e40650e8 Turned mesontest into on internal module. 2017-08-02 22:00:09 +03:00
Jussi Pakkanen ea3e03ffdd Handle objc compiler missing more reliably. 2017-08-02 18:01:39 +03:00
Jon Turney 3fa3922cea Support implibs for executables on Windows
Add a boolean 'implib' kwarg to executable().  If true, it is permitted to
use the returned build target object in link_with:

On platforms where this makes sense (e.g. Windows), an implib is generated
for the executable and used when linking.  Otherwise, it has no effect.

(Rather than checking if it is a StaticLibrary or SharedLibary, BuildTarget
subclasses gain the is_linkable_target method to test if they can appear in
link_with:)

Also install any executable implib in a similar way to a shared library
implib, i.e. placing the implib in the appropriate place

Add tests of:
- a shared_module containing a reference to a symbol which is known (at link
time) to be provided by the executable
- trying to link with non-implib executables (should fail)
- installing the implib

(This last one needs a little enhancement of the installed file checking as
this is the first install test we have which needs to work with either
MSVC-style or GCC-style implib filenames)
2017-07-20 21:11:56 +01:00
Jussi Pakkanen db34a3a701 Close files reliably. 2017-07-18 00:33:08 +02:00
Alistair Thomas 117f4ab8b5 Split out languages from compilers.py 2017-06-23 00:42:41 +01:00
Elliott Sales de Andrade a681348b05 Add some colour to test output.
Bold the section names and colourize errors&skips.
2017-06-22 06:04:59 -04:00
Jussi Pakkanen 2d659b649b Merge pull request #1924 from mesonbuild/tingping/yelp-fixes
Various yelp fixes
2017-06-21 04:36:30 -04:00
Patrick Griffis 733aee123d tests: Always consider symlink as valid installed file
An installed symlink might point to a non-existing file
(because DESTDIR is set) so just always accept them.
2017-06-17 08:39:30 -04:00
Nirbheek Chauhan 9308a6d923 tests: Add Boost unit tests and project tests on Windows
Boost tests are disabled on Windows for now because the detection
is actually completely broken. Once that's fixed (after the release)
we can enable it again.
2017-06-10 18:55:50 +05:30
Nirbheek Chauhan c1e9c757eb tests: Increase dependencies coverage a bit more 2017-06-10 00:20:03 +05:30
Nirbheek Chauhan 3a33a8ef49 unit tests: Add class to generate failing tests
It is not feasible to test all failure modes by creating projects in
`test cases/failing` that would be an explosion of files, and that
mechanism is too coarse anyway. We have no way to ensure that the
expected error is being raised.

See FailureTests.test_dependency for an example.
2017-06-09 20:21:01 +05:30
Jussi Pakkanen effe4fb134 Create helper function for a rmtree that works reliably on Windows. 2017-05-21 21:47:24 +03:00
Elliott Sales de Andrade ea636fcd51 Remove unused variables. 2017-05-17 04:41:54 -04:00
Elliott Sales de Andrade faf114299b Remove unnecessary __init__ methods. 2017-05-17 03:54:49 -04:00
Tim-Philipp Müller 076ce56425 Skip ObjectiveC/C++ tests if ObjC compiler is not available 2017-05-13 23:34:27 +03:00
Nirbheek Chauhan 1570a90822 project tests: Also regen before building
This actually caught a cached-dependency related bug for me that the
test-time regen did not. I also increased the ninja wait time to
1 second because that's actually how long you need to sleep to be
guaranteed that a change will be detected.

Must poke upstream about https://github.com/ninja-build/ninja/issues/371
2017-05-09 14:23:15 +05:30