1
0
mirror of https://github.com/ipfs/kubo.git synced 2025-06-28 00:39:31 +08:00

sharness/junit: Better test tree in jenkins

License: MIT
Signed-off-by: Łukasz Magiera <magik6k@gmail.com>
This commit is contained in:
Łukasz Magiera
2018-03-22 04:32:08 +01:00
parent d6fe0c195d
commit d25e82616e
2 changed files with 20 additions and 10 deletions

View File

@ -1,14 +1,14 @@
From 8b4a5cd6ebf9dfa462d869559b85b17d2b277d06 Mon Sep 17 00:00:00 2001
From 76b34f25b2bacdd30138b25ccbe0672d76a1632a Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=C5=81ukasz=20Magiera?= <magik6k@gmail.com>
Date: Wed, 14 Mar 2018 21:26:35 +0100
Date: Thu, 22 Mar 2018 06:11:01 +0100
Subject: [PATCH] Generate partial JUnit reports
---
sharness.sh | 99 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++----
1 file changed, 93 insertions(+), 6 deletions(-)
sharness.sh | 102 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++----
1 file changed, 96 insertions(+), 6 deletions(-)
diff --git a/sharness.sh b/sharness.sh
index 6750ff7..dc99ef9 100644
index 6750ff7..7d9915a 100644
--- a/sharness.sh
+++ b/sharness.sh
@@ -1,4 +1,4 @@
@ -68,7 +68,7 @@ index 6750ff7..dc99ef9 100644
+
+ shift
+ cat > "$tc_file" <<-EOF
+ <testcase name="$test_count - $(echo $test_name | esc_xml) ">
+ <testcase name="$test_count - $(echo $test_name | esc_xml)" classname="sharness$(uname -s).${SHARNESS_TEST_NAME}">
+ $@
+ EOF
+
@ -152,7 +152,7 @@ index 6750ff7..dc99ef9 100644
+
+ if test -n "$TEST_GENERATE_JUNIT"; then
+ cat > ".junit/case-$(printf "%04d" $test_count)" <<-EOF
+ <testcase name="$test_count - $(echo $2 | esc_xml)">
+ <testcase name="$test_count - $(echo $2 | esc_xml)" classname="sharness$(uname -s).${SHARNESS_TEST_NAME}">
+ <skipped>
+ skip $(echo $1 | esc_xml) (missing $missing_prereq${of_prereq})
+ </skipped>
@ -195,7 +195,7 @@ index 6750ff7..dc99ef9 100644
+
+ if test -n "$TEST_GENERATE_JUNIT"; then
+ cat >>"$junit_results_path" <<-EOF
+ <testsuite errors="$test_broken" failures="$((test_failure+test_fixed))" tests="$test_count" name="$SHARNESS_TEST_FILE">
+ <testsuite errors="$test_broken" failures="$((test_failure+test_fixed))" tests="$test_count" package="sharness$(uname -s).${SHARNESS_TEST_NAME}">
+ $(find .junit -name 'case-*' | sort | xargs cat)
+ </testsuite>
+ EOF
@ -203,7 +203,17 @@ index 6750ff7..dc99ef9 100644
fi
if test "$test_fixed" != 0; then
@@ -771,6 +853,11 @@ mkdir -p "$test_dir" || exit 1
@@ -745,6 +827,9 @@ export PATH SHARNESS_BUILD_DIRECTORY
SHARNESS_TEST_FILE="$0"
export SHARNESS_TEST_FILE
+SHARNESS_TEST_NAME=$(basename ${SHARNESS_TEST_FILE} ".sh")
+export SHARNESS_TEST_NAME
+
# Prepare test area.
test_dir="trash directory.$(basename "$SHARNESS_TEST_FILE" ".$SHARNESS_TEST_EXTENSION")"
test -n "$root" && test_dir="$root/$test_dir"
@@ -771,6 +856,11 @@ mkdir -p "$test_dir" || exit 1
# in subprocesses like git equals our $PWD (for pathname comparisons).
cd -P "$test_dir" || exit 1

View File

@ -7,7 +7,7 @@
# settings
version=5eee9b51b5621cec95a64018f0cc779963b230d2
patch_version=1
patch_version=6
urlprefix=https://github.com/mlafeldt/sharness.git
if test ! -n "$clonedir" ; then