Manual——Test (翻译1)
LTE Manual ——Logging(翻译)
(本文为个人学习笔记,如有不当的地方,欢迎指正!)
1.17.3 Testing framework(测试框架)
(2)Test.py
$ ./waf configure --enable-examples --enable-tests
$ ./waf build
$ ./test.py
Waf: Entering directory '/home/craigdo/repos/ns--allinone-test/ns--dev/build'
Waf: Leaving directory '/home/craigdo/repos/ns--allinone-test/ns--dev/build'
'build' finished successfully (.939s)
FAIL: TestSuite propagation-loss-model
PASS: TestSuite object-name-service
PASS: TestSuite pcap-file-object
PASS: TestSuite ns3-tcp-cwnd
...
PASS: TestSuite ns3-tcp-interoperability
PASS: Example csma-broadcast
PASS: Example csma-multicast
Usage: test.py [options] Options:
-h, --help show this help message and exit
-b BUILDPATH, --buildpath=BUILDPATH
specify the path where ns- was built (defaults to the
build directory for the current variant)
-c KIND, --constrain=KIND
constrain the test-runner by kind of test
-e EXAMPLE, --example=EXAMPLE
specify a single example to run (no relative path is
needed)
-d, --duration print the duration of each test suite and example
-e EXAMPLE, --example=EXAMPLE
specify a single example to run (no relative path is
needed)
-u, --update-data If examples use reference data files, get them to re-
generate them
-f FULLNESS, --fullness=FULLNESS
choose the duration of tests to run: QUICK, EXTENSIVE,
or TAKES_FOREVER, where EXTENSIVE includes QUICK and
TAKES_FOREVER includes QUICK and EXTENSIVE (only QUICK
tests are run by default)
-g, --grind run the test suites and examples using valgrind
-k, --kinds print the kinds of tests available
-l, --list print the list of known tests
-m, --multiple report multiple failures from test suites and test
cases
-n, --nowaf do not run waf before starting testing
-p PYEXAMPLE, --pyexample=PYEXAMPLE
specify a single python example to run (with relative
path)
-r, --retain retain all temporary files (which are normally
deleted)
-s TEST-SUITE, --suite=TEST-SUITE
specify a single test suite to run
-t TEXT-FILE, --text=TEXT-FILE
write detailed test results into TEXT-FILE.txt
-v, --verbose print progress and informational messages
-w HTML-FILE, --web=HTML-FILE, --html=HTML-FILE
write detailed test results into HTML-FILE.html
-x XML-FILE, --xml=XML-FILE
write detailed test results into XML-FILE.xml
如果指定可选的输出方式,可以生成详细的测试和状态描述。可选的样式有 text 和 HTML 。buildbots 选择 HTML 方式生成 HTML 测试报告用于 nightly builds :
$ ./test.py --html=nightly.html
$ ./test.py --text=results.txt
$ ./test.py --suite=propagation-loss-model
或者等价于
$ ./test.py -s propagation-loss-model
结果是单个 test suite 正在运行。
FAIL: TestSuite propagation-loss-model
$ ./test.py --suite=propagation-loss-model --text=results.txt
FAIL: Test Suite ''propagation-loss-model'' (real 0.02 user 0.01 system 0.00)
PASS: Test Case "Check ... Friis ... model ..." (real 0.01 user 0.00 system 0.00)
FAIL: Test Case "Check ... Log Distance ... model" (real 0.01 user 0.01 system 0.00)
Details:
Message: Got unexpected SNR value
Condition: [long description of what actually failed]
Actual: 176.395
Limit: 176.407 +- 0.0005
File: ../src/test/ns3wifi/propagation-loss-models-test-suite.cc
Line:
$ ./test.py --constrain=unit
相似地,下列命令会导致只有 example smoke tests 运行:
$ ./test.py --constrain=unit
为了快速看到合法的约束列表,你可以要求它们列举出来。下使用列代码:
$ ./test.py --kinds
Waf: Entering directory '/home/craigdo/repos/ns-3-allinone-test/ns-3-dev/build'
Waf: Leaving directory '/home/craigdo/repos/ns-3-allinone-test/ns-3-dev/build'
'build' finished successfully (.939s)Waf: Entering directory '/home/craigdo/repos/ns-3-allinone-test/ns-3-dev/build'
bvt: Build Verification Tests (to see if build completed successfully)
core: Run all TestSuite-based tests (exclude examples)
example: Examples (to see if example programs run successfully)
performance: Performance Tests (check to see if the system is as fast as expected)
system: System Tests (spans modules to check integration of modules)
unit: Unit Tests (within modules to check basic functionality)
$ ./test.py --list
Waf: Entering directory `/home/craigdo/repos/ns--allinone-test/ns--dev/build'
Waf: Leaving directory `/home/craigdo/repos/ns--allinone-test/ns--dev/build'
'build' finished successfully (.939s) Test Type Test Name
--------- ---------
performance many-uniform-random-variables-one-get-value-call
performance one-uniform-random-variable-many-get-value-calls
performance type-id-perf
system buildings-pathloss-test
system buildings-shadowing-test
system devices-mesh-dot11s-regression
system devices-mesh-flame-regression
system epc-gtpu
...
unit wimax-phy-layer
unit wimax-service-flow
unit wimax-ss-mac-layer
unit wimax-tlv
example adhoc-aloha-ideal-phy
example adhoc-aloha-ideal-phy-matrix-propagation-loss-model
example adhoc-aloha-ideal-phy-with-microwave-oven
example aodv
...
$ ./test.py --example=udp-echo
PASS: Example examples/udp/udp-echo
$ ./test.py --buildpath=/home/craigdo/repos/ns--allinone-test/ns--dev/build/debug --example=wifi-simple-adhoc
$ ./test.py --pyexample=examples/tutorial/first.py
会导致单个 example 运行,
PASS: Example examples/tutorial/first.py
$ ./test.py --list --nowaf
将会导致显示当前已经编译的 test suites ,类似于:
propagation-loss-model
ns3-tcp-cwnd
ns3-tcp-interoperability
pcap-file
object-name-service
random-variable-stream-generators
$ ./test.py --grind
$ ./test.py --retain
$ ./test.py --verbose
$ ./test.py --verbose --grind --constrain=core --html=results.html
(3)TestTaxonomy
- Build Verification Tests
- Unit Tests
- System Tests
- Examples
- Performance Tests
- QUICK
- EXTENSIVE
- TAKES_FOREVER
(3d)Examples
(4)Running Tests(运行测试)
$ ./waf --configure --enable-examples --enable-tests
(5)Debugging Tests
$ ./waf --run "test-runner --help"
你会看到类似下面的输出:
Usage: /home/craigdo/repos/ns--allinone-test/ns--dev/build/utils/ns3-dev-test-runner-debug [OPTIONS] Options:
--help : print these options
--print-test-name-list : print the list of names of tests available
--list : an alias for --print-test-name-list
--print-test-types : print the type of tests along with their names
--print-test-type-list : print the list of types of tests available
--print-temp-dir : print name of temporary directory before running
the tests
--test-type=TYPE : process only tests of type TYPE
--test-name=NAME : process only test whose name matches NAME
--suite=NAME : an alias (here for compatibility reasons only)
for --test-name=NAME
--assert-on-failure : when a test fails, crash immediately (useful
when running under a debugger
--stop-on-failure : when a test fails, stop immediately
--fullness=FULLNESS : choose the duration of tests to run: QUICK,
EXTENSIVE, or TAKES_FOREVER, where EXTENSIVE
includes QUICK and TAKES_FOREVER includes
QUICK and EXTENSIVE (only QUICK tests are
run by default)
--verbose : print details of test execution
--xml : format test run output as xml
--tempdir=DIR : set temp dir for tests to store output files
--datadir=DIR : set data dir for tests to read reference files
--out=FILE : send test result to FILE instead of standard output
--append=FILE : append test result to FILE instead of standard output
$ ./waf shell
$ cd build/utils
$ gdb ns3-dev-test-runner-debug
$ run --suite=global-value --assert-on-failure
$ ./waf --run "test-runner --suite=pcap-file"
$ NS_LOG="Packet" ./waf -- run "test-runner -- suite=pcap-file"
例如,对 “lte-test-rr-ff-mac-scheduler.cc” 添加日志功能,可以获取相关的吞吐量信息,使用类似上述的命令:
$ NS_LOG="LenaTestRrFfMacScheduler" ./waf --run "test-runner --suite=lte-rr-ff-mac-scheduler" >& log5.out
可以在 log5.out 中查看有用的日志信息,部分截图如下:

(5a)Test output(测试输出)
/tmp/ns-3.10.25.37.
$ ./test.py -r
(5b)Reporting of test failures(上报测试失败)
$ ./waf --run "test-runner --suite=pcap-file --out=myfile.txt"
(5c)Debugging test suite failures
CRASH: TestSuite ns3-wifi-interference
$ ./waf --command-template="gdb %s" --run "test-runner"
Waf: Entering directory `/home/tomh/hg/sep09/ns--allinone/ns--dev-/build'Waf: Leaving directory `/home/tomh/hg/sep09/ns-3-allinone/ns-3-dev-678/build''build' finished successfully (.380s)
GNU gdb 6.8-debian
Copyright (C) Free Software Foundation, Inc.
L cense GPLv3+: GNU GPL version or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law. Type "show copying"
and "show warranty" for details.
This GDB was configured as "x86_64-linux-gnu"...
(gdb) r --suite=
Starting program: <..>/build/utils/ns3-dev-test-runner-debug --suite=ns3-wifi-interference
[Thread debugging using libthread_db enabled]
assert failed. file=../src/core/model/type-id.cc, line=, cond="uid <= m_information.size () && uid != 0"
...
这里还有另外一个例子教你如何使用 valgrind 调试内存问题,例如:
VALGR: TestSuite devices-mesh-dot11s-regression $ ./waf --command-template="valgrind %s --suite=devices-mesh-dot11s-regression" --run test-runner
(5)Class TestRunner
(6)Test Suite
- Build Verification Tests
- Unit Tests
- System Tests
- Examples
- Performance Tests
class MySuite : public TestSuite
{
public:
MyTestSuite ();
}; MyTestSuite::MyTestSuite ()
: TestSuite ("my-test-suite-name", UNIT)
{
AddTestCase (new MyTestCase, TestCase::QUICK);
}
static MyTestSuite myTestSuite;
(7)Test Case
class MyTestCase : public TestCase{
MyTestCase ();
virtual void DoSetup (void);
virtual void DoRun (void);};
MyTestCase::MyTestCase ()
: TestCase ("Check some bit of functionality"){}
voidMyTestCase::DoRun (void){
NS_TEST_ASSERT_MSG_EQ (true, true, "Some failure message");}
Manual——Test (翻译1)的更多相关文章
- 【socket编程】select manual page翻译
原文: select manual page 依赖的头文件 /* According to POSIX.1-2001, POSIX.1-2008 */ #include <sys/select. ...
- trove manual installation 翻译
目标 此文件提供了一步一步的指导手动安装trove在一个现有OpenStack的环境为了开发. 该文件将不包括: OpenStack的设置 trove服务配置 要求 正在运行的OpenStack的环境 ...
- 开始进行lammps手册的学习啦,跟着Manual一边翻译一边做吧!(转载)
转载自:http://blog.sina.com.cn/s/blog_64813e370100ngsz.html 注明:黄色部分基本上为不懂的部分,红色字体为所做注释 一.各种文件的介绍: 1 in ...
- Show Global Status 整理
原文来源:MySQL 5.5 Reference Manual 部分翻译取自:<MySQL_5.1中文参考手册> 转载请注明原文链接http://www.cnblogs.com/lenag ...
- 生物信息学工具--bowtie&bowtie2
Bowtie和Bowtie2使用 [怪毛匠子整理] Source URL: http://www.bbioo.com/lifesciences/40-112837-1.html Bowtie和Bowt ...
- LwIP Application Developers Manual2---Protocols概览
1.前言 本文是对LwIP Application Developers Manual的翻译 lwIP是模块化的并支持广泛的协议,这些大部分协议可以被裁减从而减小代码的尺寸 2.协议概览 链路层和网络 ...
- LwIP Application Developers Manual1---介绍
1.前言 本文主要是对LwIP Application Developers Manual的翻译 2.读者(应用开发手册的读者) 谁适合读这份手册 网络应用的开发者 想了解lwIP的网络应用开发者 阅 ...
- Xming 多屏选项
最早接触xming是从GrADS软件弹出的那个窗口开始的.到后来发现它是一个显示图形界面的软件,设置multiwindow 选项,xshell+xming连远程服务器,屡试不爽.随着设备升级,用上了双 ...
- MySQL - Show Processlist 整理
MySQL - Show Processlist 整理 原文来源:MySQL 5.5 Reference Manual 部分翻译取自:<MySQL_5.1中文参考手册> 转载请注明原文 ...
- MySQL - Show Processlist 整理(转)
原文来源:MySQL 5.5 Reference Manual 部分翻译取自:<MySQL_5.1中文参考手册> 转载请注明原文链接http://www.cnblogs.com/len ...
随机推荐
- Excel Note
公式的引用分为相对引用.绝对引用和混合引用.如果要使公式中的引用随着公式的下拉改变就用相对引用.如=sum(A2:D20),这个公式下拉时引用的单元格就会随着变化.如果要使公式中的引用下拉时不会改变就 ...
- c/c++ qsort 函数的简单使用(1)
#include <stdio.h> #include <stdlib.h> //打印数组元素 void print(int arr[], int n){ ; i < n ...
- 07_编写天气预报和手机归属地的WebService
<s:element ref="s:schema" /> <s:any /> <s:any minOccurs="2" maxOc ...
- xhtml 和 html 的区别
xhtml遵循xml文档规则,对于书写比较严格,相对于html来说,主要有以下不同: 标签不能重叠,可以嵌套标签与属性都要小写标签都要有始有终,要么以</p>形式结束,要么以<br ...
- Foundation框架
1.框架是由许多类.方法.函数.文档按照一定的逻辑组织起来的集合,以便使研发程序变的更容易 清除缓存,删除这个文件夹下的所有文件/Users/fanyafang/Library/Developer/X ...
- ubuntu16.04.1下的mysql修改默认编码
在Ubuntu 下配置 Mysql 的字符编码.安装完 Mysql 后,系统默认的字符编码是 latin1 ,输入的是中文,可是输出却是一堆乱码.现在要做的就是把 Mysql的默认字符编码设置为支持中 ...
- 苹果版App开发心得
这几个月中做的工作包括网站开发.安卓App开发和苹果App开发,前两者用的语言都是我熟悉的java,故苹果知识的学习,较安卓知识的学习,多出「语言基础」一块,其他方面差不多. 之前发过安卓那篇,如感兴 ...
- 鸟哥的linux私房菜学习记录之软件安装原始码与Tarball
- 使用Python从Markdown文档中自动生成标题导航
概述 知识与思路 代码实现 概述 Markdown 很适合于技术写作,因为技术写作并不需要花哨的排版和内容, 只要内容生动而严谨,文笔朴实而优美. 为了编写对读者更友好的文章,有必要生成文章的标题导航 ...
- dr.wondr博士随笔之某古旧非智能机T6XXX 恢复一例
大家好!欢迎再次来到dr.Wonde的微博! 今次我给大家带来索尼爱立信古董机T650i的取证工作展示! 首先请出今天我们的主角索尼爱立信 T650i>> 然后在工厂模式下,连接设备,看图 ...