Add test runner

develop
lethosor 2018-02-04 16:00:53 -05:00
parent 23efb1cbf1
commit 2af5f7ab87
4 changed files with 45 additions and 4 deletions

@ -48,8 +48,9 @@ script:
- cmake .. -DCMAKE_C_COMPILER=gcc-$GCC_VERSION -DCMAKE_CXX_COMPILER=g++-$GCC_VERSION -DDFHACK_BUILD_ARCH=64 -DBUILD_DOCS:BOOL=ON -DCMAKE_INSTALL_PREFIX="$DF_FOLDER"
- make -j3 install
- mv "$DF_FOLDER"/dfhack.init-example "$DF_FOLDER"/dfhack.init
- cp ../travis/dfhack_travis.init "$DF_FOLDER"/
- "$DF_FOLDER/dfhack"
- cd ..
- cp travis/dfhack_travis.init "$DF_FOLDER"/
- python travis/run-tests.py "$DF_FOLDER"
notifications:
email: false
# irc:

@ -0,0 +1,10 @@
function set_test_stage(stage)
local f = io.open('test_stage.txt', 'w')
f:write(stage)
f:close()
end
print('running tests')
set_test_stage('done')
dfhack.run_command('die')

@ -1,2 +1,2 @@
devel/check-release
:lua scr.breakdown_level=df.interface_breakdown_types.QUIT
:lua dfhack.internal.addScriptPath(os.getenv('TRAVIS_BUILD_DIR'))
test/main

@ -0,0 +1,30 @@
import os, subprocess, sys
MAX_TRIES = 5
dfhack = 'Dwarf Fortress.exe' if sys.platform == 'win32' else './dfhack'
test_stage = 'test_stage.txt'
def get_test_stage():
if os.path.isfile(test_stage):
return open(test_stage).read().strip()
return '0'
os.chdir(sys.argv[1])
if os.path.exists(test_stage):
os.remove(test_stage)
tries = 0
while True:
tries += 1
stage = get_test_stage()
print('Run #%i: stage=%s' % (tries, get_test_stage()))
if stage == 'done':
print('Done!')
os.remove(test_stage)
sys.exit(0)
if tries > MAX_TRIES:
print('Too many tries - aborting')
sys.exit(1)
os.system(dfhack)