+libexpand = $(subst $(subst ,, ),:,$(foreach lib,$(1),$(BR)/install-$(2)-native/vpp/$(lib)/$(3)))
+
+export TEST_DIR ?= $(WS_ROOT)/test
+export RND_SEED ?= $(shell python3 -c 'import time; print(time.time())')
+
+define test
+ $(if $(filter-out $(3),retest),make -C $(BR) PLATFORM=$(1) TAG=$(2) vpp-install,)
+ $(eval libs:=lib lib64)
+ make -C test \
+ VPP_BUILD_DIR=$(BR)/build-$(2)-native \
+ VPP_BIN=$(BR)/install-$(2)-native/vpp/bin/vpp \
+ VPP_PLUGIN_PATH=$(call libexpand,$(libs),$(2),vpp_plugins) \
+ VPP_TEST_PLUGIN_PATH=$(call libexpand,$(libs),$(2),vpp_api_test_plugins) \
+ VPP_INSTALL_PATH=$(BR)/install-$(2)-native/ \
+ LD_LIBRARY_PATH=$(call libexpand,$(libs),$(2),) \
+ EXTENDED_TESTS=$(EXTENDED_TESTS) \
+ PYTHON=$(PYTHON) \
+ OS_ID=$(OS_ID) \
+ RND_SEED=$(RND_SEED) \
+ CACHE_OUTPUT=$(CACHE_OUTPUT) \
+ $(3)
+endef
+
+.PHONY: test
+test:
+ $(call test,vpp,vpp,test)
+
+.PHONY: test-debug
+test-debug:
+ $(call test,vpp,vpp_debug,test)
+
+.PHONY: test-gcov
+test-gcov:
+ $(call test,vpp,vpp_gcov,test)
+
+.PHONY: test-all
+test-all:
+ $(if $(filter-out $(3),retest),make -C $(BR) PLATFORM=vpp TAG=vpp vom-install,)
+ $(eval EXTENDED_TESTS=yes)
+ $(call test,vpp,vpp,test)
+
+.PHONY: test-all-debug
+test-all-debug:
+ $(if $(filter-out $(3),retest),make -C $(BR) PLATFORM=vpp TAG=vpp_debug vom-install,)
+ $(eval EXTENDED_TESTS=yes)
+ $(call test,vpp,vpp_debug,test)
+
+.PHONY: papi-wipe
+papi-wipe: test-wipe-papi
+ $(call banner,"This command is deprecated. Please use 'test-wipe-papi'")
+
+.PHONY: test-wipe-papi
+test-wipe-papi:
+ @make -C test papi-wipe
+
+.PHONY: test-help
+test-help:
+ @make -C test help
+
+.PHONY: test-wipe
+test-wipe:
+ @make -C test wipe
+
+.PHONY: test-shell
+test-shell:
+ $(call test,vpp,vpp,shell)
+
+.PHONY: test-shell-debug
+test-shell-debug:
+ $(call test,vpp,vpp_debug,shell)
+
+.PHONY: test-shell-gcov
+test-shell-gcov:
+ $(call test,vpp,vpp_gcov,shell)
+
+.PHONY: test-dep
+test-dep:
+ @make -C test test-dep
+
+.PHONY: test-doc
+test-doc:
+ @make -C test doc
+
+.PHONY: test-wipe-doc
+test-wipe-doc:
+ @make -C test wipe-doc
+
+.PHONY: test-cov
+test-cov:
+ @make -C $(BR) PLATFORM=vpp TAG=vpp_gcov vom-install
+ $(eval EXTENDED_TESTS=yes)
+ $(call test,vpp,vpp_gcov,cov)
+
+.PHONY: test-wipe-cov
+test-wipe-cov:
+ @make -C test wipe-cov
+
+.PHONY: test-wipe-all
+test-wipe-all:
+ @make -C test wipe-all
+
+.PHONY: test-checkstyle
+test-checkstyle:
+ @make -C test checkstyle
+
+.PHONY: test-refresh-deps
+test-refresh-deps:
+ @make -C test refresh-deps
+
+.PHONY: retest
+retest:
+ $(call test,vpp,vpp,retest)
+
+.PHONY: retest-debug
+retest-debug:
+ $(call test,vpp,vpp_debug,retest)
+
+.PHONY: retest-all
+retest-all:
+ $(eval EXTENDED_TESTS=yes)
+ $(call test,vpp,vpp,retest)
+
+.PHONY: retest-all-debug
+retest-all-debug:
+ $(eval EXTENDED_TESTS=yes)
+ $(call test,vpp,vpp_debug,retest)
+