Enable building art and tests with linux_bionic

A linux_bionic built runtime can be created by modifying the
$OUT_DIR/soong/soong.config json file to add a '"Host_bionic": true'
entry and then running the following command:

% m --skip-make $OUT_DIR/soong/host/linux_bionic-x86/<target-file>

A script 'tools/build_linux_bionic_tests.sh' was also added that will
build linux-bionic versions of host-test related files.

Also modify tests so they can be run.  Currently all run-tests pass
when run on a linux_bionic host build. All gtests pass except for the
following 9 tests:
  ArmVIXLAssemblerTest.VixlJniHelpers
  ArmVIXLAssemblerTest.VixlLoadFromOffset
  ArmVIXLAssemblerTest.VixlStoreToOffset
  DwarfTest.DebugFrame
  DwarfTest.DebugFrame64
  DwarfTest.x86_64_RegisterMapping
  DwarfTest.DebugLine
  DwarfTest.DebugLineSpecialOpcodes
  DwarfTest.DebugInfo

Since these tests must be run manually without the standard
(makefile-based) testrunner it's not clear yet whether these failures
are important or what must be done to fix them. Several tests had
dependencies on the actual location of the libart library that needed
to be fixed, these tests might as well.

Test: ./tools/build_linux_bionic_tests.sh
Test: ./test/testrunner/testrunner.py --no-build --host --64 --run-test-option=--bionic
Test: find $OUT_DIR/soong/host/linux_bionic-x86/nativetest64 -mindepth 2 -type f | while read abc; do $abc; done | tee all-tests.txt
Test: tail -n +0 -f all-tests.txt | grep FAILED

Bug: 31559095
Bug: 118778408
Change-Id: I5fae4e54371e7410678619f18fcb54a3bd34e9b0
diff --git a/test/run-test b/test/run-test
index 229e201..2363152 100755
--- a/test/run-test
+++ b/test/run-test
@@ -88,6 +88,8 @@
     export ANDROID_HOST_OUT=${OUT_DIR}/host/linux-x86
 fi
 
+host_lib_root=${ANDROID_HOST_OUT}
+
 # Allow changing DESUGAR script to something else, or to disable it with DESUGAR=false.
 if [ -z "$DESUGAR" ]; then
   export DESUGAR="$ANDROID_BUILD_TOP/art/tools/desugar.sh"
@@ -385,6 +387,14 @@
         run_args="${run_args} --64"
         suffix64="64"
         shift
+    elif [ "x$1" = "x--bionic" ]; then
+        # soong linux_bionic builds are 64bit only.
+        run_args="${run_args} --bionic --host --64"
+        suffix64="64"
+        target_mode="no"
+        DEX_LOCATION=$tmp_dir
+        host_lib_root=$OUT_DIR/soong/host/linux_bionic-x86
+        shift
     elif [ "x$1" = "x--trace" ]; then
         trace="true"
         shift
@@ -584,7 +594,7 @@
     if [ "$target_mode" = "no" ]; then
         guess_host_arch_name
         run_args="${run_args} --boot ${ANDROID_HOST_OUT}/framework/core${image_suffix}.art"
-        run_args="${run_args} --runtime-option -Djava.library.path=${ANDROID_HOST_OUT}/lib${suffix64}:${ANDROID_HOST_OUT}/nativetest${suffix64}"
+        run_args="${run_args} --runtime-option -Djava.library.path=${host_lib_root}/lib${suffix64}:${host_lib_root}/nativetest${suffix64}"
     else
         guess_target_arch_name
         run_args="${run_args} --runtime-option -Djava.library.path=/data/nativetest${suffix64}/art/${target_arch_name}"
@@ -711,6 +721,7 @@
         echo "    --output-path [path]  Location where to store the build" \
              "files."
         echo "    --64                  Run the test in 64-bit mode"
+        echo "    --bionic              Use the (host, 64-bit only) linux_bionic libc runtime"
         echo "    --trace               Run with method tracing"
         echo "    --strace              Run with syscall tracing from strace."
         echo "    --stream              Run method tracing in streaming mode (requires --trace)"