Changeset: 18bd082d75ce for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/18bd082d75ce
Modified Files:
        gdk/gdk.h
        gdk/gdk_logger.c
        gdk/gdk_strimps.c
        gdk/gdk_tracer.c
        monetdb5/mal/mal_profiler.c
        monetdb5/modules/mal/clients.c
        monetdb5/modules/mal/mal_mapi.c
        monetdb5/optimizer/opt_candidates.c
        sql/server/rel_dump.c
        sql/server/rel_optimizer.c
        sql/storage/store.c
        testing/Mtest.py.in
Branch: Aug2024
Log Message:

Introduce a TESTINGMASK (-d256) which is always on during testing.
I.e., testing using Mtest.py.  This flag is on, even when passing -d0 or
--nomito.
The flag reduces a number of values to decrease testing time, and it
prohibits printing of some changeable information.


diffs (217 lines):

diff --git a/gdk/gdk.h b/gdk/gdk.h
--- a/gdk/gdk.h
+++ b/gdk/gdk.h
@@ -390,6 +390,7 @@ gdk_export _Noreturn void GDKfatal(_In_z
 #define IOMASK         (1U<<4)
 #define BATMASK                (1U<<5)
 #define PARMASK                (1U<<7)
+#define TESTINGMASK    (1U<<8)
 #define TMMASK         (1U<<9)
 #define TEMMASK                (1U<<10)
 #define PERFMASK       (1U<<12)
diff --git a/gdk/gdk_logger.c b/gdk/gdk_logger.c
--- a/gdk/gdk_logger.c
+++ b/gdk/gdk_logger.c
@@ -2350,7 +2350,7 @@ log_new(int debug, const char *fn, const
        lng max_file_age = GDKgetenv_int("wal_max_file_age", 600);
        lng max_file_size = 0;
 
-       if (GDKdebug & FORCEMITOMASK) {
+       if (GDKdebug & TESTINGMASK) {
                max_file_size = 2048; /* 2 KiB */
        } else {
                const char *max_file_size_str = GDKgetenv("wal_max_file_size");
@@ -2548,7 +2548,7 @@ log_create(int debug, const char *fn, co
 static logged_range *
 log_next_logfile(logger *lg, ulng ts)
 {
-       int m = (ATOMIC_GET(&GDKdebug) & FORCEMITOMASK) ? 1000 : 100;
+       int m = (ATOMIC_GET(&GDKdebug) & TESTINGMASK) ? 1000 : 100;
        if (!lg->pending || !lg->pending->next)
                return NULL;
        rotation_lock(lg);
diff --git a/gdk/gdk_strimps.c b/gdk/gdk_strimps.c
--- a/gdk/gdk_strimps.c
+++ b/gdk/gdk_strimps.c
@@ -94,7 +94,7 @@
 #define STRIMP_HEADER_SIZE 64
 #define STRIMP_PAIRS (STRIMP_HEADER_SIZE - 1)
 #define STRIMP_CREATION_THRESHOLD                              \
-       ((BUN) ((ATOMIC_GET(&GDKdebug) & FORCEMITOMASK)? 100 : 5000))
+       ((BUN) ((ATOMIC_GET(&GDKdebug) & TESTINGMASK)? 100 : 5000))
 
 typedef struct {
 #ifdef UTF8STRIMPS
diff --git a/gdk/gdk_tracer.c b/gdk/gdk_tracer.c
--- a/gdk/gdk_tracer.c
+++ b/gdk/gdk_tracer.c
@@ -590,7 +590,7 @@ GDKtracer_log(const char *file, const ch
        if (interrupted)
                reinit();
 
-       if (level <= M_WARNING || (ATOMIC_GET(&GDKdebug) & FORCEMITOMASK)) {
+       if (level <= M_WARNING || (ATOMIC_GET(&GDKdebug) & TESTINGMASK)) {
                fprintf(level <= M_ERROR && !isexit ? stderr : stdout,
                        "#%s%s%s: %s: %s: %s%s%s\n",
                        add_ts ? ts : "",
diff --git a/monetdb5/mal/mal_profiler.c b/monetdb5/mal/mal_profiler.c
--- a/monetdb5/mal/mal_profiler.c
+++ b/monetdb5/mal/mal_profiler.c
@@ -1087,7 +1087,7 @@ static void
 profilerHeartbeat(void *dummy)
 {
        int t;
-       const int timeout = ATOMIC_GET(&GDKdebug) & FORCEMITOMASK ? 10 : 25;
+       const int timeout = ATOMIC_GET(&GDKdebug) & TESTINGMASK ? 10 : 25;
 
        (void) dummy;
        for (;;) {
diff --git a/monetdb5/modules/mal/clients.c b/monetdb5/modules/mal/clients.c
--- a/monetdb5/modules/mal/clients.c
+++ b/monetdb5/modules/mal/clients.c
@@ -475,8 +475,8 @@ CLTqueryTimeout(Client cntxt, MalBlkPtr 
                msg = createException(MAL, "clients.setquerytimeout",
                                                          "Session not active 
anymore");
        else {
-               /* when testing (FORCEMITOMASK), reduce timeout of 1 sec to 1 
msec */
-               lng timeout_micro = ATOMIC_GET(&GDKdebug) & FORCEMITOMASK
+               /* when testing (TESTINGMASK), reduce timeout of 1 sec to 1 
msec */
+               lng timeout_micro = ATOMIC_GET(&GDKdebug) & TESTINGMASK
                                && qto == 1 ? 1000 : (lng) qto * 1000000;
                mal_clients[idx].querytimeout = timeout_micro;
        }
diff --git a/monetdb5/modules/mal/mal_mapi.c b/monetdb5/modules/mal/mal_mapi.c
--- a/monetdb5/modules/mal/mal_mapi.c
+++ b/monetdb5/modules/mal/mal_mapi.c
@@ -292,7 +292,7 @@ SERVERlistenThread(SOCKET *Sock)
                }
                /* Wait up to 0.1 seconds (0.01 if testing) */
                retval = poll(pfd, npfd,
-                                         ATOMIC_GET(&GDKdebug) & FORCEMITOMASK 
? 10 : 100);
+                                         ATOMIC_GET(&GDKdebug) & TESTINGMASK ? 
10 : 100);
                if (retval == -1 && errno == EINTR)
                        continue;
 #else
@@ -308,7 +308,7 @@ SERVERlistenThread(SOCKET *Sock)
                }
                /* Wait up to 0.1 seconds (0.01 if testing) */
                struct timeval tv = (struct timeval) {
-                       .tv_usec = ATOMIC_GET(&GDKdebug) & FORCEMITOMASK ? 
10000 : 100000,
+                       .tv_usec = ATOMIC_GET(&GDKdebug) & TESTINGMASK ? 10000 
: 100000,
                };
 
                retval = select((int) msgsock + 1, &fds, NULL, NULL, &tv);
diff --git a/monetdb5/optimizer/opt_candidates.c 
b/monetdb5/optimizer/opt_candidates.c
--- a/monetdb5/optimizer/opt_candidates.c
+++ b/monetdb5/optimizer/opt_candidates.c
@@ -24,7 +24,7 @@ OPTcandidatesImplementation(Client cntxt
        InstrPtr p;
        str msg = MAL_SUCCEED;
 
-       if (!(ATOMIC_GET(&GDKdebug) & FORCEMITOMASK))
+       if (!(ATOMIC_GET(&GDKdebug) & TESTINGMASK))
                goto wrapup;
        (void) cntxt;
        (void) stk;                                     /* to fool compilers */
diff --git a/sql/server/rel_dump.c b/sql/server/rel_dump.c
--- a/sql/server/rel_dump.c
+++ b/sql/server/rel_dump.c
@@ -335,7 +335,7 @@ exp_print(mvc *sql, stream *fout, sql_ex
        if (decorate && e->p && e->type != e_atom && !exp_is_atom(e)) {
                for (prop *p = e->p; p; p = p->p) {
                        /* Don't show min/max/unique est on atoms, or when 
running tests with forcemito */
-                       if ((ATOMIC_GET(&GDKdebug) & NOSYNCMASK) == 0 ||
+                       if ((ATOMIC_GET(&GDKdebug) & TESTINGMASK) == 0 ||
                                (p->kind != PROP_MIN && p->kind != PROP_MAX && 
p->kind != PROP_NUNIQUES)) {
                                char *pv = propvalue2string(sql->ta, p);
                                mnstr_printf(fout, " %s %s", 
propkind2string(p), pv);
@@ -690,7 +690,7 @@ rel_print_rel(mvc *sql, stream  *fout, s
        }
        if (decorate && rel->p) {
                for (prop *p = rel->p; p; p = p->p) {
-                       if (p->kind != PROP_COUNT || (ATOMIC_GET(&GDKdebug) & 
NOSYNCMASK) == 0) {
+                       if (p->kind != PROP_COUNT || (ATOMIC_GET(&GDKdebug) & 
TESTINGMASK) == 0) {
                                char *pv = propvalue2string(sql->ta, p);
                                mnstr_printf(fout, " %s %s", 
propkind2string(p), pv);
                        }
diff --git a/sql/server/rel_optimizer.c b/sql/server/rel_optimizer.c
--- a/sql/server/rel_optimizer.c
+++ b/sql/server/rel_optimizer.c
@@ -669,7 +669,7 @@ rel_optimizer_one(mvc *sql, sql_rel *rel
                                                                          
.has_special_modify = rel && is_modify(rel->op) && rel->flag&UPD_COMP};
        visitor v = { .sql = sql, .value_based_opt = value_based_opt, 
.storage_based_opt = storage_based_opt, .changes = 1, .data = &gp };
 
-       sql->runs = !(ATOMIC_GET(&GDKdebug) & FORCEMITOMASK) && profile ? 
sa_zalloc(sql->sa, NSQLREWRITERS * sizeof(sql_optimizer_run)) : NULL;
+       sql->runs = !(ATOMIC_GET(&GDKdebug) & TESTINGMASK) && profile ? 
sa_zalloc(sql->sa, NSQLREWRITERS * sizeof(sql_optimizer_run)) : NULL;
        for ( ;rel && gp.opt_cycle < 20 && v.changes; gp.opt_cycle++) {
                v.changes = 0;
                gp = (global_props) {.cnt = {0}, .instantiate = 
(uint8_t)instantiate, .opt_cycle = gp.opt_cycle, .has_special_modify = 
gp.has_special_modify};
diff --git a/sql/storage/store.c b/sql/storage/store.c
--- a/sql/storage/store.c
+++ b/sql/storage/store.c
@@ -2452,7 +2452,7 @@ store_manager(sqlstore *store)
        MT_lock_set(&store->flush);
 
        for (;;) {
-               const int idle = ATOMIC_GET(&GDKdebug) & FORCEMITOMASK ? 5000 : 
IDLE_TIME * 1000000;
+               const int idle = ATOMIC_GET(&GDKdebug) & TESTINGMASK ? 5000 : 
IDLE_TIME * 1000000;
                /* if debug bit 1024 is set, attempt immediate log activation
                 * and clear the bit */
                if (store->debug&(128|1024) || ATOMIC_GET(&store->lastactive) + 
idle < (ATOMIC_BASE_TYPE) GDKusec()) {
@@ -4094,7 +4094,7 @@ sql_trans_commit(sql_trans *tr)
                const bool log = !tr->parent && tr->logchanges > 0;
 
                if (log) {
-                       const lng min_changes = ATOMIC_GET(&GDKdebug) & 
FORCEMITOMASK ? 5 : 1000000;
+                       const lng min_changes = ATOMIC_GET(&GDKdebug) & 
TESTINGMASK ? 5 : 1000000;
                        flush = (tr->logchanges > min_changes && 
list_empty(store->changes));
                }
 
diff --git a/testing/Mtest.py.in b/testing/Mtest.py.in
--- a/testing/Mtest.py.in
+++ b/testing/Mtest.py.in
@@ -2678,13 +2678,13 @@ class ServerClass:
         self.outfile.flush()
         self.errfile.flush()
 
+        cmd = self.cmd
         if procdebug:
-            print('LaunchIt: starting process "%s" (inpipe)\n' % '" 
"'.join(self.cmd))
+            print('LaunchIt: starting process "%s" (inpipe)\n' % '" 
"'.join(cmd))
         setpgrp = True
         stdin = open(os.devnull)
         stdout = self.outfile
         stderr = self.errfile
-        cmd = self.cmd
         if self.inmem:
             stdout = process.PIPE
         elif self.pollfile:
@@ -2694,7 +2694,7 @@ class ServerClass:
                 pass
             if self.dbg:
                 stdin = stdout = stderr = None
-                cmd = splitcommand(self.dbg) + self.cmd
+                cmd = splitcommand(self.dbg) + cmd
         else:
             stdout = process.PIPE
         if os.name == "nt":
@@ -3300,7 +3300,7 @@ if THISFILE == 'Mz.py':
     produce_html = False
     verbosity == 0
 THISPATH = os.path.realpath(os.path.dirname(sys.argv[0]))
-TSTDBG = str(2+8)
+TSTDBG = "2"
 TSTTHREADS = "0"
 dftTSTPREF = "mTests"
 TSTSUFF = "Tests"
@@ -3967,8 +3967,8 @@ def main(argv) :
             SOCK = ""
 
         exe = {}
-        exe['mserver5']       = CheckExec('mserver5')     , 'mserver5 
--debug=%s --set gdk_nr_threads=%s %s --set mapi_listenaddr=all --set 
mapi_port=0 %s %s' % \
-                                                               
(env['GDK_DEBUG'], env['GDK_NR_THREADS'], env['setMONETDB_MOD_PATH'], SOCK, 
'--forcemito' if not nomito else f'-d{1 << 24}')
+        exe['mserver5']       = CheckExec('mserver5')     , 'mserver5 
--debug=%s --debug=256 --set gdk_nr_threads=%s %s --set mapi_listenaddr=all 
--set mapi_port=0 %s %s' % \
+                                                               
(env['GDK_DEBUG'], env['GDK_NR_THREADS'], env['setMONETDB_MOD_PATH'], SOCK, 
'--forcemito' if not nomito else '')  # turn off forcemito, but keep nosync
         exe['ruby_client']   = CheckExec(env['RUBYCLIENT'].split(None, 1)[0])  
 , '%s %s' % (env['RUBYCLIENT'], '${PORT}')
         exe['MAL_Client']    = CheckExec(env['MALCLIENT'].split(None, 1)[0])  
, '%s --host=%s --port=%s' % (env['MALCLIENT'], HOST, '${PORT}')
         exe['SQL_Client']    = CheckExec(env['SQLCLIENT'].split(None, 1)[0])   
, '%s -i -e --host=%s --port=%s' % (env['SQLCLIENT'], HOST, '${PORT}')
_______________________________________________
checkin-list mailing list -- checkin-list@monetdb.org
To unsubscribe send an email to checkin-list-le...@monetdb.org

Reply via email to