diff --git a/code/__DEFINES/MC.dm b/code/__DEFINES/MC.dm index b7468da8333..8a658f3913d 100644 --- a/code/__DEFINES/MC.dm +++ b/code/__DEFINES/MC.dm @@ -41,32 +41,38 @@ //! SubSystem flags (Please design any new flags so that the default is off, to make adding flags to subsystems easier) /// subsystem does not initialize. -#define SS_NO_INIT 1 +#define SS_NO_INIT (1 << 0) /** subsystem does not fire. */ /// (like can_fire = 0, but keeps it from getting added to the processing subsystems list) /// (Requires a MC restart to change) -#define SS_NO_FIRE 2 +#define SS_NO_FIRE (1 << 1) /** Subsystem only runs on spare cpu (after all non-background subsystems have ran that tick) */ /// SS_BACKGROUND has its own priority bracket, this overrides SS_TICKER's priority bump -#define SS_BACKGROUND 4 +#define SS_BACKGROUND (1 << 2) /** Treat wait as a tick count, not DS, run every wait ticks. */ /// (also forces it to run first in the tick (unless SS_BACKGROUND)) /// (We don't want to be choked out by other subsystems queuing into us) /// (implies all runlevels because of how it works) /// This is designed for basically anything that works as a mini-mc (like SStimer) -#define SS_TICKER 8 +#define SS_TICKER (1 << 3) /** keep the subsystem's timing on point by firing early if it fired late last fire because of lag */ /// ie: if a 20ds subsystem fires say 5 ds late due to lag or what not, its next fire would be in 15ds, not 20ds. -#define SS_KEEP_TIMING 16 +#define SS_KEEP_TIMING (1 << 4) /** Calculate its next fire after its fired. */ /// (IE: if a 5ds wait SS takes 2ds to run, its next fire should be 5ds away, not 3ds like it normally would be) /// This flag overrides SS_KEEP_TIMING -#define SS_POST_FIRE_TIMING 32 +#define SS_POST_FIRE_TIMING (1 << 5) + +/// If this subsystem doesn't initialize, it should not report as a hard error in CI. +/// This should be used for subsystems that are flaky for complicated reasons, such as +/// the Lua subsystem, which relies on auxtools, which is unstable. +/// It should not be used simply to silence CI. +#define SS_OK_TO_FAIL_INIT (1 << 6) //! SUBSYSTEM STATES #define SS_IDLE 0 /// ain't doing shit. diff --git a/code/controllers/subsystem/lua.dm b/code/controllers/subsystem/lua.dm index 262acb06f6b..b10cd4c9d58 100644 --- a/code/controllers/subsystem/lua.dm +++ b/code/controllers/subsystem/lua.dm @@ -2,6 +2,7 @@ SUBSYSTEM_DEF(lua) name = "Lua Scripting" runlevels = RUNLEVEL_LOBBY | RUNLEVELS_DEFAULT wait = 0.1 SECONDS + flags = SS_OK_TO_FAIL_INIT /// A list of all lua states var/list/datum/lua_state/states = list() diff --git a/code/modules/unit_tests/_unit_tests.dm b/code/modules/unit_tests/_unit_tests.dm index 5946798f05f..22e23bbc17f 100644 --- a/code/modules/unit_tests/_unit_tests.dm +++ b/code/modules/unit_tests/_unit_tests.dm @@ -41,6 +41,11 @@ /// Intended to be used in the manner of `TEST_FOCUS(/datum/unit_test/math)` #define TEST_FOCUS(test_path) ##test_path { focus = TRUE; } +/// Logs a noticable message on GitHub, but will not mark as an error. +/// Use this when something shouldn't happen and is of note, but shouldn't block CI. +/// Does not mark the test as failed. +#define TEST_NOTICE(source, message) source.log_for_test((##message), "notice", __FILE__, __LINE__) + /// Constants indicating unit test completion status #define UNIT_TEST_PASSED 0 #define UNIT_TEST_FAILED 1 diff --git a/code/modules/unit_tests/screenshots/screenshot_humanoids__datum_species_monkey.png b/code/modules/unit_tests/screenshots/screenshot_humanoids__datum_species_monkey.png index 77ddef22ec8..6ed2663959c 100644 Binary files a/code/modules/unit_tests/screenshots/screenshot_humanoids__datum_species_monkey.png and b/code/modules/unit_tests/screenshots/screenshot_humanoids__datum_species_monkey.png differ diff --git a/code/modules/unit_tests/subsystem_init.dm b/code/modules/unit_tests/subsystem_init.dm index c377302ba6a..15ba71b6a76 100644 --- a/code/modules/unit_tests/subsystem_init.dm +++ b/code/modules/unit_tests/subsystem_init.dm @@ -1,7 +1,14 @@ +/// Tests that all subsystems that need to properly initialize. +/datum/unit_test/subsystem_init + /datum/unit_test/subsystem_init/Run() - for(var/i in Master.subsystems) - var/datum/controller/subsystem/ss = i - if(ss.flags & SS_NO_INIT) + for(var/datum/controller/subsystem/subsystem as anything in Master.subsystems) + if(subsystem.flags & SS_NO_INIT) continue - if(!ss.initialized) - TEST_FAIL("[ss]([ss.type]) is a subsystem meant to initialize but doesn't get set as initialized.") + if(!subsystem.initialized) + var/message = "[subsystem] ([subsystem.type]) is a subsystem meant to initialize but doesn't get set as initialized." + + if (subsystem.flags & SS_OK_TO_FAIL_INIT) + TEST_NOTICE(src, "[message]\nThis subsystem is marked as SS_OK_TO_FAIL_INIT. This is still a bug, but it is non-blocking.") + else + TEST_FAIL(message) diff --git a/code/modules/unit_tests/unit_test.dm b/code/modules/unit_tests/unit_test.dm index ea8e75c9e4a..6b525d7b9dc 100644 --- a/code/modules/unit_tests/unit_test.dm +++ b/code/modules/unit_tests/unit_test.dm @@ -108,6 +108,16 @@ GLOBAL_LIST_EMPTY(unit_test_mapping_logs) log_test("[path_prefix]_[name] was put in data/screenshots_new") +/// Logs a test message. Will use GitHub action syntax found at https://docs.github.com/en/actions/using-workflows/workflow-commands-for-github-actions +/datum/unit_test/proc/log_for_test(text, priority, file, line) + var/map_name = SSmapping.config.map_name + + // Need to escape the text to properly support newlines. + var/annotation_text = replacetext(text, "%", "%25") + annotation_text = replacetext(annotation_text, "\n", "%0A") + + log_world("::[priority] file=[file],line=[line],title=[map_name]: [type]::[annotation_text]") + /proc/RunUnitTest(test_path, list/test_results) var/datum/unit_test/test = new test_path @@ -124,21 +134,13 @@ GLOBAL_LIST_EMPTY(unit_test_mapping_logs) "[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] var/file = fail_reasons[reasonID][2] var/line = fail_reasons[reasonID][3] - // Github action annotation. - // See https://docs.github.com/en/actions/using-workflows/workflow-commands-for-github-actions - - // Need to escape the text to properly support newlines. - var/annotation_text = replacetext(text, "%", "%25") - annotation_text = replacetext(annotation_text, "\n", "%0A") - - log_world("::error file=[file],line=[line],title=[map_name]: [test_path]::[annotation_text]") + test.log_for_test(text, "error", file, line) // Normal log message log_entry += "\tREASON #[reasonID]: [text] at [file]:[line]" diff --git a/dependencies.sh b/dependencies.sh index c5b977c1a22..54df3c4ccb1 100644 --- a/dependencies.sh +++ b/dependencies.sh @@ -5,7 +5,7 @@ # byond version export BYOND_MAJOR=514 -export BYOND_MINOR=1560 +export BYOND_MINOR=1588 #rust_g git tag export RUST_G_VERSION=1.0.2