diff options
Diffstat (limited to 'llvm/utils/lit')
-rw-r--r-- | llvm/utils/lit/lit/TestRunner.py | 4 | ||||
-rw-r--r-- | llvm/utils/lit/lit/run.py | 8 | ||||
-rw-r--r-- | llvm/utils/lit/tests/Inputs/shtest-ulimit/ulimit_reset.txt | 3 | ||||
-rw-r--r-- | llvm/utils/lit/tests/shtest-ulimit.py | 13 |
4 files changed, 21 insertions, 7 deletions
diff --git a/llvm/utils/lit/lit/TestRunner.py b/llvm/utils/lit/lit/TestRunner.py index a7e2705..f883145 100644 --- a/llvm/utils/lit/lit/TestRunner.py +++ b/llvm/utils/lit/lit/TestRunner.py @@ -92,12 +92,12 @@ class ShellEnvironment(object): we maintain a dir stack for pushd/popd. """ - def __init__(self, cwd, env, umask=-1, ulimit={}): + def __init__(self, cwd, env, umask=-1, ulimit=None): self.cwd = cwd self.env = dict(env) self.umask = umask self.dirStack = [] - self.ulimit = ulimit + self.ulimit = ulimit if ulimit else {} def change_dir(self, newdir): if os.path.isabs(newdir): diff --git a/llvm/utils/lit/lit/run.py b/llvm/utils/lit/lit/run.py index 62070e8..55de914 100644 --- a/llvm/utils/lit/lit/run.py +++ b/llvm/utils/lit/lit/run.py @@ -137,6 +137,10 @@ class Run(object): "Raised process limit from %d to %d" % (soft_limit, desired_limit) ) except Exception as ex: - # Warn, unless this is Windows or z/OS, in which case this is expected. - if os.name != "nt" and platform.system() != "OS/390": + # Warn, unless this is Windows, z/OS, or Cygwin in which case this is expected. + if ( + os.name != "nt" + and platform.system() != "OS/390" + and platform.sys.platform != "cygwin" + ): self.lit_config.warning("Failed to raise process limit: %s" % ex) diff --git a/llvm/utils/lit/tests/Inputs/shtest-ulimit/ulimit_reset.txt b/llvm/utils/lit/tests/Inputs/shtest-ulimit/ulimit_reset.txt new file mode 100644 index 0000000..011d6db --- /dev/null +++ b/llvm/utils/lit/tests/Inputs/shtest-ulimit/ulimit_reset.txt @@ -0,0 +1,3 @@ +# RUN: %{python} %S/print_limits.py +# Fail the test so that we can assert on the output. +# RUN: not echo return diff --git a/llvm/utils/lit/tests/shtest-ulimit.py b/llvm/utils/lit/tests/shtest-ulimit.py index e843277..09cd475 100644 --- a/llvm/utils/lit/tests/shtest-ulimit.py +++ b/llvm/utils/lit/tests/shtest-ulimit.py @@ -3,11 +3,15 @@ # ulimit does not work on non-POSIX platforms. # Solaris for some reason does not respect ulimit -n, so mark it unsupported # as well. -# UNSUPPORTED: system-windows, system-solaris +# UNSUPPORTED: system-windows, system-cygwin, system-solaris -# RUN: not %{lit} -a -v %{inputs}/shtest-ulimit | FileCheck %s +# RUN: %{python} %S/Inputs/shtest-ulimit/print_limits.py | grep RLIMIT_NOFILE \ +# RUN: | sed -n -e 's/.*=//p' | tr -d '\n' > %t.nofile_limit -# CHECK: -- Testing: 2 tests{{.*}} +# RUN: not %{lit} -a -v %{inputs}/shtest-ulimit --order=lexical \ +# RUN: | FileCheck -DBASE_NOFILE_LIMIT=%{readfile:%t.nofile_limit} %s + +# CHECK: -- Testing: 3 tests{{.*}} # CHECK-LABEL: FAIL: shtest-ulimit :: ulimit-bad-arg.txt ({{[^)]*}}) # CHECK: ulimit -n @@ -16,3 +20,6 @@ # CHECK-LABEL: FAIL: shtest-ulimit :: ulimit_okay.txt ({{[^)]*}}) # CHECK: ulimit -n 50 # CHECK: RLIMIT_NOFILE=50 + +# CHECK-LABEL: FAIL: shtest-ulimit :: ulimit_reset.txt ({{[^)]*}}) +# CHECK: RLIMIT_NOFILE=[[BASE_NOFILE_LIMIT]] |