From 2da639c110cf3d395dc13b5d29e76f2dd55899e6 Mon Sep 17 00:00:00 2001 From: grammarware Date: Tue, 7 Dec 2010 21:09:41 +0000 Subject: [PATCH] better testing: failing immediately after the unsuccessful test case; the subgrammar handy script git-svn-id: https://slps.svn.sourceforge.net/svnroot/slps@891 ab42f6e0-554d-0410-b580-99e487e6eeb2 --- shared/tools/subgrammar | 18 ++++++++++++++++++ topics/presentation/subgrammar/Makefile | 7 +------ topics/presentation/subgrammar/testperform | 6 ++++++ 3 files changed, 25 insertions(+), 6 deletions(-) create mode 100755 shared/tools/subgrammar create mode 100755 topics/presentation/subgrammar/testperform diff --git a/shared/tools/subgrammar b/shared/tools/subgrammar new file mode 100755 index 00000000..61c2e142 --- /dev/null +++ b/shared/tools/subgrammar @@ -0,0 +1,18 @@ +#!/bin/sh + +LOCAL=${PWD} +cd `dirname $0` +cd ../.. +SLPS=${PWD} +cd ${LOCAL} + +if [ $# -ne 3 ]; then + echo "This tool extracts a portion of a grammar that starts at a given root nonterminal and includes all referenced nonterminals as well." + echo "Usage: subgrammar " + exit 1 +elif [ ! -r $1 ]; then + echo "Oops: $1 not found or not readable." + exit 1 +fi + +${SLPS}/topics/presentation/subgrammar/subgrammar.py $1 $2 $3 diff --git a/topics/presentation/subgrammar/Makefile b/topics/presentation/subgrammar/Makefile index fbdcebc1..b0cceede 100644 --- a/topics/presentation/subgrammar/Makefile +++ b/topics/presentation/subgrammar/Makefile @@ -1,11 +1,6 @@ test: ../../../shared/tools/xsd2bgf ../../fl/xsd/fl.xsd fl.bgf - echo 'Executing test cases...' - ls -1 tests/ | xargs -n1 -I _ basename _ .baseline.bgf | xargs -n1 -I _ ./subgrammar.py fl.bgf _ fl._.bgf - echo 'Syntax checking test results...' - ls -1 *.bgf | xargs -n1 checkxml bgf - echo 'Validating test results...' - ls -1 tests/ | xargs -n1 -I _ basename _ .baseline.bgf | xargs -n1 -I _ ../../../shared/tools/gdt fl._.bgf tests/_.baseline.bgf + ls -1 tests/ | xargs -n1 -I _ basename _ .baseline.bgf | xargs -n1 ./testperform clean: rm -f *.bgf \ No newline at end of file diff --git a/topics/presentation/subgrammar/testperform b/topics/presentation/subgrammar/testperform new file mode 100755 index 00000000..8a743498 --- /dev/null +++ b/topics/presentation/subgrammar/testperform @@ -0,0 +1,6 @@ +#!/bin/sh + +echo [Test Case] $1 +./subgrammar.py fl.bgf $1 fl.$1.bgf || exit -1 +../../../shared/tools/checkxml bgf fl.$1.bgf || exit -1 +../../../shared/tools/gdt fl.$1.bgf tests/$1.baseline.bgf || exit -1