aboutsummaryrefslogtreecommitdiff
path: root/unittests/baseplatformtests.py
AgeCommit message (Collapse)AuthorFilesLines
2022-08-16deprecate running "meson builddir" without setup subcommandEli Schwartz1-2/+2
This is ambiguous, if the build directory has the same name as a subcommand then we end up running the subcommand. It also means we have a hard time adding *new* subcommands, because if it is a popular name of a build directory then suddenly scripts that try to set up a build directory end up running a subcommand instead. The fact that we support this at all is a legacy design. Back in the day, the "meson" program was for setting up a build directory and all other tools were their own entry points, e.g. `mesontest` or `mesonconf`. Then in commit fa278f351fe3d6924b4d1961f77b5b4a36e133f8 we migrated to the subcommand mechanism. So, for backwards compatibility, we made those tools print a warning and then invoke `meson <tool>`. We also made the `meson` tool default to setup. However, we only warned for the other tools whose entry points were eventually deleted. We never warned for setup itself, we just continued to silently default to setup if no tool was provided. `meson setup` has worked since 0.42, which is 5 years old this week. It's available essentially everywhere. No one needs to use the old backwards-compatible invocation method, but it continues to drag down our ability to innovate. Let's finally do what we should have done a long time ago, and sunset it.
2022-06-13unittests: do more accurate check for ninja "nothing to do"Eli Schwartz1-2/+2
We only want to scan stdout for these strings, and particularly, if we allow `-d explain` to be mingled into stdout, then buffering issues across OSes can lead to inaccurate results.
2022-06-13unittests: allow test commands to suppress returning stderrEli Schwartz1-5/+11
Add better logging of commands by printing stdout and stderr separately, if relevant. Also while we are at it, print the actual command being run.
2022-01-30ninja backend: Fix usage of same constants file for native and crossNirbheek Chauhan1-6/+6
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-16Add a test for the --vsenv meson setup optionNirbheek Chauhan1-3/+3
The tests and the unittests both unconditionally call setup_vsenv() because all tests are run using the backend commands directly: ninja, msbuild, etc. There's no way to undo this vs env setup, so the only way to test that --vsenv works is by: 1. Removing all paths in PATH that provide ninja 2. Changing setup_vsenv(force=True) to forcibly set-up a new vsenv when MESON_FORCE_VSENV_FOR_UNITTEST is set 3. Mock-patching build_command, test_command, install_command to use `meson` instead of `ninja` 4. Asserting that 'Activating VS' is in the output for all commands 5. Ensure that compilation works because ninja is picked up from the vs env. I manually checked that this test actually does fail when the previous commit is reverted.
2022-01-10pyupgrade --py37-plusEli Schwartz1-1/+1
2021-10-31Fix cygwin test failure due to shortpath usageNirbheek Chauhan1-8/+15
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-09-24compilers/rust: Add support for clippyDylan Baker1-2/+3
Clippy is a compiler wrapper for rust that provides an extra layer of linting. It's quite popular, but unfortunately doesn't provide the output of the compiler that it's wrapping in it's output, so we don't detect that clippy is rustc. This small patch adds a new compiler class (that is the Rustc class with a different id) and the necessary logic to detect that clippy is in fact rustc) Fixes: #8767
2021-08-16unittests/base: Allow init method to failDylan Baker1-11/+29
This adds a new keyword argument to the init method, `allow_fail`. When set to True (default is False) then a failure to configure is not an error, and output is still returned. This can be useful for cases where we expect initialization to fail, and want to check the output.
2021-08-16unittests/base: Move code out of the try block of a try/except statementDylan Baker1-15/+18
There are two problems with having this in the try/except block. The first is that both of the if statements will raise, and the except statement cathces `Exception`, so it catches these two cases, prints a message that we either don't want or already printed, then re-raises.
2021-08-16unittests/baseplatform: don't double print on errorDylan Baker1-2/+4
2021-08-15editorconfig: add setting to trim trailing whitespaceEli Schwartz1-1/+0
and clean up all outstanding issues Skip 'test cases/common/141 special characters/meson.build' since it intentionally uses trailing newlines.
2021-07-26Split run_unittests.py fileXavier Claessens1-0/+438