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

elek pushed a commit to branch trunk
in repository https://gitbox.apache.org/repos/asf/hadoop.git


The following commit(s) were added to refs/heads/trunk by this push:
     new 8baebb5  HDDS-2171. Dangling links in test report due to incompatible 
realpath
8baebb5 is described below

commit 8baebb54e13b518ead45e5afabdbf18c48e6efa8
Author: Doroszlai, Attila <[email protected]>
AuthorDate: Wed Sep 25 12:02:42 2019 +0200

    HDDS-2171. Dangling links in test report due to incompatible realpath
    
    Closes #1515
---
 hadoop-ozone/dev-support/checks/_mvn_unit_report.sh | 16 +++++++++++++---
 1 file changed, 13 insertions(+), 3 deletions(-)

diff --git a/hadoop-ozone/dev-support/checks/_mvn_unit_report.sh 
b/hadoop-ozone/dev-support/checks/_mvn_unit_report.sh
index 9525a9f..df19330 100755
--- a/hadoop-ozone/dev-support/checks/_mvn_unit_report.sh
+++ b/hadoop-ozone/dev-support/checks/_mvn_unit_report.sh
@@ -16,6 +16,16 @@
 
 REPORT_DIR=${REPORT_DIR:-$PWD}
 
+_realpath() {
+  if realpath "$@" > /dev/null; then
+    realpath "$@"
+  else
+    local relative_to
+    relative_to=$(realpath "${1/--relative-to=/}") || return 1
+    realpath "$2" | sed -e "s@${relative_to}/@@"
+  fi
+}
+
 ## generate summary txt file
 find "." -name 'TEST*.xml' -print0 \
     | xargs -n1 -0 "grep" -l -E "<failure|<error" \
@@ -41,7 +51,7 @@ while IFS= read -r -d '' dir; do
       DIR_OF_TESTFILE=$(dirname "$file")
       NAME_OF_TESTFILE=$(basename "$file")
       NAME_OF_TEST="${NAME_OF_TESTFILE%.*}"
-      DESTDIRNAME=$(realpath --relative-to="$PWD" "$DIR_OF_TESTFILE/../..")
+      DESTDIRNAME=$(_realpath --relative-to="$PWD" "$DIR_OF_TESTFILE/../..") 
|| continue
       mkdir -p "$REPORT_DIR/$DESTDIRNAME"
       #shellcheck disable=SC2086
       cp -r "$DIR_OF_TESTFILE"/*$NAME_OF_TEST* "$REPORT_DIR/$DESTDIRNAME/"
@@ -55,8 +65,8 @@ for TEST_RESULT_FILE in $(find "$REPORT_DIR" -name "*.txt" | 
grep -v output); do
     FAILURES=$(grep FAILURE "$TEST_RESULT_FILE" | grep "Tests run" | awk 
'{print $18}' | sort | uniq)
 
     for FAILURE in $FAILURES; do
-        TEST_RESULT_LOCATION="$(realpath --relative-to="$REPORT_DIR" 
"$TEST_RESULT_FILE")"
-        TEST_OUTPUT_LOCATION="${TEST_RESULT_LOCATION//.txt/-output.txt/}"
+        TEST_RESULT_LOCATION="$(_realpath --relative-to="$REPORT_DIR" 
"$TEST_RESULT_FILE")"
+        TEST_OUTPUT_LOCATION="${TEST_RESULT_LOCATION//.txt/-output.txt}"
         printf " * [%s](%s) ([output](%s))\n" "$FAILURE" 
"$TEST_RESULT_LOCATION" "$TEST_OUTPUT_LOCATION" >> "$SUMMARY_FILE"
     done
 done


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to