Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Add new entry in Release_Notes.
[simgrid.git] / tools / tesh / set-output-sort.tesh
1 #!/usr/bin/env tesh
2
3 p This tests whether TESH correctly sorts command output
4
5 < p Test sorting and filtering of output
6 <
7 < $ true
8 <
9 < ! output sort
10 < $ true
11 <
12 < $ printf 'profiling: foo\n'
13 <
14 < $ printf 'profiling: foo'
15 <
16 < ! output sort
17 < $ printf 'profiling: foo\n'
18 <
19 < ! output sort
20 < $ printf 'profiling: foo'
21 <
22 < $ printf 'a\nb\nc\nd\n'
23 < > a
24 < > b
25 < > c
26 < > d
27 <
28 < $ printf 'a\nb\nc\nd'
29 < > a
30 < > b
31 < > c
32 < > d
33 <
34 < ! output sort
35 < $ printf 'c\nd\nb\na\n'
36 < > a
37 < > b
38 < > c
39 < > d
40 <
41 < ! output sort
42 < $ printf 'c\nd\nb\na'
43 < > a
44 < > b
45 < > c
46 < > d
47 <
48 < $ printf 'a\nprofiling: foo\nprofiling: bar\nb\nc\nd\nprofiling: baz\n'
49 < > a
50 < > b
51 < > c
52 < > d
53 <
54 < $ printf 'a\nprofiling: foo\nprofiling: bar\nb\nc\nd\nprofiling: baz'
55 < > a
56 < > b
57 < > c
58 < > d
59 <
60 < ! output sort
61 < $ printf 'c\nprofiling: foo\nprofiling: bar\nd\nb\na\nprofiling: baz\n'
62 < > a
63 < > b
64 < > c
65 < > d
66 <
67 < ! output sort
68 < $ printf 'c\nprofiling: foo\nprofiling: bar\nd\nb\na\nprofiling: baz'
69 < > a
70 < > b
71 < > c
72 < > d
73 $ ${bindir:=.}/tesh --ignore-jenkins
74 > Ignore all cruft seen on SimGrid's continuous integration servers
75 > Test suite from stdin
76 > [(stdin):1] Test sorting and filtering of output
77 > [(stdin):3] true
78
79 > [(stdin):6] true
80
81 > [(stdin):8] printf 'profiling: foo\n'
82
83 > [(stdin):10] printf 'profiling: foo'
84
85 > [(stdin):13] printf 'profiling: foo\n'
86
87 > [(stdin):16] printf 'profiling: foo'
88
89 > [(stdin):18] printf 'a\nb\nc\nd\n'
90
91 > [(stdin):24] printf 'a\nb\nc\nd'
92
93 > [(stdin):31] printf 'c\nd\nb\na\n'
94
95 > [(stdin):38] printf 'c\nd\nb\na'
96
97 > [(stdin):44] printf 'a\nprofiling: foo\nprofiling: bar\nb\nc\nd\nprofiling: baz\n'
98
99 > [(stdin):50] printf 'a\nprofiling: foo\nprofiling: bar\nb\nc\nd\nprofiling: baz'
100
101 > [(stdin):57] printf 'c\nprofiling: foo\nprofiling: bar\nd\nb\na\nprofiling: baz\n'
102
103 > [(stdin):64] printf 'c\nprofiling: foo\nprofiling: bar\nd\nb\na\nprofiling: baz'
104
105 > Test suite from stdin OK
106
107 p Check the Right Prefix Length (19) for "output sort"
108 ! output sort 19
109 < 12345678901234567 B line
110 < 12345678901234567 A line
111 $ cat
112 > 12345678901234567 A line
113 > 12345678901234567 B line
114
115 ! output sort 19
116 < 123456789012345678 B line
117 < 123456789012345678 A line
118 $ cat
119 > 123456789012345678 B line
120 > 123456789012345678 A line
121
122 ! expect return 2
123 ! output ignore
124 < ! output sort 19
125 < < 123456789012345678 B line
126 < < 123456789012345678 A line
127 < $ cat
128 < > 123456789012345678 A line
129 < > 123456789012345678 B line
130 $ ${bindir:=.}/tesh
131
132 p Check user-defined prefix length for "output sort"
133 ! output sort 5
134 < 000 B line
135 < 000 A line
136 $ cat
137 > 000 A line
138 > 000 B line
139
140 ! output sort 4
141 < 000 B line
142 < 000 A line
143 $ cat
144 > 000 B line
145 > 000 A line
146
147 ! expect return 2
148 ! output ignore
149 < ! output sort 4
150 < < 000 B line
151 < < 000 A line
152 < $ cat
153 < > 000 A line
154 < > 000 B line
155 $ ${bindir:=.}/tesh