git: e0fd837a30bd - main - stress2: open(2) tests with BENEATH flags.

Peter Holm pho at FreeBSD.org
Mon Mar 8 08:20:02 UTC 2021


The branch main has been updated by pho:

URL: https://cgit.FreeBSD.org/src/commit/?id=e0fd837a30bd9e6b0046db9d459fce8b2fc89cce

commit e0fd837a30bd9e6b0046db9d459fce8b2fc89cce
Author:     Peter Holm <pho at FreeBSD.org>
AuthorDate: 2021-03-08 08:08:58 +0000
Commit:     Peter Holm <pho at FreeBSD.org>
CommitDate: 2021-03-08 08:19:37 +0000

    stress2: open(2) tests with BENEATH flags.
    
    Update tests to reflect the changes of "open(2): Remove O_BENEATH and
    AT_BENEATH" in 20e91ca36a56.
---
 tools/test/stress2/misc/beneath.sh  | 11 +++--------
 tools/test/stress2/misc/beneath2.sh |  4 ++--
 tools/test/stress2/misc/beneath3.sh |  2 +-
 tools/test/stress2/misc/beneath4.sh | 24 ++++++++++++------------
 4 files changed, 18 insertions(+), 23 deletions(-)

diff --git a/tools/test/stress2/misc/beneath.sh b/tools/test/stress2/misc/beneath.sh
index 6c2f71a7e992..5f61dbd5e383 100755
--- a/tools/test/stress2/misc/beneath.sh
+++ b/tools/test/stress2/misc/beneath.sh
@@ -27,7 +27,7 @@
 # SUCH DAMAGE.
 #
 
-# Test of open(2) with the O_BENEATH flag.
+# Test of open(2) with the O_RESOLVE_BENEATH flag.
 
 # userret: returning with the following locks held:
 # shared lockmgr ufs (ufs) r = 0 (0xfffff804ec0d2a48) locked @
@@ -46,11 +46,6 @@ cat > $top/beneath.c <<EOF
 #include <string.h>
 #include <unistd.h>
 
-#ifndef O_BENEATH
-#define	O_BENEATH	0x00400000	/* Fail if not under cwd */
-#define	AT_BENEATH		0x1000	/* Fail if not under dirfd */
-#endif
-
 int
 main(int argc, char *argv[])
 {
@@ -61,7 +56,7 @@ main(int argc, char *argv[])
 	for (i = 1; i < argc; i++) {
 		name = argv[i];
 		alarm(120);
-		fd = open(name, O_RDONLY | O_BENEATH);
+		fd = open(name, O_RDONLY | O_RESOLVE_BENEATH);
 		if (fd == -1) {
 			fprintf(stderr, "open(\"%s\") failed, error %d %s\n",
 			    name, errno, strerror(errno));
@@ -69,7 +64,7 @@ main(int argc, char *argv[])
 			fprintf(stderr, "open(\"%s\") succeeded\n", name);
 			close(fd);
 		}
-		error = fstatat(AT_FDCWD, name, &st, AT_BENEATH);
+		error = fstatat(AT_FDCWD, name, &st, AT_RESOLVE_BENEATH);
 		if (error == -1){
 			fprintf(stderr, "stat(\"%s\") failed, error %d %s\n",
 			    name, errno, strerror(errno));
diff --git a/tools/test/stress2/misc/beneath2.sh b/tools/test/stress2/misc/beneath2.sh
index 93a937c054ff..a89cd8deb1e1 100755
--- a/tools/test/stress2/misc/beneath2.sh
+++ b/tools/test/stress2/misc/beneath2.sh
@@ -27,7 +27,7 @@
 # SUCH DAMAGE.
 #
 
-# O_BENEATH test with a relative path, which is a symbolic link pointing
+# O_RESOLVE_BENEATH test with a relative path, which is a symbolic link pointing
 # to an absolute path.
 
 # "panic: Assertion (ndp->ni_lcf & NI_LCF_LATCH) != 0 failed at
@@ -93,7 +93,7 @@ main(int argc, char *argv[])
 		exit(1);
 	}
 	file = argv[1];
-	if ((fd = open(file, O_RDONLY | O_BENEATH)) != 0 &&
+	if ((fd = open(file, O_RDONLY | O_RESOLVE_BENEATH)) != 0 &&
 	    errno != ENOTCAPABLE)
 		err(1, "open(%s)", file);
 
diff --git a/tools/test/stress2/misc/beneath3.sh b/tools/test/stress2/misc/beneath3.sh
index 52dc37a7f873..46f370899ee8 100755
--- a/tools/test/stress2/misc/beneath3.sh
+++ b/tools/test/stress2/misc/beneath3.sh
@@ -84,7 +84,7 @@ main(void)
 	char file[] = "/..";
 
 	errno = 0;
-	fd = open(file, O_CREAT | O_RDONLY | O_BENEATH);
+	fd = open(file, O_CREAT | O_RDONLY | O_RESOLVE_BENEATH);
 	if (fd != -1 || errno != ENOTCAPABLE)
 		err(1, "open(%s) returns %d", file, fd);
 
diff --git a/tools/test/stress2/misc/beneath4.sh b/tools/test/stress2/misc/beneath4.sh
index d9ee71a8f222..f1a5c8817662 100755
--- a/tools/test/stress2/misc/beneath4.sh
+++ b/tools/test/stress2/misc/beneath4.sh
@@ -69,7 +69,7 @@ main(int argc, char *argv[])
 	sscanf(argv[3], "%x", &flag);
 	exp = atoi(argv[4]);
 #if 0
-	if ((flag & (AT_BENEATH | AT_RESOLVE_BENEATH)) == 0) {
+	if ((flag & AT_RESOLVE_BENEATH) == 0) {
 		fprintf(stderr, "Flag must be %#x or %#x\n",
 		    AT_BENEATH, AT_RESOLVE_BENEATH);
 		return (1);
@@ -105,17 +105,17 @@ top=$dir/a
 
 cd $here
 s=0
-ls -lR $dir
-echo  AT_BENEATH
-$dir/beneath4 $top a                         0x1000  0 || s=1
-$dir/beneath4 $top b                         0x1000  2 || s=1
-$dir/beneath4 $top c                         0x1000  0 || s=1
-$dir/beneath4 $top d                         0x1000  0 || s=1
-$dir/beneath4 $top e                         0x1000  2 || s=1
-$dir/beneath4 $top fifo                      0x1000  0 || s=1
-$dir/beneath4 $top $top/../../beneath4.d/a/a 0x1000 93 || s=1
-$dir/beneath4 $top $top/..                   0x1000 93 || s=1
-$dir/beneath4 $top ../a                      0x1000  0 || s=1
+#ls -lR $dir
+#echo  AT_BENEATH
+#$dir/beneath4 $top a                         0x1000  0 || s=1
+#$dir/beneath4 $top b                         0x1000  2 || s=1
+#$dir/beneath4 $top c                         0x1000  0 || s=1
+#$dir/beneath4 $top d                         0x1000  0 || s=1
+#$dir/beneath4 $top e                         0x1000  2 || s=1
+#$dir/beneath4 $top fifo                      0x1000  0 || s=1
+#$dir/beneath4 $top $top/../../beneath4.d/a/a 0x1000 93 || s=1
+#$dir/beneath4 $top $top/..                   0x1000 93 || s=1
+#$dir/beneath4 $top ../a                      0x1000  0 || s=1
 
 printf "\nAT_RESOLVE_BENEATH\n"
 $dir/beneath4 $top a                         0x2000  0 || s=1


More information about the dev-commits-src-main mailing list