Mateusz Majewski [Wed, 21 Aug 2019 12:39:02 +0000 (14:39 +0200)]
Fix process_log docs
Oops! I actually had this done, but I did it in a separate commit and
forgotten to actually apply this change :(
Change-Id: I41cdbacb73bb4315e3a3ca904b4efbe4cb1aaaef
Mateusz Majewski [Wed, 14 Aug 2019 06:26:25 +0000 (08:26 +0200)]
Move various files from dlogutil into shared locations
This is due to the need to use them in the upcoming libdlogutil.
Change-Id: I7048116972dbef9e345b333a91f92c2067188c5a
Mateusz Majewski [Wed, 14 Aug 2019 06:26:25 +0000 (08:26 +0200)]
Pass the printing function in dlogutil by a callback
Currently it doesn't matter, however, this will come in handy when
implementing libdlogutil, since it will allow to reuse the code, but
do an arbitrary operation.
Change-Id: Ie7b907ef9409af53ec8d8aa8893c6ba6a5f57c02
Michal Bloch [Tue, 3 Sep 2019 11:15:50 +0000 (13:15 +0200)]
Add tests for some recently changed code
Change-Id: Ic89168dc09aa50fd80e10124e588cade9d2ae8f0
Signed-off-by: Michal Bloch <m.bloch@samsung.com>
Maciej Slodczyk [Tue, 3 Sep 2019 08:45:31 +0000 (10:45 +0200)]
Fix tests for future timestamps
Change-Id: I15b3242b10d643ade27f33fd8fb65710148afd68
Signed-off-by: Maciej Slodczyk <m.slodczyk2@partner.samsung.com>
Michal Bloch [Mon, 2 Sep 2019 15:05:22 +0000 (17:05 +0200)]
Fix future timestamps
Change-Id: I65e9389733d0d6718d9bf5523b9d65d52d4265d1
Signed-off-by: Michal Bloch <m.bloch@samsung.com>
Michal Bloch [Fri, 30 Aug 2019 12:03:47 +0000 (14:03 +0200)]
Fix a potential null ptr dereference
Change-Id: I5541047d606dea988b5ce5b54cb7394a3aba78ac
Signed-off-by: Michal Bloch <m.bloch@samsung.com>
Hyotaek Shim [Fri, 30 Aug 2019 10:29:29 +0000 (19:29 +0900)]
Remove destructor and destruction_lock
Change-Id: Id68323d0b8981b8cbfff53a847ced8a0b1569fb4
Signed-off-by: Hyotaek Shim <hyotaek.shim@samsung.com>
Michal Bloch [Fri, 30 Aug 2019 10:11:22 +0000 (12:11 +0200)]
Fix dlogutil getting blocked by clock changes
Change-Id: Iece15b17e78824c310d94b9f3d0228017af3f019
Signed-off-by: Michal Bloch <m.bloch@samsung.com>
Michal Bloch [Thu, 29 Aug 2019 11:36:54 +0000 (13:36 +0200)]
libdlog: handle thread cancellation
Change-Id: If52fa194ce10aab5e1766ed204c438fa62c03ba3
Signed-off-by: Michal Bloch <m.bloch@samsung.com>
Yunmi Ha [Tue, 27 Aug 2019 06:27:14 +0000 (15:27 +0900)]
Fix svace issue
Change-Id: Ia2d8b4a8253dd0c771456ea2579fe3c17b4c69fd
Signed-off-by: Yunmi Ha <yunmi.ha@samsung.com>
Mateusz Majewski [Fri, 23 Aug 2019 06:38:10 +0000 (08:38 +0200)]
Move the get_format_sorting call
This makes the set_sorting function slightly more general.
Change-Id: Ic77b0fa60bb4007baa90779905e6381e54262078
Mateusz Majewski [Fri, 23 Aug 2019 06:37:17 +0000 (08:37 +0200)]
Make sure the JSON format uses default sorting
Change-Id: If20ef91a202adf993b923b2f992036c6dcee88ac
Michal Bloch [Wed, 21 Aug 2019 13:27:14 +0000 (13:27 +0000)]
Merge "Move log filtering out of log writing" into tizen
Michal Bloch [Wed, 21 Aug 2019 13:26:52 +0000 (13:26 +0000)]
Merge "Decouple filtering and formatting messages" into tizen
Mateusz Majewski [Wed, 14 Aug 2019 09:24:08 +0000 (11:24 +0200)]
Add some JSON tests
Note that it still remains to test some of the failure cases.
Change-Id: Ie2222875b7ecafd44400e671d8b5dc51d002c694
Mateusz Majewski [Mon, 12 Aug 2019 08:25:25 +0000 (10:25 +0200)]
Move log filtering out of log writing
This also adds a nice bonus -- now, in dlogutil, the incoming logs
are only filtered once, and in one place.
Change-Id: I443b48967344353b0a92731295d11a369d9de2fb
Mateusz Majewski [Thu, 1 Aug 2019 10:58:25 +0000 (12:58 +0200)]
Decouple filtering and formatting messages
The log_filter struct contains both info on which messages to print,
and info on how to print them. If we want to provide a simple API that
allows applications to read log messages, we need to know which messages
to give to them, but there's no printing involved. Therefore, we need to
split the log_filter struct into the two structs, each with a single
responsibility.
To add to this, the filtering data is contained in the log_file struct.
All the other data contained in it is only meaningful when printing.
Therefore, we also need to pull the log_filter struct out of it, as we
probably are not going to use the log_file struct in the future
libdlogutil library.
Change-Id: Ied9e34ece9c7ee34c8249fcd201c167275a27fb3
Mateusz Majewski [Fri, 16 Aug 2019 08:35:04 +0000 (10:35 +0200)]
Cover a line in logconfig.c
Change-Id: I422cbbfdb0a96e173a0a08615e309530fe3cba45
Mateusz Majewski [Fri, 16 Aug 2019 09:19:43 +0000 (11:19 +0200)]
Fix various typos
Change-Id: I0e288eb04c33dfcdb0a1e728cddca1a340c150ba
Mateusz Majewski [Wed, 14 Aug 2019 11:33:12 +0000 (13:33 +0200)]
Fix logprint time_t handling
In JSON formatting, I passed to localtime an int variable cast to
time_t. This is UB, as the size of time_t is not defined (in fact,
time_t doesn't even need to be an integer in C). This commit fixes this
by assigning the data to a temporary time_t variable.
Also, such a system was already present when formatting to other
formats, but it featured an unnecessary cast, which this commit removes.
Change-Id: I75d30cf211b9d05c833a798070cf3c0a445956ef
Yunmi Ha [Wed, 10 Jul 2019 02:48:12 +0000 (11:48 +0900)]
Fix coverity issues
- check return value
- initialize the memory
Change-Id: Iebf46f98466d94991e949687ffb6310a4c1c85d5
Signed-off-by: Yunmi Ha <yunmi.ha@samsung.com>
Karol Lewandowski [Fri, 2 Aug 2019 15:19:25 +0000 (15:19 +0000)]
Merge "Fix a potential privilege escalation" into tizen
Michal Bloch [Tue, 12 Feb 2019 10:50:57 +0000 (11:50 +0100)]
shared: fix timestamp inconsistencies
Change-Id: I123446edceeaa9d0552f30a351fb150aa45125ed
Michal Bloch [Mon, 29 Jul 2019 13:45:56 +0000 (15:45 +0200)]
Fix a potential privilege escalation
Change-Id: I97a4fa568a5a0eb035981803f85addcee833fec4
Signed-off-by: Michal Bloch <m.bloch@samsung.com>
Mateusz Majewski [Wed, 10 Jul 2019 13:11:08 +0000 (15:11 +0200)]
Add the JSON format to dlogutil
Change-Id: I10600b919c73d4279f34721a0a3e0bf7efc425a5
Mateusz Majewski [Thu, 25 Jul 2019 09:47:21 +0000 (11:47 +0200)]
Add marking invalid timestamps
Some formats don't include both realtime and monotonic timestamps.
Currently, the missing timestamps are set to various values (either
the other timestamp or 0). This commit makes it so the nanosecond value
of missing timestamps is set to a normally impossible value of -1.
Change-Id: I458b9049e9e5b0581ae138a352b66b9821e3fc5a
Mateusz Majewski [Fri, 26 Jul 2019 11:09:46 +0000 (13:09 +0200)]
Add some more tests covering a part of logger.c
Change-Id: I0c03265bdc859809b3f7d0187fd9b52c3ec4a256
Mateusz Majewski [Tue, 23 Jul 2019 10:49:49 +0000 (12:49 +0200)]
Address the complaints of SVACE
One of them is even legitimate -- if the test was run in low memory
conditions, it could try to dereference NULL. Thanks, SVACE!
Change-Id: I61e835cc883daf6201d6ecb1a09e633047ad988f
Mateusz Majewski [Tue, 23 Jul 2019 10:10:49 +0000 (12:10 +0200)]
Reuse writer_close_fd in writer_free
It's still useful to have writer_free, since writer_create puts the new
writer directly on the heap.
Change-Id: Ia9dec7651ff322ab39818ff23e7e6f8540cf1259
Mateusz Majewski [Tue, 23 Jul 2019 08:53:06 +0000 (10:53 +0200)]
Improve modify_fd_entity
In a case in which modify_fd_entity failed, it would still record the
modification as done. This would make it fail silently without calling
epoll_ctl next time it was called, which is at least unintuitive.
Change-Id: I85b427c376e08241d33b2f864c8d16ad53c5cd7a
Mateusz Majewski [Fri, 19 Jul 2019 08:34:24 +0000 (10:34 +0200)]
Add tests covering a minor part of logger.c
Covering the entire file will unfortunately be difficult, as this commit
is already big (and pretty ugly), yet it only covers 1/6 of logger.c.
Change-Id: I46825c5c2dfaad00791356b2d3944bb54185819b
Mateusz Majewski [Fri, 19 Jul 2019 13:08:22 +0000 (15:08 +0200)]
Cover the last line of logprint.c
Change-Id: I7014206d3fc8942ba9410a19eef4a3d6b82d8fe5
Mateusz Majewski [Thu, 18 Jul 2019 12:01:15 +0000 (14:01 +0200)]
Fix a minor FD leak
Not that it matters, since we quit immediately if this happens,
but still.
Change-Id: Id97227e9cf8f377626d61144b1506f524c2a46d5
Mateusz Majewski [Thu, 18 Jul 2019 09:21:01 +0000 (11:21 +0200)]
Add tests covering a part of logutil.c
Sadly, I think that testing the remaining functions will be difficult
(too difficult for me) without refactoring them.
Change-Id: I8a37c3ba4e213f784d6b85356d235298e0cfb5c1
Mateusz Majewski [Fri, 5 Jul 2019 12:55:23 +0000 (14:55 +0200)]
Add colored headers
Change-Id: I8b83709073604799fa38855f2c5ff2b46533a52a
Mateusz Majewski [Tue, 9 Jul 2019 07:17:52 +0000 (09:17 +0200)]
Convert FilterInfo's custom list to the one from ptrs_list
Change-Id: If2b4373209b16b4b8e50e2a302f3568009e059e3
Mateusz Majewski [Tue, 16 Jul 2019 07:34:37 +0000 (09:34 +0200)]
Change config so that we won't try to open /dev/null
While this is not the prettiest syntax imaginable (and it might remind
some people of Pascal), it's probably the simplest way to achieve our
goal, since there's no need for any additional code.
Change-Id: Id8258932479fbd8d015193e1ed62ca3f6a62d5fe
Mateusz Majewski [Mon, 15 Jul 2019 09:00:17 +0000 (11:00 +0200)]
Add fdi_pipe.c tests
Also, a little issue in send_logger_request was found; it could send
too many null bytes at the end of the message. This was also fixed.
Change-Id: I410bd91bfc2329768be9397c6d095830ff1d2d00
Mateusz Majewski [Mon, 15 Jul 2019 12:43:03 +0000 (14:43 +0200)]
Fix reset_self_privledges
Change-Id: Icad7b11b46e6da1095e7c728ad9d68c83540f771
Mateusz Majewski [Wed, 10 Jul 2019 06:29:58 +0000 (08:29 +0200)]
Add tests for the monotonic timestamps functionality
Change-Id: I6a4f32d604acba8b6145a0817112a5c998fc2ab1
Michal Bloch [Fri, 12 Jul 2019 19:37:15 +0000 (19:37 +0000)]
Merge "Add new tests to cover a branch in fdi_push_log" into tizen
Mateusz Majewski [Thu, 11 Jul 2019 08:03:08 +0000 (10:03 +0200)]
Make dlogutil not quit on SIGSTOP
Change-Id: Ie02d4a8b4c86b86a5f273a5870db53ac05bd9640
Mateusz Majewski [Wed, 10 Jul 2019 10:04:17 +0000 (12:04 +0200)]
Add new tests to cover a branch in fdi_push_log
Change-Id: I1a2ad76ba932b8df3824563cc6f54a43e41e1995
Mateusz Majewski [Fri, 5 Jul 2019 05:39:54 +0000 (07:39 +0200)]
Refactor shared_query to reduce link-time dependencies
Change-Id: If654a491d32148aecd2267b64e211487ebcfd906
INSUN PYO [Mon, 24 Jun 2019 06:05:14 +0000 (15:05 +0900)]
Remove unused path files
Change-Id: Id9270ddc3eac8fc2da82f89ea2b94f72162e2e2f
Maciej Slodczyk [Fri, 21 Jun 2019 12:40:59 +0000 (14:40 +0200)]
util: speed up dumping dlogutil
Dlogutil had a chance to print logs only when the
sorting buffer was full(1) or there was no available
data in pipes(2). By checking if there are no really,
really old logs in sorting buffer independently of (1)
and (2) we can make util more responsive.
Change-Id: I59dd69f0ea00dcd1e8d8de3e7f80951c5a1a1948
Signed-off-by: Maciej Slodczyk <m.slodczyk2@partner.samsung.com>
Maciej Slodczyk [Thu, 13 Jun 2019 16:08:47 +0000 (18:08 +0200)]
daemon: update pipe config file comments
Change-Id: Iec8133046c54652ffd5d0954c1bbe183aad676a7
Signed-off-by: Maciej Slodczyk <m.slodczyk2@partner.samsung.com>
Hyotaek Shim [Wed, 5 Jun 2019 04:46:47 +0000 (04:46 +0000)]
Revert "logger: Server is optional with logger backend - do not let it block booting sequence"
This reverts commit
7eaad8b579fa11aa138f0d55dfed47d93e5a9048.
Change-Id: Ied38cc339d6c900b3816d6055f983b9758911445
Karol Lewandowski [Tue, 4 Jun 2019 15:00:39 +0000 (17:00 +0200)]
logger: Server is optional with logger backend - do not let it block booting sequence
With logger backend dlog_logger is used only to save logs to persistent storage.
Change-Id: I2cf224f9681435855d7c34690e5725b4e88546c6
Hyotaek Shim [Mon, 3 Jun 2019 09:10:48 +0000 (18:10 +0900)]
Remove unused rpm dlogbackend-logger
Change-Id: I03b8751939b25faed1f7409629d557de604130fb
Signed-off-by: Hyotaek Shim <hyotaek.shim@samsung.com>
Michal Bloch [Fri, 24 May 2019 14:27:18 +0000 (16:27 +0200)]
libdlog: reinitialize on each log if need be
Change-Id: I613cba9e29cbbe1581912cb1fccdce8c504ac536
Signed-off-by: Michal Bloch <m.bloch@samsung.com>
Michal Bloch [Mon, 20 May 2019 11:41:48 +0000 (13:41 +0200)]
libdlog: do lazy initialisation (no constructor)
Reasons: some long-living processes which start before dlog can initialize
properly but don't log anything until later, the ability to wrap some calls
before dlog can use them. See the comments inside for more details.
Change-Id: I808a2e7774f74a4c7ead68c6a6dac7cc7d2082e8
Signed-off-by: Michal Bloch <m.bloch@samsung.com>
Karol Lewandowski [Fri, 5 Apr 2019 14:12:40 +0000 (16:12 +0200)]
packaging: Unify package naming
All packages briging only configuration will start with config-
prefix.
dlogbackend-logger package is kept for transition period only -
it can be safely removed after installation.
Change-Id: Iaac5737e6d6b8c9968c592f432e5e9435b6ba55d
Michal Bloch [Wed, 15 May 2019 09:28:26 +0000 (11:28 +0200)]
tests: can handle different error message formats
Change-Id: Id171f3b632a56313bbe914e0079bce3aa38ef19b
Signed-off-by: Michal Bloch <m.bloch@samsung.com>
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
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
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>
Hyotaek Shim [Mon, 8 Apr 2019 02:28:31 +0000 (11:28 +0900)]
Modify platform upgrade scripts
Change-Id: Id737055332994dff6297468a41c7799f91e20c4b
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>
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>
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>
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>
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>
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
Michal Bloch [Fri, 22 Feb 2019 13:28:36 +0000 (14:28 +0100)]
libdlog: construct with the maximum priority
Change-Id: I4ee302ef4f016d1ba43ed5da6e4ddd6cd59f5122
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
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>
INSUN PYO [Tue, 19 Feb 2019 08:22:00 +0000 (17:22 +0900)]
spec: remove unnecessary /
Change-Id: Ibc31e92d8db6390a70097ccac380851a41327675
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>
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
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
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>
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>
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
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>
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>
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>
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>
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
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>
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>
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>
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>
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>
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>
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>
Hyotaek Shim [Sat, 2 Feb 2019 04:19:41 +0000 (04:19 +0000)]
Merge "tests: deal with some unreachable cases" into tizen
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>