Author: cazfi Date: Fri Oct 23 03:48:09 2015 New Revision: 30174 URL: http://svn.gna.org/viewcvs/freeciv?rev=30174&view=rev Log: Added configure option --enable-testmatic for test system integration.
See patch #6437 Added: branches/S2_6/m4/testmatic.m4 Modified: branches/S2_6/Makefile.am branches/S2_6/common/dataio.c branches/S2_6/configure.ac branches/S2_6/server/generator/mapgen.c branches/S2_6/server/srv_main.c branches/S2_6/server/stdinhand.c branches/S2_6/utility/log.h branches/S2_6/utility/registry_ini.c Modified: branches/S2_6/Makefile.am URL: http://svn.gna.org/viewcvs/freeciv/branches/S2_6/Makefile.am?rev=30174&r1=30173&r2=30174&view=diff ============================================================================== --- branches/S2_6/Makefile.am (original) +++ branches/S2_6/Makefile.am Fri Oct 23 03:48:09 2015 @@ -77,6 +77,7 @@ m4/web-client.m4 \ m4/xaw-client.m4 \ m4/x.m4 \ + m4/testmatic.m4 \ scripts/mapimg2anim \ scripts/setup_auth_server.sh \ scripts/diff_ignore Modified: branches/S2_6/common/dataio.c URL: http://svn.gna.org/viewcvs/freeciv/branches/S2_6/common/dataio.c?rev=30174&r1=30173&r2=30174&view=diff ============================================================================== --- branches/S2_6/common/dataio.c (original) +++ branches/S2_6/common/dataio.c Fri Oct 23 03:48:09 2015 @@ -70,6 +70,10 @@ /* Uncomment to make field range tests to asserts, fatal with -F */ /* #define FIELD_RANGE_ASSERT */ + +#if defined(TESTMATIC_ENABLED) && !defined(FIELD_RANGE_ASSERT) +#define FIELD_RANGE_ASSERT +#endif #ifdef FIELD_RANGE_ASSERT /* This evaluates _test_ twice. If that's a problem, Modified: branches/S2_6/configure.ac URL: http://svn.gna.org/viewcvs/freeciv/branches/S2_6/configure.ac?rev=30174&r1=30173&r2=30174&view=diff ============================================================================== --- branches/S2_6/configure.ac (original) +++ branches/S2_6/configure.ac Fri Oct 23 03:48:09 2015 @@ -247,6 +247,8 @@ fcweb=false FC_WEB_CLIENT + +FC_TESTMATIC dnl no: Do not compile client. dnl auto: Autodetect one. Added: branches/S2_6/m4/testmatic.m4 URL: http://svn.gna.org/viewcvs/freeciv/branches/S2_6/m4/testmatic.m4?rev=30174&view=auto ============================================================================== --- branches/S2_6/m4/testmatic.m4 (added) +++ branches/S2_6/m4/testmatic.m4 Fri Oct 23 03:48:09 2015 @@ -0,0 +1,19 @@ +# Freeciv testing support + +# +# +AC_DEFUN([FC_TESTMATIC], +[ +AC_ARG_ENABLE([testmatic], + AS_HELP_STRING([--enable-testmatic], + [Produce logging useful in freeciv testing integration]), +[case "${enableval}" in + yes) enable_testmatic=yes ;; + no) enable_testmatic=no ;; + *) AC_MSG_ERROR([bad value ${enableval} for --enable-testmatic]) ;; +esac], [enable_testmatic=no]) + + if test x$enable_testmatic = xyes ; then + AC_DEFINE([TESTMATIC_ENABLED], [1], [Testmatic integration enabled]) + fi +]) Modified: branches/S2_6/server/generator/mapgen.c URL: http://svn.gna.org/viewcvs/freeciv/branches/S2_6/server/generator/mapgen.c?rev=30174&r1=30173&r2=30174&view=diff ============================================================================== --- branches/S2_6/server/generator/mapgen.c (original) +++ branches/S2_6/server/generator/mapgen.c Fri Oct 23 03:48:09 2015 @@ -1381,7 +1381,12 @@ if (map.server.seed == 0) { /* Create a "random" map seed. */ map.server.seed = seed_rand & (MAX_UINT32 >> 1); +#ifdef TESTMATIC_ENABLED + /* Log command to reproduce the mapseed */ + log_testmatic("set mapseed %d", map.server.seed); +#else /* TESTMATICE_ENABLED */ log_debug("Setting map.seed:%d", map.server.seed); +#endif /* TESTMATIC_ENABLED */ } rstate = fc_rand_state(); Modified: branches/S2_6/server/srv_main.c URL: http://svn.gna.org/viewcvs/freeciv/branches/S2_6/server/srv_main.c?rev=30174&r1=30173&r2=30174&view=diff ============================================================================== --- branches/S2_6/server/srv_main.c (original) +++ branches/S2_6/server/srv_main.c Fri Oct 23 03:48:09 2015 @@ -196,9 +196,14 @@ /* We strip the high bit for now because neither game file nor server options can handle unsigned ints yet. - Cedric */ game.server.seed = time(NULL) & (MAX_UINT32 >> 1); +#ifdef TESTMATIC_ENABLED + /* Log command to reproduce the gameseed */ + log_testmatic("set gameseed %d", game.server.seed); +#else /* TESTMATIC_ENABLED */ log_debug("Setting game.seed:%d", game.server.seed); - } - +#endif /* TESTMATIC_ENABLED */ + } + if (!fc_rand_is_init()) { fc_srand(game.server.seed); } Modified: branches/S2_6/server/stdinhand.c URL: http://svn.gna.org/viewcvs/freeciv/branches/S2_6/server/stdinhand.c?rev=30174&r1=30173&r2=30174&view=diff ============================================================================== --- branches/S2_6/server/stdinhand.c (original) +++ branches/S2_6/server/stdinhand.c Fri Oct 23 03:48:09 2015 @@ -1169,7 +1169,7 @@ real_filename = tilde_filename; } - log_normal(_("Loading script file '%s'."), real_filename); + log_testmatic_alt(LOG_NORMAL, _("Loading script file '%s'."), real_filename); if (is_reg_file_for_access(real_filename, FALSE) && (script_file = fc_fopen(real_filename, "r"))) { Modified: branches/S2_6/utility/log.h URL: http://svn.gna.org/viewcvs/freeciv/branches/S2_6/utility/log.h?rev=30174&r1=30173&r2=30174&view=diff ============================================================================== --- branches/S2_6/utility/log.h (original) +++ branches/S2_6/utility/log.h Fri Oct 23 03:48:09 2015 @@ -107,6 +107,16 @@ #else # define log_debug(message, ...) /* Do nothing. */ #endif /* FREECIV_DEBUG */ +#ifdef TESTMATIC_ENABLED +#define log_testmatic(message, ...) \ + log_base(LOG_ERROR, message, ## __VA_ARGS__) +#define log_testmatic_alt(altlvl, message, ...) \ + log_base(LOG_ERROR, message, ## __VA_ARGS__) +#else /* TESTMATIC_ENABLED */ +#define log_testmatic(message, ...) /* Do nothing. */ +#define log_testmatic_alt(altlvl, message, ...) \ + log_base(altlvl, message, ## __VA_ARGS__) +#endif /* TESTMATIC_ENABLED */ /* Used by game debug command */ #define log_test log_normal Modified: branches/S2_6/utility/registry_ini.c URL: http://svn.gna.org/viewcvs/freeciv/branches/S2_6/utility/registry_ini.c?rev=30174&r1=30173&r2=30174&view=diff ============================================================================== --- branches/S2_6/utility/registry_ini.c (original) +++ branches/S2_6/utility/registry_ini.c Fri Oct 23 03:48:09 2015 @@ -861,8 +861,14 @@ log_verbose("Unused entries in file %s:", secfile->name); any = TRUE; } +#ifdef TESTMATIC_ENABLED + log_testmatic("%s: unused entry: %s.%s", + secfile->name != NULL ? secfile->name : "nameless", + section_name(psection), entry_name(pentry)); +#else /* TESTMATIC_ENABLED */ log_verbose(" unused entry: %s.%s", section_name(psection), entry_name(pentry)); +#endif /* TESTMATIC_ENABLED */ } } entry_list_iterate_end; } section_list_iterate_end; _______________________________________________ Freeciv-commits mailing list Freeciv-commits@gna.org https://mail.gna.org/listinfo/freeciv-commits