Merge "jiri-profile-v23: Enable go 1.6 and..."
diff --git a/jiri-test/internal/test/common.go b/jiri-test/internal/test/common.go
index dbabd8f..13ad764 100644
--- a/jiri-test/internal/test/common.go
+++ b/jiri-test/internal/test/common.go
@@ -81,16 +81,16 @@
// initTest carries out the initial actions for the given test.
func initTest(jirix *jiri.X, testName string, profileNames []string, opts ...initTestOpt) (func() error, error) {
- return initTestImpl(jirix, false, true, testName, profileNames, "", opts...)
+ return initTestImpl(jirix, false, true, true, testName, profileNames, "", opts...)
}
// initTestForTarget carries out the initial actions for the given test using
// a specific profile Target..
func initTestForTarget(jirix *jiri.X, testName string, profileNames []string, target string, opts ...initTestOpt) (func() error, error) {
- return initTestImpl(jirix, false, true, testName, profileNames, target, opts...)
+ return initTestImpl(jirix, false, true, true, testName, profileNames, target, opts...)
}
-func initTestImpl(jirix *jiri.X, needCleanup, printProfiles bool, testName string, profileNames []string, target string, opts ...initTestOpt) (func() error, error) {
+func initTestImpl(jirix *jiri.X, needCleanup, updateProfiles, printProfiles bool, testName string, profileNames []string, target string, opts ...initTestOpt) (func() error, error) {
// Output the hostname.
hostname, err := os.Hostname()
if err != nil {
@@ -126,37 +126,38 @@
return nil, err
}
- if needCleanup {
- if err := cleanupProfiles(jirix); err != nil {
- return nil, newInternalError(err, "Init")
+ if updateProfiles {
+ insertTarget := func(profile string) []string {
+ if len(target) > 0 {
+ return []string{"--target=" + target, profile}
+ }
+ return []string{profile}
}
- }
-
- insertTarget := func(profile string) []string {
- if len(target) > 0 {
- return []string{"--target=" + target, profile}
+ if needCleanup {
+ if err := cleanupProfiles(jirix); err != nil {
+ return nil, newInternalError(err, "Init")
+ }
}
- return []string{profile}
- }
-
- // Install profiles.
- args := []string{"-v", "profile-v23", "install"}
- for _, profile := range profileNames {
- clargs := append(args, insertTarget(profile)...)
- fmt.Fprintf(jirix.Stdout(), "Running: jiri %s\n", strings.Join(clargs, " "))
- if err := s.Last("jiri", clargs...); err != nil {
- return nil, fmt.Errorf("jiri %v: %v", strings.Join(clargs, " "), err)
+ // Install profiles.
+ args := []string{"-v", "profile-v23", "install"}
+ for _, profile := range profileNames {
+ clargs := append(args, insertTarget(profile)...)
+ fmt.Fprintf(jirix.Stdout(), "Running: jiri %s\n", strings.Join(clargs, " "))
+ if err := s.Last("jiri", clargs...); err != nil {
+ return nil, fmt.Errorf("jiri %v: %v", strings.Join(clargs, " "), err)
+ }
+ fmt.Fprintf(jirix.Stdout(), "jiri %v: success\n", strings.Join(clargs, " "))
}
- fmt.Fprintf(jirix.Stdout(), "jiri %v: success\n", strings.Join(clargs, " "))
+
+ // Update profiles.
+ args = []string{"profile", "update"}
+
+ if err := s.Capture(os.Stdout, os.Stderr).Last("jiri", args...); err != nil {
+ return nil, fmt.Errorf("jiri %v: %v", strings.Join(args, " "), err)
+ }
+ fmt.Fprintf(jirix.Stdout(), "jiri %v: success\n", strings.Join(args, " "))
}
- // Update profiles.
- args = []string{"profile", "update"}
-
- if err := s.Capture(os.Stdout, os.Stderr).Last("jiri", args...); err != nil {
- return nil, fmt.Errorf("jiri %v: %v", strings.Join(args, " "), err)
- }
- fmt.Fprintf(jirix.Stdout(), "jiri %v: success\n", strings.Join(args, " "))
if printProfiles {
displayProfiles(jirix, "initTest:")
}
diff --git a/jiri-test/internal/test/go_test.go b/jiri-test/internal/test/go_test.go
index 0ac7e2d..158f3ca 100644
--- a/jiri-test/internal/test/go_test.go
+++ b/jiri-test/internal/test/go_test.go
@@ -383,7 +383,7 @@
defer cleanupFake()
testName := "test-go-build"
- cleanupTest, err := initTestImpl(fake.X, false, false, testName, nil, "")
+ cleanupTest, err := initTestImpl(fake.X, false, false, false, testName, nil, "")
if err != nil {
t.Fatalf("%v", err)
}
@@ -439,7 +439,7 @@
func TestGoCoverage(t *testing.T) {
jirix := newJiriXWithRealRoot(t)
testName, pkgName := "test-go-coverage", "v.io/x/devtools/jiri-test/internal/test/testdata/foo"
- cleanupTest, err := initTestImpl(jirix, false, false, testName, nil, "")
+ cleanupTest, err := initTestImpl(jirix, false, false, false, testName, nil, "")
if err != nil {
t.Fatalf("%v", err)
}
@@ -543,7 +543,7 @@
jirix := newJiriXWithRealRoot(t)
testName, pkgName := "test-go-test", "v.io/x/devtools/jiri-test/internal/test/testdata/"+subPkg
- cleanupTest, err := initTestImpl(jirix, false, false, testName, []string{"v23:base"}, "")
+ cleanupTest, err := initTestImpl(jirix, false, false, false, testName, nil, "")
if err != nil {
t.Fatalf("%v", err)
}
diff --git a/jiri-test/internal/test/postsubmit.go b/jiri-test/internal/test/postsubmit.go
index 99395f2..49b2394 100644
--- a/jiri-test/internal/test/postsubmit.go
+++ b/jiri-test/internal/test/postsubmit.go
@@ -14,7 +14,7 @@
// and starts the corresponding Jenkins targets based on the changes.
func vanadiumPostsubmitPoll(jirix *jiri.X, testName string, _ ...Opt) (_ *test.Result, e error) {
// Initialize the test.
- cleanup, err := initTestImpl(jirix, false, false, testName, []string{"v23:base"}, "")
+ cleanup, err := initTestImpl(jirix, false, true, false, testName, []string{"v23:base"}, "")
if err != nil {
return nil, newInternalError(err, "Init")
}
diff --git a/jiri-test/internal/test/presubmit.go b/jiri-test/internal/test/presubmit.go
index d8f027b..5072d33 100644
--- a/jiri-test/internal/test/presubmit.go
+++ b/jiri-test/internal/test/presubmit.go
@@ -33,7 +33,7 @@
// which to run presubmit tests.
func vanadiumPresubmitPoll(jirix *jiri.X, testName string, _ ...Opt) (_ *test.Result, e error) {
// Initialize the test.
- cleanup, err := initTestImpl(jirix, false, false, testName, nil, "")
+ cleanup, err := initTestImpl(jirix, false, false, false, testName, nil, "")
if err != nil {
return nil, newInternalError(err, "Init")
}
@@ -69,7 +69,7 @@
}
// Initialize the test.
- cleanup, err := initTestImpl(jirix, false, false, testName, nil, "")
+ cleanup, err := initTestImpl(jirix, false, false, false, testName, nil, "")
if err != nil {
return nil, newInternalError(err, "Init")
}