test_stages: use task-result 'success' key

Cherrypicked to address crbug.com/973654

The 'failure' key of the task result report is deprecated.

Do not merge until
https://chromium-review.googlesource.com/c/infra/infra/+/1618748 is
pushed to prod.

BUG=chromium:964573
TEST=unit tests

Change-Id: Ibcb053fc06b92e73782fc7cfc59a828a21582f67
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/chromite/+/1620941
Reviewed-by: Jason Clinton <jclinton@chromium.org>
Commit-Queue: Aviv Keshet <akeshet@chromium.org>
Tested-by: Aviv Keshet <akeshet@chromium.org>
(cherry picked from commit 38211554aed67f17a28168e9cdb77926ef598b99)
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/chromite/+/1658752
Reviewed-by: Bernie Thompson <bhthompson@chromium.org>
diff --git a/cbuildbot/commands.py b/cbuildbot/commands.py
index aed14f8..5bbc608 100644
--- a/cbuildbot/commands.py
+++ b/cbuildbot/commands.py
@@ -1400,14 +1400,14 @@
     if task_id in report:
       report = report[task_id]
     logging.info(
-        'Suite ended in state %s (failure=%s) with output:\n%s',
+        'Suite ended in state %s (success=%s) with output:\n%s',
         report['task-result']['state'],
-        report['task-result']['failure'],
+        report['task-result']['success'],
         report['stdout'],
     )
 
     error = None
-    if report['task-result']['failure']:
+    if not report['task-result']['success']:
       error = failures_lib.TestFailure('Suite failed.')
 
     return HWTestSuiteResult(error, None)
diff --git a/cbuildbot/commands_unittest.py b/cbuildbot/commands_unittest.py
index 319410e..d0fb741 100644
--- a/cbuildbot/commands_unittest.py
+++ b/cbuildbot/commands_unittest.py
@@ -191,7 +191,7 @@
     report = {
         'task-result': {
             'state': state,
-            'failure': failure,
+            'success': not failure,
         },
         'stdout': stdout,
     }