mirror of
https://github.com/megastep/makeself.git
synced 2025-09-26 19:41:12 +08:00

* move from bashunit to shunit2 move run-tests.sh to test simplify build.yml * back shunit2 to submodule
46 lines
941 B
Bash
46 lines
941 B
Bash
#!/bin/bash
|
|
set -eu
|
|
THIS="$(realpath "$0")"
|
|
THISDIR="$(dirname "${THIS}")"
|
|
SRCDIR="$(dirname "${THISDIR}")"
|
|
SUT="${SRCDIR}/makeself.sh"
|
|
|
|
# Test that corrupted archives actually fail validation
|
|
|
|
cd "$THISDIR"
|
|
|
|
setupTests() {
|
|
temp_path="$(mktemp -dt appendtest.XXXXXX)"
|
|
cd "$temp_path"
|
|
mkdir -p archive
|
|
cp -a "$SRCDIR" archive/
|
|
"$SUT" "$*" archive makeself-test.run "Test $*" echo Testing --tar-extra="--exclude .git"
|
|
}
|
|
|
|
testExtraBytes() {
|
|
setupTests --sha256
|
|
|
|
./makeself-test.run --check
|
|
assertEquals $? 0
|
|
|
|
echo "Adding a bunch of random characters at the end!!" >> makeself-test.run
|
|
|
|
./makeself-test.run --check
|
|
assertNotEquals $? 0
|
|
}
|
|
|
|
testTruncated() {
|
|
setupTests --sha256
|
|
|
|
./makeself-test.run --check
|
|
assertEquals $? 0
|
|
|
|
dd if=makeself-test.run of=truncated.run bs=1 count=34303
|
|
bash truncated.run --check
|
|
assertNotEquals $? 0
|
|
}
|
|
|
|
# Load and run shUnit2.
|
|
source "./shunit2/shunit2"
|
|
|