@@ -46,6 +46,7 @@ export RUNTESTS="$(readlink -f $0)"
4646NUM=0
4747FAIL=0; FAIL_NAMES=" "
4848XFAIL=0
49+ SKIP=0
4950VERBOSE=0
5051
5152clean () {
@@ -126,7 +127,16 @@ run_tests () {
126127 testdir=$( dirname $testname )
127128 if [ -e $testdir /skip ]; then
128129 if ! [ -x $testdir /skip ] || ! $testdir /skip; then
129- echo " Skipping test: $testdir " 1>&2
130+ echo " Skipping disabled test: $testdir " 1>&2
131+ SKIP=$(( $SKIP + 1 ))
132+ continue
133+ fi
134+ fi
135+ if $NOSUDO && [ -e $testdir /control ] && \
136+ grep Restrictions: $testdir /control | grep -q sudo; then
137+ if ! [ -x $testdir /skip ] || ! $testdir /skip; then
138+ echo " Skipping sudo test: $testdir " 1>&2
139+ SKIP=$(( $SKIP + 1 ))
130140 continue
131141 fi
132142 fi
@@ -204,7 +214,7 @@ run_tests () {
204214 done < $TMPDIR /alltests
205215
206216 SUCC=$(( NUM- FAIL- XFAIL))
207- echo " Runtest: $NUM tests run, $SUCC successful, $FAIL failed + $XFAIL expected"
217+ echo " Runtest: $NUM tests run, $SUCC successful, $FAIL failed + $XFAIL expected, $SKIP skipped "
208218 if [ $FAIL -ne 0 ]; then
209219 echo " Failed: $FAIL_NAMES "
210220 exit 1;
@@ -227,19 +237,25 @@ Usage:
227237 $P -c tests
228238 Remove temporary files from an earlier test run.
229239
240+ $P -u
241+ Only run tests that require normal user access. Skip tests
242+ requiring root or sudo.
243+
230244 $P -v
231245 Show stdout and stderr (normally it's hidden).
232246EOF
233247}
234248
235249CLEAN_ONLY=0
236250NOCLEAN=0
251+ NOSUDO=false
237252STOP=0
238253PRINT=0
239- while getopts cnvsph opt; do
254+ while getopts cnuvsph opt; do
240255 case " $opt " in
241256 c) CLEAN_ONLY=1 ;;
242257 n) NOCLEAN=1 ;;
258+ u) NOSUDO=true ;;
243259 v) VERBOSE=1 ;;
244260 s) STOP=1 ;;
245261 p) PRINT=1 ;;
0 commit comments