kudu-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From t...@apache.org
Subject [4/4] incubator-kudu git commit: build: run local tests parallel with distributed tests
Date Fri, 22 Jan 2016 04:25:57 GMT
build: run local tests parallel with distributed tests

This changes the order of the build slightly so that, if distributed
testing is enabled, it asynchronously submits the job to the dist-test
cluster, and then runs the non-distributed tests locally. When the
local tests are finished, it fetches and processes the results of the
dist-test job.

This shaves several minutes off the precommit build.

Change-Id: Iaac391210589a68b43900deb28abe9aff2fe5c76
Reviewed-on: http://gerrit.cloudera.org:8080/1815
Reviewed-by: Todd Lipcon <todd@apache.org>
Tested-by: Todd Lipcon <todd@apache.org>


Project: http://git-wip-us.apache.org/repos/asf/incubator-kudu/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-kudu/commit/3d4e0ce8
Tree: http://git-wip-us.apache.org/repos/asf/incubator-kudu/tree/3d4e0ce8
Diff: http://git-wip-us.apache.org/repos/asf/incubator-kudu/diff/3d4e0ce8

Branch: refs/heads/master
Commit: 3d4e0ce8af061eb574ca0bbe735e99c59e444266
Parents: 89380b5
Author: Todd Lipcon <todd@apache.org>
Authored: Fri Jan 15 18:06:18 2016 -0800
Committer: Todd Lipcon <todd@apache.org>
Committed: Fri Jan 22 04:23:03 2016 +0000

----------------------------------------------------------------------
 build-support/jenkins/build-and-test.sh | 141 +++++++++++++++------------
 1 file changed, 77 insertions(+), 64 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-kudu/blob/3d4e0ce8/build-support/jenkins/build-and-test.sh
----------------------------------------------------------------------
diff --git a/build-support/jenkins/build-and-test.sh b/build-support/jenkins/build-and-test.sh
index 6401a33..9e7ce15 100755
--- a/build-support/jenkins/build-and-test.sh
+++ b/build-support/jenkins/build-and-test.sh
@@ -260,66 +260,18 @@ fi
 
 EXIT_STATUS=0
 
-# Run the C++ unit tests.
+# If we're running distributed tests, submit them asynchronously while
+# we run the Java and Python tests.
 if [ "$ENABLE_DIST_TEST" == "1" ]; then
   export DIST_TEST_JOB_PATH=$BUILD_ROOT/dist-test-job-id
-  $SOURCE_ROOT/build-support/dist_test.py run-all || EXIT_STATUS=$?
-  $DIST_TEST_HOME/client.py fetch --artifacts -d $TEST_LOGDIR
-  # Fetching the artifacts expands each log into its own directory.
-  # Move them back into the main log directory
-  rm -f $TEST_LOGDIR/*zip
-  for arch_dir in $TEST_LOGDIR/* ; do
-    # In the case of sharded tests, we'll have multiple subdirs
-    # which contain files of the same name. We need to disambiguate
-    # when we move back. We can grab the shard index from the task name
-    # which is in the archive directory name.
-    shard_idx=$(echo $arch_dir | perl -ne '
-      if (/(\d+)$/) {
-        print $1;
-      } else {
-        print "unknown_shard";
-      }')
-    for log_file in $arch_dir/build/test-logs/* ; do
-      mv $log_file $TEST_LOGDIR/${shard_idx}_$(basename $log_file)
-    done
-    rm -Rf $arch_dir
-  done
+  rm -f $DIST_TEST_JOB_PATH
+  $SOURCE_ROOT/build-support/dist_test.py --no-wait run-all || EXIT_STATUS=$?
   # Still need to run a few non-dist-test-capable tests locally.
   EXTRA_TEST_FLAGS="$EXTRA_TEST_FLAGS -L no_dist_test"
 fi
 
 $THIRDPARTY_BIN/ctest -j$NUM_PROCS $EXTRA_TEST_FLAGS || EXIT_STATUS=$?
 
-if [ $EXIT_STATUS != 0 ]; then
-  # Tests that crash do not generate JUnit report XML files.
-  # We go through and generate a kind of poor-man's version of them in those cases.
-  for GTEST_OUTFILE in $TEST_LOGDIR/*.txt.gz; do
-    TEST_EXE=$(basename $GTEST_OUTFILE .txt.gz)
-    GTEST_XMLFILE="$TEST_LOGDIR/$TEST_EXE.xml"
-    if [ ! -f "$GTEST_XMLFILE" ]; then
-      echo "JUnit report missing:" \
-           "generating fake JUnit report file from $GTEST_OUTFILE and saving it to $GTEST_XMLFILE"
-      zcat $GTEST_OUTFILE | $SOURCE_ROOT/build-support/parse_test_failure.py -x > $GTEST_XMLFILE
-    fi
-  done
-fi
-
-# If all tests passed, ensure that they cleaned up their test output.
-#
-# TODO: Python is currently leaking a tmp directory sometimes (KUDU-1301).
-# Temporarily disabled until that's fixed.
-#
-# if [ $EXIT_STATUS == 0 ]; then
-#   TEST_TMPDIR_CONTENTS=$(ls $TEST_TMPDIR)
-#   if [ -n "$TEST_TMPDIR_CONTENTS" ]; then
-#     echo "All tests passed, yet some left behind their test output:"
-#     for SUBDIR in $TEST_TMPDIR_CONTENTS; do
-#       echo $SUBDIR
-#     done
-#     EXIT_STATUS=1
-#   fi
-# fi
-
 if [ "$DO_COVERAGE" == "1" ]; then
   echo Generating coverage report...
   ./thirdparty/gcovr-3.0/scripts/gcovr -r .  -e '.*\.pb\..*' --xml \
@@ -346,18 +298,6 @@ if [ "$BUILD_JAVA" == "1" ]; then
   popd
 fi
 
-if [ "$HEAPCHECK" = normal ]; then
-  FAILED_TESTS=$(zgrep -L -- "WARNING: Perftools heap leak checker is active -- Performance
may suffer" build/test-logs/*-test.txt*)
-  if [ -n "$FAILED_TESTS" ]; then
-    echo "Some tests didn't heap check properly:"
-    for FTEST in $FAILED_TESTS; do
-      echo $FTEST
-    done
-    EXIT_STATUS=1
-  else
-    echo "All tests heap checked properly"
-  fi
-fi
 
 if [ "$BUILD_PYTHON" == "1" ]; then
   # Failing to compile the Python client should result in a build failure
@@ -379,8 +319,81 @@ if [ "$BUILD_PYTHON" == "1" ]; then
   python setup.py test \
     --addopts="kudu --junit-xml=$KUDU_BUILD/test-logs/python_client.xml" \
     2> $KUDU_BUILD/test-logs/python_client.log || EXIT_STATUS=$?
+
+  popd
+fi
+
+# If we submitted the tasks earlier, go fetch the results now
+if [ "$ENABLE_DIST_TEST" == "1" ]; then
+  echo Fetching previously submitted dist-test results...
+  $DIST_TEST_HOME/client.py watch || EXIT_STATUS=$?
+  DT_DIR=$TEST_LOGDIR/dist-test-out
+  rm -Rf $DT_DIR
+  $DIST_TEST_HOME/client.py fetch --artifacts -d $DT_DIR
+  # Fetching the artifacts expands each log into its own directory.
+  # Move them back into the main log directory
+  rm -f $DT_DIR/*zip
+  for arch_dir in $DT_DIR/* ; do
+    # In the case of sharded tests, we'll have multiple subdirs
+    # which contain files of the same name. We need to disambiguate
+    # when we move back. We can grab the shard index from the task name
+    # which is in the archive directory name.
+    shard_idx=$(echo $arch_dir | perl -ne '
+      if (/(\d+)$/) {
+        print $1;
+      } else {
+        print "unknown_shard";
+      }')
+    for log_file in $arch_dir/build/test-logs/* ; do
+      mv $log_file $TEST_LOGDIR/${shard_idx}_$(basename $log_file)
+    done
+    rm -Rf $arch_dir
+  done
+fi
+
+if [ "$HEAPCHECK" = normal ]; then
+  FAILED_TESTS=$(zgrep -L -- "WARNING: Perftools heap leak checker is active -- Performance
may suffer" build/test-logs/*-test.txt*)
+  if [ -n "$FAILED_TESTS" ]; then
+    echo "Some tests didn't heap check properly:"
+    for FTEST in $FAILED_TESTS; do
+      echo $FTEST
+    done
+    EXIT_STATUS=1
+  else
+    echo "All tests heap checked properly"
+  fi
+fi
+
+if [ $EXIT_STATUS != 0 ]; then
+  # Tests that crash do not generate JUnit report XML files.
+  # We go through and generate a kind of poor-man's version of them in those cases.
+  for GTEST_OUTFILE in $TEST_LOGDIR/*.txt.gz; do
+    TEST_EXE=$(basename $GTEST_OUTFILE .txt.gz)
+    GTEST_XMLFILE="$TEST_LOGDIR/$TEST_EXE.xml"
+    if [ ! -f "$GTEST_XMLFILE" ]; then
+      echo "JUnit report missing:" \
+           "generating fake JUnit report file from $GTEST_OUTFILE and saving it to $GTEST_XMLFILE"
+      zcat $GTEST_OUTFILE | $SOURCE_ROOT/build-support/parse_test_failure.py -x > $GTEST_XMLFILE
+    fi
+  done
 fi
 
+# If all tests passed, ensure that they cleaned up their test output.
+#
+# TODO: Python is currently leaking a tmp directory sometimes (KUDU-1301).
+# Temporarily disabled until that's fixed.
+#
+# if [ $EXIT_STATUS == 0 ]; then
+#   TEST_TMPDIR_CONTENTS=$(ls $TEST_TMPDIR)
+#   if [ -n "$TEST_TMPDIR_CONTENTS" ]; then
+#     echo "All tests passed, yet some left behind their test output:"
+#     for SUBDIR in $TEST_TMPDIR_CONTENTS; do
+#       echo $SUBDIR
+#     done
+#     EXIT_STATUS=1
+#   fi
+# fi
+
 set -e
 
 exit $EXIT_STATUS


Mime
View raw message