diff options
author | Panu Matilainen <pmatilai@redhat.com> | 2010-12-16 17:39:00 +0200 |
---|---|---|
committer | Panu Matilainen <pmatilai@redhat.com> | 2010-12-16 17:39:00 +0200 |
commit | 2c4899c8d7346ae3a9dbd830939fda29efb7a6a6 (patch) | |
tree | b0d51c70a21fe95b2fc736091f02af3a12e8a511 | |
parent | 8acb7f7c1d8d7e93a04ca214f98660a40ee2b319 (diff) | |
download | librpm-tizen-2c4899c8d7346ae3a9dbd830939fda29efb7a6a6.tar.gz librpm-tizen-2c4899c8d7346ae3a9dbd830939fda29efb7a6a6.tar.bz2 librpm-tizen-2c4899c8d7346ae3a9dbd830939fda29efb7a6a6.zip |
Add a pile of dependency matching tests for "obvious" cases
-rw-r--r-- | tests/Makefile.am | 1 | ||||
-rw-r--r-- | tests/local.at | 2 | ||||
-rw-r--r-- | tests/rpmdepmatch.at | 89 | ||||
-rw-r--r-- | tests/rpmtests.at | 1 |
4 files changed, 92 insertions, 1 deletions
diff --git a/tests/Makefile.am b/tests/Makefile.am index cb2456229..21113da41 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -26,6 +26,7 @@ TESTSUITE_AT += rpmconflict.at TESTSUITE_AT += rpmconfig.at TESTSUITE_AT += rpmmacro.at TESTSUITE_AT += rpmpython.at +TESTSUITE_AT += rpmdepmatch.at EXTRA_DIST += $(TESTSUITE_AT) ## testsuite data diff --git a/tests/local.at b/tests/local.at index 64564cb72..7ee80607d 100644 --- a/tests/local.at +++ b/tests/local.at @@ -13,7 +13,7 @@ rm -rf "${abs_builddir}"/testing`run rpm --eval '%_dbpath'`/* m4_define([RPMPY_RUN],[ cat << EOF > test.py import rpm, sys -def myprint(msg): +def myprint(msg = ''): sys.stdout.write('%s\n' % msg) $1 EOF diff --git a/tests/rpmdepmatch.at b/tests/rpmdepmatch.at new file mode 100644 index 000000000..a7843b41e --- /dev/null +++ b/tests/rpmdepmatch.at @@ -0,0 +1,89 @@ + +AT_BANNER([RPM dependency matching]) + +RPMPY_CHECK([provide - require pairs],[ +# ((provides), (requires), match) expected values +tests = [ + (('=', '1.2'), ('=', '1.2'), 1), + (('=', '1.2'), ('>=', '1.2'), 1), + (('=', '1.2'), ('<=', '1.2'), 1), + (('=', '1.2'), ('<', '1.2'), 0), + (('=', '1.2'), ('>', '1.2'), 0), + (('=', '1.2'), ('<>', '1.2'), 0), + + (('=', '1.2'), ('=', '1.3'), 0), + (('=', '1.2'), ('>=', '1.3'), 0), + (('=', '1.2'), ('<=', '1.3'), 1), + (('=', '1.2'), ('<', '1.3'), 1), + (('=', '1.2'), ('>', '1.3'), 0), + (('=', '1.2'), ('<>', '1.3'), 1), + + (('=', '1.2-1'), ('=', '1.2-1'), 1), + (('=', '1.2-1'), ('>=', '1.2-1'), 1), + (('=', '1.2-1'), ('<=', '1.2-1'), 1), + (('=', '1.2-1'), ('<', '1.2-1'), 0), + (('=', '1.2-1'), ('>', '1.2-1'), 0), + (('=', '1.2-1'), ('<>', '1.2-1'), 0), + + (('=', '1.2-1'), ('=', '1.2-2'), 0), + (('=', '1.2-1'), ('>=', '1.2-2'), 0), + (('=', '1.2-1'), ('<=', '1.2-2'), 1), + (('=', '1.2-1'), ('<', '1.2-2'), 1), + (('=', '1.2-1'), ('>', '1.2-2'), 0), + (('=', '1.2-1'), ('<>', '1.2-2'), 1), + + (('=', '1.3-1'), ('=', '1.2-2'), 0), + (('=', '1.3-1'), ('>=', '1.2-2'), 1), + (('=', '1.3-1'), ('<=', '1.2-2'), 0), + (('=', '1.3-1'), ('<', '1.2-2'), 0), + (('=', '1.3-1'), ('>', '1.2-2'), 1), + (('=', '1.3-1'), ('<>', '1.2-2'), 1), + + (('=', '0:1.2'), ('=', '1.2'), 1), + (('=', '0:1.2'), ('>=', '1.2'), 1), + (('=', '0:1.2'), ('<=', '1.2'), 1), + (('=', '0:1.2'), ('<', '1.2'), 0), + (('=', '0:1.2'), ('>', '1.2'), 0), + (('=', '0:1.2'), ('<>', '1.2'), 0), + + (('=', '1.2'), ('=', '0:1.2'), 1), + (('=', '1.2'), ('>=', '0:1.2'), 1), + (('=', '1.2'), ('<=', '0:1.2'), 1), + (('=', '1.2'), ('<', '0:1.2'), 0), + (('=', '1.2'), ('>', '0:1.2'), 0), + (('=', '1.2'), ('<>', '0:1.2'), 0), + + (('=', '1:1.2'), ('=', '1.2'), 0), + (('=', '1:1.2'), ('>=', '1.2'), 1), + (('=', '1:1.2'), ('<=', '1.2'), 0), + (('=', '1:1.2'), ('<', '1.2'), 0), + (('=', '1:1.2'), ('>', '1.2'), 1), + (('=', '1:1.2'), ('<>', '1.2'), 1), + + (('=', '1.2'), ('=', '1:1.2'), 0), + (('=', '1.2'), ('>=', '1:1.2'), 0), + (('=', '1.2'), ('<=', '1:1.2'), 1), + (('=', '1.2'), ('<', '1:1.2'), 1), + (('=', '1.2'), ('>', '1:1.2'), 0), + (('=', '1.2'), ('<>', '1:1.2'), 1), + + (('=', '2:1.2'), ('=', '2:1.2'), 1), + (('=', '2:1.2'), ('>=', '2:1.2'), 1), + (('=', '2:1.2'), ('<=', '2:1.2'), 1), + (('=', '2:1.2'), ('<', '2:1.2'), 0), + (('=', '2:1.2'), ('>', '2:1.2'), 0), + (('=', '2:1.2'), ('<>', '2:1.2'), 0), +] + +ms = ['no match', 'match'] + +myprint() # dumb kludge to fixup expected output +for pv, rv, res in tests: + d1 = rpm.ds(('A', pv[0], pv[1]), 'provides') + d2 = rpm.ds(('A', rv[0], rv[1]), 'requires') + match = d1.Compare(d2) + if match != res: + myprint('FAILED: %s with %s: %s' % (d1.DNEVR(), d2.DNEVR(),ms[res])) +], +[] +) diff --git a/tests/rpmtests.at b/tests/rpmtests.at index be0bdb091..7f0807d0b 100644 --- a/tests/rpmtests.at +++ b/tests/rpmtests.at @@ -10,3 +10,4 @@ m4_include([rpmconflict.at]) m4_include([rpmconfig.at]) m4_include([rpmmacro.at]) m4_include([rpmpython.at]) +m4_include([rpmdepmatch.at]) |