[feature] output path config

Signed-off-by: zhangtianli2006 <zhangtianli2006@163.com>
This commit is contained in:
zhangtianli2006 2021-08-23 19:43:11 +08:00
parent a7c7a9949e
commit 063d71380d
2 changed files with 18 additions and 10 deletions

View File

@ -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:

View File

@ -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)))