From a26e9b554c0eee0cf23547f9750c4e160efdaa7f Mon Sep 17 00:00:00 2001 From: Muhammad Satrio Wicaksono Date: Sun, 10 Dec 2023 00:29:44 +0700 Subject: [PATCH 1/2] update: adjust test_example.sh and test_example_source_only.sh --- test_example.sh | 31 ++++++++++++++++++++++++++++--- test_example_source_only.sh | 33 +++++++++++++++++++++++++++++---- 2 files changed, 57 insertions(+), 7 deletions(-) diff --git a/test_example.sh b/test_example.sh index c12b07555..955e60785 100755 --- a/test_example.sh +++ b/test_example.sh @@ -4,14 +4,39 @@ if [[ "$1" == "" ]]; then exit fi -# Test for inputed dataset +if [[ "$2" == "--number_fold" ]]; then + if [[ "$3" == "" ]]; then + echo "Error: Missing number of fold" + echo "./test_example.sh --number_fold " + exit + fi -if [[ "$2" -ne "" ]]; then - for ((i=0; i < $2; i++ )); + for ((i=0; i < $3; i++ )); do python -m tests.test_seacrowd seacrowd/sea_datasets/$1/$1.py --subset_id "$1_fold$i" done exit fi +if [[ "$2" == "--subset_id" ]]; then + if [[ "$3" == "" ]]; then + echo "Error: Missing subset_id" + echo "./test_example.sh --subset_id " + exit + fi + + python -m tests.test_seacrowd seacrowd/sea_datasets/$1/$1.py --subset_id $3 + exit + +elif [[ "$2" == "--data_dir" ]]; then + if [[ "$3" == "" ]]; then + echo "Error: Missing data_dir" + echo "./test_example.sh --data_dir " + exit + fi + + python -m tests.test_seacrowd seacrowd/sea_datasets/$1/$1.py --data_dir $3 + exit +fi + python -m tests.test_seacrowd seacrowd/sea_datasets/$1/$1.py diff --git a/test_example_source_only.sh b/test_example_source_only.sh index 632a452f9..ba77555b0 100755 --- a/test_example_source_only.sh +++ b/test_example_source_only.sh @@ -4,14 +4,39 @@ if [[ "$1" == "" ]]; then exit fi -# Test for inputed dataset +if [[ "$2" == "--number_fold" ]]; then + if [[ "$3" == "" ]]; then + echo "Error: Missing number of fold" + echo "./test_example_source_only.sh --number_fold " + exit + fi -if [[ "$2" -ne "" ]]; then - for ((i=0; i < $2; i++ )); + for ((i=0; i < $3; i++ )); do python -m tests.test_seacrowd_source_only seacrowd/sea_datasets/$1/$1.py --subset_id "$1_fold$i" done exit fi -python -m tests.test_seacrowd_source_only seacrowd/sea_datasets/$1/$1.py +if [[ "$2" == "--subset_id" ]]; then + if [[ "$3" == "" ]]; then + echo "Error: Missing subset_id" + echo "./test_example_source_only.sh --subset_id " + exit + fi + + python -m tests.test_seacrowd_source_only seacrowd/sea_datasets/$1/$1.py --subset_id $3 + exit + +elif [[ "$2" == "--data_dir" ]]; then + if [[ "$3" == "" ]]; then + echo "Error: Missing data_dir" + echo "./test_example_source_only.sh --data_dir " + exit + fi + + python -m tests.test_seacrowd_source_only seacrowd/sea_datasets/$1/$1.py --data_dir $3 + exit +fi + +python -m tests.test_seacrowd_source_only seacrowd/sea_datasets/$1/$1.py \ No newline at end of file From a9d579525f1759e5b58815cf73c1d339f271bc7e Mon Sep 17 00:00:00 2001 From: Muhammad Satrio Wicaksono Date: Sun, 10 Dec 2023 00:32:09 +0700 Subject: [PATCH 2/2] fix: minor error message when dataset is empty --- test_example.sh | 2 +- test_example_source_only.sh | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/test_example.sh b/test_example.sh index 955e60785..e9f01cb9b 100755 --- a/test_example.sh +++ b/test_example.sh @@ -1,6 +1,6 @@ if [[ "$1" == "" ]]; then echo "Error: Missing the dataset name" - echo "./test_example.sh " + echo "./test_example.sh -- " exit fi diff --git a/test_example_source_only.sh b/test_example_source_only.sh index ba77555b0..a6b5b3154 100755 --- a/test_example_source_only.sh +++ b/test_example_source_only.sh @@ -1,6 +1,6 @@ if [[ "$1" == "" ]]; then echo "Error: Missing the dataset name" - echo "./test_example_source_only.sh " + echo "./test_example_source_only.sh -- " exit fi