mirror of
https://github.com/systemd/systemd.git
synced 2025-03-28 02:50:16 +03:00
test: add integration test for systemd-storagetm
This commit is contained in:
parent
eae4943afa
commit
565b7c90eb
1
test/TEST-84-STORAGETM/Makefile
Symbolic link
1
test/TEST-84-STORAGETM/Makefile
Symbolic link
@ -0,0 +1 @@
|
||||
../TEST-01-BASIC/Makefile
|
25
test/TEST-84-STORAGETM/test.sh
Executable file
25
test/TEST-84-STORAGETM/test.sh
Executable file
@ -0,0 +1,25 @@
|
||||
#!/usr/bin/env bash
|
||||
# SPDX-License-Identifier: LGPL-2.1-or-later
|
||||
set -e
|
||||
|
||||
TEST_DESCRIPTION="test storagetm"
|
||||
|
||||
TEST_NO_NSPAWN=1
|
||||
|
||||
# shellcheck source=test/test-functions
|
||||
. "${TEST_BASE_DIR:?}/test-functions"
|
||||
|
||||
test_require_bin nvme
|
||||
|
||||
modprobe -nv nvmet-tcp || exit 0
|
||||
|
||||
test_append_files() {
|
||||
inst_binary nvme
|
||||
|
||||
instmods "=nvme"
|
||||
instmods configfs
|
||||
|
||||
generate_module_dependencies
|
||||
}
|
||||
|
||||
do_test "$@"
|
9
test/units/testsuite-84.service
Normal file
9
test/units/testsuite-84.service
Normal file
@ -0,0 +1,9 @@
|
||||
# SPDX-License-Identifier: LGPL-2.1-or-later
|
||||
[Unit]
|
||||
Description=TEST-84-STORAGETM
|
||||
After=multi-user.target
|
||||
|
||||
[Service]
|
||||
ExecStartPre=rm -f /failed /testok
|
||||
ExecStart=/usr/lib/systemd/tests/testdata/units/%N.sh
|
||||
Type=oneshot
|
25
test/units/testsuite-84.sh
Executable file
25
test/units/testsuite-84.sh
Executable file
@ -0,0 +1,25 @@
|
||||
#!/usr/bin/env bash
|
||||
# SPDX-License-Identifier: LGPL-2.1-or-later
|
||||
set -eux
|
||||
set -o pipefail
|
||||
|
||||
modprobe -v nvmet-tcp
|
||||
modprobe -v nvme-tcp
|
||||
|
||||
systemctl start sys-kernel-config.mount
|
||||
|
||||
dd if=/dev/urandom of=/var/tmp/storagetm.test bs=1024 count=10240
|
||||
|
||||
systemd-run -u teststoragetm.service -p Type=notify /usr/lib/systemd/systemd-storagetm /var/tmp/storagetm.test --nqn=quux
|
||||
|
||||
nvme connect-all -t tcp -a 127.0.0.1 -s 16858 --hostid="$(cat /proc/sys/kernel/random/uuid)"
|
||||
|
||||
dd if=/dev/nvme1n1 bs=1024 | cmp /var/tmp/storagetm.test -
|
||||
|
||||
nvme disconnect --device=nvme1
|
||||
|
||||
systemctl stop teststoragetm.service
|
||||
|
||||
rm /var/tmp/storagetm.test
|
||||
|
||||
touch /testok
|
Loading…
x
Reference in New Issue
Block a user