From 3d76e707633b66e01791a0a09e38e91213b963c2 Mon Sep 17 00:00:00 2001 From: Tavian Barnes Date: Sat, 27 Jul 2024 20:15:12 -0400 Subject: tests: Add tests for invalid users/groups --- tests/common/gid.out | 19 +++++++++++++++++++ tests/common/gid.sh | 1 + tests/common/gid_invalid_id.sh | 1 + tests/common/gid_invalid_name.sh | 1 + tests/common/gid_minus.out | 19 +++++++++++++++++++ tests/common/gid_minus.sh | 1 + tests/common/gid_minus_plus.out | 19 +++++++++++++++++++ tests/common/gid_minus_plus.sh | 1 + tests/common/gid_plus.out | 19 +++++++++++++++++++ tests/common/gid_plus.sh | 2 ++ tests/common/gid_plus_plus.out | 19 +++++++++++++++++++ tests/common/gid_plus_plus.sh | 2 ++ tests/common/uid.out | 19 +++++++++++++++++++ tests/common/uid.sh | 1 + tests/common/uid_invalid_id.sh | 1 + tests/common/uid_invalid_name.sh | 1 + tests/common/uid_minus.out | 19 +++++++++++++++++++ tests/common/uid_minus.sh | 1 + tests/common/uid_minus_plus.out | 19 +++++++++++++++++++ tests/common/uid_minus_plus.sh | 1 + tests/common/uid_plus.out | 19 +++++++++++++++++++ tests/common/uid_plus.sh | 2 ++ tests/common/uid_plus_plus.out | 19 +++++++++++++++++++ tests/common/uid_plus_plus.sh | 2 ++ 24 files changed, 208 insertions(+) create mode 100644 tests/common/gid.out create mode 100644 tests/common/gid.sh create mode 100644 tests/common/gid_invalid_id.sh create mode 100644 tests/common/gid_invalid_name.sh create mode 100644 tests/common/gid_minus.out create mode 100644 tests/common/gid_minus.sh create mode 100644 tests/common/gid_minus_plus.out create mode 100644 tests/common/gid_minus_plus.sh create mode 100644 tests/common/gid_plus.out create mode 100644 tests/common/gid_plus.sh create mode 100644 tests/common/gid_plus_plus.out create mode 100644 tests/common/gid_plus_plus.sh create mode 100644 tests/common/uid.out create mode 100644 tests/common/uid.sh create mode 100644 tests/common/uid_invalid_id.sh create mode 100644 tests/common/uid_invalid_name.sh create mode 100644 tests/common/uid_minus.out create mode 100644 tests/common/uid_minus.sh create mode 100644 tests/common/uid_minus_plus.out create mode 100644 tests/common/uid_minus_plus.sh create mode 100644 tests/common/uid_plus.out create mode 100644 tests/common/uid_plus.sh create mode 100644 tests/common/uid_plus_plus.out create mode 100644 tests/common/uid_plus_plus.sh (limited to 'tests/common') diff --git a/tests/common/gid.out b/tests/common/gid.out new file mode 100644 index 0000000..a7ccfe4 --- /dev/null +++ b/tests/common/gid.out @@ -0,0 +1,19 @@ +basic +basic/a +basic/b +basic/c +basic/c/d +basic/e +basic/e/f +basic/g +basic/g/h +basic/i +basic/j +basic/j/foo +basic/k +basic/k/foo +basic/k/foo/bar +basic/l +basic/l/foo +basic/l/foo/bar +basic/l/foo/bar/baz diff --git a/tests/common/gid.sh b/tests/common/gid.sh new file mode 100644 index 0000000..2707b4a --- /dev/null +++ b/tests/common/gid.sh @@ -0,0 +1 @@ +bfs_diff basic -gid "$(id -g)" diff --git a/tests/common/gid_invalid_id.sh b/tests/common/gid_invalid_id.sh new file mode 100644 index 0000000..74f0055 --- /dev/null +++ b/tests/common/gid_invalid_id.sh @@ -0,0 +1 @@ +! invoke_bfs -gid 1eW6f5RM9Qi diff --git a/tests/common/gid_invalid_name.sh b/tests/common/gid_invalid_name.sh new file mode 100644 index 0000000..0e2e5f5 --- /dev/null +++ b/tests/common/gid_invalid_name.sh @@ -0,0 +1 @@ +! invoke_bfs -gid eW6f5RM9Qi diff --git a/tests/common/gid_minus.out b/tests/common/gid_minus.out new file mode 100644 index 0000000..a7ccfe4 --- /dev/null +++ b/tests/common/gid_minus.out @@ -0,0 +1,19 @@ +basic +basic/a +basic/b +basic/c +basic/c/d +basic/e +basic/e/f +basic/g +basic/g/h +basic/i +basic/j +basic/j/foo +basic/k +basic/k/foo +basic/k/foo/bar +basic/l +basic/l/foo +basic/l/foo/bar +basic/l/foo/bar/baz diff --git a/tests/common/gid_minus.sh b/tests/common/gid_minus.sh new file mode 100644 index 0000000..e3822f0 --- /dev/null +++ b/tests/common/gid_minus.sh @@ -0,0 +1 @@ +bfs_diff basic -gid "-$(($(id -g) + 1))" diff --git a/tests/common/gid_minus_plus.out b/tests/common/gid_minus_plus.out new file mode 100644 index 0000000..a7ccfe4 --- /dev/null +++ b/tests/common/gid_minus_plus.out @@ -0,0 +1,19 @@ +basic +basic/a +basic/b +basic/c +basic/c/d +basic/e +basic/e/f +basic/g +basic/g/h +basic/i +basic/j +basic/j/foo +basic/k +basic/k/foo +basic/k/foo/bar +basic/l +basic/l/foo +basic/l/foo/bar +basic/l/foo/bar/baz diff --git a/tests/common/gid_minus_plus.sh b/tests/common/gid_minus_plus.sh new file mode 100644 index 0000000..4ff0877 --- /dev/null +++ b/tests/common/gid_minus_plus.sh @@ -0,0 +1 @@ +bfs_diff basic -gid "-+$(($(id -g) + 1))" diff --git a/tests/common/gid_plus.out b/tests/common/gid_plus.out new file mode 100644 index 0000000..a7ccfe4 --- /dev/null +++ b/tests/common/gid_plus.out @@ -0,0 +1,19 @@ +basic +basic/a +basic/b +basic/c +basic/c/d +basic/e +basic/e/f +basic/g +basic/g/h +basic/i +basic/j +basic/j/foo +basic/k +basic/k/foo +basic/k/foo/bar +basic/l +basic/l/foo +basic/l/foo/bar +basic/l/foo/bar/baz diff --git a/tests/common/gid_plus.sh b/tests/common/gid_plus.sh new file mode 100644 index 0000000..ccba0e6 --- /dev/null +++ b/tests/common/gid_plus.sh @@ -0,0 +1,2 @@ +test "$(id -g)" -eq 0 && skip +bfs_diff basic -gid +0 diff --git a/tests/common/gid_plus_plus.out b/tests/common/gid_plus_plus.out new file mode 100644 index 0000000..a7ccfe4 --- /dev/null +++ b/tests/common/gid_plus_plus.out @@ -0,0 +1,19 @@ +basic +basic/a +basic/b +basic/c +basic/c/d +basic/e +basic/e/f +basic/g +basic/g/h +basic/i +basic/j +basic/j/foo +basic/k +basic/k/foo +basic/k/foo/bar +basic/l +basic/l/foo +basic/l/foo/bar +basic/l/foo/bar/baz diff --git a/tests/common/gid_plus_plus.sh b/tests/common/gid_plus_plus.sh new file mode 100644 index 0000000..ec7ae86 --- /dev/null +++ b/tests/common/gid_plus_plus.sh @@ -0,0 +1,2 @@ +test "$(id -g)" -eq 0 && skip +bfs_diff basic -gid ++0 diff --git a/tests/common/uid.out b/tests/common/uid.out new file mode 100644 index 0000000..a7ccfe4 --- /dev/null +++ b/tests/common/uid.out @@ -0,0 +1,19 @@ +basic +basic/a +basic/b +basic/c +basic/c/d +basic/e +basic/e/f +basic/g +basic/g/h +basic/i +basic/j +basic/j/foo +basic/k +basic/k/foo +basic/k/foo/bar +basic/l +basic/l/foo +basic/l/foo/bar +basic/l/foo/bar/baz diff --git a/tests/common/uid.sh b/tests/common/uid.sh new file mode 100644 index 0000000..fb3cd93 --- /dev/null +++ b/tests/common/uid.sh @@ -0,0 +1 @@ +bfs_diff basic -uid "$(id -u)" diff --git a/tests/common/uid_invalid_id.sh b/tests/common/uid_invalid_id.sh new file mode 100644 index 0000000..f5b952d --- /dev/null +++ b/tests/common/uid_invalid_id.sh @@ -0,0 +1 @@ +! invoke_bfs -uid 1eW6f5RM9Qi diff --git a/tests/common/uid_invalid_name.sh b/tests/common/uid_invalid_name.sh new file mode 100644 index 0000000..a2c359f --- /dev/null +++ b/tests/common/uid_invalid_name.sh @@ -0,0 +1 @@ +! invoke_bfs -uid eW6f5RM9Qi diff --git a/tests/common/uid_minus.out b/tests/common/uid_minus.out new file mode 100644 index 0000000..a7ccfe4 --- /dev/null +++ b/tests/common/uid_minus.out @@ -0,0 +1,19 @@ +basic +basic/a +basic/b +basic/c +basic/c/d +basic/e +basic/e/f +basic/g +basic/g/h +basic/i +basic/j +basic/j/foo +basic/k +basic/k/foo +basic/k/foo/bar +basic/l +basic/l/foo +basic/l/foo/bar +basic/l/foo/bar/baz diff --git a/tests/common/uid_minus.sh b/tests/common/uid_minus.sh new file mode 100644 index 0000000..6d371f2 --- /dev/null +++ b/tests/common/uid_minus.sh @@ -0,0 +1 @@ +bfs_diff basic -uid "-$(($(id -u) + 1))" diff --git a/tests/common/uid_minus_plus.out b/tests/common/uid_minus_plus.out new file mode 100644 index 0000000..a7ccfe4 --- /dev/null +++ b/tests/common/uid_minus_plus.out @@ -0,0 +1,19 @@ +basic +basic/a +basic/b +basic/c +basic/c/d +basic/e +basic/e/f +basic/g +basic/g/h +basic/i +basic/j +basic/j/foo +basic/k +basic/k/foo +basic/k/foo/bar +basic/l +basic/l/foo +basic/l/foo/bar +basic/l/foo/bar/baz diff --git a/tests/common/uid_minus_plus.sh b/tests/common/uid_minus_plus.sh new file mode 100644 index 0000000..e7a0496 --- /dev/null +++ b/tests/common/uid_minus_plus.sh @@ -0,0 +1 @@ +bfs_diff basic -uid "-+$(($(id -u) + 1))" diff --git a/tests/common/uid_plus.out b/tests/common/uid_plus.out new file mode 100644 index 0000000..a7ccfe4 --- /dev/null +++ b/tests/common/uid_plus.out @@ -0,0 +1,19 @@ +basic +basic/a +basic/b +basic/c +basic/c/d +basic/e +basic/e/f +basic/g +basic/g/h +basic/i +basic/j +basic/j/foo +basic/k +basic/k/foo +basic/k/foo/bar +basic/l +basic/l/foo +basic/l/foo/bar +basic/l/foo/bar/baz diff --git a/tests/common/uid_plus.sh b/tests/common/uid_plus.sh new file mode 100644 index 0000000..22b2c8e --- /dev/null +++ b/tests/common/uid_plus.sh @@ -0,0 +1,2 @@ +test "$(id -u)" -eq 0 && skip +bfs_diff basic -uid +0 diff --git a/tests/common/uid_plus_plus.out b/tests/common/uid_plus_plus.out new file mode 100644 index 0000000..a7ccfe4 --- /dev/null +++ b/tests/common/uid_plus_plus.out @@ -0,0 +1,19 @@ +basic +basic/a +basic/b +basic/c +basic/c/d +basic/e +basic/e/f +basic/g +basic/g/h +basic/i +basic/j +basic/j/foo +basic/k +basic/k/foo +basic/k/foo/bar +basic/l +basic/l/foo +basic/l/foo/bar +basic/l/foo/bar/baz diff --git a/tests/common/uid_plus_plus.sh b/tests/common/uid_plus_plus.sh new file mode 100644 index 0000000..e021888 --- /dev/null +++ b/tests/common/uid_plus_plus.sh @@ -0,0 +1,2 @@ +test "$(id -u)" -eq 0 && skip +bfs_diff basic -uid ++0 -- cgit v1.2.3