From 86f0049bff0c8c802bb07fcb52ae468608ec0920 Mon Sep 17 00:00:00 2001 From: Tavian Barnes Date: Fri, 20 Jul 2018 12:59:26 -0400 Subject: tests: Add tests for mode 000 --- tests.sh | 21 +++++++++++++++++++++ tests/test_perm_000.out | 1 + tests/test_perm_000_minus.out | 8 ++++++++ tests/test_perm_000_plus.out | 8 ++++++++ tests/test_perm_000_slash.out | 8 ++++++++ 5 files changed, 46 insertions(+) create mode 100644 tests/test_perm_000.out create mode 100644 tests/test_perm_000_minus.out create mode 100644 tests/test_perm_000_plus.out create mode 100644 tests/test_perm_000_slash.out 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 -- cgit v1.2.3