On 1 February 2015 at 22:02, Amit Kucheria <amit.kuche...@linaro.org> wrote:
> On Mon, Feb 2, 2015 at 7:34 AM, Lisa Nguyen <lisa.ngu...@linaro.org> wrote:
>> Before searching for specific governors, check to see if the
>> scaling_available_governors attribute exists first. It is to add
>> more error handling.
>
> This doesn't seem to handle interactive governor that is usually the
> default on Android.

Will investigate further.

>> Signed-off-by: Lisa Nguyen <lisa.ngu...@linaro.org>
>> ---
>>  cpufreq/cpufreq_05.sh |   83 
>> +++++++++++++++++++++++++++----------------------
>>  1 file changed, 45 insertions(+), 38 deletions(-)
>>
>> diff --git a/cpufreq/cpufreq_05.sh b/cpufreq/cpufreq_05.sh
>> index 862d310..8d37bae 100755
>> --- a/cpufreq/cpufreq_05.sh
>> +++ b/cpufreq/cpufreq_05.sh
>> @@ -58,51 +58,58 @@ check_governor() {
>>      check "'$gov' directory exists" "test -d $GOV_PATH"
>>  }
>>
>> -supported=$(cat $CPU_PATH/cpu0/cpufreq/scaling_available_governors | grep 
>> "ondemand")
>> -if [ -z "$supported" ]; then
>> -    log_skip "ondemand not supported"
>> -else
>> -    for cpu in $cpus; do
>> -        switch_ondemand $cpu
>> -    done
>> -    check_governor $cpu 'ondemand'
>> -fi
>> +scaling_govs=$(cat $CPU_PATH/cpu0/cpufreq/scaling_available_governors)
>> +if [ -n "$scaling_govs" ]; then
>> +    supported=$(cat $CPU_PATH/cpu0/cpufreq/scaling_available_governors | 
>> grep "ondemand")
>> +    if [ -z "$supported" ]; then
>> +        log_skip "ondemand not supported"
>> +    else
>> +        for cpu in $cpus; do
>> +            switch_ondemand $cpu
>> +        done
>> +        check_governor $cpu 'ondemand'
>> +    fi
>>
>> -supported=$(cat $CPU_PATH/cpu0/cpufreq/scaling_available_governors | grep 
>> "conservative")
>> -if [ -z "$supported" ]; then
>> -    log_skip "conservative not supported"
>> -else
>> -    for cpu in $cpus; do
>> -        switch_conservative $cpu
>> -    done
>> -    check_governor $cpu 'conservative'
>> -fi
>> +    supported=$(cat $CPU_PATH/cpu0/cpufreq/scaling_available_governors | 
>> grep "conservative")
>> +    if [ -z "$supported" ]; then
>> +        log_skip "conservative not supported"
>> +    else
>> +        for cpu in $cpus; do
>> +            switch_conservative $cpu
>> +        done
>> +        check_governor $cpu 'conservative'
>> +    fi
>>
>> -supported=$(cat $CPU_PATH/cpu0/cpufreq/scaling_available_governors | grep 
>> "userspace")
>> -if [ -z "$supported" ]; then
>> -    log_skip "userspace not supported"
>> -else
>> -    for cpu in $cpus; do
>> -        switch_userspace $cpu
>> -    done
>> +    supported=$(cat $CPU_PATH/cpu0/cpufreq/scaling_available_governors | 
>> grep "userspace")
>> +    if [ -z "$supported" ]; then
>> +        log_skip "userspace not supported"
>> +    else
>> +        for cpu in $cpus; do
>> +            switch_userspace $cpu
>> +        done
>>
>>      check "'ondemand' directory is not there" "test ! -d 
>> $CPU_PATH/cpufreq/ondemand"
>>      check "'conservative' directory is not there" "test ! -d 
>> $CPU_PATH/cpufreq/conservative"
>> -fi
>> +    fi
>>
>> -# if more than one cpu, combine governors
>> -nrcpus=$(ls $CPU_PATH | grep "cpu[0-9].*" | wc -l)
>> -if [ $nrcpus -gt 1 ]; then
>> -    affected=$(cat $CPU_PATH/cpu0/cpufreq/affected_cpus | grep 1)
>> -    if [ -z $affected ]; then
>> -        switch_ondemand cpu0
>> -        switch_conservative cpu1
>> -        check_governor cpu0 'ondemand'
>> -        check_governor cpu1 'conservative'
>> -    else
>> -        log_skip "combine governors not supported"
>> +    # if more than one cpu, combine governors
>> +    nrcpus=$(ls $CPU_PATH | grep "cpu[0-9].*" | wc -l)
>> +    if [ $nrcpus -gt 1 ]; then
>> +        affected=$(cat $CPU_PATH/cpu0/cpufreq/affected_cpus | grep 1)
>> +        if [ -z $affected ]; then
>> +            switch_ondemand cpu0
>> +            switch_conservative cpu1
>> +            check_governor cpu0 'ondemand'
>> +            check_governor cpu1 'conservative'
>> +        else
>> +            log_skip "combine governors not supported"
>> +        fi
>>      fi
>> +
>> +    restore_governors
>> +
>> +else
>> +    log_skip "scaling available governors not available"
>>  fi
>>
>> -restore_governors
>>  test_status_show
>> --
>> 1.7.9.5
>>



-- 
Lisa Nguyen, PM-QA test suite co-maintainer
Power Management Working Group
Linaro.org │ Open source software for ARM SoCs |
irc: lisatn | lisa.ngu...@linaro.org

_______________________________________________
linaro-dev mailing list
linaro-dev@lists.linaro.org
http://lists.linaro.org/mailman/listinfo/linaro-dev

Reply via email to