blob: ce3d81227a0f0c9fece708f883d14cd6c1e2c3d3 [file] [log] [blame]
Jeff Kingf5f5e7f2017-03-16 18:09:36 -04001#!/bin/sh
2
3test_description='test sha1 collision detection'
Ævar Arnfjörð Bjarmasonfdc8f792021-10-12 15:56:38 +02004
Jeff Kingf5f5e7f2017-03-16 18:09:36 -04005. ./test-lib.sh
6TEST_DATA="$TEST_DIRECTORY/t0013"
7
Ævar Arnfjörð Bjarmasondc1cf352022-11-07 22:23:10 +01008test_lazy_prereq SHA1_IS_SHA1DC 'test-tool sha1-is-sha1dc'
9
10if ! test_have_prereq SHA1_IS_SHA1DC
Jeff Kingf5f5e7f2017-03-16 18:09:36 -040011then
Ævar Arnfjörð Bjarmasondc1cf352022-11-07 22:23:10 +010012 skip_all='skipping sha1 collision tests, not using sha1collisiondetection'
Jeff Kingf5f5e7f2017-03-16 18:09:36 -040013 test_done
14fi
15
16test_expect_success 'test-sha1 detects shattered pdf' '
Nguyễn Thái Ngọc Duydae2ff92018-03-24 08:44:32 +010017 test_must_fail test-tool sha1 <"$TEST_DATA/shattered-1.pdf" 2>err &&
Junio C Hamano67892752023-10-31 14:23:30 +090018 test_grep collision err &&
Jeff Kingf5f5e7f2017-03-16 18:09:36 -040019 grep 38762cf7f55934b34d179ae6a4c80cadccbb7f0a err
20'
21
22test_done