Send patches - preferably formatted by git format-patch - to patches at archlinux32 dot org.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDan McGee <dan@archlinux.org>2008-07-31 21:16:30 -0500
committerDan McGee <dan@archlinux.org>2008-08-23 09:20:32 -0500
commitb3033a59e922684a41b00bd94f8976995dd015da (patch)
tree569ddceb5dcd3440642a7f6195c4d3821aa9278e
parent5b51dbb11e2087e1055be24b486502be806b5e13 (diff)
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>
-rwxr-xr-xpactest/pmenv.py8
-rwxr-xr-xpactest/pmfile.py8
2 files changed, 13 insertions, 3 deletions
diff --git a/pactest/pmenv.py b/pactest/pmenv.py
index e9d0b4c9..cc433dd0 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 21baf017..ab4aa2c7 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")