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, ...
随机推荐
- vue的计算和监视属性,附一小实例
1. 计算属性 在computed属性对象中定义计算属性的方法 在页面中使用{{方法名}}来显示计算的结果 2. 监视属性: 通过通过vm对象的$watch()或watch配置来监视指定的属性 当属性 ...
- Maven,SVN,快捷键,数据库等
1.Eclipse中Maven的搭建: 1.1 从Apache网站 http://maven.apache.org/ 下载并且解压缩安装Apache Maven 下载地址: http://maven. ...
- Python基本操作之文件操作
一. 1.文件操作的函数 open("文件名字(路径)",mode="模式",encoding="字符集") 2.模式:r,w,a,r+,w ...
- SublimeText插件cssrem : px转换为rem
步骤: 下载插件: https://github.com/flashlizi/cssrem 安装插件: 打开:Sublime Text 点击: Preferences 选择: Browse Packa ...
- 即将要被淘汰的兼容之--CSS Hack
css hack 条件注释法只在IE下生效<!--[if IE]>这段文字只在IE浏览器显示<![endif]-->只在IE6下生效<!--[if IE 6]>这段 ...
- Android - 开发页面需了解的dip,sp,px知识,以及它们的转换
工作中,时常会有任务要求开发新页面,这时一般的流程是产品经理确定要开发的页面和功能,然后设计师提供设计稿,之后由我们开发人员完成开发工作. 通常,设计师提供的设计稿尺寸标注会很详细,例如涉及到字时,字 ...
- django rest framework 详解
Django REST framework 是用于构建Web API 的强大而灵活的工具包. 我们可能想使用REST框架的一些原因: Web浏览API对于开发人员来说是一个巨大的可用性. 认证策略包括 ...
- 关于 supersocket 不能通过Bootstrap 启动
App.config内容 <configSections> <section name="superSocket" type="SuperSocke ...
- JDBC源码解析
参考:https://blog.csdn.net/silviakafka/article/details/46225045
- 解决频繁自动弹出“QQ拼音升级程序”,可使用旧版QQ输入法
QQ输入法(2017年9月6日版本)下载地址: http://dlc2.pconline.com.cn/filedown_90891_8506339/BZXMP3fp/QQPinyin_Setup_5 ...