Commit Graph

264 Commits

Author SHA1 Message Date
Mathieu Duponchelle e1b138a21b Implement a generic python module
With contributions from Håvard Graff
2018-04-06 22:43:35 +02:00
Jussi Pakkanen 8eadc9d068
Merge pull request #3277 from chitranjali/shared-mod-link 2018-03-29 22:22:51 +03:00
Jussi Pakkanen be3387d937
Merge pull request #3322 from sarum9in/run_timeout 2018-03-29 21:48:09 +03:00
chitranjali cc6be2e43d Fixing flake8 2018-03-29 14:43:56 +05:30
chitranjali 34cb503c85 PR review changes closes #2865 2018-03-29 13:32:36 +05:30
chitranjali 83766313a7 fix2865 2018-03-29 13:26:32 +05:30
Aleksey Filippov 977acc94b8 Do not leave open file handlers, use context manager to clean them up 2018-03-26 23:47:51 +03:00
Aleksey Filippov fa39e1082c Timeout on test subprocesses instead of hanging and failing CI completely 2018-03-26 12:48:40 +00:00
Xavier Claessens 8efd940092 pkgconfig generator: Add required version 2018-03-25 23:20:09 +03:00
Aleksey Filippov af0b569ced Add unittests for b_ndebug=if-release and buildtype interactions 2018-03-21 16:42:35 +00:00
Jussi Pakkanen 58156ef7cf Grab a file lock on the build dir during modifications. 2018-03-20 22:28:37 +02:00
Jussi Pakkanen e984e1072b
Merge pull request #3251 from mesonbuild/fixpkgconfigdeps
Fix pkg-config dependencies leaking out (debbug 892956)
2018-03-19 23:43:35 +02:00
Jussi Pakkanen cf5f1a83d5 Fix existing tests. 2018-03-19 23:21:56 +02:00
Jussi Pakkanen c385f79737 Do not leak out private dependencies for shared libraries. 2018-03-17 00:44:56 +02:00
Jussi Pakkanen d532650b0d Add test for pkgconfig generation and usage.
This builds a project with pkg-config file, installs it and then
builds a second project that uses that dependency and runs the result.
2018-03-16 23:52:45 +02:00
Aleksey Filippov 7f042b5fe2 Use target.get_id() instead of basename and type_suffix concatenation at call site
Fixes the bug with flat layout and identical target names in subprojects.
Without this change directories are not created with subproject prefix
and they can collide.

Remove dead makedirs code in Backend.__init__(), during initialization
of backend build.targets is empty. Create output directories in
Vs2010Backend.generate_projects() instead.

Also use double blank line in run_unittests.py according to
https://www.python.org/dev/peps/pep-0008/#blank-lines.
2018-03-15 21:14:58 +02:00
Jussi Pakkanen 9ecb75670f
Merge pull request #3127 from bluetech/method-permitted-kwargs 2018-03-13 21:16:30 +02:00
Jussi Pakkanen ae0e469b06
Merge pull request #3145 from thejk/gcovr
Support gcovr >= 3.1 and add gcovr html report as fallback
2018-03-13 21:12:16 +02:00
Joel Klinghed 4e1b229b37 fixup! Allow gcovr >= 3.1 to be used to generate html coverage report
Rename gcovr_3_1 to gcovr_new_rootdir
2018-03-12 22:19:53 +01:00
Jussi Pakkanen 6585427a7d
Merge pull request #3131 from sarum9in/pkgconfig
Pkgconfig accepts libraries and pkgconfig-dependencies in requires/requires_private parameters
2018-03-12 23:02:36 +02:00
Jon Turney 7bf29b8efd Fix typo preventing soname unit tests from running
Fix a typo in ac256cb6 preventing soname unit tests from running
2018-03-12 22:25:00 +02:00
Evgenii Shatokhin 19718a8d9c Allow passing a compiler object to run_command()
Sometimes it is needed to run the current compiler with specific options
not to compile a file but rather to obtain additional info. For example,
GCC has several -print-* options to query it about the paths to
different libraries and development files. One use case is to get the
location of development files for GCC plugins, which is not easily
obtainable by other means:

  gcc -print-file-name=plugin

For this purpose, it would be convenient if the compiler object returned
by meson.get_compiler(lang) could be used in run_command() directly.
This commit implements it.

Signed-off-by: Evgenii Shatokhin <eshatokhin@virtuozzo.com>
2018-03-06 21:07:16 +02:00
Jussi Pakkanen fa1401bec1 Verify that snippets conform to expected format. 2018-03-06 14:02:22 +02:00
Jussi Pakkanen 7842bc03dd
Merge pull request #3165 from jon-turney/run-unittests
Enable linux-like unit tests on all posix-like platforms
2018-03-06 00:05:33 +02:00
Jukka Laurila 8f340ffb8d Generate meson.build based on existing source files when meson init is run in a non-empty directory. 2018-03-06 00:05:17 +02:00
Jon Turney ac256cb665 Enable linux-like unit tests on all posix-like platforms
Enable linux-like unit tests on all posix-like platforms, not just linux,
skipping tests where appropriate.  This enables these tests for OSX and
Cygwin in CI.

* Allow in-process (as well as out of process) tests to be skipped by
returning MESON_SKIP_TEST

This is needed to allow test_old_gnome_module_codepaths to be skipped when
'test cases/frameworks/7 gnome' is missing it's pre-prequisites

* Skip PIC tests on platforms where it's irrelevant

* Apple Clang reports the XCode version number, not the LLVM version number,
so the check for stdc(|++)17 needs adjusting

* Skip tests that only pertain to ELF or RPATH mechanics when irrelevant

* Skip tests that require valac if missing

* Skip asan test on Cygwin
2018-03-05 13:14:13 +00:00
Jon Turney 610e5d4a71 Invoke 'qmake --version' correctly in test_qt5dependency_qmake_detection
subprocess.getoutput() takes a string, not a list.  I'm going to guess this
is the cause of the mysterious behaviour alluded to in the comment...
2018-03-04 22:28:47 +00:00
Jussi Pakkanen 0744601fda
Merge pull request #3171 from jon-turney/flake8
Fix flake8 issues
2018-03-05 00:03:34 +02:00
Jussi Pakkanen a8da0e25ea Skip test that requires mocking when using an external exe. Also logging. 2018-03-04 19:08:37 +02:00
Jon Turney 8958529a25 Fix flake8 'variable assigned value but unused' reports
$ flake8 | grep -E 'F841'
./run_unittests.py:1987:13: F841 local variable 'objc' is assigned to but never used
./run_unittests.py:1988:13: F841 local variable 'objcpp' is assigned to but never used
./mesonbuild/minit.py:272:5: F841 local variable 'uppercase_token' is assigned to but never used
./mesonbuild/minit.py:307:5: F841 local variable 'uppercase_token' is assigned to but never used
./mesonbuild/modules/unstable_icestorm.py:36:9: F841 local variable 'result' is assigned to but never used
./mesonbuild/modules/unstable_icestorm.py:78:9: F841 local variable 'up_target' is assigned to but never used
./mesonbuild/modules/unstable_icestorm.py:81:9: F841 local variable 'time_target' is assigned to but never used
./msi/createmsi.py:226:17: F841 local variable 'file_source' is assigned to but never used
2018-03-03 21:36:37 +00:00
Jon Turney 2f6ed47077 Fix various flake8 indentation reports
$ flake8 | grep -E '(E123|E127|E128)'
./run_unittests.py:1358:37: E127 continuation line over-indented for visual indent
./run_unittests.py:1360:37: E127 continuation line over-indented for visual indent
./mesonbuild/minit.py:311:66: E128 continuation line under-indented for visual indent
./mesonbuild/minit.py:312:66: E128 continuation line under-indented for visual indent
./mesonbuild/minit.py:313:66: E128 continuation line under-indented for visual indent
./mesonbuild/compilers/cpp.py:115:63: E127 continuation line over-indented for visual indent
./msi/createmsi.py:156:13: E123 closing bracket does not match indentation of opening bracket's line
./msi/createmsi.py:188:13: E123 closing bracket does not match indentation of opening bracket's line
2018-03-03 21:35:53 +00:00
Jon Turney b8b23f4c50 Fix various flake8 whitespace reports
$ flake8 | grep -E '(E203|E221|E226|E303|W291|W293)'
./run_unittests.py:1503:5: E303 too many blank lines (2)
./mesonbuild/interpreter.py:2342:64: E226 missing whitespace around arithmetic operator
./mesonbuild/minit.py:110:17: E221 multiple spaces before operator
./mesonbuild/minit.py:131:1: W293 blank line contains whitespace
./mesonbuild/minit.py:135:19: E221 multiple spaces before operator
./mesonbuild/minit.py:155:1: W293 blank line contains whitespace
./mesonbuild/minit.py:181:1: W293 blank line contains whitespace
./mesonbuild/minit.py:183:1: W293 blank line contains whitespace
./mesonbuild/minit.py:294:47: W291 trailing whitespace
./mesonbuild/minit.py:331:47: W291 trailing whitespace
./mesonbuild/modules/unstable_icestorm.py:49:1: W293 blank line contains whitespace
./mesonbuild/modules/unstable_icestorm.py:76:31: E203 whitespace before ':'
./mesonbuild/modules/unstable_icestorm.py:82:22: E203 whitespace before ':'
2018-03-03 21:06:45 +00:00
Jon Turney cd5dba5358 Fix flake8 'imported but unused' reports
$ flake8 | grep F401
./meson.py:17:1: F401 'mesonbuild.mesonlib' imported but unused
./meson.py:18:1: F401 'locale' imported but unused
./run_unittests.py:24:1: F401 'sys' imported but unused
./mesonbuild/minit.py:2:1: F401 'pyclbr.Function' imported but unused
./mesonbuild/minit.py:18:1: F401 'os' imported but unused
./mesonbuild/backend/vs2010backend.py:15:1: F401 'sys' imported but unused
./mesonbuild/backend/xcodebackend.py:19:1: F401 'sys' imported but unused
./mesonbuild/dependencies/ui.py:20:1: F401 'shutil' imported but unused
./mesonbuild/modules/python3.py:15:1: F401 'sys' imported but unused
./mesonbuild/modules/unstable_icestorm.py:15:1: F401 '..compilers' imported but unused
./mesonbuild/modules/unstable_icestorm.py:15:1: F401 '..mlog' imported but unused
./test cases/common/98 gen extra/srcgen3.py:3:1: F401 'os' imported but unused
2018-03-03 21:06:45 +00:00
Joel Klinghed 6266089866 Allow gcovr >= 3.1 to be used to generate html coverage report
Modern gcovr includes html generation support so if lcov and
genhtml are not available fallback to gcovr.

