go.sh 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128
  1. #!/bin/bash
  2. export XOPT XDEFS
  3. XOPT="-ggdb -O0 -fomit-frame-pointer -DTEST_DELAY_BETWEEN_TESTS=0 -fprofile-arcs -ftest-coverage"
  4. XDEFS=""
  5. function clean() {
  6. echo -n " * Cleaning..."
  7. make clean > /dev/null
  8. echo "OK"
  9. }
  10. function compile() {
  11. echo -n " * Building..."
  12. if ! make > buildlog.txt
  13. then
  14. echo "failed"
  15. clean
  16. exit
  17. fi
  18. mv -f buildlog.txt ./reports/${1}_build.txt
  19. echo "OK"
  20. }
  21. function execute_test() {
  22. echo -n " * Testing..."
  23. if ! ./build/ch > testlog.txt
  24. then
  25. echo "failed"
  26. clean
  27. exit
  28. fi
  29. mv -f testlog.txt ./reports/${1}_test.txt
  30. echo "OK"
  31. }
  32. function coverage() {
  33. echo -n " * Coverage..."
  34. mkdir reports/${1}_gcov 2> /dev/null
  35. echo "Configuration $2" > gcovlog.txt
  36. echo "----------------------------------------------------------------" >> gcovlog.txt
  37. if ! make gcov >> gcovlog.txt 2> /dev/null
  38. then
  39. echo "failed"
  40. clean
  41. exit
  42. fi
  43. mv -f gcovlog.txt ./reports/${1}_gcov.txt
  44. mv -f *.gcov ./reports/${1}_gcov
  45. echo "OK"
  46. }
  47. function misra() {
  48. echo -n " * Analysing..."
  49. if ! make misra > misralog.txt 2> misraerrlog.txt
  50. then
  51. echo "failed"
  52. clean
  53. exit
  54. fi
  55. echo "OK"
  56. }
  57. function test() {
  58. if [ -z "$2" ]
  59. then
  60. msg=$1": Default Settings"
  61. XDEFS=
  62. else
  63. msg=$1": "$2
  64. XDEFS=$2
  65. fi
  66. echo $msg
  67. compile $1
  68. execute_test $1
  69. coverage $1 "$msg"
  70. misra
  71. clean
  72. }
  73. function partial() {
  74. compile
  75. execute_test
  76. misra
  77. clean
  78. }
  79. mkdir reports 2> /dev/null
  80. test cfg1 ""
  81. test cfg2 "-DCH_CFG_OPTIMIZE_SPEED=FALSE"
  82. test cfg3 "-DCH_CFG_TIME_QUANTUM=0"
  83. test cfg4 "-DCH_CFG_USE_REGISTRY=FALSE -DCH_CFG_USE_DYNAMIC=FALSE"
  84. test cfg5 "-DCH_CFG_USE_TM=FALSE"
  85. test cfg6 "-DCH_CFG_USE_SEMAPHORES=FALSE -DCH_CFG_USE_MAILBOXES=FALSE -DCH_CFG_USE_OBJ_FIFOS=FALSE"
  86. test cfg7 "-DCH_CFG_USE_SEMAPHORES_PRIORITY=TRUE"
  87. test cfg8 "-DCH_CFG_USE_MUTEXES=FALSE -DCH_CFG_USE_CONDVARS=FALSE"
  88. test cfg9 "-DCH_CFG_USE_MUTEXES_RECURSIVE=TRUE"
  89. test cfg10 "-DCH_CFG_USE_CONDVARS=FALSE"
  90. test cfg11 "-DCH_CFG_USE_CONDVARS_TIMEOUT=FALSE"
  91. test cfg12 "-DCH_CFG_USE_EVENTS=FALSE"
  92. test cfg13 "-DCH_CFG_USE_EVENTS_TIMEOUT=FALSE"
  93. test cfg14 "-DCH_CFG_USE_MESSAGES=FALSE"
  94. test cfg15 "-DCH_CFG_USE_MESSAGES_PRIORITY=TRUE"
  95. test cfg16 "-DCH_CFG_USE_MAILBOXES=FALSE -DCH_CFG_USE_OBJ_FIFOS=FALSE"
  96. test cfg17 "-DCH_CFG_USE_MEMCORE=FALSE -DCH_CFG_USE_MEMPOOLS=FALSE -DCH_CFG_USE_HEAP=FALSE -DCH_CFG_USE_DYNAMIC=FALSE -DCH_CFG_USE_OBJ_FIFOS=FALSE -DCH_CFG_USE_FACTORY=FALSE"
  97. test cfg18 "-DCH_CFG_USE_MEMPOOLS=FALSE -DCH_CFG_USE_HEAP=FALSE -DCH_CFG_USE_DYNAMIC=FALSE -DCH_CFG_USE_OBJ_FIFOS=FALSE -DCH_CFG_USE_FACTORY=FALSE"
  98. test cfg19 "-DCH_CFG_USE_MEMPOOLS=FALSE -DCH_CFG_USE_OBJ_FIFOS=FALSE -DCH_CFG_USE_FACTORY=FALSE"
  99. test cfg20 "-DCH_CFG_USE_HEAP=FALSE -DCH_CFG_USE_FACTORY=FALSE"
  100. test cfg21 "-DCH_CFG_USE_DYNAMIC=FALSE"
  101. test cfg22 "-DCH_DBG_STATISTICS=TRUE"
  102. test cfg23 "-DCH_DBG_SYSTEM_STATE_CHECK=TRUE"
  103. test cfg24 "-DCH_DBG_ENABLE_CHECKS=TRUE"
  104. test cfg25 "-DCH_DBG_ENABLE_ASSERTS=TRUE"
  105. test cfg26 "-DCH_DBG_TRACE_MASK=CH_DBG_TRACE_MASK_ALL"
  106. #test cfg27 "-DCH_DBG_ENABLE_STACK_CHECK=TRUE"
  107. test cfg28 "-DCH_DBG_FILL_THREADS=TRUE"
  108. test cfg29 "-DCH_DBG_THREADS_PROFILING=FALSE"
  109. test cfg30 "-DCH_DBG_SYSTEM_STATE_CHECK=TRUE -DCH_DBG_ENABLE_CHECKS=TRUE -DCH_DBG_ENABLE_ASSERTS=TRUE -DCH_DBG_TRACE_MASK=CH_DBG_TRACE_MASK_ALL -DCH_DBG_FILL_THREADS=TRUE"
  110. test cfg31 "-DCH_CFG_ST_RESOLUTION=16"
  111. test cfg32 "-DCH_CFG_ST_RESOLUTION=16 -DCH_CFG_INTERVALS_SIZE=64"
  112. test cfg33 "-DCH_CFG_INTERVALS_SIZE=64"
  113. test cfg34 "-DCH_CFG_USE_OBJ_FIFOS=FALSE"
  114. test cfg35 "-DCH_CFG_USE_FACTORY=FALSE"
  115. rm *log.txt 2> /dev/null
  116. echo
  117. echo "Done"