LCOV - code coverage report
Current view: top level - ccan/list/test - run-list_del_from-assert.c (source / functions) Hit Total Coverage
Test: skiboot.info Lines: 12 14 85.7 %
Date: 2024-01-02 21:04:04 Functions: 1 1 100.0 %
Branches: 0 0 -

           Branch data     Line data    Source code
       1                 :            : #define CCAN_LIST_DEBUG 1
       2                 :            : #include <ccan/list/list.h>
       3                 :            : #include <ccan/tap/tap.h>
       4                 :            : #include <ccan/list/list.c>
       5                 :            : #include <sys/types.h>
       6                 :            : #include <sys/wait.h>
       7                 :            : #include <unistd.h>
       8                 :            : #include <signal.h>
       9                 :            : 
      10                 :         10 : int main(void)
      11                 :            : {
      12                 :            :         struct list_head list1, list2;
      13                 :            :         struct list_node n1, n2, n3;
      14                 :            :         pid_t child;
      15                 :            :         int status;
      16                 :            : 
      17                 :            :         plan_tests(1);
      18                 :         10 :         list_head_init(&list1);
      19                 :         10 :         list_head_init(&list2);
      20                 :         10 :         list_add(&list1, &n1);
      21                 :         10 :         list_add(&list2, &n2);
      22                 :         10 :         list_add_tail(&list2, &n3);
      23                 :            : 
      24                 :         10 :         child = fork();
      25                 :         10 :         if (child) {
      26                 :         10 :                 wait(&status);
      27                 :            :         } else {
      28                 :            :                 /* This should abort. */
      29                 :          0 :                 list_del_from(&list1, &n3);
      30                 :          0 :                 exit(0);
      31                 :            :         }
      32                 :            : 
      33                 :         10 :         ok1(WIFSIGNALED(status) && WTERMSIG(status) == SIGABRT);
      34                 :         10 :         list_del_from(&list2, &n3);
      35                 :         10 :         return exit_status();
      36                 :            : }

Generated by: LCOV version 1.14