Compare commits

...

1 Commits

Author SHA1 Message Date
Stéphane Lesimple
08863f0f85 chore: support parallel regtests 2025-05-04 12:35:44 +02:00
7 changed files with 75 additions and 30 deletions

View File

@@ -54,7 +54,7 @@ jobs:
- name: regression tests - name: regression tests
if: matrix.printf == 'normal' if: matrix.printf == 'normal'
env: env:
REGTEST_NO_UTF8: 1 REGTEST_PARALLEL: 1
run: mkdir /var/tmp/regtest && ./regtest/runtests.sh run: mkdir /var/tmp/regtest && ./regtest/runtests.sh
win: win:
runs-on: windows-latest runs-on: windows-latest
@@ -120,7 +120,7 @@ jobs:
- name: run regression tests - name: run regression tests
if: matrix.printf == 'normal' if: matrix.printf == 'normal'
env: env:
REGTEST_NO_UTF8: 1 REGTEST_PARALLEL: 1
run: mkdir /var/tmp/regtest && ./regtest/runtests.sh run: mkdir /var/tmp/regtest && ./regtest/runtests.sh
linux: linux:
@@ -170,5 +170,5 @@ jobs:
- name: regression tests - name: regression tests
if: matrix.printf == 'normal' if: matrix.printf == 'normal'
env: env:
REGTEST_NO_UTF8: 1 REGTEST_PARALLEL: 1
run: mkdir /var/tmp/regtest && ./regtest/runtests.sh run: mkdir /var/tmp/regtest && ./regtest/runtests.sh

View File

