EC firmware_ECBattery test case fails - list index out of range

19 views
Skip to first unread message

Martin Yan

unread,
Apr 16, 2018, 3:44:51 PM4/16/18
to faft users

Hi,

 

As I test EC firmware_ECBattery case, after test server reads battery information, it shows,

 

///

'cat %s' % self._battery_current)[0])) / 1000

IndexError: list index out of range

///

 

I check the battery reading, all values sound expected,

 

  Charge:    71 %

  Manuf:     SONYCorp

  Device:    AP16K4J

  Chem:      LiP

  Serial:    0x0330

  V-design:  0x1db0 = 7600 mV

  Mode:      0x6101

  Abs charge:68 %

  Remaining: 3306 mAh

  Cap-full:  4628 mAh

  Design:  4870 mAh

  Time-full: 0h:0

   Empty:   5h:0

 

What does “list index out of range” indicate? Attached test result “test_that_results_ywfx67_battery.zip” for detail info.

 

Regards,

Martin

test_that_results_ywfx67_battery.zip

Sparry, Icarus W

unread,
Apr 16, 2018, 6:26:19 PM4/16/18
to Martin Yan, faft users

I no longer have anything to do with FAFT, but let me see if I can help anyway.

 

The “IndexError: list index out of range” is a python error, saying that you tried to access an array or list, with an invalid index, e.g you tried to access element -4 of an array.

 

If you look in the autoserv.DEBUG file you attached, you will see a bit more context, in particular the filename and the linenumber are

 

"/build/reef/usr/local/build/autotest/server/site_tests/firmware_ECBattery/firmware_ECBattery.py" line number 100.

 

Around there you should see something like

 

        kernel_reading = abs(

            int(self.faft_client.system.run_shell_command_get_output(

                'cat %s' % self._battery_current)[0])) / 1000

 

So matching the brackets this is doing

 

        self.faft_client.system.run_shell_command_get_output('cat %s' % self._battery_current)

 

which is expected to return an array of lines, and it is then going to take the first (computers count from 0, hence the [0]). So it looks like you are not getting any lines at all back.

 

If I had this issue I would add another

                      logging.info(“Looking for current in ‘%s’” % self._battery_current)

line just before the kernel_reading line, to see the filename that is being accessed with “cat” on the DUT, then try and access that name and see what it gave me.

 

The most probable cause is misconfiguration, that battery current is not available in /sys/class/power_supply/BAT0/current_now (It found your battery as BAT0).

--
You received this message because you are subscribed to the Google Groups "faft users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to faft-users+...@chromium.org.

Martin Yan

unread,
Apr 18, 2018, 9:33:00 AM4/18/18
to faft users, Marti...@microchip.com
Thanks your time to explain in details.
Look like AP doesn't get correct batt info from EC via ACPI..
Reply all
Reply to author
Forward
0 new messages