xref: /freebsd/tests/sys/fs/fusefs/ext2-misc.sh (revision ee1c3d38a26aa63fca8e9f86c0d456800d5e2576)
1# SPDX-License-Identifier: BSD-2-Clause
2#
3# Copyright (c) 2026 ConnectWise
4# All rights reserved.
5#
6# Redistribution and use in source and binary forms, with or without
7# modification, are permitted provided that the following conditions
8# are met:
9# 1. Redistributions of source code must retain the above copyright
10#    notice, this list of conditions and the following disclaimer.
11# 2. Redistributions in binary form must reproduce the above copyright
12#    notice, this list of conditions and the following disclaimer in the
13#    documentation and/or other materials provided with the distribution.
14#
15# THIS DOCUMENTATION IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
16# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
17# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
18# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
19# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
20# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
21# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
22# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
23# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
24# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
25
26# Regression test for https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=295957
27#
28# Almost any fuse file system would work, but this tests uses fusefs-ext2
29# because it's simple and its download is very small.
30atf_test_case execute cleanup
31execute_head()
32{
33	atf_set "descr" "Execute a file mounted on a fusefs file system"
34	atf_set "require.user" "root"
35	atf_set "require.progs" "fuse-ext2 mkfs.ext2"
36	atf_set "require.kmods" "fusefs"
37}
38execute_body()
39{
40	atf_check mkdir mnt
41	atf_check truncate -s 64m ext2.img
42	atf_check -o ignore -e ignore mkfs.ext2 ext2.img
43	atf_check fuse-ext2 -o rw+ ext2.img mnt
44	atf_check cp /usr/bin/true mnt
45	atf_check su -m nobody -c mnt/true
46}
47execute_cleanup()
48{
49	umount $PWD/mnt || true
50}
51
52atf_init_test_cases()
53{
54	atf_add_test_case execute
55}
56