diff --git a/.circleci/create_circleci_config.py b/.circleci/create_circleci_config.py index bea8eccf2b7e..ef8e09741f12 100644 --- a/.circleci/create_circleci_config.py +++ b/.circleci/create_circleci_config.py @@ -226,15 +226,26 @@ def to_dict(self): test_command += " || true" steps.append({"run": {"name": "Run tests", "command": test_command}}) - check_test_command = f'if [ -s reports/{self.job_name}/failures_short.txt ]; ' - check_test_command += 'then echo "Some test failed!"; echo ""; ' - check_test_command += f'cat reports/{self.job_name}/failures_short.txt; ' + # Deal with errors + check_test_command = f'if [ -s reports/{self.job_name}/errors.txt ]; ' + check_test_command += 'then echo "Some tests errored out!"; echo ""; ' + check_test_command += f'cat reports/{self.job_name}/errors.txt; ' check_test_command += 'echo ""; echo ""; ' - py_command = f'import os; fp = open("reports/{self.job_name}/summary_short.txt"); failed = os.linesep.join([x for x in fp.read().split(os.linesep) if x.startswith(("FAILED ", "ERROR "))]); fp.close(); fp = open("summary_short.txt", "w"); fp.write(failed); fp.close()' + py_command = f'import os; fp = open("reports/{self.job_name}/summary_short.txt"); failed = os.linesep.join([x for x in fp.read().split(os.linesep) if x.startswith("ERROR ")]); fp.close(); fp = open("summary_short.txt", "w"); fp.write(failed); fp.close()' check_test_command += f"$(python3 -c '{py_command}'); " + check_test_command += f'cat summary_short.txt; echo ""; exit -1; ' + # Deeal with failed tests + check_test_command += f'elif [ -s reports/{self.job_name}/failures_short.txt ]; ' + check_test_command += 'then echo "Some tests failed!"; echo ""; ' + check_test_command += f'cat reports/{self.job_name}/failures_short.txt; ' + check_test_command += 'echo ""; echo ""; ' + + py_command = f'import os; fp = open("reports/{self.job_name}/summary_short.txt"); failed = os.linesep.join([x for x in fp.read().split(os.linesep) if x.startswith("FAILED ")]); fp.close(); fp = open("summary_short.txt", "w"); fp.write(failed); fp.close()' + check_test_command += f"$(python3 -c '{py_command}'); " check_test_command += f'cat summary_short.txt; echo ""; exit -1; ' + check_test_command += f'elif [ -s reports/{self.job_name}/stats.txt ]; then echo "All tests pass!"; ' # return code `124` means the previous (pytest run) step is timeout