summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTavian Barnes <tavianator@tavianator.com>2018-07-20 12:59:26 -0400
committerTavian Barnes <tavianator@tavianator.com>2018-07-20 12:59:26 -0400
commit86f0049bff0c8c802bb07fcb52ae468608ec0920 (patch)
tree935897cfcdbf707ad661008df4e430fcff5b1d35
parent510a7bd65c680fcf292493b5c00ce32c90a5155c (diff)
downloadbfs-86f0049bff0c8c802bb07fcb52ae468608ec0920.tar.xz
tests: Add tests for mode 000
-rwxr-xr-xtests.sh21
-rw-r--r--tests/test_perm_000.out1
-rw-r--r--tests/test_perm_000_minus.out8
-rw-r--r--tests/test_perm_000_plus.out8
-rw-r--r--tests/test_perm_000_slash.out8
5 files changed, 46 insertions, 0 deletions
diff --git a/tests.sh b/tests.sh
index 2cf8062..b861760 100755
--- a/tests.sh
+++ b/tests.sh
@@ -73,6 +73,7 @@ make_basic "$TMP/basic"
# Creates a file+directory structure with various permissions for tests
function make_perms() {
+ installp -m000 /dev/null "$1/0"
installp -m444 /dev/null "$1/r"
installp -m222 /dev/null "$1/w"
installp -m644 /dev/null "$1/rw"
@@ -208,6 +209,8 @@ posix_tests=(
test_exec_plus_status
test_exec_plus_semicolon
test_flag_comma
+ test_perm_000
+ test_perm_000_minus
test_perm_222
test_perm_222_minus
test_perm_644
@@ -285,6 +288,7 @@ bsd_tests=(
test_uid_name
test_mnewer
test_H_mnewer
+ test_perm_000_plus
test_perm_222_plus
test_perm_644_plus
test_size_T
@@ -365,6 +369,7 @@ gnu_tests=(
test_ignore_readdir_race
test_ignore_readdir_race_root
test_ignore_readdir_race_notdir
+ test_perm_000_slash
test_perm_222_slash
test_perm_644_slash
test_perm_symbolic_slash
@@ -1079,6 +1084,22 @@ function test_ignore_readdir_race_notdir() {
invoke_bfs scratch -mindepth 1 -ignore_readdir_race -execdir rm -r '{}' \; -execdir touch '{}' \;
}
+function test_perm_000() {
+ bfs_diff perms -perm 000
+}
+
+function test_perm_000_minus() {
+ bfs_diff perms -perm -000
+}
+
+function test_perm_000_slash() {
+ bfs_diff perms -perm /000
+}
+
+function test_perm_000_plus() {
+ bfs_diff perms -perm +000
+}
+
function test_perm_222() {
bfs_diff perms -perm 222
}
diff --git a/tests/test_perm_000.out b/tests/test_perm_000.out
new file mode 100644
index 0000000..5fd30bc
--- /dev/null
+++ b/tests/test_perm_000.out
@@ -0,0 +1 @@
+perms/0
diff --git a/tests/test_perm_000_minus.out b/tests/test_perm_000_minus.out
new file mode 100644
index 0000000..d7494b8
--- /dev/null
+++ b/tests/test_perm_000_minus.out
@@ -0,0 +1,8 @@
+perms
+perms/0
+perms/r
+perms/rw
+perms/rwx
+perms/rx
+perms/w
+perms/wx
diff --git a/tests/test_perm_000_plus.out b/tests/test_perm_000_plus.out
new file mode 100644
index 0000000..d7494b8
--- /dev/null
+++ b/tests/test_perm_000_plus.out
@@ -0,0 +1,8 @@
+perms
+perms/0
+perms/r
+perms/rw
+perms/rwx
+perms/rx
+perms/w
+perms/wx
diff --git a/tests/test_perm_000_slash.out b/tests/test_perm_000_slash.out
new file mode 100644
index 0000000..d7494b8
--- /dev/null
+++ b/tests/test_perm_000_slash.out
@@ -0,0 +1,8 @@
+perms
+perms/0
+perms/r
+perms/rw
+perms/rwx
+perms/rx
+perms/w
+perms/wx