platform/core/system/dlog.git
5 years agoconfig: Move persistent logging configuration to separate config file 06/202906/5 accepted/tizen/unified/20190512.221838 submit/tizen/20190510.025027
Karol Lewandowski [Thu, 4 Apr 2019 14:31:17 +0000 (16:31 +0200)]
config: Move persistent logging configuration to separate config file

This will allow easy enabling/disabling this functionality by just
removing/not installing package which provides this file.

Change-Id: I4cdabed301c32c977b09f062ad7da93377b572fa

5 years agoMove config files from /opt/etc to /etc 18/205818/2
Karol Lewandowski [Wed, 8 May 2019 14:50:55 +0000 (16:50 +0200)]
Move config files from /opt/etc to /etc

Dlog configuration is not supposed to be modified on production
images, so it's safe to move it to /etc.

This allows us to drop not only the upgrade script as in this
case configuration is guaranteed to be updated with dlog itself,
but also complex package posttrans, as used for conversion from
dlog.conf being symlink to regular file.

Change-Id: Id28c66ad32b0f1c69b9935a19455f621850ecae3

5 years agoSet to NULL after memory free 97/205797/1 accepted/tizen/unified/20190510.111058 submit/tizen/20190509.082731
Yunmi Ha [Thu, 9 May 2019 08:05:49 +0000 (17:05 +0900)]
Set to NULL after memory free

Change-Id: I282d527e396c029b3edf25fe3acaedd95f214902
Signed-off-by: Yunmi Ha <yunmi.ha@samsung.com>
5 years agoModify platform upgrade scripts 23/202923/1
Hyotaek Shim [Mon, 8 Apr 2019 02:28:31 +0000 (11:28 +0900)]
Modify platform upgrade scripts

Change-Id: Id737055332994dff6297468a41c7799f91e20c4b

5 years agoAdd missed test case for the destructor 02/200902/1
Michal Bloch [Fri, 22 Feb 2019 20:19:54 +0000 (21:19 +0100)]
Add missed test case for the destructor

Change-Id: I66e3b583958f8559e0ae5514a90969637f190a45
Signed-off-by: Michal Bloch <m.bloch@samsung.com>
5 years agoFix minor issues 81/200881/1
Michal Bloch [Mon, 4 Mar 2019 19:13:19 +0000 (20:13 +0100)]
Fix minor issues

Change-Id: I884338a99299dba756ed0a6dd9510f1ff111efe9
Signed-off-by: Michal Bloch <m.bloch@samsung.com>
5 years agologger: documentation/clean code 28/200828/2
Michal Bloch [Mon, 4 Mar 2019 15:54:45 +0000 (16:54 +0100)]
logger: documentation/clean code

Change-Id: I5a24e7fb6c3911c55db46d97a4d1f1524dd3e9c5
Signed-off-by: Michal Bloch <m.bloch@samsung.com>
5 years agolibdlog: readd the destructor 16/199816/10
Michal Bloch [Fri, 22 Feb 2019 16:23:18 +0000 (17:23 +0100)]
libdlog: readd the destructor

Change-Id: I0fdd0e93d55e7d8055b50600378972c0e11e685a
Signed-off-by: Michal Bloch <m.bloch@samsung.com>
5 years agoFix SVACE complaints 39/200239/2
Michal Bloch [Mon, 18 Feb 2019 15:08:01 +0000 (16:08 +0100)]
Fix SVACE complaints

Change-Id: I86797e6ccad42527e687cbf3c2557b29c17804de
Signed-off-by: Michal Bloch <m.bloch@samsung.com>
5 years agolibdlog: improve concurrency 00/200400/2
Michal Bloch [Fri, 22 Feb 2019 13:30:12 +0000 (14:30 +0100)]
libdlog: improve concurrency

Use rwlocks since they are faster than a mutex in the common case
where only reads happen. Made locks more granular to prevent the
case where writing one resource prevents reading a different one.

Change-Id: Ifdee42dae8a3e03c56be259551059c28d6798630

5 years agolibdlog: construct with the maximum priority 99/200399/1
Michal Bloch [Fri, 22 Feb 2019 13:28:36 +0000 (14:28 +0100)]
libdlog: construct with the maximum priority

Change-Id: I4ee302ef4f016d1ba43ed5da6e4ddd6cd59f5122

5 years agoRevert "Revert "libdlog: initialise through attribute constructor"" 40/200240/2
Hyotaek Shim [Wed, 20 Feb 2019 11:18:28 +0000 (11:18 +0000)]
Revert "Revert "libdlog: initialise through attribute constructor""

This reverts commit b6fc587b29893517472bb84ad7e98a8ed212e2e8.

Change-Id: I4c2dc6b27dbeb486490df4b98d116a310137662f

5 years agotests: cover some recently added cases 27/200127/2
Michal Bloch [Mon, 18 Feb 2019 14:43:06 +0000 (15:43 +0100)]
tests: cover some recently added cases

Change-Id: I56d8bcd3e75a0b0eda72ba928e18c77f1126b18c
Signed-off-by: Michal Bloch <m.bloch@samsung.com>
5 years agospec: remove unnecessary / 17/200117/2
INSUN PYO [Tue, 19 Feb 2019 08:22:00 +0000 (17:22 +0900)]
spec: remove unnecessary /

Change-Id: Ibc31e92d8db6390a70097ccac380851a41327675

5 years agoFix a minor typo 63/200063/1
Michal Bloch [Mon, 18 Feb 2019 15:03:07 +0000 (16:03 +0100)]
Fix a minor typo

