TBR: Revert "jiri-swift: Enable tests"

This reverts commit b3596ced8d47c69ff23efa6d768e083aae766396.

This is causing the same issues we saw before, with compilations stomping on eachother.

https://veyron.corp.google.com/jenkins/job/vanadium-presubmit-test/ARCH=amd64,OS=darwin,TEST=vanadium-go-test/24496/console

Change-Id: I420a62dddc15b939d2c327c9576dc692f6e21bf0
diff --git a/jiri-swift/build_test.go b/jiri-swift/build_test.go
index ae427aa..5b83dbc 100644
--- a/jiri-swift/build_test.go
+++ b/jiri-swift/build_test.go
@@ -2,7 +2,7 @@
 // Use of this source code is governed by a BSD-style
 // license that can be found in the LICENSE file.
 
-// +build darwin,amd64
+// +build darwin,disabled
 
 package main
 
@@ -191,7 +191,19 @@
 	}
 }
 
-func TestAllCgoBuildForArmFails(t *testing.T) {
+func TestCgoBuildForSimulator64(t *testing.T) {
+	for _, p := range projects {
+		jirix := initForTest(t)
+		if err := testCgoBuildForArch(jirix, p, targetArchAmd64, buildModeArchive); err != nil {
+			t.Error(err)
+		}
+		if err := testCgoBuildForArch(jirix, p, targetArchAmd64, buildModeShared); err != nil {
+			t.Error(err)
+		}
+	}
+}
+
+func TestCgoBuildForArm(t *testing.T) {
 	for _, p := range projects {
 		jirix := initForTest(t)
 		// Expect error for ARM currently as of Go 1.5
@@ -201,34 +213,25 @@
 	}
 }
 
-func TestVanadiumCoreCgoBuildForArm64(t *testing.T) {
-	jirix := initForTest(t)
-	if err := testCgoBuildForArch(jirix, projectVanadiumCore, targetArchArm64, buildModeArchive); err != nil {
-		t.Error(err)
+func TestCgoBuildForArm64(t *testing.T) {
+	for _, p := range projects {
+		jirix := initForTest(t)
+		if err := testCgoBuildForArch(jirix, p, targetArchArm64, buildModeArchive); err != nil {
+			t.Error(err)
+		}
 	}
-	// Currently disabled as we're not using shared libraries and the unit test can take a while.
-	// Turn back on if we move to shared libraries to get around bitcode restrictions.
-	//if err := testCgoBuildForArch(jirix, projectVanadiumCore, targetArchArm64, buildModeShared); err != nil {
-	//	t.Error(err)
-	//}
 }
 
-// We don't test amd64 as that gets tested in the universal builds below (which also tests the arm64 build but
-// doesn't inspect the results as closely).
-
-func TestSyncbaseCoreCgoBuildForArm64(t *testing.T) {
-	jirix := initForTest(t)
-	if err := testCgoBuildForArch(jirix, projectSyncbaseCore, targetArchArm64, buildModeArchive); err != nil {
-		t.Error(err)
+func TestCgoBuildForAll(t *testing.T) {
+	for _, p := range projects {
+		jirix := initForTest(t)
+		if err := testCgoBuildForArch(jirix, p, targetArchAll, buildModeArchive); err != nil {
+			t.Error(err)
+		}
 	}
-	// Currently disabled as we're not using shared libraries and the unit test can take a while.
-	// Turn back on if we move to shared libraries to get around bitcode restrictions.
-	//if err := testCgoBuildForArch(jirix, projectSyncbaseCore, targetArchArm64, buildModeShared); err != nil {
-	//	t.Error(err)
-	//}
 }
 
-func testCgoBuildForArch(jirix *jiri.X, p *project, arch string, buildMode string) error {
+func testCgoBuildForArch(jirix *jiri.X, p project, arch string, buildMode string) error {
 	resetVars()
 	buildCgo = true
 	flagBuildMode = buildMode
@@ -375,48 +378,42 @@
 	return nil
 }
 
-func TestVanadiumCoreUniversalFrameworkBuilds(t *testing.T) {
-	testUniversalFrameworkBuild(t, projectVanadiumCore)
-}
-
-func TestSyncbaseCoreUniversalFrameworkBuilds(t *testing.T) {
-	testUniversalFrameworkBuild(t, projectSyncbaseCore)
-}
-
-func testUniversalFrameworkBuild(t *testing.T, p *project) {
-	jirix := initForTest(t)
-	flagTargetArch = targetArchAll
-	flagProject = p.name
-	if err := parseProjectFlag(); err != nil {
-		t.Error(err)
-		return
-	}
-	if err := parseBuildFlags(); err != nil {
-		t.Error(err)
-		return
-	}
-	// Make sure VanadiumCore exports exist
-	if err := runBuildCgo(jirix); err != nil {
-		t.Error(err)
-		return
-	}
-	if err := runBuildFramework(jirix); err != nil {
-		t.Error(err)
-		return
-	}
-	binaryPath := filepath.Join(flagOutDirSwift, selectedProject.frameworkName, selectedProject.frameworkBinaryName)
-	if err := verifyCgoBinaryForIOS(binaryPath); err != nil {
-		t.Error(err)
-		return
-	}
-	for _, targetArch := range targetArchs {
-		appleArch, _ := appleArchFromGoArch(targetArch)
-		sh.Cmd("lipo", binaryPath, "-verify_arch", appleArch).Run()
-		if !pathExists(filepath.Join(flagOutDirSwift, selectedProject.frameworkName, "Modules", selectedProject.frameworkBinaryName+".swiftmodule", appleArch+".swiftdoc")) {
-			t.Errorf("Missing swift moduledoc for architecture %v", targetArch)
+func TestUniversalFrameworkBuilds(t *testing.T) {
+	for _, p := range projects {
+		jirix := initForTest(t)
+		flagTargetArch = targetArchAll
+		flagProject = p.name
+		if err := parseProjectFlag(); err != nil {
+			t.Error(err)
+			return
 		}
-		if !pathExists(filepath.Join(flagOutDirSwift, selectedProject.frameworkName, "Modules", selectedProject.frameworkBinaryName+".swiftmodule", appleArch+".swiftmodule")) {
-			t.Errorf("Missing swift module for architecture %v", targetArch)
+		if err := parseBuildFlags(); err != nil {
+			t.Error(err)
+			return
+		}
+		// Make sure VanadiumCore exports exist
+		if err := runBuildCgo(jirix); err != nil {
+			t.Error(err)
+			return
+		}
+		if err := runBuildFramework(jirix); err != nil {
+			t.Error(err)
+			return
+		}
+		binaryPath := filepath.Join(flagOutDirSwift, selectedProject.frameworkName, selectedProject.frameworkBinaryName)
+		if err := verifyCgoBinaryForIOS(binaryPath); err != nil {
+			t.Error(err)
+			return
+		}
+		for _, targetArch := range targetArchs {
+			appleArch, _ := appleArchFromGoArch(targetArch)
+			sh.Cmd("lipo", binaryPath, "-verify_arch", appleArch).Run()
+			if !pathExists(filepath.Join(flagOutDirSwift, selectedProject.frameworkName, "Modules", selectedProject.frameworkBinaryName+".swiftmodule", appleArch+".swiftdoc")) {
+				t.Errorf("Missing swift moduledoc for architecture %v", targetArch)
+			}
+			if !pathExists(filepath.Join(flagOutDirSwift, selectedProject.frameworkName, "Modules", selectedProject.frameworkBinaryName+".swiftmodule", appleArch+".swiftmodule")) {
+				t.Errorf("Missing swift module for architecture %v", targetArch)
+			}
 		}
 	}
 }
diff --git a/jiri-swift/swift.go b/jiri-swift/swift.go
index 6d9d865..4f79b59 100644
--- a/jiri-swift/swift.go
+++ b/jiri-swift/swift.go
@@ -33,34 +33,35 @@
 
 	targetArchs []string
 
-	selectedProject     *project
-	projectSyncbaseCore = &project{
-		name:                       "SyncbaseCore",
-		commonHeaderPath:           "release/go/src/v.io/x/ref/services/syncbase/bridge/cgo/lib.h",
-		description:                "Core bindings from Swift to Syncbase; incompatible with VanadiumCore",
-		directoryName:              "SyncbaseCore",
-		exportedHeadersPackageRoot: "v.io/x",
-		frameworkName:              "SyncbaseCore.framework",
-		frameworkBinaryName:        "SyncbaseCore",
-		libraryBinaryName:          "sbcore",
-		mainPackage:                "v.io/x/ref/services/syncbase/bridge/cgo",
-		testCheckExportedSymbols:   []string{"v23_syncbase_Init", "v23_syncbase_DbLeaveSyncgroup", "v23_syncbase_RowDelete"},
-		testCheckSharedTypes:       []string{"v23_syncbase_String", "v23_syncbase_Bytes", "v23_syncbase_Strings", "v23_syncbase_VError"},
+	selectedProject *project
+	projects        = []project{
+		{
+			name:                       "VanadiumCore",
+			commonHeaderPath:           "release/go/src/v.io/x/swift/types.h",
+			description:                "Core bindings from Swift to Vanadium; incompatible with SyncbaseCore",
+			directoryName:              "VanadiumCore",
+			exportedHeadersPackageRoot: "v.io/x",
+			frameworkName:              "VanadiumCore.framework",
+			frameworkBinaryName:        "VanadiumCore",
+			libraryBinaryName:          "v23",
+			mainPackage:                "v.io/x/swift/main",
+			testCheckExportedSymbols:   []string{"swift_io_v_v23_V_nativeInitGlobal", "swift_io_v_v23_context_VContext_nativeWithCancel"},
+			testCheckSharedTypes:       []string{"SwiftByteArray", "SwiftByteArrayArray", "GoContextHandle"},
+		},
+		{
+			name:                       "SyncbaseCore",
+			commonHeaderPath:           "release/go/src/v.io/x/ref/services/syncbase/bridge/cgo/lib.h",
+			description:                "Core bindings from Swift to Syncbase; incompatible with VanadiumCore",
+			directoryName:              "SyncbaseCore",
+			exportedHeadersPackageRoot: "v.io/x",
+			frameworkName:              "SyncbaseCore.framework",
+			frameworkBinaryName:        "SyncbaseCore",
+			libraryBinaryName:          "sbcore",
+			mainPackage:                "v.io/x/ref/services/syncbase/bridge/cgo",
+			testCheckExportedSymbols:   []string{"v23_syncbase_Init", "v23_syncbase_DbLeaveSyncgroup", "v23_syncbase_RowDelete"},
+			testCheckSharedTypes:       []string{"v23_syncbase_String", "v23_syncbase_Bytes", "v23_syncbase_Strings", "v23_syncbase_VError"},
+		},
 	}
-	projectVanadiumCore = &project{
-		name:                       "VanadiumCore",
-		commonHeaderPath:           "release/go/src/v.io/x/swift/types.h",
-		description:                "Core bindings from Swift to Vanadium; incompatible with SyncbaseCore",
-		directoryName:              "VanadiumCore",
-		exportedHeadersPackageRoot: "v.io/x",
-		frameworkName:              "VanadiumCore.framework",
-		frameworkBinaryName:        "VanadiumCore",
-		libraryBinaryName:          "v23",
-		mainPackage:                "v.io/x/swift/main",
-		testCheckExportedSymbols:   []string{"swift_io_v_v23_V_nativeInitGlobal", "swift_io_v_v23_context_VContext_nativeWithCancel"},
-		testCheckSharedTypes:       []string{"SwiftByteArray", "SwiftByteArrayArray", "GoContextHandle"},
-	}
-	projects = []*project{projectVanadiumCore, projectSyncbaseCore}
 )
 
 type project struct {
@@ -152,7 +153,7 @@
 func parseProjectFlag() error {
 	for _, p := range projects {
 		if strings.ToLower(flagProject) == strings.ToLower(p.name) {
-			selectedProject = p
+			selectedProject = &p
 			return nil
 		}
 	}