Skip to content

Commit 386f5e4

Browse files
authored
Merge pull request #60 from qcom-anilyada/ci-contributions
Added Connectivity Testcases [Ethernet and Bluetooth] and one Kernel Testcase [shmbridge]
2 parents e6c52e9 + 5ac7bde commit 386f5e4

File tree

6 files changed

+473
-0
lines changed

6 files changed

+473
-0
lines changed
Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries.
2+
SPDX-License-Identifier: BSD-3-Clause-Clear
3+
4+
# Bluetooth Validation Test
5+
6+
## Overview
7+
8+
This test case validates the basic functionality of the Bluetooth controller on the device. It checks for:
9+
10+
- Presence of `bluetoothctl`
11+
- Running status of `bluetoothd`
12+
- Power state toggling of the Bluetooth controller
13+
14+
## Usage
15+
16+
Instructions:
17+
18+
1. Copy repo to Target Device: Use scp to transfer the scripts from the host to the target device. The scripts should be copied to any directory on the target device.
19+
2. Verify Transfer: Ensure that the repo have been successfully copied to any directory on the target device.
20+
3. Run Scripts: Navigate to the directory where these files are copied on the target device and execute the scripts as needed.
21+
22+
Run a Connectivity Bluetooth test using:
23+
---
24+
#### Quick Example
25+
```
26+
git clone <this-repo>
27+
cd <this-repo>
28+
scp -r common Runner user@target_device_ip:<Path in device>
29+
ssh user@target_device_ip
30+
cd <Path in device>/Runner && ./run-test.sh Bluetooth
31+
```
32+
33+
## Prerequisites
34+
- bluez package must be installed (provides bluetoothctl)
35+
- bluetoothd daemon must be running
36+
- Root access may be required for complete validation
37+
38+
## Result Format
39+
40+
Test result will be saved in Bluetooth.res as:
41+
#### Pass Criteria
42+
- bluetoothctl is available
43+
- bluetoothd is running
44+
- Power on command returns success
45+
- Bluetooth controller powered on successfully. – if all validations pass
46+
<!-- -->
47+
#### Fail Criteria
48+
- bluetoothctl not found
49+
- bluetoothd not running
50+
- Power on command fails
51+
- Failed to power on Bluetooth controller. – if any check fails
52+
53+
54+
## Output
55+
A .res file is generated in the same directory:
56+
57+
`PASS Bluetooth` OR `FAIL Bluetooth`
58+
59+
Lines changed: 89 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,89 @@
1+
#!/bin/sh
2+
3+
# Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries.
4+
# SPDX-License-Identifier: BSD-3-Clause-Clear
5+
6+
# Source init_env and functestlib.sh
7+
SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
8+
INIT_ENV=""
9+
SEARCH="$SCRIPT_DIR"
10+
while [ "$SEARCH" != "/" ]; do
11+
if [ -f "$SEARCH/init_env" ]; then
12+
INIT_ENV="$SEARCH/init_env"
13+
break
14+
fi
15+
SEARCH=$(dirname "$SEARCH")
16+
done
17+
18+
if [ -z "$INIT_ENV" ]; then
19+
echo "[ERROR] Could not find init_env (starting at $SCRIPT_DIR)" >&2
20+
exit 1
21+
fi
22+
23+
# shellcheck disable=SC1090
24+
. "$INIT_ENV"
25+
26+
# shellcheck disable=SC1090,SC1091
27+
. "$TOOLS/functestlib.sh"
28+
29+
TESTNAME="Bluetooth"
30+
test_path=$(find_test_case_by_name "$TESTNAME") || {
31+
log_fail "$TESTNAME : Test directory not found."
32+
echo "$TESTNAME FAIL" > "./$TESTNAME.res"
33+
exit 1
34+
}
35+
36+
cd "$test_path" || exit 1
37+
res_file="./$TESTNAME.res"
38+
rm -f "$res_file"
39+
40+
log_info "-----------------------------------------------------------------------------------------"
41+
log_info "-------------------Starting $TESTNAME Testcase----------------------------"
42+
log_info "Checking dependency: bluetoothctl"
43+
check_dependencies bluetoothctl
44+
45+
log_info "Checking if bluetoothd is running..."
46+
MAX_RETRIES=3
47+
RETRY_DELAY=5
48+
retry=0
49+
50+
while [ "$retry" -lt "$MAX_RETRIES" ]; do
51+
if pgrep bluetoothd >/dev/null 2>&1; then
52+
log_info "bluetoothd is running"
53+
break
54+
fi
55+
log_warn "bluetoothd not running, retrying in ${RETRY_DELAY}s..."
56+
sleep "$RETRY_DELAY"
57+
retry=$((retry + 1))
58+
done
59+
60+
if [ "$retry" -eq "$MAX_RETRIES" ]; then
61+
log_fail "Bluetooth daemon not detected after ${MAX_RETRIES} attempts."
62+
echo "$TESTNAME FAIL" > "$res_file"
63+
exit 1
64+
fi
65+
66+
log_info "Powering off Bluetooth controller..."
67+
poweroff_output=$(bluetoothctl power off 2>&1)
68+
if echo "$poweroff_output" | grep -q "Changing power off succeeded"; then
69+
log_pass "Bluetooth powered off successfully"
70+
else
71+
log_warn "Power off result: $poweroff_output"
72+
log_fail "Bluetooth power off failed"
73+
echo "$TESTNAME FAIL" > "$res_file"
74+
exit 1
75+
fi
76+
77+
log_info "Powering on Bluetooth controller..."
78+
poweron_output=$(bluetoothctl power on 2>&1)
79+
if echo "$poweron_output" | grep -q "Changing power on succeeded"; then
80+
log_pass "Bluetooth powered on successfully"
81+
echo "$TESTNAME PASS" > "$res_file"
82+
exit 0
83+
else
84+
log_warn "Power on result: $poweron_output"
85+
log_fail "Bluetooth power on failed"
86+
echo "$TESTNAME FAIL" > "$res_file"
87+
exit 1
88+
fi
89+
Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries.
2+
SPDX-License-Identifier: BSD-3-Clause-Clear
3+
4+
# Ethernet Validation Test
5+
6+
## Overview
7+
8+
This test case validates the basic functionality of the Ethernet interface (`eth0`) on the device. It checks for:
9+
10+
- Interface presence
11+
- Interface status (UP/DOWN)
12+
- Basic connectivity via ping to `8.8.8.8`
13+
14+
## Usage
15+
16+
Instructions:
17+
18+
1. Copy repo to Target Device: Use scp to transfer the scripts from the host to the target device. The scripts should be copied to any directory on the target device.
19+
2. Verify Transfer: Ensure that the repo have been successfully copied to any directory on the target device.
20+
3. Run Scripts: Navigate to the directory where these files are copied on the target device and execute the scripts as needed.
21+
22+
Run a Connectivity Ethernet test using:
23+
---
24+
#### Quick Example
25+
```
26+
git clone <this-repo>
27+
cd <this-repo>
28+
scp -r common Runner user@target_device_ip:<Path in device>
29+
ssh user@target_device_ip
30+
cd <Path in device>/Runner && ./run-test.sh Ethernet
31+
```
32+
33+
## Prerequisites
34+
35+
- `ip` and `ping` must be available
36+
- Root access may be required for complete validation
37+
38+
## Result Format
39+
Test result will be saved in `Ethernet.res` as:
40+
#### Pass Criteria
41+
- Ethernet interface eth0 is detected
42+
- Interface is successfully brought up (if down)
43+
- Ping to 8.8.8.8 succeeds
44+
- `Ethernet connectivity verified` – if all validations pass
45+
<!-- -->
46+
#### Fail Criteria
47+
- Interface eth0 is not found
48+
- Interface cannot be brought up
49+
- Ping test fails
50+
- `Ethernet ping failed` – if any check fails
51+
52+
53+
## Output
54+
A .res file is generated in the same directory:
55+
56+
`PASS Ethernet` OR `FAIL Ethernet`
57+
Lines changed: 92 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,92 @@
1+
#!/bin/sh
2+
3+
#Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries.
4+
#SPDX-License-Identifier: BSD-3-Clause-Clear
5+
6+
# Source init_env and functestlib.sh
7+
SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
8+
INIT_ENV=""
9+
SEARCH="$SCRIPT_DIR"
10+
11+
while [ "$SEARCH" != "/" ]; do
12+
if [ -f "$SEARCH/init_env" ]; then
13+
INIT_ENV="$SEARCH/init_env"
14+
break
15+
fi
16+
SEARCH=$(dirname "$SEARCH")
17+
done
18+
19+
if [ -z "$INIT_ENV" ]; then
20+
echo "[ERROR] Could not find init_env (starting at $SCRIPT_DIR)" >&2
21+
exit 1
22+
fi
23+
24+
# shellcheck disable=SC1090
25+
. "$INIT_ENV"
26+
# shellcheck disable=SC1090,SC1091
27+
. "$TOOLS/functestlib.sh"
28+
29+
TESTNAME="Ethernet"
30+
test_path=$(find_test_case_by_name "$TESTNAME") || {
31+
log_fail "$TESTNAME : Test directory not found."
32+
echo "FAIL $TESTNAME" > "./$TESTNAME.res"
33+
exit 1
34+
}
35+
36+
cd "$test_path" || exit 1
37+
res_file="./$TESTNAME.res"
38+
rm -f "$res_file"
39+
40+
log_info "--------------------------------------------------------------------------"
41+
log_info "-------------------Starting $TESTNAME Testcase----------------------------"
42+
43+
check_dependencies ip ping
44+
45+
IFACE="eth0"
46+
RETRIES=3
47+
SLEEP_SEC=3
48+
49+
# Check interface existence
50+
if ! ip link show "$IFACE" >/dev/null 2>&1; then
51+
log_fail "Ethernet interface $IFACE not found"
52+
echo "FAIL $TESTNAME" > "$res_file"
53+
exit 1
54+
fi
55+
56+
# Bring up interface with retries
57+
log_info "Ensuring $IFACE is UP..."
58+
i=0
59+
while [ $i -lt $RETRIES ]; do
60+
ip link set "$IFACE" up
61+
sleep "$SLEEP_SEC"
62+
if ip link show "$IFACE" | grep -q "state UP"; then
63+
log_info "$IFACE is UP"
64+
break
65+
fi
66+
log_warn "$IFACE is still DOWN (attempt $((i + 1))/$RETRIES)..."
67+
i=$((i + 1))
68+
done
69+
70+
if [ $i -eq $RETRIES ]; then
71+
log_fail "Failed to bring up $IFACE after $RETRIES attempts"
72+
echo "FAIL $TESTNAME" > "$res_file"
73+
exit 1
74+
fi
75+
76+
# Ping test with retries
77+
log_info "Running ping test to 8.8.8.8 via $IFACE..."
78+
i=0
79+
while [ $i -lt $RETRIES ]; do
80+
if ping -I "$IFACE" -c 4 -W 2 8.8.8.8 >/dev/null 2>&1; then
81+
log_pass "Ethernet connectivity verified via ping"
82+
echo "PASS $TESTNAME" > "$res_file"
83+
exit 0
84+
fi
85+
log_warn "Ping failed (attempt $((i + 1))/$RETRIES)... retrying"
86+
sleep "$SLEEP_SEC"
87+
i=$((i + 1))
88+
done
89+
90+
log_fail "Ping test failed after $RETRIES attempts"
91+
echo "FAIL $TESTNAME" > "$res_file"
92+
exit 1
Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries.
2+
SPDX-License-Identifier: BSD-3-Clause-Clear
3+
4+
# shmbridge Validation Test
5+
6+
## Overview
7+
8+
This test case validates the encryption and access functionality of the `shmbridge` partition by:
9+
10+
- Formatting the partition with ext4 and encryption options
11+
- Mounting it with `inlinecrypt`
12+
- Adding an encryption key using `fscryptctl`
13+
- Setting and verifying an encryption policy
14+
- Writing and reading a test file to confirm data integrity
15+
16+
## Usage
17+
18+
Instructions:
19+
20+
1. Copy repo to Target Device: Use scp to transfer the scripts from the host to the target device. The scripts should be copied to any directory on the target device.
21+
2. Verify Transfer: Ensure that the repo have been successfully copied to any directory on the target device.
22+
3. Run Scripts: Navigate to the directory where these files are copied on the target device and execute the scripts as needed.
23+
24+
Run a Kernel Baseport shmbridge test using:
25+
---
26+
#### Quick Example
27+
```
28+
git clone <this-repo>
29+
cd <this-repo>
30+
scp -r common Runner user@target_device_ip:<Path in device>
31+
ssh user@target_device_ip
32+
cd <Path in device>/Runner && ./run-test.sh shmbridge
33+
```
34+
35+
## Prerequisites
36+
- `fscryptctl`, `mkfs.ext4` and `mount` must be available
37+
- Root access is required
38+
- Partition /dev/disk/by-partlabel/xbl_ramdump_a must exist and be accessible
39+
40+
## Result Format
41+
42+
Test result will be saved in shmbridge.res as:
43+
#### Pass Criteria
44+
- Partition is found and formatted
45+
- Encryption key is added and policy is set
46+
- Test file is written and read successfully
47+
- `Test Passed` – if all validations succeed
48+
<!-- -->
49+
#### Fail Criteria
50+
- Partition not found
51+
- Encryption setup fails
52+
- Test file cannot be read or content mismatch
53+
- `Test Failed` – if any check fails
54+
55+
## Output
56+
A .res file is generated in the same directory:
57+
58+
`PASS shmbridge` OR `FAIL shmbridge`
59+

0 commit comments

Comments
 (0)