From 307c7a3d38e8e62717e737c3fa21e62a785ed815 Mon Sep 17 00:00:00 2001 From: renxiang Date: Fri, 6 Aug 2021 10:59:20 +0800 Subject: [PATCH] fuzz generate commond auto create directory Signed-off-by: renxiang --- libs/fuzzlib/README_zh.md | 10 +++++----- src/core/command/gen.py | 5 ++--- 2 files changed, 7 insertions(+), 8 deletions(-) diff --git a/libs/fuzzlib/README_zh.md b/libs/fuzzlib/README_zh.md index 4f009ac..9d17005 100644 --- a/libs/fuzzlib/README_zh.md +++ b/libs/fuzzlib/README_zh.md @@ -77,11 +77,11 @@ gen -t TESTTYPE -fn FUZZERNAME -dp DIRECTORYPATH ``` - | 参数 | 说明 | 备注 | - | ---- | -------------- | -------------------------------------------------------- | - | -t | 测试类型 | 目前仅支持"FUZZ" | - | -fn | DTFuzz名称 | 为显式区分DTFuzz,名称必须以"fuzzer"结尾 | - | -dp | DTFuzz生成路径 | 执行命令前需要手动创建fuzztest目录和对应形态目录如common | + | 参数 | 说明 | 备注 | + | ---- | -------------- | ---------------------------------------- | + | -t | 测试类型 | 目前仅支持"FUZZ" | + | -fn | DTFuzz名称 | 为显式区分DTFuzz,名称必须以"fuzzer"结尾 | + | -dp | DTFuzz生成路径 | 路径不存在则自动创建目录 | 3. gen命令示例,-t、-fn和-dp均为必选项 diff --git a/src/core/command/gen.py b/src/core/command/gen.py index e3af631..bcbeecd 100644 --- a/src/core/command/gen.py +++ b/src/core/command/gen.py @@ -53,10 +53,9 @@ class Gen(object): fuzz_path = os.path.join(sys.source_code_root_path, options.dirpath) LOG.info("fuzz_path = %s" % fuzz_path) if not os.path.exists(fuzz_path): - LOG.error("%s is not exist." % fuzz_path) - return + os.makedirs(fuzz_path) + LOG.info("make folder %s" % fuzz_path) - LOG.info("%s exist." % fuzz_path) command = [sys.executable, helper_path, 'generate', options.fuzzername, fuzz_path] LOG.info("command %s" % command) -- GitLab