From 6f4ccffa7b407600ead56fdb4de57261487e0a4d Mon Sep 17 00:00:00 2001 From: Abhishek Sinha Date: Wed, 14 May 2025 14:37:12 +0530 Subject: [PATCH 1/2] initial systemd testcases Signed-off-by: Abhishek Sinha --- Runner/suites/Platform/systemd/run.sh | 51 +++++++++++++++++++++++++++ 1 file changed, 51 insertions(+) create mode 100755 Runner/suites/Platform/systemd/run.sh diff --git a/Runner/suites/Platform/systemd/run.sh b/Runner/suites/Platform/systemd/run.sh new file mode 100755 index 00000000..ab8289ea --- /dev/null +++ b/Runner/suites/Platform/systemd/run.sh @@ -0,0 +1,51 @@ +# Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries. +# SPDX-License-Identifier: BSD-3-Clause-Clear +#!/bin/bash + +# Function to check if systemd is running with PID 1 +check_systemd_pid() { + if [ "$(ps -p 1 -o comm=)" == "systemd" ]; then + echo "PASS: Check systemd PID" + else + echo "FAIL: Check systemd PID" + fi +} + +# Function to check if systemctl stop command works for systemd-user-sessions.service +check_systemctl_stop() { + systemctl stop systemd-user-sessions.service + if systemctl is-active --quiet systemd-user-sessions.service; then + echo "FAIL: Systemctl Stop Service" + else + echo "PASS: Systemctl Stop Service" + fi +} + +# Function to check if systemctl start command works for systemd-user-sessions.service +check_systemctl_start() { + systemctl start systemd-user-sessions.service + if systemctl is-active --quiet systemd-user-sessions.service; then + echo "PASS: Systemctl Start Service" + else + echo "FAIL: Systemctl Start Service" + fi +} + +# Function to check for any failed services and print them +check_failed_services() { + failed_services=$(systemctl --failed --no-legend --plain | awk '{print $1}') + if [ -z "$failed_services" ]; then + echo "PASS: Check failed services" + else + echo "FAIL: Check failed services" + echo "$failed_services" + fi + +} + +# Call the functions +check_systemd_pid +check_systemctl_stop +check_systemctl_start +check_failed_services + From 271642228d7e24027956aaea60b7872bcfbae578 Mon Sep 17 00:00:00 2001 From: Abhishek Sinha Date: Wed, 14 May 2025 15:02:43 +0530 Subject: [PATCH 2/2] moving shebang line to non bash specific Signed-off-by: Abhishek Sinha --- Runner/suites/Platform/systemd/run.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Runner/suites/Platform/systemd/run.sh b/Runner/suites/Platform/systemd/run.sh index ab8289ea..1bf6f247 100755 --- a/Runner/suites/Platform/systemd/run.sh +++ b/Runner/suites/Platform/systemd/run.sh @@ -1,6 +1,6 @@ # Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries. # SPDX-License-Identifier: BSD-3-Clause-Clear -#!/bin/bash +#!/bin/sh # Function to check if systemd is running with PID 1 check_systemd_pid() {