参考:http://blog.csdn.net/shaoyunzhe/article/details/53096932
http://blog.csdn.net/a464057216/article/details/51889564
http://blog.csdn.net/wangcg123/article/details/71727965
下载地址:https://github.com/FDio/vpp/tree/master
git clone 下来
进入 vpp目录
依次执行命令
make install-dep
make bootstrap
make build
设置大页
mkdir /mnt/huge
mount -t hugetlbfs nodev /mnt/huge
echo 1024 > /sys/kernel/mm/hugepages/hugepages-2048kB/nr_hugepages
cat /proc/meminfo| grep Huge
之后就可以直接 make run 执行了。
使用 quit命令退出
但是之后要指定配置文件执行就要编译 dpdk了。
!!!在dpdk的目录下的 Makefile文件中改下配置 将 RTE_EAL_IGB_UIO 设置为y
才会有 igb_uio.ko 文件
之后加载驱动
modprobe uio
insmod igb_uio.ko
dmesg
查看 成功没有
绑定网卡,配置文件等,具体可以参考最上面的链接,本人也是指定配置文件会出错,暂时还没搞懂
但我的目的是执行测试框架:
要执行测试框架只要 make run 可以起来就可以了
在VPP目录下执行
make test
构建执行测试用例
就是这样的
执行 命令
make
可以查看更多执行命令和帮助
root@ubuntu:~/vpp/vpp# make
Make Targets:
bootstrap - prepare tree for build
install-dep - install software dependencies
wipe - wipe all products of debug build
wipe-release - wipe all products of release build
build - build debug binaries
build-release - build release binaries
build-coverity - build coverity artifacts
rebuild - wipe and build debug binares
rebuild-release - wipe and build release binares
run - run debug binary
run-release - run release binary
debug - run debug binary with debugger
debug-release - run release binary with debugger
test - build and run (basic) functional tests
test-debug - build and run (basic) functional tests (debug build)
test-all - build and run (all) functional tests
test-all-debug - build and run (all) functional tests (debug build)
test-shell - enter shell with test environment
test-shell-debug - enter shell with test environment (debug build)
test-wipe - wipe files generated by unit tests
retest - run functional tests
retest-debug - run functional tests (debug build)
test-help - show help on test framework
run-vat - run vpp-api-test tool
pkg-deb - build DEB packages
pkg-rpm - build RPM packages
dpdk-install-dev - install DPDK development packages
ctags - (re)generate ctags database
gtags - (re)generate gtags database
cscope - (re)generate cscope database
checkstyle - check coding style
fixstyle - fix coding style
doxygen - (re)generate documentation
bootstrap-doxygen - setup Doxygen dependencies
wipe-doxygen - wipe all generated documentation
test-doc - generate documentation for test framework
test-wipe-doc - wipe documentation for test framework
test-cov - generate code coverage report for test framework
test-wipe-cov - wipe code coverage report for test framework
test-checkstyle - check PEP8 compliance for test framework
Make Arguments:
V=[0|1] - set build verbosity level
STARTUP_CONF=<path> - startup configuration file
(e.g. /etc/vpp/startup.conf)
STARTUP_DIR=<path> - startup drectory (e.g. /etc/vpp)
It also sets STARTUP_CONF if
startup.conf file is present
GDB=<path> - gdb binary to use for debugging
PLATFORM=<name> - target platform. default is vpp
TEST=<filter> - apply filter to test set, see test-help
SAMPLE_PLUGIN=yes - in addition build/run/debug sample plugin
Current Argument Values:
V =
STARTUP_CONF =
STARTUP_DIR = /root/vpp/vpp
GDB = gdb
PLATFORM = vpp
DPDK_VERSION =
SAMPLE_PLUGIN = no
root@ubuntu:~/vpp/vpp#
最重要的如何执行单个测试用例:
make test-shell
python test_*.py(要执行的单个测试用例)
(virtualenv) root@ubuntu:~/vpp/vpp/test#
(virtualenv) root@ubuntu:~/vpp/vpp/test# python test_ip4.py
Running tests using custom test runner
Active filters: file=None, class=None, function=None
10 out of 10 tests match specified filters
Not running extended tests (some tests will be skipped)
==============================================================================
IPv4 disabled
==============================================================================
Starting IP Disabled ...
------------------------------------------------------------------------------
------------------------------------------------------------------------------
IP Disabled OK
------------------------------------------------------------------------------
==============================================================================
IPv4 Load-Balancing
==============================================================================
Starting IP Load-Balancing ...
------------------------------------------------------------------------------
------------------------------------------------------------------------------
IP Load-Balancing OK
------------------------------------------------------------------------------
==============================================================================
IPv4 routes via NULL
==============================================================================
Starting IP NULL route ...
------------------------------------------------------------------------------
------------------------------------------------------------------------------
IP NULL route OK
------------------------------------------------------------------------------
==============================================================================
IPv4 Subnets
==============================================================================
Starting IP Sub Nets ...
------------------------------------------------------------------------------
------------------------------------------------------------------------------
IP Sub Nets OK
------------------------------------------------------------------------------
==============================================================================
IPv4 VLAN-0
==============================================================================
Starting IP VLAN-0 ...
------------------------------------------------------------------------------
------------------------------------------------------------------------------
IP VLAN-0 OK
------------------------------------------------------------------------------
==============================================================================
IPv4 Test Case
==============================================================================
Starting IPv4 FIB test ...
------------------------------------------------------------------------------
------------------------------------------------------------------------------
IPv4 FIB test OK
------------------------------------------------------------------------------
==============================================================================
FIB - add/update/delete - ip4 routes
==============================================================================
Starting Add 1k routes ...
------------------------------------------------------------------------------
------------------------------------------------------------------------------
Add 1k routes OK
------------------------------------------------------------------------------
Starting Delete 100 routes ...
------------------------------------------------------------------------------
------------------------------------------------------------------------------
Delete 100 routes OK
------------------------------------------------------------------------------
Starting Add 1k routes ...
------------------------------------------------------------------------------
------------------------------------------------------------------------------
Add 1k routes OK
------------------------------------------------------------------------------
Starting Delete 1.5k routes ...
------------------------------------------------------------------------------
------------------------------------------------------------------------------
Delete 1.5k routes OK
------------------------------------------------------------------------------
所有分析要看 Makefile文件
其实执行测试的是这条
@bash -c "source $(PYTHON_VENV_PATH)/bin/activate && python run_tests.py -d $(TEST_DIR) $(UNITTEST_EXTRA_OPTS)"
构建了python的虚拟环境,然后执行 run_test 指定目录也就是 test目录。
期间遇到了很多很多的问题,比如里面的变量很多都是系统变量。开始自己设置各种问题。使用 make retest和 make test-shell可以不用设置。 对Makefile文件也不熟悉,要学习的还很多啊。
之后会具体分析测试框架