1
0
mirror of https://github.com/systemd/systemd.git synced 2024-11-05 06:52:22 +03:00
systemd/test/test-network-generator-conversion.sh
2020-03-28 11:46:48 +01:00

31 lines
758 B
Bash
Executable File

#!/usr/bin/env bash
set -ex
if [[ -n "$1" ]]; then
generator=$1
elif [[ -x /usr/lib/systemd/systemd-network-generator ]]; then
generator=/usr/lib/systemd/systemd-network-generator
elif [[ -x /lib/systemd/systemd-network-generator ]]; then
generator=/lib/systemd/systemd-network-generator
else
exit 1
fi
src="$(dirname "$0")/testdata/test-network-generator-conversion"
for f in "$src"/test-*.input; do
echo "*** Running $f"
(
out=$(mktemp --directory)
trap "rm -rf '$out'" EXIT INT QUIT PIPE
$generator --root "$out" -- $(cat $f)
if ! diff -u "$out"/run/systemd/network ${f%.input}.expected; then
echo "**** Unexpected output for $f"
exit 1
fi
) || exit 1
done