Google C++ unit test 是一款很不错的单元测试工具,易于构建单元测试例。我们在项目中也使用了此款工具,本文主要描述如何在ARMAndroid 2.3 环境下编译及使用googleC++ unit test 工具。本文假设读者已具备googleC++ unit test相应的基本知识。 如需了解基本知识,请参阅http://code.google.com/p/googletest/
1. 编译
我们项目所用的编译器:arm-linux-androideabi-g++及其相应工具链
从http://code.google.com/p/googletest/downloads/detail?name=gtest-1.6.0.zip处获取gtest-1.6.0.zip
a) 下载解压后,需更新build-aux目录下的 config.sub 。此为必须,否则将不能识别arm-linux-androideabi工具链。Config.sub可从http://gcc.gnu.org/svn/gcc/branches/cilkplus/config.sub 获取。
b) 然后执行./configure –host= arm-linux-androideabi
c) 此后会生成Makefile