Merge pull request #3634 from myk002/myk_moar_tests

enable more tests
develop
Myk 2023-08-05 00:12:33 -07:00 committed by GitHub
commit 708f2ef304
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
14 changed files with 54 additions and 23 deletions

@ -29,6 +29,9 @@ on:
docs: docs:
type: boolean type: boolean
default: false default: false
html:
type: boolean
default: true
stonesense: stonesense:
type: boolean type: boolean
default: false default: false
@ -118,6 +121,7 @@ jobs:
-DBUILD_SIZECHECK:BOOL=${{ inputs.extras }} \ -DBUILD_SIZECHECK:BOOL=${{ inputs.extras }} \
-DBUILD_SKELETON:BOOL=${{ inputs.extras }} \ -DBUILD_SKELETON:BOOL=${{ inputs.extras }} \
-DBUILD_DOCS:BOOL=${{ inputs.docs }} \ -DBUILD_DOCS:BOOL=${{ inputs.docs }} \
-DBUILD_DOCS_NO_HTML:BOOL=${{ !inputs.html }} \
-DBUILD_TESTS:BOOL=${{ inputs.tests }} \ -DBUILD_TESTS:BOOL=${{ inputs.tests }} \
-DBUILD_XMLDUMP:BOOL=${{ inputs.xml-dump-type-sizes }} \ -DBUILD_XMLDUMP:BOOL=${{ inputs.xml-dump-type-sizes }} \
-DINSTALL_DATA_FILES:BOOL=${{ inputs.common-files }} \ -DINSTALL_DATA_FILES:BOOL=${{ inputs.common-files }} \

@ -29,6 +29,9 @@ on:
docs: docs:
type: boolean type: boolean
default: false default: false
html:
type: boolean
default: true
stonesense: stonesense:
type: boolean type: boolean
default: false default: false
@ -91,7 +94,7 @@ jobs:
win-msvc win-msvc
- name: Cross-compile - name: Cross-compile
env: env:
CMAKE_EXTRA_ARGS: '-DBUILD_LIBRARY=${{ inputs.platform-files }} -DBUILD_STONESENSE:BOOL=${{ inputs.stonesense }} -DBUILD_DOCS:BOOL=${{ inputs.docs }} -DINSTALL_DATA_FILES:BOOL=${{ inputs.common-files }} -DINSTALL_SCRIPTS:BOOL=${{ inputs.common-files }} -DBUILD_DFLAUNCH:BOOL=${{ inputs.launchdf }} -DBUILD_TESTS:BOOL=${{ inputs.tests }} -DBUILD_XMLDUMP:BOOL=${{ inputs.xml-dump-type-sizes }}' CMAKE_EXTRA_ARGS: '-DBUILD_LIBRARY=${{ inputs.platform-files }} -DBUILD_STONESENSE:BOOL=${{ inputs.stonesense }} -DBUILD_DOCS:BOOL=${{ inputs.docs }} -DBUILD_DOCS_NO_HTML:BOOL=${{ !inputs.html }} -DINSTALL_DATA_FILES:BOOL=${{ inputs.common-files }} -DINSTALL_SCRIPTS:BOOL=${{ inputs.common-files }} -DBUILD_DFLAUNCH:BOOL=${{ inputs.launchdf }} -DBUILD_TESTS:BOOL=${{ inputs.tests }} -DBUILD_XMLDUMP:BOOL=${{ inputs.xml-dump-type-sizes }}'
run: | run: |
cd build cd build
bash -x build-win64-from-linux.sh bash -x build-win64-from-linux.sh

@ -20,6 +20,8 @@ jobs:
structures_ref: ${{ inputs.structures_ref }} structures_ref: ${{ inputs.structures_ref }}
artifact-name: test-msvc artifact-name: test-msvc
cache-id: test cache-id: test
docs: true
html: false
tests: true tests: true
build-linux: build-linux:
@ -33,6 +35,8 @@ jobs:
cache-id: test cache-id: test
stonesense: ${{ matrix.plugins == 'all' }} stonesense: ${{ matrix.plugins == 'all' }}
extras: ${{ matrix.plugins == 'all' }} extras: ${{ matrix.plugins == 'all' }}
docs: true
html: false
tests: true tests: true
gcc-ver: ${{ matrix.gcc }} gcc-ver: ${{ matrix.gcc }}
secrets: inherit secrets: inherit

@ -30,6 +30,7 @@ else(CMAKE_CONFIGURATION_TYPES)
endif(CMAKE_CONFIGURATION_TYPES) endif(CMAKE_CONFIGURATION_TYPES)
option(BUILD_DOCS "Choose whether to build the documentation (requires python and Sphinx)." OFF) option(BUILD_DOCS "Choose whether to build the documentation (requires python and Sphinx)." OFF)
option(BUILD_DOCS_NO_HTML "Don't build the HTML docs, only the in-game docs." OFF)
option(REMOVE_SYMBOLS_FROM_DF_STUBS "Remove debug symbols from DF stubs. (Reduces libdfhack size to about half but removes a few useful symbols)" ON) option(REMOVE_SYMBOLS_FROM_DF_STUBS "Remove debug symbols from DF stubs. (Reduces libdfhack size to about half but removes a few useful symbols)" ON)
macro(CHECK_GCC compiler_path) macro(CHECK_GCC compiler_path)
@ -468,7 +469,14 @@ if(BUILD_DOCS)
"${CMAKE_CURRENT_SOURCE_DIR}/conf.py" "${CMAKE_CURRENT_SOURCE_DIR}/conf.py"
) )
if(BUILD_DOCS_NO_HTML)
set(SPHINX_OUTPUT "${CMAKE_CURRENT_SOURCE_DIR}/docs/text/index.txt")
set(SPHINX_BUILD_TARGETS text)
else()
set(SPHINX_OUTPUT "${CMAKE_CURRENT_SOURCE_DIR}/docs/html/.buildinfo") set(SPHINX_OUTPUT "${CMAKE_CURRENT_SOURCE_DIR}/docs/html/.buildinfo")
set(SPHINX_BUILD_TARGETS html text)
endif()
set_property( set_property(
DIRECTORY PROPERTY ADDITIONAL_CLEAN_FILES TRUE DIRECTORY PROPERTY ADDITIONAL_CLEAN_FILES TRUE
"${CMAKE_CURRENT_SOURCE_DIR}/docs/changelogs" "${CMAKE_CURRENT_SOURCE_DIR}/docs/changelogs"
@ -485,9 +493,10 @@ if(BUILD_DOCS)
"${CMAKE_BINARY_DIR}/docs/text" "${CMAKE_BINARY_DIR}/docs/text"
"${CMAKE_BINARY_DIR}/docs/xml" "${CMAKE_BINARY_DIR}/docs/xml"
) )
add_custom_command(OUTPUT ${SPHINX_OUTPUT} add_custom_command(OUTPUT ${SPHINX_OUTPUT}
COMMAND "${Python3_EXECUTABLE}" "${CMAKE_CURRENT_SOURCE_DIR}/docs/build.py" COMMAND "${Python3_EXECUTABLE}" "${CMAKE_CURRENT_SOURCE_DIR}/docs/build.py"
html text --sphinx="${SPHINX_EXECUTABLE}" -- -q -W ${SPHINX_BUILD_TARGETS} --sphinx="${SPHINX_EXECUTABLE}" -- -q -W
DEPENDS ${SPHINX_DEPS} DEPENDS ${SPHINX_DEPS}
COMMENT "Building documentation with Sphinx" COMMENT "Building documentation with Sphinx"
) )
@ -500,10 +509,12 @@ if(BUILD_DOCS)
add_custom_command(TARGET dfhack_docs POST_BUILD add_custom_command(TARGET dfhack_docs POST_BUILD
COMMAND ${CMAKE_COMMAND} -E touch ${SPHINX_OUTPUT}) COMMAND ${CMAKE_COMMAND} -E touch ${SPHINX_OUTPUT})
if(NOT BUILD_DOCS_NO_HTML)
install(DIRECTORY ${dfhack_SOURCE_DIR}/docs/html/ install(DIRECTORY ${dfhack_SOURCE_DIR}/docs/html/
DESTINATION ${DFHACK_USERDOC_DESTINATION}/docs DESTINATION ${DFHACK_USERDOC_DESTINATION}/docs
FILES_MATCHING PATTERN "*" FILES_MATCHING PATTERN "*"
PATTERN html/_sources EXCLUDE) PATTERN html/_sources EXCLUDE)
endif()
install(DIRECTORY ${dfhack_SOURCE_DIR}/docs/text/ install(DIRECTORY ${dfhack_SOURCE_DIR}/docs/text/
DESTINATION ${DFHACK_USERDOC_DESTINATION}/docs) DESTINATION ${DFHACK_USERDOC_DESTINATION}/docs)
install(FILES docs/changelogs/news.rst docs/changelogs/news-dev.rst DESTINATION ${DFHACK_USERDOC_DESTINATION}) install(FILES docs/changelogs/news.rst docs/changelogs/news-dev.rst DESTINATION ${DFHACK_USERDOC_DESTINATION})

