#!/bin/sh -e
# SPDX-License-Identifier: Apache-2.0
# (C) 2022 Domenico Andreoli
# Author: Domenico Andreoli <cavok@debian.org>

# Build an object and check that pahole outputs something

WORKDIR=$(mktemp -d)
trap "rm -rf $WORKDIR" 0 INT QUIT ABRT PIPE TERM

cd $WORKDIR
cat <<EOF >test.c
struct with_hole {
    int i;
    char c;
    long l;
} _;
EOF

gcc -c -ggdb -o test.o test.c
[ -e test.o ]
pahole test.o
[ -n "`pahole test.o`" ]
