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, ...
随机推荐
- asp.net core 2.1 生成swagger文档
新建asp.netcore2.1 api项目 “WebApplication1” 在nuget管理器中添加对Swashbuckle.AspNetCore 3.0.0.Microsoft.AspNetC ...
- Devexpress Xtrareport 打印报表
需要引用 Using Devexpress.Xtrareport.UI: Using Devexpress.XtraPrinting.Localiztion 实例化报表,xtrareport my=n ...
- .Net程序员学习Linux最简单的方法(转载)
有很多关于Linux的书籍.博客.大多数都会比较“粗暴“的将一大堆的命令塞给读者,从而使很多.NET程序员望而却步.未入其门就路过了. 所以我设想用一种更为平滑的学习方式, 就是在学习命令时,先用纯语 ...
- JavaSE之Java基础(1)
1.为什么重写equals还要重写hashcode 首先equals与hashcode间的关系是这样的: 1.如果两个对象相同(即用equals比较返回true),那么它们的hashCode值一定要相 ...
- 我对CSS选择器的认识
我对CSS选择器的认识 一.简述 CSS选择器是对HTML元素进行选择的筛选条件,大概可以分为两类: 特征选择器——根据元素自身所具有的某种特征进行筛选,比如名称.ID.属性等: 关系选择器——根据元 ...
- ueditor 插件问题
- 1064. 计算斐波那契第n项 通项公式
题目描述 输入n,编写程序输出斐波那契数列的第n项.其中斐波那契数列f(n)的定义如下: f(1)=0,f(2)=1 f(n)=f(n-1)+f(n-2)(n>=2) 输入 一行 ...
- Javascript的map与forEach的区别
原理: 高级浏览器支持forEach方法语法:forEach和map都支持2个参数:一个是回调函数(item,index,list)和上下文: forEach:用来遍历数组中的每一项:这个方法执行是没 ...
- Java学习笔记——String类常用方法
所谓的字符串就是对数组的包装,所以字符串内容无法进行更改.String在JDK1.8以前保存的是字符数组:private final char value[]; 而在JDK1.9之后保存的是字节数组: ...
- SpringCloud的学习记录(6)
这一章节讲fegin的使用. 在我们生成的Demo项目上右键点击New->Module->spring Initializr, 然后next, 填写Group和Artifact等信息, 这 ...