From: anton Date: Tue, 3 Sep 2024 04:58:30 +0000 (+0000) Subject: Stop invoking diff(1) from C in access unveil regress, instead perform X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=3a6f888fbee976b484d2aafb77d7507e47f4e6e6;p=openbsd Stop invoking diff(1) from C in access unveil regress, instead perform the diffing from the make target. --- diff --git a/regress/sys/kern/unveil/Makefile b/regress/sys/kern/unveil/Makefile index 8637a054124..f04f5bc3188 100644 --- a/regress/sys/kern/unveil/Makefile +++ b/regress/sys/kern/unveil/Makefile @@ -1,4 +1,4 @@ -# $OpenBSD: Makefile,v 1.7 2024/09/01 05:48:20 anton Exp $ +# $OpenBSD: Makefile,v 1.8 2024/09/03 04:58:30 anton Exp $ WARNINGS= yes @@ -13,6 +13,6 @@ PROGS+= socket PROGS+=access run-regress-access: access - ./access ${.CURDIR}/access-expected + ./access 2>&1 | diff -u ${.CURDIR}/access-expected - .include diff --git a/regress/sys/kern/unveil/access.c b/regress/sys/kern/unveil/access.c index e2729a54e66..4dc10203d51 100644 --- a/regress/sys/kern/unveil/access.c +++ b/regress/sys/kern/unveil/access.c @@ -1,8 +1,6 @@ #include #include -#include #include -#include #include #include @@ -14,7 +12,6 @@ #define NUM_PERMS 16 static char uv_dir[] = "/tmp/uvdir.XXXXXX"; /* test directory */ -static char uv_file[] = "/tmp/uvfile.XXXXXX"; /* log file */ const char* perms[] = {"", "r", "w", "x", "c", "rw", "rx", "rc", "wx", "wc","xc", "rwx", "rwc", "rxc", "wxc", "rwxc"}; @@ -24,21 +21,11 @@ const char* filenames[] = {"f", "fr", "fw", "fx", "fc", "frw", "frx", "frc", const char* header = "unveil:access\n"; int -main(int argc, char *argv[]) +main(void) { + FILE *log = stdout; int i; - int log_fd; - FILE *log; - const char *expected; - if (argc != 2) { - fprintf(stderr, "usage: access expected-path\n"); - exit(1); - } - expected = argv[1]; - - 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"); UV_SHOULD_SUCCEED((unveil("/", "rwxc") == -1), "unveil"); UV_SHOULD_SUCCEED((chdir(uv_dir) == -1), "chdir"); @@ -63,7 +50,6 @@ main(int argc, char *argv[]) UV_SHOULD_SUCCEED((fwrite("F", 1, 1, log) != 1), "fwrite"); UV_SHOULD_SUCCEED((fwrite("\n", 1, 1, log) != 1), "fwrite"); } - UV_SHOULD_SUCCEED((fclose(log) == -1), "fclose"); - return execl("/usr/bin/diff", "diff", "-u", uv_file, expected, NULL); + return 0; }