blob: adc05bd9a4797909f3b3b4bde42f457a4f16cf61 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
|
#!/bin/bash
set -o nounset
set -o errexit
set -o errtrace
[[ -f ~/.ktestrc ]] && . ~/.ktestrc
cd /home/bcachefs/linux
BRANCH=$1
COMMIT=$2
OUTPUT=$JOBSERVER_OUTPUT_DIR/c/$COMMIT
COMMITTEXT=$(git log -n1 $COMMIT)
echo "Generating summary for branch $BRANCH commit $COMMIT"
set +e
STATUSES=$(find "$OUTPUT" -name status)
if [[ -n $STATUSES ]]; then
cat $STATUSES|grep -c PASSED > $OUTPUT/nr_passed
cat $STATUSES|grep -c FAILED > $OUTPUT/nr_failed
cat $STATUSES|grep -c NOTRUN > $OUTPUT/nr_notrun
cat $STATUSES|grep -c "NOT STARTED" > $OUTPUT/nr_notstarted
cat $STATUSES|grep -cvE '(PASSED|FAILED|NOTRUN)' > $OUTPUT/nr_unknown
echo $STATUSES|wc -w > $OUTPUT/nr_tests
fi
set -o errexit
#echo "Running test2web"
#test2web "$COMMITTEXT" "$OUTPUT" > "$OUTPUT"/index.html
git_commit_html()
{
echo '<!DOCTYPE HTML>'
echo "<html><head><title>$(git log -n1 --pretty=format:%s)</title></head>"
echo '<link href="../../bootstrap.min.css" rel="stylesheet">'
echo '<body>'
echo '<div class="container">'
echo '<table class="table">'
echo "<tr>"
echo "<th>$(git log -n1 --pretty=format:%s)</th>"
echo "</tr>"
for STATUS in $(find $OUTPUT -name status); do
TESTNAME=$(basename $(dirname $STATUS))
TESTFILE=$(echo $TESTNAME|cut -d. -f1)
STATUSMSG=Unknown
TABLECLASS=table-secondary
case $(<$STATUS) in
*PASSED*)
STATUSMSG=Passed
TABLECLASS=table-success
;;
*FAILED*)
STATUSMSG=Failed
TABLECLASS=table-danger
;;
*NOTRUN*)
STATUSMSG=Not Run
;;
*"NOT STARTED"*)
STATUSMSG="Not Started"
;;
esac
echo "<tr class=$TABLECLASS>"
echo "<td> $TESTNAME </td>"
echo "<td> $STATUSMSG </td>"
echo "<td> <a href=$TESTNAME/log.br> log </a> </td>"
echo "<td> <a href=$TESTFILE.br> full log </a> </td>"
echo "<td> <a href=$TESTNAME> output directory </a> </td>"
echo "</tr>"
done
echo "</table>"
echo "</div>"
echo "</body>"
echo "</html>"
}
git_commit_html > $OUTPUT/index.html
git_log_html()
{
echo '<!DOCTYPE HTML>'
echo "<html><head><title>$BRANCH</title></head>"
echo '<link href="bootstrap.min.css" rel="stylesheet">'
echo '<body>'
echo '<div class="container">'
echo '<table class="table">'
echo "<tr>"
echo "<th> Commit </th>"
echo "<th> Description </th>"
echo "<th> Passed </th>"
echo "<th> Failed </th>"
echo "<th> Not started </th>"
echo "<th> Not run </th>"
echo "<th> Unknown </th>"
echo "<th> Total </th>"
echo "</tr>"
git log --pretty=oneline $BRANCH|
while read LINE; do
COMMIT=$(echo $LINE|cut -d\ -f1)
COMMIT_SHORT=$(echo $LINE|cut -b1-14)
DESCRIPTION=$(echo $LINE|cut -d\ -f2-)
RESULTS=$JOBSERVER_OUTPUT_DIR/c/$COMMIT
[[ ! -d $RESULTS ]] && break
if [[ -f $RESULTS/nr_tests ]]; then
echo "<tr>"
echo "<td> <a href=\"c/$COMMIT\">$COMMIT_SHORT</a> </td>"
echo "<td> $DESCRIPTION </td>"
echo "<td> $(<$RESULTS/nr_passed) </td>"
echo "<td> $(<$RESULTS/nr_failed) </td>"
echo "<td> $(<$RESULTS/nr_notstarted) </td>"
echo "<td> $(<$RESULTS/nr_notrun) </td>"
echo "<td> $(<$RESULTS/nr_unknown) </td>"
echo "<td> $(<$RESULTS/nr_tests) </td>"
echo "</tr>"
fi
done
echo "</table>"
echo "</div>"
echo "</body>"
echo "</html>"
}
echo "Creating log for $BRANCH"
BRANCH_LOG=$(echo "$BRANCH"|tr / _).html
git_log_html > "$JOBSERVER_OUTPUT_DIR/$BRANCH_LOG"
echo "Running rsync"
flock --nonblock .rsync.lock rsync -r --delete $JOBSERVER_OUTPUT_DIR/ testdashboard@evilpiepirate.org:public_html || true
echo "Success"
|