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 = [] @@ -315,14 +321,21 @@ ) 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()) + except Exception: + try: + import resource + except ImportError: + # Windows does not have "resource" module + pass + else: + # 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()) + finally: + raise # perf test off by default since it's slow def _testIndexPerf(self):