Skip to content

initial test script for systemd #31

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 2 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
51 changes: 51 additions & 0 deletions Runner/suites/Platform/systemd/run.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
# Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries.
# SPDX-License-Identifier: BSD-3-Clause-Clear
#!/bin/sh

# 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

Loading