Skip to content

Commit

Permalink
better testing: failing immediately after the unsuccessful test case;
Browse files Browse the repository at this point in the history
the subgrammar handy script


git-svn-id: https://slps.svn.sourceforge.net/svnroot/slps@891 ab42f6e0-554d-0410-b580-99e487e6eeb2
  • Loading branch information
grammarware committed Dec 7, 2010
1 parent f874a2b commit 2da639c
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 6 deletions.
18 changes: 18 additions & 0 deletions 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 <bgf-input> <new-root> <bgf-output>"
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
7 changes: 1 addition & 6 deletions 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
6 changes: 6 additions & 0 deletions 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

0 comments on commit 2da639c

Please sign in to comment.