|
19 | 19 |
|
20 | 20 |
|
21 | 21 | def RunFirebaseTest(apk, results_dir): |
22 | | - try: |
23 | | - # game-loop tests are meant for OpenGL apps. |
24 | | - # This type of test will give the application a handle to a file, and |
25 | | - # we'll write the timeline JSON to that file. |
26 | | - # See https://firebase.google.com/docs/test-lab/android/game-loop |
27 | | - # Pixel 4. As of this commit, this is a highly available device in FTL. |
28 | | - subprocess.check_output([ |
29 | | - 'gcloud', |
30 | | - '--project', 'flutter-infra', |
31 | | - 'firebase', 'test', 'android', 'run', |
32 | | - '--type', 'game-loop', |
33 | | - '--app', apk, |
34 | | - '--timeout', '2m', |
35 | | - '--results-bucket', bucket, |
36 | | - '--results-dir', results_dir, |
37 | | - '--device', 'model=flame,version=29', |
38 | | - ]) |
39 | | - except subprocess.CalledProcessError as ex: |
40 | | - print(ex.output) |
41 | | - # Recipe will retry return codes from firebase that indicate an infra |
42 | | - # failure. |
43 | | - sys.exit(ex.returncode) |
| 22 | + # game-loop tests are meant for OpenGL apps. |
| 23 | + # This type of test will give the application a handle to a file, and |
| 24 | + # we'll write the timeline JSON to that file. |
| 25 | + # See https://firebase.google.com/docs/test-lab/android/game-loop |
| 26 | + # Pixel 4. As of this commit, this is a highly available device in FTL. |
| 27 | + process = subprocess.Popen( |
| 28 | + [ |
| 29 | + 'gcloud', |
| 30 | + '--project', 'flutter-infra', |
| 31 | + 'firebase', 'test', 'android', 'run', |
| 32 | + '--type', 'game-loop', |
| 33 | + '--app', apk, |
| 34 | + '--timeout', '2m', |
| 35 | + '--results-bucket', bucket, |
| 36 | + '--results-dir', results_dir, |
| 37 | + '--device', 'model=flame,version=29', |
| 38 | + ], |
| 39 | + stdout=subprocess.PIPE, |
| 40 | + stderr=subprocess.STDOUT, |
| 41 | + universal_newlines=True, |
| 42 | + ) |
| 43 | + return process |
44 | 44 |
|
45 | 45 |
|
46 | 46 | def CheckLogcat(results_dir): |
@@ -87,13 +87,25 @@ def main(): |
87 | 87 | git_revision = subprocess.check_output( |
88 | 88 | ['git', 'rev-parse', 'HEAD'], cwd=script_dir).strip() |
89 | 89 |
|
| 90 | + results = [] |
90 | 91 | for apk in apks: |
91 | 92 | results_dir = '%s/%s/%s' % (os.path.basename(apk), git_revision, args.build_id) |
92 | | - |
93 | | - RunFirebaseTest(apk, results_dir) |
| 93 | + process = RunFirebaseTest(apk, results_dir) |
| 94 | + results.append((results_dir, process)) |
| 95 | + |
| 96 | + for results_dir, process in results: |
| 97 | + for line in iter(process.stdout.readline, ""): |
| 98 | + print(line.strip()) |
| 99 | + return_code = process.wait() |
| 100 | + if return_code != 0: |
| 101 | + print('Firebase test failed ' + returncode) |
| 102 | + sys.exit(process.returncode) |
| 103 | + |
| 104 | + print('Checking logcat for %s' % results_dir) |
94 | 105 | CheckLogcat(results_dir) |
95 | 106 | # scenario_app produces a timeline, but the android image test does not. |
96 | 107 | if 'scenario' in apk: |
| 108 | + print('Checking timeline for %s' % results_dir) |
97 | 109 | CheckTimeline(results_dir) |
98 | 110 |
|
99 | 111 | return 0 |
|
0 commit comments