Unit Test Requirements:
-1. Install Google Test 1.7.0 on a Linux build machine to <gtest-1.7.0> from the
- following address:
-
- http://code.google.com/p/googletest/downloads/list
-
-2. Create/Append a file named "local.properties" at <oic-resource>/csdk.
- "local.properties" is used by the build process to specify the path to the
- Google Test directory.
-
- local.properties should contain GTEST_DIR, as follows:
-
- GTEST_DIR := <gtest-1.7.0>
-
-3. To run the unit test, first build the unit tests with the following command
+1. To run the unit test, first build the unit tests with the following command
from <oic-resource>:
make -f buildScript.mk linux_ub_unittests
-4. Run the unit test by issuing the following command from <oic-resource>:
+2. Run the unit test by issuing the following command from <oic-resource>:
./unittests/tests
# You must create the file "local.properties" on your local machine which contains any local paths, etc
# local.properties should NOT be committed to repo
include $(ROOT_DIR)/../csdk/local.properties
-# GTEST_DIR contains the path to Google Test libs and must be defined in local.properties
-# Example:
-# GTEST_DIR := /home/johndoe/utils/gtest-1.7.0
-
-# NOTE: to run app, make sure that LD_LIBRARY_PATH env variable
-# contains $(GTEST_DIR)/lib/.libs
+GTEST_DIR= ../../extlibs/gtest-1.7.0
OUT_DIR := $(BUILD)
ifeq ($(ROOT_DIR),)
LIB_OC_LOGGER := ../oc_logger/lib/oc_logger.a
+GTEST_LIBS := $(GTEST_DIR)/lib/.libs/libgtest.a $(GTEST_DIR)/lib/.libs/libgtest_main.a
CXX_LIBS := ../$(BUILD)/obj/liboc.a ../csdk/$(PLATFORM)/$(BUILD)/liboctbstack.a $(LIB_OC_LOGGER)
-CXX_LIBS += $(GTEST_DIR)/lib/.libs/libgtest.a $(GTEST_DIR)/lib/.libs/libgtest_main.a
+CXX_LIBS += $(GTEST_LIBS)
CC_FLAGS.debug := -g -O0 -g3 -Wall -ffunction-sections -fdata-sections \
-std=c++0x -pedantic $(INC_DIRS) -L$(ROOT_DIR)/$(BUILD) -DTB_LOG
prep_dirs:
-mkdir -p $(OUT_DIR)
-tests: tests.cpp
+tests: tests.cpp $(GTEST_LIBS)
$(CXX) $^ $(CPPFLAGS) -o $(OUT_DIR)/$@
+$(GTEST_LIBS): $(GTEST_DIR)
+ cd $(GTEST_DIR) && ./configure && make
+
+$(GTEST_DIR):
+ cd ../../extlibs && \
+ wget -q https://googletest.googlecode.com/files/gtest-1.7.0.zip && \
+ unzip gtest-1.7.0.zip
+
.PHONY: clean
clean: