[Groonga-commit] groonga/groonga [master] test function: use by N workers by default

Back to archive index

Kouhei Sutou null+****@clear*****
Sun Aug 12 12:14:32 JST 2012


Kouhei Sutou	2012-08-12 12:14:32 +0900 (Sun, 12 Aug 2012)

  New Revision: d05dac9cb9020be424bafba2f5e0033f12158151
  https://github.com/groonga/groonga/commit/d05dac9cb9020be424bafba2f5e0033f12158151

  Log:
    test function: use by N workers by default

  Modified files:
    test/function/run-test.sh

  Modified: test/function/run-test.sh (+27 -2)
===================================================================
--- test/function/run-test.sh    2012-08-12 12:07:08 +0900 (c1d2c91)
+++ test/function/run-test.sh    2012-08-12 12:14:32 +0900 (d8a0e85)
@@ -9,8 +9,25 @@ export BUILD_DIR
 top_dir="$BUILD_DIR/../.."
 top_dir=$(cd -P "$top_dir" 2>/dev/null || cd "$top_dir"; pwd)
 
+n_processors=1
+case `uname` in
+    Linux)
+	n_processors="$(grep '^processor' /proc/cpuinfo | wc -l)"
+	;;
+    Darwin)
+	n_processors="$(/usr/sbin/sysctl -n hw.ncpu)"
+	;;
+    *)
+	:
+	;;
+esac
+
 if test x"$NO_MAKE" != x"yes"; then
-    make -C $top_dir > /dev/null || exit 1
+    MAKE_ARGS=
+    if test $n_processors -gt 1; then
+	MAKE_ARGS="${MAKE_ARGS} -j${n_processors}"
+    fi
+    make -C $top_dir ${MAKE_ARGS} > /dev/null || exit 1
 fi
 
 if test -z "$RUBY"; then
@@ -56,14 +73,19 @@ if ! test -d "$grntest_dir"; then
 fi
 
 have_targets="false"
+use_gdb="false"
 next_argument_is_long_option_value="false"
 for argument in "$@"; do
     case "$argument" in
 	--*=*)
 	    ;;
-	--keep-database|--no-*|--gdb|--version|--help)
+	--keep-database|--no-*|--version|--help)
 	    # no argument options
 	    ;;
+	--gdb)
+	    # no argument options
+	    use_gdb="true"
+	    ;;
 	--*)
 	    next_argument_is_long_option_value="true"
 	    continue
@@ -80,6 +102,9 @@ for argument in "$@"; do
 done
 
 grntest_options=("$@")
+if test "$use_gdb" != "true"; then
+    grntest_options=("--n-workers" "${n_processors}" "${grntest_options[@]}")
+fi
 if test "$have_targets" != "true"; then
     grntest_options=("${grntest_options[@]}" "${BASE_DIR}/suite")
 fi
-------------- next part --------------
HTML����������������������������...
Download 



More information about the Groonga-commit mailing list
Back to archive index