[autotest] Extract _parse_control_file_text method

BUG=chromium:672348
TEST=None

Change-Id: I0b2e2bf1a01941621460a838210176c246e486ac
Reviewed-on: https://chromium-review.googlesource.com/453273
Commit-Ready: Allen Li <ayatane@chromium.org>
Tested-by: Allen Li <ayatane@chromium.org>
Reviewed-by: Aviv Keshet <akeshet@chromium.org>
diff --git a/server/cros/dynamic_suite/suite.py b/server/cros/dynamic_suite/suite.py
index b8402bd..1a3848e 100644
--- a/server/cros/dynamic_suite/suite.py
+++ b/server/cros/dynamic_suite/suite.py
@@ -578,8 +578,7 @@
             if self._test_args:
                 text = tools.inject_vars(self._test_args, text)
             try:
-                found_test = control_data.parse_control_string(
-                        text, raise_warnings=True, path=path)
+                found_test = self._parse_control_file_text(path, text)
             except control_data.ControlVariableException, e:
                 if not self._forgiving_parser:
                     msg = "Failed parsing %s\n%s" % (path, e)
@@ -588,13 +587,28 @@
             except Exception, e:
                 logging.error("Bad %s\n%s", path, e)
             else:
-                found_test.text = text
-                if self._run_prod_code:
-                    found_test.require_ssp = False
                 tests[path] = found_test
         return tests
 
 
+    def _parse_control_file_text(self, path, text):
+        """Parse control file text.
+
+        This ignores forgiving_parser because we cannot return a
+        forgiving value.
+
+        @param path: path to control file
+        @param text: control file text contents
+        @returns: a ControlData object
+        """
+        test = control_data.parse_control_string(
+                text, raise_warnings=True, path=path)
+        test.text = text
+        if self._run_prod_code:
+            test.require_ssp = False
+        return test
+
+
 class _BatchControlFileRetriever(_ControlFileRetriever):
     """Subclass that can retrieve suite control files in batch."""