diff options
author | Philipp Stephani <phst@google.com> | 2021-03-08 17:52:02 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-03-08 11:52:02 -0500 |
commit | ee1740e04a6918046e3e9f228115e65f3a1e309b (patch) | |
tree | 7224983825dd8643a39461ee211edb7f4a820103 /tests/legacy | |
parent | caf08a7e32203173fe67cb188d5c9cae725f5926 (diff) | |
download | bazelbuild-rules_go-ee1740e04a6918046e3e9f228115e65f3a1e309b.tar.gz |
Modify build constraints test to also work with ARM-64. (#2831)
Diffstat (limited to 'tests/legacy')
-rw-r--r-- | tests/legacy/build_constraints/BUILD.bazel | 3 | ||||
-rw-r--r-- | tests/legacy/build_constraints/asm_arm64.s | 20 | ||||
-rw-r--r-- | tests/legacy/build_constraints/asm_linux_amd64.s (renamed from tests/legacy/build_constraints/asm_linux.s) | 0 | ||||
-rw-r--r-- | tests/legacy/build_constraints/asm_unknown.s | 2 | ||||
-rw-r--r-- | tests/legacy/build_constraints/build_constraints_test.go | 2 |
5 files changed, 25 insertions, 2 deletions
diff --git a/tests/legacy/build_constraints/BUILD.bazel b/tests/legacy/build_constraints/BUILD.bazel index 5f012ed4..bacd8e66 100644 --- a/tests/legacy/build_constraints/BUILD.bazel +++ b/tests/legacy/build_constraints/BUILD.bazel @@ -17,7 +17,8 @@ go_library( "tag_l.go", "tag_unknown.go", # Check that constraints apply to assembly files. - "asm_linux.s", + "asm_arm64.s", + "asm_linux_amd64.s", "asm_unknown.s", # Check that constraints apply to cgo files. "cgo_linux.go", diff --git a/tests/legacy/build_constraints/asm_arm64.s b/tests/legacy/build_constraints/asm_arm64.s new file mode 100644 index 00000000..1308af68 --- /dev/null +++ b/tests/legacy/build_constraints/asm_arm64.s @@ -0,0 +1,20 @@ +// Copyright 2021 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// +build arm64 + +TEXT ·asm(SB),$0-0 + MOVD $75,R0 + MOVD R0,RET(FP) + RET diff --git a/tests/legacy/build_constraints/asm_linux.s b/tests/legacy/build_constraints/asm_linux_amd64.s index cfbaa911..cfbaa911 100644 --- a/tests/legacy/build_constraints/asm_linux.s +++ b/tests/legacy/build_constraints/asm_linux_amd64.s diff --git a/tests/legacy/build_constraints/asm_unknown.s b/tests/legacy/build_constraints/asm_unknown.s index 1fdd3662..b44dc370 100644 --- a/tests/legacy/build_constraints/asm_unknown.s +++ b/tests/legacy/build_constraints/asm_unknown.s @@ -1,4 +1,4 @@ -// +build !linux +// +build !linux,amd64 TEXT ·asm(SB),$0-0 MOVQ $34,RET(FP) diff --git a/tests/legacy/build_constraints/build_constraints_test.go b/tests/legacy/build_constraints/build_constraints_test.go index 4fb9555f..b2ac474e 100644 --- a/tests/legacy/build_constraints/build_constraints_test.go +++ b/tests/legacy/build_constraints/build_constraints_test.go @@ -32,6 +32,8 @@ func TestAsm(t *testing.T) { var want int if runtime.GOOS == "linux" { want = 12 + } else if runtime.GOARCH == "arm64" { + want = 75 } else { want = 34 } |