coverage: list all the corpus files in the files metadata

This is necessary because we're not running the subprocess as a shell,
so the other method was not working correctly. Furthermore, this method
allows for recovering from potential failures while executing testcases.

Change-Id: If58a2c7b72d7294a712ead214177f3a3ed1eeac9
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6425385
Commit-Queue: Ali Hijazi <[email protected]>
Reviewed-by: Ali Hijazi <[email protected]>
Auto-Submit: Paul Semel <[email protected]>
Commit-Queue: Paul Semel <[email protected]>
Cr-Commit-Position: refs/heads/main@{#1441500}
NOKEYCHECK=True
GitOrigin-RevId: 6025669045bf834e9c45c8d3fbb262c5acd2e0a6
diff --git a/run_all_fuzzers.py b/run_all_fuzzers.py
index d4fffc1..7631852 100644
--- a/run_all_fuzzers.py
+++ b/run_all_fuzzers.py
@@ -299,15 +299,19 @@
         # Centipede RunnerMain will by default set the watchdog thread to all
         # zeros, which means we don't need to worry about rss_limit_mb or
         # timeouts.
-        cmd = [
-            fuzzer_target_binpath,
-            os.path.join(fuzzer_target_corporadir, '*')
-        ]
+        cmd = [fuzzer_target_binpath]
+        # The centipede fuzzing target needs to have all the files listed as
+        # inputs. Unfortunately, this means that if any of the testcases fails,
+        # we won't have coverage for any files in the corpus. For that reason,
+        # we prefer listing the files and fallback on gathering profiles per
+        # testcase if that happens.
+        files = ' '.join(os.listdir(fuzzer_target_corporadir))
       else:  # libfuzzer
         cmd = [
             fuzzer_target_binpath, '-runs=0', '-rss_limit_mb=8192',
             fuzzer_target_corporadir
         ]
+        files = '*'
       all_target_details.append({
           'name':
           fuzzer_target,
@@ -324,7 +328,7 @@
           'corpus':
           fuzzer_target_corporadir,
           'files':
-          '*'
+          files
       })
 
   # We also want to run ./chrome without a valid X server.