Make logging_AsanCrash test crash if used with non-ASAN image.

The test will be emerged only by boards with ASAN profiles.

BUG=chromium:126774
TEST=./run_remote_tests.sh client/site_tests/logging_AsanCrash

Change-Id: Ib8f6a76773be1295c4479b2b212a0fb41b9cfeee
Reviewed-on: https://gerrit.chromium.org/gerrit/23345
Tested-by: Denis Glotov <glotov@chromium.org>
Reviewed-by: Nirnimesh <nirnimesh@chromium.org>
Commit-Ready: Denis Glotov <glotov@chromium.org>
diff --git a/client/site_tests/logging_AsanCrash/logging_AsanCrash.py b/client/site_tests/logging_AsanCrash/logging_AsanCrash.py
index 900500a..bfb42ed 100644
--- a/client/site_tests/logging_AsanCrash/logging_AsanCrash.py
+++ b/client/site_tests/logging_AsanCrash/logging_AsanCrash.py
@@ -9,10 +9,14 @@
 
 class logging_AsanCrash(cros_ui_test.UITest):
     version = 1
+    auto_login = False
 
     def run_once(self):
         import pyauto
 
+        if not 'asan' in utils.read_file('/etc/session_manager_use_flags.txt'):
+            raise error.TestFail('Current image not built with ASAN')
+
         ui_log = cros_logging.LogReader(constants.UI_LOG)
         ui_log.set_start_by_current()
 
@@ -28,9 +32,11 @@
                 exception=error.TestFail(
                     'Found no ui log message about Address Sanitizer catch'))
 
-            if not ui_log.can_find("'testarray'"):
-                raise error.TestFail(
-                    'ASAN caught bug but did not mentioned the cause in log')
+            utils.poll_for_condition(
+                lambda: ui_log.can_find("'testarray'"),
+                timeout=10,
+                exception=error.TestFail(
+                    'ASAN caught bug but did not mentioned the cause in log'))
 
         except:
             logging.debug('UI log: ' + ui_log.get_logs())