Add installclean step to buildbots

There can be leftover files from previous incremental build.
This is usually harmless, since we rebuild everything we use.

However, in some cases, presence of stale files can be confusing.
For example, if test does not need dex2oat, but will use one if
present (which might be stale now), or if we there are libraries
in the build which have been deleted in previous CLs.

Bug: 133142426
Test: ./art/test/testrunner/run_build_test_target.py art-jit
Change-Id: Iede85b568a7c56de4dc80f488fe09772ee767a37
diff --git a/test/testrunner/run_build_test_target.py b/test/testrunner/run_build_test_target.py
index 8801805..4191771 100755
--- a/test/testrunner/run_build_test_target.py
+++ b/test/testrunner/run_build_test_target.py
@@ -66,6 +66,16 @@
 print(custom_env)
 os.environ.update(custom_env)
 
+# always run installclean first remove any old installed files from previous builds.
+# this does not remove intermediate files, so it still avoids recompilation.
+clean_command = 'build/soong/soong_ui.bash --make-mode installclean'
+if env.DIST_DIR:
+  clean_command += ' dist'
+sys.stdout.write(str(clean_command) + '\n')
+sys.stdout.flush()
+if subprocess.call(clean_command.split()):
+  sys.exit(1)
+
 # build is just a binary/script that is directly executed to build any artifacts needed for the
 # test.
 if 'build' in target: