Commit Graph

344 Commits

Author SHA1 Message Date
Dylan Baker 2cdc6892f4 project_tests: Add a "shared_lib" type
This allows fixing tests that produce .dylib's on macOS and .so's on elf
Unices.
2020-03-06 12:11:26 -08:00
Jon Turney 42fbf9299a
Extend _run_test to test build without regenerate
Add coverage of a simple 'configure then build' sequence, to catch bugs
which occur with that.

Also, to simplify returning results from functions called by
_run_test(), allow it also throw TestResult objects, which run_test()
catches and returns.
2020-02-29 16:35:18 +00:00
Daniel Mensinger 12930051ae
test: replace pass_* functions with a test.json entry 2020-02-26 20:25:55 +01:00
Daniel Mensinger 8e60b8c146
test: merge installed_files.txt into test.json 2020-02-25 21:47:42 +01:00
Daniel Mensinger 3065202f6b
test: realise test_args.txt with a test matrix 2020-02-25 21:47:42 +01:00
Daniel Mensinger efd4e2a15b
test: merge test_matrix.json and setup_env.json into test.json 2020-02-25 21:47:37 +01:00
Daniel Mensinger 1da11be132
test: general refactoring of run_project_tests.py 2020-02-25 21:47:32 +01:00
Daniel Mensinger 96f5d4e455
boost: Updated tests 2020-02-20 13:38:45 +01:00
Jon Turney eb1a8ecf7c
Remove unused no-installed-files test feature
Looking at 45c8557d, the idea behind this seems to be that a test could
conditionally indicate that the list of installed files should not be
validated by creating that file.

It's no longer used anywhere.

Also remove a lingering no-install-files file which isn't used since commit
c693bd9b.
2020-02-13 17:15:58 +00:00
Jon Turney 3d6d908f7c
Refactor TestResult object initialization
Just add or alter attributes of the TestResult object, rather than many,
many invocations of the constructor with very similar arguments.

Define helper methods for TestResult to add the results of a step and
set the failure reason.
2020-02-13 13:28:13 +00:00
Daniel Mensinger 038e0293c6 ci: Add Fedora and OpenSUSE images 2020-02-11 19:02:25 +02:00
Dylan Baker 3689e49f4e run_project_tests: Fix it to actually work
This move the sorting logic into the TestDef class itself, which
simplifies sorting them.

