diff options
| author | Russ Cox <rsc@golang.org> | 2009-05-08 15:21:41 -0700 |
|---|---|---|
| committer | Russ Cox <rsc@golang.org> | 2009-05-08 15:21:41 -0700 |
| commit | 1ea895d9a458c9e4a91993924fcd39ce7f1dcabe (patch) | |
| tree | 5b8c80c41b4110b57cef1a0945350c2caf7557e2 /test | |
| parent | 206ea17d5fe6ad6d6492afe73ec2d72ce399a3fd (diff) | |
| download | golang-1ea895d9a458c9e4a91993924fcd39ce7f1dcabe.tar.gz | |
move things out of sys into os and runtime
R=r
OCL=28569
CL=28573
Diffstat (limited to 'test')
| -rw-r--r-- | test/235.go | 4 | ||||
| -rw-r--r-- | test/args.go | 8 | ||||
| -rw-r--r-- | test/chan/fifo.go | 4 | ||||
| -rw-r--r-- | test/chan/goroutines.go | 6 | ||||
| -rw-r--r-- | test/chan/nonblock.go | 7 | ||||
| -rw-r--r-- | test/chan/powser1.go | 4 | ||||
| -rw-r--r-- | test/chan/powser2.go | 4 | ||||
| -rw-r--r-- | test/chan/sieve.go | 4 | ||||
| -rw-r--r-- | test/char_lit.go | 6 | ||||
| -rw-r--r-- | test/env.go | 6 | ||||
| -rw-r--r-- | test/fixedbugs/bug006.go | 4 | ||||
| -rw-r--r-- | test/fixedbugs/bug059.go | 4 | ||||
| -rw-r--r-- | test/fixedbugs/bug060.go | 4 | ||||
| -rw-r--r-- | test/fixedbugs/bug120.go | 3 | ||||
| -rw-r--r-- | test/fixedbugs/bug130.go | 4 | ||||
| -rw-r--r-- | test/fixedbugs/bug141.go | 4 | ||||
| -rw-r--r-- | test/if1.go | 4 | ||||
| -rw-r--r-- | test/int_lit.go | 4 | ||||
| -rw-r--r-- | test/interface10.go | 4 | ||||
| -rw-r--r-- | test/interface4.go | 4 | ||||
| -rw-r--r-- | test/interface6.go | 4 | ||||
| -rw-r--r-- | test/ken/chan.go | 16 | ||||
| -rw-r--r-- | test/ken/chan1.go | 8 | ||||
| -rw-r--r-- | test/string_lit.go | 4 | ||||
| -rw-r--r-- | test/stringrange.go | 3 | ||||
| -rw-r--r-- | test/switch1.go | 6 | ||||
| -rw-r--r-- | test/typeswitch.go | 4 |
27 files changed, 92 insertions, 45 deletions
diff --git a/test/235.go b/test/235.go index e24106dd0..b8621cc7e 100644 --- a/test/235.go +++ b/test/235.go @@ -6,6 +6,8 @@ package main +import "os" + type T chan uint64; func M(f uint64) (in, out T) { @@ -65,5 +67,5 @@ func main() { x = min(xs); if x != OUT[i] { panic("bad: ", x, " should be ", OUT[i]); } } - sys.Exit(0); + os.Exit(0); } diff --git a/test/args.go b/test/args.go index 4b9671a53..ba9a377a6 100644 --- a/test/args.go +++ b/test/args.go @@ -6,14 +6,16 @@ package main +import "os" + func main() { - if len(sys.Args) != 3 { + if len(os.Args) != 3 { panic("argc") } - if sys.Args[1] != "arg1" { + if os.Args[1] != "arg1" { panic("arg1") } - if sys.Args[2] != "arg2" { + if os.Args[2] != "arg2" { panic("arg2") } } diff --git a/test/chan/fifo.go b/test/chan/fifo.go index ad53ab655..00a297a60 100644 --- a/test/chan/fifo.go +++ b/test/chan/fifo.go @@ -8,6 +8,8 @@ package main +import "os" + const N = 10 func AsynchFifo() { @@ -18,7 +20,7 @@ func AsynchFifo() { for i := 0; i < N; i++ { if <-ch != i { print("bad receive\n"); - sys.Exit(1); + os.Exit(1); } } } diff --git a/test/chan/goroutines.go b/test/chan/goroutines.go index c1b714356..cee8a18ac 100644 --- a/test/chan/goroutines.go +++ b/test/chan/goroutines.go @@ -20,12 +20,12 @@ func f(left, right chan int) { func main() { var n = 10000; - if len(sys.Args) > 1 { + if len(os.Args) > 1 { var err os.Error; - n, err = strconv.Atoi(sys.Args[1]); + n, err = strconv.Atoi(os.Args[1]); if err != nil { print("bad arg\n"); - sys.Exit(1); + os.Exit(1); } } leftmost := make(chan int); diff --git a/test/chan/nonblock.go b/test/chan/nonblock.go index 2b61ec9db..5fd7f0d45 100644 --- a/test/chan/nonblock.go +++ b/test/chan/nonblock.go @@ -9,6 +9,7 @@ package main +import "runtime" import "time" func i32receiver(c chan int32, strobe chan bool) { @@ -55,9 +56,9 @@ var ticker = time.Tick(10*1000); // 10 us func sleep() { <-ticker; <-ticker; - sys.Gosched(); - sys.Gosched(); - sys.Gosched(); + runtime.Gosched(); + runtime.Gosched(); + runtime.Gosched(); } func main() { diff --git a/test/chan/powser1.go b/test/chan/powser1.go index c167da192..f37f639ab 100644 --- a/test/chan/powser1.go +++ b/test/chan/powser1.go @@ -13,6 +13,8 @@ package main +import "os" + type rat struct { num, den int64; // numerator, denominator } @@ -623,7 +625,7 @@ func checka(U PS, a []rat, str string) { func main() { Init(); - if len(sys.Args) > 1 { // print + if len(os.Args) > 1 { // print print("Ones: "); printn(Ones, 10); print("Twos: "); printn(Twos, 10); print("Add: "); printn(Add(Ones, Twos), 10); diff --git a/test/chan/powser2.go b/test/chan/powser2.go index b48110819..d91001969 100644 --- a/test/chan/powser2.go +++ b/test/chan/powser2.go @@ -16,6 +16,8 @@ package main +import "os" + type rat struct { num, den int64; // numerator, denominator } @@ -636,7 +638,7 @@ func checka(U PS, a []*rat, str string) { func main() { Init(); - if len(sys.Args) > 1 { // print + if len(os.Args) > 1 { // print print("Ones: "); Printn(Ones, 10); print("Twos: "); Printn(Twos, 10); print("Add: "); Printn(Add(Ones, Twos), 10); diff --git a/test/chan/sieve.go b/test/chan/sieve.go index 7d06e98fa..49f1c105e 100644 --- a/test/chan/sieve.go +++ b/test/chan/sieve.go @@ -9,6 +9,8 @@ package main +import "os" + // Send the sequence 2, 3, 4, ... to channel 'ch'. func Generate(ch chan<- int) { for i := 2; ; i++ { @@ -47,5 +49,5 @@ func main() { for i := 0; i < len(a); i++ { if x := <-primes; x != a[i] { panic(x, " != ", a[i]) } } - sys.Exit(0); + os.Exit(0); } diff --git a/test/char_lit.go b/test/char_lit.go index d45ecf398..6699442dc 100644 --- a/test/char_lit.go +++ b/test/char_lit.go @@ -6,6 +6,8 @@ package main +import "os" + func main() { var i uint64 = ' ' + @@ -33,10 +35,10 @@ func main() { ; if '\Ucafebabe' != 0xcafebabe { print("cafebabe wrong\n"); - sys.Exit(1) + os.Exit(1) } if i != 0xcc238de1 { print("number is ", i, " should be ", 0xcc238de1, "\n"); - sys.Exit(1) + os.Exit(1) } } diff --git a/test/env.go b/test/env.go index 41f230d1a..88cec4546 100644 --- a/test/env.go +++ b/test/env.go @@ -12,15 +12,15 @@ func main() { ga, e0 := os.Getenv("GOARCH"); if e0 != nil { print("$GOARCH: ", e0.String(), "\n"); - sys.Exit(1); + os.Exit(1); } if ga != "amd64" { print("$GOARCH=", ga, "\n"); - sys.Exit(1); + os.Exit(1); } xxx, e1 := os.Getenv("DOES_NOT_EXIST"); if e1 != os.ENOENV { print("$DOES_NOT_EXIST=", xxx, "; err = ", e1.String(), "\n"); - sys.Exit(1); + os.Exit(1); } } diff --git a/test/fixedbugs/bug006.go b/test/fixedbugs/bug006.go index 2fbde9c9a..e7694f95b 100644 --- a/test/fixedbugs/bug006.go +++ b/test/fixedbugs/bug006.go @@ -6,6 +6,8 @@ package main +import "os" + const ( x float = iota; g float = 4.5 * iota; @@ -13,5 +15,5 @@ const ( func main() { if g == 0.0 { print("zero\n");} - if g != 4.5 { print(" fail\n"); sys.Exit(1); } + if g != 4.5 { print(" fail\n"); os.Exit(1); } } diff --git a/test/fixedbugs/bug059.go b/test/fixedbugs/bug059.go index 44f60fedb..b190d4f26 100644 --- a/test/fixedbugs/bug059.go +++ b/test/fixedbugs/bug059.go @@ -6,6 +6,8 @@ package main +import "os" + func P(a []string) string { s := "{"; for i := 0; i < 2; i++ { @@ -29,6 +31,6 @@ func main() { a[0] = "x"; m["0"][0] = "deleted"; if m["0"][0] != "deleted" { - sys.Exit(1); + os.Exit(1); } } diff --git a/test/fixedbugs/bug060.go b/test/fixedbugs/bug060.go index 5d5fc4a7b..82778b838 100644 --- a/test/fixedbugs/bug060.go +++ b/test/fixedbugs/bug060.go @@ -6,12 +6,14 @@ package main +import "os" + func main() { m := make(map[int]int); m[0] = 0; m[0]++; if m[0] != 1 { print("map does not increment\n"); - sys.Exit(1) + os.Exit(1) } } diff --git a/test/fixedbugs/bug120.go b/test/fixedbugs/bug120.go index 10e28034d..06a07e805 100644 --- a/test/fixedbugs/bug120.go +++ b/test/fixedbugs/bug120.go @@ -6,6 +6,7 @@ package main +import "os" import "strconv"; type Test struct { @@ -53,6 +54,6 @@ func main() { } } if !ok { - sys.Exit(1); + os.Exit(1); } } diff --git a/test/fixedbugs/bug130.go b/test/fixedbugs/bug130.go index aa3f0dd70..3d13cb8ab 100644 --- a/test/fixedbugs/bug130.go +++ b/test/fixedbugs/bug130.go @@ -6,6 +6,8 @@ package main +import "os" + type I interface { send(chan <- int) } type S struct { v int } @@ -16,5 +18,5 @@ func main() { var i I = &s; c := make(chan int); go i.send(c); - sys.Exit(<-c); + os.Exit(<-c); } diff --git a/test/fixedbugs/bug141.go b/test/fixedbugs/bug141.go index a2fd992c0..756ba308d 100644 --- a/test/fixedbugs/bug141.go +++ b/test/fixedbugs/bug141.go @@ -6,6 +6,8 @@ package main +import "os" + type S struct { i int } func (p *S) Get() int { return p.i } @@ -18,7 +20,7 @@ type Getter interface { func f1(p Empty) { switch x := p.(type) { - default: println("failed to match interface"); sys.Exit(1); + default: println("failed to match interface"); os.Exit(1); case Getter: break; } diff --git a/test/if1.go b/test/if1.go index 1784d8239..3f3ef1597 100644 --- a/test/if1.go +++ b/test/if1.go @@ -6,6 +6,8 @@ package main +import "os" + func main() { count := 7; if one := 1; { @@ -13,6 +15,6 @@ func main() { } if count != 8 { print(count, " should be 8\n"); - sys.Exit(1) + os.Exit(1) } } diff --git a/test/int_lit.go b/test/int_lit.go index 4121070f3..1f4d318af 100644 --- a/test/int_lit.go +++ b/test/int_lit.go @@ -6,6 +6,8 @@ package main +import "os" + func main() { s := 0 + @@ -18,6 +20,6 @@ func main() { 0X123; if s != 788 { print("s is ", s, "; should be 788\n"); - sys.Exit(1); + os.Exit(1); } } diff --git a/test/interface10.go b/test/interface10.go index 6afd42a2f..f84da58ed 100644 --- a/test/interface10.go +++ b/test/interface10.go @@ -6,6 +6,8 @@ package main +import "os" + const Value = 1e12 type Inter interface { M() int64 } @@ -73,6 +75,6 @@ func main() { if !ok { println("BUG: interface10"); - sys.Exit(1) + os.Exit(1) } } diff --git a/test/interface4.go b/test/interface4.go index 68c5efafb..b87130937 100644 --- a/test/interface4.go +++ b/test/interface4.go @@ -9,6 +9,8 @@ package main +import "os" + type I interface { M() int64 } type BigPtr struct { a, b, c, d int64 } @@ -70,6 +72,6 @@ func main() { nonptrs(); if bad { - sys.Exit(1) + os.Exit(1) } } diff --git a/test/interface6.go b/test/interface6.go index 8bfcdf0fc..c675595fd 100644 --- a/test/interface6.go +++ b/test/interface6.go @@ -6,6 +6,8 @@ package main +import "os" + var fail int func check(b bool, msg string) { @@ -145,6 +147,6 @@ func main() { f11(); f12(); if fail > 0 { - sys.Exit(1) + os.Exit(1) } } diff --git a/test/ken/chan.go b/test/ken/chan.go index e06d9ab40..d56d77ade 100644 --- a/test/ken/chan.go +++ b/test/ken/chan.go @@ -6,6 +6,8 @@ package main +import "os" +import "runtime" var randx int; @@ -88,7 +90,7 @@ send(c *Chan) nproc++; // total goroutines running for { for r:=nrand(10); r>=0; r-- { - sys.Gosched(); + runtime.Gosched(); } c.sc <- c.sv; if c.send() { @@ -119,7 +121,7 @@ recv(c *Chan) nproc++; // total goroutines running for { for r:=nrand(10); r>=0; r-- { - sys.Gosched(); + runtime.Gosched(); } v = <-c.rc; if c.recv(v) { @@ -148,7 +150,7 @@ sel(r0,r1,r2,r3, s0,s1,s2,s3 *Chan) for { for r:=nrand(5); r>=0; r-- { - sys.Gosched(); + runtime.Gosched(); } select { @@ -270,9 +272,9 @@ test6(c int) func wait() { - sys.Gosched(); + runtime.Gosched(); for nproc != 0 { - sys.Gosched(); + runtime.Gosched(); } } @@ -321,7 +323,7 @@ main() if tots != t || totr != t { print("tots=", tots, " totr=", totr, " sb=", t, "\n"); - sys.Exit(1); + os.Exit(1); } - sys.Exit(0); + os.Exit(0); } diff --git a/test/ken/chan1.go b/test/ken/chan1.go index c6d7825b7..5a59de1c0 100644 --- a/test/ken/chan1.go +++ b/test/ken/chan1.go @@ -6,6 +6,8 @@ package main +import "runtime" + const N = 1000; // sent messages const M = 10; // receiving goroutines const W = 2; // channel buffering @@ -48,9 +50,9 @@ main() c := make(chan int, W); for m:=0; m<M; m++ { go r(c, m); - sys.Gosched(); + runtime.Gosched(); } - sys.Gosched(); - sys.Gosched(); + runtime.Gosched(); + runtime.Gosched(); s(c); } diff --git a/test/string_lit.go b/test/string_lit.go index 5842eaa29..18f539dce 100644 --- a/test/string_lit.go +++ b/test/string_lit.go @@ -6,6 +6,8 @@ package main +import "os" + var ecode int; func assert(a, b, c string) { @@ -84,5 +86,5 @@ func main() { r = 0x10ffff + 1; s = string(r); assert(s, "\xef\xbf\xbd", "too-large rune"); - sys.Exit(ecode); + os.Exit(ecode); } diff --git a/test/stringrange.go b/test/stringrange.go index 4d581d70f..32ed1e5f0 100644 --- a/test/stringrange.go +++ b/test/stringrange.go @@ -8,6 +8,7 @@ package main import( "fmt"; + "os"; "utf8"; ) @@ -56,6 +57,6 @@ func main() { if !ok { fmt.Println("BUG: stringrange"); - sys.Exit(1) + os.Exit(1) } } diff --git a/test/switch1.go b/test/switch1.go index fac9ac8ec..9e61cc658 100644 --- a/test/switch1.go +++ b/test/switch1.go @@ -6,13 +6,15 @@ package main +import "os" + func main() { i := 0; switch x := 5; { case i < x: - sys.Exit(0); + os.Exit(0); case i == x: case i > x: - sys.Exit(1); + os.Exit(1); } } diff --git a/test/typeswitch.go b/test/typeswitch.go index 5ad694d86..0a421ae96 100644 --- a/test/typeswitch.go +++ b/test/typeswitch.go @@ -6,6 +6,8 @@ package main +import "os" + const ( Bool = iota; Int; @@ -31,7 +33,7 @@ var m = make(map[string]int) func assert(b bool, s string) { if !b { println(s); - sys.Exit(1); + os.Exit(1); } } |
