Skip to content
Merged
Show file tree
Hide file tree
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
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
# Kernel Selftest Runner

This directory contains the automation scripts for running **Linux Kernel Selftests** on Qualcomm-based platforms (e.g., RB3GEN2) using the standardized `qcom-linux-testkit` framework.

## Overview

The selftest runner (`run.sh`) is designed to:
- Automatically detect and run enabled kernel selftests using a whitelist file (`enabled_tests.list`)
- Ensure all required dependencies and directories are present
- Log detailed test results for CI/CD integration
- Support both standalone execution and integration with LAVA/automated test infrastructure

## Files

- **run.sh**: Main test runner script. Executes all tests listed in `enabled_tests.list` and produces `.res` and `.run` result files.
- **enabled_tests.list**: Whitelist of test suites or binaries to run (one per line). Supports comments and blank lines.
- **Kernel_Selftests.res**: Detailed result file, capturing PASS/FAIL/SKIP for each test or subtest.
- **Kernel_Selftests.run**: Cumulative PASS or FAIL summary, used by CI pipelines for quick parsing.

## Prerequisites

- `/kselftest` directory must be present on the device/target. This is where the selftest binaries are located (usually deployed by the build or CI).
- All test scripts must have the executable bit set (`chmod +x run.sh`), enforced by GitHub Actions.
- `enabled_tests.list` must exist and contain at least one non-comment, non-blank entry.

## Script Flow

1. **Environment Setup**:
Dynamically locates and sources `init_env` and `functestlib.sh` to ensure robust, path-independent execution.

2. **Dependency Checks**:
- Checks for required commands (e.g., `find`)
- Ensures `/kselftest` directory exists
- Validates `enabled_tests.list` is present and usable

3. **Test Discovery & Execution**:
- Parses `enabled_tests.list`, ignoring comments and blanks
- Supports both directory and subtest (e.g., `timers/thread_test`) entries
- Executes test binaries or `run_test.sh` for each listed test
- Logs individual and summary results

4. **Result Logging**:
- Writes detailed results to `Kernel_Selftests.res`
- Writes overall PASS/FAIL to `Kernel_Selftests.run`

5. **CI Compatibility**:
- Designed for direct invocation by LAVA or any CI/CD harness
- Fails early and logs meaningful errors if prerequisites are missing

## enabled_tests.list Format

```text
# This is a comment
timers
thread
timers/thread_test
# Add more test names or subtests as needed
```

- Each non-comment, non-blank line specifies a test directory or a test binary under `/kselftest`.

## Example Usage

```sh
sh run.sh
```

or from a higher-level testkit runner:

```sh
./run-test.sh Kernel_Selftests
```

## Troubleshooting

- **Missing executable bit**:
If you see permission errors, ensure all scripts are `chmod +x`.

- **Missing `/kselftest` directory**:
Ensure selftests are built and deployed to the target system.

- **Missing or empty `enabled_tests.list`**:
Add test entries as needed. The runner will fail if this file is absent or empty.

## Contribution Guidelines

- Update `enabled_tests.list` as test coverage expands.
- Follow the coding and structure conventions enforced by CI (see `CONTRIBUTING.md`).
- All changes should pass permission checks and shellcheck lints in CI.

## License

SPDX-License-Identifier: BSD-3-Clause-Clear
Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries.
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
acct:acct_syscall
arm64:btitest
arm64:check_prctl
arm64:fake_sigreturn_bad_magic
arm64:fake_sigreturn_bad_size
arm64:fake_sigreturn_bad_size_for_magic0
arm64:fake_sigreturn_duplicated_fpsimd
arm64:fake_sigreturn_misaligned_sp
arm64:fake_sigreturn_missing_fpsimd
arm64:fpmr_siginfo
arm64:fp-ptrace
arm64:hwcap
arm64:mangle_pstate_invalid_compat_toggle
arm64:mangle_pstate_invalid_daif_bits
arm64:mangle_pstate_invalid_mode_el1h
arm64:mangle_pstate_invalid_mode_el1t
arm64:mangle_pstate_invalid_mode_el2h
arm64:mangle_pstate_invalid_mode_el2t
arm64:mangle_pstate_invalid_mode_el3h
arm64:mangle_pstate_invalid_mode_el3t
arm64:nobtitest
arm64:pac
arm64:poe_siginfo
arm64:ptrace
arm64:sme_trap_za
arm64:syscall-abi
arm64:tags_test
arm64:tpidr2
arm64:tpidr2_siginfo
arm64:vec-syscfg
arm64:za-fork
breakpoints:breakpoint_test_arm64
cachestat:test_cachestat
cgroup:test_core
cgroup:test_cpuset
cgroup:test_freezer
cgroup:test_kill
clone3:clone3
clone3:clone3_clear_sighand
clone3:clone3_set_tid
clone3:close_range_test
damon:sysfs.sh
damon:sysfs_update_removed_scheme_dir.sh
net:forwarding/router_mpath_nh_res.sh
net:forwarding/router_mpath_nh.sh
net:hsr/hsr_ping.sh
net:hsr/hsr_redbox.sh
net:netfilter/bridge_brouter.sh
net:netfilter/br_netfilter_queue.sh
net:netfilter/br_netfilter.sh
net:netfilter/conntrack_icmp_related.sh
net:netfilter/conntrack_sctp_collision.sh
net:netfilter/conntrack_tcp_unreplied.sh
net:netfilter/conntrack_vrf.sh
net:netfilter/nf_conntrack_packetdrill.sh
net:netfilter/nft_conntrack_helper.sh
net:netfilter/nft_fib.sh
net:netfilter/nft_nat.sh
net:netfilter/nft_nat_zones.sh
net:netfilter/nft_queue.sh
net:netfilter/nft_tproxy_tcp.sh
net:netfilter/nft_tproxy_udp.sh
net:netfilter/nft_zones_many.sh
pidfd:pidfd_fdinfo_test
pidfd:pidfd_file_handle_test
pidfd:pidfd_getfd_test
pidfd:pidfd_open_test
pidfd:pidfd_poll_test
pidfd:pidfd_setns_test
pidfd:pidfd_test
pidfd:pidfd_wait
proc:fd-001-lookup
proc:fd-002-posix-eq
proc:fd-003-kthread
proc:proc-2-is-kthread
proc:proc-loadavg-001
proc:proc-self-isnt-kthread
proc:proc-self-map-files-001
proc:proc-self-map-files-002
proc:proc-self-syscall
proc:proc-self-wchan
proc:proc-subset-pid
proc:proc-tid0
proc:proc-uptime-001
proc:proc-uptime-002
timers:inconsistency-check
timers:nanosleep
timers:nsleep-lat
Loading
Loading