test: skip test-reread-partition-table if missing privileges
Right now, this test runs inside unprivileged chroots, despite the running_in_chroot() check. This is because running_in_chroot() fails with -EACCES, which is ignored. Hence, check for privileges before calling running_in_chroot(), otherwise call is inconclusive. Note, the test will fail later on if running without privileges anyways.
This commit is contained in:
committed by
Luca Boccassi
parent
12d2abe082
commit
7d23e27e4c
@@ -4,6 +4,7 @@
|
||||
#include <sys/file.h>
|
||||
|
||||
#include "blockdev-util.h"
|
||||
#include "capability-util.h"
|
||||
#include "fd-util.h"
|
||||
#include "loop-util.h"
|
||||
#include "memfd-util.h"
|
||||
@@ -45,6 +46,8 @@ TEST(rereadpt) {
|
||||
|
||||
if (detect_container() > 0)
|
||||
return (void) log_tests_skipped("test not available in container");
|
||||
if (geteuid() != 0 || have_effective_cap(CAP_SYS_ADMIN) <= 0)
|
||||
return (void) log_tests_skipped("test requires privileges");
|
||||
if (running_in_chroot() > 0)
|
||||
return (void) log_tests_skipped("test not available in chroot()");
|
||||
|
||||
|
||||
Reference in New Issue
Block a user