Commit Graph

178 Commits

Author SHA1 Message Date
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
Jérôme Duval c46c1e74ad run_tests.py: Haiku has no nice(). 2017-09-14 00:11:17 +03:00
Nirbheek Chauhan 192d0dd0a7 unit tests: Select test cases inside run_unittests.py
This allows people to directly run ./run_unittests.py without having
to worry about selecting the right test cases for the platform they
are on.
2017-08-13 21:16:22 +03:00
Jussi Pakkanen d94e06db21 Merged singleexe branch. 2017-08-06 17:00:51 +03:00
Jussi Pakkanen b5d829e5ac Print system information to aid in debugging remote machines. 2017-08-06 13:07:34 +03:00
Jussi Pakkanen 59a35c4c53 Print deprecation warnings on old style commands. 2017-08-02 22:01:13 +03:00
Jussi Pakkanen 5eb64a6f3e Revert "Merge pull request #1931 from centricular/use-patched-ninja"
This reverts commit aab7ada356, reversing
changes made to e1b24765af.
2017-07-18 00:30:52 +02:00
Nirbheek Chauhan b5a79b491e tests: Restore sleep for ninja on HFS+ (macOS)
QuLogic discovered that HFS+ only stores dates in uint32 seconds since
the epoch, so ninja cannot report sub-1s resolution timestamps there.
Sometime in the future Apple FS will become widely-available and we
will have to add a filesystem check at startup.

https://developer.apple.com/legacy/library/technotes/tn/tn1150.html#HFSPlusDates
2017-07-17 14:23:59 +05:30
Nirbheek Chauhan 6582cd28c8 CI: Use QuLogic's Ninja patches
This way we get some testing for the patches, and speed up our builds.

My server is hosted on a UK Linode, so it should have good uptimes.
However, we should likely move this into the Docker image at least
for Linux, and perhaps put it in a CI cache for the rest.
2017-07-17 14:23:59 +05:30
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
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
Nirbheek Chauhan 0c83f8352d dependencies: Add a new class ExternalDependency
This class now consolidates a lot of the logic that each external
dependency was duplicating in its class definition.

All external dependencies now set:

* self.version
* self.compile_args and self.link_args
* self.is_found (if found)
* self.sources
* etc

And the abstract ExternalDependency class defines the methods that
will fetch those properties. Some classes still override that for
various reasons, but those should also be migrated to properties as
far as possible.

Next step is to consolidate and standardize the way in which we call
'configuration binaries' such as sdl2-config, llvm-config, pkg-config,
etc. Currently each class has to duplicate code involved with that
even though the format is very similar.

Currently only pkg-config supports multiple version requirements, and
some classes don't even properly check the version requirement. That
will also become easier now.
2017-06-09 20:21:01 +05:30
Elliott Sales de Andrade 17328e7019 Add coverage export for tests. 2017-05-21 16:11:31 -04:00
Ole André Vadla Ravnås b595cda4ed Fix cross environment pollution.
Environment variables like CFLAGS and LDFLAGS should not affect the
cross environment.

Fixes #1772
2017-05-21 23:04:19 +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
Nirbheek Chauhan 5791cb7c4b unit tests: exe_suffix is '.exe' on Cygwin 2017-04-09 23:38:58 +05:30
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 a331bf1162 unit tests: Run on all backends, not just Ninja 2017-04-09 23:11:05 +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 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
Nirbheek Chauhan 4646958917 run_tests: Improve the backend detection 2017-04-09 23:07:49 +05:30
Nirbheek Chauhan 8df671b6f3 run_tests: Don't run unit tests when the VS backend is selected 2017-03-30 00:49:29 +05:30
Jussi Pakkanen 98af711ca6 Merge pull request #1403 from centricular/compile_resources
Make configure_file() great again
2017-02-20 14:27:06 -05:00
Nirbheek Chauhan 2a64a2d00c run_tests.py: Nice down when running on a dev machine
To avoid destroying productivity.
2017-02-20 23:32:04 +05:30
Nirbheek Chauhan 18bce47691 find_program: Correctly use scripts found in PATH
We also need to check whether the program found in PATH can be executed
directly by Windows or if we need to figure out what the interpreter is
and add it to the list.

Also add `msc` to the list of extensions that can be executed natively

Includes a project test and a unit test for this and all expected
behaviours on Windows.
2017-02-18 02:38:54 +05:30
Nirbheek Chauhan 82057ccd55 Add unit tests related to absolute prefixes
Also split the unit tests into those that are actually Linux-specific
and those that are not and can (and should) run on all platforms. This
will give us much better coverage since a lot of these test
platform-specific code in Meson that wraps features that we expose in
a platform-agnostic way.

