aboutsummaryrefslogtreecommitdiff
path: root/paludis/util/output_wrapper_TEST_setup.sh
blob: b467150f501931adbf8c8b72f3f98b65d580ca32 (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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
#!/bin/bash
# vim: set ft=sh sw=4 sts=4 et :

mkdir output_wrapper_TEST_dir || exit 2
cd output_wrapper_TEST_dir

cat <<END > stdout_prefix.bash
echo one
echo two
echo three
END

cat <<END > stderr_prefix.bash
echo one 1>&2
echo two 1>&2
echo three 1>&2
END

cat <<END > mixed_prefix.bash
echo one 1>&2
echo two
echo three 1>&2
END

cat <<END > real_long_lines.bash
for (( a = 0 ; a < 1000 ; ++a )) ; do
    echo -n eeeeeeeeee 1>&2
    echo -n oooooooooo
done
echo 1>&2
echo
END

cat <<END > long_lines.bash
./outputwrapper --stdout-prefix 'o p ' --stderr-prefix 'e p ' -- \
    bash output_wrapper_TEST_dir/real_long_lines.bash \
    1>output_wrapper_TEST_dir/long_lines_stdout \
    2>output_wrapper_TEST_dir/long_lines_stderr
cat output_wrapper_TEST_dir/long_lines_stdout output_wrapper_TEST_dir/long_lines_stderr
END

cat <<END > real_no_trailing_newlines.bash
echo -n monkey
echo -n pants 1>&2
END

cat <<END > no_trailing_newlines.bash
./outputwrapper --stdout-prefix 'o p ' --stderr-prefix 'e p ' -- \
    bash output_wrapper_TEST_dir/real_no_trailing_newlines.bash \
    1>output_wrapper_TEST_dir/no_trailing_newlines_stdout \
    2>output_wrapper_TEST_dir/no_trailing_newlines_stderr
cat output_wrapper_TEST_dir/no_trailing_newlines_stdout output_wrapper_TEST_dir/no_trailing_newlines_stderr
END

cat <<END > exit_status.bash
echo lorem ipsum dolor
echo sit amet 1>&2
exit 5
END

cat <<END > no_wrap_blanks.bash
echo
echo one 1>&2
echo 1>&2
echo two
echo three 1>&2
echo 1>&2
echo
END

cat <<END > wrap_blanks.bash
echo
echo one 1>&2
echo 1>&2
echo two
echo three 1>&2
echo 1>&2
echo
END

cat <<END > discard_blank_output.bash
echo
echo 1>&2
echo
END

cat <<END > discard_blank_output_not_blank.bash
echo
echo 1>&2
echo
echo monkey
echo
END

cat <<END > discard_wrap_blank_output.bash
echo
echo 1>&2
echo
END

cat <<END > discard_wrap_blank_output_not_blank.bash
echo
echo 1>&2
echo
echo monkey
echo
END