Skip to content
This repository has been archived by the owner on Feb 9, 2023. It is now read-only.

Commit

Permalink
Run all tests from Makefile.
Browse files Browse the repository at this point in the history
Change-Id: I50e48c20369b1e5935f3aeb100c8a77943fecd37
  • Loading branch information
dmitriykovalev committed Aug 1, 2018
1 parent b3e7f42 commit 7183f09
Show file tree
Hide file tree
Showing 3 changed files with 44 additions and 19 deletions.
32 changes: 25 additions & 7 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,22 +3,40 @@ PYTHON=python3
.PHONY: all test-download test deb clean

all:
@echo "make test-download - Download test images"
@echo "make test - Run tests"
@echo "make clean - Get rid of all generated files"
@echo "male deb - Generate Debian package"

test-vision-download:
@echo "make lint - Run python code linter"
@echo "make joy-demo-start - Start JoyDemo service"
@echo "make joy-demo-stop - Stop JoyDemo service"
@echo "make joy-demo-enable - Enable JoyDemo service"
@echo "make joy-demo-disable - Disable JoyDemo service"
@echo "make test-vision-images - Download vision test images"
@echo "make test-vision-driver - Run vision driver tests"
@echo "make test-vision-models - Run vision model tests"
@echo "make test-vision-examples - Run vision example tests"
@echo "make test-vision - Run all vision tests"
@echo "make clean - Remove generated files"
@echo "make deb - Generate Debian package"

test-vision-images:
$(MAKE) -C src/tests/images

test-vision: test-vision-download
test-vision-driver:
$(PYTHON) -m unittest \
src/tests/spicomm_test.py

test-vision-models: test-vision-images
$(PYTHON) -m unittest \
src/tests/dish_classification_test.py \
src/tests/dish_detection_test.py \
src/tests/face_detection_test.py \
src/tests/image_classification_test.py \
src/tests/object_detection_test.py

test-vision-examples: test-vision-images
$(PYTHON) -m unittest \
src/tests/vision_examples_test.py

test-vision: test-vision-driver test-vision-models test-vision-examples

deb:
dpkg-buildpackage -b -rfakeroot -us -uc -tc

Expand Down
2 changes: 1 addition & 1 deletion src/aiy/_drivers/_spicomm.py
Original file line number Diff line number Diff line change
Expand Up @@ -320,4 +320,4 @@ def transact(self, request, timeout=None):
_spicomm_types = {'sync': SyncSpicomm,
'sync_mmap': SyncSpicommMmap,
'async': AsyncSpicomm}
Spicomm = _spicomm_types.get(_spicomm_type, AsyncSpicomm)
Spicomm = _spicomm_types.get(_spicomm_type, SyncSpicommMmap)
29 changes: 18 additions & 11 deletions src/tests/vision_examples_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,31 +49,38 @@ def execute(self, cmdline, timeout):
process.wait()
self.fail('Process did not finish in time: %s' % timeout)

def test_face_detection_camera(self):
self.execute('face_detection_camera.py --num_frames 100', timeout=45.0)
def test_dish_classification(self):
image = test_image_path('hotdog.jpg')
self.execute('dish_classification.py --input %s' % image, timeout=60.0)

def test_face_detection_raspivid(self):
self.execute('face_detection_raspivid.py --num_frames 100', timeout=45.0)

def test_image_classification_camera(self):
self.execute('image_classification_camera.py --num_frames 100', timeout=45.0)
def test_dish_detection(self):
image = test_image_path('hotdog.jpg')
self.execute('dish_detection.py --input %s' % image, timeout=60.0)

def test_face_detection(self):
image = test_image_path('faces.jpg')
self.execute('face_detection.py --input %s' % image, timeout=45.0)

def test_object_detection(self):
image = test_image_path('cat.jpg')
self.execute('object_detection.py --input %s' % image, timeout=45.0)
def test_face_detection_camera(self):
self.execute('face_detection_camera.py --num_frames 100', timeout=45.0)

def test_face_detection_raspivid(self):
self.execute('face_detection_raspivid.py --num_frames 100', timeout=45.0)

def test_image_classification_mobilenet(self):
image = test_image_path('dog.jpg')
self.execute('image_classification.py --input %s' % image, timeout=45.0)

def test_image_classification_mobilenet_squeezenet(self):
def test_image_classification_squeezenet(self):
image = test_image_path('dog.jpg')
self.execute('image_classification.py --use_squeezenet --input %s' % image, timeout=45.0)

def test_image_classification_camera(self):
self.execute('image_classification_camera.py --num_frames 100', timeout=45.0)

def test_object_detection(self):
image = test_image_path('cat.jpg')
self.execute('object_detection.py --input %s' % image, timeout=45.0)

if __name__ == '__main__':
unittest.main()

0 comments on commit 7183f09

Please sign in to comment.