@@ -27,9 +27,9 @@ if ! test -d $LOGDIR; then
LOGDIR=/tmp LOGDIR=/tmp
fi fi
LOGFILE="$LOGDIR/log.txt" LOGFILE="$LOGDIR/log.txt"
DIFFLOG="$LOGDIR/difflog.txt" DIFFLOG="$LOGDIR/difflog_${CODEC_PREFIX}.txt"
NEWLOG="$LOGDIR/newlog.txt" NEWLOG="$LOGDIR/newlog_${CODEC_PREFIX}.txt"
TMPLOG="$LOGDIR/tmplog.txt" TMPLOG="$LOGDIR/tmplog_${CODEC_PREFIX}.txt"
UNAME="$(uname -s)" UNAME="$(uname -s)"
@@ -43,6 +43,12 @@ if ! $MD5SUM $RNDSEQ >/dev/null 2>&1; then
MD5SUM=../simple-md5sum MD5SUM=../simple-md5sum
fi fi
if [ "$REGTEST_PARALLEL" = 1 ]; then
REGTEST_NO_UTF8=1
fi
trap 'ret=$?; [ -n "$RETFILE" ] && echo $((nbfailed + ret)) > $RETFILE' EXIT
nbfailed=0 nbfailed=0
# For MSYS2 # For MSYS2
@@ -88,18 +94,33 @@ case "${param[0]}" in
;; ;;
esac esac
# Sanity check
echo -n "Checking for $NEWVER: "
if test -x $NEWVER; then
echo "OK"
else
echo "missing."
exit 1
fi
### Helper functions ### Helper functions
# Handle echo -n properly even in parallel mode
printbuf=''
function echo_n()
{
if [ "$REGTEST_PARALLEL" = 1 ]; then
printbuf="${printbuf}$*"
else
echo -n "$*"
fi
}
# Handle "echo" even in parallel mode (output buf if parallel)
function echo_line()
{
if [ "$REGTEST_PARALLEL" = 1 ]; then
printbuf="${printbuf}$*"
echo "$printbuf"
else
echo "$*"
fi
printbuf=''
}
# See if file needs to be created # See if file needs to be created
function file_exists() function file_exists()
@@ -166,7 +187,7 @@ function try()
if [ "$REGTEST_NO_UTF8" != 1 ]; then if [ "$REGTEST_NO_UTF8" != 1 ]; then
echo -n "[ ] " echo -n "[ ] "
fi fi
echo -n "${CODEC_PREFIX} - ${REGTEST_SECTION} - $1 - " echo_n "${CODEC_PREFIX} - ${REGTEST_SECTION} - $1 - "
return 0 return 0
else else
if [ "$REGTEST_NO_UTF8" != 1 ]; then if [ "$REGTEST_NO_UTF8" != 1 ]; then
@@ -242,7 +263,7 @@ function run_regtest()
if ! test -r $REFLOG; then if ! test -r $REFLOG; then
pass="false" pass="false"
if [ "$REGTEST_NO_UTF8" = 1 ]; then if [ "$REGTEST_NO_UTF8" = 1 ]; then
echo "BAD; '$REFLOG' is missing in log file database" echo_line "BAD; '$REFLOG' is missing in log file database"
else else
printf "%b\r%b\n" "BAD; '$REFLOG' is missing in log file database" "[\e[31m✘\e[0m]" printf "%b\r%b\n" "BAD; '$REFLOG' is missing in log file database" "[\e[31m✘\e[0m]"
fi fi
@@ -274,7 +295,7 @@ function run_regtest()
if ! diff <(tail -n +3 $REFLOG | $filter) <(cat $NEWLOG | $filter) >${DIFFLOG}; then if ! diff <(tail -n +3 $REFLOG | $filter) <(cat $NEWLOG | $filter) >${DIFFLOG}; then
if [ "$REGTEST_NO_UTF8" = 1 ]; then if [ "$REGTEST_NO_UTF8" = 1 ]; then
echo "BAD; diffs found (<expected; >created):" echo_line "BAD; diffs found (<expected; >created):"
else else
printf "%b\r%b\n" "BAD; diffs found (<expected; >created):" "[\e[31m✘\e[0m]" printf "%b\r%b\n" "BAD; diffs found (<expected; >created):" "[\e[31m✘\e[0m]"
fi fi
@@ -335,7 +356,7 @@ function run_regtest()
md5=$($MD5SUM ${testiso} | cut -d\ -f 1) md5=$($MD5SUM ${testiso} | cut -d\ -f 1)
if test "$image_md5" != "$md5"; then if test "$image_md5" != "$md5"; then
if [ "$REGTEST_NO_UTF8" = 1 ]; then if [ "$REGTEST_NO_UTF8" = 1 ]; then
echo "BAD; md5 sum mismatch in image file:" echo_line "BAD; md5 sum mismatch in image file:"
else else
printf "%b\r%b\n" "BAD; md5 sum mismatch in image file:" "[\e[31m✘\e[0m]" printf "%b\r%b\n" "BAD; md5 sum mismatch in image file:" "[\e[31m✘\e[0m]"
fi fi
@@ -349,7 +370,7 @@ function run_regtest()
md5=$($MD5SUM ${testecc} | cut -d\ -f 1) md5=$($MD5SUM ${testecc} | cut -d\ -f 1)
if test "$ecc_md5" != "$md5"; then if test "$ecc_md5" != "$md5"; then
if [ "$pass" = false ] || [ "$REGTEST_NO_UTF8" = 1 ]; then if [ "$pass" = false ] || [ "$REGTEST_NO_UTF8" = 1 ]; then
echo "BAD; md5 sum mismatch in ecc file:" echo_line "BAD; md5 sum mismatch in ecc file:"
else else
printf "%b\r%b\n" "BAD; md5 sum mismatch in ecc file:" "[\e[31m✘\e[0m]" printf "%b\r%b\n" "BAD; md5 sum mismatch in ecc file:" "[\e[31m✘\e[0m]"
fi fi
@@ -362,7 +383,7 @@ function run_regtest()
case "${pass}" in case "${pass}" in
true) true)
if [ "$REGTEST_NO_UTF8" = 1 ]; then if [ "$REGTEST_NO_UTF8" = 1 ]; then
echo GOOD echo_line GOOD
else else
printf "%b\r%b\n" "GOOD" "[\e[32m✓\e[0m]" printf "%b\r%b\n" "GOOD" "[\e[32m✓\e[0m]"
fi fi
@@ -404,3 +425,13 @@ function run_regtest()
FILE_MSG="" FILE_MSG=""
fi fi
} }
# Sanity check
echo_n "Checking for $NEWVER: "
if test -x $NEWVER; then
echo_line "OK"
else
echo_line "missing."
exit 1
fi

