Commit 37b84e27 authored by Josh Bleecher Snyder's avatar Josh Bleecher Snyder

os/exec: add BenchmarkExecEcho

Change-Id: Ie955cdc505766447f70b8f262160fe05b60a5b0c
Reviewed-on: https://go-review.googlesource.com/c/164959
Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: default avatarBrad Fitzpatrick <bradfitz@golang.org>
parent 5126fead
// Copyright 2019 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package exec
import (
"testing"
)
func BenchmarkExecEcho(b *testing.B) {
b.ReportAllocs()
path, err := LookPath("echo")
if err != nil {
b.Fatalf("could not find echo: %v", err)
}
b.ResetTimer()
for i := 0; i < b.N; i++ {
if err := Command(path).Run(); err != nil {
b.Fatalf("echo: %v", err)
}
}
}
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