Skip to content

Commit 4f6c973

Browse files
committed
Add Probe_Failure_Check test to detect driver probe issues in dmesg and remove copyright header from root README.md
Key Features: - Compatible with both `journalctl` and `dmesg`-based systems - Logs detailed output to `probe_failures.log` - Structured to align with `functestlib.sh` logging and result reporting - Designed to run standalone or integrated in CI Signed-off-by: Srikanth Muppandam <[email protected]>
1 parent 3bd98cd commit 4f6c973

File tree

3 files changed

+131
-3
lines changed

3 files changed

+131
-3
lines changed

README.md

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,3 @@
1-
# Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries.
2-
# SPDX-License-Identifier: BSD-3-Clause-Clear
3-
41
# Linux Feature Validation Framework
52

63
## Overview
Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
# Probe Failure Check Test
2+
3+
This directory contains the **Probe_Failure_Check** test suite for the Qualcomm Linux Testkit. This test verifies that no device driver probe errors occurred during the most recent system boot.
4+
5+
## Test Overview
6+
7+
- **Test Name:** Probe_Failure_Check
8+
- **Purpose:** Scan the kernel log for any "probe failed", "failed to probe", or "probe error" messages, indicating a driver failed to initialize.
9+
- **Results:**
10+
- On success: a result file `Probe_Failure_Check.res` is written with `Probe_Failure_Check PASS`.
11+
- On failure: a `probe_failures.log` file is created containing the matching log entries, and `Probe_Failure_Check.res` is written with `Probe_Failure_Check FAIL`.
12+
13+
## Files
14+
15+
- **run.sh**: The main test script. Execute to perform the check.
16+
- **probe_failures.log**: (Generated on failure) Contains all discovered probe failure messages.
17+
- **Probe_Failure_Check.res**: Test result file with PASS or FAIL.
18+
19+
## Usage
20+
21+
1. Ensure the testkit environment is set up and the board has booted.
22+
2. From this directory, make sure the script is executable:
23+
```sh
24+
chmod +x run.sh
25+
```
26+
3. Run the test:
27+
```sh
28+
./run.sh
29+
```
30+
4. Check the result:
31+
- If the test passes, look for `Probe_Failure_Check.res` containing `PASS`.
32+
- If the test fails, examine `probe_failures.log` for details.
33+
34+
## Integration
35+
36+
This test integrates with the top-level runner in `Runner/run-test.sh` and can be invoked as:
37+
38+
```sh
39+
cd Runner
40+
./run-test.sh Probe_Failure_Check
41+
```
42+
43+
The `.res` file will be parsed by CI/LAVA to determine overall test status.
44+
45+
## Dependencies
46+
47+
- **shell**: POSIX compliant (`/bin/sh`)
48+
- **journalctl** (optional): for collecting kernel logs. Falls back to `dmesg` or `/var/log/kern.log` if unavailable.
49+
- **grep**: for pattern matching.
50+
51+
## Shellcheck Compliance
52+
53+
The script is tested with `shellcheck` and disables SC2039 and SC1091 where sourcing dynamic paths.
54+
55+
## License
56+
57+
Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries.
58+
SPDX-License-Identifier: BSD-3-Clause-Clear
Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
#!/bin/sh
2+
3+
# Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries.
4+
# SPDX-License-Identifier: BSD-3-Clause-Clear
5+
6+
# Robustly 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+
if [ -z "$__INIT_ENV_LOADED" ]; then
24+
# shellcheck disable=SC1090
25+
. "$INIT_ENV"
26+
fi
27+
28+
# shellcheck disable=SC1090,SC1091
29+
. "$TOOLS/functestlib.sh"
30+
31+
TESTNAME="Probe_Failure_Check"
32+
test_path=$(find_test_case_by_name "$TESTNAME")
33+
cd "$test_path" || exit 1
34+
35+
res_file="./$TESTNAME.res"
36+
log_file="./probe_failures.log"
37+
38+
log_info "-----------------------------------------------------------------------------------------"
39+
log_info "------------------- Starting $TESTNAME Testcase ----------------------------"
40+
41+
# Helper: Fetch kernel logs
42+
get_kernel_log() {
43+
if command -v journalctl >/dev/null 2>&1; then
44+
journalctl -k -b
45+
elif command -v dmesg >/dev/null 2>&1; then
46+
dmesg
47+
elif [ -f /var/log/kern.log ]; then
48+
cat /var/log/kern.log
49+
else
50+
log_warn "No kernel log source found"
51+
return 1
52+
fi
53+
}
54+
55+
rm -f "$res_file" "$log_file"
56+
{
57+
echo "Probe Failure Report - $(date)"
58+
echo "--------------------------------------------------"
59+
} > "$log_file"
60+
61+
if get_kernel_log 2>/dev/null | \
62+
grep -iE '([[:alnum:]_.-]+:)?[[:space:]]*(probe failed|failed to probe|probe error)' \
63+
>> "$log_file"; then
64+
log_error "Probe failures detected; see $log_file"
65+
log_fail "$TESTNAME : Probe failures found"
66+
echo "$TESTNAME FAIL" > "$res_file"
67+
exit 1
68+
else
69+
rm -f "$log_file"
70+
log_pass "$TESTNAME : No probe failures found"
71+
echo "$TESTNAME PASS" > "$res_file"
72+
exit 0
73+
fi

0 commit comments

Comments
 (0)