Skip to content

Commit e73f003

Browse files
authored
skip some skippable tests (#3102)
* tests: consolidate redundant, duplicated helper code These functions currently exist in a sourced shell library, but there is an identical copy of them in a single test file. Get rid of this duplicate definition. * tests: mark some tests as skipped if bc is not installed `exit 77` is the GNU exitcode protocol for tests that cannot be run because their prerequisites are not available. If `bc` is not installed, and it often isn't, the test can be short-circuited instead of failing; meson will report them in "warning yellow". * tests: mark some tests as skipped if support is not compiled Not all test cases can be cleanly marked as skipped -- sometimes, multiple things are checked, and having one be unavailable should not mean skipping all tests. But in a couple cases, a test file only tests one thing, and that may be skipped. In such cases, it can be semantically indicated in the test harness report collection, that a skip occurred.
1 parent eb4b21e commit e73f003

File tree

4 files changed

+9
-26
lines changed

4 files changed

+9
-26
lines changed

test/test_cli.sh

Lines changed: 0 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -7,32 +7,6 @@
77

88
. ./variables.sh
99

10-
# is a difference beyond a threshold? return 0 (meaning all ok) or 1 (meaning
11-
# error, or outside threshold)
12-
#
13-
# use bc since bash does not support fp math
14-
break_threshold() {
15-
diff=$1
16-
threshold=$2
17-
return $(echo "$diff <= $threshold" | bc -l)
18-
}
19-
20-
# subtract, look for max difference less than a threshold
21-
test_difference() {
22-
before=$1
23-
after=$2
24-
threshold=$3
25-
26-
$vips subtract $before $after $tmp/difference.v
27-
$vips abs $tmp/difference.v $tmp/abs.v
28-
dif=$($vips max $tmp/abs.v)
29-
30-
if break_threshold $dif $threshold; then
31-
echo "difference is $dif"
32-
exit 1
33-
fi
34-
}
35-
3610
test_rotate() {
3711
im=$1
3812
inter=$2

test/test_connections.sh

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,4 +12,6 @@ if test_supported jpegload_source; then
1212

1313
# test max difference < 10
1414
test_difference $image $tmp/x.png 10
15+
else
16+
exit 77
1517
fi

test/test_stall.sh

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,4 +14,6 @@ if test_supported tiffload; then
1414
-1 -1 -1
1515
EOF
1616
VIPS_STALL=1 $vips conv $tmp/x.tif $tmp/x2.tif $tmp/mask.con
17+
else
18+
exit 77
1719
fi

test/variables.sh.in

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,9 +32,14 @@ test_supported() {
3232

3333
# is a difference beyond a threshold? return 0 (meaning all ok) or 1 (meaning
3434
# error, or outside threshold)
35+
#
36+
# use bc since bash does not support fp math
3537
break_threshold() {
3638
diff=$1
3739
threshold=$2
40+
if ! command -v bc >/dev/null; then
41+
exit 77
42+
fi
3843
return $(echo "$diff <= $threshold" | bc -l)
3944
}
4045

0 commit comments

Comments
 (0)