Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add json checking for more mods on all PRs #35995

Merged
merged 2 commits into from
Dec 16, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions build-scripts/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,18 @@ else
fi
wait -n
fi

if [ -n "$TEST_STAGE" ]
then
# Run the tests one more time, without actually running any tests, just to verify that all
# the mod data can be successfully loaded

# Use a blacklist of mods that currently fail to load cleanly. Hopefully this list will
# shrink over time.
blacklist=build-scripts/mod_test_blacklist
mods="$(./build-scripts/get_all_mods.py $blacklist)"
run_tests ./tests/cata_test --user-dir=all_modded --mods="$mods" '~*'
fi
fi
ccache --show-stats

Expand Down
19 changes: 19 additions & 0 deletions build-scripts/get_all_mods.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#!/usr/bin/env python3

import sys
import glob
import json

blacklist_filename, = sys.argv[1:]
with open(blacklist_filename) as blacklist_file:
blacklist = {s.rstrip('\n') for s in blacklist_file.readlines()}

mods = []

for info in glob.glob('data/mods/*/modinfo.json'):
mod_info = json.load(open(info))
mods.extend(e["ident"] for e in mod_info if e["type"] == "MOD_INFO")

mods_to_keep = [mod for mod in mods if mod not in blacklist]

print(','.join(mods_to_keep))
51 changes: 51 additions & 0 deletions build-scripts/mod_test_blacklist
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
aftershock
alt_map_key
Animatronics
Battery_Overhaul_Legacy_Mode
blazemod
cbm_slots
classic_zombies
crazy_cataclysm
crt_expansion
desertpack
DinoMod
ew_pack
FIC_Weapons
FujiStruct
generic_guns
Graphical_Overmap
growable-pots
Heavy miners
hydroponics
magiclysm
manualbionicinstall
mapgen_demo
Medieval_Stuff
MMA
modular_turrets
more_locations
More_Survival_Tools
mutant_npcs
my_sweet_cataclysm
national_guard_camp
No_Anthills
No_Bees
no_faults
no_filthy_clothing
No_Fungi
no_medieval_items
no_npc_food
No_Rail_Stations
No_Triffids
novitamins
realguns
safeautodoc
Salvaged_Robots
sees_player_hitbutton
sees_player_retro
sleepdeprivation
speedydex
stats_through_kills
Tanks
Tolerate_This
Urban_Development
22 changes: 6 additions & 16 deletions tests/test_main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@
#include "worldfactory.h"
#include "color.h"
#include "options.h"
#include "output.h"
#include "pldata.h"
#include "rng.h"
#include "type_id.h"
Expand Down Expand Up @@ -68,26 +69,15 @@ static std::string extract_argument( std::vector<const char *> &arg_vec, const s

static std::vector<mod_id> extract_mod_selection( std::vector<const char *> &arg_vec )
{
std::vector<mod_id> ret;
std::string mod_string = extract_argument( arg_vec, "--mods=" );

const char delim = ',';
size_t i = 0;
size_t pos = mod_string.find( delim );
if( pos == std::string::npos && !mod_string.empty() ) {
ret.emplace_back( mod_string );
}

while( pos != std::string::npos ) {
ret.emplace_back( mod_string.substr( i, pos - i ) );
i = ++pos;
pos = mod_string.find( delim, pos );

if( pos == std::string::npos ) {
ret.emplace_back( mod_string.substr( i, mod_string.length() ) );
std::vector<std::string> mod_names = string_split( mod_string, ',' );
std::vector<mod_id> ret;
for( const std::string mod_name : mod_names ) {
if( !mod_name.empty() ) {
ret.emplace_back( mod_name );
}
}

return ret;
}

Expand Down