• Home
  • History
  • Annotate
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1#!/bin/bash -e
2# Copyright 2018 The Chromium OS Authors. All rights reserved.
3# Use of this source code is governed by a BSD-style license that can be
4# found in the LICENSE file.
5
6base=$(dirname "$(readlink -m "$0")")
7log=$(mktemp)
8
9echo "FORTIFY..."
10# We run these tests under `script` because each FORTIFY failure, which these
11# cause *a lot* of, will complain directly to /dev/tty. For hosts, these
12# messages can easily drown out any other script output.
13if ! script -q -e -c "${base}/fortify-runtime-tests" "${log}" >/dev/null; then
14  echo "${test} failed; see logs in ${log}."
15  if grep -q '!!! Timeout reached' "${log}"; then
16    echo "Looks like the test program timed out."
17  else
18    # Try to find and pretty-print the failure message(s).
19    # The /Failures/ part of the script can't be a simple address range: if
20    # we're printing _FORTIFY_SOURCE=1 errors, we might pick up the ":::
21    # _FORTIFY_SOURCE=2 :::" header twice.
22    sed -ne '/^:::/p' \
23      -e '/^Failure(s): /{ p; :again; n; p; /^\s/b again; }' \
24      "${log}"
25  fi
26
27  echo "FAIL"
28  exit 1
29fi
30
31rm -f "${log}"
32echo "PASS"
33