Skip to content

Commit e36d923

Browse files
authored
Change flutter_build_with_compilation_error_test to check stdout or stderr (#152404)
On Xcode 16 beta 3 stderr is: ``` ** BUILD FAILED ** ``` stdout is: ``` Writing result bundle at path: /var/folders/fm/wjzsj_z95ydgn4khxqgbtqx000mfq2/T/flutter_tools.PeJZlH/flutter_ios_build_temp_dirqmiKld/temporary_xcresult_bundle error: lib/main.dart:13:11: Error: A value of type 'String' can't be assigned to a variable of type 'int'. int x = 'String'; ^ Target kernel_snapshot_program failed: Exception Failed to package /Users/m/Projects/test_create. note: Disabling previews because SWIFT_VERSION is set and SWIFT_OPTIMIZATION_LEVEL=-O, expected -Onone (in target 'Runner' from project 'Runner') note: Run script build phase 'Thin Binary' will be run during every build because the option to run the script phase "Based on dependency analysis" is unchecked. (in target 'Runner' from project 'Runner') note: Run script build phase 'Run Script' will be run during every build because the option to run the script phase "Based on dependency analysis" is unchecked. (in target 'Runner' from project 'Runner') ``` The tool output of `flutter build ios` shows both: ``` Building com.example.testCreate for device (ios-release)... Automatically signing iOS for device deployment using specified development team in Xcode project: S8QB4VV633 Running Xcode build... Xcode build done. 10.1s Failed to build iOS app Error output from Xcode build: � ** BUILD FAILED ** Xcode's output: � Writing result bundle at path: /var/folders/fm/wjzsj_z95ydgn4khxqgbtqx000mfq2/T/flutter_tools.Dgnlxc/flutt er_ios_build_temp_dirpKTDdk/temporary_xcresult_bundle error: lib/main.dart:13:11: Error: A value of type 'String' can't be assigned to a variable of type 'int'. int x = 'String'; ^ Target kernel_snapshot_program failed: Exception Failed to package /Users/magder/Projects/test_create. note: Disabling previews because SWIFT_VERSION is set and SWIFT_OPTIMIZATION_LEVEL=-O, expected -Onone (in target 'Runner' from project 'Runner') note: Run script build phase 'Run Script' will be run during every build because the option to run the script phase "Based on dependency analysis" is unchecked. (in target 'Runner' from project 'Runner') note: Run script build phase 'Thin Binary' will be run during every build because the option to run the script phase "Based on dependency analysis" is unchecked. (in target 'Runner' from project 'Runner') Encountered error while building for device. ``` The point of this test is that you can see the error `int x = 'String';` error in the tool output. #72608 (comment) I think just updating the test to check stderr or stdout is sufficient without touching the tool behavior. Fixes #151553
1 parent 058a45d commit e36d923

File tree

1 file changed

+9
-7
lines changed

1 file changed

+9
-7
lines changed

packages/flutter_tools/test/integration.shard/flutter_build_with_compilation_error_test.dart

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -63,14 +63,16 @@ int x = 'String';
6363
'--no-codesign',
6464
], workingDirectory: projectRoot.path);
6565

66-
expect(
67-
result,
68-
const ProcessResultMatcher(
69-
exitCode: 1,
70-
stderrPattern: "A value of type 'String' can't be assigned to a variable of type 'int'.",
71-
),
72-
);
66+
const String errorMessage = "A value of type 'String' can't be assigned to a variable of type 'int'.";
67+
68+
// Xcode 16 moved the xcodebuild error details from stderr to stdout.
69+
// Check that it's contained in one or the other.
70+
final bool matchStdout = result.stdout.toString().contains(errorMessage);
71+
final bool matchStderr = result.stderr.toString().contains(errorMessage);
72+
73+
expect(matchStdout || matchStderr, isTrue);
7374
expect(result.stderr, isNot(contains("Warning: The 'dart2js' entrypoint script is deprecated")));
75+
expect(result.stdout, isNot(contains("Warning: The 'dart2js' entrypoint script is deprecated")));
7476
});
7577
}
7678
}

0 commit comments

Comments
 (0)