Diego Elio Petteno (autoconf patch for 64-bit safe code)
Jon Kowal (deadlock on thread cancellation fix)
Jerry James (cleanup compiler warnings)
+ Martin Willers (rename check's internal list API to start with check_)
Anybody who has contributed code to Check or Check's build system is
considered an author. Send patches to this file to
* Cleanup compile warnings, patch #3579199 on SF.
+* Renamed Check's internal list functions to start with check_, patch #3448601 on SF.
+
Mon, Oct 22, 2012: Released Check 0.9.9
based on r637 (2012-10-22 13:54:14 +0200)
return 0;
l = s->tclst;
- for (list_front (l); !list_at_end (l); list_advance (l)) {
- tc = list_val (l);
+ for (check_list_front (l); !check_list_at_end (l); check_list_advance (l)) {
+ tc = check_list_val (l);
if (strcmp (tcname, tc->name) == 0)
return 1;
}
if (s == NULL)
return;
l = s->tclst;
- for (list_front(l); !list_at_end(l); list_advance (l)) {
- tcase_free (list_val(l));
+ for (check_list_front(l); !check_list_at_end(l); check_list_advance (l)) {
+ tcase_free (check_list_val(l));
}
- list_free (s->tclst);
+ check_list_free (s->tclst);
free(s);
}
static void tcase_free (TCase *tc)
{
- list_apply (tc->tflst, free);
- list_apply (tc->unch_sflst, free);
- list_apply (tc->ch_sflst, free);
- list_apply (tc->unch_tflst, free);
- list_apply (tc->ch_tflst, free);
- list_free(tc->tflst);
- list_free(tc->unch_sflst);
- list_free(tc->ch_sflst);
- list_free(tc->unch_tflst);
- list_free(tc->ch_tflst);
+ check_list_apply (tc->tflst, free);
+ check_list_apply (tc->unch_sflst, free);
+ check_list_apply (tc->ch_sflst, free);
+ check_list_apply (tc->unch_tflst, free);
+ check_list_apply (tc->ch_tflst, free);
+ check_list_free(tc->tflst);
+ check_list_free(tc->unch_sflst);
+ check_list_free(tc->ch_sflst);
+ check_list_free(tc->unch_tflst);
+ check_list_free(tc->ch_tflst);
free(tc);
}
{
if (s == NULL || tc == NULL)
return;
- list_add_end (s->tclst, tc);
+ check_list_add_end (s->tclst, tc);
}
void _tcase_add_test (TCase *tc, TFun fn, const char *name, int _signal, int allowed_exit_value, int start, int end)
tf->signal = _signal; /* 0 means no signal expected */
tf->allowed_exit_value = allowed_exit_value; /* 0 is default successful exit */
tf->name = name;
- list_add_end (tc->tflst, tf);
+ check_list_add_end (tc->tflst, tf);
}
static Fixture *fixture_create (SFun fun, int ischecked)
{
if (setup) {
if (ischecked)
- list_add_end (tc->ch_sflst, fixture_create(setup, ischecked));
+ check_list_add_end (tc->ch_sflst, fixture_create(setup, ischecked));
else
- list_add_end (tc->unch_sflst, fixture_create(setup, ischecked));
+ check_list_add_end (tc->unch_sflst, fixture_create(setup, ischecked));
}
/* Add teardowns at front so they are run in reverse order. */
if (teardown) {
if (ischecked)
- list_add_front (tc->ch_tflst, fixture_create(teardown, ischecked));
+ check_list_add_front (tc->ch_tflst, fixture_create(teardown, ischecked));
else
- list_add_front (tc->unch_tflst, fixture_create(teardown, ischecked));
+ check_list_add_front (tc->unch_tflst, fixture_create(teardown, ischecked));
}
}
SRunner *sr = emalloc (sizeof(SRunner)); /* freed in srunner_free */
sr->slst = check_list_create();
if (s != NULL)
- list_add_end(sr->slst, s);
+ check_list_add_end(sr->slst, s);
sr->stats = emalloc (sizeof(TestStats)); /* freed in srunner_free */
sr->stats->n_checked = sr->stats->n_failed = sr->stats->n_errors = 0;
sr->resultlst = check_list_create();
if (s == NULL)
return;
- list_add_end(sr->slst, s);
+ check_list_add_end(sr->slst, s);
}
void srunner_free (SRunner *sr)
free (sr->stats);
l = sr->slst;
- for (list_front(l); !list_at_end(l); list_advance(l)) {
- suite_free(list_val(l));
+ for (check_list_front(l); !check_list_at_end(l); check_list_advance(l)) {
+ suite_free(check_list_val(l));
}
- list_free(sr->slst);
+ check_list_free(sr->slst);
l = sr->resultlst;
- for (list_front(l); !list_at_end(l); list_advance(l)) {
- tr = list_val(l);
+ for (check_list_front(l); !check_list_at_end(l); check_list_advance(l)) {
+ tr = check_list_val(l);
free(tr->file);
free(tr->msg);
free(tr);
}
- list_free (sr->resultlst);
+ check_list_free (sr->resultlst);
free (sr);
}
trarray = malloc (sizeof(trarray[0]) * srunner_ntests_failed (sr));
rlst = sr->resultlst;
- for (list_front(rlst); !list_at_end(rlst); list_advance(rlst)) {
- TestResult *tr = list_val(rlst);
+ for (check_list_front(rlst); !check_list_at_end(rlst); check_list_advance(rlst)) {
+ TestResult *tr = check_list_val(rlst);
if (non_pass(tr->rtype))
trarray[i++] = tr;
trarray = malloc (sizeof(trarray[0]) * srunner_ntests_run (sr));
rlst = sr->resultlst;
- for (list_front(rlst); !list_at_end(rlst); list_advance(rlst)) {
- trarray[i++] = list_val(rlst);
+ for (check_list_front(rlst); !check_list_at_end(rlst); check_list_advance(rlst)) {
+ trarray[i++] = check_list_val(rlst);
}
return trarray;
}
return lp;
}
-void list_add_front (List *lp, const void *val)
+void check_list_add_front (List *lp, const void *val)
{
if (lp == NULL)
return;
lp->data[lp->current] = val;
}
-void list_add_end (List *lp, const void *val)
+void check_list_add_end (List *lp, const void *val)
{
if (lp == NULL)
return;
lp->data[lp->current] = val;
}
-int list_at_end (List *lp)
+int check_list_at_end (List *lp)
{
if (lp->current == -1)
return 1;
return (lp->current > lp->last);
}
-void list_front (List *lp)
+void check_list_front (List *lp)
{
if (lp->current == -1)
return;
}
-void list_free (List *lp)
+void check_list_free (List *lp)
{
if (lp == NULL)
return;
free (lp);
}
-void *list_val (List *lp)
+void *check_list_val (List *lp)
{
if (lp == NULL)
return NULL;
return (void*) lp->data[lp->current];
}
-void list_advance (List *lp)
+void check_list_advance (List *lp)
{
if (lp == NULL)
return;
- if (list_at_end(lp))
+ if (check_list_at_end(lp))
return;
lp->current++;
}
-void list_apply (List *lp, void (*fp) (void *))
+void check_list_apply (List *lp, void (*fp) (void *))
{
if (lp == NULL || fp == NULL)
return;
- for (list_front(lp); !list_at_end(lp); list_advance(lp))
- fp (list_val(lp));
+ for (check_list_front(lp); !check_list_at_end(lp); check_list_advance(lp))
+ fp (check_list_val(lp));
}
List * check_list_create (void);
/* Is list at end? */
-int list_at_end (List * lp);
+int check_list_at_end (List * lp);
/* Position list at front */
-void list_front(List *lp);
+void check_list_front(List *lp);
/* Add a value to the front of the list,
positioning newly added value as current value.
More expensive than list_add_end, as it uses memmove. */
-void list_add_front (List *lp, const void *val);
+void check_list_add_front (List *lp, const void *val);
/* Add a value to the end of the list,
positioning newly added value as current value */
-void list_add_end (List *lp, const void *val);
+void check_list_add_end (List *lp, const void *val);
/* Give the value of the current node */
-void *list_val (List * lp);
+void *check_list_val (List * lp);
/* Position the list at the next node */
-void list_advance (List * lp);
+void check_list_advance (List * lp);
/* Free a list, but don't free values */
-void list_free (List * lp);
+void check_list_free (List * lp);
-void list_apply (List *lp, void (*fp) (void *));
+void check_list_apply (List *lp, void (*fp) (void *));
#endif /* CHECK_LIST_H */
l->lfun = lfun;
l->close = close;
l->mode = printmode;
- list_add_end (sr->loglst, l);
+ check_list_add_end (sr->loglst, l);
return;
}
List *l;
Log *lg;
l = sr->loglst;
- for (list_front(l); !list_at_end(l); list_advance(l)) {
- lg = list_val(l);
+ for (check_list_front(l); !check_list_at_end(l); check_list_advance(l)) {
+ lg = check_list_val(l);
fflush(lg->lfile);
lg->lfun (sr, lg->lfile, lg->mode, obj, evt);
fflush(lg->lfile);
srunner_send_evt (sr, NULL, CLENDLOG_SR);
l = sr->loglst;
- for (list_front(l); !list_at_end(l); list_advance(l)) {
- Log *lg = list_val(l);
+ for (check_list_front(l); !check_list_at_end(l); check_list_advance(l)) {
+ Log *lg = check_list_val(l);
if (lg->close) {
rval = fclose (lg->lfile);
if (rval != 0)
}
free (lg);
}
- list_free(l);
+ check_list_free(l);
sr->loglst = NULL;
}
resultlst = sr->resultlst;
- for (list_front(resultlst); !list_at_end(resultlst); list_advance(resultlst)) {
- TestResult *tr = list_val(resultlst);
+ for (check_list_front(resultlst); !check_list_at_end(resultlst); check_list_advance(resultlst)) {
+ TestResult *tr = check_list_val(resultlst);
tr_fprint (file, tr, print_mode);
}
return;
slst = sr->slst;
- for (list_front(slst); !list_at_end(slst); list_advance(slst)) {
- Suite *s = list_val(slst);
+ for (check_list_front(slst); !check_list_at_end(slst); check_list_advance(slst)) {
+ Suite *s = check_list_val(slst);
if (((sname != NULL) && (strcmp (sname, s->name) != 0))
|| ((tcname != NULL) && (!suite_tcase (s, tcname))))
tcl = s->tclst;
- for (list_front(tcl);!list_at_end (tcl); list_advance (tcl)) {
- tc = list_val (tcl);
+ for (check_list_front(tcl);!check_list_at_end (tcl); check_list_advance (tcl)) {
+ tc = check_list_val (tcl);
if ((tcname != NULL) && (strcmp (tcname, tc->name) != 0)) {
continue;
tfl = tc->tflst;
- for (list_front(tfl); !list_at_end (tfl); list_advance (tfl)) {
+ for (check_list_front(tfl); !check_list_at_end (tfl); check_list_advance (tfl)) {
int i;
- tfun = list_val (tfl);
+ tfun = check_list_val (tfl);
for (i = tfun->loop_start; i < tfun->loop_end; i++)
{
static void srunner_add_failure (SRunner *sr, TestResult *tr)
{
- list_add_end (sr->resultlst, tr);
+ check_list_add_end (sr->resultlst, tr);
sr->stats->n_checked++; /* count checks during setup, test, and teardown */
if (tr->rtype == CK_FAILURE)
sr->stats->n_failed++;
l = tc->unch_sflst;
- for (list_front(l); !list_at_end(l); list_advance(l)) {
+ for (check_list_front(l); !check_list_at_end(l); check_list_advance(l)) {
send_ctx_info(CK_CTX_SETUP);
- f = list_val(l);
+ f = check_list_val(l);
if ( 0 == setjmp(error_jmp_buffer) ) {
f->fun();
send_ctx_info(CK_CTX_SETUP);
}
- for (list_front(l); !list_at_end(l); list_advance(l)) {
- f = list_val(l);
+ for (check_list_front(l); !check_list_at_end(l); check_list_advance(l)) {
+ f = check_list_val(l);
if (fstat == CK_NOFORK) {
send_ctx_info(CK_CTX_SETUP);
{
Fixture *f;
- for (list_front(l); !list_at_end(l); list_advance(l)) {
- f = list_val(l);
+ for (check_list_front(l); !check_list_at_end(l); check_list_advance(l)) {
+ f = check_list_val(l);
send_ctx_info(CK_CTX_TEARDOWN);
f->fun ();
}
Suite *s = suite_create("Suite");
SRunner *sr = srunner_create(s);
srunner_init_logging(sr, CK_SUBUNIT);
- list_front (sr->loglst);
- ck_assert_msg (!list_at_end(sr->loglst), "No entries in log list");
- first_log = list_val(sr->loglst);
+ check_list_front (sr->loglst);
+ ck_assert_msg (!check_list_at_end(sr->loglst), "No entries in log list");
+ first_log = check_list_val(sr->loglst);
ck_assert_msg (first_log != NULL, "log is NULL");
- list_advance(sr->loglst);
- ck_assert_msg(list_at_end(sr->loglst), "More than one entry in log list");
+ check_list_advance(sr->loglst);
+ ck_assert_msg(check_list_at_end(sr->loglst), "More than one entry in log list");
ck_assert_msg(first_log->lfun == subunit_lfun,
"Log function is not the subunit lfun.");
srunner_end_logging(sr);
{
List *lp = NULL;
- ck_assert_msg (list_val(lp) == NULL,
+ ck_assert_msg (check_list_val(lp) == NULL,
"Current list value should be NULL for NULL list");
lp = check_list_create();
- ck_assert_msg (list_val(lp) == NULL,
+ ck_assert_msg (check_list_val(lp) == NULL,
"Current list value should be NULL for newly created list");
- ck_assert_msg (list_at_end(lp),
+ ck_assert_msg (check_list_at_end(lp),
"Newly created list should be at end");
- list_advance(lp);
- ck_assert_msg (list_at_end(lp),
+ check_list_advance(lp);
+ ck_assert_msg (check_list_at_end(lp),
"Advancing a list at end should produce a list at end");
- list_free (lp);
+ check_list_free (lp);
}
END_TEST
START_TEST(test_free)
{
List *lp = check_list_create();
- list_add_end (lp, "abc");
- list_add_end (lp, "123");
- list_add_end (lp, NULL);
- list_free (lp);
+ check_list_add_end (lp, "abc");
+ check_list_add_end (lp, "123");
+ check_list_add_end (lp, NULL);
+ check_list_free (lp);
}
END_TEST
List * lp = check_list_create();
const char * tval = "abc";
- list_add_end (lp, tval);
+ check_list_add_end (lp, tval);
- ck_assert_msg (list_val (lp) != NULL,
+ ck_assert_msg (check_list_val (lp) != NULL,
"List current val should not be null after new insertion");
- ck_assert_msg (!list_at_end (lp),
+ ck_assert_msg (!check_list_at_end (lp),
"List should be at end after new insertion");
- ck_assert_msg (strcmp(tval, (char *) list_val (lp)) == 0,
+ ck_assert_msg (strcmp(tval, (char *) check_list_val (lp)) == 0,
"List current val should equal newly inserted val");
- list_free (lp);
+ check_list_free (lp);
}
END_TEST
List * lp = check_list_create();
const char * tval = "abc";
- list_add_front (lp, tval);
+ check_list_add_front (lp, tval);
- ck_assert_msg (list_val (lp) != NULL,
+ ck_assert_msg (check_list_val (lp) != NULL,
"List current val should not be null after new insertion");
- ck_assert_msg (strcmp(tval, (char *) list_val (lp)) == 0,
+ ck_assert_msg (strcmp(tval, (char *) check_list_val (lp)) == 0,
"List current val should equal newly inserted val");
- list_free (lp);
+ check_list_free (lp);
}
END_TEST
const char *tval1 = "abc";
const char *tval2 = "123";
- list_add_end (lp, tval1);
- list_add_end (lp, tval2);
- list_front(lp);
- ck_assert_msg (strcmp (tval1, list_val (lp)) == 0,
+ check_list_add_end (lp, tval1);
+ check_list_add_end (lp, tval2);
+ check_list_front(lp);
+ ck_assert_msg (strcmp (tval1, check_list_val (lp)) == 0,
"List head val should equal first inserted val");
- list_advance (lp);
- ck_assert_msg (!list_at_end (lp),
+ check_list_advance (lp);
+ ck_assert_msg (!check_list_at_end (lp),
"List should not be at end after two adds and one next");
- ck_assert_msg (strcmp (tval2, list_val (lp)) == 0,
+ ck_assert_msg (strcmp (tval2, check_list_val (lp)) == 0,
"List val should equal second inserted val");
- list_advance(lp);
- ck_assert_msg (list_at_end (lp),
+ check_list_advance(lp);
+ ck_assert_msg (check_list_at_end (lp),
"List should be at and after two adds and two nexts");
- list_free (lp);
+ check_list_free (lp);
}
END_TEST
const char *tval1 = "abc";
const char *tval2 = "123";
- list_add_front (lp, tval1);
- list_add_front (lp, tval2);
- list_front(lp);
- ck_assert_msg (strcmp (tval2, list_val (lp)) == 0,
+ check_list_add_front (lp, tval1);
+ check_list_add_front (lp, tval2);
+ check_list_front(lp);
+ ck_assert_msg (strcmp (tval2, check_list_val (lp)) == 0,
"List head val should equal last inserted val");
- list_advance (lp);
- ck_assert_msg (!list_at_end (lp),
+ check_list_advance (lp);
+ ck_assert_msg (!check_list_at_end (lp),
"List should not be at end after two adds and one next");
- ck_assert_msg (strcmp (tval1, list_val (lp)) == 0,
+ ck_assert_msg (strcmp (tval1, check_list_val (lp)) == 0,
"List val should equal first inserted val");
- list_advance(lp);
- ck_assert_msg (list_at_end (lp),
+ check_list_advance(lp);
+ ck_assert_msg (check_list_at_end (lp),
"List should be at and after two adds and two nexts");
- list_free (lp);
+ check_list_free (lp);
}
END_TEST
for (i = 0; i < 3; i++) {
lp = check_list_create();
for (j = 0; j < 1000; j++) {
- list_add_end (lp, "abc");
- list_add_front (lp, "123");
+ check_list_add_end (lp, "abc");
+ check_list_add_front (lp, "123");
}
- list_free(lp);
+ check_list_free(lp);
}
}
END_TEST