Allows Travis to Validate PoI Maps

Tweaks Travis to compile all PoI maps in order to allow the compiler to find certain problems such as missing paths. This is needed because PoIs are loaded at runtime as opposed to being compiled like traditional maps, making them a bit prone to problems. Travis should help find those problems before they reach the live server by failing PRs which add a broken PoI map or break any existing PoI maps.
For regular use, the PoIs will not be compiled unless done so manually by the developer.
This commit is contained in:
Neerti
2017-11-19 06:07:41 -05:00
parent 2a55433ca9
commit 396f55fb17
8 changed files with 47 additions and 2 deletions

View File

@@ -36,9 +36,14 @@ script:
- (num=`grep -E '\\\\(red|blue|green|black|b|i[^mc])' **/*.dm | wc -l`; echo "$num escapes (expecting ${MACRO_COUNT} or less)"; [ $num -le ${MACRO_COUNT} ])
- source $HOME/BYOND-${BYOND_MAJOR}.${BYOND_MINOR}/byond/bin/byondsetup
- python tools/TagMatcher/tag-matcher.py ../..
- echo "#define UNIT_TEST 1" > code/_unit_tests.dm
#First compile is to ensure maps are valid.
- echo "#define MAP_TEST 1" > code/_map_tests.dm
- cp config/example/* config/
- DreamMaker polaris.dme
- echo "#define MAP_TEST 0" > code/_map_tests.dm
#Second compile is for the unit tests. Compiling a second time to exclude the validated maps is actually faster than waiting for startup with them compiled.
- echo "#define UNIT_TEST 1" > code/_unit_tests.dm
- DreamMaker polaris.dme
- DreamDaemon polaris.dmb -invisible -trusted -core 2>&1 | tee log.txt
- grep "All Unit Tests Passed" log.txt

10
code/_map_tests.dm Normal file
View File

@@ -0,0 +1,10 @@
/*
*
* This file is used by Travis to indicate that additional maps need to be compiled to look for errors such as missing paths.
* Do not add anything but the MAP_TEST definition here as it will be overwritten by Travis when running tests.
*
*
* Should you wish to edit set MAP_TEST to 1 like so:
* #define MAP_TEST 1
*/
#define MAP_TEST 0

View File

@@ -12,7 +12,8 @@
/area/holodeck,
/area/supply/station,
/area/mine,
/area/vacant/vacant_shop
/area/vacant/vacant_shop,
/area/submap
)
var/list/exempt_from_atmos = typesof(/area/maintenance,

View File

@@ -24,4 +24,8 @@ is being loaded (to clear trees, etc). Be sure to not load the map on top of an
irreplacable objects or players, as they will all get deleted if annihilate is on. If you load the submap before
other objects have a chance to spawn (before random map gen), you shouldn't need to use annihilate.
When adding a new submap which will be loaded at runtime, you should add it to the list of '#include'-s on the top of the
map template file. This forces the submap to be compiled when the code is undergoing a unit test, which will help keep the
submap from suffering errors such as invalid paths due to them being changed elsewhere.
*/

View File

@@ -1,3 +1,12 @@
// This causes PoI maps to get 'checked' and compiled, when undergoing a unit test.
// This is so Travis can validate PoIs, and ensure future changes don't break PoIs, as PoIs are loaded at runtime and the compiler can't catch errors.
// When adding a new PoI, please add it to this list.
#if MAP_TEST
#include "deadBeacon.dmm"
#include "prepper1.dmm"
#include "quarantineshuttle.dmm"
#endif
/datum/map_template/cave
name = "Cave Content"
desc = "Don't dig too deep!"

View File

@@ -1,3 +1,10 @@
// This causes PoI maps to get 'checked' and compiled, when undergoing a unit test.
// This is so Travis can validate PoIs, and ensure future changes don't break PoIs, as PoIs are loaded at runtime and the compiler can't catch errors.
// When adding a new PoI, please add it to this list.
#if MAP_TEST
// #define "your_map_here.dmm"
#endif
/datum/map_template/space
name = "Space Content"
desc = "A map template base. In space."

View File

@@ -1,3 +1,11 @@
// This causes PoI maps to get 'checked' and compiled, when undergoing a unit test.
// This is so Travis can validate PoIs, and ensure future changes don't break PoIs, as PoIs are loaded at runtime and the compiler can't catch errors.
// When adding a new PoI, please add it to this list.
#if MAP_TEST
#include "farm1.dmm"
#include "spider1.dmm"
#endif
/datum/map_template/surface
name = "Surface Content"
desc = "Used to make the surface by 17% less boring."

View File

@@ -11,6 +11,7 @@
// END_PREFERENCES
// BEGIN_INCLUDE
#include "code\_macros.dm"
#include "code\_map_tests.dm"
#include "code\_unit_tests.dm"
#include "code\global.dm"
#include "code\hub.dm"