Add bazel version output to test runs to make it easier to identify what version of bazel is failing.
PiperOrigin-RevId: 245951359
diff --git a/src/TulsiEndToEndTests/CanaryButtonsEndToEndTest.swift b/src/TulsiEndToEndTests/CanaryButtonsEndToEndTest.swift
index 99fe43d..19d0878 100644
--- a/src/TulsiEndToEndTests/CanaryButtonsEndToEndTest.swift
+++ b/src/TulsiEndToEndTests/CanaryButtonsEndToEndTest.swift
@@ -16,7 +16,7 @@
import XCTest
@testable import BazelIntegrationTestCase
@testable import TulsiEndToEndTestBase
-
+@testable import TulsiGenerator
// End to end test that generates the Buttons project and runs its unit tests. This variation of the
// test uses the canary Bazel binary.
@@ -25,6 +25,17 @@
override func setUp() {
super.setUp()
+ guard let canaryBazelURL = fakeBazelWorkspace.canaryBazelURL else {
+ XCTFail("Expected Bazel canary URL.")
+ return
+ }
+ XCTAssert(fileManager.fileExists(atPath: canaryBazelURL.path), "Bazel canary binary is missing.")
+
+ bazelURL = canaryBazelURL
+ let completionInfo = ProcessRunner.launchProcessSync(bazelURL.path, arguments: ["version"])
+ if let versionOutput = String(data: completionInfo.stdout, encoding: .utf8) {
+ print(versionOutput)
+ }
if (!copyDataToFakeWorkspace("third_party/tulsi/src/TulsiEndToEndTests/Resources")) {
XCTFail("Failed to copy Buttons files to fake execroot.")
@@ -32,13 +43,6 @@
}
func testButtonsWithCanaryBazel() throws {
- guard let canaryBazelURL = fakeBazelWorkspace.canaryBazelURL else {
- XCTFail("Expected Bazel canary URL.")
- return
- }
- XCTAssert(fileManager.fileExists(atPath: canaryBazelURL.path), "Bazel canary is missing.")
-
- bazelURL = canaryBazelURL
let xcodeProjectURL = generateXcodeProject(tulsiProject: buttonsProjectPath,
config: "Buttons")
XCTAssert(fileManager.fileExists(atPath: xcodeProjectURL.path), "Xcode project was not generated.")
diff --git a/src/TulsiEndToEndTests/NightlyButtonsEndToEndTest.swift b/src/TulsiEndToEndTests/NightlyButtonsEndToEndTest.swift
index b77afd0..0db6988 100644
--- a/src/TulsiEndToEndTests/NightlyButtonsEndToEndTest.swift
+++ b/src/TulsiEndToEndTests/NightlyButtonsEndToEndTest.swift
@@ -16,14 +16,27 @@
import XCTest
@testable import BazelIntegrationTestCase
@testable import TulsiEndToEndTestBase
+@testable import TulsiGenerator
// End to end test that generates the Buttons project and runs its unit tests. This variation of the
// test uses the nightly Bazel binary.
class ButtonsNightlyEndToEndTest: TulsiEndToEndTest {
fileprivate let buttonsProjectPath = "third_party/tulsi/src/TulsiEndToEndTests/Resources/Buttons.tulsiproj"
+
override func setUp() {
super.setUp()
+ guard let nightlyBazelURL = fakeBazelWorkspace.nightlyBazelURL else {
+ XCTFail("Expected Bazel nightly URL.")
+ return
+ }
+ XCTAssert(fileManager.fileExists(atPath: nightlyBazelURL.path), "Bazel nightly binary is missing.")
+
+ bazelURL = nightlyBazelURL
+ let completionInfo = ProcessRunner.launchProcessSync(bazelURL.path, arguments: ["version"])
+ if let versionOutput = String(data: completionInfo.stdout, encoding: .utf8) {
+ print(versionOutput)
+ }
if (!copyDataToFakeWorkspace("third_party/tulsi/src/TulsiEndToEndTests/Resources")) {
XCTFail("Failed to copy Buttons files to fake execroot.")
@@ -31,13 +44,6 @@
}
func testButtonsWithNightlyBazel() throws {
- guard let nightlyBazelURL = fakeBazelWorkspace.nightlyBazelURL else {
- XCTFail("Expected Bazel nightly URL.")
- return
- }
- XCTAssert(fileManager.fileExists(atPath: nightlyBazelURL.path), "Bazel nightly is missing.")
-
- bazelURL = nightlyBazelURL
let xcodeProjectURL = generateXcodeProject(tulsiProject: buttonsProjectPath,
config: "Buttons")
XCTAssert(fileManager.fileExists(atPath: xcodeProjectURL.path), "Xcode project was not generated.")