php-spark/tools/makeself-2.4.5/test/corrupttest

39 lines
823 B
Plaintext
Raw Normal View History

2021-12-08 23:58:28 +00:00
#!/bin/bash
# Test that corrupted archives actually fail validation
SUT=$(realpath $(dirname $0)/../makeself.sh)
SOURCE=$(realpath ..)
setupTests() {
temp=`mktemp -d -t appendtest.XXXXX`
cd "$temp"
mkdir archive
cp -a $SOURCE archive/
$SUT $* archive makeself-test.run "Test $*" echo Testing --tar-extra="--exclude .git"
}
testExtraBytes() {
setupTests --sha256
./makeself-test.run --check
assertEqual $? 0
echo "Adding a bunch of random characters at the end!!" >> makeself-test.run
./makeself-test.run --check
assertNotEqual $? 0
}
testTruncated() {
setupTests --sha256
./makeself-test.run --check
assertEqual $? 0
dd if=makeself-test.run of=truncated.run bs=1 count=34303
bash truncated.run --check
assertNotEqual $? 0
}
source bashunit/bashunit.bash