| |
@@ -0,0 +1,27 @@
|
| |
+ #!/bin/sh
|
| |
+
|
| |
+ set -e
|
| |
+
|
| |
+ HERE=$(pwd)/$(dirname "$0")
|
| |
+ PATH="$HERE/../bin:$HERE/bin:$PATH"
|
| |
+ export PATH
|
| |
+ RET=0
|
| |
+
|
| |
+ for t in $HERE/test_*; do
|
| |
+ output=$(mktemp)
|
| |
+ diff=$(mktemp)
|
| |
+ cd "$t"
|
| |
+ fedpkg sources >"$output"
|
| |
+ if diff -u expected "$output" >"$diff"; then
|
| |
+ printf "%-40s 0K\n" "$(basename "$t")"
|
| |
+ else
|
| |
+ printf "%-40s FAIL\n" "$(basename "$t")"
|
| |
+ echo "DIFF:"
|
| |
+ cat "$diff"
|
| |
+ echo ""
|
| |
+ RET=$((RET + 1))
|
| |
+ fi
|
| |
+ cd "$HERE"
|
| |
+ rm -f "$output" "$diff"
|
| |
+ done
|
| |
+ exit $RET
|
| |
The test script modifies
$PATH
to point to the tested script first, and also adds a directory with mock scripts replacingcurl
and hash verification commands withecho
. This way when the tests runfedpkg sources
, the executed commands are just printed to stdout, where we can capture them and check they are as expected. There is no communication with any real service anywhere.The tests cover three scenarios now:
sources
filesources
filesources
fileTo run the tests simply execute the
run-tests.sh
script.