Skip to content

Commit

Permalink
we need to include a timeout for the go test execution
Browse files Browse the repository at this point in the history
  • Loading branch information
zimmski committed Dec 28, 2014
1 parent 0403644 commit 211e427
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 3 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ TODO
* https://github.com/StefanSchroeder/Golang-Mutation-testing
* drittes -> siehe git clone ordner
* https://groups.google.com/forum/?fromgroups=#!topic/golang-nuts/R2VCbCPA6ZE auch erwähnen
+ Timeouts sind erfolgreiche Fehler, daher wenn ein Timeout passiert wegen eine Mutation ist es ein PASS für die mutation
DONE- Wir wollen folgendes unterstützen
+ Statements löschen die löschbar sind, das heißt
* Keine Deklarationen aller Art
Expand Down
6 changes: 4 additions & 2 deletions cmd/go-mutesting/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,8 @@ var opts struct {
} `group:"Mutator options"`

Exec struct {
Exec string `long:"exec" description:"Execute this command for every mutation"`
Exec string `long:"exec" description:"Execute this command for every mutation"`
Timeout uint `long:"exec-timeout" description:"Sets a timeout for the command execution (in seconds)" default:"10"`
} `group:"Exec options"`

Remaining struct {
Expand Down Expand Up @@ -214,8 +215,9 @@ MUTATOR:
execCommand.Stdout = os.Stdout

execCommand.Env = append(os.Environ(), []string{
"MUTATE_ORIGINAL=" + file,
"MUTATE_CHANGED=" + mutationFile,
"MUTATE_ORIGINAL=" + file,
fmt.Sprintf("MUTATE_TIMEOUT=%d", opts.Exec.Timeout),
}...)

err = execCommand.Start()
Expand Down
4 changes: 3 additions & 1 deletion scripts/simple.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@ export GOMUTESTING_DIFF=$(diff -u $MUTATE_ORIGINAL $MUTATE_CHANGED)
mv $MUTATE_ORIGINAL $MUTATE_ORIGINAL.tmp
cp $MUTATE_CHANGED $MUTATE_ORIGINAL

go test ./... > /dev/null
export MUTATE_TIMEOUT=${MUTATE_TIMEOUT:-10}

go test -timeout $(printf '%ds' $MUTATE_TIMEOUT) ./... > /dev/null

export GOMUTESTING_RESULT=$?

Expand Down

0 comments on commit 211e427

Please sign in to comment.