Commit Graph

3312 Commits

Author SHA1 Message Date
Nirbheek Chauhan 56a8b2a181 Fix static linker exelist in cross-info and environment
https://github.com/mesonbuild/meson/pull/1406 had an incomplete fix
for this. The test case caught it.

Note: this still doesn't test that setting it in the cross-info works,
but it's the same codepath as via the environment so it should be ok.
2017-02-21 01:36:08 +05:30
Nirbheek Chauhan 798c349e35 Fix compiler exelist in cross-info and the environment
https://github.com/mesonbuild/meson/pull/1406 had an incomplete fix
for this. The test case caught it.

Note: this still doesn't test that setting it in the cross-info works,
but it's the same codepath as via the environment so it should be ok.
2017-02-21 01:36:08 +05:30
Nirbheek Chauhan de45535b7d travis: Also set OBJC and OBJCXX to CC/CXX
Else they are only autodetected and we don't test both GCC and Clang.
2017-02-21 01:36:08 +05:30
Nirbheek Chauhan 68eea4818d environment: Use shlex.split() to get AR from the env
That way if the path has spaces, it won't get messed up.
2017-02-21 01:36:08 +05:30
Hase Bastian ff34e6c0b2 Update authors.txt 2017-02-21 01:36:08 +05:30
Hase Bastian 283d5e6233 Detect (non-Apple) clang as objc/c++ compiler
See https://github.com/mesonbuild/meson/pull/1388
2017-02-21 01:35:56 +05:30
Nirbheek Chauhan 238d1a37a0 Factor out common code in compiler detection
This was being duplicated across C/C++/ObjC/ObjC++/Fortran and hence
was behaving slightly differently in each.
2017-02-21 01:35:56 +05:30
Jussi Pakkanen d6614ba811 Merge pull request #1402 from centricular/test-setup-fixes
Various fixes to how mesontest handles test setups.
2017-02-20 14:56:45 -05:00
Jussi Pakkanen 98af711ca6 Merge pull request #1403 from centricular/compile_resources
Make configure_file() great again
2017-02-20 14:27:06 -05:00
Jussi Pakkanen c8042b5574 Merged clang color. 2017-02-20 21:15:59 +02:00
Rodrigo Lourenço 73e36c5b2b Add myself as an author. 2017-02-20 19:11:30 +00: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 79fcd7054d tests/common/129: Fix configure_file invocation
There is no way for us to know that 'source.c' is a file in the source
tree if it's a string. It needs to be a file object.

This used to work earlier because we used to incorrectly run the
configure_file() command in the source dir (!) instead of the build
dir. This had nasty side-effects such as creating files in the source
tree unless you specified an absolute path...
2017-02-20 23:32:04 +05:30
Nirbheek Chauhan dabf0c1882 gnome: Support configure_file() output in compile_resources
We can't support generated XML files with custom_target() because the
dependency scanning happens at configure time, but we *can* support
generating them with configure_file().

Closes https://github.com/mesonbuild/meson/issues/1380
2017-02-20 23:32:04 +05:30
Nirbheek Chauhan cb0aa6a83a configure_file: Substitute @INPUT@/@OUTPUT@/etc in command
The same substitutions and rules as custom_target().

Also generally fix it to actually work when run in a subdir and with
anything other than absolute paths for input and output files.

We now also log a message when configuring files.

Includes tests for all this.
2017-02-20 23:32:04 +05:30
Nirbheek Chauhan 1f0319c288 gnome: Document why we need absolute paths for mkenums
I forgot why this was needed and had to dig through the git logs.
Link to the GitHub issue for future reference.
2017-02-20 23:32:03 +05:30
Nirbheek Chauhan f3ff8fe6b7 custom_target: Substitute input into output
This means replacing @PLAINNAME@ and @BASENAME@ in the outputs. This is
the same feature as generator().

This is only allowed when there is only one input file for obvious
reasons + failing test for this.
2017-02-20 23:32:03 +05:30
Nirbheek Chauhan 73b2ee08a8 Rewrite custom_target template string substitution
Factor it out into a function in mesonlib.py. This will allow us to
reuse it for generators and for configure_file(). The latter doesn't
implement this at all right now.

