#!/bin/sh
# Compile a small policy with the installed compile_seccomp_policy, using the
# architecture table shipped with the upstream tests.
set -eu

src="$(pwd)"
cd "${AUTOPKGTEST_TMP:-$(mktemp -d)}"
cat > test.policy <<'EOF'
read: 1
write: 1
close: 1
EOF
compile_seccomp_policy --arch-json "$src/tools/testdata/arch_64.json" \
	test.policy test.bpf
# A BPF program is a sequence of 8-byte instructions.
size=$(stat -c %s test.bpf)
test "$size" -gt 0
test $((size % 8)) -eq 0
echo "ok: $size bytes"
