summaryrefslogtreecommitdiffstats
path: root/src/test/test-acl-util.c
diff options
context:
space:
mode:
authorDaan De Meyer <daan.j.demeyer@gmail.com>2024-04-08 19:56:36 +0200
committerDaan De Meyer <daan.j.demeyer@gmail.com>2024-04-09 09:40:03 +0200
commitae4088b23e1658a6f6e940d6e1c8d0a14f93449b (patch)
tree9994f30ff5e1e51f6bdc75afb6d0757d8e82dd02 /src/test/test-acl-util.c
parentresolve: really always initialize aux (diff)
downloadsystemd-ae4088b23e1658a6f6e940d6e1c8d0a14f93449b.tar.xz
systemd-ae4088b23e1658a6f6e940d6e1c8d0a14f93449b.zip
test: Various build environment fixes
All bets are off in build chroots, so let's handle more cases of files or executables that might not be available in build chroots. Specifically, these are all fixes to allow the unit tests to run in the opensuse build chroot.
Diffstat (limited to 'src/test/test-acl-util.c')
-rw-r--r--src/test/test-acl-util.c18
1 files changed, 17 insertions, 1 deletions
diff --git a/src/test/test-acl-util.c b/src/test/test-acl-util.c
index 331faf1e4b..3cb106a93f 100644
--- a/src/test/test-acl-util.c
+++ b/src/test/test-acl-util.c
@@ -10,6 +10,7 @@
#include "fd-util.h"
#include "format-util.h"
#include "fs-util.h"
+#include "path-util.h"
#include "string-util.h"
#include "tests.h"
#include "tmpfile-util.h"
@@ -22,6 +23,12 @@ TEST_RET(add_acls_for_user) {
uid_t uid;
int r;
+ FOREACH_STRING(s, "capsh", "getfacl", "ls") {
+ r = find_executable(s, NULL);
+ if (r < 0)
+ return log_tests_skipped_errno(r, "Could not find %s binary: %m", s);
+ }
+
fd = mkostemp_safe(fn);
assert_se(fd >= 0);
@@ -69,11 +76,18 @@ TEST_RET(add_acls_for_user) {
return 0;
}
-TEST(fd_acl_make_read_only) {
+TEST_RET(fd_acl_make_read_only) {
_cleanup_(unlink_tempfilep) char fn[] = "/tmp/test-empty.XXXXXX";
_cleanup_close_ int fd = -EBADF;
const char *cmd;
struct stat st;
+ int r;
+
+ FOREACH_STRING(s, "capsh", "getfacl", "ls", "stat") {
+ r = find_executable(s, NULL);
+ if (r < 0)
+ return log_tests_skipped_errno(r, "Could not find %s binary: %m", s);
+ }
fd = mkostemp_safe(fn);
assert_se(fd >= 0);
@@ -125,6 +139,8 @@ TEST(fd_acl_make_read_only) {
cmd = strjoina("stat ", fn);
assert_se(system(cmd) == 0);
+
+ return 0;
}
DEFINE_TEST_MAIN(LOG_INFO);