Revert "[PATCH 7/7] RISC-V: Disable by pieces for vector setmem length > UNITS_PER_WORD"
[official-gcc.git] / libgo / go / runtime / runtime_linux_test.go
blobdc7770d38468b134c09f73cc9a582cb2f836f3de
1 // Copyright 2012 The Go Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style
3 // license that can be found in the LICENSE file.
5 package runtime_test
7 import (
8 . "runtime"
9 "syscall"
10 "testing"
11 "time"
14 var pid, tid int
16 func init() {
17 // Record pid and tid of init thread for use during test.
18 // The call to LockOSThread is just to exercise it;
19 // we can't test that it does anything.
20 // Instead we're testing that the conditions are good
21 // for how it is used in init (must be on main thread).
22 pid, tid = syscall.Getpid(), syscall.Gettid()
23 LockOSThread()
25 sysNanosleep = func(d time.Duration) {
26 // Invoke a blocking syscall directly; calling time.Sleep()
27 // would deschedule the goroutine instead.
28 ts := syscall.NsecToTimespec(d.Nanoseconds())
29 for {
30 if err := syscall.Nanosleep(&ts, &ts); err != syscall.EINTR {
31 return
37 func TestLockOSThread(t *testing.T) {
38 if pid != tid {
39 t.Fatalf("pid=%d but tid=%d", pid, tid)