~ubuntu-branches/ubuntu/trusty/syslog-ng/trusty-proposed

« back to all changes in this revision

Viewing changes to tests/unit/test_zone.c

  • Committer: Package Import Robot
  • Author(s): Laszlo Boszormenyi (GCS), Gergely Nagy
  • Date: 2011-10-11 14:30:48 UTC
  • mfrom: (1.3.7)
  • Revision ID: package-import@ubuntu.com-20111011143048-r1iljux9xbvj3lwh
Tags: 3.3.1.dfsg-1
* New upstream release with important fixes from upstream git tree with
  non-free manpages removed.
* Drop syslog-ng.conf(5) (closes: #496521).
* syslog-ng(8) is generated, and does not mention -Q anymore
  (closes: #616069).
* Supports CAP_SYSLOG on recent kernels (closes: #630172).
* Does not use g_timeout_add_seconds anymore (closes: #609154).

[ Gergely Nagy <algernon@madhouse-project.org> ]
* Update debian/copyright to DEP-5 format.
* Simplified the logrotate file by merging identical entries.
* Include local configuration files from /etc/syslog-ng/conf.d/ (Closes:
  #609050).
* Update syslog-ng.conf to be fully 3.3 compliant.
* Compress both source and binaries (except the syslog-ng meta
  package) with xz, instead of gzip.
* Use dpkg triggers to restart syslog-ng when appropriate.
* Include DFSG-free manual pages for all binaries.
* Build with Hardening enabled.
* Mention syslog(3) in /etc/default/syslog-ng, instead of
  <linux/kernel.h> (Closes: #608605)
* Support 'status' in the init script.
  Patch from Peter Eisentraut <petere@debian.org> (Closes: #644458)
* Build-Depend on libevtlog-dev (>= 0.2.12-5~) for correct shlibs.
* Use [linux-any] in Build-Depends instead of hardcoded links.
  (Closes: #634715)
* Use $SYSLOGNG_OPTS in the init script when reloading syslog-ng.
  (Closes: #589081)

Show diffs side-by-side

added added

removed removed

Lines of Context:
2
2
#include "apphook.h"
3
3
#include "timeutils.h"
4
4
#include "timeutils.h"
 
5
#include "logstamp.h"
5
6
#include <stdlib.h>
6
7
#include <string.h>
7
8
#include <stdio.h>
88
89
 
89
90
 
90
91
int
91
 
main(int argc, char *argv[])
 
92
test_zones(void)
92
93
{
93
94
  gint rc = 0;
94
95
  time_t now;
95
96
 
96
 
  app_startup();
97
97
  /* 2005-10-14 21:47:37 CEST, dst enabled */
98
98
  testcase("MET-1METDST", 1129319257, 7200);
99
99
  /* 2005-11-14 10:10:00 CET, dst disabled */
735
735
  TEST_ASSERT(test_timezone(now, "Australia/Lord_Howe"));
736
736
  TEST_ASSERT(test_timezone(now, "NZ"));
737
737
#endif
 
738
  return rc;
 
739
}
 
740
 
 
741
int
 
742
test_logstamp(void)
 
743
{
 
744
  LogStamp stamp;
 
745
  GString *target = g_string_sized_new(32);
 
746
  gint rc = 0;
 
747
 
 
748
  stamp.tv_sec = 1129319257;
 
749
  stamp.tv_usec = 123456;
 
750
 
 
751
  /* formats */
 
752
  log_stamp_format(&stamp, target, TS_FMT_BSD, 3600, 3);
 
753
  TEST_ASSERT(strcmp(target->str, "Oct 14 20:47:37.123") == 0);
 
754
  log_stamp_format(&stamp, target, TS_FMT_ISO, 3600, 3);
 
755
  TEST_ASSERT(strcmp(target->str, "2005-10-14T20:47:37.123+01:00") == 0);
 
756
  log_stamp_format(&stamp, target, TS_FMT_FULL, 3600, 3);
 
757
  TEST_ASSERT(strcmp(target->str, "2005 Oct 14 20:47:37.123") == 0);
 
758
  log_stamp_format(&stamp, target, TS_FMT_UNIX, 3600, 3);
 
759
  TEST_ASSERT(strcmp(target->str, "1129319257.123") == 0);
 
760
 
 
761
  /* timezone offsets */
 
762
  log_stamp_format(&stamp, target, TS_FMT_ISO, 5400, 3);
 
763
  TEST_ASSERT(strcmp(target->str, "2005-10-14T21:17:37.123+01:30") == 0);
 
764
  log_stamp_format(&stamp, target, TS_FMT_ISO, -3600, 3);
 
765
  TEST_ASSERT(strcmp(target->str, "2005-10-14T18:47:37.123-01:00") == 0);
 
766
  log_stamp_format(&stamp, target, TS_FMT_ISO, -5400, 3);
 
767
  TEST_ASSERT(strcmp(target->str, "2005-10-14T18:17:37.123-01:30") == 0);
 
768
  g_string_free(target, TRUE);
 
769
  return rc;
 
770
}
 
771
 
 
772
int
 
773
main(int argc, char *argv[])
 
774
{
 
775
  gint rc;
 
776
  app_startup();
 
777
 
 
778
  rc = test_logstamp() | test_zones();;
738
779
  app_shutdown();
739
780
  return rc;
740
781
}