1// Copyright 2019 The Go Authors. All rights reserved.
2// Use of this source code is governed by a BSD-style
3// license that can be found in the LICENSE file.
4
5package exec
6
7import (
8	"testing"
9)
10
11func BenchmarkExecHostname(b *testing.B) {
12	b.ReportAllocs()
13	path, err := LookPath("hostname")
14	if err != nil {
15		b.Fatalf("could not find hostname: %v", err)
16	}
17	b.ResetTimer()
18	for i := 0; i < b.N; i++ {
19		if err := Command(path).Run(); err != nil {
20			b.Fatalf("hostname: %v", err)
21		}
22	}
23}
24