Something went wrong. Try again.
forked from cz-nic/bird
Something went wrong. Try again.
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889#!/bin/sh
# Test that user and user group bird existecho "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 1fiecho "Success"
if [ -n "${CROSS_RUN}" ]; then alias bird="${CROSS_RUN} $(which bird)" alias birdcl="${CROSS_RUN} $(which birdcl)"fi
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" ] || [ "$PKG_FIXUP" -gt "1" ] ; then echo "Processing a release commit..." echo "BIRD version ${STABLE_VERSION}" > version-expected diff version-reported version-expectedelse 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 fifiecho "Success"
# Run BIRD with minimal config and test with simple birdc commandsmkdir -p /run/birdecho "protocol device {}" > minimal.confbird -c minimal.conf
birdcl show proto > show-proto-out 2>&1birdcl down > down-out 2>&1
# Wait until BIRD actually shuts down but not longer than 1 s.if [ -e /run/bird/bird.ctl ]; then sleep 1fibirdcl 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 1fiecho "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 1fi
if ! grep -qF "Shutdown requested" down-out; then echo "Error: BIRD did not shutdown correctly after DOWN command." echo "Output:" cat down-out exit 1fi
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 1fiecho "Success"
echo "All install tests passed! (ノ◕ヮ◕)ノ*:・゚✧"