Skip to content

Instantly share code, notes, and snippets.

@onlined
Last active October 23, 2017 20:33
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save onlined/4b21a443725cdc527ffc3063a069fc74 to your computer and use it in GitHub Desktop.
Save onlined/4b21a443725cdc527ffc3063a069fc74 to your computer and use it in GitHub Desktop.
Tester for FIFO logic of CENG334 HW2 (2016-2017 Spring)
#!/bin/bash
if [ -t 0 ]; then
echo "Please redirect input file to this script."
exit
fi
i=0
sorted_output=$(./simulator | tr -d ',' | sort -k11,11 -g)
while true; do
dock_output=$(grep "DID: $i" <<< $sorted_output)
[ $? -eq 0 ] || break
echo "DID: $i"
grep "AID: 1" <<< $dock_output | cut -f4 -d" " > __req_out__
grep "AID: 2" <<< $dock_output | cut -f4 -d" " > __dock_out__
diff_output=$(diff __req_out__ __dock_out__)
[ $? -eq 0 ] && echo "FIFO OK" || (echo "FIFO not OK, here's the reqeust/enter diff:" && cat <<< $diff_output)
(( i += 1 ))
done
rm -f __req_out__ __dock_out__ 2>/dev/null
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment