diff src/libsndfile-1.0.27/Octave/octave_test.sh @ 125:cd6cdf86811e

Current libsndfile source
author Chris Cannam <cannam@all-day-breakfast.com>
date Tue, 18 Oct 2016 13:22:47 +0100
parents
children
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/libsndfile-1.0.27/Octave/octave_test.sh	Tue Oct 18 13:22:47 2016 +0100
@@ -0,0 +1,81 @@
+#!/bin/bash
+
+
+# Check where we're being run from.
+if test -d Octave ; then
+	cd Octave
+	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)
+	fi
+
+# Find libsndfile shared object.
+libsndfile_lib_location=""
+
+if test -f "../src/.libs/libsndfile.so" ; then
+	libsndfile_lib_location="../src/.libs/"
+elif test -f "../src/libsndfile.so" ; then
+	libsndfile_lib_location="../src/"
+elif test -f "../src/.libs/libsndfile.dylib" ; then
+	libsndfile_lib_location="../src/.libs/"
+elif test -f "../src/libsndfile.dylib" ; then
+	libsndfile_lib_location="../src/"
+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
+	fi
+
+libsndfile_lib_location=`(cd $libsndfile_lib_location && pwd)`
+
+
+# Find sndfile.oct
+sndfile_oct_location=""
+
+if test -f .libs/sndfile.oct ; then
+	sndfile_oct_location=".libs"
+elif test -f sndfile.oct ; then
+	sndfile_oct_location="."
+else
+	echo "Not able to find the sndfile.oct binaries we've just built."
+	exit 1
+	fi
+
+case `file -b $sndfile_oct_location/sndfile.oct` in
+	ELF*)
+		;;
+	Mach*)
+		echo "Tests don't work on this platform."
+		exit 0
+		;;
+	*)
+		echo "Not able to find the sndfile.oct binary we just built."
+		exit 1
+		;;
+	esac
+
+
+# Make sure the TERM environment variable doesn't contain anything wrong.
+unset TERM
+# echo "octave_src_dir : $octave_src_dir"
+# echo "libsndfile_lib_location : $libsndfile_lib_location"
+# echo "sndfile_oct_location : $sndfile_oct_location"
+
+if test ! -f PKG_ADD ; then
+	cp $octave_src_dir/PKG_ADD .
+	fi
+
+export LD_LIBRARY_PATH="$libsndfile_lib_location:$LD_LIBRARY_PATH"
+
+octave_script="$octave_src_dir/octave_test.m"
+
+(cd $sndfile_oct_location && octave -qH $octave_script)
+res=$?
+echo
+exit $res