sharness/junit: Better test tree in jenkins
License: MIT Signed-off-by: Łukasz Magiera <magik6k@gmail.com>
Łukasz Magiera committed
Mar 22, 2018 at 04:32 UTC
d25e82616e990fafa78f56ed2398389bcba1fead
2 files changed
+20
-10
test/sharness/lib/0001-Generate-partial-JUnit-reports.patch
+19
-9
@@ -1,14 +1,14 @@
1
-From 8b4a5cd6ebf9dfa462d869559b85b17d2b277d06 Mon Sep 17 00:00:00 2001
1
+From 76b34f25b2bacdd30138b25ccbe0672d76a1632a Mon Sep 17 00:00:00 2001
2
From: =?UTF-8?q?=C5=81ukasz=20Magiera?= <magik6k@gmail.com>
3
-Date: Wed, 14 Mar 2018 21:26:35 +0100
3
+Date: Thu, 22 Mar 2018 06:11:01 +0100
4
Subject: [PATCH] Generate partial JUnit reports
5
6
---
7
- sharness.sh | 99 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++----
8
- 1 file changed, 93 insertions(+), 6 deletions(-)
7
+ sharness.sh | 102 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++----
8
+ 1 file changed, 96 insertions(+), 6 deletions(-)
9
10
diff --git a/sharness.sh b/sharness.sh
11
-index 6750ff7..dc99ef9 100644
11
+index 6750ff7..7d9915a 100644
12
--- a/sharness.sh
13
+++ b/sharness.sh
14
@@ -1,4 +1,4 @@
@@ -68,7 +68,7 @@ index 6750ff7..dc99ef9 100644
68
+
69
+ shift
70
+ cat > "$tc_file" <<-EOF
71
-+ <testcase name="$test_count - $(echo $test_name | esc_xml) ">
71
++ <testcase name="$test_count - $(echo $test_name | esc_xml)" classname="sharness$(uname -s).${SHARNESS_TEST_NAME}">
72
+ $@
73
+ EOF
74
+
@@ -152,7 +152,7 @@ index 6750ff7..dc99ef9 100644
152
+
153
+ if test -n "$TEST_GENERATE_JUNIT"; then
154
+ cat > ".junit/case-$(printf "%04d" $test_count)" <<-EOF
155
-+ <testcase name="$test_count - $(echo $2 | esc_xml)">
155
++ <testcase name="$test_count - $(echo $2 | esc_xml)" classname="sharness$(uname -s).${SHARNESS_TEST_NAME}">
156
+ <skipped>
157
+ skip $(echo $1 | esc_xml) (missing $missing_prereq${of_prereq})
158
+ </skipped>
@@ -195,7 +195,7 @@ index 6750ff7..dc99ef9 100644
195
+
196
+ if test -n "$TEST_GENERATE_JUNIT"; then
197
+ cat >>"$junit_results_path" <<-EOF
198
-+ <testsuite errors="$test_broken" failures="$((test_failure+test_fixed))" tests="$test_count" name="$SHARNESS_TEST_FILE">
198
++ <testsuite errors="$test_broken" failures="$((test_failure+test_fixed))" tests="$test_count" package="sharness$(uname -s).${SHARNESS_TEST_NAME}">
199
+ $(find .junit -name 'case-*' | sort | xargs cat)
200
+ </testsuite>
201
+ EOF
@@ -203,7 +203,17 @@ index 6750ff7..dc99ef9 100644
203
fi
204
205
if test "$test_fixed" != 0; then
206
-@@ -771,6 +853,11 @@ mkdir -p "$test_dir" || exit 1
206
+@@ -745,6 +827,9 @@ export PATH SHARNESS_BUILD_DIRECTORY
207
+ SHARNESS_TEST_FILE="$0"
208
+ export SHARNESS_TEST_FILE
209
+
210
++SHARNESS_TEST_NAME=$(basename ${SHARNESS_TEST_FILE} ".sh")
211
++export SHARNESS_TEST_NAME
212
++
213
+ # Prepare test area.
214
+ test_dir="trash directory.$(basename "$SHARNESS_TEST_FILE" ".$SHARNESS_TEST_EXTENSION")"
215
+ test -n "$root" && test_dir="$root/$test_dir"
216
+@@ -771,6 +856,11 @@ mkdir -p "$test_dir" || exit 1
217
# in subprocesses like git equals our $PWD (for pathname comparisons).
218
cd -P "$test_dir" || exit 1
219
test/sharness/lib/install-sharness.sh
+1
-1
@@ -7,7 +7,7 @@
7
8
# settings
9
version=5eee9b51b5621cec95a64018f0cc779963b230d2
10
-patch_version=1
10
+patch_version=6
11
12
urlprefix=https://github.com/mlafeldt/sharness.git
13
if test ! -n "$clonedir" ; then