tests.sh 2.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. #!/bin/bash
  2. # Run all the different permutations of all the tests.
  3. # This helps ensure that nothing gets broken.
  4. _run() {
  5. # 1. VARIATIONS: regular (t), canonical (c), IO R/W (i),
  6. # binc-nosymbols (n), struct2array (s), intern string (e),
  7. # 2. MODE: reflection (r), external (x), codecgen (g), unsafe (u), notfastpath (f)
  8. # 3. OPTIONS: verbose (v), reset (z), must (m),
  9. #
  10. # Use combinations of mode to get exactly what you want,
  11. # and then pass the variations you need.
  12. ztags=""
  13. zargs=""
  14. local OPTIND
  15. OPTIND=1
  16. while getopts "xurtcinsvgzmef" flag
  17. do
  18. case "x$flag" in
  19. 'xr') ;;
  20. 'xf') ztags="$ztags notfastpath" ;;
  21. 'xg') ztags="$ztags codecgen" ;;
  22. 'xx') ztags="$ztags x" ;;
  23. 'xu') ztags="$ztags unsafe" ;;
  24. 'xv') zargs="$zargs -tv" ;;
  25. 'xz') zargs="$zargs -tr" ;;
  26. 'xm') zargs="$zargs -tm" ;;
  27. *) ;;
  28. esac
  29. done
  30. # shift $((OPTIND-1))
  31. printf '............. TAGS: %s .............\n' "$ztags"
  32. # echo ">>>>>>> TAGS: $ztags"
  33. OPTIND=1
  34. while getopts "xurtcinsvgzmef" flag
  35. do
  36. case "x$flag" in
  37. 'xt') printf ">>>>>>> REGULAR : "; go test "-tags=$ztags" $zargs ; sleep 2 ;;
  38. 'xc') printf ">>>>>>> CANONICAL : "; go test "-tags=$ztags" $zargs -tc; sleep 2 ;;
  39. 'xi') printf ">>>>>>> I/O : "; go test "-tags=$ztags" $zargs -ti; sleep 2 ;;
  40. 'xn') printf ">>>>>>> NO_SYMBOLS : "; go test "-tags=$ztags" $zargs -tn; sleep 2 ;;
  41. 'xs') printf ">>>>>>> TO_ARRAY : "; go test "-tags=$ztags" $zargs -ts; sleep 2 ;;
  42. 'xe') printf ">>>>>>> INTERN : "; go test "-tags=$ztags" $zargs -te; sleep 2 ;;
  43. *) ;;
  44. esac
  45. done
  46. shift $((OPTIND-1))
  47. OPTIND=1
  48. }
  49. # echo ">>>>>>> RUNNING VARIATIONS OF TESTS"
  50. if [[ "x$@" = "x" ]]; then
  51. # All: r, x, g, gu
  52. _run "-rtcinsm" # regular
  53. _run "-rtcinsmz" # regular with reset
  54. _run "-rtcinsmf" # regular with no fastpath (notfastpath)
  55. _run "-xtcinsm" # external
  56. _run "-gxtcinsm" # codecgen: requires external
  57. _run "-gxutcinsm" # codecgen + unsafe
  58. elif [[ "x$@" = "x-Z" ]]; then
  59. # Regular
  60. _run "-rtcinsm" # regular
  61. _run "-rtcinsmz" # regular with reset
  62. elif [[ "x$@" = "x-F" ]]; then
  63. # regular with notfastpath
  64. _run "-rtcinsmf" # regular
  65. _run "-rtcinsmzf" # regular with reset
  66. else
  67. _run "$@"
  68. fi