summaryrefslogtreecommitdiff
path: root/tests/gtest_dlt_common.cpp
Commit message (Collapse)AuthorAgeFilesLines
* gtest: Correct data amount in gtest_dlt_commonSaya Sugiura2021-10-051-14/+18
| | | | | | | gtest_dlt_common was failing when ring buffer size was modified. Amount of data to be written is corrected in the test code. Signed-off-by: Saya Sugiura <ssugiura@jp.adit-jv.com>
* dlt_common: correct read/write positionDinh Cong Toan2021-06-301-4/+31
| | | | | | | | | In dlt_buffer_read_block() and dlt_buffer_write_block(), read/write position should be updated in case these positions are equal to the size of ringbuffer. Adding boundary check in gtest_dlt_common.cpp Signed-off-by: Dinh Cong Toan <toan.dinhcong@vn.bosch.com>
* Alternative solutions for json-c dependencyBiastoch, Darian (ADITG/ESM)2021-06-301-73/+0
| | | | | | | json-c dependency was removed from libdlt ('dlt_common') and shifted into 'dlt-control-common'. By this only the command line tools have a dependency on json-c. dlt-control-common is now built as a static library, so that it can be linked against json-c. Command line tools that included only the .c file of dlt-control-common before, are now linked against this static libarary (see console/CMakeLists.txt). Signed-off-by: dbiastoch <dbiastoch@de.adit-jv.com>
* dlt-receive: Implemented gtest for extended filteringdbiastoch2021-06-301-0/+73
| | | | | | | | -Added 'testfile_extended.dlt', which extends the default 'testfile.dlt' by messages with very different lenghts, log levels, ContextIDs and AppIDs -Added 'testfilter.json', which contains a valide json filter file -Implemented gtest 't_dlt_message_print_ascii_with_json_filter' in 'gtest_dlt_common.cpp' to test the correct behavior of extended filtering and the json filter file parsing Signed-off-by: dbiastoch <dbiastoch@de.adit-jv.com>
* Avoid memory access errors with 4-chars context ids (#250)Martin Willers2020-11-171-0/+43
| | | | | | | | | | | | | | | | | | | | | | | | For a 4-chars CTXID, i.e. one that does not include a null character, the strlen() calls were happily accessing memory until they eventually encountered a null character somewhere in memory. This was detected by valgrind, which reported a memory error when using a CTXID such as "INTM": ==21924== Conditional jump or move depends on uninitialised value(s) ==21924== at 0x4C30F78: strlen (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so) ==21924== by 0x4E4B5A0: dlt_print_id (dlt_common.c:303) ==21924== by 0x4E4CF47: dlt_message_header_flags (dlt_common.c:687) ==21924== by 0x4E51434: dlt_message_print_ascii (dlt_common.c:3169) ==21924== by 0x4E4247A: dlt_user_print_msg (dlt_user.c:4108) ==21924== by 0x4E46D92: dlt_user_log_send_log (dlt_user.c:3670) ==21924== by 0x4E46F14: dlt_user_log_write_finish (dlt_user.c:1611) Sanitize some code Using memset() and memcpy() is always preferable to hand-rolled loops, because compilers have built-in support for them. Signed-off-by: Martin Willers <M.Willers@gmx.net>
* Unittest for new apiBui Nguyen Quoc Thanh2020-07-061-1/+55
| | | | | | | Add two new testcases in tests/gtest_dlt_common.cpp for dlt_file_quick_parsing() Signed-off-by: Bui Nguyen Quoc Thanh <thanh.buinguyenquoc@vn.bosch.com>
* Redirect stdout to stderrLUONG HONG DUY KHANH(RBVH/ENG42)2020-07-061-4/+10
| | | | | | | | | | | | - daemon: New feature for LoggingMode at /etc/dlt.conf to be able to set value at 3 in order to redirect all stdout messages to stderr. - libdlt: New feature for DLT_LOG_MODE environment variable to be able to set value at 3 in order to redirect all stdout messages to stderr. - unit test: Add test cases for DLT_LOG_TO_STDERR Signed-off-by: LUONG HONG DUY KHANH(RBVH/ENG42) <KHANH.LUONGHONGDUY@vn.bosch.com>
* Avoided Seg fault in dlt_message_payload (#179) (#181)Vo Trung Chi2019-11-141-42/+29
| | | | | | | | | * Avoided Seg fault in dlt_message_payload (#179) Avoided Seg fault by adding boundary check before buffer access. Signed-off-by: Ravi Sankar P <ponnurangamravi.sankar@in.bosch.com> Signed-off-by: Vo Trung Chi <chi.votrung@vn.bosch.com>
* doxygen: Remove licenceSaya Sugiura2019-07-191-2/+0
| | | | Signed-off-by: Saya Sugiura <ssugiura@jp.adit-jv.com>
* Code beautification using uncrustifyChristoph Lipka2018-12-211-1689/+1995
| | | | Signed-off-by: Christoph Lipka <clipka@de.adit-jv.com>
* UnitTest: UpdatesManikandanC2018-12-211-23/+10
| | | | | | | | | | | | Gateway Logstorage Event Handler Signed-off-by: Christoph Lipka <clipka@de.adit-jv.com> Signed-off-by: S. Hameed <shameed@jp.adit-jv.com> Signed-off-by: Aditya Paluri <venkataaditya.paluri@in.bosch.com> Signed-off-by: Saya Sugiura <ssugiura@jp.adit-jv.com> Signed-off-by: ManikandanC <Manikandan.Chockalingam@in.bosch.com>
* minor compiler warning gcc 7.x (#30)Phong Tran2018-03-291-2/+15
| | | | | | | | | | | | | | | | | | | | | | | | | | | | * Fix -Wpointer-compare of compare with null char Signed-off-by: Phong Tran <tranmanphong@gmail.com> * dlt_common: fix -Wformat-truncation of snprintf Avoid snprintf output truncation by handling return value Signed-off-by: Phong Tran <tranmanphong@gmail.com> * dlt_offline_trace: Fix Wformat-truncation of snprintf Compile with Gcc 7.x has the warning of snprintf buffer length size. Check return value of snprintf() for avoiding the warning. Signed-off-by: Phong Tran <tranmanphong@gmail.com> * dlt_common_test: Fix memleak t_dlt_message_read some resources were not free after using. Detected by running valgrind --leak-check=full ./gtest_dlt_common Signed-off-by: Phong Tran <tranmanphong@gmail.com>
* Purged all warnings for -Wall -WextraLutz Helwing2015-10-281-59/+149
| | | | Signed-off-by: Alexander Wenzel <Alexander.AW.Wenzel@bmw.de>
* DLT daemon improvement - dlt_init()-checkLutz Helwing2015-10-071-1268/+1267
| | | | | | | | | | DLT daemon improvement - parameter value range check Adapt unit tests to check for enum return values Changed C version to gnu99 and C++ version to gnu++0c Signed-off-by: Alexander Wenzel <Alexander.AW.Wenzel@bmw.de>
* Fixed whitespace and formatting of new code Fixed licence headersLutz Helwing2015-10-071-2/+0
| | | | Signed-off-by: Alexander Wenzel <Alexander.AW.Wenzel@bmw.de>
* Cleanup masterStefan Vacek2015-10-071-12/+12
| | | | | | | - remove compiler warnings - fix file permissions Signed-off-by: Stefan Vacek <stefan.vacek@intel.com>
* Rework of unit testsStefan Held2015-07-211-459/+342
| | | | | Signed-off-by: Stefan Held <stefan_held@mentor.com> Signed-off-by: Alexander Wenzel <Alexander.AW.Wenzel@bmw.de>
* Added licence and Doxygen headersLutz Helwing2015-07-211-0/+27
| | | | Signed-off-by: Alexander Wenzel <Alexander.AW.Wenzel@bmw.de>
* Rework of unit tests in gtest_dlt_commonStefan Held2015-07-211-226/+377
| | | | | | | Fix all nullpointer errors in dlt_common.c Signed-off-by: Stefan Held <stefan_held@mentor.com> Signed-off-by: Alexander Wenzel <Alexander.AW.Wenzel@bmw.de>
* rework v2 of all unit tests added dlt_daemon_application* unit tests added ↵Stefan Held2015-06-171-1084/+1069
| | | | | | | | | | dlt_daemon_context* unit tests added dlt_daemon_user_send* unit tests comment out all unit tests who fail the test for further bugfixing Signed-off-by: Stefan Held <stefan_held@mentor.com> Conflicts: tests/CMakeLists.txt Signed-off-by: Alexander Wenzel <Alexander.AW.Wenzel@bmw.de>
* added the following unit tests for dlt_common.cStefan Held2015-06-171-21/+428
| | | | | | | | | | | | | | | dlt_uptime dlt_set_id dlt_print_char_string dlt_print_hex_string dlt_print_mixed_string dlt_print_id dlt_get_version dlt_get_major_version dlt_get_minor_version Signed-off-by: Stefan Held <stefan_held@mentor.com> Signed-off-by: Alexander Wenzel <Alexander.AW.Wenzel@bmw.de>
* added dlt_log_* unit tests rework of dlt_buffer_* and dlt_messages_* unit testsStefan Held2015-06-171-696/+1071
| | | | | Signed-off-by: Stefan Held <stefan_held@mentor.com> Signed-off-by: Alexander Wenzel <Alexander.AW.Wenzel@bmw.de>
* 1st version of gtest now the following methods can be tested dlt_common -> ↵Stefan Held2015-06-171-0/+2938
dlt_buffer_* dlt_common -> dlt_message_* Signed-off-by: Stefan Held <stefan_held@mentor.com> Conflicts: tests/CMakeLists.txt Signed-off-by: Alexander Wenzel <Alexander.AW.Wenzel@bmw.de>