mirror of
https://github.com/moparisthebest/pacman
synced 2024-08-13 17:03:46 -04:00
pactest: only snapshot needed files
Only a few of our tests need file snapshots at all and most of them only need a few files. Taking snapshots of the entire test environment for every single test is a massive waste. Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com> Signed-off-by: Allan McRae <allan@archlinux.org>
This commit is contained in:
parent
32413ad44b
commit
85c80542a5
@ -32,6 +32,12 @@ class pmrule(object):
|
|||||||
def __str__(self):
|
def __str__(self):
|
||||||
return self.rule
|
return self.rule
|
||||||
|
|
||||||
|
def snapshots_needed(self):
|
||||||
|
(testname, args) = self.rule.split("=")
|
||||||
|
if testname == "FILE_MODIFIED" or testname == "!FILE_MODIFIED":
|
||||||
|
return [args]
|
||||||
|
return []
|
||||||
|
|
||||||
def check(self, test):
|
def check(self, test):
|
||||||
"""
|
"""
|
||||||
"""
|
"""
|
||||||
|
@ -183,13 +183,18 @@ class pmtest(object):
|
|||||||
|
|
||||||
# Done.
|
# Done.
|
||||||
vprint(" Taking a snapshot of the file system")
|
vprint(" Taking a snapshot of the file system")
|
||||||
for roots, dirs, files in os.walk(self.root):
|
for filename in self.snapshots_needed():
|
||||||
for i in files:
|
f = pmfile.PacmanFile(self.root, filename)
|
||||||
filename = os.path.join(roots, i)
|
|
||||||
f = pmfile.PacmanFile(self.root, filename.replace(self.root + "/", ""))
|
|
||||||
self.files.append(f)
|
self.files.append(f)
|
||||||
vprint("\t%s" % f.name)
|
vprint("\t%s" % f.name)
|
||||||
|
|
||||||
|
|
||||||
|
def snapshots_needed(self):
|
||||||
|
files = set()
|
||||||
|
for r in self.rules:
|
||||||
|
files.update(r.snapshots_needed())
|
||||||
|
return files
|
||||||
|
|
||||||
def run(self, pacman):
|
def run(self, pacman):
|
||||||
if os.path.isfile(util.PM_LOCK):
|
if os.path.isfile(util.PM_LOCK):
|
||||||
tap.bail("\tERROR: another pacman session is on-going -- skipping")
|
tap.bail("\tERROR: another pacman session is on-going -- skipping")
|
||||||
|
Loading…
Reference in New Issue
Block a user