tests - disable fmt warn for fail/ck asserts bc of check added NULL

check adds a NULL and this messes the format warning checks in the
check macro - so disable this warning where this is done - warning
noise we don't need.
This commit is contained in:
Carsten Haitzler 2024-05-30 17:40:16 +01:00
parent 305750875e
commit ebd24a4815
8 changed files with 107 additions and 2 deletions

View File

@ -53,18 +53,27 @@ _timer2_cb(void *data)
timer->num_elem = 0;
// check add/delay timer 2
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wformat-extra-args"
fail_if(timer->add_timer2 > 1, "Error add/delay timer");
#pragma GCC diagnostic pop
// check set new delay for timer 1
ecore_timer_delay(timer->timer1, timer->delay_1[timer->num_elem]);
// check set new interval for timer 1
ecore_timer_interval_set(timer->timer1, timer->interval_1[timer->num_elem]);
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wformat-extra-args"
fail_if(!EINA_DBL_EQ(timer->interval_1[timer->num_elem], ecore_timer_interval_get(timer->timer1)), "Error set new interval");
#pragma GCC diagnostic pop
// check set new precision
ecore_timer_precision_set(timer->precision[timer->num_elem]);
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wformat-extra-args"
fail_if(!EINA_DBL_EQ(timer->precision[timer->num_elem], ecore_timer_precision_get()), "Error set new precision");
#pragma GCC diagnostic pop
// check removal timer 2
if (ecore_timer_del(timer->timer2))
@ -100,7 +109,10 @@ _timer4_cb(void *data)
// check frezze/thaw timer 3
if (freeze_thaw)
{
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wformat-extra-args"
fail_if(timer->check_freeze_thaw_timer3 != timer->count_timer3, "Error frezze/thaw timer");
#pragma GCC diagnostic pop
ecore_timer_thaw(timer->timer3);
freeze_thaw = 0;
@ -153,7 +165,10 @@ EFL_START_TEST(ecore_test_timers)
timer.timer4 = ecore_timer_add(TIMEOUT_4, _timer4_cb, &timer);
timer.timer5 = ecore_timer_add(TIMEOUT_5, _timer5_cb, &timer);
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wformat-extra-args"
fail_if((!timer.timer1 || !timer.timer2 || !timer.timer3 || !timer.timer4 || !timer.timer5), "Error add timer\n");
#pragma GCC diagnostic pop
ecore_main_loop_begin();
@ -207,7 +222,10 @@ EFL_START_TEST(ecore_test_timer_inside_call)
c->t = ecore_timer_add(0.01, _timeri_cb, c);
ecore_timer_add(1.0, timeout_timer_cb, NULL);
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wformat-extra-args"
fail_if(!c->t, "Error add timer\n");
#pragma GCC diagnostic pop
ecore_main_loop_begin();
}
@ -217,7 +235,10 @@ EFL_END_TEST
EFL_START_TEST(ecore_test_timer_valid_callbackfunc)
{
Ecore_Timer *t = NULL;
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wformat-extra-args"
fail_if((t = ecore_timer_add(0.5, NULL, NULL)), "ERROR: Invalid callback func!\n");
#pragma GCC diagnostic pop
}
EFL_END_TEST
@ -259,7 +280,10 @@ _timer_cb(void *data)
{
count++;
int num = (intptr_t) data;
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wformat-extra-args"
fail_if (num != count, "Error timer is called out of order");
#pragma GCC diagnostic pop
if (count == 8) ecore_main_loop_quit();
return ECORE_CALLBACK_CANCEL;
}

View File

@ -172,13 +172,16 @@ _assert_found_internal(const char *file, int line, const struct resolve_ctx *ctx
unsigned int i, len;
const Efl_Net_Ip_Address *o;
if (ctx->err != err)
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wformat-extra-args"
if (ctx->err != err)
_ck_assert_failed(file, line, "Failed",
"Expected error=%d (%s), got %d (%s) resolving=%s",
err, err ? eina_error_msg_get(err) : "success",
ctx->err, ctx->err ? eina_error_msg_get(ctx->err) : "success",
string,
NULL);
#pragma GCC diagnostic pop
if (err) return;
@ -191,11 +194,14 @@ _assert_found_internal(const char *file, int line, const struct resolve_ctx *ctx
EINA_VALUE_ARRAY_FOREACH(ctx->results, len, i, o)
fprintf(stderr, "result %u: %s\n", i, efl_net_ip_address_string_get(o));
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wformat-extra-args"
_ck_assert_failed(file, line, "Failed",
"Expected found=%hhu, got %hhu resolving=%s",
expected, found,
string,
NULL);
#pragma GCC diagnostic pop
}
static Eina_Value

View File

@ -2357,13 +2357,22 @@ EFL_START_TEST(eina_value_test_hash)
fail_unless(str != NULL);
snprintf(buf, sizeof(buf), "first: %d", (int) '!');
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wformat-extra-args"
fail_unless(strstr(str, buf) != NULL, "Couldn't find '%s' in '%s'", buf, str);
#pragma GCC diagnostic pop
snprintf(buf, sizeof(buf), "second: %d", (int) '-');
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wformat-extra-args"
fail_unless(strstr(str, buf) != NULL, "Couldn't find '%s' in '%s'", buf, str);
#pragma GCC diagnostic pop
snprintf(buf, sizeof(buf), "third: %d", (int) 's');
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wformat-extra-args"
fail_unless(strstr(str, buf) != NULL, "Couldn't find '%s' in '%s'", buf, str);
#pragma GCC diagnostic pop
free(str);
@ -2380,19 +2389,34 @@ EFL_START_TEST(eina_value_test_hash)
fail_unless(str != NULL);
eina_strlcpy(buf, "a: Enlightenment.org", sizeof(buf));
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wformat-extra-args"
fail_unless(strstr(str, buf) != NULL, "Couldn't find '%s' in '%s'", buf, str);
#pragma GCC diagnostic pop
eina_strlcpy(buf, "b: X11", sizeof(buf));
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wformat-extra-args"
fail_unless(strstr(str, buf) != NULL, "Couldn't find '%s' in '%s'", buf, str);
#pragma GCC diagnostic pop
eina_strlcpy(buf, "c: Pants", sizeof(buf));
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wformat-extra-args"
fail_unless(strstr(str, buf) != NULL, "Couldn't find '%s' in '%s'", buf, str);
#pragma GCC diagnostic pop
eina_strlcpy(buf, "d: on!!!", sizeof(buf));
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wformat-extra-args"
fail_unless(strstr(str, buf) != NULL, "Couldn't find '%s' in '%s'", buf, str);
#pragma GCC diagnostic pop
eina_strlcpy(buf, "e: k-s", sizeof(buf));
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wformat-extra-args"
fail_unless(strstr(str, buf) != NULL, "Couldn't find '%s' in '%s'", buf, str);
#pragma GCC diagnostic pop
free(str);

View File

@ -168,7 +168,10 @@ EFL_START_TEST(efl_io_model_test_test_file)
filemodel = efl_add(EFL_IO_MODEL_CLASS, efl_main_loop_get(),
efl_io_model_path_set(efl_added, EFL_MODEL_TEST_FILENAME_PATH));
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wformat-extra-args"
fail_if(!filemodel, "ERROR: Cannot init model!\n");
#pragma GCC diagnostic pop
handler = ecore_event_handler_add(ECORE_EVENT_SIGNAL_EXIT, exit_func, NULL);

View File

@ -172,7 +172,10 @@ EFL_START_TEST(efl_io_model_test_test_monitor_add)
filemodel = efl_add(EFL_IO_MODEL_CLASS,
efl_main_loop_get(),
efl_io_model_path_set(efl_added, tmpdir));
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wformat-extra-args"
fail_if(!filemodel, "ERROR: Cannot init model!\n");
#pragma GCC diagnostic pop
efl_event_callback_add(filemodel, EFL_MODEL_EVENT_CHILD_ADDED, &_children_added_cb, filemodel);
efl_event_callback_add(filemodel, EFL_MODEL_EVENT_CHILD_REMOVED, &_children_removed_cb, NULL);

View File

@ -151,12 +151,18 @@ EFL_START_TEST(evas_filter_parser)
fprintf(stderr, "Evas filters tests: end of invalid cases.\n");
evas_filter_program_del(pgm);
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wformat-extra-args"
for (int k = 0; good[k]; k++)
CHKGOOD(good[k]);
#pragma GCC diagnostic pop
fprintf(stderr, "Evas filters tests: start invalid cases. Ignore the following ERRs.\n");
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wformat-extra-args"
for (int k = 0; bad[k]; k++)
CHKBAAD(bad[k]);
#pragma GCC diagnostic pop
fprintf(stderr, "Evas filters tests: end of invalid cases.\n");
// All colors -- FIXME: need to check actual color value
@ -193,7 +199,10 @@ EFL_START_TEST(evas_filter_parser)
{
char buf[64];
sprintf(buf, "blend { color = '%s' }", colors[c]);
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wformat-extra-args"
CHKGOOD(buf);
#pragma GCC diagnostic pop
}
// fillmodes are parsed when converting from instructions to commands
@ -303,10 +312,13 @@ EFL_START_TEST(evas_filter_text_padding_test)
evas_object_geometry_get(to, NULL, NULL, &W, &H);
//fprintf(stderr, "Case %d: %dx%d for padding %d,%d,%d,%d\n", k, W, H, l, r, t, b);
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wformat-extra-args"
fail_if((l != tc->l) || (r != tc->r) || (t != tc->t) || (b != tc->b),
"Failed on invalid padding with '%s'\n", tc->code);
fail_if((W != (tc->l + tc->r + w)) || (H != (tc->t + tc->b + h)),
"Failed on invalid geometry with '%s'\n", tc->code);
#pragma GCC diagnostic pop
}
END_FILTER_TEST();
@ -384,7 +396,10 @@ EFL_START_TEST(evas_filter_text_render_test)
struct Filter_Test_Case *tc = &(_test_cases[k]);
w = h = 0;
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wformat-extra-args"
CHKGOOD(tc->code);
#pragma GCC diagnostic pop
if (tc->source)
{
o = evas_object_rectangle_add(evas);
@ -410,8 +425,11 @@ EFL_START_TEST(evas_filter_text_render_test)
evas_object_resize(rect, w, h);
ecore_evas_manual_render(ee);
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wformat-extra-args"
fail_if(!_ecore_evas_pixels_check(ee),
"Render test failed with: [%dx%d] '%s'", w, h, tc->code);
#pragma GCC diagnostic pop
evas_object_del(o);
evas_object_del(rect);
@ -453,19 +471,28 @@ EFL_START_TEST(evas_filter_state_test)
/* check pixels */
ecore_evas_manual_render(ee);
pixels = ecore_evas_buffer_pixels_get(ee);
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wformat-extra-args"
fail_if(!pixels || (*pixels != 0xFFFF0000),
"state render test failed: %p (%#x)", pixels, pixels ? *pixels : 0);
#pragma GCC diagnostic pop
efl_gfx_filter_state_get(to, &s1, &v1, &s2, &v2, &p);
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wformat-extra-args"
fail_unless(strequal(s1, "state1") && strequal(s2, "state2") && EINA_DBL_EQ(v1, 0.0) && EINA_DBL_EQ(v2, 1.0) && EINA_DBL_EQ(p, 0.5),
"got: %s %f %s %f %f", s1, v1, s2, v2, p);
#pragma GCC diagnostic pop
/* data test */
efl_gfx_filter_data_set(to, "data", "{r=0, g=255, b=0, a=255}", 1);
ecore_evas_manual_render(ee);
pixels = ecore_evas_buffer_pixels_get(ee);
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wformat-extra-args"
fail_if(!pixels || (*pixels != 0xFF00FF00),
"state render test failed: %p (%#x)", pixels, pixels ? *pixels : 0);
#pragma GCC diagnostic pop
END_FILTER_TEST();
}

View File

@ -282,8 +282,11 @@ EFL_START_TEST(evas_object_image_loader_orientation)
r_d = evas_object_image_data_get(rot, EINA_FALSE);
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wformat-extra-args"
fail_if(res[i].compare_func(d, r_d, r_w, r_h),
"Image orientation test failed: exif orientation flag: %s\n", res[i].desc);
#pragma GCC diagnostic pop
}
evas_object_del(orig);
@ -332,8 +335,11 @@ EFL_START_TEST(evas_object_image_orient)
r_d = evas_object_image_data_get(orig, EINA_FALSE);
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wformat-extra-args"
fail_if(res[i].compare_func(d, r_d, r_w, r_h),
"Image orientation test failed: orient flag: %s\n", res[i].desc);
#pragma GCC diagnostic pop
}
evas_object_del(orig);
@ -622,8 +628,11 @@ EFL_START_TEST(evas_object_image_partially_load_orientation)
evas_object_image_size_get(rot, &r_w, &r_h);
fail_if(w * h != r_w * r_h);
r_d = evas_object_image_data_get(rot, EINA_FALSE);
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wformat-extra-args"
fail_if(res[i].compare_func(d, r_d, r_w, r_h),
"Image orientation partially load test failed: exif orientation flag: %s\n", res[i].desc);
#pragma GCC diagnostic pop
evas_object_del(rot);
}
@ -954,6 +963,8 @@ EFL_START_TEST(evas_object_image_map_unmap)
orig = sorig.mem;
// first quarter: same image
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wformat-extra-args"
for (y = 0; y < h / 4; y++)
for (x = 0; x < w; x++)
fail_if(orig[y*stride/4 + x] != dest[y*stride2/4+x], "pixels differ [1]");
@ -983,6 +994,7 @@ EFL_START_TEST(evas_object_image_map_unmap)
fail_if(dest[y*stride/4 + x] != 0xFF00FF00, "pixels differ [3]");
fail_if(dest[(y+1)*stride/4 + x] != 0xFFFF0000, "pixels differ [4]");
}
#pragma GCC diagnostic pop
efl_gfx_buffer_unmap(o, sorig);
efl_gfx_buffer_unmap(o2, sdest);

View File

@ -58,7 +58,10 @@ EFL_START_TEST(evas_render_engines)
for (itr = built_engines; *itr != NULL; itr++)
{
Eina_Bool found = _find_list(lst, *itr);
fail_if(!found, "module should be built, but was not found: %s", *itr);
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wformat-extra-args"
fail_if(!found, "module should be built, but was not found: %s", *itr);
#pragma GCC diagnostic pop
}
evas_render_method_list_free(lst);
@ -72,7 +75,10 @@ EFL_START_TEST(evas_render_lookup)
for (itr = built_engines; *itr != NULL; itr++)
{
int id = evas_render_method_lookup(*itr);
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wformat-extra-args"
fail_if(id == 0, "could not load engine: %s", *itr);
#pragma GCC diagnostic pop
}
}
EFL_END_TEST