提交 51e28859 创建 作者: 宋海霞's avatar 宋海霞

modify

上级 d8688af6
流水线 #151472 已通过 于阶段
用时 40 秒
*.exe
*.o
*.bak
\ No newline at end of file
{
}
\ No newline at end of file
...@@ -11,7 +11,7 @@ import subprocess ...@@ -11,7 +11,7 @@ import subprocess
import platform import platform
# 使用此文件的目录作为当前工作目录 # 使用此文件的目录作为当前工作目录
os.chdir(os.path.dirname(__file__)) # os.chdir(os.path.dirname(__file__))
from colorama import Fore, init, AnsiToWin32 from colorama import Fore, init, AnsiToWin32
init(wrap=False) init(wrap=False)
...@@ -109,7 +109,9 @@ if __name__ == "__main__": ...@@ -109,7 +109,9 @@ if __name__ == "__main__":
print("开发环境中的 Python 解释器版本号:" + platform.python_version()) print("开发环境中的 Python 解释器版本号:" + platform.python_version())
print("环境变量中的 Python 解释器版本号:", end=' ') print("环境变量中的 Python 解释器版本号:", end=' ')
execResult = os.system("python --version") execResult = os.system("python --version")
if execResult != 0: if execResult != 0:
print(Fore.RED + "应用程序异常,返回值:{0}。".format(execResult), file = stream, end='') print(Fore.RED + "应用程序异常,返回值:{0}。".format(execResult), file = stream, end='')
print(Fore.WHITE, file = stream) print(Fore.WHITE, file = stream)
...@@ -131,7 +133,13 @@ if __name__ == "__main__": ...@@ -131,7 +133,13 @@ if __name__ == "__main__":
if not os.path.isfile(outputFile): if not os.path.isfile(outputFile):
break break
print("正在使用文件 {0} 验证 case{1}".format(inputFile, seqNum)) print("正在使用文件 {0} 验证 case{1}".format(inputFile, seqNum))
runCommand = "make && app.exe < {0} > {1}".format(inputFile, useroutputFile)
if platform.system().lower() == 'windows':
runCommand = "make && app.exe < {0} > {1}".format(inputFile, useroutputFile)
elif platform.system().lower() == 'linux':
runCommand = "make && ./app.exe < {0} > {1}".format(inputFile, useroutputFile)
execResult = os.system(runCommand) execResult = os.system(runCommand)
if execResult != 0: if execResult != 0:
print(Fore.RED + "应用程序异常,返回值:{0}。".format(execResult), file = stream, end='') print(Fore.RED + "应用程序异常,返回值:{0}。".format(execResult), file = stream, end='')
...@@ -141,6 +149,7 @@ if __name__ == "__main__": ...@@ -141,6 +149,7 @@ if __name__ == "__main__":
if os.path.isfile(outputFile) and os.path.isfile(useroutputFile): if os.path.isfile(outputFile) and os.path.isfile(useroutputFile):
if compare_file(outputFile, useroutputFile, seqNum) == 0: if compare_file(outputFile, useroutputFile, seqNum) == 0:
print("正在使用浏览器打开文件比较结果,可帮助用户查找验证失败的原因。") print("正在使用浏览器打开文件比较结果,可帮助用户查找验证失败的原因。")
print(Fore.RED + "注意:如果读者是在jupyterlab中完成实验,请使用以下方式打开文件比较结果:\n选择View菜单中的Explorer菜单项,在打开的文件列表中,右击result_comparation.html文件,\n在弹出的菜单中选择“Open Preview”菜单项,可以打开文件比较结果,可帮助用户查找验证失败的原因。")
# 使用浏览器打开比较结果页面 # 使用浏览器打开比较结果页面
webbrowser.open('file://' + os.path.realpath(compResultFile)) webbrowser.open('file://' + os.path.realpath(compResultFile))
break break
......
# 求分段函数
\ No newline at end of file
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论