#!/bin/sh
set -eu

# avoid using Python modules in source tree
cd "${AUTOPKGTEST_TMP:-$ADT_TMP}"

mkdir -p mypkg/debian/tests
cat <<'EOF' > mypkg/debian/changelog
mypkg (1) UNRELEASED; urgency=medium

  * Initial release.

 -- Autopkgtest <autopkgtest@example.invalid>  Mon, 12 Oct 2026 00:00:00 +0000
EOF
cat <<'EOF' > mypkg/debian/control
Source: mypkg
Maintainer: Autopkgtest <autopkgtest@example.invalid>

Package: mypkg
Architecture: all
Description: minimal source package for the installed test
EOF
cat <<EOF > mypkg/debian/tests/control
Test-Command: echo Hello
Depends:
EOF

annotate-output autopkgtest --summary-file summary -B ./mypkg -- null 2>&1
if ! grep -q '^command1[[:space:]]\+PASS$' summary; then
    echo "ERROR: Invalid summary file:" >&2
    cat summary >&2
    exit 1
fi
