Exemplo n.º 1
0
    def setUp(self):
        self.tmp_dir = tempfile.mkdtemp()
        os.environ['BOT_TMPDIR'] = os.path.join(self.tmp_dir, 'bot_tmpdir')

        test_helpers.patch(self, [
            'datastore.data_handler.get_data_bundle_bucket_name',
            'system.environment.set_environment_parameters_from_file',
        ])

        test_helpers.patch_environ(self)

        # Our tests write data/logs into subdirs of ROOT_DIR. Pivot the ROOT_DIR to
        # a temporary one.
        new_root = _create_test_root()

        os.environ['ROOT_DIR'] = new_root
        self.saved_cwd = os.getcwd()
        os.chdir(new_root)

        environment.set_bot_environment()

        fuzz_inputs = os.environ['FUZZ_INPUTS']
        shell.remove_directory(fuzz_inputs, recreate=True)

        worker_fuzz_inputs = file_host.rebase_to_worker_root(fuzz_inputs)
        shell.remove_directory(worker_fuzz_inputs, recreate=True)

        environment.set_value('GSUTIL_PATH', os.path.dirname(_which('gsutil')))

        test_utils.setup_pubsub('test-clusterfuzz')
        test_utils.create_pubsub_topic(pubsub.PubSubClient(),
                                       'test-clusterfuzz',
                                       'jobs-project-linux')
Exemplo n.º 2
0
    def setUp(self):
        helpers.patch_environ(self)
        helpers.patch(self, [
            'bot.tasks.minimize_task._run_libfuzzer_testcase',
            'bot.tasks.minimize_task._run_libfuzzer_tool',
        ])

        test_utils.setup_pubsub(utils.get_application_id())

        environment.set_value('APP_ARGS', '%TESTCASE% fuzz_target')
        environment.set_value('APP_DIR', '/libfuzzer')
        environment.set_value('APP_NAME', '')
        environment.set_value('APP_PATH', '')
        environment.set_value('BOT_TMPDIR', '/bot_tmpdir')
        environment.set_value('CRASH_STACKTRACES_DIR', '/crash_stacks')
        environment.set_value('FUZZER_DIR', '/fuzzer_dir')
        environment.set_value('INPUT_DIR', '/input_dir')
        environment.set_value('JOB_NAME', 'libfuzzer_asan_test')
        environment.set_value('USER_PROFILE_IN_MEMORY', True)
Exemplo n.º 3
0
    def setUp(self):
        helpers.patch_environ(self)
        helpers.patch(
            self,
            [
                "bot.tasks.minimize_task._run_libfuzzer_testcase",
                "bot.tasks.minimize_task._run_libfuzzer_tool",
            ],
        )

        test_utils.setup_pubsub(utils.get_application_id())

        environment.set_value("APP_ARGS", "%TESTCASE% fuzz_target")
        environment.set_value("APP_DIR", "/libfuzzer")
        environment.set_value("APP_NAME", "")
        environment.set_value("APP_PATH", "")
        environment.set_value("BOT_TMPDIR", "/bot_tmpdir")
        environment.set_value("CRASH_STACKTRACES_DIR", "/crash_stacks")
        environment.set_value("FUZZER_DIR", "/fuzzer_dir")
        environment.set_value("INPUT_DIR", "/input_dir")
        environment.set_value("JOB_NAME", "libfuzzer_asan_test")
        environment.set_value("USER_PROFILE_IN_MEMORY", True)