ambari-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From nc...@apache.org
Subject [04/23] ambari git commit: AMBARI-14349. Hadoop QA tests should skip ambari-server surefire tests if the patch doesnt include java changes (Nahappan Somasundaram via smohanty)
Date Mon, 11 Jan 2016 14:38:40 GMT
AMBARI-14349. Hadoop QA tests should skip ambari-server surefire tests if the patch doesnt
include java changes (Nahappan Somasundaram via smohanty)


Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/6633c6e7
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/6633c6e7
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/6633c6e7

Branch: refs/heads/branch-dev-patch-upgrade
Commit: 6633c6e7b9e8e651ecdad946cc86483d8090f205
Parents: 96c0b4b
Author: Sumit Mohanty <smohanty@hortonworks.com>
Authored: Fri Jan 8 14:37:04 2016 -0800
Committer: Sumit Mohanty <smohanty@hortonworks.com>
Committed: Fri Jan 8 14:37:04 2016 -0800

----------------------------------------------------------------------
 dev-support/test-patch.sh | 43 ++++++++++++++++++++++++++++++++++++++++--
 1 file changed, 41 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/6633c6e7/dev-support/test-patch.sh
----------------------------------------------------------------------
diff --git a/dev-support/test-patch.sh b/dev-support/test-patch.sh
index fed1935..222a79a 100755
--- a/dev-support/test-patch.sh
+++ b/dev-support/test-patch.sh
@@ -680,13 +680,52 @@ of hadoop-common prior to running the unit tests in $ordered_modules"
   fi
   failed_test_builds=""
   test_timeouts=""
+
+  # Get the list of modified files
+  TMP=/tmp/tmp.paths.$$
+
+  $GREP '^+++ \|^--- ' $PATCH_DIR/patch | cut -c '5-' | $GREP -v /dev/null | sort > $TMP
+
+  # if all of the lines start with a/ or b/, then this is a git patch that
+  # was generated without --no-prefix
+  if ! $GREP -qv '^a/\|^b/' $TMP ; then
+    sed -i -e 's,^[ab]/,,' $TMP
+  fi
+
   for module in $ordered_modules; do
     cd $module
+    skip_surefiretests=1
     module_suffix=`basename ${module}`
+
+    echo "Get the list of files modified in module $module"
+
+    # Come up with a list of changed files for $module into $MODULE_FILES
+    MODULE_FILES=/tmp/${module_suffix}_files.txt
+    $GREP $module $TMP > $MODULE_FILES
+    module_files=$(cat $MODULE_FILES)
+
+    for module_filename in $module_files; do
+      file_ext=$(echo $module_filename | awk -F . '{if (NF>1) {print $NF}}')
+      # Look for java extension
+      if [[ "$file_ext" == "java" ]]; then
+        skip_surefiretests=0
+        break
+      fi
+    done
+
     test_logfile=$PATCH_DIR/testrun_${module_suffix}.txt
     echo "  Running tests in $module"
-    echo "  $MVN clean install -fn  -D${PROJECT_NAME}PatchProcess"
-    $MVN clean install -fae -D${PROJECT_NAME}PatchProcess > $test_logfile 2>&1
+
+    # Skip java tests if this module did not have changes to java files
+    if [[ $skip_surefiretests -eq 0 ]];
+    then
+      echo "  $MVN clean install -fae  -D${PROJECT_NAME}PatchProcess"
+      $MVN clean install -fae -D${PROJECT_NAME}PatchProcess > $test_logfile 2>&1
+    else
+      echo "  $MVN clean install -fae  -D${PROJECT_NAME}PatchProcess -DskipSurefireTests"
+      $MVN clean install -fae -D${PROJECT_NAME}PatchProcess -DskipSurefireTests > $test_logfile
2>&1
+    fi
+
     test_build_result=$?
     cat $test_logfile
     # module_test_timeouts=`$AWK '/^Running / { if (last) { print last } last=$2 } /^Tests
run: / { last="" }' $test_logfile`


Mime
View raw message