[pacman-dev] CVS update of pacman-lib/pactest (tests/scriptlet001.py util.py)
Date: Thursday, March 22, 2007 @ 04:30:18 Author: aaron Path: /home/cvs-pacman/pacman-lib/pactest Added: tests/scriptlet001.py (1.1) Modified: util.py (1.6 -> 1.7) Quick pactest changes: * Minor change to utils.py(grep) to make it cleaner * Added scriptlet check to verify scriptlet events happen -----------------------+ tests/scriptlet001.py | 15 +++++++++++++++ util.py | 14 +++++--------- 2 files changed, 20 insertions(+), 9 deletions(-) Index: pacman-lib/pactest/tests/scriptlet001.py diff -u /dev/null pacman-lib/pactest/tests/scriptlet001.py:1.1 --- /dev/null Thu Mar 22 04:30:18 2007 +++ pacman-lib/pactest/tests/scriptlet001.py Thu Mar 22 04:30:18 2007 @@ -0,0 +1,15 @@ +# 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 = "Scriptlet test (pre/post install)" + +p1 = pmpkg("dummy") +p1.files = ['etc/dummy.conf'] +p1.install['pre_install'] = "ls /etc"; +p1.install['post_install'] = "ls /etc"; +self.addpkg(p1) + +self.args = "-U %s" % p1.filename() + +self.addrule("PACMAN_RETCODE=0") +self.addrule("PACMAN_OUTPUT=pre_install") +self.addrule("PACMAN_OUTPUT=post_install") Index: pacman-lib/pactest/util.py diff -u pacman-lib/pactest/util.py:1.6 pacman-lib/pactest/util.py:1.7 --- pacman-lib/pactest/util.py:1.6 Mon Mar 5 17:13:34 2007 +++ pacman-lib/pactest/util.py Thu Mar 22 04:30:18 2007 @@ -236,16 +236,12 @@ # def grep(filename, pattern): - found = 0 - fd = file(filename, "r") - while 1 and not found: - line = fd.readline() - if not line: - break + lines = file(filename, 'r').readlines() + for line in lines: + if not line: break if line.find(pattern) != -1: - found = 1 - fd.close() - return found + return True + return False def mkdir(dir): if os.path.isdir(dir):
On 3/22/07, Aaron Griffin <aaron@archlinux.org> wrote:
Date: Thursday, March 22, 2007 @ 04:30:18 Author: aaron Path: /home/cvs-pacman/pacman-lib/pactest
Added: tests/scriptlet001.py (1.1) Modified: util.py (1.6 -> 1.7)
Quick pactest changes: * Minor change to utils.py(grep) to make it cleaner * Added scriptlet check to verify scriptlet events happen
This scriptlet test only passes if --debug=1 is passed, which does not happen in make check. You may want to make that the default in the 'check-local' target in Makefile.am. -Dan
On 3/22/07, Dan McGee <dpmcgee@gmail.com> wrote:
On 3/22/07, Aaron Griffin <aaron@archlinux.org> wrote:
Date: Thursday, March 22, 2007 @ 04:30:18 Author: aaron Path: /home/cvs-pacman/pacman-lib/pactest
Added: tests/scriptlet001.py (1.1) Modified: util.py (1.6 -> 1.7)
Quick pactest changes: * Minor change to utils.py(grep) to make it cleaner * Added scriptlet check to verify scriptlet events happen
This scriptlet test only passes if --debug=1 is passed, which does not happen in make check. You may want to make that the default in the 'check-local' target in Makefile.am.
Good point, I didn't even thing about that.
participants (3)
-
Aaron Griffin
-
Aaron Griffin
-
Dan McGee