validate.sh 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  1. #!/bin/bash
  2. cd ..;
  3. # LOAD REQUIRED LIBRARIES:
  4. if [ "$(uname)" == "Linux" ]; then
  5. # With or without the GMSH API:
  6. if [ -d ~/SLlibs/gmsh ]; then
  7. LD_LIBRARY_PATH="$HOME/SLlibs/petsc/arch-linux2-c-opt/lib":"$HOME/SLlibs/gmsh/lib":$LD_LIBRARY_PATH
  8. else
  9. LD_LIBRARY_PATH="$HOME/SLlibs/petsc/arch-linux2-c-opt/lib":$LD_LIBRARY_PATH
  10. fi
  11. export LD_LIBRARY_PATH=$LD_LIBRARY_PATH
  12. elif [ "$(uname)" == "Darwin" ]; then
  13. DYLD_LIBRARY_PATH="$HOME/SLlibs/petsc/arch-darwin-c-opt/lib":$DYLD_LIBRARY_PATH
  14. export DYLD_LIBRARY_PATH=$DYLD_LIBRARY_PATH
  15. fi
  16. # COMPILE SPARSELIZARD:
  17. make -j4;
  18. # LOOP ON ALL EXAMPLES:
  19. echo '';
  20. for i in $(ls examples);
  21. do
  22. # Skip this script as well as all too heavy examples:
  23. if [ $i == "validate.sh" ] || [ $i == "electromagnetic-waveguide-time-resolution-3d" ] || [ $i == "superconductor-3d" ] || [ $i == "nonlinear-vonkarman-vortex-2d" ] || [ $i == "thermoacoustic-elasticity-axisymmetry-2d" ]
  24. then
  25. continue
  26. fi
  27. # Copy the example to the main directory:
  28. cp examples/$i/main.cpp ./;
  29. cp examples/$i/*.msh ./ 2>/dev/null;
  30. cp examples/$i/*.nas ./ 2>/dev/null;
  31. cp examples/$i/*.txt ./ 2>/dev/null;
  32. # Compile the current example
  33. makeout=$(make -j4);
  34. # Run the current example:
  35. out=$(./sparselizard);
  36. # Get the last character in the output:
  37. out="${out:$((${#out}-1)):1}"
  38. # If the last character is 1 the current example was run successfully:
  39. if [ $out == "1" ]
  40. then
  41. echo 'SUCCESS AT' $i;
  42. sleep 2;
  43. else
  44. echo 'FAILED AT' $i;
  45. echo '';
  46. exit 1;
  47. fi
  48. done
  49. echo '';
  50. echo '';
  51. echo 'ALL OK!';
  52. # CLEAN:
  53. rm *.msh;
  54. rm *.nas;
  55. rm *.pos;
  56. rm *.vtk;
  57. rm *.vtu;
  58. rm *.pvd;
  59. rm *.csv;