test-image-size.sh 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732
  1. #!/usr/bin/env bash
  2. # (c) Wiimm, 2010-09-24
  3. myname="${0##*/}"
  4. base=image-size
  5. log=$base.log
  6. err=$base.err
  7. db=$base.db
  8. WIT=wit
  9. [[ -f ./wit && -x ./wit ]] && WIT=./wit
  10. WDF=wdf
  11. [[ -f ./wdf && -x ./wdf ]] && WDF=./wdf
  12. export LC_ALL=C
  13. C1_LIST=($($WIT compr))
  14. C2_LIST=("")
  15. C3_LIST=("")
  16. PSEL=
  17. IO=
  18. #
  19. #------------------------------------------------------------------------------
  20. # built in help
  21. if [[ $# == 0 ]]
  22. then
  23. cat <<- ---EOT---
  24. This script expect as parameters names of ISO files. ISO files are PLAIN,
  25. WDF, WIA, CISO, WBFS or FST. Each source file is subject of this test suite.
  26. Each source is converted to several formats to find out the size of the
  27. output. Output formats are: WDF, PLAIN ISO, CISO, WBFS, WIA. WIA is checked
  28. with different compeession modes controlled by --c1 --c2 and --c3.
  29. Some output images may additonally compressed with bzip2, rar and 7z.
  30. Usage: $myname [option]... iso_file...
  31. Options:
  32. --wia : Enter fast mode => do only WDF and WIA test
  33. --bzip2 : enable bzip2 tests (default if tool 'bzip2' found)
  34. --no-bzip2 : disable bzip2 tests
  35. --rar : enable rar tests (default if tool 'rar' found)
  36. --no-rar : disable rar tests
  37. --7zip : enable 7zip tests (default if tool '7z' found)
  38. --no-7zip : disable 7zip tests
  39. --all : shortcut for --bzip2 --rar --7z
  40. --data : DATA partition only, scrub all others
  41. --c1 list : This three options define three lists of compression modes.
  42. --c2 list modes. Each element of one list is combined with each element
  43. --c3 list each element of the other lists ( c1 x c2 x c3 ). All
  44. resulting modes are normalized, sorted and repeated modes are
  45. removed. The default for --c1 are all compression methods.
  46. Options --c2 and --c3 are initial empty.
  47. --decrypt : Enable WDF/DECRYPT tests.
  48. --diff : Enable "wit DIFF" to verify WIA archives.
  49. --read : Enable read tests (conver WIA to to WDF file).
  50. --dump : 'wdf +dump a.wia >$dumpdir'
  51. --db : Enable DB mode:
  52. 1.) Scan DB to find if stat is already known.
  53. 2.) Append new WIA statistics to DB file '$db'.
  54. ---EOT---
  55. exit 1
  56. fi
  57. #
  58. #------------------------------------------------------------------------------
  59. # check existence of needed tools
  60. errtool=
  61. for tool in $WIT
  62. do
  63. which $tool >/dev/null 2>&1 || errtool="$errtool $tool"
  64. done
  65. if [[ $errtool != "" ]]
  66. then
  67. echo "$myname: missing tools in PATH:$errtool" >&2
  68. exit 2
  69. fi
  70. let HAVE_BZIP2=!$(which bzip2 >/dev/null 2>&1; echo $?)
  71. let HAVE_RAR=!$(which rar >/dev/null 2>&1; echo $?)
  72. let HAVE_7Z=!$(which 7z >/dev/null 2>&1; echo $?)
  73. OPT_WIA=0
  74. OPT_BZIP2=0
  75. OPT_RAR=0
  76. OPT_7ZIP=0
  77. OPT_DECRYPT=0
  78. OPT_DATA=0
  79. OPT_DIFF=0
  80. OPT_READ=0
  81. OPT_DUMP=0
  82. OPT_DB=0
  83. #
  84. #------------------------------------------------------------------------------
  85. # timer function
  86. let BASE_SEC=$(date +%s)
  87. function get_msec()
  88. {
  89. echo $(($(date "+(%s-BASE_SEC)*1000+10#%N/1000000")))
  90. }
  91. #-----------------------------------
  92. function print_timer()
  93. {
  94. # $1 = start time
  95. # $2 = end time
  96. # $3 = name if set
  97. local tim ms s m h
  98. let tim=$2-$1
  99. last_time=$tim
  100. let ms=tim%1000
  101. let tim=tim/1000
  102. let s=tim%60
  103. let tim=tim/60
  104. let m=tim%60
  105. let h=tim/60
  106. if ((h))
  107. then
  108. last_ftime=$(printf "%u:%02u:%02u.%03u hms" $h $m $s $ms)
  109. elif ((m))
  110. then
  111. last_ftime=$(printf " %2u:%02u.%03u m:s" $m $s $ms)
  112. else
  113. last_ftime=$(printf " %2u.%03u sec" $s $ms)
  114. fi
  115. printf "%s %s\n" "$last_ftime" "$3"
  116. }
  117. #-----------------------------------
  118. function print_stat()
  119. {
  120. printf "%-26s : " "$(printf "$@")"
  121. }
  122. #
  123. #------------------------------------------------------------------------------
  124. # calc real methods
  125. function calc_compr_modes()
  126. {
  127. #echo "--c1, N=${#C1_LIST[@]}: ${C1_LIST[*]}" >&2
  128. #echo "--c2, N=${#C2_LIST[@]}: ${C2_LIST[*]}" >&2
  129. #echo "--c3, N=${#C3_LIST[@]}: ${C3_LIST[*]}" >&2
  130. CMODES=$(
  131. for c1 in "${C1_LIST[@]}"
  132. do
  133. for c2 in "${C2_LIST[@]}"
  134. do
  135. for c3 in "${C3_LIST[@]}"
  136. do
  137. local mode="$($WIT compr --numeric --verbose "$c1$c2$c3")"
  138. if [[ $mode == - ]]
  139. then
  140. echo "Illegal compression mode: $c1$c2$c3" >&2
  141. exit 1
  142. fi
  143. echo "$mode"
  144. done
  145. done
  146. done | sort -n | uniq
  147. )
  148. CMODES=$(echo $($WIT compr $CMODES))
  149. }
  150. #
  151. #------------------------------------------------------------------------------
  152. # setup
  153. function f_abort()
  154. {
  155. echo
  156. {
  157. msg="### ${myname} CANCELED ###"
  158. sep="############################"
  159. sep="$sep$sep$sep$sep"
  160. sep="${sep:1:${#msg}}"
  161. echo ""
  162. echo "$sep"
  163. echo "$msg"
  164. echo "$sep"
  165. echo ""
  166. echo "remove tempdir: $tempdir"
  167. rm -rf "$tempdir"
  168. sync
  169. echo ""
  170. } >&2
  171. sleep 1
  172. exit 2
  173. }
  174. tempdir=
  175. trap f_abort INT TERM HUP
  176. tempdir="$(mktemp -d ./.$base.tmp.XXXXXX)" || exit 1
  177. dumpdir=./dumpdir.tmp
  178. export WIT_OPT=
  179. export WWT_OPT=
  180. #
  181. #------------------------------------------------------------------------------
  182. # check_db
  183. function check_db()
  184. {
  185. # $1 = id6
  186. # $2 = cmode
  187. if ((OPT_DB))
  188. then
  189. local id6 cmode logmsg
  190. id6="$1"
  191. cmode="$2"
  192. DB_ID="$id6-$cmode"
  193. ((OPT_DATA)) && DB_ID="$DB_ID-d"
  194. logmsg="$( grep "^$DB_ID:" $db | cut -c$((${#DB_ID}+2))- )"
  195. if [[ $logmsg != "" ]]
  196. then
  197. print_stat " > %s" "$cmode"
  198. printf "%s [DB]\n" "$logmsg"
  199. printf "%s\n" "$logmsg" >>"$tempdir/time.write.log"
  200. ((basesize)) || let basesize=$( echo "$logmsg" | awk '{print $1}' )
  201. return 0
  202. fi
  203. fi
  204. return 1
  205. }
  206. #
  207. #------------------------------------------------------------------------------
  208. # test function
  209. function test_function()
  210. {
  211. # $1 = class for log file
  212. # $2 = base time
  213. # $3 = dest file
  214. # $4 = info
  215. # $5... = command
  216. local class basetime dest start stop size perc
  217. class="$1"
  218. basetime="$2"
  219. dest="$3"
  220. info="$4"
  221. shift 4
  222. print_stat " > %s" "$info"
  223. #-----
  224. sync
  225. sleep 1
  226. start=$(get_msec)
  227. #echo; echo "$@"
  228. "$@" || return 1
  229. sync
  230. let stop=$(get_msec)+basetime
  231. #-----
  232. size="$(stat -c%s "$tempdir/$dest")"
  233. ((basesize)) || basesize=$size
  234. let perc=size*10000/basesize
  235. if ((perc>99999))
  236. then
  237. perc="$(printf "%6u%%" $((perc/100)))"
  238. else
  239. perc="$(printf "%3u.%02u%%" $((perc/100)) $((perc%100)))"
  240. fi
  241. size="$(printf "%10d %s" $size "$perc" )"
  242. #print_timer $start $stop "$size"
  243. print_timer $start $stop >/dev/null
  244. logmsg=$(printf " %s %s %s" "$size" "$last_ftime" "$info")
  245. printf "%s\n" "$logmsg"
  246. printf "%s\n" "$logmsg" >>"$tempdir/time.$class.log"
  247. [[ $DB_ID = "" ]] || printf "%s:%s\n" "$DB_ID" "$logmsg" >>"$db"
  248. return 0
  249. }
  250. #
  251. #------------------------------------------------------------------------------
  252. # test suite
  253. function test_suite()
  254. {
  255. # $1 = valid source
  256. rm -rf "$tempdir"/*
  257. mkdir -p "$tempdir"
  258. local ft id6 name
  259. ft="$($WIT FILETYPE -H -l "$1" | awk '{print $1}')" || return 1
  260. id6="$($WIT FILETYPE -H -l "$1" | awk '{print $2}')" || return 1
  261. printf "\n** %s %s %s\n" "$ft" "$id6" "$1"
  262. [[ $id6 = "-" ]] && return $STAT_NOISO
  263. name="$($WIT ID6 --long --source "$1")"
  264. name="$( echo "$name" | sed 's/ /, /')"
  265. DB_ID=
  266. #----- START, read source once
  267. if ((!OPT_DB))
  268. then
  269. basesize=0
  270. test_function write 0 b.wdf "WDF/start" \
  271. $WIT_CP "$1" --wdf "$tempdir/b.wdf" || return 1
  272. rm -f "$tempdir"/time.*.log
  273. fi
  274. #----- wdf
  275. basesize=0
  276. if ! check_db "$id6" "WDF"
  277. then
  278. test_function write 0 a.wdf "WDF" \
  279. $WIT_CP "$1" --wdf "$tempdir/a.wdf" || return 1
  280. local wdf_time=$last_time
  281. if ((OPT_BZIP2))
  282. then
  283. test_function write $wdf_time a.wdf.bz2 "WDF + BZIP2" \
  284. bzip2 --keep "$tempdir/a.wdf" || return 1
  285. fi
  286. if ((OPT_RAR))
  287. then
  288. test_function write $wdf_time a.wdf.rar "WDF + RAR" \
  289. rar a -inul "$tempdir/a.wdf.rar" "$tempdir/a.wdf" || return 1
  290. fi
  291. if ((OPT_7ZIP))
  292. then
  293. test_function write $wdf_time a.wdf.7z "WDF + 7Z" \
  294. 7z a -bd "$tempdir/a.wdf.7z" "$tempdir/a.wdf" || return 1
  295. fi
  296. rm -f "$tempdir/a.wdf"*
  297. fi
  298. #----- wdf/decrypt
  299. if ((OPT_DECRYPT)) && ! check_db "$id6" "WDF/DECRYPT"
  300. then
  301. test_function write 0 a.wdf "WDF/DECRYPT" \
  302. $WIT_CP "$1" --wdf --enc decrypt "$tempdir/a.wdf" || return 1
  303. local wdf_time=$last_time
  304. if ((OPT_BZIP2))
  305. then
  306. test_function write $wdf_time a.wdf.bz2 "WDF/DECRYPT + BZIP2" \
  307. bzip2 --keep "$tempdir/a.wdf" || return 1
  308. fi
  309. if ((OPT_RAR))
  310. then
  311. test_function write $wdf_time a.wdf.rar "WDF/DECRYPT + RAR" \
  312. rar a -inul "$tempdir/a.wdf.rar" "$tempdir/a.wdf" || return 1
  313. fi
  314. if ((OPT_7ZIP))
  315. then
  316. test_function write $wdf_time a.wdf.7z "WDF/DECRYPT + 7Z" \
  317. 7z a -bd "$tempdir/a.wdf.7z" "$tempdir/a.wdf" || return 1
  318. fi
  319. rm -f "$tempdir/a.wdf"*
  320. fi
  321. #----- wia
  322. for cmode in $CMODES
  323. do
  324. check_db "$id6" "WIA/$cmode" && continue
  325. test_function write 0 a.wia "WIA/$cmode" \
  326. $WIT_CP "$1" --wia --compr $cmode "$tempdir/a.wia" || return 1
  327. local wdf_time=$last_time
  328. DB_ID=
  329. if ((OPT_READ))
  330. then
  331. test_function read 0 a.wia "READ/$cmode" \
  332. $WIT_CP "$tempdir/a.wia" --wdf "$tempdir/read.wdf" || return 1
  333. rm -f "$tempdir/read.wdf"
  334. fi
  335. ((OPT_DUMP)) && $WDF +dump "$tempdir/a.wia" >"$dumpdir/$id6-$cmode.dump"
  336. if [[ ${cmode:0:4} == NONE ]]
  337. then
  338. if ((OPT_BZIP2))
  339. then
  340. test_function write $wdf_time a.wia.bz2 "WIA/$cmode + BZIP2" \
  341. bzip2 --keep "$tempdir/a.wia" || return 1
  342. fi
  343. if ((OPT_RAR))
  344. then
  345. test_function write $wdf_time a.wia.rar "WIA/$cmode + RAR" \
  346. rar a -inul "$tempdir/a.wia.rar" "$tempdir/a.wia" || return 1
  347. fi
  348. if ((OPT_7ZIP))
  349. then
  350. test_function write $wdf_time a.wia.7z "WIA/$cmode + 7Z" \
  351. 7z a -bd "$tempdir/a.wia.7z" "$tempdir/a.wia" || return 1
  352. fi
  353. fi
  354. if ((OPT_DIFF))
  355. then
  356. echo " - wit DIFF orig-source a.wia"
  357. wit diff $PSEL "$1" "$tempdir/a.wia" \
  358. || echo "!!! $id6: wit DIFF orig-source a.wia/$cmode FAILED!" | tee -a "$log"
  359. fi
  360. rm -f "$tempdir/a.wia"*
  361. done
  362. #----- plain iso
  363. if ((!OPT_WIA))
  364. then
  365. test_function write 0 a.iso "PLAIN ISO" \
  366. $WIT_CP "$1" --iso "$tempdir/a.iso" || return 1
  367. local iso_time=$last_time
  368. if ((OPT_BZIP2))
  369. then
  370. test_function write iso_time a.iso.bz2 "PLAIN ISO + BZIP2" \
  371. bzip2 --keep "$tempdir/a.iso" || return 1
  372. fi
  373. if ((OPT_RAR))
  374. then
  375. test_function write iso_time a.iso.rar "PLAIN ISO + RAR" \
  376. rar a -inul "$tempdir/a.iso.rar" "$tempdir/a.iso" || return 1
  377. fi
  378. if ((OPT_7ZIP))
  379. then
  380. test_function write iso_time a.iso.7z "PLAIN ISO + 7Z" \
  381. 7z a -bd "$tempdir/a.iso.7z" "$tempdir/a.iso" || return 1
  382. fi
  383. rm -f "$tempdir/a.iso"*
  384. fi
  385. #----- ciso
  386. if ((!OPT_WIA))
  387. then
  388. test_function write 0 a.ciso "CISO" \
  389. $WIT_CP "$1" --ciso "$tempdir/a.ciso" || return 1
  390. rm -f "$tempdir/a.ciso"*
  391. fi
  392. #----- wbfs
  393. if ((!OPT_WIA))
  394. then
  395. test_function write 0 a.wbfs "WBFS" \
  396. $WIT_CP "$1" --wbfs "$tempdir/a.wbfs" || return 1
  397. rm -f "$tempdir/a.wbfs"*
  398. fi
  399. #----- summary
  400. for class in write read
  401. do
  402. if [[ -s "$tempdir/time.$class.log" ]]
  403. then
  404. {
  405. printf "\f\nSummary [$class,size] of %s:\n\n" "$name"
  406. sort "$tempdir/time.$class.log"
  407. printf "\nSummary [$class,time] of %s:\n\n" "$name"
  408. sort +2 "$tempdir/time.$class.log"
  409. printf "\n"
  410. } | tee -a "$log"
  411. fi
  412. done
  413. return 0
  414. }
  415. #
  416. #------------------------------------------------------------------------------
  417. # print header
  418. {
  419. sep="-----------------------------------"
  420. printf "\n\f\n%s%s\n\n" "$sep" "$sep"
  421. date '+%F %T'
  422. echo
  423. $WIT --version
  424. echo
  425. echo "PARAM: $*"
  426. echo
  427. } | tee -a $log $err
  428. #
  429. #------------------------------------------------------------------------------
  430. # main loop
  431. opts=1
  432. calc_compr_modes
  433. while (($#))
  434. do
  435. src="$1"
  436. shift
  437. if [[ $src == --wia || $src == --fast ]] # --fast = old & obsolete
  438. then
  439. OPT_WIA=1
  440. ((opts++)) || printf "\n"
  441. printf "## --wia : Do only WDF and WIA tests\n"
  442. continue
  443. fi
  444. if [[ $src == --bzip2 || $src == --bz2 ]]
  445. then
  446. OPT_BZIP2=$HAVE_BZIP2
  447. ((opts++)) || printf "\n"
  448. printf "## --bzip2 : bzip2 tests enabled\n"
  449. continue
  450. fi
  451. if [[ $src == --no-bzip2 || $src == --nobzip2 || $src == --no-bz2 || $src == --nobz2 ]]
  452. then
  453. OPT_BZIP2=0
  454. ((opts++)) || printf "\n"
  455. printf "## --no-bzip2 : bzip2 tests disabled\n"
  456. continue
  457. fi
  458. if [[ $src == --rar ]]
  459. then
  460. OPT_RAR=$HAVE_RAR
  461. ((opts++)) || printf "\n"
  462. printf "## --rar : rar tests enabled\n"
  463. continue
  464. fi
  465. if [[ $src == --no-rar || $src == --norar ]]
  466. then
  467. OPT_RAR=0
  468. ((opts++)) || printf "\n"
  469. printf "## --no-rar : rar tests disabled\n"
  470. continue
  471. fi
  472. if [[ $src == --7zip || $src == --7z ]]
  473. then
  474. OPT_7ZIP=$HAVE_7Z
  475. ((opts++)) || printf "\n"
  476. printf "## --7zip : 7zip tests enabled\n"
  477. continue
  478. fi
  479. if [[ $src == --no-7zip || $src == --no7zip || $src == --no-7z || $src == --no7z ]]
  480. then
  481. OPT_7ZIP=0
  482. ((opts++)) || printf "\n"
  483. printf "## --no-7zip : 7zip tests disabled\n"
  484. continue
  485. fi
  486. if [[ $src == --all ]]
  487. then
  488. OPT_BZIP2=$HAVE_BZIP2
  489. OPT_RAR=$HAVE_RAR
  490. OPT_7ZIP=$HAVE_7Z
  491. ((opts++)) || printf "\n"
  492. printf "## --all : shortcut for --bzip2 --rar --7z\n"
  493. continue
  494. fi
  495. if [[ $src == --decrypt ]]
  496. then
  497. OPT_DECRYPT=1
  498. ((opts++)) || printf "\n"
  499. printf "## --decrypt : WDF/DECRYPT tests enabled\n"
  500. continue
  501. fi
  502. if [[ $src == --diff ]]
  503. then
  504. OPT_DIFF=1
  505. ((opts++)) || printf "\n"
  506. printf "## --diff : 'wit DIFF' tests enabled\n"
  507. continue
  508. fi
  509. if [[ $src == --read ]]
  510. then
  511. OPT_READ=1
  512. ((opts++)) || printf "\n"
  513. printf "## --read : Read tests enabled\n"
  514. continue
  515. fi
  516. if [[ $src == --dump ]]
  517. then
  518. OPT_DUMP=1
  519. mkdir -p $dumpdir
  520. ((opts++)) || printf "\n"
  521. printf "## --dump : 'wdf +dump a.wia >$dumpdir'\n"
  522. continue
  523. fi
  524. if [[ $src == --data ]]
  525. then
  526. PSEL="--psel data"
  527. OPT_DATA=1
  528. ((opts++)) || printf "\n"
  529. printf "## --data : DATA partition only, scrub all others\n"
  530. continue
  531. fi
  532. if [[ $src == --c1 || $src == --compr ]] # --compr = old & obsolete
  533. then
  534. C1_LIST=($( echo "$1" | tr ',' ' '))
  535. (( ${#C1_LIST[@]} )) || C1_LIST=("")
  536. shift
  537. ((opts++)) || printf "\n"
  538. printf "## --c1 : C1 list set to: ${C1_LIST[*]}\n"
  539. calc_compr_modes
  540. printf "## compression modes are: $CMODES\n"
  541. continue
  542. fi
  543. if [[ $src == --c2 || $src == --level ]] # --level = old & obsolete
  544. then
  545. C2_LIST=($( echo "$1" | tr ',' ' '))
  546. (( ${#C2_LIST[@]} )) || C2_LIST=("")
  547. shift
  548. ((opts++)) || printf "\n"
  549. printf "## --c2 : C2 list set to: ${C2_LIST[*]}\n"
  550. calc_compr_modes
  551. printf "## compression modes are: $CMODES\n"
  552. continue
  553. fi
  554. if [[ $src == --c3 ]]
  555. then
  556. C3_LIST=($( echo "$1" | tr ',' ' '))
  557. (( ${#C3_LIST[@]} )) || C3_LIST=("")
  558. shift
  559. ((opts++)) || printf "\n"
  560. printf "## --c3 : C3 list set to: ${C3_LIST[*]}\n"
  561. calc_compr_modes
  562. printf "## compression modes are: $CMODES\n"
  563. continue
  564. fi
  565. if [[ $src == --db ]]
  566. then
  567. OPT_DB=1
  568. printf "# %s - %s\n" "$(date '+%F %T')" "$($WIT --version)" >>$db
  569. ((opts++)) || printf "\n"
  570. printf "## --db : DB mode enabled.\n"
  571. continue
  572. fi
  573. #---- hidden options
  574. if [[ $src == --io ]]
  575. then
  576. IO="--io $( echo "$1" | tr -cd '0-9' )"
  577. shift
  578. ((opts++)) || printf "\n"
  579. printf "## Define option : $IO\n"
  580. continue
  581. fi
  582. #---- execute
  583. opts=0
  584. WIT_CP="$WIT COPY $PSEL $IO -q"
  585. total_start=$(get_msec)
  586. test_suite "$src"
  587. stat=$?
  588. total_stop=$(get_msec)
  589. print_stat " * TOTAL TIME:"
  590. print_timer $total_start $total_stop
  591. done 2>&1 | tee -a $err
  592. #
  593. #------------------------------------------------------------------------------
  594. # term
  595. rm -rf "$tempdir/"
  596. exit 0