Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adjust bash script test_example.sh and test_example_source_only.sh #171

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 29 additions & 4 deletions test_example.sh
Original file line number Diff line number Diff line change
@@ -1,17 +1,42 @@
if [[ "$1" == "" ]]; then
echo "Error: Missing the dataset name"
echo "./test_example.sh <dataset name> <number of cross fold (optional)>"
echo "./test_example.sh <dataset name> --<flag (optional)> <content of flag>"
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 <number of cross 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 <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 <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
35 changes: 30 additions & 5 deletions test_example_source_only.sh
Original file line number Diff line number Diff line change
@@ -1,17 +1,42 @@
if [[ "$1" == "" ]]; then
echo "Error: Missing the dataset name"
echo "./test_example_source_only.sh <dataset name> <number of cross fold (optional)>"
echo "./test_example_source_only.sh <dataset name> --<flag (optional)> <content of flag>"
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 <number of cross 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 <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 <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
Loading