On 11/04/2016 01:34 PM, Dylan Baker wrote:
If it's not present make it an empty list.

cc: Brian Paul <[email protected]>
Signed-off-by: Dylan Baker <[email protected]>
---
  framework/backends/json.py                       |  5 ++++-
  unittests/framework/backends/test_json_update.py | 24 ++++++++++++++++++++++++
  2 files changed, 28 insertions(+), 1 deletion(-)

diff --git a/framework/backends/json.py b/framework/backends/json.py
index 17002ed..5516919 100644
--- a/framework/backends/json.py
+++ b/framework/backends/json.py
@@ -380,7 +380,10 @@ def _update_eight_to_nine(result):

      """
      for test in compat.viewvalues(result['tests']):
-        test['pid'] = [test['pid']]
+        if 'pid' in test:
+            test['pid'] = [test['pid']]
+        else:
+            test['pid'] = []

      result['results_version'] = 9

diff --git a/unittests/framework/backends/test_json_update.py 
b/unittests/framework/backends/test_json_update.py
index c8e3ee6..be12d31 100644
--- a/unittests/framework/backends/test_json_update.py
+++ b/unittests/framework/backends/test_json_update.py
@@ -173,6 +173,26 @@ class TestV8toV9(object):
                      '__type__': 'Subtests',
                  },
                  'exception': None,
+            },
+            'b@test': {
+                "time": {
+                    'start': 1.2,
+                    'end': 1.8,
+                    '__type__': 'TimeAttribute'
+                },
+                'dmesg': '',
+                'result': 'fail',
+                '__type__': 'TestResult',
+                'command': '/a/command',
+                'traceback': None,
+                'out': '',
+                'environment': 'A=variable',
+                'returncode': 0,
+                'err': '',
+                'subtests': {
+                    '__type__': 'Subtests',
+                },
+                'exception': None,
              }
          },
          "time_elapsed": {
@@ -193,6 +213,10 @@ class TestV8toV9(object):
      def test_pid(self, result):
          assert result['tests']['a@test']['pid'] == [5]

+    def test_no_pid(self, result):
+        assert result['tests']['b@test']['pid'] == []
+
+
      def test_valid(self, result):
          with open(os.path.join(os.path.dirname(__file__), 'schema',
                                 'piglit-9.json'),


Thanks!  Works here.

Tested-by: Brian Paul <[email protected]>

_______________________________________________
Piglit mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/piglit

Reply via email to