blob: ec586f152311c1959405329a48560a955692bf95 [file] [log] [blame]
David Jamesa17e9462010-03-02 15:28:58 -08001#!/bin/bash
2
3# Copyright (c) 2010 The Chromium OS Authors. All rights reserved.
4# Use of this source code is governed by a BSD-style license that can be
5# found in the LICENSE file.
6
7# Load common constants. This should be the first executable line.
8# The path to common.sh should be relative to your script's location.
9. "$(dirname "$0")/common.sh"
10
11# Flags
12DEFINE_string target "x86" \
13 "The target architecture to test. One of { x86, arm }."
14DEFINE_string root "" \
15 "The root file system to check."
16
17# Parse command line
18FLAGS "$@" || exit 1
19eval set -- "${FLAGS_ARGV}"
20
21# Die on any errors
22set -e
23
24# Check all parts of a pipe
25set -o pipefail
26
27ROOT="$FLAGS_root"
28if [[ -z "$ROOT" ]]; then
29 echo "Error: --root is required."
30 exit 1
31fi
32if [[ ! -d "$ROOT" ]]; then
33 echo "Error: Root FS does not exist ($ROOT)"
34 exit 1
35fi
36
37EXITCODE=0
38
39BINARIES="$ROOT/usr/bin/Xorg
40 $ROOT/usr/bin/chromeos-wm
41 $ROOT/boot/vmlinuz
42 $ROOT/sbin/session_manager
43 $ROOT/bin/sed"
44
45if [[ $FLAGS_target != arm ]]; then
46 # chrome isn't present on arm
47 BINARIES="$BINARIES
48 $ROOT/opt/google/chrome/chrome"
49fi
50
51for i in $BINARIES; do
52 if ! [[ -f $i ]]; then
53 echo test_image: Cannot find $i
54 EXITCODE=1
55 fi
56done
57
58LIBS="`sudo find $ROOT -type f -name '*.so*'`"
59
60# Check that all .so files, plus the binaries, have the appropriate dependencies
61if ! "${SCRIPTS_DIR}/check_deps" "$ROOT" $BINARIES $LIBS; then
62 echo test_image: Failed dependency check
63 EXITCODE=1
64fi
65
66exit $EXITCODE