Hi,
I tried to build lwm2munittests from the wakaama/tests folder.
This failed for me because of missing references to the function
- utils_plainTextToInt64
- utils_plainTextToFloat64
- utils_int64ToPlainText
- utils_float64ToPlainText
- utils_opaqueToInt
I was also not able to grep the declaration nor the definitions of those, just found their usage.
For example:
wakaama $ grep -r utils_opaqueToInt .
Binary file ./tests/build/CMakeFiles/lwm2munittests.dir/tlvtests.c.o matches
./tests/tlvtests.c: length = utils_opaqueToInt(data1, sizeof(data1), &value);
./tests/tlvtests.c: length = utils_opaqueToInt(data2, sizeof(data2), &value);
./tests/tlvtests.c: length = utils_opaqueToInt(data3, sizeof(data3), &value);
./tests/tlvtests.c: length = utils_opaqueToInt(data4, sizeof(data4), &value);
It would be nice to get the tests running.
Here is my console log:
wakaama/tests/build $ cmake ..
-- The C compiler identification is GNU 4.9.4
-- The CXX compiler identification is GNU 4.9.4
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Check if the system is big endian
-- Searching 16 bit integer
-- Looking for sys/types.h
-- Looking for sys/types.h - found
-- Looking for stdint.h
-- Looking for stdint.h - found
-- Looking for stddef.h
-- Looking for stddef.h - found
-- Check size of unsigned short
-- Check size of unsigned short - done
-- Using unsigned short
-- Check if the system is big endian - little endian
-- Configuring done
-- Generating done
-- Build files have been written to: wakaama/tests/build
wakaama/tests/build $ make
+Scanning dependencies of target lwm2munittests
[ 3%] Building C object CMakeFiles/lwm2munittests.dir/block1tests.c.o
wakaama/tests/block1tests.c: In function ‘handle_12345’:
wakaama/tests/block1tests.c:26:23: warning: initialization discards ‘const’ qualifier from pointer target type
uint8_t *buffer = "12345";
^
wakaama/tests/block1tests.c: In function ‘handle_67’:
wakaama/tests/block1tests.c:37:23: warning: initialization discards ‘const’ qualifier from pointer target type
uint8_t *buffer = "67";
^
[ 7%] Building C object CMakeFiles/lwm2munittests.dir/convert_numbers_test.c.o
wakaama/tests/convert_numbers_test.c: In function ‘test_lwm2m_PlainTextToInt64’:
wakaama/tests/convert_numbers_test.c:46:9: warning: implicit declaration of function ‘utils_plainTextToInt64’ [-Wimplicit-function-declaration]
if (utils_plainTextToInt64((unsigned char*)tests[i], strlen(tests[i]), &res) != 1)
^
wakaama/tests/convert_numbers_test.c: In function ‘test_lwm2m_PlainTextToFloat64’:
wakaama/tests/convert_numbers_test.c:62:9: warning: implicit declaration of function ‘utils_plainTextToFloat64’ [-Wimplicit-function-declaration]
if (utils_plainTextToFloat64((unsigned char*)tests[i], strlen(tests[i]), &res) != 1)
^
wakaama/tests/convert_numbers_test.c: In function ‘test_lwm2m_int64ToPlainText’:
wakaama/tests/convert_numbers_test.c:79:9: warning: implicit declaration of function ‘utils_int64ToPlainText’ [-Wimplicit-function-declaration]
len = utils_int64ToPlainText(ints[i], (uint8_t**)&res);
^
wakaama/tests/convert_numbers_test.c: In function ‘test_lwm2m_float64ToPlainText’:
wakaama/tests/convert_numbers_test.c:99:9: warning: implicit declaration of function ‘utils_float64ToPlainText’ [-Wimplicit-function-declaration]
len = utils_float64ToPlainText(floats[i], (uint8_t**)&res);
^
[ 10%] Building C object CMakeFiles/lwm2munittests.dir/tlv_json_lwm2m_data_test.c.o
wakaama/tests/tlv_json_lwm2m_data_test.c:135:13: warning: ‘make_all_objects_string_types’ defined but not used [-Wunused-function]
static void make_all_objects_string_types(lwm2m_data_t * tlvP, int size)
^
[ 14%] Building C object CMakeFiles/lwm2munittests.dir/tlvtests.c.o
wakaama/tests/tlvtests.c: In function ‘test_opaqueToInt’:
wakaama/tests/tlvtests.c:101:5: warning: implicit declaration of function ‘utils_opaqueToInt’ [-Wimplicit-function-declaration]
length = utils_opaqueToInt(data1, sizeof(data1), &value);
^
[ 17%] Building C object CMakeFiles/lwm2munittests.dir/unittests.c.o
wakaama/tests/unittests.c: In function ‘lwm2m_connect_server’:
wakaama/tests/unittests.c:30:12: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
return (void *)secObjInstID;
^
wakaama/tests/unittests.c:28:36: warning: unused parameter ‘userData’ [-Wunused-parameter]
void * userData)
^
wakaama/tests/unittests.c: In function ‘lwm2m_close_connection’:
wakaama/tests/unittests.c:33:36: warning: unused parameter ‘sessionH’ [-Wunused-parameter]
void lwm2m_close_connection(void * sessionH,
^
wakaama/tests/unittests.c:34:36: warning: unused parameter ‘userData’ [-Wunused-parameter]
void * userData)
^
[ 21%] Building C object CMakeFiles/lwm2munittests.dir/uritests.c.o
[ 25%] Building C object CMakeFiles/lwm2munittests.dirwakaama/core/liblwm2m.c.o
[ 28%] Building C object CMakeFiles/lwm2munittests.dirwakaama/core/uri.c.o
[ 32%] Building C object CMakeFiles/lwm2munittests.dirwakaama/core/utils.c.o
[ 35%] Building C object CMakeFiles/lwm2munittests.dirwakaama/core/objects.c.o
wakaama/core/objects.c: In function ‘object_getRegisterPayloadBufferLength’:
wakaama/core/objects.c:556:40: warning: pointer targets in passing argument 1 of ‘prv_getObjectTemplate’ differ in signedness [-Wpointer-sign]
result = prv_getObjectTemplate(buffer, sizeof(buffer), objectP->objID);
^
wakaama/core/objects.c:502:12: note: expected ‘uint8_t *’ but argument is of type ‘char *’
static int prv_getObjectTemplate(uint8_t * buffer,
^
wakaama/core/objects.c:576:55: warning: pointer targets in passing argument 2 of ‘utils_intToText’ differ in signedness [-Wpointer-sign]
result = utils_intToText(targetP->id, buffer, sizeof(buffer));
^
In file included from wakaama/core/objects.c:53:0:
wakaama/core/internals.h:329:8: note: expected ‘uint8_t *’ but argument is of type ‘char *’
size_t utils_intToText(int64_t data, uint8_t * string, size_t length);
^
[ 39%] Building C object CMakeFiles/lwm2munittests.dirwakaama/core/tlv.c.o
[ 42%] Building C object CMakeFiles/lwm2munittests.dirwakaama/core/data.c.o
[ 46%] Building C object CMakeFiles/lwm2munittests.dirwakaama/core/list.c.o
[ 50%] Building C object CMakeFiles/lwm2munittests.dirwakaama/core/packet.c.o
[ 53%] Building C object CMakeFiles/lwm2munittests.dirwakaama/core/transaction.c.o
[ 57%] Building C object CMakeFiles/lwm2munittests.dirwakaama/core/registration.c.o
wakaama/core/registration.c: In function ‘prv_getRegistrationQueryLength’:
wakaama/core/registration.c:110:49: warning: pointer targets in passing argument 2 of ‘utils_intToText’ differ in signedness [-Wpointer-sign]
res = utils_intToText(server->lifetime, buffer, sizeof(buffer));
^
In file included from wakaama/core/registration.c:57:0:
wakaama/core/internals.h:329:8: note: expected ‘uint8_t *’ but argument is of type ‘char *’
size_t utils_intToText(int64_t data, uint8_t * string, size_t length);
^
wakaama/core/registration.c: In function ‘prv_getRegistrationQuery’:
wakaama/core/registration.c:173:49: warning: pointer targets in passing argument 2 of ‘utils_intToText’ differ in signedness [-Wpointer-sign]
res = utils_intToText(server->lifetime, buffer + index, length - index);
^
In file included from wakaama/core/registration.c:57:0:
wakaama/core/internals.h:329:8: note: expected ‘uint8_t *’ but argument is of type ‘char *’
size_t utils_intToText(int64_t data, uint8_t * string, size_t length);
^
wakaama/core/registration.c: In function ‘prv_handleDeregistrationReply’:
wakaama/core/registration.c:535:50: warning: unused parameter ‘message’ [-Wunused-parameter]
void * message)
^
[ 60%] Building C object CMakeFiles/lwm2munittests.dirwakaama/core/bootstrap.c.o
[ 64%] Building C object CMakeFiles/lwm2munittests.dirwakaama/core/management.c.o
[ 67%] Building C object CMakeFiles/lwm2munittests.dirwakaama/core/observe.c.o
wakaama/core/observe.c: In function ‘observe_handleRequest’:
wakaama/core/observe.c:159:35: warning: unused parameter ‘size’ [-Wunused-parameter]
int size,
^
[ 71%] Building C object CMakeFiles/lwm2munittests.dirwakaama/core/json.c.o
[ 75%] Building C object CMakeFiles/lwm2munittests.dirwakaama/core/discover.c.o
[ 78%] Building C object CMakeFiles/lwm2munittests.dirwakaama/core/block1.c.o
[ 82%] Building C object CMakeFiles/lwm2munittests.dirwakaama/core/er-coap-13/er-coap-13.c.o
wakaama/core/er-coap-13/er-coap-13.c: In function ‘coap_get_query_variable’:
wakaama/core/er-coap-13/er-coap-13.c:854:31: warning: unused parameter ‘packet’ [-Wunused-parameter]
coap_get_query_variable(void *packet, const char *name, const char **output)
^
wakaama/core/er-coap-13/er-coap-13.c:854:51: warning: unused parameter ‘name’ [-Wunused-parameter]
coap_get_query_variable(void *packet, const char *name, const char **output)
^
wakaama/core/er-coap-13/er-coap-13.c:854:70: warning: unused parameter ‘output’ [-Wunused-parameter]
coap_get_query_variable(void *packet, const char *name, const char **output)
^
[ 85%] Building C object CMakeFiles/lwm2munittests.dirwakaama/examples/shared/commandline.c.o
[ 89%] Building C object CMakeFiles/lwm2munittests.dirwakaama/examples/shared/platform.c.o
[ 92%] Building C object CMakeFiles/lwm2munittests.dirwakaama/examples/shared/memtrace.c.o
[ 96%] Building C object CMakeFiles/lwm2munittests.dirwakaama/examples/shared/connection.c.o
wakaama/examples/shared/connection.c: In function ‘lwm2m_buffer_send’:
wakaama/examples/shared/connection.c:206:34: warning: unused parameter ‘userdata’ [-Wunused-parameter]
void * userdata)
^
wakaama/examples/shared/connection.c: In function ‘lwm2m_session_is_equal’:
wakaama/examples/shared/connection.c:227:36: warning: unused parameter ‘userData’ [-Wunused-parameter]
void * userData)
^
[100%] Linking C executable lwm2munittests
CMakeFiles/lwm2munittests.dir/convert_numbers_test.c.o: In function `test_lwm2m_PlainTextToInt64':
convert_numbers_test.c:(.text+0x49): undefined reference to `utils_plainTextToInt64'
CMakeFiles/lwm2munittests.dir/convert_numbers_test.c.o: In function `test_lwm2m_PlainTextToFloat64':
convert_numbers_test.c:(.text+0xfb): undefined reference to `utils_plainTextToFloat64'
CMakeFiles/lwm2munittests.dir/convert_numbers_test.c.o: In function `test_lwm2m_int64ToPlainText':
convert_numbers_test.c:(.text+0x1bc): undefined reference to `utils_int64ToPlainText'
CMakeFiles/lwm2munittests.dir/convert_numbers_test.c.o: In function `test_lwm2m_float64ToPlainText':
convert_numbers_test.c:(.text+0x289): undefined reference to `utils_float64ToPlainText'
CMakeFiles/lwm2munittests.dir/tlvtests.c.o: In function `test_opaqueToInt':
tlvtests.c:(.text+0x6fa): undefined reference to `utils_opaqueToInt'
tlvtests.c:(.text+0x773): undefined reference to `utils_opaqueToInt'
tlvtests.c:(.text+0x7ee): undefined reference to `utils_opaqueToInt'
tlvtests.c:(.text+0x869): undefined reference to `utils_opaqueToInt'
collect2: error: ld returned 1 exit status
make[2]: *** [lwm2munittests] Error 1
make[1]: *** [CMakeFiles/lwm2munittests.dir/all] Error 2
make: *** [all] Error 2
Best regards,
Marcel
____________________________________________________________
Marcel Makowski
Dipl.-Math.
Software Engineer
Smart Grid
devolo AG
Charlottenburger Allee 67
52068 Aachen . Germany
Phone: +49 241 182 79-182
E-Mail: marcel.makowski@xxxxxxxxx
Website: www.devolo.de
Sitz der Gesellschaft: Aachen . Registergericht: Amtsgericht Aachen, HRB 8931
Vorstandsvorsitzender: Heiko Harbers . Aufsichtsratsvorsitzender: Georg Wazinski
____________________________________________________________