snvijaya commented on code in PR #3124:
URL: https://github.com/apache/hadoop/pull/3124#discussion_r990038530


##########
hadoop-tools/hadoop-azure/.gitignore:
##########
@@ -1,5 +1,6 @@
 .checkstyle
 bin/
-src/test/resources/combinationConfigFiles
 src/test/resources/abfs-combination-test-configs.xml
 dev-support/testlogs
+src/test/resources/accountSettings/*
+!src/test/resources/accountSettings/accountName_settings.xml.template

Review Comment:
   Done



##########
hadoop-tools/hadoop-azure/dev-support/testrun-scripts/testsupport.sh:
##########
@@ -134,108 +105,68 @@ summary() {
     echo "$combination"
     echo "========================"
     pcregrep -M "$testresultsregex" "$testlogfilename"
-  } >> "$testresultsfilename"
+  } >> "$aggregatedTestResult"
   printf "\n----- Test results -----\n"
   pcregrep -M "$testresultsregex" "$testlogfilename"
-
   secondstaken=$((ENDTIME - STARTTIME))
   mins=$((secondstaken / 60))
   secs=$((secondstaken % 60))
   printf "\nTime taken: %s mins %s secs.\n" "$mins" "$secs"
-  echo "Find test logs for the combination ($combination) in: $testlogfilename"
-  echo "Find consolidated test results in: $testresultsfilename"
-  echo "----------"
+  echo "Find test result for the combination ($combination) in: 
$testlogfilename"
+  logOutput "Consolidated test result is saved in: $aggregatedTestResult"
+  echo "------------------------"
 }
 
-init() {
-  checkdependencies
-  if ! mvn clean install -DskipTests
-  then
-    echo ""
-    echo "Exiting. Build failed."
-    exit -1
+checkdependencies() {
+  if ! [ "$(command -v pcregrep)" ]; then
+    logOutput "Exiting. pcregrep is required to run the script."
+    exit 1
   fi
-  starttime=$(date +"%Y-%m-%d_%H-%M-%S")
-  mkdir -p "$logdir"
-  testresultsfilename="$logdir/$starttime/Test-Results.txt"
-  if [[ -z "$combinations" ]]; then
-    combinations=( $( ls $combconfsdir/*.xml ))
+  if ! [ "$(command -v xmlstarlet)" ]; then
+    logOutput "Exiting. xmlstarlet is required to run the script."
+    exit 1
   fi
 }
 
-runtests() {
-  parseoptions "$@"
-  validate
-  if [ -z "$starttime" ]; then
-    init
-  fi
-  shopt -s nullglob
-  for combconffile in "${combinations[@]}"; do
-    STARTTIME=$(date +%s)
-    combination=$(basename "$combconffile" .xml)
-    mkdir -p "$logdir/$starttime"
-    testlogfilename="$logdir/$starttime/Test-Logs-$combination.txt"
-    printf "\nRunning the combination: %s..." "$combination"
-    setactiveconf
-    mvn -T 1C -Dparallel-tests=abfs -Dscale -DtestsThreadCount=$threadcount 
verify >> "$testlogfilename" || true
-    ENDTIME=$(date +%s)
-    summary
-  done
+formatxml() {
+  xmlstarlet fo -s 2 "$1" > "$1.tmp"
+  mv "$1.tmp" "$1"
 }
 
-begin() {
-  cleancombinationconfigs
+changeconf() {
+  xmlstarlet ed -P -L -d "/configuration/property[name='$1']" "$combtestfile"
+  xmlstarlet ed -P -L -s /configuration -t elem -n propertyTMP -v "" -s 
/configuration/propertyTMP -t elem -n name -v "$1" -r 
/configuration/propertyTMP -v property "$combtestfile"
+  if ! xmlstarlet ed -P -L -s "/configuration/property[name='$1']" -t elem -n 
value -v "$2" "$combtestfile"
+  then
+    logOutput "Exiting. Changing config property failed."
+    exit 1
+  fi
 }
 
-parseoptions() {
-runactivate=0
-runtests=0
-  while getopts ":c:a:t:" option; do
-    case "${option}" in
-      a)
-        if [[ "$runactivate" -eq "1" ]]; then
-          echo "-a Option is not multivalued"
-          exit 1
-        fi
-        runactivate=1
-        combination=$(basename "$OPTARG" .xml)
-        ;;
-      c)
-        runtests=1
-        combination=$(basename "$OPTARG" .xml)
-        combinations+=("$combination")
-        ;;
-      t)
-        threadcount=$OPTARG
-        ;;
-      *|?|h)
-        if [[ -z "$combinations" ]]; then
-          combinations=( $( ls $combconfsdir/*.xml ))
-        fi
-      combstr=""
-        for combconffile in "${combinations[@]}"; do
-          combname=$(basename "$combconffile" .xml)
-          combstr="${combname}, ${combstr}"
-        done
-        combstr=${combstr:0:-2}
-
-        echo "Usage: $0 [-n] [-a COMBINATION_NAME] [-c COMBINATION_NAME] [-t 
THREAD_COUNT]"
-        echo ""
-        echo "Where:"
-        echo "  -a COMBINATION_NAME   Specify the combination name which needs 
to be activated."
-        echo "                        Configured combinations: ${combstr}"
-        echo "  -c COMBINATION_NAME   Specify the combination name for test 
runs"
-        echo "  -t THREAD_COUNT       Specify the thread count"
-        exit 1
-        ;;
-    esac
-  done
-  if [[ "$runactivate" -eq "1" && "$runtests" -eq "1" ]]; then
-    echo "Both activate (-a option) and test run combinations (-c option) 
cannot be specified together"
+init() {
+  checkdependencies
+  if ! mvn clean install -DskipTests
+  then
+    echo ""
+    echo "Exiting. Build failed."
     exit 1
   fi
-  if [[ "$runactivate" -eq "1" ]]; then
-        setactiveconf
-        exit 0
-  fi
-}
+  starttime=$(date +"%Y-%m-%d_%H-%M-%S")
+  testOutputLogFolder+=$starttime
+  mkdir -p "$testOutputLogFolder"
+  aggregatedTestResult="$testOutputLogFolder/Test-Results.txt"
+ }
+
+ printAggregate() {
+   echo  :::: AGGREGATED TEST RESULT ::::
+   cat "$aggregatedTestResult"
+  fullRunEndTime=$(date +%s)
+  fullRunTimeInSecs=$((fullRunEndTime - fullRunStartTime))
+  mins=$((fullRunTimeInSecs / 60))
+  secs=$((fullRunTimeInSecs % 60))
+  printf "\nTime taken: %s mins %s secs.\n" "$mins" "$secs"
+ }
+
+logOutput() {
+  echo -e "$outputFormatOn" "$1" "$outputFormatOff"
+}

Review Comment:
   Done



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


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

Reply via email to