suites: Make ccd_open state arg explicit in cr50 tests

cros_test_platform will not support test argument forwarding or
arbitrary python code in suite definitions.
Instead, add explicit control files that set the right test argument
and use those from the relevant suites.

BUG=chromium:1012422
BUG=chromium:1014572
BUG=b:142112299
TEST=None

Change-Id: I620ca9ff222a4dbeeae2b0e994cd18e5836a634d
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/third_party/autotest/+/1857618
Tested-by: Prathmesh Prabhu <pprabhu@chromium.org>
Reviewed-by: Kevin Shelton <kmshelton@chromium.org>
Reviewed-by: Mary Ruthven <mruthven@chromium.org>
Legacy-Commit-Queue: Commit Bot <commit-bot@chromium.org>
Commit-Queue: Prathmesh Prabhu <pprabhu@chromium.org>
diff --git a/server/site_tests/firmware_Cr50CheckCap/control b/server/site_tests/firmware_Cr50CheckCap/control.ccd_open_restricted
similarity index 85%
rename from server/site_tests/firmware_Cr50CheckCap/control
rename to server/site_tests/firmware_Cr50CheckCap/control.ccd_open_restricted
index 61a7bf8..cba458a 100644
--- a/server/site_tests/firmware_Cr50CheckCap/control
+++ b/server/site_tests/firmware_Cr50CheckCap/control.ccd_open_restricted
@@ -5,7 +5,7 @@
 from autotest_lib.server import utils
 
 AUTHOR = "mruthven"
-NAME = "firmware_Cr50CheckCap"
+NAME = "firmware_Cr50CheckCap.ccd_open_restricted"
 PURPOSE = "Verify cr50 ccd capabilities."
 ATTRIBUTES = "suite:faft_cr50_pvt"
 TIME = "SHORT"
@@ -16,6 +16,9 @@
 
 Check the cr50 ccd capabilities. Make sure the default values are ok and the
 settings work as expected.
+
+This test is applicable when ccd open is restricted.
+TODO(crbug.com/1014572) Drop separate control files for ccd open state.
 """
 
 if 'args_dict' not in locals():
@@ -26,13 +29,12 @@
 
 def run(machine):
     host = hosts.create_host(machine, servo_args=servo_args)
-
     iterations = int(args_dict.get("iterations", 1))
-    ccd_open_restricted = args_dict.get("ccd_open_restricted", "").lower()
+    ccd_open_restricted = args_dict.get("ccd_open_restricted", "true").lower()
     ccd_open_restricted = ccd_open_restricted != "false"
 
     job.run_test("firmware_Cr50CheckCap", host=host, cmdline_args=args,
                  ccd_open_restricted=ccd_open_restricted,
                  full_args=args_dict, iterations=iterations)
 
-parallel_simple(run, machines)
+parallel_simple(run, machines)
\ No newline at end of file
diff --git a/server/site_tests/firmware_Cr50CheckCap/control.unrestricted b/server/site_tests/firmware_Cr50CheckCap/control.ccd_open_unrestricted
similarity index 81%
rename from server/site_tests/firmware_Cr50CheckCap/control.unrestricted
rename to server/site_tests/firmware_Cr50CheckCap/control.ccd_open_unrestricted
index ab889d4..b54a21d 100644
--- a/server/site_tests/firmware_Cr50CheckCap/control.unrestricted
+++ b/server/site_tests/firmware_Cr50CheckCap/control.ccd_open_unrestricted
@@ -5,7 +5,7 @@
 from autotest_lib.server import utils
 
 AUTHOR = "mruthven"
-NAME = "firmware_Cr50CheckCap.unrestricted"
+NAME = "firmware_Cr50CheckCap.ccd_open_unrestricted"
 PURPOSE = "Verify cr50 ccd capabilities."
 ATTRIBUTES = "suite:faft_cr50_prepvt, suite:faft_cr50_tot"
 TIME = "SHORT"
@@ -17,8 +17,8 @@
 Check the cr50 ccd capabilities. Make sure the default values are ok and the
 settings work as expected.
 
-Assume ccd open is unrestricted by default.
-TODO(b/142112299): remove this control file once suites can pass test args.
+This test is applicable when ccd open is unrestricted.
+TODO(crbug.com/1014572) Drop separate control files for ccd open state.
 """
 
 if 'args_dict' not in locals():
@@ -29,13 +29,11 @@
 
 def run(machine):
     host = hosts.create_host(machine, servo_args=servo_args)
-
     iterations = int(args_dict.get("iterations", 1))
-    ccd_open_restricted = args_dict.get("ccd_open_restricted", "").lower()
-    ccd_open_restricted = ccd_open_restricted == "true"
-
+    ccd_open_restricted = args_dict.get("ccd_open_restricted", "false").lower()
+    ccd_open_restricted = ccd_open_restricted != "false"
     job.run_test("firmware_Cr50CheckCap", host=host, cmdline_args=args,
                  ccd_open_restricted=ccd_open_restricted,
                  full_args=args_dict, iterations=iterations)
 
