validate.sh 1.4 KB

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