From 9593fc545950782ed75f12f53238b07885559b2b Mon Sep 17 00:00:00 2001 From: William Casarin Date: Mon, 9 Jul 2018 22:28:25 -0700 Subject: remove ccan for now --- ccan/list/test/run-check-corrupt.c | 90 -------------------------------------- 1 file changed, 90 deletions(-) delete mode 100644 ccan/list/test/run-check-corrupt.c (limited to 'ccan/list/test/run-check-corrupt.c') diff --git a/ccan/list/test/run-check-corrupt.c b/ccan/list/test/run-check-corrupt.c deleted file mode 100644 index 94c2e67..0000000 --- a/ccan/list/test/run-check-corrupt.c +++ /dev/null @@ -1,90 +0,0 @@ -#include -#include -#include -#include -#include -#include - -/* We don't actually want it to exit... */ -static jmp_buf aborted; -#define abort() longjmp(aborted, 1) - -#define fprintf my_fprintf -static char printf_buffer[1000]; - -static int my_fprintf(FILE *stream, const char *format, ...) -{ - va_list ap; - int ret; - (void)stream; - va_start(ap, format); - ret = vsprintf(printf_buffer, format, ap); - va_end(ap); - return ret; -} - -#include -#include -#include - -int main(void) -{ - struct list_head list; - struct list_node n1; - char expect[100]; - - plan_tests(9); - /* Empty list. */ - list.n.next = &list.n; - list.n.prev = &list.n; - ok1(list_check(&list, NULL) == &list); - - /* Bad back ptr */ - list.n.prev = &n1; - /* Non-aborting version. */ - ok1(list_check(&list, NULL) == NULL); - - /* Aborting version. */ - sprintf(expect, "test message: prev corrupt in node %p (0) of %p\n", - &list, &list); - if (setjmp(aborted) == 0) { - list_check(&list, "test message"); - fail("list_check on empty with bad back ptr didn't fail!"); - } else { - ok1(strcmp(printf_buffer, expect) == 0); - } - - /* n1 in list. */ - list.n.next = &n1; - list.n.prev = &n1; - n1.prev = &list.n; - n1.next = &list.n; - ok1(list_check(&list, NULL) == &list); - ok1(list_check_node(&n1, NULL) == &n1); - - /* Bad back ptr */ - n1.prev = &n1; - ok1(list_check(&list, NULL) == NULL); - ok1(list_check_node(&n1, NULL) == NULL); - - /* Aborting version. */ - sprintf(expect, "test message: prev corrupt in node %p (1) of %p\n", - &n1, &list); - if (setjmp(aborted) == 0) { - list_check(&list, "test message"); - fail("list_check on n1 bad back ptr didn't fail!"); - } else { - ok1(strcmp(printf_buffer, expect) == 0); - } - - sprintf(expect, "test message: prev corrupt in node %p (0) of %p\n", - &n1, &n1); - if (setjmp(aborted) == 0) { - list_check_node(&n1, "test message"); - fail("list_check_node on n1 bad back ptr didn't fail!"); - } else { - ok1(strcmp(printf_buffer, expect) == 0); - } - - return exit_status(); -} -- cgit v1.2.3