2017-03-02 Richard Biener <rguenther@suse.de>
[official-gcc.git] / libgo / go / runtime / proc_runtime_test.go
blobd56f9b14636ef267c6cab6b2ac1992cc4375a1c7
1 // Copyright 2016 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 // +build ignore
7 // Proc unit tests. In runtime package so can use runtime guts.
9 package runtime
11 func RunStealOrderTest() {
12 var ord randomOrder
13 for procs := 1; procs <= 64; procs++ {
14 ord.reset(uint32(procs))
15 if procs >= 3 && len(ord.coprimes) < 2 {
16 panic("too few coprimes")
18 for co := 0; co < len(ord.coprimes); co++ {
19 enum := ord.start(uint32(co))
20 checked := make([]bool, procs)
21 for p := 0; p < procs; p++ {
22 x := enum.position()
23 if checked[x] {
24 println("procs:", procs, "inc:", enum.inc)
25 panic("duplicate during enumeration")
27 checked[x] = true
28 enum.next()
30 if !enum.done() {
31 panic("not done")