From ee68dda86348f8de5e31f5b453073f7442736bda Mon Sep 17 00:00:00 2001 From: Pete Moore Date: Wed, 29 Nov 2017 18:48:35 +0100 Subject: [PATCH] tweaks --- .gitignore | 5 +++-- build.cmd | 5 ++++- main_test.go | 4 ++-- 3 files changed, 9 insertions(+), 5 deletions(-) diff --git a/.gitignore b/.gitignore index 0613c69b..aa3656cf 100644 --- a/.gitignore +++ b/.gitignore @@ -46,5 +46,6 @@ generic-worker.config directory-caches.json file-caches.json tasks-resolved-count.txt -coverage.tmp -coverage.report +/coverage.tmp +/coverage.report +/revision.txt diff --git a/build.cmd b/build.cmd index db917195..5e449666 100644 --- a/build.cmd +++ b/build.cmd @@ -19,6 +19,9 @@ set /P lines=<..\tmp1.txt :: this checks that if more than 0 lines are returned, we fail if %lines% gtr 0 exit /b 64 +git rev-parse HEAD > revision.txt +set /p REVISION=< revision.txt +del revision.txt set GORACE=history_size=7 -go test -v ./... || exit /b %ERRORLEVEL% +go test -ldflags "-X github.com/taskcluster/generic-worker.revision=%REVISION%" ./... || exit /b %ERRORLEVEL% ineffassign . || exit /b %ERRORLEVEL% diff --git a/main_test.go b/main_test.go index e60e7246..9a7f0b09 100644 --- a/main_test.go +++ b/main_test.go @@ -78,8 +78,8 @@ func TestIdleWithoutCrash(t *testing.T) { func TestRevisionNumberStored(t *testing.T) { if !regexp.MustCompile("^[0-9a-f]{40}$").MatchString(revision) { t.Fatalf("Git revision could not be determined - got '%v' but expected to match regular expression '^[0-9a-f](40)$'\n"+ - "Did you specify `-ldflags \"-X main.revision=\"` in your go build/install/get command?\n"+ - "Try using build.sh / build.cmd in root directory of generic-worker source code repository", revision) + "Did you specify `-ldflags \"-X github.com/taskcluster/generic-worker.revision=\"` in your go test command?\n"+ + "Try using build.sh / build.cmd in root directory of generic-worker source code repository.", revision) } t.Logf("Git revision successfully retrieved: %v", revision) }