logo

utils-std

Collection of commonly available Unix tools git clone https://anongit.hacktivis.me/git/utils-std.git
commit: 54dd1707a0418662be33d1527e2d7e86efa62952
parent d09948a62fc69d2e3949f9237cd383f5bef19ecc
Author: Haelwenn (lanodan) Monnier <contact@hacktivis.me>
Date:   Sat, 23 Nov 2024 09:54:29 +0100

test-cmd/tee: Skip when ran as root

Diffstat:

Mtest-cmd/tee.sh17++++++++++++-----
1 file changed, 12 insertions(+), 5 deletions(-)

diff --git a/test-cmd/tee.sh b/test-cmd/tee.sh @@ -21,12 +21,19 @@ t_file --infile="${WD}/inputs/all_bytes" appendfile "${WD}/inputs/all_bytes" -a t_cmd writefile:cmp '' cmp "${tmp_appendfile}" "${WD}/outputs/tee/hello_all_bytes" t_cmd appendfile:rm '' rm "${tmp_appendfile}" -tmp_noperm="$(mktemp)" -t_cmd noperm:chmod_0000 '' chmod 0000 "${tmp_noperm}" -t --exit=1 noperm "${tmp_noperm}" "tee: error: Failed opening file ‘${tmp_noperm}’: Permission denied +if [ "x${LOGNAME}" = 'xroot' ]; then + skip noperm:chmod_0000 'ran as root, ignoring' + skip noperm 'ran as root, ignoring' + skip noperm:chmod_0600 'ran as root, ignoring' + skip noperm:rm 'ran as root, ignoring' +else + tmp_noperm="$(mktemp)" + t_cmd noperm:chmod_0000 '' chmod 0000 "${tmp_noperm}" + t --exit=1 noperm "${tmp_noperm}" "tee: error: Failed opening file ‘${tmp_noperm}’: Permission denied " </dev/null -t_cmd noperm:chmod_0600 '' chmod 0600 "${tmp_noperm}" -t_cmd noperm:rm '' rm "${tmp_noperm}" + t_cmd noperm:chmod_0600 '' chmod 0600 "${tmp_noperm}" + t_cmd noperm:rm '' rm "${tmp_noperm}" +fi t --input='' nullinput