aboutsummaryrefslogblamecommitdiffstats
path: root/test-all
blob: 6ba7505ed0743ad56ff9cbb2d84a3e91687de860 (plain) (tree)
1
2
3
4
5
6
7
8
9



                       



                                                                                                  
                                                          

 
                             

                        


                                                                                       

                  


                    
                  

























                                                                                                            
#!/bin/bash

cd -- "$(dirname "$0")"

function all()
{
	echo patch md5sum rawshake256sum rawshake512sum sha1sum sha224sum sha256sum sha3-224sum \
	     sha3-256sum sha3-384sum sha3-512sum sha384sum sha512-224sum sha512-256sum sha512sum \
	     shake256sum shake512sum cksum true false echo
}

if test -n "${IN_PATH}"; then
	exec 99>&2
	exec 2>/dev/null
	for c in $(all); do
	    eval "export $(echo $c | tr '[a-z-]' '[A-Z_]')='$(realpath "$(which $c)")'"
	done
	exec 2>&99
	exec 99>&-
fi

if test $# = 0; then
	set $(all)
fi

true > result

for t in $@; do
	printf '\033[1mTesting %s ...\033[m\n' "$t"
	if ! ./${t}-test/test; then
		echo $t >> result
	fi
	echo
done

test $(wc -l < result) = 0
ret=$?
if ! test $ret = 0; then
	echo
	printf '\033[1mThe following utilities did not pass all tests, or possibility as not found:\033[m\n'
	echo
	cat result
else
	echo
	printf '\033[1mYour system is awesome!\033[m\n'
	echo
fi
rm result
exit $ret