fix compile for some of the tests, single Makefile for subset

This commit is contained in:
Matthias Ringwald 2015-05-14 08:25:34 +02:00
parent 3df1d63fe3
commit cbe987fb1e
7 changed files with 53 additions and 43 deletions

View File

@ -5,6 +5,7 @@ $ git clone https://github.com/cpputest/cpputest.git
Compile and install
$ cd cpputest
$ ./autogen.sh
$ ./configure
$ make
$ sudo make install

View File

@ -5,22 +5,26 @@ CC = g++
BTSTACK_ROOT = ../..
CPPUTEST_HOME = ${BTSTACK_ROOT}/test/cpputest
CFLAGS = -g -Wall -I. -I${BTSTACK_ROOT}/example/libusb -I${BTSTACK_ROOT}/src -I${BTSTACK_ROOT}/ble -I${BTSTACK_ROOT}/include -I$(CPPUTEST_HOME)/include
CFLAGS = -g -Wall -I.. -I${BTSTACK_ROOT}/example/libusb -I${BTSTACK_ROOT}/src -I${BTSTACK_ROOT}/ble -I${BTSTACK_ROOT}/include -I$(CPPUTEST_HOME)/include
LDFLAGS += -L$(CPPUTEST_HOME)/lib -lCppUTest -lCppUTestExt
VPATH += ${BTSTACK_ROOT}/ble
VPATH += ${BTSTACK_ROOT}/src
VPATH += ${BTSTACK_ROOT}/platforms/posix/src
COMMON = \
${BTSTACK_ROOT}/src/utils.c \
${BTSTACK_ROOT}/src/btstack_memory.c \
${BTSTACK_ROOT}/src/memory_pool.c \
${BTSTACK_ROOT}/src/linked_list.c \
${BTSTACK_ROOT}/src/sdp_util.c \
${BTSTACK_ROOT}/src/remote_device_db_memory.c \
${BTSTACK_ROOT}/src/run_loop.c \
${BTSTACK_ROOT}/src/run_loop_posix.c \
${BTSTACK_ROOT}/src/hci_cmds.c \
${BTSTACK_ROOT}/src/hci_dump.c \
${BTSTACK_ROOT}/src/hci.c \
${BTSTACK_ROOT}/ble/ad_parser.c \
utils.c \
btstack_memory.c \
memory_pool.c \
linked_list.c \
sdp_util.c \
remote_device_db_memory.c \
run_loop.c \
run_loop_posix.c \
hci_cmds.c \
hci_dump.c \
hci.c \
ad_parser.c \
COMMON_OBJ = $(COMMON:.c=.o)
@ -31,6 +35,6 @@ ad_parser: ${CORE_OBJ} ${COMMON_OBJ} advertising_data_parser.c
clean:
rm -f ad_parser le_central
rm -f *.o ${BTSTACK_ROOT}/src/*.o
rm -f *.o
rm -rf *.dSYM

View File

@ -8,20 +8,25 @@ CPPUTEST_HOME = ${BTSTACK_ROOT}/test/cpputest
CFLAGS = -DUNIT_TEST -x c++ -g -Wall -I. -I../ -I${BTSTACK_ROOT}/src -I${BTSTACK_ROOT}/ble -I${BTSTACK_ROOT}/include -I$(CPPUTEST_HOME)/include
LDFLAGS += -L$(CPPUTEST_HOME) -lCppUTest -lCppUTestExt
VPATH += ${BTSTACK_ROOT}/ble
VPATH += ${BTSTACK_ROOT}/src
VPATH += ${BTSTACK_ROOT}/platforms/posix/src
COMMON = \
${BTSTACK_ROOT}/src/utils.c \
${BTSTACK_ROOT}/src/btstack_memory.c \
${BTSTACK_ROOT}/src/memory_pool.c \
${BTSTACK_ROOT}/src/linked_list.c \
${BTSTACK_ROOT}/src/sdp_util.c \
${BTSTACK_ROOT}/src/remote_device_db_memory.c \
${BTSTACK_ROOT}/src/hci_cmds.c \
${BTSTACK_ROOT}/src/hci.c \
${BTSTACK_ROOT}/src/hci_dump.c \
${BTSTACK_ROOT}/ble/att_dispatch.c \
${BTSTACK_ROOT}/ble/att.c \
${BTSTACK_ROOT}/ble/ad_parser.c \
${BTSTACK_ROOT}/ble/gatt_client.c \
utils.c \
btstack_memory.c \
memory_pool.c \
linked_list.c \
sdp_util.c \
remote_device_db_memory.c \
hci_cmds.c \
hci.c \
hci_dump.c \
att_dispatch.c \
att.c \
ad_parser.c \
gatt_client.c \
gatt_client_test.c \
mock.c
@ -41,6 +46,6 @@ le_central: ${CORE_OBJ} ${COMMON_OBJ} le_central.o
clean:
rm -f gatt_client le_central
rm -f *.o ${BTSTACK_ROOT}/src/*.o ${BTSTACK_ROOT}/ble/*.o
rm -f *.o *.o ${BTSTACK_ROOT}/ble/*.o
rm -rf *.dSYM

View File

@ -31,16 +31,16 @@ TEST(RemoteDeviceDB, SinglePutGetDeleteKey){
link_key_t test_link_key;
link_key_type_t test_link_key_type;
remote_device_db_fs_instance()->delete_link_key(&bd_addr);
CHECK(remote_device_db_fs_instance()->get_link_key(&bd_addr, &test_link_key, &test_link_key_type) == 0);
remote_device_db_fs_instance()->delete_link_key(bd_addr);
CHECK(remote_device_db_fs_instance()->get_link_key(bd_addr, test_link_key, &test_link_key_type) == 0);
remote_device_db_fs_instance()->put_link_key(&bd_addr, &link_key, link_key_type);
CHECK(remote_device_db_fs_instance()->get_link_key(&bd_addr, &test_link_key, &test_link_key_type) == 1);
remote_device_db_fs_instance()->put_link_key(bd_addr, link_key, link_key_type);
CHECK(remote_device_db_fs_instance()->get_link_key(bd_addr, test_link_key, &test_link_key_type) == 1);
CHECK(strcmp(link_key_to_str(link_key), link_key_to_str(test_link_key)) == 0);
remote_device_db_fs_instance()->delete_link_key(&bd_addr);
CHECK(remote_device_db_fs_instance()->get_link_key(&bd_addr, &test_link_key, &test_link_key_type) == 0);
remote_device_db_fs_instance()->delete_link_key(bd_addr);
CHECK(remote_device_db_fs_instance()->get_link_key(bd_addr, test_link_key, &test_link_key_type) == 0);
}

View File

@ -82,27 +82,27 @@ TEST(RemoteDeviceDB, SortByLastUsedName){
TEST(RemoteDeviceDB, SinglePutGetDeleteKey){
sprintf((char*)link_key, "%d", 100);
remote_device_db_memory.put_link_key(addr1, &link_key, link_key_type);
remote_device_db_memory.put_link_key(addr1, link_key, link_key_type);
// dump(db_mem_link_keys);
CHECK(remote_device_db_memory.get_link_key(addr1, &link_key, &link_key_type));
CHECK(remote_device_db_memory.get_link_key(addr1, link_key, &link_key_type));
remote_device_db_memory.delete_link_key(addr1);
CHECK(!remote_device_db_memory.get_link_key(addr1, &link_key, &link_key_type));
CHECK(!remote_device_db_memory.get_link_key(addr1, link_key, &link_key_type));
}
TEST(RemoteDeviceDB, SortByLastUsedKey){
sprintf((char*)link_key, "%d", 10);
remote_device_db_memory.put_link_key(addr1, &link_key, link_key_type);
remote_device_db_memory.put_link_key(addr1, link_key, link_key_type);
// dump(db_mem_link_keys);
sprintf((char*)link_key, "%d", 20);
remote_device_db_memory.put_link_key(addr2, &link_key, link_key_type);
remote_device_db_memory.put_link_key(addr2, link_key, link_key_type);
// dump(db_mem_link_keys);
sprintf((char*)link_key, "%d", 30);
remote_device_db_memory.put_link_key(addr3, &link_key, link_key_type);
remote_device_db_memory.put_link_key(addr3, link_key, link_key_type);
// dump(db_mem_link_keys);
CHECK(remote_device_db_memory.get_link_key(addr2, &link_key, &link_key_type));
CHECK(remote_device_db_memory.get_link_key(addr2, link_key, &link_key_type));
// dump(db_mem_link_keys);
//get first element of the list

View File

@ -16,7 +16,7 @@ COMMON = \
${BTSTACK_ROOT}/src/sdp_util.c \
${BTSTACK_ROOT}/src/remote_device_db_memory.c \
${BTSTACK_ROOT}/src/run_loop.c \
${BTSTACK_ROOT}/src/run_loop_posix.c \
${BTSTACK_ROOT}/platforms/posix/src/run_loop_posix.c \
${BTSTACK_ROOT}/src/hci_cmds.c \
${BTSTACK_ROOT}/src/hci_dump.c \
${BTSTACK_ROOT}/ble/sm.c \
@ -36,6 +36,6 @@ aestest: aestest.c rijndael.c
clean:
rm -f security_manager
rm -f *.o ${BTSTACK_ROOT}/src/*.o
rm -f *.o
rm -rf *.dSYM