diff options
| author | Paolo Bonzini <pbonzini@redhat.com> | 2024-11-16 16:05:05 +0100 |
|---|---|---|
| committer | Dylan Baker <dylan@pnwbakers.com> | 2024-12-19 09:25:20 -0800 |
| commit | 5768ccba6eb77167da96712c20a4e042efb31d03 (patch) | |
| tree | 274bba153b1cdf9f5826d559681bd6be918b86b3 /unittests | |
| parent | 27c567de5d1807ac72708ea48018a21f0c6b8dd2 (diff) | |
| download | meson-5768ccba6eb77167da96712c20a4e042efb31d03.tar.gz | |
ninjabackend: add support for "ninja clippy"
Add a target that builds all crates that could be extern to others,
and then reruns clippy.
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Diffstat (limited to 'unittests')
| -rw-r--r-- | unittests/allplatformstests.py | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/unittests/allplatformstests.py b/unittests/allplatformstests.py index 1b1e16928..6544bcce1 100644 --- a/unittests/allplatformstests.py +++ b/unittests/allplatformstests.py @@ -4892,6 +4892,24 @@ class AllPlatformTests(BasePlatformTests): # When clippy is used, we should get an exception since a variable named # "foo" is used, but is on our denylist testdir = os.path.join(self.rust_test_dir, '1 basic') + self.init(testdir) + self.build('clippy') + + self.wipe() + self.init(testdir, extra_args=['--werror', '-Db_colorout=never']) + with self.assertRaises(subprocess.CalledProcessError) as cm: + self.build('clippy') + self.assertTrue('error: use of a blacklisted/placeholder name `foo`' in cm.exception.stdout or + 'error: use of a disallowed/placeholder name `foo`' in cm.exception.stdout) + + @skip_if_not_language('rust') + @unittest.skipIf(not shutil.which('clippy-driver'), 'Test requires clippy-driver') + def test_rust_clippy_as_rustc(self) -> None: + if self.backend is not Backend.ninja: + raise unittest.SkipTest('Rust is only supported with ninja currently') + # When clippy is used, we should get an exception since a variable named + # "foo" is used, but is on our denylist + testdir = os.path.join(self.rust_test_dir, '1 basic') self.init(testdir, extra_args=['--werror'], override_envvars={'RUSTC': 'clippy-driver'}) with self.assertRaises(subprocess.CalledProcessError) as cm: self.build() |
