Skip to content

Commit

Permalink
Print all CTS outputs (from gtest) in CI.
Browse files Browse the repository at this point in the history
  • Loading branch information
szadam committed Oct 2, 2023
1 parent e3a9e77 commit f3c2fcf
Show file tree
Hide file tree
Showing 3 changed files with 41 additions and 24 deletions.
23 changes: 2 additions & 21 deletions .github/workflows/cmake.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
34 changes: 34 additions & 0 deletions scripts/read_cts_output.py
Original file line number Diff line number Diff line change
@@ -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)
8 changes: 5 additions & 3 deletions test/conformance/cts_exe.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -22,18 +24,18 @@
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]
test_case = test_case.rstrip(',')
print(test_case)
output_file.write(line)

rc = result.communicate()
rc = result.wait()
output_file.close()

if rc < 0:
Expand Down

0 comments on commit f3c2fcf

Please sign in to comment.