Skip to content

Commit 0f9de6a

Browse files
authored
Move CUDAGuard/CUDAStreamGuard static_assert tests out of CUDA fixtures (#19314)
Summary: The 6 type-trait checks below were defined as TEST_F(CUDAGuardTest, ...) and TEST_F(CUDAStreamGuardTest, ...). Both fixtures' SetUp() calls GTEST_SKIP() when no CUDA device is available, so on every test host without an attached GPU these tests skip instead of running: CUDAGuardTest.CopyConstructorDeleted CUDAGuardTest.CopyAssignmentDeleted CUDAGuardTest.MoveAssignmentDeleted CUDAStreamGuardTest.CopyConstructorDeleted CUDAStreamGuardTest.CopyAssignmentDeleted CUDAStreamGuardTest.MoveAssignmentDeleted Because they never produced a successful run (Passes: 0 across 173 / 23 runs, all skips), TestX auto-disabled them and they show up as DISABLED on the executorch dashboard. These are pure compile-time static_assert checks. They do not need a CUDA device or any runtime state — if the file compiles, they pass. Move them into a separate non-fixture test suite (CUDAGuardCompileTimeTest / CUDAStreamGuardCompileTimeTest) so they run unconditionally. The remaining 15 fixture-based tests still need a real CUDA device and will be addressed separately (fixing the gpu-remote-execution platform deps so cudaGetDeviceCount returns a non-zero value). Reviewed By: Gasoonjia Differential Revision: D103937761
1 parent 5dcf0ed commit 0f9de6a

2 files changed

Lines changed: 12 additions & 6 deletions

File tree

backends/aoti/slim/cuda/test/test_cuda_guard.cpp

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -94,19 +94,22 @@ TEST_F(CUDAGuardTest, NegativeDeviceIndex) {
9494
EXPECT_FALSE(guard_result.ok());
9595
}
9696

97-
TEST_F(CUDAGuardTest, CopyConstructorDeleted) {
97+
// Compile-time type-trait checks. These do not need a CUDA device, so they
98+
// live outside the CUDAGuardTest fixture (whose SetUp() calls GTEST_SKIP
99+
// when no CUDA device is available).
100+
TEST(CUDAGuardCompileTimeTest, CopyConstructorDeleted) {
98101
static_assert(
99102
!std::is_copy_constructible_v<CUDAGuard>,
100103
"CUDAGuard should not be copy constructible");
101104
}
102105

103-
TEST_F(CUDAGuardTest, CopyAssignmentDeleted) {
106+
TEST(CUDAGuardCompileTimeTest, CopyAssignmentDeleted) {
104107
static_assert(
105108
!std::is_copy_assignable_v<CUDAGuard>,
106109
"CUDAGuard should not be copy assignable");
107110
}
108111

109-
TEST_F(CUDAGuardTest, MoveAssignmentDeleted) {
112+
TEST(CUDAGuardCompileTimeTest, MoveAssignmentDeleted) {
110113
static_assert(
111114
!std::is_move_assignable_v<CUDAGuard>,
112115
"CUDAGuard should not be move assignable");

backends/aoti/slim/cuda/test/test_cuda_stream_guard.cpp

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -234,19 +234,22 @@ TEST_F(CUDAStreamGuardTest, NegativeDeviceIndex) {
234234
EXPECT_FALSE(guard_result.ok());
235235
}
236236

237-
TEST_F(CUDAStreamGuardTest, CopyConstructorDeleted) {
237+
// Compile-time type-trait checks. These do not need a CUDA device, so they
238+
// live outside the CUDAStreamGuardTest fixture (whose SetUp() calls
239+
// GTEST_SKIP when no CUDA device is available).
240+
TEST(CUDAStreamGuardCompileTimeTest, CopyConstructorDeleted) {
238241
static_assert(
239242
!std::is_copy_constructible_v<CUDAStreamGuard>,
240243
"CUDAStreamGuard should not be copy constructible");
241244
}
242245

243-
TEST_F(CUDAStreamGuardTest, CopyAssignmentDeleted) {
246+
TEST(CUDAStreamGuardCompileTimeTest, CopyAssignmentDeleted) {
244247
static_assert(
245248
!std::is_copy_assignable_v<CUDAStreamGuard>,
246249
"CUDAStreamGuard should not be copy assignable");
247250
}
248251

249-
TEST_F(CUDAStreamGuardTest, MoveAssignmentDeleted) {
252+
TEST(CUDAStreamGuardCompileTimeTest, MoveAssignmentDeleted) {
250253
static_assert(
251254
!std::is_move_assignable_v<CUDAStreamGuard>,
252255
"CUDAStreamGuard should not be move assignable");

0 commit comments

Comments
 (0)