aboutsummaryrefslogtreecommitdiff
path: root/compiler_wrapper/x64_flags_test.go
blob: ce5caebded1c54e1b88695de4ac7a518fc25846f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
// Copyright 2019 The ChromiumOS Authors
// 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 TestAddNoMovbeFlagOnX86(t *testing.T) {
	withTestContext(t, func(ctx *testContext) {
		cmd := ctx.must(callCompiler(ctx, ctx.cfg,
			ctx.newCommand(gccX86_64, mainCc)))
		if err := verifyArgOrder(cmd, mainCc, "-mno-movbe"); err != nil {
			t.Error(err)
		}
	})
}

func TestAddNoMovbeFlagOnI686(t *testing.T) {
	withTestContext(t, func(ctx *testContext) {
		cmd := ctx.must(callCompiler(ctx, ctx.cfg,
			ctx.newCommand("./i686-cros-linux-gnu-gcc", mainCc)))
		if err := verifyArgOrder(cmd, mainCc, "-mno-movbe"); err != nil {
			t.Error(err)
		}
	})
}

func TestDoNotAddNoMovbeFlagOnArm(t *testing.T) {
	withTestContext(t, func(ctx *testContext) {
		cmd := ctx.must(callCompiler(ctx, ctx.cfg,
			ctx.newCommand(gccArmV7, mainCc)))
		if err := verifyArgCount(cmd, 0, "-mno-movbe"); err != nil {
			t.Error(err)
		}
	})
}