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