我有以下Makefile脚本调用python测试套件,该套件将结果写入名为$('.container a').mouseover(function() {
$('.container hr').css({
left: $(this).offset().left,
width: $(this).width()
});
});
的文件。然后我显示文件并读取最后一行,该行的状态指示是否所有测试用例都已执行。基于该值,我回应了一个声明。
test_results.txt
当我运行它时,我收到以下错误:target: test.py
$(PYTHON) test.py
@cat test/test_results.txt
@if [ $(shell sed -e '$$!d' test/test_results.txt) = 0 ]; then\
echo "\nAll tests passed successfully";\
else \
echo "\nNot all the tests were passed";\
fi
答案 0 :(得分:2)
如果任何测试失败,使test.py
具有非零退出状态会简单得多。然后你的食谱就是
target: test.py
@if $(PYTHON) test.py; then\
echo "\nAll tests passed successfully";\
else \
echo "\nNot all the tests were passed";\
fi
@cat test/test_results.txt