test: add cmpout to testlib
R=golang-dev, r
CC=golang-dev
https://golang.org/cl/5699060
diff --git a/test/deferprint.go b/test/deferprint.go
index eab7ed4..72c98b1 100644
--- a/test/deferprint.go
+++ b/test/deferprint.go
@@ -1,4 +1,4 @@
-// $G $D/$F.go && $L $F.$A && ./$A.out 2>&1 | cmp - $D/$F.out
+// cmpout
// Copyright 2010 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
diff --git a/test/fixedbugs/bug328.go b/test/fixedbugs/bug328.go
index 8252983..73ab46d 100644
--- a/test/fixedbugs/bug328.go
+++ b/test/fixedbugs/bug328.go
@@ -1,4 +1,4 @@
-// $G $D/$F.go && $L $F.$A && ./$A.out 2>&1 | cmp - $D/$F.out
+// cmpout
// Copyright 2011 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
diff --git a/test/fixedbugs/bug409.go b/test/fixedbugs/bug409.go
index 884d333..1dca43b 100644
--- a/test/fixedbugs/bug409.go
+++ b/test/fixedbugs/bug409.go
@@ -1,4 +1,4 @@
-// $G $D/$F.go && $L $F.$A && ./$A.out 2>&1 | cmp - $D/$F.out
+// cmpout
// Copyright 2012 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
diff --git a/test/goprint.go b/test/goprint.go
index 3fe08f3..2f0d3c3 100644
--- a/test/goprint.go
+++ b/test/goprint.go
@@ -1,4 +1,4 @@
-// $G $D/$F.go && $L $F.$A && ./$A.out 2>&1 | cmp - $D/$F.out
+// cmpout
// Copyright 2011 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
diff --git a/test/helloworld.go b/test/helloworld.go
index 9c33cab..5025ec9 100644
--- a/test/helloworld.go
+++ b/test/helloworld.go
@@ -1,4 +1,4 @@
-// $G $F.go && $L $F.$A && ./$A.out 2>&1 | cmp - $D/$F.out
+// cmpout
// Copyright 2009 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
diff --git a/test/ken/cplx0.go b/test/ken/cplx0.go
index f38ce5b..912b8c4 100644
--- a/test/ken/cplx0.go
+++ b/test/ken/cplx0.go
@@ -1,4 +1,4 @@
-// $G $D/$F.go && $L $F.$A && ./$A.out 2>&1 | cmp - $D/$F.out
+// cmpout
// Copyright 2010 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
diff --git a/test/ken/string.go b/test/ken/string.go
index e051082..9bd905d 100644
--- a/test/ken/string.go
+++ b/test/ken/string.go
@@ -1,4 +1,4 @@
-// $G $D/$F.go && $L $F.$A && ./$A.out 2>&1 | cmp - $D/$F.out
+// cmpout
// Copyright 2009 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
diff --git a/test/printbig.go b/test/printbig.go
index 6985796..5693c58 100644
--- a/test/printbig.go
+++ b/test/printbig.go
@@ -1,4 +1,4 @@
-// $G $F.go && $L $F.$A && ./$A.out 2>&1 | cmp - $D/$F.out
+// cmpout
// Copyright 2009 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
diff --git a/test/run.go b/test/run.go
index 4d4488a..3ba35f9 100644
--- a/test/run.go
+++ b/test/run.go
@@ -238,6 +238,9 @@
action = strings.TrimSpace(action)
switch action {
+ case "cmpout":
+ action = "run" // the run case already looks for <dir>/<test>.out files
+ fallthrough
case "compile", "build", "run", "errorcheck":
t.action = action
default:
diff --git a/test/testlib b/test/testlib
index ea8c5d7..2e4fefc 100644
--- a/test/testlib
+++ b/test/testlib
@@ -17,6 +17,10 @@
$G $D/$F.go && $L $F.$A && ./$A.out "$@"
}
+cmpout() {
+ $G $D/$F.go && $L $F.$A && ./$A.out 2>&1 | cmp - $D/$F.out
+}
+
errorcheck() {
errchk $G -e $D/$F.go
}