Commit Graph

149 Commits

Author SHA1 Message Date
Hemmo Nieminen 64950bd318 Add a regression test for test suites.
Ensure test setup environment variables can from now on be given also as
strings.
2017-09-01 01:47:41 +03:00
Jussi Pakkanen a1326581a5 Fix coverage target breakage and add a test for it. 2017-08-20 20:32:30 +03:00
Jussi Pakkanen e02f1dc809 Remove PHONY because Windows and OSX file systems are crap. Closes #2199. 2017-08-20 18:10:34 +03:00
Nirbheek Chauhan 0c518a8077 Add a test for dirs with reserved target names
And for dirs with the same name as run_target()s

Reproduces https://github.com/mesonbuild/meson/issues/1644
2017-08-15 00:01:33 +05:30
Nirbheek Chauhan cae5caa7f1 run_unittests: Add a helper for asserting path existence
It is useful to have a message displayed if the assert is fired.
2017-08-15 00:01:33 +05:30
Jussi Pakkanen 5c8328d27f Use "meson test" in test invocations so it will not print the deprecation warning. 2017-08-14 15:54:57 +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 59a35c4c53 Print deprecation warnings on old style commands. 2017-08-02 22:01:13 +03:00
Gabríel Arthúr Pétursson 3ddf9bf6dd Ensure same compiler flags are used for compiling PCH as normal sources
Precompiled headers should generally be compiled with the same flags as
the sources that will include the header. Some deviations are safe,
however, most will cause the compiler to reject the precompiled header
or possibly lead to compiler crashes.
2017-07-24 00:11:27 +03:00
Nirbheek Chauhan de2d59cc27 find_library: Ignore libs on MSVC properly
In addition to filtering libs out while generating the command-line, we
must also filter them out in find_library() otherwise these libs will be
detected as "found" on Windows with MSVC.

Closes https://github.com/mesonbuild/meson/issues/1509
2017-07-23 02:12:00 +03:00
Jussi Pakkanen 2269b7f60b Add build_rpath as new property allowing people to specify rpath entries that are used in the build tree but will be removed on install. 2017-07-21 19:40:54 +03:00
Martin Ejdestig 4c8c83c967 Add a mesonintrospect --dependencies test 2017-07-20 12:44:28 +02:00
Nirbheek Chauhan a27b4c4640 unittests: Don't pass /nologo to `cl` during detection
This causes it to not output the version information to stderr, which
we need to extract the version and the architecture.

Found by Jussi.
2017-07-17 19:20:00 +03:00
Nirbheek Chauhan 37057abfef unittests: Check value of cc.is_64 with MSVC 2017-07-17 19:20:00 +03:00
Nirbheek Chauhan 5660c766ab unittests: Ensure that the compiler version is not blank 2017-07-17 19:20:00 +03:00
Alistair Thomas 117f4ab8b5 Split out languages from compilers.py 2017-06-23 00:42:41 +01:00
Alistair Thomas e5559903b3 Split linkers out from compilers.py 2017-06-22 20:09:58 +01:00
Jussi Pakkanen 624709bfc1 Merge pull request #1920 from QuLogic/hg-dist
Add Mercurial dist support
2017-06-21 04:48:29 -04:00
Jussi Pakkanen c3591e5303 Handle both pkg-config and pkgconf argument order. Closes #1934. 2017-06-18 23:46:37 +03:00
Jussi Pakkanen 3bc7651907 Merge pull request #1951 from mesonbuild/dedupfix
Preserve standalone -D arguments
2017-06-18 03:49:48 +03:00
Jussi Pakkanen 1c34707aee Preserve standalone -D arguments always. 2017-06-18 00:16:45 +03:00
Jussi Pakkanen 85a263a670 Failing test for -D dedupping. 2017-06-17 13:29:13 +03:00
Jussi Pakkanen f1996f7291 Use the Windows proof dir deleter consistently. 2017-06-17 12:33:49 +03:00
Elliott Sales de Andrade eff273aa43 Add test for Mercurial dist'ing. 2017-06-13 00:32:44 -04:00
Nirbheek Chauhan 1865425b4b tests/unit/8: Rename to 9 and add -l flags 2017-06-12 22:39:33 +05:30
Jussi Pakkanen 8244f4c6a6 Created unit test to ensure linker arguments from consecutive dependencies are kept in order. 2017-06-12 22:26:10 +05:30
Nirbheek Chauhan d23e6b34c7 Preserve -L -l pairings fetched from external deps
While adding link args for external deps, sometimes different
libraries come from different prefixes, and an older version of the
same library might be present in other prefixes and we don't want to
accidentally pick that up.

For example:

/usr/local/lib/libglib-2.0.so
/usr/local/lib/pkgconfig/glib-2.0.pc
/usr/local/lib/libz.so
/usr/local/lib/pkgconfig/zlib.pc
/home/mesonuser/.local/lib/libglib-2.0.so
/home/mesonuser/.local/lib/pkgconfig/glib-2.0.pc

