summaryrefslogtreecommitdiff
path: root/tests/local.at
blob: 48c5d3f96b4fc2ab200df4673dcf9c7c6898d5f3 (plain)
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
AT_TESTED([rpm rpmbuild rpmquery])

m4_define([RPMDB_INIT],[[
runroot rpm --initdb
]])

m4_define([RPMDB_CLEAR],[[
rm -rf "${abs_builddir}"/testing`rpm --eval '%_dbpath'`/*
]])

m4_define([RPMPY_RUN],[[
cat << EOF > test.py
import rpm, sys
dbpath=rpm.expandMacro('%_dbpath')
rpm.addMacro('_dbpath', '${abs_builddir}/testing%s' % dbpath)
def myprint(msg = ''):
    sys.stdout.write('%s\n' % msg)
$1
EOF
python test.py
]])

m4_define([RPMPY_CHECK],[
AT_CHECK([RPMPY_RUN([$1])], [], [$2], [$3])
])

m4_define([RPMPY_TEST],[
AT_SETUP([$1])
AT_KEYWORDS([python])
RPMDB_CLEAR
RPMDB_INIT
RPMPY_CHECK([$2], [$3], [$4])
AT_CLEANUP
])

AT_INIT