Path: blob/master/tools/testing/selftests/cpufreq/special-tests.sh
26302 views
#!/bin/bash1# SPDX-License-Identifier: GPL-2.02#3# Special test cases reported by people45# Testcase 1: Reported here: http://marc.info/?l=linux-pm&m=140618592709858&w=267# protect against multiple inclusion8if [ $FILE_SPECIAL ]; then9return 010else11FILE_SPECIAL=DONE12fi1314source cpu.sh15source cpufreq.sh16source governor.sh1718# Test 119# $1: policy20__simple_lockdep()21{22# switch to ondemand23__switch_governor $1 "ondemand"2425# cat ondemand files26local ondir=$(find_gov_directory $1 "ondemand")27if [ -z $ondir ]; then28printf "${FUNCNAME[0]}Ondemand directory not created, quit"29return30fi3132cat $ondir/*3334# switch to conservative35__switch_governor $1 "conservative"36}3738simple_lockdep()39{40printf "** Test: Running ${FUNCNAME[0]} **\n"4142for_each_policy __simple_lockdep43}4445# Test 246# $1: policy47__concurrent_lockdep()48{49for i in `seq 0 100`; do50__simple_lockdep $151done52}5354concurrent_lockdep()55{56printf "** Test: Running ${FUNCNAME[0]} **\n"5758for_each_policy_concurrent __concurrent_lockdep59}6061# Test 362quick_shuffle()63{64# this is called concurrently from governor_race65for I in `seq 1000`66do67echo ondemand | sudo tee $CPUFREQROOT/policy*/scaling_governor &68echo userspace | sudo tee $CPUFREQROOT/policy*/scaling_governor &69done70}7172governor_race()73{74printf "** Test: Running ${FUNCNAME[0]} **\n"7576# run 8 concurrent instances77for I in `seq 8`78do79quick_shuffle &80done81}8283# Test 484# $1: cpu85hotplug_with_updates_cpu()86{87local filepath="$CPUROOT/$1/cpufreq"8889# switch to ondemand90__switch_governor_for_cpu $1 "ondemand"9192for i in `seq 1 5000`93do94reboot_cpu $195done &9697local freqs=$(cat $filepath/scaling_available_frequencies)98local oldfreq=$(cat $filepath/scaling_min_freq)99100for j in `seq 1 5000`101do102# Set all frequencies one-by-one103for freq in $freqs; do104echo $freq > $filepath/scaling_min_freq105done106done107108# restore old freq109echo $oldfreq > $filepath/scaling_min_freq110}111112hotplug_with_updates()113{114for_each_non_boot_cpu hotplug_with_updates_cpu115}116117118