summaryrefslogtreecommitdiff
path: root/test/libapt
diff options
context:
space:
mode:
Diffstat (limited to 'test/libapt')
-rw-r--r--test/libapt/assert.h13
-rw-r--r--test/libapt/cdromfindmountpointfordevice_test.cc26
-rw-r--r--test/libapt/cdromfindpackages_test.cc4
-rw-r--r--test/libapt/cdromreducesourcelist_test.cc6
-rw-r--r--test/libapt/commandline_test.cc3
-rw-r--r--test/libapt/commandlineasstring_test.cc2
-rw-r--r--test/libapt/compareversion_test.cc15
-rw-r--r--test/libapt/configuration_test.cc38
-rw-r--r--test/libapt/fileutl_test.cc9
-rw-r--r--test/libapt/getarchitectures_test.cc7
-rw-r--r--test/libapt/getlanguages_test.cc10
-rw-r--r--test/libapt/getlistoffilesindir_test.cc7
-rw-r--r--test/libapt/globalerror_test.cc8
-rw-r--r--test/libapt/hashsums_test.cc20
-rw-r--r--test/libapt/indexcopytosourcelist_test.cc9
-rw-r--r--test/libapt/makefile6
-rw-r--r--test/libapt/parsedepends_test.cc96
-rwxr-xr-xtest/libapt/run-tests8
-rw-r--r--test/libapt/sourcelist_test.cc13
-rw-r--r--test/libapt/strutil_test.cc9
-rw-r--r--test/libapt/tagfile_test.cc10
-rw-r--r--test/libapt/uri_test.cc4
22 files changed, 248 insertions, 75 deletions
diff --git a/test/libapt/assert.h b/test/libapt/assert.h
index 113c057ed..357801592 100644
--- a/test/libapt/assert.h
+++ b/test/libapt/assert.h
@@ -1,11 +1,18 @@
#include <iostream>
#include <cstdlib>
+#include <apt-pkg/macros.h>
+
+#if __GNUC__ >= 4
+ #pragma GCC diagnostic push
+ #pragma GCC diagnostic ignored "-Wmissing-declarations"
+#endif
+
#define equals(x,y) assertEquals(y, x, __LINE__)
#define equalsNot(x,y) assertEqualsNot(y, x, __LINE__)
template < typename X, typename Y >
-void OutputAssertEqual(X expect, char const* compare, Y get, unsigned long const &line) {
+APT_NORETURN void OutputAssertEqual(X expect, char const* compare, Y get, unsigned long const &line) {
std::cerr << "Test FAILED: »" << expect << "« " << compare << " »" << get << "« at line " << line << std::endl;
std::exit(EXIT_FAILURE);
}
@@ -111,3 +118,7 @@ void dumpVector(X vec) {
v != vec.end(); ++v)
std::cout << *v << std::endl;
}
+
+#if __GNUC__ >= 4
+ #pragma GCC diagnostic pop
+#endif
diff --git a/test/libapt/cdromfindmountpointfordevice_test.cc b/test/libapt/cdromfindmountpointfordevice_test.cc
new file mode 100644
index 000000000..26dcd1459
--- /dev/null
+++ b/test/libapt/cdromfindmountpointfordevice_test.cc
@@ -0,0 +1,26 @@
+#include <config.h>
+
+#include <apt-pkg/cdromutl.h>
+#include <apt-pkg/configuration.h>
+
+#include <string>
+#include <vector>
+
+#include "assert.h"
+
+int main(int argc, char const *argv[]) {
+ if (argc != 2) {
+ std::cout << "One parameter expected - given " << argc << std::endl;
+ return 100;
+ }
+
+ _config->Set("Dir::state::Mountpoints", argv[1]);
+ equals("/", FindMountPointForDevice("rootfs"));
+ equals("/", FindMountPointForDevice("/dev/disk/by-uuid/fadcbc52-6284-4874-aaaa-dcee1f05fe21"));
+ equals("/sys", FindMountPointForDevice("sysfs"));
+ equals("/sys0", FindMountPointForDevice("sysfs0"));
+ equals("/boot/efi", FindMountPointForDevice("/dev/sda1"));
+ equals("/tmp", FindMountPointForDevice("tmpfs"));
+
+ return 0;
+}
diff --git a/test/libapt/cdromfindpackages_test.cc b/test/libapt/cdromfindpackages_test.cc
index e9f5a51b0..583de1423 100644
--- a/test/libapt/cdromfindpackages_test.cc
+++ b/test/libapt/cdromfindpackages_test.cc
@@ -1,9 +1,13 @@
+#include <config.h>
+
#include <apt-pkg/cdrom.h>
#include <apt-pkg/error.h>
#include <algorithm>
#include <string>
#include <vector>
+#include <stddef.h>
+#include <iostream>
#include "assert.h"
diff --git a/test/libapt/cdromreducesourcelist_test.cc b/test/libapt/cdromreducesourcelist_test.cc
index 729da23a6..196d0136e 100644
--- a/test/libapt/cdromreducesourcelist_test.cc
+++ b/test/libapt/cdromreducesourcelist_test.cc
@@ -1,7 +1,7 @@
+#include <config.h>
+
#include <apt-pkg/cdrom.h>
-#include <apt-pkg/error.h>
-#include <algorithm>
#include <string>
#include <vector>
@@ -15,7 +15,7 @@ public:
}
};
-int main(int argc, char const *argv[]) {
+int main() {
Cdrom cd;
std::vector<std::string> List;
std::string CD("/media/cdrom/");
diff --git a/test/libapt/commandline_test.cc b/test/libapt/commandline_test.cc
index de8a30bd6..d8c5bc5bd 100644
--- a/test/libapt/commandline_test.cc
+++ b/test/libapt/commandline_test.cc
@@ -1,4 +1,7 @@
+#include <config.h>
+
#include <apt-pkg/cmndline.h>
+#include <apt-pkg/configuration.h>
#include "assert.h"
diff --git a/test/libapt/commandlineasstring_test.cc b/test/libapt/commandlineasstring_test.cc
index a38957d7e..5c005e956 100644
--- a/test/libapt/commandlineasstring_test.cc
+++ b/test/libapt/commandlineasstring_test.cc
@@ -1,3 +1,5 @@
+#include <config.h>
+
#include <apt-pkg/cmndline.h>
#include <apt-pkg/configuration.h>
diff --git a/test/libapt/compareversion_test.cc b/test/libapt/compareversion_test.cc
index fdb1d5674..43b98f240 100644
--- a/test/libapt/compareversion_test.cc
+++ b/test/libapt/compareversion_test.cc
@@ -16,22 +16,21 @@
##################################################################### */
/*}}}*/
-#include <apt-pkg/macros.h>
+#include <config.h>
+
#include <apt-pkg/error.h>
-#include <apt-pkg/version.h>
#include <apt-pkg/debversion.h>
#include <apt-pkg/fileutl.h>
-#include <iostream>
-#include <fstream>
+#include <fstream>
+#include <string>
#include <stdlib.h>
#include <unistd.h>
-#include <sys/types.h>
#include <sys/wait.h>
using namespace std;
-bool callDPkg(const char *val, const char *ref, const char &op) {
+static bool callDPkg(const char *val, const char *ref, const char &op) {
pid_t Process = ExecFork();
if (Process == 0)
{
@@ -50,7 +49,7 @@ bool callDPkg(const char *val, const char *ref, const char &op) {
return WIFEXITED(Ret) == true && WEXITSTATUS(Ret) == 0;
}
-void assertVersion(int const &CurLine, string const &A, string const &B, int const &Expected) {
+static void assertVersion(int const &CurLine, string const &A, string const &B, int const &Expected) {
int Res = debVS.CmpVersion(A.c_str(), B.c_str());
bool const dpkg = callDPkg(A.c_str(),B.c_str(), Expected);
Res = (Res < 0) ? -1 : ( (Res > 0) ? 1 : Res);
@@ -61,7 +60,7 @@ void assertVersion(int const &CurLine, string const &A, string const &B, int con
_error->Error("DPkg differ with line: %u. '%s' '%s' '%s' == false",CurLine,A.c_str(),((Expected == 1) ? "<<" : ( (Expected == 0) ? "=" : ">>")),B.c_str());
}
-bool RunTest(const char *File)
+static bool RunTest(const char *File)
{
if (FileExists(File) == false)
return _error->Error("Versiontestfile %s doesn't exist!", File);
diff --git a/test/libapt/configuration_test.cc b/test/libapt/configuration_test.cc
index 2c974ee0a..c9235500c 100644
--- a/test/libapt/configuration_test.cc
+++ b/test/libapt/configuration_test.cc
@@ -1,3 +1,5 @@
+#include <config.h>
+
#include <apt-pkg/configuration.h>
#include <string>
@@ -5,7 +7,7 @@
#include "assert.h"
-int main(int argc,const char *argv[]) {
+int main() {
Configuration Cnf;
std::vector<std::string> fds;
@@ -98,9 +100,37 @@ int main(int argc,const char *argv[]) {
equals(Cnf.FindDir("Dir::State"), "/rootdir/dev/null");
equals(Cnf.FindDir("Dir::State::lists"), "/rootdir/dev/null");
- Cnf.Set("Moo::Bar", "1");
- Cnf.Clear();
- equals(Cnf.Find("Moo::Bar"), "");
+ Cnf.Set("Moo::Bar", "1");
+ Cnf.Clear();
+ equals(Cnf.Find("Moo::Bar"), "");
+
+ std::vector<std::string> vec = Cnf.FindVector("Test::Vector", "");
+ equals(vec.size(), 0);
+ vec = Cnf.FindVector("Test::Vector", "foo");
+ equals(vec.size(), 1);
+ equals(vec[0], "foo");
+ vec = Cnf.FindVector("Test::Vector", "foo,bar");
+ equals(vec.size(), 2);
+ equals(vec[0], "foo");
+ equals(vec[1], "bar");
+ Cnf.Set("Test::Vector::", "baz");
+ Cnf.Set("Test::Vector::", "bob");
+ Cnf.Set("Test::Vector::", "dob");
+ vec = Cnf.FindVector("Test::Vector");
+ equals(vec.size(), 3);
+ equals(vec[0], "baz");
+ equals(vec[1], "bob");
+ equals(vec[2], "dob");
+ vec = Cnf.FindVector("Test::Vector", "foo,bar");
+ equals(vec.size(), 3);
+ equals(vec[0], "baz");
+ equals(vec[1], "bob");
+ equals(vec[2], "dob");
+ Cnf.Set("Test::Vector", "abel,bravo");
+ vec = Cnf.FindVector("Test::Vector", "foo,bar");
+ equals(vec.size(), 2);
+ equals(vec[0], "abel");
+ equals(vec[1], "bravo");
//FIXME: Test for configuration file parsing;
// currently only integration/ tests test them implicitly
diff --git a/test/libapt/fileutl_test.cc b/test/libapt/fileutl_test.cc
index 462bdefd9..8da832ba9 100644
--- a/test/libapt/fileutl_test.cc
+++ b/test/libapt/fileutl_test.cc
@@ -1,16 +1,15 @@
+#include <config.h>
+
#include <apt-pkg/error.h>
#include <apt-pkg/fileutl.h>
-#include "assert.h"
#include <string>
#include <vector>
-
-#include <stdio.h>
-#include <iostream>
#include <stdlib.h>
+#include "assert.h"
-int main(int argc,char *argv[])
+int main()
{
std::vector<std::string> files;
diff --git a/test/libapt/getarchitectures_test.cc b/test/libapt/getarchitectures_test.cc
index 807469263..f4dfc6ae8 100644
--- a/test/libapt/getarchitectures_test.cc
+++ b/test/libapt/getarchitectures_test.cc
@@ -1,13 +1,14 @@
+#include <config.h>
+
#include <apt-pkg/aptconfiguration.h>
#include <apt-pkg/configuration.h>
-#include "assert.h"
#include <string>
#include <vector>
-#include <iostream>
+#include "assert.h"
-int main(int argc,char *argv[])
+int main()
{
std::vector<std::string> vec;
diff --git a/test/libapt/getlanguages_test.cc b/test/libapt/getlanguages_test.cc
index cef89bde6..15aa4e879 100644
--- a/test/libapt/getlanguages_test.cc
+++ b/test/libapt/getlanguages_test.cc
@@ -1,3 +1,5 @@
+#include <config.h>
+
#include <apt-pkg/aptconfiguration.h>
#include <apt-pkg/configuration.h>
@@ -105,6 +107,14 @@ int main(int argc,char *argv[])
vec = APT::Configuration::getLanguages(false, false, env);
equals(vec.size(), 1);
equals(vec[0], "fr");
+
+ _config->Set("Acquire::Languages", "environment,en");
+ env[0] = "de_DE.UTF-8";
+ vec = APT::Configuration::getLanguages(false, false, env);
+ equals(vec.size(), 3);
+ equals(vec[0], "de_DE");
+ equals(vec[1], "de");
+ equals(vec[2], "en");
_config->Set("Acquire::Languages", "");
_config->Set("Acquire::Languages::1", "environment");
diff --git a/test/libapt/getlistoffilesindir_test.cc b/test/libapt/getlistoffilesindir_test.cc
index b2c95e840..df125fc83 100644
--- a/test/libapt/getlistoffilesindir_test.cc
+++ b/test/libapt/getlistoffilesindir_test.cc
@@ -1,12 +1,13 @@
+#include <config.h>
+
#include <apt-pkg/fileutl.h>
-#include "assert.h"
#include <string>
#include <vector>
-
-#include <stdio.h>
#include <iostream>
+#include "assert.h"
+
#define P(x) std::string(argv[1]).append("/").append(x)
int main(int argc,char *argv[])
diff --git a/test/libapt/globalerror_test.cc b/test/libapt/globalerror_test.cc
index b6939231d..e913fdc12 100644
--- a/test/libapt/globalerror_test.cc
+++ b/test/libapt/globalerror_test.cc
@@ -1,11 +1,15 @@
+#include <config.h>
+
#include <apt-pkg/error.h>
-#include "assert.h"
+#include <stddef.h>
#include <string>
#include <errno.h>
#include <string.h>
-int main(int argc,char *argv[])
+#include "assert.h"
+
+int main()
{
std::string const textOfErrnoZero(strerror(0));
diff --git a/test/libapt/hashsums_test.cc b/test/libapt/hashsums_test.cc
index 3da89052b..d743faec6 100644
--- a/test/libapt/hashsums_test.cc
+++ b/test/libapt/hashsums_test.cc
@@ -1,12 +1,15 @@
+#include <config.h>
+
#include <apt-pkg/md5.h>
#include <apt-pkg/sha1.h>
#include <apt-pkg/sha2.h>
#include <apt-pkg/strutl.h>
#include <apt-pkg/hashes.h>
#include <apt-pkg/fileutl.h>
-#include <iostream>
-#include <stdio.h>
+#include <iostream>
+#include <stdlib.h>
+#include <string>
#include "assert.h"
@@ -43,24 +46,29 @@ template <class T> void TestMill(const char *Out)
int main(int argc, char** argv)
{
+ if (argc != 6) {
+ std::cout << "Five parameter expected - given " << argc << std::endl;
+ return 100;
+ }
+
// test HashSumValue which doesn't calculate but just stores sums
{
- string md5sum = argv[2];
+ std::string md5sum = argv[2];
MD5SumValue md5(md5sum);
equals(md5.Value(), md5sum);
}
{
- string sha1sum = argv[3];
+ std::string sha1sum = argv[3];
SHA1SumValue sha1(sha1sum);
equals(sha1.Value(), sha1sum);
}
{
- string sha2sum = argv[4];
+ std::string sha2sum = argv[4];
SHA256SumValue sha2(sha2sum);
equals(sha2.Value(), sha2sum);
}
{
- string sha2sum = argv[5];
+ std::string sha2sum = argv[5];
SHA512SumValue sha2(sha2sum);
equals(sha2.Value(), sha2sum);
}
diff --git a/test/libapt/indexcopytosourcelist_test.cc b/test/libapt/indexcopytosourcelist_test.cc
index 69d8fae86..e04ab261b 100644
--- a/test/libapt/indexcopytosourcelist_test.cc
+++ b/test/libapt/indexcopytosourcelist_test.cc
@@ -1,8 +1,11 @@
+#include <config.h>
+
#include <apt-pkg/configuration.h>
#include <apt-pkg/aptconfiguration.h>
#include <apt-pkg/indexcopy.h>
#include <string>
+#include <stdio.h>
#include "assert.h"
@@ -12,14 +15,14 @@ public:
IndexCopy::ConvertToSourceList(CD, Path);
return Path;
}
- bool GetFile(std::string &Filename,unsigned long long &Size) { return false; }
- bool RewriteEntry(FILE *Target,std::string File) { return false; }
+ bool GetFile(std::string &/*Filename*/, unsigned long long &/*Size*/) { return false; }
+ bool RewriteEntry(FILE * /*Target*/, std::string /*File*/) { return false; }
const char *GetFileName() { return NULL; }
const char *Type() { return NULL; }
};
-int main(int argc, char const *argv[]) {
+int main() {
NoCopy ic;
std::string const CD("/media/cdrom/");
diff --git a/test/libapt/makefile b/test/libapt/makefile
index a8e053d6e..66d6ea783 100644
--- a/test/libapt/makefile
+++ b/test/libapt/makefile
@@ -94,6 +94,12 @@ SLIBS = -lapt-pkg
SOURCE = cdromreducesourcelist_test.cc
include $(PROGRAM_H)
+# test cdroms FindMountPointForDevice for udev autodetection
+PROGRAM = CdromFindMountPointForDevice${BASENAME}
+SLIBS = -lapt-pkg
+SOURCE = cdromfindmountpointfordevice_test.cc
+include $(PROGRAM_H)
+
# test IndexCopy::ConvertToSourceList
PROGRAM = IndexCopyToSourceList${BASENAME}
SLIBS = -lapt-pkg
diff --git a/test/libapt/parsedepends_test.cc b/test/libapt/parsedepends_test.cc
index e95016240..5564e2bc0 100644
--- a/test/libapt/parsedepends_test.cc
+++ b/test/libapt/parsedepends_test.cc
@@ -1,16 +1,24 @@
+#include <config.h>
+
#include <apt-pkg/deblistparser.h>
#include <apt-pkg/configuration.h>
+#include <apt-pkg/pkgcache.h>
+
+#include <string.h>
+#include <string>
#include "assert.h"
-int main(int argc,char *argv[]) {
+int main() {
std::string Package;
std::string Version;
unsigned int Op = 5;
unsigned int Null = 0;
bool StripMultiArch = true;
bool ParseArchFlags = false;
+ bool ParseRestrictionsList = false;
_config->Set("APT::Architecture","amd64");
+ _config->Set("APT::Build-Profiles","stage1");
const char* Depends =
"debhelper:any (>= 5.0), "
@@ -27,6 +35,9 @@ int main(int argc,char *argv[]) {
"os-for-me [ linux-any ], "
"cpu-not-for-me [ any-armel ], "
"os-not-for-me [ kfreebsd-any ], "
+ "not-in-stage1 <!profile.stage1>, "
+ "not-in-stage1-or-nodoc <!profile.nodoc !profile.stage1>, "
+ "only-in-stage1 <unknown.unknown profile.stage1>, "
"overlord-dev:any (= 7.15.3~) | overlord-dev:native (>> 7.15.5), "
;
@@ -39,7 +50,7 @@ test:
const char* Start = Depends;
const char* End = Depends + strlen(Depends);
- Start = debListParser::ParseDepends(Start, End, Package, Version, Op, ParseArchFlags, StripMultiArch);
+ Start = debListParser::ParseDepends(Start, End, Package, Version, Op, ParseArchFlags, StripMultiArch, ParseRestrictionsList);
if (StripMultiArch == true)
equals("debhelper", Package);
else
@@ -47,7 +58,7 @@ test:
equals("5.0", Version);
equals(Null | pkgCache::Dep::GreaterEq, Op);
- Start = debListParser::ParseDepends(Start, End, Package, Version, Op, ParseArchFlags, StripMultiArch);
+ Start = debListParser::ParseDepends(Start, End, Package, Version, Op, ParseArchFlags, StripMultiArch, ParseRestrictionsList);
if (StripMultiArch == true)
equals("libdb-dev", Package);
else
@@ -55,7 +66,7 @@ test:
equals("", Version);
equals(Null | pkgCache::Dep::NoOp, Op);
- Start = debListParser::ParseDepends(Start, End, Package, Version, Op, ParseArchFlags, StripMultiArch);
+ Start = debListParser::ParseDepends(Start, End, Package, Version, Op, ParseArchFlags, StripMultiArch, ParseRestrictionsList);
if (StripMultiArch == true)
equals("gettext", Package);
else
@@ -63,7 +74,7 @@ test:
equals("0.12", Version);
equals(Null | pkgCache::Dep::LessEq, Op);
- Start = debListParser::ParseDepends(Start, End, Package, Version, Op, ParseArchFlags, StripMultiArch);
+ Start = debListParser::ParseDepends(Start, End, Package, Version, Op, ParseArchFlags, StripMultiArch, ParseRestrictionsList);
if (StripMultiArch == true)
equals("libcurl4-gnutls-dev", Package);
else
@@ -71,104 +82,131 @@ test:
equals("", Version);
equals(Null | pkgCache::Dep::Or, Op);
- Start = debListParser::ParseDepends(Start, End, Package, Version, Op, ParseArchFlags, StripMultiArch);
+ Start = debListParser::ParseDepends(Start, End, Package, Version, Op, ParseArchFlags, StripMultiArch, ParseRestrictionsList);
equals("libcurl3-gnutls-dev", Package);
equals("7.15.5", Version);
equals(Null | pkgCache::Dep::Greater, Op);
- Start = debListParser::ParseDepends(Start, End, Package, Version, Op, ParseArchFlags, StripMultiArch);
+ Start = debListParser::ParseDepends(Start, End, Package, Version, Op, ParseArchFlags, StripMultiArch, ParseRestrictionsList);
equals("debiandoc-sgml", Package);
equals("", Version);
equals(Null | pkgCache::Dep::NoOp, Op);
- Start = debListParser::ParseDepends(Start, End, Package, Version, Op, ParseArchFlags, StripMultiArch);
+ Start = debListParser::ParseDepends(Start, End, Package, Version, Op, ParseArchFlags, StripMultiArch, ParseRestrictionsList);
equals("apt", Package);
equals("0.7.25", Version);
equals(Null | pkgCache::Dep::GreaterEq, Op);
if (ParseArchFlags == true) {
- Start = debListParser::ParseDepends(Start, End, Package, Version, Op, ParseArchFlags, StripMultiArch);
+ Start = debListParser::ParseDepends(Start, End, Package, Version, Op, ParseArchFlags, StripMultiArch, ParseRestrictionsList);
equals("", Package); // not-for-me
} else {
- equals(true, 0 == debListParser::ParseDepends(Start, End, Package, Version, Op, ParseArchFlags, StripMultiArch));
+ equals(true, 0 == debListParser::ParseDepends(Start, End, Package, Version, Op, ParseArchFlags, StripMultiArch, ParseRestrictionsList));
Start = strstr(Start, ",");
Start++;
}
if (ParseArchFlags == true) {
- Start = debListParser::ParseDepends(Start, End, Package, Version, Op, ParseArchFlags, StripMultiArch);
+ Start = debListParser::ParseDepends(Start, End, Package, Version, Op, ParseArchFlags, StripMultiArch, ParseRestrictionsList);
equals("only-for-me", Package);
equals("", Version);
equals(Null | pkgCache::Dep::NoOp, Op);
} else {
- equals(true, 0 == debListParser::ParseDepends(Start, End, Package, Version, Op, ParseArchFlags, StripMultiArch));
+ equals(true, 0 == debListParser::ParseDepends(Start, End, Package, Version, Op, ParseArchFlags, StripMultiArch, ParseRestrictionsList));
Start = strstr(Start, ",");
Start++;
}
if (ParseArchFlags == true) {
- Start = debListParser::ParseDepends(Start, End, Package, Version, Op, ParseArchFlags, StripMultiArch);
+ Start = debListParser::ParseDepends(Start, End, Package, Version, Op, ParseArchFlags, StripMultiArch, ParseRestrictionsList);
equals("any-for-me", Package);
equals("", Version);
equals(Null | pkgCache::Dep::NoOp, Op);
} else {
- equals(true, 0 == debListParser::ParseDepends(Start, End, Package, Version, Op, ParseArchFlags, StripMultiArch));
+ equals(true, 0 == debListParser::ParseDepends(Start, End, Package, Version, Op, ParseArchFlags, StripMultiArch, ParseRestrictionsList));
Start = strstr(Start, ",");
Start++;
}
if (ParseArchFlags == true) {
- Start = debListParser::ParseDepends(Start, End, Package, Version, Op, ParseArchFlags, StripMultiArch);
+ Start = debListParser::ParseDepends(Start, End, Package, Version, Op, ParseArchFlags, StripMultiArch, ParseRestrictionsList);
equals("not-for-darwin", Package);
equals("", Version);
equals(Null | pkgCache::Dep::NoOp, Op);
} else {
- equals(true, 0 == debListParser::ParseDepends(Start, End, Package, Version, Op, ParseArchFlags, StripMultiArch));
+ equals(true, 0 == debListParser::ParseDepends(Start, End, Package, Version, Op, ParseArchFlags, StripMultiArch, ParseRestrictionsList));
Start = strstr(Start, ",");
Start++;
}
if (ParseArchFlags == true) {
- Start = debListParser::ParseDepends(Start, End, Package, Version, Op, ParseArchFlags, StripMultiArch);
+ Start = debListParser::ParseDepends(Start, End, Package, Version, Op, ParseArchFlags, StripMultiArch, ParseRestrictionsList);
equals("cpu-for-me", Package);
equals("", Version);
equals(Null | pkgCache::Dep::NoOp, Op);
} else {
- equals(true, 0 == debListParser::ParseDepends(Start, End, Package, Version, Op, ParseArchFlags, StripMultiArch));
+ equals(true, 0 == debListParser::ParseDepends(Start, End, Package, Version, Op, ParseArchFlags, StripMultiArch, ParseRestrictionsList));
Start = strstr(Start, ",");
Start++;
}
if (ParseArchFlags == true) {
- Start = debListParser::ParseDepends(Start, End, Package, Version, Op, ParseArchFlags, StripMultiArch);
+ Start = debListParser::ParseDepends(Start, End, Package, Version, Op, ParseArchFlags, StripMultiArch, ParseRestrictionsList);
equals("os-for-me", Package);
equals("", Version);
equals(Null | pkgCache::Dep::NoOp, Op);
} else {
- equals(true, 0 == debListParser::ParseDepends(Start, End, Package, Version, Op, ParseArchFlags, StripMultiArch));
+ equals(true, 0 == debListParser::ParseDepends(Start, End, Package, Version, Op, ParseArchFlags, StripMultiArch, ParseRestrictionsList));
Start = strstr(Start, ",");
Start++;
}
if (ParseArchFlags == true) {
- Start = debListParser::ParseDepends(Start, End, Package, Version, Op, ParseArchFlags, StripMultiArch);
+ Start = debListParser::ParseDepends(Start, End, Package, Version, Op, ParseArchFlags, StripMultiArch, ParseRestrictionsList);
equals("", Package); // cpu-not-for-me
} else {
- equals(true, 0 == debListParser::ParseDepends(Start, End, Package, Version, Op, ParseArchFlags, StripMultiArch));
+ equals(true, 0 == debListParser::ParseDepends(Start, End, Package, Version, Op, ParseArchFlags, StripMultiArch, ParseRestrictionsList));
Start = strstr(Start, ",");
Start++;
}
if (ParseArchFlags == true) {
- Start = debListParser::ParseDepends(Start, End, Package, Version, Op, ParseArchFlags, StripMultiArch);
+ Start = debListParser::ParseDepends(Start, End, Package, Version, Op, ParseArchFlags, StripMultiArch, ParseRestrictionsList);
equals("", Package); // os-not-for-me
} else {
- equals(true, 0 == debListParser::ParseDepends(Start, End, Package, Version, Op, ParseArchFlags, StripMultiArch));
+ equals(true, 0 == debListParser::ParseDepends(Start, End, Package, Version, Op, ParseArchFlags, StripMultiArch, ParseRestrictionsList));
+ Start = strstr(Start, ",");
+ Start++;
+ }
+
+ if (ParseRestrictionsList == true) {
+ Start = debListParser::ParseDepends(Start, End, Package, Version, Op, ParseArchFlags, StripMultiArch, ParseRestrictionsList);
+ equals("", Package); // not-in-stage1
+ } else {
+ equals(true, 0 == debListParser::ParseDepends(Start, End, Package, Version, Op, ParseArchFlags, StripMultiArch, ParseRestrictionsList));
+ Start = strstr(Start, ",");
+ Start++;
+ }
+
+ if (ParseRestrictionsList == true) {
+ Start = debListParser::ParseDepends(Start, End, Package, Version, Op, ParseArchFlags, StripMultiArch, ParseRestrictionsList);
+ equals("", Package); // not-in-stage1-or-in-nodoc
+ } else {
+ equals(true, 0 == debListParser::ParseDepends(Start, End, Package, Version, Op, ParseArchFlags, StripMultiArch, ParseRestrictionsList));
+ Start = strstr(Start, ",");
+ Start++;
+ }
+
+ if (ParseRestrictionsList == true) {
+ Start = debListParser::ParseDepends(Start, End, Package, Version, Op, ParseArchFlags, StripMultiArch, ParseRestrictionsList);
+ equals("only-in-stage1", Package);
+ } else {
+ equals(true, 0 == debListParser::ParseDepends(Start, End, Package, Version, Op, ParseArchFlags, StripMultiArch, ParseRestrictionsList));
Start = strstr(Start, ",");
Start++;
}
- Start = debListParser::ParseDepends(Start, End, Package, Version, Op, ParseArchFlags, StripMultiArch);
+ Start = debListParser::ParseDepends(Start, End, Package, Version, Op, ParseArchFlags, StripMultiArch, ParseRestrictionsList);
if (StripMultiArch == true)
equals("overlord-dev", Package);
else
@@ -176,7 +214,7 @@ test:
equals("7.15.3~", Version);
equals(Null | pkgCache::Dep::Equals | pkgCache::Dep::Or, Op);
- debListParser::ParseDepends(Start, End, Package, Version, Op, ParseArchFlags, StripMultiArch);
+ debListParser::ParseDepends(Start, End, Package, Version, Op, ParseArchFlags, StripMultiArch, ParseRestrictionsList);
if (StripMultiArch == true)
equals("overlord-dev", Package);
else
@@ -185,11 +223,13 @@ test:
equals(Null | pkgCache::Dep::Greater, Op);
if (StripMultiArch == false)
- ParseArchFlags = true;
+ if (ParseArchFlags == false)
+ ParseRestrictionsList = !ParseRestrictionsList;
+ ParseArchFlags = !ParseArchFlags;
StripMultiArch = !StripMultiArch;
runner++;
- if (runner < 4)
+ if (runner < 8)
goto test; // this is the prove: tests are really evil ;)
return 0;
diff --git a/test/libapt/run-tests b/test/libapt/run-tests
index a056f31f9..0baedcf9e 100755
--- a/test/libapt/run-tests
+++ b/test/libapt/run-tests
@@ -108,6 +108,14 @@ do
"${tmppath}/dists/unstable/InRelease" \
"${tmppath}/dists/broken/Release.gpg"
ln -s "${tmppath}/dists/unstable" "${tmppath}/dists/sid"
+ elif [ $name = "CdromFindMountPointForDevice${EXT}" ]; then
+ tmppath=$(mktemp)
+ echo 'rootfs / rootfs rw 0 0
+sysfs /sys sysfs rw,nosuid,nodev,noexec,relatime 0 0
+sysfs0 /sys0 sysfs rw,nosuid,nodev,noexec,relatime 0 0
+/dev/disk/by-uuid/fadcbc52-6284-4874-aaaa-dcee1f05fe21 / ext4 rw,relatime,errors=remount-ro,data=ordered 0 0
+/dev/sda1 /boot/efi vfat rw,nosuid,nodev,noexec,relatime,fmask=0000,dmask=0000,allow_utime=0022,codepage=437,iocharset=utf8,shortname=lower,quiet,utf8,errors=remount-ro,rw,nosuid,nodev,noexec,relatime,fmask=0000,dmask=0000,allow_utime=0022,codepage=437,iocharset=utf8,shortname=lower,quiet,utf8,errors=remount-ro,rw,nosuid,nodev,noexec,relatime,fmask=0000,dmask=0000,allow_utime=0022,codepage=437,iocharset=utf8,shortname=lower,quiet,utf8,errors=remount-ro,rw,nosuid,nodev,noexec,relatime,fmask=0000,dmask=0000,allow_utime=0022,codepage=437,iocharset=utf8,shortname=lower,quiet,utf8,errors=remount-ro 0 0
+tmpfs /tmp tmpfs rw,nosuid,nodev,relatime 0 0' > $tmppath
fi
echo -n "Testing with ${NAME} "
diff --git a/test/libapt/sourcelist_test.cc b/test/libapt/sourcelist_test.cc
index 0300ce929..71aa54f1e 100644
--- a/test/libapt/sourcelist_test.cc
+++ b/test/libapt/sourcelist_test.cc
@@ -1,15 +1,20 @@
+#include <config.h>
+
+#include <apt-pkg/configuration.h>
#include <apt-pkg/sourcelist.h>
-#include <apt-pkg/tagfile.h>
+#include <apt-pkg/fileutl.h>
-#include "assert.h"
+#include <string>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
+#include "assert.h"
+
char *tempfile = NULL;
int tempfile_fd = -1;
-void remove_tmpfile(void)
+static void remove_tmpfile(void)
{
if (tempfile_fd > 0)
close(tempfile_fd);
@@ -19,7 +24,7 @@ void remove_tmpfile(void)
}
}
-int main(int argc, char *argv[])
+int main()
{
_config->Set("APT::Sources::Use-Deb822", true);
diff --git a/test/libapt/strutil_test.cc b/test/libapt/strutil_test.cc
index 8215654d0..618f4daba 100644
--- a/test/libapt/strutil_test.cc
+++ b/test/libapt/strutil_test.cc
@@ -1,8 +1,13 @@
+#include <config.h>
+
#include <apt-pkg/strutl.h>
+#include <string>
+#include <vector>
+
#include "assert.h"
-int main(int argc,char *argv[])
+int main()
{
std::string input, output, expected;
@@ -44,7 +49,7 @@ int main(int argc,char *argv[])
// Split
input = "status: libnet1:amd64: unpacked";
- vector<std::string> result = StringSplit(input, ": ");
+ std::vector<std::string> result = StringSplit(input, ": ");
equals(result[0], "status");
equals(result[1], "libnet1:amd64");
equals(result[2], "unpacked");
diff --git a/test/libapt/tagfile_test.cc b/test/libapt/tagfile_test.cc
index d12c74c95..aaf46e3e9 100644
--- a/test/libapt/tagfile_test.cc
+++ b/test/libapt/tagfile_test.cc
@@ -1,15 +1,19 @@
+#include <config.h>
+
#include <apt-pkg/fileutl.h>
#include <apt-pkg/tagfile.h>
-#include "assert.h"
+#include <string>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
+#include "assert.h"
+
char *tempfile = NULL;
int tempfile_fd = -1;
-void remove_tmpfile(void)
+static void remove_tmpfile(void)
{
if (tempfile_fd > 0)
close(tempfile_fd);
@@ -19,7 +23,7 @@ void remove_tmpfile(void)
}
}
-int main(int argc, char *argv[])
+int main()
{
FileFd fd;
const char contents[] = "FieldA-12345678: the value of the field";
diff --git a/test/libapt/uri_test.cc b/test/libapt/uri_test.cc
index 8216ade71..6559f1390 100644
--- a/test/libapt/uri_test.cc
+++ b/test/libapt/uri_test.cc
@@ -1,5 +1,9 @@
+#include <config.h>
+
#include <apt-pkg/strutl.h>
+#include <string>
+
#include "assert.h"
int main() {