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
11 changes: 11 additions & 0 deletions Runner/init_env
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# Source this file to setup the test suite environment
if [ -e '/var/Runner' ];then
export BASEDIR='/var/Runner'
export TOOLS='/var/Runner/utils'
export SUITES='/var/Runner/suites'
export CALIBRATION='/var/Runner/calib.txt'
export FTRACE_EVENTS='/var/Runner/ftrace_events'
export PATH=$PATH:'/bin'
export PATH=$PATH:'/sbin'
fi

54 changes: 54 additions & 0 deletions Runner/run-test.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
#!/bin/sh
# Import test suite definitions
source /var/Runner/init_env

#import test functions library
source $TOOLS/functestlib.sh


# Find test case path by name
find_test_case_by_name() {
local test_name="$1"
find /var/Runner/suites -type d -iname "$test_name" 2>/dev/null
}

# Execute a test case
execute_test_case() {
local test_path="$1"
if [ -d "$test_path" ]; then
run_script="$test_path/run.sh"
if [ -f "$run_script" ]; then
log "Executing test case: $test_path"
sh "$run_script" 2>&1
# if [ $? -eq 0 ]; then
# log "Test case $test_path passed."
# else
# log "Test case $test_path failed."
# fi
else
log "No run.sh found in $test_path"
fi
else
log "Test case directory not found: $test_path"
fi
}

# Function to run a specific test case by name
run_specific_test_by_name() {
local test_name="$1"
test_path=$(find_test_case_by_name "$test_name")
if [ -z "$test_path" ]; then
log "Test case with name $test_name not found."
else
execute_test_case "$test_path"
fi
}

# Main script logic
if [ "$#" -eq 0 ]; then
log "Usage: $0 [all | <testcase_name>]"
exit 1
fi


run_specific_test_by_name "$1"
56 changes: 56 additions & 0 deletions Runner/suites/Kernel/FunctionalArea/baseport/BWMON/run.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
#!/bin/sh
# Import test suite definitions
/var/Runner/init_env
TESTNAME="BWMON"

#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 "Fetching te interconnect summary"
extract_votes() {
cat /sys/kernel/debug/interconnect/interconnect_summary | grep -i pmu | awk '{print $NF}'
}
log_info "Initial vote check:"
sleep 5
log_info "Initial vote check:"
initial_votes=$(extract_votes)
log_info "$initial_votes"
log_info "$initial_votes"

log_info "Running bw_mem tool..."
/var/common/bins/bw_mem 4000000000 frd &

sleep 2

log_info "Vote check while bw_mem tool is running:"
final_votes=$(extract_votes)
log_info "$final_votes"

wait

log_info "Comparing votes"


incremented=true
for i in $(seq 2 $(echo "$initial_votes" | wc -l)); do
initial_vote=$(echo "$initial_votes" | sed -n "${i}p")
final_vote=$(echo "$final_votes" | sed -n "${i}p")
if [ "$final_vote" -le "$initial_vote" ]; then
incremented=false
log_pass "Vote did not increment for row $i: initial=$initial_vote, final=$final_vote"
else
log_pass "Vote incremented for row $i: initial=$initial_vote, final=$final_vote"
fi
done

if $incremented; then
log_pass "$TESTNAME : Test Passed"
echo "$TESTNAME : Test Passed" > $test_path/$TESTNAME.res
else
log_fail "$TESTNAME : Test Failed"
echo "$TESTNAME : Test Failed" > $test_path/$TESTNAME.res
fi
log_info "-------------------Completed $TESTNAME Testcase----------------------------"
23 changes: 23 additions & 0 deletions Runner/suites/Kernel/FunctionalArea/baseport/Buses/run.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
#!/bin/sh
# Import test suite definitions
/var/Runner/init_env
TESTNAME="Buses"

#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 "running i2c binary"
output=$(/var/common/bins/buses/i2c-msm-test -v -D /dev/i2c-0 -l | grep "ret:1")


if echo "$output" | grep -q "Reading"; then
log_pass "$TESTNAME : Test Passed"
echo "$TESTNAME : Test Passed" > $test_path/$TESTNAME.res
else
log_fail "$TESTNAME : Test Failed"
echo "$TESTNAME : Test Failed" > $test_path/$TESTNAME.res
fi
log_info "-------------------Completed $TESTNAME Testcase----------------------------"
128 changes: 128 additions & 0 deletions Runner/suites/Kernel/FunctionalArea/baseport/CPUFreq_Validation/run.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,128 @@
#!/bin/bash

