Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(201)

Unified Diff: platform_tools/barelinux/bin/arm64_download

Issue 239243005: arm64_download script waits for VM to boot before finishing. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 6 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: platform_tools/barelinux/bin/arm64_download
diff --git a/platform_tools/barelinux/bin/arm64_download b/platform_tools/barelinux/bin/arm64_download
index b43873c943e992ec23df1f4cd7a9246ef70f925d..c14b167829593a259effebed76c8357c4f88a952 100755
--- a/platform_tools/barelinux/bin/arm64_download
+++ b/platform_tools/barelinux/bin/arm64_download
@@ -6,6 +6,8 @@
# found in the LICENSE file.
+set -e
epoger 2014/04/15 19:33:06 Note that "set -e" can have its pitfalls. See htt
+
usage() {
cat >&2 <<EOF
arm64_download - this script downloads the Linaro's ARMv8 Aarch64
@@ -20,7 +22,7 @@ background. After the boot is complete, you can SSH into the system
at port 8022 via user@localhost. The SSH key will be downloaded into
the working directery as well.
-Requires gsutil, xz, tar, and gunzip.
+Requires gsutil, xz, tar, md5sum, and gunzip.
Usage:
$0 WORKING_DIRECTORY
@@ -31,39 +33,30 @@ EOF
return 1
}
-try() {
- # print an error on nonzero return code
- "$@"
- local ret=$?
- if [ $ret != 0 ] ; then
- echo "'$@' failed and returned ${ret}." >&2
- return $ret
- fi
-}
-
download_necessary_software_to_dir() (
+ echo 'Downloading necessary software.'
cd "$1"
local location="chromium-skia-gm/arm64env"
- try gsutil cp "gs://${location}/md5sum.txt" . || return
- if md5sum -c --quiet "md5sum.txt"; then
- return 0
+ gsutil cp "gs://${location}/md5sum.txt" . 2> /dev/null
+ if ! md5sum -c --quiet "md5sum.txt"; then
+ gsutil cp "gs://${location}/*" .
fi
- try gsutil cp "gs://${location}/*" . || return
+ echo 'Done.'
)
install_compiler() {
local working_dir="$1"
local toolchain="gcc-linaro-aarch64-linux-gnu-4.8-2013.12_linux"
(
- try cd "$working_dir" || return
- try test -f "${toolchain}.tar.xz" || return
- try xz --decompress --stdout < "${toolchain}.tar.xz" | \
- try tar xf - || return
+ cd "$working_dir"
+ test -f "${toolchain}.tar.xz"
+ xz --decompress --stdout < "${toolchain}.tar.xz" | \
+ tar xf -
)
local dir="${working_dir}/${toolchain}"
- try test -d "$dir" || return
- try test -x "${dir}/bin/aarch64-linux-gnu-gcc" || return
- try test -x "${dir}/bin/aarch64-linux-gnu-g++" || return
+ test -d "$dir"
+ test -x "${dir}/bin/aarch64-linux-gnu-gcc"
+ test -x "${dir}/bin/aarch64-linux-gnu-g++"
}
install_runtime() {
@@ -75,22 +68,24 @@ install_runtime() {
local compressed_foundation_model='FM000-KT-00035-r0p8-52rel06.tgz'
local keyfile='CLEAN_AND_CONFIGURED_key'
- try cp "${working_dir}/$firmware" "${working_dir}/firmware" || return
+ echo 'Installing runtime files.'
+ cp "${working_dir}/$firmware" "${working_dir}/firmware"
- try xz --decompress --stdout \
+ xz --decompress --stdout \
< "${working_dir}/${compressed_rootfs}" \
- > "${working_dir}/rootfs" || return
- try test -f "${working_dir}/rootfs" || return
+ > "${working_dir}/rootfs"
+ test -f "${working_dir}/rootfs"
(
- try cd "$working_dir" || return
- try test -f "$compressed_foundation_model" || return
- try gunzip -c "$compressed_foundation_model" | try tar xf - || return
- try test -d "Foundation_v8pkg" || return # Assert.
+ cd "$working_dir"
+ test -f "$compressed_foundation_model"
+ gunzip -c "$compressed_foundation_model" | tar xf -
+ test -d "Foundation_v8pkg" # Assert.
)
- try cp "${working_dir}/${keyfile}" "${working_dir}/key" || return
+ cp "${working_dir}/${keyfile}" "${working_dir}/key"
chmod 'go=' "${working_dir}/key"
+ echo 'Done.'
}
start_arm64_image() {
@@ -100,10 +95,10 @@ start_arm64_image() {
local firmware="${working_dir}/firmware"
local rootfs="${working_dir}/rootfs"
- try test -d "$foundation_dir" || return
- try test -x "$foundation" || return
- try test -f "$firmware" || return
- try test -f "$rootfs" || return
+ test -d "$foundation_dir"
+ test -x "$foundation"
+ test -f "$firmware"
+ test -f "$rootfs"
for PID in $(ps -o 'pid=' -C 'Foundation_v8') ; do
kill $PID
@@ -118,31 +113,34 @@ start_arm64_image() {
--network-nat-subnet="192.168.31.0/24" \
--network-nat-ports="8022=22" \
> /dev/null 2>&1 &
+ echo 'Waiting for foundation model to boot...'
+ while ! ssh -i "${working_dir}/key" \
+ -o NoHostAuthenticationForLocalhost=yes \
+ -p 8022 user@localhost true 2> /dev/null; do
+ sleep 5 ;
+ done
echo 'Listening to SSH on port 8022.'
}
arm64_download() {
local working_directory="$1"
- try mkdir -p "$working_directory" || return
-
- try download_necessary_software_to_dir "$working_directory" || return
+ mkdir -p "$working_directory"
- try install_compiler "$working_directory" || return
+ download_necessary_software_to_dir "$working_directory"
- try install_runtime "$working_directory" || return
+ install_compiler "$working_directory"
- try start_arm64_image "$working_directory" || return
+ install_runtime "$working_directory"
- try start_arm64_image \
- "$working_directory" \
- || return
+ start_arm64_image "$working_directory"
}
for command in gsutil xz tar md5sum gunzip; do
- try command -v "$command" > /dev/null || usage || exit
+ command -v "$command" > /dev/null || usage
done
if [ -z "$1" ] ; then
- usage || exit
+ usage
fi
-try arm64_download "$1"
+
+arm64_download "$1"
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698