aboutsummaryrefslogtreecommitdiff
path: root/compiler_wrapper/ccache_flag_test.go
diff options
context:
space:
mode:
authorAndroid Build Coastguard Worker <android-build-coastguard-worker@google.com>2024-03-04 22:09:09 +0000
committerAndroid Build Coastguard Worker <android-build-coastguard-worker@google.com>2024-03-04 22:09:09 +0000
commite4e9fc469b0edc4a9c00aee93007bb158bd16c93 (patch)
tree1712145996c7c1417f2e15c23c5f9e6de3529460 /compiler_wrapper/ccache_flag_test.go
parent70ae128471ed69464c0fcc335019d1d9d4bca65c (diff)
parent229e46055785e329ca397400bd4bfba35a7ec1db (diff)
downloadtoolchain-utils-e4e9fc469b0edc4a9c00aee93007bb158bd16c93.tar.gz
Snap for 11526323 from 229e46055785e329ca397400bd4bfba35a7ec1db to simpleperf-releasesimpleperf-release
Change-Id: I3f786968fe8de6ceeb4585432b15cae5ad404b77
Diffstat (limited to 'compiler_wrapper/ccache_flag_test.go')
-rw-r--r--compiler_wrapper/ccache_flag_test.go29
1 files changed, 28 insertions, 1 deletions
diff --git a/compiler_wrapper/ccache_flag_test.go b/compiler_wrapper/ccache_flag_test.go
index 330d1a1c..087d97be 100644
--- a/compiler_wrapper/ccache_flag_test.go
+++ b/compiler_wrapper/ccache_flag_test.go
@@ -32,8 +32,35 @@ func TestNotCallCCacheGivenConfig(t *testing.T) {
})
}
-func TestNotCallCCacheGivenConfigAndNoCCacheArg(t *testing.T) {
+func TestCallCCacheGivenEnviron(t *testing.T) {
withCCacheEnabledTestContext(t, func(ctx *testContext) {
+ ctx.env = append(ctx.env, "COMPILER_WRAPPER_FORCE_CCACHE=1")
+
+ cmd := ctx.must(callCompiler(ctx, ctx.cfg,
+ ctx.newCommand(gccX86_64, mainCc)))
+ if err := verifyPath(cmd, "/usr/bin/ccache"); err != nil {
+ t.Error(err)
+ }
+ if err := verifyArgOrder(cmd, gccX86_64+".real", mainCc); err != nil {
+ t.Error(err)
+ }
+ })
+}
+
+func TestNotCallCCacheGivenEnviron(t *testing.T) {
+ withCCacheEnabledTestContext(t, func(ctx *testContext) {
+ ctx.env = append(ctx.env, "COMPILER_WRAPPER_FORCE_CCACHE=0")
+
+ cmd := ctx.must(callCompiler(ctx, ctx.cfg,
+ ctx.newCommand(gccX86_64, mainCc)))
+ if err := verifyPath(cmd, gccX86_64+".real"); err != nil {
+ t.Error(err)
+ }
+ })
+}
+
+func TestNotCallCCacheGivenConfigAndNoCCacheArg(t *testing.T) {
+ withTestContext(t, func(ctx *testContext) {
cmd := ctx.must(callCompiler(ctx, ctx.cfg,
ctx.newCommand(gccX86_64, "-noccache", mainCc)))
if err := verifyPath(cmd, gccX86_64+".real"); err != nil {