LCOV - code coverage report
Current view: top level - libsystemd/sd-device - test-udev-device-thread.c (source / functions) Hit Total Coverage
Test: main_coverage.info Lines: 12 12 100.0 %
Date: 2019-08-22 15:41:25 Functions: 2 2 100.0 %

          Line data    Source code
       1             : /* SPDX-License-Identifier: LGPL-2.1+ */
       2             : 
       3             : #include <pthread.h>
       4             : #include <stdbool.h>
       5             : #include <stdio.h>
       6             : #include <stdlib.h>
       7             : 
       8             : #include "libudev.h"
       9             : 
      10             : #include "macro.h"
      11             : 
      12           1 : static void* thread(void *p) {
      13           1 :         struct udev_device **d = p;
      14             : 
      15           1 :         assert_se(!(*d = udev_device_unref(*d)));
      16             : 
      17           1 :         return NULL;
      18             : }
      19             : 
      20           1 : int main(int argc, char *argv[]) {
      21             :         struct udev_device *loopback;
      22             :         pthread_t t;
      23             : 
      24           1 :         assert_se(unsetenv("SYSTEMD_MEMPOOL") == 0);
      25             : 
      26           1 :         assert_se(loopback = udev_device_new_from_syspath(NULL, "/sys/class/net/lo"));
      27             : 
      28           1 :         assert_se(udev_device_get_properties_list_entry(loopback));
      29             : 
      30           1 :         assert_se(pthread_create(&t, NULL, thread, &loopback) == 0);
      31           1 :         assert_se(pthread_join(t, NULL) == 0);
      32             : 
      33           1 :         assert_se(!loopback);
      34             : 
      35           1 :         return 0;
      36             : }

Generated by: LCOV version 1.14