Currently hack/test-go.sh runs in serial in independent executions of
go test. By running all tests at once, we get parallel execution.
However, we cannot use -coverprofile with this mode, which seems worthwhile.
On a 4-core mac, runs tests in 15s that ran in 80s before. Tested on F20 and
OSX Mavericks.
Fix quoting so that it works with arbitrary path names (e.g. containing
spaces.) Make hack/config-go.sh non-executable since it is meant for
sourcing and not as a standalone.
Tested:
- Checked out the tree to a directory with spaces, called the
build script from outside the tree, confirmed it worked as expected.
- Confirmed binaries work by running them with -version.
- Ran hack/build-go.sh cmd/kubecfg and confirmed only kubecfg was built.
- Ran hack/build-go.sh cmd/integration and confirmed it was built.
- Checked it out on a Mac and confirmed that the build script works.
- Confirmed that hack/test-go.sh and hack/test-cmd.sh work.
Signed-off-by: Filipe Brandenburger <filbranden@google.com>
Detect whether the tree is dirty and append a "-dirty" indication to the
git commit (common practice with other repos, e.g. kernel, docker.)
Properly handle the case where a git tree is not found (e.g. building
from archive.)
In the sed expression, look for the variable to be updated
(commitFromGit) instead of hardcoding a line number.
Tested:
- Built from a dirty tree:
$ output/go/bin/kubelet -version
Kubernetes version 0.1, build 2d784c684c75-dirty
- Built from a clean tree:
$ output/go/bin/kubelet -version
Kubernetes version 0.1, build 505f23a31172
- Built from an archive:
$ hack/build-go.sh
WARNING: unable to find git commit, falling back to commitFromGit = `(none)`
$ output/go/bin/kubelet -version
Kubernetes version 0.1, build (none)
Signed-off-by: Filipe Brandenburger <filbranden@google.com>
Tested: Passed -version argument to kubelet (and all other binaries):
$ output/go/bin/kubecfg -version
Kubernetes version 0.1, build 6454a541fd56
Signed-off-by: Filipe Brandenburger <filbranden@google.com>
In Go it's much more efficient to build several commands in the same
`go build` because the build has to load most of the dependency tree
each time. Roughly 50% on my machine:
Together (go1.2 on OS X):
real 0m4.049s
user 0m8.387s
sys 0m2.766s
Separate:
real 0m13.392s
user 0m12.420s
sys 0m6.882s
Pass arguments after the package directly to go test
hack/test-go.sh pkg/util -v -test.run=TestNewStringSet
And also allow global flags
hack/test-go.sh "" -v