Abort deleting the directory if deletion of any of its chromeos subtree fails.

TEST=None
BUG=None

Change-Id: I4dfd2f67d8bc7f6f329b58800c148a923e78eace
Reviewed-on: https://chrome-internal-review.googlesource.com/161678
Reviewed-by: Luis Lozano <llozano@chromium.org>
Commit-Queue: Han Shen <shenhan@google.com>
Tested-by: Han Shen <shenhan@google.com>
diff --git a/auto_delete_nightly_test_data.py b/auto_delete_nightly_test_data.py
index f990f12..faebb5b 100755
--- a/auto_delete_nightly_test_data.py
+++ b/auto_delete_nightly_test_data.py
@@ -29,11 +29,18 @@
       all_succeeded = False
       print 'Failed to remove chromeos tree "{0}", please check.'.format(cd)
 
+  if not all_succeeded:
+    print 'Failed to delete at least one chromeos tree, please check.'
+    return False
+
   ## Now delete the numbered dir Before forcibly removing the directory, just
-  ## check 's' to make sure it is sane.
-  if not re.search('^' + constants.CROSTC_WORKSPACE + '/(' +
-                   '|'.join(DIR_BY_WEEKDAY) + ')', s):
-    print 'Trying to delete an invalid dir, please check.'
+  ## check 's' to make sure it is sane.  A valid dir to be removed must be
+  ## '/usr/local/google/crostc/(SUN|MON|TUE...|SAT)'.
+  valid_dir_pattern = ('^' + constants.CROSTC_WORKSPACE + '/(' +
+                       '|'.join(DIR_BY_WEEKDAY) + ')')
+  if not re.search(valid_dir_pattern, s):
+    print ('Trying to delete an invalid dir "{0}" (must match "{1}"), '
+           'please check.'.format(s, valid_dir_pattern))
     return False
 
   cmd = 'rm -fr {0}'.format(s)