flatcar-scripts/build_library/test_image_content.sh
Darin Petkov a973d2bdb4 Add checks for blacklisted directories to test_image_content.
Also, blacklist /usr/share/locale. Most recently this unused directory crept
back into the image after some "sudo" package changes/upgrades.

BUG=chromium-os:11820
TEST=build_image dev for x86-alex, tegra2, amd64-generic

Change-Id: I0a209a5030a3da3674d3a38faf2367032c6e3423
Reviewed-on: https://gerrit.chromium.org/gerrit/16352
Tested-by: Darin Petkov <petkov@chromium.org>
Reviewed-by: Chris Sosa <sosa@chromium.org>
Commit-Ready: Darin Petkov <petkov@chromium.org>
2012-02-23 02:18:20 -08:00

46 lines
1.1 KiB
Bash

# Copyright (c) 2012 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/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
local blacklist_dirs=(
"$root/usr/share/locale"
)
for dir in "${blacklist_dirs[@]}"; do
if [ -d "$dir" ]; then
error "test_image_content: Blacklisted directory found: $dir"
returncode=1
fi
done
return $returncode
}