Check that smali generated output file
Smali always returns 0 exit code, so also check presence of
the output file to catch syntax errors.
Bug: 305699351
Test: Build fails if there is smali syntax error
Change-Id: I4f7c379f274f2269ee8fffaed1ecf17854a6e97c
diff --git a/test/run_test_build.py b/test/run_test_build.py
index c5b76c2..3037c82 100755
--- a/test/run_test_build.py
+++ b/test/run_test_build.py
@@ -272,8 +272,9 @@
def make_smali(dst_dex: Path, src_dir: Path) -> Optional[Path]:
if not use_smali or not src_dir.exists():
return None # No sources to compile.
- self.smali(["-JXmx512m", "assemble"] + smali_args + ["--api", str(api_level)] +
- ["--output", dst_dex] + sorted(src_dir.glob("**/*.smali")))
+ p = self.smali(["-JXmx512m", "assemble"] + smali_args + ["--api", str(api_level)] +
+ ["--output", dst_dex] + sorted(src_dir.glob("**/*.smali")))
+ assert dst_dex.exists(), p.stdout # NB: smali returns 0 exit code even on failure.
return dst_dex
def make_java(dst_dir: Path, *src_dirs: Path) -> Optional[Path]: