Skip to content

Commit 691279b

Browse files
committed
update util tests: handle optional thread environment variable in OpenMP validation test
1 parent 3882703 commit 691279b

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

modules/util/tests/util.cpp

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,12 @@ TEST(util_tests, extracts_correct_namespace) {
1919
TEST(util_tests, threads_control_check_openmp_disabled_valgrind) {
2020
const auto num_threads_env_var = env::get<int>("PPC_NUM_THREADS");
2121

22-
EXPECT_EQ(ppc::util::GetNumThreads(), omp_get_max_threads());
22+
if (num_threads_env_var.has_value()) {
23+
omp_set_num_threads(num_threads_env_var.value());
24+
EXPECT_EQ(ppc::util::GetNumThreads(), omp_get_max_threads());
25+
} else {
26+
EXPECT_EQ(ppc::util::GetNumThreads(), 1);
27+
}
2328
}
2429

2530
namespace test_ns {

0 commit comments

Comments
 (0)