[PATCH 12/15] test/py: Move U-Boot building into a function