Message ID | patch-v2-2.8-7b1220b641e-20210920T225701Z-avarab@gmail.com (mailing list archive) |
---|---|
State | Superseded |
Headers | show |
Series | progress: assert "global_progress" + test fixes / cleanup | expand |
On Tue, Sep 21, 2021 at 01:09:23AM +0200, Ævar Arnfjörð Bjarmason wrote: > > Test what happens when we "stop" without a "start", omit the "stop" > after a "start", or try to start two concurrent progress bars. This > extends the trace2 tests added in 98a13647408 (trace2: log progress > time and throughput, 2020-05-12). I wondered whether these tests were more testing the helper, rather than testing the API, but I think this is a good change - you're correct that having the helper assume correct usage by automatically start_progress()ing and stop_progress()ing was an oversight. Thanks. Diff is pretty straightforward. Reviewed-by: Emily Shaffer <emilyshaffer@google.com>
diff --git a/t/t0500-progress-display.sh b/t/t0500-progress-display.sh index ca96ac1fa55..ffa819ca1db 100755 --- a/t/t0500-progress-display.sh +++ b/t/t0500-progress-display.sh @@ -323,4 +323,37 @@ test_expect_success 'progress generates traces' ' grep "\"key\":\"total_bytes\",\"value\":\"409600\"" trace.event ' +test_expect_success 'progress generates traces: stop / start' ' + cat >in <<-\EOF && + start + stop + EOF + + GIT_TRACE2_EVENT="$(pwd)/trace-startstop.event" test-tool progress \ + <in 2>stderr && + test_region progress "Working hard" trace-startstop.event +' + +test_expect_success 'progress generates traces: start without stop' ' + cat >in <<-\EOF && + start + EOF + + GIT_TRACE2_EVENT="$(pwd)/trace-start.event" test-tool progress \ + <in 2>stderr && + grep region_enter.*progress trace-start.event && + ! grep region_leave.*progress trace-start.event +' + +test_expect_success 'progress generates traces: stop without start' ' + cat >in <<-\EOF && + stop + EOF + + GIT_TRACE2_EVENT="$(pwd)/trace-stop.event" test-tool progress \ + <in 2>stderr && + ! grep region_enter.*progress trace-stop.event && + ! grep region_leave.*progress trace-stop.event +' + test_done
Test what happens when we "stop" without a "start", omit the "stop" after a "start", or try to start two concurrent progress bars. This extends the trace2 tests added in 98a13647408 (trace2: log progress time and throughput, 2020-05-12). Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com> --- t/t0500-progress-display.sh | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+)