Update moblab test retry validation to match with TF output

BUG=b:205496802
TEST=None

Change-Id: I1c943056e0ae98536428f26f8fece59c5fed3336
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/third_party/autotest/+/3292607
Tested-by: Rohit Makasana <rohitbm@chromium.org>
Auto-Submit: Rohit Makasana <rohitbm@chromium.org>
Reviewed-by: Kazuhiro Inaba <kinaba@chromium.org>
Reviewed-by: Julio Hurtado <juahurta@google.com>
Commit-Queue: Rohit Makasana <rohitbm@chromium.org>
(cherry picked from commit 0f6c52efdb5df28e6f27d1597ba043d3bab34320)
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/third_party/autotest/+/3301443
Reviewed-by: Derek Beckett <dbeckett@chromium.org>
Commit-Queue: Derek Beckett <dbeckett@chromium.org>
diff --git a/test_suites/control.cts_hardware b/test_suites/control.cts_hardware
index a850b9c..fe0c553 100644
--- a/test_suites/control.cts_hardware
+++ b/test_suites/control.cts_hardware
@@ -19,15 +19,19 @@
 import common
 from autotest_lib.server.cros.dynamic_suite import dynamic_suite
 
-
 def predicate(test):
   if not hasattr(test, 'suite') or not hasattr(test, 'name'):
     return False
   if not NAME in test.suite.split(','):
     return False
-  # Strip off the cheets_CTS. from the test name before comparing to args
-  name = test.name[test.name.find('.') + 1:]
-  if 'tests' in args_dict and name not in args_dict['tests']:
+  # Moblab specific workflow:
+  # Moblab prepares retry test package list using test failures in TF stdout.
+  # `args_dics['tests']` holds list of items in format abi.CtsPackageName.
+  #   ie. ['arm,CtsAppTestCases', 'x86.CtsCameraTestCases', ...]
+  # `test.name` holds the actual autotest test name.
+  #   ie. cheets_CTS_P.x86.CtsMediaTestCases.other
+  name = test.name.split('.')
+  if 'tests' in args_dict and name[1]+'.'+name[2] not in args_dict['tests']:
     return False
   return True