mirror of
https://github.com/tailscale/tailscale.git
synced 2025-12-03 02:21:58 +00:00
tstest/archtest: add GOARCH-specific tests, run via qemu-user
Updates #3233 Change-Id: Ia224c90490d41e50a1d547eeea709b0d9171c1f9 Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
This commit is contained in:
committed by
Brad Fitzpatrick
parent
b02eb1d5c5
commit
c18b9d58aa
32
tstest/archtest/archtest_test.go
Normal file
32
tstest/archtest/archtest_test.go
Normal file
@@ -0,0 +1,32 @@
|
||||
// Copyright (c) 2021 Tailscale Inc & 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 archtest
|
||||
|
||||
import (
|
||||
"runtime"
|
||||
"testing"
|
||||
|
||||
"inet.af/netstack/atomicbitops"
|
||||
)
|
||||
|
||||
// tests netstack's AlignedAtomicInt64.
|
||||
func TestAlignedAtomicInt64(t *testing.T) {
|
||||
type T struct {
|
||||
A atomicbitops.AlignedAtomicInt64
|
||||
x int32
|
||||
B atomicbitops.AlignedAtomicInt64
|
||||
}
|
||||
|
||||
t.Logf("I am %v/%v\n", runtime.GOOS, runtime.GOARCH)
|
||||
var x T
|
||||
x.A.Store(1)
|
||||
x.B.Store(2)
|
||||
if got, want := x.A.Load(), int64(1); got != want {
|
||||
t.Errorf("A = %v; want %v", got, want)
|
||||
}
|
||||
if got, want := x.B.Load(), int64(2); got != want {
|
||||
t.Errorf("A = %v; want %v", got, want)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user