Make ART chroot setup & sync scripts a bit more robust.

Before this change, if one forgot to run
`art/tools/setup-buildbot-device.sh` before running
`art/tools/buildbot-sync.sh`, the tree on the device under
`$ART_TEST_CHROOT` would become messy (as the contents of
`$ANDROID_PRODUCT_OUT/system` and `$ANDROID_PRODUCT_OUT/data` would be
directly copied into `$ART_TEST_CHROOT`) and scripts
`tools/teardown-buildbot-device.sh` and
`art/tools/cleanup-buildbot-device.sh` would not work correctly.

To avoid that issue, have `tools/buildbot-sync.sh` create all the
expected directories under `$ART_TEST_CHROOT` prior to pushing files
into them, so that the behavior of `tools/buildbot-sync.sh` is
independent of whether `art/tools/setup-buildbot-device.sh` had run
before or not.

Test: Check that running:
        `art/tools/buildbot-sync.sh && art/tools/setup-buildbot-device.sh`
      produces the same effect as running:
        `art/tools/setup-buildbot-device.sh && art/tools/buildbot-sync.sh`
Bug: 34729697
Bug: 121117762
Change-Id: Ieebb3588648f2f61efaa82fb25078e0018db97be
diff --git a/tools/buildbot-sync.sh b/tools/buildbot-sync.sh
index 95dfd3c..6c803b6 100755
--- a/tools/buildbot-sync.sh
+++ b/tools/buildbot-sync.sh
@@ -135,6 +135,7 @@
 
 # Sync the system directory to the chroot.
 echo -e "${green}Syncing system directory...${nc}"
+adb shell mkdir -p "$ART_TEST_CHROOT/system"
 adb push "$ANDROID_PRODUCT_OUT/system" "$ART_TEST_CHROOT/"
 # Overwrite the default public.libraries.txt file with a smaller one that
 # contains only the public libraries pushed to the chroot directory.
@@ -155,8 +156,10 @@
   # the chroot directory, instead of simply using a symlink, as Bionic's linker
   # relies on the real path name of a binary (e.g.
   # `/apex/com.android.art/bin/dex2oat`) to select the linker configuration.
+  adb shell mkdir -p "$ART_TEST_CHROOT/apex"
   adb shell rm -rf "$ART_TEST_CHROOT/apex/${dst_apex}"
-  adb shell cp -a "$ART_TEST_CHROOT/system/apex/${src_apex}" "$ART_TEST_CHROOT/apex/${dst_apex}" || exit 1
+  adb shell cp -a "$ART_TEST_CHROOT/system/apex/${src_apex}" "$ART_TEST_CHROOT/apex/${dst_apex}" \
+    || exit 1
 }
 
 # "Activate" the required APEX modules.
@@ -187,4 +190,5 @@
 
 # Sync the data directory to the chroot.
 echo -e "${green}Syncing data directory...${nc}"
+adb shell mkdir -p "$ART_TEST_CHROOT/data"
 adb push "$ANDROID_PRODUCT_OUT/data" "$ART_TEST_CHROOT/"