Dump list of results directory files for debugging.

We found Chrome trace data files are sometimes not uploaded to the
server after running in the CI.
Leave file list to the log for examining where it goes wrong.

BUG=chromium:1140286
TEST=../third_party/autotest/files/utils/unittest_suite.py -r server/site_tests/tast --debug

Change-Id: Ibc506fb894c22ae3276aaf0b177cbb75ad9d4f02
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/third_party/autotest/+/2571132
Reviewed-by: Shuhei Takahashi <nya@chromium.org>
Commit-Queue: Tatsuhisa Yamaguchi <yamaguchi@chromium.org>
Tested-by: Tatsuhisa Yamaguchi <yamaguchi@chromium.org>
diff --git a/server/site_tests/tast/tast.py b/server/site_tests/tast/tast.py
index 4f168e1..c12968b 100644
--- a/server/site_tests/tast/tast.py
+++ b/server/site_tests/tast/tast.py
@@ -461,6 +461,18 @@
         self._run_tast('run', args, self._max_run_sec + tast._RUN_EXIT_SEC,
                        log_stdout=True)
 
+        # Dump a list of the results directory files for log upload issue investigation.
+        # crbug.com/1140286
+        cmd = ['ls', '-Ral', self.resultsdir]
+        utils.run(cmd,
+                  ignore_status=False,
+                  timeout=5,
+                  stdout_tee=utils.TEE_TO_LOGS,
+                  stderr_tee=utils.TEE_TO_LOGS,
+                  stderr_is_expected=False,
+                  stdout_level=logging.INFO,
+                  stderr_level=logging.ERROR)
+
     def _read_run_error(self):
         """Reads a global run error message written by the tast command."""
         # The file is only written if a run error occurred.