Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
G
go-ipfs
概览
概览
详情
活动
周期分析
版本库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
统计图
问题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程表
图表
维基
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
jihao
go-ipfs
Commits
36d819d0
Unverified
提交
36d819d0
authored
5月 12, 2018
作者:
Whyrusleeping
提交者:
GitHub
5月 12, 2018
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #4959 from ipfs/feat/ci/times
ci: Collect test times for sharness
上级
8272647d
9b4296d9
隐藏空白字符变更
内嵌
并排
正在显示
2 个修改的文件
包含
41 行增加
和
21 行删除
+41
-21
0001-Generate-partial-JUnit-reports.patch
test/sharness/lib/0001-Generate-partial-JUnit-reports.patch
+40
-20
install-sharness.sh
test/sharness/lib/install-sharness.sh
+1
-1
没有找到文件。
test/sharness/lib/0001-Generate-partial-JUnit-reports.patch
浏览文件 @
36d819d0
From
76b34f25b2bacdd30138b25ccbe0672d76a1632a
Mon Sep 17 00:00:00 2001
From
bc6bf844ef4e4cd468bc1ec96f2d6af738eb8d2f
Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=C5=81ukasz=20Magiera?= <magik6k@gmail.com>
Date:
Thu, 22 Mar 2018 06:11:01 +01
00
Date:
Sat, 21 Apr 2018 22:01:45 +02
00
Subject: [PATCH] Generate partial JUnit reports
---
sharness.sh | 1
02 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++-
---
1 file changed,
96
insertions(+), 6 deletions(-)
sharness.sh | 1
14 +++++++++++++++++++++++++++++++++++++++++++++++++
---
1 file changed,
108
insertions(+), 6 deletions(-)
diff --git a/sharness.sh b/sharness.sh
index 6750ff7..
7d9915a
100644
index 6750ff7..
336e426
100644
--- a/sharness.sh
+++ b/sharness.sh
@@ -1,4 +1,4 @@
...
...
@@ -46,13 +46,13 @@ index 6750ff7..7d9915a 100644
+esc=$(printf '\033')
+
+esc_xml() {
+ sed 's/&/\&/g; s/</\</g; s/>/\>/g; s/"/\"/g; s/'"$esc"'/
\
/g; s///g;'
+ sed 's/&/\&/g; s/</\</g; s/>/\>/g; s/"/\"/g; s/'"$esc"'//g; s///g;'
+}
+
test -n "$test_description" || error "Test script did not set test_description."
if test "$help" = "t"; then
@@ -251,30 +265,7
5
@@ test_have_prereq() {
@@ -251,30 +265,7
8
@@ test_have_prereq() {
test $total_prereq = $ok_prereq
}
...
...
@@ -65,10 +65,13 @@ index 6750ff7..7d9915a 100644
+
+ test_name=$1
+ tc_file=".junit/case-$(printf "%04d" $test_count)"
+ time_sec="$(cat .junit/time | xargs printf '%04d' | sed -e 's/\(...\)$/.\1/g')"
+
+ echo "$(expr $(cat .junit/time_total) + $(cat .junit/time) )" > .junit/time_total
+
+ shift
+ cat > "$tc_file" <<-EOF
+ <testcase name="$test_count - $(echo $test_name | esc_xml)" classname="sharness$(uname -s).${SHARNESS_TEST_NAME}">
+ <testcase name="$test_count - $(echo $test_name | esc_xml)" classname="sharness$(uname -s).${SHARNESS_TEST_NAME}"
time="${time_sec}"
>
+ $@
+ EOF
+
...
...
@@ -89,7 +92,7 @@ index 6750ff7..7d9915a 100644
+ fi
+
+ echo "</testcase>" >> "$tc_file"
+ rm -f .junit/tout .junit/terr
+ rm -f .junit/tout .junit/terr
.junit/time
+}
+
# You are not expected to call test_ok_ and test_failure_ directly, use
...
...
@@ -128,7 +131,7 @@ index 6750ff7..7d9915a 100644
}
# Public: Execute commands in debug mode.
@@ -310,
7 +369,11
@@ test_pause() {
@@ -310,
15 +372,25
@@ test_pause() {
test_eval_() {
# This is a separate function because some tests use
# "return" to end a test_expect_success block early.
...
...
@@ -141,7 +144,21 @@ index 6750ff7..7d9915a 100644
}
test_run_() {
@@ -355,8 +418,18 @@ test_skip_() {
test_cleanup=:
expecting_failure=$2
+
+ start_time_ms=$(date "+%s%3N");
test_eval_ "$1"
eval_ret=$?
+ if test -n "$TEST_GENERATE_JUNIT"; then
+ echo $(expr $(date "+%s%3N") - ${start_time_ms} ) > .junit/time;
+ fi
+
if test "$chain_lint" = "t"; then
test_eval_ "(exit 117) && $1"
if test "$?" != 117; then
@@ -355,8 +427,18 @@ test_skip_() {
of_prereq=" of $test_prereq"
fi
...
...
@@ -152,7 +169,7 @@ index 6750ff7..7d9915a 100644
+
+ if test -n "$TEST_GENERATE_JUNIT"; then
+ cat > ".junit/case-$(printf "%04d" $test_count)" <<-EOF
+ <testcase name="$test_count - $(echo $2 | esc_xml)" classname="sharness$(uname -s).${SHARNESS_TEST_NAME}">
+ <testcase name="$test_count - $(echo $2 | esc_xml)" classname="sharness$(uname -s).${SHARNESS_TEST_NAME}"
time="0"
>
+ <skipped>
+ skip $(echo $1 | esc_xml) (missing $missing_prereq${of_prereq})
+ </skipped>
...
...
@@ -162,7 +179,7 @@ index 6750ff7..7d9915a 100644
: true
;;
*)
@@ -403,7 +4
76
,7 @@ test_expect_success() {
@@ -403,7 +4
85
,7 @@ test_expect_success() {
test "$#" = 3 && { test_prereq=$1; shift; } || test_prereq=
test "$#" = 2 || error "bug in the test script: not 2 or 3 parameters to test_expect_success"
export test_prereq
...
...
@@ -171,7 +188,7 @@ index 6750ff7..7d9915a 100644
say >&3 "expecting success: $2"
if test_run_ "$2"; then
test_ok_ "$1"
@@ -442,7 +5
15
,7 @@ test_expect_failure() {
@@ -442,7 +5
24
,7 @@ test_expect_failure() {
test "$#" = 3 && { test_prereq=$1; shift; } || test_prereq=
test "$#" = 2 || error "bug in the test script: not 2 or 3 parameters to test_expect_failure"
export test_prereq
...
...
@@ -180,7 +197,7 @@ index 6750ff7..7d9915a 100644
say >&3 "checking known breakage: $2"
if test_run_ "$2" expecting_failure; then
test_known_broken_ok_ "$1"
@@ -675,6 +7
48
,7 @@ test_done() {
@@ -675,6 +7
57
,7 @@ test_done() {
test_results_dir="$SHARNESS_TEST_DIRECTORY/test-results"
mkdir -p "$test_results_dir"
test_results_path="$test_results_dir/${SHARNESS_TEST_FILE%.$SHARNESS_TEST_EXTENSION}.$$.counts"
...
...
@@ -188,14 +205,16 @@ index 6750ff7..7d9915a 100644
cat >>"$test_results_path" <<-EOF
total $test_count
@@ -684,6 +7
58,14
@@ test_done() {
@@ -684,6 +7
67,16
@@ test_done() {
failed $test_failure
EOF
+
+ if test -n "$TEST_GENERATE_JUNIT"; then
+ time_sec="$(cat .junit/time_total | xargs printf "%04d" | sed -e 's/\(...\)$/.\1/g')"
+
+ cat >>"$junit_results_path" <<-EOF
+ <testsuite errors="$test_broken" failures="$((test_failure+test_fixed))" tests="$test_count" package="sharness$(uname -s).${SHARNESS_TEST_NAME}">
+ <testsuite errors="$test_broken" failures="$((test_failure+test_fixed))" tests="$test_count" package="sharness$(uname -s).${SHARNESS_TEST_NAME}"
time="${time_sec}"
>
+ $(find .junit -name 'case-*' | sort | xargs cat)
+ </testsuite>
+ EOF
...
...
@@ -203,7 +222,7 @@ index 6750ff7..7d9915a 100644
fi
if test "$test_fixed" != 0; then
@@ -745,6 +8
27
,9 @@ export PATH SHARNESS_BUILD_DIRECTORY
@@ -745,6 +8
38
,9 @@ export PATH SHARNESS_BUILD_DIRECTORY
SHARNESS_TEST_FILE="$0"
export SHARNESS_TEST_FILE
...
...
@@ -213,18 +232,19 @@ index 6750ff7..7d9915a 100644
# Prepare test area.
test_dir="trash directory.$(basename "$SHARNESS_TEST_FILE" ".$SHARNESS_TEST_EXTENSION")"
test -n "$root" && test_dir="$root/$test_dir"
@@ -771,6 +8
56,11
@@ mkdir -p "$test_dir" || exit 1
@@ -771,6 +8
67,12
@@ mkdir -p "$test_dir" || exit 1
# in subprocesses like git equals our $PWD (for pathname comparisons).
cd -P "$test_dir" || exit 1
+# Prepare JUnit report dir
+if test -n "$TEST_GENERATE_JUNIT"; then
+ mkdir -p .junit
+ echo 0 > .junit/time_total
+fi
+
this_test=${SHARNESS_TEST_FILE##*/}
this_test=${this_test%.$SHARNESS_TEST_EXTENSION}
for skp in $SKIP_TESTS; do
--
2.1
6.2
2.1
7.0
test/sharness/lib/install-sharness.sh
浏览文件 @
36d819d0
...
...
@@ -7,7 +7,7 @@
# settings
version
=
5eee9b51b5621cec95a64018f0cc779963b230d2
patch_version
=
8
patch_version
=
17
urlprefix
=
https://github.com/mlafeldt/sharness.git
if
test
!
-n
"
$clonedir
"
;
then
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论