Change-Id: I731d40935df0612c45f2d59ca09c5f2cf424c5eb
Signed-off-by: Michal Bloch <m.bloch@samsung.com>
5 years agoRevert "libdlog: initialise through attribute constructor" 15/199815/3 accepted/tizen/unified/20190218.163242 submit/tizen/20190218.011546
Michal Bloch [Thu, 14 Feb 2019 11:57:21 +0000 (12:57 +0100)]
Revert "libdlog: initialise through attribute constructor"

This reverts commit a1ffe213e5c242a7e10e65e49cb50b6fae945ed8.

Multiple Tizen daemons close all descriptors and only then try
to do logging. Initialising the library on first use means that
this use case works correctly. Meanwhile, with constructor-based
initialisation, this mass close affects all dlog FDs. While in
general this won't help if somebody sends a log and then closes
FDs, it means that the most common use case (somewhat enforced
by previous dlog behaviour) is solved.

Change-Id: Ic4e72a5d88c2050bcd20f781793a563ddbc49347

5 years agoFix issues in compilation and link flags 19/199919/2
Nikolai Merinov [Wed, 30 Jan 2019 13:11:59 +0000 (16:11 +0300)]
Fix issues in compilation and link flags

Moved as-needed flag to LDFLAGS, disabled specific warnings,
added linkage with math library.

Change-Id: Iaa79c4e75b2775373594ad880307ff3f701417c7

5 years agolibdlog: inotify read safety 58/199758/1
Michal Bloch [Thu, 14 Feb 2019 10:57:18 +0000 (11:57 +0100)]
libdlog: inotify read safety

Change-Id: I8b05f2a21a666aa12fa87c151b46d4c39abd898e
Signed-off-by: Michal Bloch <m.bloch@samsung.com>
5 years agotests: add logutil fdi_logger unit tests 46/199646/1 submit/tizen/20190214.061712
Michal Bloch [Wed, 13 Feb 2019 16:33:52 +0000 (17:33 +0100)]
tests: add logutil fdi_logger unit tests

Change-Id: I9c118c1f2ff996416b6f00c2012ac648380805c8
Signed-off-by: Michal Bloch <m.bloch@samsung.com>
5 years agoutil: minor correctness fixes 45/199645/1
Michal Bloch [Wed, 13 Feb 2019 16:33:32 +0000 (17:33 +0100)]
util: minor correctness fixes

 * `logger_clear` now always returns 0 on success (could be > 0 previously)
 * `logger_create` no longer considers a path successfully opened regardless of later allocation failures
 * `logger_create` no longer tries to access uninitialized memory

Change-Id: Ia21f7ee294fc2463285fd59c4c4e10804dad0206

5 years agosvace: tests: memory management fixes + commentary 66/199466/2 submit/tizen/20190213.012117
Michal Bloch [Tue, 12 Feb 2019 10:06:27 +0000 (11:06 +0100)]
svace: tests: memory management fixes + commentary

Change-Id: Ia677bb98b7f625ff504b5ab0331f37bfcae31ab0
Signed-off-by: sanghyeok.oh <sanghyeok.oh@samsung.com>
Signed-off-by: Michal Bloch <m.bloch@samsung.com>
5 years agotests: fix build errors on 64-bit architectures 18/199518/1
Maciej Slodczyk [Tue, 12 Feb 2019 09:48:52 +0000 (10:48 +0100)]
tests: fix build errors on 64-bit architectures

Change-Id: I14c5b8539373167c9bda96eef9f7d369a7fcbb07
Signed-off-by: Maciej Slodczyk <m.slodczyk2@partner.samsung.com>
5 years agoFix miscellaneous SVACE issues 59/199459/1
Michal Bloch [Mon, 11 Feb 2019 12:55:39 +0000 (13:55 +0100)]
Fix miscellaneous SVACE issues

Change-Id: Iefc042ccffa7114d96a2d796d23d74e7e27d2315
Signed-off-by: Michal Bloch <m.bloch@samsung.com>
5 years agotests: fix miscellaneous SVACE trivialities 58/199458/1
Michal Bloch [Mon, 11 Feb 2019 11:45:57 +0000 (12:45 +0100)]
tests: fix miscellaneous SVACE trivialities

Change-Id: Ifc4c323fc7c04d997777e7f25b02559334e08a8f
Signed-off-by: Michal Bloch <m.bloch@samsung.com>
5 years agoshared: move logger-specific code out of logcommon 68/199168/1
Michal Bloch [Fri, 25 Jan 2019 12:29:11 +0000 (13:29 +0100)]
shared: move logger-specific code out of logcommon

Split some functions used only by the Android Logger backend
away from logcommon. This also removes logcommon's dependency
on logconfig.

Change-Id: I365163cf9f95ff52035437c89975868c142a2dc5

5 years agotests: add logutil fd_info unit tests 60/199160/1 submit/tizen/20190207.012533
Michal Bloch [Mon, 4 Feb 2019 19:14:43 +0000 (20:14 +0100)]
tests: add logutil fd_info unit tests

Change-Id: I3de39916bc32dee5a3e1cbde713a0a80fbd90a7f
Signed-off-by: Michal Bloch <m.bloch@samsung.com>
5 years agotests: add logutil sort vector unit tests 28/199128/1
Michal Bloch [Fri, 1 Feb 2019 16:10:41 +0000 (17:10 +0100)]
tests: add logutil sort vector unit tests

Change-Id: If94434c9d633f418718e83ca4415e265dca7c68f
Signed-off-by: Michal Bloch <m.bloch@samsung.com>
5 years agotests: expand logger storage unit tests 82/198882/2
Michal Bloch [Wed, 30 Jan 2019 16:35:41 +0000 (17:35 +0100)]
tests: expand logger storage unit tests

Change-Id: Iddd1801c4293255f92a90a48230b939e90b123d3
Signed-off-by: Michal Bloch <m.bloch@samsung.com>
5 years agotests: fix lcov failures on non-i586 archs 15/199115/1
Michal Bloch [Mon, 4 Feb 2019 11:42:51 +0000 (12:42 +0100)]
tests: fix lcov failures on non-i586 archs

Change-Id: I15f8d07018bce5e8889b5df2f972046314800d59
Signed-off-by: Michal Bloch <m.bloch@samsung.com>
5 years agodlog_logger: fix dumping storage readers ownership 81/198881/2
Michal Bloch [Wed, 30 Jan 2019 16:35:52 +0000 (17:35 +0100)]
dlog_logger: fix dumping storage readers ownership

Readers now get disconnected from the storage as soon as they read
what they wanted to, instead of waiting until the last log gets
removed from the storage.

Change-Id: Ie1ae500cfa0cb923e2f8b1e476d5411ea13c2960
Signed-off-by: Michal Bloch <m.bloch@samsung.com>
5 years agolibdlog: extract declarations into a header 79/198879/2
Michal Bloch [Wed, 30 Jan 2019 13:48:46 +0000 (14:48 +0100)]
libdlog: extract declarations into a header

Change-Id: Ia2c892765322b4b147dd2f4c9720d607bdabb023
Signed-off-by: Michal Bloch <m.bloch@samsung.com>
5 years agolibdlog: initialise through attribute constructor 68/198868/3
Michal Bloch [Fri, 25 Jan 2019 10:37:57 +0000 (11:37 +0100)]
libdlog: initialise through attribute constructor

The previous implementation suffered from the double-checked locking
anti-pattern. It is possible for writes to be reordered either by the
compiler OR the hardware (for example armv7l does this), potentially
setting the initialisation flag before having actually initialized
the rest of the library, meaning a parallel thread could see the flag
and try to use uninitialised variables.

Using the constructor attribute solves this neatly since it is done
before any parallel threads can do anything; even runtime invocation
through `dlopen()` is safe since in that case other threads won't be
able to access the pointer to `dlog_print` before `dlopen()` returns,
by which time the constructor must have finished.

Change-Id: Ic55a6d6858dc2112efd67338894a0c44b876fee8
Signed-off-by: Michal Bloch <m.bloch@samsung.com>
5 years agoMerge "tests: deal with some unreachable cases" into tizen
Hyotaek Shim [Sat, 2 Feb 2019 04:19:41 +0000 (04:19 +0000)]
Merge "tests: deal with some unreachable cases" into tizen

5 years agotests: deal with some unreachable cases 94/199094/1
Michal Bloch [Fri, 1 Feb 2019 15:55:12 +0000 (16:55 +0100)]
tests: deal with some unreachable cases

Change-Id: Ib0d09e5c70fd16a0a3856bfb56214273984641cf
Signed-off-by: Michal Bloch <m.bloch@samsung.com>
5 years agotests: add unit tests for shared/log_file.c 93/199093/1
Michal Bloch [Fri, 1 Feb 2019 09:59:29 +0000 (10:59 +0100)]
tests: add unit tests for shared/log_file.c

Change-Id: I881fe740f0d9058c3ad99c0638a739cd28ea21d6
Signed-off-by: Michal Bloch <m.bloch@samsung.com>
5 years agotests: complete logprint.c unit test coverage 02/199002/1
Michal Bloch [Thu, 31 Jan 2019 14:22:03 +0000 (15:22 +0100)]
tests: complete logprint.c unit test coverage

Change-Id: I6436583e249c3b555dc1834db9ea957c8c0d3670
Signed-off-by: Michal Bloch <m.bloch@samsung.com>
5 years agoshared: fix multiple memory ownership problems 01/199001/1
Michal Bloch [Thu, 31 Jan 2019 19:35:42 +0000 (20:35 +0100)]
shared: fix multiple memory ownership problems

The function was supposed to create a deep copy
of a filterspec list, which it generally seemed
to do if everything went fine.

However:
 * if copying the first filterspec element failed,
   the *original* elements were all freed, which
   resulted in dangling pointers.
 * if copying the N+1'th filterspec failed, any
   subsequent filterspecs were removed from the
   *original* as well.
 * if everything succeeded, the original object
   actually got a copy of the list, and the new
   object got the original list.

Change-Id: I064b54d505c471fb042b036cf72398fb0fa5297c
Signed-off-by: Michal Bloch <m.bloch@samsung.com>
5 years agoshared: fix integer conversion 99/198999/2
Michal Bloch [Thu, 31 Jan 2019 16:47:53 +0000 (17:47 +0100)]
shared: fix integer conversion

typeof (int - size_t) == size_t

Change-Id: I17e96f9747a33b04ee2b2c325decac9974147051
Signed-off-by: Michal Bloch <m.bloch@samsung.com>
5 years agotests: add negative unit tests for logctl 80/198880/1 accepted/tizen/unified/20190201.061322 submit/tizen/20190131.021840 submit/tizen/20190131.080207
Michal Bloch [Wed, 30 Jan 2019 15:04:55 +0000 (16:04 +0100)]
tests: add negative unit tests for logctl

Completes logctl coverage.

Change-Id: I3f2ab69d071361ca7f0573e86b2a2636db4f6e2c
Signed-off-by: Michal Bloch <m.bloch@samsung.com>
5 years agotests: further expand logctl unit tests 59/198459/3
Michal Bloch [Thu, 24 Jan 2019 18:30:40 +0000 (19:30 +0100)]
tests: further expand logctl unit tests

Change-Id: I022b9e8c090a2bcfcff7b7e7d697257f73d545cc
Signed-off-by: Michal Bloch <m.bloch@samsung.com>
5 years agotests: basic unit tests for logprint.c 23/198323/6
Michal Bloch [Wed, 23 Jan 2019 19:23:13 +0000 (20:23 +0100)]
tests: basic unit tests for logprint.c

Change-Id: If4d17fc03ccc03069acc011c613549d0710a66ce
Signed-off-by: Michal Bloch <m.bloch@samsung.com>
5 years agodlogutil: fix a potential deadlock 55/198455/1
Michal Bloch [Thu, 24 Jan 2019 15:00:17 +0000 (16:00 +0100)]
dlogutil: fix a potential deadlock

Change-Id: Iff6961991c833f7ab4664fc3ac44859bd2e69cd1
Signed-off-by: Michal Bloch <m.bloch@samsung.com>
5 years agoshared: fix incorrect timestamps 22/198322/3
Michal Bloch [Wed, 23 Jan 2019 19:22:01 +0000 (20:22 +0100)]
shared: fix incorrect timestamps

The RECV_REALTIME and RWTIME formats would print an incorrect
timestamp when used alongside default-monotonic log sources.

Change-Id: I0a67f35a60b77052528349d88b11f905a7afcb50
Signed-off-by: Michal Bloch <m.bloch@samsung.com>
5 years agoutil: pipe: speed up dumping dlogutil 19/198419/2
Maciej Slodczyk [Thu, 24 Jan 2019 10:43:07 +0000 (11:43 +0100)]
util: pipe: speed up dumping dlogutil

Dumping dlogutil is slow because of too small read buffer
in util and clogging write pipe in daemon. Increase their
size to make the log dump quick.

Change-Id: If254bc650fdad98f4681540da754494f4522085f
Signed-off-by: Maciej Slodczyk <m.slodczyk2@partner.samsung.com>
5 years agoutil: pipe: save time on copying buffers 92/198292/6
Maciej Slodczyk [Wed, 23 Jan 2019 10:56:54 +0000 (11:56 +0100)]
util: pipe: save time on copying buffers

Buffer memory is moved after each log message is printed,
which is not necessary. Print out all logs in the buffer,
then put any remaining data at the beginning of the buffer.

Change-Id: I500c58a2cbebcab60543a69b7a4ac9f00c154b46
Signed-off-by: Maciej Slodczyk <m.slodczyk2@partner.samsung.com>
5 years agotests: basic logctl unit tests 21/198321/2
Michal Bloch [Wed, 23 Jan 2019 18:34:32 +0000 (19:34 +0100)]
tests: basic logctl unit tests

Change-Id: I02c854e043f934c42e44eecbacd8bc85db22a7e8
Signed-off-by: Michal Bloch <m.bloch@samsung.com>
5 years agologctl: extract stuff into headers 20/198320/2
Michal Bloch [Wed, 23 Jan 2019 18:33:58 +0000 (19:33 +0100)]
logctl: extract stuff into headers

Change-Id: Ifdb379a8fde51becade46f4bf05b91a21a81a72d
Signed-off-by: Michal Bloch <m.bloch@samsung.com>
5 years agologctl: fix an error in documentation 19/198319/2
Michal Bloch [Wed, 23 Jan 2019 18:32:26 +0000 (19:32 +0100)]
logctl: fix an error in documentation

Change-Id: I3309c18fe252ec614e92b8ed0b1dc457d58899bb
Signed-off-by: Michal Bloch <m.bloch@samsung.com>
5 years agotests: reinstate 100% libdlog coverage 24/198324/1
Michal Bloch [Wed, 23 Jan 2019 20:17:14 +0000 (21:17 +0100)]
tests: reinstate 100% libdlog coverage

Change-Id: I993a5d6d36f5ebc5fc6220cc74988eeb4de7e808
Signed-off-by: Michal Bloch <m.bloch@samsung.com>
5 years agounit tests: add a copy of TCT 44/198244/4
Michal Bloch [Mon, 21 Jan 2019 11:33:38 +0000 (12:33 +0100)]
unit tests: add a copy of TCT

Running the actual TCT suite is a massive hassle, especially
given its simplicity, so it's great to be able to catch any
applicable bugs at build time.

Change-Id: Id7b546f347ef8e98b8647b2a0c63c3f6ae103908
Signed-off-by: Michal Bloch <m.bloch@samsung.com>
5 years agoFix coding style 12/198312/3
Michal Bloch [Wed, 23 Jan 2019 15:04:51 +0000 (16:04 +0100)]
Fix coding style

Change-Id: Ie33d0b3a0f99eaa823faec9f719ac715ee0e3d5e
Signed-off-by: Michal Bloch <m.bloch@samsung.com>
5 years agoFix a potential buffer overflow 29/197629/2
Michal Bloch [Mon, 14 Jan 2019 14:37:16 +0000 (15:37 +0100)]
Fix a potential buffer overflow

Change-Id: I7407b2ed68322d6c0fd6eac2ec3600cd14ce7d80
Signed-off-by: Michal Bloch <m.bloch@samsung.com>
5 years agopackaging: Allow disabling dynamic filtering in resulting package 95/197995/5
Karol Lewandowski [Thu, 17 Jan 2019 13:03:01 +0000 (14:03 +0100)]
packaging: Allow disabling dynamic filtering in resulting package

