vpp自动化测试报错调试

1)vpp 自动化测试方法
        在源码目录下,执行 make test 命令可进行自动化测试,并可通过 make test-help 来查看具体的参数信息。
2)如果在执行 make test 时,vpp 报错,或者 vpp crash,导致 python 侧 IO 超时,比如:

...
Starting ACL create/delete test ...
------------------------------------------------------------------------------
Received read timeout 5s
11:44:08,004 [Errno 2] No such file or directory
Received read timeout 5s
11:44:13,001 [Errno 2] No such file or directory
------------------------------------------------------------------------------
...
==============================================================================
ERROR: ACL create/delete test
------------------------------------------------------------------------------
Traceback (most recent call last):
  File "test_acl_plugin.py", line 603, in test_0001_acl_create
    acls=[first_acl])
  File "/root/vpp/build-root/rpmbuild/vpp-18.07.1/test/vpp_papi_provider.py", line 2864, in acl_interface_set_acl_list
    expected_retval=expected_retval)
  File "/root/vpp/build-root/rpmbuild/vpp-18.07.1/test/vpp_papi_provider.py", line 160, in api
    reply = api_fn(**api_args)
  File "build/bdist.linux-arch/egg/vpp_papi/vpp_papi.py", line 106, in __call__
    return self._func(**kwargs)
  File "build/bdist.linux-arch/egg/vpp_papi/vpp_papi.py", line 397, in f
    return self._call_vpp(i, msg, multipart, **kwargs)
  File "build/bdist.linux-arch/egg/vpp_papi/vpp_papi.py", line 604, in _call_vpp
    msg = self._read()
  File "build/bdist.linux-arch/egg/vpp_papi/vpp_papi.py", line 442, in _read
    raise IOError(rv, 'vac_read failed')
IOError: [Errno -1] vac_read failed

3)此时应该通过执行 make test-shell DEBUG=gdb,进入测试框架提供的 shell 环境,如下所示:

[root@bogon vpp-18.07.1]# make test-shell DEBUG=gdb
...
(virtualenv) [root@bogon test]# 
(virtualenv) [root@bogon test]# 

然后单独执行那个报错的测试用例,比如:test_acl_plugin.py:

(virtualenv) [root@bogon test]# python test_acl_plugin.py
...
------------------------------------------------------------------------------
You can debug the VPP using e.g.:
gdb /root/vpp/build-root/rpmbuild/vpp-18.07.1/build-root/install-vpp-native/vpp/bin/vpp -ex 'attach 1880693'
Now is the time to attach a gdb by running the above command and set up breakpoints etc.
------------------------------------------------------------------------------
Press ENTER to continue running the testcase...

执行上述命令后,程序会停下来,根据上面的提示,可通过 gdb attach 来调试上述测试用例在执行过程中启动的 vpp 实例,在你认为有问题的地方打上断点,并 continue,如下所示:

[root@bogon vpp-18.07.1]# gdb /root/vpp/build-root/rpmbuild/vpp-18.07.1/build-root/install-vpp-native/vpp/bin/vpp -ex 'attach 1880693'
...
Reading symbols from /root/vpp/build-root/rpmbuild/vpp-18.07.1/build-root/install-vpp-native/vpp/bin/vpp...done.
Attaching to program: /root/vpp/build-root/rpmbuild/vpp-18.07.1/build-root/install-vpp-native/vpp/bin/vpp, process 2483450
[New LWP 2483451]
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib64/libthread_db.so.1".
0x000000fff67d65d4 in epoll_pwait () from /lib64/libc.so.6
(gdb) b vnet_classify_new_table
Breakpoint 1 at 0xfff6dcef90: file /root/vpp/build-root/rpmbuild/vpp-18.07.1/build-data/../src/vnet/classify/vnet_classify.c, line 128.
(gdb) c
Continuing.

4)在刚才启动的测试用例中敲回车,以便让测试用例继续执行,在 gdb 中命中断点后就可以进行调试了。

You can debug the VPP using e.g.:
gdb /root/vpp/build-root/rpmbuild/vpp-18.07.1/build-root/install-vpp-native/vpp/bin/vpp -ex 'attach 1880693'
Now is the time to attach a gdb by running the above command and set up breakpoints etc.
------------------------------------------------------------------------------
Press ENTER to continue running the testcase...
==============================================================================
ACL plugin Test Case
==============================================================================
Starting ACL plugin version check; learn MACs ...
------------------------------------------------------------------------------
------------------------------------------------------------------------------
ACL plugin version check; learn MACs OK
------------------------------------------------------------------------------
Starting ACL create/delete test ...

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值