If the elfdbg binary is missing in $PATH it makes the tests executions to fail,
instead report the missing binary. `make test` will only succeed if the binary
is present and installed using `make install`
#! /usr/bin/env atf-sh
. $(atf_get_srcdir)/test_helper.sh
+elfdbg_path=$(which elfdbg)
atf_test_case stripped
{
generate_bin_nodbg
- out=$(elfdbg bin)
+ [ ! -f "${elfdbg_path}" ] && atf_fail "No elfdbg binary found in '$PATH'"
+
+ out=$(${elfdbg_path} bin)
expected="NO DEBUG"
if [ "$out" == "$expected" ]; then
atf_pass
{
generate_bin_dbg
- out=$(elfdbg bin)
+ [ ! -f "${elfdbg_path}" ] && atf_fail "No elfdbg binary found in '$PATH'"
+
+ out=$(${elfdbg_path} bin)
expected="HAS DEBUG"
if [ "$out" == "$expected" ]; then
atf_pass
generate_bin_nodbg()
{
- cat > bin.c << EOF
+ cat > bin.c <<EOF
int
main(void) {
return (0);
}
EOF
/usr/bin/cc -o bin bin.c
- /usr/bin/strip bin
+ /usr/bin/strip bin
}
generate_bin_dbg()
{
- cat > bin.c << EOF
+ cat > bin.c <<EOF
int
main(void) {
return (0);