Unwanted feature will be disableable via _with_dynamic_filtering
rpm's compile time option.

Change-Id: Icce63a9a62a1aa9f7a1778d5be359b89116371ef

5 years agolibdlog: remove library destructor 84/197584/8
Maciej Slodczyk [Mon, 14 Jan 2019 08:55:09 +0000 (09:55 +0100)]
libdlog: remove library destructor

A destructor assumes that it has an exclusive thread
access (no other library function can run in paralell).
This condition is not always met, which can lead to a
race condition and use after free situation. Since all
other, backend specific resources are not freed anyway,
we can get rid of the destructor to make things more
reliable.
The function itself is left because it is still necessary
in tests.

Change-Id: I3bc2a7b660c6c805182592a70a8a954beba16772
Signed-off-by: Maciej Slodczyk <m.slodczyk2@partner.samsung.com>
5 years agologctl/common: unduplicate free_ptr/freep 57/198157/2
Michal Bloch [Mon, 21 Jan 2019 14:05:40 +0000 (15:05 +0100)]
logctl/common: unduplicate free_ptr/freep

Change-Id: Ibbada3aa01904860a396ee50fb8ebf92a5e46ae4
Signed-off-by: Michal Bloch <m.bloch@samsung.com>
5 years agologger: fix data corruption for listening sockets 56/198156/1
Michal Bloch [Mon, 21 Jan 2019 12:52:56 +0000 (13:52 +0100)]
logger: fix data corruption for listening sockets

The sockets are of the type SOCK_STREAM which can receive data
in chunks. This is quite unlikely due to small data sizes but
is not impossible.

Change-Id: I5efa42c52c58fcd913eb882a77641f595fc99e9e
Signed-off-by: Michal Bloch <m.bloch@samsung.com>
5 years agoExpand commentary on previous
Michal Bloch [Mon, 21 Jan 2019 12:26:55 +0000 (13:26 +0100)]
Expand commentary on previous

Change-Id: I2eb99e2201ebb82451d5dc291ed0866455f269f5
Signed-off-by: Michal Bloch <m.bloch@samsung.com>
5 years agosvace: set umask to protect tempfile 71/197771/6
sanghyeok.oh [Wed, 16 Jan 2019 08:13:28 +0000 (17:13 +0900)]
svace: set umask to protect tempfile

umask(077) needs to be called before mkstemp(),
to prevent a potential race condition vulnerability.

Change-Id: Id7c167e9627e55d563dc4a881a6ecfbb4843f70e
Signed-off-by: sanghyeok.oh <sanghyeok.oh@samsung.com>
Signed-off-by: Hyotaek Shim <hyotaek.shim@samsung.com>
5 years agoutil: allow filterspec to work with empty-tagged messages 58/197458/2 accepted/tizen/unified/20190117.151819 submit/tizen/20190116.045852
Maciej Slodczyk [Thu, 10 Jan 2019 13:21:45 +0000 (14:21 +0100)]
util: allow filterspec to work with empty-tagged messages

Change-Id: I9b49e3a07145e2f3dc83ab59b99e9ee340dab414
Signed-off-by: Maciej Slodczyk <m.slodczyk2@partner.samsung.com>
5 years agoMerge "testsuite: speed up format tests" into tizen
Michal Bloch [Mon, 7 Jan 2019 15:28:29 +0000 (15:28 +0000)]
Merge "testsuite: speed up format tests" into tizen

5 years agotestsuite: speed up format tests 07/196907/1
Maciej Slodczyk [Mon, 7 Jan 2019 11:46:19 +0000 (12:46 +0100)]
testsuite: speed up format tests

Get rid of unnecessary sorting in dlogutil
when performing format checks.

Change-Id: Iaecd583c3994f73de0b11626a89e87b19379f7ae
Signed-off-by: Maciej Slodczyk <m.slodczyk2@partner.samsung.com>
5 years agolibdlog: detect and notify about empty tagged messages 78/196578/3
Maciej Slodczyk [Wed, 2 Jan 2019 11:18:46 +0000 (12:18 +0100)]
libdlog: detect and notify about empty tagged messages

It is an error for an application to send a message with empty tag. To
make it easy to catch such situation and fix it in the app, empty-tagged
messages are exluded from limiter and marked with DLOG_ERROR_NOTAG tag.

Change-Id: I5ca0e0ef0e20f9d7cabcec11dad379023b7f0630
Signed-off-by: Maciej Slodczyk <m.slodczyk2@partner.samsung.com>
5 years agologctl: simplify and document a confusing function 06/196706/2 submit/tizen/20190107.090102
Michal Bloch [Thu, 3 Jan 2019 15:53:34 +0000 (16:53 +0100)]
logctl: simplify and document a confusing function

  Minor behaviour change: all affected lines are now moved to the end,
  in the order they were specified in the kv struct (used to stay in
  place) and duplicate keys are pruned (used to be left alone).

  Example: kv pairs {"A", "1"} and {"B", "2"}, file:
    C=3
    B=8
    A=4
    B=6
    D=4

  Previously, the resulting file:
    C=3
    B=2
    A=1
    B=2
    D=4

  Now:
    C=3
    D=4
    A=1
    B=2

  This has no effect on configs because the order among different keys
  doesn't matter and a given key used to get the same value across copies,
  but allows to simplify some logic.

Change-Id: Ib2ac9e07dced12614cde000dc3876e2887410537
Signed-off-by: Michal Bloch <m.bloch@samsung.com>
5 years agoFix log_config initialisation properly 90/196690/1
Michal Bloch [Thu, 3 Jan 2019 12:27:33 +0000 (13:27 +0100)]
Fix log_config initialisation properly

The test wrapper around log_config_read had different behaviour
than the real function and did not properly initialise members.

The previous fix was less elegant and is no longer needed.
This partially reverts commit 682e540702101156881a5c3219f1b27a8fcb4894.

Change-Id: Ib9210dabe0c6033fe22de073ceaada30e012cdc5
Signed-off-by: Michal Bloch <m.bloch@samsung.com>
5 years agoRelease 5.5.1 94/196594/1 submit/tizen/20190103.011939
Karol Lewandowski [Wed, 2 Jan 2019 14:20:58 +0000 (15:20 +0100)]
Release 5.5.1

This release adds follwing features:

 - dlog printf format is now enforced

 - android driver v2 is now required for android backend

 - reduce default client side buffer to 64k (from 1MB) due to
   global (system wide) limit

 - add testsuite together with coverage reporting

Lastly, long list of fixes.

Change-Id: I03af7cc3dba8c7c9fa8a8758f281cdb5eeef5b59

5 years agofix: test common: use correct cast to validate pipefd receive 93/196593/1
Karol Lewandowski [Wed, 2 Jan 2019 14:51:40 +0000 (15:51 +0100)]
fix: test common: use correct cast to validate pipefd receive

Change-Id: Ibf7b808ddfccdbdc9ea54e44f37961383099954e

5 years agofix: parse_number 64-bit architecture compatibility 66/196466/1 submit/tizen/20181231.025611
Karol Lewandowski [Sun, 30 Dec 2018 02:05:32 +0000 (03:05 +0100)]
fix: parse_number 64-bit architecture compatibility

Simplify strtol() return error code checking to properly handle 64-bit
architectures.  Problem appears only on 64-bit architectures, where
LONG_MAX (long type, 4 bytes) does not fit into regular int type
(4 bytes).

Additionally, this commit removes str2num() function which is copy
paste of parse_number (with same bugs).

Change-Id: I44cbcdd1e5601c8ed988368932e84f29f719c8a9

5 years agofix: ensure log_config is always properly initialized 64/196464/3
Karol Lewandowski [Fri, 28 Dec 2018 15:17:03 +0000 (16:17 +0100)]
fix: ensure log_config is always properly initialized

Proper initialization is required to be able to free the
structure after eg. failing log_config_read() which might
have either read some entries (and updated .begin/.end)
or have not read anything (keeping .begin/.end unchanged).

Change-Id: I3a2a2434488e13349746a85afcb4c81752609dd9

5 years agoRemove executable flag from non-executable files 81/196281/1 submit/tizen/20181227.070601
lokilee73 [Thu, 27 Dec 2018 03:11:54 +0000 (12:11 +0900)]
Remove executable flag from non-executable files

Change-Id: Ibf83f8fcec9a3596a317b3d202fc76eb89ecc259
Signed-off-by: lokilee73 <changjoo.lee@samsung.com>
5 years agotests: top up coverage of some files in shared 11/196111/1
Michal Bloch [Thu, 20 Dec 2018 17:26:54 +0000 (18:26 +0100)]
tests: top up coverage of some files in shared

Change-Id: I33be1871e67a90f20099afe8e632519253043e27
Signed-off-by: Michal Bloch <m.bloch@samsung.com>
5 years agotests: extend logcommon unit tests 13/196013/3
Michal Bloch [Fri, 14 Dec 2018 19:33:32 +0000 (20:33 +0100)]
tests: extend logcommon unit tests

Change-Id: I64900e1c453be7131a05fdc886a290df756364bb
Signed-off-by: Michal Bloch <m.bloch@samsung.com>
5 years agotests: reinstate 100% libdlog unit test coverage 12/196012/3
Michal Bloch [Thu, 20 Dec 2018 15:24:00 +0000 (16:24 +0100)]
tests: reinstate 100% libdlog unit test coverage

Change-Id: I4d5fb273567a63c04d21a87434cf532c5b62f383
Signed-off-by: Michal Bloch <m.bloch@samsung.com>
5 years agotests: compile with -O0 11/196011/3
Michal Bloch [Tue, 18 Dec 2018 14:25:12 +0000 (15:25 +0100)]
tests: compile with -O0

autoconf adds some flags, including -O2, which prevents
gcov from properly measuring test coverage by optimizing
various functions and code paths out.

Change-Id: I288ed6261f6a07ed23e5cd09c7517bb4b39695ba
Signed-off-by: Michal Bloch <m.bloch@samsung.com>
5 years agolibdlog: handle limiter allocation failures 10/196010/3
Michal Bloch [Thu, 20 Dec 2018 15:21:56 +0000 (16:21 +0100)]
libdlog: handle limiter allocation failures

Change-Id: Ie097957247c72c3d8cdccfbc4d3b080343582873
Signed-off-by: Michal Bloch <m.bloch@samsung.com>
5 years agolibdlog: stricter correctness checks 09/196009/2
Michal Bloch [Tue, 18 Dec 2018 14:54:13 +0000 (15:54 +0100)]
libdlog: stricter correctness checks

Change-Id: Ice3b5b65d907e7c56c2924dcb94a3300b89a94ad
Signed-off-by: Michal Bloch <m.bloch@samsung.com>
5 years agoEnforce Android Logger device protocol version 2 57/194657/10 submit/tizen/20181221.003724
Michal Bloch [Thu, 13 Dec 2018 16:14:04 +0000 (17:14 +0100)]
Enforce Android Logger device protocol version 2

