1
1
mirror of https://github.com/systemd/systemd-stable.git synced 2024-12-25 23:21:33 +03:00
systemd-stable/test/TEST-35-NETWORK-GENERATOR/test.sh
2019-07-14 10:59:54 +09:00

37 lines
919 B
Bash
Executable File

#!/bin/bash
set -e
TEST_DESCRIPTION="network-generator tests"
. $TEST_BASE_DIR/test-functions
test_setup() {
mkdir -p $TESTDIR/run/systemd/network
}
test_run() {
local generator
if [[ -x $BUILD_DIR/systemd-network-generator ]]; then
generator=$BUILD_DIR/systemd-network-generator
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
for f in test-*.input; do
echo "*** Running $f"
rm -f $TESTDIR/run/systemd/network/*
$generator --root $TESTDIR -- $(cat $f)
if ! diff -u $TESTDIR/run/systemd/network ${f%.input}.expected; then
echo "**** Unexpected output for $f"
exit 1
fi
done
}
do_test "$@"