FAFT firmware_ECBattery: IndexError: list index out of range

12 views
Skip to first unread message

Martin Yan

unread,
Aug 9, 2021, 1:50:34 PM8/9/21
to faft users

Hi All,

 

I am performing firmware_ECBattery job on FAFT test, but AutoServer shows error message in attached “test_that.txt”.

 

Per recommendation, I added log prior to

        logging.info("MYan Looking for current in %s" % self._battery_current)      

        # Kernel gives current value in uA. Convert to mA here.

        kernel_reading = abs()

 

then able to get “current_now”,

MYan Looking for current in /sys/class/power_supply/BAT0/current_now

 

Does this look correct?

I am able to get battery information on DUT via “ectool battery”, is there anything missing? Why “% self._battery_current)[0]” returns out of range value.

 

 

test_that.txt

Greg Edelston

unread,
Aug 9, 2021, 4:54:20 PM8/9/21
to Martin Yan, faft users
Hi Martin,

test_that.txt appears to be empty. It's a little tough to diagnose the problem without seeing either your local code diff or the error message.

You mentioned "% self._battery_current)[0]". It looks like this is the end of the logging.info call that you pasted. But, I also see that there is a [0] at the end of the logging.info call. Presumably this is the cause of your out-of-index error. logging.info() doesn't return anything (as far as I know), so calling logging.info(...)[0] will try to get the 0th index of nothing, which is impossible. I think that if you delete the [0], the error will go away.

Let me know if this works for you.

Greg

--
To unsubscribe from this group and stop receiving emails from it, send an email to faft-users+...@chromium.org.


--
Greg Edelston | SWE > ChromeOS > EngProd > Firmware | grede...@google.com | 203-550-5182

Martin Yan

unread,
Aug 9, 2021, 5:07:56 PM8/9/21
to faft users, Greg Edelston, faft users, Martin Yan
oops, attached "test_that.txt" error messages.

the error line in firmware_ECBattery is kernel_reading...

        kernel_reading = abs(
            int(self.faft_client.system.run_shell_command_get_output(
                'cat %s' % self._battery_current)[0])) / 1000
        logging.info("Current reading from servo: %dmA", servo_reading)
        logging.info("Current reading from kernel: %dmA", kernel_reading)
test_that.txt
Reply all
Reply to author
Forward
0 new messages