hs-test: added cleanup target
- Also added checkstyle-go and fixstyle-go to 'make help' Type: make Change-Id: I5402efa02bbbc54a20db8f54b0488c58a62ffaa1 Signed-off-by: Adrian Villin <avillin@cisco.com>
This commit is contained in:

committed by
Dave Wallace

parent
82ad9660be
commit
7d1e4a4ddb
1
.gitignore
vendored
1
.gitignore
vendored
@ -124,6 +124,7 @@ compile_commands.json
|
||||
/extras/hs-test/http_server
|
||||
/extras/hs-test/.build.ok
|
||||
/extras/hs-test/.build.cov.ok
|
||||
/extras/hs-test/.last_hst_ppid
|
||||
/extras/hs-test/summary/
|
||||
|
||||
# ./configure
|
||||
|
9
Makefile
9
Makefile
@ -271,8 +271,10 @@ help:
|
||||
@echo " checkstyle-commit - check commit message format"
|
||||
@echo " checkstyle-python - check python coding style using 'black' formatter"
|
||||
@echo " checkstyle-api - check api for incompatible changes"
|
||||
@echo " checkstyle-go - check style of .go source files"
|
||||
@echo " fixstyle - fix coding style"
|
||||
@echo " fixstyle-python - fix python coding style using 'black' formatter"
|
||||
@echo " fixstyle-go - format .go source files"
|
||||
@echo " doxygen - DEPRECATED - use 'make docs'"
|
||||
@echo " bootstrap-doxygen - DEPRECATED"
|
||||
@echo " wipe-doxygen - DEPRECATED"
|
||||
@ -281,6 +283,7 @@ help:
|
||||
@echo " json-api-files - (re)-generate json api files"
|
||||
@echo " json-api-files-debug - (re)-generate json api files for debug target"
|
||||
@echo " go-api-files - (re)-generate golang api files"
|
||||
@echo " cleanup-hst - stops and removes all docker contaiers and namespaces"
|
||||
@echo " docs - Build the Sphinx documentation"
|
||||
@echo " docs-venv - Build the virtual environment for the Sphinx docs"
|
||||
@echo " docs-clean - Remove the generated files from the Sphinx docs"
|
||||
@ -740,6 +743,10 @@ json-api-files-debug:
|
||||
go-api-files: json-api-files
|
||||
$(WS_ROOT)/src/tools/vppapigen/generate_go.py $(ARGS)
|
||||
|
||||
.PHONY: cleanup-hst
|
||||
cleanup-hst:
|
||||
$(MAKE) -C extras/hs-test cleanup-hst
|
||||
|
||||
.PHONY: ctags
|
||||
ctags: ctags.files
|
||||
@ctags --totals --tag-relative=yes -L $<
|
||||
@ -786,7 +793,7 @@ fixstyle-go:
|
||||
@$(MAKE) -C extras/hs-test fixstyle-go
|
||||
|
||||
.PHONY: checkstyle-all
|
||||
checkstyle-all: checkstyle-commit checkstyle checkstyle-python docs-spell
|
||||
checkstyle-all: checkstyle-commit checkstyle checkstyle-python docs-spell checkstyle-go
|
||||
|
||||
.PHONY: fixstyle
|
||||
fixstyle:
|
||||
|
@ -67,6 +67,7 @@ help:
|
||||
@echo " build-go - just build golang files"
|
||||
@echo " checkstyle-go - check style of .go source files"
|
||||
@echo " fixstyle-go - format .go source files"
|
||||
@echo " cleanup-hst - stops and removes all docker contaiers and namespaces"
|
||||
@echo " list-tests - list all tests"
|
||||
@echo
|
||||
@echo "make build arguments:"
|
||||
@ -114,25 +115,25 @@ build-vpp-gcov:
|
||||
|
||||
.PHONY: test
|
||||
test: .deps.ok .build.ok
|
||||
# '-' ignores the exit status, it is set in compress.sh
|
||||
# necessary so gmake won't skip executing the bash script
|
||||
-bash ./test --persist=$(PERSIST) --verbose=$(VERBOSE) \
|
||||
@# '-' ignores the exit status, it is set in compress.sh
|
||||
@# necessary so gmake won't skip executing the bash script
|
||||
@-bash ./test --persist=$(PERSIST) --verbose=$(VERBOSE) \
|
||||
--unconfigure=$(UNCONFIGURE) --debug=$(DEBUG) --test=$(TEST) --cpus=$(CPUS) \
|
||||
--vppsrc=$(VPPSRC) --parallel=$(PARALLEL) --repeat=$(REPEAT)
|
||||
@bash ./script/compress.sh
|
||||
|
||||
.PHONY: test-debug
|
||||
test-debug: .deps.ok .build_debug.ok
|
||||
# '-' ignores the exit status, it is set in compress.sh
|
||||
# necessary so gmake won't skip executing the bash script
|
||||
-bash ./test --persist=$(PERSIST) --verbose=$(VERBOSE) \
|
||||
@# '-' ignores the exit status, it is set in compress.sh
|
||||
@# necessary so gmake won't skip executing the bash script
|
||||
@-bash ./test --persist=$(PERSIST) --verbose=$(VERBOSE) \
|
||||
--unconfigure=$(UNCONFIGURE) --debug=$(DEBUG) --test=$(TEST) --cpus=$(CPUS) \
|
||||
--vppsrc=$(VPPSRC) --parallel=$(PARALLEL) --repeat=$(REPEAT)
|
||||
@bash ./script/compress.sh
|
||||
|
||||
.PHONY: test-cov
|
||||
test-cov: .deps.ok .build.cov.ok
|
||||
-bash ./test --persist=$(PERSIST) --verbose=$(VERBOSE) \
|
||||
@-bash ./test --persist=$(PERSIST) --verbose=$(VERBOSE) \
|
||||
--unconfigure=$(UNCONFIGURE) --debug=$(DEBUG) --test=$(TEST-HS) --cpus=$(CPUS) \
|
||||
--vppsrc=$(VPPSRC)
|
||||
@$(MAKE) -C ../.. test-cov-post HS_TEST=1
|
||||
@ -200,3 +201,26 @@ fixstyle-go:
|
||||
@echo "*******************************************************************"
|
||||
@echo "Fixstyle done."
|
||||
@echo "*******************************************************************"
|
||||
|
||||
.PHONY: cleanup-hst
|
||||
cleanup-hst:
|
||||
@if [ ! -f ".last_hst_ppid" ]; then \
|
||||
echo "'.last_hst_ppid' file does not exist."; \
|
||||
exit 1; \
|
||||
fi
|
||||
@echo "****************************"
|
||||
@echo "Removing docker containers:"
|
||||
@# "-" ignores errors
|
||||
@-sudo docker rm $$(sudo docker stop $$(sudo docker ps -a -q --filter "name=$$(cat .last_hst_ppid)") -t 0)
|
||||
@echo "****************************"
|
||||
@echo "Removing IP address files:"
|
||||
@find . -type f -regextype egrep -regex '.*[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+' -exec sudo rm -v {} \;
|
||||
@echo "****************************"
|
||||
@echo "Removing network namespaces:"
|
||||
@for ns in $$(ip netns list | grep $$(cat .last_hst_ppid) | awk '{print $$1}'); do \
|
||||
echo $$ns; \
|
||||
sudo ip netns delete $$ns; \
|
||||
done
|
||||
@echo "****************************"
|
||||
@echo "Done."
|
||||
@echo "****************************"
|
||||
|
@ -1,6 +1,8 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"runtime"
|
||||
"testing"
|
||||
@ -24,6 +26,14 @@ func TestHst(t *testing.T) {
|
||||
} else {
|
||||
suiteTimeout = time.Minute * 5
|
||||
}
|
||||
|
||||
// creates a file with PPID, used for 'make cleanup-hst'
|
||||
ppid := fmt.Sprint(os.Getppid())
|
||||
ppid = ppid[:len(ppid)-1]
|
||||
f, _ := os.Create(".last_hst_ppid")
|
||||
f.Write([]byte(ppid))
|
||||
f.Close()
|
||||
|
||||
RegisterFailHandler(Fail)
|
||||
RunSpecs(t, "HST")
|
||||
}
|
||||
|
Reference in New Issue
Block a user