aboutsummaryrefslogtreecommitdiff
path: root/compiler_wrapper/pie_flags_test.go
diff options
context:
space:
mode:
authorAndroid Build Coastguard Worker <android-build-coastguard-worker@google.com>2023-07-07 04:46:16 +0000
committerAndroid Build Coastguard Worker <android-build-coastguard-worker@google.com>2023-07-07 04:46:16 +0000
commit2ce6e8be8e2dd5dbed108e6d5387e4bd21c3d04c (patch)
tree77dc031614745bb406dbd90cea9a082a1b5cdd54 /compiler_wrapper/pie_flags_test.go
parent904b3e949a93a8953db41e41b256a5b27debeed4 (diff)
parent40214b48188358a80b7478bfff21d4814dd9177c (diff)
downloadtoolchain-utils-android14-mainline-art-release.tar.gz
Change-Id: Ic798bced996e8800fcd5f3f45be364c0b6d53417
Diffstat (limited to 'compiler_wrapper/pie_flags_test.go')
-rw-r--r--compiler_wrapper/pie_flags_test.go84
1 files changed, 0 insertions, 84 deletions
diff --git a/compiler_wrapper/pie_flags_test.go b/compiler_wrapper/pie_flags_test.go
deleted file mode 100644
index 77a0fc8f..00000000
--- a/compiler_wrapper/pie_flags_test.go
+++ /dev/null
@@ -1,84 +0,0 @@
-// Copyright 2019 The Chromium OS Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-package main
-
-import (
- "testing"
-)
-
-func TestAddPieFlags(t *testing.T) {
- withTestContext(t, func(ctx *testContext) {
- initPieConfig(ctx.cfg)
- cmd := ctx.must(callCompiler(ctx, ctx.cfg,
- ctx.newCommand(gccX86_64, mainCc)))
- if err := verifyArgOrder(cmd, "-pie", mainCc); err != nil {
- t.Error(err)
- }
- if err := verifyArgOrder(cmd, "-fPIE", mainCc); err != nil {
- t.Error(err)
- }
- })
-}
-
-func TestOmitPieFlagsWhenNoPieArgGiven(t *testing.T) {
- withTestContext(t, func(ctx *testContext) {
- initPieConfig(ctx.cfg)
- cmd := ctx.must(callCompiler(ctx, ctx.cfg,
- ctx.newCommand(gccX86_64, "-nopie", mainCc)))
- if err := verifyArgCount(cmd, 0, "-nopie"); err != nil {
- t.Error(err)
- }
- if err := verifyArgCount(cmd, 0, "-pie"); err != nil {
- t.Error(err)
- }
- if err := verifyArgCount(cmd, 0, "-fPIE"); err != nil {
- t.Error(err)
- }
-
- cmd = ctx.must(callCompiler(ctx, ctx.cfg,
- ctx.newCommand(gccX86_64, "-fno-pie", mainCc)))
- if err := verifyArgCount(cmd, 0, "-pie"); err != nil {
- t.Error(err)
- }
- if err := verifyArgCount(cmd, 0, "-fPIE"); err != nil {
- t.Error(err)
- }
- })
-}
-
-func TestOmitPieFlagsWhenKernelDefined(t *testing.T) {
- withTestContext(t, func(ctx *testContext) {
- initPieConfig(ctx.cfg)
- cmd := ctx.must(callCompiler(ctx, ctx.cfg,
- ctx.newCommand(gccX86_64, "-D__KERNEL__", mainCc)))
- if err := verifyArgCount(cmd, 0, "-pie"); err != nil {
- t.Error(err)
- }
- if err := verifyArgCount(cmd, 0, "-fPIE"); err != nil {
- t.Error(err)
- }
- })
-}
-
-func TestAddPieFlagsForEabiEvenIfNoPieGiven(t *testing.T) {
- withTestContext(t, func(ctx *testContext) {
- initPieConfig(ctx.cfg)
- cmd := ctx.must(callCompiler(ctx, ctx.cfg,
- ctx.newCommand(gccX86_64Eabi, "-nopie", mainCc)))
- if err := verifyArgCount(cmd, 0, "-nopie"); err != nil {
- t.Error(err)
- }
- if err := verifyArgCount(cmd, 1, "-pie"); err != nil {
- t.Error(err)
- }
- if err := verifyArgCount(cmd, 1, "-fPIE"); err != nil {
- t.Error(err)
- }
- })
-}
-
-func initPieConfig(cfg *config) {
- cfg.commonFlags = []string{"-fPIE", "-pie"}
-}