[CP-stable]Change flutter_build_with_compilation_error_test to check stdout or stderr (#153116)

### Issue Link:
https://github.com/flutter/flutter/issues/151553

### Changelog Description:
Make a flutter_tools test pass on Xcode 16 beta.

### Impact Description:
When we update our CI to Xcode 16 after it releases (likely in September), all tests should pass.

### Workaround:
Turning off the test.

### Risk:
What is the risk level of this cherry-pick?

### Test Coverage:
Are you confident that your fix is well-tested by automated tests?

### Validation Steps:
- Install Xcode 15 and run the test (this is happening in CI now).
- Install Xcode 16 latest beta and run the test.  

Part of https://github.com/flutter/flutter/issues/148959
This commit is contained in:
flutteractionsbot 2024-08-12 11:07:56 -07:00 committed by GitHub
parent 80c2e84975
commit dcc1f06039
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -63,14 +63,16 @@ int x = 'String';
'--no-codesign',
], workingDirectory: projectRoot.path);
expect(
result,
const ProcessResultMatcher(
exitCode: 1,
stderrPattern: "A value of type 'String' can't be assigned to a variable of type 'int'.",
),
);
const String errorMessage = "A value of type 'String' can't be assigned to a variable of type 'int'.";
// Xcode 16 moved the xcodebuild error details from stderr to stdout.
// Check that it's contained in one or the other.
final bool matchStdout = result.stdout.toString().contains(errorMessage);
final bool matchStderr = result.stderr.toString().contains(errorMessage);
expect(matchStdout || matchStderr, isTrue);
expect(result.stderr, isNot(contains("Warning: The 'dart2js' entrypoint script is deprecated")));
expect(result.stdout, isNot(contains("Warning: The 'dart2js' entrypoint script is deprecated")));
});
}
}