View File

@@ -1,5 +1,6 @@
#!/usr/bin/env bash #!/usr/bin/env bash
CODEC_PREFIX=RS01
. common.bash . common.bash
ISOSIZE=21000 ISOSIZE=21000
@@ -11,8 +12,6 @@ TMPISO=$TMPDIR/rs01-tmp.iso
TMPECC=$TMPDIR/rs01-tmp.ecc TMPECC=$TMPDIR/rs01-tmp.ecc
SIMISO=$TMPDIR/rs01-sim.iso SIMISO=$TMPDIR/rs01-sim.iso
CODEC_PREFIX=RS01
# Create master image and ecc file # Create master image and ecc file
if ! file_exists $MASTERISO; then if ! file_exists $MASTERISO; then

View File

@@ -1,5 +1,6 @@
#!/usr/bin/env bash #!/usr/bin/env bash
CODEC_PREFIX=RS02
. common.bash . common.bash
ISOSIZE=30000 ISOSIZE=30000
@@ -14,8 +15,6 @@ NO_FILE=$TMPDIR/none.file
ISO_PLUS137=$ISODIR/rs02-plus137.iso ISO_PLUS137=$ISODIR/rs02-plus137.iso
CODEC_PREFIX=RS02
# Create master image # Create master image
if ! file_exists $MASTERISO; then if ! file_exists $MASTERISO; then

View File

@@ -1,5 +1,6 @@
#!/usr/bin/env bash #!/usr/bin/env bash
CODEC_PREFIX=RS03f
. common.bash . common.bash
ISOSIZE=21000 ISOSIZE=21000
@@ -10,7 +11,6 @@ MASTERECC=$ISODIR/rs03f-master.ecc
SIMISO=$TMPDIR/rs03f-sim.iso SIMISO=$TMPDIR/rs03f-sim.iso
TMPISO=$TMPDIR/rs03f-tmp.iso TMPISO=$TMPDIR/rs03f-tmp.iso
TMPECC=$TMPDIR/rs03f-tmp.ecc TMPECC=$TMPDIR/rs03f-tmp.ecc
CODEC_PREFIX=RS03f
# Create master image # Create master image

View File

@@ -1,5 +1,6 @@
#!/usr/bin/env bash #!/usr/bin/env bash
CODEC_PREFIX=RS03i
. common.bash . common.bash
ISOSIZE=21000 ISOSIZE=21000
@@ -17,8 +18,6 @@ LMI_HEADER=235219
LMI_LAYER_SIZE=1409 LMI_LAYER_SIZE=1409
LMI_FIRSTCRC=235303 LMI_FIRSTCRC=235303
CODEC_PREFIX=RS03i
# Create master image # Create master image
if ! file_exists $MASTERISO; then if ! file_exists $MASTERISO; then

View File

@@ -1,10 +1,27 @@
#!/usr/bin/env bash #!/usr/bin/env bash
cd "$(dirname "$0")" cd "$(dirname "$0")"
export DVDISASTER_SCSI_SIMULATED_NODELAY=1
if [ "$REGTEST_PARALLEL" = 1 ]; then
for i in rs*.bash; do
( RETFILE=/tmp/result.$i REGTEST_NO_UTF8=1 ./$i ) &
done
wait
else
for i in rs*.bash; do
RETFILE=/tmp/result.$i ./$i
done
fi
allfailed=0 allfailed=0
for i in rs*.bash; do for i in rs*.bash; do
( DVDISASTER_SCSI_SIMULATED_NODELAY=1 ./$i ); ret=$? ret=$(cat /tmp/result.$i)
[ -z "$ret" ] && ret=1
rm -f /tmp/result.$i
allfailed=$((allfailed + ret)) allfailed=$((allfailed + ret))
done done
echo Failed $allfailed tests echo Failed $allfailed tests
[ $allfailed -ge 256 ] && allfailed=255 [ $allfailed -ge 256 ] && allfailed=255
exit $allfailed exit $allfailed