third_party_libsnd/Octave/octave_test.sh

82 lines
1.8 KiB
Bash
Raw Permalink Normal View History

2007-08-26 02:45:48 +00:00
#!/bin/bash
# Check where we're being run from.
2012-11-30 10:44:02 +00:00
if test -d Octave ; then
2007-08-26 02:45:48 +00:00
cd Octave
2012-11-30 10:44:02 +00:00
octave_src_dir=$(pwd)
elif test -z "$octave_src_dir" ; then
echo
echo "Error : \$octave_src_dir is undefined."
echo
exit 1
else
octave_src_dir=$(cd $octave_src_dir && pwd)
2007-08-26 02:45:48 +00:00
fi
# Find libsndfile shared object.
libsndfile_lib_location=""
2007-08-26 02:45:48 +00:00
2012-11-30 10:44:02 +00:00
if test -f "../src/.libs/libsndfile.so" ; then
libsndfile_lib_location="../src/.libs/"
2012-11-30 10:44:02 +00:00
elif test -f "../src/libsndfile.so" ; then
libsndfile_lib_location="../src/"
2012-11-30 10:44:02 +00:00
elif test -f "../src/.libs/libsndfile.dylib" ; then
libsndfile_lib_location="../src/.libs/"
2012-11-30 10:44:02 +00:00
elif test -f "../src/libsndfile.dylib" ; then
libsndfile_lib_location="../src/"
2007-08-26 02:45:48 +00:00
else
echo
echo "Not able to find the libsndfile shared lib we've just built."
echo "This may cause the following test to fail."
echo
2007-08-26 02:45:48 +00:00
fi
libsndfile_lib_location=`(cd $libsndfile_lib_location && pwd)`
2007-08-26 02:45:48 +00:00
2008-10-27 08:54:49 +00:00
# Find sndfile.oct
sndfile_oct_location=""
2007-08-26 02:45:48 +00:00
2012-11-30 10:44:02 +00:00
if test -f .libs/sndfile.oct ; then
2008-10-27 08:54:49 +00:00
sndfile_oct_location=".libs"
2012-11-30 10:44:02 +00:00
elif test -f sndfile.oct ; then
2008-10-27 08:54:49 +00:00
sndfile_oct_location="."
2007-08-26 02:45:48 +00:00
else
2008-10-27 08:54:49 +00:00
echo "Not able to find the sndfile.oct binaries we've just built."
2007-08-26 02:45:48 +00:00
exit 1
fi
2008-10-27 08:54:49 +00:00
case `file -b $sndfile_oct_location/sndfile.oct` in
2007-08-26 02:45:48 +00:00
ELF*)
;;
Mach*)
echo "Tests don't work on this platform."
exit 0
;;
2007-08-26 02:45:48 +00:00
*)
2012-11-30 10:44:02 +00:00
echo "Not able to find the sndfile.oct binary we just built."
2007-08-26 02:45:48 +00:00
exit 1
;;
esac
# Make sure the TERM environment variable doesn't contain anything wrong.
unset TERM
2012-11-30 10:44:02 +00:00
# echo "octave_src_dir : $octave_src_dir"
# echo "libsndfile_lib_location : $libsndfile_lib_location"
2008-10-27 08:54:49 +00:00
# echo "sndfile_oct_location : $sndfile_oct_location"
2007-08-26 02:45:48 +00:00
2012-11-30 10:44:02 +00:00
if test ! -f PKG_ADD ; then
cp $octave_src_dir/PKG_ADD .
fi
2007-08-26 02:45:48 +00:00
2012-11-30 10:44:02 +00:00
export LD_LIBRARY_PATH="$libsndfile_lib_location:$LD_LIBRARY_PATH"
2007-08-26 03:12:04 +00:00
octave_script="$octave_src_dir/octave_test.m"
2007-08-26 02:45:48 +00:00
2008-10-27 08:54:49 +00:00
(cd $sndfile_oct_location && octave -qH $octave_script)
2012-11-30 10:44:02 +00:00
res=$?
echo
exit $res