Commit 0587f1f5 authored by Noah Orensa's avatar Noah Orensa
Browse files

add getter for checking if the current worker is a driver

parent d290b8a4
......@@ -22,6 +22,8 @@ using Status = dtest::Test::Status;
#define dtest_worker_id() dtest::Context::instance()->workerId()
#define dtest_is_driver() dtest::Test::isDriver()
////
#include <dtest_core/unit_test.h>
......
......@@ -172,6 +172,10 @@ public:
);
static void runWorker(uint32_t id);
static bool isDriver() {
return _isDriver;
}
};
......
......@@ -104,6 +104,15 @@ dunit("unit-test", "worker-id")
assert(dtest_num_workers() == 4);
});
dunit("unit-test", "is-driver")
.workers(1)
.driver([] {
assert(dtest_is_driver());
})
.worker([] {
assert(! dtest_is_driver());
});
dunit("distributed-unit-test", "wait-notify")
.workers(4)
.driver([] {
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment