A FAFT test case for kernel A corruption.

This test corrupts kernel A and checks for kernel B on the next boot.
It will fail if kernel verification mis-behaved.

BUG=chromium-os:19710
TEST=run_remote_tests.sh --remote=$REMOTE_IP -a \
     "servo_vid=0x18d1 servo_pid=0x5001" firmware_CorruptKernelA

Change-Id: Ie41c1cb51216c9d830478335abd47c193a8f9dcc
Reviewed-on: https://gerrit.chromium.org/gerrit/10841
Commit-Ready: Tom Wai-Hong Tam <waihong@chromium.org>
Reviewed-by: Tom Wai-Hong Tam <waihong@chromium.org>
Tested-by: Tom Wai-Hong Tam <waihong@chromium.org>
diff --git a/client/cros/faft_client.py b/client/cros/faft_client.py
index e17f166..09a87ab 100644
--- a/client/cros/faft_client.py
+++ b/client/cros/faft_client.py
@@ -124,6 +124,26 @@
                 'crossystem %s' % key)[0]
 
 
+    def get_root_dev(self):
+        """Get the name of root device without partition number.
+
+        Returns:
+            A string of the root device without partition number.
+        """
+        self._chromeos_interface.log('Requesting get root device')
+        return self._chromeos_interface.get_root_dev()
+
+
+    def get_root_part(self):
+        """Get the name of root device with partition number.
+
+        Returns:
+            A string of the root device with partition number.
+        """
+        self._chromeos_interface.log('Requesting get root part')
+        return self._chromeos_interface.get_root_part()
+
+
     def set_try_fw_b(self):
         """Set 'Try Frimware B' flag in crossystem."""
         self._chromeos_interface.log('Requesting restart with firmware B')
@@ -158,6 +178,28 @@
         self._flashrom_handler.restore_firmware(section)
 
 
+    @allow_multiple_section_input
+    def corrupt_kernel(self, section):
+        """Corrupt the requested kernel section.
+
+        Args:
+            section: A kernel section, either 'a' or 'b'.
+        """
+        self._chromeos_interface.log('Corrupting kernel %s' % section)
+        self._kernel_handler.corrupt_kernel(section)
+
+
+    @allow_multiple_section_input
+    def restore_kernel(self, section):
+        """Restore the requested kernel section (previously corrupted).
+
+        Args:
+            section: A kernel section, either 'a' or 'b'.
+        """
+        self._chromeos_interface.log('restoring kernel %s' % section)
+        self._kernel_handler.restore_kernel(section)
+
+
     def cleanup(self):
         """Cleanup for the RPC server. Currently nothing."""
         pass