aboutsummaryrefslogtreecommitdiff
path: root/compiler_wrapper/android_config_test.go
diff options
context:
space:
mode:
authorTobias Bosch <tbosch@google.com>2019-10-01 15:00:52 -0700
committerTobias Bosch <tbosch@google.com>2019-10-02 16:53:48 +0000
commitc88ee8a1d2c3d925a90f7a880ae085237b117454 (patch)
treee1c35815b9b354ffebe485c077e17c22099b59e2 /compiler_wrapper/android_config_test.go
parent5322d4af4264a1e63fa33c732cdfb32454347a5c (diff)
downloadtoolchain-utils-c88ee8a1d2c3d925a90f7a880ae085237b117454.tar.gz
Android wrapper: Support compile with fallback.
The old android wrapper supports to use a fallback compiler in case of errors. This replicates this logic. See https://cs.corp.google.com/android/toolchain/llvm_android/compiler_wrapper.py. BUG=chromium:773875 TEST=unit test, golden tests comparing to old wrapper Change-Id: Iff7281e6e21c4834f9a4493884ed7b3d66b87967 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/third_party/toolchain-utils/+/1833898 Tested-by: Tobias Bosch <tbosch@google.com> Reviewed-by: George Burgess <gbiv@chromium.org>
Diffstat (limited to 'compiler_wrapper/android_config_test.go')
-rw-r--r--compiler_wrapper/android_config_test.go42
1 files changed, 42 insertions, 0 deletions
diff --git a/compiler_wrapper/android_config_test.go b/compiler_wrapper/android_config_test.go
index 74881a02..6d51bfe9 100644
--- a/compiler_wrapper/android_config_test.go
+++ b/compiler_wrapper/android_config_test.go
@@ -26,6 +26,7 @@ func TestAndroidConfig(t *testing.T) {
runGoldenRecords(ctx, androidGoldenDir, []goldenFile{
createAndroidClangPathGoldenInputs(ctx),
createBisectGoldenInputs(filepath.Join(ctx.tempDir, "clang")),
+ createAndroidCompileWithFallbackGoldenInputs(ctx),
})
})
}
@@ -74,3 +75,44 @@ func createAndroidClangPathGoldenInputs(ctx *testContext) goldenFile {
},
}
}
+
+func createAndroidCompileWithFallbackGoldenInputs(ctx *testContext) goldenFile {
+ env := []string{
+ "ANDROID_LLVM_PREBUILT_COMPILER_PATH=fallback_compiler",
+ "ANDROID_LLVM_STDERR_REDIRECT=" + filepath.Join(ctx.tempDir, "fallback_stderr"),
+ "ANDROID_LLVM_FALLBACK_DISABLED_WARNINGS=-a -b",
+ }
+ defaultPath := filepath.Join(ctx.tempDir, "clang")
+ return goldenFile{
+ Name: "compile_with_fallback.json",
+ Records: []goldenRecord{
+ {
+ WrapperCmd: newGoldenCmd(defaultPath, mainCc),
+ Env: env,
+ Cmds: okResults,
+ },
+ {
+ WrapperCmd: newGoldenCmd(defaultPath, mainCc),
+ Env: env,
+ Cmds: []commandResult{
+ {
+ ExitCode: 1,
+ },
+ okResult,
+ },
+ },
+ {
+ WrapperCmd: newGoldenCmd(defaultPath, mainCc),
+ Env: env,
+ Cmds: []commandResult{
+ {
+ ExitCode: 1,
+ },
+ {
+ ExitCode: 1,
+ },
+ },
+ },
+ },
+ }
+}