Commit 6f9cffb9 authored by drallensmith's avatar drallensmith

May have figured out doing travis tests with two languages

parent 869f1719
......@@ -14,6 +14,7 @@ install:
brew install cartr/qt4/qt
;
fi
- sudo pip install nose numpy
os:
- linux
- osx
......@@ -23,3 +24,4 @@ compiler:
script:
- mkdir build && cd build
- cmake -DCMAKE_BUILD_TYPE=RelwithDebInfo .. && make -j4 && make install
- cd .. && nosetests --exe
......@@ -3,11 +3,14 @@
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))
for state in range(hfo.NUM_GAME_STATUS_STATES):
for state in range(hfo.NUM_GAME_STATUS_STATES):
assert len(hfo_env.statusToString(state))
if __name__ == '__main__':
test_basic()
......@@ -8,26 +8,8 @@ import time
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()
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...
status = hfo_env.step()
......@@ -37,7 +19,26 @@ def try_step(): # if a game ends within ~20 frames, something is wrong...
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
min_state_size = 58+(9*4)
......@@ -106,7 +107,10 @@ try:
hfo.SERVER_DOWN), ("Status is {!s} ({!r}), not SERVER_DOWN".
format(hfo_env.statusToString(status), status))
finally:
finally:
if HFO_process.poll() is None:
HFO_process.terminate()
os.system("killall -9 rcssserver")
if __name__ == '__main__':
test_with_server()
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment