1*49cdfc7eSAndroid Build Coastguard Worker // SPDX-License-Identifier: GPL-2.0-only
2*49cdfc7eSAndroid Build Coastguard Worker /*
3*49cdfc7eSAndroid Build Coastguard Worker * Copyright (c) Wipro Technologies Ltd, 2002. All Rights Reserved.
4*49cdfc7eSAndroid Build Coastguard Worker * Nirmala Devi Dhanasekar <[email protected]>
5*49cdfc7eSAndroid Build Coastguard Worker * Copyright (C) 2024 SUSE LLC Andrea Cervesato <[email protected]>
6*49cdfc7eSAndroid Build Coastguard Worker */
7*49cdfc7eSAndroid Build Coastguard Worker
8*49cdfc7eSAndroid Build Coastguard Worker /*\
9*49cdfc7eSAndroid Build Coastguard Worker * [Description]
10*49cdfc7eSAndroid Build Coastguard Worker *
11*49cdfc7eSAndroid Build Coastguard Worker * Basic test that checks mount() syscall works on multiple filesystems.
12*49cdfc7eSAndroid Build Coastguard Worker */
13*49cdfc7eSAndroid Build Coastguard Worker
14*49cdfc7eSAndroid Build Coastguard Worker #include "tst_test.h"
15*49cdfc7eSAndroid Build Coastguard Worker #include <sys/mount.h>
16*49cdfc7eSAndroid Build Coastguard Worker
17*49cdfc7eSAndroid Build Coastguard Worker #define MNTPOINT "mntpoint"
18*49cdfc7eSAndroid Build Coastguard Worker
cleanup(void)19*49cdfc7eSAndroid Build Coastguard Worker static void cleanup(void)
20*49cdfc7eSAndroid Build Coastguard Worker {
21*49cdfc7eSAndroid Build Coastguard Worker if (tst_is_mounted(MNTPOINT))
22*49cdfc7eSAndroid Build Coastguard Worker SAFE_UMOUNT(MNTPOINT);
23*49cdfc7eSAndroid Build Coastguard Worker }
24*49cdfc7eSAndroid Build Coastguard Worker
run(void)25*49cdfc7eSAndroid Build Coastguard Worker static void run(void)
26*49cdfc7eSAndroid Build Coastguard Worker {
27*49cdfc7eSAndroid Build Coastguard Worker TST_EXP_PASS(mount(tst_device->dev, MNTPOINT, tst_device->fs_type, 0, NULL));
28*49cdfc7eSAndroid Build Coastguard Worker
29*49cdfc7eSAndroid Build Coastguard Worker if (tst_is_mounted(MNTPOINT)) {
30*49cdfc7eSAndroid Build Coastguard Worker tst_res(TPASS, "folder has been mounted");
31*49cdfc7eSAndroid Build Coastguard Worker SAFE_UMOUNT(MNTPOINT);
32*49cdfc7eSAndroid Build Coastguard Worker } else {
33*49cdfc7eSAndroid Build Coastguard Worker tst_res(TFAIL, "folder has not been mounted");
34*49cdfc7eSAndroid Build Coastguard Worker }
35*49cdfc7eSAndroid Build Coastguard Worker }
36*49cdfc7eSAndroid Build Coastguard Worker
37*49cdfc7eSAndroid Build Coastguard Worker static struct tst_test test = {
38*49cdfc7eSAndroid Build Coastguard Worker .cleanup = cleanup,
39*49cdfc7eSAndroid Build Coastguard Worker .test_all = run,
40*49cdfc7eSAndroid Build Coastguard Worker .needs_root = 1,
41*49cdfc7eSAndroid Build Coastguard Worker .format_device = 1,
42*49cdfc7eSAndroid Build Coastguard Worker .all_filesystems = 1,
43*49cdfc7eSAndroid Build Coastguard Worker .mntpoint = MNTPOINT,
44*49cdfc7eSAndroid Build Coastguard Worker .skip_filesystems = (const char *const []){
45*49cdfc7eSAndroid Build Coastguard Worker "ntfs",
46*49cdfc7eSAndroid Build Coastguard Worker NULL
47*49cdfc7eSAndroid Build Coastguard Worker },
48*49cdfc7eSAndroid Build Coastguard Worker };
49