blob: 02e443cbfaabc879004f0dc10cb3a07eccafc32d (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
|
#!/bin/sh
# z/OS: what file tagging and conversion cost (n/a elsewhere).
#
# Run on z/OS against /bin/sh and bash: sh bench/run.sh ./zash /bin/sh bash
# Each part does the same work in every shell; the output is only counts,
# so it compares equal across shells. The scratch files are created in
# the current directory (bench/run.sh runs each bench in a work dir).
[ "$(uname -s)" = OS/390 ] || exit 3
command -v chtag >/dev/null 2>&1 || exit 3
# 1. Redirections creating new files: untagged (the default) ...
i=0
while [ $i -lt 1000 ]; do
echo line >u$i
i=$((i + 1))
done
# ... and with a deferred text tag on each new file.
_TAG_REDIR_OUT=TXT
export _TAG_REDIR_OUT
i=0
while [ $i -lt 1000 ]; do
echo line >t$i
i=$((i + 1))
done
unset _TAG_REDIR_OUT
rm -f u* t*
# 2. Sourcing a script tagged ISO8859-1 and one tagged IBM-1047: one of
# them needs conversion whichever character set the shell is.
_TAG_REDIR_OUT=BIN printf '\145\143\150\157\040\170\012' >s819
chtag -tc ISO8859-1 s819
_TAG_REDIR_OUT=BIN printf '\205\203\210\226\100\247\025' >s1047
chtag -tc IBM-1047 s1047
n=0
i=0
while [ $i -lt 500 ]; do
. ./s819 >/dev/null
. ./s1047 >/dev/null
n=$((n + 2))
i=$((i + 1))
done
echo "sourced $n"
# 3. Here-documents read by a builtin.
i=0
while [ $i -lt 2000 ]; do
read -r x <<END
here $i
END
i=$((i + 1))
done
echo "heredocs $i"
# 4. Pipelines from the shell to an EBCDIC program, and back.
i=0
while [ $i -lt 200 ]; do
echo "pipe $i" | cat >/dev/null
i=$((i + 1))
done
echo "pipes $i"
i=0
while [ $i -lt 200 ]; do
x=$(uname -s)
i=$((i + 1))
done
echo "cmdsubs $i $x"
|