mirror of
https://github.com/systemd/systemd-stable.git
synced 2024-12-23 17:34:00 +03:00
test-barrier: skip the test in virtualized/containerized environments
This commit is contained in:
parent
1dea095cdb
commit
a1e3f0f38b
@ -17,6 +17,7 @@
|
||||
#include "barrier.h"
|
||||
#include "util.h"
|
||||
#include "tests.h"
|
||||
#include "virt.h"
|
||||
|
||||
/* 20ms to test deadlocks; All timings use multiples of this constant as
|
||||
* alarm/sleep timers. If this timeout is too small for slow machines to perform
|
||||
@ -420,11 +421,27 @@ TEST_BARRIER(test_barrier_pending_exit,
|
||||
TEST_BARRIER_WAIT_SUCCESS(pid2));
|
||||
|
||||
int main(int argc, char *argv[]) {
|
||||
int v;
|
||||
test_setup_logging(LOG_INFO);
|
||||
|
||||
if (!slow_tests_enabled())
|
||||
return log_tests_skipped("slow tests are disabled");
|
||||
|
||||
/*
|
||||
* This test uses real-time alarms and sleeps to test for CPU races
|
||||
* explicitly. This is highly fragile if your system is under load. We
|
||||
* already increased the BASE_TIME value to make the tests more robust,
|
||||
* but that just makes the test take significantly longer. Given the recent
|
||||
* issues when running the test in a virtualized environments, limit it
|
||||
* to bare metal machines only, to minimize false-positives in CIs.
|
||||
*/
|
||||
v = detect_virtualization();
|
||||
if (IN_SET(v, -EPERM, -EACCES))
|
||||
return log_tests_skipped("Cannot detect virtualization");
|
||||
|
||||
if (v != VIRTUALIZATION_NONE)
|
||||
return log_tests_skipped("This test requires a baremetal machine");
|
||||
|
||||
test_barrier_sync();
|
||||
test_barrier_wait_next();
|
||||
test_barrier_wait_next_twice();
|
||||
|
Loading…
Reference in New Issue
Block a user