octave_test.sh 1.8 KB

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