TestRunnerWave521CEnc.sh 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600
  1. #!/bin/bash
  2. source common.sh
  3. # default values
  4. g_product_name="wave521c"
  5. test_exec="./w5_enc_test"
  6. wiki_log_file="./log/enc_confluence.log"
  7. enable_random=0;
  8. txt_param_switch=0;
  9. secondary_axi_def=3 # bit0 : LF, bit1 : BIT
  10. build_stream=0
  11. cfg_dir=./cfg
  12. ref_dir=.
  13. yuv_base_path=./yuv
  14. if [ "${OS}" = "Windows_NT" ]; then
  15. ref_c_exec=./hevc_enc.exe
  16. else
  17. ref_c_exec=./hevc_enc
  18. fi
  19. cframe_c_exec=./cframe
  20. codec=hevc
  21. simulation="false"
  22. ACLK_MIN_2000T=6
  23. BCLK_MIN_2000T=6
  24. CCLK_MIN_2000T=6
  25. ACLK_AVC_MAX_2000T=15
  26. BCLK_AVC_MAX_2000T=15
  27. CCLK_AVC_MAX_2000T=15
  28. ACLK_HEVC_MAX_2000T=8
  29. BCLK_HEVC_MAX_2000T=8
  30. CCLK_HEVC_MAX_2000T=8
  31. ACLK_MIN_HAPS=1000 #min:300
  32. BCLK_MIN_HAPS=1000
  33. CCLK_MIN_HAPS=1000
  34. ACLK_MAX_HAPS=5000
  35. BCLK_MAX_HAPS=5000
  36. CCLK_MAX_HAPS=5000
  37. ACLK_MIN_VU440=5000 #min:300
  38. BCLK_MIN_VU440=5000
  39. CCLK_MIN_VU440=5000
  40. ACLK_MAX_VU440=50000
  41. BCLK_MAX_VU440=50000
  42. CCLK_MAX_VU440=50000
  43. RET_SUCCESS=0
  44. RET_HANGUP=2
  45. function help {
  46. echo ""
  47. echo "-------------------------------------------------------------------------------"
  48. echo "Chips&Media conformance Tool v2.0"
  49. echo "All copyright reserved by Chips&Media"
  50. echo "-------------------------------------------------------------------------------"
  51. echo "$0 OPTION streamlist_file"
  52. echo "-h help"
  53. echo "-c codec. default: hevc"
  54. echo " valid codec list: avc, hevc"
  55. echo "--yuv-dir input yuv directory"
  56. echo "--ref-dir ref-c directory"
  57. echo "--bin-dir ref-c directory"
  58. echo "--enable-random [optional] generate random opton"
  59. echo "--build-stream Just generate golden stream with Ref-C."
  60. }
  61. OPTSTRING="-o hwn:c:"
  62. OPTSTRING="${OPTSTRING} -l jump-stream:,bsmode:,enable-random,md5-dir:"
  63. OPTSTRING="${OPTSTRING},yuv-dir:,build-stream,ref-dir:,wiki:,n:,cfg-dir:,bin-dir:,"
  64. OPTS=`getopt $OPTSTRING -- "$@"`
  65. if [ $? != 0 ]; then
  66. exit 1;
  67. fi
  68. eval set -- "$OPTS"
  69. while true; do
  70. case "$1" in
  71. -h)
  72. help
  73. exit 0
  74. shift;;
  75. -n)
  76. g_frame_num="-n $2"
  77. if [ "$2" = "" ]; then
  78. frame_num_refc=""
  79. else
  80. frame_num_refc="-f $2"
  81. fi
  82. shift 2;;
  83. -c)
  84. codec=$(echo $2 | tr '[:upper:]' '[:lower:]')
  85. shift 2;;
  86. --bin-dir)
  87. bin_dir_user=$2
  88. shift 2;;
  89. --enable-random)
  90. enable_random=1
  91. shift;;
  92. --yuv-dir)
  93. yuv_dir_user=$2
  94. shift 2;;
  95. --cfg-dir)
  96. cfg_dir_user=$2
  97. shift 2;;
  98. --ref-dir)
  99. ref_dir=$2
  100. shift 2;;
  101. --build-stream)
  102. build_stream=1;
  103. shift;;
  104. --wiki)
  105. wiki_log_file=$2
  106. shift 2;;
  107. --)
  108. shift
  109. break;;
  110. esac
  111. done
  112. shift $(($OPTIND - 1))
  113. case "${codec}" in
  114. "hevc") g_codec_index=12;;
  115. "avc") g_codec_index=0
  116. ref_c_exec=./avc_enc
  117. ;;
  118. *)
  119. echo "unsupported codec: ${codec}"
  120. help
  121. exit 1
  122. ;;
  123. esac
  124. if [ ! -z $yuv_dir_user ]; then
  125. yuv_dir="$yuv_dir_user"
  126. yuv_base_path="$yuv_dir_user"
  127. fi
  128. if [ ! -z $cfg_dir_user ]; then
  129. cfg_dir="$cfg_dir_user"
  130. fi
  131. if [ ! -z $bin_dir_user ]; then
  132. bin_dir="$bin_dir_user"
  133. fi
  134. ################################################################################
  135. # Get param from target text file #
  136. ################################################################################
  137. input_param_name=TestRunnerParamWave521CEnc.txt
  138. if [ -f $input_param_name ] && [ $enable_random == 0 ]; then
  139. echo "read $input_param_name"
  140. while read line; do
  141. # remove right comment
  142. line=$(echo $line | tr -d '\n')
  143. line=$(echo $line | tr -d '\r')
  144. line="${line%%\#*}"
  145. attr=$(echo $line | cut -d'=' -f1)
  146. attr=$(echo $attr | tr -d ' ')
  147. if [ "$attr" == "enable-cbcrInterleave" ]; then
  148. value=$(echo $line | cut -d '=' -f3)
  149. else
  150. value=$(echo $line | cut -d'=' -f2)
  151. fi
  152. if [ "$attr" != "MODE_COMP" ]; then
  153. value=$(echo $value | tr -d ' ')
  154. fi
  155. case "$attr" in
  156. default) default_opt="$value";;
  157. product) g_product_name="$value";;
  158. core) g_num_cores_temp="$value"
  159. g_multi_vcore=1;;
  160. secondary-axi) secondary_axi_temp="$value";;
  161. enable-cbcrInterleave) nv21_temp="$value";;
  162. enable_nv21) nv21_temp="$value";;
  163. yuv_src_mode) g_yuv_mode_temp="$value";;
  164. srcFormat) srcFormat_temp="$value";;
  165. stream-endian) stream_endian_temp="$value";;
  166. source-endian) source_endian_temp="$value";;
  167. frame-endian) frame_endian_temp="$value";;
  168. bsmode) bsmode_temp="$value";;
  169. rotAngle) rotAngle_temp="$value";;
  170. mirDir) mirDir_temp="$value";;
  171. lowLatencyMode) g_lowLatencyMode_temp="$value";;
  172. cframe) g_cframe_temp="$value";;
  173. cframelossless) g_cframelossless_temp="$value";;
  174. cframetx16y) g_cframetx16y_temp="$value";;
  175. cframetx16c) g_cframetx16c_temp="$value";;
  176. cframe_422) g_cframe_422_temp="$value";;
  177. MODE_COMP_ENCODED) MODE_COMP_ENCODED_temp="$value";;
  178. sfs) g_subFrameSync_temp="$value";;
  179. ring) g_ringBuffer_temp="$value";;
  180. n) g_frame_num="-n $value"
  181. if [ "$value" = "0" ]; then
  182. frame_num_refc=""
  183. else
  184. frame_num_refc="-f $value"
  185. fi;;
  186. txt-param) txt_param_switch=1;;
  187. *) ;;
  188. esac
  189. done < $input_param_name
  190. else
  191. if [ ! -f "$input_param_name" ]; then
  192. echo " $input_param_name file doesn't exist";
  193. fi
  194. fi
  195. streamset_path=$1
  196. echo "streamset_path=$1"
  197. streamset_file=`basename ${streamset_path}`
  198. if [ ! -f "${streamset_path}" ]; then
  199. echo "No such file: ${streamset_path}"
  200. exit 1
  201. fi
  202. ################################################################################
  203. # calculate stream number #
  204. ################################################################################
  205. stream_file_array=()
  206. index=0
  207. num_of_streams=0
  208. while read line || [ -n "$line" ]; do
  209. line=$(echo $line | tr -d '\n')
  210. line=$(echo $line | tr -d '\r')
  211. line=${line#*( )} # remove front whitespace
  212. line=$(echo $line | cut -d' ' -f1)
  213. firstchar=${line:0:1}
  214. case "$firstchar" in
  215. "@") break;; # exit flag
  216. "#") continue;; # comment
  217. ";") continue;; # comment
  218. "") continue;; # comment
  219. *)
  220. esac
  221. stream_file_array[$index]="$line"
  222. index=$(($index + 1))
  223. done < ${streamset_path}
  224. num_of_streams=${#stream_file_array[@]}
  225. #echo ${stream_file_array[@]}
  226. count=1
  227. success_count=0
  228. failure_count=0
  229. remain_count=${num_of_streams}
  230. basedir=${basedir//\/} # remove last delimeter
  231. mkdir -p temp
  232. mkdir -p output
  233. mkdir -p log/encoder_conformance
  234. conf_log_path="log/encoder_conformance/${streamset_file}_r${g_revision}.log"
  235. conf_err_log_path="log/encoder_conformance/${streamset_file}_error_r${g_revision}.log"
  236. temp_log_path="./temp/temp.log"
  237. # truncate contents of log file
  238. echo "" > $conf_log_path
  239. echo "" > $conf_err_log_path
  240. echo "" > $temp_log_path
  241. beginTime=$(date +%s%N)
  242. ################################################################################
  243. # read cfg file. #
  244. ################################################################################
  245. force_reset=0
  246. for line in ${stream_file_array[@]}; do
  247. cfg_path="${cfg_dir}/${line}"
  248. cfg_base_path=$(dirname $line)
  249. cfg_base_name=$(basename $line)
  250. if [ "$cfg_base_path" == "" ]; then
  251. cfg_base_path="."
  252. fi
  253. test_param=""
  254. if [ ! -f ${cfg_path} ]; then
  255. echo "cfg not exist, cfg_path=$cfg_path" >> $conf_err_log_path
  256. echo "[RESULT] FAILURE" >> $conf_err_log_path
  257. count=$(($count + 1))
  258. failure_count=$(($failure_count + 1))
  259. remain_count=$(($remain_count - 1))
  260. continue
  261. fi
  262. read_cfg $cfg_path
  263. #default value
  264. MODE_COMP_ENCODED_temp=1 #MODE_COMP_ENCODED(bit_stream)
  265. if [ "$haps" = "1" ]; then
  266. ACLK_MIN=${ACLK_MIN_HAPS}
  267. BCLK_MIN=${BCLK_MIN_HAPS}
  268. CCLK_MIN=${CCLK_MIN_HAPS}
  269. ACLK_MAX=${ACLK_MAX_HAPS}
  270. BCLK_MAX=${BCLK_MAX_HAPS}
  271. CCLK_MAX=${CCLK_MAX_HAPS}
  272. KHz_clock=1
  273. elif [ "board" == "vu440" ] || [ "board" == "haps" ]; then
  274. ACLK_MIN=${ACLK_MIN_VU440}
  275. BCLK_MIN=${BCLK_MIN_VU440}
  276. CCLK_MIN=${CCLK_MIN_VU440}
  277. ACLK_MAX=${ACLK_MAX_VU440}
  278. BCLK_MAX=${BCLK_MAX_VU440}
  279. CCLK_MAX=${CCLK_MAX_VU440}
  280. KHz_clock=1
  281. else
  282. ACLK_MIN=${ACLK_MIN_2000T}
  283. BCLK_MIN=${BCLK_MIN_2000T}
  284. CCLK_MIN=${CCLK_MIN_2000T}
  285. if [ "$g_codec_index" = "12" ]; then #hevc
  286. ACLK_MAX=${ACLK_HEVC_MAX_2000T}
  287. BCLK_MAX=${BCLK_HEVC_MAX_2000T}
  288. CCLK_MAX=${CCLK_HEVC_MAX_2000T}
  289. else
  290. ACLK_MAX=${ACLK_AVC_MAX_2000T}
  291. BCLK_MAX=${BCLK_AVC_MAX_2000T}
  292. CCLK_MAX=${CCLK_AVC_MAX_2000T}
  293. fi
  294. fi
  295. if [ $enable_random == 1 ] && [ $txt_param_switch == 0 ]; then
  296. get_random_param 0 $g_product_name
  297. else
  298. get_default_param 0 $g_product_name
  299. fi
  300. g_secondary_axi=$(($g_secondary_axi >> 1))
  301. ################################################################################
  302. # check minimum size with rotation #
  303. ################################################################################
  304. if [ "$g_product_name" = "wave521c_dual" ]; then
  305. g_rotAngle=0
  306. g_mirDir=0
  307. fi
  308. if [ "$g_rotAngle" == "90" ] || [ "$g_rotAngle" == "270" ]; then
  309. if [ "$cfg_height" -lt "256" ] || [ "$cfg_width" -lt "128" ]; then
  310. echo "width=$cfg_width, height=$cfg_height rot=$g_rotAngle"
  311. echo "[ERR] Not support src_width < 128 || src_height < 256 with 90, 270 degree rotation"
  312. echo "[ERR] change rotAngle value to 0"
  313. g_rotAngle=0
  314. fi
  315. fi
  316. ################################################################################
  317. # check dual_core condition
  318. ################################################################################
  319. if [ "$g_ringBuffer" == "1" ] || [ "$g_ringBuffer" == "2" ]; then
  320. if [ $cfg_WaveFrontSynchro != 0 ]; then
  321. echo "========================================================"
  322. echo "disable ringBuffer(WaveFrontSynchro & ringbuffer enabled. not supported)"
  323. echo "========================================================"
  324. g_ringBuffer=0
  325. fi
  326. fi
  327. ################################################################################
  328. # make argv parameter #
  329. ################################################################################
  330. #reset after hangup
  331. backup=$g_fpga_reset
  332. if [ $force_reset -eq 1 ]; then
  333. g_fpga_reset=1
  334. force_reset=0
  335. fi
  336. #make argc & argv parameter
  337. build_test_param 0
  338. g_fpga_reset=$backup
  339. test_param="${test_param} $g_func_ret_str"
  340. if [ "$g_rotAngle" == "0" ] && [ "$g_mirDir" == "0" ]; then rot_arg=0
  341. elif [ "$g_rotAngle" == "180" ] && [ "$g_mirDir" == "3" ]; then rot_arg=0
  342. elif [ "$g_rotAngle" == "90" ] && [ "$g_mirDir" == "0" ]; then rot_arg=1
  343. elif [ "$g_rotAngle" == "270" ] && [ "$g_mirDir" == "3" ]; then rot_arg=1
  344. elif [ "$g_rotAngle" == "180" ] && [ "$g_mirDir" == "0" ]; then rot_arg=2
  345. elif [ "$g_rotAngle" == "0" ] && [ "$g_mirDir" == "3" ]; then rot_arg=2
  346. elif [ "$g_rotAngle" == "270" ] && [ "$g_mirDir" == "0" ]; then rot_arg=3
  347. elif [ "$g_rotAngle" == "90" ] && [ "$g_mirDir" == "3" ]; then rot_arg=3
  348. elif [ "$g_rotAngle" == "0" ] && [ "$g_mirDir" == "2" ]; then rot_arg=6
  349. elif [ "$g_rotAngle" == "180" ] && [ "$g_mirDir" == "1" ]; then rot_arg=6
  350. elif [ "$g_rotAngle" == "90" ] && [ "$g_mirDir" == "2" ]; then rot_arg=7
  351. elif [ "$g_rotAngle" == "270" ] && [ "$g_mirDir" == "1" ]; then rot_arg=7
  352. elif [ "$g_rotAngle" == "180" ] && [ "$g_mirDir" == "2" ]; then rot_arg=4
  353. elif [ "$g_rotAngle" == "0" ] && [ "$g_mirDir" == "1" ]; then rot_arg=4
  354. elif [ "$g_rotAngle" == "270" ] && [ "$g_mirDir" == "2" ]; then rot_arg=5
  355. elif [ "$g_rotAngle" == "90" ] && [ "$g_mirDir" == "1" ]; then rot_arg=5
  356. fi
  357. output_filename="$(basename $line).bin"
  358. test_param="${test_param} --output=$output_filename --cfgFileName=$cfg_path"
  359. #ifdef SUPPORT_LOOK_AHEAD_RC
  360. if [[ "$cfg_path" == *"larc"* ]]; then
  361. #set cfgFileName_larc_pass1
  362. cfg_path_pass1=`echo ${cfg_path} | sed 's/pass2/pass1/'`
  363. test_param="${test_param} --cfgFileName_larc_pass1=$cfg_path_pass1"
  364. fi
  365. #endif
  366. test_param="${test_param} $g_frame_num"
  367. yuv_path="${yuv_dir}/${cfg_InputFile}"
  368. file_name=${cfg_BitstreamFile%.*}
  369. file_ext=${cfg_BitstreamFile##*.}
  370. ref_stream_path="${ref_dir}/${cfg_base_path}/${file_name}_${rot_arg}.${file_ext}"
  371. if [ "$simulation" == "true" ]; then
  372. test_param="${test_param} --input=${yuv_path}"
  373. fi
  374. #ifdef SUPPORT_LOOK_AHEAD_RC
  375. if [[ "$cfg_path" == *"larc"* ]]; then
  376. test_param="${test_param} --input_larc_pass1=${larc_pass1_input_param}"
  377. fi
  378. #endif
  379. test_param="${test_param} --ref_stream_path=${ref_stream_path}"
  380. ################################################################################
  381. # print information #
  382. ################################################################################
  383. log_conf "--------------------------------------------------------------------------------" ${temp_log_path}
  384. log_conf "[${count}/${num_of_streams}] ${cfg_path}" ${temp_log_path}
  385. log_conf "--------------------------------------------------------------------------------" ${temp_log_path}
  386. log_conf "yuv_path : $yuv_path" $temp_log_path
  387. log_conf "ref_stream_path : $ref_stream_path" $temp_log_path
  388. log_conf "width X Height : $cfg_width X $cfg_height" $temp_log_path
  389. log_conf "BitstreamFile : $cfg_BitstreamFile" $temp_log_path
  390. log_conf "-------------------------------------------" $temp_log_path
  391. log_conf "RANDOM TEST : ${ON_OFF[$enable_random]}" $temp_log_path
  392. log_conf "SEC AXI : ${g_secondary_axi}, 0x01:RDO, 0x02:LF" $temp_log_path
  393. log_conf "BITSTREAM MODE : ${ENC_WAVE_BSMODE_NAME[$g_ringBuffer]}" $temp_log_path
  394. log_conf "Endian : ${g_stream_endian}, ${g_frame_endian}, ${g_source_endian}" $temp_log_path
  395. log_conf "Standard : ${CODEC_NAME[$g_codec_index]}" $temp_log_path
  396. if [ "$g_cframe" == "1" ]; then
  397. log_conf "Input Format : CFRAME " $temp_log_path
  398. log_conf " lossless : $g_cframelossless " $temp_log_path
  399. log_conf " tx16 y : $g_cframetx16y" $temp_log_path
  400. log_conf " tx16 c : $g_cframetx16c" $temp_log_path
  401. log_conf " 422 : $g_cframe_422" $temp_log_path
  402. elif [ "$g_packedFormat" == "1" ]; then
  403. log_conf "Input Format : (${g_packedFormat})YUYV" $temp_log_path
  404. elif [ "$g_packedFormat" == "2" ]; then
  405. log_conf "Input Format : (${g_packedFormat})YVYU" $temp_log_path
  406. elif [ "$g_packedFormat" == "3" ]; then
  407. log_conf "Input Format : (${g_packedFormat})UYVY" $temp_log_path
  408. elif [ "$g_packedFormat" == "4" ]; then
  409. log_conf "Input Format : (${g_packedFormat})VYUY" $temp_log_path
  410. elif [ $g_cbcr_interleave -eq 1 ]; then
  411. if [ "$g_enable_nv21" == "0" ] || [ "$g_enable_nv21" == "1" ]; then
  412. log_conf "Input Format : cbcrInterleave nv21=${g_enable_nv21}" $temp_log_path
  413. fi
  414. else
  415. log_conf "Input Format : 420 Planar" $temp_log_path
  416. fi
  417. log_conf "srcFormat : ${SRC_FORMAT_NAME[$g_srcFormat]}" $temp_log_path
  418. log_conf "Rotation : ${g_rotAngle}" $temp_log_path
  419. if [ "$g_mirDir" == "0" ]; then
  420. log_conf "Mirror : (${g_mirDir})NONE" $temp_log_path
  421. elif [ "$g_mirDir" == "1" ]; then
  422. log_conf "Mirror : (${g_mirDir})Vertical" $temp_log_path
  423. elif [ "$g_mirDir" == "2" ]; then
  424. log_conf "Mirror : (${g_mirDir})Horizontal" $temp_log_path
  425. else
  426. log_conf "Mirror : (${g_mirDir})Vert-Horz" $temp_log_path
  427. fi
  428. log_conf "rot_arg : $rot_arg" $temp_log_path
  429. log_conf "LOW LATENCY : ${g_lowLatencyMode}, 0x01:interrupt, 0x02:fast bitstream-packing" $temp_log_path
  430. log_conf "--------------------------------------------------------------------------------" $temp_log_path
  431. ################################################################################
  432. # make ref-prebuilt stream #
  433. ################################################################################
  434. if [ ! -f "$ref_stream_path" ] || [ $build_stream -eq 1 ]; then
  435. ref_stream_base_dir=$(dirname $ref_stream_path)
  436. if [ ! -d "$ref_stream_base_dir" ]; then
  437. mkdir -p "$ref_stream_base_dir"
  438. chmod 755 "$ref_stream_base_dir"
  439. echo "CREATE REF-STREAM DIR: $ref_stream_base_dir"
  440. fi
  441. if [ "$g_num_cores" == "2" ]; then
  442. REF_C_EXEC_PARAM="-c $cfg_path -p ${yuv_base_path}/ -b temp.bin $extra_param $frame_num_refc --NumCores=2"
  443. else
  444. REF_C_EXEC_PARAM="-c $cfg_path -p ${yuv_base_path}/ -b temp.bin $extra_param $frame_num_refc"
  445. fi
  446. rm -rf temp.bin || echo ignore_err
  447. echo "$ref_c_exec $REF_C_EXEC_PARAM"
  448. result=0
  449. $ref_c_exec $REF_C_EXEC_PARAM || result=1
  450. if [ "$result" != "0" ]; then
  451. echo "ref-c error"
  452. remain_count=$(($remain_count - 1))
  453. count=$(($count + 1))
  454. continue
  455. fi
  456. if [ -s temp.bin ]; then
  457. echo "cp -v temp.bin $ref_stream_path"
  458. cp -v temp.bin $ref_stream_path
  459. fi
  460. if [ $build_stream -eq 1 ]; then
  461. remain_count=$(($remain_count - 1))
  462. count=$(($count + 1))
  463. continue
  464. fi
  465. fi
  466. ################################################################################
  467. # run Test #
  468. ################################################################################
  469. result=0
  470. test_param_print=$test_param
  471. log_conf "$test_exec $test_param_print" $temp_log_path
  472. cat $temp_log_path >> $conf_log_path
  473. test_exec_param="$test_exec $test_param"
  474. result=0
  475. if [ "$simulation" == "true" ]; then
  476. test_exec_param="$test_exec_param $g_w_param $g_fsdb_param $g_ius_param --TestRunner=1"
  477. set -o pipefail; $test_exec_param 2>&1 | tee -a $conf_log_path || result=1
  478. else
  479. $test_exec_param || result=$?
  480. fi
  481. if [ $result -eq $RET_HANGUP ]; then
  482. force_reset=1
  483. fi
  484. if [ "$result" == "0" ]; then
  485. log_conf "[RESULT] SUCCESS" $conf_log_path
  486. success_count=$(($success_count + 1))
  487. else
  488. cat ./ErrorLog.txt >> $conf_log_path
  489. log_conf "[RESULT] FAILURE" $conf_log_path
  490. failure_count=$(($failure_count + 1))
  491. cat $temp_log_path >> $conf_err_log_path
  492. cat ./ErrorLog.txt >> $conf_err_log_path
  493. echo "[RESULT] FAILURE" >> $conf_err_log_path
  494. if [ $result -eq 10 ]; then
  495. echo "Abnormal exit!!!"
  496. break
  497. fi
  498. fi
  499. remain_count=$(($remain_count - 1))
  500. count=$(($count + 1))
  501. # clear temp log
  502. echo ${cfg_path}
  503. echo "" > $temp_log_path
  504. done
  505. endTime=$(date +%s%N)
  506. elapsed=$((($endTime - $beginTime) / 1000000000))
  507. elapsedH=$(($elapsed / 3600))
  508. elapsedS=$(($elapsed % 60))
  509. elapsedM=$(((($elapsed - $elapsedS) / 60) % 60))
  510. if [ "$((elapsedS / 10))" == "0" ]; then elapsedS="0${elapsedS}" ;fi
  511. if [ "$((elapsedM / 10))" == "0" ]; then elapsedM="0${elapsedM}" ;fi
  512. if [ "$((elapsedH / 10))" == "0" ]; then elapsedH="0${elapsedH}" ;fi
  513. if [ $elapsed -le 30 ]; then
  514. time_hms="{color:red}*${elapsedH}:${elapsedM}:${elapsedS}*{color}"
  515. else
  516. time_hms="${elapsedH}:${elapsedM}:${elapsedS}"
  517. fi
  518. log_filename=$(basename $conf_log_path)
  519. log_err_filename=$(basename $conf_err_log_path)
  520. if [ $failure_count == 0 ] && [ $num_of_streams != 0 ]; then
  521. pass=${PASS}
  522. rm $conf_err_log_path
  523. log_err_filename=""
  524. else
  525. pass=${FAIL}
  526. fi
  527. wiki_log="| $streamset_file | $num_of_streams | $success_count | $failure_count | $remain_count | $log_filename | ${log_err_filename} | $pass | $time_hms | | | |"
  528. echo $wiki_log
  529. echo "$wiki_log" >> $wiki_log_file
  530. if [ "$num_of_streams" == "0" ]; then
  531. echo "num_of_streams: $num_of_streams = exit 1"
  532. exit 1
  533. fi
  534. exit $failure_count