run_coverage.sh: dont run unneccesary tests and disable timing - webdump_tests - Testfiles for webdump
HTML git clone git://git.codemadness.org/webdump_tests
DIR Log
DIR Files
DIR Refs
DIR README
---
DIR commit 6cd0cea869fb0aef601bac20aa0021c3e1da6227
DIR parent 8dd5907ff53c821a32de247ac163835d38e97d9a
HTML Author: Hiltjo Posthuma <hiltjo@codemadness.org>
Date: Tue, 14 Jul 2026 10:40:33 +0200
run_coverage.sh: dont run unneccesary tests and disable timing
Speed up tests, same coverage:
stats so far:
- webdump.c: Lines executed:96.87% of 1311
- xml.c: Lines executed:82.39% of 318
todo:
webdump.c: some known paths are not tested: out of memory and a path to silence
an untaken path: a false-positive compiler warning.
xml.c: TODO: copy some tests from sfeed_tests. There some more paths are
tested (shared code).
Diffstat:
M run_coverage.sh | 40 ++++++++++++++++++++++----------
1 file changed, 28 insertions(+), 12 deletions(-)
---
DIR diff --git a/run_coverage.sh b/run_coverage.sh
@@ -26,24 +26,28 @@ echo | "$bin" -s 'a@012345678901234567890123456789012345678901234567890123456789
echo | "$bin" -w plop 2>/dev/null
run() {
- # with crude timing information.
- starttime=$(echo | ts -m '%.s')
- echo -n "running $bin $@ < $f" >&2
- "$bin" "$@" >/dev/null 2>/dev/null
- endtime=$(echo | ts -m '%.s')
- duration=$(echo "$endtime - $starttime" | bc)
- echo ": $?, ($duration)" >&2
-
+# # with crude timing information.
+# starttime=$(echo | ts -m '%.s')
# echo -n "running $bin $@ < $f" >&2
# "$bin" "$@" >/dev/null 2>/dev/null
-# echo ": $?" >&2
+# endtime=$(echo | ts -m '%.s')
+# duration=$(echo "$endtime - $starttime" | bc)
+# echo ": $?, ($duration)" >&2
+
+ echo -n "running $bin $@ < $f" >&2
+ "$bin" "$@" >/dev/null 2>/dev/null
+ echo ": $?" >&2
}
-# test base URL combinations.
-while read -r baseurl; do
+runtests() {
+ baseurl="$1"
+ f="$2"
-for f in realworld/* tests/*; do
run -r < "$f"
+ run -l -i < "$f"
+ run -l -r < "$f"
+ run -l -i -r < "$f"
+
run -b "$baseurl" -r < "$f"
run -l -i -b "$baseurl" -r < "$f"
run -a -l -i -b "$baseurl" -r < "$f"
@@ -74,9 +78,21 @@ for f in realworld/* tests/*; do
run -8 -d -a -I -l -i -x < "$f"
run -8 -d -a -I -l -i -x -b "$baseurl" < "$f"
run -x -s 'main' -a -l -i -b "$baseurl" < "$f"
+}
+
+baseurl="http://codemadness.org/"
+for f in realworld/* tests/*; do
+ runtests "$baseurl" "$f"
done
+# test base URL combinations for specific tests.
+while read -r baseurl; do
+ for f in tests/urls.html tests/base.html; do
+ runtests "$baseurl" "$f"
+ done
done <<!EOF
+https://codemadness.org/
+http://codemadness.org/
http://example.com
gopher://codemadness.org/1/git/sfeed
file://host/path