-# needs a git repo with micropython sharing a top-level directory
-# where make has been run in the mpy-cross directory
-
-# Compile unittest to bytecode
-../../micropython/mpy-cross/mpy-cross unittest.py
-
-# filter directories, and create relevant ones on the board
-find . -type d -mindepth 1 | \
- grep -v -E "(^./.git|^./.idea|^./.vscode|__pycache__)" | \
- xargs -n1 -I {} sh -c "echo Creating directory {} ...; ampy --port ${PORT} mkdir --exists-okay {}"
-
-# put top-level .py modules in place
-for NAME in agnostic
-do
- echo "Copying ${NAME}.py ..."
- ampy --port ${PORT} put ${NAME}.py ${NAME}.py
-done
-
-# put top-level .mpy modules in place
-for NAME in unittest
+export MPYCROSS=`realpath ../../../micropython/mpy-cross/mpy-cross`
+
+# switch to test sources
+cd ../src
+# create test source directories on board
+find testing -type d | \
+ grep -v -E "(^./.git.*|^./.idea|^./.vscode|__pycache__)" | \
+ xargs -n1 -I {} sh -c "echo Creating directory {} ...; ampy --port ${PORT} mkdir --exists-okay {}"
+# compile source .py files to .mpy
+find . -type f -name '*.py' | \
+ xargs -n1 -I {} sh -c "echo compiling {} ...; ${MPYCROSS} {}"
+# upload bytecode .mpy files
+find . -type f -name '*.mpy' | \
+ xargs -n1 -I {} sh -c "echo uploading {} ...; ampy --port ${PORT} put {} {}"
+
+#switch to test libraries
+cd ../libraries/
+
+# Compile adafruit libraries to bytecode and upload
+for SUBMODULE in `find . -mindepth 1 -maxdepth 1 -type d `