diff options
Diffstat (limited to 'scripts/image_signing/ensure_not_ASAN.sh')
-rwxr-xr-x | scripts/image_signing/ensure_not_ASAN.sh | 39 |
1 files changed, 22 insertions, 17 deletions
diff --git a/scripts/image_signing/ensure_not_ASAN.sh b/scripts/image_signing/ensure_not_ASAN.sh index 16cc88cd..f19b1ddf 100755 --- a/scripts/image_signing/ensure_not_ASAN.sh +++ b/scripts/image_signing/ensure_not_ASAN.sh @@ -11,26 +11,31 @@ set -e . "$(dirname "$0")/common.sh" usage() { - echo "Usage $PROG image" + echo "Usage $PROG image" } main() { - if [ $# -ne 1 ]; then - usage - exit 1 - fi - - local image="$1" - - local loopdev=$(loopback_partscan "${image}") - local rootfs=$(make_temp_dir) + if [[ $# -ne 1 ]]; then + usage + exit 1 + fi + + local image="$1" + + local loopdev rootfs + if [[ -d "${image}" ]]; then + rootfs="${image}" + else + rootfs=$(make_temp_dir) + loopdev=$(loopback_partscan "${image}") mount_loop_image_partition_ro "${loopdev}" 3 "${rootfs}" - - # This mirrors the check performed in the platform_ToolchainOptions - # autotest. - if readelf -s "$rootfs/opt/google/chrome/chrome" | \ - grep -q __asan_init; then - exit 1 - fi + fi + + # This mirrors the check performed in the platform_ToolchainOptions + # autotest. + if readelf -s "$rootfs/opt/google/chrome/chrome" | \ + grep -q __asan_init; then + exit 1 + fi } main "$@" |