summaryrefslogtreecommitdiff
path: root/test/pacman/tests
diff options
context:
space:
mode:
authorAllan McRae <allan@archlinux.org>2010-05-30 14:41:59 +1000
committerDan McGee <dan@archlinux.org>2010-06-02 13:14:51 -0500
commit844d82fad811626b0b8e54db60ee4b3ea32a3cb9 (patch)
treed6ae52c513db060b1f81227c34bfb366ea3fa58c /test/pacman/tests
parentccea1b55766200c1ab371cf0f3b38c4cebdb2063 (diff)
Move pacman test suite
Move the test suite to test/pacman in order to make a logical location for a future makepkg test suite. Signed-off-by: Allan McRae <allan@archlinux.org> Signed-off-by: Dan McGee <dan@archlinux.org>
Diffstat (limited to 'test/pacman/tests')
-rw-r--r--test/pacman/tests/.gitignore1
-rw-r--r--test/pacman/tests/Makefile.am27
-rw-r--r--test/pacman/tests/config001.py17
-rw-r--r--test/pacman/tests/config002.py12
-rw-r--r--test/pacman/tests/database001.py11
-rw-r--r--test/pacman/tests/database002.py11
-rw-r--r--test/pacman/tests/database010.py17
-rw-r--r--test/pacman/tests/database011.py17
-rw-r--r--test/pacman/tests/database012.py31
-rw-r--r--test/pacman/tests/depconflict100.py15
-rw-r--r--test/pacman/tests/depconflict110.py13
-rw-r--r--test/pacman/tests/depconflict111.py13
-rw-r--r--test/pacman/tests/depconflict120.py19
-rw-r--r--test/pacman/tests/deptest001.py16
-rw-r--r--test/pacman/tests/dummy001.py21
-rw-r--r--test/pacman/tests/fileconflict001.py22
-rw-r--r--test/pacman/tests/fileconflict002.py18
-rw-r--r--test/pacman/tests/fileconflict003.py18
-rw-r--r--test/pacman/tests/fileconflict004.py19
-rw-r--r--test/pacman/tests/fileconflict005.py22
-rw-r--r--test/pacman/tests/fileconflict006.py24
-rw-r--r--test/pacman/tests/fileconflict007.py17
-rw-r--r--test/pacman/tests/ignore001.py17
-rw-r--r--test/pacman/tests/ignore002.py35
-rw-r--r--test/pacman/tests/ignore003.py35
-rw-r--r--test/pacman/tests/ignore004.py46
-rw-r--r--test/pacman/tests/ignore005.py46
-rw-r--r--test/pacman/tests/ldconfig001.py12
-rw-r--r--test/pacman/tests/ldconfig002.py16
-rw-r--r--test/pacman/tests/ldconfig003.py14
-rw-r--r--test/pacman/tests/mode001.py12
-rw-r--r--test/pacman/tests/mode002.py12
-rw-r--r--test/pacman/tests/mode003.py20
-rw-r--r--test/pacman/tests/pacman001.py5
-rw-r--r--test/pacman/tests/pacman002.py5
-rw-r--r--test/pacman/tests/pacman003.py5
-rw-r--r--test/pacman/tests/pacman004.py5
-rw-r--r--test/pacman/tests/provision001.py10
-rw-r--r--test/pacman/tests/provision010.py15
-rw-r--r--test/pacman/tests/provision011.py15
-rw-r--r--test/pacman/tests/provision012.py15
-rw-r--r--test/pacman/tests/provision020.py15
-rw-r--r--test/pacman/tests/provision021.py15
-rw-r--r--test/pacman/tests/provision022.py15
-rw-r--r--test/pacman/tests/query001.py10
-rw-r--r--test/pacman/tests/query002.py21
-rw-r--r--test/pacman/tests/query003.py11
-rw-r--r--test/pacman/tests/query004.py10
-rw-r--r--test/pacman/tests/query005.py21
-rw-r--r--test/pacman/tests/reason001.py16
-rw-r--r--test/pacman/tests/remove001.py9
-rw-r--r--test/pacman/tests/remove010.py13
-rw-r--r--test/pacman/tests/remove011.py13
-rw-r--r--test/pacman/tests/remove020.py13
-rw-r--r--test/pacman/tests/remove021.py13
-rw-r--r--test/pacman/tests/remove030.py11
-rw-r--r--test/pacman/tests/remove040.py15
-rw-r--r--test/pacman/tests/remove041.py19
-rw-r--r--test/pacman/tests/remove042.py15
-rw-r--r--test/pacman/tests/remove043.py15
-rw-r--r--test/pacman/tests/remove044.py16
-rw-r--r--test/pacman/tests/remove045.py27
-rw-r--r--test/pacman/tests/remove047.py24
-rw-r--r--test/pacman/tests/remove049.py18
-rw-r--r--test/pacman/tests/remove050.py20
-rw-r--r--test/pacman/tests/remove051.py20
-rw-r--r--test/pacman/tests/remove052.py21
-rw-r--r--test/pacman/tests/remove060.py19
-rw-r--r--test/pacman/tests/scriptlet001.py20
-rw-r--r--test/pacman/tests/scriptlet002.py20
-rw-r--r--test/pacman/tests/smoke001.py23
-rw-r--r--test/pacman/tests/symlink001.py20
-rw-r--r--test/pacman/tests/sync001.py13
-rw-r--r--test/pacman/tests/sync002.py18
-rw-r--r--test/pacman/tests/sync003.py13
-rw-r--r--test/pacman/tests/sync009.py13
-rw-r--r--test/pacman/tests/sync010.py27
-rw-r--r--test/pacman/tests/sync011.py20
-rw-r--r--test/pacman/tests/sync012.py20
-rw-r--r--test/pacman/tests/sync020.py19
-rw-r--r--test/pacman/tests/sync021.py21
-rw-r--r--test/pacman/tests/sync030.py19
-rw-r--r--test/pacman/tests/sync031.py19
-rw-r--r--test/pacman/tests/sync040.py15
-rw-r--r--test/pacman/tests/sync041.py16
-rw-r--r--test/pacman/tests/sync042.py14
-rw-r--r--test/pacman/tests/sync043.py18
-rw-r--r--test/pacman/tests/sync044.py20
-rw-r--r--test/pacman/tests/sync045.py18
-rw-r--r--test/pacman/tests/sync050.py11
-rw-r--r--test/pacman/tests/sync100.py12
-rw-r--r--test/pacman/tests/sync1000.py17
-rw-r--r--test/pacman/tests/sync1003.py21
-rw-r--r--test/pacman/tests/sync1004.py18
-rw-r--r--test/pacman/tests/sync1008.py19
-rw-r--r--test/pacman/tests/sync101.py12
-rw-r--r--test/pacman/tests/sync102.py12
-rw-r--r--test/pacman/tests/sync103.py13
-rw-r--r--test/pacman/tests/sync104.py12
-rw-r--r--test/pacman/tests/sync110.py22
-rw-r--r--test/pacman/tests/sync1100.py23
-rw-r--r--test/pacman/tests/sync1101.py12
-rw-r--r--test/pacman/tests/sync1102.py12
-rw-r--r--test/pacman/tests/sync1103.py11
-rw-r--r--test/pacman/tests/sync120.py21
-rw-r--r--test/pacman/tests/sync130.py16
-rw-r--r--test/pacman/tests/sync131.py18
-rw-r--r--test/pacman/tests/sync132.py18
-rw-r--r--test/pacman/tests/sync133.py18
-rw-r--r--test/pacman/tests/sync134.py21
-rw-r--r--test/pacman/tests/sync135.py31
-rw-r--r--test/pacman/tests/sync136.py15
-rw-r--r--test/pacman/tests/sync137.py14
-rw-r--r--test/pacman/tests/sync138.py22
-rw-r--r--test/pacman/tests/sync150.py25
-rw-r--r--test/pacman/tests/sync200.py.in18
-rw-r--r--test/pacman/tests/sync300.py14
-rw-r--r--test/pacman/tests/sync301.py27
-rw-r--r--test/pacman/tests/sync400.py24
-rw-r--r--test/pacman/tests/sync401.py21
-rw-r--r--test/pacman/tests/sync402.py21
-rw-r--r--test/pacman/tests/sync403.py23
-rw-r--r--test/pacman/tests/sync404.py26
-rw-r--r--test/pacman/tests/sync405.py24
-rw-r--r--test/pacman/tests/sync406.py31
-rw-r--r--test/pacman/tests/sync500.py15
-rw-r--r--test/pacman/tests/sync501.py18
-rw-r--r--test/pacman/tests/sync890.py20
-rw-r--r--test/pacman/tests/sync891.py22
-rw-r--r--test/pacman/tests/sync892.py24
-rw-r--r--test/pacman/tests/sync893.py20
-rw-r--r--test/pacman/tests/sync895.py20
-rw-r--r--test/pacman/tests/sync896.py21
-rw-r--r--test/pacman/tests/sync897.py24
-rw-r--r--test/pacman/tests/sync898.py18
-rw-r--r--test/pacman/tests/sync899.py18
-rw-r--r--test/pacman/tests/sync900.py25
-rw-r--r--test/pacman/tests/sync901.py25
-rw-r--r--test/pacman/tests/sync990.py19
-rw-r--r--test/pacman/tests/sync992.py23
-rw-r--r--test/pacman/tests/sync993.py20
-rw-r--r--test/pacman/tests/sync999.py21
-rw-r--r--test/pacman/tests/trans001.py20
-rw-r--r--test/pacman/tests/type001.py17
-rw-r--r--test/pacman/tests/unresolvable001.py21
-rw-r--r--test/pacman/tests/upgrade001.py18
-rw-r--r--test/pacman/tests/upgrade002.py18
-rw-r--r--test/pacman/tests/upgrade003.py18
-rw-r--r--test/pacman/tests/upgrade004.py12
-rw-r--r--test/pacman/tests/upgrade005.py23
-rw-r--r--test/pacman/tests/upgrade010.py18
-rw-r--r--test/pacman/tests/upgrade011.py16
-rw-r--r--test/pacman/tests/upgrade012.py14
-rw-r--r--test/pacman/tests/upgrade013.py20
-rw-r--r--test/pacman/tests/upgrade014.py23
-rw-r--r--test/pacman/tests/upgrade015.py15
-rw-r--r--test/pacman/tests/upgrade016.py16
-rw-r--r--test/pacman/tests/upgrade020.py18
-rw-r--r--test/pacman/tests/upgrade021.py18
-rw-r--r--test/pacman/tests/upgrade022.py18
-rw-r--r--test/pacman/tests/upgrade023.py18
-rw-r--r--test/pacman/tests/upgrade024.py15
-rw-r--r--test/pacman/tests/upgrade025.py17
-rw-r--r--test/pacman/tests/upgrade026.py17
-rw-r--r--test/pacman/tests/upgrade030.py21
-rw-r--r--test/pacman/tests/upgrade031.py19
-rw-r--r--test/pacman/tests/upgrade032.py19
-rw-r--r--test/pacman/tests/upgrade040.py31
-rw-r--r--test/pacman/tests/upgrade041.py31
-rw-r--r--test/pacman/tests/upgrade042.py28
-rw-r--r--test/pacman/tests/upgrade043.py28
-rw-r--r--test/pacman/tests/upgrade045.py16
-rw-r--r--test/pacman/tests/upgrade046.py33
-rw-r--r--test/pacman/tests/upgrade050.py15
-rw-r--r--test/pacman/tests/upgrade051.py15
-rw-r--r--test/pacman/tests/upgrade052.py20
-rw-r--r--test/pacman/tests/upgrade053.py19
-rw-r--r--test/pacman/tests/upgrade054.py19
-rw-r--r--test/pacman/tests/upgrade055.py25
-rw-r--r--test/pacman/tests/upgrade056.py23
-rw-r--r--test/pacman/tests/upgrade057.py21
-rw-r--r--test/pacman/tests/upgrade058.py16
-rw-r--r--test/pacman/tests/upgrade059.py26
-rw-r--r--test/pacman/tests/upgrade060.py21
-rw-r--r--test/pacman/tests/upgrade061.py22
-rw-r--r--test/pacman/tests/upgrade070.py15
-rw-r--r--test/pacman/tests/upgrade071.py14
-rw-r--r--test/pacman/tests/upgrade072.py15
-rw-r--r--test/pacman/tests/upgrade073.py27
-rw-r--r--test/pacman/tests/upgrade074.py14
-rw-r--r--test/pacman/tests/upgrade075.py14
-rw-r--r--test/pacman/tests/upgrade076.py18
-rw-r--r--test/pacman/tests/upgrade080.py16
-rw-r--r--test/pacman/tests/upgrade081.py16
-rw-r--r--test/pacman/tests/upgrade082.py19
-rw-r--r--test/pacman/tests/upgrade083.py19
-rw-r--r--test/pacman/tests/upgrade084.py16
-rw-r--r--test/pacman/tests/upgrade090.py28
-rw-r--r--test/pacman/tests/xfercommand001.py20
199 files changed, 3679 insertions, 0 deletions
diff --git a/test/pacman/tests/.gitignore b/test/pacman/tests/.gitignore
new file mode 100644
index 00000000..665d9ce6
--- /dev/null
+++ b/test/pacman/tests/.gitignore
@@ -0,0 +1 @@
+sync200.py
diff --git a/test/pacman/tests/Makefile.am b/test/pacman/tests/Makefile.am
new file mode 100644
index 00000000..b793687b
--- /dev/null
+++ b/test/pacman/tests/Makefile.am
@@ -0,0 +1,27 @@
+CONFTESTS = $(patsubst %py.in,%py,$(wildcard *.py.in))
+
+check_SCRIPTS = \
+ $(wildcard *.py) \
+ $(CONFTESTS)
+
+noinst_SCRIPTS = $(check_SCRIPTS)
+
+EXTRA_DIST = $(check_SCRIPTS)
+
+CLEANFILES = $(CONFTESTS)
+
+#### Taken from the autoconf scripts Makefile.am ####
+edit = sed \
+ -e 's|@LIBS[@]|$(LIBS)|g' \
+ -e 's|@configure_input[@]|Generated from $@.in; do not edit by hand.|g'
+
+
+$(CONFTESTS): Makefile
+ @echo ' ' GEN $@;
+ @rm -f $@ $@.tmp
+ @test -f $(srcdir)/$@.in && $(edit) $(srcdir)/$@.in >$@.tmp || true
+ @test -f $@.tmp || false
+ @chmod a-w $@.tmp
+ @mv $@.tmp $@
+
+# vim:set ts=2 sw=2 noet:
diff --git a/test/pacman/tests/config001.py b/test/pacman/tests/config001.py
new file mode 100644
index 00000000..3411433f
--- /dev/null
+++ b/test/pacman/tests/config001.py
@@ -0,0 +1,17 @@
+self.description = "Quick check for Include being parsed in [options]"
+
+self.option['Include'] = ['/dev/null']
+
+p = pmpkg("foobar")
+p.files = ["bin/foobar"]
+p.desc = "test description"
+p.groups = ["foo"]
+p.url = "http://www.archlinux.org"
+p.license = "GPL2"
+p.arch = "i686"
+
+self.addpkg2db("local", p)
+
+self.args = "-Qi %s" % p.name
+
+self.addrule("PACMAN_RETCODE=0")
diff --git a/test/pacman/tests/config002.py b/test/pacman/tests/config002.py
new file mode 100644
index 00000000..8efe5a04
--- /dev/null
+++ b/test/pacman/tests/config002.py
@@ -0,0 +1,12 @@
+self.description = "Quick check for Include being parsed in [db]"
+
+sp = pmpkg("dummy")
+sp.files = ["bin/dummy",
+ "usr/man/man1/dummy.1"]
+self.addpkg2db("sync", sp)
+
+self.db['sync'].option['Include'] = ['/dev/null']
+
+self.args = "-Si %s" % sp.name
+
+self.addrule("PACMAN_RETCODE=0")
diff --git a/test/pacman/tests/database001.py b/test/pacman/tests/database001.py
new file mode 100644
index 00000000..de4c0404
--- /dev/null
+++ b/test/pacman/tests/database001.py
@@ -0,0 +1,11 @@
+self.description = "-D --asdeps"
+
+lp = pmpkg("pkg")
+lp.reason = 0
+self.addpkg2db("local", lp)
+
+self.args = "-D pkg --asdeps"
+
+self.addrule("PACMAN_RETCODE=0")
+self.addrule("PKG_EXIST=pkg")
+self.addrule("PKG_REASON=pkg|1")
diff --git a/test/pacman/tests/database002.py b/test/pacman/tests/database002.py
new file mode 100644
index 00000000..05fa7f4b
--- /dev/null
+++ b/test/pacman/tests/database002.py
@@ -0,0 +1,11 @@
+self.description = "-D --asexplicit"
+
+lp = pmpkg("pkg")
+lp.reason = 1
+self.addpkg2db("local", lp)
+
+self.args = "-D pkg --asexplicit"
+
+self.addrule("PACMAN_RETCODE=0")
+self.addrule("PKG_EXIST=pkg")
+self.addrule("PKG_REASON=pkg|0")
diff --git a/test/pacman/tests/database010.py b/test/pacman/tests/database010.py
new file mode 100644
index 00000000..662dc1b6
--- /dev/null
+++ b/test/pacman/tests/database010.py
@@ -0,0 +1,17 @@
+# TODO: these are labeled as database packages because they sure seem to me to
+# be database-type operations. In their current implementation however they are
+# calling -U and -R rather than -D. Obviously the tests will need to be updated
+# if this changes.
+self.description = "Remove a package with --dbonly, no files touched"
+
+p = pmpkg("dummy")
+p.files = ["bin/dummy",
+ "usr/man/man1/dummy.1"]
+self.addpkg2db("local", p)
+
+self.args = "-R --dbonly %s" % p.name
+
+self.addrule("PACMAN_RETCODE=0")
+self.addrule("!PKG_EXIST=dummy")
+for f in p.files:
+ self.addrule("FILE_EXIST=%s" % f)
diff --git a/test/pacman/tests/database011.py b/test/pacman/tests/database011.py
new file mode 100644
index 00000000..7d475d91
--- /dev/null
+++ b/test/pacman/tests/database011.py
@@ -0,0 +1,17 @@
+# TODO: these are labeled as database packages because they sure seem to me to
+# be database-type operations. In their current implementation however they are
+# calling -U and -R rather than -D. Obviously the tests will need to be updated
+# if this changes.
+self.description = "Install a package with --dbonly, no files touched"
+
+p = pmpkg("dummy")
+p.files = ["bin/dummy",
+ "usr/man/man1/dummy.1"]
+self.addpkg(p)
+
+self.args = "-U --dbonly %s" % p.filename()
+
+self.addrule("PACMAN_RETCODE=0")
+self.addrule("PKG_EXIST=dummy")
+for f in p.files:
+ self.addrule("!FILE_EXIST=%s" % f)
diff --git a/test/pacman/tests/database012.py b/test/pacman/tests/database012.py
new file mode 100644
index 00000000..a1f86980
--- /dev/null
+++ b/test/pacman/tests/database012.py
@@ -0,0 +1,31 @@
+# TODO: these are labeled as database packages because they sure seem to me to
+# be database-type operations. In their current implementation however they are
+# calling -U and -R rather than -D. Obviously the tests will need to be updated
+# if this changes.
+self.description = "Upgrade a package with --dbonly, no files touched"
+
+lp = pmpkg("dummy")
+lp.files = ["bin/dummy",
+ "usr/man/man1/dummy.1"]
+self.addpkg2db("local", lp)
+
+p = pmpkg("dummy", "2.0-1")
+p.files = ["bin/dummy",
+ "bin/dummy2",
+ "usr/man/man1/dummy.1"]
+self.addpkg(p)
+
+self.args = "-U --dbonly %s" % p.filename()
+
+self.addrule("PACMAN_RETCODE=0")
+self.addrule("PKG_EXIST=dummy")
+self.addrule("PKG_VERSION=dummy|2.0-1")
+for f in lp.files:
+ self.addrule("!FILE_EXIST=%s" % f)
+# TODO: I honestly think the above should NOT delete the original files, it
+# should upgrade the DB entry without touching anything on the file system.
+# E.g. this test should be the same as:
+# pacman -R --dbonly dummy && pacman -U --dbonly dummy.pkg.tar.gz
+#for f in lp.files:
+# self.addrule("FILE_EXIST=%s" % f)
+self.addrule("!FILE_EXIST=bin/dummy2")
diff --git a/test/pacman/tests/depconflict100.py b/test/pacman/tests/depconflict100.py
new file mode 100644
index 00000000..948017d9
--- /dev/null
+++ b/test/pacman/tests/depconflict100.py
@@ -0,0 +1,15 @@
+self.description = "a package conflicts with itself"
+
+sp1 = pmpkg("pkg1")
+sp1.conflicts = ["pkg1"]
+self.addpkg2db("sync", sp1);
+
+sp2 = pmpkg("pkg2", "1.0-2")
+self.addpkg2db("sync", sp2)
+
+self.args = "-S %s" % " ".join([p.name for p in sp1, sp2])
+
+self.addrule("PACMAN_RETCODE=0")
+self.addrule("PKG_EXIST=pkg1")
+self.addrule("PKG_EXIST=pkg2")
+self.addrule("PKG_VERSION=pkg2|1.0-2")
diff --git a/test/pacman/tests/depconflict110.py b/test/pacman/tests/depconflict110.py
new file mode 100644
index 00000000..82e17d0b
--- /dev/null
+++ b/test/pacman/tests/depconflict110.py
@@ -0,0 +1,13 @@
+self.description = "conflict with version (conflict)"
+
+p = pmpkg("pkg1")
+p.conflicts = ["pkg2<=1.0-2"]
+self.addpkg(p);
+
+lp = pmpkg("pkg2", "1.0-1")
+self.addpkg2db("local", lp)
+
+self.args = "-U %s --ask=4" % p.filename()
+self.addrule("PACMAN_RETCODE=0")
+self.addrule("PKG_EXIST=pkg1")
+self.addrule("!PKG_EXIST=pkg2")
diff --git a/test/pacman/tests/depconflict111.py b/test/pacman/tests/depconflict111.py
new file mode 100644
index 00000000..0d11dd92
--- /dev/null
+++ b/test/pacman/tests/depconflict111.py
@@ -0,0 +1,13 @@
+self.description = "conflict with version (no conflict)"
+
+p = pmpkg("pkg1")
+p.conflicts = ["pkg2=1.0-2"]
+self.addpkg(p);
+
+lp = pmpkg("pkg2", "1.0-1")
+self.addpkg2db("local", lp)
+
+self.args = "-U %s" % p.filename()
+self.addrule("PACMAN_RETCODE=0")
+self.addrule("PKG_EXIST=pkg1")
+self.addrule("PKG_EXIST=pkg2")
diff --git a/test/pacman/tests/depconflict120.py b/test/pacman/tests/depconflict120.py
new file mode 100644
index 00000000..a9f3f6b3
--- /dev/null
+++ b/test/pacman/tests/depconflict120.py
@@ -0,0 +1,19 @@
+self.description = "target vs db conflict will disappear after upgrade"
+
+sp1 = pmpkg("pkg1")
+sp1.conflicts = ["imaginary"]
+self.addpkg2db("sync", sp1);
+
+sp2 = pmpkg("pkg2", "1.0-2")
+self.addpkg2db("sync", sp2)
+
+lp = pmpkg("pkg2", "1.0-1")
+lp.provides = ["imaginary"]
+self.addpkg2db("local", lp)
+
+self.args = "-S %s" % " ".join([p.name for p in sp1, sp2])
+
+self.addrule("PACMAN_RETCODE=0")
+self.addrule("PKG_EXIST=pkg1")
+self.addrule("PKG_EXIST=pkg2")
+self.addrule("PKG_VERSION=pkg2|1.0-2")
diff --git a/test/pacman/tests/deptest001.py b/test/pacman/tests/deptest001.py
new file mode 100644
index 00000000..18569bea
--- /dev/null
+++ b/test/pacman/tests/deptest001.py
@@ -0,0 +1,16 @@
+self.description = "test deptest (-T) functionality"
+
+lp1 = pmpkg("pkg1")
+self.addpkg2db("local", lp1)
+
+lp3 = pmpkg("pkg3", "2.0-1")
+lp3.provides = ("prov=3.0")
+self.addpkg2db("local", lp3)
+
+self.args = "-T pkg1 pkg2 pkg3\>2.1 prov\>\=3.0"
+
+self.addrule("PACMAN_RETCODE=127")
+self.addrule("!PACMAN_OUTPUT=pkg1")
+self.addrule("PACMAN_OUTPUT=pkg2")
+self.addrule("PACMAN_OUTPUT=pkg3")
+self.addrule("!PACMAN_OUTPUT=prov")
diff --git a/test/pacman/tests/dummy001.py b/test/pacman/tests/dummy001.py
new file mode 100644
index 00000000..85a5d99c
--- /dev/null
+++ b/test/pacman/tests/dummy001.py
@@ -0,0 +1,21 @@
+self.description = "Dummy test case (modify for own use)"
+
+p1 = pmpkg("dummy")
+p1.files = ["etc/dummy.conf*",
+ "lib/libdummy.so.0",
+ "lib/libdummy.so -> ./libdummy.so.0",
+ "usr/",
+ "bin/dummy"]
+p1.backup = ["etc/dummy.conf*"]
+p1.install['post_install'] = "echo toto";
+p1.url="ze url"
+self.addpkg(p1)
+
+#p2 = pmpkg("dummy", "1.0-2")
+#p2.files = ["etc/dummy.conf**"]
+#p2.backup = ["etc/dummy.conf"]
+#self.addpkg(p2)
+
+self.args = "-U %s" % p1.filename()
+
+self.addrule("PACMAN_RETCODE=0")
diff --git a/test/pacman/tests/fileconflict001.py b/test/pacman/tests/fileconflict001.py
new file mode 100644
index 00000000..8c13911c
--- /dev/null
+++ b/test/pacman/tests/fileconflict001.py
@@ -0,0 +1,22 @@
+self.description = "Fileconflict with symlinks"
+
+lp = pmpkg("dummy")
+lp.files = ["dir/realdir/",
+ "dir/symdir -> realdir"]
+self.addpkg2db("local", lp)
+
+p1 = pmpkg("pkg1")
+p1.files = ["dir/realdir/file"]
+self.addpkg(p1)
+
+p2 = pmpkg("pkg2")
+p2.files = ["dir/symdir/file"]
+self.addpkg(p2)
+
+self.args = "-U %s" % " ".join([p.filename() for p in p1, p2])
+
+self.addrule("PACMAN_RETCODE=1")
+self.addrule("!PKG_EXIST=pkg1")
+self.addrule("!PKG_EXIST=pkg2")
+
+self.expectfailure = True
diff --git a/test/pacman/tests/fileconflict002.py b/test/pacman/tests/fileconflict002.py
new file mode 100644
index 00000000..f70873ba
--- /dev/null
+++ b/test/pacman/tests/fileconflict002.py
@@ -0,0 +1,18 @@
+self.description = "Fileconflict with symlinks (2)"
+
+p1 = pmpkg("pkg1")
+p1.files = ["dir/realdir/file",
+ "dir/symdir -> realdir"]
+self.addpkg(p1)
+
+p2 = pmpkg("pkg2")
+p2.files = ["dir/symdir/file"]
+self.addpkg(p2)
+
+self.args = "-U %s" % " ".join([p.filename() for p in p1, p2])
+
+self.addrule("PACMAN_RETCODE=1")
+self.addrule("!PKG_EXIST=pkg1")
+self.addrule("!PKG_EXIST=pkg2")
+
+self.expectfailure = True
diff --git a/test/pacman/tests/fileconflict003.py b/test/pacman/tests/fileconflict003.py
new file mode 100644
index 00000000..89696fcb
--- /dev/null
+++ b/test/pacman/tests/fileconflict003.py
@@ -0,0 +1,18 @@
+self.description = "FS#8156"
+
+p1 = pmpkg("pkg1")
+p1.files = ["test/",
+ "test/file"]
+self.addpkg2db("local", p1)
+
+p2 = pmpkg("pkg2")
+p2.files = ["test2/",
+ "test2/file2",
+ "test -> test2"]
+self.addpkg2db("sync", p2)
+
+self.args = "-S pkg2"
+
+self.addrule("PACMAN_RETCODE=1")
+self.addrule("PKG_EXIST=pkg1")
+self.addrule("!PKG_EXIST=pkg2")
diff --git a/test/pacman/tests/fileconflict004.py b/test/pacman/tests/fileconflict004.py
new file mode 100644
index 00000000..a5347ccd
--- /dev/null
+++ b/test/pacman/tests/fileconflict004.py
@@ -0,0 +1,19 @@
+self.description = "dir->symlink change during package upgrade (no conflict)"
+
+p1 = pmpkg("pkg1", "1.0-1")
+p1.files = ["test/",
+ "test/file"]
+self.addpkg2db("local", p1)
+
+p2 = pmpkg("pkg1", "2.0-1")
+p2.files = ["test2/",
+ "test2/file2",
+ "test -> test2"]
+self.addpkg2db("sync", p2)
+
+self.args = "-S pkg1"
+
+self.addrule("PACMAN_RETCODE=0")
+self.addrule("PKG_EXIST=pkg1")
+self.addrule("PKG_VERSION=pkg1|2.0-1")
+self.addrule("FILE_TYPE=test|link")
diff --git a/test/pacman/tests/fileconflict005.py b/test/pacman/tests/fileconflict005.py
new file mode 100644
index 00000000..5c554afe
--- /dev/null
+++ b/test/pacman/tests/fileconflict005.py
@@ -0,0 +1,22 @@
+self.description = "dir->symlink change during package upgrade (conflict)"
+
+p1 = pmpkg("pkg1", "1.0-1")
+p1.files = ["test/",
+ "test/file1"]
+self.addpkg2db("local", p1)
+
+p2 = pmpkg("pkg2")
+p2.files = ["test/file2"]
+self.addpkg2db("local", p2)
+
+p3 = pmpkg("pkg1", "2.0-1")
+p3.files = ["test2/",
+ "test2/file3",
+ "test -> test2"]
+self.addpkg2db("sync", p3)
+
+self.args = "-S pkg1"
+
+self.addrule("PACMAN_RETCODE=1")
+self.addrule("PKG_EXIST=pkg1")
+self.addrule("PKG_VERSION=pkg1|1.0-1")
diff --git a/test/pacman/tests/fileconflict006.py b/test/pacman/tests/fileconflict006.py
new file mode 100644
index 00000000..84afff2d
--- /dev/null
+++ b/test/pacman/tests/fileconflict006.py
@@ -0,0 +1,24 @@
+self.description = "dir->symlink change during package upgrade (conflict)"
+
+p1 = pmpkg("pkg1", "1.0-1")
+p1.files = ["test/",
+ "test/file1",
+ "test/dir/file1",
+ "test/dir/file2"]
+self.addpkg2db("local", p1)
+
+p2 = pmpkg("pkg2")
+p2.files = ["test/dir/file3"]
+self.addpkg2db("local", p2)
+
+p3 = pmpkg("pkg1", "2.0-1")
+p3.files = ["test2/",
+ "test2/file3",
+ "test -> test2"]
+self.addpkg2db("sync", p3)
+
+self.args = "-S pkg1"
+
+self.addrule("PACMAN_RETCODE=1")
+self.addrule("PKG_EXIST=pkg1")
+self.addrule("PKG_VERSION=pkg1|1.0-1")
diff --git a/test/pacman/tests/fileconflict007.py b/test/pacman/tests/fileconflict007.py
new file mode 100644
index 00000000..7e6d85ef
--- /dev/null
+++ b/test/pacman/tests/fileconflict007.py
@@ -0,0 +1,17 @@
+self.description = "Fileconflict with symlinks (klibc case)"
+
+lp = pmpkg("pkg")
+lp.files = ["dir/realdir/",
+ "dir/symdir -> realdir",
+ "dir/realdir/file"]
+self.addpkg2db("local", lp)
+
+p = pmpkg("pkg", "1.0-2")
+p.files = ["dir/symdir/file"]
+self.addpkg(p)
+
+self.args = "-U %s" % p.filename()
+
+self.addrule("PACMAN_RETCODE=0")
+self.addrule("PKG_EXIST=pkg")
+self.addrule("PKG_VERSION=pkg|1.0-2")
diff --git a/test/pacman/tests/ignore001.py b/test/pacman/tests/ignore001.py
new file mode 100644
index 00000000..bb3fa59a
--- /dev/null
+++ b/test/pacman/tests/ignore001.py
@@ -0,0 +1,17 @@
+self.description = "Sync with irrelevant ignored packages"
+
+package1 = pmpkg("package1")
+self.addpkg2db("local", package1)
+
+package2 = pmpkg("package2")
+self.addpkg2db("local", package2)
+
+package2up = pmpkg("package2", "2.0-1")
+self.addpkg2db("sync", package2up)
+
+self.option["IgnorePkg"] = ["irrelavent"]
+self.args = "-Su"
+
+self.addrule("PACMAN_RETCODE=0")
+self.addrule("PKG_VERSION=package1|1.0-1")
+self.addrule("PKG_VERSION=package2|2.0-1")
diff --git a/test/pacman/tests/ignore002.py b/test/pacman/tests/ignore002.py
new file mode 100644
index 00000000..9b09e8f7
--- /dev/null
+++ b/test/pacman/tests/ignore002.py
@@ -0,0 +1,35 @@
+self.description = "Sync with relevant ignored packages"
+
+package1 = pmpkg("package1")
+self.addpkg2db("local", package1)
+
+package2 = pmpkg("package2")
+self.addpkg2db("local", package2)
+
+package3 = pmpkg("package3")
+package3.depends = ["package2=1.0-1"]
+self.addpkg2db("local", package3)
+
+package4 = pmpkg("package4")
+package4.depends = ["package3=1.0-1"]
+self.addpkg2db("local", package4)
+
+package2up = pmpkg("package2", "2.0-1")
+self.addpkg2db("sync", package2up)
+
+package3up = pmpkg("package3", "2.0-1")
+package3up.depends = ["package2=2.0-1"]
+self.addpkg2db("sync", package3up)
+
+package4up = pmpkg("package4", "2.0-1")
+package4up.depends = ["package3=2.0-1"]
+self.addpkg2db("sync", package4up)
+
+self.option["IgnorePkg"] = ["package2"]
+self.args = "-Su"
+
+self.addrule("PACMAN_RETCODE=1")
+self.addrule("PKG_VERSION=package1|1.0-1")
+self.addrule("PKG_VERSION=package2|1.0-1")
+self.addrule("PKG_VERSION=package3|1.0-1")
+self.addrule("PKG_VERSION=package4|1.0-1")
diff --git a/test/pacman/tests/ignore003.py b/test/pacman/tests/ignore003.py
new file mode 100644
index 00000000..8768a6ef
--- /dev/null
+++ b/test/pacman/tests/ignore003.py
@@ -0,0 +1,35 @@
+self.description = "Sync with relevant ignored packages and dependency loop"
+
+package1 = pmpkg("package1")
+self.addpkg2db("local", package1)
+
+package2 = pmpkg("package2")
+self.addpkg2db("local", package2)
+
+package3 = pmpkg("package3")
+package3.depends = ["package2=1.0-1"]
+self.addpkg2db("local", package3)
+
+package4 = pmpkg("package4")
+package4.depends = ["package3=1.0-1"]
+self.addpkg2db("local", package4)
+
+package2up = pmpkg("package2", "2.0-1")
+self.addpkg2db("sync", package2up)
+
+package3up = pmpkg("package3", "2.0-1")
+package3up.depends = ["package2=2.0-1", "package4=2.0-1"]
+self.addpkg2db("sync", package3up)
+
+package4up = pmpkg("package4", "2.0-1")
+package4up.depends = ["package3=2.0-1"]
+self.addpkg2db("sync", package4up)
+
+self.option["IgnorePkg"] = ["package2"]
+self.args = "-Su"
+
+self.addrule("PACMAN_RETCODE=1")
+self.addrule("PKG_VERSION=package1|1.0-1")
+self.addrule("PKG_VERSION=package2|1.0-1")
+self.addrule("PKG_VERSION=package3|1.0-1")
+self.addrule("PKG_VERSION=package4|1.0-1")
diff --git a/test/pacman/tests/ignore004.py b/test/pacman/tests/ignore004.py
new file mode 100644
index 00000000..e6af48bd
--- /dev/null
+++ b/test/pacman/tests/ignore004.py
@@ -0,0 +1,46 @@
+self.description = "Sync with ignore causing top-level to be ignored"
+
+packageA1 = pmpkg("packageA1")
+packageA1.depends = ["packageA2=1.0-1", "packageA3=1.0-1"];
+self.addpkg2db("local", packageA1)
+
+packageA2 = pmpkg("packageA2")
+packageA2.depends = ["packageA4=1.0-1", "packageA5=1.0-1"];
+self.addpkg2db("local", packageA2)
+
+packageA3 = pmpkg("packageA3")
+self.addpkg2db("local", packageA3)
+
+packageA4 = pmpkg("packageA4")
+self.addpkg2db("local", packageA4)
+
+packageA5 = pmpkg("packageA5")
+self.addpkg2db("local", packageA5)
+
+packageA1up = pmpkg("packageA1", "2.0-1")
+packageA1up.depends = ["packageA2=2.0-1", "packageA3=2.0-1"];
+self.addpkg2db("sync", packageA1up)
+
+packageA2up = pmpkg("packageA2", "2.0-1")
+packageA2up.depends = ["packageA4=2.0-1", "packageA5=2.0-1"];
+self.addpkg2db("sync", packageA2up)
+
+packageA3up = pmpkg("packageA3", "2.0-1")
+self.addpkg2db("sync", packageA3up)
+
+packageA4up = pmpkg("packageA4", "2.0-1")
+self.addpkg2db("sync", packageA4up)
+
+packageA5up = pmpkg("packageA5", "2.0-1")
+self.addpkg2db("sync", packageA5up)
+
+
+self.option["IgnorePkg"] = ["packageA3"]
+self.args = "-S packageA1"
+
+self.addrule("PACMAN_RETCODE=1")
+self.addrule("PKG_VERSION=packageA1|1.0-1")
+self.addrule("PKG_VERSION=packageA2|1.0-1")
+self.addrule("PKG_VERSION=packageA3|1.0-1")
+self.addrule("PKG_VERSION=packageA4|1.0-1")
+self.addrule("PKG_VERSION=packageA5|1.0-1")
diff --git a/test/pacman/tests/ignore005.py b/test/pacman/tests/ignore005.py
new file mode 100644
index 00000000..274e44c3
--- /dev/null
+++ b/test/pacman/tests/ignore005.py
@@ -0,0 +1,46 @@
+self.description = "Sync with ignore causing top-level to be included"
+
+packageA1 = pmpkg("packageA1")
+packageA1.depends = ["packageA2>=1.0-1", "packageA3=1.0-1"];
+self.addpkg2db("local", packageA1)
+
+packageA2 = pmpkg("packageA2")
+packageA2.depends = ["packageA4=1.0-1", "packageA5=1.0-1"];
+self.addpkg2db("local", packageA2)
+
+packageA3 = pmpkg("packageA3")
+self.addpkg2db("local", packageA3)
+
+packageA4 = pmpkg("packageA4")
+self.addpkg2db("local", packageA4)
+
+packageA5 = pmpkg("packageA5")
+self.addpkg2db("local", packageA5)
+
+packageA1up = pmpkg("packageA1", "2.0-1")
+packageA1up.depends = ["packageA2>=2.0-1", "packageA3=2.0-1"];
+self.addpkg2db("sync", packageA1up)
+
+packageA2up = pmpkg("packageA2", "2.0-1")
+packageA2up.depends = ["packageA4=2.0-1", "packageA5=2.0-1"];
+self.addpkg2db("sync", packageA2up)
+
+packageA3up = pmpkg("packageA3", "2.0-1")
+self.addpkg2db("sync", packageA3up)
+
+packageA4up = pmpkg("packageA4", "2.0-1")
+self.addpkg2db("sync", packageA4up)
+
+packageA5up = pmpkg("packageA5", "2.0-1")
+self.addpkg2db("sync", packageA5up)
+
+
+self.option["IgnorePkg"] = ["packageA3"]
+self.args = "-S packageA1 packageA2 --ask=32"
+
+self.addrule("PACMAN_RETCODE=0")
+self.addrule("PKG_VERSION=packageA1|1.0-1")
+self.addrule("PKG_VERSION=packageA2|2.0-1")
+self.addrule("PKG_VERSION=packageA3|1.0-1")
+self.addrule("PKG_VERSION=packageA4|2.0-1")
+self.addrule("PKG_VERSION=packageA5|2.0-1")
diff --git a/test/pacman/tests/ldconfig001.py b/test/pacman/tests/ldconfig001.py
new file mode 100644
index 00000000..9ac2ff35
--- /dev/null
+++ b/test/pacman/tests/ldconfig001.py
@@ -0,0 +1,12 @@
+# quick note here - chroot() is expected to fail. We're not checking the
+# validity of the scripts, only that they fire (or try to)
+self.description = "Make sure ldconfig runs on an add operation"
+
+p = pmpkg("dummy")
+self.addpkg(p)
+
+# --debug is necessary to check PACMAN_OUTPUT
+self.args = "--debug -U %s" % p.filename()
+
+self.addrule("PACMAN_RETCODE=0")
+self.addrule("PACMAN_OUTPUT=ldconfig")
diff --git a/test/pacman/tests/ldconfig002.py b/test/pacman/tests/ldconfig002.py
new file mode 100644
index 00000000..162f5831
--- /dev/null
+++ b/test/pacman/tests/ldconfig002.py
@@ -0,0 +1,16 @@
+# quick note here - chroot() is expected to fail. We're not checking the
+# validity of the scripts, only that they fire (or try to)
+self.description = "Make sure ldconfig runs on an upgrade operation"
+
+lp = pmpkg("dummy")
+self.addpkg2db("local", lp)
+
+p = pmpkg("dummy", "1.0-2")
+self.addpkg(p)
+
+# --debug is necessary to check PACMAN_OUTPUT
+self.args = "--debug -U %s" % p.filename()
+
+self.addrule("PACMAN_RETCODE=0")
+self.addrule("PKG_VERSION=dummy|1.0-2")
+self.addrule("PACMAN_OUTPUT=ldconfig")
diff --git a/test/pacman/tests/ldconfig003.py b/test/pacman/tests/ldconfig003.py
new file mode 100644
index 00000000..1b48efad
--- /dev/null
+++ b/test/pacman/tests/ldconfig003.py
@@ -0,0 +1,14 @@
+# quick note here - chroot() is expected to fail. We're not checking the
+# validity of the scripts, only that they fire (or try to)
+self.description = "Make sure ldconfig runs on a sync operation"
+
+sp = pmpkg("dummy")
+self.addpkg2db("sync", sp)
+
+self.args = "-S %s" % sp.name
+
+# --debug is necessary to check PACMAN_OUTPUT
+self.args = "--debug -S %s" % sp.name
+
+self.addrule("PACMAN_RETCODE=0")
+self.addrule("PACMAN_OUTPUT=ldconfig")
diff --git a/test/pacman/tests/mode001.py b/test/pacman/tests/mode001.py
new file mode 100644
index 00000000..4ec11e10
--- /dev/null
+++ b/test/pacman/tests/mode001.py
@@ -0,0 +1,12 @@
+self.description = "Check the mode of default files in a package"
+
+p = pmpkg("pkg1")
+p.files = ["bin/foo",
+ "bin/bar"]
+self.addpkg(p)
+
+self.args = "-U %s" % p.filename()
+
+self.addrule("PACMAN_RETCODE=0")
+for f in p.files:
+ self.addrule("FILE_MODE=%s|644" % f)
diff --git a/test/pacman/tests/mode002.py b/test/pacman/tests/mode002.py
new file mode 100644
index 00000000..cc4a8fe8
--- /dev/null
+++ b/test/pacman/tests/mode002.py
@@ -0,0 +1,12 @@
+self.description = "Check execute mode on files in a package"
+
+p = pmpkg("pkg1")
+p.files = ["bin/foo|755",
+ "bin/bar|755"]
+self.addpkg(p)
+
+self.args = "-U %s" % p.filename()
+
+self.addrule("PACMAN_RETCODE=0")
+self.addrule("FILE_MODE=bin/foo|755")
+self.addrule("FILE_MODE=bin/bar|755")
diff --git a/test/pacman/tests/mode003.py b/test/pacman/tests/mode003.py
new file mode 100644
index 00000000..1193a5cf
--- /dev/null
+++ b/test/pacman/tests/mode003.py
@@ -0,0 +1,20 @@
+self.description = "Backup file permissions test (same as orig)"
+
+lp = pmpkg("filesystem")
+lp.files = ["etc/profile|666"]
+lp.backup = ["etc/profile*"]
+self.addpkg2db("local", lp)
+
+p = pmpkg("filesystem", "1.0-2")
+p.files = ["etc/profile|666**"]
+p.backup = ["etc/profile"]
+self.addpkg(p)
+
+self.args = "-U %s" % p.filename()
+
+self.addrule("PACMAN_RETCODE=0")
+self.addrule("!FILE_PACSAVE=etc/profile")
+self.addrule("FILE_PACNEW=etc/profile")
+self.addrule("FILE_EXIST=etc/profile")
+self.addrule("FILE_MODE=etc/profile|666")
+self.addrule("FILE_MODE=etc/profile.pacnew|666")
diff --git a/test/pacman/tests/pacman001.py b/test/pacman/tests/pacman001.py
new file mode 100644
index 00000000..d467e3f2
--- /dev/null
+++ b/test/pacman/tests/pacman001.py
@@ -0,0 +1,5 @@
+self.description = "Test command line option (--version)"
+
+self.args = "--version"
+
+self.addrule("PACMAN_RETCODE=2")
diff --git a/test/pacman/tests/pacman002.py b/test/pacman/tests/pacman002.py
new file mode 100644
index 00000000..c0217259
--- /dev/null
+++ b/test/pacman/tests/pacman002.py
@@ -0,0 +1,5 @@
+self.description = "Test command line option (--help)"
+
+self.args = "--help"
+
+self.addrule("PACMAN_RETCODE=2")
diff --git a/test/pacman/tests/pacman003.py b/test/pacman/tests/pacman003.py
new file mode 100644
index 00000000..b5275943
--- /dev/null
+++ b/test/pacman/tests/pacman003.py
@@ -0,0 +1,5 @@
+self.description = "Test command line option (-S --help)"
+
+self.args = "-S --help"
+
+self.addrule("PACMAN_RETCODE=2")
diff --git a/test/pacman/tests/pacman004.py b/test/pacman/tests/pacman004.py
new file mode 100644
index 00000000..d8d6b102
--- /dev/null
+++ b/test/pacman/tests/pacman004.py
@@ -0,0 +1,5 @@
+self.description = "Test command line option (-v)"
+
+self.args = "-v"
+
+self.addrule("PACMAN_RETCODE=1")
diff --git a/test/pacman/tests/provision001.py b/test/pacman/tests/provision001.py
new file mode 100644
index 00000000..37e3d935
--- /dev/null
+++ b/test/pacman/tests/provision001.py
@@ -0,0 +1,10 @@
+self.description = "-S provision"
+
+sp = pmpkg("pkg1")
+sp.provides = ["provision=1.0-1"]
+self.addpkg2db("sync", sp)
+
+self.args = "-S provision"
+
+self.addrule("PACMAN_RETCODE=0")
+self.addrule("PKG_EXIST=pkg1")
diff --git a/test/pacman/tests/provision010.py b/test/pacman/tests/provision010.py
new file mode 100644
index 00000000..711a7319
--- /dev/null
+++ b/test/pacman/tests/provision010.py
@@ -0,0 +1,15 @@
+self.description = "provision>=1.0-2 dependency"
+
+p = pmpkg("pkg1", "1.0-2")
+p.depends = ["provision>=1.0-2"]
+self.addpkg(p)
+
+lp = pmpkg("pkg2", "1.0-2")
+lp.provides = ["provision"]
+self.addpkg2db("local", lp)
+
+self.args = "-U %s" % p.filename()
+
+self.addrule("PACMAN_RETCODE=1")
+self.addrule("!PKG_EXIST=pkg1")
+self.addrule("PKG_EXIST=pkg2")
diff --git a/test/pacman/tests/provision011.py b/test/pacman/tests/provision011.py
new file mode 100644
index 00000000..96aac300
--- /dev/null
+++ b/test/pacman/tests/provision011.py
@@ -0,0 +1,15 @@
+self.description = "provision>=1.0-2 dependency (2)"
+
+p = pmpkg("pkg1", "1.0-2")
+p.depends = ["provision>=1.0-2"]
+self.addpkg(p)
+
+lp = pmpkg("pkg2", "1.0-2")
+lp.provides = ["provision=1.0-2"]
+self.addpkg2db("local", lp)
+
+self.args = "-U %s" % p.filename()
+
+self.addrule("PACMAN_RETCODE=0")
+self.addrule("PKG_EXIST=pkg1")
+self.addrule("PKG_EXIST=pkg2")
diff --git a/test/pacman/tests/provision012.py b/test/pacman/tests/provision012.py
new file mode 100644
index 00000000..f7ed2216
--- /dev/null
+++ b/test/pacman/tests/provision012.py
@@ -0,0 +1,15 @@
+self.description = "provision>=1.0-2 dependency (3)"
+
+p = pmpkg("pkg1", "1.0-2")
+p.depends = ["provision>=1.0-2"]
+self.addpkg(p)
+
+lp = pmpkg("pkg2", "1.0-2")
+lp.provides = ["provision=1.0-1"]
+self.addpkg2db("local", lp)
+
+self.args = "-U %s" % p.filename()
+
+self.addrule("PACMAN_RETCODE=1")
+self.addrule("!PKG_EXIST=pkg1")
+self.addrule("PKG_EXIST=pkg2")
diff --git a/test/pacman/tests/provision020.py b/test/pacman/tests/provision020.py
new file mode 100644
index 00000000..7cb0a01b
--- /dev/null
+++ b/test/pacman/tests/provision020.py
@@ -0,0 +1,15 @@
+self.description = "provision>=1.0-2 dependency"
+
+p = pmpkg("pkg1", "1.0-2")
+p.depends = ["provision>=1.0-2"]
+self.addpkg2db("sync", p)
+
+lp = pmpkg("pkg2", "1.0-2")
+lp.provides = ["provision"]
+self.addpkg2db("local", lp)
+
+self.args = "-S %s" % p.name
+
+self.addrule("PACMAN_RETCODE=1")
+self.addrule("!PKG_EXIST=pkg1")
+self.addrule("PKG_EXIST=pkg2")
diff --git a/test/pacman/tests/provision021.py b/test/pacman/tests/provision021.py
new file mode 100644
index 00000000..a98e1f33
--- /dev/null
+++ b/test/pacman/tests/provision021.py
@@ -0,0 +1,15 @@
+self.description = "provision>=1.0-2 dependency (2)"
+
+p = pmpkg("pkg1", "1.0-2")
+p.depends = ["provision>=1.0-2"]
+self.addpkg2db("sync", p)
+
+lp = pmpkg("pkg2", "1.0-2")
+lp.provides = ["provision=1.0-2"]
+self.addpkg2db("local", lp)
+
+self.args = "-S %s" % p.name
+
+self.addrule("PACMAN_RETCODE=0")
+self.addrule("PKG_EXIST=pkg1")
+self.addrule("PKG_EXIST=pkg2")
diff --git a/test/pacman/tests/provision022.py b/test/pacman/tests/provision022.py
new file mode 100644
index 00000000..4883d428
--- /dev/null
+++ b/test/pacman/tests/provision022.py
@@ -0,0 +1,15 @@
+self.description = "provision>=1.0-2 dependency (3)"
+
+p = pmpkg("pkg1", "1.0-2")
+p.depends = ["provision>=1.0-2"]
+self.addpkg2db("sync", p)
+
+lp = pmpkg("pkg2", "1.0-2")
+lp.provides = ["provision=1.0-1"]
+self.addpkg2db("local", lp)
+
+self.args = "-S %s" % p.name
+
+self.addrule("PACMAN_RETCODE=1")
+self.addrule("!PKG_EXIST=pkg1")
+self.addrule("PKG_EXIST=pkg2")
diff --git a/test/pacman/tests/query001.py b/test/pacman/tests/query001.py
new file mode 100644
index 00000000..8faf0e15
--- /dev/null
+++ b/test/pacman/tests/query001.py
@@ -0,0 +1,10 @@
+self.description = "Query a package"
+
+p = pmpkg("foobar")
+p.files = ["bin/foobar"]
+self.addpkg2db("local", p)
+
+self.args = "-Q %s" % p.name
+
+self.addrule("PACMAN_RETCODE=0")
+self.addrule("PACMAN_OUTPUT=%s" % p.name)
diff --git a/test/pacman/tests/query002.py b/test/pacman/tests/query002.py
new file mode 100644
index 00000000..7d943644
--- /dev/null
+++ b/test/pacman/tests/query002.py
@@ -0,0 +1,21 @@
+self.description = "Query info on a package"
+
+p = pmpkg("foobar")
+p.files = ["bin/foobar"]
+p.desc = "test description"
+p.groups = ["foo"]
+p.url = "http://www.archlinux.org"
+p.license = "GPL2"
+p.arch = "i686"
+# test old style date
+p.builddate = "Mon Oct 1 01:40:21 2007 UTC"
+p.packager = "Arch Linux"
+
+self.addpkg2db("local", p)
+
+self.args = "-Qi %s" % p.name
+
+self.addrule("PACMAN_RETCODE=0")
+self.addrule("PACMAN_OUTPUT=%s" % p.name)
+self.addrule("PACMAN_OUTPUT=%s" % p.desc)
+self.addrule("PACMAN_OUTPUT=2007")
diff --git a/test/pacman/tests/query003.py b/test/pacman/tests/query003.py
new file mode 100644
index 00000000..41b8a45b
--- /dev/null
+++ b/test/pacman/tests/query003.py
@@ -0,0 +1,11 @@
+self.description = "Query search for a package"
+
+p = pmpkg("foobar")
+p.files = ["bin/foobar"]
+p.groups = ["group1", "group2"]
+self.addpkg2db("local", p)
+
+self.args = "-Qs %s" % p.name
+
+self.addrule("PACMAN_RETCODE=0")
+self.addrule("PACMAN_OUTPUT=%s" % p.name)
diff --git a/test/pacman/tests/query004.py b/test/pacman/tests/query004.py
new file mode 100644
index 00000000..8faf0e15
--- /dev/null
+++ b/test/pacman/tests/query004.py
@@ -0,0 +1,10 @@
+self.description = "Query a package"
+
+p = pmpkg("foobar")
+p.files = ["bin/foobar"]
+self.addpkg2db("local", p)
+
+self.args = "-Q %s" % p.name
+
+self.addrule("PACMAN_RETCODE=0")
+self.addrule("PACMAN_OUTPUT=%s" % p.name)
diff --git a/test/pacman/tests/query005.py b/test/pacman/tests/query005.py
new file mode 100644
index 00000000..0c0bc51e
--- /dev/null
+++ b/test/pacman/tests/query005.py
@@ -0,0 +1,21 @@
+self.description = "Query info on a package"
+
+p = pmpkg("foobar")
+p.files = ["bin/foobar"]
+p.desc = "test description"
+p.groups = ["foo"]
+p.url = "http://www.archlinux.org"
+p.license = "GPL2"
+p.arch = "i686"
+# test new style date
+p.builddate = "1196640127"
+p.packager = "Arch Linux"
+
+self.addpkg2db("local", p)
+
+self.args = "-Qi %s" % p.name
+
+self.addrule("PACMAN_RETCODE=0")
+self.addrule("PACMAN_OUTPUT=%s" % p.name)
+self.addrule("PACMAN_OUTPUT=%s" % p.desc)
+self.addrule("PACMAN_OUTPUT=2007")
diff --git a/test/pacman/tests/reason001.py b/test/pacman/tests/reason001.py
new file mode 100644
index 00000000..40433f5e
--- /dev/null
+++ b/test/pacman/tests/reason001.py
@@ -0,0 +1,16 @@
+self.description = "Copy reason (to-be-replaced -> replacement)"
+
+sp = pmpkg("libfoo-ng")
+sp.replaces = [ "libfoo" ]
+self.addpkg2db("sync", sp)
+
+lp = pmpkg("libfoo")
+lp.reason = 1
+self.addpkg2db("local", lp)
+
+self.args = "-Su"
+
+self.addrule("PACMAN_RETCODE=0")
+self.addrule("!PKG_EXIST=libfoo")
+self.addrule("PKG_EXIST=libfoo-ng")
+self.addrule("PKG_REASON=libfoo-ng|1")
diff --git a/test/pacman/tests/remove001.py b/test/pacman/tests/remove001.py
new file mode 100644
index 00000000..02d00a42
--- /dev/null
+++ b/test/pacman/tests/remove001.py
@@ -0,0 +1,9 @@
+self.description = "Remove a package listed 5 times"
+
+p = pmpkg("foo")
+self.addpkg2db("local", p)
+
+self.args = "-R " + "foo "*5
+
+self.addrule("PACMAN_RETCODE=1")
+self.addrule("PKG_EXIST=foo")
diff --git a/test/pacman/tests/remove010.py b/test/pacman/tests/remove010.py
new file mode 100644
index 00000000..dbdc47e7
--- /dev/null
+++ b/test/pacman/tests/remove010.py
@@ -0,0 +1,13 @@
+self.description = "Remove a package with an unchanged file marked for backup"
+
+p1 = pmpkg("dummy")
+p1.files = ["etc/dummy.conf"]
+p1.backup = ["etc/dummy.conf"]
+self.addpkg2db("local", p1)
+
+self.args = "-R %s" % p1.name
+
+self.addrule("PACMAN_RETCODE=0")
+self.addrule("!PKG_EXIST=dummy")
+self.addrule("!FILE_EXIST=etc/dummy.conf")
+self.addrule("!FILE_PACSAVE=etc/dummy.conf")
diff --git a/test/pacman/tests/remove011.py b/test/pacman/tests/remove011.py
new file mode 100644
index 00000000..3e559bf9
--- /dev/null
+++ b/test/pacman/tests/remove011.py
@@ -0,0 +1,13 @@
+self.description = "Remove a package with a modified file marked for backup"
+
+p1 = pmpkg("dummy")
+p1.files = ["etc/dummy.conf*"]
+p1.backup = ["etc/dummy.conf"]
+self.addpkg2db("local", p1)
+
+self.args = "-R %s" % p1.name
+
+self.addrule("PACMAN_RETCODE=0")
+self.addrule("!PKG_EXIST=dummy")
+self.addrule("!FILE_EXIST=etc/dummy.conf")
+self.addrule("FILE_PACSAVE=etc/dummy.conf")
diff --git a/test/pacman/tests/remove020.py b/test/pacman/tests/remove020.py
new file mode 100644
index 00000000..bdfc2c26
--- /dev/null
+++ b/test/pacman/tests/remove020.py
@@ -0,0 +1,13 @@
+self.description = "Remove a package with a file marked for backup (--nosave)"
+
+p1 = pmpkg("dummy")
+p1.files = ["etc/dummy.conf"]
+p1.backup = ["etc/dummy.conf"]
+self.addpkg2db("local", p1)
+
+self.args = "-Rn %s" % p1.name
+
+self.addrule("PACMAN_RETCODE=0")
+self.addrule("!PKG_EXIST=dummy")
+self.addrule("!FILE_EXIST=etc/dummy.conf")
+self.addrule("!FILE_PACSAVE=etc/dummy.conf")
diff --git a/test/pacman/tests/remove021.py b/test/pacman/tests/remove021.py
new file mode 100644
index 00000000..87217563
--- /dev/null
+++ b/test/pacman/tests/remove021.py
@@ -0,0 +1,13 @@
+self.description = "Remove a package with a modified file marked for backup (--nosave)"
+
+p1 = pmpkg("dummy")
+p1.files = ["etc/dummy.conf*"]
+p1.backup = ["etc/dummy.conf"]
+self.addpkg2db("local", p1)
+
+self.args = "-Rn %s" % p1.name
+
+self.addrule("PACMAN_RETCODE=0")
+self.addrule("!PKG_EXIST=dummy")
+self.addrule("!FILE_EXIST=etc/dummy.conf")
+self.addrule("!FILE_PACSAVE=etc/dummy.conf")
diff --git a/test/pacman/tests/remove030.py b/test/pacman/tests/remove030.py
new file mode 100644
index 00000000..e975a4ba
--- /dev/null
+++ b/test/pacman/tests/remove030.py
@@ -0,0 +1,11 @@
+self.description = "Remove a package in HoldPkg"
+
+p1 = pmpkg("dummy")
+self.addpkg2db("local", p1)
+
+self.option["HoldPkg"] = ["dummy"]
+
+self.args = "-R %s" % p1.name
+
+self.addrule("PACMAN_RETCODE=1")
+self.addrule("PKG_EXIST=dummy")
diff --git a/test/pacman/tests/remove040.py b/test/pacman/tests/remove040.py
new file mode 100644
index 00000000..9d95b60e
--- /dev/null
+++ b/test/pacman/tests/remove040.py
@@ -0,0 +1,15 @@
+self.description = "Remove a package that requires another package"
+
+lp1 = pmpkg("pkg1")
+lp1.depends = ["imaginary"]
+self.addpkg2db("local", lp1)
+
+lp2 = pmpkg("pkg2")
+lp2.provides = ["imaginary"]
+self.addpkg2db("local", lp2)
+
+self.args = "-R %s" % lp1.name
+
+self.addrule("PACMAN_RETCODE=0")
+self.addrule("!PKG_EXIST=pkg1")
+self.addrule("PKG_EXIST=pkg2")
diff --git a/test/pacman/tests/remove041.py b/test/pacman/tests/remove041.py
new file mode 100644
index 00000000..be27fd4c
--- /dev/null
+++ b/test/pacman/tests/remove041.py
@@ -0,0 +1,19 @@
+self.description = "Remove a no longer needed package (multiple provision)"
+
+lp1 = pmpkg("pkg1")
+lp1.provides = ["imaginary"]
+self.addpkg2db("local", lp1)
+
+lp2 = pmpkg("pkg2")
+lp2.provides = ["imaginary"]
+self.addpkg2db("local", lp2)
+
+lp3 = pmpkg("pkg3")
+lp3.depends = ["imaginary"]
+self.addpkg2db("local", lp3)
+
+self.args = "-R %s" % lp1.name
+
+self.addrule("PACMAN_RETCODE=0")
+self.addrule("!PKG_EXIST=pkg1")
+self.addrule("PKG_EXIST=pkg2")
diff --git a/test/pacman/tests/remove042.py b/test/pacman/tests/remove042.py
new file mode 100644
index 00000000..796d0406
--- /dev/null
+++ b/test/pacman/tests/remove042.py
@@ -0,0 +1,15 @@
+self.description = "Cascade remove a package required by another package"
+
+lp1 = pmpkg("pkg1")
+lp1.depends = ["imaginary"]
+self.addpkg2db("local", lp1)
+
+lp2 = pmpkg("pkg2")
+lp2.provides = ["imaginary"]
+self.addpkg2db("local", lp2)
+
+self.args = "-Rc %s" % lp2.name
+
+self.addrule("PACMAN_RETCODE=0")
+self.addrule("!PKG_EXIST=pkg1")
+self.addrule("!PKG_EXIST=pkg2")
diff --git a/test/pacman/tests/remove043.py b/test/pacman/tests/remove043.py
new file mode 100644
index 00000000..0d448d0d
--- /dev/null
+++ b/test/pacman/tests/remove043.py
@@ -0,0 +1,15 @@
+self.description = "Remove a package required by another package"
+
+lp1 = pmpkg("pkg1")
+lp1.depends = ["imaginary"]
+self.addpkg2db("local", lp1)
+
+lp2 = pmpkg("pkg2")
+lp2.provides = ["imaginary"]
+self.addpkg2db("local", lp2)
+
+self.args = "-R %s" % lp2.name
+
+self.addrule("!PACMAN_RETCODE=0")
+self.addrule("PKG_EXIST=pkg1")
+self.addrule("PKG_EXIST=pkg2")
diff --git a/test/pacman/tests/remove044.py b/test/pacman/tests/remove044.py
new file mode 100644
index 00000000..720c1fe7
--- /dev/null
+++ b/test/pacman/tests/remove044.py
@@ -0,0 +1,16 @@
+self.description = "-Rs test"
+
+lp1 = pmpkg("pkg1")
+lp1.depends = ["pkg2=1.1-1"]
+self.addpkg2db("local", lp1)
+
+lp2 = pmpkg("pkg2", "1.0-1")
+lp2.reason = 1
+self.addpkg2db("local", lp2)
+
+
+self.args = "-Rs %s" % lp1.name
+
+self.addrule("PACMAN_RETCODE=0")
+self.addrule("!PKG_EXIST=pkg1")
+self.addrule("PKG_EXIST=pkg2")
diff --git a/test/pacman/tests/remove045.py b/test/pacman/tests/remove045.py
new file mode 100644
index 00000000..f42e58f2
--- /dev/null
+++ b/test/pacman/tests/remove045.py
@@ -0,0 +1,27 @@
+self.description = "-Rs advanced test"
+
+lp1 = pmpkg("pkg1")
+lp1.depends = ["pkg2" , "pkg3"]
+self.addpkg2db("local", lp1)
+
+lp2 = pmpkg("pkg2")
+lp2.reason = 1
+lp2.depends = ["pkg4"]
+self.addpkg2db("local", lp2)
+
+lp3 = pmpkg("pkg3")
+lp3.reason = 1
+self.addpkg2db("local", lp3)
+
+lp4 = pmpkg("pkg4")
+lp4.reason = 1
+lp4.depends = ["pkg3"]
+self.addpkg2db("local", lp4)
+
+self.args = "-Rs %s" % lp1.name
+
+self.addrule("PACMAN_RETCODE=0")
+self.addrule("!PKG_EXIST=pkg1")
+self.addrule("!PKG_EXIST=pkg2")
+self.addrule("!PKG_EXIST=pkg3")
+self.addrule("!PKG_EXIST=pkg4")
diff --git a/test/pacman/tests/remove047.py b/test/pacman/tests/remove047.py
new file mode 100644
index 00000000..8bb1a63a
--- /dev/null
+++ b/test/pacman/tests/remove047.py
@@ -0,0 +1,24 @@
+self.description = "Remove a package required by other packages"
+
+lp1 = pmpkg("pkg1")
+self.addpkg2db("local", lp1)
+
+lp2 = pmpkg("pkg2")
+lp2.depends = ["pkg1"]
+self.addpkg2db("local", lp2)
+
+lp3 = pmpkg("pkg3")
+lp3.depends = ["pkg1"]
+self.addpkg2db("local", lp3)
+
+lp4 = pmpkg("pkg4")
+lp4.depends = ["pkg1"]
+self.addpkg2db("local", lp4)
+
+self.args = "-R pkg1 pkg2"
+
+self.addrule("!PACMAN_RETCODE=0")
+self.addrule("PKG_EXIST=pkg1")
+self.addrule("PKG_EXIST=pkg2")
+self.addrule("PKG_EXIST=pkg3")
+self.addrule("PKG_EXIST=pkg4")
diff --git a/test/pacman/tests/remove049.py b/test/pacman/tests/remove049.py
new file mode 100644
index 00000000..a0336295
--- /dev/null
+++ b/test/pacman/tests/remove049.py
@@ -0,0 +1,18 @@
+self.description = "-Ru test"
+
+lp1 = pmpkg("pkg1")
+self.addpkg2db("local", lp1)
+
+lp2 = pmpkg("pkg2")
+self.addpkg2db("local", lp2)
+
+lp3 = pmpkg("pkg3")
+lp3.depends = [ "pkg1" ]
+self.addpkg2db("local", lp3)
+
+self.args = "-Ru pkg1 pkg2"
+
+self.addrule("PACMAN_RETCODE=0")
+self.addrule("PKG_EXIST=pkg1")
+self.addrule("!PKG_EXIST=pkg2")
+self.addrule("PKG_EXIST=pkg3") \ No newline at end of file
diff --git a/test/pacman/tests/remove050.py b/test/pacman/tests/remove050.py
new file mode 100644
index 00000000..44b0d18c
--- /dev/null
+++ b/test/pacman/tests/remove050.py
@@ -0,0 +1,20 @@
+self.description = "-Rs test (exclude explicit)"
+
+lp1 = pmpkg("pkg1")
+lp1.depends = ["pkg2" , "pkg3"]
+self.addpkg2db("local", lp1)
+
+lp2 = pmpkg("pkg2")
+lp2.reason = 1
+self.addpkg2db("local", lp2)
+
+lp3 = pmpkg("pkg3")
+lp3.reason = 0
+self.addpkg2db("local", lp3)
+
+self.args = "-Rs %s" % lp1.name
+
+self.addrule("PACMAN_RETCODE=0")
+self.addrule("!PKG_EXIST=pkg1")
+self.addrule("!PKG_EXIST=pkg2")
+self.addrule("PKG_EXIST=pkg3")
diff --git a/test/pacman/tests/remove051.py b/test/pacman/tests/remove051.py
new file mode 100644
index 00000000..bba87bba
--- /dev/null
+++ b/test/pacman/tests/remove051.py
@@ -0,0 +1,20 @@
+self.description = "-Rss test (include explicit)"
+
+lp1 = pmpkg("pkg1")
+lp1.depends = ["pkg2" , "pkg3"]
+self.addpkg2db("local", lp1)
+
+lp2 = pmpkg("pkg2")
+lp2.reason = 1
+self.addpkg2db("local", lp2)
+
+lp3 = pmpkg("pkg3")
+lp3.reason = 0
+self.addpkg2db("local", lp3)
+
+self.args = "-Rss %s" % lp1.name
+
+self.addrule("PACMAN_RETCODE=0")
+self.addrule("!PKG_EXIST=pkg1")
+self.addrule("!PKG_EXIST=pkg2")
+self.addrule("!PKG_EXIST=pkg3")
diff --git a/test/pacman/tests/remove052.py b/test/pacman/tests/remove052.py
new file mode 100644
index 00000000..df1e0db1
--- /dev/null
+++ b/test/pacman/tests/remove052.py
@@ -0,0 +1,21 @@
+self.description = "-Rs test (dependency chain)"
+
+lp1 = pmpkg("pkg1")
+lp1.depends = ["pkg2"]
+self.addpkg2db("local", lp1)
+
+lp2 = pmpkg("pkg2")
+lp2.depends = ["pkg3"]
+lp2.reason = 1
+self.addpkg2db("local", lp2)
+
+lp3 = pmpkg("pkg3")
+lp3.reason = 1
+self.addpkg2db("local", lp3)
+
+self.args = "-Rs %s" % " ".join([p.name for p in lp1, lp3])
+
+self.addrule("PACMAN_RETCODE=0")
+self.addrule("!PKG_EXIST=pkg1")
+self.addrule("!PKG_EXIST=pkg2")
+self.addrule("!PKG_EXIST=pkg3")
diff --git a/test/pacman/tests/remove060.py b/test/pacman/tests/remove060.py
new file mode 100644
index 00000000..7f705519
--- /dev/null
+++ b/test/pacman/tests/remove060.py
@@ -0,0 +1,19 @@
+self.description = "Remove a group"
+
+lp1 = pmpkg("pkg1")
+lp1.groups = ["grp"]
+
+lp2 = pmpkg("pkg2")
+
+lp3 = pmpkg("pkg3")
+lp3.groups = ["grp"]
+
+for p in lp1, lp2, lp3:
+ self.addpkg2db("local", p);
+
+self.args = "-R grp"
+
+self.addrule("PACMAN_RETCODE=0")
+self.addrule("!PKG_EXIST=pkg1")
+self.addrule("PKG_EXIST=pkg2")
+self.addrule("!PKG_EXIST=pkg3")
diff --git a/test/pacman/tests/scriptlet001.py b/test/pacman/tests/scriptlet001.py
new file mode 100644
index 00000000..ff7fcd20
--- /dev/null
+++ b/test/pacman/tests/scriptlet001.py
@@ -0,0 +1,20 @@
+self.description = "Scriptlet test (pre/post install)"
+
+p1 = pmpkg("dummy")
+p1.files = ['etc/dummy.conf']
+pre = "OUTPUT FROM PRE_INSTALL"
+post = "OUTPUT FROM POST_INSTALL"
+p1.install['pre_install'] = "echo " + pre
+p1.install['post_install'] = "echo " + post
+self.addpkg(p1)
+
+# --debug is necessary to check PACMAN_OUTPUT
+self.args = "--debug -U %s" % p1.filename()
+
+self.addrule("PACMAN_RETCODE=0")
+self.addrule("PACMAN_OUTPUT=" + pre)
+self.addrule("PACMAN_OUTPUT=" + post)
+
+fakechroot = which("fakechroot")
+if not fakechroot:
+ self.expectfailure = True
diff --git a/test/pacman/tests/scriptlet002.py b/test/pacman/tests/scriptlet002.py
new file mode 100644
index 00000000..cc316a10
--- /dev/null
+++ b/test/pacman/tests/scriptlet002.py
@@ -0,0 +1,20 @@
+self.description = "Scriptlet test (pre/post remove)"
+
+p1 = pmpkg("dummy")
+p1.files = ['etc/dummy.conf']
+pre = "OUTPUT FROM PRE_REMOVE";
+post = "OUTPUT FROM POST_REMOVE";
+p1.install['pre_remove'] = "echo " + pre
+p1.install['post_remove'] = "echo " + post
+self.addpkg2db("local", p1)
+
+# --debug is necessary to check PACMAN_OUTPUT
+self.args = "--debug -R %s" % p1.name
+
+self.addrule("PACMAN_RETCODE=0")
+self.addrule("PACMAN_OUTPUT=" + pre)
+self.addrule("PACMAN_OUTPUT=" + post)
+
+fakechroot = which("fakechroot")
+if not fakechroot:
+ self.expectfailure = True
diff --git a/test/pacman/tests/smoke001.py b/test/pacman/tests/smoke001.py
new file mode 100644
index 00000000..c6636391
--- /dev/null
+++ b/test/pacman/tests/smoke001.py
@@ -0,0 +1,23 @@
+self.description = "Install a thousand packages in a single transaction"
+
+p = pmpkg("pkg1000")
+
+self.addpkg2db("local", p)
+
+for i in range(1000):
+ p = pmpkg("pkg%03d" % i)
+ p.depends = ["pkg%03d" % (i+1)]
+ p.files = ["usr/share/pkg%03d" % i]
+ self.addpkg(p)
+
+_list = []
+[_list.append(p.filename()) for p in self.localpkgs]
+self.args = "-U %s" % " ".join(_list)
+
+self.addrule("PACMAN_RETCODE=0")
+#for i in range(1000):
+# self.addrule("PKG_EXIST=pkg%03d" %i)
+# picked 3 random packages to test for, since the loop is too much to handle
+self.addrule("PKG_EXIST=pkg050")
+self.addrule("PKG_EXIST=pkg674")
+self.addrule("PKG_EXIST=pkg999")
diff --git a/test/pacman/tests/symlink001.py b/test/pacman/tests/symlink001.py
new file mode 100644
index 00000000..cbf71ccc
--- /dev/null
+++ b/test/pacman/tests/symlink001.py
@@ -0,0 +1,20 @@
+self.description = "Dir symlinks overwritten on install (the perl/git bug)"
+
+lp = pmpkg("dummy")
+lp.files = ["dir/realdir/",
+ "dir/symdir -> realdir"]
+self.addpkg2db("local", lp)
+
+p = pmpkg("pkg1")
+p.files = ["dir/symdir/tmp"]
+self.addpkg(p)
+
+self.args = "-U %s" % p.filename()
+
+self.addrule("PACMAN_RETCODE=0")
+self.addrule("PKG_EXIST=pkg1")
+self.addrule("FILE_EXIST=dir/symdir/tmp")
+self.addrule("FILE_EXIST=dir/realdir/tmp")
+self.addrule("FILE_TYPE=dir/symdir/tmp|file")
+self.addrule("FILE_TYPE=dir/symdir|link")
+self.addrule("FILE_TYPE=dir/realdir|dir")
diff --git a/test/pacman/tests/sync001.py b/test/pacman/tests/sync001.py
new file mode 100644
index 00000000..0f5fdcfb
--- /dev/null
+++ b/test/pacman/tests/sync001.py
@@ -0,0 +1,13 @@
+self.description = "Install a package from a sync db"
+
+sp = pmpkg("dummy")
+sp.files = ["bin/dummy",
+ "usr/man/man1/dummy.1"]
+self.addpkg2db("sync", sp)
+
+self.args = "-S %s" % sp.name
+
+self.addrule("PACMAN_RETCODE=0")
+self.addrule("PKG_EXIST=dummy")
+for f in sp.files:
+ self.addrule("FILE_EXIST=%s" % f)
diff --git a/test/pacman/tests/sync002.py b/test/pacman/tests/sync002.py
new file mode 100644
index 00000000..a183f911
--- /dev/null
+++ b/test/pacman/tests/sync002.py
@@ -0,0 +1,18 @@
+self.description = "Upgrade a package from a sync db"
+
+sp = pmpkg("dummy", "1.0-2")
+sp.files = ["bin/dummy",
+ "usr/man/man1/dummy.1"]
+self.addpkg2db("sync", sp)
+
+lp = pmpkg("dummy")
+lp.files = ["bin/dummy",
+ "usr/man/man1/dummy.1"]
+self.addpkg2db("local", lp)
+
+self.args = "-S %s" % sp.name
+
+self.addrule("PACMAN_RETCODE=0")
+self.addrule("PKG_VERSION=dummy|1.0-2")
+for f in lp.files:
+ self.addrule("FILE_MODIFIED=%s" % f)
diff --git a/test/pacman/tests/sync003.py b/test/pacman/tests/sync003.py
new file mode 100644
index 00000000..b21cbcaa
--- /dev/null
+++ b/test/pacman/tests/sync003.py
@@ -0,0 +1,13 @@
+self.description = "Install a package from a sync db, with a filesystem conflict"
+
+sp = pmpkg("dummy")
+sp.files = ["bin/dummy",
+ "usr/man/man1/dummy.1"]
+self.addpkg2db("sync", sp)
+
+self.filesystem = ["bin/dummy"]
+
+self.args = "-S %s" % sp.name
+
+self.addrule("PACMAN_RETCODE=1")
+self.addrule("!PKG_EXIST=dummy")
diff --git a/test/pacman/tests/sync009.py b/test/pacman/tests/sync009.py
new file mode 100644
index 00000000..0f5fdcfb
--- /dev/null
+++ b/test/pacman/tests/sync009.py
@@ -0,0 +1,13 @@
+self.description = "Install a package from a sync db"
+
+sp = pmpkg("dummy")
+sp.files = ["bin/dummy",
+ "usr/man/man1/dummy.1"]
+self.addpkg2db("sync", sp)
+
+self.args = "-S %s" % sp.name
+
+self.addrule("PACMAN_RETCODE=0")
+self.addrule("PKG_EXIST=dummy")
+for f in sp.files:
+ self.addrule("FILE_EXIST=%s" % f)
diff --git a/test/pacman/tests/sync010.py b/test/pacman/tests/sync010.py
new file mode 100644
index 00000000..df407a32
--- /dev/null
+++ b/test/pacman/tests/sync010.py
@@ -0,0 +1,27 @@
+self.description = "Install a package from a sync db with cascaded dependencies"
+
+sp1 = pmpkg("dummy", "1.0-2")
+sp1.files = ["bin/dummy",
+ "usr/man/man1/dummy.1"]
+sp1.depends = ["dep1"]
+
+sp2 = pmpkg("dep1")
+sp2.files = ["bin/dep1"]
+sp2.depends = ["dep2"]
+
+sp3 = pmpkg("dep2")
+sp3.files = ["bin/dep2"]
+
+for p in sp1, sp2, sp3:
+ self.addpkg2db("sync", p);
+
+self.args = "-S %s" % sp1.name
+
+self.addrule("PACMAN_RETCODE=0")
+self.addrule("PKG_VERSION=dummy|1.0-2")
+self.addrule("PKG_DEPENDS=dummy|dep1")
+for p in sp1, sp2, sp3:
+ self.addrule("PKG_EXIST=%s" % p.name)
+ for f in p.files:
+ self.addrule("FILE_EXIST=%s" % f)
+self.addrule("PKG_DEPENDS=dep1|dep2")
diff --git a/test/pacman/tests/sync011.py b/test/pacman/tests/sync011.py
new file mode 100644
index 00000000..f5b1943a
--- /dev/null
+++ b/test/pacman/tests/sync011.py
@@ -0,0 +1,20 @@
+self.description = "Install a package from a sync db with cascaded dependencies + provides"
+
+sp1 = pmpkg("dummy", "1.0-2")
+sp1.depends = ["dep1", "dep2=1.0-2"]
+
+sp2 = pmpkg("dep1")
+sp2.files = ["bin/dep1"]
+sp2.provides = ["dep2"]
+
+sp3 = pmpkg("dep2", "1.0-2")
+
+for p in sp1, sp2, sp3:
+ self.addpkg2db("sync", p);
+
+self.args = "-S %s" % sp1.name
+
+self.addrule("PACMAN_RETCODE=0")
+self.addrule("PKG_VERSION=dummy|1.0-2")
+self.addrule("PKG_EXIST=dep1")
+self.addrule("PKG_EXIST=dep2")
diff --git a/test/pacman/tests/sync012.py b/test/pacman/tests/sync012.py
new file mode 100644
index 00000000..3aaba376
--- /dev/null
+++ b/test/pacman/tests/sync012.py
@@ -0,0 +1,20 @@
+self.description = "Install packages from a sync db with circular dependencies"
+
+sp1 = pmpkg("pkg1")
+sp1.depends = ["pkg2"]
+
+sp2 = pmpkg("pkg2")
+sp2.depends = ["pkg3"]
+
+sp3 = pmpkg("pkg3")
+sp3.depends = ["pkg1"]
+
+for p in sp1, sp2, sp3:
+ self.addpkg2db("sync", p);
+
+self.args = "-S %s" % sp1.name
+
+self.addrule("PACMAN_RETCODE=0")
+self.addrule("PKG_EXIST=pkg1")
+self.addrule("PKG_EXIST=pkg2")
+self.addrule("PKG_EXIST=pkg3")
diff --git a/test/pacman/tests/sync020.py b/test/pacman/tests/sync020.py
new file mode 100644
index 00000000..0f2a0413
--- /dev/null
+++ b/test/pacman/tests/sync020.py
@@ -0,0 +1,19 @@
+self.description = "Install a group from a sync db"
+
+sp1 = pmpkg("pkg1")
+sp1.groups = ["grp"]
+
+sp2 = pmpkg("pkg2")
+sp2.groups = ["grp"]
+
+sp3 = pmpkg("pkg3")
+sp3.groups = ["grp"]
+
+for p in sp1, sp2, sp3:
+ self.addpkg2db("sync", p);
+
+self.args = "-S %s" % "grp"
+
+self.addrule("PACMAN_RETCODE=0")
+for p in sp1, sp2, sp3:
+ self.addrule("PKG_EXIST=%s" % p.name)
diff --git a/test/pacman/tests/sync021.py b/test/pacman/tests/sync021.py
new file mode 100644
index 00000000..4c664d8e
--- /dev/null
+++ b/test/pacman/tests/sync021.py
@@ -0,0 +1,21 @@
+self.description = "Install a group from a sync db with a package in IgnorePkg"
+
+sp1 = pmpkg("pkg1")
+sp1.groups = ["grp"]
+
+sp2 = pmpkg("pkg2")
+sp2.groups = ["grp"]
+
+sp3 = pmpkg("pkg3")
+sp3.groups = ["grp"]
+
+for p in sp1, sp2, sp3:
+ self.addpkg2db("sync", p);
+
+self.option["IgnorePkg"] = ["pkg2"]
+
+self.args = "-S grp"
+
+self.addrule("PACMAN_RETCODE=0")
+for p in sp1, sp2, sp3:
+ self.addrule("PKG_EXIST=%s" % p.name)
diff --git a/test/pacman/tests/sync030.py b/test/pacman/tests/sync030.py
new file mode 100644
index 00000000..1fd97500
--- /dev/null
+++ b/test/pacman/tests/sync030.py
@@ -0,0 +1,19 @@
+self.description = "Sync packages non-explicitly"
+
+lp1 = pmpkg("pkg1")
+lp1.reason = 0
+self.addpkg2db("local", lp1)
+
+p1 = pmpkg("pkg1", "1.0-2")
+p2 = pmpkg("pkg2", "1.0-2")
+
+for p in p1, p2:
+ self.addpkg2db("sync", p)
+
+self.args = "-S --asdeps %s" % " ".join([p.name for p in p1, p2])
+
+self.addrule("PACMAN_RETCODE=0")
+self.addrule("PKG_VERSION=pkg1|1.0-2")
+self.addrule("PKG_VERSION=pkg2|1.0-2")
+self.addrule("PKG_REASON=pkg1|1")
+self.addrule("PKG_REASON=pkg2|1")
diff --git a/test/pacman/tests/sync031.py b/test/pacman/tests/sync031.py
new file mode 100644
index 00000000..4aa2ee39
--- /dev/null
+++ b/test/pacman/tests/sync031.py
@@ -0,0 +1,19 @@
+self.description = "Sync packages explicitly"
+
+lp1 = pmpkg("pkg1")
+lp1.reason = 1
+self.addpkg2db("local", lp1)
+
+p1 = pmpkg("pkg1", "1.0-2")
+p2 = pmpkg("pkg2", "1.0-2")
+
+for p in p1, p2:
+ self.addpkg2db("sync", p)
+
+self.args = "-S --asexplicit %s" % " ".join([p.name for p in p1, p2])
+
+self.addrule("PACMAN_RETCODE=0")
+self.addrule("PKG_VERSION=pkg1|1.0-2")
+self.addrule("PKG_VERSION=pkg2|1.0-2")
+self.addrule("PKG_REASON=pkg1|0")
+self.addrule("PKG_REASON=pkg2|0")
diff --git a/test/pacman/tests/sync040.py b/test/pacman/tests/sync040.py
new file mode 100644
index 00000000..e5641fe0
--- /dev/null
+++ b/test/pacman/tests/sync040.py
@@ -0,0 +1,15 @@
+self.description = "Install two targets from a sync db with a conflict"
+
+sp1 = pmpkg("pkg1")
+sp1.conflicts = ["pkg2"]
+
+sp2 = pmpkg("pkg2")
+
+for p in sp1, sp2:
+ self.addpkg2db("sync", p);
+
+self.args = "-S %s" % " ".join([p.name for p in sp1, sp2])
+
+self.addrule("PACMAN_RETCODE=1")
+for p in sp1, sp2:
+ self.addrule("!PKG_EXIST=%s" % p.name)
diff --git a/test/pacman/tests/sync041.py b/test/pacman/tests/sync041.py
new file mode 100644
index 00000000..328728e2
--- /dev/null
+++ b/test/pacman/tests/sync041.py
@@ -0,0 +1,16 @@
+self.description = "Install two conflicting targets"
+
+sp1 = pmpkg("pkg1")
+sp1.conflicts = ["pkg2"]
+
+sp2 = pmpkg("pkg2")
+sp2.conflicts = ["pkg1"]
+
+for p in sp1, sp2:
+ self.addpkg2db("sync", p);
+
+self.args = "-S %s" % " ".join([p.name for p in sp1, sp2])
+
+self.addrule("PACMAN_RETCODE=1")
+self.addrule("!PKG_EXIST=pkg1")
+self.addrule("!PKG_EXIST=pkg2")
diff --git a/test/pacman/tests/sync042.py b/test/pacman/tests/sync042.py
new file mode 100644
index 00000000..7c3498d3
--- /dev/null
+++ b/test/pacman/tests/sync042.py
@@ -0,0 +1,14 @@
+self.description = "Install a sync package conflicting with a local one"
+
+sp = pmpkg("pkg1")
+sp.conflicts = ["pkg2"]
+self.addpkg2db("sync", sp);
+
+lp = pmpkg("pkg2")
+self.addpkg2db("local", lp);
+
+self.args = "-S %s" % sp.name
+
+self.addrule("PACMAN_RETCODE=1")
+self.addrule("!PKG_EXIST=pkg1")
+self.addrule("PKG_EXIST=pkg2")
diff --git a/test/pacman/tests/sync043.py b/test/pacman/tests/sync043.py
new file mode 100644
index 00000000..8461e9f9
--- /dev/null
+++ b/test/pacman/tests/sync043.py
@@ -0,0 +1,18 @@
+self.description = "Install a sync package conflicting with two local ones"
+
+sp = pmpkg("pkg1")
+sp.conflicts = ["pkg2", "pkg3"]
+self.addpkg2db("sync", sp);
+
+lp1 = pmpkg("pkg2")
+self.addpkg2db("local", lp1);
+
+lp2 = pmpkg("pkg3")
+self.addpkg2db("local", lp2);
+
+self.args = "-S %s --ask=4" % sp.name
+
+self.addrule("PACMAN_RETCODE=0")
+self.addrule("PKG_EXIST=pkg1")
+self.addrule("!PKG_EXIST=pkg2")
+self.addrule("!PKG_EXIST=pkg3")
diff --git a/test/pacman/tests/sync044.py b/test/pacman/tests/sync044.py
new file mode 100644
index 00000000..0c8fd2e9
--- /dev/null
+++ b/test/pacman/tests/sync044.py
@@ -0,0 +1,20 @@
+self.description = "A dependency induces a replacement"
+
+lp1 = pmpkg("pkg1")
+self.addpkg2db("local", lp1);
+
+sp2 = pmpkg("pkg2")
+sp2.depends = ["pkg3"]
+self.addpkg2db("sync", sp2);
+
+sp3 = pmpkg("pkg3")
+sp3.conflicts = ["pkg1"]
+self.addpkg2db("sync", sp3);
+
+self.args = "-S pkg2 --ask=4"
+
+self.addrule("PACMAN_RETCODE=0")
+self.addrule("!PKG_EXIST=pkg1")
+self.addrule("PKG_EXIST=pkg2")
+self.addrule("PKG_EXIST=pkg3")
+self.addrule("PKG_REASON=pkg3|1")
diff --git a/test/pacman/tests/sync045.py b/test/pacman/tests/sync045.py
new file mode 100644
index 00000000..574c0a52
--- /dev/null
+++ b/test/pacman/tests/sync045.py
@@ -0,0 +1,18 @@
+self.description = "Install a sync package conflicting with two local ones (-d)"
+
+sp = pmpkg("pkg1")
+sp.conflicts = ["pkg2", "pkg3"]
+self.addpkg2db("sync", sp);
+
+lp1 = pmpkg("pkg2")
+self.addpkg2db("local", lp1);
+
+lp2 = pmpkg("pkg3")
+self.addpkg2db("local", lp2);
+
+self.args = "-Sd %s --ask=4" % sp.name
+
+self.addrule("PACMAN_RETCODE=0")
+self.addrule("PKG_EXIST=pkg1")
+self.addrule("!PKG_EXIST=pkg2")
+self.addrule("!PKG_EXIST=pkg3")
diff --git a/test/pacman/tests/sync050.py b/test/pacman/tests/sync050.py
new file mode 100644
index 00000000..1ed697f3
--- /dev/null
+++ b/test/pacman/tests/sync050.py
@@ -0,0 +1,11 @@
+self.description = "Install a virtual target (provided by a sync package)"
+
+sp1 = pmpkg("pkg1")
+sp1.provides = ["pkg2"]
+self.addpkg2db("sync", sp1);
+
+self.args = "-S %s" % sp1.name
+
+self.addrule("PACMAN_RETCODE=0")
+self.addrule("PKG_EXIST=pkg1")
+self.addrule("!PKG_EXIST=pkg2")
diff --git a/test/pacman/tests/sync100.py b/test/pacman/tests/sync100.py
new file mode 100644
index 00000000..a4997fb1
--- /dev/null
+++ b/test/pacman/tests/sync100.py
@@ -0,0 +1,12 @@
+self.description = "Sysupgrade with a newer sync package"
+
+sp = pmpkg("dummy", "1.0-2")
+lp = pmpkg("dummy")
+
+self.addpkg2db("sync", sp)
+self.addpkg2db("local", lp)
+
+self.args = "-Su"
+
+self.addrule("PACMAN_RETCODE=0")
+self.addrule("PKG_VERSION=dummy|1.0-2")
diff --git a/test/pacman/tests/sync1000.py b/test/pacman/tests/sync1000.py
new file mode 100644
index 00000000..e7f43263
--- /dev/null
+++ b/test/pacman/tests/sync1000.py
@@ -0,0 +1,17 @@
+# If someone else can come up with a better name, please do so
+self.description = "stonecrest's problem"
+
+sp = pmpkg("dummy", "1.1-1")
+self.addpkg2db("sync", sp)
+
+lp1 = pmpkg("dummy", "1.0-1")
+self.addpkg2db("local", lp1)
+
+lp2 = pmpkg("pkg")
+lp2.depends = [ "dummy=1.0" ]
+self.addpkg2db("local", lp2)
+
+self.args = "-Su"
+
+self.addrule("!PACMAN_RETCODE=0")
+self.addrule("!PKG_VERSION=dummy|1.1-1")
diff --git a/test/pacman/tests/sync1003.py b/test/pacman/tests/sync1003.py
new file mode 100644
index 00000000..cd980637
--- /dev/null
+++ b/test/pacman/tests/sync1003.py
@@ -0,0 +1,21 @@
+self.description = "Induced removal would break dependency"
+
+sp1 = pmpkg("pkg1", "1.0-2")
+sp1.replaces = [ "pkg2" ]
+self.addpkg2db("sync", sp1)
+
+lp2 = pmpkg("pkg2", "1.0-1")
+self.addpkg2db("local", lp2)
+
+lp3 = pmpkg("pkg3", "1.0-1")
+lp3.depends = [ "pkg2=1.0" ]
+self.addpkg2db("local", lp3)
+
+self.args = "-Su"
+
+self.addrule("PACMAN_RETCODE=1")
+self.addrule("!PKG_EXIST=pkg1")
+self.addrule("PKG_EXIST=pkg2")
+self.addrule("PKG_EXIST=pkg3")
+self.addrule("PKG_VERSION=pkg2|1.0-1")
+self.addrule("PKG_VERSION=pkg3|1.0-1")
diff --git a/test/pacman/tests/sync1004.py b/test/pacman/tests/sync1004.py
new file mode 100644
index 00000000..a9cee49c
--- /dev/null
+++ b/test/pacman/tests/sync1004.py
@@ -0,0 +1,18 @@
+self.description = "Induced removal would break dependency (2)"
+
+sp1 = pmpkg("pkg1")
+sp1.conflicts = [ "depend" ]
+self.addpkg2db("sync", sp1)
+
+sp2 = pmpkg("pkg2")
+sp2.depends = ["depend"]
+self.addpkg2db("sync", sp2)
+
+lp = pmpkg("depend")
+self.addpkg2db("local", lp)
+
+self.args = "-S pkg1 pkg2 --ask=4"
+
+self.addrule("PACMAN_RETCODE=1")
+self.addrule("PKG_EXIST=depend")
+
diff --git a/test/pacman/tests/sync1008.py b/test/pacman/tests/sync1008.py
new file mode 100644
index 00000000..a6064597
--- /dev/null
+++ b/test/pacman/tests/sync1008.py
@@ -0,0 +1,19 @@
+self.description = "Conflicting package names in sync repos"
+
+sp1 = pmpkg("cpkg", "1.0-1")
+sp1.provides = [ "provision1" ]
+self.addpkg2db("sync1", sp1)
+
+sp2 = pmpkg("cpkg", "2.0-1")
+sp2.provides = [ "provision2" ]
+self.addpkg2db("sync2", sp2)
+
+sp3 = pmpkg("pkg")
+sp3.depends = [ "provision1" , "provision2" ]
+self.addpkg2db("sync1", sp3)
+
+self.args = "-S pkg"
+
+self.addrule("PACMAN_RETCODE=1")
+self.addrule("!PKG_EXIST=pkg")
+self.addrule("!PKG_EXIST=cpkg")
diff --git a/test/pacman/tests/sync101.py b/test/pacman/tests/sync101.py
new file mode 100644
index 00000000..5d39ecb9
--- /dev/null
+++ b/test/pacman/tests/sync101.py
@@ -0,0 +1,12 @@
+self.description = "Sysupgrade with same version for local and sync packages"
+
+sp = pmpkg("dummy")
+lp = pmpkg("dummy")
+
+self.addpkg2db("sync", sp)
+self.addpkg2db("local", lp)
+
+self.args = "-Su"
+
+self.addrule("PACMAN_RETCODE=0")
+self.addrule("!PKG_MODIFIED=dummy")
diff --git a/test/pacman/tests/sync102.py b/test/pacman/tests/sync102.py
new file mode 100644
index 00000000..40a7ec99
--- /dev/null
+++ b/test/pacman/tests/sync102.py
@@ -0,0 +1,12 @@
+self.description = "Sysupgrade with a newer local package"
+
+sp = pmpkg("dummy", "0.9-1")
+lp = pmpkg("dummy")
+
+self.addpkg2db("sync", sp)
+self.addpkg2db("local", lp)
+
+self.args = "-Su"
+
+self.addrule("PACMAN_RETCODE=0")
+self.addrule("!PKG_MODIFIED=dummy")
diff --git a/test/pacman/tests/sync103.py b/test/pacman/tests/sync103.py
new file mode 100644
index 00000000..15e7c8e1
--- /dev/null
+++ b/test/pacman/tests/sync103.py
@@ -0,0 +1,13 @@
+self.description = "Sysupgrade with a local package not existing in sync db"
+
+sp = pmpkg("spkg")
+self.addpkg2db("sync", sp)
+
+lp = pmpkg("lpkg")
+self.addpkg2db("local", lp)
+
+self.args = "-Su"
+
+self.addrule("PACMAN_RETCODE=0")
+self.addrule("!PKG_MODIFIED=lpkg")
+self.addrule("!PKG_EXIST=spkg")
diff --git a/test/pacman/tests/sync104.py b/test/pacman/tests/sync104.py
new file mode 100644
index 00000000..6d51b85a
--- /dev/null
+++ b/test/pacman/tests/sync104.py
@@ -0,0 +1,12 @@
+self.description = "-Suu"
+
+sp = pmpkg("dummy", "0.9-1")
+lp = pmpkg("dummy", "1.0-1")
+
+self.addpkg2db("sync", sp)
+self.addpkg2db("local", lp)
+
+self.args = "-Suu"
+
+self.addrule("PACMAN_RETCODE=0")
+self.addrule("PKG_VERSION=dummy|0.9-1")
diff --git a/test/pacman/tests/sync110.py b/test/pacman/tests/sync110.py
new file mode 100644
index 00000000..08a1a890
--- /dev/null
+++ b/test/pacman/tests/sync110.py
@@ -0,0 +1,22 @@
+self.description = "Sysupgrade of a package pulling new dependencies"
+
+sp1 = pmpkg("pkg1", "1.0-2")
+sp1.depends = ["pkg2"]
+
+sp2 = pmpkg("pkg2")
+sp2.depends = ["pkg3"]
+
+sp3 = pmpkg("pkg3")
+
+for p in sp1, sp2, sp3:
+ self.addpkg2db("sync", p)
+
+lp1 = pmpkg("pkg1")
+self.addpkg2db("local", lp1)
+
+self.args = "-Su"
+
+self.addrule("PACMAN_RETCODE=0")
+self.addrule("PKG_VERSION=pkg1|1.0-2")
+for p in sp2, sp3:
+ self.addrule("PKG_REASON=%s|1" % p.name)
diff --git a/test/pacman/tests/sync1100.py b/test/pacman/tests/sync1100.py
new file mode 100644
index 00000000..887b85e8
--- /dev/null
+++ b/test/pacman/tests/sync1100.py
@@ -0,0 +1,23 @@
+self.description = "Get info on package from a sync db"
+
+sp = pmpkg("dummy")
+sp.files = ["bin/dummy",
+ "usr/man/man1/dummy.1"]
+sp.desc = "test description"
+sp.groups = ["foo"]
+sp.url = "http://www.archlinux.org"
+sp.license = "GPL2"
+sp.arch = "i686"
+# test both old style and new style dates
+sp.builddate = "Mon Oct 1 01:40:21 2007 UTC"
+sp.packager = "Arch Linux"
+sp.md5sum = "00000000000000000000000000000000"
+
+self.addpkg2db("sync", sp)
+
+self.args = "-Si %s" % sp.name
+
+self.addrule("PACMAN_RETCODE=0")
+self.addrule("PACMAN_OUTPUT=%s" % sp.name)
+self.addrule("PACMAN_OUTPUT=%s" % sp.desc)
+self.addrule("PACMAN_OUTPUT=2007")
diff --git a/test/pacman/tests/sync1101.py b/test/pacman/tests/sync1101.py
new file mode 100644
index 00000000..e3ed0f0f
--- /dev/null
+++ b/test/pacman/tests/sync1101.py
@@ -0,0 +1,12 @@
+self.description = "Search for package from a sync db"
+
+sp = pmpkg("dummy")
+sp.groups = ["group1", "group2"]
+sp.files = ["bin/dummy",
+ "usr/man/man1/dummy.1"]
+self.addpkg2db("sync", sp)
+
+self.args = "-Ss %s" % sp.name
+
+self.addrule("PACMAN_RETCODE=0")
+self.addrule("PACMAN_OUTPUT=%s" % sp.name)
diff --git a/test/pacman/tests/sync1102.py b/test/pacman/tests/sync1102.py
new file mode 100644
index 00000000..3a27238f
--- /dev/null
+++ b/test/pacman/tests/sync1102.py
@@ -0,0 +1,12 @@
+self.description = "Get URL on package from a sync db"
+
+sp = pmpkg("dummy")
+sp.files = ["bin/dummy",
+ "usr/man/man1/dummy.1"]
+self.addpkg2db("sync", sp)
+
+self.args = "-Sp %s" % sp.name
+
+self.addrule("PACMAN_RETCODE=0")
+self.addrule("PACMAN_OUTPUT=%s" % sp.name)
+self.addrule("PACMAN_OUTPUT=file://")
diff --git a/test/pacman/tests/sync1103.py b/test/pacman/tests/sync1103.py
new file mode 100644
index 00000000..052c7236
--- /dev/null
+++ b/test/pacman/tests/sync1103.py
@@ -0,0 +1,11 @@
+self.description = "Get package list from sync dbs"
+
+sp = pmpkg("dummy")
+sp.files = ["bin/dummy",
+ "usr/man/man1/dummy.1"]
+self.addpkg2db("sync", sp)
+
+self.args = "-Sl"
+
+self.addrule("PACMAN_RETCODE=0")
+self.addrule("PACMAN_OUTPUT=%s" % sp.name)
diff --git a/test/pacman/tests/sync120.py b/test/pacman/tests/sync120.py
new file mode 100644
index 00000000..994e440e
--- /dev/null
+++ b/test/pacman/tests/sync120.py
@@ -0,0 +1,21 @@
+self.description = "Sysupgrade of packages in 'IgnorePkg'"
+
+sp1 = pmpkg("pkg1", "1.0-2")
+sp2 = pmpkg("pkg2", "1.0-2")
+
+for p in sp1, sp2:
+ self.addpkg2db("sync", p)
+
+lp1 = pmpkg("pkg1")
+lp2 = pmpkg("pkg2")
+
+for p in lp1, lp2:
+ self.addpkg2db("local", p)
+
+self.option["IgnorePkg"] = ["pkg2"]
+
+self.args = "-Su"
+
+self.addrule("PACMAN_RETCODE=0")
+self.addrule("PKG_VERSION=pkg1|1.0-2")
+self.addrule("!PKG_MODIFIED=pkg2")
diff --git a/test/pacman/tests/sync130.py b/test/pacman/tests/sync130.py
new file mode 100644
index 00000000..afd196d1
--- /dev/null
+++ b/test/pacman/tests/sync130.py
@@ -0,0 +1,16 @@
+self.description = "Sysupgrade with a sync package replacing a local one"
+
+sp = pmpkg("pkg2")
+sp.replaces = ["pkg1"]
+
+self.addpkg2db("sync", sp)
+
+lp = pmpkg("pkg1")
+
+self.addpkg2db("local", lp)
+
+self.args = "-Su"
+
+self.addrule("PACMAN_RETCODE=0")
+self.addrule("!PKG_EXIST=pkg1")
+self.addrule("PKG_EXIST=pkg2")
diff --git a/test/pacman/tests/sync131.py b/test/pacman/tests/sync131.py
new file mode 100644
index 00000000..6d70d609
--- /dev/null
+++ b/test/pacman/tests/sync131.py
@@ -0,0 +1,18 @@
+self.description = "Sysupgrade with a sync package replacing a set of local ones"
+
+sp = pmpkg("pkg4")
+sp.replaces = ["pkg1", "pkg2", "pkg3"]
+self.addpkg2db("sync", sp)
+
+lp1 = pmpkg("pkg1")
+self.addpkg2db("local", lp1)
+
+lp2 = pmpkg("pkg2")
+self.addpkg2db("local", lp2)
+
+self.args = "-Su"
+
+self.addrule("PACMAN_RETCODE=0")
+self.addrule("PKG_EXIST=pkg4")
+self.addrule("!PKG_EXIST=pkg1")
+self.addrule("!PKG_EXIST=pkg2")
diff --git a/test/pacman/tests/sync132.py b/test/pacman/tests/sync132.py
new file mode 100644
index 00000000..2d671c73
--- /dev/null
+++ b/test/pacman/tests/sync132.py
@@ -0,0 +1,18 @@
+self.description = "Sysupgrade with a replacement for a local package out of date"
+
+sp1 = pmpkg("pkg1")
+sp1.replaces = ["pkg2"]
+sp2 = pmpkg("pkg2", "2.0-1")
+
+for p in sp1, sp2:
+ self.addpkg2db("sync", p)
+
+lp = pmpkg("pkg2")
+
+self.addpkg2db("local", lp)
+
+self.args = "-Su"
+
+self.addrule("PACMAN_RETCODE=0")
+self.addrule("!PKG_EXIST=pkg1")
+self.addrule("PKG_EXIST=pkg2")
diff --git a/test/pacman/tests/sync133.py b/test/pacman/tests/sync133.py
new file mode 100644
index 00000000..cea603b8
--- /dev/null
+++ b/test/pacman/tests/sync133.py
@@ -0,0 +1,18 @@
+self.description = "Sysupgrade with a sync package replacing a local one in 'IgnorePkg'"
+
+sp = pmpkg("pkg2")
+sp.replaces = ["pkg1"]
+
+self.addpkg2db("sync", sp)
+
+lp = pmpkg("pkg1")
+
+self.addpkg2db("local", lp)
+
+self.option["IgnorePkg"] = ["pkg1"]
+
+self.args = "-Su"
+
+self.addrule("PACMAN_RETCODE=0")
+self.addrule("PKG_EXIST=pkg1")
+self.addrule("!PKG_EXIST=pkg2")
diff --git a/test/pacman/tests/sync134.py b/test/pacman/tests/sync134.py
new file mode 100644
index 00000000..572ab326
--- /dev/null
+++ b/test/pacman/tests/sync134.py
@@ -0,0 +1,21 @@
+self.description = "Sysupgrade with a set of sync packages replacing a set local one"
+
+sp1 = pmpkg("pkg2")
+sp1.replaces = ["pkg1"]
+
+sp2 = pmpkg("pkg3")
+sp2.replaces = ["pkg1"]
+
+for p in sp1, sp2:
+ self.addpkg2db("sync", p)
+
+lp = pmpkg("pkg1")
+
+self.addpkg2db("local", lp)
+
+self.args = "-Su"
+
+self.addrule("PACMAN_RETCODE=0")
+self.addrule("!PKG_EXIST=pkg1")
+for p in sp1, sp2:
+ self.addrule("PKG_EXIST=%s" % p.name)
diff --git a/test/pacman/tests/sync135.py b/test/pacman/tests/sync135.py
new file mode 100644
index 00000000..18c412aa
--- /dev/null
+++ b/test/pacman/tests/sync135.py
@@ -0,0 +1,31 @@
+self.description = "Sysupgrade with a set of sync packages replacing a set of local ones"
+
+sp1 = pmpkg("pkg2")
+sp1.replaces = ["pkg1"]
+
+sp2 = pmpkg("pkg3")
+sp2.replaces = ["pkg1"]
+
+sp3 = pmpkg("pkg4")
+sp3.replaces = ["pkg1", "pkg0"]
+
+sp4 = pmpkg("pkg5")
+sp4.replaces = ["pkg0"]
+
+for p in sp1, sp2, sp3, sp4:
+ self.addpkg2db("sync", p)
+
+lp1 = pmpkg("pkg1")
+
+lp2 = pmpkg("pkg0")
+
+for p in lp1, lp2:
+ self.addpkg2db("local", p)
+
+self.args = "-Su"
+
+self.addrule("PACMAN_RETCODE=0")
+for p in lp1, lp2:
+ self.addrule("!PKG_EXIST=%s" % p.name)
+for p in sp1, sp2, sp3, sp4:
+ self.addrule("PKG_EXIST=%s" % p.name)
diff --git a/test/pacman/tests/sync136.py b/test/pacman/tests/sync136.py
new file mode 100644
index 00000000..58d08eb0
--- /dev/null
+++ b/test/pacman/tests/sync136.py
@@ -0,0 +1,15 @@
+self.description = "Sysupgrade with a sync package forcing a downgrade"
+
+sp = pmpkg("dummy", "1.0-1")
+sp.force = 1
+
+self.addpkg2db("sync", sp)
+
+lp = pmpkg("dummy", "1.0-2")
+
+self.addpkg2db("local", lp)
+
+self.args = "-Su"
+
+self.addrule("PACMAN_RETCODE=0")
+self.addrule("PKG_VERSION=dummy|1.0-1")
diff --git a/test/pacman/tests/sync137.py b/test/pacman/tests/sync137.py
new file mode 100644
index 00000000..94caca70
--- /dev/null
+++ b/test/pacman/tests/sync137.py
@@ -0,0 +1,14 @@
+self.description = "Sysupgrade with a force and ignore on same package"
+
+lp = pmpkg("dummy", "1.0-1")
+
+self.addpkg2db("local", lp)
+
+sp = pmpkg("dummy", "1.0-2")
+sp.force = 1
+self.addpkg2db("sync", sp)
+
+self.args = "-Su --ignore %s" % lp.name
+
+self.addrule("PACMAN_RETCODE=0")
+self.addrule("PKG_VERSION=dummy|1.0-1")
diff --git a/test/pacman/tests/sync138.py b/test/pacman/tests/sync138.py
new file mode 100644
index 00000000..e67c4f46
--- /dev/null
+++ b/test/pacman/tests/sync138.py
@@ -0,0 +1,22 @@
+self.description = "Sysupgrade of packages in 'IgnoreGroup'"
+
+sp1 = pmpkg("pkg1", "1.0-2")
+sp2 = pmpkg("pkg2", "1.0-2")
+sp2.groups = ["grp"]
+
+for p in sp1, sp2:
+ self.addpkg2db("sync", p)
+
+lp1 = pmpkg("pkg1")
+lp2 = pmpkg("pkg2")
+
+for p in lp1, lp2:
+ self.addpkg2db("local", p)
+
+self.option["IgnoreGroup"] = ["grp"]
+
+self.args = "-Su"
+
+self.addrule("PACMAN_RETCODE=0")
+self.addrule("PKG_VERSION=pkg1|1.0-2")
+self.addrule("!PKG_MODIFIED=pkg2")
diff --git a/test/pacman/tests/sync150.py b/test/pacman/tests/sync150.py
new file mode 100644
index 00000000..b62bd984
--- /dev/null
+++ b/test/pacman/tests/sync150.py
@@ -0,0 +1,25 @@
+self.description = "-Su foo"
+
+sp1 = pmpkg("pkg1", "1.0-2")
+sp1.depends = ["pkg2"]
+
+sp2 = pmpkg("pkg2")
+sp2.depends = ["pkg3"]
+
+sp3 = pmpkg("pkg3")
+
+sp4 = pmpkg("pkg4")
+
+for p in sp1, sp2, sp3, sp4:
+ self.addpkg2db("sync", p)
+
+lp1 = pmpkg("pkg1")
+self.addpkg2db("local", lp1)
+
+self.args = "-Su %s" % sp4.name
+
+self.addrule("PACMAN_RETCODE=0")
+self.addrule("PKG_VERSION=pkg1|1.0-2")
+for p in sp2, sp3:
+ self.addrule("PKG_REASON=%s|1" % p.name)
+self.addrule("PKG_REASON=%s|0" % sp4.name)
diff --git a/test/pacman/tests/sync200.py.in b/test/pacman/tests/sync200.py.in
new file mode 100644
index 00000000..c83e9ac7
--- /dev/null
+++ b/test/pacman/tests/sync200.py.in
@@ -0,0 +1,18 @@
+self.description = "Synchronize the local database"
+
+if not "fetch" in "@LIBS@":
+ self.option['XferCommand'] = ['/usr/bin/curl %u > %o']
+
+sp1 = pmpkg("spkg1", "1.0-1")
+sp1.depends = ["spkg2"]
+sp2 = pmpkg("spkg2", "2.0-1")
+sp2.depends = ["spkg3"]
+sp3 = pmpkg("spkg3", "3.0-1")
+sp3.depends = ["spkg1"]
+
+for sp in sp1, sp2, sp3:
+ self.addpkg2db("sync", sp)
+
+self.args = "-Sy"
+
+self.addrule("PACMAN_RETCODE=0")
diff --git a/test/pacman/tests/sync300.py b/test/pacman/tests/sync300.py
new file mode 100644
index 00000000..31b520a8
--- /dev/null
+++ b/test/pacman/tests/sync300.py
@@ -0,0 +1,14 @@
+self.description = "Sync with corrupt database (broken deps)"
+
+sp1 = pmpkg("pkg1")
+sp1.depends = ["pkg2=1.1"]
+self.addpkg2db("sync", sp1)
+
+sp2 = pmpkg("pkg2", "1.0-1")
+self.addpkg2db("sync", sp2)
+
+self.args = "-S %s" % sp1.name
+
+self.addrule("PACMAN_RETCODE=1")
+self.addrule("!PKG_EXIST=pkg1")
+self.addrule("!PKG_EXIST=pkg2")
diff --git a/test/pacman/tests/sync301.py b/test/pacman/tests/sync301.py
new file mode 100644
index 00000000..96402fc3
--- /dev/null
+++ b/test/pacman/tests/sync301.py
@@ -0,0 +1,27 @@
+self.description = "Sysupgrade : pacman needs to be upgraded and has new deps"
+
+sp = pmpkg("pacman", "1.0-2")
+sp.depends = ["dep"]
+self.addpkg2db("sync", sp)
+
+spdep = pmpkg("dep")
+self.addpkg2db("sync", spdep)
+
+sp1 = pmpkg("pkg1", "1.0-2")
+self.addpkg2db("sync", sp1)
+
+lp = pmpkg("pacman", "1.0-1")
+self.addpkg2db("local", lp)
+
+lp1 = pmpkg("pkg1", "1.0-1")
+self.addpkg2db("local", lp1)
+
+self.option["SyncFirst"] = ["pacman"]
+
+self.args = "-Su"
+
+self.addrule("PACMAN_RETCODE=0")
+self.addrule("PKG_EXIST=pacman")
+self.addrule("PKG_VERSION=pacman|1.0-2")
+self.addrule("PKG_VERSION=pkg1|1.0-1")
+self.addrule("PKG_EXIST=dep")
diff --git a/test/pacman/tests/sync400.py b/test/pacman/tests/sync400.py
new file mode 100644
index 00000000..dd6aaf4e
--- /dev/null
+++ b/test/pacman/tests/sync400.py
@@ -0,0 +1,24 @@
+self.description = "Install package with dep that conflicts with older version of package"
+
+sp1 = pmpkg("pkg1", "1.0-2")
+sp1.depends = ["pkg2=1.0-2"]
+self.addpkg2db("sync", sp1)
+
+sp2 = pmpkg("pkg2", "1.0-2")
+sp2.conflicts = [ "pkg1=1.0-1" ]
+self.addpkg2db("sync", sp2)
+
+lp1 = pmpkg("pkg1", "1.0-1")
+lp1.depends = ["pkg2=1.0-1"]
+self.addpkg2db("local", lp1)
+
+lp2 = pmpkg("pkg2", "1.0-1")
+self.addpkg2db("local", lp2)
+
+self.args = "-S pkg1"
+
+self.addrule("PACMAN_RETCODE=0")
+self.addrule("PKG_EXIST=pkg1")
+self.addrule("PKG_VERSION=pkg1|1.0-2")
+self.addrule("PKG_EXIST=pkg2")
+self.addrule("PKG_VERSION=pkg2|1.0-2")
diff --git a/test/pacman/tests/sync401.py b/test/pacman/tests/sync401.py
new file mode 100644
index 00000000..eb816377
--- /dev/null
+++ b/test/pacman/tests/sync401.py
@@ -0,0 +1,21 @@
+self.description = "Ensure we choose provider already in target list"
+
+sp1 = pmpkg("pkg1")
+sp1.depends = ["dep"]
+self.addpkg2db("sync", sp1)
+
+sp2 = pmpkg("pkg2")
+sp2.provides = ["dep"]
+self.addpkg2db("sync", sp2)
+
+sp3 = pmpkg("pkg3")
+sp3.conflicts = ["pkg2"]
+sp3.provides = ["dep"]
+self.addpkg2db("sync", sp3)
+
+self.args = "-S pkg1 pkg2"
+
+self.addrule("PACMAN_RETCODE=0")
+self.addrule("PKG_EXIST=pkg1")
+self.addrule("PKG_EXIST=pkg2")
+self.addrule("!PKG_EXIST=pkg3")
diff --git a/test/pacman/tests/sync402.py b/test/pacman/tests/sync402.py
new file mode 100644
index 00000000..6d82f735
--- /dev/null
+++ b/test/pacman/tests/sync402.py
@@ -0,0 +1,21 @@
+self.description = "Choice between two providers (1)"
+
+sp1 = pmpkg("pkg1")
+sp1.depends = ["dep"]
+self.addpkg2db("sync", sp1)
+
+sp2 = pmpkg("pkg2")
+sp2.provides = ["dep"]
+self.addpkg2db("sync", sp2)
+
+sp3 = pmpkg("pkg3")
+sp3.conflicts = ["pkg1"]
+sp3.provides = ["dep"]
+self.addpkg2db("sync", sp3)
+
+self.args = "-S pkg1"
+
+self.addrule("PACMAN_RETCODE=0")
+self.addrule("PKG_EXIST=pkg1")
+self.addrule("PKG_EXIST=pkg2")
+self.addrule("!PKG_EXIST=pkg3")
diff --git a/test/pacman/tests/sync403.py b/test/pacman/tests/sync403.py
new file mode 100644
index 00000000..d8ab763c
--- /dev/null
+++ b/test/pacman/tests/sync403.py
@@ -0,0 +1,23 @@
+self.description = "Choice between two providers (2)"
+
+sp1 = pmpkg("pkg1")
+sp1.depends = ["dep"]
+self.addpkg2db("sync", sp1)
+
+sp2 = pmpkg("pkg2")
+sp2.conflicts = [ "pkg1" ]
+sp2.provides = [ "dep" ]
+self.addpkg2db("sync", sp2)
+
+sp3 = pmpkg("pkg3")
+sp3.provides = [ "dep" ]
+self.addpkg2db("sync", sp3)
+
+self.args = "-S pkg1"
+
+self.addrule("PACMAN_RETCODE=0")
+self.addrule("PKG_EXIST=pkg1")
+self.addrule("!PKG_EXIST=pkg2")
+self.addrule("PKG_EXIST=pkg3")
+
+self.expectfailure = True
diff --git a/test/pacman/tests/sync404.py b/test/pacman/tests/sync404.py
new file mode 100644
index 00000000..118f9e9d
--- /dev/null
+++ b/test/pacman/tests/sync404.py
@@ -0,0 +1,26 @@
+self.description = "FS#9024"
+
+sp = pmpkg("xorg-server")
+sp.depends = [ "libgl" ]
+self.addpkg2db("sync", sp)
+
+sp1 = pmpkg("nvidia-utils")
+sp1.provides = [ "libgl" ]
+sp1.conflicts = [ "libgl", "libgl-dri" ]
+self.addpkg2db("sync", sp1)
+
+sp2 = pmpkg("libgl")
+sp2.provides = [ "libgl-dri" ]
+self.addpkg2db("sync", sp2)
+
+sp3 = pmpkg("nvidia")
+sp3.depends = [ "nvidia-utils" ]
+self.addpkg2db("sync", sp3)
+
+self.args = "-S xorg-server nvidia"
+
+self.addrule("PACMAN_RETCODE=0")
+self.addrule("PKG_EXIST=xorg-server")
+self.addrule("PKG_EXIST=nvidia")
+self.addrule("PKG_EXIST=nvidia-utils")
+self.addrule("!PKG_EXIST=libgl")
diff --git a/test/pacman/tests/sync405.py b/test/pacman/tests/sync405.py
new file mode 100644
index 00000000..941a1af4
--- /dev/null
+++ b/test/pacman/tests/sync405.py
@@ -0,0 +1,24 @@
+self.description = "phonon/qt issue"
+
+sp1 = pmpkg("kdelibs")
+sp1.depends = ["phonon"]
+self.addpkg2db("sync", sp1);
+
+sp2 = pmpkg("qt", "4.6.1-1")
+self.addpkg2db("sync", sp2)
+
+sp3 = pmpkg("phonon")
+self.addpkg2db("sync", sp3)
+
+lp = pmpkg("qt", "4.5.3-1")
+lp.provides = ["phonon"]
+lp.conflicts = ["phonon"]
+self.addpkg2db("local", lp)
+
+self.args = "-S %s" % " ".join([p.name for p in sp1, sp2])
+
+self.addrule("PACMAN_RETCODE=0")
+self.addrule("PKG_EXIST=kdelibs")
+self.addrule("PKG_EXIST=qt")
+self.addrule("PKG_EXIST=phonon")
+self.addrule("PKG_VERSION=qt|4.6.1-1")
diff --git a/test/pacman/tests/sync406.py b/test/pacman/tests/sync406.py
new file mode 100644
index 00000000..c15862fd
--- /dev/null
+++ b/test/pacman/tests/sync406.py
@@ -0,0 +1,31 @@
+self.description = "phonon/qt issue (2)"
+
+sp1 = pmpkg("kdelibs")
+sp1.depends = ["phonon"]
+self.addpkg2db("sync", sp1);
+
+sp2 = pmpkg("qt", "4.6.1-1")
+self.addpkg2db("sync", sp2)
+
+sp3 = pmpkg("phonon")
+self.addpkg2db("sync", sp3)
+
+sp4 = pmpkg("kdeapp")
+sp4.depends = ["qt>=4.6"]
+self.addpkg2db("sync", sp4)
+
+lp = pmpkg("qt", "4.5.3-1")
+lp.provides = ["phonon"]
+lp.conflicts = ["phonon"]
+self.addpkg2db("local", lp)
+
+self.args = "-S %s" % " ".join([p.name for p in sp1, sp4])
+
+self.addrule("PACMAN_RETCODE=0")
+self.addrule("PKG_EXIST=kdelibs")
+self.addrule("PKG_EXIST=qt")
+self.addrule("PKG_EXIST=phonon")
+self.addrule("PKG_EXIST=kdeapp")
+self.addrule("PKG_VERSION=qt|4.6.1-1")
+
+self.expectfailure = True
diff --git a/test/pacman/tests/sync500.py b/test/pacman/tests/sync500.py
new file mode 100644
index 00000000..ccfffa7c
--- /dev/null
+++ b/test/pacman/tests/sync500.py
@@ -0,0 +1,15 @@
+self.description = "Install a package from a sync db with NoExtract"
+
+sp = pmpkg("dummy")
+sp.files = ["bin/dummy",
+ "usr/man/man1/dummy.1"]
+self.addpkg2db("sync", sp)
+
+self.option["NoExtract"] = ["usr/man/man1/dummy.1"]
+
+self.args = "-S %s" % sp.name
+
+self.addrule("PACMAN_RETCODE=0")
+self.addrule("PKG_EXIST=dummy")
+self.addrule("FILE_EXIST=bin/dummy")
+self.addrule("!FILE_EXIST=usr/man/man1/dummy.1")
diff --git a/test/pacman/tests/sync501.py b/test/pacman/tests/sync501.py
new file mode 100644
index 00000000..eb826e21
--- /dev/null
+++ b/test/pacman/tests/sync501.py
@@ -0,0 +1,18 @@
+self.description = "Upgrade a package, with a file in NoUpgrade"
+
+sp = pmpkg("dummy", "1.0-2")
+sp.files = ["etc/dummy.conf"]
+self.addpkg2db("sync", sp)
+
+lp = pmpkg("dummy")
+lp.files = ["etc/dummy.conf"]
+self.addpkg2db("local", lp)
+
+self.option["NoUpgrade"] = ["etc/dummy.conf"]
+
+self.args = "-S %s" % sp.name
+
+self.addrule("PKG_VERSION=dummy|1.0-2")
+self.addrule("!FILE_MODIFIED=etc/dummy.conf")
+self.addrule("FILE_PACNEW=etc/dummy.conf")
+self.addrule("!FILE_PACSAVE=etc/dummy.conf")
diff --git a/test/pacman/tests/sync890.py b/test/pacman/tests/sync890.py
new file mode 100644
index 00000000..e8380b79
--- /dev/null
+++ b/test/pacman/tests/sync890.py
@@ -0,0 +1,20 @@
+self.description = "conflict 'db vs targ'"
+
+sp = pmpkg("pkg3")
+
+self.addpkg2db("sync", sp)
+
+lp1 = pmpkg("pkg1")
+
+lp2 = pmpkg("pkg2")
+lp2.conflicts = ["pkg3"]
+
+for p in lp1, lp2:
+ self.addpkg2db("local", p)
+
+self.args = "-S %s --ask=4" % sp.name
+
+self.addrule("PACMAN_RETCODE=0")
+self.addrule("PKG_EXIST=pkg1")
+self.addrule("!PKG_EXIST=pkg2")
+self.addrule("PKG_EXIST=pkg3")
diff --git a/test/pacman/tests/sync891.py b/test/pacman/tests/sync891.py
new file mode 100644
index 00000000..9b99e94a
--- /dev/null
+++ b/test/pacman/tests/sync891.py
@@ -0,0 +1,22 @@
+self.description = "conflict 'db vs targ'"
+
+sp1 = pmpkg("pkg2")
+sp2 = pmpkg("pkg3")
+
+for p in sp1, sp2:
+ self.addpkg2db("sync", p)
+
+lp1 = pmpkg("pkg1")
+
+lp2 = pmpkg("pkg2")
+lp2.conflicts = ["pkg3"]
+
+for p in lp1, lp2:
+ self.addpkg2db("local", p)
+
+self.args = "-S %s" % " ".join([p.name for p in sp1, sp2])
+
+self.addrule("PACMAN_RETCODE=0")
+self.addrule("PKG_EXIST=pkg1")
+self.addrule("PKG_EXIST=pkg2")
+self.addrule("PKG_EXIST=pkg3")
diff --git a/test/pacman/tests/sync892.py b/test/pacman/tests/sync892.py
new file mode 100644
index 00000000..dfd889ea
--- /dev/null
+++ b/test/pacman/tests/sync892.py
@@ -0,0 +1,24 @@
+self.description = "conflict 'targ vs targ' and 'db vs targ'"
+
+sp1 = pmpkg("pkg2")
+sp1.conflicts = ["pkg1"]
+
+sp2 = pmpkg("pkg3")
+
+for p in sp1, sp2:
+ self.addpkg2db("sync", p)
+
+lp1 = pmpkg("pkg1")
+
+lp2 = pmpkg("pkg2")
+lp2.conflicts = ["pkg3"]
+
+for p in lp1, lp2:
+ self.addpkg2db("local", p)
+
+self.args = "-S %s --ask=4" % " ".join([p.name for p in sp1, sp2])
+
+self.addrule("PACMAN_RETCODE=0")
+self.addrule("!PKG_EXIST=pkg1")
+self.addrule("PKG_EXIST=pkg2")
+self.addrule("PKG_EXIST=pkg3")
diff --git a/test/pacman/tests/sync893.py b/test/pacman/tests/sync893.py
new file mode 100644
index 00000000..e96bb7b6
--- /dev/null
+++ b/test/pacman/tests/sync893.py
@@ -0,0 +1,20 @@
+self.description = "conflict 'db vs db'"
+
+sp1 = pmpkg("pkg1", "1.0-2")
+sp1.conflicts = ["pkg2"]
+self.addpkg2db("sync", sp1);
+
+sp2 = pmpkg("pkg2", "1.0-2")
+self.addpkg2db("sync", sp2)
+
+lp1 = pmpkg("pkg1")
+self.addpkg2db("local", lp1)
+
+lp2 = pmpkg("pkg2")
+self.addpkg2db("local", lp2)
+
+self.args = "-S %s --ask=4" % " ".join([p.name for p in sp1, sp2])
+
+self.addrule("PACMAN_RETCODE=1")
+self.addrule("PKG_EXIST=pkg1")
+self.addrule("PKG_EXIST=pkg2")
diff --git a/test/pacman/tests/sync895.py b/test/pacman/tests/sync895.py
new file mode 100644
index 00000000..fd987864
--- /dev/null
+++ b/test/pacman/tests/sync895.py
@@ -0,0 +1,20 @@
+self.description = "Sync causes single package removal of a provide (failure)"
+
+sp = pmpkg("pkg3")
+sp.conflicts = ["pkg1"]
+self.addpkg2db("sync", sp)
+
+lp1 = pmpkg("pkg1")
+lp1.provides = ["foo"]
+self.addpkg2db("local", lp1)
+
+lp2 = pmpkg("pkg2")
+lp2.depends = ["foo"]
+self.addpkg2db("local", lp2)
+
+self.args = "-S %s --ask=4" % sp.name
+
+self.addrule("PACMAN_RETCODE=1")
+self.addrule("PKG_EXIST=pkg1")
+self.addrule("PKG_EXIST=pkg2")
+self.addrule("!PKG_EXIST=pkg3")
diff --git a/test/pacman/tests/sync896.py b/test/pacman/tests/sync896.py
new file mode 100644
index 00000000..492bd7b4
--- /dev/null
+++ b/test/pacman/tests/sync896.py
@@ -0,0 +1,21 @@
+self.description = "Sync causes single package removal of a provide (success)"
+
+sp = pmpkg("pkg3")
+sp.conflicts = ["pkg1"]
+sp.provides = ["foo"]
+self.addpkg2db("sync", sp)
+
+lp1 = pmpkg("pkg1")
+lp1.provides = ["foo"]
+self.addpkg2db("local", lp1)
+
+lp2 = pmpkg("pkg2")
+lp2.depends = ["foo"]
+self.addpkg2db("local", lp2)
+
+self.args = "-S %s --ask=4" % sp.name
+
+self.addrule("PACMAN_RETCODE=0")
+self.addrule("!PKG_EXIST=pkg1")
+self.addrule("PKG_EXIST=pkg2")
+self.addrule("PKG_EXIST=pkg3")
diff --git a/test/pacman/tests/sync897.py b/test/pacman/tests/sync897.py
new file mode 100644
index 00000000..8a1c5a7c
--- /dev/null
+++ b/test/pacman/tests/sync897.py
@@ -0,0 +1,24 @@
+self.description = "System upgrade with package conflicts"
+
+sp1 = pmpkg("pkg1", "1.0-2")
+sp1.conflicts = ["pkg2", "pkg3"]
+self.addpkg2db("sync", sp1);
+
+sp2 = pmpkg("pkg2", "1.0-2")
+self.addpkg2db("sync", sp2)
+
+lp1 = pmpkg("pkg1")
+self.addpkg2db("local", lp1)
+
+lp2 = pmpkg("pkg2")
+self.addpkg2db("local", lp2)
+
+lp3 = pmpkg("pkg3")
+self.addpkg2db("local", lp3)
+
+self.args = "-Su --ask=4"
+
+self.addrule("PACMAN_RETCODE=1")
+self.addrule("PKG_EXIST=pkg1")
+self.addrule("PKG_EXIST=pkg2")
+self.addrule("PKG_EXIST=pkg3")
diff --git a/test/pacman/tests/sync898.py b/test/pacman/tests/sync898.py
new file mode 100644
index 00000000..af16801d
--- /dev/null
+++ b/test/pacman/tests/sync898.py
@@ -0,0 +1,18 @@
+self.description = "System upgrade with conflicts and provides"
+
+sp1 = pmpkg("pkg1", "1.0-2")
+sp1.conflicts = ["pkg2"]
+sp1.provides = ["pkg2"]
+self.addpkg2db("sync", sp1);
+
+sp2 = pmpkg("pkg2", "1.0-2")
+self.addpkg2db("sync", sp2)
+
+lp1 = pmpkg("pkg1")
+self.addpkg2db("local", lp1)
+
+self.args = "-S %s" % " ".join([p.name for p in sp1, sp2])
+
+self.addrule("PACMAN_RETCODE=0")
+self.addrule("PKG_MODIFIED=pkg1")
+self.addrule("!PKG_EXIST=pkg2")
diff --git a/test/pacman/tests/sync899.py b/test/pacman/tests/sync899.py
new file mode 100644
index 00000000..fd308050
--- /dev/null
+++ b/test/pacman/tests/sync899.py
@@ -0,0 +1,18 @@
+self.description = "System upgrade - conflict/provide with an installed package"
+
+sp1 = pmpkg("pkg1", "1.0-2")
+sp1.conflicts = ["pkg2"]
+sp1.provides = ["pkg2"]
+self.addpkg2db("sync", sp1);
+
+lp1 = pmpkg("pkg1")
+self.addpkg2db("local", lp1)
+
+lp2 = pmpkg("pkg2")
+self.addpkg2db("local", lp2)
+
+self.args = "-Su --ask=4"
+
+self.addrule("PACMAN_RETCODE=0")
+self.addrule("PKG_EXIST=pkg1")
+self.addrule("!PKG_EXIST=pkg2")
diff --git a/test/pacman/tests/sync900.py b/test/pacman/tests/sync900.py
new file mode 100644
index 00000000..744fad03
--- /dev/null
+++ b/test/pacman/tests/sync900.py
@@ -0,0 +1,25 @@
+self.description = "Replace one package with another providing it"
+
+sp = pmpkg("bar")
+sp.provides = ["foo"]
+sp.conflicts = ["foo"]
+self.addpkg2db("sync", sp)
+
+lp = pmpkg("foo")
+self.addpkg2db("local", lp)
+
+lp1 = pmpkg("pkg1")
+lp1.depends = ["foo"]
+self.addpkg2db("local", lp1)
+
+lp2 = pmpkg("pkg2")
+lp2.depends = ["foo"]
+self.addpkg2db("local", lp2)
+
+self.args = "-S %s --ask=4" % sp.name
+
+self.addrule("PACMAN_RETCODE=0")
+self.addrule("!PKG_EXIST=foo")
+self.addrule("PKG_EXIST=bar")
+self.addrule("PKG_EXIST=pkg1")
+self.addrule("PKG_EXIST=pkg2")
diff --git a/test/pacman/tests/sync901.py b/test/pacman/tests/sync901.py
new file mode 100644
index 00000000..f5834533
--- /dev/null
+++ b/test/pacman/tests/sync901.py
@@ -0,0 +1,25 @@
+self.description = "Replace a package providing package with actual package"
+
+sp = pmpkg("foo")
+self.addpkg2db("sync", sp)
+
+lp = pmpkg("bar")
+lp.provides = ["foo"]
+lp.conflicts = ["foo"]
+self.addpkg2db("local", lp)
+
+lp1 = pmpkg("pkg1")
+lp1.depends = ["foo"]
+self.addpkg2db("local", lp1)
+
+lp2 = pmpkg("pkg2")
+lp2.depends = ["foo"]
+self.addpkg2db("local", lp2)
+
+self.args = "-S %s --ask=4" % sp.name
+
+self.addrule("PACMAN_RETCODE=0")
+self.addrule("PKG_EXIST=foo")
+self.addrule("!PKG_EXIST=bar")
+self.addrule("PKG_EXIST=pkg1")
+self.addrule("PKG_EXIST=pkg2")
diff --git a/test/pacman/tests/sync990.py b/test/pacman/tests/sync990.py
new file mode 100644
index 00000000..6ac5a1f6
--- /dev/null
+++ b/test/pacman/tests/sync990.py
@@ -0,0 +1,19 @@
+self.description = "Sync a package pulling a dependency conflicting with a target"
+
+sp1 = pmpkg("pkg1")
+sp1.depends = ["pkg3"]
+
+sp2 = pmpkg("pkg2")
+
+sp3 = pmpkg("pkg3")
+sp3.conflicts = ["pkg2"]
+
+for p in sp1, sp2, sp3:
+ self.addpkg2db("sync", p)
+
+self.args = "-S %s" % " ".join([p.name for p in sp1, sp2])
+
+self.addrule("PACMAN_RETCODE=1")
+self.addrule("!PKG_EXIST=pkg1")
+self.addrule("!PKG_EXIST=pkg2")
+self.addrule("!PKG_EXIST=pkg3")
diff --git a/test/pacman/tests/sync992.py b/test/pacman/tests/sync992.py
new file mode 100644
index 00000000..63faaaba
--- /dev/null
+++ b/test/pacman/tests/sync992.py
@@ -0,0 +1,23 @@
+self.description = "Sync a package pulling a conflicting dependency"
+
+sp1 = pmpkg("pkg1")
+sp1.depends = ["pkg3"]
+
+sp2 = pmpkg("pkg2")
+
+sp3 = pmpkg("pkg3")
+sp3.conflicts = ["pkg2"]
+sp3.provides = ["pkg2"]
+
+for p in sp1, sp2, sp3:
+ self.addpkg2db("sync", p)
+
+lp1 = pmpkg("pkg2", "0.1-1")
+self.addpkg2db("local", lp1)
+
+self.args = "-S %s --ask=4" % " ".join([p.name for p in sp1, sp2])
+
+self.addrule("PACMAN_RETCODE=0")
+self.addrule("PKG_EXIST=pkg1")
+self.addrule("!PKG_EXIST=pkg2")
+self.addrule("PKG_EXIST=pkg3")
diff --git a/test/pacman/tests/sync993.py b/test/pacman/tests/sync993.py
new file mode 100644
index 00000000..82cc803a
--- /dev/null
+++ b/test/pacman/tests/sync993.py
@@ -0,0 +1,20 @@
+self.description = "Choose a dependency satisfier (target-list vs. database)"
+
+sp1 = pmpkg("pkg1")
+sp1.depends = ["dep"]
+
+sp2 = pmpkg("pkg2")
+sp2.provides = ["dep"]
+
+sp3 = pmpkg("pkg3")
+sp3.provides = ["dep"]
+
+for p in sp1, sp2, sp3:
+ self.addpkg2db("sync", p)
+
+self.args = "-S pkg1 pkg3"
+
+self.addrule("PACMAN_RETCODE=0")
+self.addrule("PKG_EXIST=pkg1")
+self.addrule("!PKG_EXIST=pkg2")
+self.addrule("PKG_EXIST=pkg3")
diff --git a/test/pacman/tests/sync999.py b/test/pacman/tests/sync999.py
new file mode 100644
index 00000000..89447cad
--- /dev/null
+++ b/test/pacman/tests/sync999.py
@@ -0,0 +1,21 @@
+self.description = "System upgrade"
+
+sp1 = pmpkg("pkg1", "1.0-2")
+sp1.conflicts = ["pkg2"]
+sp1.provides = ["pkg2"]
+self.addpkg2db("sync", sp1);
+
+sp2 = pmpkg("pkg2", "1.0-2")
+self.addpkg2db("sync", sp2)
+
+lp1 = pmpkg("pkg1")
+self.addpkg2db("local", lp1)
+
+lp2 = pmpkg("pkg2")
+self.addpkg2db("local", lp2)
+
+self.args = "-Su --ask=4"
+
+self.addrule("PACMAN_RETCODE=0")
+self.addrule("PKG_EXIST=pkg1")
+self.addrule("!PKG_EXIST=pkg2")
diff --git a/test/pacman/tests/trans001.py b/test/pacman/tests/trans001.py
new file mode 100644
index 00000000..b9889b14
--- /dev/null
+++ b/test/pacman/tests/trans001.py
@@ -0,0 +1,20 @@
+self.description = "fileconflict error cancels the sync transaction after the removal part"
+
+sp = pmpkg("pkg1")
+sp.replaces = ["pkg3"]
+sp.files = ["dir/file"]
+self.addpkg2db("sync", sp)
+
+lp1 = pmpkg("pkg3")
+self.addpkg2db("local", lp1)
+
+lp2 = pmpkg("pkg2")
+lp2.files = ["dir/file"]
+self.addpkg2db("local", lp2)
+
+self.args = "-Su"
+
+self.addrule("PACMAN_RETCODE=1")
+self.addrule("!PKG_EXIST=pkg1")
+self.addrule("PKG_EXIST=pkg2")
+self.addrule("PKG_EXIST=pkg3")
diff --git a/test/pacman/tests/type001.py b/test/pacman/tests/type001.py
new file mode 100644
index 00000000..d55dcc11
--- /dev/null
+++ b/test/pacman/tests/type001.py
@@ -0,0 +1,17 @@
+self.description = "Check the types of default files in a package"
+
+p = pmpkg("pkg1")
+p.files = ["foo/file1",
+ "foo/file2",
+ "foo/dir/",
+ "foo/symdir -> dir"]
+self.addpkg(p)
+
+self.args = "-U %s" % p.filename()
+
+self.addrule("PACMAN_RETCODE=0")
+self.addrule("FILE_TYPE=foo/|dir")
+self.addrule("FILE_TYPE=foo/file1|file")
+self.addrule("FILE_TYPE=foo/file2|file")
+self.addrule("FILE_TYPE=foo/dir|dir")
+self.addrule("FILE_TYPE=foo/symdir|link")
diff --git a/test/pacman/tests/unresolvable001.py b/test/pacman/tests/unresolvable001.py
new file mode 100644
index 00000000..c98a4c02
--- /dev/null
+++ b/test/pacman/tests/unresolvable001.py
@@ -0,0 +1,21 @@
+self.description = "An unresolvable dependency"
+
+packageA1 = pmpkg("dep")
+self.addpkg2db("local", packageA1)
+
+packageA1up = pmpkg("dep", "2.0-1")
+packageA1up.depends = ["fake"];
+self.addpkg2db("sync", packageA1up)
+
+packageA2up = pmpkg("package")
+packageA2up.depends = ["dep"];
+self.addpkg2db("sync", packageA2up)
+
+self.args = "-S package dep --ask=32"
+
+self.addrule("PACMAN_RETCODE=0")
+self.addrule("PKG_EXIST=package")
+self.addrule("PKG_EXIST=dep")
+self.addrule("PKG_VERSION=dep|1.0-1")
+
+self.expectfailure = True
diff --git a/test/pacman/tests/upgrade001.py b/test/pacman/tests/upgrade001.py
new file mode 100644
index 00000000..2a9538e0
--- /dev/null
+++ b/test/pacman/tests/upgrade001.py
@@ -0,0 +1,18 @@
+self.description = "Upgrade a package (newer version)"
+
+lp = pmpkg("dummy")
+lp.files = ["bin/dummy",
+ "usr/man/man1/dummy.1"]
+self.addpkg2db("local", lp)
+
+p = pmpkg("dummy", "1.0-2")
+p.files = ["bin/dummy",
+ "usr/man/man1/dummy.1"]
+self.addpkg(p)
+
+self.args = "-U %s" % p.filename()
+
+self.addrule("PKG_MODIFIED=dummy")
+self.addrule("PKG_VERSION=dummy|1.0-2")
+for f in lp.files:
+ self.addrule("FILE_MODIFIED=%s" % f)
diff --git a/test/pacman/tests/upgrade002.py b/test/pacman/tests/upgrade002.py
new file mode 100644
index 00000000..d561d894
--- /dev/null
+++ b/test/pacman/tests/upgrade002.py
@@ -0,0 +1,18 @@
+self.description = "Upgrade a package (same version)"
+
+lp = pmpkg("dummy")
+lp.files = ["bin/dummy",
+ "usr/man/man1/dummy.1"]
+self.addpkg2db("local", lp)
+
+p = pmpkg("dummy")
+p.files = ["bin/dummy",
+ "usr/man/man1/dummy.1"]
+self.addpkg(p)
+
+self.args = "-U %s" % p.filename()
+
+self.addrule("PKG_MODIFIED=dummy")
+self.addrule("PKG_VERSION=dummy|1.0-1")
+for f in lp.files:
+ self.addrule("FILE_MODIFIED=%s" % f)
diff --git a/test/pacman/tests/upgrade003.py b/test/pacman/tests/upgrade003.py
new file mode 100644
index 00000000..a67a2653
--- /dev/null
+++ b/test/pacman/tests/upgrade003.py
@@ -0,0 +1,18 @@
+self.description = "Upgrade a package (older version)"
+
+lp = pmpkg("dummy", "1.0-2")
+lp.files = ["bin/dummy",
+ "usr/man/man1/dummy.1"]
+self.addpkg2db("local", lp)
+
+p = pmpkg("dummy")
+p.files = ["bin/dummy",
+ "usr/man/man1/dummy.1"]
+self.addpkg(p)
+
+self.args = "-U %s" % p.filename()
+
+self.addrule("PKG_MODIFIED=dummy")
+self.addrule("PKG_VERSION=dummy|1.0-1")
+for f in lp.files:
+ self.addrule("FILE_MODIFIED=%s" % f)
diff --git a/test/pacman/tests/upgrade004.py b/test/pacman/tests/upgrade004.py
new file mode 100644
index 00000000..31daf915
--- /dev/null
+++ b/test/pacman/tests/upgrade004.py
@@ -0,0 +1,12 @@
+self.description = "Upgrade a package (not installed)"
+
+p = pmpkg("dummy")
+p.files = ["bin/dummy",
+ "usr/man/man1/dummy.1"]
+self.addpkg(p)
+
+self.args = "-U %s" % p.filename()
+
+self.addrule("PKG_EXIST=dummy")
+for f in p.files:
+ self.addrule("FILE_EXIST=%s" % f)
diff --git a/test/pacman/tests/upgrade005.py b/test/pacman/tests/upgrade005.py
new file mode 100644
index 00000000..0f8c13ef
--- /dev/null
+++ b/test/pacman/tests/upgrade005.py
@@ -0,0 +1,23 @@
+self.description = "Install a set of three packages"
+
+p1 = pmpkg("pkg1")
+p1.files = ["bin/pkg1",
+ "usr/man/man1/pkg1.1"]
+
+p2 = pmpkg("pkg2", "2.0-1")
+p2.files = ["bin/pkg2",
+ "usr/man/man1/pkg2.1"]
+
+p3 = pmpkg("pkg3", "3.0-1")
+p3.files = ["bin/pkg3", "usr/man/man1/pkg3.1"]
+
+for p in p1, p2, p3:
+ self.addpkg(p)
+
+self.args = "-U %s" % " ".join([p.filename() for p in p1, p2, p3])
+
+self.addrule("PACMAN_RETCODE=0")
+for p in p1, p2, p3:
+ self.addrule("PKG_EXIST=%s" % p.name)
+ for f in p.files:
+ self.addrule("FILE_EXIST=%s" % f)
diff --git a/test/pacman/tests/upgrade010.py b/test/pacman/tests/upgrade010.py
new file mode 100644
index 00000000..3d8b21e1
--- /dev/null
+++ b/test/pacman/tests/upgrade010.py
@@ -0,0 +1,18 @@
+self.description = "Upgrade a package, with a file in NoUpgrade"
+
+lp = pmpkg("dummy")
+lp.files = ["etc/dummy.conf"]
+self.addpkg2db("local", lp)
+
+p = pmpkg("dummy", "1.0-2")
+p.files = ["etc/dummy.conf"]
+self.addpkg(p)
+
+self.option["NoUpgrade"] = ["etc/dummy.conf"]
+
+self.args = "-U %s" % p.filename()
+
+self.addrule("PKG_VERSION=dummy|1.0-2")
+self.addrule("!FILE_MODIFIED=etc/dummy.conf")
+self.addrule("FILE_PACNEW=etc/dummy.conf")
+self.addrule("!FILE_PACSAVE=etc/dummy.conf")
diff --git a/test/pacman/tests/upgrade011.py b/test/pacman/tests/upgrade011.py
new file mode 100644
index 00000000..d8ed8734
--- /dev/null
+++ b/test/pacman/tests/upgrade011.py
@@ -0,0 +1,16 @@
+self.description = "Upgrade a package with a filesystem conflict"
+
+p = pmpkg("dummy", "2.0-1")
+p.files = ["bin/dummy", "usr/share/file"]
+self.addpkg(p)
+
+lp = pmpkg("dummy", "1.0-1")
+lp.files = ["bin/dummy"]
+self.addpkg2db("local", lp)
+
+self.filesystem = ["usr/share/file"]
+
+self.args = "-U %s" % p.filename()
+
+self.addrule("PACMAN_RETCODE=1")
+self.addrule("PKG_VERSION=dummy|1.0-1")
diff --git a/test/pacman/tests/upgrade012.py b/test/pacman/tests/upgrade012.py
new file mode 100644
index 00000000..dba8dc18
--- /dev/null
+++ b/test/pacman/tests/upgrade012.py
@@ -0,0 +1,14 @@
+self.description = "Install a package with a filesystem conflict (--force)"
+
+p = pmpkg("dummy")
+p.files = ["bin/dummy", "usr/man/man1/dummy.1"]
+self.addpkg(p)
+
+self.filesystem = ["bin/dummy"]
+
+self.args = "-Uf %s" % p.filename()
+
+self.addrule("PACMAN_RETCODE=0")
+self.addrule("PKG_EXIST=dummy")
+self.addrule("FILE_MODIFIED=bin/dummy")
+self.addrule("FILE_EXIST=usr/man/man1/dummy.1")
diff --git a/test/pacman/tests/upgrade013.py b/test/pacman/tests/upgrade013.py
new file mode 100644
index 00000000..5a327599
--- /dev/null
+++ b/test/pacman/tests/upgrade013.py
@@ -0,0 +1,20 @@
+self.description = "Install two packages with a conflicting file"
+
+p1 = pmpkg("dummy")
+p1.files = ["bin/dummy",
+ "usr/man/man1/dummy.1",
+ "usr/common"]
+
+p2 = pmpkg("foobar")
+p2.files = ["bin/foobar",
+ "usr/man/man1/foobar.1",
+ "usr/common"]
+
+for p in p1, p2:
+ self.addpkg(p)
+
+self.args = "-U %s" % " ".join([p.filename() for p in p1, p2])
+
+self.addrule("PACMAN_RETCODE=1")
+self.addrule("!PKG_EXIST=dummy")
+self.addrule("!PKG_EXIST=foobar")
diff --git a/test/pacman/tests/upgrade014.py b/test/pacman/tests/upgrade014.py
new file mode 100644
index 00000000..1632dd36
--- /dev/null
+++ b/test/pacman/tests/upgrade014.py
@@ -0,0 +1,23 @@
+self.description = "Install two packages with a conflicting file (--force)"
+
+p1 = pmpkg("dummy")
+p1.files = ["bin/dummy",
+ "usr/man/man1/dummy.1",
+ "usr/common"]
+
+p2 = pmpkg("foobar")
+p2.files = ["bin/foobar",
+ "usr/man/man1/foobar.1",
+ "usr/common"]
+
+for p in p1, p2:
+ self.addpkg(p)
+
+self.args = "-Uf %s" % " ".join([p.filename() for p in p1, p2])
+
+self.addrule("PACMAN_RETCODE=0")
+for p in p1, p2:
+ self.addrule("PKG_EXIST=%s" % p.name)
+ self.addrule("PKG_FILES=%s|usr/common" % p.name)
+ for f in p.files:
+ self.addrule("FILE_EXIST=%s" % f)
diff --git a/test/pacman/tests/upgrade015.py b/test/pacman/tests/upgrade015.py
new file mode 100644
index 00000000..22f7c36b
--- /dev/null
+++ b/test/pacman/tests/upgrade015.py
@@ -0,0 +1,15 @@
+self.description = "Install a package with an existing file (--force)"
+
+p = pmpkg("dummy")
+p.files = ["etc/dummy.conf"]
+self.addpkg(p)
+
+self.filesystem = ["etc/dummy.conf"]
+
+self.args = "-Uf %s" % p.filename()
+
+self.addrule("PACMAN_RETCODE=0")
+self.addrule("PKG_EXIST=dummy")
+self.addrule("FILE_MODIFIED=etc/dummy.conf")
+self.addrule("!FILE_PACNEW=etc/dummy.conf")
+self.addrule("!FILE_PACORIG=etc/dummy.conf")
diff --git a/test/pacman/tests/upgrade016.py b/test/pacman/tests/upgrade016.py
new file mode 100644
index 00000000..dd31c9ab
--- /dev/null
+++ b/test/pacman/tests/upgrade016.py
@@ -0,0 +1,16 @@
+self.description = "Install a package with an existing file (--force, new modified)"
+
+p = pmpkg("dummy")
+p.files = ["etc/dummy.conf*"]
+p.backup = ["etc/dummy.conf"]
+self.addpkg(p)
+
+self.filesystem = ["etc/dummy.conf"]
+
+self.args = "-Uf %s" % p.filename()
+
+self.addrule("PACMAN_RETCODE=0")
+self.addrule("PKG_EXIST=dummy")
+self.addrule("FILE_MODIFIED=etc/dummy.conf")
+self.addrule("!FILE_PACNEW=etc/dummy.conf")
+self.addrule("FILE_PACORIG=etc/dummy.conf")
diff --git a/test/pacman/tests/upgrade020.py b/test/pacman/tests/upgrade020.py
new file mode 100644
index 00000000..6a7994bb
--- /dev/null
+++ b/test/pacman/tests/upgrade020.py
@@ -0,0 +1,18 @@
+self.description = "Upgrade a package, with a file in 'backup' (local unchanged, new modified)"
+
+lp = pmpkg("dummy")
+lp.files = ["etc/dummy.conf"]
+lp.backup = ["etc/dummy.conf"]
+self.addpkg2db("local", lp)
+
+p = pmpkg("dummy", "1.0-2")
+p.files = ["etc/dummy.conf*"]
+p.backup = ["etc/dummy.conf"]
+self.addpkg(p)
+
+self.args = "-U %s" % p.filename()
+
+self.addrule("PKG_VERSION=dummy|1.0-2")
+self.addrule("FILE_MODIFIED=etc/dummy.conf")
+self.addrule("!FILE_PACNEW=etc/dummy.conf")
+self.addrule("!FILE_PACSAVE=etc/dummy.conf")
diff --git a/test/pacman/tests/upgrade021.py b/test/pacman/tests/upgrade021.py
new file mode 100644
index 00000000..b45ea18a
--- /dev/null
+++ b/test/pacman/tests/upgrade021.py
@@ -0,0 +1,18 @@
+self.description = "Upgrade a package, with a file in 'backup' (local modified, new unchanged)"
+
+lp = pmpkg("dummy")
+lp.files = ["etc/dummy.conf*"]
+lp.backup = ["etc/dummy.conf"]
+self.addpkg2db("local", lp)
+
+p = pmpkg("dummy", "1.0-2")
+p.files = ["etc/dummy.conf"]
+p.backup = ["etc/dummy.conf"]
+self.addpkg(p)
+
+self.args = "-U %s" % p.filename()
+
+self.addrule("PKG_VERSION=dummy|1.0-2")
+self.addrule("!FILE_MODIFIED=etc/dummy.conf")
+self.addrule("!FILE_PACNEW=etc/dummy.conf")
+self.addrule("!FILE_PACSAVE=etc/dummy.conf")
diff --git a/test/pacman/tests/upgrade022.py b/test/pacman/tests/upgrade022.py
new file mode 100644
index 00000000..dcf7ae01
--- /dev/null
+++ b/test/pacman/tests/upgrade022.py
@@ -0,0 +1,18 @@
+self.description = "Upgrade a package, with a file in 'backup' (local and new modified)"
+
+lp = pmpkg("dummy")
+lp.files = ["etc/dummy.conf"]
+lp.backup = ["etc/dummy.conf*"]
+self.addpkg2db("local", lp)
+
+p = pmpkg("dummy", "1.0-2")
+p.files = ["etc/dummy.conf**"]
+p.backup = ["etc/dummy.conf"]
+self.addpkg(p)
+
+self.args = "-U %s" % p.filename()
+
+self.addrule("PKG_VERSION=dummy|1.0-2")
+self.addrule("!FILE_MODIFIED=etc/dummy.conf")
+self.addrule("FILE_PACNEW=etc/dummy.conf")
+self.addrule("!FILE_PACSAVE=etc/dummy.conf")
diff --git a/test/pacman/tests/upgrade023.py b/test/pacman/tests/upgrade023.py
new file mode 100644
index 00000000..d1d2e314
--- /dev/null
+++ b/test/pacman/tests/upgrade023.py
@@ -0,0 +1,18 @@
+self.description = "Upgrade a package, with a backup file in the NEW package only"
+
+lp = pmpkg("dummy")
+lp.files = ["etc/dummy.conf*"]
+self.addpkg2db("local", lp)
+
+p = pmpkg("dummy", "1.1-1")
+p.files = ["etc/dummy.conf"]
+p.backup = ["etc/dummy.conf"]
+self.addpkg(p)
+
+self.args = "-U %s" % p.filename()
+
+self.addrule("PKG_VERSION=dummy|1.1-1")
+self.addrule("!FILE_MODIFIED=etc/dummy.conf")
+# Do we want this pacnew or not?
+self.addrule("FILE_PACNEW=etc/dummy.conf")
+self.addrule("!FILE_PACSAVE=etc/dummy.conf")
diff --git a/test/pacman/tests/upgrade024.py b/test/pacman/tests/upgrade024.py
new file mode 100644
index 00000000..ec2f7623
--- /dev/null
+++ b/test/pacman/tests/upgrade024.py
@@ -0,0 +1,15 @@
+self.description = "Upgrade a package, with a file leaving 'backup'"
+
+lp = pmpkg("dummy")
+lp.files = ["etc/dummy.conf*"]
+lp.backup = ["etc/dummy.conf"]
+self.addpkg2db("local", lp)
+
+p = pmpkg("dummy", "1.0-2")
+self.addpkg(p)
+
+self.args = "-U %s" % p.filename()
+
+self.addrule("PKG_VERSION=dummy|1.0-2")
+self.addrule("FILE_PACSAVE=etc/dummy.conf")
+self.addrule("!FILE_EXIST=etc/dummy.conf")
diff --git a/test/pacman/tests/upgrade025.py b/test/pacman/tests/upgrade025.py
new file mode 100644
index 00000000..2c9c06f3
--- /dev/null
+++ b/test/pacman/tests/upgrade025.py
@@ -0,0 +1,17 @@
+self.description = "Upgrade a package, with a file leaving 'backup' but staying in the pkg"
+
+lp = pmpkg("dummy")
+lp.files = ["etc/dummy.conf*"]
+lp.backup = ["etc/dummy.conf"]
+self.addpkg2db("local", lp)
+
+p = pmpkg("dummy", "1.0-2")
+p.files = ["etc/dummy.conf"]
+self.addpkg(p)
+
+self.args = "-U %s" % p.filename()
+
+self.addrule("PKG_VERSION=dummy|1.0-2")
+self.addrule("FILE_PACSAVE=etc/dummy.conf")
+self.addrule("!FILE_PACNEW=etc/dummy.conf")
+self.addrule("FILE_EXIST=etc/dummy.conf")
diff --git a/test/pacman/tests/upgrade026.py b/test/pacman/tests/upgrade026.py
new file mode 100644
index 00000000..8e3ef239
--- /dev/null
+++ b/test/pacman/tests/upgrade026.py
@@ -0,0 +1,17 @@
+self.description = "Upgrade a package, with a file leaving the pkg but staying in 'backup'"
+
+lp = pmpkg("dummy")
+lp.files = ["etc/dummy.conf*"]
+lp.backup = ["etc/dummy.conf"]
+self.addpkg2db("local", lp)
+
+p = pmpkg("dummy", "1.0-2")
+p.backup = ["etc/dummy.conf"]
+self.addpkg(p)
+
+self.args = "-U %s" % p.filename()
+
+self.addrule("PKG_VERSION=dummy|1.0-2")
+self.addrule("FILE_PACSAVE=etc/dummy.conf")
+self.addrule("!FILE_PACNEW=etc/dummy.conf")
+self.addrule("!FILE_EXIST=etc/dummy.conf")
diff --git a/test/pacman/tests/upgrade030.py b/test/pacman/tests/upgrade030.py
new file mode 100644
index 00000000..8a6c473b
--- /dev/null
+++ b/test/pacman/tests/upgrade030.py
@@ -0,0 +1,21 @@
+self.description = "Upgrade packages with various reasons"
+
+lp1 = pmpkg("pkg1")
+lp1.reason = 0
+lp2 = pmpkg("pkg2")
+lp2.reason = 1
+
+for p in lp1, lp2:
+ self.addpkg2db("local", p)
+
+p1 = pmpkg("pkg1", "1.0-2")
+p2 = pmpkg("pkg2", "1.0-2")
+
+for p in p1, p2:
+ self.addpkg(p)
+
+self.args = "-U %s" % " ".join([p.filename() for p in p1, p2])
+
+self.addrule("PACMAN_RETCODE=0")
+self.addrule("PKG_REASON=pkg1|0")
+self.addrule("PKG_REASON=pkg2|1")
diff --git a/test/pacman/tests/upgrade031.py b/test/pacman/tests/upgrade031.py
new file mode 100644
index 00000000..856de983
--- /dev/null
+++ b/test/pacman/tests/upgrade031.py
@@ -0,0 +1,19 @@
+self.description = "Install packages non-explicitly"
+
+lp1 = pmpkg("pkg1")
+lp1.reason = 0
+self.addpkg2db("local", lp1)
+
+p1 = pmpkg("pkg1", "1.0-2")
+p2 = pmpkg("pkg2", "1.0-2")
+
+for p in p1, p2:
+ self.addpkg(p)
+
+self.args = "-U --asdeps %s" % " ".join([p.filename() for p in p1, p2])
+
+self.addrule("PACMAN_RETCODE=0")
+self.addrule("PKG_VERSION=pkg1|1.0-2")
+self.addrule("PKG_VERSION=pkg2|1.0-2")
+self.addrule("PKG_REASON=pkg1|1")
+self.addrule("PKG_REASON=pkg2|1")
diff --git a/test/pacman/tests/upgrade032.py b/test/pacman/tests/upgrade032.py
new file mode 100644
index 00000000..85e048e0
--- /dev/null
+++ b/test/pacman/tests/upgrade032.py
@@ -0,0 +1,19 @@
+self.description = "Install packages explicitly"
+
+lp1 = pmpkg("pkg1")
+lp1.reason = 1
+self.addpkg2db("local", lp1)
+
+p1 = pmpkg("pkg1", "1.0-2")
+p2 = pmpkg("pkg2", "1.0-2")
+
+for p in p1, p2:
+ self.addpkg(p)
+
+self.args = "-U --asexplicit %s" % " ".join([p.filename() for p in p1, p2])
+
+self.addrule("PACMAN_RETCODE=0")
+self.addrule("PKG_VERSION=pkg1|1.0-2")
+self.addrule("PKG_VERSION=pkg2|1.0-2")
+self.addrule("PKG_REASON=pkg1|0")
+self.addrule("PKG_REASON=pkg2|0")
diff --git a/test/pacman/tests/upgrade040.py b/test/pacman/tests/upgrade040.py
new file mode 100644
index 00000000..e17c7176
--- /dev/null
+++ b/test/pacman/tests/upgrade040.py
@@ -0,0 +1,31 @@
+self.description = "File relocation between two packages"
+
+lp1 = pmpkg("dummy")
+lp1.files = ["bin/dummy",
+ "usr/share/file"]
+
+lp2 = pmpkg("foobar")
+lp2.files = ["bin/foobar"]
+
+for p in lp1, lp2:
+ self.addpkg2db("local", p)
+
+p1 = pmpkg("dummy")
+p1.files = ["bin/dummy"]
+
+p2 = pmpkg("foobar")
+p2.files = ["bin/foobar",
+ "usr/share/file"]
+
+for p in p1, p2:
+ self.addpkg(p)
+
+self.args = "-U %s" % " ".join([p.filename() for p in p1, p2])
+
+self.addrule("PACMAN_RETCODE=0")
+for p in p1, p2:
+ self.addrule("PKG_EXIST=%s" % p.name)
+self.addrule("FILE_MODIFIED=bin/dummy")
+self.addrule("FILE_MODIFIED=bin/foobar")
+self.addrule("FILE_EXIST=usr/share/file")
+self.addrule("FILE_MODIFIED=usr/share/file")
diff --git a/test/pacman/tests/upgrade041.py b/test/pacman/tests/upgrade041.py
new file mode 100644
index 00000000..20da4f14
--- /dev/null
+++ b/test/pacman/tests/upgrade041.py
@@ -0,0 +1,31 @@
+self.description = "File relocation between two packages (reverse order)"
+
+lp1 = pmpkg("dummy")
+lp1.files = ["bin/dummy"]
+
+lp2 = pmpkg("foobar")
+lp2.files = ["bin/foobar",
+ "usr/share/file"]
+
+for p in lp1, lp2:
+ self.addpkg2db("local", p)
+
+p1 = pmpkg("dummy")
+p1.files = ["bin/dummy",
+ "usr/share/file"]
+
+p2 = pmpkg("foobar")
+p2.files = ["bin/foobar"]
+
+for p in p1, p2:
+ self.addpkg(p)
+
+self.args = "-U %s" % " ".join([p.filename() for p in p1, p2])
+
+self.addrule("PACMAN_RETCODE=0")
+for p in p1, p2:
+ self.addrule("PKG_EXIST=%s" % p.name)
+self.addrule("FILE_MODIFIED=bin/dummy")
+self.addrule("FILE_MODIFIED=bin/foobar")
+self.addrule("FILE_EXIST=usr/share/file")
+self.addrule("FILE_MODIFIED=usr/share/file")
diff --git a/test/pacman/tests/upgrade042.py b/test/pacman/tests/upgrade042.py
new file mode 100644
index 00000000..d6140d45
--- /dev/null
+++ b/test/pacman/tests/upgrade042.py
@@ -0,0 +1,28 @@
+self.description = "Backup file relocation"
+
+lp1 = pmpkg("bash")
+lp1.files = ["etc/profile*"]
+lp1.backup = ["etc/profile"]
+self.addpkg2db("local", lp1)
+
+p1 = pmpkg("bash", "1.0-2")
+self.addpkg(p1)
+
+lp2 = pmpkg("filesystem")
+self.addpkg2db("local", lp2)
+
+p2 = pmpkg("filesystem", "1.0-2")
+p2.files = ["etc/profile**"]
+p2.backup = ["etc/profile"]
+p2.depends = [ "bash" ]
+self.addpkg(p2)
+
+self.args = "-U %s" % " ".join([p.filename() for p in p1, p2])
+
+self.filesystem = ["etc/profile"]
+
+self.addrule("PKG_VERSION=bash|1.0-2")
+self.addrule("PKG_VERSION=filesystem|1.0-2")
+self.addrule("!FILE_PACSAVE=etc/profile")
+self.addrule("FILE_PACNEW=etc/profile")
+self.addrule("FILE_EXIST=etc/profile")
diff --git a/test/pacman/tests/upgrade043.py b/test/pacman/tests/upgrade043.py
new file mode 100644
index 00000000..e76dc463
--- /dev/null
+++ b/test/pacman/tests/upgrade043.py
@@ -0,0 +1,28 @@
+self.description = "Backup file relocation (reverse order)"
+
+lp1 = pmpkg("bash")
+lp1.files = ["etc/profile*"]
+lp1.backup = ["etc/profile"]
+self.addpkg2db("local", lp1)
+
+p1 = pmpkg("bash", "1.0-2")
+p1.depends = [ "filesystem" ]
+self.addpkg(p1)
+
+lp2 = pmpkg("filesystem")
+self.addpkg2db("local", lp2)
+
+p2 = pmpkg("filesystem", "1.0-2")
+p2.files = ["etc/profile**"]
+p2.backup = ["etc/profile"]
+self.addpkg(p2)
+
+self.args = "-U %s" % " ".join([p.filename() for p in p1, p2])
+
+self.filesystem = ["etc/profile"]
+
+self.addrule("PKG_VERSION=bash|1.0-2")
+self.addrule("PKG_VERSION=filesystem|1.0-2")
+self.addrule("!FILE_PACSAVE=etc/profile")
+self.addrule("FILE_PACNEW=etc/profile")
+self.addrule("FILE_EXIST=etc/profile")
diff --git a/test/pacman/tests/upgrade045.py b/test/pacman/tests/upgrade045.py
new file mode 100644
index 00000000..b2f81274
--- /dev/null
+++ b/test/pacman/tests/upgrade045.py
@@ -0,0 +1,16 @@
+self.description = "FS#9235"
+
+lp = pmpkg("foo")
+lp.files = ["etc/foo.cfg -> etc/foo.cfg"]
+lp.backup = ["etc/foo.cfg"]
+self.addpkg2db("local", lp)
+
+p1 = pmpkg("foo", "1.0-2")
+p1.files = ["etc/foo.cfg*"]
+p1.backup = ["etc/foo.cfg"]
+self.addpkg(p1)
+
+self.args = "-U %s" % p1.filename()
+
+self.addrule("PKG_VERSION=foo|1.0-2")
+self.addrule("FILE_EXIST=etc/foo.cfg")
diff --git a/test/pacman/tests/upgrade046.py b/test/pacman/tests/upgrade046.py
new file mode 100644
index 00000000..12390647
--- /dev/null
+++ b/test/pacman/tests/upgrade046.py
@@ -0,0 +1,33 @@
+self.description = "File relocation between two packages (reverse order, --force)"
+
+lp1 = pmpkg("dummy")
+lp1.files = ["bin/dummy"]
+
+lp2 = pmpkg("foobar")
+lp2.files = ["bin/foobar",
+ "usr/share/file"]
+
+for p in lp1, lp2:
+ self.addpkg2db("local", p)
+
+p1 = pmpkg("dummy")
+p1.files = ["bin/dummy",
+ "usr/share/file"]
+
+p2 = pmpkg("foobar")
+p2.files = ["bin/foobar"]
+
+for p in p1, p2:
+ self.addpkg(p)
+
+self.args = "-Uf %s" % " ".join([p.filename() for p in p1, p2])
+
+self.addrule("PACMAN_RETCODE=0")
+for p in p1, p2:
+ self.addrule("PKG_EXIST=%s" % p.name)
+self.addrule("FILE_MODIFIED=bin/dummy")
+self.addrule("FILE_MODIFIED=bin/foobar")
+self.addrule("FILE_EXIST=usr/share/file")
+self.addrule("FILE_MODIFIED=usr/share/file")
+
+self.expectfailure = True
diff --git a/test/pacman/tests/upgrade050.py b/test/pacman/tests/upgrade050.py
new file mode 100644
index 00000000..f05b0b62
--- /dev/null
+++ b/test/pacman/tests/upgrade050.py
@@ -0,0 +1,15 @@
+self.description = "Upgrade package with a conflict == depend (not installed)"
+
+p1 = pmpkg("pkg1")
+p1.conflicts = ["pkg2"]
+p1.depends = ["pkg2"]
+self.addpkg(p1)
+
+p2 = pmpkg("pkg2")
+self.addpkg(p2)
+
+self.args = "-U %s" % " ".join([p.filename() for p in p1, p2])
+
+self.addrule("PACMAN_RETCODE=1")
+self.addrule("!PKG_EXIST=pkg1")
+self.addrule("!PKG_EXIST=pkg2")
diff --git a/test/pacman/tests/upgrade051.py b/test/pacman/tests/upgrade051.py
new file mode 100644
index 00000000..1d173218
--- /dev/null
+++ b/test/pacman/tests/upgrade051.py
@@ -0,0 +1,15 @@
+self.description = "Upgrade to a package that provides another package"
+
+lp = pmpkg("pkg1")
+self.addpkg2db("local", lp)
+
+p = pmpkg("pkg2")
+p.conflicts = ["pkg1"]
+p.provides = ["pkg1"]
+self.addpkg(p)
+
+self.args = "-U %s --ask=4" % p.filename()
+
+self.addrule("PACMAN_RETCODE=0")
+self.addrule("!PKG_EXIST=pkg1")
+self.addrule("PKG_EXIST=pkg2")
diff --git a/test/pacman/tests/upgrade052.py b/test/pacman/tests/upgrade052.py
new file mode 100644
index 00000000..7000a12f
--- /dev/null
+++ b/test/pacman/tests/upgrade052.py
@@ -0,0 +1,20 @@
+self.description = "Upgrade to a package that provides less than before"
+
+lp1 = pmpkg("pkg1")
+lp1.depends = ["imaginary"]
+self.addpkg2db("local", lp1)
+
+lp2 = pmpkg("pkg2")
+lp2.provides = ["imaginary", "real"]
+self.addpkg2db("local", lp2)
+
+p = pmpkg("pkg2", "1.0-2")
+p.provides = ["real"]
+self.addpkg(p)
+
+self.args = "-U %s" % p.filename()
+
+self.addrule("PACMAN_RETCODE=1")
+self.addrule("PKG_EXIST=pkg1")
+self.addrule("PKG_VERSION=pkg2|1.0-1")
+self.addrule("PKG_PROVIDES=pkg2|imaginary")
diff --git a/test/pacman/tests/upgrade053.py b/test/pacman/tests/upgrade053.py
new file mode 100644
index 00000000..78de0b5e
--- /dev/null
+++ b/test/pacman/tests/upgrade053.py
@@ -0,0 +1,19 @@
+self.description = "Upgrade a package with dependency on provided package (same)"
+
+lp1 = pmpkg("pkg1")
+lp1.depends = ["imaginary"]
+self.addpkg2db("local", lp1)
+
+lp2 = pmpkg("pkg2")
+lp2.provides = ["imaginary", "real"]
+self.addpkg2db("local", lp2)
+
+p = pmpkg("pkg1", "1.0-2")
+p.depends = ["imaginary"]
+self.addpkg(p)
+
+self.args = "-U %s" % p.filename()
+
+self.addrule("PACMAN_RETCODE=0")
+self.addrule("PKG_VERSION=pkg1|1.0-2")
+self.addrule("PKG_EXIST=pkg2")
diff --git a/test/pacman/tests/upgrade054.py b/test/pacman/tests/upgrade054.py
new file mode 100644
index 00000000..817d1b3d
--- /dev/null
+++ b/test/pacman/tests/upgrade054.py
@@ -0,0 +1,19 @@
+self.description = "Upgrade a package with dependency on provided package (different)"
+
+lp1 = pmpkg("pkg1")
+lp1.depends = ["imaginary"]
+self.addpkg2db("local", lp1)
+
+lp2 = pmpkg("pkg2")
+lp2.provides = ["imaginary", "real"]
+self.addpkg2db("local", lp2)
+
+p = pmpkg("pkg1", "1.0-2")
+p.depends = ["real"]
+self.addpkg(p)
+
+self.args = "-U %s" % p.filename()
+
+self.addrule("PACMAN_RETCODE=0")
+self.addrule("PKG_VERSION=pkg1|1.0-2")
+self.addrule("PKG_EXIST=pkg2")
diff --git a/test/pacman/tests/upgrade055.py b/test/pacman/tests/upgrade055.py
new file mode 100644
index 00000000..25083962
--- /dev/null
+++ b/test/pacman/tests/upgrade055.py
@@ -0,0 +1,25 @@
+self.description = "Upgrade a package that provides one of two imaginary packages"
+
+lp1 = pmpkg("pkg1")
+lp1.depends = ["imaginary", "imaginary2"]
+self.addpkg2db("local", lp1)
+
+lp2 = pmpkg("pkg2")
+lp2.provides = ["imaginary"]
+self.addpkg2db("local", lp2)
+
+lp3 = pmpkg("pkg3")
+lp3.provides = ["imaginary2"]
+self.addpkg2db("local", lp3)
+
+p = pmpkg("pkg2", "1.0-2")
+p.provides = ["imaginary"]
+self.addpkg(p)
+
+self.args = "-U %s" % p.filename()
+
+self.addrule("PACMAN_RETCODE=0")
+self.addrule("PKG_EXIST=pkg1")
+self.addrule("PKG_VERSION=pkg2|1.0-2")
+self.addrule("PKG_EXIST=pkg3")
+self.addrule("PKG_DEPENDS=pkg1|imaginary")
diff --git a/test/pacman/tests/upgrade056.py b/test/pacman/tests/upgrade056.py
new file mode 100644
index 00000000..908fa30c
--- /dev/null
+++ b/test/pacman/tests/upgrade056.py
@@ -0,0 +1,23 @@
+self.description = "Upgrade a package that removes a provide but another package still provides it"
+
+lp1 = pmpkg("pkg1")
+lp1.depends = ["imaginary"]
+self.addpkg2db("local", lp1)
+
+lp2 = pmpkg("pkg2")
+lp2.provides = ["imaginary"]
+self.addpkg2db("local", lp2)
+
+lp3 = pmpkg("pkg3")
+lp3.provides = ["imaginary"]
+self.addpkg2db("local", lp3)
+
+p = pmpkg("pkg2", "1.0-2")
+self.addpkg(p)
+
+self.args = "-U %s" % p.filename()
+
+self.addrule("PACMAN_RETCODE=0")
+self.addrule("PKG_EXIST=pkg1")
+self.addrule("PKG_VERSION=pkg2|1.0-2")
+self.addrule("PKG_EXIST=pkg3")
diff --git a/test/pacman/tests/upgrade057.py b/test/pacman/tests/upgrade057.py
new file mode 100644
index 00000000..b1eb5029
--- /dev/null
+++ b/test/pacman/tests/upgrade057.py
@@ -0,0 +1,21 @@
+self.description = "Upgrade a package that both provides and is a dependency"
+
+lp1 = pmpkg("pkg1")
+lp1.depends = ["pkg2", "imag3"]
+self.addpkg2db("local", lp1)
+
+lp2 = pmpkg("pkg2")
+lp2.provides = ["imag3"]
+self.addpkg2db("local", lp2)
+
+p = pmpkg("pkg2", "1.0-2")
+p.provides = ["imag3"]
+self.addpkg(p)
+
+self.args = "-U %s" % p.filename()
+
+self.addrule("PACMAN_RETCODE=0")
+self.addrule("PKG_EXIST=pkg1")
+self.addrule("PKG_VERSION=pkg2|1.0-2")
+self.addrule("PKG_DEPENDS=pkg1|pkg2")
+self.addrule("PKG_DEPENDS=pkg1|imag3")
diff --git a/test/pacman/tests/upgrade058.py b/test/pacman/tests/upgrade058.py
new file mode 100644
index 00000000..38576fff
--- /dev/null
+++ b/test/pacman/tests/upgrade058.py
@@ -0,0 +1,16 @@
+self.description = "Upgrade a package that's older version is required by another package."
+
+lp1 = pmpkg("pkg1")
+lp1.depends = [ "pkg2=1.0" ]
+self.addpkg2db("local", lp1)
+
+lp2 = pmpkg("pkg2", "1.0-1")
+self.addpkg2db("local", lp2)
+
+p = pmpkg("pkg2", "1.1-1")
+self.addpkg(p)
+
+self.args = "-U %s" % p.filename()
+
+self.addrule("PACMAN_RETCODE=1")
+self.addrule("!PKG_VERSION=pkg2|1.1-1")
diff --git a/test/pacman/tests/upgrade059.py b/test/pacman/tests/upgrade059.py
new file mode 100644
index 00000000..9cd9f1f0
--- /dev/null
+++ b/test/pacman/tests/upgrade059.py
@@ -0,0 +1,26 @@
+self.description = "Upgrade packages which would break a multiple-depend"
+
+lp1 = pmpkg("pkg1")
+lp1.depends = ["imaginary"]
+self.addpkg2db("local", lp1)
+
+lp2 = pmpkg("pkg2", "1.0-1")
+lp2.provides = ["imaginary"]
+self.addpkg2db("local", lp2)
+
+lp3 = pmpkg("pkg3", "1.0-1")
+lp3.provides = ["imaginary"]
+self.addpkg2db("local", lp3)
+
+p2 = pmpkg("pkg2", "1.0-2")
+self.addpkg(p2)
+
+p3 = pmpkg("pkg3", "1.0-2")
+self.addpkg(p3)
+
+self.args = "-U %s" % " ".join([p.filename() for p in p2, p3])
+
+self.addrule("PACMAN_RETCODE=1")
+self.addrule("PKG_EXIST=pkg1")
+self.addrule("PKG_VERSION=pkg2|1.0-1")
+self.addrule("PKG_VERSION=pkg3|1.0-1")
diff --git a/test/pacman/tests/upgrade060.py b/test/pacman/tests/upgrade060.py
new file mode 100644
index 00000000..7a28f3eb
--- /dev/null
+++ b/test/pacman/tests/upgrade060.py
@@ -0,0 +1,21 @@
+self.description = "Try to upgrade two packages which would break deps"
+
+lp1 = pmpkg("pkg1")
+lp1.depends = ["pkg2=1.0"]
+self.addpkg2db("local", lp1)
+
+lp2 = pmpkg("pkg2", "1.0-1")
+self.addpkg2db("local", lp2)
+
+p1 = pmpkg("pkg1", "1.1-1")
+p1.depends = ["pkg2=1.0-1"]
+self.addpkg(p1)
+
+p2 = pmpkg("pkg2", "1.1-1")
+self.addpkg(p2)
+
+self.args = "-U %s" % " ".join([p.filename() for p in p1, p2])
+
+self.addrule("PACMAN_RETCODE=1")
+self.addrule("PKG_VERSION=pkg1|1.0-1")
+self.addrule("PKG_VERSION=pkg2|1.0-1")
diff --git a/test/pacman/tests/upgrade061.py b/test/pacman/tests/upgrade061.py
new file mode 100644
index 00000000..310e5043
--- /dev/null
+++ b/test/pacman/tests/upgrade061.py
@@ -0,0 +1,22 @@
+self.description = "Try to upgrade two packages which would break deps"
+
+lp1 = pmpkg("pkg1", "1.0-1")
+lp1.depends = ["imaginary"]
+self.addpkg2db("local", lp1)
+
+lp2 = pmpkg("pkg2", "1.0-1")
+lp2.provides = ["imaginary"]
+self.addpkg2db("local", lp2)
+
+p1 = pmpkg("pkg1", "1.0-2")
+p1.depends = ["imaginary"]
+self.addpkg(p1)
+
+p2 = pmpkg("pkg2", "1.0-2")
+self.addpkg(p2)
+
+self.args = "-U %s" % " ".join([p.filename() for p in p1, p2])
+
+self.addrule("PACMAN_RETCODE=1")
+self.addrule("PKG_VERSION=pkg1|1.0-1")
+self.addrule("PKG_VERSION=pkg2|1.0-1")
diff --git a/test/pacman/tests/upgrade070.py b/test/pacman/tests/upgrade070.py
new file mode 100644
index 00000000..01f0ba48
--- /dev/null
+++ b/test/pacman/tests/upgrade070.py
@@ -0,0 +1,15 @@
+self.description = "Install a package with a file in NoExtract"
+
+p = pmpkg("dummy")
+p.files = ["bin/dummy",
+ "usr/man/man1/dummy.1"]
+self.addpkg(p)
+
+self.option["NoExtract"] = ["usr/man/man1/dummy.1"]
+
+self.args = "-U %s" % p.filename()
+
+self.addrule("PACMAN_RETCODE=0")
+self.addrule("PKG_EXIST=dummy")
+self.addrule("FILE_EXIST=bin/dummy")
+self.addrule("!FILE_EXIST=usr/man/man1/dummy.1")
diff --git a/test/pacman/tests/upgrade071.py b/test/pacman/tests/upgrade071.py
new file mode 100644
index 00000000..1f21c558
--- /dev/null
+++ b/test/pacman/tests/upgrade071.py
@@ -0,0 +1,14 @@
+self.description = "Install a package with a missing dependency"
+
+p = pmpkg("dummy")
+p.files = ["bin/dummy",
+ "usr/man/man1/dummy.1"]
+p.depends = ["dep1"]
+self.addpkg(p)
+
+self.args = "-U %s" % p.filename()
+
+self.addrule("PACMAN_RETCODE=1")
+self.addrule("!PKG_EXIST=dummy")
+for f in p.files:
+ self.addrule("!FILE_EXIST=%s" % f)
diff --git a/test/pacman/tests/upgrade072.py b/test/pacman/tests/upgrade072.py
new file mode 100644
index 00000000..f88e150c
--- /dev/null
+++ b/test/pacman/tests/upgrade072.py
@@ -0,0 +1,15 @@
+self.description = "Install a package with a missing dependency (nodeps)"
+
+p = pmpkg("dummy")
+p.files = ["bin/dummy",
+ "usr/man/man1/dummy.1"]
+p.depends = ["dep1"]
+self.addpkg(p)
+
+self.args = "-Ud %s" % p.filename()
+
+self.addrule("PACMAN_RETCODE=0")
+self.addrule("PKG_EXIST=dummy")
+self.addrule("PKG_DEPENDS=dummy|dep1")
+for f in p.files:
+ self.addrule("FILE_EXIST=%s" % f)
diff --git a/test/pacman/tests/upgrade073.py b/test/pacman/tests/upgrade073.py
new file mode 100644
index 00000000..752a2336
--- /dev/null
+++ b/test/pacman/tests/upgrade073.py
@@ -0,0 +1,27 @@
+self.description = "Install a package with cascaded dependencies"
+
+p1 = pmpkg("dummy", "1.0-2")
+p1.files = ["bin/dummy",
+ "usr/man/man1/dummy.1"]
+p1.depends = ["dep1"]
+
+p2 = pmpkg("dep1")
+p2.files = ["bin/dep1"]
+p2.depends = ["dep2"]
+
+p3 = pmpkg("dep2")
+p3.files = ["bin/dep2"]
+
+for p in p1, p2, p3:
+ self.addpkg(p)
+
+self.args = "-U %s" % " ".join([p.filename() for p in p1, p2, p3])
+
+self.addrule("PACMAN_RETCODE=0")
+self.addrule("PKG_VERSION=dummy|1.0-2")
+self.addrule("PKG_DEPENDS=dummy|dep1")
+self.addrule("PKG_DEPENDS=dep1|dep2")
+for p in p1, p2, p3:
+ self.addrule("PKG_EXIST=%s" % p.name)
+ for f in p.files:
+ self.addrule("FILE_EXIST=%s" % f)
diff --git a/test/pacman/tests/upgrade074.py b/test/pacman/tests/upgrade074.py
new file mode 100644
index 00000000..ca052855
--- /dev/null
+++ b/test/pacman/tests/upgrade074.py
@@ -0,0 +1,14 @@
+self.description = "pkg2<2.0 dependency (satisfy)"
+
+p = pmpkg("pkg1")
+p.depends = ["pkg2<2.0"]
+self.addpkg(p)
+
+lp = pmpkg("pkg2", "1.9b-3")
+self.addpkg2db("local", lp)
+
+self.args = "-U %s" % p.filename()
+
+self.addrule("PACMAN_RETCODE=0")
+self.addrule("PKG_EXIST=pkg1")
+self.addrule("PKG_EXIST=pkg2")
diff --git a/test/pacman/tests/upgrade075.py b/test/pacman/tests/upgrade075.py
new file mode 100644
index 00000000..8d2f3fc4
--- /dev/null
+++ b/test/pacman/tests/upgrade075.py
@@ -0,0 +1,14 @@
+self.description = "pkg2<2.0 dependency (not satisfy)"
+
+p = pmpkg("pkg1")
+p.depends = ["pkg2<2.0"]
+self.addpkg(p)
+
+lp = pmpkg("pkg2", "2.0-3")
+self.addpkg2db("local", lp)
+
+self.args = "-U %s" % p.filename()
+
+self.addrule("PACMAN_RETCODE=1")
+self.addrule("!PKG_EXIST=pkg1")
+self.addrule("PKG_EXIST=pkg2")
diff --git a/test/pacman/tests/upgrade076.py b/test/pacman/tests/upgrade076.py
new file mode 100644
index 00000000..87ccbddf
--- /dev/null
+++ b/test/pacman/tests/upgrade076.py
@@ -0,0 +1,18 @@
+self.description = "Package downgrade (failure)"
+
+lp1 = pmpkg("pkg1")
+lp1.depends = ["pkg2=1.1"]
+self.addpkg2db("local", lp1)
+
+lp2 = pmpkg("pkg2", "1.1-1")
+self.addpkg2db("local", lp2)
+
+p = pmpkg("pkg2", "1.0-1")
+self.addpkg(p)
+
+self.args = "-U %s" % p.filename()
+
+self.addrule("PACMAN_RETCODE=1")
+self.addrule("PKG_EXIST=pkg1")
+self.addrule("PKG_EXIST=pkg2")
+self.addrule("PKG_VERSION=pkg2|1.1-1")
diff --git a/test/pacman/tests/upgrade080.py b/test/pacman/tests/upgrade080.py
new file mode 100644
index 00000000..9ddbd708
--- /dev/null
+++ b/test/pacman/tests/upgrade080.py
@@ -0,0 +1,16 @@
+self.description = "Install a package (correct architecture)"
+
+p = pmpkg("dummy")
+p.files = ["bin/dummy",
+ "usr/man/man1/dummy.1"]
+p.arch = 'testarch'
+self.addpkg(p)
+
+self.option["Architecture"] = ['testarch']
+
+self.args = "-U %s" % p.filename()
+
+self.addrule("PACMAN_RETCODE=0")
+self.addrule("PKG_EXIST=dummy")
+for f in p.files:
+ self.addrule("FILE_EXIST=%s" % f)
diff --git a/test/pacman/tests/upgrade081.py b/test/pacman/tests/upgrade081.py
new file mode 100644
index 00000000..99e22311
--- /dev/null
+++ b/test/pacman/tests/upgrade081.py
@@ -0,0 +1,16 @@
+self.description = "Install a package (wrong architecture)"
+
+p = pmpkg("dummy")
+p.files = ["bin/dummy",
+ "usr/man/man1/dummy.1"]
+p.arch = 'testarch'
+self.addpkg(p)
+
+self.option["Architecture"] = ['nottestarch']
+
+self.args = "-U %s" % p.filename()
+
+self.addrule("PACMAN_RETCODE=1")
+self.addrule("!PKG_EXIST=dummy")
+for f in p.files:
+ self.addrule("!FILE_EXIST=%s" % f)
diff --git a/test/pacman/tests/upgrade082.py b/test/pacman/tests/upgrade082.py
new file mode 100644
index 00000000..0bdbdf71
--- /dev/null
+++ b/test/pacman/tests/upgrade082.py
@@ -0,0 +1,19 @@
+self.description = "Install a package (correct architecture, auto)"
+
+import os
+machine = os.uname()[4]
+
+p = pmpkg("dummy")
+p.files = ["bin/dummy",
+ "usr/man/man1/dummy.1"]
+p.arch = machine
+self.addpkg(p)
+
+self.option["Architecture"] = ['auto']
+
+self.args = "-U %s" % p.filename()
+
+self.addrule("PACMAN_RETCODE=0")
+self.addrule("PKG_EXIST=dummy")
+for f in p.files:
+ self.addrule("FILE_EXIST=%s" % f)
diff --git a/test/pacman/tests/upgrade083.py b/test/pacman/tests/upgrade083.py
new file mode 100644
index 00000000..097ae02c
--- /dev/null
+++ b/test/pacman/tests/upgrade083.py
@@ -0,0 +1,19 @@
+self.description = "Install a package (wrong architecture, auto)"
+
+import os
+machine = os.uname()[4]
+
+p = pmpkg("dummy")
+p.files = ["bin/dummy",
+ "usr/man/man1/dummy.1"]
+p.arch = machine + 'wrong'
+self.addpkg(p)
+
+self.option["Architecture"] = ['auto']
+
+self.args = "-U %s" % p.filename()
+
+self.addrule("PACMAN_RETCODE=1")
+self.addrule("!PKG_EXIST=dummy")
+for f in p.files:
+ self.addrule("!FILE_EXIST=%s" % f)
diff --git a/test/pacman/tests/upgrade084.py b/test/pacman/tests/upgrade084.py
new file mode 100644
index 00000000..8268e3ff
--- /dev/null
+++ b/test/pacman/tests/upgrade084.py
@@ -0,0 +1,16 @@
+self.description = "Install a package ('any' architecture)"
+
+p = pmpkg("dummy")
+p.files = ["bin/dummy",
+ "usr/man/man1/dummy.1"]
+p.arch = 'any'
+self.addpkg(p)
+
+self.option["Architecture"] = ['auto']
+
+self.args = "-U %s" % p.filename()
+
+self.addrule("PACMAN_RETCODE=0")
+self.addrule("PKG_EXIST=dummy")
+for f in p.files:
+ self.addrule("FILE_EXIST=%s" % f)
diff --git a/test/pacman/tests/upgrade090.py b/test/pacman/tests/upgrade090.py
new file mode 100644
index 00000000..26e531c9
--- /dev/null
+++ b/test/pacman/tests/upgrade090.py
@@ -0,0 +1,28 @@
+self.description = "-U syncdeps test"
+
+p1 = pmpkg("pkg1", "1.0-2")
+p1.files = ["bin/pkg1"]
+
+p2 = pmpkg("pkg2", "1.0-2")
+p2.depends = ["dep"]
+
+p3 = pmpkg("pkg3", "1.0-2")
+p3.depends = ["unres"]
+
+for p in p1, p2, p3:
+ self.addpkg(p)
+
+sp = pmpkg("dep")
+sp.files = ["bin/dep"]
+self.addpkg2db("sync", sp)
+
+self.args = "-U %s --ask=32" % " ".join([p.filename() for p in p1, p2, p3])
+
+self.addrule("PACMAN_RETCODE=0")
+for p in p1, p2, sp:
+ self.addrule("PKG_EXIST=%s" % p.name)
+ for f in p.files:
+ self.addrule("FILE_EXIST=%s" % f)
+self.addrule("PKG_VERSION=pkg1|1.0-2")
+self.addrule("PKG_VERSION=pkg2|1.0-2")
+self.addrule("!PKG_EXIST=pkg3")
diff --git a/test/pacman/tests/xfercommand001.py b/test/pacman/tests/xfercommand001.py
new file mode 100644
index 00000000..a645cf7f
--- /dev/null
+++ b/test/pacman/tests/xfercommand001.py
@@ -0,0 +1,20 @@
+self.description = "Quick check for using XferCommand"
+
+# this setting forces us to download packages
+self.cachepkgs = False
+#wget doesn't support file:// urls. curl does
+self.option['XferCommand'] = ['/usr/bin/curl %u > %o']
+
+numpkgs = 10
+pkgnames = []
+for i in xrange(numpkgs):
+ name = "pkg_%s" % i
+ pkgnames.append(name)
+ p = pmpkg(name)
+ p.files = ["usr/bin/foo-%s" % i]
+ self.addpkg2db("sync", p)
+
+self.args = "-S %s" % ' '.join(pkgnames)
+
+for name in pkgnames:
+ self.addrule("PKG_EXIST=%s" % name)