t/lib-httpd: require SANITY prereq
[gitweb.git] / t / lib-httpd.sh
index bfdff2a8c93091c8e2db8e03a74eae5c5a53991c..d8918821e6e19aafd1411000aefb8c0583092e96 100644 (file)
@@ -36,6 +36,11 @@ then
        test_done
 fi
 
+if ! test_have_prereq SANITY; then
+       test_skip_or_die $GIT_TEST_HTTPD \
+               "Cannot run httpd tests as root"
+fi
+
 HTTPD_PARA=""
 
 for DEFAULT_HTTPD_PATH in '/usr/sbin/httpd' '/usr/sbin/apache2'
@@ -64,7 +69,7 @@ case $(uname) in
 esac
 
 LIB_HTTPD_PATH=${LIB_HTTPD_PATH-"$DEFAULT_HTTPD_PATH"}
-LIB_HTTPD_PORT=${LIB_HTTPD_PORT-'8111'}
+LIB_HTTPD_PORT=${LIB_HTTPD_PORT-${this_test#t}}
 
 TEST_PATH="$TEST_DIRECTORY"/lib-httpd
 HTTPD_ROOT_PATH="$PWD"/httpd