This is an automated email from the ASF dual-hosted git repository.

adoroszlai pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/hadoop-ozone.git


The following commit(s) were added to refs/heads/master by this push:
     new 86bd3b3  HDDS-3862. Prepare checks for running some tests multiple 
times (#1128)
86bd3b3 is described below

commit 86bd3b3659ed3801339851da021e92b6b6677769
Author: Doroszlai, Attila <6454655+adorosz...@users.noreply.github.com>
AuthorDate: Thu Jul 2 21:07:03 2020 +0200

    HDDS-3862. Prepare checks for running some tests multiple times (#1128)
---
 .../dev-support/checks/_mvn_unit_report.sh         | 14 ++++---
 hadoop-ozone/dev-support/checks/integration.sh     | 25 +----------
 .../checks/{integration.sh => junit.sh}            | 49 ++++++++++++++++------
 hadoop-ozone/dev-support/checks/unit.sh            | 24 +----------
 4 files changed, 48 insertions(+), 64 deletions(-)

diff --git a/hadoop-ozone/dev-support/checks/_mvn_unit_report.sh 
b/hadoop-ozone/dev-support/checks/_mvn_unit_report.sh
index 682de9e..2d9b37c 100755
--- a/hadoop-ozone/dev-support/checks/_mvn_unit_report.sh
+++ b/hadoop-ozone/dev-support/checks/_mvn_unit_report.sh
@@ -27,17 +27,18 @@ _realpath() {
 }
 
 ## generate summary txt file
-find "." -name 'TEST*.xml' -print0 \
+find "." -not -path '*/iteration*' -name 'TEST*.xml' -print0 \
     | xargs -n1 -0 "grep" -l -E "<failure|<error" \
     | awk -F/ '{sub("'"TEST-"'",""); sub(".xml",""); print $NF}' \
     | tee "$REPORT_DIR/summary.txt"
 
 #Copy heap dump and dump leftovers
-find "." -name "*.hprof" \
+find "." -not -path '*/iteration*' \
+    \( -name "*.hprof" \
     -or -name "*.dump" \
     -or -name "*.dumpstream" \
-    -or -name "hs_err_*.log" \
-  -exec cp {} "$REPORT_DIR/" \;
+    -or -name "hs_err_*.log" \) \
+  -exec mv {} "$REPORT_DIR/" \;
 
 ## Add the tests where the JVM is crashed
 grep -A1 'Crashed tests' "${REPORT_DIR}/output.log" \
@@ -58,11 +59,12 @@ grep -e 'Running org' -e 'Tests run: .* in org' 
"${REPORT_DIR}/output.log" \
 
 #Collect of all of the report files of FAILED tests
 for failed_test in $(< ${REPORT_DIR}/summary.txt); do
-  for file in $(find "." -name "${failed_test}.txt" -or -name 
"${failed_test}-output.txt" -or -name "TEST-${failed_test}.xml"); do
+  for file in $(find "." -not -path '*/iteration*' \
+      \( -name "${failed_test}.txt" -or -name "${failed_test}-output.txt" -or 
-name "TEST-${failed_test}.xml" \)); do
     dir=$(dirname "${file}")
     dest_dir=$(_realpath --relative-to="${PWD}" "${dir}/../..") || continue
     mkdir -p "${REPORT_DIR}/${dest_dir}"
-    cp "${file}" "${REPORT_DIR}/${dest_dir}"/
+    mv "${file}" "${REPORT_DIR}/${dest_dir}"/
   done
 done
 
diff --git a/hadoop-ozone/dev-support/checks/integration.sh 
b/hadoop-ozone/dev-support/checks/integration.sh
index 7ffd6e5..3673518 100755
--- a/hadoop-ozone/dev-support/checks/integration.sh
+++ b/hadoop-ozone/dev-support/checks/integration.sh
@@ -14,27 +14,6 @@
 # See the License for the specific language governing permissions and
 # limitations under the License.
 
-set -o pipefail
-
 DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
-cd "$DIR/../../.." || exit 1
-
-REPORT_DIR=${OUTPUT_DIR:-"$DIR/../../../target/integration"}
-mkdir -p "$REPORT_DIR"
-
-export MAVEN_OPTS="-Xmx4096m"
-mvn -B install -DskipTests -Dskip.npx -Dskip.installnpx
-mvn -B -fae test -Dskip.npx -Dskip.installnpx -pl 
:hadoop-ozone-integration-test,:mini-chaos-tests "$@" \
-  | tee "${REPORT_DIR}/output.log"
-rc=$?
-
-#Archive combined jacoco records
-mvn -B -N jacoco:merge -Djacoco.destFile=$REPORT_DIR/jacoco-combined.exec
-
-# shellcheck source=hadoop-ozone/dev-support/checks/_mvn_unit_report.sh
-source "$DIR/_mvn_unit_report.sh"
-
-if [[ -s "$REPORT_DIR/summary.txt" ]] ; then
-    exit 1
-fi
-exit ${rc}
+CHECK=integration
+source "${DIR}/junit.sh" -pl :hadoop-ozone-integration-test,:mini-chaos-tests 
"$@"
diff --git a/hadoop-ozone/dev-support/checks/integration.sh 
b/hadoop-ozone/dev-support/checks/junit.sh
old mode 100755
new mode 100644
similarity index 54%
copy from hadoop-ozone/dev-support/checks/integration.sh
copy to hadoop-ozone/dev-support/checks/junit.sh
index 7ffd6e5..fbb9a61
--- a/hadoop-ozone/dev-support/checks/integration.sh
+++ b/hadoop-ozone/dev-support/checks/junit.sh
@@ -14,27 +14,50 @@
 # See the License for the specific language governing permissions and
 # limitations under the License.
 
-set -o pipefail
+set -u -o pipefail
 
 DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
 cd "$DIR/../../.." || exit 1
 
-REPORT_DIR=${OUTPUT_DIR:-"$DIR/../../../target/integration"}
-mkdir -p "$REPORT_DIR"
+: ${CHECK:="unit"}
+: ${ITERATIONS:="1"}
 
 export MAVEN_OPTS="-Xmx4096m"
-mvn -B install -DskipTests -Dskip.npx -Dskip.installnpx
-mvn -B -fae test -Dskip.npx -Dskip.installnpx -pl 
:hadoop-ozone-integration-test,:mini-chaos-tests "$@" \
-  | tee "${REPORT_DIR}/output.log"
-rc=$?
+MAVEN_OPTIONS='-B -Dskip.npx -Dskip.installnpx'
+mvn ${MAVEN_OPTIONS} -DskipTests clean install
+
+REPORT_DIR=${OUTPUT_DIR:-"$DIR/../../../target/${CHECK}"}
+mkdir -p "$REPORT_DIR"
+
+rc=0
+for i in $(seq 1 ${ITERATIONS}); do
+  if [[ ${ITERATIONS} -gt 1 ]]; then
+    original_report_dir="${REPORT_DIR}"
+    REPORT_DIR="${original_report_dir}/iteration${i}"
+    mkdir -p "${REPORT_DIR}"
+  fi
+
+  mvn ${MAVEN_OPTIONS} -fae "$@" test \
+    | tee "${REPORT_DIR}/output.log"
+  irc=$?
+
+  # shellcheck source=hadoop-ozone/dev-support/checks/_mvn_unit_report.sh
+  source "${DIR}/_mvn_unit_report.sh"
+  if [[ ${irc} == 0 ]] && [[ -s "${REPORT_DIR}/summary.txt" ]]; then
+    irc=1
+  fi
+
+  if [[ ${ITERATIONS} -gt 1 ]]; then
+    REPORT_DIR="${original_report_dir}"
+    echo "Iteration ${i} exit code: ${irc}" | tee -a 
"${REPORT_DIR}/summary.txt"
+  fi
+
+  if [[ ${rc} == 0 ]]; then
+    rc=${irc}
+  fi
+done
 
 #Archive combined jacoco records
 mvn -B -N jacoco:merge -Djacoco.destFile=$REPORT_DIR/jacoco-combined.exec
 
-# shellcheck source=hadoop-ozone/dev-support/checks/_mvn_unit_report.sh
-source "$DIR/_mvn_unit_report.sh"
-
-if [[ -s "$REPORT_DIR/summary.txt" ]] ; then
-    exit 1
-fi
 exit ${rc}
diff --git a/hadoop-ozone/dev-support/checks/unit.sh 
b/hadoop-ozone/dev-support/checks/unit.sh
index 1b76c8d..22139b5 100755
--- a/hadoop-ozone/dev-support/checks/unit.sh
+++ b/hadoop-ozone/dev-support/checks/unit.sh
@@ -14,26 +14,6 @@
 # See the License for the specific language governing permissions and
 # limitations under the License.
 
-set -o pipefail
-
 DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
-cd "$DIR/../../.." || exit 1
-
-REPORT_DIR=${OUTPUT_DIR:-"$DIR/../../../target/unit"}
-mkdir -p "$REPORT_DIR"
-
-export MAVEN_OPTS="-Xmx4096m"
-mvn -B -DskipShade -Dskip.npx -Dskip.installnpx -fae test -pl 
\!:hadoop-ozone-integration-test,\!:mini-chaos-tests "$@" \
-  | tee "${REPORT_DIR}/output.log"
-rc=$?
-
-#Archive combined jacoco records
-mvn -B -N jacoco:merge -Djacoco.destFile=$REPORT_DIR/jacoco-combined.exec
-
-# shellcheck source=hadoop-ozone/dev-support/checks/_mvn_unit_report.sh
-source "$DIR/_mvn_unit_report.sh"
-
-if [[ -s "$REPORT_DIR/summary.txt" ]] ; then
-    exit 1
-fi
-exit ${rc}
+CHECK=unit
+source "${DIR}/junit.sh" -pl 
\!:hadoop-ozone-integration-test,\!:mini-chaos-tests "$@"


---------------------------------------------------------------------
To unsubscribe, e-mail: ozone-commits-unsubscr...@hadoop.apache.org
For additional commands, e-mail: ozone-commits-h...@hadoop.apache.org

Reply via email to