# CPUFreq Validator: Parallel, Colorized
/var/Runner/init_env
TESTNAME="CPUFreq_Validation"

#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 "=== CPUFreq Frequency Walker with Validation ==="

# Color codes
GREEN="\e[32m"
RED="\e[31m"
YELLOW="\e[33m"
BLUE="\e[34m"
NC="\e[0m" # No Color

NUM_CPUS=$(nproc)
echo -e "${YELLOW}Detected $NUM_CPUS CPU cores.${NC}"

overall_pass=true
declare -A core_status

validate_cpu_core() {
local cpu=$1
local core_id=$2

echo -e "${BLUE}Processing $cpu...${NC}"

if [ ! -d "$cpu/cpufreq" ]; then
echo -e "${BLUE}[SKIP]${NC} $cpu does not support cpufreq."
core_status["$core_id"]="skip"
return
fi

available_freqs=$(cat "$cpu/cpufreq/scaling_available_frequencies" 2>/dev/null)

if [ -z "$available_freqs" ]; then
echo -e "${YELLOW}[INFO]${NC} No available frequencies for $cpu. Skipping..."
core_status["$core_id"]="skip"
return
fi

# Set governor to userspace
if echo "userspace" | tee "$cpu/cpufreq/scaling_governor" > /dev/null; then
echo -e "${YELLOW}[INFO]${NC} Set governor to userspace."
else
echo -e "${RED}[ERROR]${NC} Cannot set userspace governor for $cpu."
core_status["$core_id"]="fail"
return
fi

core_status["$core_id"]="pass" # Assume pass unless a failure happens

for freq in $available_freqs; do
log_info "Setting $cpu to frequency $freq kHz..."
if echo $freq | tee "$cpu/cpufreq/scaling_setspeed" > /dev/null; then
sleep 0.2
actual_freq=$(cat "$cpu/cpufreq/scaling_cur_freq")
if [ "$actual_freq" == "$freq" ]; then
echo -e "${GREEN}[PASS]${NC} $cpu set to $freq kHz."
else
echo -e "${RED}[FAIL]${NC} Tried to set $cpu to $freq kHz, but current is $actual_freq kHz."
core_status["$core_id"]="fail"
fi
else
echo -e "${RED}[ERROR]${NC} Failed to set $cpu to $freq kHz."
core_status["$core_id"]="fail"
fi
done

# Restore governor
echo "Restoring $cpu governor to 'ondemand'..."
echo "ondemand" | sudo tee "$cpu/cpufreq/scaling_governor" > /dev/null
}

# Launch validation per CPU in parallel
cpu_index=0
for cpu in /sys/devices/system/cpu/cpu[0-9]*; do
validate_cpu_core "$cpu" "$cpu_index" &
((cpu_index++))
done

# Wait for all background jobs to finish
wait

# Summary
log_info ""
log_info "=== Per-Core Test Summary ==="
for idx in "${!core_status[@]}"; do
status=${core_status[$idx]}
case "$status" in
pass)
echo -e "CPU$idx: ${GREEN}[PASS]${NC}"
;;
fail)
echo -e "CPU$idx: ${RED}[FAIL]${NC}"
overall_pass=false
;;
skip)
echo -e "CPU$idx: ${BLUE}[SKIPPED]${NC}"
;;
*)
echo -e "CPU$idx: ${RED}[UNKNOWN STATUS]${NC}"
overall_pass=false
;;
esac
done

# Overall result
log_info ""
log_info "=== Overall CPUFreq Validation Result ==="
if $overall_pass; then
echo -e "${GREEN}[OVERALL PASS]${NC} All CPUs validated successfully."
log_pass "$TESTNAME : Test Passed"
echo "$TESTNAME : Test Passed" > $test_path/$TESTNAME.res
exit 0
else
echo -e "${RED}[OVERALL FAIL]${NC} Some CPUs failed frequency validation."
log_fail "$TESTNAME : Test Failed"
echo "$TESTNAME : Test Failed" > $test_path/$TESTNAME.res
exit 1
fi

