regtests: enhancements for Windows

This commit is contained in:
Stéphane Lesimple
2020-08-25 13:06:26 +02:00
parent 196506c3dd
commit d8e0dab436
5 changed files with 25 additions and 9 deletions

View File

@@ -6,6 +6,7 @@ SETVERSION="0.80"
DATABASE=./database
RNDSEQ="./fixed-random-sequence"
NON_EXISTENT_DEVICE=/dev/sdz
ISODIR=/var/tmp/regtest
if ! test -d $ISODIR; then
echo "$ISODIR does not exist."
@@ -29,8 +30,16 @@ fi
# Assemble sed expressions for removal of variable output contents
SED_REMOVE_ISO_DIR=$(echo "${ISODIR}/" | sed -e "s/\//\\\\\//g")
SED_REMOVE_DEV_SHM=$(echo "/dev/shm/" | sed -e "s/\//\\\\\//g")
SED_REMOVE_ISO_DIR="([a-zA-Z]:/[a-zA-Z0-9/]+)?${ISODIR}/"
# For MSYS2
if [ -n "$ORIGINAL_TEMP" ]; then
ISODIR="$ORIGINAL_TEMP"
# /c/ => C:/
SED_REMOVE_ISO_DIR="$(echo "$ISODIR" | cut -c2 | tr a-z A-Z):$(echo "$ISODIR" | cut -c3-)/"
NON_EXISTENT_DEVICE=V:
fi
# Usage
@@ -196,20 +205,20 @@ function run_regtest()
# ignore the memory tracker line when no memory leaks
# have been found
grep -v "dvdisaster: No memory leaks found." $NEWLOG >$TMPLOG
grep -va "dvdisaster: No memory leaks found." $NEWLOG >$TMPLOG
mv $TMPLOG $NEWLOG
# ignore log lines specified by user
if test -n "$IGNORE_LOG_LINE"; then
egrep -v "$IGNORE_LOG_LINE" $NEWLOG >$TMPLOG
grep -Eva "$IGNORE_LOG_LINE" $NEWLOG >$TMPLOG
mv $TMPLOG $NEWLOG
fi
filter=cat
echo "$options" | grep -qw SORTED && filter=sort
if ! diff <(tail -n +3 $REFLOG | $filter) <(sed -e "s/${SED_REMOVE_ISO_DIR}//g" $NEWLOG | $filter) >${DIFFLOG}; then
if ! diff <(tail -n +3 $REFLOG | $filter) <(sed -re "s=${SED_REMOVE_ISO_DIR}==g" $NEWLOG | $filter) >${DIFFLOG}; then
printf "%b\r%b\n" "BAD; diffs found (<expected; >created):" "[\e[31m✘\e[0m]"
cat ${DIFFLOG}
@@ -220,7 +229,7 @@ function run_regtest()
if test "$answer" == "a"; then
cp $REFLOG $LOGDIR
head -n 2 $LOGDIR/${CODEC_PREFIX}_${testsymbol} >$REFLOG
sed -e "s/${SED_REMOVE_ISO_DIR}//g" $NEWLOG >>$REFLOG
sed -e "s=${SED_REMOVE_ISO_DIR}==g" $NEWLOG >>$REFLOG
pass="skip"
else
pass="false"

View File

@@ -659,7 +659,7 @@ fi
if try "scanning image, device not existant" scan_no_device; then
extra_args="--debug -d /dev/sdz --sim-cd=$MASTERISO --fixed-speed-values"
extra_args="--debug -d $NON_EXISTENT_DEVICE --sim-cd=$MASTERISO --fixed-speed-values"
run_regtest scan_no_device "--spinup-delay=0 -s" $ISODIR/no.iso $ISODIR/no.ecc
fi
@@ -946,7 +946,7 @@ fi
if try "reading image, device not existant" read_no_device; then
run_regtest read_no_device "--debug --sim-cd=$MASTERISO --fixed-speed-values --spinup-delay=0 -d /dev/sdz -r" $TMPISO $ISODIR/no.ecc
run_regtest read_no_device "--debug --sim-cd=$MASTERISO --fixed-speed-values --spinup-delay=0 -d $NON_EXISTENT_DEVICE -r" $TMPISO $ISODIR/no.ecc
fi
# Read image from device with insufficient permissions
@@ -1499,7 +1499,7 @@ fi
if try "reading image, device not existant" adaptive_no_device; then
run_regtest adaptive_no_device "--debug --sim-cd=$MASTERISO --fixed-speed-values --spinup-delay=0 -d /dev/sdz -r --adaptive-read" $TMPISO $ISODIR/no.ecc
run_regtest adaptive_no_device "--debug --sim-cd=$MASTERISO --fixed-speed-values --spinup-delay=0 -d $NON_EXISTENT_DEVICE -r --adaptive-read" $TMPISO $ISODIR/no.ecc
fi
# Read image from device with insufficient permissions
@@ -1785,3 +1785,5 @@ if try "reading medium containing dead sector markers" adaptive_medium_with_dsm;
run_regtest adaptive_medium_with_dsm "--debug --sim-cd=$SIMISO --fixed-speed-values --spinup-delay=0 -r --adaptive-read" $TMPISO $ISODIR/no.ecc
fi
exit $nbfailed

View File

@@ -2139,3 +2139,4 @@ if try "reading RS02 image with non-matching RS03 ecc file" read_with_wrong_rs03
run_regtest read_with_wrong_rs03_file "--debug --sim-cd=$SIMISO --fixed-speed-values --spinup-delay=0 -r" $TMPISO $TMPECC
fi
exit $nbfailed

View File

@@ -1493,3 +1493,5 @@ fi
### Reading tests (adaptive)
REGTEST_SECTION="Reading tests (adaptive)"
exit $nbfailed

View File

@@ -2070,3 +2070,5 @@ fi
### Reading tests (adaptive)
REGTEST_SECTION="Reading tests (adaptive)"
exit $nbfailed