Commit fc96c623 authored by Yuan Zhixiang's avatar Yuan Zhixiang
Browse files

合并 有/无 用例的情况

parent 556c898a
...@@ -82,34 +82,22 @@ if gcc_retcode == 0: ...@@ -82,34 +82,22 @@ if gcc_retcode == 0:
# print >> sys.stderr, '===' # print >> sys.stderr, '==='
if input_data is None: if input_data is None:
# 无用例输入 input_data = ''
# 使用Valgrind运行编译后的代码
VALGRIND_EXE = os.path.join(DN, 'valgrind-3.11.0/inst/bin/valgrind') # 使用Valgrind运行编译后的代码
valgrind_p = Popen(['stdbuf', '-o0', # 确保stdout不会被缓冲,以便正确追踪 VALGRIND_EXE = os.path.join(DN, 'valgrind-3.11.0/inst/bin/valgrind')
VALGRIND_EXE, valgrind_p = Popen(['stdbuf', '-o0', # 确保stdout不会被缓冲,以便正确追踪
'--tool=memcheck', VALGRIND_EXE,
'--source-filename=' + FN, '--tool=memcheck',
'--trace-filename=' + VGTRACE_PATH, '--source-filename=' + FN,
EXE_PATH], '--trace-filename=' + VGTRACE_PATH,
stdout=PIPE, stderr=PIPE) EXE_PATH],
(valgrind_stdout, valgrind_stderr) = valgrind_p.communicate() stdout=PIPE,
valgrind_retcode = valgrind_p.returncode stdin=PIPE,
else: stderr=PIPE)
# 有用例输入 valgrind_p.stdin.write(input_data.encode('utf-8'))
# 使用Valgrind运行编译后的代码 (valgrind_stdout, valgrind_stderr) = valgrind_p.communicate()
VALGRIND_EXE = os.path.join(DN, 'valgrind-3.11.0/inst/bin/valgrind') valgrind_retcode = valgrind_p.returncode
valgrind_p = Popen(['stdbuf', '-o0', # 确保stdout不会被缓冲,以便正确追踪
VALGRIND_EXE,
'--tool=memcheck',
'--source-filename=' + FN,
'--trace-filename=' + VGTRACE_PATH,
EXE_PATH],
stdout=PIPE,
stdin=PIPE,
stderr=PIPE)
valgrind_p.stdin.write(input_data.encode('utf-8'))
(valgrind_stdout, valgrind_stderr) = valgrind_p.communicate()
valgrind_retcode = valgrind_p.returncode
# 输出Valgrind的错误信息 # 输出Valgrind的错误信息
# 防止输出多余信息 # 防止输出多余信息
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment