-
-
Notifications
You must be signed in to change notification settings - Fork 920
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Make git_bisect_run_general.sh more general purpose, with pre- and po…
…st-commands to run around "ant clean jar".
- Loading branch information
Showing
2 changed files
with
66 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,72 @@ | ||
#! /bin/sh | ||
#! /bin/bash | ||
|
||
# simple script for use with 'git bisect run' | ||
# e.g., git bisect run tool/git_bisect_run_mspec.sh <args> | ||
# arguments will be passed on to jruby | ||
# e.g., git bisect run tool/git_bisect_run.sh -T--1.9 spec/ruby/language/defined_spec.rb | ||
|
||
PRE_COMMAND='' | ||
POST_COMMAND='' | ||
COMMAND='-v' # an empty $COMMAND will put the script in interactive mode, which may be confusing | ||
V='' | ||
|
||
function print_usage { | ||
echo "usage: $0 [-c command] [-p pre] [-P post] [-v]" | ||
} | ||
|
||
function build { | ||
ant clean jar | ||
if [ $? -gt 0 ]; then | ||
exit 125 | ||
fi | ||
} | ||
|
||
function print_var { | ||
if [[ -n $V ]]; then | ||
eval "VAR=\$$1" | ||
echo "$1: $VAR" | ||
fi | ||
} | ||
|
||
# opts | ||
while getopts "c:hp:P:v" opt; do | ||
case $opt in | ||
c) | ||
COMMAND=${OPTARG} | ||
if [[ -z $COMMAND ]]; then | ||
echo "COMMAND is empty. Aborting." | ||
exit 1 | ||
fi | ||
;; | ||
h) | ||
print_usage | ||
exit 0 | ||
;; | ||
p) | ||
PRE_COMMAND=${OPTARG} | ||
;; | ||
P) | ||
POST_COMMAND=${OPTARG} | ||
;; | ||
v) | ||
V='VERBOSE' | ||
;; | ||
esac | ||
done | ||
|
||
cd `dirname $0`/.. | ||
if [ ! -e spec/mspec ]; then | ||
ant fetch-stable-specs | ||
fi | ||
|
||
ant clean jar | ||
if [ $? -gt 0 ]; then | ||
exit 125 | ||
fi | ||
./bin/jruby $* | ||
print_var 'PRE_COMMAND' | ||
${PRE_COMMAND} | ||
|
||
build | ||
|
||
print_var 'COMMAND' | ||
./bin/jruby ${COMMAND} | ||
EXIT_STATUS=$? | ||
|
||
print_var 'POST_COMMAND' | ||
${POST_COMMAND} | ||
exit ${EXIT_STATUS} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,4 @@ | ||
#! /bin/sh | ||
|
||
# simple script for use with 'git bisect run' | ||
# e.g., git bisect run tool/git_bisect_run_mspec.sh -T--1.9 spec/ruby/language/defined_spec.rb | ||
# arguments will be passed on to mspec. | ||
|
||
cd `dirname $0`/.. | ||
if [ ! -e spec/mspec ]; then | ||
ant fetch-stable-specs | ||
fi | ||
|
||
ant clean jar | ||
jruby spec/mspec/bin/mspec $* | ||
# see git_bisect_run_general.sh for more explanation | ||
exec `dirname $0`/git_bisect_run_general.sh -c "spec/mspec/bin/mspec $*" |