[pacman-dev] [PATCH] pactest: remove need for pause when running tests
Instead of pausing 1.5 seconds on tests that check file mtimes, change the mtimes to something in the far past so we can immediately tell if a file was modified and/or touched. This saves a decent amount of time on the upgrade tests which often check mtimes. 355 was a completely arbitrary time value, don't ask me why I picked it. Signed-off-by: Dan McGee <dan@archlinux.org> --- pactest/pmenv.py | 8 +++++--- pactest/pmfile.py | 8 ++++++++ 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/pactest/pmenv.py b/pactest/pmenv.py index e9d0b4c..cc433dd 100755 --- a/pactest/pmenv.py +++ b/pactest/pmenv.py @@ -71,9 +71,11 @@ class pmenv: t.generate() # Hack for mtimes consistency for i in t.rules: - if i.rule.find("MODIFIED") != -1: - time.sleep(1.5) - break + if i.rule.find("FILE_MODIFIED") != -1: + [test, arg] = i.rule.split("=") + for f in t.files: + if f.name == arg: + f.resettimes() t.run(self.pacman) diff --git a/pactest/pmfile.py b/pactest/pmfile.py index 21baf01..ab4aa2c 100755 --- a/pactest/pmfile.py +++ b/pactest/pmfile.py @@ -56,6 +56,14 @@ class pmfile: return retval + def resettimes(self): + """ + """ + + filename = os.path.join(self.root, self.name) + os.utime(filename, (355, 355)) + self.mtime = getmtime(filename) + vprint("\tmtime reset (%s)" % self.name) if __name__ == "__main__": f = pmfile("/tmp", "foobar") -- 1.5.6.3
Instead of using our "binaries" in our calls to pactest and vercmptest, use the libtool linked ones. We need to ensure they are created by calling the scripts once, and from there we can use them directly. This has some pretty large benefits due to much reduced forking of processes. Note: I am not sure this will work on all platforms, namely Cygwin. Further testing is necessary. Signed-off-by: Dan McGee <dan@archlinux.org> --- Makefile.am | 6 ++++-- 1 files changed, 4 insertions(+), 2 deletions(-) diff --git a/Makefile.am b/Makefile.am index ea3b0e0..bc0129d 100644 --- a/Makefile.am +++ b/Makefile.am @@ -13,12 +13,14 @@ dist_pkgdata_DATA = PKGBUILD.proto proto.install ChangeLog.proto # run the pactest test suite and vercmp tests check-local: pactest src/pacman src/util + $(top_builddir)/src/pacman/pacman --version || test $$? -eq 2 && true $(PYTHON) $(top_srcdir)/pactest/pactest.py --debug=1 \ --test $(top_srcdir)/pactest/tests/*.py \ - -p $(top_builddir)/src/pacman/pacman + -p $(top_builddir)/src/pacman/.libs/lt-pacman rm -rf $(top_builddir)/root + $(top_builddir)/src/util/vercmp || test $$? -eq 2 && true $(SH) $(top_srcdir)/pactest/vercmptest.sh \ - $(top_builddir)/src/util/vercmp + $(top_builddir)/src/util/.libs/lt-vercmp # create the pacman DB and cache directories upon install install-data-local: -- 1.5.6.3
On Sun, Aug 03, 2008 at 10:00:40PM -0500, Dan McGee <dan@archlinux.org> wrote:
Instead of using our "binaries" in our calls to pactest and vercmptest, use the libtool linked ones. We need to ensure they are created by calling the scripts once, and from there we can use them directly. This has some pretty large benefits due to much reduced forking of processes.
Note: I am not sure this will work on all platforms, namely Cygwin. Further testing is necessary.
The other problem is IMHO that lt-pacman will use the system-wide libalpm, which is not what you want when you use make check. If you really want such a hack, then you should set LD_LIBRARY_PATH correctly, but what about just using dolt from http://gitweb.freedesktop.org/?p=dolt.git;a=summary ? IIRC it worked fine with pacman-g2, so it'll be OK with pacman as well, I guess.
On Mon, Aug 4, 2008 at 8:58 AM, Miklos Vajna <vmiklos@frugalware.org> wrote:
On Sun, Aug 03, 2008 at 10:00:40PM -0500, Dan McGee <dan@archlinux.org> wrote:
Instead of using our "binaries" in our calls to pactest and vercmptest, use the libtool linked ones. We need to ensure they are created by calling the scripts once, and from there we can use them directly. This has some pretty large benefits due to much reduced forking of processes.
Note: I am not sure this will work on all platforms, namely Cygwin. Further testing is necessary.
The other problem is IMHO that lt-pacman will use the system-wide libalpm, which is not what you want when you use make check.
If you really want such a hack, then you should set LD_LIBRARY_PATH correctly, but what about just using dolt from http://gitweb.freedesktop.org/?p=dolt.git;a=summary ?
IIRC it worked fine with pacman-g2, so it'll be OK with pacman as well, I guess.
Actually, I always had this problem with cygwin, the normal src/pacman/pacman seems to always use the system wide libalpm. So I always had to make install first before running make check or src/pacman/pacman. I don't know if there is also a lt-pacman there.
On Mon, Aug 4, 2008 at 9:10 AM, Xavier <shiningxc@gmail.com> wrote:
Actually, I always had this problem with cygwin, the normal src/pacman/pacman seems to always use the system wide libalpm. So I always had to make install first before running make check or src/pacman/pacman. I don't know if there is also a lt-pacman there.
Arf, after inspecting this pacman libtool generated script, I noticed the PATH directories were totally messed up. And that is once again because of directory whitespaces. The default HOME in cygwin is the user directory, so : /cygdrive/c/Documents and Settings/<username> So I naturally started working there, but it looks like GNU tools in general play quite badly with it. I am tired of trying to debug this crap so I just moved everything in a dir with no spaces, and now it is a bit better. At least now src/pacman/pacman works properly using the correct libalpm. But looks like there is still something wrong : $ ls -al src/pacman/.libs -rw-r--r-- 1 xav Some 7756 Aug 4 11:30 lt-pacman.c -rwxr-xr-x 1 xav Some 188468 Aug 4 11:29 pacman.exe So lt-pacman does not get compiled or something, I don't know.. Actually, I did not even know the differences between lt-pacman and pacman, but I just found out : $ ldd src/pacman/.libs/lt-pacman linux-gate.so.1 => (0xb80a0000) libalpm.so.3 => /home/xav/divers/pacman/lib/libalpm/.libs/libalpm.so.3 (0xb807f000) libdownload.so => /usr/lib/libdownload.so (0xb8069000) libarchive.so.2 => /usr/lib/libarchive.so.2 (0xb803d000) $ ldd src/pacman/.libs/pacman linux-gate.so.1 => (0xb8085000) libalpm.so.3 => not found libdownload.so => /usr/lib/libdownload.so (0xb806e000) libarchive.so.2 => /usr/lib/libarchive.so.2 (0xb8042000) So lt-pacman is indeed the one we wants and links to the correct libalpm library. But it does not get built on cygwin..
On Mon, Aug 4, 2008 at 5:00 AM, Dan McGee <dan@archlinux.org> wrote:
Instead of pausing 1.5 seconds on tests that check file mtimes, change the mtimes to something in the far past so we can immediately tell if a file was modified and/or touched. This saves a decent amount of time on the upgrade tests which often check mtimes.
355 was a completely arbitrary time value, don't ask me why I picked it.
This is great. Now that I think about it, I always noticed this delay when running pactests with MODIFIED rules. I tested it on cygwin, and it worked perfectly. Nice time saver too. Before: pactest/pactest.py -p src/pacman/pacman -t pactest/tests/upgrade0* 24.46s user 22.75s system 66% cpu 1:10.92 total After: pactest/pactest.py -p src/pacman/pacman -t pactest/tests/upgrade0* 24.90s user 21.81s system 95% cpu 48.818 total
participants (3)
-
Dan McGee
-
Miklos Vajna
-
Xavier