From ec492dd9e01334d19de6ff5e149f21e1b50e352a Mon Sep 17 00:00:00 2001 From: jonathanmetzman <31354670+jonathanmetzman@users.noreply.github.com> Date: Fri, 18 Jun 2021 04:59:01 -0700 Subject: [PATCH] [CIFuzz][NFC] Put integration test decorator on class instead of test methods (#5936) --- infra/cifuzz/run_fuzzers_test.py | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/infra/cifuzz/run_fuzzers_test.py b/infra/cifuzz/run_fuzzers_test.py index 973fcb5b0..a5abf08bd 100644 --- a/infra/cifuzz/run_fuzzers_test.py +++ b/infra/cifuzz/run_fuzzers_test.py @@ -67,27 +67,27 @@ class RunFuzzerIntegrationTestMixin: # pylint: disable=too-few-public-methods,i self.assertEqual(result, run_fuzzers.RunFuzzersResult.NO_BUG_FOUND) +@unittest.skipIf(not os.getenv('INTEGRATION_TESTS'), + 'INTEGRATION_TESTS=1 not set') class RunMemoryFuzzerIntegrationTest(RunFuzzerIntegrationTestMixin, unittest.TestCase): """Integration test for build_fuzzers with an MSAN build.""" FUZZER_DIR = MEMORY_FUZZER_DIR FUZZER = MEMORY_FUZZER - @unittest.skipIf(not os.getenv('INTEGRATION_TESTS'), - 'INTEGRATION_TESTS=1 not set') def test_run_with_memory_sanitizer(self): """Tests run_fuzzers with a valid MSAN build.""" self._test_run_with_sanitizer(self.FUZZER_DIR, 'memory') +@unittest.skipIf(not os.getenv('INTEGRATION_TESTS'), + 'INTEGRATION_TESTS=1 not set') class RunUndefinedFuzzerIntegrationTest(RunFuzzerIntegrationTestMixin, unittest.TestCase): """Integration test for build_fuzzers with an UBSAN build.""" FUZZER_DIR = UNDEFINED_FUZZER_DIR FUZZER = UNDEFINED_FUZZER - @unittest.skipIf(not os.getenv('INTEGRATION_TESTS'), - 'INTEGRATION_TESTS=1 not set') def test_run_with_undefined_sanitizer(self): """Tests run_fuzzers with a valid UBSAN build.""" self._test_run_with_sanitizer(self.FUZZER_DIR, 'undefined') @@ -304,14 +304,14 @@ class BatchFuzzTargetRunnerTest(fake_filesystem_unittest.TestCase): self.assertEqual(mocked_run_fuzz_target.call_count, 2) +@unittest.skipIf(not os.getenv('INTEGRATION_TESTS'), + 'INTEGRATION_TESTS=1 not set') class RunAddressFuzzersIntegrationTest(RunFuzzerIntegrationTestMixin, unittest.TestCase): """Integration tests for build_fuzzers with an ASAN build.""" BUILD_DIR_NAME = 'cifuzz-latest-build' - @unittest.skipIf(not os.getenv('INTEGRATION_TESTS'), - 'INTEGRATION_TESTS=1 not set') def test_new_bug_found(self): """Tests run_fuzzers with a valid ASAN build.""" # Set the first return value to True, then the second to False to @@ -330,8 +330,6 @@ class RunAddressFuzzersIntegrationTest(RunFuzzerIntegrationTestMixin, build_dir = os.path.join(workspace, 'out', self.BUILD_DIR_NAME) self.assertNotEqual(0, len(os.listdir(build_dir))) - @unittest.skipIf(not os.getenv('INTEGRATION_TESTS'), - 'INTEGRATION_TESTS=1 not set') @mock.patch('fuzz_target.FuzzTarget.is_reproducible', side_effect=[True, True]) def test_old_bug_found(self, _):