diff options
author | Mike Yuan <me@yhndnzj.com> | 2023-09-20 11:40:54 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-09-20 11:40:54 +0200 |
commit | 357d352cb69ec1039e5db28b2cb99c14d25e9172 (patch) | |
tree | 22d4667353192c96bbd1f7552cea18d7761a66e8 /test | |
parent | service: use empty_to_na() where appropriate (diff) | |
parent | test: introduce TEST-83-BTRFS (diff) | |
download | systemd-357d352cb69ec1039e5db28b2cb99c14d25e9172.tar.xz systemd-357d352cb69ec1039e5db28b2cb99c14d25e9172.zip |
Merge pull request #29179 from YHNdnzj/resume-offset-btrfs
btrfs-util: introduce btrfs_get_file_physical_offset_fd
Diffstat (limited to 'test')
l--------- | test/TEST-83-BTRFS/Makefile | 1 | ||||
-rw-r--r-- | test/TEST-83-BTRFS/deny-list-ubuntu-ci | 0 | ||||
-rwxr-xr-x | test/TEST-83-BTRFS/test.sh | 25 | ||||
-rw-r--r-- | test/units/testsuite-83.service | 8 | ||||
-rwxr-xr-x | test/units/testsuite-83.sh | 25 |
5 files changed, 59 insertions, 0 deletions
diff --git a/test/TEST-83-BTRFS/Makefile b/test/TEST-83-BTRFS/Makefile new file mode 120000 index 0000000000..e9f93b1104 --- /dev/null +++ b/test/TEST-83-BTRFS/Makefile @@ -0,0 +1 @@ +../TEST-01-BASIC/Makefile
\ No newline at end of file diff --git a/test/TEST-83-BTRFS/deny-list-ubuntu-ci b/test/TEST-83-BTRFS/deny-list-ubuntu-ci new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/test/TEST-83-BTRFS/deny-list-ubuntu-ci diff --git a/test/TEST-83-BTRFS/test.sh b/test/TEST-83-BTRFS/test.sh new file mode 100755 index 0000000000..5c32c517e1 --- /dev/null +++ b/test/TEST-83-BTRFS/test.sh @@ -0,0 +1,25 @@ +#!/usr/bin/env bash +# SPDX-License-Identifier: LGPL-2.1-or-later +set -e + +TEST_DESCRIPTION="test btrfs-util" + +TEST_NO_NSPAWN=1 +FSTYPE=btrfs +IMAGE_NAME="btrfs" +TEST_FORCE_NEWIMAGE=1 + +# shellcheck source=test/test-functions +. "${TEST_BASE_DIR:?}/test-functions" + +if ! command -v btrfs >/dev/null || ! command -v mkfs.btrfs >/dev/null; then + echo "TEST: $TEST_DESCRIPTION [SKIPPED]: btrfs not supported by host" >&2 + exit 0 +fi + +test_append_files() { + install_btrfs + image_install sync +} + +do_test "$@" diff --git a/test/units/testsuite-83.service b/test/units/testsuite-83.service new file mode 100644 index 0000000000..55ebb45730 --- /dev/null +++ b/test/units/testsuite-83.service @@ -0,0 +1,8 @@ +# SPDX-License-Identifier: LGPL-2.1-or-later +[Unit] +Description=TEST-83-BTRFS + +[Service] +ExecStartPre=rm -f /failed /testok +ExecStart=/usr/lib/systemd/tests/testdata/units/%N.sh +Type=oneshot diff --git a/test/units/testsuite-83.sh b/test/units/testsuite-83.sh new file mode 100755 index 0000000000..a722c79d4e --- /dev/null +++ b/test/units/testsuite-83.sh @@ -0,0 +1,25 @@ +#!/usr/bin/env bash +# SPDX-License-Identifier: LGPL-2.1-or-later +set -eux +set -o pipefail + +TEST_BTRFS_OFFSET=/usr/lib/systemd/tests/unit-tests/manual/test-btrfs-physical-offset + +SWAPFILE=/var/tmp/swapfile + +btrfs filesystem mkswapfile -s 10m "$SWAPFILE" +sync -f "$SWAPFILE" + +offset_btrfs_progs="$(btrfs inspect-internal map-swapfile -r "$SWAPFILE")" +echo "btrfs-progs: $offset_btrfs_progs" + +offset_btrfs_util="$("$TEST_BTRFS_OFFSET" "$SWAPFILE")" +echo "btrfs-util: $offset_btrfs_util" + +(( offset_btrfs_progs == offset_btrfs_util )) + +rm -f "$SWAPFILE" + +/usr/lib/systemd/tests/unit-tests/manual/test-btrfs + +touch /testok |