LCOV - code coverage report
Current view: top level - glib/gio/tests - unix-mounts.c (source / functions) Hit Total Coverage
Test: unnamed Lines: 18 18 100.0 %
Date: 2024-04-23 05:16:05 Functions: 3 3 100.0 %
Branches: 0 0 -

           Branch data     Line data    Source code
       1                 :            : /* GLib testing framework examples and tests
       2                 :            :  *
       3                 :            :  * Copyright © 2017 Endless Mobile, Inc.
       4                 :            :  *
       5                 :            :  * SPDX-License-Identifier: LGPL-2.1-or-later
       6                 :            :  *
       7                 :            :  * This library is free software; you can redistribute it and/or
       8                 :            :  * modify it under the terms of the GNU Lesser General Public
       9                 :            :  * License as published by the Free Software Foundation; either
      10                 :            :  * version 2.1 of the License, or (at your option) any later version.
      11                 :            :  *
      12                 :            :  * This library is distributed in the hope that it will be useful,
      13                 :            :  * but WITHOUT ANY WARRANTY; without even the implied warranty of
      14                 :            :  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
      15                 :            :  * Lesser General Public License for more details.
      16                 :            :  *
      17                 :            :  * You should have received a copy of the GNU Lesser General
      18                 :            :  * Public License along with this library; if not, see <http://www.gnu.org/licenses/>.
      19                 :            :  */
      20                 :            : 
      21                 :            : #include <glib.h>
      22                 :            : 
      23                 :            : #ifndef G_OS_UNIX
      24                 :            : #error This is a Unix-specific test
      25                 :            : #endif
      26                 :            : 
      27                 :            : #include <errno.h>
      28                 :            : #include <locale.h>
      29                 :            : #include <glib/gstdio.h>
      30                 :            : #include <gio/gio.h>
      31                 :            : #include <gio/gunixmounts.h>
      32                 :            : 
      33                 :            : static void
      34                 :          1 : test_is_system_fs_type (void)
      35                 :            : {
      36                 :          1 :   g_assert_true (g_unix_is_system_fs_type ("tmpfs"));
      37                 :          1 :   g_assert_false (g_unix_is_system_fs_type ("ext4"));
      38                 :            : 
      39                 :            :   /* Check that some common network file systems aren’t considered ‘system’. */
      40                 :          1 :   g_assert_false (g_unix_is_system_fs_type ("cifs"));
      41                 :          1 :   g_assert_false (g_unix_is_system_fs_type ("nfs"));
      42                 :          1 :   g_assert_false (g_unix_is_system_fs_type ("nfs4"));
      43                 :          1 :   g_assert_false (g_unix_is_system_fs_type ("smbfs"));
      44                 :          1 : }
      45                 :            : 
      46                 :            : static void
      47                 :          1 : test_is_system_device_path (void)
      48                 :            : {
      49                 :          1 :   g_assert_true (g_unix_is_system_device_path ("devpts"));
      50                 :          1 :   g_assert_false (g_unix_is_system_device_path ("/"));
      51                 :          1 : }
      52                 :            : 
      53                 :            : int
      54                 :          1 : main (int   argc,
      55                 :            :       char *argv[])
      56                 :            : {
      57                 :          1 :   setlocale (LC_ALL, "");
      58                 :            : 
      59                 :          1 :   g_test_init (&argc, &argv, NULL);
      60                 :            : 
      61                 :          1 :   g_test_add_func ("/unix-mounts/is-system-fs-type", test_is_system_fs_type);
      62                 :          1 :   g_test_add_func ("/unix-mounts/is-system-device-path", test_is_system_device_path);
      63                 :            : 
      64                 :          1 :   return g_test_run ();
      65                 :            : }

Generated by: LCOV version 1.14