20 lines
487 B
Bash
Executable file
20 lines
487 B
Bash
Executable file
#!/usr/bin/env bash
|
|
|
|
echo "Building executable..."
|
|
|
|
cd "${FLAKE:-$(dirname $0)}"
|
|
if command -v nix &>/dev/null; then
|
|
bidirectional="$(nix build --no-link --print-out-paths .#a2-p2-bidirectional)/bin/bidirectional"
|
|
else
|
|
gcc bidirectional.c -o bidirectional
|
|
bidirectional="./bidirectional"
|
|
fi
|
|
|
|
out="$("$bidirectional")"
|
|
read -r -d '' expected <<EOF
|
|
Sending message from parent to child
|
|
Response from child to parent
|
|
EOF
|
|
if test "$out" = "$expected"; then
|
|
echo "SUCCESS"
|
|
fi
|