-
Notifications
You must be signed in to change notification settings - Fork 17
Add encrypted ext4 and connectivity validation scripts to baseport suite #35
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
Open
qcom-anilyada
wants to merge
3
commits into
qualcomm-linux:main
Choose a base branch
from
qcom-anilyada:testBranch
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
#!/bin/sh | ||
|
||
# SPDX-License-Identifier: BSD-3-Clause-Clear | ||
# Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries. | ||
|
||
# Import test suite definitions | ||
. $(pwd)/init_env | ||
TESTNAME="Bluetooth" | ||
|
||
#import test functions library | ||
. $TOOLS/functestlib.sh | ||
test_path=$(find_test_case_by_name "$TESTNAME") | ||
log_info "--------------------------------------------------------------------------" | ||
log_info "-------------------Starting $TESTNAME Testcase----------------------------" | ||
|
||
log_info "Starting Bluetooth Test..." | ||
|
||
# Check if bluetoothctl is available | ||
if ! command -v bluetoothctl >/dev/null 2>&1; then | ||
log_fail "bluetoothctl not found. Please install bluez." | ||
echo "$TESTNAME FAIL" > $test_path/$TESTNAME.res | ||
exit 1 | ||
fi | ||
|
||
# Check if bluetoothd is running | ||
if ! pgrep bluetoothd >/dev/null; then | ||
log_fail "bluetoothd is not running. Please start the Bluetooth daemon." | ||
echo "$TESTNAME FAIL" > $test_path/$TESTNAME.res | ||
exit 1 | ||
fi | ||
|
||
# Power off Bluetooth controller | ||
log_info "Powering off Bluetooth controller..." | ||
bluetoothctl power off | ||
|
||
# Power on Bluetooth controller | ||
log_info "Powering on Bluetooth controller..." | ||
output=$(bluetoothctl power on) | ||
|
||
qcom-anilyada marked this conversation as resolved.
Show resolved
Hide resolved
|
||
# Check for success message | ||
if echo "$output" | grep -q "Changing power on succeeded"; then | ||
log_pass "Bluetooth controller powered on successfully." | ||
echo "$TESTNAME PASS" > $test_path/$TESTNAME.res | ||
else | ||
log_fail "Failed to power on Bluetooth controller." | ||
echo "$TESTNAME FAIL" > $test_path/$TESTNAME.res | ||
fi | ||
|
||
log_info "-------------------Completed $TESTNAME Testcase----------------------------" | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Please include a README.md file with all the prerequisites required to validate this test. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
#!/bin/sh | ||
|
||
# SPDX-License-Identifier: BSD-3-Clause-Clear | ||
# Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries. | ||
|
||
# Import test suite definitions | ||
source $(pwd)/init_env | ||
TESTNAME="Ethernet" | ||
|
||
#import test functions library | ||
source $TOOLS/functestlib.sh | ||
test_path=$(find_test_case_by_name "$TESTNAME") | ||
log_info "--------------------------------------------------------------------------" | ||
log_info "-------------------Starting $TESTNAME Testcase----------------------------" | ||
|
||
log_info "Checking if dependency:net-tools is available" | ||
check_dependencies net-tools | ||
|
||
log_info "Starting Ethernet test..." | ||
|
||
IFACE="eth0" | ||
|
||
# Check interface existence | ||
if ! ip link show "$IFACE" >/dev/null 2>&1; then | ||
qcom-anilyada marked this conversation as resolved.
Show resolved
Hide resolved
|
||
log_fail "Ethernet interface $IFACE not found" | ||
echo "$TESTNAME FAIL" > $test_path/$TESTNAME.res | ||
exit 1 | ||
fi | ||
|
||
# Check if interface is up, try to bring it up if not | ||
if ! ip link show "$IFACE" | grep -q "state UP"; then | ||
log_warn "Interface $IFACE is down, attempting to bring it up..." | ||
ip link set "$IFACE" up | ||
sleep 3 | ||
if ! ip link show "$IFACE" | grep -q "state UP"; then | ||
log_fail "Failed to bring up $IFACE" | ||
echo "$TESTNAME FAIL" > $test_path/$TESTNAME.res | ||
exit 1 | ||
fi | ||
fi | ||
|
||
# Ping test | ||
log_info "Running ping test to 8.8.8.8..." | ||
if ping -I "$IFACE" -c 4 -W 2 8.8.8.8 >/dev/null 2>&1; then | ||
log_pass "Ethernet connectivity verified" | ||
echo "$TESTNAME PASS" > $test_path/$TESTNAME.res | ||
else | ||
log_fail "Ethernet ping failed" | ||
echo "$TESTNAME FAIL" > $test_path/$TESTNAME.res | ||
exit 1 | ||
fi | ||
|
||
log_info "-------------------Completed $TESTNAME Testcase----------------------------" | ||
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
#!/bin/sh | ||
# SPDX-License-Identifier: BSD-3-Clause-Clear | ||
# Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries. | ||
|
||
# Import test suite definitions | ||
. "$(pwd)/init_env" | ||
TESTNAME="WIFI" | ||
|
||
# Import test functions library | ||
. "$TOOLS/functestlib.sh" | ||
test_path=$(find_test_case_by_name "$TESTNAME") | ||
|
||
log_info "--------------------------------------------------------------------------" | ||
log_info "-------------------Starting $TESTNAME Testcase----------------------------" | ||
log_info "Starting WiFi Test..." | ||
|
||
WLAN="wlan0" | ||
SSID_CONF="$(dirname "$0")/wifi_test.conf" # should contain: SSID and PASSWORD | ||
|
||
if [ ! -f "$SSID_CONF" ]; then | ||
log_fail "WiFi config $SSID_CONF not found" | ||
echo "$TESTNAME FAIL" > "$test_path/$TESTNAME.res" | ||
exit 1 | ||
fi | ||
|
||
. "$SSID_CONF" | ||
|
||
log_info "Loaded SSID=$SSID, PASSWORD=$PASSWORD" | ||
|
||
if ! command -v nmcli >/dev/null 2>&1; then | ||
log_fail "nmcli not found" | ||
echo "$TESTNAME FAIL" > "$test_path/$TESTNAME.res" | ||
exit 1 | ||
fi | ||
|
||
# Restart NetworkManager if needed | ||
if ! systemctl is-active NetworkManager >/dev/null 2>&1; then | ||
log_warn "NetworkManager not active. Trying to start it..." | ||
systemctl start NetworkManager | ||
sleep 3 | ||
if ! systemctl is-active NetworkManager >/dev/null 2>&1; then | ||
log_fail "Failed to start NetworkManager" | ||
echo "$TESTNAME FAIL" > "$test_path/$TESTNAME.res" | ||
exit 1 | ||
fi | ||
fi | ||
|
||
# Connect to WiFi | ||
log_info "Attempting to connect to SSID: $SSID" | ||
nmcli_output=$(nmcli dev wifi connect "$SSID" password "$PASSWORD" ifname "$WLAN" 2>&1) | ||
log_info "nmcli output: $nmcli_output" | ||
sleep 5 | ||
|
||
if echo "$nmcli_output" | grep -qi "successfully activated"; then | ||
log_pass "Connected to $SSID" | ||
echo "$TESTNAME PASS" > "$test_path/$TESTNAME.res" | ||
else | ||
log_fail "Failed to connect to $SSID" | ||
echo "$TESTNAME FAIL" > "$test_path/$TESTNAME.res" | ||
exit 1 | ||
fi | ||
|
||
|
||
log_info "-------------------Completed $TESTNAME Testcase----------------------------" | ||
|
75 changes: 75 additions & 0 deletions
75
Runner/suites/Kernel/FunctionalArea/baseport/shmbridge/run.sh
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
#!/bin/sh | ||
# SPDX-License-Identifier: BSD-3-Clause-Clear | ||
# Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries. | ||
|
||
# Import test suite definitions | ||
source "$(pwd)/init_env" | ||
TESTNAME="shmbridge" | ||
|
||
# Import test functions library | ||
source "$TOOLS/functestlib.sh" | ||
test_path=$(find_test_case_by_name "$TESTNAME") | ||
|
||
log_info "--------------------------------------------------------------------------" | ||
log_info "-------------------Starting $TESTNAME Testcase----------------------------" | ||
|
||
MOUNT_POINT="/mnt/overlay" | ||
PARTITION="/dev/disk/by-partlabel/xbl_ramdump_a" | ||
KEY_FILE="$MOUNT_POINT/stdkey" | ||
TEST_DIR="$MOUNT_POINT/test" | ||
TEST_FILE="$TEST_DIR/txt" | ||
|
||
log_info "Creating mount point at $MOUNT_POINT" | ||
mkdir -p "$MOUNT_POINT" | ||
|
||
log_info "Checking if partition exists" | ||
if [ ! -e "$PARTITION" ]; then | ||
log_fail "Partition $PARTITION not found" | ||
echo "$TESTNAME FAIL" > "$test_path/$TESTNAME.res" | ||
exit 1 | ||
fi | ||
|
||
log_info "Formatting partition with ext4 and encryption options" | ||
if ! mount | grep -q "$PARTITION"; then | ||
mkfs.ext4 -F -O encrypt,stable_inodes "$PARTITION" | ||
else | ||
log_warn "$PARTITION is already mounted; skipping format" | ||
fi | ||
|
||
log_info "Mounting partition to $MOUNT_POINT with inlinecrypt" | ||
mount "$PARTITION" -o inlinecrypt "$MOUNT_POINT" | ||
|
||
log_info "Generating 64-byte encryption key" | ||
head -c 64 /dev/urandom > "$KEY_FILE" | ||
|
||
log_info "Checking if dependency binary is available" | ||
check_dependencies fscryptctl | ||
|
||
log_info "Adding encryption key using fscryptctl" | ||
identifier=$(fscryptctl add_key "$MOUNT_POINT" < "$KEY_FILE") | ||
|
||
mkdir -p "$TEST_DIR" | ||
|
||
log_info "Setting encryption policy on $TEST_DIR" | ||
fscryptctl set_policy --iv-ino-lblk-64 "$identifier" "$TEST_DIR" | ||
|
||
log_info "Verifying encryption policy" | ||
fscryptctl get_policy "$TEST_DIR" | ||
|
||
log_info "Writing test file" | ||
echo "hello" > "$TEST_FILE" | ||
sync | ||
echo 3 > /proc/sys/vm/drop_caches | ||
|
||
log_info "Reading test file" | ||
if cat "$TEST_FILE" | grep -q "hello"; then | ||
log_pass "$TESTNAME : Test Passed" | ||
echo "$TESTNAME PASS" > "$test_path/$TESTNAME.res" | ||
else | ||
log_fail "$TESTNAME : Test Failed" | ||
echo "$TESTNAME FAIL" > "$test_path/$TESTNAME.res" | ||
exit 1 | ||
fi | ||
|
||
log_info "-------------------Completed $TESTNAME Testcase----------------------------" | ||
|
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please include a README.md file with all the prerequisites required to validate this test.