Add database test code to imgtest.