mirror of
https://github.com/freebsd/freebsd-src.git
synced 2026-10-28 11:25:21 +01:00
tests: Add pjdfstest integration
Use ATF to wrap the new reimplementation of pjdfstest that came out of GSOC 2022, now available in the ports tree as filesystems/pjdfstest. So far I added tests for UFS (with several different option combinations), tmpfs and ZFS, plus ZFS+nullfs. All of these create a memory disk, initialize the filesystem, and point the pjdfstest executable at it. In the future it would be good to add tests for at least NFS and p9fs. Reviewed by: asomers MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D56605
This commit is contained in:
1 parent
d7c110658e
commit
8fd4d1c0ff
6 files changed
+301
No files matched your search
@@ -834,6 +834,8 @@
|
||||
fs
|
||||
fusefs
|
||||
..
|
||||
pjdfstest
|
||||
..
|
||||
tarfs
|
||||
..
|
||||
tmpfs
|
||||
|
||||
@@ -12,6 +12,7 @@ TESTSRC= ${SRCTOP}/contrib/netbsd-tests/fs
|
||||
.if ${COMPILER_FEATURES:Mc++14} && ${MK_GOOGLETEST} != "no"
|
||||
TESTS_SUBDIRS+= fusefs
|
||||
.endif
|
||||
TESTS_SUBDIRS+= pjdfstest
|
||||
TESTS_SUBDIRS+= tarfs
|
||||
TESTS_SUBDIRS+= tmpfs
|
||||
TESTS_SUBDIRS+= unionfs
|
||||
|
||||
@@ -0,0 +1,12 @@
|
||||
TESTSDIR= ${TESTSBASE}/sys/fs/pjdfstest
|
||||
|
||||
PACKAGE= tests
|
||||
|
||||
ATF_TESTS_SH+= tmpfs \
|
||||
ufs \
|
||||
zfs
|
||||
|
||||
# Tests use an external resource.
|
||||
TEST_METADATA.p9fs+= is_exclusive=true
|
||||
|
||||
.include <bsd.test.mk>
|
||||
@@ -0,0 +1,60 @@
|
||||
#
|
||||
# Copyright (c) 2026 Mark Johnston <[email protected]>
|
||||
#
|
||||
# SPDX-License-Identifier: BSD-2-Clause
|
||||
#
|
||||
|
||||
setup()
|
||||
{
|
||||
cat <<__EOF__ > pjdfstest.toml
|
||||
[features]
|
||||
chflags = {}
|
||||
posix_fallocate = {}
|
||||
rename_ctime = {}
|
||||
stat_st_birthtime = {}
|
||||
utimensat = {}
|
||||
utime_now = {}
|
||||
|
||||
[settings]
|
||||
naptime = 0.001
|
||||
__EOF__
|
||||
|
||||
atf_check mkdir mnt
|
||||
atf_check mount -t tmpfs none mnt
|
||||
}
|
||||
|
||||
doit()
|
||||
{
|
||||
atf_check -o ignore pjdfstest -c pjdfstest.toml -p mnt
|
||||
atf_check umount mnt
|
||||
atf_check rmdir mnt
|
||||
}
|
||||
|
||||
cleanup()
|
||||
{
|
||||
if [ -d ./mnt ]; then
|
||||
umount ./mnt
|
||||
fi
|
||||
}
|
||||
|
||||
atf_test_case tmpfs cleanup
|
||||
tmpfs_head()
|
||||
{
|
||||
atf_set descr "Checks that pjdfstest passes on tmpfs"
|
||||
atf_set require.progs pjdfstest
|
||||
atf_set require.user root
|
||||
}
|
||||
tmpfs_body()
|
||||
{
|
||||
setup
|
||||
doit
|
||||
}
|
||||
tmpfs_cleanup()
|
||||
{
|
||||
cleanup
|
||||
}
|
||||
|
||||
atf_init_test_cases()
|
||||
{
|
||||
atf_add_test_case tmpfs
|
||||
}
|
||||
@@ -0,0 +1,130 @@
|
||||
#
|
||||
# Copyright (c) 2026 Mark Johnston <[email protected]>
|
||||
#
|
||||
# SPDX-License-Identifier: BSD-2-Clause
|
||||
#
|
||||
|
||||
setup()
|
||||
{
|
||||
local md
|
||||
|
||||
atf_check -o save:md mdconfig -a -t swap -s 1g
|
||||
md=/dev/$(cat md)
|
||||
atf_check -o ignore -e ignore newfs -t $@ $md
|
||||
|
||||
cat <<__EOF__ > pjdfstest.toml
|
||||
[features]
|
||||
chflags = {}
|
||||
posix_fallocate = {}
|
||||
rename_ctime = {}
|
||||
stat_st_birthtime = {}
|
||||
utimensat = {}
|
||||
utime_now = {}
|
||||
|
||||
[settings]
|
||||
naptime = 0.001
|
||||
__EOF__
|
||||
|
||||
atf_check mkdir mnt
|
||||
atf_check mount $md ./mnt
|
||||
}
|
||||
|
||||
doit()
|
||||
{
|
||||
atf_check -o ignore pjdfstest -c pjdfstest.toml -p mnt
|
||||
atf_check umount ./mnt
|
||||
atf_check rmdir ./mnt
|
||||
}
|
||||
|
||||
cleanup()
|
||||
{
|
||||
if [ -d ./mnt ]; then
|
||||
umount ./mnt
|
||||
fi
|
||||
if [ -s md ]; then
|
||||
mdconfig -d -u $(cat md)
|
||||
fi
|
||||
}
|
||||
|
||||
atf_test_case ufs1 cleanup
|
||||
ufs1_head()
|
||||
{
|
||||
atf_set descr "Run pjdfstest on a UFS1 filesystem"
|
||||
atf_set require.user root
|
||||
atf_set require.progs pjdfstest
|
||||
}
|
||||
ufs1_body()
|
||||
{
|
||||
setup -O 1
|
||||
# UFS1 doesn't have 64-bit timestamps or a birthtime field in the inode.
|
||||
cat >> pjdfstest.toml <<__EOF__
|
||||
expected_failures = [
|
||||
"utimensat::birthtime",
|
||||
"utimensat::y2038"
|
||||
]
|
||||
__EOF__
|
||||
doit
|
||||
}
|
||||
ufs1_cleanup()
|
||||
{
|
||||
cleanup
|
||||
}
|
||||
|
||||
atf_test_case ufs2_nosu cleanup
|
||||
ufs2_nosu_head()
|
||||
{
|
||||
atf_set descr "Run pjdfstest on a UFS2 filesystem without soft updates"
|
||||
atf_set require.user root
|
||||
atf_set require.progs pjdfstest
|
||||
}
|
||||
ufs2_nosu_body()
|
||||
{
|
||||
setup -O 2 -u
|
||||
doit
|
||||
}
|
||||
ufs2_nosu_cleanup()
|
||||
{
|
||||
cleanup
|
||||
}
|
||||
|
||||
atf_test_case ufs2_su cleanup
|
||||
ufs2_su_head()
|
||||
{
|
||||
atf_set descr "Run pjdfstest on a UFS2 filesystem with soft updates"
|
||||
atf_set require.user root
|
||||
atf_set require.progs pjdfstest
|
||||
}
|
||||
ufs2_su_body()
|
||||
{
|
||||
setup -O 2 -U
|
||||
doit
|
||||
}
|
||||
ufs2_su_cleanup()
|
||||
{
|
||||
cleanup
|
||||
}
|
||||
|
||||
atf_test_case ufs2_suj cleanup
|
||||
ufs2_suj_head()
|
||||
{
|
||||
atf_set descr "Run pjdfstest on a UFS2 filesystem with soft updates journaling"
|
||||
atf_set require.user root
|
||||
atf_set require.progs pjdfstest
|
||||
}
|
||||
ufs2_suj_body()
|
||||
{
|
||||
setup -O 2 -U -j
|
||||
doit
|
||||
}
|
||||
ufs2_suj_cleanup()
|
||||
{
|
||||
cleanup
|
||||
}
|
||||
|
||||
atf_init_test_cases()
|
||||
{
|
||||
atf_add_test_case ufs1
|
||||
atf_add_test_case ufs2_nosu
|
||||
atf_add_test_case ufs2_su
|
||||
atf_add_test_case ufs2_suj
|
||||
}
|
||||
@@ -0,0 +1,96 @@
|
||||
#
|
||||
# Copyright (c) 2026 Mark Johnston <[email protected]>
|
||||
#
|
||||
# SPDX-License-Identifier: BSD-2-Clause
|
||||
#
|
||||
|
||||
setup()
|
||||
{
|
||||
local disk pool
|
||||
|
||||
truncate -s 1g disk
|
||||
|
||||
cat <<__EOF__ > pjdfstest.toml
|
||||
[features]
|
||||
chflags = {}
|
||||
rename_ctime = {}
|
||||
stat_st_birthtime = {}
|
||||
utimensat = {}
|
||||
utime_now = {}
|
||||
|
||||
[settings]
|
||||
naptime = 0.001
|
||||
__EOF__
|
||||
|
||||
atf_check mkdir mnt
|
||||
pool=pjdfstest$$
|
||||
atf_check zpool create -m $(pwd)/mnt $pool $(pwd)/disk
|
||||
echo $pool > pool
|
||||
}
|
||||
|
||||
doit()
|
||||
{
|
||||
local mp
|
||||
|
||||
mp=${1:-mnt}
|
||||
atf_check -o ignore pjdfstest -c pjdfstest.toml -p $mp
|
||||
if [ "$mp" != "mnt" ]; then
|
||||
atf_check umount $mp
|
||||
atf_check rmdir $mp
|
||||
fi
|
||||
atf_check zpool destroy $(cat pool)
|
||||
atf_check rm -f pool
|
||||
}
|
||||
|
||||
cleanup()
|
||||
{
|
||||
if [ -s pool ]; then
|
||||
zpool destroy $(cat pool)
|
||||
fi
|
||||
}
|
||||
|
||||
atf_test_case zfs cleanup
|
||||
zfs_head()
|
||||
{
|
||||
atf_set descr "Checks that pjdfstest passes on zfs"
|
||||
atf_set require.user root
|
||||
atf_set require.progs pjdfstest
|
||||
}
|
||||
zfs_body()
|
||||
{
|
||||
setup
|
||||
doit
|
||||
}
|
||||
zfs_cleanup()
|
||||
{
|
||||
cleanup
|
||||
}
|
||||
|
||||
atf_test_case zfs_nullfs cleanup
|
||||
zfs_nullfs_head()
|
||||
{
|
||||
atf_set descr "Checks that pjdfstest passes on zfs mounted via nullfs"
|
||||
atf_set require.user root
|
||||
atf_set require.progs pjdfstest
|
||||
}
|
||||
zfs_nullfs_body()
|
||||
{
|
||||
setup
|
||||
atf_check mkdir mnt2
|
||||
atf_check mount -t nullfs mnt mnt2
|
||||
doit mnt2
|
||||
}
|
||||
zfs_nullfs_cleanup()
|
||||
{
|
||||
if [ -d mnt2 ]; then
|
||||
umount mnt2
|
||||
rmdir mnt2
|
||||
fi
|
||||
cleanup
|
||||
}
|
||||
|
||||
atf_init_test_cases()
|
||||
{
|
||||
atf_add_test_case zfs
|
||||
atf_add_test_case zfs_nullfs
|
||||
}
|
||||
Reference in new issue
Block a user