From ae2be086c6996e6ed02b7d828fdcac38248a964d Mon Sep 17 00:00:00 2001 From: Daniel Hartwig Date: Sat, 9 Jun 2012 22:49:37 +0200 Subject: * apt-pkg/contrib/cmdline.cc: - apply patch from Daniel Hartwig to fix a segfault in case the LongOpt is empty (Closes: #676331) --- test/libapt/commandline_test.cc | 21 +++++++++++++++++++++ test/libapt/makefile | 6 ++++++ 2 files changed, 27 insertions(+) create mode 100644 test/libapt/commandline_test.cc (limited to 'test') diff --git a/test/libapt/commandline_test.cc b/test/libapt/commandline_test.cc new file mode 100644 index 000000000..a37fb0220 --- /dev/null +++ b/test/libapt/commandline_test.cc @@ -0,0 +1,21 @@ +#include + +#include "assert.h" + +int main() +{ + CommandLine::Args Args[] = { + { 't', 0, "Test::Worked", 0 }, + { 'z', "zero", "Test::Zero", 0 }, + {0,0,0,0} + }; + + CommandLine CmdL(Args,_config); + char const * argv[] = { "test", "--zero", "-t" }; + CmdL.Parse(3 , argv); + + equals(true, _config->FindB("Test::Worked", false)); + equals(true, _config->FindB("Test::Zero", false)); + + return 0; +} diff --git a/test/libapt/makefile b/test/libapt/makefile index 1952051e2..b2e6db2dd 100644 --- a/test/libapt/makefile +++ b/test/libapt/makefile @@ -33,6 +33,12 @@ SLIBS = -lapt-pkg SOURCE = getlistoffilesindir_test.cc include $(PROGRAM_H) +# Program for testing CommandLine reconstruction +PROGRAM = Commandline${BASENAME} +SLIBS = -lapt-pkg +SOURCE = commandline_test.cc +include $(PROGRAM_H) + # Program for testing CommandLine reconstruction PROGRAM = CommandlineAsString${BASENAME} SLIBS = -lapt-pkg -- cgit v1.2.3 From 7a6d9076595b2acc164d6f057f609c96c359ea08 Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Sat, 9 Jun 2012 22:55:51 +0200 Subject: fix segfault with empty LongOpt in --no-* branch --- test/libapt/commandline_test.cc | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) (limited to 'test') diff --git a/test/libapt/commandline_test.cc b/test/libapt/commandline_test.cc index a37fb0220..de8a30bd6 100644 --- a/test/libapt/commandline_test.cc +++ b/test/libapt/commandline_test.cc @@ -9,13 +9,24 @@ int main() { 'z', "zero", "Test::Zero", 0 }, {0,0,0,0} }; - CommandLine CmdL(Args,_config); + char const * argv[] = { "test", "--zero", "-t" }; CmdL.Parse(3 , argv); - equals(true, _config->FindB("Test::Worked", false)); equals(true, _config->FindB("Test::Zero", false)); + _config->Clear("Test"); + equals(false, _config->FindB("Test::Worked", false)); + equals(false, _config->FindB("Test::Zero", false)); + + _config->Set("Test::Zero", true); + equals(true, _config->FindB("Test::Zero", false)); + + char const * argv2[] = { "test", "--no-zero", "-t" }; + CmdL.Parse(3 , argv2); + equals(true, _config->FindB("Test::Worked", false)); + equals(false, _config->FindB("Test::Zero", false)); + return 0; } -- cgit v1.2.3 From a98b6615254f8f7251d43c52de8f1f605c821ed7 Mon Sep 17 00:00:00 2001 From: Daniel Hartwig Date: Sun, 10 Jun 2012 00:18:19 +0200 Subject: * cmdline/apt-get.cc: - print URIs for all changelogs in case of --print-uris, thanks to Daniel Hartwig for the patch! (Closes: #674897) --- test/integration/test-apt-get-changelog | 3 +++ 1 file changed, 3 insertions(+) (limited to 'test') diff --git a/test/integration/test-apt-get-changelog b/test/integration/test-apt-get-changelog index 0a80cc08c..d013cc458 100755 --- a/test/integration/test-apt-get-changelog +++ b/test/integration/test-apt-get-changelog @@ -17,6 +17,9 @@ echo 'Apt::Changelogs::Server "http://localhost:8080/";' >> ./aptconfig.conf testequal "'http://localhost:8080//pool/apt_1.0/changelog'" aptget changelog apt --print-uris +testequal "'http://localhost:8080//pool/apt_1.0/changelog' +'http://localhost:8080//pool/apt_1.0/changelog'" aptget changelog apt apt --print-uris + aptget changelog apt -qq > apt.changelog testfileequal 'apt.changelog' "$(cat aptarchive/pool/apt_1.0/changelog)" rm apt.changelog -- cgit v1.2.3 From f87fab03bade8a049b318df68dfa4c361fab944c Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Sun, 10 Jun 2012 00:40:55 +0200 Subject: * apt-pkg/aptconfiguration.cc: - if APT::Languages=none save "none" in allCodes so that the detected configuration is cached as intended (Closes: #674690, LP: #1004947) --- test/libapt/getlanguages_test.cc | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'test') diff --git a/test/libapt/getlanguages_test.cc b/test/libapt/getlanguages_test.cc index 274cf4aa4..cef89bde6 100644 --- a/test/libapt/getlanguages_test.cc +++ b/test/libapt/getlanguages_test.cc @@ -144,7 +144,8 @@ int main(int argc,char *argv[]) _config->Set("Acquire::Languages", "none"); vec = APT::Configuration::getLanguages(true, false, env); - equals(vec.size(), 0); + equals(vec.size(), 1); + equals(vec[0], "none"); _config->Set("Acquire::Languages", ""); _config->Set("Dir::State::lists", "/non-existing-dir"); @@ -168,7 +169,8 @@ int main(int argc,char *argv[]) _config->Set("Acquire::Languages", "none"); env[0] = "de_DE.UTF-8"; vec = APT::Configuration::getLanguages(true, false, env); - equals(vec.size(), 0); + equals(vec.size(), 1); + equals(vec[0], "none"); _config->Set("Acquire::Languages", ""); //FIXME: Remove support for this deprecated setting -- cgit v1.2.3 From d5dea0bed00ff1811fac1b56c2046d63c937a3f6 Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Mon, 11 Jun 2012 00:16:51 +0200 Subject: check build-dep candidate if install is forbidden --- test/integration/framework | 3 ++- .../test-bug-632221-cross-dependency-satisfaction | 14 ++++++++++++++ 2 files changed, 16 insertions(+), 1 deletion(-) (limited to 'test') diff --git a/test/integration/framework b/test/integration/framework index 5a0e1070f..dba8c0162 100644 --- a/test/integration/framework +++ b/test/integration/framework @@ -508,7 +508,8 @@ Architecture: $ARCH" >> $FILE test -z "$DEPENDENCIES" || echo "$DEPENDENCIES" >> $FILE echo "Files: d41d8cd98f00b204e9800998ecf8427e 0 ${NAME}_${VERSION}.dsc - d41d8cd98f00b204e9800998ecf8427e 0 ${NAME}_${VERSION}.tar.gz" >> $FILE + d41d8cd98f00b204e9800998ecf8427e 0 ${NAME}_${VERSION}.tar.gz +" >> $FILE } insertinstalledpackage() { diff --git a/test/integration/test-bug-632221-cross-dependency-satisfaction b/test/integration/test-bug-632221-cross-dependency-satisfaction index a128366c5..93cc153e6 100755 --- a/test/integration/test-bug-632221-cross-dependency-satisfaction +++ b/test/integration/test-bug-632221-cross-dependency-satisfaction @@ -23,8 +23,22 @@ insertpackage 'unstable' 'linux-stuff' 'amd64,armel' '1.0' insertsource 'unstable' 'apt' 'any' '0.8.15' 'Build-Depends: doxygen, libc6-dev, libc6-dev:native, cool:any, amdboot:amd64, foreigner, libfwibble-dev, arm-stuff [any-arm] | linux-stuff [ linux-any]' +insertsource 'unstable' 'forbidden-none' 'any' '1' 'Build-Depends: amdboot:any' +insertsource 'unstable' 'forbidden-same' 'any' '1' 'Build-Depends: libc6:any' +insertsource 'unstable' 'forbidden-foreign' 'any' '1' 'Build-Depends: doxygen:any' + setupaptarchive +testequal "Reading package lists... +Building dependency tree... +E: Build-Depends dependency for forbidden-none can't be satisfied because amdboot:any is not allowed on 'Multi-Arch: none' packages" aptget build-dep forbidden-none -s -a armel +testequal "Reading package lists... +Building dependency tree... +E: Build-Depends dependency for forbidden-same can't be satisfied because libc6:any is not allowed on 'Multi-Arch: same' packages" aptget build-dep forbidden-same -s -a armel +testequal "Reading package lists... +Building dependency tree... +E: Build-Depends dependency for forbidden-foreign can't be satisfied because doxygen:any is not allowed on 'Multi-Arch: foreign' packages" aptget build-dep forbidden-foreign -s -a armel + testequal 'Reading package lists... Building dependency tree... The following NEW packages will be installed: -- cgit v1.2.3 From 249a02f55a2b311fc130efe3b3a99995b6a71360 Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Mon, 11 Jun 2012 02:17:17 +0200 Subject: add a few tests to check that arch-specific qualifiers work --- .../test-bug-632221-cross-dependency-satisfaction | 43 ++++++++++++++++++++++ 1 file changed, 43 insertions(+) (limited to 'test') diff --git a/test/integration/test-bug-632221-cross-dependency-satisfaction b/test/integration/test-bug-632221-cross-dependency-satisfaction index 93cc153e6..208c613a2 100755 --- a/test/integration/test-bug-632221-cross-dependency-satisfaction +++ b/test/integration/test-bug-632221-cross-dependency-satisfaction @@ -27,6 +27,12 @@ insertsource 'unstable' 'forbidden-none' 'any' '1' 'Build-Depends: amdboot:any' insertsource 'unstable' 'forbidden-same' 'any' '1' 'Build-Depends: libc6:any' insertsource 'unstable' 'forbidden-foreign' 'any' '1' 'Build-Depends: doxygen:any' +insertpackage 'unstable' 'specific' 'amd64' '1.0' 'Depends: libc6:amd64' +insertpackage 'unstable' 'specific' 'armel' '1.0' 'Depends: libc6:armel' + +insertsource 'unstable' 'source-specific-amd64' 'amd64' '1' 'Build-Depends: specific:amd64' +insertsource 'unstable' 'source-specific-armel' 'armel' '1' 'Build-Depends: specific:armel' + setupaptarchive testequal "Reading package lists... @@ -39,6 +45,43 @@ testequal "Reading package lists... Building dependency tree... E: Build-Depends dependency for forbidden-foreign can't be satisfied because doxygen:any is not allowed on 'Multi-Arch: foreign' packages" aptget build-dep forbidden-foreign -s -a armel +testequal 'Reading package lists... +Building dependency tree... +The following NEW packages will be installed: + libc6 specific +0 upgraded, 2 newly installed, 0 to remove and 0 not upgraded. +Inst libc6 (1.0 unstable [amd64]) +Inst specific (1.0 unstable [amd64]) +Conf libc6 (1.0 unstable [amd64]) +Conf specific (1.0 unstable [amd64])' aptget build-dep source-specific-amd64 -s +testequal 'Reading package lists... +Building dependency tree... +The following NEW packages will be installed: + libc6 specific +0 upgraded, 2 newly installed, 0 to remove and 0 not upgraded. +Inst libc6 (1.0 unstable [amd64]) +Inst specific (1.0 unstable [amd64]) +Conf libc6 (1.0 unstable [amd64]) +Conf specific (1.0 unstable [amd64])' aptget build-dep source-specific-amd64 -s -a armel +testequal 'Reading package lists... +Building dependency tree... +The following NEW packages will be installed: + libc6:armel specific:armel +0 upgraded, 2 newly installed, 0 to remove and 0 not upgraded. +Inst libc6:armel (1.0 unstable [armel]) +Inst specific:armel (1.0 unstable [armel]) +Conf libc6:armel (1.0 unstable [armel]) +Conf specific:armel (1.0 unstable [armel])' aptget build-dep source-specific-armel -s +testequal 'Reading package lists... +Building dependency tree... +The following NEW packages will be installed: + libc6:armel specific:armel +0 upgraded, 2 newly installed, 0 to remove and 0 not upgraded. +Inst libc6:armel (1.0 unstable [armel]) +Inst specific:armel (1.0 unstable [armel]) +Conf libc6:armel (1.0 unstable [armel]) +Conf specific:armel (1.0 unstable [armel])' aptget build-dep source-specific-armel -s -a armel + testequal 'Reading package lists... Building dependency tree... The following NEW packages will be installed: -- cgit v1.2.3