Commit d290b8a4 authored by Noah Orensa's avatar Noah Orensa
Browse files

add getter for number of workers of current test

parent e6f2a84c
......@@ -18,6 +18,8 @@ using Status = dtest::Test::Status;
#define module(name) static auto __dtest_concat(__module_controller__uid_, __COUNTER__) = (*(new dtest::ModuleController(name)))
#define dtest_num_workers() dtest::Context::instance()->numWorkers()
#define dtest_worker_id() dtest::Context::instance()->workerId()
////
......
......@@ -228,6 +228,10 @@ public:
}
virtual uint32_t workerId() const = 0;
uint16_t numWorkers() const {
return _currentTest->_numWorkers;
}
};
class DriverContext : public Context {
......
......@@ -95,11 +95,13 @@ dunit("unit-test", "worker-id")
}
assert(dtest_worker_id() == 0);
assert(dtest_num_workers() == 4);
})
.worker([] {
uint32_t id = dtest_worker_id();
dtest_send_msg(id);
assert(id <= 4);
assert(dtest_num_workers() == 4);
});
dunit("distributed-unit-test", "wait-notify")
......
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