For accurate testing on Android, test compilation needs to more closely match the Android build system. This means flipping all the switches for -nostdlibinc, -nostdlib, etc. and instead using the libraries that were either prebuilt or built by the system.
Android's build system isn't able to efficiently handle many small builds run concurrently. The downside of this is that directly using the Android build system to compile each test cannot be done in parallel, and would take roughly 7 hours to complete a test run.
To deal with this, when config.android is true, lit.cfg will pull all of the cppflags and ldflags right out of config instead of trying to determine them on its own. It's dirtied a little bit by crtbegin and crtend.
The other thing this patch does is deal with pushing the built test to the android device, running it on the device, and removing it when done. There are a few intricacies wrapped around adb shell, as adb considers all commands that were able to be run on the device, regardless of their exit codes, to be successful. As such, the commands are run as adb shell COMMAND; echo $?, and the last line of stdout is read to determine the real exit status.