blob: ed9b00c1a3945c3518b0c1f29709d27b0464ac5c (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
|
#[test]
fn test_membarrier() {
use rustix::process::{membarrier, membarrier_query, MembarrierCommand, MembarrierQuery};
let query: MembarrierQuery = membarrier_query();
// Supported registration commands should succeed.
for cmd in [
MembarrierCommand::RegisterGlobalExpedited,
MembarrierCommand::RegisterPrivateExpedited,
MembarrierCommand::RegisterPrivateExpeditedSyncCore,
MembarrierCommand::RegisterPrivateExpeditedRseq,
]
.iter()
.copied()
{
if query.contains_command(cmd) {
membarrier(cmd).unwrap();
}
}
// All supported commands should now succeed, and all unsupported
// commands should fail.
for cmd in [
MembarrierCommand::Global,
MembarrierCommand::GlobalExpedited,
MembarrierCommand::PrivateExpedited,
MembarrierCommand::PrivateExpeditedSyncCore,
MembarrierCommand::PrivateExpeditedRseq,
]
.iter()
.copied()
{
if query.contains_command(cmd) {
membarrier(cmd).unwrap();
} else {
membarrier(cmd).unwrap_err();
}
}
}
|