LCOV - code coverage report
Current view: top level - fuzz - fuzz-udev-database.c (source / functions) Hit Total Coverage
Test: systemd_full.info Lines: 0 13 0.0 %
Date: 2019-08-23 13:36:53 Functions: 0 1 0.0 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 0 10 0.0 %

           Branch data     Line data    Source code
       1                 :            : /* SPDX-License-Identifier: LGPL-2.1+ */
       2                 :            : 
       3                 :            : #include "device-internal.h"
       4                 :            : #include "device-private.h"
       5                 :            : #include "fd-util.h"
       6                 :            : #include "fs-util.h"
       7                 :            : #include "fuzz.h"
       8                 :            : #include "tmpfile-util.h"
       9                 :            : 
      10                 :          0 : int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) {
      11                 :          0 :         _cleanup_(sd_device_unrefp) sd_device *dev = NULL;
      12                 :          0 :         _cleanup_(unlink_tempfilep) char filename[] = "/tmp/fuzz-udev-database.XXXXXX";
      13                 :          0 :         _cleanup_fclose_ FILE *f = NULL;
      14                 :            : 
      15         [ #  # ]:          0 :         if (!getenv("SYSTEMD_LOG_LEVEL"))
      16                 :          0 :                 log_set_max_level(LOG_CRIT);
      17                 :            : 
      18         [ #  # ]:          0 :         assert_se(fmkostemp_safe(filename, "r+", &f) == 0);
      19         [ #  # ]:          0 :         if (size != 0)
      20         [ #  # ]:          0 :                 assert_se(fwrite(data, size, 1, f) == 1);
      21                 :            : 
      22                 :          0 :         fflush(f);
      23         [ #  # ]:          0 :         assert_se(device_new_aux(&dev) >= 0);
      24                 :          0 :         (void) device_read_db_internal_filename(dev, filename);
      25                 :          0 :         return 0;
      26                 :            : }

Generated by: LCOV version 1.14