From 081c9d442a6d39fb9bc419fe3ce697cc791cb844 Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Sun, 9 Nov 2014 21:38:53 +0100 Subject: various small additional tests and testcases Usually they don't provide a lot in terms of what they test, but they help in covering many lines from strictly anecdotal commands (stats, moo) and error messages, so that stuff which really needs to be tested, but isn't is better visible in coverage reports. Git-Dch: Ignore --- test/integration/test-apt-cache | 124 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 124 insertions(+) create mode 100755 test/integration/test-apt-cache (limited to 'test/integration/test-apt-cache') diff --git a/test/integration/test-apt-cache b/test/integration/test-apt-cache new file mode 100755 index 000000000..f47c0e08b --- /dev/null +++ b/test/integration/test-apt-cache @@ -0,0 +1,124 @@ +#!/bin/sh +set -e + +TESTDIR=$(readlink -f $(dirname $0)) +. $TESTDIR/framework + +setupenvironment +configarchitecture 'amd64' 'i386' + +DESCR='Some description + That has multiple lines' +insertpackage 'unstable' 'fancy' 'all' '1' +insertpackage 'unstable,installed' 'foo' 'all' '1' 'Depends: bar +Conflicts: foobar +Recommends: cool (>= 2) | cooler (<< 5)' "$DESCR" +insertpackage 'unstable' 'bar' 'all' '1' 'Depends: bar +Breaks: foo (<< 1) +Replaces: foo (<< 1)' "$DESCR" + +setupaptarchive + +# dpkg is installed by our framework +testdpkginstalled 'dpkg' +testempty aptcache unmet dpkg + +# FIXME: Find some usecase for unmet as it seems kinda useless/broken +#testsuccess aptcache unmet +#testsuccess aptcache unmet foo + +# not too useful to test, but makes coverage green… +testsuccess aptcache stats +cp rootdir/tmp/testsuccess.output stats.output +testsuccess test -s stats.output +testsuccess aptcache xvcg foo +cp rootdir/tmp/testsuccess.output xvcg.output +testsuccess test -s xvcg.output +testsuccess aptcache dotty foo +cp rootdir/tmp/testsuccess.output dotty.output +testsuccess test -s dotty.output +# for this, even the sourcecode says it is useless (expect debugging) +testsuccess aptcache dump +cp rootdir/tmp/testsuccess.output dump.output +testsuccess test -s dump.output + +testequal 'dpkg +bar +fancy +foo' aptcache pkgnames +testequal 'bar' aptcache pkgnames bar +testequal 'fancy +foo' aptcache pkgnames f + +testequal " foo | 1 | file:$(readlink -f .)/aptarchive/ unstable/main amd64 Packages" aptcache madison foo + +### depends + +testequal 'foo + Depends: bar + |Recommends: + Recommends: + Conflicts: + Conflicts: ' aptcache depends foo +testequal 'foo + Depends: bar + Recommends: + Conflicts: + Conflicts: ' aptcache depends foo -o APT::Cache::ShowOnlyFirstOr=1 +testequal 'foo + Depends: bar + |Recommends: (>= 2) + Recommends: (<< 5) + Conflicts: + Conflicts: ' aptcache depends foo -o APT::Cache::ShowVersion=1 +testequal 'foo + Depends: bar + Conflicts: + Conflicts: ' aptcache depends foo --no-recommends +testequal 'foo + Depends: bar' aptcache depends foo --important +testequal 'foo + Conflicts: + Conflicts: ' aptcache depends foo --important --no-depends --conflicts +testequal 'foo + Depends: bar + |Recommends: + Recommends: + Conflicts: + Conflicts: +bar + Depends: bar + Breaks: foo + Breaks: + Replaces: foo + Replaces: + + + + +' aptcache depends foo --recurse +testequal 'foo + Depends: bar +bar + Depends: bar + Replaces: foo + Replaces: +' aptcache depends foo --recurse --important --replaces + +## rdpends + +testequal 'foo +Reverse Depends: + bar + bar' aptcache rdepends foo +testequal 'foo +Reverse Depends: + Replaces: bar + Breaks: bar' aptcache rdepends foo -o APT::Cache::ShowDependencyType=1 +testequal 'foo +Reverse Depends: + Replaces: bar (<< 1) + Breaks: bar (<< 1)' aptcache rdepends foo -o APT::Cache::ShowDependencyType=1 -o APT::Cache::ShowVersion=1 +testequal 'foo +Reverse Depends: + Breaks: bar (<< 1)' aptcache rdepends foo -o APT::Cache::ShowDependencyType=1 -o APT::Cache::ShowVersion=1 --important --breaks -- cgit v1.2.3 From 25b86db159fbc3c043628e285c0c1ef24dec2c6e Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Tue, 10 Mar 2015 00:59:44 +0100 Subject: test exitcode as well as string equality We use test{success,failure} now all over the place in the framework, so its only consequencial to do this in the situations in which we test for a specific output as well. Git-Dch: Ignore --- test/integration/test-apt-cache | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) (limited to 'test/integration/test-apt-cache') diff --git a/test/integration/test-apt-cache b/test/integration/test-apt-cache index f47c0e08b..f3db8024f 100755 --- a/test/integration/test-apt-cache +++ b/test/integration/test-apt-cache @@ -42,45 +42,45 @@ testsuccess aptcache dump cp rootdir/tmp/testsuccess.output dump.output testsuccess test -s dump.output -testequal 'dpkg +testsuccessequal 'dpkg bar fancy foo' aptcache pkgnames -testequal 'bar' aptcache pkgnames bar -testequal 'fancy +testsuccessequal 'bar' aptcache pkgnames bar +testsuccessequal 'fancy foo' aptcache pkgnames f -testequal " foo | 1 | file:$(readlink -f .)/aptarchive/ unstable/main amd64 Packages" aptcache madison foo +testsuccessequal " foo | 1 | file:$(readlink -f .)/aptarchive/ unstable/main amd64 Packages" aptcache madison foo ### depends -testequal 'foo +testsuccessequal 'foo Depends: bar |Recommends: Recommends: Conflicts: Conflicts: ' aptcache depends foo -testequal 'foo +testsuccessequal 'foo Depends: bar Recommends: Conflicts: Conflicts: ' aptcache depends foo -o APT::Cache::ShowOnlyFirstOr=1 -testequal 'foo +testsuccessequal 'foo Depends: bar |Recommends: (>= 2) Recommends: (<< 5) Conflicts: Conflicts: ' aptcache depends foo -o APT::Cache::ShowVersion=1 -testequal 'foo +testsuccessequal 'foo Depends: bar Conflicts: Conflicts: ' aptcache depends foo --no-recommends -testequal 'foo +testsuccessequal 'foo Depends: bar' aptcache depends foo --important -testequal 'foo +testsuccessequal 'foo Conflicts: Conflicts: ' aptcache depends foo --important --no-depends --conflicts -testequal 'foo +testsuccessequal 'foo Depends: bar |Recommends: Recommends: @@ -97,7 +97,7 @@ bar ' aptcache depends foo --recurse -testequal 'foo +testsuccessequal 'foo Depends: bar bar Depends: bar @@ -107,18 +107,18 @@ bar ## rdpends -testequal 'foo +testsuccessequal 'foo Reverse Depends: bar bar' aptcache rdepends foo -testequal 'foo +testsuccessequal 'foo Reverse Depends: Replaces: bar Breaks: bar' aptcache rdepends foo -o APT::Cache::ShowDependencyType=1 -testequal 'foo +testsuccessequal 'foo Reverse Depends: Replaces: bar (<< 1) Breaks: bar (<< 1)' aptcache rdepends foo -o APT::Cache::ShowDependencyType=1 -o APT::Cache::ShowVersion=1 -testequal 'foo +testsuccessequal 'foo Reverse Depends: Breaks: bar (<< 1)' aptcache rdepends foo -o APT::Cache::ShowDependencyType=1 -o APT::Cache::ShowVersion=1 --important --breaks -- cgit v1.2.3