@ -553,6 +553,7 @@ local function run_tests(tests, status, counts, config)
goto skip goto skip
end end
if not MODES[test.config.mode].detect() then if not MODES[test.config.mode].detect() then
print(('Switching to %s mode for test: %s'):format(test.config.mode, test.name))
local ok, err = pcall(MODES[test.config.mode].navigate, config) local ok, err = pcall(MODES[test.config.mode].navigate, config)
if not ok then if not ok then
MODES[test.config.mode].failed = true MODES[test.config.mode].failed = true

@ -207,7 +207,7 @@ end
-- returns the name of the output file for the given context -- returns the name of the output file for the given context
function get_filename(opts, phase, ordinal) function get_filename(opts, phase, ordinal)
local fullname = 'dfhack-config/blueprints/' .. opts.name local fullname = 'dfhack-config/blueprints/' .. opts.name
local _,_,basename = fullname:find('/([^/]+)/?$') local _,_,basename = opts.name:find('([^/]+)/*$')
if not basename then if not basename then
-- should not happen since opts.name should already be validated -- should not happen since opts.name should already be validated
error(('could not parse basename out of "%s"'):format(fullname)) error(('could not parse basename out of "%s"'):format(fullname))

@ -3,7 +3,7 @@ config.target = 'core'
local gui = require('gui') local gui = require('gui')
local widgets = require('gui.widgets') local widgets = require('gui.widgets')
local fs = defclass(fs, gui.FramedScreen) local fs = defclass(nil, gui.FramedScreen)
fs.ATTRS = { fs.ATTRS = {
frame_style = gui.GREY_LINE_FRAME, frame_style = gui.GREY_LINE_FRAME,
frame_title = 'TestFramedScreen', frame_title = 'TestFramedScreen',

@ -1,4 +1,4 @@
config.target = 'core' --config.target = 'core'
local h = require('helpdb') local h = require('helpdb')

@ -1,3 +1,5 @@
config.target = 'blueprint'
local b = require('plugins.blueprint') local b = require('plugins.blueprint')
-- also covers code shared between parse_gui_commandline and parse_commandline -- also covers code shared between parse_gui_commandline and parse_commandline
@ -117,9 +119,9 @@ function test.parse_gui_commandline()
function() b.parse_gui_commandline({}, {''}) end) function() b.parse_gui_commandline({}, {''}) end)
opts = {} opts = {}
b.parse_gui_commandline(opts, {'imaname', 'dig', 'query'}) b.parse_gui_commandline(opts, {'imaname', 'dig', 'place'})
expect.table_eq({auto_phase=false, format='minimal', split_strategy='none', expect.table_eq({auto_phase=false, format='minimal', split_strategy='none',
name='imaname', dig=true, query=true}, name='imaname', dig=true, place=true},
opts) opts)
expect.error_match('unknown phase', expect.error_match('unknown phase',
@ -203,9 +205,9 @@ function test.do_phase_positive_dims()
function() function()
local spos = {x=10, y=20, z=30} local spos = {x=10, y=20, z=30}
local epos = {x=11, y=21, z=31} local epos = {x=11, y=21, z=31}
b.query(spos, epos, 'imaname') b.place(spos, epos, 'imaname')
expect.eq(1, mock_run.call_count) expect.eq(1, mock_run.call_count)
expect.table_eq({'2', '2', '2', 'imaname', 'query', expect.table_eq({'2', '2', '2', 'imaname', 'place',
'--cursor=10,20,30'}, '--cursor=10,20,30'},
mock_run.call_args[1]) mock_run.call_args[1])
end) end)
@ -217,9 +219,9 @@ function test.do_phase_negative_dims()
function() function()
local spos = {x=11, y=21, z=31} local spos = {x=11, y=21, z=31}
local epos = {x=10, y=20, z=30} local epos = {x=10, y=20, z=30}
b.query(spos, epos, 'imaname') b.place(spos, epos, 'imaname')
expect.eq(1, mock_run.call_count) expect.eq(1, mock_run.call_count)
expect.table_eq({'2', '2', '-2', 'imaname', 'query', expect.table_eq({'2', '2', '-2', 'imaname', 'place',
'--cursor=10,20,31'}, '--cursor=10,20,31'},
mock_run.call_args[1]) mock_run.call_args[1])
end) end)
@ -231,9 +233,9 @@ function test.do_phase_ensure_cursor_is_at_upper_left()
function() function()
local spos = {x=11, y=20, z=30} local spos = {x=11, y=20, z=30}
local epos = {x=10, y=21, z=31} local epos = {x=10, y=21, z=31}
b.query(spos, epos, 'imaname') b.place(spos, epos, 'imaname')
expect.eq(1, mock_run.call_count) expect.eq(1, mock_run.call_count)
expect.table_eq({'2', '2', '2', 'imaname', 'query', expect.table_eq({'2', '2', '2', 'imaname', 'place',
'--cursor=10,20,30'}, '--cursor=10,20,30'},
mock_run.call_args[1]) mock_run.call_args[1])
end) end)
@ -241,16 +243,16 @@ end
function test.get_filename() function test.get_filename()
local opts = {name='a', split_strategy='none'} local opts = {name='a', split_strategy='none'}
expect.eq('blueprints/a.csv', b.get_filename(opts, 'dig', 1)) expect.eq('dfhack-config/blueprints/a.csv', b.get_filename(opts, 'dig', 1))
opts = {name='a/', split_strategy='none'} opts = {name='a/', split_strategy='none'}
expect.eq('blueprints/a/a.csv', b.get_filename(opts, 'dig', 1)) expect.eq('dfhack-config/blueprints/a/a.csv', b.get_filename(opts, 'dig', 1))
opts = {name='a', split_strategy='phase'} opts = {name='a', split_strategy='phase'}
expect.eq('blueprints/a-1-dig.csv', b.get_filename(opts, 'dig', 1)) expect.eq('dfhack-config/blueprints/a-1-dig.csv', b.get_filename(opts, 'dig', 1))
opts = {name='a/', split_strategy='phase'} opts = {name='a/', split_strategy='phase'}
expect.eq('blueprints/a/a-5-dig.csv', b.get_filename(opts, 'dig', 5)) expect.eq('dfhack-config/blueprints/a/a-5-dig.csv', b.get_filename(opts, 'dig', 5))
expect.error_match('could not parse basename', function() expect.error_match('could not parse basename', function()
b.get_filename({name='', split_strategy='none'}) b.get_filename({name='', split_strategy='none'})

@ -1,3 +1,5 @@
config.target = 'cxxrandom'
local rng = require('plugins.cxxrandom') local rng = require('plugins.cxxrandom')
function test.cxxrandom_distributions() function test.cxxrandom_distributions()

@ -1,4 +1,5 @@
config.mode = 'fortress' config.mode = 'fortress'
--config.target = 'orders'
local FILE_PATH_PATTERN = 'dfhack-config/orders/%s.json' local FILE_PATH_PATTERN = 'dfhack-config/orders/%s.json'

@ -1,3 +1,5 @@
config.target = 'workflow'
local workflow = require('plugins.workflow') local workflow = require('plugins.workflow')
function test.job_outputs() function test.job_outputs()

@ -26,6 +26,7 @@
-- crashing the game. -- crashing the game.
config.mode = 'fortress' config.mode = 'fortress'
config.target = {'quickfort', 'blueprint', 'dig-now', 'tiletypes', 'gui/quantum'}
local argparse = require('argparse') local argparse = require('argparse')
local gui = require('gui') local gui = require('gui')

@ -28,7 +28,7 @@ function test.viewscreenDtors()
for name, type in pairs(df) do for name, type in pairs(df) do
if name:startswith('viewscreen') then if name:startswith('viewscreen') then
print('testing', name) print('testing', name)
v = type:new() local v = type:new()
expect.true_(v:delete(), "destructor returned false: " .. name) expect.true_(v:delete(), "destructor returned false: " .. name)
end end
end end