Merge branch 'jk/run-network-tests-by-default'
authorJunio C Hamano <gitster@pobox.com>
Wed, 5 Mar 2014 23:06:42 +0000 (15:06 -0800)
committerJunio C Hamano <gitster@pobox.com>
Wed, 5 Mar 2014 23:06:45 +0000 (15:06 -0800)
Teach "make test" to run networking tests when possible by default.

* jk/run-network-tests-by-default:
tests: turn on network daemon tests by default

1  2 
t/lib-git-daemon.sh
t/lib-httpd.sh
diff --combined t/lib-git-daemon.sh
index 1f22de260a2d456ee73d29f29b049fd5771e8ecc,615bf5de67cd66ca2fb63c226270e9316c3897dc..bc4b3412fbca1f545ebdcaf23d3ef83d124ddc71
  #     stop_git_daemon
  #     test_done
  
- if test -z "$GIT_TEST_GIT_DAEMON"
+ test_tristate GIT_TEST_GIT_DAEMON
+ if test "$GIT_TEST_GIT_DAEMON" = false
  then
-       skip_all="git-daemon testing disabled (define GIT_TEST_GIT_DAEMON to enable)"
+       skip_all="git-daemon testing disabled (unset GIT_TEST_GIT_DAEMON to enable)"
        test_done
  fi
  
 -LIB_GIT_DAEMON_PORT=${LIB_GIT_DAEMON_PORT-'8121'}
 +LIB_GIT_DAEMON_PORT=${LIB_GIT_DAEMON_PORT-${this_test#t}}
  
  GIT_DAEMON_PID=
  GIT_DAEMON_DOCUMENT_ROOT_PATH="$PWD"/repo
@@@ -58,7 -59,8 +59,8 @@@ start_git_daemon() 
                kill "$GIT_DAEMON_PID"
                wait "$GIT_DAEMON_PID"
                trap 'die' EXIT
-               error "git daemon failed to start"
+               test_skip_or_die $GIT_TEST_GIT_DAEMON \
+                       "git daemon failed to start"
        fi
  }
  
diff --combined t/lib-httpd.sh
index b43162ea2a932deb521381863900279c8d87f2b1,f9c2e22e6d5194f11f119e370ada77921df4106b..252cbf163bcff90aabe39a48219e00565f577ffe
  # Copyright (c) 2008 Clemens Buchacher <drizzd@aon.at>
  #
  
- if test -z "$GIT_TEST_HTTPD"
+ test_tristate GIT_TEST_HTTPD
+ if test "$GIT_TEST_HTTPD" = false
  then
-       skip_all="Network testing disabled (define GIT_TEST_HTTPD to enable)"
+       skip_all="Network testing disabled (unset GIT_TEST_HTTPD to enable)"
        test_done
  fi
  
@@@ -64,7 -65,7 +65,7 @@@ case $(uname) i
  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
@@@ -76,8 -77,7 +77,7 @@@ GIT_VALGRIND_OPTIONS=$GIT_VALGRIND_OPTI
  
  if ! test -x "$LIB_HTTPD_PATH"
  then
-       skip_all="skipping test, no web server found at '$LIB_HTTPD_PATH'"
-       test_done
+       test_skip_or_die $GIT_TEST_HTTPD "no web server found at '$LIB_HTTPD_PATH'"
  fi
  
  HTTPD_VERSION=`$LIB_HTTPD_PATH -v | \
@@@ -89,19 -89,20 +89,20 @@@ the
        then
                if ! test $HTTPD_VERSION -ge 2
                then
-                       skip_all="skipping test, at least Apache version 2 is required"
-                       test_done
+                       test_skip_or_die $GIT_TEST_HTTPD \
+                               "at least Apache version 2 is required"
                fi
                if ! test -d "$DEFAULT_HTTPD_MODULE_PATH"
                then
-                       skip_all="Apache module directory not found.  Skipping tests."
-                       test_done
+                       test_skip_or_die $GIT_TEST_HTTPD \
+                               "Apache module directory not found"
                fi
  
                LIB_HTTPD_MODULE_PATH="$DEFAULT_HTTPD_MODULE_PATH"
        fi
  else
-       error "Could not identify web server at '$LIB_HTTPD_PATH'"
+       test_skip_or_die $GIT_TEST_HTTPD \
+               "Could not identify web server at '$LIB_HTTPD_PATH'"
  fi
  
  prepare_httpd() {
@@@ -155,9 -156,8 +156,8 @@@ start_httpd() 
                >&3 2>&4
        if test $? -ne 0
        then
-               skip_all="skipping test, web server setup failed"
                trap 'die' EXIT
-               test_done
+               test_skip_or_die $GIT_TEST_HTTPD "web server setup failed"
        fi
  }