Commit Graph

14 Commits

Author SHA1 Message Date
Nirbheek Chauhan 2512c25c0b ninja backend: Fix usage of same constants file for native and cross
For example:
```
meson builddir \
        --native-file vs2019-paths.txt \
        --native-file vs2019-win-x64.txt \
        --cross-file vs2019-paths.txt \
        --cross-file vs2019-win-arm64.txt
```
This was causing the error:

> ERROR: Multiple producers for Ninja target "/path/to/vs2019-paths.txt". Please rename your targets.

Fix it by using a set() when generating the list of regen files, and
add a test for it too.
2022-01-30 02:13:42 +05:30
Dylan Baker 6b272973e0 dependencies: don't pass kwargs from get_pkgconfig_variable
This is a layering violation, we're relying on the way the interpreter
handles keyword arguments. Instead, pass them as free variables,
destructuring in the interpreter
2022-01-18 17:53:29 -05:00
Eli Schwartz 751f84405e
pyupgrade --py37-plus 2022-01-10 18:36:56 -05:00
Jussi Pakkanen 117ba23071 Condense test directory numbers for rc1. 2022-01-02 19:07:36 +02:00
Nirbheek Chauhan af5993fffd shared_module: Add soname when used as a link target
Emit a detailed deprecation warning that explains what to do instead.
Also add a unittest.

```
DEPRECATION: target prog links against shared module mymod, which is incorrect.
             This will be an error in the future, so please use shared_library() for mymod instead.
             If shared_module() was used for mymod because it has references to undefined symbols,
             use shared_libary() with `override_options: ['b_lundef=false']` instead.
```

Fixes https://github.com/mesonbuild/meson/issues/9492
2021-11-24 23:18:53 +05:30
Nirbheek Chauhan 04ae1cfb79 Fix cygwin test failure due to shortpath usage
Two tests are failing on Cygwin because the argument is passed as
a long-path and the Path is ending up as a short-path:

AllPlatformTests.test_run_target_files_path

  Traceback (most recent call last):
    File "/cygdrive/d/a/meson/meson/test cases/common/51 run target/check-env.py", line 22, in <module>
      assert build_root == env_build_root
  AssertionError

SubprojectsCommandTests.test_purge

  >       self.assertEqual(deleting(out), sorted([
              str(self.subprojects_dir / 'redirect.wrap'),
              str(self.subprojects_dir / 'sub_file'),
              str(self.subprojects_dir / 'sub_git'),
          ]))
  E       AssertionError: Lists differ: ['/cygdrive/c/Users/runneradmin/AppData/Local/Temp/tmpeaa2a49[205 chars]git'] != ['/cygdrive/c/Users/RUNNER~1/AppData/Local/Temp/tmpeaa2a49z/s[196 chars]git']

  [...]

  ['/cygdrive/c/Users/runneradmin/AppData/Local/Temp/tmpeaa2a49z/src/subprojects/redirect.wrap',
                      ^^^^^^^^^^^
  ['/cygdrive/c/Users/RUNNER~1/AppData/Local/Temp/tmpeaa2a49z/src/subprojects/redirect.wrap',
                      ^^^^^^^^

The fix is to not use the tempdir for all tests, but only for tests
that check the mode.
2021-10-31 19:22:36 +05:30
Eli Schwartz 739de7b088
unittests: use better assert methods
assertTrue and assertFalse are recommended against, if you can get a
more specific assertion. And sometimes it is considerably shorter, for
example we have a custom assertPathExists which we can take advantage
of.
2021-10-26 20:53:43 -04:00
Paolo Bonzini 7639b70796 cmake: handle arguments in the [binaries] section of the machine file
Sometimes, the machine file can include compiler command line options,
in order to pick the correct multilib.  For example, Meson uses "$cc
--print-search-dirs" to find the library search path, where $cc is the
cc from the machine file.  Because the outputs of "gcc -m32
--print-search-dirs" and "gcc --print-search-dirs" are different, this
only works if you have

   [binaries]
   cc = ['gcc', '-m32']

in the machine file.  Right now, however, the cmake module assumes that
the compiler listed in the machine file is either a compiler, or a
"launcher" followed by the compiler.  Check if the second argument
starts with a slash (for Microsoft-like compilers) or a dash (for
everyone else), and if so presume that the CMAKE_*_COMPILER_LAUNCHER
need not be defined.
2021-10-08 20:09:43 +02:00
makise-homura 613c9e26c4 pkgconfig: pkg-configs version<0.29.1 escape variables incorrectly 2021-09-29 20:16:02 -07:00
Alan Coopersmith 7f0193e294 unittests: Make test_prelinking work on Solaris
Running 'cc --version' finds the Solaris Studio C compiler, not gcc,
and it doesn't support --version.
2021-09-25 18:12:14 -07:00
Dylan Baker e0ab7290f0 unittests: Ensure that symlink is removed after tests complete
using `TestCase.addCleanup` is both neat and tidy, and also ensures that
the cleanup will be done, even if the test fails.
2021-08-20 21:22:55 +03:00
Eli Schwartz 59d4f771d2
editorconfig: add setting to trim trailing whitespace
and clean up all outstanding issues

Skip 'test cases/common/141 special characters/meson.build' since it
intentionally uses trailing newlines.
2021-08-15 09:36:18 -04:00
lilinzhe dd2e3bf446 pkg-config: support for `-l:libfoo.a`
fixs: #9000 Meson not correctly process with -l:xxx.a link arguments in pkgconfig .pc file.

see also:https://stackoverflow.com/questions/48532868/gcc-library-option-with-a-colon-llibevent-a

with unit test, unit test will be partially skiped if pkg-config version < 0.28 .
    see: https://gitlab.freedesktop.org/pkg-config/pkg-config/-/blob/master/NEWS
2021-08-09 19:32:48 +02:00
Xavier Claessens 7eb4c23156 Split run_unittests.py file 2021-07-26 15:19:13 -04:00