Skip to content

Commit

Permalink
rocfft-test: store string in exception types instead of stringstream
Browse files Browse the repository at this point in the history
  • Loading branch information
evetsso authored Jan 6, 2025
1 parent aa32f96 commit e66468a
Show file tree
Hide file tree
Showing 9 changed files with 86 additions and 86 deletions.
24 changes: 12 additions & 12 deletions clients/tests/bitwise_repro/bitwise_repro_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -63,15 +63,15 @@ TEST(bitwise_repro_test, compare_precisions)
}
catch(HOSTBUF_MEM_USAGE& e)
{
GTEST_SKIP() << e.msg.str();
GTEST_SKIP() << e.msg;
}
catch(ROCFFT_SKIP& e)
{
GTEST_SKIP() << e.msg.str();
GTEST_SKIP() << e.msg;
}
catch(ROCFFT_FAIL& e)
{
GTEST_FAIL() << e.msg.str();
GTEST_FAIL() << e.msg;
}
SUCCEED();
}
Expand Down Expand Up @@ -108,15 +108,15 @@ TEST(bitwise_repro_test, compare_lengths)
}
catch(HOSTBUF_MEM_USAGE& e)
{
GTEST_SKIP() << e.msg.str();
GTEST_SKIP() << e.msg;
}
catch(ROCFFT_SKIP& e)
{
GTEST_SKIP() << e.msg.str();
GTEST_SKIP() << e.msg;
}
catch(ROCFFT_FAIL& e)
{
GTEST_FAIL() << e.msg.str();
GTEST_FAIL() << e.msg;
}
SUCCEED();
}
Expand Down Expand Up @@ -153,15 +153,15 @@ TEST(bitwise_repro_test, compare_transform_types)
}
catch(HOSTBUF_MEM_USAGE& e)
{
GTEST_SKIP() << e.msg.str();
GTEST_SKIP() << e.msg;
}
catch(ROCFFT_SKIP& e)
{
GTEST_SKIP() << e.msg.str();
GTEST_SKIP() << e.msg;
}
catch(ROCFFT_FAIL& e)
{
GTEST_FAIL() << e.msg.str();
GTEST_FAIL() << e.msg;
}
SUCCEED();
}
Expand Down Expand Up @@ -201,15 +201,15 @@ TEST_P(bitwise_repro_test, compare_to_reference)
}
catch(HOSTBUF_MEM_USAGE& e)
{
GTEST_SKIP() << e.msg.str();
GTEST_SKIP() << e.msg;
}
catch(ROCFFT_SKIP& e)
{
GTEST_SKIP() << e.msg.str();
GTEST_SKIP() << e.msg;
}
catch(ROCFFT_FAIL& e)
{
GTEST_FAIL() << e.msg.str();
GTEST_FAIL() << e.msg;
}
SUCCEED();
}
Expand Down
30 changes: 15 additions & 15 deletions clients/tests/bitwise_repro/bitwise_repro_test.h
Original file line number Diff line number Diff line change
Expand Up @@ -80,9 +80,9 @@ inline void execute_fft(Tparams& params,
std::stringstream msg;
msg << "hipMemcpy failure";
if(skip_runtime_fails)
throw ROCFFT_SKIP{std::move(msg)};
throw ROCFFT_SKIP{msg.str()};
else
throw ROCFFT_FAIL{std::move(msg)};
throw ROCFFT_FAIL{msg.str()};
}
}
if(verbose > 2)
Expand Down Expand Up @@ -128,9 +128,9 @@ void compute_fft_data(Tparams& params,
std::stringstream msg;
msg << "Work buffer allocation failed with size: " << params.workbuffersize;
if(skip_runtime_fails)
throw ROCFFT_SKIP{std::move(msg)};
throw ROCFFT_SKIP{msg.str()};
else
throw ROCFFT_FAIL{std::move(msg)};
throw ROCFFT_FAIL{msg.str()};
}
ASSERT_EQ(plan_status, fft_status_success) << "plan creation failed";

