diff options
author | Anton Lindqvist <anton@cvs.openbsd.org> | 2024-09-03 04:58:31 +0000 |
---|---|---|
committer | Anton Lindqvist <anton@cvs.openbsd.org> | 2024-09-03 04:58:31 +0000 |
commit | c636aa2196ff2343544a0fb887c46284e6dc2d95 (patch) | |
tree | 7c00a18dd025af5298f064876b54dd7398caf23f /regress | |
parent | fe904bba9ebefa435d94832abacd9ad6a5690c3f (diff) |
Stop invoking diff(1) from C in access unveil regress, instead perform
the diffing from the make target.
Diffstat (limited to 'regress')
-rw-r--r-- | regress/sys/kern/unveil/Makefile | 4 | ||||
-rw-r--r-- | regress/sys/kern/unveil/access.c | 20 |
2 files changed, 5 insertions, 19 deletions
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 <bsd.regress.mk> 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 <err.h> #include <fcntl.h> -#include <limits.h> #include <stdio.h> -#include <stdlib.h> #include <string.h> #include <unistd.h> @@ -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; } |