• <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白盒測試流程(2)

    發表于:2015-03-25來源:uml.org.cn作者:不詳點擊數: 標簽:linux
    如何結合gdb和gcov進行白盒測試?主要有兩個階段: 1.編譯程序,執行gdb調試腳本。 在編譯程序的時候加上-fprofile-arcs -ftest-coverage參數。所以這里運行 gcc

      如何結合gdb和gcov進行白盒測試?主要有兩個階段:

      1.編譯程序,執行gdb調試腳本。

      在編譯程序的時候加上-fprofile-arcs -ftest-coverage參數。所以這里運行

      gcc -fprofile-arcs -ftest-coverage -g -o calnumber calnumber.c

      gdb的命令參數-x可以從文件讀出gdb調試命令再執行。運行

      gdb -x calnumber.gdb > calnumber.res

      下面是gdb腳本的輸出:

      $cat calnumber.res

    GNU gdb 6.5.50.20060706-cvs (cygwin-special)
    Copyright (C) 2006 Free Software Foundation, Inc.
    GDB is free software, covered by the GNU General Public License, and you are
    welcome to change it and/or distribute copies of it under certain conditions.
    Type "show copying" to see the conditions.
    There is absolutely no warranty for GDB. Type "show warranty" for details.
    This GDB was configured as "i686-pc-cygwin".

    ---------------------
    Test Case 1

    Breakpoint 1 at 0x401083: file calnumber.c, line 4.

    Breakpoint 1, main () at calnumber.c:4
    4 {
    Breakpoint 2 at 0x401096: file calnumber.c, line 9.

    Breakpoint 2, main () at calnumber.c:9
    9 for(i = 0; i <= number; i++)
    "check number == 8" $1 = 1
    "check sum == 0" $2 = 1
    "set number = 4" $3 = 4
    Breakpoint 3 at 0x4010c2: file calnumber.c, line 14.

    Breakpoint 3, main () at calnumber.c:14
    14 if(sum != 36)
    "set sum = 10" $4 = 10
    Breakpoint 4 at 0x401121: file calnumber.c, line 24.

    Breakpoint 4, main () at calnumber.c:24
    24 if(quit) printf("Finish!\n");
    "check quit == 0" $5 = 1
    "check i == 5" $6 = 1
    "check sum == 10" $7 = 1
    sum = 10

    Program exited normally.

    ---------------------
    Test Case 2

    Breakpoint 5 at 0x401083: file calnumber.c, line 4.

    Breakpoint 5, main () at calnumber.c:4
    4 {
    Breakpoint 6 at 0x401121: file calnumber.c, line 24.

    Breakpoint 6, main () at calnumber.c:24
    24 if(quit) printf("Finish!\n");
    "check i == 9" $8 = 1
    "check sum == 36" $9 = 1
    "check quit == 1" $10 = 1
    sum is 36

    Program exited normally.

    原文轉自: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>