Expand All @@ -147,9 +147,9 @@ void compute_fft_data(Tparams& params,
<< " with code " << hipError_to_string(hip_status);
++n_hip_failures;
if(skip_runtime_fails)
throw ROCFFT_SKIP{std::move(msg)};
throw ROCFFT_SKIP{msg.str()};
else
throw ROCFFT_FAIL{std::move(msg)};
throw ROCFFT_FAIL{msg.str()};
}
pibuffer[i] = ibuffer[i].data();
}
Expand Down Expand Up @@ -180,9 +180,9 @@ void compute_fft_data(Tparams& params,

++n_hip_failures;
if(skip_runtime_fails)
throw ROCFFT_SKIP{std::move(msg)};
throw ROCFFT_SKIP{msg.str()};
else
throw ROCFFT_FAIL{std::move(msg)};
throw ROCFFT_FAIL{msg.str()};
}
}
#else
Expand All @@ -204,11 +204,11 @@ void compute_fft_data(Tparams& params,
ss << "hipMemcpy failure with error " << hip_status;
if(skip_runtime_fails)
{
throw ROCFFT_SKIP{std::move(ss)};
throw ROCFFT_SKIP{ss.str()};
}
else
{
throw ROCFFT_FAIL{std::move(ss)};
throw ROCFFT_FAIL{ss.str()};
}
}
}
Expand Down Expand Up @@ -238,9 +238,9 @@ void compute_fft_data(Tparams& params,
<< "(" << bytes_to_GiB(obuffer_sizes[i]) << " GiB)"
<< " with code " << hipError_to_string(hip_status);
if(skip_runtime_fails)
throw ROCFFT_SKIP{std::move(msg)};
throw ROCFFT_SKIP{msg.str()};
else
throw ROCFFT_FAIL{std::move(msg)};
throw ROCFFT_FAIL{msg.str()};
}
}
}
Expand Down Expand Up @@ -285,7 +285,7 @@ inline void bitwise_repro_impl(Tparams& params, Tparams& params_comp)
{
std::stringstream msg;
msg << "FFT input tokens are identical";
throw ROCFFT_SKIP{std::move(msg)};
throw ROCFFT_SKIP{msg.str()};
}

std::vector<hostbuf> fft_input_comp, fft_output_comp;
Expand Down Expand Up @@ -355,7 +355,7 @@ inline void bitwise_repro_impl(Tparams& params)
std::stringstream msg;
msg << "FFT result entry added to the repro-db file. Previously stored reference entry not "
"found. \n";
throw ROCFFT_SKIP{std::move(msg)};
throw ROCFFT_SKIP{msg.str()};
}
}

Expand Down Expand Up @@ -391,4 +391,4 @@ inline void bitwise_repro(rocfft_params& params, rocfft_params& params_comp)
}
}

#endif // BITWISE_REPRO_TEST_H
#endif // BITWISE_REPRO_TEST_H
6 changes: 3 additions & 3 deletions clients/tests/buffer_hash_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -366,7 +366,7 @@ TEST(rocfft_UnitTest, buffer_hashing_half)
}
catch(HOSTBUF_MEM_USAGE& e)
{
GTEST_SKIP() << e.msg.str();
GTEST_SKIP() << e.msg;
}
}

Expand All @@ -381,7 +381,7 @@ TEST(rocfft_UnitTest, buffer_hashing_single)
}
catch(HOSTBUF_MEM_USAGE& e)
{
GTEST_SKIP() << e.msg.str();
GTEST_SKIP() << e.msg;
}
}

Expand All @@ -396,6 +396,6 @@ TEST(rocfft_UnitTest, buffer_hashing_double)
}
catch(HOSTBUF_MEM_USAGE& e)
{
GTEST_SKIP() << e.msg.str();
GTEST_SKIP() << e.msg;
}
}
2 changes: 1 addition & 1 deletion clients/tests/callback_change_type.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -224,6 +224,6 @@ TEST_P(change_type, short_to_float)
}
catch(HOSTBUF_MEM_USAGE& e)
{
GTEST_SKIP() << e.msg.str();
GTEST_SKIP() << e.msg;
}
}
10 changes: 5 additions & 5 deletions clients/tests/gtest_main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -803,15 +803,15 @@ TEST(manual, vs_fftw) // MANUAL TESTS HERE
{
// explicitly clear test cache
last_cpu_fft_data = last_cpu_fft_cache();
GTEST_SKIP() << e.msg.str();
GTEST_SKIP() << e.msg;
}
catch(ROCFFT_SKIP& e)
{
GTEST_SKIP() << e.msg.str();
GTEST_SKIP() << e.msg;
}
catch(ROCFFT_FAIL& e)
{
GTEST_FAIL() << e.msg.str();
GTEST_FAIL() << e.msg;
}
}

Expand Down Expand Up @@ -845,11 +845,11 @@ TEST(manual, bitwise_reproducibility) // MANUAL TESTS HERE
}
catch(ROCFFT_SKIP& e)
{
GTEST_SKIP() << e.msg.str();
GTEST_SKIP() << e.msg;
}
catch(ROCFFT_FAIL& e)
{
GTEST_FAIL() << e.msg.str();
GTEST_FAIL() << e.msg;
}
SUCCEED();
}
6 changes: 3 additions & 3 deletions clients/tests/rocfft_accuracy_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -94,15 +94,15 @@ TEST_P(accuracy_test, vs_fftw)
{
// explicitly clear cache
last_cpu_fft_data = last_cpu_fft_cache();
GTEST_SKIP() << e.msg.str();
GTEST_SKIP() << e.msg;
}
catch(ROCFFT_SKIP& e)
{
GTEST_SKIP() << e.msg.str();
GTEST_SKIP() << e.msg;
}
catch(ROCFFT_FAIL& e)
{
GTEST_FAIL() << e.msg.str();
GTEST_FAIL() << e.msg;
}
break;
}
Expand Down
Loading

0 comments on commit e66468a

Please sign in to comment.