• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1#!/bin/sh
2# SPDX-License-Identifier: GPL-2.0-or-later
3# Copyright (c) International Business Machines  Corp., 2005
4# Copyright (c) 2021 Joerg Vehlow <joerg.vehlow@aox-tech.de>
5# Author: Avantika Mathur (mathurav@us.ibm.com)
6
7TST_CNT=3
8FS_BIND_TESTFUNC=test
9
10. fs_bind_lib.sh
11
12test1()
13{
14	tst_res TINFO "regression: bind unshared directory to unshare mountpoint"
15
16	mkdir dir
17	EXPECT_PASS mount --bind "$FS_BIND_DISK1" dir
18	fs_bind_check "$FS_BIND_DISK1" dir
19	EXPECT_PASS umount dir
20}
21
22test2()
23{
24	tst_res TINFO "regression: rbind unshared directory to unshare mountpoint"
25
26	mkdir dir1
27	mkdir dir2
28	EXPECT_PASS mount --bind "$FS_BIND_DISK1" dir1
29	EXPECT_PASS mount --bind "$FS_BIND_DISK2" dir1/a
30	EXPECT_PASS mount --rbind dir1 dir2
31
32	fs_bind_check dir1/a dir2/a
33
34	EXPECT_PASS umount dir1/a
35	EXPECT_PASS umount dir2/a
36	EXPECT_PASS umount dir2
37	EXPECT_PASS umount dir1
38}
39
40test3()
41{
42	tst_res TINFO "regression: move unshared directory to unshare mountpoint"
43
44	mkdir dir1
45	mkdir dir2
46	EXPECT_PASS mount --bind "$FS_BIND_DISK1" dir1
47	EXPECT_PASS mount --bind "$FS_BIND_DISK2" dir1/a
48	EXPECT_PASS mount --move dir1 dir2
49
50	fs_bind_check dir2/a "$FS_BIND_DISK2"
51
52	EXPECT_PASS umount dir2/a
53	EXPECT_PASS umount dir2
54}
55
56tst_run
57