diff --git a/src/core/command/run.py b/src/core/command/run.py index 20bb93f83bcbefd7fa3fc13de39e261d69042ccb..d16ec1e099910d96f745a167f3a98c3c34709a45 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 f77f8b8ed2d4e420ce70622b96139c8354381729..001f27408bb1f613bb3462db64fdfd77753b88a7 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))