dts--tests(一)
cmdline.py
"""
DPDK Test suite.
Test cmdline.
""" import utils from test_case import TestCase class TestCmdline(TestCase): def set_up_all(self):
"""
Run at the start of each test suite. Cmdline Prerequisites:
cmdline build pass
At least one core in DUT
"""
out = self.dut.build_dpdk_apps('examples/cmdline')
'''
rm -rf ./app/test/test_resource_c.res.o
dut.10.240.176.254: rm -rf ./app/test/test_resource_tar.res.o
dut.10.240.176.254: rm -rf ./app/test/test_pci_sysfs.res.o
dut.10.240.176.254: make -j 70 -C examples/cmdline
'''
self.verify('make: Leaving directory' in out, "Compilation failed")
self.verify("Error" not in out, "compilation error 1")
self.verify("No such file" not in out, "compilation error 2") # Run cmdline app
cores = self.dut.get_core_list('1S/1C/1T') #['1']
'''
(Pdb) self.dut.get_core_list('1S/3C/1T')
['1', '2', '3']
(Pdb) self.dut.get_core_list('2S/3C/1T')
['1', '2', '3', '32', '33', '34']
(Pdb) self.dut.get_core_list('1S/5C/1T')
['1', '2', '3', '4', '5']
(Pdb) self.dut.get_core_list('1S/3C/1T')
['1', '2', '3'] '''
coreMask = utils.create_mask(cores)
'''
['1'] -> '0x2' #转换为16进制
['1', '2', '3'] -> '0xe'
['1', '2', '3', '32', '33', '34'] -> '0x70000000e'
'''
self.dut.send_expect("./examples/cmdline/build/app/cmdline -n 1 -c " + coreMask, "> ", 10) def set_up(self):
"""
Run before each test case.
Nothing to do.
"""
pass def test_cmdline_sample_commands(self):
"""
Sample commands test.
""" # add a test object with an IP address associated
out = self.dut.send_expect("add object 192.168.0.1", "example> ")
self.verify("Object object added, ip=192.168.0.1" in out, "add command error") # verify the object existance
out = self.dut.send_expect("add object 192.168.0.1", "example> ")
self.verify("Object object already exist" in out, "double add command error") # show the object result by 'show' command
out = self.dut.send_expect("show object", "example> ")
self.verify("Object object, ip=192.168.0.1" in out, "show command error") # delete the object in cmdline
out = self.dut.send_expect("del object", "example> ")
self.verify("Object object removed, ip=192.168.0.1" in out, "del command error") # double delete the object to verify the correctness
out = self.dut.send_expect("del object", "example> ", 1)
self.verify("Bad arguments" in out, "double del command error") # verify no such object anymore
out = self.dut.send_expect("show object", "example> ", 1)
self.verify("Bad arguments" in out, "final show command error") # verify the help command
out = self.dut.send_expect("help", "example> ", 1) """
Demo example of command line interface in RTE This is a readline-like interface that can be used to
debug your RTE application. It supports some features
of GNU readline like completion, cut/paste, and some
other special bindings. This demo shows how rte_cmdline library can be
extended to handle a list of objects. There are
3 commands:
- add obj_name IP
- del obj_name
- show obj_name
"""
self.verify(" " in out, "help command error") out = self.dut.send_expect("?", "example> ", 1)
"""
show [Mul-choice STRING]: Show/del an object
del [Mul-choice STRING]: Show/del an object
add [Fixed STRING]: Add an object (name, val)
help [Fixed STRING]: show help
"""
self.verify(" " in out, "? command error") def tear_down(self):
"""
Run after each test case.
Nothing to do.
"""
pass def tear_down_all(self):
"""
Run after each test suite.
Stop cmdline app.
"""
self.dut.kill_all()
测试的目的:
Test Case: cmdline sample commands test
======================================= Add a test object with an IP address associated to it:: example>add object 192.168.0.1
Object object added, ip=192.168.0.1 Verify the object existence:: example>add object 192.168.0.1
Object object already exist Show the object result by ``show`` command:: example>show object
Object object, ip=192.168.0.1 Verify the output matches the configuration. Delete the object in cmdline and show the result again:: example>del object
Object object removed, ip=192.168.0.1 Double delete the object to verify the correctness:: example>del object
Bad arguments Verify no such object exist now.:: example>show object
Bad arguments Verify the hidden command ? and help command:: example>help
Demo example of command line interface in RTE This is a readline-like interface that can be used to
debug your RTE application. It supports some features
of GNU readline like completion, cut/paste, and some
other special bindings. This demo shows how rte_cmdline library can be
extended to handle a list of objects. There are
3 commands:
- add obj_name IP
- del obj_name
- show obj_name example>?
show [Mul-choice STRING]: Show/del an object
del [Mul-choice STRING]: Show/del an object
add [Fixed STRING]: Add an object (name, val)
help [Fixed STRING]: show help cmdline.py
# add a test object with an IP address associated
out = self.dut.send_expect("add object 192.168.0.1", "example> ")
self.verify("Object object added, ip=192.168.0.1" in out, "add command error") # verify the object existance
out = self.dut.send_expect("add object 192.168.0.1", "example> ")
self.verify("Object object already exist" in out, "double add command error") # show the object result by 'show' command
out = self.dut.send_expect("show object", "example> ")
self.verify("Object object, ip=192.168.0.1" in out, "show command error") # delete the object in cmdline
out = self.dut.send_expect("del object", "example> ")
self.verify("Object object removed, ip=192.168.0.1" in out, "del command error") # double delete the object to verify the correctness
out = self.dut.send_expect("del object", "example> ", 1)
self.verify("Bad arguments" in out, "double del command error") # verify no such object anymore
out = self.dut.send_expect("show object", "example> ", 1)
self.verify("Bad arguments" in out, "final show command error") # verify the help command
out = self.dut.send_expect("help", "example> ", 1) """
Demo example of command line interface in RTE This is a readline-like interface that can be used to
debug your RTE application. It supports some features
of GNU readline like completion, cut/paste, and some
other special bindings. This demo shows how rte_cmdline library can be
extended to handle a list of objects. There are
3 commands:
- add obj_name IP
- del obj_name
- show obj_name
"""
self.verify(" " in out, "help command error") out = self.dut.send_expect("help", "example> ", 1)
"""
show [Mul-choice STRING]: Show/del an object
del [Mul-choice STRING]: Show/del an object
add [Fixed STRING]: Add an object (name, val)
help [Fixed STRING]: show help
"""
self.verify(" " in out, "? command error")
dut:执行详细信息
[root@localhost cmdline]# ./examples/cmdline/build/app/cmdline -n 1 -c 0x2
EAL: PCI device 0000:82:00.0 on NUMA socket 1
EAL: probe driver: 8086:10fb net_ixgbe
EAL: PCI device 0000:82:00.1 on NUMA socket 1
EAL: probe driver: 8086:10fb net_ixgbe
example> add object 192.168.0.1
Object object added, ip=192.168.0.1
example> add object 192.168.0.1
Object object already exist
example> show object 192.168.0.1
Bad arguments
example> show object
Object object, ip=192.168.0.1
example> del object
Object object removed, ip=192.168.0.1
example> del object
Bad arguments
example> show object
Bad arguments
example> help
Demo example of command line interface in RTE This is a readline-like interface that can be used to
debug your RTE application. It supports some features
of GNU readline like completion, cut/paste, and some
other special bindings. This demo shows how rte_cmdline library can be
extended to handle a list of objects. There are
3 commands:
- add obj_name IP
- del obj_name
- show obj_name example>
show [Mul-choice STRING]: Show/del an object
del [Mul-choice STRING]: Show/del an object
add [Fixed STRING]: Add an object (name, val)
help [Fixed STRING]: show help
dts--tests(一)的更多相关文章
- Django基础,Day6 - 单元测试tests
在django项目app目录下,有个tests.py,我们通常可以直接在这文件中写我们的单元测试代码. test for a model 根据前面章节的操作步骤下来,在Question Model中有 ...
- XUnit - Shared Context between Tests
原文 单元测试类通常都会有share setup和cleanup的相关代码.xUnit.net根据共享的范围提供了几种share setup和cleanup的方法. Constructor and D ...
- .dtsi .dts dtc dtb 是什么
基础 .dts: device tree source .dtsi: device tree source include .dts比作源文件,.dtsi比作头文件. dtc是linux源码 /s ...
- SSIS之-DTS对象&事件
1.Dts 是类 Microsoft.SqlServer.Dts.Tasks.ScriptTask.ScriptObjectModel 类的一个实例,Dts 对象有 7 个属性和一个方法,以下是DTS ...
- 使用命令行工具运行Xcode 7 UI Tests
原文:Run Xcode 7 UI Tests from the command line 苹果在Xcode 7中引入了一项新技术UI Tests,允许开发者使用Swift或Objective C代码 ...
- Junit很少出现的一个问题 No tests found matching ...
java.lang.Exception: No tests found matching [{ExactMatcher:fDisplayName=test2], {ExactMatcher:fDisp ...
- MOOCULUS微积分-2: 数列与级数学习笔记 3. Convergence tests
此课程(MOOCULUS-2 "Sequences and Series")由Ohio State University于2014年在Coursera平台讲授. PDF格式教材下载 ...
- Django~automated tests
def xx(): 冒号下一行要缩进 ATD http://blog.csdn.net/doupei2006/article/details/7657547 http://www.jb51.net/a ...
- iOS9 UI Tests探索笔记
UI Tests是什么? UI Tests是一个自动测试UI与交互的Testing组件 UI Tests有什么用? 它可以通过编写代码.或者是记录开发者的操作过程并代码化,来实现自动点击某个按钮.视图 ...
- x264中I,P,B帧和PTS,DTS的关系
转自:http://www.cppblog.com/tx7do/archive/2013/01/30/197633.html 基本概念: I frame :帧内编码帧 又称intra picture, ...
随机推荐
- Newtonsoft.Json解析json字符串和写json字符串
写: StringWriter sw = new StringWriter(); JsonWriter writer = new JsonWriter(sw); //如果报错则使用JsonWriter ...
- Asp.Net MVC 5 Razor 视图 未将对象引用到实例
未将对象引用到实例的错误居然指向了@{Leyout=“..此处略,核实路径无误”}. 最后发现原来是在一个<select .. name="@Model.Category"& ...
- (五)JavaScript之[类型转换]
/** * 类型转换 * * JavaScript 数据类型 * 1.不同的数据类型 * string * number * object * boolean * function * * 2.对象类 ...
- constrained属性
hibernate文档上是这么写的: constrained(约束) (可选) 表明该类对应的表对应的数据库表,和被关联的对象所对应的数据库表之间,通过一个外键引用对主键进行约束.这个选项影响save ...
- python-daemon
http://legacy.python.org/dev/peps/pep-3143/#python-daemon install yum install python-daemon example ...
- sudoer解释
/etc/sudoer ## Sudoers allows particular users to run various commands as ## the root user, without ...
- 笨办法学Python(十七)
习题 17: 更多文件操作 现在让我们再学习几种文件操作.我们将编写一个 Python 脚本,将一个文件中的内容拷贝到另外一个文件中.这个脚本很短,不过它会让你对于文件操作有更多的了解. from s ...
- hp zbook15G2 nVidia K1100M显卡在ubuntu linux下闪屏问题
我的hp zbook15G2有一块nVidia K1100M显卡. 故障现象 安装ubuntu 16.4之后,屏幕出现闪烁现象. 重启后,进入bios,屏幕依然在闪烁. 再重启,进入另一块硬盘的win ...
- graphql 项目搭建(二)
一.Express基本框架 1.新建一个文件夹gql-server vscode 打开项目,在终端下输入yarn init -y 生成package.json 包(如果没安装yarn ,npm也一样, ...
- 【转】C内存操作函数
一.malloc/calloc 名称: Malloc/calloc 功能: 动态内存分配函数 头文件: #include <stdlib.h> 函数原形: void *malloc(si ...