16c3174886cab07c86d05c29be5d19a2e5b16683dprimiano@chromium.org#!/bin/sh
26c3174886cab07c86d05c29be5d19a2e5b16683dprimiano@chromium.org
36c3174886cab07c86d05c29be5d19a2e5b16683dprimiano@chromium.org# Copyright (c) 2014, Google Inc.
46c3174886cab07c86d05c29be5d19a2e5b16683dprimiano@chromium.org# All rights reserved.
56c3174886cab07c86d05c29be5d19a2e5b16683dprimiano@chromium.org#
66c3174886cab07c86d05c29be5d19a2e5b16683dprimiano@chromium.org# Redistribution and use in source and binary forms, with or without
76c3174886cab07c86d05c29be5d19a2e5b16683dprimiano@chromium.org# modification, are permitted provided that the following conditions are
86c3174886cab07c86d05c29be5d19a2e5b16683dprimiano@chromium.org# met:
96c3174886cab07c86d05c29be5d19a2e5b16683dprimiano@chromium.org#
106c3174886cab07c86d05c29be5d19a2e5b16683dprimiano@chromium.org#     * Redistributions of source code must retain the above copyright
116c3174886cab07c86d05c29be5d19a2e5b16683dprimiano@chromium.org# notice, this list of conditions and the following disclaimer.
126c3174886cab07c86d05c29be5d19a2e5b16683dprimiano@chromium.org#     * Redistributions in binary form must reproduce the above
136c3174886cab07c86d05c29be5d19a2e5b16683dprimiano@chromium.org# copyright notice, this list of conditions and the following disclaimer
146c3174886cab07c86d05c29be5d19a2e5b16683dprimiano@chromium.org# in the documentation and/or other materials provided with the
156c3174886cab07c86d05c29be5d19a2e5b16683dprimiano@chromium.org# distribution.
166c3174886cab07c86d05c29be5d19a2e5b16683dprimiano@chromium.org#     * Neither the name of Google Inc. nor the names of its
176c3174886cab07c86d05c29be5d19a2e5b16683dprimiano@chromium.org# contributors may be used to endorse or promote products derived from
186c3174886cab07c86d05c29be5d19a2e5b16683dprimiano@chromium.org# this software without specific prior written permission.
196c3174886cab07c86d05c29be5d19a2e5b16683dprimiano@chromium.org#
206c3174886cab07c86d05c29be5d19a2e5b16683dprimiano@chromium.org# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
216c3174886cab07c86d05c29be5d19a2e5b16683dprimiano@chromium.org# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
226c3174886cab07c86d05c29be5d19a2e5b16683dprimiano@chromium.org# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
236c3174886cab07c86d05c29be5d19a2e5b16683dprimiano@chromium.org# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
246c3174886cab07c86d05c29be5d19a2e5b16683dprimiano@chromium.org# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
256c3174886cab07c86d05c29be5d19a2e5b16683dprimiano@chromium.org# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
266c3174886cab07c86d05c29be5d19a2e5b16683dprimiano@chromium.org# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
276c3174886cab07c86d05c29be5d19a2e5b16683dprimiano@chromium.org# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
286c3174886cab07c86d05c29be5d19a2e5b16683dprimiano@chromium.org# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
296c3174886cab07c86d05c29be5d19a2e5b16683dprimiano@chromium.org# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
306c3174886cab07c86d05c29be5d19a2e5b16683dprimiano@chromium.org# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
316c3174886cab07c86d05c29be5d19a2e5b16683dprimiano@chromium.org
322aa2e9728b4960b0c7ef6898d06a57679a3b6292primiano@chromium.orgsource "${0%/*}/microdump_stackwalk_test_vars"  # for MICRODUMP_SUPPORTED_ARCHS.
336c3174886cab07c86d05c29be5d19a2e5b16683dprimiano@chromium.orgtestdata_dir=$srcdir/src/processor/testdata
342aa2e9728b4960b0c7ef6898d06a57679a3b6292primiano@chromium.org
352aa2e9728b4960b0c7ef6898d06a57679a3b6292primiano@chromium.orgset -e  # Bail out with an error if any of the commands below fails.
362aa2e9728b4960b0c7ef6898d06a57679a3b6292primiano@chromium.orgfor ARCH in $MICRODUMP_SUPPORTED_ARCHS; do
372aa2e9728b4960b0c7ef6898d06a57679a3b6292primiano@chromium.org  echo "Testing microdump_stackwalk for arch $ARCH"
382aa2e9728b4960b0c7ef6898d06a57679a3b6292primiano@chromium.org  ./src/processor/microdump_stackwalk $testdata_dir/microdump-${ARCH}.dmp \
392aa2e9728b4960b0c7ef6898d06a57679a3b6292primiano@chromium.org                                      $testdata_dir/symbols/microdump | \
402aa2e9728b4960b0c7ef6898d06a57679a3b6292primiano@chromium.org   tr -d '\015' | \
412aa2e9728b4960b0c7ef6898d06a57679a3b6292primiano@chromium.org   diff -u $testdata_dir/microdump.stackwalk-${ARCH}.out -
422aa2e9728b4960b0c7ef6898d06a57679a3b6292primiano@chromium.orgdone
432aa2e9728b4960b0c7ef6898d06a57679a3b6292primiano@chromium.orgexit 0
44