Commit f2b79cad authored by Alex Brainman's avatar Alex Brainman

runtime: import os package in BenchmarkRunningGoProgram

I would like to use BenchmarkRunningGoProgram to measure
changes for issue #15588. So the program in the benchmark
should import "os" package.

It is also reasonable that basic Go program includes
"os" package.

For #15588.

Change-Id: Ida6712eab22c2e79fbe91b6fdd492eaf31756852
Reviewed-on: https://go-review.googlesource.com/37914
Run-TryBot: Alex Brainman <alex.brainman@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: 's avatarIan Lance Taylor <iant@golang.org>
parent 165a96e2
...@@ -1037,7 +1037,7 @@ func BenchmarkRunningGoProgram(b *testing.B) { ...@@ -1037,7 +1037,7 @@ func BenchmarkRunningGoProgram(b *testing.B) {
defer os.RemoveAll(tmpdir) defer os.RemoveAll(tmpdir)
src := filepath.Join(tmpdir, "main.go") src := filepath.Join(tmpdir, "main.go")
err = ioutil.WriteFile(src, []byte(benchmarkRunnigGoProgram), 0666) err = ioutil.WriteFile(src, []byte(benchmarkRunningGoProgram), 0666)
if err != nil { if err != nil {
b.Fatal(err) b.Fatal(err)
} }
...@@ -1060,9 +1060,11 @@ func BenchmarkRunningGoProgram(b *testing.B) { ...@@ -1060,9 +1060,11 @@ func BenchmarkRunningGoProgram(b *testing.B) {
} }
} }
const benchmarkRunnigGoProgram = ` const benchmarkRunningGoProgram = `
package main package main
import _ "os" // average Go program will use "os" package, do the same here
func main() { func main() {
} }
` `
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment