Make unveil access regress work with objdir.
authoranton <anton@openbsd.org>
Sun, 1 Sep 2024 05:48:20 +0000 (05:48 +0000)
committeranton <anton@openbsd.org>
Sun, 1 Sep 2024 05:48:20 +0000 (05:48 +0000)
regress/sys/kern/unveil/Makefile
regress/sys/kern/unveil/access.c

index 7eee884..8637a05 100644 (file)
@@ -1,4 +1,4 @@
-#      $OpenBSD: Makefile,v 1.6 2024/08/31 20:03:03 jeremy Exp $
+#      $OpenBSD: Makefile,v 1.7 2024/09/01 05:48:20 anton Exp $
 
 WARNINGS=      yes
 
@@ -10,6 +10,9 @@ run-regress-syscalls:
        ${SUDO} ./syscalls
 
 PROGS+=                                socket
-PROGS+=                                access
+
+PROGS+=access
+run-regress-access: access
+       ./access ${.CURDIR}/access-expected
 
 .include <bsd.regress.mk>
index 24dbfaa..e2729a5 100644 (file)
@@ -23,14 +23,20 @@ const char* filenames[] = {"f", "fr", "fw", "fx", "fc", "frw", "frx", "frc",
                           "frwc", "frxc", "fwxc", "frwxc"};
 const char* header = "unveil:access\n";
 
-int main(int argc, char** argv) {
+int
+main(int argc, char *argv[])
+{
        int i;
        int log_fd;
        FILE *log;
-       char expected[PATH_MAX];
-       char *exp;
+       const char *expected;
+
+       if (argc != 2) {
+               fprintf(stderr, "usage: access expected-path\n");
+               exit(1);
+       }
+       expected = argv[1];
 
-       UV_SHOULD_SUCCEED(((exp = realpath("access-expected", expected)) == NULL), "realpath");
        UV_SHOULD_SUCCEED(((log_fd = mkstemp(uv_file)) == -1), "mkstemp");
        UV_SHOULD_SUCCEED(((log = fdopen(log_fd, "w")) == NULL), "fdopen");
        UV_SHOULD_SUCCEED((mkdtemp(uv_dir) == NULL), "mkdtmp");