CodeQL / Analyze (actions) (push) Canceled after 0s
CodeQL / Analyze (python) (push) Canceled after 0s
pre-commit / pre-commit (push) Canceled after 0s
Multi-Arch CI / setup (push) Canceled after 0s
Publish build_manylinux_x86_64 images / publish_build_manylinux_x86_64 (push) Canceled after 0s
Setup (Multi-Arch) / setup (push) Canceled after 0s
Multi-Arch CI / Linux::${{ fromJSON(needs.setup.outputs.linux_build_config || '{}').build_variant_label || 'skip' }} (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish no_rocm_image_ubi10 image / publish_no_rocm_image_ubi10 (push) Canceled after 0s
Multi-Arch CI / Windows::${{ fromJSON(needs.setup.outputs.windows_build_config || '{}').build_variant_label || 'skip' }} (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Multi-Arch CI / Manifest Diff (push) Canceled after 0s
TheRock Manifest Diff Report / Generate Manifest Diff Report (push) Canceled after 0s
Multi-Arch CI / CI Summary (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04 (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04_ocl_rt images / publish_no_rocm_image_ubuntu24_04_ocl_rt (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_rocgdb (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04_rocgdb images / publish_no_rocm_image_ubuntu24_04_rocgdb (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_ocl_rt (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Unit Tests / Unit Tests :: ubuntu-24.04 (push) Canceled after 0s
Unit Tests / Unit Tests :: windows-2022 (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_media (push) Canceled after 0s
Unit Tests / Unit Tests Summary (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_openmpi (push) Canceled after 0s
96 lines
2.8 KiB
Python
96 lines
2.8 KiB
Python
# Copyright (c) Advanced Micro Devices, Inc., or its affiliates.
|
|
#
|
|
# SPDX-License-Identifier: MIT
|
|
|
|
import subprocess
|
|
import sys
|
|
import unittest
|
|
import os
|
|
|
|
class CompileAndCapture(unittest.TestCase):
|
|
path = None
|
|
expected_error_count = 0
|
|
expected_warning_count = 0
|
|
hip_path = None
|
|
file = None
|
|
error_string = None
|
|
warning_string = None
|
|
platform = None
|
|
|
|
def setUp(self):
|
|
self.error_string = 'error:'
|
|
self.warning_string = 'warning:'
|
|
self.assertFalse(self.hip_path == None)
|
|
self.assertFalse(self.path == None)
|
|
self.assertFalse(self.file == None)
|
|
self.assertTrue(self.platform == 'amd' or self.platform == 'nvidia')
|
|
|
|
def test(self):
|
|
if os.name == 'nt':
|
|
hipcc = self.hip_path + '/bin/hipcc.bat'
|
|
else:
|
|
hipcc = self.hip_path + '/bin/hipcc'
|
|
|
|
compiler_args = [
|
|
hipcc,
|
|
'-I' + self.path + '/../../../include',
|
|
'-c',
|
|
self.path + '/' + self.file,
|
|
]
|
|
# HIP compiler on AMD platforms has limit of 20 errors, and some negative
|
|
# test cases expect that more errors are detected.
|
|
if (self.platform == 'amd'):
|
|
compiler_args.append('-ferror-limit=200')
|
|
compiler_output = subprocess.run(compiler_args, stderr=subprocess.PIPE)
|
|
# Get the compiler output in the stdout if -V flag is raised during ctest invocation.
|
|
compiler_stderr = compiler_output.stderr.decode('UTF-8')
|
|
print(compiler_stderr)
|
|
|
|
error_count = compiler_stderr.count(self.error_string)
|
|
if self.expected_error_count < 0:
|
|
self.assertGreater(error_count, 0)
|
|
else:
|
|
self.assertEqual(error_count, self.expected_error_count)
|
|
|
|
warning_count = compiler_stderr.count(self.warning_string)
|
|
if self.expected_warning_count < 0:
|
|
self.assertGreater(warning_count, 0)
|
|
else:
|
|
self.assertEqual(warning_count, self.expected_warning_count)
|
|
|
|
if __name__ == '__main__':
|
|
try:
|
|
CompileAndCapture.path = sys.argv[1]
|
|
except IndexError:
|
|
CompileAndCapture.path = None
|
|
|
|
try:
|
|
CompileAndCapture.platform = sys.argv[2]
|
|
except IndexError:
|
|
CompileAndCapture.platform = None
|
|
|
|
try:
|
|
CompileAndCapture.hip_path = sys.argv[3]
|
|
except IndexError:
|
|
CompileAndCapture.hip_path = None
|
|
|
|
try:
|
|
CompileAndCapture.file = sys.argv[4]
|
|
except IndexError:
|
|
CompileAndCapture.file = None
|
|
|
|
try:
|
|
CompileAndCapture.expected_error_count = int(sys.argv[5])
|
|
except IndexError:
|
|
CompileAndCapture.expected_error_count = 0
|
|
|
|
try:
|
|
CompileAndCapture.expected_warning_count = int(sys.argv[6])
|
|
except IndexError:
|
|
CompileAndCapture.expected_warning_count = 0
|
|
|
|
# Unittest looks at the same argv's as the __main__ and doesn't know how
|
|
# to handle arguments other than the executable (0). Therefore passing only
|
|
# executable as the argv for unittest module.
|
|
unittest.main(argv=[sys.argv[0]])
|