欢迎访问 生活随笔!

生活随笔

当前位置: 首页 > 编程资源 > 编程问答 >内容正文

编程问答

vpp自动化测试报错调试

发布时间:2023/12/14 编程问答 29 豆豆
生活随笔 收集整理的这篇文章主要介绍了 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_createacls=[first_acl])File "/root/vpp/build-root/rpmbuild/vpp-18.07.1/test/vpp_papi_provider.py", line 2864, in acl_interface_set_acl_listexpected_retval=expected_retval)File "/root/vpp/build-root/rpmbuild/vpp-18.07.1/test/vpp_papi_provider.py", line 160, in apireply = 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 freturn self._call_vpp(i, msg, multipart, **kwargs)File "build/bdist.linux-arch/egg/vpp_papi/vpp_papi.py", line 604, in _call_vppmsg = self._read()File "build/bdist.linux-arch/egg/vpp_papi/vpp_papi.py", line 442, in _readraise 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 ...

总结

以上是生活随笔为你收集整理的vpp自动化测试报错调试的全部内容,希望文章能够帮你解决所遇到的问题。

如果觉得生活随笔网站内容还不错,欢迎将生活随笔推荐给好友。