File: git_bisect_run_general.sh

package info (click to toggle)
jruby 9.4.12.0%2Bds-1~exp1
  • links: PTS, VCS
  • area: main
  • in suites: experimental
  • size: 89,468 kB
  • sloc: ruby: 550,612; java: 276,882; yacc: 25,873; ansic: 6,285; xml: 6,172; sh: 1,775; sed: 94; makefile: 76; jsp: 48; tcl: 40; exp: 12
file content (72 lines) | stat: -rwxr-xr-x 1,112 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
#!/usr/bin/env bash

# simple script for use with 'git bisect run'
# e.g., git bisect run tool/git_bisect_run.sh 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

print_var 'PRE_COMMAND'
${PRE_COMMAND}

build

print_var 'COMMAND'
./bin/jruby ${COMMAND}
EXIT_STATUS=$?

print_var 'POST_COMMAND'
${POST_COMMAND}
exit ${EXIT_STATUS}