diff options
-rwxr-xr-x | tests.sh | 193 | ||||
-rw-r--r-- | tests/test_D_all.out | 19 | ||||
-rw-r--r-- | tests/test_D_multi.out | 19 | ||||
-rw-r--r-- | tests/test_O0.out | 19 | ||||
-rw-r--r-- | tests/test_O1.out | 19 | ||||
-rw-r--r-- | tests/test_O2.out | 19 | ||||
-rw-r--r-- | tests/test_O3.out | 19 | ||||
-rw-r--r-- | tests/test_Ofast.out | 19 | ||||
-rw-r--r-- | tests/test_fprint0.out | bin | 0 -> 16 bytes | |||
-rw-r--r-- | tests/test_fprintf.out | 19 | ||||
-rw-r--r-- | tests/test_perm_setid.out | 3 | ||||
-rw-r--r-- | tests/test_perm_sticky.out | 2 | ||||
-rw-r--r-- | tests/test_print0.out | bin | 0 -> 16 bytes |
13 files changed, 350 insertions, 0 deletions
@@ -166,6 +166,10 @@ posix_tests=( test_weird_names + test_incomplete + test_missing_paren + test_extra_paren + # Flags test_H @@ -231,6 +235,8 @@ posix_tests=( test_perm_symbolic_minus test_perm_leading_plus_symbolic_minus test_permcopy + test_perm_setid + test_perm_sticky test_prune test_prune_or_print @@ -339,6 +345,9 @@ bsd_tests=( test_lname test_L_lname + test_ls + test_L_ls + test_maxdepth test_mindepth @@ -456,12 +465,18 @@ gnu_tests=( test_false + test_fls + test_follow test_fprint test_fprint_duplicate test_fprint_error + test_fprint0 + + test_fprintf + test_fstype test_gid @@ -488,6 +503,9 @@ gnu_tests=( test_lname test_L_lname + test_ls + test_L_ls + test_maxdepth test_mindepth @@ -515,6 +533,8 @@ gnu_tests=( test_print_error + test_print0 + test_printf test_printf_empty test_printf_slash @@ -543,6 +563,7 @@ gnu_tests=( test_regex test_regex_parens + test_regex_error test_regextype_posix_basic test_regextype_posix_extended @@ -593,8 +614,19 @@ bfs_tests=( test_expr_flag_path test_expr_path_flag + test_typo + # Flags + test_D_multi + test_D_all + + test_O0 + test_O1 + test_O2 + test_O3 + test_Ofast + test_S_bfs test_S_dfs test_S_ids @@ -605,6 +637,7 @@ bfs_tests=( test_exclude_depth test_exclude_mindepth test_exclude_print + test_exclude_exclude # Primaries @@ -649,6 +682,11 @@ bfs_tests=( test_hidden + test_newerma_nonexistent + test_newermt_invalid + test_newermq + test_newerqm + test_nohidden test_nohidden_depth @@ -658,6 +696,12 @@ bfs_tests=( test_perm_leading_plus_symbolic test_printf_w + test_printf_incomplete_escape + test_printf_invalid_escape + test_printf_incomplete_format + test_printf_invalid_format + test_printf_duplicate_flag + test_printf_must_be_numeric test_type_multi @@ -667,6 +711,8 @@ bfs_tests=( test_L_unique_loops test_L_unique_depth + test_version + test_xtype_multi # Optimizer tests @@ -1416,6 +1462,22 @@ function test_newermt_epoch_minus_one() { bfs_diff times -newermt 1969-12-31T23:59:59Z } +function test_newermt_invalid() { + ! invoke_bfs times -newermt not_a_date_time 2>/dev/null +} + +function test_newerma_nonexistent() { + ! invoke_bfs times -newerma basic/nonexistent 2>/dev/null +} + +function test_newermq() { + ! invoke_bfs times -newermq times/a 2>/dev/null +} + +function test_newerqm() { + ! invoke_bfs times -newerqm times/a 2>/dev/null +} + function test_size() { bfs_diff basic -type f -size 0 } @@ -1678,6 +1740,14 @@ function test_permcopy() { bfs_diff perms -perm u+rw,g+u-w,o=g } +function test_perm_setid() { + bfs_diff rainbow -perm /ug+s +} + +function test_perm_sticky() { + bfs_diff rainbow -perm /ug+t +} + function test_prune() { bfs_diff basic -name foo -prune } @@ -1758,6 +1828,10 @@ function test_regex_parens() { bfs_diff . -regex '\./\((\)' } +function test_regex_error() { + ! invoke_bfs basic -regex '[' 2>/dev/null +} + function test_E() { cd weirdnames bfs_diff -E . -regex '\./(\()' @@ -1912,6 +1986,18 @@ function test_nouser_ulimit() { bfs_diff deep -nouser } +function test_ls() { + invoke_bfs rainbow -ls >scratch/test_ls.out +} + +function test_L_ls() { + invoke_bfs -L rainbow -ls >scratch/test_L_ls.out +} + +function test_fls() { + invoke_bfs rainbow -fls scratch/test_fls.out +} + function test_printf() { bfs_diff basic -printf '%%p(%p) %%d(%d) %%f(%f) %%h(%h) %%H(%H) %%P(%P) %%m(%m) %%M(%M) %%y(%y)\n' } @@ -2007,6 +2093,41 @@ function test_printf_l_nonlink() { bfs_diff links -printf '| %24p -> %-24l |\n' } +function test_printf_incomplete_escape() { + ! invoke_bfs basic -printf '\' 2>/dev/null +} + +function test_printf_invalid_escape() { + ! invoke_bfs basic -printf '\!' 2>/dev/null +} + +function test_printf_incomplete_format() { + ! invoke_bfs basic -printf '%' 2>/dev/null +} + +function test_printf_invalid_format() { + ! invoke_bfs basic -printf '%!' 2>/dev/null +} + +function test_printf_duplicate_flag() { + ! invoke_bfs basic -printf '%--p' 2>/dev/null +} + +function test_printf_must_be_numeric() { + ! invoke_bfs basic -printf '%+p' 2>/dev/null +} + +function test_fprintf() { + invoke_bfs basic -fprintf scratch/test_fprintf.out '%%p(%p) %%d(%d) %%f(%f) %%h(%h) %%H(%H) %%P(%P) %%m(%m) %%M(%M) %%y(%y)\n' + sort -o scratch/test_fprintf.out scratch/test_fprintf.out + + if [ "$UPDATE" ]; then + cp scratch/test_fprintf.out "$TESTS/test_fprintf.out" + else + diff -u scratch/test_fprintf.out "$TESTS/test_fprintf.out" + fi +} + function test_fstype() { fstype="$(invoke_bfs basic -maxdepth 0 -printf '%F\n')" bfs_diff basic -fstype "$fstype" @@ -2072,6 +2193,18 @@ function test_precedence() { bfs_diff basic \( -name foo -type d -o -name bar -a -type f \) -print , \! -empty -type f -print } +function test_incomplete() { + ! invoke_bfs basic \( 2>/dev/null +} + +function test_missing_paren() { + ! invoke_bfs basic \( -print 2>/dev/null +} + +function test_extra_paren() { + ! invoke_bfs basic -print \) 2>/dev/null +} + function test_color() { LS_COLORS= bfs_diff rainbow -color } @@ -2370,6 +2503,26 @@ function test_fprint_error() { fi } +function test_print0() { + invoke_bfs basic/a basic/b -print0 >scratch/test_print0.out + + if [ "$UPDATE" ]; then + cp scratch/test_print0.out "$TESTS/test_print0.out" + else + cmp -s scratch/test_print0.out "$TESTS/test_print0.out" + fi +} + +function test_fprint0() { + invoke_bfs basic/a basic/b -fprint0 scratch/test_fprint0.out + + if [ "$UPDATE" ]; then + cp scratch/test_fprint0.out "$TESTS/test_fprint0.out" + else + cmp -s scratch/test_fprint0.out "$TESTS/test_fprint0.out" + fi +} + function test_closed_stdin() { bfs_diff basic <&- } @@ -2674,6 +2827,42 @@ function test_help() { return 0 } +function test_version() { + invoke_bfs -version >/dev/null +} + +function test_typo() { + invoke_bfs -dikkiq 2>&1 | grep follow >/dev/null +} + +function test_D_multi() { + bfs_diff -D opt,tree,unknown basic 2>/dev/null +} + +function test_D_all() { + bfs_diff -D all basic 2>/dev/null +} + +function test_O0() { + bfs_diff -O0 basic -not \( -type f -not -type f \) +} + +function test_O1() { + bfs_diff -O1 basic -not \( -type f -not -type f \) +} + +function test_O2() { + bfs_diff -O2 basic -not \( -type f -not -type f \) +} + +function test_O3() { + bfs_diff -O3 basic -not \( -type f -not -type f \) +} + +function test_Ofast() { + bfs_diff -Ofast basic -not \( -xtype f -not -xtype f \) +} + function test_S() { invoke_bfs -S "$1" -s basic >"$TMP/test_S_$1.out" @@ -2712,6 +2901,10 @@ function test_exclude_print() { ! invoke_bfs basic -exclude -print 2>/dev/null } +function test_exclude_exclude() { + ! invoke_bfs basic -exclude -exclude -name foo 2>/dev/null +} + BOL= EOL='\n' diff --git a/tests/test_D_all.out b/tests/test_D_all.out new file mode 100644 index 0000000..bb3cd8d --- /dev/null +++ b/tests/test_D_all.out @@ -0,0 +1,19 @@ +basic +basic/a +basic/b +basic/c +basic/e +basic/g +basic/i +basic/j +basic/k +basic/l +basic/c/d +basic/e/f +basic/g/h +basic/j/foo +basic/k/foo +basic/l/foo +basic/k/foo/bar +basic/l/foo/bar +basic/l/foo/bar/baz diff --git a/tests/test_D_multi.out b/tests/test_D_multi.out new file mode 100644 index 0000000..bb3cd8d --- /dev/null +++ b/tests/test_D_multi.out @@ -0,0 +1,19 @@ +basic +basic/a +basic/b +basic/c +basic/e +basic/g +basic/i +basic/j +basic/k +basic/l +basic/c/d +basic/e/f +basic/g/h +basic/j/foo +basic/k/foo +basic/l/foo +basic/k/foo/bar +basic/l/foo/bar +basic/l/foo/bar/baz diff --git a/tests/test_O0.out b/tests/test_O0.out new file mode 100644 index 0000000..bb3cd8d --- /dev/null +++ b/tests/test_O0.out @@ -0,0 +1,19 @@ +basic +basic/a +basic/b +basic/c +basic/e +basic/g +basic/i +basic/j +basic/k +basic/l +basic/c/d +basic/e/f +basic/g/h +basic/j/foo +basic/k/foo +basic/l/foo +basic/k/foo/bar +basic/l/foo/bar +basic/l/foo/bar/baz diff --git a/tests/test_O1.out b/tests/test_O1.out new file mode 100644 index 0000000..bb3cd8d --- /dev/null +++ b/tests/test_O1.out @@ -0,0 +1,19 @@ +basic +basic/a +basic/b +basic/c +basic/e +basic/g +basic/i +basic/j +basic/k +basic/l +basic/c/d +basic/e/f +basic/g/h +basic/j/foo +basic/k/foo +basic/l/foo +basic/k/foo/bar +basic/l/foo/bar +basic/l/foo/bar/baz diff --git a/tests/test_O2.out b/tests/test_O2.out new file mode 100644 index 0000000..bb3cd8d --- /dev/null +++ b/tests/test_O2.out @@ -0,0 +1,19 @@ +basic +basic/a +basic/b +basic/c +basic/e +basic/g +basic/i +basic/j +basic/k +basic/l +basic/c/d +basic/e/f +basic/g/h +basic/j/foo +basic/k/foo +basic/l/foo +basic/k/foo/bar +basic/l/foo/bar +basic/l/foo/bar/baz diff --git a/tests/test_O3.out b/tests/test_O3.out new file mode 100644 index 0000000..bb3cd8d --- /dev/null +++ b/tests/test_O3.out @@ -0,0 +1,19 @@ +basic +basic/a +basic/b +basic/c +basic/e +basic/g +basic/i +basic/j +basic/k +basic/l +basic/c/d +basic/e/f +basic/g/h +basic/j/foo +basic/k/foo +basic/l/foo +basic/k/foo/bar +basic/l/foo/bar +basic/l/foo/bar/baz diff --git a/tests/test_Ofast.out b/tests/test_Ofast.out new file mode 100644 index 0000000..bb3cd8d --- /dev/null +++ b/tests/test_Ofast.out @@ -0,0 +1,19 @@ +basic +basic/a +basic/b +basic/c +basic/e +basic/g +basic/i +basic/j +basic/k +basic/l +basic/c/d +basic/e/f +basic/g/h +basic/j/foo +basic/k/foo +basic/l/foo +basic/k/foo/bar +basic/l/foo/bar +basic/l/foo/bar/baz diff --git a/tests/test_fprint0.out b/tests/test_fprint0.out Binary files differnew file mode 100644 index 0000000..1347444 --- /dev/null +++ b/tests/test_fprint0.out diff --git a/tests/test_fprintf.out b/tests/test_fprintf.out new file mode 100644 index 0000000..77ce17a --- /dev/null +++ b/tests/test_fprintf.out @@ -0,0 +1,19 @@ +%p(basic) %d(0) %f(basic) %h(.) %H(basic) %P() %m(755) %M(drwxr-xr-x) %y(d) +%p(basic/a) %d(1) %f(a) %h(basic) %H(basic) %P(a) %m(644) %M(-rw-r--r--) %y(f) +%p(basic/b) %d(1) %f(b) %h(basic) %H(basic) %P(b) %m(644) %M(-rw-r--r--) %y(f) +%p(basic/c) %d(1) %f(c) %h(basic) %H(basic) %P(c) %m(755) %M(drwxr-xr-x) %y(d) +%p(basic/c/d) %d(2) %f(d) %h(basic/c) %H(basic) %P(c/d) %m(644) %M(-rw-r--r--) %y(f) +%p(basic/e) %d(1) %f(e) %h(basic) %H(basic) %P(e) %m(755) %M(drwxr-xr-x) %y(d) +%p(basic/e/f) %d(2) %f(f) %h(basic/e) %H(basic) %P(e/f) %m(644) %M(-rw-r--r--) %y(f) +%p(basic/g) %d(1) %f(g) %h(basic) %H(basic) %P(g) %m(755) %M(drwxr-xr-x) %y(d) +%p(basic/g/h) %d(2) %f(h) %h(basic/g) %H(basic) %P(g/h) %m(755) %M(drwxr-xr-x) %y(d) +%p(basic/i) %d(1) %f(i) %h(basic) %H(basic) %P(i) %m(755) %M(drwxr-xr-x) %y(d) +%p(basic/j) %d(1) %f(j) %h(basic) %H(basic) %P(j) %m(755) %M(drwxr-xr-x) %y(d) +%p(basic/j/foo) %d(2) %f(foo) %h(basic/j) %H(basic) %P(j/foo) %m(644) %M(-rw-r--r--) %y(f) +%p(basic/k) %d(1) %f(k) %h(basic) %H(basic) %P(k) %m(755) %M(drwxr-xr-x) %y(d) +%p(basic/k/foo) %d(2) %f(foo) %h(basic/k) %H(basic) %P(k/foo) %m(755) %M(drwxr-xr-x) %y(d) +%p(basic/k/foo/bar) %d(3) %f(bar) %h(basic/k/foo) %H(basic) %P(k/foo/bar) %m(644) %M(-rw-r--r--) %y(f) +%p(basic/l) %d(1) %f(l) %h(basic) %H(basic) %P(l) %m(755) %M(drwxr-xr-x) %y(d) +%p(basic/l/foo) %d(2) %f(foo) %h(basic/l) %H(basic) %P(l/foo) %m(755) %M(drwxr-xr-x) %y(d) +%p(basic/l/foo/bar) %d(3) %f(bar) %h(basic/l/foo) %H(basic) %P(l/foo/bar) %m(755) %M(drwxr-xr-x) %y(d) +%p(basic/l/foo/bar/baz) %d(4) %f(baz) %h(basic/l/foo/bar) %H(basic) %P(l/foo/bar/baz) %m(644) %M(-rw-r--r--) %y(f) diff --git a/tests/test_perm_setid.out b/tests/test_perm_setid.out new file mode 100644 index 0000000..865a74e --- /dev/null +++ b/tests/test_perm_setid.out @@ -0,0 +1,3 @@ +rainbow/sgid +rainbow/sugid +rainbow/suid diff --git a/tests/test_perm_sticky.out b/tests/test_perm_sticky.out new file mode 100644 index 0000000..c07eb61 --- /dev/null +++ b/tests/test_perm_sticky.out @@ -0,0 +1,2 @@ +rainbow/sticky +rainbow/sticky_ow diff --git a/tests/test_print0.out b/tests/test_print0.out Binary files differnew file mode 100644 index 0000000..1347444 --- /dev/null +++ b/tests/test_print0.out |