Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
S
Seminar-HFO
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Shashank Suhas
Seminar-HFO
Commits
6f9cffb9
Commit
6f9cffb9
authored
Jul 07, 2017
by
drallensmith
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
May have figured out doing travis tests with two languages
parent
869f1719
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
92 additions
and
83 deletions
+92
-83
.travis.yml
.travis.yml
+2
-0
tests/test_basic.py
tests/test_basic.py
+8
-5
tests/test_with_server.py
tests/test_with_server.py
+82
-78
No files found.
.travis.yml
View file @
6f9cffb9
...
@@ -14,6 +14,7 @@ install:
...
@@ -14,6 +14,7 @@ install:
brew install cartr/qt4/qt
brew install cartr/qt4/qt
;
;
fi
fi
-
sudo pip install nose numpy
os
:
os
:
-
linux
-
linux
-
osx
-
osx
...
@@ -23,3 +24,4 @@ compiler:
...
@@ -23,3 +24,4 @@ compiler:
script
:
script
:
-
mkdir build && cd build
-
mkdir build && cd build
-
cmake -DCMAKE_BUILD_TYPE=RelwithDebInfo .. && make -j4 && make install
-
cmake -DCMAKE_BUILD_TYPE=RelwithDebInfo .. && make -j4 && make install
-
cd .. && nosetests --exe
tests/test_basic.py
View file @
6f9cffb9
...
@@ -3,11 +3,14 @@
...
@@ -3,11 +3,14 @@
import
hfo
import
hfo
hfo_env
=
hfo
.
HFOEnvironment
()
def
test_basic
():
hfo_env
=
hfo
.
HFOEnvironment
()
for
action
in
range
(
hfo
.
NUM_HFO_ACTIONS
):
for
action
in
range
(
hfo
.
NUM_HFO_ACTIONS
):
assert
len
(
hfo_env
.
actionToString
(
action
))
assert
len
(
hfo_env
.
actionToString
(
action
))
for
state
in
range
(
hfo
.
NUM_GAME_STATUS_STATES
):
for
state
in
range
(
hfo
.
NUM_GAME_STATUS_STATES
):
assert
len
(
hfo_env
.
statusToString
(
state
))
assert
len
(
hfo_env
.
statusToString
(
state
))
if
__name__
==
'__main__'
:
test_basic
()
tests/test_with_server.py
View file @
6f9cffb9
...
@@ -8,26 +8,8 @@ import time
...
@@ -8,26 +8,8 @@ import time
import
hfo
import
hfo
test_dir
=
os
.
path
.
dirname
(
os
.
path
.
abspath
(
os
.
path
.
realpath
(
__file__
)))
binary_dir
=
os
.
path
.
normpath
(
test_dir
+
"/../bin"
)
conf_dir
=
os
.
path
.
join
(
binary_dir
,
'teams/base/config/formations-dt'
)
bin_HFO
=
os
.
path
.
join
(
binary_dir
,
"HFO"
)
popen_list
=
[
sys
.
executable
,
"-x"
,
bin_HFO
,
"--offense-agents=1"
,
"--defense-npcs=2"
,
"--offense-npcs=2"
,
"--trials=1"
,
"--headless"
]
HFO_process
=
subprocess
.
Popen
(
popen_list
)
hfo_env
=
hfo
.
HFOEnvironment
()
hfo_env
=
hfo
.
HFOEnvironment
()
time
.
sleep
(
0.2
)
assert
(
HFO_process
.
poll
()
is
None
),
"Failed to start HFO with command '{}'"
.
format
(
" "
.
join
(
popen_list
))
time
.
sleep
(
3
)
def
try_step
():
# if a game ends within ~20 frames, something is wrong...
def
try_step
():
# if a game ends within ~20 frames, something is wrong...
status
=
hfo_env
.
step
()
status
=
hfo_env
.
step
()
...
@@ -37,7 +19,26 @@ def try_step(): # if a game ends within ~20 frames, something is wrong...
...
@@ -37,7 +19,26 @@ def try_step(): # if a game ends within ~20 frames, something is wrong...
return
hfo_env
.
getState
()
return
hfo_env
.
getState
()
try
:
def
test_with_server
():
test_dir
=
os
.
path
.
dirname
(
os
.
path
.
abspath
(
os
.
path
.
realpath
(
__file__
)))
binary_dir
=
os
.
path
.
normpath
(
test_dir
+
"/../bin"
)
conf_dir
=
os
.
path
.
join
(
binary_dir
,
'teams/base/config/formations-dt'
)
bin_HFO
=
os
.
path
.
join
(
binary_dir
,
"HFO"
)
popen_list
=
[
sys
.
executable
,
"-x"
,
bin_HFO
,
"--offense-agents=1"
,
"--defense-npcs=2"
,
"--offense-npcs=2"
,
"--trials=1"
,
"--headless"
]
HFO_process
=
subprocess
.
Popen
(
popen_list
)
time
.
sleep
(
0.2
)
assert
(
HFO_process
.
poll
()
is
None
),
"Failed to start HFO with command '{}'"
.
format
(
" "
.
join
(
popen_list
))
time
.
sleep
(
3
)
try
:
hfo_env
.
connectToServer
(
config_dir
=
conf_dir
)
# using defaults otherwise
hfo_env
.
connectToServer
(
config_dir
=
conf_dir
)
# using defaults otherwise
min_state_size
=
58
+
(
9
*
4
)
min_state_size
=
58
+
(
9
*
4
)
...
@@ -106,7 +107,10 @@ try:
...
@@ -106,7 +107,10 @@ try:
hfo
.
SERVER_DOWN
),
(
"Status is {!s} ({!r}), not SERVER_DOWN"
.
hfo
.
SERVER_DOWN
),
(
"Status is {!s} ({!r}), not SERVER_DOWN"
.
format
(
hfo_env
.
statusToString
(
status
),
status
))
format
(
hfo_env
.
statusToString
(
status
),
status
))
finally
:
finally
:
if
HFO_process
.
poll
()
is
None
:
if
HFO_process
.
poll
()
is
None
:
HFO_process
.
terminate
()
HFO_process
.
terminate
()
os
.
system
(
"killall -9 rcssserver"
)
os
.
system
(
"killall -9 rcssserver"
)
if
__name__
==
'__main__'
:
test_with_server
()
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment