1b815c7f3Sopenharmony_ci#!/bin/bash 2b815c7f3Sopenharmony_ci 3b815c7f3Sopenharmony_ci 4b815c7f3Sopenharmony_ci# Check where we're being run from. 5b815c7f3Sopenharmony_ciif test -d Octave ; then 6b815c7f3Sopenharmony_ci cd Octave 7b815c7f3Sopenharmony_ci octave_src_dir=$(pwd) 8b815c7f3Sopenharmony_cielif test -z "$octave_src_dir" ; then 9b815c7f3Sopenharmony_ci echo 10b815c7f3Sopenharmony_ci echo "Error : \$octave_src_dir is undefined." 11b815c7f3Sopenharmony_ci echo 12b815c7f3Sopenharmony_ci exit 1 13b815c7f3Sopenharmony_cielse 14b815c7f3Sopenharmony_ci octave_src_dir=$(cd $octave_src_dir && pwd) 15b815c7f3Sopenharmony_ci fi 16b815c7f3Sopenharmony_ci 17b815c7f3Sopenharmony_ci# Find libsndfile shared object. 18b815c7f3Sopenharmony_cilibsndfile_lib_location="" 19b815c7f3Sopenharmony_ci 20b815c7f3Sopenharmony_ciif test -f "../src/.libs/libsndfile.so" ; then 21b815c7f3Sopenharmony_ci libsndfile_lib_location="../src/.libs/" 22b815c7f3Sopenharmony_cielif test -f "../src/libsndfile.so" ; then 23b815c7f3Sopenharmony_ci libsndfile_lib_location="../src/" 24b815c7f3Sopenharmony_cielif test -f "../src/.libs/libsndfile.dylib" ; then 25b815c7f3Sopenharmony_ci libsndfile_lib_location="../src/.libs/" 26b815c7f3Sopenharmony_cielif test -f "../src/libsndfile.dylib" ; then 27b815c7f3Sopenharmony_ci libsndfile_lib_location="../src/" 28b815c7f3Sopenharmony_cielse 29b815c7f3Sopenharmony_ci echo 30b815c7f3Sopenharmony_ci echo "Not able to find the libsndfile shared lib we've just built." 31b815c7f3Sopenharmony_ci echo "This may cause the following test to fail." 32b815c7f3Sopenharmony_ci echo 33b815c7f3Sopenharmony_ci fi 34b815c7f3Sopenharmony_ci 35b815c7f3Sopenharmony_cilibsndfile_lib_location=`(cd $libsndfile_lib_location && pwd)` 36b815c7f3Sopenharmony_ci 37b815c7f3Sopenharmony_ci 38b815c7f3Sopenharmony_ci# Find sndfile.oct 39b815c7f3Sopenharmony_cisndfile_oct_location="" 40b815c7f3Sopenharmony_ci 41b815c7f3Sopenharmony_ciif test -f .libs/sndfile.oct ; then 42b815c7f3Sopenharmony_ci sndfile_oct_location=".libs" 43b815c7f3Sopenharmony_cielif test -f sndfile.oct ; then 44b815c7f3Sopenharmony_ci sndfile_oct_location="." 45b815c7f3Sopenharmony_cielse 46b815c7f3Sopenharmony_ci echo "Not able to find the sndfile.oct binaries we've just built." 47b815c7f3Sopenharmony_ci exit 1 48b815c7f3Sopenharmony_ci fi 49b815c7f3Sopenharmony_ci 50b815c7f3Sopenharmony_cicase `file -b $sndfile_oct_location/sndfile.oct` in 51b815c7f3Sopenharmony_ci ELF*) 52b815c7f3Sopenharmony_ci ;; 53b815c7f3Sopenharmony_ci Mach*) 54b815c7f3Sopenharmony_ci echo "Tests don't work on this platform." 55b815c7f3Sopenharmony_ci exit 0 56b815c7f3Sopenharmony_ci ;; 57b815c7f3Sopenharmony_ci *) 58b815c7f3Sopenharmony_ci echo "Not able to find the sndfile.oct binary we just built." 59b815c7f3Sopenharmony_ci exit 1 60b815c7f3Sopenharmony_ci ;; 61b815c7f3Sopenharmony_ci esac 62b815c7f3Sopenharmony_ci 63b815c7f3Sopenharmony_ci 64b815c7f3Sopenharmony_ci# Make sure the TERM environment variable doesn't contain anything wrong. 65b815c7f3Sopenharmony_ciunset TERM 66b815c7f3Sopenharmony_ci# echo "octave_src_dir : $octave_src_dir" 67b815c7f3Sopenharmony_ci# echo "libsndfile_lib_location : $libsndfile_lib_location" 68b815c7f3Sopenharmony_ci# echo "sndfile_oct_location : $sndfile_oct_location" 69b815c7f3Sopenharmony_ci 70b815c7f3Sopenharmony_ciif test ! -f PKG_ADD ; then 71b815c7f3Sopenharmony_ci cp $octave_src_dir/PKG_ADD . 72b815c7f3Sopenharmony_ci fi 73b815c7f3Sopenharmony_ci 74b815c7f3Sopenharmony_ciexport LD_LIBRARY_PATH="$libsndfile_lib_location:$LD_LIBRARY_PATH" 75b815c7f3Sopenharmony_ci 76b815c7f3Sopenharmony_cioctave_script="$octave_src_dir/octave_test.m" 77b815c7f3Sopenharmony_ci 78b815c7f3Sopenharmony_ci(cd $sndfile_oct_location && octave -qH $octave_script) 79b815c7f3Sopenharmony_cires=$? 80b815c7f3Sopenharmony_ciecho 81b815c7f3Sopenharmony_ciexit $res 82