-
Notifications
You must be signed in to change notification settings - Fork 256
[QE] manage absence of xml filter to process xml result #4935
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -63,10 +63,16 @@ cd $targetFolder/bin | |||||||||||||||||||||||||||||||||||||||||||||||
| cd .. | ||||||||||||||||||||||||||||||||||||||||||||||||
| init_line=$(grep -n '<?xml version="1.0" encoding="UTF-8"?>' results/e2e.results | awk '{split($0,n,":"); print n[1]}') | ||||||||||||||||||||||||||||||||||||||||||||||||
| if ! command -v xsltproc &>/dev/null | ||||||||||||||||||||||||||||||||||||||||||||||||
| then | ||||||||||||||||||||||||||||||||||||||||||||||||
| sudo yum install -y xsltproc || echo "Warning: Failed to install xsltproc" | ||||||||||||||||||||||||||||||||||||||||||||||||
| then | ||||||||||||||||||||||||||||||||||||||||||||||||
| sudo yum install -y xsltproc || sudo yum install -y --nogpgcheck xsltproc || echo "Warning: Failed to install xsltproc" | ||||||||||||||||||||||||||||||||||||||||||||||||
| fi | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Comment on lines
+66
to
+68
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Install the correct package; avoid sudo hangs; gate --nogpgcheck behind an opt‑in. On RHEL, the xsltproc binary is provided by the libxslt package. yum install xsltproc commonly fails with “No match”. Also, sudo may not exist or can hang awaiting a TTY. Finally, installing with --nogpgcheck should be opt‑in to reduce supply‑chain risk. Apply this diff to harden installation: -then
- sudo yum install -y xsltproc || sudo yum install -y --nogpgcheck xsltproc || echo "Warning: Failed to install xsltproc"
-fi
+then
+ # Choose package manager
+ PM=""
+ if command -v dnf &>/dev/null; then PM="dnf"; elif command -v yum &>/dev/null; then PM="yum"; fi
+ # Prefer running without sudo if already root; use non‑interactive sudo if available
+ SUDO=""
+ if [ "$EUID" -ne 0 ] && command -v sudo &>/dev/null; then SUDO="sudo -n"; fi
+ if [ -n "$PM" ]; then
+ # xsltproc is provided by libxslt on RHEL/Fedora
+ if ! $SUDO $PM -y install libxslt; then
+ if [ "${CRC_ALLOW_UNSIGNED:=}" = "1" ]; then
+ $SUDO $PM -y --nogpgcheck install libxslt || echo "Warning: Failed to install libxslt/xsltproc." >&2
+ else
+ echo "Warning: xsltproc missing and unsigned packages not allowed (set CRC_ALLOW_UNSIGNED=1 to allow pre-release unsigned install)." >&2
+ fi
+ fi
+ else
+ echo "Warning: No supported package manager found to install xsltproc." >&2
+ fi
+fi📝 Committable suggestion
Suggested change
|
||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||
| if command -v xsltproc &>/dev/null | ||||||||||||||||||||||||||||||||||||||||||||||||
| then | ||||||||||||||||||||||||||||||||||||||||||||||||
| tail -n +$init_line results/e2e.results | xsltproc filter.xsl - > results/$junitFilename | ||||||||||||||||||||||||||||||||||||||||||||||||
| else | ||||||||||||||||||||||||||||||||||||||||||||||||
| tail -n +$init_line results/e2e.results > results/$junitFilename | ||||||||||||||||||||||||||||||||||||||||||||||||
| fi | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Comment on lines
+70
to
75
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Emit valid JUnit XML when xsltproc is unavailable. Writing a raw tail into an .xml file produces invalid JUnit and can break report consumers. Generate a minimal, valid JUnit report embedding raw output in a failure message. -if command -v xsltproc &>/dev/null
-then
- tail -n +$init_line results/e2e.results | xsltproc filter.xsl - > results/$junitFilename
-else
- tail -n +$init_line results/e2e.results > results/$junitFilename
-fi
+if command -v xsltproc &>/dev/null
+then
+ tail -n +${init_line:-1} "results/e2e.results" | xsltproc "filter.xsl" - > "results/$junitFilename"
+else
+ {
+ echo '<?xml version="1.0" encoding="UTF-8"?>'
+ echo '<testsuite name="crc-e2e" tests="1" failures="1">'
+ echo ' <testcase classname="crc.e2e" name="xsltproc-missing">'
+ echo ' <failure message="xsltproc not available; emitting raw results">'
+ echo '<![CDATA['
+ tail -n +${init_line:-1} "results/e2e.results"
+ echo ']]>'
+ echo ' </failure>'
+ echo ' </testcase>'
+ echo '</testsuite>'
+ } > "results/$junitFilename"
+fi🤖 Prompt for AI Agents |
||||||||||||||||||||||||||||||||||||||||||||||||
| tail -n +$init_line results/e2e.results | xsltproc filter.xsl - > results/$junitFilename | ||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||
| # Copy logs and diagnose | ||||||||||||||||||||||||||||||||||||||||||||||||
| cp -r bin/out/test-results/* results | ||||||||||||||||||||||||||||||||||||||||||||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why we want to have a non signed package installed?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We are waiting for pre release RHEL to confirm if recent non signed packages is a mistake.
This is just a workaround, but probably we will refuse this change