aboutsummaryrefslogtreecommitdiff
path: root/compiler_wrapper/sysroot_flag_test.go
diff options
context:
space:
mode:
Diffstat (limited to 'compiler_wrapper/sysroot_flag_test.go')
-rw-r--r--compiler_wrapper/sysroot_flag_test.go26
1 files changed, 26 insertions, 0 deletions
diff --git a/compiler_wrapper/sysroot_flag_test.go b/compiler_wrapper/sysroot_flag_test.go
index 9fea6848..bca8d1b0 100644
--- a/compiler_wrapper/sysroot_flag_test.go
+++ b/compiler_wrapper/sysroot_flag_test.go
@@ -6,9 +6,35 @@ package main
import (
"path"
+ "regexp"
"testing"
)
+func TestOmitSysrootGivenSysrootSuppressionFlag(t *testing.T) {
+ escapedAutodetectionFlag := regexp.QuoteMeta(skipSysrootAutodetectionFlag)
+ withTestContext(t, func(ctx *testContext) {
+ runWithCompiler := func(compiler string) {
+ cmd := ctx.must(callCompiler(ctx, ctx.cfg,
+ ctx.newCommand(compiler, skipSysrootAutodetectionFlag, mainCc)))
+ if err := verifyArgOrder(cmd, mainCc); err != nil {
+ t.Error(err)
+ }
+ if err := verifyArgCount(cmd, 0, "--sysroot.*"); err != nil {
+ t.Error(err)
+ }
+ if err := verifyArgCount(cmd, 0, "-L.*"); err != nil {
+ t.Error(err)
+ }
+ if err := verifyArgCount(cmd, 0, escapedAutodetectionFlag); err != nil {
+ t.Error(err)
+ }
+ }
+
+ runWithCompiler(gccX86_64)
+ runWithCompiler(clangX86_64)
+ })
+}
+
func TestOmitSysrootGivenUserDefinedSysroot(t *testing.T) {
withTestContext(t, func(ctx *testContext) {
runWithCompiler := func(compiler string) {