-parallel_simple(run, machines)
+parallel_simple(run, machines)
\ No newline at end of file
diff --git a/server/site_tests/firmware_Cr50Open/control b/server/site_tests/firmware_Cr50Open/control.ccd_open_restricted
similarity index 79%
rename from server/site_tests/firmware_Cr50Open/control
rename to server/site_tests/firmware_Cr50Open/control.ccd_open_restricted
index 74e2441..115f594 100644
--- a/server/site_tests/firmware_Cr50Open/control
+++ b/server/site_tests/firmware_Cr50Open/control.ccd_open_restricted
@@ -5,7 +5,7 @@
 from autotest_lib.server import utils
 
 AUTHOR = "mruthven"
-NAME = "firmware_Cr50Open"
+NAME = "firmware_Cr50Open.ccd_open_restricted"
 PURPOSE = "Verify cr50 open"
 ATTRIBUTES = "suite:faft_cr50_pvt"
 TIME = "SHORT"
@@ -19,6 +19,9 @@
 
 This test must be run with servo instead of CCD, because we need to be able to
 fake power button presses.
+
+This test is applicable when ccd open is restricted.
+TODO(crbug.com/1014572) Drop separate control files for ccd open state.
 """
 
 if 'args_dict' not in locals():
@@ -35,7 +38,7 @@
     ccd_open_restricted = ccd_open_restricted != "false"
 
     job.run_test("firmware_Cr50Open", host=host, cmdline_args=args,
-                 ccd_open_restricted=ccd_open_restricted, full_args=args_dict,
-                 iterations=iterations)
+                 ccd_open_restricted=ccd_open_restricted,
+                 full_args=args_dict, iterations=iterations)
 
 parallel_simple(run, machines)
diff --git a/server/site_tests/firmware_Cr50Open/control.unrestricted b/server/site_tests/firmware_Cr50Open/control.ccd_open_unrestricted
similarity index 75%
rename from server/site_tests/firmware_Cr50Open/control.unrestricted
rename to server/site_tests/firmware_Cr50Open/control.ccd_open_unrestricted
index 2fa42ca..4254fda 100644
--- a/server/site_tests/firmware_Cr50Open/control.unrestricted
+++ b/server/site_tests/firmware_Cr50Open/control.ccd_open_unrestricted
@@ -5,7 +5,7 @@
 from autotest_lib.server import utils
 
 AUTHOR = "mruthven"
-NAME = "firmware_Cr50Open.unrestricted"
+NAME = "firmware_Cr50Open.ccd_open_unrestricted"
 PURPOSE = "Verify cr50 open"
 ATTRIBUTES = "suite:faft_cr50_prepvt, suite:faft_cr50_tot"
 TIME = "SHORT"
@@ -20,8 +20,8 @@
 This test must be run with servo instead of CCD, because we need to be able to
 fake power button presses.
 
-Assume ccd open is unrestricted by default.
-TODO(b/142112299): remove this control file once suites can pass test args.
+This test is applicable when ccd open is unrestricted.
+TODO(crbug.com/1014572) Drop separate control files for ccd open state.
 """
 
 if 'args_dict' not in locals():
@@ -32,13 +32,12 @@
 
 def run(machine):
     host = hosts.create_host(machine, servo_args=servo_args)
-
     iterations = int(args_dict.get("iterations", 1))
-    ccd_open_restricted = args_dict.get("ccd_open_restricted", "").lower()
-    ccd_open_restricted = ccd_open_restricted == "true"
+    ccd_open_restricted = args_dict.get("ccd_open_restricted", "false").lower()
+    ccd_open_restricted = ccd_open_restricted != "false"
 
     job.run_test("firmware_Cr50Open", host=host, cmdline_args=args,
-                 ccd_open_restricted=ccd_open_restricted, full_args=args_dict,
-                 iterations=iterations)
+                 ccd_open_restricted=ccd_open_restricted,
+                 full_args=args_dict, iterations=iterations)
 
-parallel_simple(run, machines)
+parallel_simple(run, machines)
\ No newline at end of file
diff --git a/test_suites/control.faft_cr50_prepvt b/test_suites/control.faft_cr50_prepvt
index ec15b3a..cb1d016 100644
--- a/test_suites/control.faft_cr50_prepvt
+++ b/test_suites/control.faft_cr50_prepvt
@@ -34,8 +34,5 @@
 args_dict['name'] = 'faft_cr50_prepvt'
 args_dict['add_experimental'] = True
 args_dict['job'] = job
-args_dict['test_args'] = {
-	'ccd_open_restricted' : 'False',
-}
 
 dynamic_suite.reimage_and_run(**args_dict)
diff --git a/test_suites/control.faft_cr50_tot b/test_suites/control.faft_cr50_tot
index dce8144..1460734 100644
--- a/test_suites/control.faft_cr50_tot
+++ b/test_suites/control.faft_cr50_tot
@@ -34,8 +34,7 @@
 args_dict['add_experimental'] = True
 args_dict['job'] = job
 args_dict['test_args'] = {
-	'tot_test_run' : 'True',
-	'ccd_open_restricted' : 'False'
+    'tot_test_run': 'True',
 }
 
 dynamic_suite.reimage_and_run(**args_dict)