updated color stuff to work more broadly
This commit is contained in:
@@ -1,4 +1,8 @@
|
|||||||
#! /usr/bin/env bash
|
#! /usr/bin/env bash
|
||||||
|
|
||||||
|
GREEN='\033[0;32m'
|
||||||
|
RED='\033[0;31m'
|
||||||
|
NONE='\033[0m'
|
||||||
|
|
||||||
# run_test testdir testnumber
|
# run_test testdir testnumber
|
||||||
run_test () {
|
run_test () {
|
||||||
@@ -39,11 +43,12 @@ print_error_message () {
|
|||||||
local testnum=$1
|
local testnum=$1
|
||||||
local contrunning=$2
|
local contrunning=$2
|
||||||
local filetype=$3
|
local filetype=$3
|
||||||
builtin echo -e "\e[31mtest $testnum: $filetype incorrect\e[0m"
|
builtin echo -e "test $testnum: ${RED}$testnum.$filetype incorrect${NONE}"
|
||||||
echo " what results should be found in file: $testdir/$testnum.$filetype"
|
echo " what results should be found in file: $testdir/$testnum.$filetype"
|
||||||
echo " what results produced by your program: tests-out/$testnum.$filetype"
|
echo " what results produced by your program: tests-out/$testnum.$filetype"
|
||||||
echo " compare the two using diff, cmp, or related tools to debug, e.g.:"
|
echo " compare the two using diff, cmp, or related tools to debug, e.g.:"
|
||||||
echo " prompt> diff $testdir/$testnum.$filetype tests-out/$testnum.$filetype"
|
echo " prompt> diff $testdir/$testnum.$filetype tests-out/$testnum.$filetype"
|
||||||
|
echo " See tests/$testnum.run for what is being run"
|
||||||
if (( $contrunning == 0 )); then
|
if (( $contrunning == 0 )); then
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
@@ -82,7 +87,7 @@ run_and_check () {
|
|||||||
exit 0
|
exit 0
|
||||||
fi
|
fi
|
||||||
if (( $verbose == 1 )); then
|
if (( $verbose == 1 )); then
|
||||||
echo -n -e "\e[33mrunning test $testnum: \e[0m"
|
echo -n -e "running test $testnum: "
|
||||||
cat $testdir/$testnum.desc
|
cat $testdir/$testnum.desc
|
||||||
fi
|
fi
|
||||||
run_test $testdir $testnum $verbose
|
run_test $testdir $testnum $verbose
|
||||||
@@ -95,7 +100,7 @@ run_and_check () {
|
|||||||
fi
|
fi
|
||||||
# echo "results: outcheck:$outcheck errcheck:$errcheck"
|
# echo "results: outcheck:$outcheck errcheck:$errcheck"
|
||||||
if (( $rccheck == 0 )) && (( $outcheck == 0 )) && (( $errcheck == 0 )) && (( $othercheck == 0 )); then
|
if (( $rccheck == 0 )) && (( $outcheck == 0 )) && (( $errcheck == 0 )) && (( $othercheck == 0 )); then
|
||||||
builtin echo -e "\e[32mtest $testnum: passed\e[0m"
|
echo -e "test $testnum: ${GREEN}passed${NONE}"
|
||||||
if (( $verbose == 1 )); then
|
if (( $verbose == 1 )); then
|
||||||
echo ""
|
echo ""
|
||||||
fi
|
fi
|
||||||
@@ -183,7 +188,7 @@ fi
|
|||||||
# do a one-time setup step
|
# do a one-time setup step
|
||||||
if (( $skippre == 0 )); then
|
if (( $skippre == 0 )); then
|
||||||
if [[ -f tests/pre ]]; then
|
if [[ -f tests/pre ]]; then
|
||||||
builtin echo -e "\e[33mdoing one-time pre-test\e[0m (use -s to suppress)"
|
echo -e "doing one-time pre-test (use -s to suppress)"
|
||||||
source tests/pre
|
source tests/pre
|
||||||
if (( $? != 0 )); then
|
if (( $? != 0 )); then
|
||||||
echo "pre-test: failed"
|
echo "pre-test: failed"
|
||||||
|
|||||||
Reference in New Issue
Block a user