mirror of
https://github.com/Dasharo/systemd.git
synced 2026-03-06 15:02:31 -08:00
login: do not hardcode tty used in TEST-35-LOGIN
The test can be run manually outside of CI.
This commit is contained in:
@@ -1,9 +1,9 @@
|
||||
/* SPDX-License-Identifier: LGPL-2.1-or-later */
|
||||
|
||||
/* Usage:
|
||||
* ./test-session-properties <SESSION-OBJECT-PATH>
|
||||
* ./test-session-properties <SESSION-OBJECT-PATH> [<TTY>]
|
||||
* e.g.,
|
||||
* ./test-session-properties /org/freedesktop/login1/session/_32
|
||||
* ./test-session-properties /org/freedesktop/login1/session/_32 /dev/tty2
|
||||
*/
|
||||
|
||||
#include <fcntl.h>
|
||||
@@ -18,6 +18,8 @@
|
||||
#include "terminal-util.h"
|
||||
#include "tests.h"
|
||||
|
||||
static const char *arg_tty = NULL;
|
||||
|
||||
static BusLocator session;
|
||||
|
||||
/* Tests org.freedesktop.logind.Session SetType */
|
||||
@@ -105,10 +107,12 @@ TEST(set_tty) {
|
||||
_cleanup_(sd_bus_flush_close_unrefp) sd_bus* bus = NULL;
|
||||
_cleanup_(sd_bus_error_free) sd_bus_error error = SD_BUS_ERROR_NULL;
|
||||
_cleanup_free_ char *tty = NULL;
|
||||
const char *path = "/dev/tty2"; /* testsuite uses tty2 */
|
||||
int fd;
|
||||
|
||||
fd = open(path, O_RDWR|O_CLOEXEC|O_NOCTTY);
|
||||
if (!arg_tty)
|
||||
return;
|
||||
|
||||
fd = open(arg_tty, O_RDWR|O_CLOEXEC|O_NOCTTY);
|
||||
assert_se(fd >= 0);
|
||||
|
||||
assert_se(sd_bus_open_system(&bus) >= 0);
|
||||
@@ -136,6 +140,9 @@ static int intro(void) {
|
||||
.interface = "org.freedesktop.login1.Session",
|
||||
};
|
||||
|
||||
if (saved_argc > 2)
|
||||
arg_tty = saved_argv[2];
|
||||
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
@@ -517,7 +517,7 @@ test_session_properties() {
|
||||
create_session
|
||||
|
||||
s=$(loginctl list-sessions --no-legend | awk '$3 == "logind-test-user" { print $1 }')
|
||||
/usr/lib/systemd/tests/unit-tests/manual/test-session-properties "/org/freedesktop/login1/session/_3${s?}"
|
||||
/usr/lib/systemd/tests/unit-tests/manual/test-session-properties "/org/freedesktop/login1/session/_3${s?}" /dev/tty2
|
||||
}
|
||||
|
||||
test_list_users_sessions() {
|
||||
|
||||
Reference in New Issue
Block a user