diff --git a/tests/test-remotefilelog-datapack.py b/tests/test-remotefilelog-datapack.py --- a/tests/test-remotefilelog-datapack.py +++ b/tests/test-remotefilelog-datapack.py @@ -4,7 +4,6 @@ import hashlib import os import random -import resource import shutil import stat import struct @@ -39,6 +38,7 @@ class datapacktestsbase(object): def __init__(self, datapackreader, paramsavailable): self.datapackreader = datapackreader + self.iscdatapack = not paramsavailable self.paramsavailable = paramsavailable def setUp(self): @@ -276,6 +276,12 @@ def testPacksCache(self): """Test that we remember the most recent packs while fetching the delta chain.""" + # This test will require many file descriptors. Python's mmap objects + # will keep an internal fd to support mmap.resize, which could exhaust + # the fd limit. Therefore we only run the test with the native code + # path, which does not keep fd open for mmaps. + if not self.iscdatapack: + raise unittest.SkipTest('ignored for Python code path') packdir = self.makeTempDir() deltachains = [] @@ -300,29 +306,20 @@ self.createPack(chain, packdir) deltachains.append(chain) - try: - store = datapackstore(mercurial.ui.ui(), packdir) + store = datapackstore(mercurial.ui.ui(), packdir, self.iscdatapack) - random.shuffle(deltachains) - for randomchain in deltachains: - revision = random.choice(randomchain) - chain = store.getdeltachain(revision[0], revision[1]) + random.shuffle(deltachains) + for randomchain in deltachains: + revision = random.choice(randomchain) + chain = store.getdeltachain(revision[0], revision[1]) - mostrecentpack = next(iter(store.packs), None) - self.assertEquals( - mostrecentpack.getdeltachain(revision[0], revision[1]), - chain - ) + mostrecentpack = next(iter(store.packs), None) + self.assertEquals( + mostrecentpack.getdeltachain(revision[0], revision[1]), + chain + ) - self.assertEquals(randomchain.index(revision) + 1, len(chain)) - except Exception as ex: - print('Exception: %r' % ex) - # Print out RLIMIT_NOFILE - print('RLIMIT_NOFILE: %r' - % (resource.getrlimit(resource.RLIMIT_NOFILE),)) - # Print debug information about what files are opened by the - # current process. - os.system('lsof -p %s' % os.getpid()) + self.assertEquals(randomchain.index(revision) + 1, len(chain)) # perf test off by default since it's slow def _testIndexPerf(self):