This repository was archived by the owner on May 28, 2025. It is now read-only.
File tree Expand file tree Collapse file tree 5 files changed +56
-0
lines changed
tests/run-make/libtest-junit Expand file tree Collapse file tree 5 files changed +56
-0
lines changed Original file line number Diff line number Diff line change 1+ # ignore-cross-compile
2+ include ../tools.mk
3+
4+ # Test expected libtest's junit output
5+
6+ OUTPUT_FILE_DEFAULT := $(TMPDIR ) /libtest-junit-output-default.xml
7+ OUTPUT_FILE_STDOUT_SUCCESS := $(TMPDIR ) /libtest-junit-output-stdout-success.xml
8+
9+ all : f.rs validate_junit.py output-default.xml output-stdout-success.xml
10+ $(RUSTC ) --test f.rs
11+ RUST_BACKTRACE=0 $(call RUN,f) -Z unstable-options --test-threads=1 --format=junit > $(OUTPUT_FILE_DEFAULT ) || true
12+ RUST_BACKTRACE=0 $(call RUN,f) -Z unstable-options --test-threads=1 --format=junit --show-output > $(OUTPUT_FILE_STDOUT_SUCCESS ) || true
13+
14+ cat $(OUTPUT_FILE_DEFAULT) | "$(PYTHON)" validate_junit.py
15+ cat $(OUTPUT_FILE_STDOUT_SUCCESS) | "$(PYTHON)" validate_junit.py
16+
17+ # Normalize the actual output and compare to expected output file
18+ cat $(OUTPUT_FILE_DEFAULT) | sed 's/time="[0-9.]*"/time="$$TIME"/g' | diff output-default.xml -
19+ cat $(OUTPUT_FILE_STDOUT_SUCCESS) | sed 's/time="[0-9.]*"/time="$$TIME"/g' | diff output-stdout-success.xml -
Original file line number Diff line number Diff line change 1+ #[ test]
2+ fn a ( ) {
3+ println ! ( "print from successful test" ) ;
4+ // Should pass
5+ }
6+
7+ #[ test]
8+ fn b ( ) {
9+ println ! ( "print from failing test" ) ;
10+ assert ! ( false ) ;
11+ }
12+
13+ #[ test]
14+ #[ should_panic]
15+ fn c ( ) {
16+ assert ! ( false ) ;
17+ }
18+
19+ #[ test]
20+ #[ ignore = "msg" ]
21+ fn d ( ) {
22+ assert ! ( false ) ;
23+ }
Original file line number Diff line number Diff line change 1+ <?xml version =" 1.0" encoding =" UTF-8" ?><testsuites ><testsuite name =" test" package =" test" id =" 0" errors =" 0" failures =" 1" tests =" 4" skipped =" 1" ><testcase classname =" unknown" name =" a" time =" $TIME" /><testcase classname =" unknown" name =" b" time =" $TIME" ><failure type =" assert" /></testcase ><testcase classname =" unknown" name =" c" time =" $TIME" /><system-out /><system-err /></testsuite ></testsuites >
Original file line number Diff line number Diff line change 1+ <?xml version =" 1.0" encoding =" UTF-8" ?><testsuites ><testsuite name =" test" package =" test" id =" 0" errors =" 0" failures =" 1" tests =" 4" skipped =" 1" ><testcase classname =" unknown" name =" a" time =" $TIME" /><testcase classname =" unknown" name =" b" time =" $TIME" ><failure type =" assert" /></testcase ><testcase classname =" unknown" name =" c" time =" $TIME" /><system-out /><system-err /></testsuite ></testsuites >
Original file line number Diff line number Diff line change 1+ #!/usr/bin/env python
2+
3+ import sys
4+ import xml .etree .ElementTree as ET
5+
6+ # Try to decode line in order to ensure it is a valid XML document
7+ for line in sys .stdin :
8+ try :
9+ ET .fromstring (line )
10+ except ET .ParseError as pe :
11+ print ("Invalid xml: %r" % line )
12+ raise
You can’t perform that action at this time.
0 commit comments