PKG_CONFIG_PATH="/home/mesonuser/.local/lib/pkgconfig/:/usr/local/lib/pkgconfig/"

If a target uses `dependencies : [glib_dep, zlib_dep]`, it will end up
using /usr/local/lib/libglib-2.0.so instead of
/home/mesonuser/.local/lib/libglib-2.0.so despite using the pkg-config
file in /home/mesonuser/.local/lib/pkgconfig because we reorder the -L
flag and separate it from the -l flag.

With this change, external link arguments will be added to the
compiler list without de-dup or reordering.

Closes https://github.com/mesonbuild/meson/issues/1718
2017-06-12 20:55:19 +05:30
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 38716f0fcb tests: Improve llvm dependency test coverage 2017-06-09 20:21:01 +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 de1305c9e8 Do not use context managers. Because Windows. 2017-06-08 16:17:20 +03:00
Jussi Pakkanen 7c03bfb463 Merged needs_exe_wrapper branch. 2017-06-07 20:09:43 +03:00
Nirbheek Chauhan 198c2f2d55 unit tests: Skip tests if no readelf found 2017-06-05 13:20:04 +05:30
Nirbheek Chauhan 41f8f1a53b unit tests: Also check RUNPATH when fetching RPATH 2017-06-05 03:09:17 +05:30
Nirbheek Chauhan 264ce6c0bc Use absolute RPATHs while linking due to a binutils bug
Use -rpath-link with the absolute paths to the respective build dirs
to work around a binutils bug that causes $ORIGIN to not be used while
linking.

Includes a unit test that manually checks the RPATH value written out
to ensure that it uses $ORIGIN.

See: https://sourceware.org/bugzilla/show_bug.cgi?id=16936

Closes https://github.com/mesonbuild/meson/issues/1897
2017-06-05 02:19:46 +05:30
Nirbheek Chauhan d79bdb9b6b unit tests: Use only implementation of get_soname 2017-06-05 02:11:07 +05:30
Nirbheek Chauhan 4b428053f4 ninja: Use shlex.quote for quoting on non-Windows
This is more reliable, and more accurate. For instance, this means
arguments in commands aren't surrounded by `'` on Linux unless that
is actually needed by that specific argument.

There is no equivalent helper for Windows, so we keep the old
behaviour for that.
2017-06-02 10:41:13 +05:30
Nirbheek Chauhan ae9b23832e ninja: De-dup libraries and use --start/end-group
Now we aggressively de-dup the list of libraries used while linking,
and when linking with GNU ld we have to enclose all static libraries
with -Wl,--start-group and -Wl,--end-group to force the linker to
resolve all symbols recursively. This is needed when static libraries
have circular deps on each other (see included test).

The --start/end-group change is also needed for circular dependencies
between static libraries because we no longer recursively list out all
library dependencies.

The size of build.ninja for GStreamer is now down to 6.1M from 20M,
and yields a net reduction in configuration time of 10%
2017-06-02 07:10:55 +05:30
Ole André Vadla Ravnås b32c757073
environment: Add needs_exe_wrapper for overriding auto-detection.
This is useful when build_machine appears to be compatible with
host_machine, but actually isn't. For example when:
- build_machine is macOS and host_machine is the iOS Simulator
- the build_machine's libc is glibc but the host_machine libc is uClibc
- code relies on kernel features not available on the build_machine
2017-05-29 21:05:57 +02: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
Jussi Pakkanen 5ec6151e56 Merge pull request #1810 from QuLogic/pycharm-warnings
Fix various warnings found in PyCharm
2017-05-18 19:44:57 +03:00
Jussi Pakkanen a31bc4ede5 Skip unittests that request it rather than mark them as failed. Closes #1804. 2017-05-18 19:44:33 +03:00
Elliott Sales de Andrade 4abe9a9d78 Add missing asserts in unit tests. 2017-05-17 19:43:23 -04:00
Elliott Sales de Andrade ea636fcd51 Remove unused variables. 2017-05-17 04:41:54 -04:00
Elliott Sales de Andrade 65b1d33931 Remove unused imports. 2017-05-17 03:42:16 -04:00
Jussi Pakkanen 8068fc0d1d Add test and release notes. 2017-05-12 14:25:27 +03:00
Peter Hutterer 7ed19902be pkgconfig: add suppport for custom variables during generation
Usage:
    pkgconfig.generate(
      ...
      description : 'A library with custom variables.',
      variables : ['foo=bar', 'datadir=${prefix}/data']
      )

The variables 'prefix', 'libdir' and 'includedir' are reserved, meson will
fail with an error message.

Variables can reference each other with the pkgconfig notation, e.g.

   variables : ['datadir=${prefix}/data',
                'otherdatadir=${datadir}/other']

meson does not check this for correctness or that the referenced variable
exists, we merely keep the same order as specified.
2017-05-11 00:13:30 +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
Peter Hutterer ca924451ac Use American English: behaviour -> behavior 2017-05-04 22:09:27 +03:00