coverage_helper: use 'ipfs commands --flags'
License: MIT Signed-off-by: Christian Couder <chriscool@tuxfamily.org>
Christian Couder committed
Oct 24, 2015 at 07:54 UTC
c321f0626a445277524df803065f543789e4cb55
1 file changed
+30
-3
test/sharness_test_coverage_helper.sh
+30
-3
@@ -97,7 +97,7 @@ done | sort | uniq >"$CMD_RES" || die "Could not write '$CMD_RES'"
97
98
log "Get all the ipfs commands from 'ipfs commands'"
99
CMD_CMDS="$TMPDIR/commands.txt"
100
-ipfs commands >"$CMD_CMDS" || die "'ipfs commands' failed"
100
+ipfs commands --flags >"$CMD_CMDS" || die "'ipfs commands' failed"
101
102
# Portable function to reverse lines in a file
103
reverse() {
@@ -111,8 +111,14 @@ reverse() {
111
112
log "Match the test line commands with the commands they use"
113
GLOBAL_REV="$TMPDIR/global_results_reversed.txt"
114
-reverse "$CMD_CMDS" | while read -r ipfs cmd sub1 sub2
115
-do
114
+
115
+process_command() {
116
+ ipfs="$1"
117
+ cmd="$2"
118
+ sub1="$3"
119
+ sub2="$4"
120
+ sub3="$5"
121
+
122
if test -n "$cmd"
123
then
124
CMD_OUT="$TMPDIR/res_${ipfs}_${cmd}"
@@ -130,6 +136,13 @@ do
136
CMD_OUT="${CMD_OUT}_${sub2}"
137
PATTERN="$PATTERN(\W.*)*\W$sub2"
138
NAME="$NAME $sub2"
139
+
140
+ if test -n "$sub3"
141
+ then
142
+ CMD_OUT="${CMD_OUT}_${sub3}"
143
+ PATTERN="$PATTERN(\W.*)*\W$sub3"
144
+ NAME="$NAME $sub3"
145
+ fi
146
fi
147
fi
148
@@ -137,6 +150,20 @@ do
150
reverse "$CMD_OUT.txt" | sed -e 's/^sharness\///' | cut -d- -f1 | uniq -c >>"$GLOBAL_REV"
151
echo "$NAME" >>"$GLOBAL_REV"
152
fi
153
+}
154
+
155
+reverse "$CMD_CMDS" | while read -r line
156
+do
157
+ LONG_CMD=$(echo "$line" | cut -d/ -f1)
158
+ SHORT_CMD=$(expr "$line" : "[^/]*/*\(.*\)")
159
+
160
+ log "Processing $LONG_CMD"
161
+ process_command $LONG_CMD
162
+
163
+ log "Processing $SHORT_CMD"
164
+ process_command $SHORT_CMD
165
+
166
+ echo >>"$GLOBAL_REV"
167
done
168
169
# The following will allow us to check that