Commit d100e16e authored by Fabien Freling's avatar Fabien Freling
Browse files

Add scrip shell for checking that each source has a test file.

	* build-aux/check_source_has_test.sh: Check tests according to sources.
	* build-aux/check_test_hierarchy.sh: Small update.

git-svn-id: https://svn.lrde.epita.fr/svn/oln/trunk@3991 4aad255d-cdde-0310-9447-f3009e2ae8c0
parent 65f3f636
2009-06-04 Fabien Freling <fabien.freling@lrde.epita.fr>
Add scrip shell for checking that each source has a test file.
* build-aux/check_source_has_test.sh: Check tests according to sources.
* build-aux/check_test_hierarchy.sh: Small update.
2009-06-04 Guillaume Lazzara <lazzara@lrde.epita.fr>
* Makefile.am: add pretty_check rule.
......
#! /bin/sh
failed_tests=0
all_tests=0
check_directory ()
{
echo "Current directories: $1 $2"
for file in `ls $1`; do
test_file=${file%.hh}.cc
if [ -f ${1}/$file ]; then
all_tests=$(($all_tests + 1))
if [ -f ${2}/$test_file ]; then
echo "\t\e[0;32mOK\e[m $file <-> $test_file"
else
# FIXME: Manage exceptions.
if [ "$file" != "all.hh" -a \
"$file" != "essential.hh" ]; then
echo "\t\e[0;31mFAIL\e[m Test \"$test_file\" does not exist."
failed_tests=$(($failed_tests + 1))
fi
fi
fi
if [ -d ${1}/$file ]; then
if [ -d ${2}/$file ]; then
echo ""
check_directory ${1}/$file ${2}/$file
else
# FIXME: Manage exceptions.
if [ "$file" != "internal" ]; then
echo "\e[0;31mFAIL\e[m Test directory \"${2}/$file\" does not exist."
fi
fi
fi
done
}
if [ $# -ne 2 ]; then
echo "Usage: ./check_test_hierarchy mln/ tests/"
exit 1
fi
echo "Source directory: $1"
echo "Test directory: $2"
echo "---"
if [ -d ${1} ]; then
if [ -d ${2} ]; then
check_directory ${1} ${2}
else
echo "\e[0;31mFAIL\e[m Test directory $2 does not exist."
fi
else
echo "\e[0;31mFAIL\e[m Source directory $1 does not exist."
fi
echo "\n====="
echo "Uncorrect tests: $failed_tests"
......@@ -12,7 +12,7 @@ check_directory ()
if [ -f ${1}/$file ]; then
all_tests=$(($all_tests + 1))
if [ -f ${2}/$source_file ]; then
echo "\t\e[0;32mOK\e[m $file <-> $source_file"
echo "\t\e[0;32mOK\e[m $file <-> $source_file" > /dev/null
else
# FIXME: Manage exceptions.
if [ "$file" != "Makefile.am" ]; then
......@@ -28,7 +28,7 @@ check_directory ()
check_directory ${1}/$file ${2}/$file
else
# FIXME: Manage exceptions.
echo "\e[0;31mFAIL\e[m ${1}/$file source directory does not exist."
echo "\e[0;31mFAIL\e[m ${2}/$file source directory does not exist."
fi
fi
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment