forked from rpm-software-management/rpmlint
-
Notifications
You must be signed in to change notification settings - Fork 0
/
test.sh
executable file
·64 lines (55 loc) · 1.53 KB
/
test.sh
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
#!/bin/sh
export PYTHONPATH=$(pwd)/tools:$(pwd)
export TESTPATH="$(pwd)/test/"
: ${PYTHON:=python} ${PYTEST:=py.test} ${FLAKE8:=flake8}
: ${PYTHONWARNINGS:=all}
export PYTHONWARNINGS
echo
echo "Please ignore the possibly occurring output like this:"
echo " .../Patch*.patch: No such file or directory"
echo
for i in $TESTPATH/test.*.py; do
$PYTHON $i
RET=$?
if [ $RET -ne 0 ]; then
exit $RET
fi
done
run_rpmlint="$PYTHON ./rpmlint -C $(pwd)"
echo "Check that rpmlint executes with no unexpected errors"
echo "...in default locale"
$run_rpmlint test/*/*.rpm test/spec/*.spec >/dev/null
rc=$?
test $rc -eq 0 -o $rc -eq 64 || exit $rc
echo "...in the C locale"
LC_ALL=C $run_rpmlint test/*/*.rpm test/spec/*.spec >/dev/null
rc=$?
test $rc -eq 0 -o $rc -eq 64 || exit $rc
echo "...with specfile from stdin"
$run_rpmlint - < $TESTPATH/spec/SpecCheck.spec >/dev/null
rc=$?
test $rc -eq 0 || exit $rc
echo "$PYTEST tests"
$PYTEST -v || exit $?
unset PYTHONWARNINGS
echo "$FLAKE8 tests"
$FLAKE8 --version
$FLAKE8 . ./rpmdiff ./rpmlint || exit $?
echo "man page tests"
if man --help 2>&1 | grep -q -- --warnings; then
tmpfile=$(mktemp) || exit 1
for manpage in ./rpmdiff.1 ./rpmlint.1; do
man --warnings $manpage >/dev/null 2>$tmpfile
if [ -s $tmpfile ]; then
echo $manpage:
cat $tmpfile
rm -f $tmpfile
exit 1
else
>$tmpfile
fi
done
rm -f $tmpfile
else
echo "Skipped, man does not seem to recognize the --warnings switch"
fi