Tests are for:
https://github.com/mesonbuild/meson/issues/1341
https://github.com/mesonbuild/meson/issues/1345
https://github.com/mesonbuild/meson/issues/1349
2017-02-18 02:37:32 +05:30
Nirbheek Chauhan bbbc4e336b Run some unit tests on all platforms
InternalTests can be run on all platforms since they have nothing
Linux-specific.
2017-01-30 03:19:41 +05:30
Jussi Pakkanen 92f8e0ab31 Do not run arm cross compilation tests on arm. 2016-12-31 14:04:58 +02:00
Jussi Pakkanen 7aa314368f Some merge conflicts are logical. Such as this one was. 2016-12-21 00:28:57 +02:00
Jussi Pakkanen a2528a8816 Merge pull request #1233 from mesonbuild/wip/ignatenko/code-style
Trivial cleanups in code
2016-12-21 00:09:44 +02:00
Jussi Pakkanen 2b65083463 Fix cross test and run them if a cross compiler is available. 2016-12-20 20:33:59 +02:00
Igor Gnatenko 8268eb4959 tree-wide: remove unused imports
./setup.py:17:1: F401 'os' imported but unused
import os
^
./setup.py:37:1: F401 'stat.ST_MODE' imported but unused
from stat import ST_MODE
^
./run_tests.py:17:1: F401 'os' imported but unused
import subprocess, sys, os
^
./run_tests.py:18:1: F401 'shutil' imported but unused
import shutil
^
./run_unittests.py:23:1: F401 'mesonbuild.dependencies.Qt5Dependency' imported but unused
from mesonbuild.dependencies import PkgConfigDependency, Qt5Dependency
^
./mesonbuild/build.py:15:1: F401 '.coredata' imported but unused
from . import coredata
^
./mesonbuild/interpreter.py:32:1: F401 'subprocess' imported but unused
import os, sys, subprocess, shutil, uuid, re
^
./mesonbuild/interpreter.py:32:1: F401 're' imported but unused
import os, sys, subprocess, shutil, uuid, re
^
./mesonbuild/dependencies.py:23:1: F401 'subprocess' imported but unused
import os, stat, glob, subprocess, shutil
^
./mesonbuild/mesonlib.py:17:1: F401 'sys' imported but unused
import platform, subprocess, operator, os, shutil, re, sys
^
./mesonbuild/modules/qt5.py:15:1: F401 'subprocess' imported but unused
import os, subprocess
^
./mesonbuild/modules/pkgconfig.py:15:1: F401 '..coredata' imported but unused
from .. import coredata, build
^
./mesonbuild/scripts/scanbuild.py:15:1: F401 'sys' imported but unused
import sys, os
^
./mesonbuild/scripts/meson_exe.py:20:1: F401 'subprocess' imported but unused
import subprocess
^
./mesonbuild/scripts/meson_exe.py:22:1: F401 '..mesonlib.MesonException' imported but unused
from ..mesonlib import MesonException, Popen_safe
^
./mesonbuild/scripts/symbolextractor.py:23:1: F401 'subprocess' imported but unused
import os, sys, subprocess
^
./mesonbuild/scripts/symbolextractor.py:25:1: F401 '..mesonlib.MesonException' imported but unused
from ..mesonlib import MesonException, Popen_safe
^
./mesonbuild/scripts/meson_install.py:19:1: F401 '..mesonlib.MesonException' imported but unused
from ..mesonlib import MesonException, Popen_safe
^
./mesonbuild/scripts/yelphelper.py:15:1: F401 'sys' imported but unused
import sys, os
^
./mesonbuild/scripts/yelphelper.py:20:1: F401 '..mesonlib.MesonException' imported but unused
from ..mesonlib import MesonException
^
./mesonbuild/backend/vs2010backend.py:17:1: F401 're' imported but unused
import re
^
./test cases/vala/8 generated sources/src/copy_file.py:3:1: F401 'os' imported but unused
import os
^
./test cases/common/107 postconf/postconf.py:3:1: F401 'sys' imported but unused
import sys, os
^
./test cases/common/129 object only target/obj_generator.py:5:1: F401 'shutil' imported but unused
import sys, shutil, subprocess
^
./test cases/common/57 custom target chain/usetarget/subcomp.py:3:1: F401 'os' imported but unused
import sys, os
^
./test cases/common/95 dep fallback/subprojects/boblib/genbob.py:3:1: F401 'os' imported but unused
import os
^
./test cases/common/98 gen extra/srcgen.py:4:1: F401 'os' imported but unused
import os
^
./test cases/common/113 generatorcustom/gen.py:3:1: F401 'os' imported but unused
import sys, os
^
./test cases/common/113 generatorcustom/catter.py:3:1: F401 'os' imported but unused
import sys, os
^
./test cases/common/59 object generator/obj_generator.py:5:1: F401 'shutil' imported but unused
import sys, shutil, subprocess
^

Signed-off-by: Igor Gnatenko <i.gnatenko.brain@gmail.com>
2016-12-19 18:19:35 +01:00
Jussi Pakkanen afe00697fa Run unittests only with default compiler. 2016-11-01 15:26:23 -07:00
Jussi Pakkanen 8faf0414ce Some fixes to unittest running. 2016-10-12 21:11:56 +03:00
Jussi Pakkanen f90bfa5245 Review fixes. 2016-10-09 14:41:47 -04:00
Jussi Pakkanen 3a002709f4 Pass cmd line args onwards. 2016-10-08 08:06:59 -04:00
Jussi Pakkanen b11a5b93cb Store all invocation output. Not shown to users yet. 2016-10-08 07:54:37 -04:00
Jussi Pakkanen c7936f6819 Run unittests. 2016-10-08 07:44:19 -04:00
Nirbheek Chauhan 81423270f5 run_tests: Print stdo and stde in failing test logs
This is a superset of the mlog output, and also contains the ninja
output and the test output.
2016-10-07 11:53:24 +05:30
Jussi Pakkanen c334eeda76 Merge pull request #684 from mesonbuild/pdb
Create pdb files with MSVC
2016-09-11 13:04:55 +03:00
Nirbheek Chauhan 91c5f07a8e run_tests.py: Ignore .pdb files while validating install
Their presence depends on build options and compiler, and we don't
currently have the test infrastructure to deal with this.
2016-09-11 10:10:48 +05:30
Elliott Sales de Andrade aec1e88c21 Use context manager in test cases. 2016-08-30 04:17:46 -04:00
Matthias Klumpp 56823272ab Implement D support
This patch adds support for the D programming language[1] to Meson.

The following compilers are supported:
* LDC
* GDC
* DMD

[1]: http://dlang.org/
2016-08-19 03:02:51 +02:00
Jussi Pakkanen f3c793b9c1 Added test for a prebuilt static library and a declare_dependency that uses it. 2016-07-25 22:00:38 +03:00