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
88 lines
3.4 KiB
C++
88 lines
3.4 KiB
C++
// Copyright Advanced Micro Devices, Inc., or its affiliates.
|
|
// SPDX-License-Identifier: MIT
|
|
|
|
#include "TestContext.hpp"
|
|
|
|
#include <rocRoller/AssemblyKernel.hpp>
|
|
#include <rocRoller/Utilities/Utils.hpp>
|
|
|
|
#include <catch2/catch_test_macros.hpp>
|
|
#include <catch2/matchers/catch_matchers_string.hpp>
|
|
|
|
TEST_CASE("escapeSymbolName escapes bad characters", "[utils]")
|
|
{
|
|
CHECK(rocRoller::escapeSymbolName("goodKernelName") == "goodKernelName");
|
|
CHECK(rocRoller::escapeSymbolName("good__kernel__name") == "good__kernel__name");
|
|
|
|
CHECK(rocRoller::escapeSymbolName("my bad kernel name") == "my_bad_kernel_name");
|
|
|
|
CHECK(rocRoller::escapeSymbolName("My Bad Kernel Name") == "My_Bad_Kernel_Name");
|
|
|
|
CHECK(rocRoller::escapeSymbolName("my bad kernel name: and more 'bad', (characters)")
|
|
== "my_bad_kernel_name_and_more_bad_characters");
|
|
|
|
CHECK(rocRoller::escapeSymbolName("my bad kernel name: xnack+") == "my_bad_kernel_name_xnackp");
|
|
CHECK(rocRoller::escapeSymbolName("my bad kernel name: xnack-") == "my_bad_kernel_name_xnackm");
|
|
|
|
CHECK(rocRoller::escapeSymbolName("my _bad_ kernel name_") == "my__bad__kernel_name_");
|
|
|
|
CHECK(rocRoller::escapeSymbolName("") == "_");
|
|
}
|
|
|
|
TEST_CASE("TestContext::EscapeKernelName escapes bad characters", "[meta-test][infrastructure]")
|
|
{
|
|
CHECK(TestContext::EscapeKernelName("goodKernelName") == "goodKernelName");
|
|
CHECK(TestContext::EscapeKernelName("good__kernel__name") == "good__kernel__name");
|
|
|
|
CHECK(TestContext::EscapeKernelName("my bad kernel name") == "my_bad_kernel_name");
|
|
|
|
CHECK(TestContext::EscapeKernelName("My Bad Kernel Name") == "My_Bad_Kernel_Name");
|
|
|
|
CHECK(TestContext::EscapeKernelName("my bad kernel name: and more 'bad', (characters)")
|
|
== "my_bad_kernel_name_and_more_bad_characters");
|
|
|
|
CHECK(TestContext::EscapeKernelName("my bad kernel name: xnack+")
|
|
== "my_bad_kernel_name_xnackp");
|
|
CHECK(TestContext::EscapeKernelName("my bad kernel name: xnack-")
|
|
== "my_bad_kernel_name_xnackm");
|
|
|
|
CHECK(TestContext::EscapeKernelName("my _bad_ kernel name_") == "my__bad__kernel_name_");
|
|
|
|
CHECK(TestContext::EscapeKernelName("") == "_");
|
|
}
|
|
|
|
TEST_CASE("TestContext::KernelName includes test name", "[meta-test][infrastructure]")
|
|
{
|
|
rocRoller::GPUArchitectureTarget target
|
|
= {rocRoller::GPUArchitectureGFX::GFX90A, {.xnack = true}};
|
|
CHECK(TestContext::KernelName("my kernel", 5, target)
|
|
== "TestContext_KernelName_includes_test_name_my_kernel_5_gfx90a_xnackp");
|
|
}
|
|
|
|
TEST_CASE("TestContext::ForTestDevice gives a usable GPU.", "[meta-test][infrastructure][gpu]")
|
|
{
|
|
using namespace Catch::Matchers;
|
|
auto context = TestContext::ForTestDevice();
|
|
|
|
REQUIRE(context.get() != nullptr);
|
|
auto kernelName = context->kernel()->kernelName();
|
|
CHECK_THAT(kernelName, StartsWith("TestContext"));
|
|
CHECK_THAT(kernelName, ContainsSubstring("usable"));
|
|
|
|
CHECK(context->hipDeviceIndex() >= 0);
|
|
}
|
|
|
|
TEST_CASE("TestContext::ForTarget does not give a usable GPU.", "[meta-test][infrastructure]")
|
|
{
|
|
using namespace Catch::Matchers;
|
|
auto context = TestContext::ForTarget({rocRoller::GPUArchitectureGFX::GFX942});
|
|
|
|
REQUIRE(context.get() != nullptr);
|
|
auto kernelName = context->kernel()->kernelName();
|
|
CHECK_THAT(kernelName, StartsWith("TestContext"));
|
|
CHECK_THAT(kernelName, ContainsSubstring("does_not"));
|
|
CHECK_THAT(kernelName, ContainsSubstring("gfx942"));
|
|
|
|
CHECK(context->hipDeviceIndex() == -1);
|
|
}
|