In the unit test phase, only launch sequences with functions we support.

This commit is contained in:
Sam Hocevar 2010-01-12 23:53:24 +00:00 committed by sam
parent 638dc792a8
commit 47e539f59d

View File

@ -2,6 +2,11 @@
. "$(dirname "$0")/functions.inc"
HAVE_GETLINE=$("$ZZCAT" -l | grep -q '^ getline(' && echo "y")
HAVE_GETDELIM=$("$ZZCAT" -l | grep -q '^ getdelim(' && echo "y")
HAVE_GETC_UNLOCKED=$("$ZZCAT" -l | grep -q '^ getc_unlocked(' && echo "y")
HAVE_FGETC_UNLOCKED=$("$ZZCAT" -l | grep -q '^ fgetc_unlocked(' && echo "y")
checkutils()
{
r=$1
@ -56,47 +61,74 @@ checkutils()
# Regression tests for stuff that used to break
check "$ZZOPTS" "$ZZCAT -x \"fread(1,33000) fseek(1,SEEK_SET) fread(1,1) fseek(4093,SEEK_CUR) fread(1,1) fseek(1,SEEK_CUR) fread(1,1)\" $file" \
"eglibc (2.9-21) bug regression"
if [ "$HAVE_GET_UNLOCKED $HAVE_GETLINE" = "y y" ]; then
check "$ZZOPTS" "$ZZCAT -x \"repeat(33000,getc_unlocked() ungetc() getline() feof(10))\" $file" \
"sed getc_unlocked() bug regression"
fi
# Misc tests
for n in \
"fread(1,33000)" \
"repeat(33,fread(1,1000))" \
"repeat(1000,fread(1,33))" \
"getc() fread(1,33000)" \
"getc_unlocked() fread(1,33000)" \
"fgetc() fread(1,33000)" \
"fgetc_unlocked() fread(1,33000)" \
"getc() ungetc() fread(1,33000)" \
"getc_unlocked() ungetc() fread(1,33000)" \
"fgetc() ungetc() fread(1,33000)" \
"fgetc_unlocked() ungetc() fread(1,33000)" \
"repeat(33000,getc(),feof(10))" \
"repeat(33000,getc_unlocked(),feof(10))" \
"repeat(33000,fgetc(),feof(10))" \
"repeat(33000,fgetc_unlocked(),feof(10))" \
"repeat(8000,getc()) fread(1,33000)" \
"repeat(8000,getc_unlocked()) fread(1,33000)" \
"repeat(8000,fgetc()) fread(1,33000)" \
"repeat(8000,fgetc_unlocked()) fread(1,33000)" \
"repeat(10,getline()) fread(1,33000)" \
"repeat(10,getdelim(0)) fread(1,33000)" \
"repeat(10,getdelim(' ')) fread(1,33000)" \
"fread(1,100) fseek(50,SEEK_SET) fread(1,33000)" \
"fread(1,100) rewind() fseek(50,SEEK_CUR) fread(1,33000)" \
"fread(1,33000) rewind() repeat(10000,fseek(1,SEEK_CUR) fread(1,1))" \
"fread(1,33000) rewind() repeat(10000,fseek(2,SEEK_CUR) fread(1,2))" \
"fread(1,33000) rewind() repeat(10000,fseek(3,SEEK_CUR) fread(1,3))" \
"fread(1,33000) rewind() repeat(10000,fseek(4,SEEK_CUR) fread(1,4))" \
"repeat(33000,getc() ungetc() getline() feof(10))" \
"repeat(33000,fgetc() ungetc() getline() feof(10))" \
"fread(1,33000) fseek(1000,SEEK_CUR) repeat(10000,fread(1,2),feof(10))" \
"fread(1,33000) fseek(1000,SEEK_CUR) repeat(10000,getc(),feof(10))" \
"fread(1,33000) fseek(1000,SEEK_CUR) repeat(10000,fgetc(),feof(10))" \
; do
check "$ZZOPTS" "$ZZCAT -x \"$n\" $file" "$n"
done
# Platform-specific tests
if [ "$HAVE_GETLINE" = "y" ]; then
for n in \
"repeat(10,getline()) fread(1,33000)" \
"repeat(33000,getc() ungetc() getline() feof(10))" \
"repeat(33000,fgetc() ungetc() getline() feof(10))" \
; do
check "$ZZOPTS" "$ZZCAT -x \"$n\" $file" "$n"
done
fi
if [ "$HAVE_GETDELIM" = "y" ]; then
for n in \
"repeat(10,getdelim(0)) fread(1,33000)" \
"repeat(10,getdelim(' ')) fread(1,33000)" \
; do
check "$ZZOPTS" "$ZZCAT -x \"$n\" $file" "$n"
done
fi
if [ "$HAVE_GETC_UNLOCKED" = "y" ]; then
for n in \
"getc_unlocked() fread(1,33000)" \
"getc_unlocked() ungetc() fread(1,33000)" \
"repeat(33000,getc_unlocked(),feof(10))" \
"repeat(8000,getc_unlocked()) fread(1,33000)" \
"fread(1,33000) fseek(1000,SEEK_CUR) repeat(10000,getc_unlocked(),feof(10))" \
; do
check "$ZZOPTS" "$ZZCAT -x \"$n\" $file" "$n"
done
fi
if [ "$HAVE_FGETC_UNLOCKED" = "y" ]; then
for n in \
"fgetc_unlocked() fread(1,33000)" \
"fgetc_unlocked() ungetc() fread(1,33000)" \
"repeat(33000,fgetc_unlocked(),feof(10))" \
"repeat(8000,fgetc_unlocked()) fread(1,33000)" \
; do
check "$ZZOPTS" "$ZZCAT -x \"$n\" $file" "$n"
done
fi
done
}