From 2471028227cc3fdbf2a60deaf01c93c16ff12169 Mon Sep 17 00:00:00 2001 From: lethosor Date: Tue, 28 Sep 2021 21:18:50 -0400 Subject: [PATCH] test.lua: Dump some DF globals This should help identify differences in environments, e.g. what the screen resolution is in `PRINT_MODE:TEXT`. The `scripts/gui/blueprint:render_labels` test currently fails in an 80x25 resolution, which implies that our CI is using something else. --- .github/workflows/build.yml | 2 +- ci/test.lua | 19 +++++++++++++++++++ 2 files changed, 20 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 843b8528e..139bff74f 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -89,7 +89,7 @@ jobs: script -qe -c "python ci/run-tests.py --headless --keep-status \"$DF_FOLDER\"" || status=$((status + 1)) python ci/check-rpc.py "$DF_FOLDER/dfhack-rpc.txt" || status=$((status + 2)) mkdir -p artifacts - cp "$DF_FOLDER/test_status.json" "$DF_FOLDER"/*.log artifacts || status=$((status + 4)) + cp "$DF_FOLDER"/test*.json "$DF_FOLDER"/*.log artifacts || status=$((status + 4)) exit $status - name: Upload test artifacts uses: actions/upload-artifact@v1 diff --git a/ci/test.lua b/ci/test.lua index e8573bb3f..9a4a33ef2 100644 --- a/ci/test.lua +++ b/ci/test.lua @@ -72,6 +72,7 @@ arrays. For example: local CONFIG_FILE = 'test_config.json' local STATUS_FILE = 'test_status.json' +local DF_STATE_FILE = 'test_df_state.json' local TestStatus = { PENDING = 'pending', PASSED = 'passed', @@ -569,6 +570,23 @@ local function run_tests(tests, status, counts, config) save_test_status(status) end +local function dump_df_state() + local state = { + enabler = { + fps = df.global.enabler.fps, + gfps = df.global.enabler.gfps, + fullscreen = df.global.enabler.fullscreen, + }, + gps = { + dimx = df.global.gps.dimx, + dimy = df.global.gps.dimy, + display_frames = df.global.gps.display_frames, + }, + } + json.encode_file(state, DF_STATE_FILE) + print('DF global state: ' .. json.encode(state, {pretty = false})) +end + local function main(args) local help, resume, test_dir, mode_filter, save_dir, test_filter = false, false, nil, {}, nil, {} @@ -610,6 +628,7 @@ local function main(args) file_errors = 0, } + dump_df_state() local test_files = get_test_files(config.test_dir) local tests = get_tests(test_files, counts) local status = filter_tests(tests, config)