aboutsummaryrefslogtreecommitdiff
path: root/run_unittests.py
AgeCommit message (Collapse)AuthorFilesLines
2018-06-18meson_install: Don't add DESTDIR to install_nameNirbheek Chauhan1-2/+15
This was added accidentally. Includes a test for it. Also fix a rebase error. The variable was defined incorrectly and was overwritten with the correct value immediately afterwards.
2018-06-18unittests: Assert that we have pkg-config on all CINirbheek Chauhan1-5/+12
Our appveyor configuration provides pkg-config when building for mingw, cygwin, msvc, etc. Of course, people manually running the tests won't require pkg-config.
2018-06-18macos: Rewrite install_name for dependent built libraries on installNirbheek Chauhan1-7/+20
On macOS, we set the install_name for built libraries to @rpath/libfoo.dylib, and when linking to the library, we set the RPATH to its path in the build directory. This allows all built binaries to be run as-is from the build directory (uninstalled). However, on install, we have to strip all the RPATHs because they point to the build directory, and we change the install_name of all built libraries to the absolute path to the library. This causes the install name in binaries to be out of date. We now change that install name to point to the absolute path to each built library after installation. Fixes https://github.com/mesonbuild/meson/issues/3038 Fixes https://github.com/mesonbuild/meson/issues/3077 With this, the default workflow on macOS matches what everyone seems to do, including Autotools and CMake. The next step is providing a way for build files to override the install_name that is used after installation for use with, f.ex., private libraries when combined with the install_rpath: kwarg on targets.
2018-06-18Test that binaries that use external libraries workNirbheek Chauhan1-13/+52
When we link to an external library either with find_library() without any dirs:, or with dependency(), we should be able to run uninstalled out of the box without having to set any environment variables or other shenanigans. This is especially important on macOS because only the system frameworks directory is in the default runtime path, and all other frameworks and libraries need to be found with RPATH or absolute path to the dylib.
2018-06-09Fix options being reset to default on reconfigureXavier Claessens1-0/+5
Closes: #3712
2018-06-08Add a unit test for `meson introspect --installed`Nirbheek Chauhan1-0/+3
2018-06-07More clearly explain portability issues with linking to a moduleJon Turney1-2/+5
Refine #3277 According to what I read on the internet, on OSX, both MH_BUNDLE (module) and MH_DYLIB (shared library) can be dynamically loaded using dlopen(), but it is not possible to link against MH_BUNDLE as if they were shared libraries. Metion this as an issue in the documentation. Emitting a warning, and then going on to fail during the build with mysterious errors in symbolextractor isn't very helpful, so make attempting this an error on OSX. Add a test for that. See also: https://docstore.mik.ua/orelly/unix3/mac/ch05_03.htm https://stackoverflow.com/questions/2339679/what-are-the-differences-between-so-and-dylib-on-osx
2018-06-06Add unit test for option precedenceXavier Claessens1-1/+27
Closes #3456.
2018-06-06Convert args.projectoptions into a dictXavier Claessens1-19/+41
This simplifies a lot of code, and centralize "key=value" parsing in a single place. Unknown command line options becomes an hard error instead of merely printing warning message. It has been warning it would become an hard error for a while now. This has exceptions though, any unknown option starting with "<lang>_" or "b_" are ignored because they depend on which languages gets added and which compiler gets selected. Also any option for unknown subproject are ignored because they depend on which subproject actually gets built. Also write more command line parsing tests. "19 bad command line options" is removed because bad cmd line option became hard error and it's covered with new tests in "30 command line".
2018-06-06Fix command line unit test not actually testing failure messageXavier Claessens1-8/+9
self.init() raise an exception so anything else in the 'with' block is not executed.
2018-06-06Remove had_argument_for() it is not used anymoreXavier Claessens1-13/+13
This also means we don't need to keep original command line arguments anymore.
2018-06-06Move get_args_from_envvars() from environment to compilersXavier Claessens1-1/+1
2018-06-06Warn when Apple bitcode support is enabled and in-useNirbheek Chauhan1-2/+6
We have to disable some options, so tell the user about them and point to the documentation so they can read more about it.
2018-06-06Add documentation for Builtin options and bitcodeNirbheek Chauhan1-0/+21
Also add a test that ensures that new base options and compiler options are always documented.
2018-06-06Add a new option for building with Apple bitcode supportNirbheek Chauhan1-0/+43
Normally, people would just pass -fembed-bitcode in CFLAGS, but this conflicts with -Wl,-dead_strip_dylibs and -bundle, so we need it as an option so that those can be quietly disabled.
2018-06-06meson introspect: Fix --installed argumentNirbheek Chauhan1-1/+4
Traceback (most recent call last): File "meson.py", line 29, in <module> sys.exit(mesonmain.main()) File "mesonbuild/mesonmain.py", line 411, in main return run(sys.argv[1:], launcher) File "mesonbuild/mesonmain.py", line 320, in run return mintro.run(remaining_args) File "mesonbuild/mintro.py", line 234, in run list_installed(installdata) File "mesonbuild/mintro.py", line 72, in list_installed for path, installdir, aliases, unknown1, unknown2 in installdata.targets: ValueError: too many values to unpack (expected 5)
2018-06-03Extend test_rc_depends_files test caseJon Turney1-3/+19
Extend test_rc_depends_files test case to also cover depfile generation for a resource file generated by a custom_target
2018-06-03Have the windows.resource_compiler() preprocesor write a depfileJon Turney1-1/+7
When using binutils's windres, we can instruct it to invoke the preprocessor in such a way that it writes a depfile, so that dependencies on #included files are automatically tracked. Not implemented for MSVC tools, so skip testing it in that case.
2018-06-02Add extended unit test for 'install_mode'Filipe Brandenburger1-0/+33
This new unit test will use the targets in '198 install_mode' and confirm that every file and directory gets the expected mode, ensuring that the setting is properly applied at install time.
2018-06-02Check mode of file, not subdirectory, in install_subdir.Filipe Brandenburger1-1/+1
When using an install_mode in install_subdir(), that should apply to the files and not to the directory tree. Otherwise, an install_mode not including the executable bit will make the tree inaccessible, since directories need it to be traversed. If the mode needs to be applied to both files and directories, then install_subdir() is only useful to install files with the executable bit set, which is not really that useful... So default to just using the umask for the directories and applying install_mode to the files only. This can be reviewed in the future, possibly by adding a separate install_dir_mode attribute, or perhaps adding an optional fourth field to FileMode with the mode for directories (this is similar to how RPM handles specifying mode of directory trees recursively added to the package.)
2018-06-01Fix assertRebuiltTarget with VS backendJon Turney1-2/+0
For the VS backend, assertRebuiltTarget() asserts the that target is both recompiled and relinked. This isn't correct for test_rc_depends_files, as changing the rc script's dependencies only causes the executable to be relinked, and not to also have it's source recompiled. assertRebuiltTarget already gets this right for the ninja backend.
2018-06-01Also run Windows unit tests on CygwinJon Turney1-1/+2
2018-06-01Add a depend_files: keyword to windows.compile_resources()Jon Turney1-0/+10
Expose depend_files: from the custom_target this creates. This is the change suggested in #2815, with tests and documentation added. Fixes #2789 (duplicate #2830)
2018-06-01Set the meson command to use when we know what it isNirbheek Chauhan1-39/+25
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-05-31Revert "mesonlib: handle meson exe wrappers"Nirbheek Chauhan1-2/+1
This reverts commit 0627e9d616dc311b7c9b0ef17301f680ac9e78a7. Breaks installation: https://github.com/mesonbuild/meson/issues/3647 Will be restored once that can be fixed.
2018-05-30mesonlib: handle meson exe wrappersMartin Kelly1-1/+2
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-30run_unittests: typo fixMartin Kelly1-1/+1
2018-05-22Merge pull request #3383 from mesonbuild/nirbheek/configure-file-nodataJussi Pakkanen1-1/+1
configure_file: Add a new action 'copy'
2018-05-22configure_file: Add a new action 'copy'Nirbheek Chauhan1-1/+1
This will copy the file to the build directory without trying to read it or substitute values into it. Also do this optimization if the configuration_data() object passed to the `configuration:` kwarg is empty, and print a warning about it. See also: https://github.com/mesonbuild/meson/issues/1542
2018-05-21dict: unit test integer keyMathieu Duponchelle1-0/+4
2018-05-21dict: fix CI issuesMathieu Duponchelle1-4/+3
2018-05-20dict: address review commentsMathieu Duponchelle1-0/+11
2018-05-17Generalize message about fallback failureJon Turney1-2/+2
The fallback might be not used not only because it couldn't be found, but also because something went wrong trying to use it. Also, update a test which relies on the specific text
2018-05-10unit tests: Undo accidental disabling of testNirbheek Chauhan1-1/+0
Was accidentally merged. https://github.com/mesonbuild/meson/pull/3240/files#r181593745
2018-05-09gdbus_codegen: Guess the output list for docbook generationNirbheek Chauhan1-2/+16
We were setting it to a file list that would always be wrong, and always out of date since it would never exist. However, the output list is not predictable. It usually has a 1-1 relationship with the input XML files, but it may not. This must be fixed later with API for users to provide the output names. See: https://github.com/mesonbuild/meson/pull/3539
2018-05-03python module: Move tests to test cases/unitNirbheek Chauhan1-1/+1
The tests are only run via unit tests, so that's where they should be.
2018-05-03python module: make it work with pypyMathieu Duponchelle1-0/+13
pypy installations don't usuallyy ship with pkg-config files, we thus need to replicate what their version of distutils does. In addition, we also try our best to build against other pythons that do not have pkg-config files.
2018-05-02pkgconfig: Don't expose internal libraries in .pc filesNirbheek Chauhan1-5/+6
Libraries that have been linked with link_whole: are internal implementation details and should never be exposed to the outside world in either Libs: or Libs.private: Closes https://github.com/mesonbuild/meson/issues/3509
2018-05-02Keep separator spaces in pkg-config declarations. Closes #3479.Jussi Pakkanen1-0/+11
2018-04-27Passing --default-library=both should override project valueXavier Claessens1-0/+10
Looks like this has always been broken, had_argument_for() was checking if we have --default_library instead of --default-library.
2018-04-27Passing --bindir twice is fineXavier Claessens1-4/+2
Unit test was asserting that "meson --bindir=foo --bindir=bar" must succeed and "meson configure --bindir=foo --bindir=bar" must fail. There should be no difference between those 2 command lines. In this case it's fine to have it twice because there is no ambiguity, second overrides the first, that's done by python's argparse.
2018-04-27Fix --warnlevel being renamed to --warning-level in latest releaseXavier Claessens1-0/+38
2018-04-26Merge pull request #3225 from filbranden/fixperms3Jussi Pakkanen1-0/+68
Introduce install_umask to determine permissions of files in install tree. Default it to 022
2018-04-25tests: Add the same kind of tests for configure.Dylan Baker1-1/+29
2018-04-25Tests: Add some tests for mixing -Dfoo and --fooDylan Baker1-0/+26
These are at least some of the tests that really deserved to be written for 78e37c495326325ae003683411971779291f8324, but I was lazy.
2018-04-23Skip snippet validation if docs dir does not exist.Jussi Pakkanen1-0/+1
2018-04-23Use the correct file path. Not the wrong one.Jussi Pakkanen1-1/+1
2018-04-20regression: pkgconfig module: Fix Fix regression in Requires.private generation.Martin Hostettler1-1/+8
The fix for Requires generation in #3406 missed a second code path with the same problem. Passing a pkgconfig dependency to requires would produce Q, t, 5, C, o,r, e' instead of 'Qt5Core'. This was introduced in 8efd940.
2018-04-18Add a unit test for install_umask.Filipe Brandenburger1-0/+68
This test copies a src tree using umask of 002, then runs the build and install under umask 027. It ensures that the default install_umask of 022 is still applied to all files and directories in the install tree.
2018-04-18Renamed test dirs so numbers are sequential.Jussi Pakkanen1-1/+1