factory: Fix 'factory dump-test-list' |
|||
Issue description
Currently the 'factory dump-test-list' command is broken when output format is YAML:
localhost ~ # factory dump-test-list main
Traceback (most recent call last):
File "/usr/local/factory/py/tools/factory.py", line 506, in <module>
main()
File "/usr/local/factory/py/tools/factory.py", line 502, in main
args.subcommand.Run()
File "/usr/local/factory/py/tools/factory.py", line 270, in Run
test_lists.YamlDumpTestListDestructive(test_list, sys.stdout)
File "/usr/local/factory/py_pkg/cros/factory/test/test_lists/test_lists.py", line 615, in YamlDumpTestListDestructive
return yaml.safe_dump(test_list, stream)
File "/usr/local/lib64/python2.7/site-packages/yaml/__init__.py", line 218, in safe_dump
return dump_all([data], stream, Dumper=SafeDumper, **kwds)
File "/usr/local/lib64/python2.7/site-packages/yaml/__init__.py", line 190, in dump_all
dumper.represent(data)
File "/usr/local/lib64/python2.7/site-packages/yaml/representer.py", line 28, in represent
node = self.represent_data(data)
File "/usr/local/lib64/python2.7/site-packages/yaml/representer.py", line 67, in represent_data
node = self.yaml_representers[None](self, data)
File "/usr/local/lib64/python2.7/site-packages/yaml/representer.py", line 247, in represent_undefined
raise RepresenterError("cannot represent an object: %s" % data)
yaml.representer.RepresenterError: cannot represent an object: FactoryTestList(action_on_failure='NEXT')
CSV format works, but I think it'd be better if we can fix YAML format.
Also it may be even better if we can add json format, to output the json style test list.
,
Jul 6 2017
The following revision refers to this bug: https://chromium.googlesource.com/chromiumos/platform/factory/+/92da3659d9e74901b5a061f4ad4bb9d07d9a7b0f commit 92da3659d9e74901b5a061f4ad4bb9d07d9a7b0f Author: Wei-Han Chen <stimim@google.com> Date: Thu Jul 06 06:37:33 2017 test: factory: add ToTestListConfig Convert a FactoryTestList object into a JSON serializable object that can be validated by test_list.schema.json. BUG= chromium:739183 TEST=None Change-Id: Ide9f2463b35ddb10445471177636f845de57e5c0 Reviewed-on: https://chromium-review.googlesource.com/559251 Commit-Ready: Wei-Han Chen <stimim@chromium.org> Tested-by: Wei-Han Chen <stimim@chromium.org> Reviewed-by: Wei-Han Chen <stimim@chromium.org> [modify] https://crrev.com/92da3659d9e74901b5a061f4ad4bb9d07d9a7b0f/py/test/factory.py
,
Jul 6 2017
The following revision refers to this bug: https://chromium.googlesource.com/chromiumos/platform/factory/+/1efcbd47d01163f6af8594da33b1cc300d2c59e8 commit 1efcbd47d01163f6af8594da33b1cc300d2c59e8 Author: Wei-Han Chen <stimim@google.com> Date: Thu Jul 06 08:33:12 2017 tools: factory: fix dump-test-list If we want to dump test list in YAML format, we need to import `cros.factory.test.event_log`, otherwise YAML module does not know how to dump a FactoryTestList object. In this CL, we don't pass FactoryTestList object to YAML module directly. We convert it into JSON serializable object first, so we don't need to depend on event_log. BUG= chromium:739183 TEST=make test; dump a test list without importing event_log Change-Id: I11ad5f7431725429f462c5e02dabf2522bb91517 Reviewed-on: https://chromium-review.googlesource.com/559290 Commit-Ready: Wei-Han Chen <stimim@chromium.org> Tested-by: Wei-Han Chen <stimim@chromium.org> Reviewed-by: Wei-Han Chen <stimim@chromium.org> [modify] https://crrev.com/1efcbd47d01163f6af8594da33b1cc300d2c59e8/py/tools/factory.py
,
Jul 12 2017
@stimim, is this fixed or you have something else left?
,
Jul 13 2017
|
|||
►
Sign in to add a comment |
|||
Comment 1 by stimim@chromium.org
, Jul 5 2017