Skip to content

Commit 967a3ea

Browse files
avargitster
authored andcommitted
pack-objects & index-pack: add test for --threads warning
Add a test for the warning that's emitted when --threads or pack.threads is provided under NO_PTHREADS=YesPlease. This uses the new PTHREADS prerequisite. The assertion for C_LOCALE_OUTPUT in the latter test is currently redundant, since unlike index-pack the pack-objects warnings aren't i18n'd. However they might be changed to be i18n'd in the future, and there's no harm in future-proofing the test. There's an existing bug in the implementation of pack-objects which this test currently tests for as-is. Details about the bug & the fix are included in a follow-up change. Signed-off-by: Ævar Arnfjörð Bjarmason <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 68c7d27 commit 967a3ea

File tree

1 file changed

+36
-0
lines changed

1 file changed

+36
-0
lines changed

t/t5300-pack-object.sh

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -421,6 +421,42 @@ test_expect_success 'index-pack <pack> works in non-repo' '
421421
test_path_is_file foo.idx
422422
'
423423

424+
test_expect_success !PTHREADS,C_LOCALE_OUTPUT 'index-pack --threads=N or pack.threads=N warns when no pthreads' '
425+
test_must_fail git index-pack --threads=2 2>err &&
426+
grep ^warning: err >warnings &&
427+
test_line_count = 1 warnings &&
428+
grep -F "no threads support, ignoring --threads=2" err &&
429+
430+
test_must_fail git -c pack.threads=2 index-pack 2>err &&
431+
grep ^warning: err >warnings &&
432+
test_line_count = 1 warnings &&
433+
grep -F "no threads support, ignoring pack.threads" err &&
434+
435+
test_must_fail git -c pack.threads=2 index-pack --threads=4 2>err &&
436+
grep ^warning: err >warnings &&
437+
test_line_count = 2 warnings &&
438+
grep -F "no threads support, ignoring --threads=4" err &&
439+
grep -F "no threads support, ignoring pack.threads" err
440+
'
441+
442+
test_expect_success !PTHREADS,C_LOCALE_OUTPUT 'pack-objects --threads=N or pack.threads=N warns when no pthreads' '
443+
git pack-objects --threads=2 --stdout --all </dev/null >/dev/null 2>err &&
444+
grep ^warning: err >warnings &&
445+
test_line_count = 1 warnings &&
446+
grep -F "no threads support, ignoring --threads" err &&
447+
448+
git -c pack.threads=2 pack-objects --stdout --all </dev/null >/dev/null 2>err &&
449+
grep ^warning: err >warnings &&
450+
test_must_fail test_line_count = 1 warnings &&
451+
grep -F "no threads support, ignoring pack.threads" err &&
452+
453+
git -c pack.threads=2 pack-objects --threads=4 --stdout --all </dev/null >/dev/null 2>err &&
454+
grep ^warning: err >warnings &&
455+
test_line_count = 2 warnings &&
456+
grep -F "no threads support, ignoring --threads" err &&
457+
grep -F "no threads support, ignoring pack.threads" err
458+
'
459+
424460
#
425461
# WARNING!
426462
#

0 commit comments

Comments
 (0)