Test all maps in parallel integration tests (#66864)

This commit is contained in:
Tastyfish
2022-05-12 00:12:02 -07:00
committed by GitHub
parent 20c6c11943
commit d8d29f6701
6 changed files with 61 additions and 2 deletions
+2
View File
@@ -46,6 +46,7 @@
#define UNIT_TEST_FAILED 1
#define UNIT_TEST_SKIPPED 2
#define TEST_PRE 0
#define TEST_DEFAULT 1
#define TEST_DEL_WORLD INFINITY
@@ -100,6 +101,7 @@
#include "keybinding_init.dm"
#include "load_map_security.dm"
#include "machine_disassembly.dm"
#include "mapping.dm"
#include "medical_wounds.dm"
#include "merge_type.dm"
#include "metabolizing.dm"
+19
View File
@@ -0,0 +1,19 @@
/// Conveys all log_mapping messages as unit test failures, as they all indicate mapping problems.
/datum/unit_test/log_mapping
// Happen before all other tests, to make sure we only capture normal mapping logs.
priority = TEST_PRE
/datum/unit_test/log_mapping/Run()
var/static/regex/test_areacoord_regex = regex(@"\(-?\d+,-?\d+,(-?\d+)\)")
for(var/log_entry in GLOB.unit_test_mapping_logs)
// Only fail if AREACOORD was conveyed, and it's a station or mining z-level.
// This is due to mapping errors don't have coords being impossible to diagnose as a unit test,
// and various ruins frequently intentionally doing non-standard things.
if(!test_areacoord_regex.Find(log_entry))
continue
var/z = text2num(test_areacoord_regex.group[1])
if(!is_station_level(z) && !is_mining_level(z))
continue
TEST_FAIL(log_entry)
+4 -1
View File
@@ -14,6 +14,8 @@ You can use the run_loc_floor_bottom_left and run_loc_floor_top_right to get tur
GLOBAL_DATUM(current_test, /datum/unit_test)
GLOBAL_VAR_INIT(failed_any_test, FALSE)
GLOBAL_VAR(test_log)
/// When unit testing, all logs sent to log_mapping are stored here and retrieved in log_mapping unit test.
GLOBAL_LIST_EMPTY(unit_test_mapping_logs)
/datum/unit_test
//Bit of metadata for the future maybe
@@ -98,6 +100,7 @@ GLOBAL_VAR(test_log)
"[test.succeeded ? TEST_OUTPUT_GREEN("PASS") : TEST_OUTPUT_RED("FAIL")]: [test_path] [duration / 10]s",
)
var/list/fail_reasons = test.fail_reasons
var/map_name = SSmapping.config.map_name
for(var/reasonID in 1 to LAZYLEN(fail_reasons))
var/text = fail_reasons[reasonID][1]
@@ -111,7 +114,7 @@ GLOBAL_VAR(test_log)
var/annotation_text = replacetext(text, "%", "%25")
annotation_text = replacetext(annotation_text, "\n", "%0A")
log_world("::error file=[file],line=[line],title=[test_path]::[annotation_text]")
log_world("::error file=[file],line=[line],title=[map_name]: [test_path]::[annotation_text]")
// Normal log message
log_entry += "\tREASON #[reasonID]: [text] at [file]:[line]"