Commit 4d86b01f authored by Jacob Vosmaer (GitLab)'s avatar Jacob Vosmaer (GitLab)

Merge branch 'go-toolchain-support' into 'master'

Improve support for standard Go tools



See merge request !55
parents f184885d 858140d5
......@@ -25,12 +25,12 @@ _build:
touch $@
.PHONY: test
test: testdata/data/group/test.git clean-build clean-workhorse all
test: clean-build clean-workhorse all
go fmt ${PKG}/... | awk '{ print } END { if (NR > 0) { print "Please run go fmt"; exit 1 } }'
support/path go test ${PKG}/...
_support/path go test ${PKG}/...
@echo SUCCESS
coverage: testdata/data/group/test.git
coverage:
go test -cover -coverprofile=test.coverage
go tool cover -html=test.coverage -o coverage.html
rm -f test.coverage
......@@ -38,12 +38,6 @@ coverage: testdata/data/group/test.git
fmt:
go fmt ./...
testdata/data/group/test.git: testdata/data
git clone --bare https://gitlab.com/gitlab-org/gitlab-test.git $@
testdata/data:
mkdir -p $@
.PHONY: clean
clean: clean-workhorse clean-build
rm -rf testdata/data testdata/scratch
......
......@@ -34,6 +34,22 @@ const testProject = "group/test"
var checkoutDir = path.Join(scratchDir, "test")
var cacheDir = path.Join(scratchDir, "cache")
func TestMain(m *testing.M) {
source := "https://gitlab.com/gitlab-org/gitlab-test.git"
clonePath := path.Join(testRepoRoot, testRepo)
if _, err := os.Stat(clonePath); err != nil {
testCmd := exec.Command("git", "clone", "--bare", source, clonePath)
testCmd.Stdout = os.Stdout
testCmd.Stderr = os.Stderr
if err := testCmd.Run(); err != nil {
os.Exit(-1)
}
}
os.Exit(m.Run())
}
func TestAllowedClone(t *testing.T) {
// Prepare clone directory
if err := os.RemoveAll(scratchDir); err != nil {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment