oats 0.0.6 → 0.0.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/Gemfile +0 -1
- data/bin/agent +43 -53
- data/doc/oats_httpd.conf +12 -4
- data/lib/oats/driver.rb +4 -3
- data/lib/oats/ragent.rb +1 -1
- data/lib/oats/{oats.rb → user_api.rb} +2 -1
- data/lib/oats/version.rb +1 -1
- data/lib/oats.rb +1 -2
- metadata +4 -4
data/Gemfile
CHANGED
@@ -11,7 +11,6 @@ unless defined?(OATS_GEM_IS_ALREADY_INCLUDED)
|
|
11
11
|
end
|
12
12
|
test_gemfile = $oats_execution['options'][ "_:gemfile"] if $oats_execution and $oats_execution['options']
|
13
13
|
test_gemfile ||= ENV['OATS_TESTS'] + '/Gemfile'
|
14
|
-
puts "AUT Gemfile :" + test_gemfile
|
15
14
|
if File.exist?(test_gemfile)
|
16
15
|
puts "Including AUT Gemfile: " + test_gemfile
|
17
16
|
eval(IO.read(test_gemfile), binding)
|
data/bin/agent
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
#!/bin/bash
|
2
2
|
# This script is used to start OATS in agent mode and communicate with OCC.
|
3
3
|
|
4
|
-
[ "$OS" ] || export OS=$(uname)
|
4
|
+
[ "$OS" ] || export OS=$(uname)
|
5
5
|
if [ "$OS" == "Windows_NT" ]; then
|
6
6
|
export PATH="$PATH:/cygdrive/c/apps/cygwin/bin"
|
7
7
|
[ "$HOSTNAME" ] || HOSTNAME="$COMPUTERNAME"
|
@@ -14,14 +14,14 @@ doc="
|
|
14
14
|
Starts OATS agent to be used with OCC
|
15
15
|
|
16
16
|
USAGE: agent [-k[ill]] [-n[ickname] OATS_AGENT_NICKNAME] [ -p[ort] OATS_AGENT_PORT ]
|
17
|
-
[ -r[epo]
|
17
|
+
[ -r[epo] OATS_TESTS_REPOSITORY_VERSION ] [ -u OATS_USER]
|
18
18
|
|
19
19
|
Parameters: (also can be passed in via environment variables
|
20
20
|
-n OATS_AGENT_NICKNAME OCC ID of the agent.
|
21
21
|
-p OATS_AGENT_PORT Agent port to communicate with OCC. Default is port previously
|
22
22
|
used for OATS_AGENT_NICKNAME.
|
23
23
|
-u OATS_USER who started the agent. Used for logging purposes only.
|
24
|
-
-r
|
24
|
+
-r OATS_TESTS_REPOSITORY_VERSION Required to update the agent.
|
25
25
|
-k kill the agent, or set OATS_KILL_AGENT
|
26
26
|
-d DISPLAY_NUM Number of the VNC Display, for Linux only
|
27
27
|
|
@@ -29,7 +29,7 @@ Example:
|
|
29
29
|
/home/occadmin/oats/bin/agent -p 3011 -n occ_1 -r 403cc620c265db84dbd3fb7d7cce4d57416bff09
|
30
30
|
|
31
31
|
The agent script should be in the path so that ssh from occ can pick it up.
|
32
|
-
Git requires definition of
|
32
|
+
Git requires definition of OATS_TESTS_GIT_REPOSITORY environment variable.
|
33
33
|
"
|
34
34
|
input_pars="$@"
|
35
35
|
while [ "$1" ]; do
|
@@ -38,7 +38,7 @@ while [ "$1" ]; do
|
|
38
38
|
-n*) shift; OATS_AGENT_NICKNAME="$1" ;;
|
39
39
|
-u*) shift; OATS_USER="$1" ;;
|
40
40
|
-k*) OATS_KILL_AGENT='OATS_KILL_AGENT' ;;
|
41
|
-
-r*) shift;
|
41
|
+
-r*) shift; OATS_TESTS_REPOSITORY_VERSION="$1" ;;
|
42
42
|
-d*) shift; DISPLAY_NUM="$1" ;;
|
43
43
|
*) echo "Unrecognized parameter: $1" ;
|
44
44
|
echo "$doc"
|
@@ -60,22 +60,12 @@ function fkill {
|
|
60
60
|
}
|
61
61
|
|
62
62
|
{
|
63
|
-
agent_echo "$0 $input_pars"
|
63
|
+
agent_echo "Invoking $0 $input_pars"
|
64
64
|
|
65
65
|
# Need these off when called by OCC, otherwise they OCC values are inherited
|
66
66
|
unset RUBYOPT BUNDLE_BIN_PATH BUNDLE_GEMFILE # GEM_HOME GEM_PATH # RAILS_ENV
|
67
|
-
|
68
|
-
|
69
|
-
OATS_HOME=$PWD
|
70
|
-
fi
|
71
|
-
[ "$OATS_GIT_REPOSITORY" ] && OATS_HOME="$HOME/results_archive/$OATS_AGENT_NICKNAME"/oats
|
72
|
-
export OATS_HOME
|
73
|
-
export OATS_AGENT_LOGFILE="$logFile"
|
74
|
-
oats_bin="$OATS_HOME/bin"
|
75
|
-
# [ "$OS" == "Windows_NT" ] && oats_bin=$(cygpath -w $oats_bin)
|
76
|
-
# ruby_com="$oats_bin/oats -n $OATS_AGENT_NICKNAME -p $OATS_AGENT_PORT"
|
77
|
-
ruby_com="oats -n $OATS_AGENT_NICKNAME -p $OATS_AGENT_PORT"
|
78
|
-
export PATH="$PATH:$OATS_HOME/bin:$OATS_HOME/bin/$OS"
|
67
|
+
[ "$OATS_TESTS_GIT_REPOSITORY" ] && export OATS_TESTS="$HOME/results_archive/$OATS_AGENT_NICKNAME"/oats_tests
|
68
|
+
ruby_com="$(dirname $(type -p $0))/oats -n $OATS_AGENT_NICKNAME -p $OATS_AGENT_PORT"
|
79
69
|
if [ -e "$config_agent_file" ]; then
|
80
70
|
line=$(grep "^$OATS_AGENT_NICKNAME" "$config_agent_file")
|
81
71
|
read nickname PREV_OATS_AGENT_PORT pid display<<< $line
|
@@ -92,7 +82,7 @@ function fkill {
|
|
92
82
|
fi
|
93
83
|
if [ -z "$OATS_AGENT_PORT" ]; then
|
94
84
|
agent_echo "$0: Must specify a port, exiting..." >&2
|
95
|
-
|
85
|
+
exit 1
|
96
86
|
fi
|
97
87
|
|
98
88
|
[ "$OATS_AGENT_PORT" == "$PREV_OATS_AGENT_PORT" ] && PREV_OATS_AGENT_PORT=''
|
@@ -129,16 +119,32 @@ function fkill {
|
|
129
119
|
done
|
130
120
|
[ "$OATS_KILL_AGENT" ] && return
|
131
121
|
|
132
|
-
if [
|
133
|
-
|
134
|
-
|
135
|
-
|
122
|
+
if [ -d $OATS_TESTS/.svn ]; then
|
123
|
+
COUNTER=0
|
124
|
+
[ "$OATS_TESTS_REPOSITORY_VERSION" ] && agent_echo "Requested OATS Version: $OATS_TESTS_REPOSITORY_VERSION"
|
125
|
+
while [ $COUNTER -lt 5 ]; do
|
126
|
+
let COUNTER=COUNTER+1
|
127
|
+
OATS_TESTS_CODE_VERSION=$(svn info $OATS_TESTS | sed -n 's/Last Changed Rev: *//p')
|
128
|
+
[ "$OATS_TESTS_REPOSITORY_VERSION" ] || break
|
129
|
+
[ "$OATS_TESTS_CODE_VERSION" -ge "$OATS_TESTS_REPOSITORY_VERSION" ] && break
|
130
|
+
[ $COUNTER -eq 1 ] || sleep 3
|
131
|
+
svn update $OATS_TESTS 2>&1
|
132
|
+
done
|
133
|
+
if [ $COUNTER -eq 5 ]; then
|
134
|
+
agent_echo "Could not update the code version $OATS_TESTS_CODE_VERSION to $OATS_TESTS_REPOSITORY_VERSION" >&2
|
135
|
+
return 2
|
136
|
+
fi
|
137
|
+
agent_echo "Current OATS code version: $OATS_TESTS_CODE_VERSION"
|
138
|
+
elif [ "$OATS_TESTS_GIT_REPOSITORY" ]; then
|
139
|
+
[ -d $OATS_TESTS ] || git clone $OATS_TESTS_GIT_REPOSITORY $OATS_TESTS
|
140
|
+
cd $OATS_TESTS
|
141
|
+
origin="$OATS_TESTS_GIT_REPOSITORY"
|
136
142
|
[ "$origin" ] || origin=origin
|
137
|
-
if [ "$
|
143
|
+
if [ "$OATS_TESTS_REPOSITORY_VERSION" ]; then
|
138
144
|
for i in 1 2; do
|
139
|
-
out=$(git checkout $
|
140
|
-
if [ "$out" == "fatal: reference is not a tree: $
|
141
|
-
echo -n "Need to pull requested version: $
|
145
|
+
out=$(git checkout $OATS_TESTS_REPOSITORY_VERSION 2>&1) && break # may detach HEAD, but it is OK
|
146
|
+
if [ "$out" == "fatal: reference is not a tree: $OATS_TESTS_REPOSITORY_VERSION" ]; then
|
147
|
+
echo -n "Need to pull requested version: $OATS_TESTS_REPOSITORY_VERSION "
|
142
148
|
else
|
143
149
|
echo "$out"
|
144
150
|
fi
|
@@ -147,33 +153,17 @@ function fkill {
|
|
147
153
|
else
|
148
154
|
git pull $origin master # fast-forward master from origin
|
149
155
|
fi
|
150
|
-
|
151
|
-
if [ "${
|
152
|
-
agent_echo "Could not update the code version $
|
153
|
-
return 2
|
154
|
-
fi
|
155
|
-
[ "$OATS_REPOSITORY_VERSION" ] || agent_echo "Using OATS code version: $OATS_CODE_VERSION"
|
156
|
-
elif [ -d .svn ]; then
|
157
|
-
COUNTER=0
|
158
|
-
[ "$OATS_REPOSITORY_VERSION" ] && agent_echo "Requested OATS Version: $OATS_REPOSITORY_VERSION"
|
159
|
-
while [ $COUNTER -lt 5 ]; do
|
160
|
-
let COUNTER=COUNTER+1
|
161
|
-
OATS_CODE_VERSION=$(svn info $OATS_HOME | sed -n 's/Last Changed Rev: *//p')
|
162
|
-
[ "$OATS_REPOSITORY_VERSION" ] || break
|
163
|
-
[ "$OATS_CODE_VERSION" -ge "$OATS_REPOSITORY_VERSION" ] && break
|
164
|
-
[ $COUNTER -eq 1 ] || sleep 3
|
165
|
-
svn update $OATS_HOME 2>&1
|
166
|
-
done
|
167
|
-
if [ $COUNTER -eq 5 ]; then
|
168
|
-
agent_echo "Could not update the code version $OATS_CODE_VERSION to $OATS_REPOSITORY_VERSION" >&2
|
156
|
+
OATS_TESTS_CODE_VERSION=$(git rev-list HEAD -1) # last commit in checked out version
|
157
|
+
if [ "${OATS_TESTS_CODE_VERSION##$OATS_TESTS_REPOSITORY_VERSION*}" ]; then
|
158
|
+
agent_echo "Could not update the code version $OATS_TESTS_CODE_VERSION to $OATS_TESTS_REPOSITORY_VERSION" >&2
|
169
159
|
return 2
|
170
160
|
fi
|
171
|
-
agent_echo "
|
161
|
+
[ "$OATS_TESTS_REPOSITORY_VERSION" ] || agent_echo "Using OATS code version: $OATS_TESTS_CODE_VERSION"
|
172
162
|
else
|
173
|
-
|
174
|
-
[ "$
|
163
|
+
OATS_TESTS_CODE_VERSION=$OATS_TESTS_REPOSITORY_VERSION
|
164
|
+
[ "$OATS_TESTS_CODE_VERSION" ] && agent_echo "Setting OATS code version to the requested version: $OATS_TESTS_CODE_VERSION]" # This is not set for development/debug
|
175
165
|
fi
|
176
|
-
export
|
166
|
+
export OATS_TESTS_CODE_VERSION
|
177
167
|
# echo "$OATS_AGENT_NICKNAME $OATS_AGENT_PORT" >| $config_agent_file
|
178
168
|
if [ "$OS" == "Linux" ]; then # Do this with VNC displays
|
179
169
|
# Allocate 2x as display. VNC takes 592x, vino takes next available from 59++
|
@@ -187,9 +177,9 @@ function fkill {
|
|
187
177
|
cd $OATS_HOME # Needed for bundler
|
188
178
|
agent_echo "Starting agent $OATS_AGENT_NICKNAME on port $OATS_AGENT_PORT"
|
189
179
|
$ruby_com
|
190
|
-
} >> $
|
180
|
+
} >> $OATS_AGENT_LOGFILE 2>&1 &
|
191
181
|
|
192
182
|
PID=$(jobs -p)
|
193
|
-
echo "Initiated PID: $PID" >> $
|
183
|
+
echo "Initiated PID: $PID" >> $OATS_AGENT_LOGFILE
|
194
184
|
echo "$PID"
|
195
|
-
echo "$OATS_AGENT_NICKNAME $OATS_AGENT_PORT $PID $DISPLAY_NUM" >| $
|
185
|
+
echo "$OATS_AGENT_NICKNAME $OATS_AGENT_PORT $PID $DISPLAY_NUM" >| $OATS_AGENT_CONFIG_FILE
|
data/doc/oats_httpd.conf
CHANGED
@@ -11,6 +11,12 @@
|
|
11
11
|
Order allow,deny
|
12
12
|
Allow from all
|
13
13
|
</Directory>
|
14
|
+
<Directory "/home/occadmin/oats_tests">
|
15
|
+
Options Indexes FollowSymLinks
|
16
|
+
AllowOverride None
|
17
|
+
Order allow,deny
|
18
|
+
Allow from all
|
19
|
+
</Directory>
|
14
20
|
<Directory "/home/occadmin/results">
|
15
21
|
Options Indexes FollowSymLinks
|
16
22
|
AllowOverride None
|
@@ -23,10 +29,12 @@
|
|
23
29
|
Order allow,deny
|
24
30
|
Allow from all
|
25
31
|
</Directory>
|
26
|
-
|
32
|
+
|
33
|
+
# Point this alias to the test folders of AUT or use a link
|
27
34
|
#Alias /oats/tests <FolderOfYourApplicationUnderTest>
|
35
|
+
Alias /oats/tests /home/occadmin/oats_tests
|
28
36
|
Alias /oats /home/occadmin/oats
|
29
|
-
Alias /r /home/occadmin/results
|
30
|
-
Alias /a /home/occadmin/results_archive
|
31
|
-
ServerAdmin
|
37
|
+
Alias /oats/r /home/occadmin/results
|
38
|
+
Alias /oats/a /home/occadmin/results_archive
|
39
|
+
ServerAdmin OccAdminO@your.com
|
32
40
|
DocumentRoot "/home/occadmin/results_archive"
|
data/lib/oats/driver.rb
CHANGED
@@ -12,17 +12,17 @@ module Oats
|
|
12
12
|
def Driver.agent
|
13
13
|
ENV['KILL_AGENT' ] = 'KILL_AGENT' if $oats_execution['options']["_:kill_agent"]
|
14
14
|
ENV['OATS_USER' ] = $oats_execution['options']["_:oats_user"] if $oats_execution['options']["_:oats_user"]
|
15
|
-
ENV['
|
15
|
+
ENV['OATS_TESTS_REPOSITORY_VERSION' ] = $oats_execution['options']["_:repository_version"] if $oats_execution['options']["_:repository_version"]
|
16
16
|
nick = $oats_execution['options']["execution:occ:agent_nickname"]
|
17
17
|
ENV['OATS_AGENT_NICKNAME' ] = nick if nick
|
18
18
|
port = $oats_execution['options']["execution:occ:agent_port"].to_s
|
19
19
|
ENV['OATS_AGENT_PORT'] = port if port
|
20
20
|
dir = ENV['HOME'] + "/results_archive/#{nick}/agent_logs"
|
21
21
|
FileUtils.mkdir_p(dir) unless File.exists?(dir)
|
22
|
-
ENV['
|
22
|
+
ENV['OATS_AGENT_CONFIG_FILE'] = "#{dir}/config-agent.txt"
|
23
23
|
dat = `date +'%m%d%H%M%S'`.chomp
|
24
24
|
log_file = "#{dir}/agent_#{dat}.log"
|
25
|
-
ENV['
|
25
|
+
ENV['OATS_AGENT_LOGFILE'] = log_file
|
26
26
|
agent_log_file = "#{dir}/agent.log"
|
27
27
|
cmd = ENV['OATS_HOME'] + '/bin/agent'
|
28
28
|
pid = `#{cmd}`.chomp
|
@@ -191,6 +191,7 @@ module Oats
|
|
191
191
|
# oats_data['_']['load_history'].last.omit = true
|
192
192
|
when /\.xls$/
|
193
193
|
suite = id
|
194
|
+
require 'spreadsheet' unless defined?(Spreadsheet)
|
194
195
|
book = Spreadsheet.open test_yaml
|
195
196
|
tests = $oats_global['xl']
|
196
197
|
unless tests and tests[id]
|
data/lib/oats/ragent.rb
CHANGED
@@ -222,7 +222,7 @@ module Oats
|
|
222
222
|
'machine' => occ['agent_host'],
|
223
223
|
'port' => occ['agent_port'] }
|
224
224
|
query['jobid'] = prev_jobid if prev_jobid
|
225
|
-
query['repo'] = ENV['
|
225
|
+
query['repo'] = ENV['OATS_TESTS_CODE_VERSION'].to_s if ENV['OATS_TESTS_CODE_VERSION'] and ENV['OATS_TESTS_CODE_VERSION'] != ''
|
226
226
|
query['logfile'] = File.basename(ENV['OATS_AGENT_LOGFILE']||'agent.log')
|
227
227
|
Ragent.server_logger ra, "Getting next OCC job: " + query.inspect
|
228
228
|
query['password='] = ra.request[:password] if ra and ra.request[:password]
|
@@ -1,7 +1,8 @@
|
|
1
1
|
require 'oats/util'
|
2
2
|
require 'oats/oats_exceptions'
|
3
|
+
|
3
4
|
# Need these set for OCC when this is required from OCC
|
4
|
-
ENV['OATS_HOME'] ||= File.expand_path( '
|
5
|
+
ENV['OATS_HOME'] ||= File.expand_path( '../..', File.dirname(__FILE__) )
|
5
6
|
ENV['OATS_TESTS'] ||= (ENV['OATS_HOME'] + '/oats_tests')
|
6
7
|
|
7
8
|
module Oats
|
data/lib/oats/version.rb
CHANGED
data/lib/oats.rb
CHANGED
@@ -32,5 +32,4 @@ require 'log4r' # http://log4r.sourceforge.net/rdoc/index.html
|
|
32
32
|
require 'oats/driver'
|
33
33
|
require 'oats/oats_lock'
|
34
34
|
|
35
|
-
|
36
|
-
require 'oats/oats' # Interface methods to user methods implemented in other modules
|
35
|
+
require 'oats/user_api' # Interface methods to user methods implemented in other modules
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: oats
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 17
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 0
|
9
|
-
-
|
10
|
-
version: 0.0.
|
9
|
+
- 7
|
10
|
+
version: 0.0.7
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Levent Atasoy
|
@@ -165,7 +165,6 @@ files:
|
|
165
165
|
- lib/oats/keywords.rb
|
166
166
|
- lib/oats/log4r_init.rb
|
167
167
|
- lib/oats/mysql.rb
|
168
|
-
- lib/oats/oats.rb
|
169
168
|
- lib/oats/oats_data.rb
|
170
169
|
- lib/oats/oats_exceptions.rb
|
171
170
|
- lib/oats/oats_lock.rb
|
@@ -181,6 +180,7 @@ files:
|
|
181
180
|
- lib/oats/test_data.rb
|
182
181
|
- lib/oats/test_list.rb
|
183
182
|
- lib/oats/unixdiff.rb
|
183
|
+
- lib/oats/user_api.rb
|
184
184
|
- lib/oats/util.rb
|
185
185
|
- lib/oats/version.rb
|
186
186
|
- nbproject/configs/agent-n.properties
|