Advertisement
Gistrec

Run custom tests

Aug 23rd, 2019
259
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 4.40 KB | None | 0 0
  1. HelpMessage() {
  2.     echo "#######################################"
  3.     echo "# Script runs the tests for Intel(R) ADL"
  4.     echo "# Usage: ${BASH_SOURCE[1]} -o <OS> [-c <compiler>] [-a <arch>] [-i <isa>] [-m <mode>] [-d <domain>]"
  5.     echo "# Args:"
  6.     echo "#   -o/--os         - Target OS. Available OS: linux, qnx70. Default: linux"
  7.     echo "#   -c/--compiler   - Compiler used for test. Available compilers are: intel1900, gnu540, gnu710 and so on"
  8.     echo "#   -a/--arch       - Target architecture. Available architectures: intel64. Default: intel64"
  9.     echo "#   -i/--isa        - ISA, Available ISAs: sse42, avx512. Default: sse42"
  10.     echo "#   -m/--mode       - Test mode. Available modes: release, debug, relwithdebinfo, minsizerel. Default: release"
  11.     echo "#   -d/--domain     - Domain to run. By default, all domains are selected for test"
  12.     echo "#   --test-case     - Test case name. By default, all test cases are selected for run"
  13.     echo "#   --interface     - Interface to test. Available interfaces: c, cpp. Default: both"
  14.     echo "#   -t/--test-type  - Test type. Available types: correct_interface, incorrect_arguments, plausibility"
  15.     echo "#   --unit          - Unit to test. By default, all domain units are selected for test"
  16.     echo "#######################################"
  17. }
  18.  
  19. ErrorMessage() {
  20.     if [ $1 != 0 ]; then
  21.         echo $2 - FAILED
  22.         exit $1
  23.     fi
  24. }
  25.  
  26. while [[ $# -ge 1 ]]
  27. do
  28.     key="$1"
  29.  
  30.     case $key in
  31.         -d|--domain)
  32.             DOMAIN="$2"
  33.             shift
  34.             ;;
  35.         -a|--arch)
  36.             LIB_ARCH="$2"
  37.             shift
  38.             ;;
  39.         --test-case)
  40.             TEST_CASE="$2"
  41.             shift
  42.             ;;
  43.         -i|--isa)
  44.             ISA="$2"
  45.             shift
  46.             ;;
  47.         --interface)
  48.             INTERFACE="$2"
  49.             shift
  50.             ;;
  51.         -c|--compiler)
  52.             COMPILER="$2"
  53.             shift
  54.             ;;
  55.         -o|--os)
  56.             OS="$2"
  57.             shift
  58.             ;;
  59.         -m|--mode)
  60.             MODE="$2"
  61.             shift
  62.             ;;
  63.         -t|--test-type)
  64.             TEST_TYPE="$2"
  65.             shift
  66.             ;;
  67.         --unit)
  68.             UNIT="$2"
  69.             shift
  70.             ;;
  71.         *)
  72.             ;;
  73.     esac
  74.  
  75.     shift
  76. done
  77.  
  78. if [ "${OS}" == "" ]; then
  79.     OS="linux"
  80. fi
  81.  
  82. if [ "${ARCH}" == "" ]; then
  83.     ARCH="intel64"
  84. fi
  85.  
  86. if [ "${MODE}" == "" ]; then
  87.     MODE="release"
  88. fi
  89.  
  90. if [ "${COMPILER}" == "" ]; then
  91.     ErrorMessage 1 "You have to set compiler"
  92. fi
  93.  
  94. if [ "${INTERFACE}" == "" ]; then
  95.     INTERFACE="*"
  96. fi
  97.  
  98. if [ "${TEST_TYPE}" == "" ]; then
  99.     TEST_TYPE="*"
  100. fi
  101.  
  102. if [ "${DOMAIN}" == "" ]; then
  103.     DOMAIN="*"
  104. fi
  105.  
  106. if [ "${UNIT}" == "" ]; then
  107.     UNIT="*"
  108. fi
  109.  
  110. if [ "$TEST_CASE" == "" ]; then
  111.     TEST_CASE="*"
  112. fi
  113.  
  114. if [ "${ISA}" == "" ]; then
  115.     ISA="sse42"
  116. fi
  117.  
  118. echo "#######################################"
  119. echo "# Starting ADL TS"
  120. echo "# Test configuration:"
  121. echo "# COMPILER:   ${COMPILER}"
  122. echo "# OS:         ${OS}"
  123. echo "# LIB_ARCH:   ${ARCH}"
  124. echo "# MODE:       ${MODE}"
  125. echo "# ISA:        ${ISA}"
  126. echo "# DOMAIN:     ${DOMAIN}"
  127. echo "# TEST CASE:  ${TEST_CASE}"
  128. echo "# TEST TYPE:  ${TEST_TYPE}"
  129. echo "# UNIT:       ${UNIT}"
  130. echo "# INTERFACE:  ${INTERFACE}"
  131. echo "# Start time: `date`"
  132. echo "########################################"
  133.  
  134. # Структура папок, где находятся тесты:
  135. #
  136. # _build/adl_ts_<os>_<arch>_<compiler>_<mode>/<arch>/<isa>/<interface>_interface/<domain>/<unit>/unit_testing/<test-type>/<test-case>
  137. #
  138. # Где:
  139. #   os         - Target OS. Available OS: linux, qnx70
  140. #   arch       - Target architecture. Available architectures: intel64
  141. #   compiler   - Compiler used for build. Available compilers are: intel1900, gnu540, gnu710 and so on
  142. #   mode       - Build mode. Available modes: release, debug
  143. #   isa        - ISA, Available ISAs: sse42, avx512
  144. #   interface  - Interface to build. Available interfaces: c, cpp
  145. #   domain     - Domain to build
  146. #   unit       - Unit to build
  147. #   test-type  - Test type. Available types: correct_interface, incorrect_arguments, plausibility
  148. #   test-case  - Test case name
  149.  
  150. for FILENAME in `find ./_build/adl_ts_${OS}_${ARCH}_${COMPILER}_${MODE}/${ARCH}/${ISA}/${INTERFACE}_interface/${DOMAIN}/${UNIT}/unit_testing/${TEST_TYPE}/ -type f -name "${TEST_CASE}*.exe"`
  151. do
  152.     ./${FILENAME}
  153. done
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement