olibc/tests/test.sh

39 lines
697 B
Bash
Raw Normal View History

2021-12-19 08:35:56 +00:00
#!/bin/bash
# Simple script for testing olibc
# Recommended to execute in directory tests/ or src/
CC=cc
cd ../builds/tests
for i in $(ls); do
if [ -d $i ]
then
echo ------------------------
echo --- TESTING $i.h ---
echo ------------------------
echo
cd $i
for j in $(ls); do
if [ -x $j ] && [[ $j != *"-cc"* ]]
then
cat $(cd ../../../tests/$i ; pwd)/$j.c | sed 's/put_int(/printf("%d\\n",/' | cc -x c -o $j-cc -
./$j > tmp
./$j-cc > tmp-cc
if [ "$(diff tmp tmp-cc)" == "" ]
then
echo $j - TEST SUCCESS
else
echo $j - TEST FAILED
echo "---- DIFF OUTPUT ----"
diff -y tmp tmp-cc
fi
echo "---"
fi
done
fi
done