From 76a718e0816da0df026a160fb4dfb9f12e46848e Mon Sep 17 00:00:00 2001 From: Zach Johnson Date: Wed, 1 Jun 2016 17:33:28 -0700 Subject: Fix CpuThrottlingWaiter cat failures Some devices can return multiple CPUs directories on the same line when running ls to list the CPUs on the device. e.g. /sys/devices/system/cpu/cpu0/cpufreq /sys/devices/system/cpu/cpu3/cpufreq /sys/devices/system/cpu/cpu1/cpufreq /sys/devices/system/cpu/cpu4/cpufreq CpuThrottlingWaiter splits the ls output by line and feeds this into a cat command to get the frequency to check if any cores are throttled. e.g. cat /sys/devices/system/cpu/cpu1/cpufreq /sys/devices/system/cpu/cpu4/cpufreq/cpuinfo_max_freq When the cat command fails (trying to cat the cpufreq directory), CpuThrottlingWaiter assumes the device is throttled. And then does this until it times out. Fix this by telling the ls command to only output one directory per line. Change-Id: I27197d6ab8eb8767bb6903f197c5a650b3f26392 --- src/com/android/tradefed/targetprep/CpuThrottlingWaiter.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/com/android/tradefed/targetprep/CpuThrottlingWaiter.java b/src/com/android/tradefed/targetprep/CpuThrottlingWaiter.java index 06ba6c3cd..a9aae9dfc 100644 --- a/src/com/android/tradefed/targetprep/CpuThrottlingWaiter.java +++ b/src/com/android/tradefed/targetprep/CpuThrottlingWaiter.java @@ -116,7 +116,7 @@ public class CpuThrottlingWaiter implements ITargetPreparer { protected Map getCpuMaxFreqs(ITestDevice device) throws DeviceNotAvailableException { Map ret = new HashMap<>(); - String result = device.executeShellCommand("ls -d /sys/devices/system/cpu/cpu*/cpufreq"); + String result = device.executeShellCommand("ls -1 -d /sys/devices/system/cpu/cpu*/cpufreq"); String[] lines = result.split("\r?\n"); List cpuPaths = new ArrayList<>(); for (String line : lines) { -- cgit v1.2.3