fork/fish-shell

git clone https://git.julia.blue/fork/fish-shell

NahorFix failing system tests on Cygwin440e7fcbc

master
2.6 KiB87 linesraw
1#RUN: %fish %s
2
3ulimit --core-size
4#CHECK: {{unlimited|\d+}}
5ulimit --core-size 0
6ulimit --core-size
7#CHECK: 0
8
9ulimit 4352353252352352334
10#CHECKERR: ulimit: Invalid limit '4352353252352352334'
11#CHECKERR:
12#CHECKERR: {{.*}}checks/ulimit.fish (line {{\d+}}):
13#CHECKERR: ulimit 4352353252352352334
14#CHECKERR: ^
15#CHECKERR: (Type 'help ulimit' for related documentation)
16
17# Try to increase a hard limit
18# Since limits vary between OSes and distributions, we need to find
19# a non-unlimited dynamically
20set -l ulimit_opts -c -d -f -n -s -t -u
21for ulimit_opt in $ulimit_opts
22    set -l max (ulimit -H $ulimit_opt 2>/dev/null)
23    if contains -- "$max" "" unlimited
24        continue
25    end
26    set found true
27    echo "Using $ulimit_opt to increase hard limit" >&2
28    ulimit -H $ulimit_opt (math $max + 1) >/dev/null
29    and if __fish_is_cygwin
30        echo "ulimit: Permission denied when changing resource of type 'Fake result for  Cygwin'" >&2
31    end
32    break
33end
34if not set -q found
35    echo "All common hard ulimits are unlimited, cannot increase them" >&2
36end
37#CHECKERR: Using {{-.}} to increase hard limit
38#CHECKERR: ulimit: Permission denied when changing resource of type '{{.+}}'
39
40# Try to lower a hard limit below its soft one
41set -e found
42for ulimit_opt in $ulimit_opts
43    set -l min (ulimit -S $ulimit_opt 2>/dev/null)
44    if contains -- "$min" "" 0
45        continue
46    end
47    if test $min = unlimited
48        set min 1024
49    end
50    set found true
51    echo "Using $ulimit_opt to lower hard limit" >&2
52    ulimit -H $ulimit_opt (math $min - 1) >/dev/null
53    and if test (__fish_uname) = FreeBSD
54        echo "ulimit: FreeBSD doesn't fail unlike other platforms, so fake it" >&2
55    end
56    break
57end
58if not set -q found
59    echo "All common soft ulimits are 0, cannot decrease hard ulimits below them" >&2
60end
61#CHECKERR: Using {{-.}} to lower hard limit
62#CHECKERR: ulimit: {{.+}}
63
64if test (__fish_uname) = Linux
65    ulimit -K 1024
66else
67    ulimit -q 1024
68end
69#CHECKERR: ulimit: Resource limit not available on this operating system
70#CHECKERR: {{.*}}checks/ulimit.fish (line {{\d+}}):
71#CHECKERR: ulimit -{{.}} 1024
72#CHECKERR: ^
73#CHECKERR: (Type 'help ulimit' for related documentation)
74
75ulimit --core-size 0 1 2
76#CHECKERR: ulimit: too many arguments
77#CHECKERR: {{.*}}checks/ulimit.fish (line {{\d+}}):
78#CHECKERR: ulimit --core-size 0 1 2
79#CHECKERR: ^
80#CHECKERR: (Type 'help ulimit' for related documentation)
81
82ulimit --core-size abc
83#CHECKERR: ulimit: Invalid limit 'abc'
84#CHECKERR: {{.*}}checks/ulimit.fish (line {{\d+}}):
85#CHECKERR: ulimit --core-size abc
86#CHECKERR: ^
87#CHECKERR: (Type 'help ulimit' for related documentation)