117 lines · bash
1#!/bin/bash2# SPDX-License-Identifier: GPL-2.03#4# Special test cases reported by people5 6# Testcase 1: Reported here: http://marc.info/?l=linux-pm&m=140618592709858&w=27 8# protect against multiple inclusion9if [ $FILE_SPECIAL ]; then10 return 011else12 FILE_SPECIAL=DONE13fi14 15source cpu.sh16source cpufreq.sh17source governor.sh18 19# Test 120# $1: policy21__simple_lockdep()22{23 # switch to ondemand24 __switch_governor $1 "ondemand"25 26 # cat ondemand files27 local ondir=$(find_gov_directory $1 "ondemand")28 if [ -z $ondir ]; then29 printf "${FUNCNAME[0]}Ondemand directory not created, quit"30 return31 fi32 33 cat $ondir/*34 35 # switch to conservative36 __switch_governor $1 "conservative"37}38 39simple_lockdep()40{41 printf "** Test: Running ${FUNCNAME[0]} **\n"42 43 for_each_policy __simple_lockdep44}45 46# Test 247# $1: policy48__concurrent_lockdep()49{50 for i in `seq 0 100`; do51 __simple_lockdep $152 done53}54 55concurrent_lockdep()56{57 printf "** Test: Running ${FUNCNAME[0]} **\n"58 59 for_each_policy_concurrent __concurrent_lockdep60}61 62# Test 363quick_shuffle()64{65 # this is called concurrently from governor_race66 for I in `seq 1000`67 do68 echo ondemand | sudo tee $CPUFREQROOT/policy*/scaling_governor &69 echo userspace | sudo tee $CPUFREQROOT/policy*/scaling_governor &70 done71}72 73governor_race()74{75 printf "** Test: Running ${FUNCNAME[0]} **\n"76 77 # run 8 concurrent instances78 for I in `seq 8`79 do80 quick_shuffle &81 done82}83 84# Test 485# $1: cpu86hotplug_with_updates_cpu()87{88 local filepath="$CPUROOT/$1/cpufreq"89 90 # switch to ondemand91 __switch_governor_for_cpu $1 "ondemand"92 93 for i in `seq 1 5000`94 do95 reboot_cpu $196 done &97 98 local freqs=$(cat $filepath/scaling_available_frequencies)99 local oldfreq=$(cat $filepath/scaling_min_freq)100 101 for j in `seq 1 5000`102 do103 # Set all frequencies one-by-one104 for freq in $freqs; do105 echo $freq > $filepath/scaling_min_freq106 done107 done108 109 # restore old freq110 echo $oldfreq > $filepath/scaling_min_freq111}112 113hotplug_with_updates()114{115 for_each_non_boot_cpu hotplug_with_updates_cpu116}117