cheets_CTS/GTS: Clean up test profile after the test.

Filesystem manipulated by kernel 5.4 cannot be fully cleaned
up by older kernels (4.19 or before). To avoid the leftover
artifact to affect CTS quota tests on older kernels, we let
the new kernel to clean up the data at the teardown step.

TEST=Run cheets_CTS_R.11_r3.arm.CtsUsb and check /home/.shadow/

Change-Id: I1b3d3ea0e84fd239a2f79ed97c5224aaa091b67a
Commit-Queue: Kazuhiro Inaba <>
Commit-Queue: Jaydeep Mehta <>
Tested-by: Kazuhiro Inaba <>
Auto-Submit: Kazuhiro Inaba <>
Reviewed-by: Jaydeep Mehta <>
(cherry picked from commit c333e70e25f0c030e42e3c59f80c28649a8ae6a2)
Reviewed-by: Kazuhiro Inaba <>
diff --git a/server/cros/tradefed/ b/server/cros/tradefed/
index e76e463..d56c958 100644
--- a/server/cros/tradefed/
+++ b/server/cros/tradefed/
@@ -229,6 +229,16 @@
     def cleanup(self):
         """Cleans up any dirtied state."""
+        try:
+            # Clean up test data that may not be deletable on previous
+            # ChromeOS versions. See b/170276268.
+            self._run_commands([
+                    'cryptohome --action=remove --force --user=test@test.test'
+            ],
+                               ignore_status=True)
+        except:
+            logging.error('Failed to clean up the test account.')
         if hasattr(self, '_tradefed_install'):