log_warning_error_tests()



Hi guys, can I please query a recent change to the function 'log_warning_error_tests()' in the module 'tests/testglib.c' ?

It looks like that function got modified very recently.  At the end of the function there's a particular line:-

        gprint (NULL);

which was previously only getting called in some specific situation (an error condition, I think) but it's been moved out of its condition block and is now getting called routinely.  Unfortunately, 'gprint()' calls 'g_return_if_fail()' which triggers an abort error if the supplied parameter is NULL.  The actual abort occurs in function 'g_logv()' because of this code (in abbreviated form, for simplification):-

        if (strcmp (expected->log_domain, log_domain) == 0 &&
            ((log_level & expected->log_level) == expected->log_level) &&
            g_pattern_match_simple (expected->pattern, msg))
        {
            return;
        }
        else
        {
            log_level |= G_LOG_FLAG_FATAL;
        }

I'm not quite sure what 'g_pattern_match_simple()' does = but from what I can tell, if the supplied message matches "*g_print*assertion*failed*" the function simply returns.  Otherwise it sets G_LOG_FLAG_FATAL (which later causes the abort).  The problem in this case is that the message supplied from 'g_return_if_fail' is, in fact, "gmessages.c: line 1446: assertion 'format != NULL' failed"

I don't know enough to know whether 'gprint (NULL)' is a valid operation (in which case, 'g_logv()' shouldn't be aborting) - or whether 'gprint (NULL)' is in fact, invalid (in which case, the test shouldn't be calling it with a NULL parameter in the first place).

It's a complicated situation but I hope someone can make sense of this !!

John


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]