• <ruby id="5koa6"></ruby>
    <ruby id="5koa6"><option id="5koa6"><thead id="5koa6"></thead></option></ruby>

    <progress id="5koa6"></progress>

  • <strong id="5koa6"></strong>
  • linux白盒測試流程(4)

    發表于:2015-03-25來源:uml.org.cn作者:不詳點擊數: 標簽:linux
    return 0 ; -: 27 :} 分析這個文件說明目前的代碼覆蓋率是100.00%。為了簡化流程,寫了個腳本完成上述任務。 $cat flow.sh # !/ bin / sh output_key_word = check case_key_w
    return 0;
    -: 27:}

      分析這個文件說明目前的代碼覆蓋率是100.00%。為了簡化流程,寫了個腳本完成上述任務。

      $cat flow.sh

    #!/bin/sh

    output_key_word='check'
    case_key_word='Case'

    usage()
    {
    echo "Usage : flow.sh file_name"
    exit;
    }

    # input file is $1.res
    # output file is $2.ver
    #
    generate_ver()
    {
    echo --------------------------------------- > $2
    echo -e "\tTest Results Summary\n" >> $2
    echo -e -n "Total Number of Comparisons\t\t:\t" >> $2
    comparison_nums=`grep -r $output_key_word $1 | cut -f2 | wc -l`
    echo -e "$comparison_nums" >> $2

    echo -e -n "Total Number of Comparisons Failed\t:\t" >> $2
    failed_nums=`grep -r $output_key_word $1 | cut -f2 | grep -r '= 0'| wc -l`
    echo -e "$failed_nums" >> $2

    echo -e -n "Total Number of Comparisons Passed\t:\t" >> $2
    passed_nums=`expr $comparison_nums - $failed_nums`
    echo -e "$passed_nums" >> $2

    echo -e -n "Total Number of Test Cases Included\t:\t" >> $2
    case_nums=`grep -r $case_key_word $1 | wc -l`
    echo -e "$case_nums" >> $2

    echo >> $2
    echo -e -n "Percentage of Comparisons Passed\t:\t">>$2
    percentage=`awk 'BEGIN{print '$passed_nums'/'$comparison_nums'}'`
    echo -e "$percentage" >> $2
    echo >> $2

    echo --------------------------------------- >> $2

    }

    [ $# -ne 1 ] && usage

    # Clean
    rm -f *.gcno *.gcda *.c.gcov
    rm -f *.ver *.rpt *.res

    # Complier
    gcc -fprofile-arcs -ftest-coverage -g -o $1 $1.c

    # Debug
    [ -e $1.gdb ] && gdb -x $1.gdb > $1.res

    # Test Result Report
    generate_ver $1.res $1.ver
    [ -e $1.ver ] && echo "Generate VER file successfully!"

    # Code Coverage Report
    gcov $1.c > $1.rpt
    [ -e $1.c.gcov ] && cat $1.c.gcov >> $1.rpt
    [ -e $1.rpt ] && echo "Generate RPT file successfully!"

    原文轉自:http://www.uml.org.cn/Test/2009021210.asp

    老湿亚洲永久精品ww47香蕉图片_日韩欧美中文字幕北美法律_国产AV永久无码天堂影院_久久婷婷综合色丁香五月

  • <ruby id="5koa6"></ruby>
    <ruby id="5koa6"><option id="5koa6"><thead id="5koa6"></thead></option></ruby>

    <progress id="5koa6"></progress>

  • <strong id="5koa6"></strong>