1
0
mirror of https://github.com/golang/go synced 2024-11-05 14:46:11 -07:00

cmd/stress: flush out Usage doc

Provide more context when you run `stress -h` besides just the flags.

Change-Id: I9dbe7ba2b7178dd7a542d8c4c29bf79999a38234
Reviewed-on: https://go-review.googlesource.com/44810
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
This commit is contained in:
Kevin Burke 2017-06-04 22:26:59 -07:00 committed by Brad Fitzpatrick
parent e011c1062a
commit 011098bb92

View File

@ -4,14 +4,14 @@
// +build !plan9 // +build !plan9
// The stress utility is intended for catching of episodic failures. // The stress utility is intended for catching sporadic failures.
// It runs a given process in parallel in a loop and collects any failures. // It runs a given process in parallel in a loop and collects any failures.
// Usage: // Usage:
// $ stress ./fmt.test -test.run=TestSometing -test.cpu=10 // $ stress ./fmt.test -test.run=TestSometing -test.cpu=10
// You can also specify a number of parallel processes with -p flag; // You can also specify a number of parallel processes with -p flag;
// instruct the utility to not kill hanged processes for gdb attach; // instruct the utility to not kill hanged processes for gdb attach;
// or specify the failure output you are looking for (if you want to // or specify the failure output you are looking for (if you want to
// ignore some other episodic failures). // ignore some other sporadic failures).
package main package main
import ( import (
@ -34,6 +34,19 @@ var (
flagIgnore = flag.String("ignore", "", "ignore failure if output matches `regexp`") flagIgnore = flag.String("ignore", "", "ignore failure if output matches `regexp`")
) )
func init() {
flag.Usage = func() {
os.Stderr.WriteString(`The stress utility is intended for catching sporadic failures.
It runs a given process in parallel in a loop and collects any failures.
Usage:
$ stress ./fmt.test -test.run=TestSometing -test.cpu=10
`)
flag.PrintDefaults()
}
}
func main() { func main() {
flag.Parse() flag.Parse()
if *flagP <= 0 || *flagTimeout <= 0 || len(flag.Args()) == 0 { if *flagP <= 0 || *flagTimeout <= 0 || len(flag.Args()) == 0 {