summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorCEST 2005 Dodji Seketeli <dodji@seketeli.org>2005-05-10 19:48:58 +0000
committerDodji Seketeli <dodji@src.gnome.org>2005-05-10 19:48:58 +0000
commit87e540b6a27f7fcca8b450bb44a8b197eeffb464 (patch)
tree99d68d410ff91b556e58c73b6c5cd262fc7959a6 /tests
parent3e0fb4e6acd9b29303384da9242b08c70e4d9add (diff)
downloadlibcroco-87e540b6a27f7fcca8b450bb44a8b197eeffb464.tar.gz
applied the following patches:
Tue May 10 21:49:05 CEST 2005 Dodji Seketeli <dodji@seketeli.org> applied the following patches: dodji@gnome.org--xml-style-2004/libcroco--mainline--0.6--patch-29 2004-06-09 00:09:41 GMT updated NEWS file for 0.6.0 [Dodji Seketeli] dodji@gnome.org--xml-style-2004/libcroco--mainline--0.6--patch-30 2004-09-20 16:13:02 GMT fixed a nasty memory management bug [Dodji Seketeli] dodji@gnome.org--xml-style-2004/libcroco--mainline--0.6--patch-31 2005-02-10 21:41:04 GMT rm test output upon 'make clean' [Peter Moulder] dodji@gnome.org--xml-style-2004/libcroco--mainline--0.6--patch-32 2005-02-13 13:14:16 GMT make 'all' target a prerequisite of the 'test' target [Peter Moulder] dodji@gnome.org--xml-style-2004/libcroco--mainline--0.6--patch-33 2005-02-13 19:24:25 GMT allow building/testing in a directory different from srcdir [Peter Moulder/Dodji Seketeli] dodji@gnome.org--xml-style-2004/libcroco--mainline--0.6--patch-34 2005-02-13 19:42:48 GMT added better api documentation [Peter Moulder] dodji@gnome.org--xml-style-2004/libcroco--mainline--0.6--patch-35 2005-05-05 16:38:07 GMT initial port to gtk-doc, switch to automake 1.7 [Sven Herzberg, Dodji Seketeli] dodji@gnome.org--xml-style-2004/libcroco--mainline--0.6--patch-36 2005-05-05 16:51:38 GMT more gtk-doc stuffs [Dodji Seketeli] dodji@gnome.org--xml-style-2004/libcroco--mainline--0.6--patch-37 2005-05-06 14:20:20 GMT typos and c++ compilation fixes [Peter Moulder]
Diffstat (limited to 'tests')
-rw-r--r--tests/Makefile.am2
-rwxr-xr-xtests/test-functional-notation.sh3
-rwxr-xr-xtests/test-lots-of-comments.sh3
-rwxr-xr-xtests/test-parsing-location.sh3
-rwxr-xr-xtests/test-prop-ident.sh7
-rwxr-xr-xtests/test-sel-child-class.sh3
-rwxr-xr-xtests/test-several-media.sh7
-rwxr-xr-xtests/test-unknown-at-rule.sh7
-rwxr-xr-xtests/test-unknown-at-rule2.sh7
-rwxr-xr-xtests/testctl138
-rwxr-xr-xtests/valgrind-version.sh2
11 files changed, 90 insertions, 92 deletions
diff --git a/tests/Makefile.am b/tests/Makefile.am
index 9bcb645..e54313f 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -27,6 +27,6 @@ test6_LDFLAGS=$(EXTRALDFLAGS)
croco_lib=$(top_builddir)/src/@CROCO_LIB@
LDADD=$(croco_lib)
-INCLUDES=-I$(top_srcdir)/intl -I$(top_srcdir)/src
+INCLUDES=-I$(top_srcdir)/intl -I$(top_srcdir)/src -I$(top_builddir)/src
AM_CFLAGS=-I. @LIBXML2_CFLAGS@ @GLIB2_CFLAGS@
diff --git a/tests/test-functional-notation.sh b/tests/test-functional-notation.sh
index 5d23685..b53974c 100755
--- a/tests/test-functional-notation.sh
+++ b/tests/test-functional-notation.sh
@@ -1,6 +1,5 @@
#!/bin/sh
-HERE_DIR=`dirname $0`
-. $HERE_DIR/global-vars.sh
+. global-test-vars.sh
$CSSLINT $TEST_INPUTS_DIR/functional-notation.css
diff --git a/tests/test-lots-of-comments.sh b/tests/test-lots-of-comments.sh
index c47a6c2..f403831 100755
--- a/tests/test-lots-of-comments.sh
+++ b/tests/test-lots-of-comments.sh
@@ -1,6 +1,5 @@
#!/bin/sh
-HERE_DIR=`dirname $0`
-. $HERE_DIR/global-vars.sh
+. global-test-vars.sh
$CSSLINT $TEST_INPUTS_DIR/lots-of-comments.css
diff --git a/tests/test-parsing-location.sh b/tests/test-parsing-location.sh
index 70fa409..e37e089 100755
--- a/tests/test-parsing-location.sh
+++ b/tests/test-parsing-location.sh
@@ -1,6 +1,5 @@
#!/bin/sh
-HERE_DIR=`dirname $0`
-. $HERE_DIR/global-vars.sh
+. global-test-vars.sh
$CSSLINT --dump-location $TEST_INPUTS_DIR/parsing-location.css
diff --git a/tests/test-prop-ident.sh b/tests/test-prop-ident.sh
index e07005d..4689d13 100755
--- a/tests/test-prop-ident.sh
+++ b/tests/test-prop-ident.sh
@@ -1,6 +1,5 @@
-#!/bin/sh
+#! /bin/sh
-HERE_DIR=`dirname $0`
-. $HERE_DIR/global-vars.sh
+. global-test-vars.sh
-$CSSLINT $TEST_INPUTS_DIR/prop-vendor-ident.css
+$CSSLINT "$TEST_INPUTS_DIR"/prop-vendor-ident.css
diff --git a/tests/test-sel-child-class.sh b/tests/test-sel-child-class.sh
index cb1e4d3..16589ec 100755
--- a/tests/test-sel-child-class.sh
+++ b/tests/test-sel-child-class.sh
@@ -1,6 +1,5 @@
#!/bin/sh
-HERE_DIR=`dirname $0`
-. $HERE_DIR/global-vars.sh
+. global-test-vars.sh
$CSSLINT -e --user-sheet $TEST_INPUTS_DIR/sel-child-class.css --xml $TEST_INPUTS_DIR/sel-child-class.xml --xpath /test/body/div/div/p
diff --git a/tests/test-several-media.sh b/tests/test-several-media.sh
index 394d43a..7b0279d 100755
--- a/tests/test-several-media.sh
+++ b/tests/test-several-media.sh
@@ -1,6 +1,5 @@
-#!/bin/sh
+#! /bin/sh
-HERE_DIR=`dirname $0`
-. $HERE_DIR/global-vars.sh
+. global-test-vars.sh
-$CSSLINT $TEST_INPUTS_DIR/several-media.css
+$CSSLINT "$TEST_INPUTS_DIR"/several-media.css
diff --git a/tests/test-unknown-at-rule.sh b/tests/test-unknown-at-rule.sh
index a9de6c8..5059cd1 100755
--- a/tests/test-unknown-at-rule.sh
+++ b/tests/test-unknown-at-rule.sh
@@ -1,6 +1,5 @@
-#!/bin/sh
+#! /bin/sh
-HERE_DIR=`dirname $0`
-. $HERE_DIR/global-vars.sh
+. ./global-test-vars.sh
-$CSSLINT $TEST_INPUTS_DIR/unknown-at-rule.css
+$CSSLINT "$TEST_INPUTS_DIR"/unknown-at-rule.css
diff --git a/tests/test-unknown-at-rule2.sh b/tests/test-unknown-at-rule2.sh
index 8b421ad..54b4ff2 100755
--- a/tests/test-unknown-at-rule2.sh
+++ b/tests/test-unknown-at-rule2.sh
@@ -1,6 +1,5 @@
-#!/bin/sh
+#! /bin/sh
-HERE_DIR=`dirname $0`
-. $HERE_DIR/global-vars.sh
+. ./global-test-vars.sh
-$CSSLINT $TEST_INPUTS_DIR/unknown-at-rule2.css
+$CSSLINT "$TEST_INPUTS_DIR"/unknown-at-rule2.css
diff --git a/tests/testctl b/tests/testctl
index 88dba5e..68f5190 100755
--- a/tests/testctl
+++ b/tests/testctl
@@ -1,4 +1,4 @@
-#!/bin/sh
+#! /bin/sh
#####################################
#This script just runs the tests of
@@ -9,8 +9,20 @@
#just to run 'testctl run' and see the result.
####################################
-#the directory that contains the tests
-HERE=`dirname $0`
+#the directory that contains the tests sources is:
+#$TEST_SOURCE_DIR. User can set this var in the environment
+#before calling this script. Otherwise, we set it to a default value
+if test x$TEST_SOURCE_DIR = x ; then
+ TEST_SOURCE_DIR=`dirname "$0"`
+fi
+
+#the directory that contains the test outputs is:
+#$TEST_OUT_DIR
+#User can set this var in the environment before
+#calling this script. Otherwise, we set it to a default value.
+if test x$TEST_OUT_DIR = x ; then
+ TEST_OUT_DIR=tests
+fi
#the list of tests to be run
@@ -117,7 +129,7 @@ parse_command_line ()
#builds the list of available test functions.
build_tests_list ()
{
- for TEST_PROG in `find $HERE -type f -print | egrep ^$HERE/test\(\([-0-9a-zA-Z_]\)+\)?\(\.sh\)?$ | grep -v testctl` ; do
+ for TEST_PROG in "$TEST_SOURCE_DIR"/test*.sh "$TEST_OUT_DIR"/test?; do
TEST_PROG=`basename $TEST_PROG`
echo "run test: $TEST_PROG"
TEST_PROG_LIST="$TEST_PROG_LIST $TEST_PROG"
@@ -132,23 +144,23 @@ build_tests_list ()
#if no, means that the output of the test is to be saved as a result of a test.
run_test_prog ()
{
- TEST_PROG=$1
- REFERENCE=$2
- DISPLAY_ON_STDOUT=$3
+ TEST_PROG="$1"
+ REFERENCE="$2"
+ DISPLAY_ON_STDOUT="$3"
OUTPUT_DIR=
OUTPUT_SUFFIX=
TEST_INPUT_LIST=
- VALGRIND_OPTIONS="--error-limit=no --num-callers=100 --logfile=$HERE/$VALGRIND_LOGS_DIR/$TEST_PROG-valgrind.log --leak-check=yes --show-reachable=yes --quiet --suppressions=$HERE/vg.supp"
+ VALGRIND_OPTIONS="--error-limit=no --num-callers=100 --logfile=$TEST_OUT_DIR/$VALGRIND_LOGS_DIR/$TEST_PROG-valgrind.log --leak-check=yes --show-reachable=yes --quiet --suppressions=$TEST_SOURCE_DIR/vg.supp"
if test x$RUN_VALGRIND = xno ; then
VALGRIND=
else
- if ! test -x $HERE/valgrind-version.sh ; then
- echo "Argh! Could not find file $HERE/valgrind-version.sh"
+ if ! test -x "$TEST_SOURCE_DIR"/valgrind-version.sh ; then
+ echo "Argh! Could not find file $TEST_SOURCE_DIR/valgrind-version.sh"
exit -1 ;
fi
- version=`$HERE/valgrind-version.sh`
+ version=`"$TEST_SOURCE_DIR"/valgrind-version.sh`
if ! test "x$version" = "xokay" ; then
- echo "You must install a valgrind versin greater than 2.1.1"
+ echo "You must install a valgrind version greater than 2.1.1"
echo "version=$version"
exit -1
fi
@@ -166,36 +178,30 @@ run_test_prog ()
fi
fi
export VALGRIND
- is_shell_script=`echo $TEST_PROG | egrep "(.*)?.sh"`
- if test x$is_shell_script = x ; then
- is_shell_script=no
- else
- is_shell_script=yes
- fi
+ case "$TEST_PROG" in
+ *.sh) is_shell_script=yes ;;
+ *) is_shell_script=no ;;
+ esac
- if ! test -d $HERE/$VALGRIND_LOGS_DIR ; then
- mkdir $HERE/$VALGRIND_LOGS_DIR
+ if ! test -d "$TEST_OUT_DIR/$VALGRIND_LOGS_DIR" ; then
+ mkdir "$TEST_OUT_DIR/$VALGRIND_LOGS_DIR"
fi
- for TEST_INPUT in `ls -1 $HERE/$TEST_INPUT_DIR | egrep ^${TEST_PROG}\([\.0-9]\)+\css\$` ; do
+ for TEST_INPUT in `ls -1 "$TEST_SOURCE_DIR/$TEST_INPUT_DIR" | egrep "^${TEST_PROG}"'[.0-9]+css$'` ; do
TEST_INPUT_LIST="$TEST_INPUT_LIST $TEST_INPUT"
done
if test "$REFERENCE" = "yes" ; then
- OUTPUT_DIR=$HERE/$TEST_OUT_REF_DIR
+ OUTPUT_DIR="$TEST_SOURCE_DIR/$TEST_OUT_REF_DIR"
OUTPUT_SUFFIX=.out
-
- if test ! -d $HERE/$OUTPUT_DIR ; then
- mkdir $HERE/$OUTPUT_DIR
- fi
else
- if test ! -d $HERE/$TEST_OUTPUT_DIR/ ; then
- echo "creating tmp directory $$HERE/$TEST_OUTPUT_DIR ..."
- mkdir $HERE/$TEST_OUTPUT_DIR ;
+ OUTPUT_DIR="$TEST_OUT_DIR/$TEST_OUTPUT_DIR"
+ OUTPUT_SUFFIX=.out
+ if test ! -d "$OUTPUT_DIR" ; then
+ echo "creating tmp directory $OUTPUT_DIR ..."
+ mkdir "$OUTPUT_DIR"
echo "done"
fi
- OUTPUT_DIR=$HERE/$TEST_OUTPUT_DIR
- OUTPUT_SUFFIX=.out
fi
if test "empty$TEST_INPUT_LIST" != "empty" ; then
@@ -203,44 +209,44 @@ run_test_prog ()
TEST_INPUT_NAME=`basename $TEST_INPUT .sh`
if test "$DISPLAY_ON_STDOUT" = "yes" ; then
echo "###############################################"
- echo "launching $VALGRIND $HERE/$TEST_PROG $HERE/$TEST_INPUT_DIR/$TEST_INPUT"....
+ echo "launching $VALGRIND $TEST_PROG $TEST_SOURCE_DIR/$TEST_INPUT_DIR/$TEST_INPUT"....
echo "###############################################"
if test x$is_shell_script = xyes ; then
- $HERE/$TEST_PROG $HERE/$TEST_INPUT_DIR/$TEST_INPUT
+ "$TEST_SOURCE_DIR/$TEST_PROG" "$TEST_SOURCE_DIR/$TEST_INPUT_DIR/$TEST_INPUT"
else
- $VALGRIND $HERE/.libs/$TEST_PROG $HERE/$TEST_INPUT_DIR/$TEST_INPUT
+ $VALGRIND "$TEST_OUT_DIR/.libs/$TEST_PROG" "$TEST_SOURCE_DIR/$TEST_INPUT_DIR/$TEST_INPUT"
fi
echo "###############################################"
echo "done"
echo "###############################################"
echo ""
else
- echo "executing $VALGRIND $HERE/$TEST_PROG $HERE/$TEST_INPUT_DIR/$TEST_INPUT > $OUTPUT_DIR/${TEST_INPUT_NAME}${OUTPUT_SUFFIX} ..."
- $VALGRIND $HERE/.libs/$TEST_PROG $HERE/$TEST_INPUT_DIR/$TEST_INPUT > $OUTPUT_DIR/${TEST_INPUT_NAME}${OUTPUT_SUFFIX}
+ echo "executing $VALGRIND $TEST_PROG $TEST_SOURCE_DIR/$TEST_INPUT_DIR/$TEST_INPUT > $OUTPUT_DIR/${TEST_INPUT_NAME}${OUTPUT_SUFFIX} ..."
+ $VALGRIND "$TEST_OUT_DIR/.libs/$TEST_PROG" "$TEST_SOURCE_DIR/$TEST_INPUT_DIR/$TEST_INPUT" > "$OUTPUT_DIR/${TEST_INPUT_NAME}${OUTPUT_SUFFIX}"
echo "done"
fi
done
else
if test "$DISPLAY_ON_STDOUT" = "yes" ; then
echo "####################################################"
- echo "launching $VALGRIND $HERE/$TEST_PROG ..."
+ echo "launching $VALGRIND $TEST_PROG ..."
echo "####################################################"
if test x$is_shell_script = xyes ; then
- $HERE/$TEST_PROG
+ "$TEST_SOURCE_DIR/$TEST_PROG"
else
- $VALGRIND $HERE/.libs/$TEST_PROG
+ $VALGRIND "$TEST_OUT_DIR/.libs/$TEST_PROG"
fi
echo "####################################################"
echo "done"
echo "####################################################"
echo ""
else
- TEST_INPUT_NAME=`basename $TEST_PROG .sh`
- echo "executing $VALGRIND $HERE/$TEST_PROG > $OUTPUT_DIR/${TEST_PROG}${OUTPUT_SUFFIX} ..."
+ TEST_INPUT_NAME=`basename "$TEST_PROG" .sh`
+ echo "executing $VALGRIND $TEST_PROG > $OUTPUT_DIR/${TEST_PROG}${OUTPUT_SUFFIX} ..."
if test x$is_shell_script = xyes ; then
- $HERE/$TEST_PROG > $OUTPUT_DIR/${TEST_INPUT_NAME}${OUTPUT_SUFFIX}
+ "$TEST_SOURCE_DIR/$TEST_PROG" > "$OUTPUT_DIR/${TEST_INPUT_NAME}${OUTPUT_SUFFIX}"
else
- $VALGRIND $HERE/.libs/$TEST_PROG > $OUTPUT_DIR/${TEST_INPUT_NAME}${OUTPUT_SUFFIX}
+ $VALGRIND "$TEST_OUT_DIR/.libs/$TEST_PROG" > "$OUTPUT_DIR/${TEST_INPUT_NAME}${OUTPUT_SUFFIX}"
fi
echo "done"
fi
@@ -250,46 +256,46 @@ run_test_prog ()
cleanup_tests ()
{
- if test -d $HERE/$TEST_OUTPUT_DIR ; then
- echo "removing $HERE/$TEST_OUTPUT_DIR"
- rm -rf $HERE/$TEST_OUTPUT_DIR/*
- rm -rf $HERE/$VALGRIND_LOGS_DIR
+ if test -d "$TEST_OUT_DIR/$TEST_OUTPUT_DIR" ; then
+ echo "removing $TEST_OUT_DIR/$TEST_OUTPUT_DIR/*"
+ rm -rf "$TEST_OUT_DIR/$TEST_OUTPUT_DIR"
+ rm -rf "$TEST_OUT_DIR/$VALGRIND_LOGS_DIR"
fi
- if test -f $HERE/$ERROR_REPORT_FILE ; then
- rm $HERE/$ERROR_REPORT_FILE
+ if test -f "$TEST_OUT_DIR/$ERROR_REPORT_FILE" ; then
+ rm "$TEST_OUT_DIR/$ERROR_REPORT_FILE"
fi
}
run_test_report ()
{
- diff -ur --exclude=*CVS* --exclude=*cvs* --exclude=Makefile* --exclude=.arch-ids $HERE/$TEST_OUT_REF_DIR $HERE/$TEST_OUTPUT_DIR > /tmp/toto$$
- NB_DIFF=`cat /tmp/toto$$ | wc -l`
+ diff -ur --exclude='*CVS*' --exclude='*cvs*' --exclude='Makefile*' --exclude=.arch-ids "$TEST_SOURCE_DIR/$TEST_OUT_REF_DIR" "$TEST_OUT_DIR/$TEST_OUTPUT_DIR" > "$TEST_OUT_DIR/tmpdiff.$$"
+ NB_DIFF=`wc -l < "$TEST_OUT_DIR/tmpdiff.$$"`
if test "$NB_DIFF" -eq 0 ; then
echo "/////////////ALL THE TESTS ARE OK :) //////////////////"
- rm /tmp/toto$$
+ rm "$TEST_OUT_DIR/tmpdiff.$$"
else
echo "SOME TESTS ARE KO :("
- mv /tmp/toto$$ $HERE/$ERROR_REPORT_FILE
- echo "See $HERE/$ERROR_REPORT_FILE to see what's going on"
+ mv "$TEST_OUT_DIR/tmpdiff.$$" "$TEST_OUT_DIR/$ERROR_REPORT_FILE"
+ echo "See $TEST_OUT_DIR/$ERROR_REPORT_FILE to see what's going on"
fi
###################
#Valgrind errors #
###################
memleaks=no
- for vg_log in `find $HERE/$VALGRIND_LOGS_DIR -name "*-valgrind.log*" -print` ; do
- if test -s $vg_log ; then
- leaks=`cat $vg_log | grep -i leak | grep -v no`
- errors=`cat $vg_log | grep -w Invalid`
+ for vg_log in `find "$TEST_OUT_DIR/$VALGRIND_LOGS_DIR" -name '*-valgrind.log*' -print` ; do
+ if test -s "$vg_log" ; then
+ leaks=`cat "$vg_log" | grep -i leak | grep -v no`
+ errors=`cat "$vg_log" | grep -w Invalid`
if test "x$leaks" = "x" -a "x$errors" = "x" ; then
- rm -f $vg_log ;
+ rm -f "$vg_log" ;
else
echo "valgrind reported some memory leaks/corruptions in $vg_log"
memleaks=yes
fi
else
- rm $vg_log
+ rm "$vg_log"
fi
done
if test "x$RUN_VALGRIND" = "xyes" ; then
@@ -303,7 +309,7 @@ run_test_report ()
############################
#Executes the "run" command along with
-#it's command options.
+#its command options.
#For the sake of safety checking
############################
execute_run_cmd ()
@@ -352,12 +358,12 @@ execute_run_cmd ()
fi
for TEST in $TEST_PROG_LIST ; do
- run_test_prog $TEST no no;
+ run_test_prog "$TEST" no no;
done
run_test_report ;
else
#run the test and display result on stdout
- run_test_prog $TEST_PROG no yes ;
+ run_test_prog "$TEST_PROG" no yes ;
fi
}
@@ -372,12 +378,12 @@ execute_run_cmd ()
#############################
execute_command ()
{
- arg=$1 ;
+ arg="$1" ;
case "$arg" in
run)
- execute_run_cmd $@
+ execute_run_cmd "$@"
;;
ref)
@@ -388,7 +394,7 @@ execute_command ()
fi
for TEST in $TEST_PROG_LIST ; do
- run_test_prog $TEST yes no;
+ run_test_prog "$TEST" yes no;
done
;;
diff --git a/tests/valgrind-version.sh b/tests/valgrind-version.sh
index fbfd326..55cbfc2 100755
--- a/tests/valgrind-version.sh
+++ b/tests/valgrind-version.sh
@@ -1,4 +1,4 @@
-#!/bin/sh
+#! /bin/sh
valgrind=`which valgrind`
awk=`which awk`