Additionally it remove overcomplicated sort logic, because python
strings are compared character by character, we don't need to do the
split and cast to int, we know that realistically a maximum of 4
characters (the first 4 numbers) are going to be compared in most cases.
2020-02-07 09:29:02 -08:00
Daniel Mensinger 883262dbf6
tests: Added basic test matrix support for project tests 2020-02-05 12:11:32 +01:00
Jussi Pakkanen d8faf9b706
Merge pull request #6536 from jon-turney/cross-testing-refactor
Refactor CI cross-testing
2020-01-30 23:13:24 +02:00
Michael Hirsch, Ph.D 00f5dadd5b
Bugfix: sanitize_dir: use pathlib to handle case-insensitive filesystems (#6398) 2020-01-30 23:07:44 +02:00
Jon Turney ea805d4287
Make run_project_tests.py aware of --cross-file option 2020-01-28 21:42:06 +00:00
Daniel Mensinger 375a51712b
cmake: Some test improvements 2020-01-26 18:23:41 +01:00
Nirbheek Chauhan 2c8e676e2b tests: Fix some test failures on Ubuntun 16.04 CI
* xenial doesn't ship many dependencies, so make them all optional
  since we don't guarantee that everything will work
* cmake/{5,6}: needs stdlib.h for EXIT_SUCCESS on GCC 5
* common/222: needs C++11, and GCC 5 doesn't understand `auto`
  correctly unless we explicitly enable it.
* frameworks/1 boost: xenial doesn't ship boost_python3, so make it
  properly optional
* frameworks/6 gettext: gettext can be installed without xgettext,
  which doesn't cause the project to fail, but the installed files
  list is different which causes the test to fail.
* frameworks/7 gnome: gobject-introspection can't be enabled because
  the sanitizer unit test detects leaks in glib and fails
2020-01-24 02:53:34 +05:30
Daniel Mensinger 09b53c534f types: import typing as T (fixes #6333) 2020-01-08 15:28:17 +01:00
Michael Hirsch, Ph.D a910ba133a
doc: cuda windows comment 2019-12-23 17:25:14 -05:00
Jussi Pakkanen 17dd9e5bff
Merge pull request #6207 from dcbaker/linker-option
Add a way to select the dynamic linker meson uses
2019-12-11 23:29:33 +02:00
Michael Hirsch, Ph.D 8be7278855 run_project_tests: argparse(choices) for --only name check 2019-12-07 21:21:25 +02:00
Jussi Pakkanen 06cc98ab54
Merge pull request #6228 from scivision/scalapack
deps: add Scalapack
2019-12-07 21:17:53 +02:00
Daniel Mensinger 379d633ef2 lgtm: fix Unreachable code 2019-12-05 00:22:10 +02:00
Dylan Baker 39efd97714 run_project_tests: Fix skip rust
which expects an argument of backend, but isn't getting one.
2019-12-03 13:08:42 -08:00
Michael Hirsch, Ph.D 3120481d77
CI: scalapack not skippable since it's now in Docker image 2019-11-30 21:37:45 -05:00
Michael Hirsch, Ph.D 92b77cb321
deps: add scalapack
Scalapack uses a library stack that can be challenging to manage.
Not least of all since many Scalapacks ship with broken / incomplete
pkg-config files and CMake FindScalapack.cmake

This resolves those issues for typical Scalapack setups including:

* Linux: Intel MKL or OpenMPI + Netlib
* MacOS: Intel MKL or OpenMPI + Netlib
* Windows: Intel MKL (OpenMPI not available on Windows)
2019-11-30 21:29:49 -05:00
Daniel Mensinger 9435f11b17
ci: Add CI command to include text files in the CI log 2019-11-19 15:21:13 +01:00
Michael Hirsch, Ph.D 1baa1c9222 use '-Werror=unused-parameter' for gcc/clang on project tests and -fimplicit-none on fortran
Fortran: check for undeclared variables by forcing implicit none everywhere
C/C++: check for unused parameters and return types

removed unused variables from test cases

ci: do missing return and unused arg check with Github Actions
2019-11-17 13:24:42 +02:00
Daniel Mensinger 892c8ebe65
run_project_tests: Added print_tool_versions() 2019-10-20 12:04:15 +02:00
Dylan Baker 0c22798b1a compilers: replace CompilerType with MachineInfo
Now that the linkers are split out of the compilers this enum is
only used to know what platform we're compiling for. Which is
what the MachineInfo class is for
2019-10-07 12:08:20 -07:00
Patrick Griffis 1670fca36f Add blocks dependency
This allows easily enabling the blocks clang extension.
2019-09-23 21:10:00 +03:00
Michael Hirsch, Ph.D 3447767cac
PGI: windows PGI is sort of MSVC-like 2019-09-05 11:50:23 -04:00
Dylan Baker 25e32b56fb tests: add wasm to run_project_tests --only 2019-08-12 10:40:09 -07:00
Jussi Pakkanen f39600647d Condense test directory names. 2019-08-03 02:29:44 +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
Michael Hirsch, Ph.D 3d18da0de3
actually failfast, was not failing fast before 2019-07-30 03:14:24 -04:00
Daniel Mensinger 3b2126531a cmake: added test case for environment variables 2019-07-23 05:50:55 +00:00
Michael Hirsch, Ph.D cb7d236696 pythonic file checks 2019-07-11 22:37:25 +03:00
Jussi Pakkanen b1fbbde0b0 Use pytest parallelisation if available. 2019-07-09 22:38:30 +03:00
Jussi Pakkanen 4b1ab96795 Add command line argument to skip unit tests. 2019-07-09 22:03:58 +03:00
Michael Hirsch, Ph.D 5b109c9ad2 correct missing argument for IntelClFortranCompiler
ifort passes all tests

cleanup logic
2019-06-24 14:06:32 -04:00
Michael Hirsch, Ph.D 40a3a6c3d0 only --only option to run_project_tests, add type hints, improve variable name use 2019-06-23 18:22:43 +03:00
Michael Hirsch, Ph.D d61116efc1 windows project_test speedup by 2 2019-06-23 17:33:28 +03:00
Jussi Pakkanen 80856884cc Do not check for DOS line endings in log files. 2019-06-22 22:11:28 +03:00
Jussi Pakkanen 6d6acab6fe Detect broken Rust compiler setups. 2019-06-22 00:16:20 +03:00
John Ericson 07777e15d4 Purge `is_cross` and friends without changing user interfaces
In most cases instead pass `for_machine`, the name of the relevant
machines (what compilers target, what targets run on, etc). This allows
us to use the cross code path in the native case, deduplicating the
code.

As one can see, environment got bigger as more information is kept
structured there, while ninjabackend got a smaller. Overall a few amount
of lines were added, but the hope is what's added is a lot simpler than
what's removed.
2019-06-09 13:13:25 -04:00
John Ericson 32e827dcdc Use `env.machines.*` to avoid some `is_cross`
This is a small example of the `is_cross` removal the that abstraction
enables.
2019-06-09 13:13:20 -04:00
Daniel Mensinger 703054903b
cmake: disable the CMake tests for msvc2015 2019-06-06 18:27:05 +02:00
Daniel Mensinger 493e505d58
cmake: better logging 2019-06-06 18:27:04 +02:00
Daniel Mensinger cb57847c30
cmake: fixed installed_files.txt 2019-06-06 18:27:03 +02:00
Daniel Mensinger bf81aac465
cmake: Added project tests 2019-06-06 18:27:02 +02:00
Joel Rosdahl f13e65b93a Update to new ccache URL
ccache’s web site is now located at https://ccache.dev.

Bonus: Use the preferred capitalization “Ccache” instead of “CCache”.
2019-05-27 01:10:57 +03:00
Dylan Baker f5ea341319 compilers/clike: ICL needs msvc workarounds in has_function 2019-05-13 11:22:31 -07:00
Jussi Pakkanen b0f90a793f Better detection of tab indentation.
"But surely nobody would indent by having spaces first,
and tabs after that. Right? Right?"
2019-05-09 22:38:44 +03:00
Jussi Pakkanen 1f4023fa47
Merge pull request #5311 from mensinda/flake8Plugins
Added flake8 plugins and some code fixes
2019-05-02 23:30:29 +03:00
Michael Hirsch, Ph.D 06bfc2dab6 per-target manual specification of link_language 2019-05-02 23:26:51 +03:00
Daniel Mensinger 3581839f4c
Fix unused variables warnings 2019-04-29 12:22:50 +02:00
Daniel Mensinger bf98ffca9e
Fix blind exceptions 2019-04-29 12:16:06 +02:00
Jon Turney 744ca13ddb
Don't always skip objc/objc++ tests on Windows
These tests can run under MSYS2 using gcc or clang objc/objc++.
2019-04-15 12:07:17 +01:00
Jon Turney 1e9b753c95
Report detected compilers in run_project_tests
v2:
Use compilers.all_languages for the list of known languages
2019-04-15 12:06:58 +01:00
Ari Vuollet 5ee2fb6ede d: Fix linker errors with shared libraries on Windows 2019-04-03 19:59:24 +03:00
John Ericson f53f58f54e Always initialize compiler_options before sanity_check
This is because sanity checking wants to use CFLAGS and friends.
2019-03-27 10:54:56 -04:00
Jussi Pakkanen ed5992a10d
Merge pull request #5031 from bonzini/kconfig
Kconfig Module
2019-03-20 22:03:47 +02:00
Paolo Bonzini 7a02b76e70 interpreterbase: protect string division with FeatureNew
Meson is not warning if you join paths with / but you are requesting a
version older than 0.49.0; fix this before adding more features to the
division operator.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2019-03-18 10:51:44 -07:00
Mark Schulte 647bd2839e [modules] Add kconfig module
Add a kconfig module to allow meson to integrate with existing projects
that use kconfig.
2019-03-15 11:42:36 +01:00
Dylan Baker e7c4601fe3 tests: disable Dlang tests on windows
These don't work and no one has fixed them. When I've tried to
download dmd for windows I can't get a valid installer from their
website. Let's at least turn the CI green.
2019-03-13 23:18:09 +02:00
Michael Hirsch, Ph.D 71cffa67fa add NetCDF 2019-02-28 22:13:38 +02:00
Jussi Pakkanen a81207881b Disable D tests if dmd install is broken. 2019-02-26 01:26:54 +02:00
Dylan Baker 097faee83b run_project_tests: add support for loading cross files 2019-02-04 14:42:55 -08:00
Dylan Baker 30cf4f9c3a run_project_tests: Add support for loading a native file in tests
The file must be called nativefile.txt
2019-02-04 14:42:55 -08:00
Nirbheek Chauhan 042f5638bf project tests: qt is available on the macOS CI 2019-02-01 00:14:09 +05:30
Jussi Pakkanen 8eca221aac More tests and pic. 2019-01-21 23:35:38 +02:00
Dylan Baker 978e6fb88f tests: Add tests for the python module
This doesn't touch everything as it's just based on the python3 module
tests, ported to the python module. It's still better than the one very
basic test in the unit test module.
2018-12-12 12:23:37 -08:00
Jon Turney 94cdb68a3a
Deal with clang-cl generating empty implibs
Deal with clang-cl doing the sane (but different to MSVC) thing, of
generating an empty import library, rather than silently ignoring
/IMPLIB when there are no exports.
2018-11-06 13:19:44 +00:00
Jon Turney 5d51329d27
Extend test to when both name_{suf,pre}fix: are used 2018-11-06 13:17:21 +00:00
Jon Turney b17f6dae54
Add a test of installed library names when name_{suf,pre}fix: is used
Extend platform_fix_name() to handle this case

We avoid using library(version:), so we don't have to teach
platform_fix_name() all the platform details of versioned shared library
naming.  Hopefully that's exercised by platform-specific tests...
2018-11-06 13:17:12 +00:00
Jon Turney 3c38e46774
Use compiler detector in detect_system_compiler()
Use the compiler detector in detect_system_compiler(), rather than trying to
guess based on what it is the PATH (which could utterly fail e.g when CC env
var is set)

Note that this detection is only used by platform_fix_name() to interpret
installed_files.txt
2018-11-04 15:42:06 +00: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 4911a51aa2 Add option to fail fast in tests 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 5262aac977 Skip all dot files/directories when running tests 2018-09-25 01:14:48 +09:00
Guillermo Ignacio Enriquez Gutierrez b8581b7b67 Fix test script to be able to run in local macos 2018-09-22 22:45:34 +09:00
Marco Trevisan (Treviño) 0fc9a60189 run_proect_tests: add cygwin as platform fix name 2018-09-14 22:35:46 +02:00
Marco Trevisan (Treviño) 81e7a0981b run_project_tests: remove pdb workaround, just use filters
And ignore .dll.a files in non cygwin gcc instances
2018-09-14 20:19:35 +02:00
Marco Trevisan (Treviño) c677925dc1 run_projects_tests: Fail if we install extra files even if not in cl
As per commit 2340fd3, unexpected installed files are not reported anymore when
using compilers other than 'cl', this regression was introduced in the attempt
of not reporting extra .pdb files, but actually caused any non extra .pdb file
in other compilers to be ignored.

Fix boolean test, by reporting any extra file a part '.pdb' ones under non 'cl'
compiler, while anyone under 'cl'.
2018-09-12 21:31:26 -05:00
Jussi Pakkanen e8932adb14 Do not scan test logs. Closes #4046. 2018-08-19 14:00:40 +03:00
Jussi Pakkanen 11b520feda Scan markdown files for tabs. 2018-08-19 14:00:40 +03:00
Jussi Pakkanen 972535a6ac Condense test dirs. 2018-08-19 12:39:46 +03:00
Jussi Pakkanen b400cbe058 Kill tabs dead! For good! 2018-08-15 22:28:42 +03:00
Jussi Pakkanen 17bfbb99e5 Condense test dirs. 2018-07-31 19:22:24 +03:00
Jussi Pakkanen 2bc0f56b21 Write full directory name in files so script will change them. 2018-07-31 19:17:49 +03:00
Xavier Claessens f4d60acaa9 Remove had_argument_for() it is not used anymore
This also means we don't need to keep original command line arguments
anymore.
2018-06-06 20:02:37 +00:00
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
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
Nirbheek Chauhan 2340fd3d8a tests/windows: Tests for #1444
Check that pdb files are installed
2017-03-03 15:52:31 +05:30
Nirbheek Chauhan 2e30912447 vs: Fix running of tests to use mesontest.py
Back in November when this broke, we didn't notice because our tests
are run in-process, so we don't check that `msbuild RUN_TESTS.vcxproj`
and `ninja test` actually work.

Now we do.
2017-01-28 01:05:21 +05:30
Jussi Pakkanen 0a2daf84eb No longer require a binary called python3 on Windows. The default name is "python". 2017-01-23 21:02:04 +02:00
Mike Sinkovsky 969be1f679 cleanup: Remove redundant parentheses 2017-01-18 21:22:47 +02:00
Mike Sinkovsky 0dd1e33898 style: [E251] unexpected spaces around keyword / parameter equals 2017-01-11 12:33:27 -05:00
Mike Sinkovsky 84902cb93a style: [E301] expected 1 blank line, found 0 2017-01-11 12:33:27 -05:00
Nirbheek Chauhan 747d4f2b03 We only need Ninja 1.5.x for the core code
This change helps us run on older distros such as Ubuntu LTS which is
very lazy in updating even non-core and stable packages such as Ninja.

Ninja 1.6.x is only needed for running the tests.
2017-01-09 14:03:03 -05:00
Nirbheek Chauhan a99732aaf2 Project tests: Also catch ValueError
It seems on Windows, deleting in a loop can cause a race where the
following error is raised:

Traceback (most recent call last):
  File "run_project_tests.py", line 550, in <module>
    (passing_tests, failing_tests, skipped_tests) = run_tests(all_tests, 'meson-test-run', options.extra_args)
  File "run_project_tests.py", line 416, in run_tests
    result = result.result()
  File "C:\python34-x64\lib\concurrent\futures\_base.py", line 402, in result
    return self.__get_result()
  File "C:\python34-x64\lib\concurrent\futures\_base.py", line 354, in __get_result
    raise self._exception
ValueError: I/O operation on closed file.

https://ci.appveyor.com/project/jpakkane/meson/build/1.0.1559/job/vsek754eu000kg3e
2017-01-04 00:42:06 +05:30
Nirbheek Chauhan 89ea236b02 project tests: Always print the logs of failing tests
There is never any reason to not do this since this script is supposed
to be run by developers and testers who are concerned with the details
of the problems.

It also helps with intermittent or hard-to-reproduce errors.
2017-01-02 17:18:07 -05:00
Jussi Pakkanen dc70916ca4 Catch permissionerrors too, since Windows seems to produce them occasionally. 2017-01-02 17:17:40 -05:00
Igor Gnatenko 116da33cdd style: fix E128 violations
E128: continuation line under-indented for visual indent

Signed-off-by: Igor Gnatenko <i.gnatenko.brain@gmail.com>
2017-01-01 12:02:05 -05:00
Igor Gnatenko ea570bcb67 style: fix E265 violations
E265: block comment should start with '# '

Signed-off-by: Igor Gnatenko <i.gnatenko.brain@gmail.com>
2017-01-01 12:02:05 -05:00
Igor Gnatenko 2017d8578a style: fix E226 violations
E226: missing whitespace around arithmetic operator

Signed-off-by: Igor Gnatenko <i.gnatenko.brain@gmail.com>
2017-01-01 12:02:05 -05:00
Jussi Pakkanen b55235dfbd Fix space before :. 2016-12-31 16:28:15 +02:00
Nirbheek Chauhan a3c02262f9 Force a Ninja regeneration before each project test
We have no test coverage for regeneration at all, which is why issues
like #1246 slide by without us noticing. With this, we will run a regen
on every test during `ninja test` after it has been compiled. This will
not affect test times too much since the regen will not rebuild anything
at all since there have been no source changes.
2016-12-23 19:07:45 +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 701e393261 Make cross tests use same framework as regular tests. 2016-12-20 20:35:29 +02:00
Igor Gnatenko 9ffc0d2f89 tree-wide: remove blank lines at EOF
Signed-off-by: Igor Gnatenko <i.gnatenko.brain@gmail.com>
2016-12-19 18:34:06 +01:00
Igor Gnatenko 1590e185f4 run_project_test: don't import sys twice
Signed-off-by: Igor Gnatenko <i.gnatenko.brain@gmail.com>
2016-12-19 18:33:58 +01:00
Nirbheek Chauhan c854ae1801 run_project_tests.py: Also do ninja clean on tests
This will catch things like #1220
2016-12-19 20:52:14 +05:30
Jussi Pakkanen 4d2a2802b5 Pass --no-rebuild arg when running inprocess to prevent Ninja vomit. 2016-12-04 00:03:30 +02:00
Jussi Pakkanen ed33e64c71 Guard against cpu_count failing. 2016-12-02 22:40:54 +02:00
Jussi Pakkanen c7ddce163f All testing is now in mesontest.py, which simplifies a lot of stuff. 2016-11-18 22:10:22 +02:00
Jussi Pakkanen dc10945ad7 Merge pull request #995 from centricular/more-appveyor-builds
appveyor.yml: Test more than just MSVC2010 + Ninja on x86
2016-11-09 15:00:46 -05:00
Jussi Pakkanen 5603f90287 Allow tests to mark themselves as skipped during runtime. 2016-11-09 15:00:28 -05:00
Nirbheek Chauhan a90af371f6 project tests: Fix appveyor overwriting the platform env variable
There is no way to do this in the .appveyor.yml file since it seems that
the appveyor environment is forcibly written after each cmd command that
is run.
2016-11-10 00:40:16 +05:30
Nirbheek Chauhan da782c62df project tests: Skip lang-specific tests based on backend
XCode and Visual Studio are likely never going to support these
languages, so don't fail if the compiler happens to be in the PATH.
2016-11-10 00:40:16 +05:30
Nirbheek Chauhan 377fe51003 project tests: Require both javac and java for Java tests 2016-11-09 02:38:10 +05:30
Nirbheek Chauhan b08c8c7b77 run_tests.py: Add support for tests that fail at build-time or test-time 2016-10-14 19:13:21 +05:30
Jussi Pakkanen c7936f6819 Run unittests. 2016-10-08 07:44:19 -04:00