Commit 0a887f79 authored by Julien Lopez's avatar Julien Lopez

Two test suites, for the first one:

	make test
For the complete one:
	make extendedtest
This last test suite will show some errors as it tests unimplemented
features. See tests/test.sh for the implementation.
Useless Makefiles removed
parent 8720c392
...@@ -95,7 +95,10 @@ cvs_snapshot_bin: clean ...@@ -95,7 +95,10 @@ cvs_snapshot_bin: clean
.PHONY: test .PHONY: test
test: all test: all
$(MAKE) -C tests test @tests/test.sh
extendedtest: all
@tests/test.sh -e
############ CGI DEMO ################### ############ CGI DEMO ###################
......
...@@ -11,6 +11,7 @@ ifneq ($(ML_INTERFACE), false) ...@@ -11,6 +11,7 @@ ifneq ($(ML_INTERFACE), false)
INSTALL_BINARIES += cduce_mktop INSTALL_BINARIES += cduce_mktop
endif endif
OUNIT_TESTS=a eval cdnum cdsdl
ifeq ($(NATIVE),true) ifeq ($(NATIVE),true)
all: cduce_lib.cmxa all: cduce_lib.cmxa
...@@ -259,9 +260,10 @@ cduce_packed: cduce_packed.$(EXTENSION) ...@@ -259,9 +260,10 @@ cduce_packed: cduce_packed.$(EXTENSION)
cduce_lib.$(EXTENSION_LIB): $(OBJECTS:.cmo=.$(EXTENSION)) cduce_lib.$(EXTENSION_LIB): $(OBJECTS:.cmo=.$(EXTENSION))
@echo "Pack cduce_lib.$(EXTENSION)" @echo "Pack cduce_lib.$(EXTENSION)"
$(HIDE)$(COMPILE) -o cduce_lib.$(EXTENSION) $(INCLUDES) -pack $^ @test -e lib || mkdir lib
$(HIDE)$(COMPILE) -o lib/cduce_lib.$(EXTENSION) $(INCLUDES) -pack $^
@echo "Build $@" @echo "Build $@"
$(HIDE)$(COMPILE) -a -o $@ cduce_lib.$(EXTENSION) $(HIDE)$(COMPILE) -a -o lib/$@ lib/cduce_lib.$(EXTENSION)
dtd2cduce: tools/dtd2cduce.ml dtd2cduce: tools/dtd2cduce.ml
@echo "Build $@" @echo "Build $@"
...@@ -287,7 +289,11 @@ clean: ...@@ -287,7 +289,11 @@ clean:
rm -f configure.log rm -f configure.log
rm -rf web/doc rm -rf web/doc
rm -f META rm -f META
$(MAKE) -C tests clean rm -rf lib
$(RM) tests/schema/regtest/test.cd tests/schema/regtest/test.log
$(RM) tests/schema/test.cd tests/schema/test.log
$(RM) oUnit-* tests/ocaml/a/c.ml tests/ocaml/a/c.cdo tests/ocaml/a/c.cmi tests/ocaml/a/c.cmo
for i in $(OUNIT_TESTS); do $(RM) `echo tests/ocaml/$$i/$$i tests/ocaml/$$i/$$i.ml tests/ocaml/$$i/$$i.c[dm][oxi] tests/ocaml/$$i/$${i}test.cm[io]`; done
distclean: clean distclean: clean
rm -f Makefile.conf rm -f Makefile.conf
......
TESTDIR = schema ocaml
RM = rm -f
.PHONY: test
test:
@for d in $(TESTDIR); do $(MAKE) -C $$d $@; done
extendedtest:
@for d in $(TESTDIR); do $(MAKE) -C $$d $@; done
clean:
$(RM) schema/regtest/test.cd schema/regtest/test.log
$(RM) schema/test.cd schema/test.log
$(MAKE) -C ocaml clean
CAML=ocamlc -I $@
CDUCE=../../cduce -I $@
CDO2ML=$(CDUCE) --mlstub
OUNIT_TESTS=a eval cdnum cdsdl
RM=rm -f
all: $(OUNIT_TESTS)
test: a eval cdnum
extendedtest: all
a:
@$(CAML) -c $@/$@.mli
@$(CDUCE) --compile $@/c.cd
@$(CDUCE) --compile $@/$@.cd
@$(CDO2ML) $@/c.cdo > $@/c.ml
@$(CDO2ML) $@/$@.cdo > $@/$@.ml
@ocamlfind $(CAML) -g -package cduce,oUnit -linkpkg -o $@/$@ $@/c.ml $@/$@.ml $@/$@test.ml
@./$@/$@
eval:
@$(CAML) -c $@/$@.mli
@$(CDUCE) --compile $@/$@.cd -I $(OCAML_TOPLEVEL_PATH)/../cduce
@$(CDO2ML) $@/$@.cdo > $@/$@.ml
@ocamlfind $(CAML) -I $@ -package cduce,oUnit -linkpkg -o $@/$@ $@/$@.ml $@/$@test.ml
@./$@/$@
cdnum:
@$(CAML) -c $@/$@.mli
@$(CDUCE) --compile $@/$@.cd -I `ocamlfind query num`
@$(CDO2ML) $@/$@.cdo > $@/$@.ml
@ocamlfind $(CAML) -I $@ -package cduce,num,oUnit -linkpkg -o $@/$@ $@/$@.ml $@/$@test.ml
@./$@/$@
cdsdl:
@$(CAML) -c -I `ocamlfind query sdl` $@/$@.mli
@$(CDUCE) --compile -I `ocamlfind query sdl` $@/$@.cd
@$(CDO2ML) -I `ocamlfind query sdl` $@/$@.cdo > $@/$@.ml
@ocamlfind $(CAML) -package cduce,sdl,oUnit -linkpkg -o $@/$@ $@/$@.ml $@/$@test.ml
@./$@/$@
clean:
$(RM) oUnit-* a/c.ml a/c.cdo a/c.cmi a/c.cmo
for i in $(OUNIT_TESTS); do $(RM) `echo $$i/$$i $$i/$$i.ml $$i/$$i.c[dm][oxi] $$i/$${i}test.cm[io]`; done
.PHONY: a cdsdl cdmysql eval cdnum test extendedtest
TESTS=library1.xsd library2.xsd library3.xsd mails.xsd po.xsd po2.xsd
.PHONY: regtest test extendedtest
regtest:
@$(MAKE) -C $@ test
test: regtest
@echo -n "Tests on schema: "
@-./test.pl test.cd test.log $(TESTS)
@echo " passed."
extendedtest: regtest
@echo -n "Tests on schema: "
@-./test.pl test.cd test.log *.xsd
@echo " passed."
TESTDIR =
.PHONY: test extendedtest
test:
@echo -n "Tests on regtest: "
@-cd ../; ./test.pl regtest/test.cd regtest/test.log regtest/*.xsd
@echo " passed."
@for d in $(TESTDIR); do $(MAKE) -C $$d $@; done
extendedtest:
@echo -n "Tests on regtest: "
@-cd ../; ./test.pl regtest/test.cd regtest/test.log regtest/*.xsd
@echo " passed."
@for d in $(TESTDIR); do $(MAKE) -C $$d $@; done
#!/usr/bin/perl -w #!/usr/bin/perl -w
use strict; use strict;
use File::Basename;
my $testfile = shift || die "testfile?"; my $testfile = shift || die "testfile?";
my $logfile = shift || die "logfile?"; my $logfile = shift || die "logfile?";
my $cduce = "../../cduce"; my $rootdir = dirname($0);
my $cduce = $rootdir . "/../../cduce";
my $failed_tests = ""; my $failed_tests = "";
my $nbr_tests = 0; my $nbr_tests = 0;
my $nbr_success = 0; my $nbr_success = 0;
...@@ -38,14 +41,15 @@ EOF ...@@ -38,14 +41,15 @@ EOF
EOF EOF
} }
if (-f "$1.xml") { if (-f "$1.xml") {
if ($1 ne "po2" && $1 ne "regtest/mails_tns" && $1 ne "regtest/model_group") { if ($1 ne "$rootdir/po2" && $1 ne "$rootdir/regtest/mails_tns"
&& $1 ne "$rootdir/regtest/model_group") {
print CD <<EOF; print CD <<EOF;
let x = load_xml "$1.xml";; let x = load_xml "$1.xml";;
let y = validate x with X . $root;; let y = validate x with X . $root;;
print_xml y;; print_xml y;;
EOF EOF
} }
elsif ($1 eq "po2") { elsif ($1 eq "$rootdir/po2") {
print CD <<EOF; print CD <<EOF;
let x = load_xml "$1.xml";; let x = load_xml "$1.xml";;
let _ = let _ =
...@@ -54,7 +58,7 @@ elsif ($1 eq "po2") { ...@@ -54,7 +58,7 @@ elsif ($1 eq "po2") {
print_xml y;; print_xml y;;
EOF EOF
} }
elsif ($1 eq "regtest/mails_tns") { elsif ($1 eq "$rootdir/regtest/mails_tns") {
print CD <<EOF; print CD <<EOF;
let x = load_xml "$1.xml";; let x = load_xml "$1.xml";;
let _ = let _ =
...@@ -63,7 +67,7 @@ elsif ($1 eq "regtest/mails_tns") { ...@@ -63,7 +67,7 @@ elsif ($1 eq "regtest/mails_tns") {
print_xml y;; print_xml y;;
EOF EOF
} }
elsif ($1 eq "regtest/model_group") { elsif ($1 eq "$rootdir/regtest/model_group") {
print CD <<EOF; print CD <<EOF;
let x = load_xml "$1.xml";; let x = load_xml "$1.xml";;
let content = match x with <_ ..>cont -> cont;; let content = match x with <_ ..>cont -> cont;;
...@@ -75,8 +79,8 @@ EOF ...@@ -75,8 +79,8 @@ EOF
my $retval = system "$cduce $testfile >> $logfile 2>&1"; my $retval = system "$cduce $testfile >> $logfile 2>&1";
if ($? == -1) { if ($? == -1) {
die "Can't execute CDuce (tried $cduce)\n"; die "Can't execute CDuce (tried $cduce)\n";
} elsif (($? != 0 && $1 ne "regtest/simple_type_recursion") || } elsif (($? != 0 && $1 ne "$rootdir/regtest/simple_type_recursion") ||
($? = 0 && $1 eq "regtest/simple_type_recursion")) { ($? = 0 && $1 eq "$rootdir/regtest/simple_type_recursion")) {
print "E: test failed on $s\n"; print "E: test failed on $s\n";
$failed_tests .= " $s"; $failed_tests .= " $s";
} }
......
#!/bin/sh
ROOT=`dirname $0`
EXTENDED="false"
SCHEMADIR=$ROOT/schema
SCHEMATESTS="$SCHEMADIR/library1.xsd $SCHEMADIR/library2.xsd\
$SCHEMADIR/library3.xsd $SCHEMADIR/mails.xsd $SCHEMADIR/po.xsd\
$SCHEMADIR/po2.xsd"
SCHEMASCRIPT=$SCHEMADIR/test.pl
SCHEMACDFILE=$SCHEMADIR/test.cd
SCHEMALOGFILE=$SCHEMADIR/test.log
REGDIR=$ROOT/schema/regtest
REGSCRIPT=$SCHEMADIR/test.pl
REGCDFILE=$REGDIR/test.cd
REGLOGFILE=$REGDIR/test.log
OCAMLDIR=$ROOT/ocaml
while test $# -ne 0; do
if test $1 = "-e"; then EXTENDED="true"; fi; shift;
done
echo -n "Tests on schema: "
if test $EXTENDED = "false"; then
$SCHEMASCRIPT $SCHEMACDFILE $SCHEMALOGFILE $SCHEMATESTS
else
$SCHEMASCRIPT $SCHEMACDFILE $SCHEMALOGFILE $SCHEMADIR/*.xsd
fi
echo " passed."
echo -n "Tests on regtest: "
$REGSCRIPT $REGCDFILE $REGLOGFILE $REGDIR/*.xsd
echo " passed."
ocamlc -I $OCAMLDIR/a -c $OCAMLDIR/a/a.mli
$ROOT/../cduce -I $OCAMLDIR/a --compile $OCAMLDIR/a/c.cd
$ROOT/../cduce -I $OCAMLDIR/a --compile $OCAMLDIR/a/a.cd
$ROOT/../cduce -I $OCAMLDIR/a --mlstub $OCAMLDIR/a/c.cdo > $OCAMLDIR/a/c.ml
$ROOT/../cduce -I $OCAMLDIR/a --mlstub $OCAMLDIR/a/a.cdo > $OCAMLDIR/a/a.ml
ocamlfind ocamlc -I $OCAMLDIR/a -g -package cduce,oUnit -linkpkg -o $OCAMLDIR/a/a $OCAMLDIR/a/c.ml $OCAMLDIR/a/a.ml $OCAMLDIR/a/atest.ml
$OCAMLDIR/a/a
ocamlc -I $OCAMLDIR/eval -c $OCAMLDIR/eval/eval.mli
$ROOT/../cduce -I $OCAMLDIR/eval --compile $OCAMLDIR/eval/eval.cd -I $OCAML_TOPLEVEL_PATH/../cduce
$ROOT/../cduce -I $OCAMLDIR/eval --mlstub $OCAMLDIR/eval/eval.cdo > $OCAMLDIR/eval/eval.ml
ocamlfind ocamlc -I $OCAMLDIR/eval -package cduce,oUnit -linkpkg -o $OCAMLDIR/eval/eval $OCAMLDIR/eval/eval.ml $OCAMLDIR/eval/evaltest.ml
$OCAMLDIR/eval/eval
ocamlc -I $OCAMLDIR/cdnum -c $OCAMLDIR/cdnum/cdnum.mli
$ROOT/../cduce -I $OCAMLDIR/cdnum --compile $OCAMLDIR/cdnum/cdnum.cd -I `ocamlfind query num`
$ROOT/../cduce -I $OCAMLDIR/cdnum --mlstub $OCAMLDIR/cdnum/cdnum.cdo > $OCAMLDIR/cdnum/cdnum.ml
ocamlfind ocamlc -I $OCAMLDIR/cdnum -package cduce,num,oUnit -linkpkg -o $OCAMLDIR/cdnum/cdnum $OCAMLDIR/cdnum/cdnum.ml $OCAMLDIR/cdnum/cdnumtest.ml
$OCAMLDIR/cdnum/cdnum
if test $EXTENDED = "true"; then
ocamlc -I $OCAMLDIR/cdsdl -c -I `ocamlfind query sdl` $OCAMLDIR/cdsdl/cdsdl.mli
$ROOT/../cduce -I $OCAMLDIR/cdsdl --compile -I `ocamlfind query sdl` $OCAMLDIR/cdsdl/cdsdl.cd
$ROOT/../cduce -I $OCAMLDIR/cdsdl --mlstub -I `ocamlfind query sdl` $OCAMLDIR/cdsdl/cdsdl.cdo > $OCAMLDIR/cdsdl/cdsdl.ml
ocamlfind ocamlc -I $OCAMLDIR/cdsdl -package cduce,sdl,oUnit -linkpkg -o $OCAMLDIR/cdsdl/cdsdl $OCAMLDIR/cdsdl/cdsdl.ml $OCAMLDIR/cdsdl/cdsdltest.ml
$OCAMLDIR/cdsdl/cdsdl
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