#!/bin/sh
# consolidated baseline capture (guest, root) -> /root/w5755/logs/
mkdir -p /root/w5755/logs
cd /root/w5755

echo "=== env ==="
{
	uname -a
	cc --version | head -1
	kldstat
	sysctl vfs.usermount 2>/dev/null || true
} > logs/env.txt 2>&1

echo "=== witness module ==="
{
	kldstat | grep -q cesu_witness || kldload /root/w5755/cesu_witness/cesu_witness.ko
	dmesg | grep witness
} > logs/witness_baseline.log 2>&1

echo "=== DF-5755 e2e ==="
sh run5755.sh > logs/run5755_baseline.log 2>&1
echo rc=$?

echo "=== DF-5756 e2e ==="
sh run5756.sh > logs/run5756_baseline.log 2>&1
echo rc=$?

echo "=== userland differential ==="
./difftest > logs/difftest.log 2>&1
echo rc=$?

echo "=== image hashes ==="
sha256 /root/fat5755.img /root/fat5756.img > logs/hashes.txt 2>&1 || \
	sha256sum /root/fat5755.img /root/fat5756.img > logs/hashes.txt 2>&1
cat logs/env.txt
