-
Notifications
You must be signed in to change notification settings - Fork 17
Added Kernel Level testcases #48
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
Merged
Merged
Changes from all commits
Commits
Show all changes
4 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
37 changes: 37 additions & 0 deletions
37
Runner/suites/Kernel/FunctionalArea/DCVS/Freq_Scaling/README.md
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,37 @@ | ||
# DCVS Frequency Scaling Validation Test | ||
|
||
This test validates the DCVS support and runtime status on Qualcomm platforms with Yocto builds. | ||
|
||
## Overview | ||
|
||
The test script performs these functional checks: | ||
|
||
1. **Kernel Configuration**: | ||
- Validates presence of `CONFIG_CPU_FREQ`, `CONFIG_CPU_FREQ_GOV_PERFORMANCE` and `CONFIG_CPU_FREQ_GOV_SCHEDUTIL*` entries in `/proc/config.gz`. | ||
|
||
2. **Runtime Verification**: | ||
- Checks `/sys/devices/system/cpu/cpu0/cpufreq` before and after a load is applied. | ||
|
||
## How to Run | ||
|
||
```sh | ||
source init_env | ||
cd suites/Kernel/FunctionalArea/DCVS/Freq_Scaling | ||
./run.sh | ||
``` | ||
|
||
## Prerequisites | ||
|
||
- `dmesg`, `grep`, `zgrep`, `lsmod` must be available | ||
- Root access may be required for complete validation | ||
|
||
## Result Format | ||
|
||
Test result will be saved in `Freq_Scaling.res` as: | ||
- `DCVS scaling appears functional. Test Passed` – if all validations pass | ||
- `DCVS did not scale as expected. Test Failed` – if any check fails | ||
|
||
## License | ||
|
||
SPDX-License-Identifier: BSD-3-Clause-Clear | ||
(C) Qualcomm Technologies, Inc. and/or its subsidiaries. |
97 changes: 97 additions & 0 deletions
97
Runner/suites/Kernel/FunctionalArea/DCVS/Freq_Scaling/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,97 @@ | ||
#!/bin/sh | ||
# Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries. | ||
# SPDX-License-Identifier: BSD-3-Clause-Clear | ||
|
||
# Robustly find and source init_env | ||
SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)" | ||
INIT_ENV="" | ||
SEARCH="$SCRIPT_DIR" | ||
while [ "$SEARCH" != "/" ]; do | ||
if [ -f "$SEARCH/init_env" ]; then | ||
INIT_ENV="$SEARCH/init_env" | ||
break | ||
fi | ||
SEARCH=$(dirname "$SEARCH") | ||
done | ||
|
||
if [ -z "$INIT_ENV" ]; then | ||
echo "[ERROR] Could not find init_env (starting at $SCRIPT_DIR)" >&2 | ||
exit 1 | ||
fi | ||
|
||
# Only source if not already loaded (idempotent) | ||
if [ -z "$__INIT_ENV_LOADED" ]; then | ||
# shellcheck disable=SC1090 | ||
. "$INIT_ENV" | ||
fi | ||
# Always source functestlib.sh, using $TOOLS exported by init_env | ||
# shellcheck disable=SC1090,SC1091 | ||
. "$TOOLS/functestlib.sh" | ||
|
||
TESTNAME="Freq_Scaling" | ||
test_path=$(find_test_case_by_name "$TESTNAME") | ||
cd "$test_path" || exit 1 | ||
# shellcheck disable=SC2034 | ||
res_file="./$TESTNAME.res" | ||
|
||
log_info "-------------------------------------------------" | ||
log_info "----------- Starting $TESTNAME Test -------------" | ||
|
||
check_dependencies zcat grep | ||
|
||
CONFIGS="CONFIG_CPU_FREQ CONFIG_CPU_FREQ_GOV_SCHEDUTIL CONFIG_CPU_FREQ_GOV_PERFORMANCE" | ||
check_kernel_config "$CONFIGS" || { | ||
vnarapar marked this conversation as resolved.
Show resolved
Hide resolved
|
||
log_fail "Kernel config validation failed." | ||
echo "$TESTNAME FAIL" > "$res_file" | ||
exit 1 | ||
} | ||
|
||
CPUFREQ_BASE_PATH="/sys/devices/system/cpu" | ||
i=0 | ||
|
||
miss=0 | ||
|
||
for cpu_dir in /sys/devices/system/cpu/cpu[0-8]*; do | ||
CPUFREQ_PATH="$cpu_dir/cpufreq" | ||
if [ -d "$CPUFREQ_PATH" ]; then | ||
cpu_name="${cpu_dir##*/}" | ||
log_pass "$cpu_name has cpufreq interface" | ||
else | ||
miss=1 | ||
fi | ||
done | ||
|
||
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. Add checks similar to IOMMU test. 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. Added the required checks |
||
if [ "$miss" -eq 1 ]; then | ||
echo "CPUFreq interface not found. Test Failed" | ||
echo "$TESTNAME FAIL" > "$res_file" | ||
exit 1 | ||
fi | ||
|
||
log_info "Reading scaling governor..." | ||
GOVERNOR=$(cat $CPUFREQ_PATH/scaling_governor) | ||
log_info "Current governor: $GOVERNOR" | ||
|
||
log_info "Reading min/max frequencies" | ||
MIN_FREQ=$(cat $CPUFREQ_PATH/cpuinfo_min_freq) | ||
MAX_FREQ=$(cat $CPUFREQ_PATH/cpuinfo_max_freq) | ||
log_info "CPU frequency range: $MIN_FREQ - $MAX_FREQ" | ||
|
||
log_info "Triggering frequency update via governor" | ||
dd if=/dev/urandom of=/dev/null bs=1M count=1000 & | ||
LOAD_PID=$! | ||
sleep 2 | ||
|
||
CURRENT_FREQ=$(cat $CPUFREQ_PATH/scaling_cur_freq) | ||
log_info "Observed frequency under load: $CURRENT_FREQ" | ||
|
||
kill $LOAD_PID | ||
|
||
if [ "$CURRENT_FREQ" -gt "$MIN_FREQ" ]; then | ||
log_pass "DCVS scaling appears functional. Test Passed" | ||
echo "$TESTNAME PASS" > "$res_file" | ||
else | ||
log_fail "DCVS did not scale as expected. Test Failed" | ||
echo "$TESTNAME FAIL" > "$res_file" | ||
fi | ||
|
||
log_info "----------- Completed $TESTNAME Test ------------" |
37 changes: 37 additions & 0 deletions
37
Runner/suites/Kernel/FunctionalArea/Scheduler/CPU_affinity/README.md
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,37 @@ | ||
# Scheduler CPU Affinity validation Test | ||
|
||
This test validates the Scheduler support and runtime status on Qualcomm platforms with Yocto builds. | ||
|
||
## Overview | ||
|
||
The test script performs these functional checks: | ||
|
||
1. **Kernel Configuration**: | ||
- Validates presence of `CONFIG_SCHED_DEBUG`, `CONFIG_CGROUP_SCHED` and `CONFIG_SMP*` entries in `/proc/config.gz`. | ||
|
||
2. **Runtime Verification**: | ||
- Checks cpu affinity by creating a CPU-bound background task | ||
|
||
## How to Run | ||
|
||
```sh | ||
source init_env | ||
cd suites/Kernel/FunctionalArea/Scheduler/CPU_affinity | ||
./run.sh | ||
``` | ||
|
||
## Prerequisites | ||
|
||
- `taskset`, `grep`, `zgrep`, `top`, `chrt` must be available | ||
- Root access may be required for complete validation | ||
|
||
## Result Format | ||
|
||
Test result will be saved in `CPU_affinity.res` as: | ||
- `Default scheduling policy detected. Test passed` – if all validations pass | ||
- `Unexpected scheduling policy. Test Failed` – if any check fails | ||
|
||
## License | ||
|
||
SPDX-License-Identifier: BSD-3-Clause-Clear | ||
(C) Qualcomm Technologies, Inc. and/or its subsidiaries. |
93 changes: 93 additions & 0 deletions
93
Runner/suites/Kernel/FunctionalArea/Scheduler/CPU_affinity/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,93 @@ | ||
#!/bin/sh | ||
# Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries. | ||
# SPDX-License-Identifier: BSD-3-Clause-Clear | ||
|
||
# Robustly find and source init_env | ||
SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)" | ||
INIT_ENV="" | ||
SEARCH="$SCRIPT_DIR" | ||
while [ "$SEARCH" != "/" ]; do | ||
if [ -f "$SEARCH/init_env" ]; then | ||
INIT_ENV="$SEARCH/init_env" | ||
break | ||
fi | ||
SEARCH=$(dirname "$SEARCH") | ||
done | ||
|
||
if [ -z "$INIT_ENV" ]; then | ||
echo "[ERROR] Could not find init_env (starting at $SCRIPT_DIR)" >&2 | ||
exit 1 | ||
fi | ||
|
||
# Only source if not already loaded (idempotent) | ||
if [ -z "$__INIT_ENV_LOADED" ]; then | ||
# shellcheck disable=SC1090 | ||
. "$INIT_ENV" | ||
fi | ||
# Always source functestlib.sh, using $TOOLS exported by init_env | ||
# shellcheck disable=SC1090,SC1091 | ||
. "$TOOLS/functestlib.sh" | ||
|
||
TESTNAME="CPU_affinity" | ||
test_path=$(find_test_case_by_name "$TESTNAME") | ||
cd "$test_path" || exit 1 | ||
# shellcheck disable=SC2034 | ||
res_file="./$TESTNAME.res" | ||
|
||
log_info "----------------------------------------------------" | ||
log_info "-------- Starting $TESTNAME Functional Test --------" | ||
|
||
check_dependencies taskset top chrt zcat grep | ||
|
||
REQUIRED_CONFIGS="CONFIG_SCHED_DEBUG CONFIG_CGROUP_SCHED CONFIG_SMP" | ||
for config in $REQUIRED_CONFIGS; do | ||
if check_kernel_config "$config"; then | ||
log_pass "$config is enabled" | ||
echo "$TESTNAME PASS" > "$res_file" | ||
else | ||
log_fail "$config is missing" | ||
echo "$TESTNAME FAIL" > "$res_file" | ||
exit 1 | ||
fi | ||
done | ||
|
||
log_info "Creating a CPU-bound background task..." | ||
cpu_task() { | ||
while true; do :; done | ||
} | ||
cpu_task & | ||
TASK_PID=$! | ||
sleep 2 | ||
|
||
log_info "Checking CPU affinity of task $TASK_PID..." | ||
CPU_AFFINITY=$(taskset -p $TASK_PID | awk -F: '{print $2}' | xargs) | ||
log_info "CPU affinity: $CPU_AFFINITY" | ||
|
||
log_info "Setting affinity to CPU 0" | ||
taskset -pc 0 $TASK_PID > /dev/null | ||
sleep 1 | ||
|
||
NEW_AFFINITY=$(taskset -p $TASK_PID | awk -F: '{print $2}' | xargs) | ||
if [ "$NEW_AFFINITY" = "1" ]; then | ||
vnarapar marked this conversation as resolved.
Show resolved
Hide resolved
|
||
log_pass "Successfully set CPU affinity" | ||
echo "$TESTNAME PASS" > "$res_file" | ||
else | ||
log_fail "Failed to set CPU affinity" | ||
echo "$TESTNAME FAIL" > "$res_file" | ||
fi | ||
|
||
log_info "Checking scheduling policy of task..." | ||
SCHED_POLICY=$(chrt -p $TASK_PID | grep "scheduling policy" | awk -F: '{print $2}' | xargs) | ||
log_info "Scheduling Policy: $SCHED_POLICY" | ||
|
||
if echo "$SCHED_POLICY" | grep -q "SCHED_OTHER"; then | ||
log_pass "Default scheduling policy detected. Test passed" | ||
echo "$TESTNAME PASS" > "$res_file" | ||
else | ||
log_fail "Unexpected scheduling policy. Test Failed" | ||
echo "$TESTNAME FAIL" > "$res_file" | ||
fi | ||
|
||
kill $TASK_PID | ||
echo "$TESTNAME PASS" > $test_path/$TESTNAME.res | ||
log_info "-------- Completed $TESTNAME Functional Test --------" |
43 changes: 43 additions & 0 deletions
43
Runner/suites/Kernel/FunctionalArea/baseport/iommu/README.md
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,43 @@ | ||
# IOMMU Validation Test | ||
|
||
This test validates the IOMMU (Input-Output Memory Management Unit) support and runtime status on Qualcomm platforms with Yocto builds. | ||
|
||
## Overview | ||
|
||
The test script performs these functional checks: | ||
|
||
1. **Kernel Configuration**: | ||
- Validates presence of `CONFIG_IOMMU_SUPPORT` and `CONFIG_ARM_SMMU*` entries in `/proc/config.gz`. | ||
|
||
2. **Driver Loading**: | ||
- Confirms SMMU/IOMMU-related drivers are loaded via `/proc/modules`. | ||
|
||
3. **Device Tree Nodes**: | ||
- Verifies IOMMU/SMMU-related nodes in `/proc/device-tree`. | ||
|
||
4. **Runtime Verification**: | ||
- Checks `dmesg` for any runtime IOMMU initialization or fault logs. | ||
|
||
## How to Run | ||
|
||
```sh | ||
source init_env | ||
cd suites/Kernel/FunctionalArea/IOMMU_Validation | ||
./run.sh | ||
``` | ||
|
||
## Prerequisites | ||
|
||
- `dmesg`, `grep`, `zgrep`, `lsmod` must be available | ||
- Root access may be required for complete validation | ||
|
||
## Result Format | ||
|
||
Test result will be saved in `IOMMU.res` as: | ||
- `IOMMU PASS` – if all validations pass | ||
- `IOMMU FAIL` – if any check fails | ||
|
||
## License | ||
|
||
SPDX-License-Identifier: BSD-3-Clause-Clear | ||
(C) Qualcomm Technologies, Inc. and/or its subsidiaries. |
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
Oops, something went wrong.
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.
Test name is wrong
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.
Updated test name