git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH 0/3] tests: improve misc run-command, hook, submodule tests

From
Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Date
Oct 29, 2022, 02:59 UTC
Message-ID
<cover-0.3-00000000000-20221029T025520Z-avarab@gmail.com>

These are small tests changes left out of[1], which has since graduated as 6ae1a6eaf26 (Merge branch 'ab/run-hook-api-cleanup', 2022-10-27). The range-diff is to the relevant part of v2 of that topic.

I updated the commit message of 2/3, and adjusted 3/3 to make the diff smaller, but functionally the same as far as how the test works.

These changes have already been reviewed, and the only (understandable) objection was that they were side-tracks in v2 of [1] that we could do without in the context of that topic.

1. https://lore.kernel.org/git/cover-v3-00.15-00000000000-20221012T205712Z-avarab@gmail.com/
Ævar Arnfjörð Bjarmason (3):
  hook tests: fix redirection logic error in 96e7225b310
  submodule tests: reset "trace.out" between "grep" invocations
  run-command tests: test stdout of run_command_parallel()
 t/t0061-run-command.sh      | 15 ++++++++++-----
 t/t1800-hook.sh             |  2 +-
 t/t5526-fetch-submodules.sh |  8 ++++++++
 3 files changed, 19 insertions(+), 6 deletions(-)
Range-diff:
1:  bc51dfcb1be = 1:  1ba41a5842c hook tests: fix redirection logic error in 96e7225b310
2:  3027f5587a7 ! 2:  708375e3104 submodule tests: reset "trace.out" between "grep" invocations
    @@ Commit message
         not print out a "9 tasks" line, but let's be paranoid and stop
         implicitly assuming that that's the case.
     
    +    This change was originally left out of 51243f9f0f6 (run-command API:
    +    don't fall back on online_cpus(), 2022-10-12), which added the
    +    ">trace.out" seen at the end of the context.
    +
         Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
     
      ## t/t5526-fetch-submodules.sh ##
    @@ t/t5526-fetch-submodules.sh: test_expect_success "'fetch.recurseSubmodules=on-de
     +		>trace.out &&
     +
      		GIT_TRACE=$(pwd)/trace.out git fetch --jobs 9 &&
    --		grep "9 tasks" trace.out
    -+		grep "9 tasks" trace.out &&
    -+		>trace.out &&
    - 	)
    - '
    - 
    + 		grep "9 tasks" trace.out &&
    + 		>trace.out &&
3:  c4923358bbd ! 3:  6d6c2241bf2 run-command tests: test stdout of run_command_parallel()
    @@ t/t0061-run-command.sh: World
      
      test_expect_success 'run_command runs in parallel with more jobs available than tasks' '
     -	test-tool run-command run-command-parallel 5 sh -c "printf \"%s\n%s\n\" Hello World" 2>actual &&
    --	test_cmp expect actual
    -+	test-tool run-command run-command-parallel 5 sh -c "printf \"%s\n%s\n\" Hello World" >out 2>err &&
    ++	test-tool run-command run-command-parallel 5 sh -c "printf \"%s\n%s\n\" Hello World" >out 2>actual &&
     +	test_must_be_empty out &&
    -+	test_cmp expect err
    + 	test_cmp expect actual
      '
      
    - test_expect_success 'run_command runs ungrouped in parallel with more jobs available than tasks' '
     @@ t/t0061-run-command.sh: test_expect_success 'run_command runs ungrouped in parallel with more jobs avail
      '
      
      test_expect_success 'run_command runs in parallel with as many jobs as tasks' '
     -	test-tool run-command run-command-parallel 4 sh -c "printf \"%s\n%s\n\" Hello World" 2>actual &&
    --	test_cmp expect actual
    -+	test-tool run-command run-command-parallel 4 sh -c "printf \"%s\n%s\n\" Hello World" >out 2>err &&
    ++	test-tool run-command run-command-parallel 4 sh -c "printf \"%s\n%s\n\" Hello World" >out 2>actual &&
     +	test_must_be_empty out &&
    -+	test_cmp expect err
    + 	test_cmp expect actual
      '
      
    - test_expect_success 'run_command runs ungrouped in parallel with as many jobs as tasks' '
     @@ t/t0061-run-command.sh: test_expect_success 'run_command runs ungrouped in parallel with as many jobs as
      '
      
      test_expect_success 'run_command runs in parallel with more tasks than jobs available' '
     -	test-tool run-command run-command-parallel 3 sh -c "printf \"%s\n%s\n\" Hello World" 2>actual &&
    --	test_cmp expect actual
    -+	test-tool run-command run-command-parallel 3 sh -c "printf \"%s\n%s\n\" Hello World" >out 2>err &&
    ++	test-tool run-command run-command-parallel 3 sh -c "printf \"%s\n%s\n\" Hello World" >out 2>actual &&
     +	test_must_be_empty out &&
    -+	test_cmp expect err
    + 	test_cmp expect actual
      '
      
    - test_expect_success 'run_command runs ungrouped in parallel with more tasks than jobs available' '
     @@ t/t0061-run-command.sh: asking for a quick stop
      EOF
      
      test_expect_success 'run_command is asked to abort gracefully' '
     -	test-tool run-command run-command-abort 3 false 2>actual &&
    --	test_cmp expect actual
    -+	test-tool run-command run-command-abort 3 false >out 2>err &&
    ++	test-tool run-command run-command-abort 3 false >out 2>actual &&
     +	test_must_be_empty out &&
    -+	test_cmp expect err
    + 	test_cmp expect actual
      '
      
    - test_expect_success 'run_command is asked to abort gracefully (ungroup)' '
     @@ t/t0061-run-command.sh: no further jobs available
      EOF
      
      test_expect_success 'run_command outputs ' '
     -	test-tool run-command run-command-no-jobs 3 sh -c "printf \"%s\n%s\n\" Hello World" 2>actual &&
    --	test_cmp expect actual
    -+	test-tool run-command run-command-no-jobs 3 sh -c "printf \"%s\n%s\n\" Hello World" >out 2>err &&
    ++	test-tool run-command run-command-no-jobs 3 sh -c "printf \"%s\n%s\n\" Hello World" >out 2>actual &&
     +	test_must_be_empty out &&
    -+	test_cmp expect err
    + 	test_cmp expect actual
      '
      
    - test_expect_success 'run_command outputs (ungroup) ' '
-- 
2.38.0.1280.g8136eb6fab2
Next: Ævar Arnfjörð Bjarmason
Message 1 of 11 in “tests: improve misc run-command, hook, submodule tests”
  1. 0/3 tests: improve misc run-command, hook, submodule testsÆvar Arnfjörð Bjarmason, Oct 29, 2022
  2. 1/3 hook tests: fix redirection logic error in 96e7225b310Ævar Arnfjörð Bjarmason, Oct 29, 2022
  3. Taylor BlauOct 29, 2022
  4. Ævar Arnfjörð BjarmasonOct 31, 2022
  5. Taylor BlauOct 31, 2022
  6. 2/3 submodule tests: reset "trace.out" between "grep" invocationsÆvar Arnfjörð Bjarmason, Oct 29, 2022
  7. Taylor BlauOct 29, 2022
  8. Ævar Arnfjörð BjarmasonOct 31, 2022
  9. Taylor BlauOct 31, 2022
  10. 3/3 run-command tests: test stdout of run_command_parallel()Ævar Arnfjörð Bjarmason, Oct 29, 2022
  11. Taylor BlauOct 29, 2022

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.