Commit Graph

80 Commits

Author SHA1 Message Date
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
Jussi Pakkanen c96557c9ed Store and print test logs of executed projects. 2017-05-05 17:17:09 +02:00
Dylan Baker a8173630ea Don't use len() to test emptiness vs not emptiness
Meson has a common pattern of using 'if len(foo) == 0:' or
'if len(foo) != 0:', however, this is a common anti-pattern in python.
Instead tests for emptiness/non-emptiness should be done with a simple
'if foo:' or 'if not foo:'

Consider the following:
>>> import timeit
>>> timeit.timeit('if len([]) == 0: pass')
0.10730923599840025
>>> timeit.timeit('if not []: pass')
0.030033907998586074
>>> timeit.timeit('if len(['a', 'b', 'c', 'd']) == 0: pass')
0.1154778649979562
>>> timeit.timeit("if not ['a', 'b', 'c', 'd']: pass")
0.08259823200205574
>>> timeit.timeit('if len("") == 0: pass')
0.089759664999292
>>> timeit.timeit('if not "": pass')
0.02340641999762738
>>> timeit.timeit('if len("foo") == 0: pass')
0.08848102600313723
>>> timeit.timeit('if not "foo": pass')
0.04032287199879647

And for the one additional case of 'if len(foo.strip()) == 0', which can
be replaced with 'if not foo.isspace()'
>>> timeit.timeit('if len("   ".strip()) == 0: pass')
0.15294511600222904
>>> timeit.timeit('if "   ".isspace(): pass')
0.09413968399894657
>>> timeit.timeit('if len("   abc".strip()) == 0: pass')
0.2023209120015963
>>> timeit.timeit('if "   abc".isspace(): pass')
0.09571301700270851

In other words, it's always a win to not use len(), when you don't
actually want to check the length.
2017-05-02 21:57:26 +03:00
Elliott Sales de Andrade 8706d7d098 Warn when directory numbers are non-unique. 2017-04-29 21:40:37 -04:00
Elliott Sales de Andrade 59c5955169 Shorten detect_tests_to_run.
Remove some duplication with a list comprehension, and invert conditions
instead of long ternary statements.
2017-04-29 21:40:37 -04:00
Nirbheek Chauhan 4f0d42967e tests: Move appveyor platform workaround to run_tests.py
This is also needed for the unit tests
2017-04-09 23:11:36 +05:30
Nirbheek Chauhan f80d471345 unit tests: Fix running specific targets with MSBuild
/t:targetname syntax doesn't work, but running the vcxproj does work

Also use the Backend enum everywhere.
2017-04-09 23:11:36 +05:30
Nirbheek Chauhan 7e4a67c790 run_project_tests: Clean on backends that can't install
Also sets more groundwork for running unit tests with backends other
that Ninja.

Transferring global state to executors is totally broken in Python 3.4
so just serialize all the commands.
2017-04-09 23:11:05 +05:30
Nirbheek Chauhan 388e5a63dc project tests: Add a new BuildStep called validate 2017-04-09 23:10:12 +05:30
Nirbheek Chauhan 323fe43413 run_project_tests: Clean-up backend detection a bit
Set a global variable that has it so other places can use it, and
error out on unknown backends
2017-04-09 23:10:12 +05:30
Nirbheek Chauhan d755228afe tests: Factor out common code to run_tests
And use generic build/clean/test/install commands in the unit tests,
just like project tests. This sets the groundwork for running the unit
tests with all backends.
2017-04-09 23:08:42 +05:30
Jon Turney 2930d3bda6 Ignore missing .pdb files when not using MSVS
This fixes 'test cases/windows/1 basic' on Cygwin
2017-04-06 22:48:02 +01:00
Jon Turney 85f989f744 Don't run framework tests on Cygwin 2017-04-06 22:48:02 +01:00
Jon Turney 6c9260c47f Run test cases/windows/ tests on Cygwin
Also, always run 'test cases/windows/5 resources' on Cygwin since it can
handle args containing spaces correctly.
2017-04-06 22:48:02 +01:00
Jon Turney fd47ef3a27 Use '.exe' extension for executables for Cygwin
Use '.exe' extension for executables for Cygwin when building and installing
2017-04-06 22:47:15 +01:00
Jon Turney 5af98a5ee8 Use correct shared library naming for Cygwin
Use correct shared library naming for Cygwin when building and installing
2017-04-06 22:47:15 +01:00
Nirbheek Chauhan f4f9272e87 project tests: Don't look for PDB files on MinGW/GCC 2017-03-28 14:47:55 +05:30
Nirbheek Chauhan 52e1b0a3c9 project tests: DummyExecutor for MSYS2 and OpenBSD
Added and tested on MSYS2/MinGW which doesn't implement the required
semaphore locks in the multiprocessing module:

Traceback (most recent call last):
  File "C:/msys64/mingw64/lib/python3.5\multiprocessing\synchronize.py", line 29, in <module>
    from _multiprocessing import SemLock, sem_unlink
ImportError: cannot import name 'sem_unlink'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "run_project_tests.py", line 560, in <module>
    (passing_tests, failing_tests, skipped_tests) = run_tests(all_tests, 'meson-test-run', options.extra_args)
  File "run_project_tests.py", line 406, in run_tests
    executor = conc.ProcessPoolExecutor(max_workers=num_workers)
  File "F:/msys64/mingw64/lib/python3.5\concurrent\futures\process.py", line 390, in __init__
    EXTRA_QUEUED_CALLS)
  File "F:/msys64/mingw64/lib/python3.5\multiprocessing\context.py", line 101, in Queue
    return Queue(maxsize, ctx=self.get_context())
  File "F:/msys64/mingw64/lib/python3.5\multiprocessing\queues.py", line 42, in __init__
    self._rlock = ctx.Lock()
  File "F:/msys64/mingw64/lib/python3.5\multiprocessing\context.py", line 65, in Lock
    from .synchronize import Lock
  File "F:/msys64/mingw64/lib/python3.5\multiprocessing\synchronize.py", line 34, in <module>
    " function, see issue 3770.")
ImportError: This platform lacks a functioning sem_open implementation, therefore, the required synchronization primitives needed will not function, see issue 3770.

See also:
https://bugs.python.org/issue3770
https://github.com/mesonbuild/meson/issues/1323

According to 3770, the same problem also exists on OpenBSD, so this
will potentially also be useful there.
2017-03-28 14:47:55 +05:30
Nirbheek Chauhan 665dd78ffe project tests: Print meson log instead of stdout for configure failures 2017-03-14 12:30:06 +05:30