Author: cazfi Date: Fri Oct 23 03:47:56 2015 New Revision: 30173 URL: http://svn.gna.org/viewcvs/freeciv?rev=30173&view=rev Log: Added configure option --enable-testmatic for test system integration.
See patch #6437 Added: trunk/m4/testmatic.m4 Modified: trunk/Makefile.am trunk/common/dataio.c trunk/configure.ac trunk/server/generator/mapgen.c trunk/server/srv_main.c trunk/server/stdinhand.c trunk/utility/log.h trunk/utility/registry_ini.c Modified: trunk/Makefile.am URL: http://svn.gna.org/viewcvs/freeciv/trunk/Makefile.am?rev=30173&r1=30172&r2=30173&view=diff ============================================================================== --- trunk/Makefile.am (original) +++ trunk/Makefile.am Fri Oct 23 03:47:56 2015 @@ -77,6 +77,7 @@ m4/sound.m4 \ m4/vsnprintf.m4 \ m4/web-client.m4 \ + m4/testmatic.m4 \ scripts/mapimg2anim \ scripts/setup_auth_server.sh \ scripts/diff_ignore Modified: trunk/common/dataio.c URL: http://svn.gna.org/viewcvs/freeciv/trunk/common/dataio.c?rev=30173&r1=30172&r2=30173&view=diff ============================================================================== --- trunk/common/dataio.c (original) +++ trunk/common/dataio.c Fri Oct 23 03:47:56 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: trunk/configure.ac URL: http://svn.gna.org/viewcvs/freeciv/trunk/configure.ac?rev=30173&r1=30172&r2=30173&view=diff ============================================================================== --- trunk/configure.ac (original) +++ trunk/configure.ac Fri Oct 23 03:47:56 2015 @@ -281,6 +281,8 @@ esac], [fcweb=false]) FC_WEB_CLIENT + +FC_TESTMATIC dnl no: Do not compile client. dnl auto: Autodetect one. Added: trunk/m4/testmatic.m4 URL: http://svn.gna.org/viewcvs/freeciv/trunk/m4/testmatic.m4?rev=30173&view=auto ============================================================================== --- trunk/m4/testmatic.m4 (added) +++ trunk/m4/testmatic.m4 Fri Oct 23 03:47:56 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: trunk/server/generator/mapgen.c URL: http://svn.gna.org/viewcvs/freeciv/trunk/server/generator/mapgen.c?rev=30173&r1=30172&r2=30173&view=diff ============================================================================== --- trunk/server/generator/mapgen.c (original) +++ trunk/server/generator/mapgen.c Fri Oct 23 03:47:56 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: trunk/server/srv_main.c URL: http://svn.gna.org/viewcvs/freeciv/trunk/server/srv_main.c?rev=30173&r1=30172&r2=30173&view=diff ============================================================================== --- trunk/server/srv_main.c (original) +++ trunk/server/srv_main.c Fri Oct 23 03:47:56 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: trunk/server/stdinhand.c URL: http://svn.gna.org/viewcvs/freeciv/trunk/server/stdinhand.c?rev=30173&r1=30172&r2=30173&view=diff ============================================================================== --- trunk/server/stdinhand.c (original) +++ trunk/server/stdinhand.c Fri Oct 23 03:47:56 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: trunk/utility/log.h URL: http://svn.gna.org/viewcvs/freeciv/trunk/utility/log.h?rev=30173&r1=30172&r2=30173&view=diff ============================================================================== --- trunk/utility/log.h (original) +++ trunk/utility/log.h Fri Oct 23 03:47:56 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: trunk/utility/registry_ini.c URL: http://svn.gna.org/viewcvs/freeciv/trunk/utility/registry_ini.c?rev=30173&r1=30172&r2=30173&view=diff ============================================================================== --- trunk/utility/registry_ini.c (original) +++ trunk/utility/registry_ini.c Fri Oct 23 03:47:56 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