@@ -11,9 +11,9 @@ usage() {
1111 echo " "
1212 echo " OPTIONS DESCRIPTION"
1313 echo " -d, --directory DIR Directory to run tests in."
14- echo " Default: 'axlearn /axlearn/common '."
14+ echo " Default: 'opt /axlearn'."
1515 echo " -t, --test-files FILES Pattern for test files to run."
16- echo " Default: '*_test.py'."
16+ echo " Default: 'axlearn/common/ *_test.py'."
1717 echo " -o, --output DIRECTORY Output directory for logs and summary."
1818 echo " Default: 'test_runs/<timestamp>'."
1919 echo " -h, --help Show this help message and exit."
@@ -39,7 +39,7 @@ run_tests() {
3939}
4040
4141# DEFAULT VALUES
42- DIR=' /opt/axlearn/axlearn/common '
42+ DIR=' /opt/axlearn'
4343TEST_FILES=()
4444OUTPUT_DIRECTORY=' '
4545
@@ -95,15 +95,6 @@ LOG_DIRECTORY="${OUTPUT_DIRECTORY}/logs"
9595
9696mkdir -p " ${LOG_DIRECTORY} "
9797
98- if [ " ${# TEST_FILES[@]} " -gt 0 ]; then
99- echo " Test Files:"
100- for f in " ${TEST_FILES[@]} " ; do
101- echo " $f "
102- done
103- else
104- echo " Test Files Pattern: '*_test.py' (default)"
105- fi
106-
10798# DEPENDENCIES
10899pip install torch torchvision --index-url https://download.pytorch.org/whl/cpu
109100pip install timm transformers scikit-learn grain evaluate prefixed wandb
@@ -115,26 +106,28 @@ curl https://huggingface.co/FacebookAI/roberta-base/raw/main/merges.txt -o /opt/
115106curl https://huggingface.co/FacebookAI/roberta-base/raw/main/vocab.json -o /opt/axlearn/axlearn/data/tokenizers/bpe/roberta-base-vocab.json
116107
117108# RETRIEVE TEST FILES
109+ expanded_test_files=()
118110if [ " ${# TEST_FILES[@]} " -eq 0 ]; then
119- TEST_FILES=(" *_test.py" )
111+ # if we are not giving anything for --test-files than we can match all those *_test.py files
112+ readarray -t expanded_test_files < <( find . -name " *_test.py" -type f)
113+ # otherwise let's check in the --test-files pattern
114+ else
115+ for pattern in " ${TEST_FILES[@]} " ; do
116+ readarray -t found_files < <( find . -name " $pattern " -type f)
117+ if [ ${# found_files[@]} -gt 0 ]; then
118+ expanded_test_files+=( " ${found_files[@]} " )
119+ else
120+ echo " Warning: No files found matching pattern '$pattern '"
121+ fi
122+ done
120123fi
121124
122- expanded_test_files=()
123- for pattern in " ${TEST_FILES[@]} " ; do
124- # retrieve all the files
125- files=( $pattern )
126- if [ " ${# files[@]} " -gt 0 ]; then
127- expanded_test_files+=( " ${files[@]} " )
128- else
129- echo " Warning: No files matched pattern '$pattern '"
130- fi
131- done
132-
133125if [ " ${# expanded_test_files[@]} " -eq 0 ]; then
134126 echo " No test files found to run."
135127 exit 1
136128fi
137129
130+ # EXCLUDE PATTERNS
138131EXCLUDE_PATTERNS=(" array_serialization_test.py"
139132 " t5_test.py" # tensorflow bug
140133 " loss_test.py"
@@ -185,11 +178,12 @@ done
185178
186179
187180# RUN TESTS
188- TEST_8_DEVICES_FILES=(" gda_test.py"
189- " input_base_test.py"
190- " input_dispatch_test.py"
191- " trainer_test.py"
192- " utils_test.py"
181+ TEST_8_DEVICES_FILES=(
182+ " axlearn/common/gda_test.py"
183+ " axlearn/common/input_base_test.py"
184+ " axlearn/common/input_dispatch_test.py"
185+ " axlearn/common/trainer_test.py"
186+ " axlearn/common/utils_test.py"
193187)
194188TEST_8_DEVICES_WITH_PATHS=()
195189for file in " ${TEST_8_DEVICES_FILES[@]} " ; do
0 commit comments