From 131229e67f834be99423df72648e0b91af1666ed Mon Sep 17 00:00:00 2001 From: caojiale1 Date: Fri, 18 Aug 2023 16:57:20 +0800 Subject: [PATCH] Signed-off-by caojiale1 caojiale1@huawei.com Signed-off-by: caojiale1 --- src/core/command/run.py | 8 ++++++++ src/core/driver/drivers.py | 4 +++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/src/core/command/run.py b/src/core/command/run.py index 20bb93f..d16ec1e 100644 --- a/src/core/command/run.py +++ b/src/core/command/run.py @@ -17,6 +17,7 @@ # import platform import random +import shutil import subprocess from pydoc import classname import time @@ -298,6 +299,13 @@ class Run(object): del self.history_cmd_list[0] self.history_cmd_list.append(cmd_record) print("-------------run end: ", self.history_cmd_list) + if "fuzztest" == options.testtype[0] and options.coverage is False: + report = get_plugin(plugin_type=Plugin.REPORTER, plugin_id="ALL")[0] + latest_corpus_path = os.path.join(sys.framework_root_dir, "reports", "latest_corpus") + if os.path.exists(latest_corpus_path): + shutil.rmtree(latest_corpus_path) + shutil.copytree(os.path.join(report.report_path, "result"), latest_corpus_path) + if options.coverage and platform.system() != "Windows": pull_service_gcov_path = os.path.join( sys.framework_root_dir, "localCoverage/resident_service/pull_service_gcda.py") diff --git a/src/core/driver/drivers.py b/src/core/driver/drivers.py index f77f8b8..001f274 100644 --- a/src/core/driver/drivers.py +++ b/src/core/driver/drivers.py @@ -697,7 +697,9 @@ class CppTestDriver(IDriver): f.writelines(lines) def _push_corpus_cov_if_exist(self, suite_file): - cov_file = suite_file + "_corpus.tar.gz" + corpus_path = suite_file.split("fuzztest")[-1].strip(os.sep) + cov_file = os.path.join( + sys.framework_root_dir, "reports", "latest_corpus", corpus_path + "_corpus.tar.gz") LOG.info("corpus_cov file :%s" % str(cov_file)) self.config.device.push_file(cov_file, os.path.join(self.config.target_test_path)) -- Gitee