Skip to content

Commit fe004a4

Browse files
avarttaylorr
authored andcommitted
run-command tests: test stdout of run_command_parallel()
Extend the tests added in c553c72 (run-command: add an asynchronous parallel child processor, 2015-12-15) to test stdout in addition to stderr. When the "ungroup" feature was added in fd3aaf5 (run-command: add an "ungroup" option to run_process_parallel(), 2022-06-07) its tests were made to test both the stdout and stderr, but these existing tests were left alone. Let's also exhaustively test our expected output here. Signed-off-by: Ævar Arnfjörð Bjarmason <[email protected]> Signed-off-by: Taylor Blau <[email protected]>
1 parent ac48da5 commit fe004a4

File tree

1 file changed

+10
-5
lines changed

1 file changed

+10
-5
lines changed

t/t0061-run-command.sh

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,8 @@ World
130130
EOF
131131

132132
test_expect_success 'run_command runs in parallel with more jobs available than tasks' '
133-
test-tool run-command run-command-parallel 5 sh -c "printf \"%s\n%s\n\" Hello World" 2>actual &&
133+
test-tool run-command run-command-parallel 5 sh -c "printf \"%s\n%s\n\" Hello World" >out 2>actual &&
134+
test_must_be_empty out &&
134135
test_cmp expect actual
135136
'
136137

@@ -141,7 +142,8 @@ test_expect_success 'run_command runs ungrouped in parallel with more jobs avail
141142
'
142143

143144
test_expect_success 'run_command runs in parallel with as many jobs as tasks' '
144-
test-tool run-command run-command-parallel 4 sh -c "printf \"%s\n%s\n\" Hello World" 2>actual &&
145+
test-tool run-command run-command-parallel 4 sh -c "printf \"%s\n%s\n\" Hello World" >out 2>actual &&
146+
test_must_be_empty out &&
145147
test_cmp expect actual
146148
'
147149

@@ -152,7 +154,8 @@ test_expect_success 'run_command runs ungrouped in parallel with as many jobs as
152154
'
153155

154156
test_expect_success 'run_command runs in parallel with more tasks than jobs available' '
155-
test-tool run-command run-command-parallel 3 sh -c "printf \"%s\n%s\n\" Hello World" 2>actual &&
157+
test-tool run-command run-command-parallel 3 sh -c "printf \"%s\n%s\n\" Hello World" >out 2>actual &&
158+
test_must_be_empty out &&
156159
test_cmp expect actual
157160
'
158161

@@ -172,7 +175,8 @@ asking for a quick stop
172175
EOF
173176

174177
test_expect_success 'run_command is asked to abort gracefully' '
175-
test-tool run-command run-command-abort 3 false 2>actual &&
178+
test-tool run-command run-command-abort 3 false >out 2>actual &&
179+
test_must_be_empty out &&
176180
test_cmp expect actual
177181
'
178182

@@ -187,7 +191,8 @@ no further jobs available
187191
EOF
188192

189193
test_expect_success 'run_command outputs ' '
190-
test-tool run-command run-command-no-jobs 3 sh -c "printf \"%s\n%s\n\" Hello World" 2>actual &&
194+
test-tool run-command run-command-no-jobs 3 sh -c "printf \"%s\n%s\n\" Hello World" >out 2>actual &&
195+
test_must_be_empty out &&
191196
test_cmp expect actual
192197
'
193198

0 commit comments

Comments
 (0)