OILS / test / torture.sh View on Github | oils.pub

37 lines, 11 significant
1#!/usr/bin/env bash
2#
3# Torture the shell
4#
5# Usage:
6# test/torture.sh <function name>
7
8: ${LIB_OSH=stdlib/osh}
9source $LIB_OSH/task-five.sh
10
11test-infinite-func() {
12 local sh=${1:-bash}
13
14 # bash goes forever?
15 # mksh segfaults
16 # ash: default
17 # dash limits to 1000; zsh limits to FUNCNEST
18 # osh: seg fault
19
20 $sh -c 'f() { f; }; f'
21}
22
23test-infinite-redir() {
24 local sh=${1:-bash}
25
26 # dash: 1: Maximum function recursion depth (1000) reached
27
28 # bash environment: redirection error: cannot duplicate fd: Too many open files
29 # environment: line 1: /dev/null: Too many open files
30
31 # osh finds this
32 # [ -c flag ]:1: I/O error applying redirect: Too many open files
33
34 $sh -c 'f() { f > /dev/null; }; f'
35}
36
37task-five "$@"