1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79
|
#!/bin/sh
# Test that user and user group bird exist
echo "Testing that user and group 'bird' exists..."
if ! id bird >/dev/null 2>&1; then
echo "Error: User or group 'bird' does not exist after installation"
exit 1
fi
echo "Success"
STABLE_VERSION=$(cat VERSION)
CI_COMMIT_MESSAGE=$(echo "$1" | sed '$s/\r\{0,1\}$//') # trimming new line
echo "Testing version..."
bird --version 2>&1 | grep -F "$STABLE_VERSION"
bird --version 2>version-reported
if [ "$CI_COMMIT_MESSAGE" = "NEWS and version update" ]; then
echo "Processing a release commit..."
echo "BIRD version ${STABLE_VERSION}" > version-expected
diff version-reported version-expected
else
echo "Processing a non-release commit..."
if ! grep -qF "BIRD version ${STABLE_VERSION}+branch" version-reported; then
echo "Error: Version mismatch!"
( echo "Reported: "; cat version-reported )
( echo "Expected: "; echo "BIRD version ${STABLE_VERSION}+branch.<branch-name>.<commit-hash>" )
exit 1
fi
fi
echo "Success"
# Run BIRD with minimal config and test with simple birdc commands
mkdir -p /run/bird
echo "protocol device {}" > minimal.conf
bird -c minimal.conf
birdcl show proto > show-proto-out 2>&1
birdcl down > down-out 2>&1
birdcl show proto > show-proto-after-down-out 2>&1
echo "Testing that BIRD can be started..."
if ! grep -qE "BIRD .* ready\." show-proto-out || ! grep -qE "BIRD .* ready\." down-out; then
echo "Error: BIRD did not start correctly"
echo "Output:"
cat show-proto-out down-out
exit 1
fi
echo "Success"
echo "Testing that BIRD responds to command-line commands..."
if ! grep -qE "device1\s*Device\s*---\s*up" show-proto-out; then
echo "Error: BIRD did not show protocols correctly"
echo "Output:"
cat show-proto-out
exit 1
fi
if ! grep -qF "Shutdown requested" down-out; then
echo "Error: BIRD did not shutdown correctly after DOWN command."
echo "Output:"
cat down-out
exit 1
fi
if ! grep -qF "Unable to connect to server control socket" show-proto-after-down-out; then
echo "Error: BIRD did not shutdown correctly after DOWN command."
echo "Output:"
cat show-proto-after-down-out
exit 1
fi
echo "Success"
echo "All install tests passed! (ノ◕ヮ◕)ノ*:・゚✧"
|