Skip to content

Fix test for unset PPC_NUM_THREADS environment variable #461

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Jun 23, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 3 additions & 7 deletions modules/core/util/tests/util.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

#include <gtest/gtest.h>

#include <libenvpp/detail/get.hpp>
#include <string_view>

#include "omp.h"
Expand All @@ -16,14 +17,9 @@ TEST(util_tests, extracts_correct_namespace) {
}

TEST(util_tests, threads_control_check_openmp_disabled_valgrind) {
int ppc_num_threads = ppc::util::GetNumThreads();
const auto num_threads_env_var = env::get<int>("PPC_NUM_THREADS");

int omp_num_threads = -1;
#pragma omp parallel default(none) shared(omp_num_threads) num_threads(ppc::util::GetNumThreads())
omp_num_threads = omp_get_num_threads();

// Check Result
ASSERT_EQ(ppc_num_threads, omp_num_threads);
EXPECT_EQ(ppc::util::GetNumThreads(), omp_get_max_threads());
}

namespace test_ns {
Expand Down
Loading