Test directory

This commit is contained in:
Davide Berardi 2024-02-19 12:55:40 +01:00
parent b63d124680
commit 3d3deb0a9e
1 changed files with 41 additions and 0 deletions

41
test/run-tests.sh Executable file
View File

@ -0,0 +1,41 @@
#!/bin/sh
set -eu
test000() {
echo "[Test 000 ] check compilation"
cd ..
# Standard compilation
echo "[Test 000 a] Debug compilation "
make CFLAGS=-DDEBUG clean all
file ./snappy-fox | grep -q ELF
echo "[Test 000 b] Normal compilation "
make clean all
file ./snappy-fox | grep -q ELF
echo "[Test 000 ] ok"
}
test001() {
echo "[Test 001 ]check standard framed run"
cd ..
echo "[Test 001 a] normal image"
./snappy-fox example/exampleimage.snappy example/exampleimage.jpg
file example/exampleimage.jpg | grep -q JPEG
# The example image is CRC corrupted
echo "[Test 001 b] CRC Corruption"
! ./snappy-fox --consider_crc_errors \
example/exampleimage.snappy example/exampleimage.jpg
# Test on the corrupted image
echo "[Test 001 c] Corrupted image"
! ./snappy-fox \
example/alteredimage.snappy example/alteredimage.jpg
echo "[Test 001 c] Corrupted image ignoring offset errors"
./snappy-fox --ignore_offset_errors \
example/alteredimage.snappy example/alteredimage.jpg
echo "[Test 001 ] ok"
}
( test000 )
( test001 )