mirror of
https://github.com/kata-containers/kata-containers.git
synced 2025-06-27 15:57:09 +00:00
runtime: fix make check
Need to use the correct script path. Fixes: #802 Signed-off-by: Peng Tao <bergwolf@hyper.sh>
This commit is contained in:
parent
07caa2f2ec
commit
eaa5c43357
30
ci/go-no-os-exit.sh
Executable file
30
ci/go-no-os-exit.sh
Executable file
@ -0,0 +1,30 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
# Copyright (c) 2018 Intel Corporation
|
||||||
|
#
|
||||||
|
# SPDX-License-Identifier: Apache-2.0
|
||||||
|
#
|
||||||
|
# Check there are no os.Exit() calls creeping into the code
|
||||||
|
# We don't use that exit path in the Kata codebase.
|
||||||
|
|
||||||
|
# Allow the path to check to be over-ridden.
|
||||||
|
# Default to the current directory.
|
||||||
|
go_packages=${1:-.}
|
||||||
|
|
||||||
|
echo "Checking for no os.Exit() calls for package [${go_packages}]"
|
||||||
|
|
||||||
|
candidates=`go list -f '{{.Dir}}/*.go' $go_packages`
|
||||||
|
for f in $candidates; do
|
||||||
|
filename=`basename $f`
|
||||||
|
# skip all go test files
|
||||||
|
[[ $filename == *_test.go ]] && continue
|
||||||
|
# skip exit.go where, the only file we should call os.Exit() from.
|
||||||
|
[[ $filename == "exit.go" ]] && continue
|
||||||
|
files="$f $files"
|
||||||
|
done
|
||||||
|
|
||||||
|
[ -z "$files" ] && echo "No files to check, skipping" && exit 0
|
||||||
|
|
||||||
|
if egrep -n '\<os\.Exit\>' $files; then
|
||||||
|
echo "Direct calls to os.Exit() are forbidden, please use exit() so atexit() works"
|
||||||
|
exit 1
|
||||||
|
fi
|
@ -582,7 +582,6 @@ $(MONITOR_OUTPUT): $(SOURCES) $(GENERATED_FILES) $(MAKEFILE_LIST)
|
|||||||
.PHONY: \
|
.PHONY: \
|
||||||
check \
|
check \
|
||||||
check-go-static \
|
check-go-static \
|
||||||
check-go-test \
|
|
||||||
coverage \
|
coverage \
|
||||||
default \
|
default \
|
||||||
install \
|
install \
|
||||||
@ -688,9 +687,9 @@ go-test: $(GENERATED_FILES)
|
|||||||
go test -v -mod=vendor ./...
|
go test -v -mod=vendor ./...
|
||||||
|
|
||||||
check-go-static:
|
check-go-static:
|
||||||
$(QUIET_CHECK).ci/static-checks.sh
|
$(QUIET_CHECK)../../ci/static-checks.sh
|
||||||
$(QUIET_CHECK).ci/go-no-os-exit.sh ./cli
|
$(QUIET_CHECK)../../ci/go-no-os-exit.sh ./cli
|
||||||
$(QUIET_CHECK).ci/go-no-os-exit.sh ./virtcontainers
|
$(QUIET_CHECK)../../ci/go-no-os-exit.sh ./virtcontainers
|
||||||
|
|
||||||
coverage:
|
coverage:
|
||||||
go test -v -mod=vendor -covermode=atomic -coverprofile=coverage.txt ./...
|
go test -v -mod=vendor -covermode=atomic -coverprofile=coverage.txt ./...
|
||||||
|
Loading…
Reference in New Issue
Block a user