Will no longer fail on devices compatible with version 2 of the protocol
which change the GET_LOG_LEN ioctl behaviour where the returned value is
not the sum of the values returned by read() calls. Such devices are so
far a straight-up hypothetical, but it's better to exercise our foresight
right now rather than have to deal with the fallout after such change,
since as unlikely as a fix would be given that this behaviour is not in
theory an error and that DLog is the primary way to access this interface,
it doesn't look like Android Logger is getting abandoned anytime soon.

This patch also makes protocol version requirement checks more strict;
specifically, it makes support for version 2 mandatory. Previously such
devices would silently drop logs past the amount that would usually be
reported by a v2 device, so we now spare ourselves painful debugging
and won't have to pollute our code with exceptional handling of obsolete
versions. The drawback is not particularly harsh because virtually all
kernels nowadays have either dropped Android Logger devices altogether,
or use version 2.

Change-Id: Ic66f0abfb1de83fba454bfa151b7e40b90e30ad6
Signed-off-by: Michal Bloch <m.bloch@samsung.com>
5 years agoutil: document some tricky code 29/195729/2
Michal Bloch [Mon, 17 Dec 2018 15:40:30 +0000 (16:40 +0100)]
util: document some tricky code

Change-Id: I301c7bd877248201edb7ca27590ad348b18db06a
Signed-off-by: Michal Bloch <m.bloch@samsung.com>
5 years agotests: add queued_entry unit tests 12/195612/1
Michal Bloch [Fri, 14 Dec 2018 18:29:46 +0000 (19:29 +0100)]
tests: add queued_entry unit tests

Change-Id: Ifd9748ba07f8f6a7e0faa7a2dc0871b9b9cc8617
Signed-off-by: Michal Bloch <m.bloch@samsung.com>
5 years agoFix minor issues with log entry parsing 11/195611/1
Michal Bloch [Fri, 14 Dec 2018 18:29:14 +0000 (19:29 +0100)]
Fix minor issues with log entry parsing

Change-Id: I2a566647cdde20aa7168d816afd1c78146567f4f
Signed-off-by: Michal Bloch <m.bloch@samsung.com>
5 years agoFix missing header inclusion 10/195610/1
Michal Bloch [Fri, 14 Dec 2018 18:28:27 +0000 (19:28 +0100)]
Fix missing header inclusion

`get_proper_clock` returns `clockid_t` which requires <time.h>

Change-Id: I40c6416246cde0d2033b80bf8eb7219f3500fb77
Signed-off-by: Michal Bloch <m.bloch@samsung.com>
5 years agotestsuite: test tag based dynamic filters 40/195440/3
Maciej Slodczyk [Thu, 13 Dec 2018 11:43:18 +0000 (12:43 +0100)]
testsuite: test tag based dynamic filters

Change-Id: Iebea3f70867d117b765737113bead7837bd285f6
Signed-off-by: Maciej Slodczyk <m.slodczyk2@partner.samsung.com>
5 years agotestsuite: check if dlogctl denies invalid arguments 36/195336/3
Maciej Slodczyk [Wed, 12 Dec 2018 17:46:43 +0000 (18:46 +0100)]
testsuite: check if dlogctl denies invalid arguments

Change-Id: I7b50ead74478b210e04b1324ed7d2bf0da54d949
Signed-off-by: Maciej Slodczyk <m.slodczyk2@partner.samsung.com>
5 years agoApply __attribute__((format(printf..))) Warning to Public dlog_print() 38/195438/2 submit/tizen/20181213.113859
Hyotaek Shim [Thu, 13 Dec 2018 11:33:42 +0000 (20:33 +0900)]
Apply __attribute__((format(printf..))) Warning to Public dlog_print()

In public rootstrap, dlog-internal.h is removed.
So,
"#pragma GCC diagnostic warning "-Wformat"" will be applied instead of
"#pragma GCC diagnostic error "-Wformat""

Change-Id: I56beb06ac1cdb17fee45411e32f058f56b743bba
Signed-off-by: Hyotaek Shim <hyotaek.shim@samsung.com>
5 years agotests: add libdlog base unit tests 41/195341/1
Michal Bloch [Tue, 11 Dec 2018 19:33:19 +0000 (20:33 +0100)]
tests: add libdlog base unit tests

Change-Id: I9d489ed607d9917aaf782339b7db700259955ac9
Signed-off-by: Michal Bloch <m.bloch@samsung.com>
5 years agolibdlog: fix reconstruction after destruction 40/195340/1
Michal Bloch [Mon, 10 Dec 2018 10:59:59 +0000 (11:59 +0100)]
libdlog: fix reconstruction after destruction

Change-Id: Ib3409ce958d6c936f9a44e337bbec50d36117d02
Signed-off-by: Michal Bloch <m.bloch@samsung.com>
5 years agotestsuite: test filters added by dlogctl 34/195334/2
Maciej Slodczyk [Wed, 12 Dec 2018 16:54:19 +0000 (17:54 +0100)]
testsuite: test filters added by dlogctl

Change-Id: I3309ee558a3549438aa9a45bf17ab2ff03a184de
Signed-off-by: Maciej Slodczyk <m.slodczyk2@partner.samsung.com>
5 years agoutil: fix dlogutil failing with multiple buffers 35/195335/2
Maciej Slodczyk [Wed, 12 Dec 2018 16:57:00 +0000 (17:57 +0100)]
util: fix dlogutil failing with multiple buffers

