From f6b49e9585406d7ee66bd98919abf4af9bcc269d Mon Sep 17 00:00:00 2001 From: ydshieh Date: Mon, 18 Sep 2023 11:19:26 +0200 Subject: [PATCH 1/4] fix --- .circleci/create_circleci_config.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.circleci/create_circleci_config.py b/.circleci/create_circleci_config.py index bea8eccf2b7..2c7b59774eb 100644 --- a/.circleci/create_circleci_config.py +++ b/.circleci/create_circleci_config.py @@ -226,7 +226,7 @@ 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 = f'if [ -s reports/{self.job_name}/failures_short.txt ] || [ -s reports/{self.job_name}/errors.txt ]; ' check_test_command += 'then echo "Some test failed!"; echo ""; ' check_test_command += f'cat reports/{self.job_name}/failures_short.txt; ' check_test_command += 'echo ""; echo ""; ' From 80c336a71bb59eeb64067568aa60d990637afbc8 Mon Sep 17 00:00:00 2001 From: ydshieh Date: Mon, 18 Sep 2023 11:32:52 +0200 Subject: [PATCH 2/4] fix --- .circleci/create_circleci_config.py | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/.circleci/create_circleci_config.py b/.circleci/create_circleci_config.py index 2c7b59774eb..a131211e8f1 100644 --- a/.circleci/create_circleci_config.py +++ b/.circleci/create_circleci_config.py @@ -226,12 +226,20 @@ 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 ] || [ -s reports/{self.job_name}/errors.txt ]; ' - check_test_command += 'then echo "Some test failed!"; echo ""; ' + 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("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'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 ", "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("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; ' From 8a9827cf5b636eec3d67f381ca3c34be72443c4e Mon Sep 17 00:00:00 2001 From: ydshieh Date: Mon, 18 Sep 2023 13:36:53 +0200 Subject: [PATCH 3/4] fix --- .circleci/create_circleci_config.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.circleci/create_circleci_config.py b/.circleci/create_circleci_config.py index a131211e8f1..ac3733f3c01 100644 --- a/.circleci/create_circleci_config.py +++ b/.circleci/create_circleci_config.py @@ -226,6 +226,7 @@ def to_dict(self): test_command += " || true" steps.append({"run": {"name": "Run tests", "command": test_command}}) + # 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; ' @@ -234,7 +235,8 @@ def to_dict(self): 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'elif [ -s reports/{self.job_name}/failures_short.txt ]; ' + # 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 ""; ' From 0eae55937fe9248082c69ff5bd04733848531b29 Mon Sep 17 00:00:00 2001 From: ydshieh Date: Mon, 18 Sep 2023 13:56:57 +0200 Subject: [PATCH 4/4] fix --- .circleci/create_circleci_config.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.circleci/create_circleci_config.py b/.circleci/create_circleci_config.py index ac3733f3c01..ef8e09741f1 100644 --- a/.circleci/create_circleci_config.py +++ b/.circleci/create_circleci_config.py @@ -234,6 +234,7 @@ def to_dict(self): 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 ]; ' @@ -243,8 +244,8 @@ def to_dict(self): 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