diff --git a/.github/workflows/cmake.yml b/.github/workflows/cmake.yml index aeda44227a..b09b7915a4 100644 --- a/.github/workflows/cmake.yml +++ b/.github/workflows/cmake.yml @@ -283,30 +283,11 @@ jobs: tar -xvf ${{github.workspace}}/dpcpp_compiler.tar.gz -C dpcpp_compiler - name: Execute CTS - run: > - srun -p pvc-shared scripts/devcloud-test.sh ${{github.workspace}} ${{matrix.compiler.c}} ${{matrix.compiler.cxx}} ${{matrix.build_type}} + run: srun -p pvc-shared scripts/devcloud-test.sh ${{github.workspace}} ${{matrix.compiler.c}} ${{matrix.compiler.cxx}} ${{matrix.build_type}} - name: CTS output if: always() - run: | - echo "#### sampler ####" - cat ${{github.workspace}}/build/test/conformance/sampler/output.txt - echo "#### memory ####" - cat ${{github.workspace}}/build/test/conformance/memory/output.txt - echo "#### virtual_memory ####" - cat ${{github.workspace}}/build/test/conformance/virtual_memory/output.txt - echo "#### device ####" - cat ${{github.workspace}}/build/test/conformance/device/output.txt - echo "#### runtime ####" - cat ${{github.workspace}}/build/test/conformance/runtime/output.txt - echo "#### queue ####" - cat ${{github.workspace}}/build/test/conformance/queue/output.txt - echo "#### context ####" - cat ${{github.workspace}}/build/test/conformance/context/output.txt - echo "#### event ####" - cat ${{github.workspace}}/build/test/conformance/event/output.txt - echo "#### usm ####" - cat ${{github.workspace}}/build/test/conformance/usm/output.txt + run: python3 ${{github.workspace}}/scripts/read_cts_output.py ${{github.workspace}}/build windows-build: name: Build - Windows diff --git a/scripts/read_cts_output.py b/scripts/read_cts_output.py new file mode 100644 index 0000000000..aeb99e8ca8 --- /dev/null +++ b/scripts/read_cts_output.py @@ -0,0 +1,34 @@ +""" + Copyright (C) 2023 Intel Corporation + + Part of the Unified-Runtime Project, under the Apache License v2.0 with LLVM Exceptions. + See LICENSE.TXT + SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception + +""" +# Print conformance test output from gtest, which is captured by the cts_exe.py script. + +import os +import sys + +def print_file_content(folder_path, conformance_folder): + file_path = os.path.join(folder_path, "output.txt") + print(f"#### {conformance_folder} ####") + + if os.path.isfile(file_path): + with open(file_path, "r") as file: + print(file.read()) + else: + print(f"Warning: File {file_path} does not exist.") + +if __name__ == '__main__': + build_dir = sys.argv[1] + conformance_path = os.path.join(build_dir, "test/conformance/") + + # Folder expected not to have CTS output. We expect output for all CTS binaries. + exclude_folders = ["CmakeFiles", "testing"] + + for conformance_folder in os.listdir(conformance_path): + if conformance_folder not in exclude_folders: + folder_path = os.path.join(conformance_path, conformance_folder) + print_file_content(folder_path, conformance_folder) diff --git a/test/conformance/cts_exe.py b/test/conformance/cts_exe.py index e924a35a1b..433a58d3c5 100644 --- a/test/conformance/cts_exe.py +++ b/test/conformance/cts_exe.py @@ -7,6 +7,8 @@ SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception """ +# Writing conformance test output from gtest to a file and checking failed tests with match files. +# The match files contain tests that are expected to fail. import sys from argparse import ArgumentParser @@ -22,10 +24,10 @@ args = parser.parse_args() output_file = open("output.txt", "w") - result = subprocess.Popen([args.test_command, '--gtest_brief=1'], stdout=subprocess.PIPE, stderr=subprocess.STDOUT, text=True) # nosec B603 + result = subprocess.Popen([args.test_command, '--gtest_brief=1'], stdout=subprocess.PIPE, + stderr=subprocess.STDOUT, text=True) # nosec B603 pat = re.compile(r'\[( )*FAILED( )*\]') - for line in result.stdout: if pat.search(line): test_case = line.split(" ")[5] @@ -33,7 +35,7 @@ print(test_case) output_file.write(line) - rc = result.communicate() + rc = result.wait() output_file.close() if rc < 0: