diff --git a/test/README b/test/README index 75d923c88..814dc0bbb 100644 --- a/test/README +++ b/test/README @@ -5,6 +5,7 @@ $ git clone https://github.com/cpputest/cpputest.git Compile and install $ cd cpputest +$ ./autogen.sh $ ./configure $ make $ sudo make install diff --git a/test/ble_client/Makefile b/test/ble_client/Makefile index 20fd5ed7a..82ad3b502 100644 --- a/test/ble_client/Makefile +++ b/test/ble_client/Makefile @@ -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 \ No newline at end of file diff --git a/test/gatt_client/Makefile b/test/gatt_client/Makefile index 9e5da2084..00efc1f0f 100644 --- a/test/gatt_client/Makefile +++ b/test/gatt_client/Makefile @@ -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 \ No newline at end of file diff --git a/test/gatt_client/gatt_client.c b/test/gatt_client/gatt_client_test.c similarity index 100% rename from test/gatt_client/gatt_client.c rename to test/gatt_client/gatt_client_test.c diff --git a/test/remote_device_db/remote_device_db_fs_test.c b/test/remote_device_db/remote_device_db_fs_test.c index d82560e73..df733c2c0 100644 --- a/test/remote_device_db/remote_device_db_fs_test.c +++ b/test/remote_device_db/remote_device_db_fs_test.c @@ -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); } diff --git a/test/remote_device_db/remote_device_db_memory_test.c b/test/remote_device_db/remote_device_db_memory_test.c index eeed3192e..d80a65366 100644 --- a/test/remote_device_db/remote_device_db_memory_test.c +++ b/test/remote_device_db/remote_device_db_memory_test.c @@ -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 diff --git a/test/security_manager/Makefile b/test/security_manager/Makefile index 7b34257e2..e326269b4 100644 --- a/test/security_manager/Makefile +++ b/test/security_manager/Makefile @@ -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 \ No newline at end of file