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, ...
随机推荐
- 解决navicate 连接mysql数据库中文乱码的问题
以下均是ubuntu12.04为准 1.修改mysql的配置文件. 1.1.vi /etc/mysql/my.conf找到[client]在其下面添加 default-character-set=u ...
- EF Core 2.1 +数据库视图
1.参考文档 https://stackoverflow.com/questions/36012616/working-with-sql-views-in-entity-framework-core ...
- BZOJ4245: [ONTAK2015]OR-XOR(前缀和)
题意 题目链接 Sol 又是一道非常interesting的题目 很显然要按位考虑 因为最终答案是xor之后or,所以分开之后之后这样位上1的数量是一定是偶数,否则直接加到答案里面 同时,这里面有些部 ...
- RNQOJ [stupid]愚蠢的矿工(树形依赖背包)
题意 题目链接 Sol 树形依赖背包板子题 树形依赖背包大概就是说:对于一个点,只有选了它的父亲才能选自身 把dfs序建出来,倒过来考虑 设\(f[i][j]\)表示从第\(i\)个节点往后背包体积为 ...
- AngularJS 指令解析(二)
AngularJS 指令解析(二) 第一篇我们讲过了作用域(scope)这块内容,现在我们进入正题,讲AngularJS的指令. 什么是指令? 这里我们引用官方的一句话: Custom directi ...
- css随堂笔记(二)
css sub注释 注释不能嵌套 sub生成结构代码快捷 复合选择器 1.后代选择器 语法:选择器1 选择器2 选择器3 { 属性名:属性值 } 2.子代选择器 子代选择器语法: 选择器1> ...
- position 的属性值
理论上来说,全部 position 的取值有8个 包括:position:static | relative | absolute | fixed | sticky | initial | inhe ...
- iDempiere 使用指南 采购入库流程
Created by 蓝色布鲁斯,QQ32876341,blog http://www.cnblogs.com/zzyan/ iDempiere官方中文wiki主页 http://wiki.idemp ...
- DirectX HLSL 内置函数
Intrinsic Functions (DirectX HLSL) The following table lists the intrinsic functions available in HL ...
- 用Android studio进行 OpenCV 开发的第一个项目
我的天! 折腾了好久终于搭建成功了第一个项目. 项目环境: Windows 7 家庭普通版 64位 Android studio 1.5.1 OpenCV-2.4.9-android-sdk 基于 ...