Skip to content

Instantly share code, notes, and snippets.

@davecheney
Created June 18, 2013 23:22
Show Gist options
  • Select an option

  • Save davecheney/5810404 to your computer and use it in GitHub Desktop.

Select an option

Save davecheney/5810404 to your computer and use it in GitHub Desktop.
usage: cd $PACKAGE; bash stress.bash
#!/bin/bash
set -e
eval $(go env)
export GOROOT
pkgs() {
go list std | grep -v cmd
}
rand() {
echo $[ 1 + $[ RANDOM % $[ $1 - 1 ] ] ]
}
pkgs | xargs -n 1 -P 4 -I % sh -c 'cd $GOROOT/src/pkg/$0 && go test -v -c' %
while true ; do
pkgs | xargs -n1 -P $(rand 8) -I % -t bash -xe -c \
'cd $GOROOT/src/pkg/$0 && if [ -x $(basename $0).test ] ; then GOMAXPROCS=$1 $GOROOT/src/pkg/$0/$(basename $0).test || exit 255; fi ' % $(rand 128)
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment