Unfortunately I don't have a simple example showing how to do this, but I want to say that almost everything is possible. OpenCV library has unit tests, which are built on top of gtest. And our buildbot (continuos integration system written in python) runs this tests every night on an Android device. But I will not recommend you to look into OpenCV internals, because this is large library and probably better to start from scratch...
Answers for some of you questions are below:
- Is it possible to write a shell script that will run the successfully compiled tests (e.g. $ABIN/*Test)
on the device and report the results, in the same way that unit tests work on the Mac or Linux?
Yes, it is possible. For communication with device through command line you can use adb tool. But first of all you need rooted device, otherwise you will not have access even to chmod command. If you don't know where to get rooted device, use emulator.
Then you have to build your gtests as Android console applications. They actually similar to usual console apps on linux. Having console test application you can create a shell script (or batch, python, etc) which will push the console to the device, and return you text output. adb push, adb shell chmod ..., adb shell <run>, ...
- Can I run the tests in the emulator as well as on the device?
Yes, but be careful with compilation options, because emulator has older ARM architecture (v6?). Modern devices have ARM v7 arch.
- Can I debug the tests in Eclipse?
How do I set it up?
Best regards,
Kirill Kornyakov