My favorites | Sign in
Project Home Downloads Wiki Issues Source
New issue   Search
for
  Advanced search   Search tips   Subscriptions
Issue 1464: gooftools write_hwid
1 person starred this issue and may be notified of changes. Back to list
Status:  Invalid
Owner:  ----
Closed:  Jul 2012


Sign in to add a comment
 
Reported by dasi...@gmail.com, Jul 9, 2012
************************************************************
***** NOTE: THIS BUG TRACKER IS FOR GERRIT CODE REVIEW *****
***** DO NOT SUBMIT BUGS FOR CHROME, ANDROID, INTERNAL *****
***** ISSUES WITH YOUR COMPANY'S GERRIT SETUP, ETC.    *****
***** THOSE ISSUE BELONG IN DIFFERENT ISSUE TRACKERS!  *****
************************************************************

***********************************************************************
modify factory_HWID.py : 
self.data['hwid'] = shopfloor.get_hwid() --->
self.data['hwid'] = gooftools.run("gooftool probe_hwids -b PARROT")
***********************************************************************
class WriteHwidTask(task.FactoryTask):

    def __init__(self, data):
        self.data = data

    def write_hwid(self):
        # TODO(hungte) Support partial matching by gooftools or hwid_tool.
        # When the input is not a complete HWID (i.e., BOM-VARIANT pair), select
        # and derive the complete ID from active HWIDs in current database.
        # Ex: input="BLUE A" => matched to "MARIO BLUE A-B 6868".
        hwid = self.data['hwid']
        assert hwid
        gooftools.run("gooftool write_hwid '%s'" % hwid)
        self.stop()

    def start(self):
        assert 'hwid' in self.data, "Missing HWID in data."
        hwid = self.data.get('hwid', None)

        if not hwid:
            raise ValueError("Invalid empty HWID")
        self.add_widget(ui.make_label("%s\n%s" % (_MESSAGE_WRITING, hwid)))
        task.schedule(self.write_hwid)


class ShopFloorHwidTask(task.FactoryTask):

    def __init__(self, data):
        self.data = data

    def start(self):
        self.add_widget(ui.make_label(_MESSAGE_FETCH_FROM_SHOP_FLOOR))
        task.schedule(self.fetch_hwid)

    def fetch_hwid(self):
#        self.data['hwid'] = shopfloor.get_hwid()
        self.data['hwid'] = gooftools.run("gooftool probe_hwids -b PARROT")
        self.stop()


class factory_HWID(test.test):
    version = 3

    def run_once(self, override_hwid=None):
        factory.log('%s run_once' % self.__class__)

        self.data = {'hwid': override_hwid}
        self.tasks = [WriteHwidTask(self.data)]
        if not override_hwid:
            self.tasks.insert(0,
                              ShopFloorHwidTask(self.data)
                              if shopfloor.is_enabled()
                              else select_task.SelectHwidTask(self.data))
        task.run_factory_tasks(self.job, self.tasks)

        factory.log('%s run_once finished' % repr(self.__class__))

log:
07/09 10:23:29 INFO |  __init__:0160| <class 'factory_HWID.factory_HWID'> run_once
07/09 10:23:29 DEBUG|     event:0307| Initializing event client
07/09 10:23:29 INFO |      task:0109| Starting task: ShopFloorHwidTask
07/09 10:23:29 INFO |  __init__:0160| Running gooftool: gooftool probe_hwids -b PARROT
07/09 10:23:46 INFO |  __init__:0160| gooftool result: SUCCESS (0), message: PARROT DVT A-A 4104

07/09 10:23:46 DEBUG|      task:0094| ShopFloorHwidTask: stopped.
07/09 10:23:46 INFO |  __init__:0160| Stopping task: ShopFloorHwidTask
07/09 10:23:46 INFO |      task:0109| Starting task: WriteHwidTask
07/09 10:23:46 ERROR|        ui:0541| Traceback (most recent call last):
07/09 10:23:46 ERROR|        ui:0541|   File "/usr/local/autotest/cros/factory/task.py", line 28, in idle_callback
07/09 10:23:46 ERROR|        ui:0541|     task(*args, **kargs)
07/09 10:23:46 ERROR|        ui:0541|   File "/usr/local/autotest/site_tests/factory_HWID/factory_HWID.py", line 32, in write_hwid
07/09 10:23:46 ERROR|        ui:0541|     gooftools.run("gooftool write_hwid '%s'" % hwid)
07/09 10:23:46 ERROR|        ui:0541| TypeError: not all arguments converted during string formatting
07/09 10:23:46 ERROR|        ui:0560| <type 'exceptions.TypeError'>
Traceback (most recent call last):
  File "/usr/local/autotest/cros/factory/task.py", line 28, in idle_callback
    task(*args, **kargs)
  File "/usr/local/autotest/site_tests/factory_HWID/factory_HWID.py", line 32, in write_hwid
    gooftools.run("gooftool write_hwid '%s'" % hwid)
TypeError: not all arguments converted during string formatting
07/09 10:23:46 DEBUG|logging_ma:0564| Logging subprocess finished
07/09 10:23:46 DEBUG|logging_ma:0564| Logging subprocess finished

Please provide any additional information below.
Jul 10, 2012
Project Member #1 edwin.ke...@gmail.com
This doesn't seem to have anything to do with the Gerrit Code Review project.
Status: Invalid
Sign in to add a comment

Powered by Google Project Hosting