Also includes unit tests.
2017-02-20 23:32:03 +05:30
Nirbheek Chauhan af1b898cc5 configure_file: Don't allow both command and configuration kwargs 2017-02-20 23:32:03 +05:30
Nirbheek Chauhan a6c71c62c8 gnome: Print an error message when generated files are passed to compile_resources 2017-02-20 23:32:03 +05:30
Rodrigo Lourenço ec1c163da0 Add auto option to b_colored when using Clang. Remove Clang version check when enabling colored output. 2017-02-20 17:48:04 +00:00
Nirbheek Chauhan 8c8ad2cc49 rpm: Fix missing parenthesis and quotation mark
Pointed out by Mike Sinkovsky
2017-02-20 12:04:29 -05:00
Rodrigo Lourenço 15ecd6aeb2 Update minimum Clang version for colored output 2017-02-20 09:17:04 +00:00
Jussi Pakkanen e410e2aa5b Merge pull request #1406 from mesonbuild/fixdetection
Fix compiler detection + cross when envvar not set.
2017-02-19 17:20:33 -05:00
Jussi Pakkanen 69e51109c2 Run regen before loading test data because it might have changed. 2017-02-19 17:20:14 -05:00
Jussi Pakkanen c76dcdb62b Fix the rest of them. 2017-02-19 21:56:33 +02:00
Jussi Pakkanen 4dfd9701e3 Fix compiler detection + cross when envvar not set. 2017-02-19 21:04:46 +02:00
Nirbheek Chauhan f0ccbc649c Vim syntax: new function add_test_setup()
Also remove is_subproject; it's not a global function
2017-02-19 13:17:44 -05:00
Jussi Pakkanen 476174477e Merge pull request #1400 from centricular/fix-gresource-version
gnome: Fix minimum gresource dependency required
2017-02-19 13:14:08 -05:00
Nirbheek Chauhan f90f17b250 unit tests: Test some corner-cases in test setups
https://github.com/mesonbuild/meson/pull/1402
2017-02-19 23:13:32 +05:30
Nirbheek Chauhan 06d615611b mesontest: Use setup timeout multiplier if not specified
The setup's timeout multiplier will always be set, and it will default
to 1.0, so just use that.

Without this, the setup's timeout multiplier was always ignored.
2017-02-19 23:13:32 +05:30
Nirbheek Chauhan 5bf4338913 mesontest: Use test setup name in logfiles
When using a setup, use the setup name as the namebase for the logfile
instead of the wrapper. The wrapper may not be set, or it may be shared
between test setups.

Also don't try to use the wrapper if it's an empty list.

Closes https://github.com/mesonbuild/meson/issues/1371
2017-02-19 23:13:32 +05:30
Nirbheek Chauhan d1bc5c3404 add_test_setup: Treat no env as empty env
Otherwise env is {} and we get a traceback trying to use the setup:

$ /home/cassidy/dev/meson/mesontest.py -C build --setup valgrind
ninja: Entering directory `/home/cassidy/dev/gst/master/gst-build/build'
ninja: no work to do.
Traceback (most recent call last):
  File "/home/cassidy/dev/meson/mesontest.py", line 579, in <module>
    sys.exit(run(sys.argv[1:]))
  File "/home/cassidy/dev/meson/mesontest.py", line 575, in run
    return th.doit()
  File "/home/cassidy/dev/meson/mesontest.py", line 337, in doit
    self.run_tests(tests)
  File "/home/cassidy/dev/meson/mesontest.py", line 485, in run_tests
    self.drain_futures(futures, logfile, jsonlogfile)
  File "/home/cassidy/dev/meson/mesontest.py", line 504, in drain_futures
    self.print_stats(numlen, tests, name, result.result(), i, logfile, jsonlogfile)
  File "/usr/lib64/python3.5/concurrent/futures/_base.py", line 398, in result
    return self.__get_result()
  File "/usr/lib64/python3.5/concurrent/futures/_base.py", line 357, in __get_result
    raise self._exception
  File "/usr/lib64/python3.5/concurrent/futures/thread.py", line 55, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/cassidy/dev/meson/mesontest.py", line 216, in run_single_test
    child_env.update(self.options.global_env.get_env(child_env))
AttributeError: 'dict' object has no attribute 'get_env'

There is no harm in doing this, and this is the simplest fix for this.

Closes https://github.com/mesonbuild/meson/issues/1371
2017-02-19 23:13:32 +05:30
Nirbheek Chauhan f1fe823763 Add repr() for EnvironmentVariables{,Holder}
Makes it easier to debug issues with it
2017-02-19 23:13:32 +05:30
Nirbheek Chauhan e9f9a42c7a mesontest: Don't run tests if no tests were selected
The output is very confusing otherwise. Before it said
'No suitable tests defined' and then showed a list of tests that
passed/failed.

Now it will just say 'No suitable tests defined' and exit.
2017-02-19 23:13:32 +05:30
Jussi Pakkanen 0cf18eb3bc Merge pull request #1356 from centricular/cross-platform-unit-tests
Run unit tests on more platforms, and more
2017-02-19 12:37:56 -05:00
Jussi Pakkanen aba099a491 Merge pull request #1396 from fabio-porcedda/cross-ccache
cross_file: add support for "ccache"
2017-02-19 11:42:27 -05:00
Nirbheek Chauhan 07c3d35d4b mesontest: Set MALLOC_PERTURB_ to a random value
This is useful enough that we can enable this for everyone. If people
really don't want this, they can pass MALLOC_PERTURB_=0 in the
environment or in the test.
2017-02-19 11:39:27 -05:00
Rodrigo Lourenço 76cd306204 Add b_colorout option for Clang compilers. 2017-02-19 16:36:49 +00:00
Nirbheek Chauhan af85d0e65e gnome: Fix minimum gresource dependency required
This is the latest release of glib that exists and has the required
dependency-generation fixes.

Without this GNOME Recipes cannot even configure.
2017-02-19 03:59:26 +05:30
Nirbheek Chauhan 577a3591c9 gnome: Only check gresource version with CustomTargets
We don't need dependencies to work correctly to use the output of
configure_file in the dependencies: kwarg.

This allows GNOME Recipes to built without the latest glib git.
2017-02-19 03:59:26 +05:30
Nirbheek Chauhan f23a4a8b27 run_command: Fix error message on incorrect argument
Be more descriptive so people know what they can do.
2017-02-19 03:53:21 +05:30
Nirbheek Chauhan 2478bb144d rpm: We no longer provide the full path to a library
Ever since we changed how we do library searching, the full path to the
library has not been available under `.fullpath`. This has been broken
for at least a year...
2017-02-19 03:50:43 +05:30
Nirbheek Chauhan 940b8a2e93 tests/common/119: Test array args to join_paths()
This wasn't intended, but it works and people are using it. So test it.
2017-02-19 03:50:43 +05:30
Nirbheek Chauhan 7d1cee9d84 dependencies: Remove useless and verbose dict.get() call
We already ensured that the cross-info binaries section has pkg-config
in the if check above.
2017-02-19 03:50:43 +05:30
Nirbheek Chauhan 7e805a019a find_program: Fix implementation of .path()
And actually test that prog.path() works. The earlier test was just
running the command without checking if it succeeded.

Also make everything use prog.get_command() or get_path() instead of
accessing the internal member prog.fullpath directly.
2017-02-19 03:49:31 +05:30
Nirbheek Chauhan 280346da3a find_program: Support passing mesonlib.File objects
This means you can pass files() and the return value of configure_file()
to find_program() now.
2017-02-19 03:01:24 +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 d5b4944924 run_unittests: Move more tests to AllPlatformTests
Only tests that depend on Linux-specific behaviour are now in
LinuxlikeTests.
2017-02-18 02:38:54 +05:30
Nirbheek Chauhan b3d5db49e8 mesonintrospect: Normalize install_filename in the output
Without this, we can output a mixture of '/' and '\' on platforms where
os.path.sep is '\' and prefix or outdir uses '/'. Let's always return
the path in the format of the platform we're running on.

This is needed to make the test_install_introspection() unittest work
properly on Windows.
2017-02-18 02:38:54 +05:30