Lines Matching +full:n +full:- +full:1

2 # SPDX-License-Identifier: GPL-2.0
14 # $1: cpu
17 if [ ! -d $CPUROOT/$1/cpufreq ]; then
18 printf "Warning: No cpufreq directory present for $1\n"
24 if [ -d $CPUROOT/$1/cpufreq ]; then
25 printf "Warning: cpufreq directory present for $1\n"
31 policies=$(ls $CPUFREQROOT| grep "policy[0-9].*")
39 policies=$(ls $CPUFREQROOT| grep "policy[0-9].*")
45 # $1: Path
48 local files=`ls $1`
50 printf "Printing directory: $1\n\n"
53 if [ -f $1/$file ]; then
56 local rfile=$(ls -l $1/$file | awk '$1 ~ /^.*r.*/ { print $NF; }')
58 if [ ! -z $rfile ]; then
59 cat $1/$file
61 printf "$file is not readable\n"
64 printf "\n"
65 read_cpufreq_files_in_dir "$1/$file"
68 printf "\n"
74 printf "** Test: Running ${FUNCNAME[0]} **\n\n"
78 printf "%s\n\n" "------------------------------------------------"
84 # $1: directory path
87 local files=`ls $1`
89 printf "Updating directory: $1\n\n"
92 if [ -f $1/$file ]; then
94 local rwfile=$(ls -l $1/$file | awk '$1 ~ /^.*rw.*/ { print $NF; }')
96 if [ ! -z $rwfile ]; then
100 local val=$(cat $1/$file)
101 printf "Writing $val to: $file\n"
102 echo $val > $1/$file
106 printf "\n"
107 update_cpufreq_files_in_dir "$1/$file"
111 printf "\n"
117 printf "** Test: Running ${FUNCNAME[0]} **\n\n"
121 printf "%s\n\n" "------------------------------------------------"
127 # $1: policy
130 cat $CPUFREQROOT/$1/scaling_cur_freq
133 # $1: policy
137 printf "Change frequency for $1 to $2\n"
138 echo $2 > $CPUFREQROOT/$1/scaling_setspeed
141 # $1: policy
144 local filepath="$CPUFREQROOT/$1"
146 backup_governor $1
148 local found=$(switch_governor $1 "userspace")
149 if [ $found = 1 ]; then
150 printf "${FUNCNAME[0]}: userspace governor not available for: $1\n"
154 printf "Switched governor for $1 to userspace\n\n"
157 printf "Available frequencies for $1: $freqs\n\n"
159 # Set all frequencies one-by-one
161 set_cpu_frequency $1 $freq
164 printf "\n"
166 restore_governor $1
169 # $1: loop count
172 printf "** Test: Running ${FUNCNAME[0]} for $1 loops **\n\n"
174 for i in `seq 1 $1`; do
177 printf "\n%s\n\n" "------------------------------------------------"
183 printf "*** RUNNING CPUFREQ SANITY TESTS ***\n"
184 printf "====================================\n\n"
188 ktap_exit_fail_msg "No cpu is managed by cpufreq core, exiting\n"
190 printf "CPUFreq manages: $count CPUs\n\n"
207 shuffle_governors_for_all_cpus 1
211 # $1: "suspend" or "hibernate", $2: loop count
214 printf "** Test: Running ${FUNCNAME[0]}: Trying $1 for $2 loops **\n\n"
217 if [ ! -d $SYSFS/power/ -o ! -f $SYSFS/power/state ]; then
218 printf "$SYSFS/power/state not available\n"
219 return 1
222 if [ $1 = "suspend" ]; then
224 elif [ $1 = "hibernate" ]; then
227 printf "$1 is not a valid option\n"
228 return 1
231 if [ -n $filename ]; then
234 if [ -z "$present" ]; then
235 printf "Tried to $1 but $filename isn't present in $SYSFS/power/state\n"
236 return 1;
239 for i in `seq 1 $2`; do
240 printf "Starting $1\n"
243 if ! command -v rtcwake &> /dev/null; then
244 printf "rtcwake could not be found, please install it.\n"
245 return 1
248 rtcwake -m $filename -s 15
250 if [ $? -ne 0 ]; then
251 printf "Failed to suspend using RTC wake alarm\n"
252 return 1
258 printf "Came out of $1\n"
260 printf "Do basic tests after finishing $1 to verify cpufreq state\n\n"