|
|
787d6d |
From 1925845dc10330e4b48fec68333fac6ef2b7bf5c Mon Sep 17 00:00:00 2001
|
|
|
787d6d |
From: Yu Watanabe <watanabe.yu+github@gmail.com>
|
|
|
787d6d |
Date: Wed, 1 Jun 2022 08:56:08 +0900
|
|
|
787d6d |
Subject: [PATCH] test: import logind test from debian/ubuntu test suite
|
|
|
787d6d |
|
|
|
787d6d |
[dtardon: Picked just the scaffolding, not the tests themselves.]
|
|
|
787d6d |
|
|
|
787d6d |
(cherry picked from commit 9c94ab0f6ff22da4278a6e9a93ddc480607c55ac)
|
|
|
787d6d |
|
|
|
787d6d |
Related: #1866955
|
|
|
787d6d |
---
|
|
|
787d6d |
test/TEST-35-LOGIN/Makefile | 1 +
|
|
|
787d6d |
test/TEST-35-LOGIN/test.sh | 55 +++++++++++++++++++++++++++++++++
|
|
|
787d6d |
test/TEST-35-LOGIN/testsuite.sh | 9 ++++++
|
|
|
787d6d |
3 files changed, 65 insertions(+)
|
|
|
787d6d |
create mode 120000 test/TEST-35-LOGIN/Makefile
|
|
|
787d6d |
create mode 100755 test/TEST-35-LOGIN/test.sh
|
|
|
787d6d |
create mode 100755 test/TEST-35-LOGIN/testsuite.sh
|
|
|
787d6d |
|
|
|
787d6d |
diff --git a/test/TEST-35-LOGIN/Makefile b/test/TEST-35-LOGIN/Makefile
|
|
|
787d6d |
new file mode 120000
|
|
|
787d6d |
index 0000000000..e9f93b1104
|
|
|
787d6d |
--- /dev/null
|
|
|
787d6d |
+++ b/test/TEST-35-LOGIN/Makefile
|
|
|
787d6d |
@@ -0,0 +1 @@
|
|
|
787d6d |
+../TEST-01-BASIC/Makefile
|
|
|
787d6d |
\ No newline at end of file
|
|
|
787d6d |
diff --git a/test/TEST-35-LOGIN/test.sh b/test/TEST-35-LOGIN/test.sh
|
|
|
787d6d |
new file mode 100755
|
|
|
787d6d |
index 0000000000..32410c8149
|
|
|
787d6d |
--- /dev/null
|
|
|
787d6d |
+++ b/test/TEST-35-LOGIN/test.sh
|
|
|
787d6d |
@@ -0,0 +1,55 @@
|
|
|
787d6d |
+#!/usr/bin/env bash
|
|
|
787d6d |
+# SPDX-License-Identifier: LGPL-2.1-or-later
|
|
|
787d6d |
+set -e
|
|
|
787d6d |
+
|
|
|
787d6d |
+TEST_DESCRIPTION="LOGIN"
|
|
|
787d6d |
+
|
|
|
787d6d |
+# shellcheck source=test/test-functions
|
|
|
787d6d |
+. "${TEST_BASE_DIR:?}/test-functions"
|
|
|
787d6d |
+
|
|
|
787d6d |
+test_setup() {
|
|
|
787d6d |
+ create_empty_image
|
|
|
787d6d |
+ mkdir -p "$TESTDIR"/root
|
|
|
787d6d |
+ mount "${LOOPDEV}p1" "$TESTDIR"/root
|
|
|
787d6d |
+
|
|
|
787d6d |
+ (
|
|
|
787d6d |
+ LOG_LEVEL=5
|
|
|
787d6d |
+ eval $(udevadm info --export --query=env --name="${LOOPDEV}p2")
|
|
|
787d6d |
+
|
|
|
787d6d |
+ setup_basic_environment
|
|
|
787d6d |
+
|
|
|
787d6d |
+ inst_binary pkill
|
|
|
787d6d |
+ inst_binary useradd
|
|
|
787d6d |
+ inst_binary userdel
|
|
|
787d6d |
+
|
|
|
787d6d |
+ # mask some services that we do not want to run in these tests
|
|
|
787d6d |
+ ln -fs /dev/null "$initdir"/etc/systemd/system/systemd-hwdb-update.service
|
|
|
787d6d |
+ ln -fs /dev/null "$initdir"/etc/systemd/system/systemd-journal-catalog-update.service
|
|
|
787d6d |
+ ln -fs /dev/null "$initdir"/etc/systemd/system/systemd-networkd.service
|
|
|
787d6d |
+ ln -fs /dev/null "$initdir"/etc/systemd/system/systemd-networkd.socket
|
|
|
787d6d |
+ ln -fs /dev/null "$initdir"/etc/systemd/system/systemd-resolved.service
|
|
|
787d6d |
+ ln -fs /dev/null "$initdir"/etc/systemd/system/systemd-machined.service
|
|
|
787d6d |
+
|
|
|
787d6d |
+ # setup the testsuite service
|
|
|
787d6d |
+ cat >"$initdir"/etc/systemd/system/testsuite.service <
|
|
|
787d6d |
+[Unit]
|
|
|
787d6d |
+Description=Testsuite service
|
|
|
787d6d |
+
|
|
|
787d6d |
+[Service]
|
|
|
787d6d |
+ExecStart=/bin/bash -x /testsuite.sh
|
|
|
787d6d |
+Type=oneshot
|
|
|
787d6d |
+StandardOutput=tty
|
|
|
787d6d |
+StandardError=tty
|
|
|
787d6d |
+NotifyAccess=all
|
|
|
787d6d |
+EOF
|
|
|
787d6d |
+ cp testsuite.sh "$initdir"/
|
|
|
787d6d |
+
|
|
|
787d6d |
+ setup_testsuite
|
|
|
787d6d |
+ ) || return 1
|
|
|
787d6d |
+ setup_nspawn_root
|
|
|
787d6d |
+
|
|
|
787d6d |
+ ddebug "umount $TESTDIR/root"
|
|
|
787d6d |
+ umount "$TESTDIR"/root
|
|
|
787d6d |
+}
|
|
|
787d6d |
+
|
|
|
787d6d |
+do_test "$@"
|
|
|
787d6d |
diff --git a/test/TEST-35-LOGIN/testsuite.sh b/test/TEST-35-LOGIN/testsuite.sh
|
|
|
787d6d |
new file mode 100755
|
|
|
787d6d |
index 0000000000..9855b4bc80
|
|
|
787d6d |
--- /dev/null
|
|
|
787d6d |
+++ b/test/TEST-35-LOGIN/testsuite.sh
|
|
|
787d6d |
@@ -0,0 +1,9 @@
|
|
|
787d6d |
+#!/usr/bin/env bash
|
|
|
787d6d |
+# SPDX-License-Identifier: LGPL-2.1-or-later
|
|
|
787d6d |
+set -eux
|
|
|
787d6d |
+set -o pipefail
|
|
|
787d6d |
+
|
|
|
787d6d |
+: >/failed
|
|
|
787d6d |
+
|
|
|
787d6d |
+touch /testok
|
|
|
787d6d |
+rm /failed
|