diff options
Diffstat (limited to 'tests')
90 files changed, 1381 insertions, 96 deletions
diff --git a/tests/Makefile.am b/tests/Makefile.am index b339e79..0fa5a36 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -6,7 +6,16 @@ TESTS = $(TESTRUNS) if ENABLE_IMDIAG TESTS += \ + stop-localvar.sh \ + stop-msgvar.sh \ + fac_authpriv.sh \ + fac_local0.sh \ + fac_mail.sh \ + fac_news.sh \ + fac_uucp.sh \ + rfc5424parser.sh \ arrayqueue.sh \ + global_vars.sh \ da-mainmsg-q.sh \ validation-run.sh \ imtcp-multiport.sh \ @@ -14,6 +23,7 @@ TESTS += \ diskqueue.sh \ diskqueue-fsync.sh \ rulesetmultiqueue.sh \ + rulesetmultiqueue-v6.sh \ manytcp.sh \ rsf_getenv.sh \ imtcp_conndrop.sh \ @@ -45,6 +55,7 @@ TESTS += \ execonlywhenprevsuspended2.sh \ execonlywhenprevsuspended3.sh \ execonlywhenprevsuspended4.sh \ + execonlywhenprevsuspended_multiwrkr.sh \ pipe_noreader.sh \ dircreate_dflt.sh \ dircreate_off.sh \ @@ -53,10 +64,11 @@ TESTS += \ imuxsock_ccmiddle_root.sh \ udp-msgreduc-vg.sh \ udp-msgreduc-orgmsg-vg.sh \ - queue-persist.sh + queue-persist.sh \ discard-rptdmsg.sh \ discard-allmark.sh \ discard.sh \ + stop.sh \ failover-async.sh \ failover-double.sh \ failover-basic.sh \ @@ -71,6 +83,7 @@ TESTS += \ rscript_prifilt.sh \ rscript_optimizer1.sh \ rscript_ruleset_call.sh \ + rs_optimizer_pri.sh \ cee_simple.sh \ cee_diskqueue.sh \ incltest.sh \ @@ -96,7 +109,9 @@ if ENABLE_MYSQL_TESTS TESTS += \ mysql-basic.sh \ mysql-basic-cnf6.sh \ - mysql-asyn.sh + mysql-asyn.sh \ + mysql-actq-mt.sh \ + mysql-actq-mt-withpause.sh if ENABLE_OMLIBDBI TESTS += \ libdbi-basic.sh \ @@ -105,7 +120,8 @@ endif if HAVE_VALGRIND TESTS += \ mysql-basic-vg.sh \ - mysql-asyn-vg.sh + mysql-asyn-vg.sh \ + mysql-actq-mt-withpause-vg.sh endif endif @@ -117,6 +133,27 @@ TESTS += \ imptcp_conndrop.sh endif +if ENABLE_ELASTICSEARCH +TESTS += \ + elasticsearch-basic.sh \ + elasticsearch-basic-bulk.sh \ + elasticsearch-basic-errorfile-empty.sh \ + elasticsearch-basic-errorfile-populated.sh \ + elasticsearch-bulk-errorfile-empty.sh \ + elasticsearch-bulk-errorfile-populated.sh +endif + +if ENABLE_MMPSTRUCDATA +TESTS += \ + mmpstrucdata.sh +endif + +if ENABLE_MMJSONPARSE +TESTS += \ + mmjsonparse_simple.sh \ + mmjsonparse_cim.sh +endif + if ENABLE_GNUTLS # TODO: re-enable in newer version #TESTS += \ @@ -134,6 +171,10 @@ if ENABLE_OMUXSOCK TESTS += uxsock_simple.sh endif +if ENABLE_RELP +TESTS += sndrcv_relp.sh +endif + if ENABLE_OMUDPSPOOF TESTS += sndrcv_omudpspoof.sh \ sndrcv_omudpspoof_nonstdpt.sh @@ -289,6 +330,40 @@ EXTRA_DIST= 1.rstest 2.rstest 3.rstest err1.rstest \ testsuites/rscript_stop.conf \ rscript_stop2.sh \ testsuites/rscript_stop2.conf \ + stop.sh \ + testsuites/stop.conf \ + rscript_le.sh \ + testsuites/rscript_le.conf \ + rscript_ge.sh \ + testsuites/rscript_ge.conf \ + rscript_lt.sh \ + testsuites/rscript_lt.conf \ + rscript_gt.sh \ + testsuites/rscript_gt.conf \ + rscript_ne.sh \ + testsuites/rscript_ne.conf \ + rscript_eq.sh \ + testsuites/rscript_eq.conf \ + stop-localvar.sh \ + testsuites/stop-localvar.conf \ + stop-msgvar.sh \ + testsuites/stop-msgvar.conf \ + global_vars.sh \ + testsuites/global_vars.conf \ + rfc5424parser.sh \ + testsuites/rfc5424parser.conf \ + fac_authpriv.sh \ + testsuites/fac_authpriv.conf \ + fac_local0.sh \ + testsuites/fac_local0.conf \ + fac_mail.sh \ + testsuites/fac_mail.conf \ + fac_news.sh \ + testsuites/fac_news.conf \ + fac_uucp.sh \ + testsuites/fac_uucp.conf \ + rs_optimizer_pri.sh \ + testsuites/rs_optimizer_pri.conf \ rscript_prifilt.sh \ testsuites/rscript_prifilt.conf \ rscript_optimizer1.sh \ @@ -299,6 +374,10 @@ EXTRA_DIST= 1.rstest 2.rstest 3.rstest err1.rstest \ testsuites/cee_simple.conf \ cee_diskqueue.sh \ testsuites/cee_diskqueue.conf \ + mmjsonparse_simple.sh \ + testsuites/mmjsonparse_simple.conf \ + mmjsonparse_cim.sh \ + testsuites/mmjsonparse_cim.conf \ incltest.sh \ testsuites/incltest.conf \ incltest_dir.sh \ @@ -308,6 +387,18 @@ EXTRA_DIST= 1.rstest 2.rstest 3.rstest err1.rstest \ incltest_dir_wildcard.sh \ testsuites/incltest_dir_wildcard.conf \ testsuites/incltest.d/include.conf \ + elasticsearch-basic.sh \ + testsuites/elasticsearch-basic.conf \ + elasticsearch-basic-bulk.sh \ + testsuites/elasticsearch-basic-bulk.conf \ + elasticsearch-basic-errorfile-empty.sh \ + testsuites/elasticsearch-basic-errorfile-empty.conf \ + elasticsearch-basic-errorfile-populated.sh \ + testsuites/elasticsearch-basic-errorfile-populated.conf \ + elasticsearch-bulk-errorfile-empty.sh \ + testsuites/elasticsearch-bulk-errorfile-empty.conf \ + elasticsearch-bulk-errorfile-populated.sh \ + testsuites/elasticsearch-bulk-errorfile-populated.conf \ linkedlistqueue.sh \ testsuites/linkedlistqueue.conf \ da-mainmsg-q.sh \ @@ -397,6 +488,9 @@ EXTRA_DIST= 1.rstest 2.rstest 3.rstest err1.rstest \ sndrcv.sh \ testsuites/sndrcv_sender.conf \ testsuites/sndrcv_rcvr.conf \ + sndrcv_relp.sh \ + testsuites/sndrcv_relp_sender.conf \ + testsuites/sndrcv_relp_rcvr.conf \ sndrcv_udp.sh \ testsuites/sndrcv_udp_sender.conf \ testsuites/sndrcv_udp_rcvr.conf \ @@ -460,6 +554,8 @@ EXTRA_DIST= 1.rstest 2.rstest 3.rstest err1.rstest \ testsuites/master.nolimittag \ rulesetmultiqueue.sh \ testsuites/rulesetmultiqueue.conf \ + rulesetmultiqueue-v6.sh \ + testsuites/rulesetmultiqueue-v6.conf \ omruleset.sh \ testsuites/omruleset.conf \ omruleset-queue.sh \ @@ -478,6 +574,8 @@ EXTRA_DIST= 1.rstest 2.rstest 3.rstest err1.rstest \ testsuites/execonlywhenprevsuspended3.conf \ execonlywhenprevsuspended4.sh \ testsuites/execonlywhenprevsuspended4.conf \ + execonlywhenprevsuspended_multiwrkr.sh \ + testsuites/execonlywhenprevsuspended_multiwrkr.conf \ tabescape_dflt.sh \ testsuites/tabescape_dflt.conf \ testsuites/1.tabescape_dflt \ @@ -511,6 +609,12 @@ EXTRA_DIST= 1.rstest 2.rstest 3.rstest err1.rstest \ mysql-asyn.sh \ mysql-asyn-vg.sh \ testsuites/mysql-asyn.conf \ + mysql-actq-mt.sh \ + mysql-actq-mt-withpause.sh \ + mysql-actq-mt-withpause-vg.sh \ + testsuites/mysql-actq-mt.conf \ + mmpstrucdata.sh \ + testsuites/mmpstrucdata.conf \ cfg.sh # TODO: re-enable diff --git a/tests/Makefile.in b/tests/Makefile.in index c8c959e..6524d86 100644 --- a/tests/Makefile.in +++ b/tests/Makefile.in @@ -48,10 +48,21 @@ host_triplet = @host@ @ENABLE_TESTBENCH_TRUE@ $(am__append_7) $(am__append_8) \ @ENABLE_TESTBENCH_TRUE@ $(am__append_9) $(am__append_10) \ @ENABLE_TESTBENCH_TRUE@ $(am__append_11) $(am__append_12) \ -@ENABLE_TESTBENCH_TRUE@ $(am__append_13) +@ENABLE_TESTBENCH_TRUE@ $(am__append_13) $(am__append_14) \ +@ENABLE_TESTBENCH_TRUE@ $(am__append_15) $(am__append_16) \ +@ENABLE_TESTBENCH_TRUE@ $(am__append_17) #TESTS = $(TESTRUNS) cfg.sh @ENABLE_IMDIAG_TRUE@@ENABLE_TESTBENCH_TRUE@am__append_1 = \ +@ENABLE_IMDIAG_TRUE@@ENABLE_TESTBENCH_TRUE@ stop-localvar.sh \ +@ENABLE_IMDIAG_TRUE@@ENABLE_TESTBENCH_TRUE@ stop-msgvar.sh \ +@ENABLE_IMDIAG_TRUE@@ENABLE_TESTBENCH_TRUE@ fac_authpriv.sh \ +@ENABLE_IMDIAG_TRUE@@ENABLE_TESTBENCH_TRUE@ fac_local0.sh \ +@ENABLE_IMDIAG_TRUE@@ENABLE_TESTBENCH_TRUE@ fac_mail.sh \ +@ENABLE_IMDIAG_TRUE@@ENABLE_TESTBENCH_TRUE@ fac_news.sh \ +@ENABLE_IMDIAG_TRUE@@ENABLE_TESTBENCH_TRUE@ fac_uucp.sh \ +@ENABLE_IMDIAG_TRUE@@ENABLE_TESTBENCH_TRUE@ rfc5424parser.sh \ @ENABLE_IMDIAG_TRUE@@ENABLE_TESTBENCH_TRUE@ arrayqueue.sh \ +@ENABLE_IMDIAG_TRUE@@ENABLE_TESTBENCH_TRUE@ global_vars.sh \ @ENABLE_IMDIAG_TRUE@@ENABLE_TESTBENCH_TRUE@ da-mainmsg-q.sh \ @ENABLE_IMDIAG_TRUE@@ENABLE_TESTBENCH_TRUE@ validation-run.sh \ @ENABLE_IMDIAG_TRUE@@ENABLE_TESTBENCH_TRUE@ imtcp-multiport.sh \ @@ -59,6 +70,7 @@ host_triplet = @host@ @ENABLE_IMDIAG_TRUE@@ENABLE_TESTBENCH_TRUE@ diskqueue.sh \ @ENABLE_IMDIAG_TRUE@@ENABLE_TESTBENCH_TRUE@ diskqueue-fsync.sh \ @ENABLE_IMDIAG_TRUE@@ENABLE_TESTBENCH_TRUE@ rulesetmultiqueue.sh \ +@ENABLE_IMDIAG_TRUE@@ENABLE_TESTBENCH_TRUE@ rulesetmultiqueue-v6.sh \ @ENABLE_IMDIAG_TRUE@@ENABLE_TESTBENCH_TRUE@ manytcp.sh \ @ENABLE_IMDIAG_TRUE@@ENABLE_TESTBENCH_TRUE@ rsf_getenv.sh \ @ENABLE_IMDIAG_TRUE@@ENABLE_TESTBENCH_TRUE@ imtcp_conndrop.sh \ @@ -90,6 +102,7 @@ host_triplet = @host@ @ENABLE_IMDIAG_TRUE@@ENABLE_TESTBENCH_TRUE@ execonlywhenprevsuspended2.sh \ @ENABLE_IMDIAG_TRUE@@ENABLE_TESTBENCH_TRUE@ execonlywhenprevsuspended3.sh \ @ENABLE_IMDIAG_TRUE@@ENABLE_TESTBENCH_TRUE@ execonlywhenprevsuspended4.sh \ +@ENABLE_IMDIAG_TRUE@@ENABLE_TESTBENCH_TRUE@ execonlywhenprevsuspended_multiwrkr.sh \ @ENABLE_IMDIAG_TRUE@@ENABLE_TESTBENCH_TRUE@ pipe_noreader.sh \ @ENABLE_IMDIAG_TRUE@@ENABLE_TESTBENCH_TRUE@ dircreate_dflt.sh \ @ENABLE_IMDIAG_TRUE@@ENABLE_TESTBENCH_TRUE@ dircreate_off.sh \ @@ -98,7 +111,33 @@ host_triplet = @host@ @ENABLE_IMDIAG_TRUE@@ENABLE_TESTBENCH_TRUE@ imuxsock_ccmiddle_root.sh \ @ENABLE_IMDIAG_TRUE@@ENABLE_TESTBENCH_TRUE@ udp-msgreduc-vg.sh \ @ENABLE_IMDIAG_TRUE@@ENABLE_TESTBENCH_TRUE@ udp-msgreduc-orgmsg-vg.sh \ -@ENABLE_IMDIAG_TRUE@@ENABLE_TESTBENCH_TRUE@ queue-persist.sh +@ENABLE_IMDIAG_TRUE@@ENABLE_TESTBENCH_TRUE@ queue-persist.sh \ +@ENABLE_IMDIAG_TRUE@@ENABLE_TESTBENCH_TRUE@ discard-rptdmsg.sh \ +@ENABLE_IMDIAG_TRUE@@ENABLE_TESTBENCH_TRUE@ discard-allmark.sh \ +@ENABLE_IMDIAG_TRUE@@ENABLE_TESTBENCH_TRUE@ discard.sh \ +@ENABLE_IMDIAG_TRUE@@ENABLE_TESTBENCH_TRUE@ stop.sh \ +@ENABLE_IMDIAG_TRUE@@ENABLE_TESTBENCH_TRUE@ failover-async.sh \ +@ENABLE_IMDIAG_TRUE@@ENABLE_TESTBENCH_TRUE@ failover-double.sh \ +@ENABLE_IMDIAG_TRUE@@ENABLE_TESTBENCH_TRUE@ failover-basic.sh \ +@ENABLE_IMDIAG_TRUE@@ENABLE_TESTBENCH_TRUE@ failover-rptd.sh \ +@ENABLE_IMDIAG_TRUE@@ENABLE_TESTBENCH_TRUE@ failover-no-rptd.sh \ +@ENABLE_IMDIAG_TRUE@@ENABLE_TESTBENCH_TRUE@ failover-no-basic.sh \ +@ENABLE_IMDIAG_TRUE@@ENABLE_TESTBENCH_TRUE@ rcvr_fail_restore.sh \ +@ENABLE_IMDIAG_TRUE@@ENABLE_TESTBENCH_TRUE@ rscript_contains.sh \ +@ENABLE_IMDIAG_TRUE@@ENABLE_TESTBENCH_TRUE@ rscript_field.sh \ +@ENABLE_IMDIAG_TRUE@@ENABLE_TESTBENCH_TRUE@ rscript_stop.sh \ +@ENABLE_IMDIAG_TRUE@@ENABLE_TESTBENCH_TRUE@ rscript_stop2.sh \ +@ENABLE_IMDIAG_TRUE@@ENABLE_TESTBENCH_TRUE@ rscript_prifilt.sh \ +@ENABLE_IMDIAG_TRUE@@ENABLE_TESTBENCH_TRUE@ rscript_optimizer1.sh \ +@ENABLE_IMDIAG_TRUE@@ENABLE_TESTBENCH_TRUE@ rscript_ruleset_call.sh \ +@ENABLE_IMDIAG_TRUE@@ENABLE_TESTBENCH_TRUE@ rs_optimizer_pri.sh \ +@ENABLE_IMDIAG_TRUE@@ENABLE_TESTBENCH_TRUE@ cee_simple.sh \ +@ENABLE_IMDIAG_TRUE@@ENABLE_TESTBENCH_TRUE@ cee_diskqueue.sh \ +@ENABLE_IMDIAG_TRUE@@ENABLE_TESTBENCH_TRUE@ incltest.sh \ +@ENABLE_IMDIAG_TRUE@@ENABLE_TESTBENCH_TRUE@ incltest_dir.sh \ +@ENABLE_IMDIAG_TRUE@@ENABLE_TESTBENCH_TRUE@ incltest_dir_wildcard.sh \ +@ENABLE_IMDIAG_TRUE@@ENABLE_TESTBENCH_TRUE@ incltest_dir_empty_wildcard.sh \ +@ENABLE_IMDIAG_TRUE@@ENABLE_TESTBENCH_TRUE@ linkedlistqueue.sh @ENABLE_IMDIAG_TRUE@@ENABLE_TESTBENCH_TRUE@@HAVE_VALGRIND_TRUE@am__append_2 = \ @ENABLE_IMDIAG_TRUE@@ENABLE_TESTBENCH_TRUE@@HAVE_VALGRIND_TRUE@ discard-rptdmsg-vg.sh \ @@ -112,7 +151,9 @@ host_triplet = @host@ @ENABLE_MYSQL_TESTS_TRUE@@ENABLE_TESTBENCH_TRUE@am__append_3 = \ @ENABLE_MYSQL_TESTS_TRUE@@ENABLE_TESTBENCH_TRUE@ mysql-basic.sh \ @ENABLE_MYSQL_TESTS_TRUE@@ENABLE_TESTBENCH_TRUE@ mysql-basic-cnf6.sh \ -@ENABLE_MYSQL_TESTS_TRUE@@ENABLE_TESTBENCH_TRUE@ mysql-asyn.sh +@ENABLE_MYSQL_TESTS_TRUE@@ENABLE_TESTBENCH_TRUE@ mysql-asyn.sh \ +@ENABLE_MYSQL_TESTS_TRUE@@ENABLE_TESTBENCH_TRUE@ mysql-actq-mt.sh \ +@ENABLE_MYSQL_TESTS_TRUE@@ENABLE_TESTBENCH_TRUE@ mysql-actq-mt-withpause.sh @ENABLE_MYSQL_TESTS_TRUE@@ENABLE_OMLIBDBI_TRUE@@ENABLE_TESTBENCH_TRUE@am__append_4 = \ @ENABLE_MYSQL_TESTS_TRUE@@ENABLE_OMLIBDBI_TRUE@@ENABLE_TESTBENCH_TRUE@ libdbi-basic.sh \ @@ -120,7 +161,8 @@ host_triplet = @host@ @ENABLE_MYSQL_TESTS_TRUE@@ENABLE_TESTBENCH_TRUE@@HAVE_VALGRIND_TRUE@am__append_5 = \ @ENABLE_MYSQL_TESTS_TRUE@@ENABLE_TESTBENCH_TRUE@@HAVE_VALGRIND_TRUE@ mysql-basic-vg.sh \ -@ENABLE_MYSQL_TESTS_TRUE@@ENABLE_TESTBENCH_TRUE@@HAVE_VALGRIND_TRUE@ mysql-asyn-vg.sh +@ENABLE_MYSQL_TESTS_TRUE@@ENABLE_TESTBENCH_TRUE@@HAVE_VALGRIND_TRUE@ mysql-asyn-vg.sh \ +@ENABLE_MYSQL_TESTS_TRUE@@ENABLE_TESTBENCH_TRUE@@HAVE_VALGRIND_TRUE@ mysql-actq-mt-withpause-vg.sh @ENABLE_IMPTCP_TRUE@@ENABLE_TESTBENCH_TRUE@am__append_6 = \ @ENABLE_IMPTCP_TRUE@@ENABLE_TESTBENCH_TRUE@ manyptcp.sh \ @@ -128,20 +170,36 @@ host_triplet = @host@ @ENABLE_IMPTCP_TRUE@@ENABLE_TESTBENCH_TRUE@ imptcp_addtlframedelim.sh \ @ENABLE_IMPTCP_TRUE@@ENABLE_TESTBENCH_TRUE@ imptcp_conndrop.sh +@ENABLE_ELASTICSEARCH_TRUE@@ENABLE_TESTBENCH_TRUE@am__append_7 = \ +@ENABLE_ELASTICSEARCH_TRUE@@ENABLE_TESTBENCH_TRUE@ elasticsearch-basic.sh \ +@ENABLE_ELASTICSEARCH_TRUE@@ENABLE_TESTBENCH_TRUE@ elasticsearch-basic-bulk.sh \ +@ENABLE_ELASTICSEARCH_TRUE@@ENABLE_TESTBENCH_TRUE@ elasticsearch-basic-errorfile-empty.sh \ +@ENABLE_ELASTICSEARCH_TRUE@@ENABLE_TESTBENCH_TRUE@ elasticsearch-basic-errorfile-populated.sh \ +@ENABLE_ELASTICSEARCH_TRUE@@ENABLE_TESTBENCH_TRUE@ elasticsearch-bulk-errorfile-empty.sh \ +@ENABLE_ELASTICSEARCH_TRUE@@ENABLE_TESTBENCH_TRUE@ elasticsearch-bulk-errorfile-populated.sh + +@ENABLE_MMPSTRUCDATA_TRUE@@ENABLE_TESTBENCH_TRUE@am__append_8 = \ +@ENABLE_MMPSTRUCDATA_TRUE@@ENABLE_TESTBENCH_TRUE@ mmpstrucdata.sh + +@ENABLE_MMJSONPARSE_TRUE@@ENABLE_TESTBENCH_TRUE@am__append_9 = \ +@ENABLE_MMJSONPARSE_TRUE@@ENABLE_TESTBENCH_TRUE@ mmjsonparse_simple.sh \ +@ENABLE_MMJSONPARSE_TRUE@@ENABLE_TESTBENCH_TRUE@ mmjsonparse_cim.sh + # TODO: re-enable in newer version #TESTS += \ # #sndrcv_tls_anon.sh \ # #sndrcv_tls_anon_rebind.sh \ # #imtcp-tls-basic.sh -@ENABLE_GNUTLS_TRUE@@ENABLE_TESTBENCH_TRUE@@HAVE_VALGRIND_TRUE@am__append_7 = imtcp-tls-basic-vg.sh \ +@ENABLE_GNUTLS_TRUE@@ENABLE_TESTBENCH_TRUE@@HAVE_VALGRIND_TRUE@am__append_10 = imtcp-tls-basic-vg.sh \ @ENABLE_GNUTLS_TRUE@@ENABLE_TESTBENCH_TRUE@@HAVE_VALGRIND_TRUE@ imtcp_conndrop_tls-vg.sh -@ENABLE_OMUXSOCK_TRUE@@ENABLE_TESTBENCH_TRUE@am__append_8 = uxsock_simple.sh -@ENABLE_OMUDPSPOOF_TRUE@@ENABLE_TESTBENCH_TRUE@am__append_9 = sndrcv_omudpspoof.sh \ +@ENABLE_OMUXSOCK_TRUE@@ENABLE_TESTBENCH_TRUE@am__append_11 = uxsock_simple.sh +@ENABLE_RELP_TRUE@@ENABLE_TESTBENCH_TRUE@am__append_12 = sndrcv_relp.sh +@ENABLE_OMUDPSPOOF_TRUE@@ENABLE_TESTBENCH_TRUE@am__append_13 = sndrcv_omudpspoof.sh \ @ENABLE_OMUDPSPOOF_TRUE@@ENABLE_TESTBENCH_TRUE@ sndrcv_omudpspoof_nonstdpt.sh -@ENABLE_OMSTDOUT_TRUE@@ENABLE_TESTBENCH_TRUE@am__append_10 = omod-if-array.sh \ +@ENABLE_OMSTDOUT_TRUE@@ENABLE_TESTBENCH_TRUE@am__append_14 = omod-if-array.sh \ @ENABLE_OMSTDOUT_TRUE@@ENABLE_TESTBENCH_TRUE@ proprepltest.sh \ @ENABLE_OMSTDOUT_TRUE@@ENABLE_TESTBENCH_TRUE@ parsertest.sh \ @ENABLE_OMSTDOUT_TRUE@@ENABLE_TESTBENCH_TRUE@ timestamp.sh \ @@ -153,16 +211,16 @@ host_triplet = @host@ @ENABLE_OMSTDOUT_TRUE@@ENABLE_TESTBENCH_TRUE@ tabescape_off.sh \ @ENABLE_OMSTDOUT_TRUE@@ENABLE_TESTBENCH_TRUE@ fieldtest.sh -@ENABLE_IMDIAG_TRUE@@ENABLE_OMRULESET_TRUE@@ENABLE_TESTBENCH_TRUE@am__append_11 = omruleset.sh \ +@ENABLE_IMDIAG_TRUE@@ENABLE_OMRULESET_TRUE@@ENABLE_TESTBENCH_TRUE@am__append_15 = omruleset.sh \ @ENABLE_IMDIAG_TRUE@@ENABLE_OMRULESET_TRUE@@ENABLE_TESTBENCH_TRUE@ omruleset-queue.sh # random.sh is temporarily disabled as it needs some work # to rsyslog core to complete in reasonable time #TESTS += random.sh -@ENABLE_IMFILE_TRUE@@ENABLE_TESTBENCH_TRUE@am__append_12 = imfile-basic.sh -@ENABLE_IMFILE_TRUE@@ENABLE_TESTBENCH_TRUE@@HAVE_VALGRIND_TRUE@am__append_13 = imfile-basic-vg.sh -@ENABLE_GNUTLS_TRUE@am__append_14 = -lgcrypt +@ENABLE_IMFILE_TRUE@@ENABLE_TESTBENCH_TRUE@am__append_16 = imfile-basic.sh +@ENABLE_IMFILE_TRUE@@ENABLE_TESTBENCH_TRUE@@HAVE_VALGRIND_TRUE@am__append_17 = imfile-basic-vg.sh +@ENABLE_GNUTLS_TRUE@am__append_18 = -lgcrypt subdir = tests DIST_COMMON = README $(srcdir)/Makefile.am $(srcdir)/Makefile.in ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 @@ -297,7 +355,6 @@ GREP = @GREP@ GSS_LIBS = @GSS_LIBS@ GUARDTIME_CFLAGS = @GUARDTIME_CFLAGS@ GUARDTIME_LIBS = @GUARDTIME_LIBS@ -HAVE_LIBGCRYPT_CONFIG = @HAVE_LIBGCRYPT_CONFIG@ HAVE_MYSQL_CONFIG = @HAVE_MYSQL_CONFIG@ HAVE_ORACLE_CONFIG = @HAVE_ORACLE_CONFIG@ HAVE_PGSQL_CONFIG = @HAVE_PGSQL_CONFIG@ @@ -318,14 +375,15 @@ LEXLIB = @LEXLIB@ LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@ LIBDBI_CFLAGS = @LIBDBI_CFLAGS@ LIBDBI_LIBS = @LIBDBI_LIBS@ -LIBEE_CFLAGS = @LIBEE_CFLAGS@ -LIBEE_LIBS = @LIBEE_LIBS@ LIBESTR_CFLAGS = @LIBESTR_CFLAGS@ LIBESTR_LIBS = @LIBESTR_LIBS@ LIBGCRYPT_CFLAGS = @LIBGCRYPT_CFLAGS@ +LIBGCRYPT_CONFIG = @LIBGCRYPT_CONFIG@ LIBGCRYPT_LIBS = @LIBGCRYPT_LIBS@ LIBLOGGING_CFLAGS = @LIBLOGGING_CFLAGS@ LIBLOGGING_LIBS = @LIBLOGGING_LIBS@ +LIBLOGGING_STDLOG_CFLAGS = @LIBLOGGING_STDLOG_CFLAGS@ +LIBLOGGING_STDLOG_LIBS = @LIBLOGGING_STDLOG_LIBS@ LIBLOGNORM_CFLAGS = @LIBLOGNORM_CFLAGS@ LIBLOGNORM_LIBS = @LIBLOGNORM_LIBS@ LIBM = @LIBM@ @@ -350,6 +408,8 @@ NM = @NM@ NMEDIT = @NMEDIT@ OBJDUMP = @OBJDUMP@ OBJEXT = @OBJEXT@ +OPENSSL_CFLAGS = @OPENSSL_CFLAGS@ +OPENSSL_LIBS = @OPENSSL_LIBS@ ORACLE_CFLAGS = @ORACLE_CFLAGS@ ORACLE_LIBS = @ORACLE_LIBS@ OTOOL = @OTOOL@ @@ -561,6 +621,40 @@ EXTRA_DIST = 1.rstest 2.rstest 3.rstest err1.rstest \ testsuites/rscript_stop.conf \ rscript_stop2.sh \ testsuites/rscript_stop2.conf \ + stop.sh \ + testsuites/stop.conf \ + rscript_le.sh \ + testsuites/rscript_le.conf \ + rscript_ge.sh \ + testsuites/rscript_ge.conf \ + rscript_lt.sh \ + testsuites/rscript_lt.conf \ + rscript_gt.sh \ + testsuites/rscript_gt.conf \ + rscript_ne.sh \ + testsuites/rscript_ne.conf \ + rscript_eq.sh \ + testsuites/rscript_eq.conf \ + stop-localvar.sh \ + testsuites/stop-localvar.conf \ + stop-msgvar.sh \ + testsuites/stop-msgvar.conf \ + global_vars.sh \ + testsuites/global_vars.conf \ + rfc5424parser.sh \ + testsuites/rfc5424parser.conf \ + fac_authpriv.sh \ + testsuites/fac_authpriv.conf \ + fac_local0.sh \ + testsuites/fac_local0.conf \ + fac_mail.sh \ + testsuites/fac_mail.conf \ + fac_news.sh \ + testsuites/fac_news.conf \ + fac_uucp.sh \ + testsuites/fac_uucp.conf \ + rs_optimizer_pri.sh \ + testsuites/rs_optimizer_pri.conf \ rscript_prifilt.sh \ testsuites/rscript_prifilt.conf \ rscript_optimizer1.sh \ @@ -571,6 +665,10 @@ EXTRA_DIST = 1.rstest 2.rstest 3.rstest err1.rstest \ testsuites/cee_simple.conf \ cee_diskqueue.sh \ testsuites/cee_diskqueue.conf \ + mmjsonparse_simple.sh \ + testsuites/mmjsonparse_simple.conf \ + mmjsonparse_cim.sh \ + testsuites/mmjsonparse_cim.conf \ incltest.sh \ testsuites/incltest.conf \ incltest_dir.sh \ @@ -580,6 +678,18 @@ EXTRA_DIST = 1.rstest 2.rstest 3.rstest err1.rstest \ incltest_dir_wildcard.sh \ testsuites/incltest_dir_wildcard.conf \ testsuites/incltest.d/include.conf \ + elasticsearch-basic.sh \ + testsuites/elasticsearch-basic.conf \ + elasticsearch-basic-bulk.sh \ + testsuites/elasticsearch-basic-bulk.conf \ + elasticsearch-basic-errorfile-empty.sh \ + testsuites/elasticsearch-basic-errorfile-empty.conf \ + elasticsearch-basic-errorfile-populated.sh \ + testsuites/elasticsearch-basic-errorfile-populated.conf \ + elasticsearch-bulk-errorfile-empty.sh \ + testsuites/elasticsearch-bulk-errorfile-empty.conf \ + elasticsearch-bulk-errorfile-populated.sh \ + testsuites/elasticsearch-bulk-errorfile-populated.conf \ linkedlistqueue.sh \ testsuites/linkedlistqueue.conf \ da-mainmsg-q.sh \ @@ -669,6 +779,9 @@ EXTRA_DIST = 1.rstest 2.rstest 3.rstest err1.rstest \ sndrcv.sh \ testsuites/sndrcv_sender.conf \ testsuites/sndrcv_rcvr.conf \ + sndrcv_relp.sh \ + testsuites/sndrcv_relp_sender.conf \ + testsuites/sndrcv_relp_rcvr.conf \ sndrcv_udp.sh \ testsuites/sndrcv_udp_sender.conf \ testsuites/sndrcv_udp_rcvr.conf \ @@ -732,6 +845,8 @@ EXTRA_DIST = 1.rstest 2.rstest 3.rstest err1.rstest \ testsuites/master.nolimittag \ rulesetmultiqueue.sh \ testsuites/rulesetmultiqueue.conf \ + rulesetmultiqueue-v6.sh \ + testsuites/rulesetmultiqueue-v6.conf \ omruleset.sh \ testsuites/omruleset.conf \ omruleset-queue.sh \ @@ -750,6 +865,8 @@ EXTRA_DIST = 1.rstest 2.rstest 3.rstest err1.rstest \ testsuites/execonlywhenprevsuspended3.conf \ execonlywhenprevsuspended4.sh \ testsuites/execonlywhenprevsuspended4.conf \ + execonlywhenprevsuspended_multiwrkr.sh \ + testsuites/execonlywhenprevsuspended_multiwrkr.conf \ tabescape_dflt.sh \ testsuites/tabescape_dflt.conf \ testsuites/1.tabescape_dflt \ @@ -783,6 +900,12 @@ EXTRA_DIST = 1.rstest 2.rstest 3.rstest err1.rstest \ mysql-asyn.sh \ mysql-asyn-vg.sh \ testsuites/mysql-asyn.conf \ + mysql-actq-mt.sh \ + mysql-actq-mt-withpause.sh \ + mysql-actq-mt-withpause-vg.sh \ + testsuites/mysql-actq-mt.conf \ + mmpstrucdata.sh \ + testsuites/mmpstrucdata.conf \ cfg.sh @@ -802,7 +925,7 @@ uxsockrcvr_LDADD = $(SOL_LIBS) tcpflood_SOURCES = tcpflood.c tcpflood_CPPFLAGS = $(PTHREADS_CFLAGS) $(GNUTLS_CFLAGS) tcpflood_LDADD = $(SOL_LIBS) $(PTHREADS_LIBS) $(GNUTLS_LIBS) \ - $(am__append_14) + $(am__append_18) minitcpsrv_SOURCES = minitcpsrvr.c minitcpsrv_LDADD = $(SOL_LIBS) syslog_caller_SOURCES = syslog_caller.c @@ -918,22 +1041,25 @@ distclean-compile: @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/uxsockrcvr.Po@am__quote@ .c.o: -@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< -@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@am__fastdepCC_TRUE@ $(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.o$$||'`;\ +@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\ +@am__fastdepCC_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c $< +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ $< .c.obj: -@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` -@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@am__fastdepCC_TRUE@ $(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.obj$$||'`;\ +@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ `$(CYGPATH_W) '$<'` &&\ +@am__fastdepCC_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c `$(CYGPATH_W) '$<'` +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ `$(CYGPATH_W) '$<'` .c.lo: -@am__fastdepCC_TRUE@ $(AM_V_CC)$(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< -@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo +@am__fastdepCC_TRUE@ $(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.lo$$||'`;\ +@am__fastdepCC_TRUE@ $(LTCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\ +@am__fastdepCC_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Plo @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LTCOMPILE) -c -o $@ $< @@ -1257,30 +1383,6 @@ uninstall-am: mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ tags uninstall uninstall-am -@ENABLE_IMDIAG_TRUE@@ENABLE_TESTBENCH_TRUE@ discard-rptdmsg.sh \ -@ENABLE_IMDIAG_TRUE@@ENABLE_TESTBENCH_TRUE@ discard-allmark.sh \ -@ENABLE_IMDIAG_TRUE@@ENABLE_TESTBENCH_TRUE@ discard.sh \ -@ENABLE_IMDIAG_TRUE@@ENABLE_TESTBENCH_TRUE@ failover-async.sh \ -@ENABLE_IMDIAG_TRUE@@ENABLE_TESTBENCH_TRUE@ failover-double.sh \ -@ENABLE_IMDIAG_TRUE@@ENABLE_TESTBENCH_TRUE@ failover-basic.sh \ -@ENABLE_IMDIAG_TRUE@@ENABLE_TESTBENCH_TRUE@ failover-rptd.sh \ -@ENABLE_IMDIAG_TRUE@@ENABLE_TESTBENCH_TRUE@ failover-no-rptd.sh \ -@ENABLE_IMDIAG_TRUE@@ENABLE_TESTBENCH_TRUE@ failover-no-basic.sh \ -@ENABLE_IMDIAG_TRUE@@ENABLE_TESTBENCH_TRUE@ rcvr_fail_restore.sh \ -@ENABLE_IMDIAG_TRUE@@ENABLE_TESTBENCH_TRUE@ rscript_contains.sh \ -@ENABLE_IMDIAG_TRUE@@ENABLE_TESTBENCH_TRUE@ rscript_field.sh \ -@ENABLE_IMDIAG_TRUE@@ENABLE_TESTBENCH_TRUE@ rscript_stop.sh \ -@ENABLE_IMDIAG_TRUE@@ENABLE_TESTBENCH_TRUE@ rscript_stop2.sh \ -@ENABLE_IMDIAG_TRUE@@ENABLE_TESTBENCH_TRUE@ rscript_prifilt.sh \ -@ENABLE_IMDIAG_TRUE@@ENABLE_TESTBENCH_TRUE@ rscript_optimizer1.sh \ -@ENABLE_IMDIAG_TRUE@@ENABLE_TESTBENCH_TRUE@ rscript_ruleset_call.sh \ -@ENABLE_IMDIAG_TRUE@@ENABLE_TESTBENCH_TRUE@ cee_simple.sh \ -@ENABLE_IMDIAG_TRUE@@ENABLE_TESTBENCH_TRUE@ cee_diskqueue.sh \ -@ENABLE_IMDIAG_TRUE@@ENABLE_TESTBENCH_TRUE@ incltest.sh \ -@ENABLE_IMDIAG_TRUE@@ENABLE_TESTBENCH_TRUE@ incltest_dir.sh \ -@ENABLE_IMDIAG_TRUE@@ENABLE_TESTBENCH_TRUE@ incltest_dir_wildcard.sh \ -@ENABLE_IMDIAG_TRUE@@ENABLE_TESTBENCH_TRUE@ incltest_dir_empty_wildcard.sh \ -@ENABLE_IMDIAG_TRUE@@ENABLE_TESTBENCH_TRUE@ linkedlistqueue.sh @ENABLE_GNUTLS_TRUE@@ENABLE_TESTBENCH_TRUE@@HAVE_VALGRIND_TRUE@ manytcp-too-few-tls-vg.sh # rtinit tests disabled for the moment - also questionable if they diff --git a/tests/chkseq.c b/tests/chkseq.c index b22c899..596d8dc 100644 --- a/tests/chkseq.c +++ b/tests/chkseq.c @@ -7,10 +7,14 @@ * -s<starting number> -e<ending number> * default for s is 0. -e should be given (else it is also 0) * -d may be specified, in which case duplicate messages are permitted. + * -m number of messages permitted to be missing without triggering a + * failure. This is necessary for some failover tests, where it is + * impossible to totally guard against messagt loss. By default, NO + * message is permitted to be lost. * * Part of the testbench for rsyslog. * - * Copyright 2009 Rainer Gerhards and Adiscon GmbH. + * Copyright 2009-2014 Rainer Gerhards and Adiscon GmbH. * * This file is part of rsyslog. * @@ -47,12 +51,15 @@ int main(int argc, char *argv[]) int dupsPermitted = 0; int start = 0, end = 0; int opt; + int lostok = 0; /* how many messages are OK to be lost? */ int nDups = 0; + int reachedEOF; int edLen; /* length of extra data */ static char edBuf[500*1024]; /* buffer for extra data (pretty large to be on the save side...) */ + static char ioBuf[sizeof(edBuf)+1024]; char *file = NULL; - while((opt = getopt(argc, argv, "e:f:ds:vE")) != EOF) { + while((opt = getopt(argc, argv, "e:f:ds:vm:E")) != EOF) { switch((char)opt) { case 'f': file = optarg; @@ -69,6 +76,9 @@ int main(int argc, char *argv[]) case 'v': ++verbose; break; + case 'm': + lostok = atoi(optarg); + break; case 'E': bHaveExtraData = 1; break; @@ -102,19 +112,32 @@ int main(int argc, char *argv[]) for(i = start ; i < end+1 ; ++i) { if(bHaveExtraData) { - scanfOK = fscanf(fp, "%d,%d,%s\n", &val, &edLen, edBuf) == 3 ? 1 : 0; + if(fgets(ioBuf, sizeof(ioBuf), fp) == NULL) { + scanfOK = 0; + } else { + scanfOK = sscanf(ioBuf, "%d,%d,%s\n", &val, &edLen, edBuf) == 3 ? 1 : 0; + } if(edLen != (int) strlen(edBuf)) { printf("extra data length specified %d, but actually is %ld in record %d\n", edLen, (long) strlen(edBuf), i); exit(1); } } else { - scanfOK = fscanf(fp, "%d\n", &val) == 1 ? 1 : 0; + if(fgets(ioBuf, sizeof(ioBuf), fp) == NULL) { + scanfOK = 0; + } else { + scanfOK = sscanf(ioBuf, "%d\n", &val) == 1 ? 1 : 0; + } } if(!scanfOK) { printf("scanf error in index i=%d\n", i); exit(1); } + while(val > i && lostok > 0) { + --lostok; + printf("message %d missing (ok due to -m [now %d])\n", i, lostok); + ++i; + } if(val != i) { if(val == i - 1 && dupsPermitted) { --i; @@ -126,15 +149,57 @@ int main(int argc, char *argv[]) } } - if(nDups != 0) - printf("info: had %d duplicates (this is no error)\n", nDups); - if(i - 1 != end) { printf("only %d records in file, expected %d\n", i - 1, end); exit(1); } - if(!feof(fp)) { + int c = getc(fp); + if(c == EOF) { + reachedEOF = 1; + } else { + ungetc(c, fp); + /* if duplicates are permitted, we need to do a final check if we have duplicates at the + * end of file. + */ + if(dupsPermitted) { + i = end; + while(!feof(fp)) { + if(bHaveExtraData) { + if(fgets(ioBuf, sizeof(ioBuf), fp) == NULL) { + scanfOK = 0; + } else { + scanfOK = sscanf(ioBuf, "%d,%d,%s\n", &val, &edLen, edBuf) == 3 ? 1 : 0; + } + if(edLen != (int) strlen(edBuf)) { + printf("extra data length specified %d, but actually is %ld in record %d\n", + edLen, (long) strlen(edBuf), i); + exit(1); + } + } else { + if(fgets(ioBuf, sizeof(ioBuf), fp) == NULL) { + scanfOK = 0; + } else { + scanfOK = sscanf(ioBuf, "%d\n", &val) == 1 ? 1 : 0; + } + } + + if(val != i) { + reachedEOF = 0; + goto breakIF; + } + } + reachedEOF = feof(fp) ? 1 : 0; + } else { + reachedEOF = 0; + } + } + +breakIF: + if(nDups != 0) + printf("info: had %d duplicates (this is no error)\n", nDups); + + if(!reachedEOF) { printf("end of processing, but NOT end of file!\n"); exit(1); } diff --git a/tests/daqueue-persist.sh b/tests/daqueue-persist.sh index feb2a34..0781a7d 100755 --- a/tests/daqueue-persist.sh +++ b/tests/daqueue-persist.sh @@ -2,6 +2,7 @@ # to carry out multiple tests with different queue modes # added 2009-05-27 by Rgerhards # This file is part of the rsyslog project, released under GPLv3 +echo =============================================================================== echo \[daqueue-persist.sh\]: test data persisting at shutdown source $srcdir/daqueue-persist-drvr.sh LinkedList source $srcdir/daqueue-persist-drvr.sh FixedArray diff --git a/tests/diag.sh b/tests/diag.sh index 2fdcbfb..fd294ce 100755 --- a/tests/diag.sh +++ b/tests/diag.sh @@ -22,6 +22,7 @@ case $1 in rm -rf test-spool test-logdir stat-file1 rm -f rsyslog.out.*.log work-presort rsyslog.pipe rm -f rsyslog.input rsyslog.empty + rm -f rsyslog.errorfile rm -f core.* vgcore.* # Note: rsyslog.action.*.include must NOT be deleted, as it # is used to setup some parameters BEFORE calling init. This @@ -35,8 +36,20 @@ case $1 in rm -rf test-spool test-logdir stat-file1 rm -f rsyslog.out.*.log rsyslog.random.data work-presort rsyslog.pipe rm -f rsyslog.input rsyslog.conf.tlscert stat-file1 rsyslog.empty + rm -f rsyslog.errorfile echo ------------------------------------------------------------------------------- ;; + 'es-init') # initialize local Elasticsearch *testbench* instance for the next + # test. NOTE: do NOT put anything useful on that instance! + curl -XDELETE localhost:9200/rsyslog_testbench + ;; + 'es-getdata') # read data from ES to a local file so that we can process + # it with out regular tooling. + # Note: param 2 MUST be number of records to read (ES does + # not return the full set unless you tell it explicitely). + curl localhost:9200/rsyslog_testbench/_search?size=$2 > work + python $srcdir/es_response_get_msgnum.py > rsyslog.out.log + ;; 'startup') # start rsyslogd with default params. $2 is the config file name to use # returns only after successful startup, $3 is the instance (blank or 2!) $valgrind ../tools/rsyslogd -u2 -n -irsyslog$3.pid -M../runtime/.libs:../.libs -f$srcdir/testsuites/$2 & @@ -109,6 +122,7 @@ case $1 in echo Shutting down instance 2 fi $srcdir/diag.sh wait-queueempty $2 + ./msleep 100 # wait 100 milliseconds kill `cat rsyslog$2.pid` # note: we do not wait for the actual termination! ;; @@ -141,7 +155,7 @@ case $1 in 'seq-check') # do the usual sequence check to see if everything was properly received. $2 is the instance. rm -f work cp rsyslog.out.log work-presort - sort < rsyslog.out.log > work + sort -g < rsyslog.out.log > work # $4... are just to have the abilit to pass in more options... # add -v to chkseq if you need more verbose output ./chkseq -fwork -s$2 -e$3 $4 $5 $6 $7 @@ -154,7 +168,7 @@ case $1 in # a duplicateof seq-check, but we could not change its calling conventions without # breaking a lot of exitings test cases, so we preferred to duplicate the code here. rm -f work2 - sort < rsyslog2.out.log > work2 + sort -g < rsyslog2.out.log > work2 # $4... are just to have the abilit to pass in more options... # add -v to chkseq if you need more verbose output ./chkseq -fwork2 -s$2 -e$3 $4 $5 $6 $7 @@ -167,7 +181,7 @@ case $1 in 'gzip-seq-check') # do the usual sequence check, but for gzip files rm -f work ls -l rsyslog.out.log - gunzip < rsyslog.out.log | sort > work + gunzip < rsyslog.out.log | sort -g > work ls -l work # $4... are just to have the abilit to pass in more options... ./chkseq -fwork -v -s$2 -e$3 $4 $5 $6 $7 @@ -190,5 +204,12 @@ case $1 in ZCAT=zcat fi ;; + 'generate-HOSTNAME') # generate the HOSTNAME file + source $srcdir/diag.sh startup gethostname.conf + source $srcdir/diag.sh tcpflood -m1 -M "<128>" + ./msleep 100 + source $srcdir/diag.sh shutdown-when-empty # shut down rsyslogd when done processing messages + source $srcdir/diag.sh wait-shutdown # we need to wait until rsyslogd is finished! + ;; *) echo "invalid argument" $1 esac diff --git a/tests/diskqueue.sh b/tests/diskqueue.sh index b871e9e..853a836 100755 --- a/tests/diskqueue.sh +++ b/tests/diskqueue.sh @@ -5,6 +5,7 @@ # added 2009-04-17 by Rgerhards # This file is part of the rsyslog project, released under GPLv3 # uncomment for debugging support: +echo =============================================================================== echo \[diskqueue.sh\]: testing queue disk-only mode # uncomment for debugging support: #export RSYSLOG_DEBUG="debug nostdout noprintmutexaction" diff --git a/tests/elasticsearch-basic-bulk.sh b/tests/elasticsearch-basic-bulk.sh new file mode 100755 index 0000000..f62db16 --- /dev/null +++ b/tests/elasticsearch-basic-bulk.sh @@ -0,0 +1,12 @@ +# This file is part of the rsyslog project, released under ASL 2.0 +echo =============================================================================== +echo \[elasticsearch-basic-bulk.sh\]: basic test for elasticsearch functionality +source $srcdir/diag.sh init +source $srcdir/diag.sh es-init +source $srcdir/diag.sh startup elasticsearch-basic-bulk.conf +source $srcdir/diag.sh injectmsg 0 10000 +source $srcdir/diag.sh shutdown-when-empty +source $srcdir/diag.sh wait-shutdown +source $srcdir/diag.sh es-getdata 10000 +source $srcdir/diag.sh seq-check 0 9999 +source $srcdir/diag.sh exit diff --git a/tests/elasticsearch-basic-errorfile-empty.sh b/tests/elasticsearch-basic-errorfile-empty.sh new file mode 100755 index 0000000..6dbcde9 --- /dev/null +++ b/tests/elasticsearch-basic-errorfile-empty.sh @@ -0,0 +1,17 @@ +# This file is part of the rsyslog project, released under ASL 2.0 +echo =============================================================================== +echo \[elasticsearch-basic-errorfile-empty\]: basic test for elasticsearch functionality +source $srcdir/diag.sh init +source $srcdir/diag.sh es-init +source $srcdir/diag.sh startup elasticsearch-basic-errorfile-empty.conf +source $srcdir/diag.sh injectmsg 0 10000 +source $srcdir/diag.sh shutdown-when-empty +source $srcdir/diag.sh wait-shutdown +source $srcdir/diag.sh es-getdata 10000 +if [ -f rsyslog.errorfile ] +then + echo "error: error file exists!" + exit 1 +fi +source $srcdir/diag.sh seq-check 0 9999 +source $srcdir/diag.sh exit diff --git a/tests/elasticsearch-basic-errorfile-populated.sh b/tests/elasticsearch-basic-errorfile-populated.sh new file mode 100755 index 0000000..7239a59 --- /dev/null +++ b/tests/elasticsearch-basic-errorfile-populated.sh @@ -0,0 +1,26 @@ +# This file is part of the rsyslog project, released under ASL 2.0 +echo =============================================================================== +echo \[elasticsearch-basic-errorfile-populated\]: basic test for elasticsearch functionality +source $srcdir/diag.sh init +source $srcdir/diag.sh es-init +curl -XPUT localhost:9200/rsyslog_testbench/ -d '{ + "mappings": { + "test-type": { + "properties": { + "msgnum": { + "type": "integer" + } + } + } + } +}' +source $srcdir/diag.sh startup elasticsearch-basic-errorfile-populated.conf +source $srcdir/diag.sh injectmsg 0 1000 +source $srcdir/diag.sh shutdown-when-empty +source $srcdir/diag.sh wait-shutdown +if [ ! -f rsyslog.errorfile ] +then + echo "error: error file does not exist!" + exit 1 +fi +source $srcdir/diag.sh exit diff --git a/tests/elasticsearch-basic.sh b/tests/elasticsearch-basic.sh new file mode 100755 index 0000000..18c847c --- /dev/null +++ b/tests/elasticsearch-basic.sh @@ -0,0 +1,12 @@ +# This file is part of the rsyslog project, released under ASL 2.0 +echo =============================================================================== +echo \[elasticsearch-basic.sh\]: basic test for elasticsearch functionality +source $srcdir/diag.sh init +source $srcdir/diag.sh es-init +source $srcdir/diag.sh startup elasticsearch-basic.conf +source $srcdir/diag.sh injectmsg 0 10000 +source $srcdir/diag.sh shutdown-when-empty +source $srcdir/diag.sh wait-shutdown +source $srcdir/diag.sh es-getdata 10000 +source $srcdir/diag.sh seq-check 0 9999 +source $srcdir/diag.sh exit diff --git a/tests/elasticsearch-bulk-errorfile-empty.sh b/tests/elasticsearch-bulk-errorfile-empty.sh new file mode 100755 index 0000000..a370e72 --- /dev/null +++ b/tests/elasticsearch-bulk-errorfile-empty.sh @@ -0,0 +1,17 @@ +# This file is part of the rsyslog project, released under ASL 2.0 +echo =============================================================================== +echo \[elasticsearch-bulk-errorfile-empty\]: basic test for elasticsearch functionality +source $srcdir/diag.sh init +source $srcdir/diag.sh es-init +source $srcdir/diag.sh startup elasticsearch-bulk-errorfile-empty.conf +source $srcdir/diag.sh injectmsg 0 10000 +source $srcdir/diag.sh shutdown-when-empty +source $srcdir/diag.sh wait-shutdown +source $srcdir/diag.sh es-getdata 10000 +if [ -f rsyslog.errorfile ] +then + echo "error: error file exists!" + exit 1 +fi +source $srcdir/diag.sh seq-check 0 9999 +source $srcdir/diag.sh exit diff --git a/tests/elasticsearch-bulk-errorfile-populated.sh b/tests/elasticsearch-bulk-errorfile-populated.sh new file mode 100755 index 0000000..169fa1c --- /dev/null +++ b/tests/elasticsearch-bulk-errorfile-populated.sh @@ -0,0 +1,26 @@ +# This file is part of the rsyslog project, released under ASL 2.0 +echo =============================================================================== +echo \[elasticsearch-bulk-errorfile-populated\]: basic test for elasticsearch functionality +source $srcdir/diag.sh init +source $srcdir/diag.sh es-init +curl -XPUT localhost:9200/rsyslog_testbench/ -d '{ + "mappings": { + "test-type": { + "properties": { + "msgnum": { + "type": "integer" + } + } + } + } +}' +source $srcdir/diag.sh startup elasticsearch-bulk-errorfile-populated.conf +source $srcdir/diag.sh injectmsg 0 1000 +source $srcdir/diag.sh shutdown-when-empty +source $srcdir/diag.sh wait-shutdown +if [ ! -f rsyslog.errorfile ] +then + echo "error: error file does not exist!" + exit 1 +fi +source $srcdir/diag.sh exit diff --git a/tests/execonlywhenprevsuspended_multiwrkr.sh b/tests/execonlywhenprevsuspended_multiwrkr.sh new file mode 100755 index 0000000..5d960b0 --- /dev/null +++ b/tests/execonlywhenprevsuspended_multiwrkr.sh @@ -0,0 +1,10 @@ +# rgerhards, 2013-12-05 +echo ===================================================================================== +echo \[execonlywhenprevsuspended_multiwrkr.sh\]: test execonly...suspended functionality multiworker case +source $srcdir/diag.sh init +source $srcdir/diag.sh startup execonlywhenprevsuspended_multiwrkr.conf +source $srcdir/diag.sh injectmsg 0 1000 +source $srcdir/diag.sh shutdown-when-empty # shut down rsyslogd when done processing messages +source $srcdir/diag.sh wait-shutdown +source $srcdir/diag.sh seq-check 1 999 +source $srcdir/diag.sh exit diff --git a/tests/fac_authpriv.sh b/tests/fac_authpriv.sh new file mode 100755 index 0000000..f2c8544 --- /dev/null +++ b/tests/fac_authpriv.sh @@ -0,0 +1,11 @@ +# This tests proper processing of the authpriv facility. +# added 2014-09-16 by Rgerhards + +# This file is part of the rsyslog project, released under ASL 2.0 +source $srcdir/diag.sh init +source $srcdir/diag.sh startup fac_authpriv.conf +source $srcdir/diag.sh tcpflood -m1000 -P 81 +source $srcdir/diag.sh shutdown-when-empty # shut down rsyslogd when done processing messages +source $srcdir/diag.sh wait-shutdown # and wait for it to terminate +source $srcdir/diag.sh seq-check 0 999 +source $srcdir/diag.sh exit diff --git a/tests/fac_local0.sh b/tests/fac_local0.sh new file mode 100755 index 0000000..516d3c0 --- /dev/null +++ b/tests/fac_local0.sh @@ -0,0 +1,10 @@ +# added 2014-09-17 by Rgerhards + +# This file is part of the rsyslog project, released under ASL 2.0 +source $srcdir/diag.sh init +source $srcdir/diag.sh startup fac_local0.conf +source $srcdir/diag.sh tcpflood -m1000 -P 129 +source $srcdir/diag.sh shutdown-when-empty # shut down rsyslogd when done processing messages +source $srcdir/diag.sh wait-shutdown # and wait for it to terminate +source $srcdir/diag.sh seq-check 0 999 +source $srcdir/diag.sh exit diff --git a/tests/fac_mail.sh b/tests/fac_mail.sh new file mode 100755 index 0000000..e8873da --- /dev/null +++ b/tests/fac_mail.sh @@ -0,0 +1,10 @@ +# added 2014-09-17 by Rgerhards + +# This file is part of the rsyslog project, released under ASL 2.0 +source $srcdir/diag.sh init +source $srcdir/diag.sh startup fac_mail.conf +source $srcdir/diag.sh tcpflood -m1000 -P 17 +source $srcdir/diag.sh shutdown-when-empty # shut down rsyslogd when done processing messages +source $srcdir/diag.sh wait-shutdown # and wait for it to terminate +source $srcdir/diag.sh seq-check 0 999 +source $srcdir/diag.sh exit diff --git a/tests/fac_news.sh b/tests/fac_news.sh new file mode 100755 index 0000000..85ded82 --- /dev/null +++ b/tests/fac_news.sh @@ -0,0 +1,10 @@ +# added 2014-09-17 by Rgerhards + +# This file is part of the rsyslog project, released under ASL 2.0 +source $srcdir/diag.sh init +source $srcdir/diag.sh startup fac_news.conf +source $srcdir/diag.sh tcpflood -m1000 -P 57 +source $srcdir/diag.sh shutdown-when-empty # shut down rsyslogd when done processing messages +source $srcdir/diag.sh wait-shutdown # and wait for it to terminate +source $srcdir/diag.sh seq-check 0 999 +source $srcdir/diag.sh exit diff --git a/tests/fac_uucp.sh b/tests/fac_uucp.sh new file mode 100755 index 0000000..6c5c06b --- /dev/null +++ b/tests/fac_uucp.sh @@ -0,0 +1,10 @@ +# added 2014-09-17 by Rgerhards + +# This file is part of the rsyslog project, released under ASL 2.0 +source $srcdir/diag.sh init +source $srcdir/diag.sh startup fac_uucp.conf +source $srcdir/diag.sh tcpflood -m1000 -P 65 +source $srcdir/diag.sh shutdown-when-empty # shut down rsyslogd when done processing messages +source $srcdir/diag.sh wait-shutdown # and wait for it to terminate +source $srcdir/diag.sh seq-check 0 999 +source $srcdir/diag.sh exit diff --git a/tests/fieldtest.sh b/tests/fieldtest.sh index 9875fda..10541ef 100755 --- a/tests/fieldtest.sh +++ b/tests/fieldtest.sh @@ -1,5 +1,6 @@ echo \[fieldtest.sh\]: test fieldtest via udp $srcdir/killrsyslog.sh # kill rsyslogd if it runs for some reason +source $srcdir/diag.sh generate-HOSTNAME ./nettester -tfield1 -iudp if [ "$?" -ne "0" ]; then diff --git a/tests/global_vars.sh b/tests/global_vars.sh new file mode 100755 index 0000000..5c6c579 --- /dev/null +++ b/tests/global_vars.sh @@ -0,0 +1,15 @@ +# Test for global variables +# added 2013-11-18 by rgerhards +# This file is part of the rsyslog project, released under ASL 2.0 +echo =============================================================================== +echo \[global_vars.sh\]: testing global variable support +source $srcdir/diag.sh init +source $srcdir/diag.sh startup global_vars.conf + +# 40000 messages should be enough +source $srcdir/diag.sh injectmsg 0 40000 + +source $srcdir/diag.sh shutdown-when-empty # shut down rsyslogd when done processing messages +source $srcdir/diag.sh wait-shutdown +source $srcdir/diag.sh seq-check 0 39999 +source $srcdir/diag.sh exit diff --git a/tests/inputname.sh b/tests/inputname.sh index 71f11c1..f89285b 100755 --- a/tests/inputname.sh +++ b/tests/inputname.sh @@ -1,5 +1,6 @@ echo \[inputname.sh\]: testing $InputTCPServerInputName directive $srcdir/killrsyslog.sh # kill rsyslogd if it runs for some reason +source $srcdir/diag.sh generate-HOSTNAME echo port 12514 ./nettester -tinputname_imtcp_12514 -cinputname_imtcp -itcp -p12514 diff --git a/tests/killrsyslog.sh b/tests/killrsyslog.sh index aac2490..9edf773 100755 --- a/tests/killrsyslog.sh +++ b/tests/killrsyslog.sh @@ -4,10 +4,12 @@ then echo rsyslog.pid exists, trying to shut down rsyslogd process `cat rsyslog.pid`. kill -9 `cat rsyslog.pid` sleep 1 + rm rsyslog.pid fi if [ -e "rsyslog2.pid" ] then echo rsyslog2.pid exists, trying to shut down rsyslogd process `cat rsyslog2.pid`. kill -9 `cat rsyslog2.pid` sleep 1 + rm rsyslog2.pid fi diff --git a/tests/manytcp.sh b/tests/manytcp.sh index ec8f245..f52c4df 100755 --- a/tests/manytcp.sh +++ b/tests/manytcp.sh @@ -3,7 +3,7 @@ echo \[manytcp.sh\]: test concurrent tcp connections source $srcdir/diag.sh init source $srcdir/diag.sh startup manytcp.conf # the config file specifies exactly 1100 connections -source $srcdir/diag.sh tcpflood -c1000 -m40000 +source $srcdir/diag.sh tcpflood -c-1100 -m40000 # the sleep below is needed to prevent too-early termination of the tcp listener sleep 1 source $srcdir/diag.sh shutdown-when-empty # shut down rsyslogd when done processing messages diff --git a/tests/mmjsonparse_cim.sh b/tests/mmjsonparse_cim.sh new file mode 100755 index 0000000..68beeba --- /dev/null +++ b/tests/mmjsonparse_cim.sh @@ -0,0 +1,13 @@ +# added 2014-07-15 by rgerhards +# This file is part of the rsyslog project, released under ASL 2.0 +echo =============================================================================== +echo \[mmjsonparse_cim.sh\]: basic test for mmjsonparse module with "cim" cookie +source $srcdir/diag.sh init +source $srcdir/diag.sh startup mmjsonparse_cim.conf +./tcpflood -m 5000 -j "@cim: " +echo doing shutdown +source $srcdir/diag.sh shutdown-when-empty +echo wait on shutdown +source $srcdir/diag.sh wait-shutdown +source $srcdir/diag.sh seq-check 0 4999 +source $srcdir/diag.sh exit diff --git a/tests/mmjsonparse_simple.sh b/tests/mmjsonparse_simple.sh new file mode 100755 index 0000000..62ff8f9 --- /dev/null +++ b/tests/mmjsonparse_simple.sh @@ -0,0 +1,13 @@ +# added 2014-07-15 by rgerhards +# This file is part of the rsyslog project, released under ASL 2.0 +echo =============================================================================== +echo \[mmjsonparse_simple.sh\]: basic test for mmjsonparse module with defaults +source $srcdir/diag.sh init +source $srcdir/diag.sh startup mmjsonparse_simple.conf +./tcpflood -m 5000 -j "@cee: " +echo doing shutdown +source $srcdir/diag.sh shutdown-when-empty +echo wait on shutdown +source $srcdir/diag.sh wait-shutdown +source $srcdir/diag.sh seq-check 0 4999 +source $srcdir/diag.sh exit diff --git a/tests/mmpstrucdata.sh b/tests/mmpstrucdata.sh new file mode 100755 index 0000000..62b6ba9 --- /dev/null +++ b/tests/mmpstrucdata.sh @@ -0,0 +1,12 @@ +# This file is part of the rsyslog project, released under ASL 2.0 +# rgerhards, 2013-11-22 +echo =============================================================================== +echo \[mmpstrucdata.sh\]: testing mmpstrucdata +source $srcdir/diag.sh init +source $srcdir/diag.sh startup mmpstrucdata.conf +sleep 1 +source $srcdir/diag.sh tcpflood -m100 -y +source $srcdir/diag.sh shutdown-when-empty # shut down rsyslogd when done processing messages +source $srcdir/diag.sh wait-shutdown +source $srcdir/diag.sh seq-check 0 99 +source $srcdir/diag.sh exit diff --git a/tests/mysql-actq-mt-withpause-vg.sh b/tests/mysql-actq-mt-withpause-vg.sh new file mode 100755 index 0000000..ab76a02 --- /dev/null +++ b/tests/mysql-actq-mt-withpause-vg.sh @@ -0,0 +1,22 @@ +# This file is part of the rsyslog project, released under ASL 2.0 +echo =============================================================================== +echo \[mysql-act-mt.sh\]: test for mysql with multithread actionq +source $srcdir/diag.sh init +mysql --user=rsyslog --password=testbench < testsuites/mysql-truncate.sql +source $srcdir/diag.sh startup-vg mysql-actq-mt.conf +source $srcdir/diag.sh injectmsg 0 50000 +source $srcdir/diag.sh wait-queueempty +echo waiting for worker threads to timeout +./msleep 3000 +source $srcdir/diag.sh injectmsg 50000 50000 +source $srcdir/diag.sh wait-queueempty +echo waiting for worker threads to timeout +./msleep 2000 +source $srcdir/diag.sh injectmsg 100000 50000 +source $srcdir/diag.sh shutdown-when-empty +source $srcdir/diag.sh wait-shutdown-vg +source $srcdir/diag.sh check-exit-vg +# note "-s" is requried to suppress the select "field header" +mysql -s --user=rsyslog --password=testbench < testsuites/mysql-select-msg.sql > rsyslog.out.log +source $srcdir/diag.sh seq-check 0 149999 +source $srcdir/diag.sh exit diff --git a/tests/mysql-actq-mt-withpause.sh b/tests/mysql-actq-mt-withpause.sh new file mode 100755 index 0000000..d680ddf --- /dev/null +++ b/tests/mysql-actq-mt-withpause.sh @@ -0,0 +1,21 @@ +# This file is part of the rsyslog project, released under ASL 2.0 +echo =============================================================================== +echo \[mysql-act-mt.sh\]: test for mysql with multithread actionq +source $srcdir/diag.sh init +mysql --user=rsyslog --password=testbench < testsuites/mysql-truncate.sql +source $srcdir/diag.sh startup mysql-actq-mt.conf +source $srcdir/diag.sh injectmsg 0 50000 +source $srcdir/diag.sh wait-queueempty +echo waiting for worker threads to timeout +./msleep 3000 +source $srcdir/diag.sh injectmsg 50000 50000 +source $srcdir/diag.sh wait-queueempty +echo waiting for worker threads to timeout +./msleep 2000 +source $srcdir/diag.sh injectmsg 100000 50000 +source $srcdir/diag.sh shutdown-when-empty +source $srcdir/diag.sh wait-shutdown +# note "-s" is requried to suppress the select "field header" +mysql -s --user=rsyslog --password=testbench < testsuites/mysql-select-msg.sql > rsyslog.out.log +source $srcdir/diag.sh seq-check 0 149999 +source $srcdir/diag.sh exit diff --git a/tests/mysql-actq-mt.sh b/tests/mysql-actq-mt.sh new file mode 100755 index 0000000..ae96cde --- /dev/null +++ b/tests/mysql-actq-mt.sh @@ -0,0 +1,13 @@ +# This file is part of the rsyslog project, released under ASL 2.0 +echo =============================================================================== +echo \[mysql-act-mt.sh\]: test for mysql with multithread actionq +source $srcdir/diag.sh init +mysql --user=rsyslog --password=testbench < testsuites/mysql-truncate.sql +source $srcdir/diag.sh startup mysql-actq-mt.conf +source $srcdir/diag.sh injectmsg 0 150000 +source $srcdir/diag.sh shutdown-when-empty +source $srcdir/diag.sh wait-shutdown +# note "-s" is requried to suppress the select "field header" +mysql -s --user=rsyslog --password=testbench < testsuites/mysql-select-msg.sql > rsyslog.out.log +source $srcdir/diag.sh seq-check 0 149999 +source $srcdir/diag.sh exit diff --git a/tests/nettester.c b/tests/nettester.c index 4e4fe55..82f3013 100644 --- a/tests/nettester.c +++ b/tests/nettester.c @@ -12,7 +12,7 @@ * * Part of the testbench for rsyslog. * - * Copyright 2009 Rainer Gerhards and Adiscon GmbH. + * Copyright 2009-2014 Rainer Gerhards and Adiscon GmbH. * * This file is part of rsyslog. * @@ -49,6 +49,7 @@ #include <getopt.h> #include <errno.h> #include <ctype.h> +#include <netdb.h> #define EXIT_FAILURE 1 #define INVALID_SOCKET -1 @@ -65,6 +66,7 @@ static char* pszCustomConf = NULL; /* custom config file, use -c conf to specify static int verbose = 0; /* verbose output? -v option */ static int IPv4Only = 0; /* use only IPv4 in rsyslogd call? */ static char **ourEnvp; +static char *ourHostName; /* these two are quick hacks... */ int iFailed = 0; @@ -339,6 +341,44 @@ void unescapeTestdata(char *testdata) } +/* expand variables in expected string. Here we use tilde (~) as expension + * character, because the more natural % is very common in syslog messages + * (and most importantly in the samples we currently have. + * Currently supported are: + * ~H - our hostname + * Note: yes, there are vulns in this code. Doesn't matter, as it is a + * quick and dirty test program, NOT intended to be used in any production! + */ +static void +doVarsInExpected(char **pe) +{ + char *n, *newBase; + char *e = *pe; + n = newBase = malloc(strlen(e) + 1024); /* we simply say "sufficient" */ + while(*e) { + if(*e == '~') { + ++e; + if(*e == 'H') { + ++e; + char *hn = ourHostName; + while(*hn) + *n++ = *hn++; + } else { + *n++ = '?'; + ++e; + } + } else if(*e == '\\') { + ++e; /* skip */ + *n++ = *e++; + } else { + *n++ = *e++; + } + } + *n = '\0'; + free(*pe); + *pe = newBase; +} + /* Process a specific test case. File name is provided. * Needs to return 0 if all is OK, something else otherwise. */ @@ -391,9 +431,9 @@ processTestFile(int fd, char *pszFileName) */ getline(&expected, &lenLn, fp); expected[strlen(expected)-1] = '\0'; /* remove \n */ + doVarsInExpected(&expected); /* pull response from server and then check if it meets our expectation */ -//printf("try pull pipe...\n"); readLine(fd, buf); if(strlen(buf) == 0) { printf("something went wrong - read a zero-length string from rsyslogd\n"); @@ -493,6 +533,23 @@ void doAtExit(void) unlink(NETTEST_INPUT_CONF_FILE); } + +/* Note: the HOSTNAME file must have been pre-generated */ +static void +getHostname(void) +{ + size_t dummy; + FILE *fp; + if((fp = fopen("HOSTNAME", "r")) == NULL) { + perror("HOSTNAME"); + printf("error opening HOSTNAME configuration file\n"); + exit(1); + } + getline(&ourHostName, &dummy, fp); + fclose(fp); +} + + /* Run the test suite. This must be called with exactly one parameter, the * name of the test suite. For details, see file header comment at the top * of this file. @@ -508,6 +565,8 @@ int main(int argc, char *argv[], char *envp[]) char testcases[4096]; ourEnvp = envp; + getHostname(); + while((opt = getopt(argc, argv, "4c:i:p:t:v")) != EOF) { switch((char)opt) { case '4': diff --git a/tests/omod-if-array.sh b/tests/omod-if-array.sh index 4e916f1..3e0409e 100755 --- a/tests/omod-if-array.sh +++ b/tests/omod-if-array.sh @@ -1,4 +1,8 @@ echo \[omod-if-array.sh\]: test omod-if-array via udp +echo NOTE: the interface checked with this test is currently NOT +echo supported. We may support it again in the future. So for now\, +echo we just skip this test and do not remove it. +exit 77 $srcdir/killrsyslog.sh # kill rsyslogd if it runs for some reason ./nettester -tomod-if-array -iudp -p4711 diff --git a/tests/parsertest.sh b/tests/parsertest.sh index 9f9c2f7..eda098e 100755 --- a/tests/parsertest.sh +++ b/tests/parsertest.sh @@ -1,5 +1,15 @@ echo TEST: \[parsertest.sh\]: various parser tests source $srcdir/diag.sh init + +# first we need to obtain the hostname as rsyslog sees it +rm -f HOSTNAME +source $srcdir/diag.sh startup gethostname.conf +source $srcdir/diag.sh tcpflood -m1 -M "<128>" +./msleep 100 +source $srcdir/diag.sh shutdown-when-empty # shut down rsyslogd when done processing messages +source $srcdir/diag.sh wait-shutdown # we need to wait until rsyslogd is finished! + +# now start the real tests source $srcdir/diag.sh nettester parse1 udp source $srcdir/diag.sh nettester parse1 tcp source $srcdir/diag.sh nettester parse2 udp @@ -38,4 +48,5 @@ source $srcdir/diag.sh nettester parse-nodate tcp -4 source $srcdir/diag.sh nettester snare_ccoff_udp udp -4 source $srcdir/diag.sh nettester snare_ccoff_udp2 udp -4 +rm -f HOSTNAME source $srcdir/diag.sh exit diff --git a/tests/proprepltest.sh b/tests/proprepltest.sh index 2e59a31..fcc0b18 100755 --- a/tests/proprepltest.sh +++ b/tests/proprepltest.sh @@ -1,5 +1,6 @@ echo \[proprepltest.sh\]: various tests for the property replacer source $srcdir/diag.sh init +source $srcdir/diag.sh generate-HOSTNAME source $srcdir/diag.sh nettester rfctag udp source $srcdir/diag.sh nettester rfctag tcp source $srcdir/diag.sh nettester nolimittag udp diff --git a/tests/rcvr_fail_restore.sh b/tests/rcvr_fail_restore.sh index 79486f1..0822f57 100755 --- a/tests/rcvr_fail_restore.sh +++ b/tests/rcvr_fail_restore.sh @@ -11,9 +11,12 @@ source $srcdir/diag.sh init # set instance-specific debugging parameters! #export RSYSLOG_DEBUG="debug nostdout" #export RSYSLOG_DEBUGLOG="log2" +echo starting receiver source $srcdir/diag.sh startup rcvr_fail_restore_rcvr.conf 2 +#export RSYSLOG_DEBUG="debug nostdout" #export RSYSLOG_DEBUGLOG="log" #valgrind="valgrind" +echo starting sender source $srcdir/diag.sh startup rcvr_fail_restore_sender.conf # re-set params so that new instances do not thrash it... #unset RSYSLOG_DEBUG @@ -29,6 +32,7 @@ source $srcdir/diag.sh wait-queueempty # Step 2: shutdown receiver, then send some more data, which then # needs to go into the queue. # +echo step 2 source $srcdir/diag.sh shutdown-when-empty 2 source $srcdir/diag.sh wait-shutdown 2 @@ -41,6 +45,7 @@ ls -l test-spool # # Step 3: restart receiver, wait that the sender drains its queue # +echo step 3 #export RSYSLOG_DEBUGLOG="log2" source $srcdir/diag.sh startup rcvr_fail_restore_rcvr.conf 2 echo waiting for sender to drain queue [may need a short while] @@ -54,6 +59,7 @@ echo file size to expect is $OLDFILESIZE # Step 4: send new data. Queue files are not permitted to grow now # (but one file continous to exist). # +echo step 4 source $srcdir/diag.sh injectmsg 11001 10 source $srcdir/diag.sh wait-queueempty @@ -82,6 +88,7 @@ fi # Step 5: stop receiver again, then send some more data, which then # needs to go into the queue. # +echo step 5 echo "*** done primary test *** now checking if DA can be restarted" source $srcdir/diag.sh shutdown-when-empty 2 source $srcdir/diag.sh wait-shutdown 2 @@ -95,6 +102,7 @@ ls -l test-spool # # Step 6: restart receiver, wait that the sender drains its queue # +echo step 6 source $srcdir/diag.sh startup rcvr_fail_restore_rcvr.conf 2 echo waiting for sender to drain queue [may need a short while] source $srcdir/diag.sh wait-queueempty @@ -118,5 +126,5 @@ then exit 1 fi # do the final check -source $srcdir/diag.sh seq-check 1 21010 +source $srcdir/diag.sh seq-check 1 21010 -m 100 source $srcdir/diag.sh exit diff --git a/tests/rfc5424parser.sh b/tests/rfc5424parser.sh new file mode 100755 index 0000000..3f5be49 --- /dev/null +++ b/tests/rfc5424parser.sh @@ -0,0 +1,12 @@ +# This file is part of the rsyslog project, released under ASL 2.0 +# rgerhards, 2013-11-22 +echo =============================================================================== +echo \[rfc5424parser.sh\]: testing mmpstrucdata +source $srcdir/diag.sh init +source $srcdir/diag.sh startup rfc5424parser.conf +sleep 1 +source $srcdir/diag.sh tcpflood -m100 -y +source $srcdir/diag.sh shutdown-when-empty # shut down rsyslogd when done processing messages +source $srcdir/diag.sh wait-shutdown +source $srcdir/diag.sh seq-check 0 99 +source $srcdir/diag.sh exit diff --git a/tests/rs_optimizer_pri.sh b/tests/rs_optimizer_pri.sh new file mode 100755 index 0000000..4d6e463 --- /dev/null +++ b/tests/rs_optimizer_pri.sh @@ -0,0 +1,17 @@ +# Test for the RainerScript optimizer, folding of +# syslogfacility/priority-text to prifilt. Unfortunately, we cannot yet +# automatically detect if the optimizer does not correctly fold, but we +# can at least detect if it segfaults or otherwise creates incorrect code. +# This file is part of the rsyslog project, released under ASL 2.0 +# rgerhards, 2013-11-20 +echo =============================================================================== +echo \[rs_optimizer_pri.sh\]: testing RainerScript PRI optimizer +source $srcdir/diag.sh init +source $srcdir/diag.sh startup rs_optimizer_pri.conf +sleep 1 +source $srcdir/diag.sh tcpflood -m100 # correct facility +source $srcdir/diag.sh tcpflood -m100 -P175 # incorrect facility --> must be ignored +source $srcdir/diag.sh shutdown-when-empty # shut down rsyslogd when done processing messages +source $srcdir/diag.sh wait-shutdown +source $srcdir/diag.sh seq-check 0 99 +source $srcdir/diag.sh exit diff --git a/tests/rscript_eq.sh b/tests/rscript_eq.sh new file mode 100755 index 0000000..5668d4b --- /dev/null +++ b/tests/rscript_eq.sh @@ -0,0 +1,13 @@ +# added 2014-01-17 by rgerhards +# This file is part of the rsyslog project, released under ASL 2.0 +echo =============================================================================== +echo \[rscript_eq.sh\]: testing rainerscript EQ statement +source $srcdir/diag.sh init +source $srcdir/diag.sh startup rscript_eq.conf +source $srcdir/diag.sh injectmsg 0 8000 +echo doing shutdown +source $srcdir/diag.sh shutdown-when-empty +echo wait on shutdown +source $srcdir/diag.sh wait-shutdown +source $srcdir/diag.sh seq-check 5000 5002 +source $srcdir/diag.sh exit diff --git a/tests/rscript_ge.sh b/tests/rscript_ge.sh new file mode 100755 index 0000000..798e944 --- /dev/null +++ b/tests/rscript_ge.sh @@ -0,0 +1,13 @@ +# added 2014-01-17 by rgerhards +# This file is part of the rsyslog project, released under ASL 2.0 +echo =============================================================================== +echo \[rscript_ge.sh\]: testing rainerscript GE statement +source $srcdir/diag.sh init +source $srcdir/diag.sh startup rscript_ge.conf +source $srcdir/diag.sh injectmsg 0 8000 +echo doing shutdown +source $srcdir/diag.sh shutdown-when-empty +echo wait on shutdown +source $srcdir/diag.sh wait-shutdown +source $srcdir/diag.sh seq-check 0 4999 +source $srcdir/diag.sh exit diff --git a/tests/rscript_gt.sh b/tests/rscript_gt.sh new file mode 100755 index 0000000..157f6f3 --- /dev/null +++ b/tests/rscript_gt.sh @@ -0,0 +1,13 @@ +# added 2014-01-17 by rgerhards +# This file is part of the rsyslog project, released under ASL 2.0 +echo =============================================================================== +echo \[rscript_gt.sh\]: testing rainerscript GT statement +source $srcdir/diag.sh init +source $srcdir/diag.sh startup rscript_gt.conf +source $srcdir/diag.sh injectmsg 0 8000 +echo doing shutdown +source $srcdir/diag.sh shutdown-when-empty +echo wait on shutdown +source $srcdir/diag.sh wait-shutdown +source $srcdir/diag.sh seq-check 5000 7999 +source $srcdir/diag.sh exit diff --git a/tests/rscript_le.sh b/tests/rscript_le.sh new file mode 100755 index 0000000..426f207 --- /dev/null +++ b/tests/rscript_le.sh @@ -0,0 +1,13 @@ +# added 2014-01-17 by rgerhards +# This file is part of the rsyslog project, released under ASL 2.0 +echo =============================================================================== +echo \[rscript_le.sh\]: testing rainerscript LE statement +source $srcdir/diag.sh init +source $srcdir/diag.sh startup rscript_le.conf +source $srcdir/diag.sh injectmsg 0 8000 +echo doing shutdown +source $srcdir/diag.sh shutdown-when-empty +echo wait on shutdown +source $srcdir/diag.sh wait-shutdown +source $srcdir/diag.sh seq-check 0 5000 +source $srcdir/diag.sh exit diff --git a/tests/rscript_lt.sh b/tests/rscript_lt.sh new file mode 100755 index 0000000..5d35164 --- /dev/null +++ b/tests/rscript_lt.sh @@ -0,0 +1,13 @@ +# added 2014-01-17 by rgerhards +# This file is part of the rsyslog project, released under ASL 2.0 +echo =============================================================================== +echo \[rscript_lt.sh\]: testing rainerscript LT statement +source $srcdir/diag.sh init +source $srcdir/diag.sh startup rscript_lt.conf +source $srcdir/diag.sh injectmsg 0 8000 +echo doing shutdown +source $srcdir/diag.sh shutdown-when-empty +echo wait on shutdown +source $srcdir/diag.sh wait-shutdown +source $srcdir/diag.sh seq-check 0 4999 +source $srcdir/diag.sh exit diff --git a/tests/rscript_ne.sh b/tests/rscript_ne.sh new file mode 100755 index 0000000..9459ddd --- /dev/null +++ b/tests/rscript_ne.sh @@ -0,0 +1,13 @@ +# added 2014-01-17 by rgerhards +# This file is part of the rsyslog project, released under ASL 2.0 +echo =============================================================================== +echo \[rscript_ne.sh\]: testing rainerscript NE statement +source $srcdir/diag.sh init +source $srcdir/diag.sh startup rscript_ne.conf +source $srcdir/diag.sh injectmsg 0 8000 +echo doing shutdown +source $srcdir/diag.sh shutdown-when-empty +echo wait on shutdown +source $srcdir/diag.sh wait-shutdown +source $srcdir/diag.sh seq-check 5000 5002 +source $srcdir/diag.sh exit diff --git a/tests/rulesetmultiqueue-v6.sh b/tests/rulesetmultiqueue-v6.sh new file mode 100755 index 0000000..21166fe --- /dev/null +++ b/tests/rulesetmultiqueue-v6.sh @@ -0,0 +1,33 @@ +# Test for disk-only queue mode with v6+ config +# This tests defines three rulesets, each one with its own queue. Then, it +# sends data to them and checks the outcome. Note that we do need to +# use some custom code as the test driver framework does not (yet?) +# support multi-output-file operations. +# added 2013-11-14 by Rgerhards +# This file is part of the rsyslog project, released under GPLv3 +echo =============================================================================== +echo \[rulesetmultiqueu.sh\]: testing multiple queues via rulesets +source $srcdir/diag.sh init +rm -f rsyslog.out1.log rsyslog.out2.log rsyslog.out3.log +source $srcdir/diag.sh startup rulesetmultiqueue-v6.conf +source $srcdir/diag.sh wait-startup +# now fill the three files (a bit sequentially, but they should +# still get their share of concurrency - to increase the chance +# we use three connections per set). +source $srcdir/diag.sh tcpflood -c3 -p13514 -m20000 -i0 +source $srcdir/diag.sh tcpflood -c3 -p13515 -m20000 -i20000 +source $srcdir/diag.sh tcpflood -c3 -p13516 -m20000 -i40000 + +# in this version of the imdiag, we do not have the capability to poll +# all queues for emptyness. So we do a sleep in the hopes that this will +# sufficiently drain the queues. This is race, but the best we currently +# can do... - rgerhards, 2009-11-05 +sleep 2 +source $srcdir/diag.sh shutdown-when-empty # shut down rsyslogd when done processing messages +source $srcdir/diag.sh wait-shutdown +# now consolidate all logs into a single one so that we can use the +# regular check logic +cat rsyslog.out1.log rsyslog.out2.log rsyslog.out3.log > rsyslog.out.log +source $srcdir/diag.sh seq-check 0 59999 +rm -f rsyslog.out1.log rsyslog.out2.log rsyslog.out3.log +source $srcdir/diag.sh exit diff --git a/tests/sndrcv_relp.sh b/tests/sndrcv_relp.sh new file mode 100755 index 0000000..e679651 --- /dev/null +++ b/tests/sndrcv_relp.sh @@ -0,0 +1,5 @@ +# added 2013-12-10 by Rgerhards +# This file is part of the rsyslog project, released under ASL 2.0 +echo =============================================================================== +echo \[sndrcv_relp.sh\]: testing sending and receiving via relp +source $srcdir/sndrcv_drvr.sh sndrcv_relp 50000 diff --git a/tests/stop-localvar.sh b/tests/stop-localvar.sh new file mode 100755 index 0000000..9157301 --- /dev/null +++ b/tests/stop-localvar.sh @@ -0,0 +1,12 @@ +# Test for "stop" statement +# This file is part of the rsyslog project, released under ASL 2.0 +echo =============================================================================== +echo \[stop-localvar.sh\]: testing stop statement together with local variables +source $srcdir/diag.sh init +source $srcdir/diag.sh startup stop-localvar.conf +sleep 1 +source $srcdir/diag.sh tcpflood -m2000 -i1 +source $srcdir/diag.sh shutdown-when-empty # shut down rsyslogd when done processing messages +source $srcdir/diag.sh wait-shutdown +source $srcdir/diag.sh seq-check 100 999 +source $srcdir/diag.sh exit diff --git a/tests/stop-msgvar.sh b/tests/stop-msgvar.sh new file mode 100755 index 0000000..d8902da --- /dev/null +++ b/tests/stop-msgvar.sh @@ -0,0 +1,12 @@ +# Test for "stop" statement +# This file is part of the rsyslog project, released under ASL 2.0 +echo =============================================================================== +echo \[stop-msgvar.sh\]: testing stop statement together with message variables +source $srcdir/diag.sh init +source $srcdir/diag.sh startup stop-msgvar.conf +sleep 1 +source $srcdir/diag.sh tcpflood -m2000 -i1 +source $srcdir/diag.sh shutdown-when-empty # shut down rsyslogd when done processing messages +source $srcdir/diag.sh wait-shutdown +source $srcdir/diag.sh seq-check 100 999 +source $srcdir/diag.sh exit diff --git a/tests/stop.sh b/tests/stop.sh new file mode 100755 index 0000000..f3dcf99 --- /dev/null +++ b/tests/stop.sh @@ -0,0 +1,12 @@ +# Test for "stop" statement +# This file is part of the rsyslog project, released under ASL 2.0 +echo =============================================================================== +echo \[stop.sh\]: testing stop statement +source $srcdir/diag.sh init +source $srcdir/diag.sh startup stop.conf +sleep 1 +source $srcdir/diag.sh tcpflood -m10 -i1 +source $srcdir/diag.sh shutdown-when-empty # shut down rsyslogd when done processing messages +source $srcdir/diag.sh wait-shutdown +source $srcdir/diag.sh seq-check 2 10 +source $srcdir/diag.sh exit diff --git a/tests/tabescape_dflt.sh b/tests/tabescape_dflt.sh index d0e13ec..6a47949 100755 --- a/tests/tabescape_dflt.sh +++ b/tests/tabescape_dflt.sh @@ -1,6 +1,7 @@ echo =============================================================================== echo \[tabescape_dflt.sh\]: test for default tab escaping -$srcdir/killrsyslog.sh # kill rsyslogd if it runs for some reason +source $srcdir/diag.sh init +source $srcdir/diag.sh generate-HOSTNAME ./nettester -ttabescape_dflt -iudp if [ "$?" -ne "0" ]; then diff --git a/tests/tabescape_off.sh b/tests/tabescape_off.sh index 71ede7c..90f4792 100755 --- a/tests/tabescape_off.sh +++ b/tests/tabescape_off.sh @@ -1,6 +1,7 @@ echo =============================================================================== echo \[tabescape_off.sh\]: test for tab escaping off -$srcdir/killrsyslog.sh # kill rsyslogd if it runs for some reason +source $srcdir/diag.sh init +source $srcdir/diag.sh generate-HOSTNAME ./nettester -ttabescape_off -iudp if [ "$?" -ne "0" ]; then diff --git a/tests/tcpflood.c b/tests/tcpflood.c index b3cef2e..1c60aa4 100644 --- a/tests/tcpflood.c +++ b/tests/tcpflood.c @@ -6,7 +6,12 @@ * -p target port (default 13514) * -n number of target ports (targets are in range -p..(-p+-n-1) * Note -c must also be set to at LEAST the number of -n! - * -c number of connections (default 1) + * -c number of connections (default 1), use negative number + * to set a "soft limit": if tcpflood cannot open the + * requested number of connections, gracefully degrade to + * whatever number could be opened. This is useful in environments + * where system config constraints cannot be overriden (e.g. + * vservers, non-admin users, ...) * -m number of messages to send (connection is random) * -i initial message number (optional) * -P PRI to be used for generated messages (default is 167). @@ -48,13 +53,15 @@ * -b number of messages within a batch (default: 100,000,000 millions) * -Y use multiple threads, one per connection (which means 1 if one only connection * is configured!) + * -y use RFC5424 style test message * -z private key file for TLS mode * -Z cert (public key) file for TLS mode * -L loglevel to use for GnuTLS troubleshooting (0-off to 10-all, 0 default) + * -j format message in json, parameter is JSON cookie * * Part of the testbench for rsyslog. * - * Copyright 2009, 2010 Rainer Gerhards and Adiscon GmbH. + * Copyright 2009, 2013 Rainer Gerhards and Adiscon GmbH. * * This file is part of rsyslog. * @@ -111,9 +118,11 @@ static int targetPort = 13514; static int numTargetPorts = 1; static int dynFileIDs = 0; static int extraDataLen = 0; /* amount of extra data to add to message */ +static int useRFC5424Format = 0; /* should the test message be in RFC5424 format? */ static int bRandomizeExtraData = 0; /* randomize amount of extra data added */ static int numMsgsToSend; /* number of messages to send */ -static unsigned numConnections = 1; /* number of connections to create */ +static int numConnections = 1; /* number of connections to create */ +static int softLimitConnections = 0; /* soft connection limit, see -c option description */ static int *sockArray; /* array of sockets to use */ static int msgNum = 0; /* initial message number to start with */ static int bShowProgress = 1; /* show progress messages */ @@ -137,6 +146,7 @@ static int numThrds = 1; /* number of threads to use */ static char *tlsCertFile = NULL; static char *tlsKeyFile = NULL; static int tlsLogLevel = 0; +static char *jsonCookie = NULL; /* if non-NULL, use JSON format with this cookie */ #ifdef ENABLE_GNUTLS static gnutls_session_t *sessArray; /* array of TLS sessions to use */ @@ -208,7 +218,7 @@ int openConn(int *fd) int rnd; if((sock=socket(AF_INET, SOCK_STREAM, 0))==-1) { - perror("socket()"); + perror("\nsocket()"); return(1); } @@ -250,7 +260,7 @@ int openConn(int *fd) */ int openConnections(void) { - unsigned i; + int i; char msgBuf[128]; size_t lenMsg; @@ -270,6 +280,12 @@ int openConnections(void) } if(openConn(&(sockArray[i])) != 0) { printf("error in trying to open connection i=%d\n", i); + if(softLimitConnections) { + numConnections = i - 1; + printf("Connection limit is soft, continuing with only %d " + "connections.\n", numConnections); + break; + } return 1; } if(transport == TP_TLS) { @@ -294,7 +310,7 @@ int openConnections(void) */ void closeConnections(void) { - unsigned i; + int i; size_t lenMsg; struct linger ling; char msgBuf[128]; @@ -358,13 +374,28 @@ genMsg(char *buf, size_t maxBuf, int *pLenBuf, struct instdata *inst) } } } while(!done); /* Attention: do..while()! */ + } else if(jsonCookie != NULL) { + if(useRFC5424Format) { + *pLenBuf = snprintf(buf, maxBuf, "<%s>1 2003-03-01T01:00:00.000Z mymachine.example.com tcpflood " + "- tag [tcpflood@32473 MSGNUM=\"%8.8d\"] %s{\"msgnum\":%d}%c", + msgPRI, msgNum, jsonCookie, msgNum, frameDelim); + } else { + *pLenBuf = snprintf(buf, maxBuf, "<%s>Mar 1 01:00:00 172.20.245.8 tag %s{\"msgnum\":%d}%c", + msgPRI, jsonCookie, msgNum, frameDelim); + } } else if(MsgToSend == NULL) { if(dynFileIDs > 0) { snprintf(dynFileIDBuf, sizeof(dynFileIDBuf), "%d:", rand() % dynFileIDs); } if(extraDataLen == 0) { - *pLenBuf = snprintf(buf, maxBuf, "<%s>Mar 1 01:00:00 172.20.245.8 tag msgnum:%s%8.8d:%c", - msgPRI, dynFileIDBuf, msgNum, frameDelim); + if(useRFC5424Format) { + *pLenBuf = snprintf(buf, maxBuf, "<%s>1 2003-03-01T01:00:00.000Z mymachine.example.com tcpflood " + "- tag [tcpflood@32473 MSGNUM=\"%8.8d\"] msgnum:%s%8.8d:%c", + msgPRI, msgNum, dynFileIDBuf, msgNum, frameDelim); + } else { + *pLenBuf = snprintf(buf, maxBuf, "<%s>Mar 1 01:00:00 172.20.245.8 tag msgnum:%s%8.8d:%c", + msgPRI, dynFileIDBuf, msgNum, frameDelim); + } } else { if(bRandomizeExtraData) edLen = ((long) rand() + extraDataLen) % extraDataLen + 1; @@ -372,8 +403,14 @@ genMsg(char *buf, size_t maxBuf, int *pLenBuf, struct instdata *inst) edLen = extraDataLen; memset(extraData, 'X', edLen); extraData[edLen] = '\0'; - *pLenBuf = snprintf(buf, maxBuf, "<%s>Mar 1 01:00:00 172.20.245.8 tag msgnum:%s%8.8d:%d:%s%c", - msgPRI, dynFileIDBuf, msgNum, edLen, extraData, frameDelim); + if(useRFC5424Format) { + *pLenBuf = snprintf(buf, maxBuf, "<%s>1 2003-03-01T01:00:00.000Z mymachine.example.com tcpflood " + "- tag [tcpflood@32473 MSGNUM=\"%8.8d\"] msgnum:%s%8.8d:%c", + msgPRI, msgNum, dynFileIDBuf, msgNum, frameDelim); + } else { + *pLenBuf = snprintf(buf, maxBuf, "<%s>Mar 1 01:00:00 172.20.245.8 tag msgnum:%s%8.8d:%d:%s%c", + msgPRI, dynFileIDBuf, msgNum, edLen, extraData, frameDelim); + } } } else { /* use fixed message format from command line */ @@ -419,7 +456,7 @@ int sendMessages(struct instdata *inst) if(runMultithreaded) { socknum = inst->idx; } else { - if(i < numConnections) + if((int) i < numConnections) socknum = i; else if(i >= inst->numMsgs - numConnections) { socknum = i - (inst->numMsgs - numConnections); @@ -830,7 +867,7 @@ int main(int argc, char *argv[]) setvbuf(stdout, buf, _IONBF, 48); - while((opt = getopt(argc, argv, "b:ef:F:t:p:c:C:m:i:I:P:d:Dn:L:M:rsBR:S:T:XW:Yz:Z:")) != -1) { + while((opt = getopt(argc, argv, "b:ef:F:t:p:c:C:m:i:I:P:d:Dn:L:M:rsBR:S:T:XW:yYz:Z:j:")) != -1) { switch (opt) { case 'b': batchsize = atoll(optarg); break; @@ -840,7 +877,11 @@ int main(int argc, char *argv[]) break; case 'n': numTargetPorts = atoi(optarg); break; - case 'c': numConnections = (unsigned) atoi(optarg); + case 'c': numConnections = atoi(optarg); + if(numConnections < 0) { + numConnections *= -1; + softLimitConnections = 1; + } break; case 'C': numFileIterations = atoi(optarg); break; @@ -850,6 +891,8 @@ int main(int argc, char *argv[]) break; case 'P': msgPRI = optarg; break; + case 'j': jsonCookie = optarg; + break; case 'd': extraDataLen = atoi(optarg); if(extraDataLen > MAX_EXTRADATA_LEN) { fprintf(stderr, "-d max is %d!\n", @@ -908,6 +951,8 @@ int main(int argc, char *argv[]) break; case 'Y': runMultithreaded = 1; break; + case 'y': useRFC5424Format = 1; + break; case 'z': tlsKeyFile = optarg; break; case 'Z': tlsCertFile = optarg; diff --git a/tests/testsuites/elasticsearch-basic-bulk.conf b/tests/testsuites/elasticsearch-basic-bulk.conf new file mode 100644 index 0000000..69a0495 --- /dev/null +++ b/tests/testsuites/elasticsearch-basic-bulk.conf @@ -0,0 +1,10 @@ +$IncludeConfig diag-common.conf + +template(name="tpl" type="string" + string="{\"msgnum\":\"%msg:F,58:2%\"}") + +module(load="../plugins/omelasticsearch/.libs/omelasticsearch") +:msg, contains, "msgnum:" action(type="omelasticsearch" + template="tpl" + searchIndex="rsyslog_testbench" + bulkmode="on") diff --git a/tests/testsuites/elasticsearch-basic-errorfile-empty.conf b/tests/testsuites/elasticsearch-basic-errorfile-empty.conf new file mode 100644 index 0000000..6b0371c --- /dev/null +++ b/tests/testsuites/elasticsearch-basic-errorfile-empty.conf @@ -0,0 +1,10 @@ +$IncludeConfig diag-common.conf + +template(name="tpl" type="string" + string="{\"msgnum\":\"%msg:F,58:2%\"}") + +module(load="../plugins/omelasticsearch/.libs/omelasticsearch") +:msg, contains, "msgnum:" action(type="omelasticsearch" + template="tpl" + searchIndex="rsyslog_testbench" + errorFile="./rsyslog.errorfile") diff --git a/tests/testsuites/elasticsearch-basic-errorfile-populated.conf b/tests/testsuites/elasticsearch-basic-errorfile-populated.conf new file mode 100644 index 0000000..d13b712 --- /dev/null +++ b/tests/testsuites/elasticsearch-basic-errorfile-populated.conf @@ -0,0 +1,15 @@ +$IncludeConfig diag-common.conf + +# Note: we must mess up with the template, because we can not +# instruct ES to put further constraints on the data type and +# values. So we require integer and make sure it is none. +template(name="tpl" type="string" + string="{\"msgnum\":\"x%msg:F,58:2%\"}") + +module(load="../plugins/omelasticsearch/.libs/omelasticsearch") +:msg, contains, "msgnum:" action(type="omelasticsearch" + template="tpl" + searchIndex="rsyslog_testbench" + searchType="test-type" + bulkmode="off" + errorFile="./rsyslog.errorfile") diff --git a/tests/testsuites/elasticsearch-basic.conf b/tests/testsuites/elasticsearch-basic.conf new file mode 100644 index 0000000..627bacc --- /dev/null +++ b/tests/testsuites/elasticsearch-basic.conf @@ -0,0 +1,9 @@ +$IncludeConfig diag-common.conf + +template(name="tpl" type="string" + string="{\"msgnum\":\"%msg:F,58:2%\"}") + +module(load="../plugins/omelasticsearch/.libs/omelasticsearch") +:msg, contains, "msgnum:" action(type="omelasticsearch" + template="tpl" + searchIndex="rsyslog_testbench") diff --git a/tests/testsuites/elasticsearch-bulk-errorfile-empty.conf b/tests/testsuites/elasticsearch-bulk-errorfile-empty.conf new file mode 100644 index 0000000..46e7cce --- /dev/null +++ b/tests/testsuites/elasticsearch-bulk-errorfile-empty.conf @@ -0,0 +1,11 @@ +$IncludeConfig diag-common.conf + +template(name="tpl" type="string" + string="{\"msgnum\":\"%msg:F,58:2%\"}") + +module(load="../plugins/omelasticsearch/.libs/omelasticsearch") +:msg, contains, "msgnum:" action(type="omelasticsearch" + template="tpl" + searchIndex="rsyslog_testbench" + bulkmode="on" + errorFile="./rsyslog.errorfile") diff --git a/tests/testsuites/elasticsearch-bulk-errorfile-populated.conf b/tests/testsuites/elasticsearch-bulk-errorfile-populated.conf new file mode 100644 index 0000000..21e7ddd --- /dev/null +++ b/tests/testsuites/elasticsearch-bulk-errorfile-populated.conf @@ -0,0 +1,15 @@ +$IncludeConfig diag-common.conf + +# Note: we must mess up with the template, because we can not +# instruct ES to put further constraints on the data type and +# values. So we require integer and make sure it is none. +template(name="tpl" type="string" + string="{\"msgnum\":\"x%msg:F,58:2%\"}") + +module(load="../plugins/omelasticsearch/.libs/omelasticsearch") +:msg, contains, "msgnum:" action(type="omelasticsearch" + template="tpl" + searchIndex="rsyslog_testbench" + searchType="test-type" + bulkmode="on" + errorFile="./rsyslog.errorfile") diff --git a/tests/testsuites/execonlywhenprevsuspended.conf b/tests/testsuites/execonlywhenprevsuspended.conf index 04dc6b5..8f9263d 100644 --- a/tests/testsuites/execonlywhenprevsuspended.conf +++ b/tests/testsuites/execonlywhenprevsuspended.conf @@ -1,5 +1,6 @@ # See main .sh file for info # rgerhards, 2010-06-23 +main_queue(queue.workerthreads="1") $IncludeConfig diag-common.conf # omtesting provides the ability to cause "SUSPENDED" action state diff --git a/tests/testsuites/execonlywhenprevsuspended_multiwrkr.conf b/tests/testsuites/execonlywhenprevsuspended_multiwrkr.conf new file mode 100644 index 0000000..7af2536 --- /dev/null +++ b/tests/testsuites/execonlywhenprevsuspended_multiwrkr.conf @@ -0,0 +1,12 @@ +main_queue(queue.dequeueBatchSize="10" queue.workerthreads="3" queue.workerthreadminimummessages="100") +$IncludeConfig diag-common.conf + +# omtesting provides the ability to cause "SUSPENDED" action state +$ModLoad ../plugins/omtesting/.libs/omtesting + +$MainMsgQueueTimeoutShutdown 100000 +$template outfmt,"%msg:F,58:2%\n" + +:msg, contains, "msgnum:" :omtesting:fail 2 0 +$ActionExecOnlyWhenPreviousIsSuspended on +& ./rsyslog.out.log;outfmt diff --git a/tests/testsuites/fac_authpriv.conf b/tests/testsuites/fac_authpriv.conf new file mode 100644 index 0000000..6a6484b --- /dev/null +++ b/tests/testsuites/fac_authpriv.conf @@ -0,0 +1,7 @@ +$IncludeConfig diag-common.conf + +$ModLoad ../plugins/imtcp/.libs/imtcp +$InputTCPServerRun 13514 + +$template outfmt,"%msg:F,58:2%,%msg:F,58:3%,%msg:F,58:4%\n" +authpriv.* ./rsyslog.out.log;outfmt diff --git a/tests/testsuites/fac_local0.conf b/tests/testsuites/fac_local0.conf new file mode 100644 index 0000000..2357e63 --- /dev/null +++ b/tests/testsuites/fac_local0.conf @@ -0,0 +1,8 @@ +$IncludeConfig diag-common.conf + +module(load="../plugins/imtcp/.libs/imtcp") +input(type="imtcp" port="13514") + +template(type="string" name="outfmt" string="%msg:F,58:2%,%msg:F,58:3%,%msg:F,58:4%\n") +if $syslogfacility-text == "local0" then + action(type="omfile" file="rsyslog.out.log" template="outfmt") diff --git a/tests/testsuites/fac_mail.conf b/tests/testsuites/fac_mail.conf new file mode 100644 index 0000000..ffe0dfd --- /dev/null +++ b/tests/testsuites/fac_mail.conf @@ -0,0 +1,7 @@ +$IncludeConfig diag-common.conf + +module(load="../plugins/imtcp/.libs/imtcp") +input(type="imtcp" port="13514") + +template(type="string" name="outfmt" string="%msg:F,58:2%,%msg:F,58:3%,%msg:F,58:4%\n") +mail.* action(type="omfile" file="rsyslog.out.log" template="outfmt") diff --git a/tests/testsuites/fac_news.conf b/tests/testsuites/fac_news.conf new file mode 100644 index 0000000..efc6ba0 --- /dev/null +++ b/tests/testsuites/fac_news.conf @@ -0,0 +1,8 @@ +$IncludeConfig diag-common.conf + +module(load="../plugins/imtcp/.libs/imtcp") +input(type="imtcp" port="13514") + +template(type="string" name="outfmt" string="%msg:F,58:2%,%msg:F,58:3%,%msg:F,58:4%\n") +if prifilt("news.*") then + action(type="omfile" file="rsyslog.out.log" template="outfmt") diff --git a/tests/testsuites/fac_uucp.conf b/tests/testsuites/fac_uucp.conf new file mode 100644 index 0000000..90d9646 --- /dev/null +++ b/tests/testsuites/fac_uucp.conf @@ -0,0 +1,7 @@ +$IncludeConfig diag-common.conf + +module(load="../plugins/imtcp/.libs/imtcp") +input(type="imtcp" port="13514") + +template(type="string" name="outfmt" string="%msg:F,58:2%,%msg:F,58:3%,%msg:F,58:4%\n") +uucp.* action(type="omfile" file="rsyslog.out.log" template="outfmt") diff --git a/tests/testsuites/global_vars.conf b/tests/testsuites/global_vars.conf new file mode 100644 index 0000000..0d1a3cb --- /dev/null +++ b/tests/testsuites/global_vars.conf @@ -0,0 +1,17 @@ +$IncludeConfig diag-common.conf + +$MainMsgQueueTimeoutShutdown 10000 + +module(load="../plugins/imtcp/.libs/imtcp") +input(type="imtcp" port="13514") + +template(name="outfmt" type="string" string="%$/msgnum%\n") +template(name="dynfile" type="string" string="rsyslog.out.log") /* trick to use relative path names! */ + +if $/msgnum == "" then + set $/msgnum = 0; + +if $msg contains "msgnum:" then { + action(type="omfile" dynaFile="dynfile" template="outfmt") + set $/msgnum = $/msgnum + 1; +} diff --git a/tests/testsuites/mmjsonparse_cim.conf b/tests/testsuites/mmjsonparse_cim.conf new file mode 100644 index 0000000..47cfd7d --- /dev/null +++ b/tests/testsuites/mmjsonparse_cim.conf @@ -0,0 +1,11 @@ +$IncludeConfig diag-common.conf +template(name="outfmt" type="string" string="%$!cim!msgnum%\n") + +module(load="../plugins/mmjsonparse/.libs/mmjsonparse") +module(load="../plugins/imptcp/.libs/imptcp") +input(type="imptcp" port="13514") + +action(type="mmjsonparse" cookie="@cim:" container="!cim") +if $parsesuccess == "OK" then { + action(type="omfile" file="./rsyslog.out.log" template="outfmt") +} diff --git a/tests/testsuites/mmjsonparse_simple.conf b/tests/testsuites/mmjsonparse_simple.conf new file mode 100644 index 0000000..f298a57 --- /dev/null +++ b/tests/testsuites/mmjsonparse_simple.conf @@ -0,0 +1,11 @@ +$IncludeConfig diag-common.conf +template(name="outfmt" type="string" string="%$!msgnum%\n") + +module(load="../plugins/mmjsonparse/.libs/mmjsonparse") +module(load="../plugins/imptcp/.libs/imptcp") +input(type="imptcp" port="13514") + +action(type="mmjsonparse") +if $parsesuccess == "OK" then { + action(type="omfile" file="./rsyslog.out.log" template="outfmt") +} diff --git a/tests/testsuites/mmpstrucdata.conf b/tests/testsuites/mmpstrucdata.conf new file mode 100644 index 0000000..fd18fd9 --- /dev/null +++ b/tests/testsuites/mmpstrucdata.conf @@ -0,0 +1,12 @@ +$IncludeConfig diag-common.conf + +module(load="../plugins/mmpstrucdata/.libs/mmpstrucdata") +module(load="../plugins/imtcp/.libs/imtcp") + +template(name="outfmt" type="string" string="%$!rfc5424-sd!tcpflood@32473!msgnum%\n") + +input(type="imtcp" port="13514") + +action(type="mmpstrucdata") +if $msg contains "msgnum" then + action(type="omfile" template="outfmt" file="rsyslog.out.log") diff --git a/tests/testsuites/mysql-actq-mt.conf b/tests/testsuites/mysql-actq-mt.conf new file mode 100644 index 0000000..e12b77b --- /dev/null +++ b/tests/testsuites/mysql-actq-mt.conf @@ -0,0 +1,14 @@ +$IncludeConfig diag-common.conf + +module(load="../plugins/ommysql/.libs/ommysql") + +:msg, contains, "msgnum:" { + action(type="ommysql" server="127.0.0.1" + db="Syslog" uid="rsyslog" pwd="testbench" + queue.size="10000" queue.type="linkedList" + queue.workerthreads="5" + queue.workerthreadMinimumMessages="500" + queue.timeoutWorkerthreadShutdown="1000" + queue.timeoutEnqueue="10000" + ) +} diff --git a/tests/testsuites/mysql-asyn.conf b/tests/testsuites/mysql-asyn.conf index acdf9bb..44b151a 100644 --- a/tests/testsuites/mysql-asyn.conf +++ b/tests/testsuites/mysql-asyn.conf @@ -2,4 +2,5 @@ $IncludeConfig diag-common.conf $ModLoad ../plugins/ommysql/.libs/ommysql $ActionQueueType LinkedList +$ActionQueueTimeoutEnqueue 10000 # 10 second to make sure we do not loose due to action q full :msg, contains, "msgnum:" :ommysql:127.0.0.1,Syslog,rsyslog,testbench; diff --git a/tests/testsuites/rcvr_fail_restore_sender.conf b/tests/testsuites/rcvr_fail_restore_sender.conf index 6b11aa4..d5c34ef 100644 --- a/tests/testsuites/rcvr_fail_restore_sender.conf +++ b/tests/testsuites/rcvr_fail_restore_sender.conf @@ -5,11 +5,17 @@ $ModLoad ../plugins/imtcp/.libs/imtcp $InputTCPServerRun 13514 $WorkDirectory test-spool +$MainMsgQueueSize 2000 +$MainMsgQueueLowWaterMark 800 +$MainMsgQueueHighWaterMark 1000 +$MainMsgQueueDequeueBatchSize 1 $MainMsgQueueMaxFileSize 1g +$MainMsgQueueWorkerThreads 1 $MainMsgQueueFileName mainq # we use the shortest resume interval a) to let the test not run too long # and b) make sure some retries happen before the reconnect $ActionResumeInterval 1 +$ActionSendResendLastMsgOnReconnect on $ActionResumeRetryCount -1 *.* @@127.0.0.1:13515 diff --git a/tests/testsuites/rfc5424parser.conf b/tests/testsuites/rfc5424parser.conf new file mode 100644 index 0000000..cd90d12 --- /dev/null +++ b/tests/testsuites/rfc5424parser.conf @@ -0,0 +1,10 @@ +$IncludeConfig diag-common.conf + +module(load="../plugins/imtcp/.libs/imtcp") + +template(name="outfmt" type="string" string="%msg:F,58:2%\n") + +input(type="imtcp" port="13514") + +if $msg contains "msgnum" then + action(type="omfile" template="outfmt" file="rsyslog.out.log") diff --git a/tests/testsuites/rs_optimizer_pri.conf b/tests/testsuites/rs_optimizer_pri.conf new file mode 100644 index 0000000..9ff27dc --- /dev/null +++ b/tests/testsuites/rs_optimizer_pri.conf @@ -0,0 +1,8 @@ +$IncludeConfig diag-common.conf +template(name="outfmt" type="string" string="%msg:F,58:2%\n") + +module(load="../plugins/imtcp/.libs/imtcp") +input(type="imtcp" port="13514") + +if $syslogfacility-text == "local4" then + action(type="omfile" template="outfmt" file="rsyslog.out.log") diff --git a/tests/testsuites/rscript_eq.conf b/tests/testsuites/rscript_eq.conf new file mode 100644 index 0000000..0130aed --- /dev/null +++ b/tests/testsuites/rscript_eq.conf @@ -0,0 +1,14 @@ +$IncludeConfig diag-common.conf + +template(name="outfmt" type="list") { + property(name="$!usr!msgnum") + constant(value="\n") +} + +if $msg contains 'msgnum' then { + set $!usr!msgnum = field($msg, 58, 2); + if $!usr!msgnum == "00005000" or + $!usr!msgnum == "00005001" or + $!usr!msgnum == "00005002" then + action(type="omfile" file="./rsyslog.out.log" template="outfmt") +} diff --git a/tests/testsuites/rscript_ge.conf b/tests/testsuites/rscript_ge.conf new file mode 100644 index 0000000..c2ff86a --- /dev/null +++ b/tests/testsuites/rscript_ge.conf @@ -0,0 +1,13 @@ +$IncludeConfig diag-common.conf + +template(name="outfmt" type="list") { + property(name="$!usr!msgnum") + constant(value="\n") +} + +if $msg contains 'msgnum' then { + set $!usr!msgnum = field($msg, 58, 2); + if $!usr!msgnum >= "00005000" then + stop + action(type="omfile" file="./rsyslog.out.log" template="outfmt") +} diff --git a/tests/testsuites/rscript_gt.conf b/tests/testsuites/rscript_gt.conf new file mode 100644 index 0000000..9a651ad --- /dev/null +++ b/tests/testsuites/rscript_gt.conf @@ -0,0 +1,12 @@ +$IncludeConfig diag-common.conf + +template(name="outfmt" type="list") { + property(name="$!usr!msgnum") + constant(value="\n") +} + +if $msg contains 'msgnum' then { + set $!usr!msgnum = field($msg, 58, 2); + if $!usr!msgnum > "00004999" then + action(type="omfile" file="./rsyslog.out.log" template="outfmt") +} diff --git a/tests/testsuites/rscript_le.conf b/tests/testsuites/rscript_le.conf new file mode 100644 index 0000000..1963cc5 --- /dev/null +++ b/tests/testsuites/rscript_le.conf @@ -0,0 +1,12 @@ +$IncludeConfig diag-common.conf + +template(name="outfmt" type="list") { + property(name="$!usr!msgnum") + constant(value="\n") +} + +if $msg contains 'msgnum' then { + set $!usr!msgnum = field($msg, 58, 2); + if $!usr!msgnum <= "00005000" then + action(type="omfile" file="./rsyslog.out.log" template="outfmt") +} diff --git a/tests/testsuites/rscript_lt.conf b/tests/testsuites/rscript_lt.conf new file mode 100644 index 0000000..1f455ec --- /dev/null +++ b/tests/testsuites/rscript_lt.conf @@ -0,0 +1,12 @@ +$IncludeConfig diag-common.conf + +template(name="outfmt" type="list") { + property(name="$!usr!msgnum") + constant(value="\n") +} + +if $msg contains 'msgnum' then { + set $!usr!msgnum = field($msg, 58, 2); + if $!usr!msgnum < "00005000" then + action(type="omfile" file="./rsyslog.out.log" template="outfmt") +} diff --git a/tests/testsuites/rscript_ne.conf b/tests/testsuites/rscript_ne.conf new file mode 100644 index 0000000..43148ca --- /dev/null +++ b/tests/testsuites/rscript_ne.conf @@ -0,0 +1,18 @@ +$IncludeConfig diag-common.conf + +template(name="outfmt" type="list") { + property(name="$!usr!msgnum") + constant(value="\n") +} + +if $msg contains 'msgnum' then { + set $!usr!msgnum = field($msg, 58, 2); + if $!usr!msgnum != "00005000" and + $!usr!msgnum != "00005001" and + $!usr!msgnum != "00005002" then + set $!usr!write = 0; + else + set $!usr!write = 1; + if $!usr!write == 1 then + action(type="omfile" file="./rsyslog.out.log" template="outfmt") +} diff --git a/tests/testsuites/rulesetmultiqueue-v6.conf b/tests/testsuites/rulesetmultiqueue-v6.conf new file mode 100644 index 0000000..3aeaa33 --- /dev/null +++ b/tests/testsuites/rulesetmultiqueue-v6.conf @@ -0,0 +1,34 @@ +# Test for multiple ruleset queues (see .sh file for details) +# rgerhards, 2009-10-30 +$IncludeConfig diag-common.conf +$ModLoad ../plugins/imtcp/.libs/imtcp +$MainMsgQueueTimeoutShutdown 10000 + +# general definition +$template outfmt,"%msg:F,58:2%\n" + +# create the individual rulesets +$template dynfile1,"rsyslog.out1.log" # trick to use relative path names! +ruleset(name="file1" queue.type="linkedList") { + :msg, contains, "msgnum:" ?dynfile1;outfmt +} + +$template dynfile2,"rsyslog.out2.log" # trick to use relative path names! +ruleset(name="file2" queue.type="linkedList") { + :msg, contains, "msgnum:" ?dynfile2;outfmt +} + +$template dynfile3,"rsyslog.out3.log" # trick to use relative path names! +ruleset(name="file3" queue.type="linkedList") { + :msg, contains, "msgnum:" ?dynfile3;outfmt +} + +# start listeners and bind them to rulesets +$InputTCPServerBindRuleset file1 +$InputTCPServerRun 13514 + +$InputTCPServerBindRuleset file2 +$InputTCPServerRun 13515 + +$InputTCPServerBindRuleset file3 +$InputTCPServerRun 13516 diff --git a/tests/testsuites/samples.parse-nodate b/tests/testsuites/samples.parse-nodate index 5432bca..720bdda 100644 --- a/tests/testsuites/samples.parse-nodate +++ b/tests/testsuites/samples.parse-nodate @@ -1,5 +1,5 @@ <27>xapi: [error|xen3|15|Guest liveness monitor D:bca30ab3f1c1|master_connection] Connection to master died. I will continue to retry indefinitely (supressing future logging of this message) -27,daemon,err,localhost.localdomain,xapi,xapi:, [error|xen3|15|Guest liveness monitor D:bca30ab3f1c1|master_connection] Connection to master died. I will continue to retry indefinitely (supressing future logging of this message) +27,daemon,err,~H,xapi,xapi:, [error|xen3|15|Guest liveness monitor D:bca30ab3f1c1|master_connection] Connection to master died. I will continue to retry indefinitely (supressing future logging of this message) # a message with just text (as permitted by rfc 3164) # it is questionable if the current sample result is really correct as of 3164! This is a message! diff --git a/tests/testsuites/samples.snare_ccoff_udp b/tests/testsuites/samples.snare_ccoff_udp index 1ae7e8b..3a7f5e5 100644 --- a/tests/testsuites/samples.snare_ccoff_udp +++ b/tests/testsuites/samples.snare_ccoff_udp @@ -3,12 +3,12 @@ # *real* cases (just mangled to anonymize them...) # Sample 1 - note the absence of PRI! windowsserver MSWinEventLog 1 Security 1167 Fri Mar 19 15:33:30 2010 540 Security SYSTEM User Success Audit WINDOWSSERVER Logon/Logoff Successful Network Logon: User Name: WINDOWSSERVER$ Domain: DOMX Logon ID: (0x0,0xF88396) Logon Type: 3 Logon Process: Kerberos Authentication Package: Kerberos Workstation Name: Logon GUID: {79b6eb79-7bcc-8a2e-7dad-953c51dc00fd} Caller User Name: - Caller Domain: - Caller Logon ID: - Caller Process ID: - Transited Services: - Source Network Address: 10.11.11.3 Source Port: 3306 733\n -13,user,notice,localhost.localdomain,windowsserver,windowsserver MSWinEventLog 1 Security 1167 Fri, Mar 19 15:33:30 2010 540 Security SYSTEM User Success Audit WINDOWSSERVER Logon/Logoff Successful Network Logon: User Name: WINDOWSSERVER$ Domain: DOMX Logon ID: (0x0,0xF88396) Logon Type: 3 Logon Process: Kerberos Authentication Package: Kerberos Workstation Name: Logon GUID: {79b6eb79-7bcc-8a2e-7dad-953c51dc00fd} Caller User Name: - Caller Domain: - Caller Logon ID: - Caller Process ID: - Transited Services: - Source Network Address: 10.11.11.3 Source Port: 3306 733 +13,user,notice,~H,windowsserver,windowsserver MSWinEventLog 1 Security 1167 Fri, Mar 19 15:33:30 2010 540 Security SYSTEM User Success Audit WINDOWSSERVER Logon/Logoff Successful Network Logon: User Name: WINDOWSSERVER$ Domain: DOMX Logon ID: (0x0,0xF88396) Logon Type: 3 Logon Process: Kerberos Authentication Package: Kerberos Workstation Name: Logon GUID: {79b6eb79-7bcc-8a2e-7dad-953c51dc00fd} Caller User Name: - Caller Domain: - Caller Logon ID: - Caller Process ID: - Transited Services: - Source Network Address: 10.11.11.3 Source Port: 3306 733 # Sample 2 # the samples below need to be disabled for the "workaround patch" for the message # parser to work. They need to be re-enabled once a final solution has been crafted #windowsserver MSWinEventLog 1 Security 1166 Fri Mar 19 15:33:30 2010 576 Security SYSTEM User Success Audit WINDOWSSERVER Logon/Logoff Special privileges assigned to new logon: User Name: WINDOWSSERVER$ Domain: DOMX Logon ID: (0x0,0xF88396) Privileges: SeSecurityPrivilege SeBackupPrivilege SeRestorePrivilege SeTakeOwnershipPrivilege SeDebugPrivilege SeSystemEnvironmentPrivilege SeLoadDriverPrivilege SeImpersonatePrivilege SeEnableDelegationPrivilege 732\n -#13,user,notice,localhost,windowsserver,windowsserver MSWinEventLog 1 Security 1166 Fri, Mar 19 15:33:30 2010 576 Security SYSTEM User Success Audit WINDOWSSERVER Logon/Logoff Special privileges assigned to new logon: User Name: WINDOWSSERVER$ Domain: DOMX Logon ID: (0x0,0xF88396) Privileges: SeSecurityPrivilege SeBackupPrivilege SeRestorePrivilege SeTakeOwnershipPrivilege SeDebugPrivilege SeSystemEnvironmentPrivilege SeLoadDriverPrivilege SeImpersonatePrivilege SeEnableDelegationPrivilege 732 +#13,user,notice,~H,windowsserver,windowsserver MSWinEventLog 1 Security 1166 Fri, Mar 19 15:33:30 2010 576 Security SYSTEM User Success Audit WINDOWSSERVER Logon/Logoff Special privileges assigned to new logon: User Name: WINDOWSSERVER$ Domain: DOMX Logon ID: (0x0,0xF88396) Privileges: SeSecurityPrivilege SeBackupPrivilege SeRestorePrivilege SeTakeOwnershipPrivilege SeDebugPrivilege SeSystemEnvironmentPrivilege SeLoadDriverPrivilege SeImpersonatePrivilege SeEnableDelegationPrivilege 732 # Sample 3 #windowsserver MSWinEventLog 1 Security 1165 Fri Mar 19 15:33:30 2010 538 Security SYSTEM User Success Audit WINDOWSSERVER Logon/Logoff User Logoff: User Name: WINDOWSSERVER$ Domain: DOMX Logon ID: (0x0,0xF8830B) Logon Type: 3 731\n -#13,user,notice,localhost,windowsserver,windowsserver MSWinEventLog 1 Security 1165 Fri, Mar 19 15:33:30 2010 538 Security SYSTEM User Success Audit WINDOWSSERVER Logon/Logoff User Logoff: User Name: WINDOWSSERVER$ Domain: DOMX Logon ID: (0x0,0xF8830B) Logon Type: 3 731 +#13,user,notice,~H,windowsserver,windowsserver MSWinEventLog 1 Security 1165 Fri, Mar 19 15:33:30 2010 538 Security SYSTEM User Success Audit WINDOWSSERVER Logon/Logoff User Logoff: User Name: WINDOWSSERVER$ Domain: DOMX Logon ID: (0x0,0xF8830B) Logon Type: 3 731 diff --git a/tests/testsuites/samples.snare_ccoff_udp2 b/tests/testsuites/samples.snare_ccoff_udp2 index da3a2b1..05233e7 100644 --- a/tests/testsuites/samples.snare_ccoff_udp2 +++ b/tests/testsuites/samples.snare_ccoff_udp2 @@ -14,13 +14,13 @@ test insert into windows (Message, Facility,FromHost, Priority, DeviceReportedTime, ReceivedAt, InfoUnitID, SysLogTag) values ('', 1, 'test',5, '20100321185328', '20100321185328', 1, '') # and yet another one we have seen in practice UX=Abcd-efg-hij-klmno; XXXXX=1111111111, Z123=192.12.231.245:11111, S1234=123456789, XXXXXX=111111111 -insert into windows (Message, Facility,FromHost, Priority, DeviceReportedTime, ReceivedAt, InfoUnitID, SysLogTag) values (' XXXXX=1111111111, Z123=192.12.231.245:11111, S1234=123456789, XXXXXX=111111111', 1, 'localhost.localdomain',5, '20100321185328', '20100321185328', 1, 'UX=Abcd-efg-hij-klmno;') +insert into windows (Message, Facility,FromHost, Priority, DeviceReportedTime, ReceivedAt, InfoUnitID, SysLogTag) values (' XXXXX=1111111111, Z123=192.12.231.245:11111, S1234=123456789, XXXXXX=111111111', 1, '~H',5, '20100321185328', '20100321185328', 1, 'UX=Abcd-efg-hij-klmno;') # Sample 1 - note the absence of PRI! windowsserver MSWinEventLog 1 Security 1167 Fri Mar 19 15:33:30 2010 540 Security SYSTEM User Success Audit WINDOWSSERVER Logon/Logoff Successful Network Logon: User Name: WINDOWSSERVER$ Domain: DOMX Logon ID: (0x0,0xF88396) Logon Type: 3 Logon Process: Kerberos Authentication Package: Kerberos Workstation Name: Logon GUID: {79b6eb79-7bcc-8a2e-7dad-953c51dc00fd} Caller User Name: - Caller Domain: - Caller Logon ID: - Caller Process ID: - Transited Services: - Source Network Address: 10.11.11.3 Source Port: 3306 733\n -insert into windows (Message, Facility,FromHost, Priority, DeviceReportedTime, ReceivedAt, InfoUnitID, SysLogTag) values (' Mar 19 15:33:30 2010 540 Security SYSTEM User Success Audit WINDOWSSERVER Logon/Logoff Successful Network Logon: User Name: WINDOWSSERVER$ Domain: DOMX Logon ID: (0x0,0xF88396) Logon Type: 3 Logon Process: Kerberos Authentication Package: Kerberos Workstation Name: Logon GUID: {79b6eb79-7bcc-8a2e-7dad-953c51dc00fd} Caller User Name: - Caller Domain: - Caller Logon ID: - Caller Process ID: - Transited Services: - Source Network Address: 10.11.11.3 Source Port: 3306 733', 1, 'localhost.localdomain',5, '20100321185328', '20100321185328', 1, 'windowsserver MSWinEventLog 1 Security 1167 Fri') +insert into windows (Message, Facility,FromHost, Priority, DeviceReportedTime, ReceivedAt, InfoUnitID, SysLogTag) values (' Mar 19 15:33:30 2010 540 Security SYSTEM User Success Audit WINDOWSSERVER Logon/Logoff Successful Network Logon: User Name: WINDOWSSERVER$ Domain: DOMX Logon ID: (0x0,0xF88396) Logon Type: 3 Logon Process: Kerberos Authentication Package: Kerberos Workstation Name: Logon GUID: {79b6eb79-7bcc-8a2e-7dad-953c51dc00fd} Caller User Name: - Caller Domain: - Caller Logon ID: - Caller Process ID: - Transited Services: - Source Network Address: 10.11.11.3 Source Port: 3306 733', 1, '~H',5, '20100321185328', '20100321185328', 1, 'windowsserver MSWinEventLog 1 Security 1167 Fri') # Sample 2 windowsserver MSWinEventLog 1 Security 1166 Fri Mar 19 15:33:30 2010 576 Security SYSTEM User Success Audit WINDOWSSERVER Logon/Logoff Special privileges assigned to new logon: User Name: WINDOWSSERVER$ Domain: DOMX Logon ID: (0x0,0xF88396) Privileges: SeSecurityPrivilege SeBackupPrivilege SeRestorePrivilege SeTakeOwnershipPrivilege SeDebugPrivilege SeSystemEnvironmentPrivilege SeLoadDriverPrivilege SeImpersonatePrivilege SeEnableDelegationPrivilege 732\n -insert into windows (Message, Facility,FromHost, Priority, DeviceReportedTime, ReceivedAt, InfoUnitID, SysLogTag) values (' Mar 19 15:33:30 2010 576 Security SYSTEM User Success Audit WINDOWSSERVER Logon/Logoff Special privileges assigned to new logon: User Name: WINDOWSSERVER$ Domain: DOMX Logon ID: (0x0,0xF88396) Privileges: SeSecurityPrivilege SeBackupPrivilege SeRestorePrivilege SeTakeOwnershipPrivilege SeDebugPrivilege SeSystemEnvironmentPrivilege SeLoadDriverPrivilege SeImpersonatePrivilege SeEnableDelegationPrivilege 732', 1, 'localhost.localdomain',5, '20100321185328', '20100321185328', 1, 'windowsserver MSWinEventLog 1 Security 1166 Fri') +insert into windows (Message, Facility,FromHost, Priority, DeviceReportedTime, ReceivedAt, InfoUnitID, SysLogTag) values (' Mar 19 15:33:30 2010 576 Security SYSTEM User Success Audit WINDOWSSERVER Logon/Logoff Special privileges assigned to new logon: User Name: WINDOWSSERVER$ Domain: DOMX Logon ID: (0x0,0xF88396) Privileges: SeSecurityPrivilege SeBackupPrivilege SeRestorePrivilege SeTakeOwnershipPrivilege SeDebugPrivilege SeSystemEnvironmentPrivilege SeLoadDriverPrivilege SeImpersonatePrivilege SeEnableDelegationPrivilege 732', 1, '~H',5, '20100321185328', '20100321185328', 1, 'windowsserver MSWinEventLog 1 Security 1166 Fri') # Sample 3 windowsserver MSWinEventLog 1 Security 1165 Fri Mar 19 15:33:30 2010 538 Security SYSTEM User Success Audit WINDOWSSERVER Logon/Logoff User Logoff: User Name: WINDOWSSERVER$ Domain: DOMX Logon ID: (0x0,0xF8830B) Logon Type: 3 731\n -insert into windows (Message, Facility,FromHost, Priority, DeviceReportedTime, ReceivedAt, InfoUnitID, SysLogTag) values (' Mar 19 15:33:30 2010 538 Security SYSTEM User Success Audit WINDOWSSERVER Logon/Logoff User Logoff: User Name: WINDOWSSERVER$ Domain: DOMX Logon ID: (0x0,0xF8830B) Logon Type: 3 731', 1, 'localhost.localdomain',5, '20100321185328', '20100321185328', 1, 'windowsserver MSWinEventLog 1 Security 1165 Fri') +insert into windows (Message, Facility,FromHost, Priority, DeviceReportedTime, ReceivedAt, InfoUnitID, SysLogTag) values (' Mar 19 15:33:30 2010 538 Security SYSTEM User Success Audit WINDOWSSERVER Logon/Logoff User Logoff: User Name: WINDOWSSERVER$ Domain: DOMX Logon ID: (0x0,0xF8830B) Logon Type: 3 731', 1, '~H',5, '20100321185328', '20100321185328', 1, 'windowsserver MSWinEventLog 1 Security 1165 Fri') diff --git a/tests/testsuites/sndrcv_relp_rcvr.conf b/tests/testsuites/sndrcv_relp_rcvr.conf new file mode 100644 index 0000000..d79f714 --- /dev/null +++ b/tests/testsuites/sndrcv_relp_rcvr.conf @@ -0,0 +1,9 @@ +# rgerhards, 2013-12-10 +$IncludeConfig diag-common.conf + +module(load="../plugins/imrelp/.libs/imrelp") +# then SENDER sends to this port (not tcpflood!) +input(type="imrelp" port="13515") + +$template outfmt,"%msg:F,58:2%\n" +:msg, contains, "msgnum:" action(type="omfile" file="rsyslog.out.log" template="outfmt") diff --git a/tests/testsuites/sndrcv_relp_sender.conf b/tests/testsuites/sndrcv_relp_sender.conf new file mode 100644 index 0000000..7706622 --- /dev/null +++ b/tests/testsuites/sndrcv_relp_sender.conf @@ -0,0 +1,8 @@ +# rgerhards, 2013-12-10 +$IncludeConfig diag-common2.conf + +module(load="../plugins/omrelp/.libs/omrelp") +module(load="../plugins/imptcp/.libs/imptcp") +input(type="imptcp" port="13514") /* this port for tcpflood! */ + +action(type="omrelp" protocol="tcp" target="127.0.0.1" port="13515") diff --git a/tests/testsuites/stop-localvar.conf b/tests/testsuites/stop-localvar.conf new file mode 100644 index 0000000..63df650 --- /dev/null +++ b/tests/testsuites/stop-localvar.conf @@ -0,0 +1,21 @@ +/* note: variables are strings (at least in v7), so we need to convert + * to a number when we check the conditon. + * Even if we change the variable representation at some later point, + * we should NOT change this test here, but better add a new one. + * rgerhards, 2013-11-19 + */ +$IncludeConfig diag-common.conf +template(name="outfmt" type="string" string="%$.nbr%\n") + +module(load="../plugins/imtcp/.libs/imtcp") +input(type="imtcp" port="13514") + +if $msg contains "msgnum:" then { + set $.nbr = field($msg, 58, 2); + if cnum($.nbr) < 100 then + stop + /* check is intentionally more complex than needed! */ + else if not (cnum($.nbr) > 999) then { + action(type="omfile" file="rsyslog.out.log" template="outfmt") + } +} diff --git a/tests/testsuites/stop-msgvar.conf b/tests/testsuites/stop-msgvar.conf new file mode 100644 index 0000000..020ebd8 --- /dev/null +++ b/tests/testsuites/stop-msgvar.conf @@ -0,0 +1,21 @@ +/* note: variables are strings (at least in v7), so we need to convert + * to a number when we check the conditon. + * Even if we change the variable representation at some later point, + * we should NOT change this test here, but better add a new one. + * rgerhards, 2013-11-19 + */ +$IncludeConfig diag-common.conf +template(name="outfmt" type="string" string="%$!nbr%\n") + +module(load="../plugins/imtcp/.libs/imtcp") +input(type="imtcp" port="13514") + +if $msg contains "msgnum:" then { + set $!nbr = field($msg, 58, 2); + if cnum($!nbr) < 100 then + stop + /* check is intentionally more complex than needed! */ + else if not (cnum($!nbr) > 999) then { + action(type="omfile" file="rsyslog.out.log" template="outfmt") + } +} diff --git a/tests/testsuites/stop.conf b/tests/testsuites/stop.conf new file mode 100644 index 0000000..84beab8 --- /dev/null +++ b/tests/testsuites/stop.conf @@ -0,0 +1,11 @@ +$IncludeConfig diag-common.conf + +module(load="../plugins/imtcp/.libs/imtcp") +input(type="imtcp" port="13514") + +if $msg contains "00000001" then + stop + +template(name="outfmt" type="string" string="%msg:F,58:2%\n") +if $msg contains "msgnum:" then + action(type="omfile" file="rsyslog.out.log" template="outfmt") diff --git a/tests/testsuites/weird.parse1 b/tests/testsuites/weird.parse1 index 907198a..c24d983 100644 --- a/tests/testsuites/weird.parse1 +++ b/tests/testsuites/weird.parse1 @@ -11,10 +11,10 @@ 14,user,info,Aug 30 23:00:05,X4711,,, # there is a SP at the end of the line <14>Aug 30 23:00:05 -14,user,info,Aug 30 23:00:05,localhost.localdomain,,, +14,user,info,Aug 30 23:00:05,~H,,, # and here is no SP at the end of the line <14>Aug 30 23:00:05 -14,user,info,Aug 30 23:00:05,localhost.localdomain,,, +14,user,info,Aug 30 23:00:05,~H,,, # unfortunately, I can not test missing dates with this test suite, because # we would have the current date in the response, which we can not check against # @@ -31,7 +31,7 @@ 14,user,info,Aug 30 23:00:05,X4711,,, # there is a SP at the end of the line <14>2010-08-30T23:00:05Z -14,user,info,Aug 30 23:00:05,localhost.localdomain,,, +14,user,info,Aug 30 23:00:05,~H,,, # and here is no SP at the end of the line <14>2010-08-30T23:00:05Z -14,user,info,Aug 30 23:00:05,localhost.localdomain,,, +14,user,info,Aug 30 23:00:05,~H,,, diff --git a/tests/timestamp.sh b/tests/timestamp.sh index 71416c3..e18a98b 100755 --- a/tests/timestamp.sh +++ b/tests/timestamp.sh @@ -1,5 +1,6 @@ echo \[timestamp.sh\]: various timestamp tests source $srcdir/diag.sh init +source $srcdir/diag.sh generate-HOSTNAME source $srcdir/diag.sh nettester ts3164 udp source $srcdir/diag.sh nettester ts3164 tcp source $srcdir/diag.sh nettester ts3339 udp diff --git a/tests/validation-run.sh b/tests/validation-run.sh index a68ee8a..2250e12 100755 --- a/tests/validation-run.sh +++ b/tests/validation-run.sh @@ -23,19 +23,19 @@ #set -x echo \[validation-run.sh\]: testing configuraton validation echo "testing a failed configuration verification run" -../tools/rsyslogd -dn -u2 -c4 -N1 -f$srcdir/testsuites/invalid.conf -M../runtime/.libs:../.libs +../tools/rsyslogd -u2 -N1 -f$srcdir/testsuites/invalid.conf -M../runtime/.libs:../.libs if [ $? -ne 1 ]; then echo "after test 1: return code ne 1" exit 1 fi echo testing a valid config verification run -../tools/rsyslogd -u2 -c4 -N1 -f$srcdir/testsuites/valid.conf -M../runtime/.libs:../.libs +../tools/rsyslogd -u2 -N1 -f$srcdir/testsuites/valid.conf -M../runtime/.libs:../.libs if [ $? -ne 0 ]; then echo "after test 2: return code ne 0" exit 1 fi echo testing empty config file -../tools/rsyslogd -u2 -c4 -N1 -f/dev/null -M../runtime/.libs:../.libs +../tools/rsyslogd -u2 -N1 -f/dev/null -M../runtime/.libs:../.libs if [ $? -ne 1 ]; then echo "after test 3: return code ne 1" exit 1 |