tests.sh 2.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  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. # json-indent (d), circular (l)
  8. # 2. MODE: reflection (r), external (x), codecgen (g), unsafe (u), notfastpath (f)
  9. # 3. OPTIONS: verbose (v), reset (z), must (m),
  10. #
  11. # Use combinations of mode to get exactly what you want,
  12. # and then pass the variations you need.
  13. ztags=""
  14. zargs=""
  15. local OPTIND
  16. OPTIND=1
  17. while getopts "_xurtcinsvgzmefdl" flag
  18. do
  19. case "x$flag" in
  20. 'xr') ;;
  21. 'xf') ztags="$ztags notfastpath" ;;
  22. 'xg') ztags="$ztags codecgen" ;;
  23. 'xx') ztags="$ztags x" ;;
  24. 'xu') ztags="$ztags unsafe" ;;
  25. 'xv') zargs="$zargs -tv" ;;
  26. 'xz') zargs="$zargs -tr" ;;
  27. 'xm') zargs="$zargs -tm" ;;
  28. 'xl') zargs="$zargs -tl" ;;
  29. *) ;;
  30. esac
  31. done
  32. # shift $((OPTIND-1))
  33. printf '............. TAGS: %s .............\n' "$ztags"
  34. # echo ">>>>>>> TAGS: $ztags"
  35. OPTIND=1
  36. while getopts "_xurtcinsvgzmefdl" flag
  37. do
  38. case "x$flag" in
  39. 'xt') printf ">>>>>>> REGULAR : "; go test "-tags=$ztags" $zargs ; sleep 2 ;;
  40. 'xc') printf ">>>>>>> CANONICAL : "; go test "-tags=$ztags" $zargs -tc; sleep 2 ;;
  41. 'xi') printf ">>>>>>> I/O : "; go test "-tags=$ztags" $zargs -ti; sleep 2 ;;
  42. 'xn') printf ">>>>>>> NO_SYMBOLS : "; go test "-tags=$ztags" -run=Binc $zargs -tn; sleep 2 ;;
  43. 'xs') printf ">>>>>>> TO_ARRAY : "; go test "-tags=$ztags" $zargs -ts; sleep 2 ;;
  44. 'xe') printf ">>>>>>> INTERN : "; go test "-tags=$ztags" $zargs -te; sleep 2 ;;
  45. 'xd') printf ">>>>>>> INDENT : ";
  46. go test "-tags=$ztags" -run=JsonCodecsTable -td=-1 $zargs;
  47. go test "-tags=$ztags" -run=JsonCodecsTable -td=8 $zargs;
  48. sleep 2 ;;
  49. *) ;;
  50. esac
  51. done
  52. shift $((OPTIND-1))
  53. OPTIND=1
  54. }
  55. # echo ">>>>>>> RUNNING VARIATIONS OF TESTS"
  56. if [[ "x$@" = "x" ]]; then
  57. # All: r, x, g, gu
  58. _run "-_tcinsed_ml" # regular
  59. _run "-_tcinsed_ml_z" # regular with reset
  60. _run "-_tcinsed_ml_f" # regular with no fastpath (notfastpath)
  61. _run "-x_tcinsed_ml" # external
  62. _run "-gx_tcinsed_ml" # codecgen: requires external
  63. _run "-gxu_tcinsed_ml" # codecgen + unsafe
  64. elif [[ "x$@" = "x-Z" ]]; then
  65. # Regular
  66. _run "-_tcinsed_ml" # regular
  67. _run "-_tcinsed_ml_z" # regular with reset
  68. elif [[ "x$@" = "x-F" ]]; then
  69. # regular with notfastpath
  70. _run "-_tcinsed_ml_f" # regular
  71. _run "-_tcinsed_ml_zf" # regular with reset
  72. else
  73. _run "$@"
  74. fi