Makefile: update make go-test call

1. use ci/go-test.sh to replace the direct call to go test
2. fix data race test
3. install hook whether it is root or not

Fixes #1494

Signed-off-by: Binbin Zhang <binbin36520@gmail.com>
This commit is contained in:
Binbin Zhang 2021-08-23 16:21:14 +08:00
parent 1b28d7180f
commit 7304e52a59
3 changed files with 4 additions and 5 deletions

View File

@ -1,3 +1,4 @@
#!/bin/bash
#
# Copyright (c) 2020 Intel Corporation
#

View File

@ -602,14 +602,12 @@ test: install-hook go-test
install-hook:
make -C virtcontainers hook
ifeq ($(shell id -u), 0)
echo "installing mock hook"
make -C virtcontainers install
endif
sudo -E make -C virtcontainers install
go-test: $(GENERATED_FILES)
go clean -testcache
go test -v -mod=vendor ./...
$(QUIET_TEST)../../ci/go-test.sh
fast-test: $(GENERATED_FILES)
go clean -testcache

View File

@ -36,6 +36,7 @@ func (tty *ttyIO) close() {
if tty.Stdin != nil {
tty.Stdin.Close()
tty.Stdin = nil
}
cf := func(w io.Writer) {
if w == nil {
@ -111,7 +112,6 @@ func ioCopy(exitch, stdinCloser chan struct{}, tty *ttyIO, stdinPipe io.WriteClo
if tty.Stdin != nil {
// close stdin to make the other routine stop
tty.Stdin.Close()
tty.Stdin = nil
}
}()
}