pmrep: further zbxsend python3 fixes
[pcp.git] / qa / common.python
blobc27df074647865f290c24d2d4d875c9acecf7f2f
2 # Common shell routines for testing python modules
3 # Copyright (c) 2012-2014 Red Hat.
6 # get standard environment, filters and checks
7 . ./common.product
8 . ./common.filter
9 . ./common.check
11 python=${PCP_PYTHON_PROG:-python}
12 eval $python -c exit 2>/dev/null || _notrun "$python unavailable"
14 # verify output from unittest indicates successful testing
15 _check_unittest()
17 mode=$1
18 file=$2
20 $PCP_ECHO_PROG $PCP_ECHO_N "$mode - ""$PCP_ECHO_C"
21 if grep OK $file
22 then
23 return 0
26 # Give some hint as to what went wrong ...
28 $PCP_AWK_PROG <$file '
29 $1 == "FAIL:" { want = 1 }
30 $1 == "File" { want = 1 }
31 want == 1 && $1 == "Ran" { exit }
32 want == 1 { print }'
33 return 1