Skip to content

Commit

Permalink
Merge pull request #115 from astoica1/FISH-10057-fix-security-tck-tes…
Browse files Browse the repository at this point in the history
…t-results

FISH-10057: added custom failsafe xml parser for security tck
  • Loading branch information
astoica1 authored Nov 25, 2024
2 parents 1578767 + 8c20e57 commit 1adf539
Showing 1 changed file with 41 additions and 0 deletions.
41 changes: 41 additions & 0 deletions security-tck/summary-tck.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
#!/bin/bash

# Function to parse an xml file. Returns $E and $C, $E being the Entity, $C the Content
rdom () { local IFS=\> ; read -d \< E C ;}

# Find every failsafe-summary.xml in the child folders and list them in a file
find target/security-tck*/tck -iname 'failsafe-summary.xml' -type f > summarylist.txt
COMPLETED=0
ERRORS=0
FAILURES=0
SKIPPED=0

# For each element of the file list, parse them to find the number of completed/errors/failures/skipped tests
while read File;
do
while rdom;
do
if [[ $E = "completed" ]]; then
COMPLETED=$(($COMPLETED + $C))
elif [[ $E = "errors" ]]; then
ERRORS=$(($ERRORS + $C))
elif [[ $E = "failures" ]]; then
FAILURES=$(($FAILURES + $C))
elif [[ $E = "skipped" ]]; then
SKIPPED=$(($SKIPPED + $C))
fi
done < $File
done < summarylist.txt

#Create a specific failsafe-summary-custom.xml to aggregate the results in one file
echo '<?xml version="1.0" encoding="UTF-8"?>' > failsafe-summary-custom.xml
echo '<failsafe-summary xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="https://maven.apache.org/surefire/maven-surefire-plugin/xsd/failsafe-summary.xsd" result="254" timeout="false">' >> failsafe-summary-custom.xml
echo ' <completed>'$COMPLETED'</completed>' >> failsafe-summary-custom.xml
echo ' <errors>'$ERRORS'</errors>' >> failsafe-summary-custom.xml
echo ' <failures>'$FAILURES'</failures>' >> failsafe-summary-custom.xml
echo ' <skipped>'$SKIPPED'</skipped>' >> failsafe-summary-custom.xml
echo ' <failureMessage xsi:nil="true" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"/>' >> failsafe-summary-custom.xml
echo '</failsafe-summary>' >> failsafe-summary-custom.xml

# Clean the list of files
rm summarylist.txt

0 comments on commit 1adf539

Please sign in to comment.