log_info "-------------------Completed $TESTNAME Testcase----------------------------"
63 changes: 63 additions & 0 deletions Runner/suites/Kernel/FunctionalArea/baseport/GIC/run.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
#!/bin/sh
# Import test suite definitions
/var/Runner/init_env
TESTNAME="GIC"

#import test functions library
source $TOOLS/functestlib.sh
test_path=$(find_test_case_by_name "$TESTNAME")
log_info "-----------------------------------------------------------------------------------------"
log_info "-------------------Starting $TESTNAME Testcase----------------------------"

# Function to get the timer count
get_timer_count() {
cat /proc/interrupts | grep arch_timer
}

# Get the initial timer count
echo "Initial timer count:"
initial_count=$(get_timer_count)
echo "$initial_count"

# Wait for 2 minutes
sleep 120

# Get the timer count after 2 minutes
echo "Timer count after 2 minutes:"
final_count=$(get_timer_count)
echo "$final_count"

# Compare the initial and final counts
echo "Comparing timer counts:"
echo "$initial_count" | while read -r line; do
cpu=$(echo "$line" | awk '{print $1}')
initial_values=$(echo "$line" | awk '{for(i=2;i<=9;i++) print $i}')
final_values=$(echo "$final_count" | grep "$cpu" | awk '{for(i=2;i<=9;i++) print $i}')

fail_test=false
initial_values_list=$(echo "$initial_values" | tr ' ' '\n')
final_values_list=$(echo "$final_values" | tr ' ' '\n')

i=0
echo "$initial_values_list" | while read -r initial_value; do
final_value=$(echo "$final_values_list" | sed -n "$((i+1))p")
if [ "$initial_value" -lt "$final_value" ]; then
echo "CPU $i: Timer count has incremented. Test PASSED"
log_pass "CPU $i: Timer count has incremented. Test PASSED"
else
echo "CPU $i: Timer count has not incremented. Test FAILED"
log_fail "CPU $i: Timer count has not incremented. Test FAILED"
fail_test=true
fi
i=$((i+1))
done
echo $fail_test
if [ "$fail_test" = false ]; then
log_pass "$TESTNAME : Test Passed"
echo "$TESTNAME : Test Passed" > $test_path/$TESTNAME.res
else
log_fail "$TESTNAME : Test Failed"
echo "$TESTNAME : Test Failed" > $test_path/$TESTNAME.res
fi
done
log_info "-------------------Completed $TESTNAME Testcase----------------------------"
48 changes: 48 additions & 0 deletions Runner/suites/Kernel/FunctionalArea/baseport/IPA/run.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
#!/bin/sh
# Import test suite definitions
source /var/Runner/init_env
TESTNAME="IPA"
#import test functions library
log() {
local level="$1"
shift
# echo "$(date '+%Y-%m-%d %H:%M:%S') - $message" | tee -a /var/test_framework.log
echo "[$level] $(/bin/date '+%Y-%m-%d %H:%M:%S') - $*" | /usr/bin/tee -a /var/test_output.log
}
# Find test case path by name
find_test_case_by_name() {
local test_name="$1"
find /var/Runner/suites -type d -name "$test_name" 2>/dev/null
}
# Logging levels
log_info() { log "INFO" "$@"; }
log_pass() { log "PASS" "$@"; }
log_fail() { log "FAIL" "$@"; }
log_error() { log "ERROR" "$@"; }

test_path=$(find_test_case_by_name "$TESTNAME")
log_info "-----------------------------------------------------------------------------------------"
log_info "-------------------Starting $TESTNAME Testcase----------------------------"

PATH=$(find / -name "ipa.ko" 2>/dev/null)

# Check if the file was found
if [ -z "$PATH" ]; then
log_error "ipa.ko file not found."
exit 1
fi

# Insert the module
TEST=$(/sbin/insmod "$PATH")
log_info "output of insmod $TEST"

if /sbin/lsmod | /bin/grep "ipa"; then
log_info "$(/sbin/lsmod | /bin/grep "ipa")"
log_pass "$TESTNAME : Test Passed"
echo "$TESTNAME : Test Passed" > $test_path/$TESTNAME.res
else
log_error "rmnet module not running"
log_fail "$TESTNAME : Test Failed"
echo "$TESTNAME : Test Failed" > $test_path/$TESTNAME.res
fi
log_info "-------------------Completed $TESTNAME Testcase----------------------------"
Loading