From 4436cb101e0756ad2a452fe81f0db2f18c14d60e Mon Sep 17 00:00:00 2001 From: "John J. Camilleri" Date: Wed, 30 Jun 2021 13:47:15 +0200 Subject: [PATCH] Move testsuite/compiler/canonical on level up, update test script --- testsuite/{compiler => }/canonical/.gitignore | 0 .../gold/FoodsFin.gf} | 0 .../canonical => canonical/grammars}/Foods.gf | 0 .../grammars}/FoodsFin.gf | 0 .../grammars}/FoodsI.gf | 0 .../grammars}/Greetings.gf | 0 .../grammars}/GreetingsBul.gf | 0 .../grammars}/GreetingsGer.gf | 0 .../grammars}/LexFoods.gf | 0 .../grammars}/LexFoodsFin.gf | 0 .../grammars}/Phrasebook.gf | 0 .../grammars}/PhrasebookBul.gf | 0 .../grammars}/PhrasebookGer.gf | 0 .../grammars}/Sentences.gf | 0 .../grammars}/SentencesBul.gf | 0 .../grammars}/SentencesGer.gf | 0 .../grammars}/SentencesI.gf | 0 .../canonical => canonical/grammars}/Words.gf | 0 .../grammars}/WordsBul.gf | 0 .../grammars}/WordsGer.gf | 0 testsuite/canonical/run.sh | 42 +++++++++++++++++++ testsuite/compiler/canonical/run.sh | 23 ---------- 22 files changed, 42 insertions(+), 23 deletions(-) rename testsuite/{compiler => }/canonical/.gitignore (100%) rename testsuite/{compiler/canonical/FoodsFin.gf.gold => canonical/gold/FoodsFin.gf} (100%) rename testsuite/{compiler/canonical => canonical/grammars}/Foods.gf (100%) rename testsuite/{compiler/canonical => canonical/grammars}/FoodsFin.gf (100%) rename testsuite/{compiler/canonical => canonical/grammars}/FoodsI.gf (100%) rename testsuite/{compiler/canonical => canonical/grammars}/Greetings.gf (100%) rename testsuite/{compiler/canonical => canonical/grammars}/GreetingsBul.gf (100%) rename testsuite/{compiler/canonical => canonical/grammars}/GreetingsGer.gf (100%) rename testsuite/{compiler/canonical => canonical/grammars}/LexFoods.gf (100%) rename testsuite/{compiler/canonical => canonical/grammars}/LexFoodsFin.gf (100%) rename testsuite/{compiler/canonical => canonical/grammars}/Phrasebook.gf (100%) rename testsuite/{compiler/canonical => canonical/grammars}/PhrasebookBul.gf (100%) rename testsuite/{compiler/canonical => canonical/grammars}/PhrasebookGer.gf (100%) rename testsuite/{compiler/canonical => canonical/grammars}/Sentences.gf (100%) rename testsuite/{compiler/canonical => canonical/grammars}/SentencesBul.gf (100%) rename testsuite/{compiler/canonical => canonical/grammars}/SentencesGer.gf (100%) rename testsuite/{compiler/canonical => canonical/grammars}/SentencesI.gf (100%) rename testsuite/{compiler/canonical => canonical/grammars}/Words.gf (100%) rename testsuite/{compiler/canonical => canonical/grammars}/WordsBul.gf (100%) rename testsuite/{compiler/canonical => canonical/grammars}/WordsGer.gf (100%) create mode 100755 testsuite/canonical/run.sh delete mode 100755 testsuite/compiler/canonical/run.sh diff --git a/testsuite/compiler/canonical/.gitignore b/testsuite/canonical/.gitignore similarity index 100% rename from testsuite/compiler/canonical/.gitignore rename to testsuite/canonical/.gitignore diff --git a/testsuite/compiler/canonical/FoodsFin.gf.gold b/testsuite/canonical/gold/FoodsFin.gf similarity index 100% rename from testsuite/compiler/canonical/FoodsFin.gf.gold rename to testsuite/canonical/gold/FoodsFin.gf diff --git a/testsuite/compiler/canonical/Foods.gf b/testsuite/canonical/grammars/Foods.gf similarity index 100% rename from testsuite/compiler/canonical/Foods.gf rename to testsuite/canonical/grammars/Foods.gf diff --git a/testsuite/compiler/canonical/FoodsFin.gf b/testsuite/canonical/grammars/FoodsFin.gf similarity index 100% rename from testsuite/compiler/canonical/FoodsFin.gf rename to testsuite/canonical/grammars/FoodsFin.gf diff --git a/testsuite/compiler/canonical/FoodsI.gf b/testsuite/canonical/grammars/FoodsI.gf similarity index 100% rename from testsuite/compiler/canonical/FoodsI.gf rename to testsuite/canonical/grammars/FoodsI.gf diff --git a/testsuite/compiler/canonical/Greetings.gf b/testsuite/canonical/grammars/Greetings.gf similarity index 100% rename from testsuite/compiler/canonical/Greetings.gf rename to testsuite/canonical/grammars/Greetings.gf diff --git a/testsuite/compiler/canonical/GreetingsBul.gf b/testsuite/canonical/grammars/GreetingsBul.gf similarity index 100% rename from testsuite/compiler/canonical/GreetingsBul.gf rename to testsuite/canonical/grammars/GreetingsBul.gf diff --git a/testsuite/compiler/canonical/GreetingsGer.gf b/testsuite/canonical/grammars/GreetingsGer.gf similarity index 100% rename from testsuite/compiler/canonical/GreetingsGer.gf rename to testsuite/canonical/grammars/GreetingsGer.gf diff --git a/testsuite/compiler/canonical/LexFoods.gf b/testsuite/canonical/grammars/LexFoods.gf similarity index 100% rename from testsuite/compiler/canonical/LexFoods.gf rename to testsuite/canonical/grammars/LexFoods.gf diff --git a/testsuite/compiler/canonical/LexFoodsFin.gf b/testsuite/canonical/grammars/LexFoodsFin.gf similarity index 100% rename from testsuite/compiler/canonical/LexFoodsFin.gf rename to testsuite/canonical/grammars/LexFoodsFin.gf diff --git a/testsuite/compiler/canonical/Phrasebook.gf b/testsuite/canonical/grammars/Phrasebook.gf similarity index 100% rename from testsuite/compiler/canonical/Phrasebook.gf rename to testsuite/canonical/grammars/Phrasebook.gf diff --git a/testsuite/compiler/canonical/PhrasebookBul.gf b/testsuite/canonical/grammars/PhrasebookBul.gf similarity index 100% rename from testsuite/compiler/canonical/PhrasebookBul.gf rename to testsuite/canonical/grammars/PhrasebookBul.gf diff --git a/testsuite/compiler/canonical/PhrasebookGer.gf b/testsuite/canonical/grammars/PhrasebookGer.gf similarity index 100% rename from testsuite/compiler/canonical/PhrasebookGer.gf rename to testsuite/canonical/grammars/PhrasebookGer.gf diff --git a/testsuite/compiler/canonical/Sentences.gf b/testsuite/canonical/grammars/Sentences.gf similarity index 100% rename from testsuite/compiler/canonical/Sentences.gf rename to testsuite/canonical/grammars/Sentences.gf diff --git a/testsuite/compiler/canonical/SentencesBul.gf b/testsuite/canonical/grammars/SentencesBul.gf similarity index 100% rename from testsuite/compiler/canonical/SentencesBul.gf rename to testsuite/canonical/grammars/SentencesBul.gf diff --git a/testsuite/compiler/canonical/SentencesGer.gf b/testsuite/canonical/grammars/SentencesGer.gf similarity index 100% rename from testsuite/compiler/canonical/SentencesGer.gf rename to testsuite/canonical/grammars/SentencesGer.gf diff --git a/testsuite/compiler/canonical/SentencesI.gf b/testsuite/canonical/grammars/SentencesI.gf similarity index 100% rename from testsuite/compiler/canonical/SentencesI.gf rename to testsuite/canonical/grammars/SentencesI.gf diff --git a/testsuite/compiler/canonical/Words.gf b/testsuite/canonical/grammars/Words.gf similarity index 100% rename from testsuite/compiler/canonical/Words.gf rename to testsuite/canonical/grammars/Words.gf diff --git a/testsuite/compiler/canonical/WordsBul.gf b/testsuite/canonical/grammars/WordsBul.gf similarity index 100% rename from testsuite/compiler/canonical/WordsBul.gf rename to testsuite/canonical/grammars/WordsBul.gf diff --git a/testsuite/compiler/canonical/WordsGer.gf b/testsuite/canonical/grammars/WordsGer.gf similarity index 100% rename from testsuite/compiler/canonical/WordsGer.gf rename to testsuite/canonical/grammars/WordsGer.gf diff --git a/testsuite/canonical/run.sh b/testsuite/canonical/run.sh new file mode 100755 index 000000000..7e5a90f12 --- /dev/null +++ b/testsuite/canonical/run.sh @@ -0,0 +1,42 @@ +#!/usr/bin/env sh + +FAILURES=0 + +# https://github.com/GrammaticalFramework/gf-core/issues/100 +stack run -- --batch --output-format=canonical_gf grammars/PhrasebookBul.gf +stack run -- --batch canonical/PhrasebookBul.gf +if [ $? -ne 0 ]; then + echo "Canonical grammar doesn't compile: FAIL" + FAILURES=$((FAILURES+1)) +else + echo "Canonical grammar compiles: OK" +fi + +# https://github.com/GrammaticalFramework/gf-core/issues/101 +stack run -- --batch --output-format=canonical_gf grammars/PhrasebookGer.gf +for s in c2 objCtrl; do + grep VRead --after-context=216 canonical/PhrasebookGer.gf | grep "$s" > /dev/null + if [ $? -ne 1 ]; then + echo "Canonical grammar contains `$s`: FAIL" + FAILURES=$((FAILURES+1)) + else + echo "Canonical grammar does not contain `$s`: OK" + fi +done + +# https://github.com/GrammaticalFramework/gf-core/issues/102 +stack run -- --batch --output-format=canonical_gf grammars/FoodsFin.gf +diff canonical/FoodsFin.gf gold/FoodsFin.gf +if [ $? -ne 0 ]; then + echo "Canonical grammar doesn't match gold version: FAIL" + FAILURES=$((FAILURES+1)) +else + echo "Canonical grammar matches gold version: OK" +fi + +if [ $FAILURES -ne 0 ]; then + echo "Failures: $FAILURES" + exit 1 +else + echo "All tests passed" +fi diff --git a/testsuite/compiler/canonical/run.sh b/testsuite/compiler/canonical/run.sh deleted file mode 100755 index b9cc7e25b..000000000 --- a/testsuite/compiler/canonical/run.sh +++ /dev/null @@ -1,23 +0,0 @@ -#!/usr/bin/env sh - -# https://github.com/GrammaticalFramework/gf-core/issues/100 -stack run -- --batch --output-format=canonical_gf PhrasebookBul.gf -stack run -- --batch canonical/PhrasebookBul.gf - -# https://github.com/GrammaticalFramework/gf-core/issues/101 -stack run -- --batch --output-format=canonical_gf PhrasebookGer.gf -for s in c2 objCtrl; do - grep VRead --after-context=216 canonical/PhrasebookGer.gf | grep "$s" > /dev/null - if [ $? -ne 1 ]; then - echo "$s found" - exit 1 - fi -done - -# https://github.com/GrammaticalFramework/gf-core/issues/102 -stack run -- --batch --output-format=canonical_gf FoodsFin.gf -diff canonical/FoodsFin.gf ./FoodsFin.gf.gold -if [ $? -ne 0 ]; then - echo "Compiled grammar doesn't match gold version" - exit 1 -fi