#!/bin/sh

# This test produces a temporary file with build lines without gcc hardening.
# These lines must be ignored by blhc (>= 0.12).

set -e

TMPFILE=$(mktemp)
trap "rm -f $TMPFILE" EXIT

echo "dpkg-buildpackage: source package test" > $TMPFILE
echo "" >> $TMPFILE

# Adding an ignore line
echo 'blhc: ignore-line-regexp: .*-o\ test\ test\.c' >> $TMPFILE

# The following example was taken from the README
echo "gcc -g -O2 -o test test.c" >> $TMPFILE

blhc $TMPFILE | grep missing && exit 1 || exit 0
