From 063d71380d6c68dbfcc08210c449121709ae8a6c Mon Sep 17 00:00:00 2001 From: zhangtianli2006 Date: Mon, 23 Aug 2021 19:43:11 +0800 Subject: [PATCH] [feature] output path config Signed-off-by: zhangtianli2006 --- vcheck.py | 14 +++++++++----- vmake.py | 14 +++++++++----- 2 files changed, 18 insertions(+), 10 deletions(-) diff --git a/vcheck.py b/vcheck.py index ccb2662..43266c2 100644 --- a/vcheck.py +++ b/vcheck.py @@ -65,6 +65,10 @@ task_cnt = [] vconf = open("vtest.conf", "r") name, sub_tasks = vconf.readline().split() +folder = vconf.readline().strip() +if (not os.path.exists(folder)): + os.makedirs(folder) + sub_tasks = int(sub_tasks) tot_tasks = 0 @@ -89,9 +93,9 @@ for i in range(1, sub_tasks + 1): for j in range(1, task_cnt[i - 1] + 1): tot_id += 1 exe_path = "./run_{}".format(name) - in_path = "{}.{}.{}.in".format(name, i, j) - out_path = ".output.tmp" - ans_path = "{}.{}.{}.out".format(name, i, j) + in_path = "{}/{}.{}.{}.in".format(folder, name, i, j) + out_path = "{}/.output.tmp".format(folder) + ans_path = "{}/{}.{}.{}.out".format(folder, name, i, j) check_file(exe_path, "[ERR] Executable file {} not found.".format(exe_path)) check_file(in_path, "[ERR] Input file {} not found.".format(in_path)) @@ -122,8 +126,8 @@ for i in range(1, sub_tasks + 1): tot_end_time = time.time() -if os.path.exists(".output.tmp"): - os.remove(".output.tmp") +if os.path.exists("{}/.output.tmp".format(folder)): + os.remove("{}/.output.tmp".format(folder)) print("\nSummary:", end="") if wa != 0: diff --git a/vmake.py b/vmake.py index 071eebe..20555f2 100644 --- a/vmake.py +++ b/vmake.py @@ -29,6 +29,10 @@ task_cnt = [] vconf = open("vtest.conf", "r") name, sub_tasks = vconf.readline().split() +folder = vconf.readline().strip() +if (not os.path.exists(folder)): + os.makedirs(folder) + sub_tasks = int(sub_tasks) tot_tasks = 0 @@ -52,9 +56,9 @@ for i in range(1, sub_tasks + 1): tot_id += 1 mk_path = "./mk_{}".format(name) std_path = "./std_{}".format(name) - in_path = ".input.tmp" - out_path = "{}.{}.{}.in".format(name, i, j) - ans_path = "{}.{}.{}.out".format(name, i, j) + in_path = "{}/.input.tmp".format(folder) + out_path = "{}/{}.{}.{}.in".format(folder, name, i, j) + ans_path = "{}/{}.{}.{}.out".format(folder, name, i, j) check_file(mk_path, "[ERR] Executable file {} not found.".format(mk_path)) check_file(std_path, "[ERR] Executable file {} not found.".format(std_path)) @@ -98,8 +102,8 @@ for i in range(1, sub_tasks + 1): tot_end_time = time.time() -if os.path.exists(".input.tmp"): - os.remove(".input.tmp") +if os.path.exists("{}/.input.tmp".format(folder)): + os.remove("{}/.input.tmp".format(folder)) print("\nSummary:") print(" Total time: {}ms".format(round((tot_end_time - tot_start_time) * 1000, 2)))