2017-08-29 03:58:09 +00:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
set -e
|
|
|
|
|
2018-02-19 18:49:45 +00:00
|
|
|
function cecho {
|
|
|
|
case $1 in
|
|
|
|
red) tput setaf 1 ;;
|
|
|
|
green) tput setaf 2 ;;
|
|
|
|
yellow) tput setaf 3 ;;
|
|
|
|
esac
|
|
|
|
echo -e "$2"
|
|
|
|
tput sgr0
|
|
|
|
}
|
|
|
|
|
2017-09-07 04:33:22 +00:00
|
|
|
function do_make {
|
|
|
|
make "$1" \
|
2018-02-19 18:49:45 +00:00
|
|
|
&& (cecho green "make $1 good") \
|
|
|
|
|| (tput blink ; cecho red "MAKE $1 BAD" ; return 1)
|
2017-09-07 04:33:22 +00:00
|
|
|
}
|
2017-08-29 03:58:09 +00:00
|
|
|
|
2017-09-06 01:41:13 +00:00
|
|
|
function verify {
|
2018-02-22 05:18:46 +00:00
|
|
|
diff "orig/$1.bin" "out/$1.\$F1" \
|
2018-02-19 18:49:45 +00:00
|
|
|
&& (cecho green "diff $1 good" ) \
|
|
|
|
|| (tput blink ; cecho red "DIFF $1 BAD" ; return 1)
|
2017-09-06 01:41:13 +00:00
|
|
|
}
|
|
|
|
|
2017-09-14 03:09:36 +00:00
|
|
|
function stats {
|
2018-03-06 05:20:00 +00:00
|
|
|
echo "$(printf '%-20s' $1)""$(../res/stats.pl < $1)"
|
2017-09-14 03:09:36 +00:00
|
|
|
}
|
|
|
|
|
2018-02-22 05:18:46 +00:00
|
|
|
function mount {
|
|
|
|
uppercase=$(echo "$1" | tr /a-z/ /A-Z/)
|
|
|
|
cp "out/$1" "mount/$uppercase" \
|
|
|
|
&& (cecho green "mounted $uppercase" ) \
|
|
|
|
|| (cecho red "failed to mount $uppercase" ; return 1)
|
|
|
|
}
|
|
|
|
|
2017-09-07 04:33:22 +00:00
|
|
|
#do_make clean
|
|
|
|
do_make all
|
|
|
|
|
2017-08-29 03:58:09 +00:00
|
|
|
# Verify original and output match
|
2017-09-14 03:09:36 +00:00
|
|
|
echo "Verifying diffs:"
|
2017-09-06 01:41:13 +00:00
|
|
|
verify "calculator"
|
2018-02-22 05:18:46 +00:00
|
|
|
verify "show.text.file"
|
2017-09-11 03:18:29 +00:00
|
|
|
verify "date"
|
|
|
|
verify "puzzle"
|
2017-08-29 03:58:09 +00:00
|
|
|
|
2018-02-22 05:18:46 +00:00
|
|
|
# Compute stats
|
2018-03-06 05:20:00 +00:00
|
|
|
echo "Stats:"
|
2017-09-14 03:09:36 +00:00
|
|
|
stats "calculator.s"
|
2018-02-22 05:18:46 +00:00
|
|
|
stats "show.text.file.s"
|
2017-09-14 03:09:36 +00:00
|
|
|
stats "date.s"
|
|
|
|
stats "puzzle.s"
|
|
|
|
|
2018-02-22 05:18:46 +00:00
|
|
|
# Mountable directory
|
|
|
|
echo "Copying files to mount/"
|
|
|
|
mount 'show.image.file.$F1'
|
2018-04-05 00:11:32 +00:00
|
|
|
mount 'this.apple.$F1'
|