Kept lcov and genhtml as default so to not surprise existing
users of coverage-html with the different output of gcovr.

gcovr added html support in 3.0 but as there already is a test
for 3.1 because of the changes to -r/--rootdir I opted to only
allow html generation for >= 3.1 to keep things simple.
2018-02-27 21:58:05 +01:00
Hemmo Nieminen 473dc80701 Add some test setup selection tests. 2018-02-25 21:44:59 +02:00
Aleksey Filippov d6b5d7fe9f Add library with generated_pc and PkgConfigDependency support to pkgconfig.generate() 2018-02-24 23:41:08 +00:00
Ran Benita 4d8e4654cb Warn if non-permitted keyword arguments are given to compiler methods
This can help future generations avoid mistakes like this:
edb1c66239

To avoid breaking builds, this is currently just an error. After
sufficient time has passed this can hopefully become a hard error,
similarly to the already-existing `permittedKwargs` warnings.
2018-02-23 04:35:15 +02:00
Jon Turney cf98f5e370 Enable searching system crossfile locations on more platforms
There's no reason not to also look in these places on Cygwin or OSX.  Don't
do this on Windows, as these paths aren't meaningful there.

Move test_cross_file_system_paths from LinuxlikeTests to AllPlatformTests.
2018-02-21 23:58:14 +02:00
Nirbheek Chauhan 8842839bb4 pkgconfig deps: Warn when a static library isn't found
A hard error makes this feature useless in most cases since a static
library usually won't be found for every library, particularly system
libraries like -lm. Instead, warn so the user can provide the static
library if they wish.

This feature will be expanded and made more extensible and more usable
in the future.

Closes https://github.com/mesonbuild/meson/issues/2785
2018-02-20 19:26:51 +02:00
Nirbheek Chauhan 0c1c387703 gnome: Fix depend_files listing for compile_resources
Also add a unit test that will test all codepaths for old Glib tools
versions.

Closes https://github.com/mesonbuild/meson/issues/2860
2018-02-20 19:26:16 +02:00
Nirbheek Chauhan b2007217e0 vala: Fix path of C file with generated Vala files
We missed one particular edge-case in #2413: when the generated vala
file is inside --basedir, the path is not just the basename.c

Since this case can never happen in a project test, this includes a unit
test for the same.

Closes https://github.com/mesonbuild/meson/issues/815
2018-02-20 00:19:11 +02:00
Jon Turney 9e6d3f903c Only expose exception() test function during unit tests 2018-02-15 12:51:25 +00:00
Jon Turney b78a01bced Add a test case for python exception exit status 2018-02-15 12:51:25 +00:00
Jon Turney 6a1a56ab57 Report warning/error locations in a format IDEs may already know how to parse
Examples:

meson.build:2:0: ERROR: Dependency is both required and not-found
meson.build:4: WARNING: Keyword argument "link_with" defined multiple times.

These are already matched by the default compilation-error-regexp-alist in
emacs.

Also:
Don't start 'red' markup until after the \n before an error
Unabsorb full-stop at end of warning with location from mlog.warning()
Update warning_location test
2018-01-30 06:48:22 +11:00
Xavier Claessens 6e2e94c645 pkgconfig: Also ignore not found deps passed directly to pc generator
Currently only not found deps implicitly pulled from a Library object
are ignored. We should also ignore not found deps passed directly to
generate() method.

This makes the unit testing more complicated because libfoo pkgconfig
dependency cannot be found when generated from the within the same
meson.build.
2018-01-19 13:45:14 -05:00
Xavier Claessens ec37f625c7 run_unittests.py: Support building multiple projects in a single test 2018-01-19 11:48:27 -05:00
Jussi Pakkanen 5e4538fe63 Add external dependencies to pc files only if found. Closes #2911. 2018-01-19 15:49:49 +02:00
Jussi Pakkanen 714ac85d22 Renamed test dir to avoid duplicated numbers. 2018-01-19 15:49:49 +02:00
Dylan Baker 4620bdd8b4 tests: fix rpath_uses_ORIGIN on dragonflybsd
Which always seems to prepend /usr/lib/gcc50 (or whatever version) to
the rpath, and $ORIGIN after that.
2018-01-06 13:49:34 -08:00
Jussi Pakkanen 0538009d30 Bump minimum supported Python from 3.4 to 3.5. 2018-01-04 21:29:02 +02:00