create_remote_test_driver: include Tast and Tast Tests in RTD image

Update RTD docker image to include all files needed by Tast and Tast Tests

1. Emerge tast-cmd and tast-remote-tests-cros
2. Copy following files and directories to rtd directory
    /usr/bin/tast
    /usr/bin/tast_rtd
    /usr/bin/remote_test_runner
    /usr/libexec/tast/bundles
    /usr/share/tast/data
    /etc/tast/vars

Manual Test Result:
$ cros_sdk /home/${USER}/trunk/src/scripts/create_remote_test_driver --output_dir "${tmp}"
$ ls -l  chroot//tmp/tmp.NqcczFOAjI/*/*/*
chroot//tmp/tmp.NqcczFOAjI/rtd/tast/bin:
total 33296
-rwxr-xr-x 1 seewaifu primarygroup 11855832 Jan  6 21:47 remote_test_runner
-rwxr-xr-x 1 seewaifu primarygroup 12925240 Jan  6 21:47 tast
-rwxr-xr-x 1 seewaifu primarygroup  9308760 Jan  6 21:47 tast_rtd

chroot//tmp/tmp.NqcczFOAjI/rtd/tast/bundles:
total 4
drwxr-xr-x 2 seewaifu primarygroup 4096 Jan  6 21:47 remote

chroot//tmp/tmp.NqcczFOAjI/rtd/tast/data:
total 4
drwxr-xr-x 3 seewaifu primarygroup 4096 Nov 30 17:58 chromiumos

chroot//tmp/tmp.NqcczFOAjI/rtd/tast/ssh_keys:
total 8
-rw-r--r-- 1 seewaifu primarygroup 1671 Dec  4 10:47 testing_rsa
-rw-r--r-- 1 seewaifu primarygroup  399 Dec  4 10:47 testing_rsa.pub

chroot//tmp/tmp.NqcczFOAjI/rtd/tast/vars:
total 8
drwxr-xr-x 2 seewaifu primarygroup 4096 Dec 28 09:41 private
drwxr-xr-x 2 seewaifu primarygroup 4096 Nov 30 17:54 public

BUG=chromium:1162362
TEST=Manual testing

Change-Id: I3f28ad8ec39d7aa6a94e34dd2ef99341a6273828
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosutils/+/2606390
Commit-Queue: Seewai Fu <seewaifu@google.com>
Tested-by: Seewai Fu <seewaifu@google.com>
Reviewed-by: Tatsuhisa Yamaguchi <yamaguchi@chromium.org>
Reviewed-by: Shuhei Takahashi <nya@chromium.org>
Reviewed-by: Sean Abraham <seanabraham@chromium.org>
diff --git a/create_remote_test_driver b/create_remote_test_driver
index 1607ddf..0b1abd7 100755
--- a/create_remote_test_driver
+++ b/create_remote_test_driver
@@ -7,6 +7,25 @@
 # Populates a directory with everything necessary to build a remote test driver
 # container.
 
+# BuildAndCopyTastItems builds and copies all Tast related executables
+# and data to targets.
+BuildAndCopyTastItems() {
+    # Emerge tast related executables.
+    sudo emerge tast-cmd
+    sudo emerge tast-remote-tests-cros
+    local tast_dir="$1/tast"
+    local tast_bin_dir="${tast_dir}/bin"
+    # Copy tast related items.
+    mkdir -p "${tast_bin_dir}"
+    cp /usr/bin/tast "${tast_bin_dir}"
+    cp /usr/bin/tast_rtd "${tast_bin_dir}"
+    cp /usr/bin/remote_test_runner "${tast_bin_dir}"
+    cp -pdr /usr/libexec/tast/bundles "${tast_dir}"
+    cp -pdr /usr/share/tast/data "${tast_dir}"
+    cp -pdr /etc/tast/vars "${tast_dir}"
+    cp -pdr /home/"${USER}"/trunk/chromite/ssh_keys "${tast_dir}"
+}
+
 readonly script_dir="$(dirname "$(realpath -e "${BASH_SOURCE[0]}")")"
 . "${script_dir}/common.sh" || exit 1
 
@@ -55,7 +74,9 @@
 # Build and copy the tnull (fake) RTD.
 sudo emerge tnull
 cp /usr/bin/tnull "${rtd_dir}/"
+
 # tast and tauto entries will eventually go here.
+BuildAndCopyTastItems "${rtd_dir}"
 
 command_completed
 info "Done. Wrote output to ${output_dir}"