Skip to content

Commit

Permalink
CI: add xfstests
Browse files Browse the repository at this point in the history
Add xfstests into CI for overlayfs, it will work as Github Actions.

Currently not all test cases can be run, only about half of `generic/*`
for the Fuse Overlay FS, some test cases are expected to fail due to
missing function implementation, little are unexpected due to potential
bugs which will be investigated laterly.

Signed-off-by: Wei Zhang <weizhang555.zw@gmail.com>
  • Loading branch information
WeiZhang555 committed Jan 4, 2024
1 parent b263196 commit 81b24b2
Show file tree
Hide file tree
Showing 8 changed files with 108 additions and 4 deletions.
20 changes: 20 additions & 0 deletions .github/workflows/xfstests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,3 +32,23 @@ jobs:
cd $GITHUB_WORKSPACE
sudo ./tests/scripts/xfstests_pathr.sh
xfstests_on_overlayfs:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install Rust
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
override: true
- name: Build overlay binary
run: |
cd tests/overlay
cargo build --release
sudo install -t /usr/sbin/ -m 700 ./target/release/overlay
- name: Setup and run xfstest
run: |
cd $GITHUB_WORKSPACE
sudo ./tests/scripts/xfstests_overlay.sh
7 changes: 7 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -54,3 +54,10 @@ smoke-macos: check-macos

docker-smoke:
docker run --env RUST_BACKTRACE=1 --rm --privileged --volume ${current_dir}:/fuse-rs rust:1.68 sh -c "rustup component add clippy rustfmt; cd /fuse-rs; make smoke-all"

testoverlay:
cd tests/testoverlay && cargo build

# Setup xfstests env and run.
xfstests:
./tests/scripts/xfstests.sh
2 changes: 1 addition & 1 deletion tests/testoverlay/Cargo.toml → tests/overlay/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[package]
name = "testoverlay"
name = "overlay"
version = "0.1.0"
edition = "2021"

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ fn new_passthroughfs_layer(rootdir: &str) -> Result<BoxedLayer> {

fn help() {
println!(
"Usage:\n testoverlay -o lowerdir=<lower1>:<lower2>:<more>,upperdir=<upper>,workdir=<work> <name> <mountpoint> [-l log_level]\n"
"Usage:\n overlay -o lowerdir=<lower1>:<lower2>:<more>,upperdir=<upper>,workdir=<work> <name> <mountpoint> [-l log_level]\n"
);
}

Expand Down
24 changes: 24 additions & 0 deletions tests/scripts/xfstests_overlay.exclude
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# Exclude list for tests that we know are broken in smb3
#
generic/011 # Broken: dirstress 5 processes.
generic/020 # ENOSPC, suppose to be FUSE compatibility issue.
generic/023 # Rename is not supported currently.
generic/024 # Rename is not supported currently.
generic/025 # Rename is not supported currently.
generic/035 # Rename is not supported currently.
generic/078 # Rename is not supported currently.
generic/089 # Rename is not supported currently.
generic/099 # Suppose to be FUSE compatibility issue.
generic/184 # Special device isn't supported due to 'nodev' mount option.
generic/241 # Rename is not supported currently.
generic/245 # Rename is not supported currently.
generic/375 # Suppose to be FUSE compatibility issue, about posix acl support
generic/426 # Suppose to be FUSE compatibility issue: 'open_by_handle'
generic/434 # Special device isn't supported due to 'nodev' mount option.
generic/444 # Suppose to be FUSE compatibility issue, about posix acl support
generic/467 # Suppose to be FUSE compatibility issue: 'open_by_handle'
generic/477 # Suppose to be FUSE compatibility issue: 'open_by_handle'
generic/591 # Broken.
generic/633 # Suppose to be FUSE compatibility issue.
generic/697 # Suppose to be FUSE compatibility issue.
generic/736
52 changes: 52 additions & 0 deletions tests/scripts/xfstests_overlay.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
#!/bin/bash

current_dir=$(dirname $(realpath $0))

sudo apt-get update
sudo apt-get install acl attr automake bc dbench dump e2fsprogs fio gawk \
gcc git indent libacl1-dev libaio-dev libcap-dev libgdbm-dev libtool \
libtool-bin liburing-dev libuuid1 lvm2 make psmisc python3 quota sed \
uuid-dev uuid-runtime xfsprogs linux-headers-$(uname -r) sqlite3
sudo apt-get install exfatprogs f2fs-tools ocfs2-tools udftools xfsdump \
xfslibs-dev

# clone xfstests and install.
cd /tmp/
git clone -b v2023.12.10 git://git.kernel.org/pub/scm/fs/xfs/xfstests-dev.git
cd xfstests-dev
make
sudo make install
# overwrite local config.
cat >local.config <<EOF
export TEST_DEV=testoverlay
export TEST_DIR=/tmp/testoverlay/merged
#export SCRATCH_DEV=testoverlay
#export SCRATCH_MNT=/tmp/test2/merged
export FSTYP=fuse
export FUSE_SUBTYP=.testoverlay
EOF

# create fuse overlay mount script.
# /tmp/testoverlay must exists.
sudo cat >/usr/sbin/mount.fuse.testoverlay <<EOF
#!/bin/bash
ulimit -n 1048576
exec /usr/sbin/overlay -o \
lowerdir=/tmp/testoverlay/lower2:/tmp/testoverlay/lower1,upperdir=/tmp/testoverlay/upper,workdir=/tmp/testoverlay/work \
testoverlay /tmp/testoverlay/merged \
1>>/tmp/testoverlay.log 2>&1 &
sleep 1
EOF
sudo chmod +x /usr/sbin/mount.fuse.testoverlay

# create related directories.
mkdir -p /tmp/testoverlay/{upper,work,merged,lower2,lower1}

echo "====> Start to run xfstests."
# run tests.
cd /tmp/xfstests-dev
# Some tests are not supported by fuse or cannot pass currently.
sudo ./check -fuse -E $current_dir/xfstests_overlay.exclude


3 changes: 2 additions & 1 deletion tests/scripts/xfstests_pathr.exclude
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,5 @@ generic/467
generic/471
generic/477
generic/591
generic/633
generic/633
generic/736
2 changes: 1 addition & 1 deletion tests/scripts/xfstests_pathr.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ sudo apt-get install acl attr automake bc dbench dump e2fsprogs fio gawk \

# clone xfstests and install.
cd /tmp/
git clone git://git.kernel.org/pub/scm/fs/xfs/xfstests-dev.git
git clone -b v2023.12.10 git://git.kernel.org/pub/scm/fs/xfs/xfstests-dev.git
cd xfstests-dev
make
sudo make install
Expand Down

0 comments on commit 81b24b2

Please sign in to comment.