mirror of
https://github.com/flatcar/scripts.git
synced 2025-09-22 06:01:41 +02:00
Convert build_library/test_image to a shell library.
Renamed the fuction from "test_image" to "test_image_content"; renamed the source file to match. BUG=None TEST=build both x86 and arm images Change-Id: I158f2c5bc0f2fc260d48bd125a1899e6a21d7b79 Reviewed-on: http://gerrit.chromium.org/gerrit/5821 Reviewed-by: Vince Laviano <vlaviano@chromium.org> Tested-by: Richard Barnette <jrbarnette@chromium.org>
This commit is contained in:
parent
b01cc8d2d3
commit
aaef76166f
14
build_image
14
build_image
@ -83,13 +83,13 @@ eval set -- "${FLAGS_ARGV}"
|
||||
# so will die prematurely if 'set -e' is specified before now.
|
||||
set -e
|
||||
|
||||
. "${SCRIPT_ROOT}/build_library/board_options.sh" || exit 1
|
||||
|
||||
# Determine build version.
|
||||
OVERLAY_CHROMEOS_DIR="${SRC_ROOT}/third_party/chromiumos-overlay/chromeos"
|
||||
. "${OVERLAY_CHROMEOS_DIR}/config/chromeos_version.sh" || exit 1
|
||||
|
||||
. "${SCRIPT_ROOT}/build_library/build_gpt.sh" || exit 1
|
||||
. "${BUILD_LIBRARY_DIR}/board_options.sh" || exit 1
|
||||
. "${BUILD_LIBRARY_DIR}/build_gpt.sh" || exit 1
|
||||
. "${BUILD_LIBRARY_DIR}/test_image_content.sh" || exit 1
|
||||
|
||||
|
||||
EMERGE_BOARD_CMD="emerge-$BOARD"
|
||||
@ -441,9 +441,7 @@ install_dev_packages() {
|
||||
# building a factory install shim, as the INSTALL_MASK for it will make
|
||||
# test_image fail.
|
||||
if [ ${FLAGS_factory_install} -eq ${FLAGS_FALSE} ]; then
|
||||
"${BUILD_LIBRARY_DIR}/test_image" \
|
||||
--root="${ROOT_FS_DIR}" \
|
||||
--target="${ARCH}"
|
||||
test_image_content "$ROOT_FS_DIR"
|
||||
fi
|
||||
echo "Developer image built and stored at ${image_name}"
|
||||
|
||||
@ -600,9 +598,7 @@ create_base_image() {
|
||||
# Don't test the factory install shim
|
||||
if [ ${FLAGS_factory_install} -eq ${FLAGS_FALSE} ]; then
|
||||
# Check that the image has been correctly created.
|
||||
"${BUILD_LIBRARY_DIR}/test_image" \
|
||||
--root="${ROOT_FS_DIR}" \
|
||||
--target="${ARCH}"
|
||||
test_image_content "$ROOT_FS_DIR"
|
||||
fi
|
||||
|
||||
# Clean up symlinks so they work on a running target rooted at "/".
|
||||
|
@ -1,68 +0,0 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Copyright (c) 2011 The Chromium OS Authors. All rights reserved.
|
||||
# Use of this source code is governed by a BSD-style license that can be
|
||||
# found in the LICENSE file.
|
||||
|
||||
SCRIPT_ROOT=$(readlink -f $(dirname "$0")/..)
|
||||
. "${SCRIPT_ROOT}/common.sh" || exit 1
|
||||
|
||||
# We're invoked only by build_image, which runs in the chroot
|
||||
assert_inside_chroot
|
||||
|
||||
# Flags
|
||||
DEFINE_string target "x86" \
|
||||
"The target architecture to test. One of { x86, arm }."
|
||||
DEFINE_string root "" \
|
||||
"The root file system to check."
|
||||
|
||||
# Parse command line
|
||||
FLAGS "$@" || exit 1
|
||||
eval set -- "${FLAGS_ARGV}"
|
||||
|
||||
# Die on any errors
|
||||
set -e
|
||||
|
||||
# Check all parts of a pipe
|
||||
set -o pipefail
|
||||
|
||||
ROOT="$FLAGS_root"
|
||||
if [[ -z "$ROOT" ]]; then
|
||||
echo "Error: --root is required."
|
||||
exit 1
|
||||
fi
|
||||
if [[ ! -d "$ROOT" ]]; then
|
||||
echo "Error: Root FS does not exist ($ROOT)"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
EXITCODE=0
|
||||
|
||||
BINARIES="$ROOT/usr/bin/Xorg
|
||||
$ROOT/usr/bin/chromeos-wm
|
||||
$ROOT/boot/vmlinuz
|
||||
$ROOT/sbin/session_manager
|
||||
$ROOT/bin/sed"
|
||||
|
||||
if [[ $FLAGS_target != arm ]]; then
|
||||
# chrome isn't present on arm
|
||||
BINARIES="$BINARIES
|
||||
$ROOT/opt/google/chrome/chrome"
|
||||
fi
|
||||
|
||||
for i in $BINARIES; do
|
||||
if ! [[ -f $i ]]; then
|
||||
echo test_image: Cannot find $i
|
||||
EXITCODE=1
|
||||
fi
|
||||
done
|
||||
|
||||
LIBS="`sudo find $ROOT -type f -name '*.so*'`"
|
||||
|
||||
# Check that all .so files, plus the binaries, have the appropriate dependencies
|
||||
if ! "${SCRIPTS_DIR}/build_library/check_deps" "$ROOT" $BINARIES $LIBS; then
|
||||
echo test_image: Failed dependency check
|
||||
EXITCODE=1
|
||||
fi
|
||||
|
||||
exit $EXITCODE
|
36
build_library/test_image_content.sh
Normal file
36
build_library/test_image_content.sh
Normal file
@ -0,0 +1,36 @@
|
||||
# Copyright (c) 2011 The Chromium OS Authors. All rights reserved.
|
||||
# Use of this source code is governed by a BSD-style license that can be
|
||||
# found in the LICENSE file.
|
||||
|
||||
test_image_content() {
|
||||
local root="$1"
|
||||
local returncode=0
|
||||
|
||||
local binaries=(
|
||||
"$root/usr/bin/Xorg"
|
||||
"$root/usr/bin/chromeos-wm"
|
||||
"$root/boot/vmlinuz"
|
||||
"$root/sbin/session_manager"
|
||||
"$root/bin/sed"
|
||||
"$root/opt/google/chrome/chrome"
|
||||
)
|
||||
|
||||
for test_file in "${binaries[@]}"; do
|
||||
if [ ! -f "$test_file" ]; then
|
||||
error "test_image_content: Cannot find '$test_file'"
|
||||
returncode=1
|
||||
fi
|
||||
done
|
||||
|
||||
local libs=( $(sudo find "$root" -type f -name '*.so*') )
|
||||
|
||||
# Check that all .so files, plus the binaries, have the appropriate
|
||||
# dependencies.
|
||||
local check_deps="${BUILD_LIBRARY_DIR}/check_deps"
|
||||
if ! "$check_deps" "$root" "${binaries[@]}" "${libs[@]}"; then
|
||||
error "test_image_content: Failed dependency check"
|
||||
returncode=1
|
||||
fi
|
||||
|
||||
return $returncode
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user