Subversion Repositories wimsdev

Rev

Rev 10196 | Blame | Compare with Previous | Last modification | View Log | RSS feed

  1. #!/bin/sh
  2. wims_home=`pwd`;
  3. dir=$wims_home/wimstest/flydraw
  4. flydraw=$wims_home/src/Flydraw/flydraw
  5. mkdir -p $dir/tmp
  6.  
  7. check(){
  8.     cmp --quiet -i 8:8 $dir/tmp/$f.gif $dir/targets/$f.gif
  9.     case "$?" in
  10.         0) echo "OK, test $f passed."
  11.            ok=$((ok+1))
  12.            ;;
  13.         1) echo "FAIL: images differ with test $f"
  14.            nok=$((nok+1))
  15.            ;;
  16.         2) echo "FAIL: something is wrong with $f, maybe some missing file?"
  17.            ;;
  18.         *) echo "BAAAD! this should never happen!"
  19.            exit2
  20.            ;;
  21.     esac
  22. }
  23.  
  24. #----------------- INITIALISATIONS ------------------------
  25. ok=0
  26. nok=0
  27.  
  28. rm -f $dir/tmp/*.gif
  29.  
  30. #------------------- TESTS ---------------------------------
  31. echo "---------- TESTING FLYDRAW --------------"
  32.  
  33.  
  34. list=`ls $dir/src`;
  35. for f in $list; do
  36.  draw_content=`cat $dir/src/$f`
  37.  $flydraw <<@
  38. $draw_content
  39. output $dir/tmp/$f.gif
  40. @
  41. check
  42. done;
  43.  
  44.  
  45. #---------------------- SUMMARY -----------------------
  46. echo "------- END OF TEST FOR FLYDRAW ---------"
  47. echo "Tests passed: $ok"
  48. echo "Tests failed: $nok"
  49. echo "-----------------------------------------"
  50.  
  51. #------------- Return non-zero value if failed --------
  52. if [ "$nok" -gt 0 ]; then
  53.     exit 1
  54. fi
  55.  
  56.