From 01967fbacbd12f7010617ffa1261ffe954d7bf8f Mon Sep 17 00:00:00 2001 From: "Vitor A. M. Jorge" Date: Sun, 4 Oct 2026 02:06:21 -0300 Subject: [PATCH] pt: make the Sparrowhawk test scripts runnable tests/nemo_text_processing/pt/test_sparrowhawk_inverse_text_normalization.sh could not run in the sparrowhawk container (docker/launch.sh, which tools/text_processing_deployment/export_grammars.sh --MODE=test starts, as CONTRIBUTING.md describes): - PROJECT_DIR defaulted to /workspace/tests/en, while every test case path is $PROJECT_DIR/pt/..., and shUnit2 is loaded from $PROJECT_DIR/../shunit2. Default it to /workspace/tests, which resolves both. The second argument, when given, is that tests root (not the language directory). - Arguments were not cleared before loading shUnit2, which then took them for test names when the script is called with arguments. Clear them before loading shUnit2, as the English scripts do. The pt TN script, test_sparrowhawk_normalization.sh, already had the right default but not the shift; it gets the same two lines. With these, the ITN script passes all 11 test groups and the TN script all 10 on main ("Ran 11 tests. OK" / "Ran 10 tests. OK"), also when called with the grammar directory and the tests root as arguments. Other languages' scripts (fr, ru, sv, vi, zh, hy, es_en) share the PROJECT_DIR default and are not changed here. These scripts declare #!/bin/sh but use bash features, as most of the repo's Sparrowhawk scripts do; they are run with bash, and that is left for a separate change. Signed-off-by: Vitor A. M. Jorge --- .../pt/test_sparrowhawk_inverse_text_normalization.sh | 5 ++++- .../pt/test_sparrowhawk_normalization.sh | 3 +++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/tests/nemo_text_processing/pt/test_sparrowhawk_inverse_text_normalization.sh b/tests/nemo_text_processing/pt/test_sparrowhawk_inverse_text_normalization.sh index 511411e90..50ee77774 100755 --- a/tests/nemo_text_processing/pt/test_sparrowhawk_inverse_text_normalization.sh +++ b/tests/nemo_text_processing/pt/test_sparrowhawk_inverse_text_normalization.sh @@ -1,7 +1,7 @@ #! /bin/sh GRAMMARS_DIR=${1:-"/workspace/sparrowhawk/documentation/grammars"} -PROJECT_DIR=${2:-"/workspace/tests/en"} +PROJECT_DIR=${2:-"/workspace/tests"} runtest () { input=$1 @@ -82,5 +82,8 @@ testITNWord() { runtest $input } +# Remove all command-line arguments +shift $# + # Load shUnit2 . $PROJECT_DIR/../shunit2/shunit2 diff --git a/tests/nemo_text_processing/pt/test_sparrowhawk_normalization.sh b/tests/nemo_text_processing/pt/test_sparrowhawk_normalization.sh index c9f39aaa7..0877a6c80 100755 --- a/tests/nemo_text_processing/pt/test_sparrowhawk_normalization.sh +++ b/tests/nemo_text_processing/pt/test_sparrowhawk_normalization.sh @@ -87,5 +87,8 @@ testTNElectronic() { # runtest $input # } +# Remove all command-line arguments +shift $# + # Load shUnit2 . $PROJECT_DIR/../shunit2/shunit2