From 11fe18479eeb7bb97062a2922da13ba816597007 Mon Sep 17 00:00:00 2001
From: Dan McGee <dan@archlinux.org>
Date: Thu, 7 Feb 2008 19:36:17 -0600
Subject: pactest: make more resiliant to missing files

Add a bunch of guards around function calls like open() and stat() to ensure
we are not going to get ourselves a python error. This made implementing and
testing the new upgrade045 pactest much easier, as its whole purpose was to
create a dead symlink and debug a segfault of pacman (which caused no DB
entries to be written) to support the previously checked in fix for FS#9235
(commit 0c2206f542ce6df2606586d43f190cd5a423fb13). Both of these cases are
now non-fatal in pactest.

Signed-off-by: Dan McGee <dan@archlinux.org>
---
 pactest/tests/upgrade045.py | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)
 create mode 100644 pactest/tests/upgrade045.py

(limited to 'pactest/tests')

diff --git a/pactest/tests/upgrade045.py b/pactest/tests/upgrade045.py
new file mode 100644
index 00000000..b2f81274
--- /dev/null
+++ b/pactest/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")
-- 
cgit v1.2.3-70-g09d2