summaryrefslogtreecommitdiffstats
path: root/t
Commit message (Collapse)AuthorAgeFilesLines
* Fix a few test casesGergely Nagy2012-08-121-21/+22
| | | | | | | | The test_overrides() test must be run first, otherwise we'll already likely not have a clean environment to test in. Furthermore, when testing discovery, make sure that NOIMPLICIT is not set. Signed-off-by: Gergely Nagy <algernon@balabit.hu>
* Fix test_perfGergely Nagy2012-08-111-2/+3
| | | | | | | test_perf was still relying on the old behaviour of ul_openlog(): no more, it uses ul_set_log_flags() now. Signed-off-by: Gergely Nagy <algernon@balabit.hu>
* Test reorganisationGergely Nagy2012-08-112-178/+230
| | | | | | | | | | | | Moved some tests around between test_umberlog and test_umberlog_preload, so only those tests remain in test_umberlog_preload that do test something that the LD_PRELOAD lib variant provides. Also added a comment above each test to quickly clarify what they're meant to test. Signed-off-by: Gergely Nagy <algernon@balabit.hu>
* LOG_UL_NODISCOVER => LOG_UL_NOIMPLICITGergely Nagy2012-08-113-37/+44
| | | | | | | | Based on a suggestion by Miloslav Trmač <mitr@redhat.com>, rename LOG_UL_NODISCOVER to LOG_UL_NOIMPLICIT, and clarify the documentation slightly. Signed-off-by: Gergely Nagy <algernon@balabit.hu>
* Support disabling discovery for the LD_PRELOAD variantGergely Nagy2012-08-102-1/+37
| | | | | | | | When compiled with --disable-discovery, the LD_PRELOAD variant will have automatic field discovery disabled. This does not affect the linkable library, which always has them enabled by default. Signed-off-by: Gergely Nagy <algernon@balabit.hu>
* Introduce ul_set_log_flags()Gergely Nagy2012-08-102-97/+142
| | | | | | | | | | | | | | Instead of piggy-backing on ul_openlog(), and accepting new flags at openlog()-time, use a separate function, ul_set_log_flags() to achieve the same. This way, anyone who wants to flip any of the new flags, will have to use ul_set_log_flags(), as ul_openlog() ignores them from now on. This is based on work done by Miloslav Trmač <mitr@redhat.com>, and is both an API and an ABI breakage. Signed-off-by: Gergely Nagy <algernon@balabit.hu>
* Split the library into a linkable and an LD_PRELOAD-able partGergely Nagy2012-08-105-324/+456
| | | | | | | | | | | | In order to satisfy the desire of using libumberlog, specifically ul_format(), without having to worry about syslog() & friends being overridden, split the library into two parts: A linkable library, which provides the new API, but does not override the legacy syslog() functions; and a new, LD_PRELOAD-able part, which does override the old ones. Signed-off-by: Gergely Nagy <algernon@balabit.hu>
* Whitespace & coding style cleanupGergely Nagy2012-08-101-1/+1
| | | | Signed-off-by: Gergely Nagy <algernon@balabit.hu>
* Remove some unused variables.Miloslav Trmač2012-07-301-1/+0
| | | | Signed-off-by: Miloslav Trmač <mitr@redhat.com>
* Mark missing host name separately from flags.Miloslav Trmač2012-07-301-0/+2
| | | | | | | | | | | This simplifies the syslog() path a little, and allows us to express "host name should be cached but no value is set.". Because host name field is already emptied by default and in closelog (), this also means uncached data is used before openlog () and after closelog (). Signed-off-by: Miloslav Trmač <mitr@redhat.com>
* Initialize [UG]ID to "no value cached"Miloslav Trmač2012-07-301-0/+8
| | | | | | | Now syslog () without openlog () will include a correct [UG]ID value instead of 0. Also reset the cache on closelog (). Signed-off-by: Miloslav Trmač <mitr@redhat.com>
* Initialize PID to "no value cached"Miloslav Trmač2012-07-301-0/+18
| | | | | | | Now syslog () without openlog () will include a correct PID value instead of 0. Also reset the cache on closelog (). Signed-off-by: Miloslav Trmač <mitr@redhat.com>
* Don't reset flags on closelog()Miloslav Trmač2012-07-301-0/+11
| | | | ... to be compatible with BSD syslog.
* Default ident (log tag) to program_invocation_short_nameMiloslav Trmač2012-07-301-0/+8
| | | | | | | This is a glibc variable, so leave the "program" field missing on platforms that don't support it. Signed-off-by: Miloslav Trmač <mitr@redhat.com>
* Don't include "program": "(null)" if ident is not setMiloslav Trmač2012-07-301-0/+2
| | | | Signed-off-by: Miloslav Trmač <mitr@redhat.com>
* Don't reset facility on closelog()Miloslav Trmač2012-07-301-2/+2
| | | | | | | This is not defined by closelog(3p), and the BSD implementation doesn't do it either. Signed-off-by: Miloslav Trmač <mitr@redhat.com>
* Change the default facility to LOG_USER.Miloslav Trmač2012-07-301-0/+20
| | | | | | ... to comply with openlog(3p). Signed-off-by: Miloslav Trmač <mitr@redhat.com>
* Leave printf format parsing to glibc if possible.Gergely Nagy2012-07-191-0/+35
| | | | | | | | | | | | | Call glibc's parse_printf_format() to gather information about argument types. This automatically handles positional parameters and user-defined printf formats for ordinary parameter types; it doesn't handle user-defined printf parameter types (such as defined by libdfp for decimal floating-point). Also add a (non-comprehensive) test. Signed-off-by: Miloslav Trmač <mitr@redhat.com> Signed-off-by: Gergely Nagy <algernon@balabit.hu>
* t/test_umberlog: Fix a minor indentation issueGergely Nagy2012-06-221-1/+1
| | | | Signed-off-by: Gergely Nagy <algernon@balabit.hu>
* Test escaping of all control charactersMiloslav Trmač2012-06-221-0/+7
| | | | | | ... now that \f does not break the test. Signed-off-by: Miloslav Trmač <mitr@redhat.com>
* Don't create unnecessary libtool wrapper scripts for testsGergely Nagy2012-06-221-0/+1
| | | | | | | This marginally speeds up build, and simplifies debugging/valgrind runs Signed-off-by: Miloslav Trmač <mitr@redhat.com> Signed-off-by: Gergely Nagy <algernon@balabit.hu>
* Convert the test suite to CheckGergely Nagy2012-04-292-32/+51
| | | | | | | | | | | While assert() is a neat tool, it is not really suitable for testing, as it gives hardly any indication on what part of the test suite failed, and why. For this purpose, an existing testing library, such as Check is a much better option, so lets use that! Signed-off-by: Gergely Nagy <algernon@madhouse-project.org>
* Add a closelog() wrapper to clear the environmentGergely Nagy2012-04-281-0/+19
| | | | | | | | | | | | | | | Our openlog() wrapper fills in a couple of variables, and those were kept around even after a closelog(), and thus, affected ul_format() calls even after a closelog(). This in turn, made one of the test cases fail, as that was relying on the default behaviour, which was modified due to an openlog() in an earlier test case. We now wrap closelog() aswell, and NULL out our settings to get a clean state, and add a test case to verify this behaviour aswell. Signed-off-by: Gergely Nagy <algernon@madhouse-project.org>
* Resolve facility & priority properlyGergely Nagy2012-04-201-0/+18
| | | | | | | | | | | | | | | | | | | The priority passed to the syslog() call can contain a facility embedded, so we need to extract it to find both the facility and the priority. This also means that the facility set at openlog()-time can be overridden later, so _find_facility() has to take the priority value into account. This patch makes libumberlog do just the above: extract both priority and facility from the priority passed to syslog(), and if facility is 0, use the default set at openlog()-time, if any. Added a test case to test this expected behaviour. Reported-by: Peter Czanik <czanik@balabit.hu> Signed-off-by: Gergely Nagy <algernon@balabit.hu>
* Make json-c optional.Gergely Nagy2012-04-131-0/+2
| | | | | | | When json-c is not found, instead of failing at configure time, continue, but disable the test suite. Signed-off-by: Gergely Nagy <algernon@balabit.hu>
* Implement string escaping.Gergely Nagy2012-04-131-0/+30
| | | | | | With this patch, both JSON keys and values will be properly escaped. Signed-off-by: Gergely Nagy <algernon@balabit.hu>
* t/: Add a new performance test.Gergely Nagy2012-04-132-1/+74
| | | | | | | The new test case always succeeds, it's purpose is to echo the performance results. Signed-off-by: Gergely Nagy <algernon@balabit.hu>
* Portability fixesGergely Nagy2012-03-241-2/+2
| | | | | | | | Use _POSIX_HOST_NAME_MAX instead of HOST_NAME_MAX: both Linux and FreeBSD have the former, but FreeBSD does not have HOST_NAME_MAX in limits.h Signed-off-by: Gergely Nagy <algernon@balabit.hu>
* Rename the project to libumberlogGergely Nagy2012-03-232-20/+20
| | | | Signed-off-by: Gergely Nagy <algernon@balabit.hu>
* Check (v)asprintf() return values.Gergely Nagy2012-03-221-1/+2
| | | | | | | If (v)asprintf() returns an error, abort() away, because we can't possibly proceed. Signed-off-by: Gergely Nagy <algernon@balabit.hu>
* Add the timestamp to the JSON payload too.Gergely Nagy2012-03-211-0/+30
| | | | | | Add high-precision timestamp to the JSON payload (unless disabled). Signed-off-by: Gergely Nagy <algernon@balabit.hu>
* Include the hostname in the JSON payload.Gergely Nagy2012-03-211-0/+6
| | | | | | | Include the hostname (as returned by gethostname()) in the JSON payload. Test case updated to verify this. Signed-off-by: Gergely Nagy <algernon@balabit.hu>
* t: Make sure that discovered fields override supplied ones.Gergely Nagy2012-03-201-0/+31
| | | | Signed-off-by: Gergely Nagy <algernon@balabit.hu>
* Implement a test suite.Gergely Nagy2012-03-202-0/+140
The test suite uses cee_format() to format the messages, and parses the resulting string back into JSON, and verifies that certain key values are what we expect them to be. Signed-off-by: Gergely Nagy <algernon@balabit.hu>