Exemple #1
0
void
test_init(void)
{
    static int counter = 0;

    if (counter != 0)
        c_critical("We don't support running more than one test at a time\n"
                   "in a single test run due to the state leakage that can\n"
                   "cause subsequent tests to fail.\n"
                   "\n"
                   "If you want to run all the tests you should run\n"
                   "$ make check");
    counter++;

    if (is_boolean_env_set("V"))
        _test_is_verbose = true;

    /* NB: This doesn't have any effect since commit 47444dac of glib
     * because the environment variable is read in a magic constructor
     * so it is too late to set them here */
    if (c_getenv("G_DEBUG")) {
        char *debug = c_strconcat(c_getenv("G_DEBUG"), ",fatal-warnings", NULL);
        c_setenv("G_DEBUG", debug, true);
        c_free(debug);
    } else
        c_setenv("G_DEBUG", "fatal-warnings", true);
}
Exemple #2
0
static bool
is_boolean_env_set(const char *variable)
{
    char *val = getenv(variable);
    bool ret;

    if (!val)
        return false;

    if (c_ascii_strcasecmp(val, "1") == 0 ||
        c_ascii_strcasecmp(val, "on") == 0 ||
        c_ascii_strcasecmp(val, "true") == 0)
        ret = true;
    else if (c_ascii_strcasecmp(val, "0") == 0 ||
             c_ascii_strcasecmp(val, "off") == 0 ||
             c_ascii_strcasecmp(val, "false") == 0)
        ret = false;
    else {
        c_critical("Spurious boolean environment variable value (%s=%s)",
                   variable,
                   val);
        ret = true;
    }

    return ret;
}
Exemple #3
0
void
test_init(void)
{
    static int counter = 0;

    if (counter != 0)
        c_critical("We don't support running more than one test at a time\n"
                   "in a single test run due to the state leakage that can\n"
                   "cause subsequent tests to fail.\n"
                   "\n"
                   "If you want to run all the tests you should run\n"
                   "$ make check");
    counter++;

    if (is_boolean_env_set("V"))
        _test_is_verbose = true;
}
Exemple #4
0
static void
register_edit_object_cb(void *object, uint64_t edit_mode_id, void *user_data)
{
    rig_slave_t *slave = user_data;
    uint64_t *id_chunk;

    if (lookup_object(slave, edit_mode_id)) {
        c_critical("Tried to re-register object");
        return;
    }

    /* XXX: We need a mechanism for hooking into frontend edits that
     * happen as a result of UI logic so we can make sure to unregister
     * objects that might be deleted by UI logic. */

    id_chunk = rut_magazine_chunk_alloc(_rig_slave_object_id_magazine);
    *id_chunk = edit_mode_id;

    c_hash_table_insert(slave->edit_id_to_play_object_map, id_chunk, object);
    c_hash_table_insert(slave->play_object_to_edit_id_map, object, id_chunk);
}