Files
Renderive/Kernel/tests/renderive/scheduling/Scheduler_Test.cpp
T
2026-08-15 16:27:56 +08:00

29 lines
975 B
C++

#include <gtest/gtest.h>
#include <atomic>
#include <condition_variable>
#include <mutex>
#include "renderive/scheduling/Scheduler.hpp"
#include "renderive/scheduling/detail/OneTBB_Runtime.hpp"
TEST(scheduler_test, reports_oneTBB_runtime_activity) {
const auto before = renderive::scheduling::scheduler_statistics();
EXPECT_GT(before.concurrency, 0U);
std::mutex mutex;
std::condition_variable completed;
bool done{};
renderive::scheduling::detail::OneTBB_Runtime::instance().enqueue([&] {
{
std::lock_guard lock(mutex);
done = true;
}
completed.notify_one();
});
{
std::unique_lock lock(mutex);
completed.wait(lock, [&] { return done; });
}
const auto after = renderive::scheduling::scheduler_statistics();
EXPECT_EQ(after.concurrency, before.concurrency);
EXPECT_GE(after.worker_entry_count, before.worker_entry_count);
EXPECT_GE(after.peak_workers, 1U);
}