Change-Id: Ia0375c7118194dddb51725af3cdfea3065de353f
Signed-off-by: Maciej Slodczyk <m.slodczyk2@partner.samsung.com>
5 years agotestsuite: make sure proper values are returned when testing filters 30/195330/2
Maciej Slodczyk [Wed, 12 Dec 2018 13:03:47 +0000 (14:03 +0100)]
testsuite: make sure proper values are returned when testing filters

Change-Id: I08200630ea299c71865f06da09a235ed395d533d
Signed-off-by: Maciej Slodczyk <m.slodczyk2@partner.samsung.com>
5 years agotestsuite: extend dynamic filters tests 29/195329/2
Maciej Slodczyk [Wed, 12 Dec 2018 12:59:38 +0000 (13:59 +0100)]
testsuite: extend dynamic filters tests

Dynamic filters directory SMACK label is now tested,
as well as alternative filters config file.

Change-Id: I3d2879885c87991965fab65339c68f0b05d9ab18
Signed-off-by: Maciej Slodczyk <m.slodczyk2@partner.samsung.com>
5 years agoshared: add log_config_copy & log_config_remove 05/195105/6
Michal Bloch [Tue, 11 Dec 2018 18:03:59 +0000 (19:03 +0100)]
shared: add log_config_copy & log_config_remove

The former copies a config structure and the latter removes
an entry under given key. Includes unit tests for both.

Change-Id: Ideca55a2b9fe9d0b038675e06f5ace72d12af78a
Signed-off-by: Michal Bloch <m.bloch@samsung.com>
5 years agotests: add libdlog Android Logger unit tests 78/195078/2
Michal Bloch [Fri, 7 Dec 2018 16:29:02 +0000 (17:29 +0100)]
tests: add libdlog Android Logger unit tests

Change-Id: Ib529daa9fb8fff828c0255bdd871bf81b7263158
Signed-off-by: Michal Bloch <m.bloch@samsung.com>
5 years agotests: add libdlog-pipe unit tests 66/194866/4
Michal Bloch [Fri, 7 Dec 2018 12:23:00 +0000 (13:23 +0100)]
tests: add libdlog-pipe unit tests

Change-Id: I7f25900125ba5901a527c6a1268a39e3d68c3710
Signed-off-by: Michal Bloch <m.bloch@samsung.com>
5 years agolibdlog pipe: fix correctness checks 65/194865/2
Michal Bloch [Fri, 7 Dec 2018 12:21:22 +0000 (13:21 +0100)]
libdlog pipe: fix correctness checks

 * rejects on negative buffer ID (no longer crashes)
 * rejects relative socket paths
 * accepts maximal payloads

Change-Id: I7344cf4d47eb65c98a65a01ad4ada38ca9c9b5fd
Signed-off-by: Michal Bloch <m.bloch@samsung.com>
5 years agolibdlog: fail early on long pipe paths 64/194864/2
Michal Bloch [Fri, 30 Nov 2018 11:42:08 +0000 (12:42 +0100)]
libdlog: fail early on long pipe paths

Change-Id: I779b8427db928c8dc29174b508194cbd38561329
Signed-off-by: Michal Bloch <m.bloch@samsung.com>
5 years agoFix `log_config_free` corrupting the config 18/195218/3
Michal Bloch [Tue, 11 Dec 2018 18:03:22 +0000 (19:03 +0100)]
Fix `log_config_free` corrupting the config

It used to leave the config in a corrupt state that
referenced freed memory and leaked any added entries.
This did not cause any actual problems because no
config structure was ever reused in production code,
only in tests which do that for convenience.

Change-Id: I90a52c31ca2985ab9c67b32849bca426fb3f1ed7
Signed-off-by: Michal Bloch <m.bloch@samsung.com>
5 years agoRevert "Apply __attribute__((format(printf..))) to Public dlog_print()" 46/195246/2
Hyotaek Shim [Wed, 12 Dec 2018 02:20:51 +0000 (02:20 +0000)]
Revert "Apply __attribute__((format(printf..))) to Public dlog_print()"

This reverts commit 6b5b9d0c435fa4b79395e22bc8ba39eedee3f0c0.

Change-Id: Id7739408a38f86f78ddaa12e93e42de2cc208a8d

5 years agodlogutil: allow printing current DLog version 77/195177/2
Maciej Slodczyk [Mon, 10 Dec 2018 15:20:38 +0000 (16:20 +0100)]
dlogutil: allow printing current DLog version

Change-Id: I49c1d4cf5c5bd725c9d516414e7fbd0774f2af8d
Signed-off-by: Maciej Slodczyk <m.slodczyk2@partner.samsung.com>
5 years agoMerge "dlogctl: allow empty priority when printing limits" into tizen
Maciej Slodczyk [Tue, 11 Dec 2018 08:32:11 +0000 (08:32 +0000)]
Merge "dlogctl: allow empty priority when printing limits" into tizen

5 years agoMerge "dlogsend: notify and return error code when message send fails" into tizen
Maciej Slodczyk [Tue, 11 Dec 2018 08:32:04 +0000 (08:32 +0000)]
Merge "dlogsend: notify and return error code when message send fails" into tizen

5 years agoFix compilation errors 01/195101/2
Michal Bloch [Mon, 10 Dec 2018 15:32:33 +0000 (16:32 +0100)]
Fix compilation errors

 * `malloc` requires `stdlib.h`
 * case labels only accept constants, not variables (even static const)

Change-Id: Ie508947abd79e6d3b47a08f63cb07dbf8463dd72
Signed-off-by: Michal Bloch <m.bloch@samsung.com>