move things out of sys into os and runtime
R=r
OCL=28569
CL=28573
diff --git a/test/235.go b/test/235.go
index e24106d..b8621cc 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 @@
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 4b9671a..ba9a377 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 ad53ab6..00a297a 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 @@
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 c1b7143..cee8a18 100644
--- a/test/chan/goroutines.go
+++ b/test/chan/goroutines.go
@@ -20,12 +20,12 @@
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 2b61ec9..5fd7f0d 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 @@
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 c167da1..f37f639 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 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 b481108..d910019 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 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 7d06e98..49f1c10 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 @@
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 d45ecf3..6699442 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 @@
;
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 41f230d..88cec45 100644
--- a/test/env.go
+++ b/test/env.go
@@ -12,15 +12,15 @@
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 2fbde9c..e7694f9 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 @@
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 44f60fe..b190d4f 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 @@
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 5d5fc4a..82778b8 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 10e2803..06a07e8 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 @@
}
}
if !ok {
- sys.Exit(1);
+ os.Exit(1);
}
}
diff --git a/test/fixedbugs/bug130.go b/test/fixedbugs/bug130.go
index aa3f0dd..3d13cb8 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 @@
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 a2fd992..756ba30 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 @@
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 1784d82..3f3ef15 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 @@
}
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 4121070..1f4d318 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 @@
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 6afd42a..f84da58 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 @@
if !ok {
println("BUG: interface10");
- sys.Exit(1)
+ os.Exit(1)
}
}
diff --git a/test/interface4.go b/test/interface4.go
index 68c5efa..b871309 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 @@
nonptrs();
if bad {
- sys.Exit(1)
+ os.Exit(1)
}
}
diff --git a/test/interface6.go b/test/interface6.go
index 8bfcdf0..c675595 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 @@
f11();
f12();
if fail > 0 {
- sys.Exit(1)
+ os.Exit(1)
}
}
diff --git a/test/ken/chan.go b/test/ken/chan.go
index e06d9ab..d56d77a 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 @@
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 @@
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 @@
for {
for r:=nrand(5); r>=0; r-- {
- sys.Gosched();
+ runtime.Gosched();
}
select {
@@ -270,9 +272,9 @@
func
wait()
{
- sys.Gosched();
+ runtime.Gosched();
for nproc != 0 {
- sys.Gosched();
+ runtime.Gosched();
}
}
@@ -321,7 +323,7 @@
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 c6d7825..5a59de1 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 @@
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 5842eaa..18f539d 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 @@
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 4d581d7..32ed1e5 100644
--- a/test/stringrange.go
+++ b/test/stringrange.go
@@ -8,6 +8,7 @@
import(
"fmt";
+ "os";
"utf8";
)
@@ -56,6 +57,6 @@
if !ok {
fmt.Println("BUG: stringrange");
- sys.Exit(1)
+ os.Exit(1)
}
}
diff --git a/test/switch1.go b/test/switch1.go
index fac9ac8..9e61cc6 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 5ad694d..0a421ae 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 @@
func assert(b bool, s string) {
if !b {
println(s);
- sys.Exit(1);
+ os.Exit(1);
}
}