summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJosh Coalson <jcoalson@users.sourceforce.net>2002-12-04 04:57:33 +0000
committerJosh Coalson <jcoalson@users.sourceforce.net>2002-12-04 04:57:33 +0000
commit34c1ea8ca2a567043d079c4a6e0baa3f0f6341d4 (patch)
tree6f97818ff043e25cb60a24031a793790da57c5a2
parent23fec2b7dc23478cb6e6ae44388551c2d71c0ac9 (diff)
downloadflac-34c1ea8ca2a567043d079c4a6e0baa3f0f6341d4.tar.gz
instrument for valgrind
-rw-r--r--Makefile.lite11
-rw-r--r--build/config.mk9
-rw-r--r--build/exe.mk6
-rw-r--r--build/lib.mk2
-rw-r--r--src/share/Makefile.lite2
-rw-r--r--src/test_grabbag/Makefile.lite2
-rw-r--r--test/Makefile.am6
-rw-r--r--test/Makefile.lite28
-rwxr-xr-xtest/test_bins.sh16
-rwxr-xr-xtest/test_grabbag.sh15
-rwxr-xr-xtest/test_libFLAC++.sh13
-rwxr-xr-xtest/test_libFLAC.sh13
-rwxr-xr-xtest/test_libOggFLAC++.sh13
-rwxr-xr-xtest/test_libOggFLAC.sh13
-rwxr-xr-xtest/test_metaflac.sh149
-rwxr-xr-xtest/test_streams.sh34
16 files changed, 218 insertions, 114 deletions
diff --git a/Makefile.lite b/Makefile.lite
index f5956093..3d4af364 100644
--- a/Makefile.lite
+++ b/Makefile.lite
@@ -22,6 +22,7 @@
#
# all : build all libraries and programs in the default configuration (currently 'release')
# debug : build all libraries and programs in debug mode
+# valgrind: build all libraries and programs in debug mode, dynamically linked and ready for valgrind
# release : build all libraries and programs in release mode
# test : run the unit and stream tests
# clean : remove all non-distro files
@@ -37,9 +38,11 @@ DEFAULT_CONFIG = release
CONFIG = $(DEFAULT_CONFIG)
debug : CONFIG = debug
+valgrind: CONFIG = valgrind
release : CONFIG = release
debug : all
+valgrind: all
release : all
doc:
@@ -91,7 +94,13 @@ test_libOggFLAC++: libFLAC libOggFLAC libOggFLAC++
(cd src/$@ ; $(MAKE) -f Makefile.lite $(CONFIG))
test: debug
- (cd test ; $(MAKE) -f Makefile.lite)
+ (cd test ; $(MAKE) -f Makefile.lite debug)
+
+testv: valgrind
+ (cd test ; $(MAKE) -f Makefile.lite valgrind)
+
+testr: release
+ (cd test ; $(MAKE) -f Makefile.lite release)
clean:
-(cd doc ; $(MAKE) -f Makefile.lite clean)
diff --git a/build/config.mk b/build/config.mk
index dd19ef90..c2ec1602 100644
--- a/build/config.mk
+++ b/build/config.mk
@@ -21,8 +21,13 @@
DEFAULT_BUILD = release
-debug : BUILD = debug
-release : BUILD = release
+debug : BUILD = debug
+valgrind : BUILD = debug
+release : BUILD = release
+
+debug : LINKAGE = -static
+valgrind : LINKAGE = -dynamic
+release : LINKAGE = -static
all default: $(DEFAULT_BUILD)
diff --git a/build/exe.mk b/build/exe.mk
index c931bfdd..bc16463d 100644
--- a/build/exe.mk
+++ b/build/exe.mk
@@ -29,11 +29,9 @@ CC = gcc
CCC = g++
endif
NASM = nasm
-# LINKAGE can be forced to -static or -dynamic from invocation if desired, but it defaults to -static except on OSX
+# override to -dynamic on OSX
ifeq ($(DARWIN_BUILD),yes)
LINKAGE = -dynamic
-else
-LINKAGE = -static
endif
LINK = $(CC) $(LINKAGE)
OBJPATH = $(topdir)/obj
@@ -48,6 +46,7 @@ DEBUG_PROGRAM = $(DEBUG_BINPATH)/$(PROGRAM_NAME)
RELEASE_PROGRAM = $(RELEASE_BINPATH)/$(PROGRAM_NAME)
debug : CFLAGS = -g -O0 -DDEBUG $(DEBUG_CFLAGS) -Wall -W -DVERSION=$(VERSION) $(DEFINES) $(INCLUDES)
+valgrind: CFLAGS = -g -O0 -DDEBUG $(DEBUG_CFLAGS) -Wall -W -DVERSION=$(VERSION) $(DEFINES) $(INCLUDES)
release : CFLAGS = -O3 -fomit-frame-pointer -funroll-loops -finline-functions -DNDEBUG $(RELEASE_CFLAGS) -Wall -W -Winline -DFLaC__INLINE=__inline__ -DVERSION=$(VERSION) $(DEFINES) $(INCLUDES)
LFLAGS = -L$(LIBPATH)
@@ -58,6 +57,7 @@ DEBUG_OBJS = $(SRCS_C:%.c=%.debug.o) $(SRCS_CC:%.cc=%.debug.o) $(SRCS_CPP:%.cpp=
RELEASE_OBJS = $(SRCS_C:%.c=%.release.o) $(SRCS_CC:%.cc=%.release.o) $(SRCS_CPP:%.cpp=%.release.o) $(SRCS_NASM:%.nasm=%.release.o)
debug : $(ORDINALS_H) $(DEBUG_PROGRAM)
+valgrind: $(ORDINALS_H) $(DEBUG_PROGRAM)
release : $(ORDINALS_H) $(RELEASE_PROGRAM)
$(DEBUG_PROGRAM) : $(DEBUG_OBJS)
diff --git a/build/lib.mk b/build/lib.mk
index bec4fcb5..d0d80a2c 100644
--- a/build/lib.mk
+++ b/build/lib.mk
@@ -56,6 +56,7 @@ LINKD = $(CC) -shared
endif
debug : CFLAGS = -g -O0 -DDEBUG $(DEBUG_CFLAGS) -Wall -W -DVERSION=$(VERSION) $(DEFINES) $(INCLUDES)
+valgrind: CFLAGS = -g -O0 -DDEBUG $(DEBUG_CFLAGS) -Wall -W -DVERSION=$(VERSION) $(DEFINES) $(INCLUDES)
release : CFLAGS = -O3 -fomit-frame-pointer -funroll-loops -finline-functions -DNDEBUG $(RELEASE_CFLAGS) -Wall -W -Winline -DFLaC__INLINE=__inline__ -DVERSION=$(VERSION) $(DEFINES) $(INCLUDES)
LFLAGS = -L$(LIBPATH)
@@ -66,6 +67,7 @@ DEBUG_OBJS = $(SRCS_C:%.c=%.debug.o) $(SRCS_CC:%.cc=%.debug.o) $(SRCS_CPP:%.cpp=
RELEASE_OBJS = $(SRCS_C:%.c=%.release.o) $(SRCS_CC:%.cc=%.release.o) $(SRCS_CPP:%.cpp=%.release.o) $(SRCS_NASM:%.nasm=%.release.o)
debug : $(ORDINALS_H) $(DEBUG_STATIC_LIB) $(DEBUG_DYNAMIC_LIB)
+valgrind: $(ORDINALS_H) $(DEBUG_STATIC_LIB) $(DEBUG_DYNAMIC_LIB)
release : $(ORDINALS_H) $(RELEASE_STATIC_LIB) $(RELEASE_DYNAMIC_LIB)
$(DEBUG_STATIC_LIB): $(DEBUG_OBJS)
diff --git a/src/share/Makefile.lite b/src/share/Makefile.lite
index 291e91fe..1419c0fd 100644
--- a/src/share/Makefile.lite
+++ b/src/share/Makefile.lite
@@ -23,9 +23,11 @@ DEFAULT_CONFIG = release
CONFIG = $(DEFAULT_CONFIG)
debug : CONFIG = debug
+valgrind: CONFIG = valgrind
release : CONFIG = release
debug : all
+valgrind: all
release : all
gain_analysis:
diff --git a/src/test_grabbag/Makefile.lite b/src/test_grabbag/Makefile.lite
index c6609fd3..0f6df512 100644
--- a/src/test_grabbag/Makefile.lite
+++ b/src/test_grabbag/Makefile.lite
@@ -23,9 +23,11 @@ DEFAULT_CONFIG = release
CONFIG = $(DEFAULT_CONFIG)
debug : CONFIG = debug
+valgrind: CONFIG = valgrind
release : CONFIG = release
debug : all
+valgrind: all
release : all
cuesheet:
diff --git a/test/Makefile.am b/test/Makefile.am
index 5d0568d7..987f9304 100644
--- a/test/Makefile.am
+++ b/test/Makefile.am
@@ -21,6 +21,12 @@ else
TESTS_ENVIRONMENT = FLAC__EXHAUSTIVE_TESTS=no
endif
+if FLaC__VALGRIND_TESTING
+TESTS_ENVIRONMENT = $(TESTS_ENVIRONMENT) FLAC__VALGRIND=yes
+else
+TESTS_ENVIRONMENT = $(TESTS_ENVIRONMENT) FLAC__VALGRIND=no
+endif
+
SUBDIRS = cuesheets
if FLaC__HAS_OGG
diff --git a/test/Makefile.lite b/test/Makefile.lite
index 90f1cd4b..b4ed0e1d 100644
--- a/test/Makefile.lite
+++ b/test/Makefile.lite
@@ -22,18 +22,26 @@
topdir = ..
all: clean
- FLAC__EXHAUSTIVE_TESTS=yes ./test_libFLAC.sh
- FLAC__EXHAUSTIVE_TESTS=yes ./test_libFLAC++.sh
- FLAC__EXHAUSTIVE_TESTS=yes ./test_libOggFLAC.sh
- FLAC__EXHAUSTIVE_TESTS=yes ./test_libOggFLAC++.sh
- FLAC__EXHAUSTIVE_TESTS=yes ./test_metaflac.sh
- FLAC__EXHAUSTIVE_TESTS=yes ./test_grabbag.sh
- FLAC__EXHAUSTIVE_TESTS=yes ./test_streams.sh
- FLAC__EXHAUSTIVE_TESTS=yes ./test_bins.sh
+ $(FLAC__EXHAUSTIVE_TESTS) $(FLAC__VALGRIND) ./test_libFLAC.sh
+ $(FLAC__EXHAUSTIVE_TESTS) $(FLAC__VALGRIND) ./test_libFLAC++.sh
+ $(FLAC__EXHAUSTIVE_TESTS) $(FLAC__VALGRIND) ./test_libOggFLAC.sh
+ $(FLAC__EXHAUSTIVE_TESTS) $(FLAC__VALGRIND) ./test_libOggFLAC++.sh
+ $(FLAC__EXHAUSTIVE_TESTS) $(FLAC__VALGRIND) ./test_metaflac.sh
+ $(FLAC__EXHAUSTIVE_TESTS) $(FLAC__VALGRIND) ./test_grabbag.sh
+ $(FLAC__EXHAUSTIVE_TESTS) $(FLAC__VALGRIND) ./test_streams.sh
+ $(FLAC__EXHAUSTIVE_TESTS) $(FLAC__VALGRIND) ./test_bins.sh
-debug: all
+debug : FLAC__EXHAUSTIVE_TESTS=FLAC__EXHAUSTIVE_TESTS=yes
+valgrind: FLAC__EXHAUSTIVE_TESTS=FLAC__EXHAUSTIVE_TESTS=no
+release : FLAC__EXHAUSTIVE_TESTS=FLAC__EXHAUSTIVE_TESTS=yes
-release: all
+debug : FLAC__VALGRIND=FLAC__VALGRIND=no
+valgrind: FLAC__VALGRIND=FLAC__VALGRIND=yes
+release : FLAC__VALGRIND=FLAC__VALGRIND=no
+
+debug : all
+valgrind: all
+release : all
clean:
rm -f *.raw *.flac *.ogg *.cmp *.wav ../../test_files/bins/*.raw ../../test_files/bins/*.flac ../../test_files/bins/*.cmp *.diff *.log *.cue core
diff --git a/test/test_bins.sh b/test/test_bins.sh
index b793b795..b8ee5228 100755
--- a/test/test_bins.sh
+++ b/test/test_bins.sh
@@ -19,14 +19,20 @@
LD_LIBRARY_PATH=../src/libFLAC/.libs:../obj/release/lib:../obj/debug/lib:$LD_LIBRARY_PATH
export LD_LIBRARY_PATH
-PATH=../src/flac:../obj/release/b:../obj/debug/bin:$PATH
+PATH=../src/flac:../obj/release/bin:../obj/debug/bin:$PATH
BINS_PATH=../../test_files/bins
flac --help 1>/dev/null 2>/dev/null || (echo "ERROR can't find flac executable" 1>&2 && exit 1)
if [ $? != 0 ] ; then exit 1 ; fi
-#FLAC="valgrind --leak-check=yes --show-reachable=yes --logfile-fd=1 flac"
-FLAC=flac
+run_flac ()
+{
+ if [ "$FLAC__VALGRIND" = yes ] ; then
+ valgrind --leak-check=yes --show-reachable=yes --num-callers=10 --logfile-fd=4 flac $* 4>>valgrind.log
+ else
+ flac $*
+ fi
+}
test -d ${BINS_PATH} || exit 77
@@ -38,7 +44,7 @@ test_file ()
encode_options="$4"
echo -n "$name (--channels=$channels --bps=$bps $encode_options): encode..."
- cmd="$FLAC --verify --silent --force-raw-format --endian=big --sign=signed --sample-rate=44100 --bps=$bps --channels=$channels $encode_options $name.bin"
+ cmd="run_flac --verify --silent --force-raw-format --endian=big --sign=signed --sample-rate=44100 --bps=$bps --channels=$channels $encode_options $name.bin"
echo "### ENCODE $name #######################################################" >> ./streams.log
echo "### cmd=$cmd" >> ./streams.log
if $cmd 2>>./streams.log ; then : ; else
@@ -46,7 +52,7 @@ test_file ()
exit 1
fi
echo -n "decode..."
- cmd="$FLAC --silent --endian=big --sign=signed --decode --force-raw-format $name.flac";
+ cmd="run_flac --silent --endian=big --sign=signed --decode --force-raw-format $name.flac";
echo "### DECODE $name #######################################################" >> ./streams.log
echo "### cmd=$cmd" >> ./streams.log
if $cmd 2>>./streams.log ; then : ; else
diff --git a/test/test_grabbag.sh b/test/test_grabbag.sh
index be470a45..dae78281 100755
--- a/test/test_grabbag.sh
+++ b/test/test_grabbag.sh
@@ -19,11 +19,20 @@
LD_LIBRARY_PATH=../src/libFLAC/.libs:../src/share/grabbag/.libs:../obj/release/lib:../obj/debug/lib:$LD_LIBRARY_PATH
export LD_LIBRARY_PATH
-PATH=../src/test_grabbag/cuesheet:../obj/release/b:../obj/debug/bin:$PATH
+PATH=../src/test_grabbag/cuesheet:../obj/release/bin:../obj/debug/bin:$PATH
test_cuesheet -h 1>/dev/null 2>/dev/null || (echo "ERROR can't find test_cuesheet executable" 1>&2 && exit 1)
if [ $? != 0 ] ; then exit 1 ; fi
+run_test_cuesheet ()
+{
+ if [ "$FLAC__VALGRIND" = yes ] ; then
+ valgrind --leak-check=yes --show-reachable=yes --num-callers=10 --logfile-fd=4 test_cuesheet $* 4>>valgrind.log
+ else
+ test_cuesheet $*
+ fi
+}
+
########################################################################
#
# test_cuesheet
@@ -43,7 +52,7 @@ rm -f $log
#
for cuesheet in $bad_cuesheets ; do
echo "NEGATIVE $cuesheet" >> $log 2>&1
- test_cuesheet $cuesheet $good_leadout cdda >> $log 2>&1
+ run_test_cuesheet $cuesheet $good_leadout cdda >> $log 2>&1
exit_code=$?
if [ "$exit_code" = 255 ] ; then
echo "Error: test script is broken"
@@ -59,7 +68,7 @@ done
#
for cuesheet in $good_cuesheets ; do
echo "POSITIVE $cuesheet" >> $log 2>&1
- test_cuesheet $cuesheet $good_leadout cdda >> $log 2>&1
+ run_test_cuesheet $cuesheet $good_leadout cdda >> $log 2>&1
exit_code=$?
if [ "$exit_code" = 255 ] ; then
echo "Error: test script is broken"
diff --git a/test/test_libFLAC++.sh b/test/test_libFLAC++.sh
index bc380067..e9e39d8c 100755
--- a/test/test_libFLAC++.sh
+++ b/test/test_libFLAC++.sh
@@ -19,10 +19,19 @@
LD_LIBRARY_PATH=../src/libFLAC++/.libs:../src/libFLAC/.libs:../obj/release/lib:../obj/debug/lib:$LD_LIBRARY_PATH
export LD_LIBRARY_PATH
-PATH=../src/test_libFLAC++:../obj/release/b:../obj/debug/bin:$PATH
+PATH=../src/test_libFLAC++:../obj/release/bin:../obj/debug/bin:$PATH
export PATH
-if test_libFLAC++ ; then : ; else
+run_test_libFLACpp ()
+{
+ if [ "$FLAC__VALGRIND" = yes ] ; then
+ valgrind --leak-check=yes --show-reachable=yes --num-callers=10 --logfile-fd=4 test_libFLAC++ $* 4>>valgrind.log
+ else
+ test_libFLAC++ $*
+ fi
+}
+
+if run_test_libFLACpp ; then : ; else
echo "ERROR during test_libFLAC++" 1>&2
exit 1
fi
diff --git a/test/test_libFLAC.sh b/test/test_libFLAC.sh
index e828be0c..0c048944 100755
--- a/test/test_libFLAC.sh
+++ b/test/test_libFLAC.sh
@@ -19,10 +19,19 @@
LD_LIBRARY_PATH=../src/libFLAC/.libs:../obj/release/lib:../obj/debug/lib:$LD_LIBRARY_PATH
export LD_LIBRARY_PATH
-PATH=../src/test_libFLAC:../obj/release/b:../obj/debug/bin:$PATH
+PATH=../src/test_libFLAC:../obj/release/bin:../obj/debug/bin:$PATH
export PATH
-if test_libFLAC ; then : ; else
+run_test_libFLAC ()
+{
+ if [ "$FLAC__VALGRIND" = yes ] ; then
+ valgrind --leak-check=yes --show-reachable=yes --num-callers=10 --logfile-fd=4 test_libFLAC $* 4>>valgrind.log
+ else
+ test_libFLAC $*
+ fi
+}
+
+if run_test_libFLAC ; then : ; else
echo "ERROR during test_libFLAC" 1>&2
exit 1
fi
diff --git a/test/test_libOggFLAC++.sh b/test/test_libOggFLAC++.sh
index 00ea45f7..6c8234e3 100755
--- a/test/test_libOggFLAC++.sh
+++ b/test/test_libOggFLAC++.sh
@@ -19,10 +19,19 @@
LD_LIBRARY_PATH=../src/libOggFLAC++/.libs:../src/libOggFLAC/.libs:../src/libFLAC/.libs:../obj/release/lib:../obj/debug/lib:$LD_LIBRARY_PATH
export LD_LIBRARY_PATH
-PATH=../src/test_libOggFLAC++:../obj/release/b:../obj/debug/bin:$PATH
+PATH=../src/test_libOggFLAC++:../obj/release/bin:../obj/debug/bin:$PATH
export PATH
-if test_libOggFLAC++ ; then : ; else
+run_test_libOggFLACpp ()
+{
+ if [ "$FLAC__VALGRIND" = yes ] ; then
+ valgrind --leak-check=yes --show-reachable=yes --num-callers=10 --logfile-fd=4 test_libOggFLAC++ $* 4>>valgrind.log
+ else
+ test_libOggFLAC++ $*
+ fi
+}
+
+if run_test_libOggFLACpp ; then : ; else
echo "ERROR during test_libOggFLAC++" 1>&2
exit 1
fi
diff --git a/test/test_libOggFLAC.sh b/test/test_libOggFLAC.sh
index 15b0e32e..842297c8 100755
--- a/test/test_libOggFLAC.sh
+++ b/test/test_libOggFLAC.sh
@@ -19,10 +19,19 @@
LD_LIBRARY_PATH=../src/libOggFLAC/.libs../src/libFLAC/.libs:../obj/release/lib:../obj/debug/lib:$LD_LIBRARY_PATH
export LD_LIBRARY_PATH
-PATH=../src/test_libOggFLAC:../obj/release/b:../obj/debug/bin:$PATH
+PATH=../src/test_libOggFLAC:../obj/release/bin:../obj/debug/bin:$PATH
export PATH
-if test_libOggFLAC ; then : ; else
+run_test_libOggFLAC ()
+{
+ if [ "$FLAC__VALGRIND" = yes ] ; then
+ valgrind --leak-check=yes --show-reachable=yes --num-callers=10 --logfile-fd=4 test_libOggFLAC $* 4>>valgrind.log
+ else
+ test_libOggFLAC $*
+ fi
+}
+
+if run_test_libOggFLAC ; then : ; else
echo "ERROR during test_libOggFLAC" 1>&2
exit 1
fi
diff --git a/test/test_metaflac.sh b/test/test_metaflac.sh
index 9fb46338..2072eba6 100755
--- a/test/test_metaflac.sh
+++ b/test/test_metaflac.sh
@@ -19,7 +19,7 @@
LD_LIBRARY_PATH=../src/libFLAC/.libs:../obj/release/lib:../obj/debug/lib:$LD_LIBRARY_PATH
export LD_LIBRARY_PATH
-PATH=../src/flac:../src/metaflac:../obj/release/b:../obj/debug/bin:$PATH
+PATH=../src/flac:../src/metaflac:../obj/release/bin:../obj/debug/bin:$PATH
flacfile=metaflac.flac
@@ -29,10 +29,23 @@ if [ $? != 0 ] ; then exit 1 ; fi
metaflac --help 1>/dev/null 2>/dev/null || (echo "ERROR can't find metaflac executable" 1>&2 && exit 1)
if [ $? != 0 ] ; then exit 1 ; fi
-#FLAC="valgrind --leak-check=yes --show-reachable=yes flac"
-FLAC=flac
-#METAFLAC="valgrind --leak-check=yes --show-reachable=yes metaflac"
-METAFLAC=metaflac
+run_flac ()
+{
+ if [ "$FLAC__VALGRIND" = yes ] ; then
+ valgrind --leak-check=yes --show-reachable=yes --num-callers=10 --logfile-fd=4 flac $* 4>>valgrind.log
+ else
+ flac $*
+ fi
+}
+
+run_metaflac ()
+{
+ if [ "$FLAC__VALGRIND" = yes ] ; then
+ valgrind --leak-check=yes --show-reachable=yes --num-callers=10 --logfile-fd=4 metaflac $* 4>>valgrind.log
+ else
+ metaflac $*
+ fi
+}
echo "Generating stream..."
if [ -f /bin/sh.exe ] ; then
@@ -40,7 +53,7 @@ if [ -f /bin/sh.exe ] ; then
else
inputfile=/bin/sh
fi
-if $FLAC --verify -0 --output-name=$flacfile --force-raw-format --endian=big --sign=signed --channels=1 --bps=8 --sample-rate=44100 $inputfile ; then
+if run_flac --verify -0 --output-name=$flacfile --force-raw-format --endian=big --sign=signed --channels=1 --bps=8 --sample-rate=44100 $inputfile ; then
chmod +w $flacfile
else
echo "ERROR during generation" 1>&2
@@ -58,7 +71,7 @@ check_exit ()
check_flac ()
{
- if $FLAC --silent --test $flacfile ; then : ; else
+ if run_flac --silent --test $flacfile ; then : ; else
echo "ERROR in $flacfile" 1>&2
exit 1
fi
@@ -66,11 +79,11 @@ check_flac ()
check_flac
-(set -x && $METAFLAC --list $flacfile)
+(set -x && run_metaflac --list $flacfile)
check_exit
(set -x &&
-$METAFLAC \
+run_metaflac \
--show-md5sum \
--show-min-blocksize \
--show-max-blocksize \
@@ -84,193 +97,193 @@ $METAFLAC \
)
check_exit
-(set -x && $METAFLAC --preserve-modtime --add-padding=12345 $flacfile)
+(set -x && run_metaflac --preserve-modtime --add-padding=12345 $flacfile)
check_exit
check_flac
# some flavors of /bin/sh (e.g. Darwin's) won't even handle quoted spaces, so we underscore:
-(set -x && $METAFLAC --set-vc-field="ARTIST=The_artist_formerly_known_as_the_artist..." $flacfile)
+(set -x && run_metaflac --set-vc-field="ARTIST=The_artist_formerly_known_as_the_artist..." $flacfile)
check_exit
check_flac
-(set -x && $METAFLAC --list --block-type=VORBIS_COMMENT $flacfile)
+(set -x && run_metaflac --list --block-type=VORBIS_COMMENT $flacfile)
check_exit
-(set -x && $METAFLAC --set-vc-field="ARTIST=Chuck_Woolery" $flacfile)
+(set -x && run_metaflac --set-vc-field="ARTIST=Chuck_Woolery" $flacfile)
check_exit
check_flac
-(set -x && $METAFLAC --list --block-type=VORBIS_COMMENT $flacfile)
+(set -x && run_metaflac --list --block-type=VORBIS_COMMENT $flacfile)
check_exit
-(set -x && $METAFLAC --list --block-type=VORBIS_COMMENT $flacfile)
+(set -x && run_metaflac --list --block-type=VORBIS_COMMENT $flacfile)
check_exit
-(set -x && $METAFLAC --set-vc-field="ARTIST=Vern" $flacfile)
+(set -x && run_metaflac --set-vc-field="ARTIST=Vern" $flacfile)
check_exit
check_flac
-(set -x && $METAFLAC --list --block-type=VORBIS_COMMENT $flacfile)
+(set -x && run_metaflac --list --block-type=VORBIS_COMMENT $flacfile)
check_exit
-(set -x && $METAFLAC --set-vc-field="TITLE=He_who_smelt_it_dealt_it" $flacfile)
+(set -x && run_metaflac --set-vc-field="TITLE=He_who_smelt_it_dealt_it" $flacfile)
check_exit
check_flac
-(set -x && $METAFLAC --list --block-type=VORBIS_COMMENT $flacfile)
+(set -x && run_metaflac --list --block-type=VORBIS_COMMENT $flacfile)
check_exit
-(set -x && $METAFLAC --show-vc-vendor --show-vc-field=ARTIST $flacfile)
+(set -x && run_metaflac --show-vc-vendor --show-vc-field=ARTIST $flacfile)
check_exit
-(set -x && $METAFLAC --remove-vc-firstfield=ARTIST $flacfile)
+(set -x && run_metaflac --remove-vc-firstfield=ARTIST $flacfile)
check_exit
check_flac
-(set -x && $METAFLAC --list --block-type=VORBIS_COMMENT $flacfile)
+(set -x && run_metaflac --list --block-type=VORBIS_COMMENT $flacfile)
check_exit
-(set -x && $METAFLAC --remove-vc-field=ARTIST $flacfile)
+(set -x && run_metaflac --remove-vc-field=ARTIST $flacfile)
check_exit
check_flac
-(set -x && $METAFLAC --list --block-type=VORBIS_COMMENT $flacfile)
+(set -x && run_metaflac --list --block-type=VORBIS_COMMENT $flacfile)
check_exit
-(set -x && $METAFLAC --list --block-number=0 $flacfile)
+(set -x && run_metaflac --list --block-number=0 $flacfile)
check_exit
-(set -x && $METAFLAC --list --block-number=1,2,999 $flacfile)
+(set -x && run_metaflac --list --block-number=1,2,999 $flacfile)
check_exit
-(set -x && $METAFLAC --list --block-type=VORBIS_COMMENT,PADDING $flacfile)
+(set -x && run_metaflac --list --block-type=VORBIS_COMMENT,PADDING $flacfile)
check_exit
-(set -x && $METAFLAC --list --except-block-type=SEEKTABLE,VORBIS_COMMENT $flacfile)
+(set -x && run_metaflac --list --except-block-type=SEEKTABLE,VORBIS_COMMENT $flacfile)
check_exit
-(set -x && $METAFLAC --add-padding=4321 $flacfile $flacfile)
+(set -x && run_metaflac --add-padding=4321 $flacfile $flacfile)
check_exit
check_flac
-(set -x && $METAFLAC --merge-padding $flacfile)
+(set -x && run_metaflac --merge-padding $flacfile)
check_exit
check_flac
-(set -x && $METAFLAC --add-padding=0 $flacfile)
+(set -x && run_metaflac --add-padding=0 $flacfile)
check_exit
check_flac
-(set -x && $METAFLAC --sort-padding $flacfile)
+(set -x && run_metaflac --sort-padding $flacfile)
check_exit
check_flac
-(set -x && $METAFLAC --add-padding=0 $flacfile)
+(set -x && run_metaflac --add-padding=0 $flacfile)
check_exit
check_flac
-(set -x && $METAFLAC --remove-vc-all $flacfile)
+(set -x && run_metaflac --remove-vc-all $flacfile)
check_exit
check_flac
-(set -x && $METAFLAC --remove --block-number=1,99 --dont-use-padding $flacfile)
+(set -x && run_metaflac --remove --block-number=1,99 --dont-use-padding $flacfile)
check_exit
check_flac
-(set -x && $METAFLAC --remove --block-number=99 --dont-use-padding $flacfile)
+(set -x && run_metaflac --remove --block-number=99 --dont-use-padding $flacfile)
check_exit
check_flac
-(set -x && $METAFLAC --remove --block-type=PADDING $flacfile)
+(set -x && run_metaflac --remove --block-type=PADDING $flacfile)
check_exit
check_flac
-(set -x && $METAFLAC --remove --block-type=PADDING --dont-use-padding $flacfile)
+(set -x && run_metaflac --remove --block-type=PADDING --dont-use-padding $flacfile)
check_exit
check_flac
-(set -x && $METAFLAC --add-padding=0 $flacfile $flacfile)
+(set -x && run_metaflac --add-padding=0 $flacfile $flacfile)
check_exit
check_flac
-(set -x && $METAFLAC --remove --except-block-type=PADDING $flacfile)
+(set -x && run_metaflac --remove --except-block-type=PADDING $flacfile)
check_exit
check_flac
-(set -x && $METAFLAC --remove-all $flacfile)
+(set -x && run_metaflac --remove-all $flacfile)
check_exit
check_flac
-(set -x && $METAFLAC --remove-all --dont-use-padding $flacfile)
+(set -x && run_metaflac --remove-all --dont-use-padding $flacfile)
check_exit
check_flac
-(set -x && $METAFLAC --remove-all --dont-use-padding $flacfile)
+(set -x && run_metaflac --remove-all --dont-use-padding $flacfile)
check_exit
check_flac
-(set -x && $METAFLAC --set-vc-field="f=0123456789abcdefghij" $flacfile)
+(set -x && run_metaflac --set-vc-field="f=0123456789abcdefghij" $flacfile)
check_exit
check_flac
-(set -x && $METAFLAC --list --except-block-type=STREAMINFO $flacfile)
+(set -x && run_metaflac --list --except-block-type=STREAMINFO $flacfile)
check_exit
-(set -x && $METAFLAC --remove-vc-all --set-vc-field="f=0123456789abcdefghi" $flacfile)
+(set -x && run_metaflac --remove-vc-all --set-vc-field="f=0123456789abcdefghi" $flacfile)
check_exit
check_flac
-(set -x && $METAFLAC --list --except-block-type=STREAMINFO $flacfile)
+(set -x && run_metaflac --list --except-block-type=STREAMINFO $flacfile)
check_exit
-(set -x && $METAFLAC --remove-vc-all --set-vc-field="f=0123456789abcde" $flacfile)
+(set -x && run_metaflac --remove-vc-all --set-vc-field="f=0123456789abcde" $flacfile)
check_exit
check_flac
-(set -x && $METAFLAC --list --except-block-type=STREAMINFO $flacfile)
+(set -x && run_metaflac --list --except-block-type=STREAMINFO $flacfile)
check_exit
-(set -x && $METAFLAC --remove-vc-all --set-vc-field="f=0" $flacfile)
+(set -x && run_metaflac --remove-vc-all --set-vc-field="f=0" $flacfile)
check_exit
check_flac
-(set -x && $METAFLAC --list --except-block-type=STREAMINFO $flacfile)
+(set -x && run_metaflac --list --except-block-type=STREAMINFO $flacfile)
check_exit
-(set -x && $METAFLAC --remove-vc-all --set-vc-field="f=0123456789" $flacfile)
+(set -x && run_metaflac --remove-vc-all --set-vc-field="f=0123456789" $flacfile)
check_exit
check_flac
-(set -x && $METAFLAC --list --except-block-type=STREAMINFO $flacfile)
+(set -x && run_metaflac --list --except-block-type=STREAMINFO $flacfile)
check_exit
-(set -x && $METAFLAC --remove-vc-all --set-vc-field="f=0123456789abcdefghi" $flacfile)
+(set -x && run_metaflac --remove-vc-all --set-vc-field="f=0123456789abcdefghi" $flacfile)
check_exit
check_flac
-(set -x && $METAFLAC --list --except-block-type=STREAMINFO $flacfile)
+(set -x && run_metaflac --list --except-block-type=STREAMINFO $flacfile)
check_exit
-(set -x && $METAFLAC --remove-vc-all --set-vc-field="f=0123456789" $flacfile)
+(set -x && run_metaflac --remove-vc-all --set-vc-field="f=0123456789" $flacfile)
check_exit
check_flac
-(set -x && $METAFLAC --list --except-block-type=STREAMINFO $flacfile)
+(set -x && run_metaflac --list --except-block-type=STREAMINFO $flacfile)
check_exit
-(set -x && $METAFLAC --remove-vc-all --set-vc-field="f=0123456789abcdefghij" $flacfile)
+(set -x && run_metaflac --remove-vc-all --set-vc-field="f=0123456789abcdefghij" $flacfile)
check_exit
check_flac
-(set -x && $METAFLAC --list --except-block-type=STREAMINFO $flacfile)
+(set -x && run_metaflac --list --except-block-type=STREAMINFO $flacfile)
check_exit
-(set -x && echo "TITLE=Tittle" | $METAFLAC --import-vc-from=- $flacfile)
+(set -x && echo "TITLE=Tittle" | run_metaflac --import-vc-from=- $flacfile)
check_exit
check_flac
-(set -x && $METAFLAC --list --block-type=VORBIS_COMMENT $flacfile)
+(set -x && run_metaflac --list --block-type=VORBIS_COMMENT $flacfile)
check_exit
cat > vc.txt << EOF
artist=Fartist
artist=artits
EOF
-(set -x && $METAFLAC --import-vc-from=vc.txt $flacfile)
+(set -x && run_metaflac --import-vc-from=vc.txt $flacfile)
check_exit
check_flac
-(set -x && $METAFLAC --list --block-type=VORBIS_COMMENT $flacfile)
+(set -x && run_metaflac --list --block-type=VORBIS_COMMENT $flacfile)
check_exit
rm vc.txt
@@ -278,18 +291,18 @@ rm vc.txt
cs_in=cuesheets/good.000.cue
cs_out=metaflac.cue
cs_out2=metaflac2.cue
-(set -x && $METAFLAC --import-cuesheet-from="$cs_in" $flacfile)
+(set -x && run_metaflac --import-cuesheet-from="$cs_in" $flacfile)
check_exit
check_flac
-(set -x && $METAFLAC --export-cuesheet-to=$cs_out $flacfile)
+(set -x && run_metaflac --export-cuesheet-to=$cs_out $flacfile)
check_exit
-(set -x && $METAFLAC --remove --block-type=CUESHEET $flacfile)
+(set -x && run_metaflac --remove --block-type=CUESHEET $flacfile)
check_exit
check_flac
-(set -x && $METAFLAC --import-cuesheet-from=$cs_out $flacfile)
+(set -x && run_metaflac --import-cuesheet-from=$cs_out $flacfile)
check_exit
check_flac
-(set -x && $METAFLAC --export-cuesheet-to=$cs_out2 $flacfile)
+(set -x && run_metaflac --export-cuesheet-to=$cs_out2 $flacfile)
check_exit
echo "comparing cuesheets:"
if diff $cs_out $cs_out2 ; then : ; else
diff --git a/test/test_streams.sh b/test/test_streams.sh
index 2e240356..f4dc2e21 100755
--- a/test/test_streams.sh
+++ b/test/test_streams.sh
@@ -19,11 +19,20 @@
LD_LIBRARY_PATH=../src/libFLAC/.libs:../obj/release/lib:../obj/debug/lib:$LD_LIBRARY_PATH
export LD_LIBRARY_PATH
-PATH=../src/flac:../src/test_streams:../obj/release/b:../obj/debug/bin:$PATH
+PATH=../src/flac:../src/test_streams:../obj/release/bin:../obj/debug/bin:$PATH
flac --help 1>/dev/null 2>/dev/null || (echo "ERROR can't find flac executable" 1>&2 && exit 1)
if [ $? != 0 ] ; then exit 1 ; fi
+run_flac ()
+{
+ if [ "$FLAC__VALGRIND" = yes ] ; then
+ valgrind --leak-check=yes --show-reachable=yes --num-callers=10 --logfile-fd=4 flac $* 4>>valgrind.log
+ else
+ flac $*
+ fi
+}
+
echo "Generating streams..."
if test_streams ; then : ; else
echo "ERROR during test_streams" 1>&2
@@ -39,18 +48,15 @@ else
echo "flac --ogg doesn't work"
fi
-#FLAC="valgrind --leak-check=yes --show-reachable=yes --logfile-fd=1 flac"
-FLAC=flac
-
#
# multi-file tests
#
echo "Generating multiple input files from noise..."
-if $FLAC --verify --silent --force-raw-format --endian=big --sign=signed --sample-rate=44100 --bps=16 --channels=2 noise.raw ; then : ; else
+if run_flac --verify --silent --force-raw-format --endian=big --sign=signed --sample-rate=44100 --bps=16 --channels=2 noise.raw ; then : ; else
echo "ERROR generating FLAC file" 1>&2
exit 1
fi
-if $FLAC --decode --silent noise.flac ; then : ; else
+if run_flac --decode --silent noise.flac ; then : ; else
echo "ERROR generating WAVE file" 1>&2
exit 1
fi
@@ -76,14 +82,14 @@ test_multifile ()
encode_options="$encode_options --sector-align"
fi
- if $FLAC $encode_options file0.wav file1.wav file2.wav ; then : ; else
+ if run_flac $encode_options file0.wav file1.wav file2.wav ; then : ; else
echo "ERROR" 1>&2
exit 1
fi
for n in 0 1 2 ; do
mv file$n.$suffix file${n}x.$suffix
done
- if $FLAC --decode file0x.$suffix file1x.$suffix file2x.$suffix ; then : ; else
+ if run_flac --decode file0x.$suffix file1x.$suffix file2x.$suffix ; then : ; else
echo "ERROR" 1>&2
exit 1
fi
@@ -141,7 +147,7 @@ test_file ()
encode_options="$4"
echo -n "$name (--channels=$channels --bps=$bps $encode_options): encode..."
- cmd="$FLAC --verify --silent --force-raw-format --endian=big --sign=signed --sample-rate=44100 --bps=$bps --channels=$channels $encode_options $name.raw"
+ cmd="run_flac --verify --silent --force-raw-format --endian=big --sign=signed --sample-rate=44100 --bps=$bps --channels=$channels $encode_options $name.raw"
echo "### ENCODE $name #######################################################" >> ./streams.log
echo "### cmd=$cmd" >> ./streams.log
if $cmd 2>>./streams.log ; then : ; else
@@ -149,7 +155,7 @@ test_file ()
exit 1
fi
echo -n "decode..."
- cmd="$FLAC --silent --endian=big --sign=signed --decode --force-raw-format --output-name=$name.cmp $name.flac"
+ cmd="run_flac --silent --endian=big --sign=signed --decode --force-raw-format --output-name=$name.cmp $name.flac"
echo "### DECODE $name #######################################################" >> ./streams.log
echo "### cmd=$cmd" >> ./streams.log
if $cmd 2>>./streams.log ; then : ; else
@@ -182,7 +188,7 @@ test_file_piped ()
echo -n "$name: encode via pipes..."
if [ $is_win = yes ] ; then
- cmd="$FLAC --verify --silent --force-raw-format --endian=big --sign=signed --sample-rate=44100 --bps=$bps --channels=$channels $encode_options --stdout $name.raw"
+ cmd="run_flac --verify --silent --force-raw-format --endian=big --sign=signed --sample-rate=44100 --bps=$bps --channels=$channels $encode_options --stdout $name.raw"
echo "### ENCODE $name #######################################################" >> ./streams.log
echo "### cmd=$cmd" >> ./streams.log
if $cmd 1>$name.flac 2>>./streams.log ; then : ; else
@@ -190,7 +196,7 @@ test_file_piped ()
exit 1
fi
else
- cmd="$FLAC --verify --silent --force-raw-format --endian=big --sign=signed --sample-rate=44100 --bps=$bps --channels=$channels $encode_options --stdout -"
+ cmd="run_flac --verify --silent --force-raw-format --endian=big --sign=signed --sample-rate=44100 --bps=$bps --channels=$channels $encode_options --stdout -"
echo "### ENCODE $name #######################################################" >> ./streams.log
echo "### cmd=$cmd" >> ./streams.log
if cat $name.raw | $cmd 1>$name.flac 2>>./streams.log ; then : ; else
@@ -200,7 +206,7 @@ test_file_piped ()
fi
echo -n "decode via pipes..."
if [ $is_win = yes ] ; then
- cmd="$FLAC --silent --endian=big --sign=signed --decode --force-raw-format --stdout $name.flac"
+ cmd="run_flac --silent --endian=big --sign=signed --decode --force-raw-format --stdout $name.flac"
echo "### DECODE $name #######################################################" >> ./streams.log
echo "### cmd=$cmd" >> ./streams.log
if $cmd 1>$name.cmp 2>>./streams.log ; then : ; else
@@ -208,7 +214,7 @@ test_file_piped ()
exit 1
fi
else
- cmd="$FLAC --silent --endian=big --sign=signed --decode --force-raw-format --stdout -"
+ cmd="run_flac --silent --endian=big --sign=signed --decode --force-raw-format --stdout -"
echo "### DECODE $name #######################################################" >> ./streams.log
echo "### cmd=$cmd" >> ./streams.log
if cat $name.flac | $cmd 1>$name.cmp 2>>./streams.log ; then : ; else