Imported Upstream version 1.07
This commit is contained in:
parent
87e0216b00
commit
a8f50c0a7c
53 changed files with 15751 additions and 0 deletions
9
tests/01.pod.t
Executable file
9
tests/01.pod.t
Executable file
|
@ -0,0 +1,9 @@
|
|||
#!/usr/bin/perl -w -T -*- Perl -*-
|
||||
# $Id: 01.pod.t.in,v 1.1 2006/03/09 17:37:31 rockyb Exp $
|
||||
my $top_builddir = $ENV{top_builddir} ? $ENV{top_builddir} : '..';
|
||||
|
||||
use Test::More;
|
||||
use File::Spec::Functions;
|
||||
eval "use Test::Pod 1.14";
|
||||
plan skip_all => "Test::Pod 1.14 required for testing POD" if $@;
|
||||
all_pod_files_ok(catfile($top_builddir, "ps-watcher"));
|
9
tests/01.pod.t.in
Normal file
9
tests/01.pod.t.in
Normal file
|
@ -0,0 +1,9 @@
|
|||
#!@PERL@ -w -T -*- Perl -*-
|
||||
# $Id: 01.pod.t.in,v 1.1 2006/03/09 17:37:31 rockyb Exp $
|
||||
my $top_builddir = $ENV{top_builddir} ? $ENV{top_builddir} : '..';
|
||||
|
||||
use Test::More;
|
||||
use File::Spec::Functions;
|
||||
eval "use Test::Pod 1.14";
|
||||
plan skip_all => "Test::Pod 1.14 required for testing POD" if $@;
|
||||
all_pod_files_ok(catfile($top_builddir, "@PACKAGE@"));
|
38
tests/Makefile.am
Normal file
38
tests/Makefile.am
Normal file
|
@ -0,0 +1,38 @@
|
|||
##############################################################################
|
||||
# $Id: Makefile.am,v 1.9 2006/03/09 17:37:31 rockyb Exp $
|
||||
# Copyright (C) 2003, 2004, 2006 Rocky Bernstein <rocky@cpan.org>
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation; either version 2 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
##############################################################################
|
||||
|
||||
MOSTLYCLEANFILES = *~
|
||||
|
||||
# The keeps automake from substituting PS_VARS
|
||||
PS_VARS = ''
|
||||
|
||||
check_SCRIPTS = 01.pod.t args.t basic.t count.t full.t paction.t
|
||||
|
||||
check_DATA = args.cnf basic.cnf \
|
||||
count.cnf full.cnf paction.cnf
|
||||
|
||||
EXTRA_DIST = $(check_SCRIPTS) $(check_DATA) \
|
||||
01.pod.t.in args.t.in basic.cnf.in count.t.in driver
|
||||
|
||||
all:
|
||||
|
||||
check: test
|
||||
|
||||
test:
|
||||
srcdir=$(srcdir); export srcdir; \
|
||||
$(PERL) $(srcdir)/driver
|
351
tests/Makefile.in
Normal file
351
tests/Makefile.in
Normal file
|
@ -0,0 +1,351 @@
|
|||
# Makefile.in generated by automake 1.10.1 from Makefile.am.
|
||||
# @configure_input@
|
||||
|
||||
# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
|
||||
# 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
|
||||
# This Makefile.in is free software; the Free Software Foundation
|
||||
# gives unlimited permission to copy and/or distribute it,
|
||||
# with or without modifications, as long as this notice is preserved.
|
||||
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
|
||||
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
|
||||
# PARTICULAR PURPOSE.
|
||||
|
||||
@SET_MAKE@
|
||||
|
||||
##############################################################################
|
||||
# $Id: Makefile.am,v 1.9 2006/03/09 17:37:31 rockyb Exp $
|
||||
# Copyright (C) 2003, 2004, 2006 Rocky Bernstein <rocky@cpan.org>
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation; either version 2 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
##############################################################################
|
||||
VPATH = @srcdir@
|
||||
pkgdatadir = $(datadir)/@PACKAGE@
|
||||
pkglibdir = $(libdir)/@PACKAGE@
|
||||
pkgincludedir = $(includedir)/@PACKAGE@
|
||||
am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
|
||||
install_sh_DATA = $(install_sh) -c -m 644
|
||||
install_sh_PROGRAM = $(install_sh) -c
|
||||
install_sh_SCRIPT = $(install_sh) -c
|
||||
INSTALL_HEADER = $(INSTALL_DATA)
|
||||
transform = $(program_transform_name)
|
||||
NORMAL_INSTALL = :
|
||||
PRE_INSTALL = :
|
||||
POST_INSTALL = :
|
||||
NORMAL_UNINSTALL = :
|
||||
PRE_UNINSTALL = :
|
||||
POST_UNINSTALL = :
|
||||
build_triplet = @build@
|
||||
host_triplet = @host@
|
||||
subdir = tests
|
||||
DIST_COMMON = $(srcdir)/01.pod.t.in $(srcdir)/Makefile.am \
|
||||
$(srcdir)/Makefile.in $(srcdir)/args.t.in \
|
||||
$(srcdir)/basic.cnf.in $(srcdir)/basic.t.in \
|
||||
$(srcdir)/count.t.in $(srcdir)/full.t.in
|
||||
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
|
||||
am__aclocal_m4_deps = $(top_srcdir)/configure.ac
|
||||
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
|
||||
$(ACLOCAL_M4)
|
||||
mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
|
||||
CONFIG_CLEAN_FILES = 01.pod.t args.t basic.t count.t full.t basic.cnf
|
||||
SOURCES =
|
||||
DIST_SOURCES =
|
||||
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
|
||||
ACLOCAL = @ACLOCAL@
|
||||
AMTAR = @AMTAR@
|
||||
AUTOCONF = @AUTOCONF@
|
||||
AUTOHEADER = @AUTOHEADER@
|
||||
AUTOMAKE = @AUTOMAKE@
|
||||
AWK = @AWK@
|
||||
CVS2CL = @CVS2CL@
|
||||
CYGPATH_W = @CYGPATH_W@
|
||||
DEFS = @DEFS@
|
||||
ECHO_C = @ECHO_C@
|
||||
ECHO_N = @ECHO_N@
|
||||
ECHO_T = @ECHO_T@
|
||||
INSTALL = @INSTALL@
|
||||
INSTALL_DATA = @INSTALL_DATA@
|
||||
INSTALL_PROGRAM = @INSTALL_PROGRAM@
|
||||
INSTALL_SCRIPT = @INSTALL_SCRIPT@
|
||||
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
|
||||
LIBOBJS = @LIBOBJS@
|
||||
LIBS = @LIBS@
|
||||
LN_S = @LN_S@
|
||||
LTLIBOBJS = @LTLIBOBJS@
|
||||
MAINT = @MAINT@
|
||||
MAKEINFO = @MAKEINFO@
|
||||
MKDIR_P = @MKDIR_P@
|
||||
PACKAGE = @PACKAGE@
|
||||
PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
|
||||
PACKAGE_NAME = @PACKAGE_NAME@
|
||||
PACKAGE_STRING = @PACKAGE_STRING@
|
||||
PACKAGE_TARNAME = @PACKAGE_TARNAME@
|
||||
PACKAGE_VERSION = @PACKAGE_VERSION@
|
||||
PATH_SEPARATOR = @PATH_SEPARATOR@
|
||||
PERL = @PERL@
|
||||
PS = @PS@
|
||||
PS_ARGS = @PS_ARGS@
|
||||
PS_ARGS_FMT = @PS_ARGS_FMT@
|
||||
PS_CAN_RETURN_MULTIPLE_LINES = @PS_CAN_RETURN_MULTIPLE_LINES@
|
||||
PS_CUSTOM_HEADER = @PS_CUSTOM_HEADER@
|
||||
PS_FULLCMD_FMT = @PS_FULLCMD_FMT@
|
||||
PS_NO_NULL_HEADER = @PS_NO_NULL_HEADER@
|
||||
PS_PID_OPTS = @PS_PID_OPTS@
|
||||
PS_TIME_VAR = @PS_TIME_VAR@
|
||||
|
||||
# The keeps automake from substituting PS_VARS
|
||||
PS_VARS = ''
|
||||
SET_MAKE = @SET_MAKE@
|
||||
SHELL = @SHELL@
|
||||
STRIP = @STRIP@
|
||||
VERSION = @VERSION@
|
||||
abs_builddir = @abs_builddir@
|
||||
abs_srcdir = @abs_srcdir@
|
||||
abs_top_builddir = @abs_top_builddir@
|
||||
abs_top_srcdir = @abs_top_srcdir@
|
||||
am__leading_dot = @am__leading_dot@
|
||||
am__tar = @am__tar@
|
||||
am__untar = @am__untar@
|
||||
bindir = @bindir@
|
||||
build = @build@
|
||||
build_alias = @build_alias@
|
||||
build_cpu = @build_cpu@
|
||||
build_os = @build_os@
|
||||
build_vendor = @build_vendor@
|
||||
builddir = @builddir@
|
||||
datadir = @datadir@
|
||||
datarootdir = @datarootdir@
|
||||
docdir = @docdir@
|
||||
dvidir = @dvidir@
|
||||
exec_prefix = @exec_prefix@
|
||||
host = @host@
|
||||
host_alias = @host_alias@
|
||||
host_cpu = @host_cpu@
|
||||
host_os = @host_os@
|
||||
host_vendor = @host_vendor@
|
||||
htmldir = @htmldir@
|
||||
includedir = @includedir@
|
||||
infodir = @infodir@
|
||||
install_sh = @install_sh@
|
||||
libdir = @libdir@
|
||||
libexecdir = @libexecdir@
|
||||
localedir = @localedir@
|
||||
localstatedir = @localstatedir@
|
||||
mandir = @mandir@
|
||||
mkdir_p = @mkdir_p@
|
||||
oldincludedir = @oldincludedir@
|
||||
pdfdir = @pdfdir@
|
||||
prefix = @prefix@
|
||||
program_transform_name = @program_transform_name@
|
||||
psdir = @psdir@
|
||||
sbindir = @sbindir@
|
||||
sharedstatedir = @sharedstatedir@
|
||||
srcdir = @srcdir@
|
||||
sysconfdir = @sysconfdir@
|
||||
target_alias = @target_alias@
|
||||
top_builddir = @top_builddir@
|
||||
top_srcdir = @top_srcdir@
|
||||
MOSTLYCLEANFILES = *~
|
||||
check_SCRIPTS = 01.pod.t args.t basic.t count.t full.t paction.t
|
||||
check_DATA = args.cnf basic.cnf \
|
||||
count.cnf full.cnf paction.cnf
|
||||
|
||||
EXTRA_DIST = $(check_SCRIPTS) $(check_DATA) \
|
||||
01.pod.t.in args.t.in basic.cnf.in count.t.in driver
|
||||
|
||||
all: all-am
|
||||
|
||||
.SUFFIXES:
|
||||
$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps)
|
||||
@for dep in $?; do \
|
||||
case '$(am__configure_deps)' in \
|
||||
*$$dep*) \
|
||||
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
|
||||
&& exit 0; \
|
||||
exit 1;; \
|
||||
esac; \
|
||||
done; \
|
||||
echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu tests/Makefile'; \
|
||||
cd $(top_srcdir) && \
|
||||
$(AUTOMAKE) --gnu tests/Makefile
|
||||
.PRECIOUS: Makefile
|
||||
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
|
||||
@case '$?' in \
|
||||
*config.status*) \
|
||||
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
|
||||
*) \
|
||||
echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
|
||||
cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
|
||||
esac;
|
||||
|
||||
$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
|
||||
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
|
||||
|
||||
$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
|
||||
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
|
||||
$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
|
||||
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
|
||||
01.pod.t: $(top_builddir)/config.status $(srcdir)/01.pod.t.in
|
||||
cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@
|
||||
args.t: $(top_builddir)/config.status $(srcdir)/args.t.in
|
||||
cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@
|
||||
basic.t: $(top_builddir)/config.status $(srcdir)/basic.t.in
|
||||
cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@
|
||||
count.t: $(top_builddir)/config.status $(srcdir)/count.t.in
|
||||
cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@
|
||||
full.t: $(top_builddir)/config.status $(srcdir)/full.t.in
|
||||
cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@
|
||||
basic.cnf: $(top_builddir)/config.status $(srcdir)/basic.cnf.in
|
||||
cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@
|
||||
tags: TAGS
|
||||
TAGS:
|
||||
|
||||
ctags: CTAGS
|
||||
CTAGS:
|
||||
|
||||
|
||||
distdir: $(DISTFILES)
|
||||
@srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
|
||||
topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
|
||||
list='$(DISTFILES)'; \
|
||||
dist_files=`for file in $$list; do echo $$file; done | \
|
||||
sed -e "s|^$$srcdirstrip/||;t" \
|
||||
-e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
|
||||
case $$dist_files in \
|
||||
*/*) $(MKDIR_P) `echo "$$dist_files" | \
|
||||
sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
|
||||
sort -u` ;; \
|
||||
esac; \
|
||||
for file in $$dist_files; do \
|
||||
if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
|
||||
if test -d $$d/$$file; then \
|
||||
dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
|
||||
if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
|
||||
cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
|
||||
fi; \
|
||||
cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
|
||||
else \
|
||||
test -f $(distdir)/$$file \
|
||||
|| cp -p $$d/$$file $(distdir)/$$file \
|
||||
|| exit 1; \
|
||||
fi; \
|
||||
done
|
||||
check-am: all-am
|
||||
$(MAKE) $(AM_MAKEFLAGS) $(check_SCRIPTS) $(check_DATA)
|
||||
check: check-am
|
||||
all-am: Makefile
|
||||
installdirs:
|
||||
install: install-am
|
||||
install-exec: install-exec-am
|
||||
install-data: install-data-am
|
||||
uninstall: uninstall-am
|
||||
|
||||
install-am: all-am
|
||||
@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
|
||||
|
||||
installcheck: installcheck-am
|
||||
install-strip:
|
||||
$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
|
||||
install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
|
||||
`test -z '$(STRIP)' || \
|
||||
echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
|
||||
mostlyclean-generic:
|
||||
-test -z "$(MOSTLYCLEANFILES)" || rm -f $(MOSTLYCLEANFILES)
|
||||
|
||||
clean-generic:
|
||||
|
||||
distclean-generic:
|
||||
-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
|
||||
|
||||
maintainer-clean-generic:
|
||||
@echo "This command is intended for maintainers to use"
|
||||
@echo "it deletes files that may require special tools to rebuild."
|
||||
clean: clean-am
|
||||
|
||||
clean-am: clean-generic mostlyclean-am
|
||||
|
||||
distclean: distclean-am
|
||||
-rm -f Makefile
|
||||
distclean-am: clean-am distclean-generic
|
||||
|
||||
dvi: dvi-am
|
||||
|
||||
dvi-am:
|
||||
|
||||
html: html-am
|
||||
|
||||
info: info-am
|
||||
|
||||
info-am:
|
||||
|
||||
install-data-am:
|
||||
|
||||
install-dvi: install-dvi-am
|
||||
|
||||
install-exec-am:
|
||||
|
||||
install-html: install-html-am
|
||||
|
||||
install-info: install-info-am
|
||||
|
||||
install-man:
|
||||
|
||||
install-pdf: install-pdf-am
|
||||
|
||||
install-ps: install-ps-am
|
||||
|
||||
installcheck-am:
|
||||
|
||||
maintainer-clean: maintainer-clean-am
|
||||
-rm -f Makefile
|
||||
maintainer-clean-am: distclean-am maintainer-clean-generic
|
||||
|
||||
mostlyclean: mostlyclean-am
|
||||
|
||||
mostlyclean-am: mostlyclean-generic
|
||||
|
||||
pdf: pdf-am
|
||||
|
||||
pdf-am:
|
||||
|
||||
ps: ps-am
|
||||
|
||||
ps-am:
|
||||
|
||||
uninstall-am:
|
||||
|
||||
.MAKE: install-am install-strip
|
||||
|
||||
.PHONY: all all-am check check-am clean clean-generic distclean \
|
||||
distclean-generic distdir dvi dvi-am html html-am info info-am \
|
||||
install install-am install-data install-data-am install-dvi \
|
||||
install-dvi-am install-exec install-exec-am install-html \
|
||||
install-html-am install-info install-info-am install-man \
|
||||
install-pdf install-pdf-am install-ps install-ps-am \
|
||||
install-strip installcheck installcheck-am installdirs \
|
||||
maintainer-clean maintainer-clean-generic mostlyclean \
|
||||
mostlyclean-generic pdf pdf-am ps ps-am uninstall uninstall-am
|
||||
|
||||
|
||||
all:
|
||||
|
||||
check: test
|
||||
|
||||
test:
|
||||
srcdir=$(srcdir); export srcdir; \
|
||||
$(PERL) $(srcdir)/driver
|
||||
# Tell versions [3.59,3.63) of GNU make to not export all variables.
|
||||
# Otherwise a system limit (for SysV at least) may be exceeded.
|
||||
.NOEXPORT:
|
13
tests/args.cnf
Normal file
13
tests/args.cnf
Normal file
|
@ -0,0 +1,13 @@
|
|||
# Scripts on some OS's don't show as the script name as the command name.
|
||||
# Rather the name of the interpreter is listed (e.g. bash or perl)
|
||||
# Here's how you can match against a script.
|
||||
# Look for my processes: ps-watcher.
|
||||
[perl]
|
||||
trigger = \$args =~ /ps-watcher --log/
|
||||
action = echo "ok 1"
|
||||
occurs = every
|
||||
# On BSD/OS the name of the script rather than the interpreter is show.
|
||||
[ps-watcher]
|
||||
trigger = \$args =~ /ps-watcher --log/
|
||||
action = echo "ok 1"
|
||||
occurs = every
|
38
tests/args.t
Executable file
38
tests/args.t
Executable file
|
@ -0,0 +1,38 @@
|
|||
#!/usr/bin/perl -w
|
||||
# $Id: args.t.in,v 1.8 2006/03/10 13:12:36 rockyb Exp $
|
||||
# Arg checks
|
||||
use strict;
|
||||
use Test::More;
|
||||
use Config;
|
||||
|
||||
if ('cygwin' eq $Config{osname}) {
|
||||
plan( skip_all => "cygwin's ps is not powerful enough this test");
|
||||
exit 0;
|
||||
}
|
||||
|
||||
plan( tests => 2);
|
||||
|
||||
my $test='args';
|
||||
|
||||
my $srcdir = $ENV{srcdir} ? $ENV{srcdir} : '.';
|
||||
my $cmd = "/usr/bin/perl ../ps-watcher --log --nosyslog --nodaemon "
|
||||
. " --sleep -1 --config ${srcdir}/$test.cnf";
|
||||
my @output = `$cmd 2>&1`;
|
||||
|
||||
# First line is Id line. This doesn't count in testing.
|
||||
shift @output;
|
||||
|
||||
my $count=0;
|
||||
foreach (@output) {
|
||||
if (/^.+:\s+.*ok/) {
|
||||
s/.+:\s+//;
|
||||
ok(1, "Saw first matching process");
|
||||
$count++;
|
||||
last;
|
||||
}
|
||||
}
|
||||
ok($count>0, "Saw more than one matching process");
|
||||
|
||||
#;;; Local Variables: ***
|
||||
#;;; mode:perl ***
|
||||
#;;; End: ***
|
38
tests/args.t.in
Normal file
38
tests/args.t.in
Normal file
|
@ -0,0 +1,38 @@
|
|||
#!@PERL@ -w
|
||||
# $Id: args.t.in,v 1.8 2006/03/10 13:12:36 rockyb Exp $
|
||||
# Arg checks
|
||||
use strict;
|
||||
use Test::More;
|
||||
use Config;
|
||||
|
||||
if ('cygwin' eq $Config{osname}) {
|
||||
plan( skip_all => "cygwin's ps is not powerful enough this test");
|
||||
exit 0;
|
||||
}
|
||||
|
||||
plan( tests => 2);
|
||||
|
||||
my $test='args';
|
||||
|
||||
my $srcdir = $ENV{srcdir} ? $ENV{srcdir} : '.';
|
||||
my $cmd = "@PERL@ ../ps-watcher --log --nosyslog --nodaemon "
|
||||
. " --sleep -1 --config ${srcdir}/$test.cnf";
|
||||
my @output = `$cmd 2>&1`;
|
||||
|
||||
# First line is Id line. This doesn't count in testing.
|
||||
shift @output;
|
||||
|
||||
my $count=0;
|
||||
foreach (@output) {
|
||||
if (/^.+:\s+.*ok/) {
|
||||
s/.+:\s+//;
|
||||
ok(1, "Saw first matching process");
|
||||
$count++;
|
||||
last;
|
||||
}
|
||||
}
|
||||
ok($count>0, "Saw more than one matching process");
|
||||
|
||||
#;;; Local Variables: ***
|
||||
#;;; mode:perl ***
|
||||
#;;; End: ***
|
27
tests/basic.cnf
Normal file
27
tests/basic.cnf
Normal file
|
@ -0,0 +1,27 @@
|
|||
# $Id: basic.cnf.in,v 1.4 2005/04/04 23:50:58 rockyb Exp $
|
||||
# We gotta have at least two processes running. Like the OS
|
||||
# and the ps-watcher program
|
||||
[.]
|
||||
trigger = $count > 1
|
||||
action = echo "ok 1"
|
||||
occurs = first
|
||||
|
||||
# Look for my processes
|
||||
[perl]
|
||||
action = echo "ok 2" || echo "$ps_pat"
|
||||
|
||||
[.?]
|
||||
trigger = elapsed2secs('$etime') >= 0
|
||||
action = echo "ok 3"
|
||||
occurs = first
|
||||
|
||||
# I'm assuming there is no process with just a single space.
|
||||
[^ $]
|
||||
action = echo "ok 4"
|
||||
occurs = none
|
||||
|
||||
# Test to see if first-trigger works.
|
||||
[.*]
|
||||
trigger = $pid == $$
|
||||
action = echo "ok 5"
|
||||
occurs = first-trigger
|
27
tests/basic.cnf.in
Normal file
27
tests/basic.cnf.in
Normal file
|
@ -0,0 +1,27 @@
|
|||
# $Id: basic.cnf.in,v 1.4 2005/04/04 23:50:58 rockyb Exp $
|
||||
# We gotta have at least two processes running. Like the OS
|
||||
# and the ps-watcher program
|
||||
[.]
|
||||
trigger = $count > 1
|
||||
action = echo "ok 1"
|
||||
occurs = first
|
||||
|
||||
# Look for my processes
|
||||
[perl]
|
||||
action = echo "ok 2" || echo "$ps_pat"
|
||||
|
||||
[.?]
|
||||
trigger = elapsed2secs('$@PS_TIME_VAR@') >= 0
|
||||
action = echo "ok 3"
|
||||
occurs = first
|
||||
|
||||
# I'm assuming there is no process with just a single space.
|
||||
[^ $]
|
||||
action = echo "ok 4"
|
||||
occurs = none
|
||||
|
||||
# Test to see if first-trigger works.
|
||||
[.*]
|
||||
trigger = $pid == $$
|
||||
action = echo "ok 5"
|
||||
occurs = first-trigger
|
32
tests/basic.t
Executable file
32
tests/basic.t
Executable file
|
@ -0,0 +1,32 @@
|
|||
#!/usr/bin/perl -w
|
||||
# $Id: basic.t.in,v 1.8 2006/03/10 19:07:06 rockyb Exp $
|
||||
# Some basic checks
|
||||
use strict;
|
||||
use Test::More;
|
||||
|
||||
if ( 'etime' ) {
|
||||
plan( tests => 5);
|
||||
} else {
|
||||
plan( tests => 4 );
|
||||
}
|
||||
|
||||
my $test='basic';
|
||||
my $cmd = "/usr/bin/perl ../ps-watcher --log --nosyslog --nodaemon "
|
||||
. "--sleep -1 --config $test.cnf";
|
||||
my @output = `$cmd 2>&1`;
|
||||
|
||||
# First line is Id line. This doesn't count in testing.
|
||||
shift @output;
|
||||
|
||||
my $i=1;
|
||||
foreach (@output) {
|
||||
s/.+:\s+//;
|
||||
$i++ if (!'etime' && $i==3);
|
||||
my $result = sprintf "ok %d", $i;
|
||||
$i++;
|
||||
ok($_ =~ m{$result});
|
||||
}
|
||||
|
||||
#;;; Local Variables: ***
|
||||
#;;; mode:perl ***
|
||||
#;;; End: ***
|
32
tests/basic.t.in
Executable file
32
tests/basic.t.in
Executable file
|
@ -0,0 +1,32 @@
|
|||
#!@PERL@ -w
|
||||
# $Id: basic.t.in,v 1.8 2006/03/10 19:07:06 rockyb Exp $
|
||||
# Some basic checks
|
||||
use strict;
|
||||
use Test::More;
|
||||
|
||||
if ( '@PS_TIME_VAR@' ) {
|
||||
plan( tests => 5);
|
||||
} else {
|
||||
plan( tests => 4 );
|
||||
}
|
||||
|
||||
my $test='basic';
|
||||
my $cmd = "@PERL@ ../ps-watcher --log --nosyslog --nodaemon "
|
||||
. "--sleep -1 --config $test.cnf";
|
||||
my @output = `$cmd 2>&1`;
|
||||
|
||||
# First line is Id line. This doesn't count in testing.
|
||||
shift @output;
|
||||
|
||||
my $i=1;
|
||||
foreach (@output) {
|
||||
s/.+:\s+//;
|
||||
$i++ if (!'@PS_TIME_VAR@' && $i==3);
|
||||
my $result = sprintf "ok %d", $i;
|
||||
$i++;
|
||||
ok($_ =~ m{$result});
|
||||
}
|
||||
|
||||
#;;; Local Variables: ***
|
||||
#;;; mode:perl ***
|
||||
#;;; End: ***
|
12
tests/count.cnf
Normal file
12
tests/count.cnf
Normal file
|
@ -0,0 +1,12 @@
|
|||
# $Id: count.cnf,v 1.1 2002/02/06 04:10:54 rocky Exp $
|
||||
# Test of count and none parameters
|
||||
|
||||
# I'm assuming there can't be a processes with $ in the name
|
||||
[fuxaduxa$]
|
||||
occurs = none
|
||||
action = echo "ok 1"
|
||||
|
||||
# Look for my processes so there should be at least one.
|
||||
[perl]
|
||||
occurs = none
|
||||
action = echo "not ok 2"
|
24
tests/count.t
Executable file
24
tests/count.t
Executable file
|
@ -0,0 +1,24 @@
|
|||
#!/usr/bin/perl -w
|
||||
# $Id: count.t.in,v 1.5 2006/03/10 13:12:36 rockyb Exp $
|
||||
# Some count checks
|
||||
use strict;
|
||||
|
||||
my $test='count';
|
||||
print "1..2\n";
|
||||
|
||||
my $srcdir = $ENV{srcdir} ? $ENV{srcdir} : '.';
|
||||
my @output = `/usr/bin/perl ../ps-watcher --log --sleep -1 --nodaemon --config ${srcdir}/$test.cnf 2>&1`;
|
||||
|
||||
# First line is Id line. This doesn't count in testing.
|
||||
shift @output;
|
||||
|
||||
my $count = @output;
|
||||
foreach (@output) {
|
||||
s/.+:\s+//;
|
||||
print $_;
|
||||
}
|
||||
print "ok 2\n" unless $count == 2;
|
||||
|
||||
#;;; Local Variables: ***
|
||||
#;;; mode:perl ***
|
||||
#;;; End: ***
|
24
tests/count.t.in
Normal file
24
tests/count.t.in
Normal file
|
@ -0,0 +1,24 @@
|
|||
#!@PERL@ -w
|
||||
# $Id: count.t.in,v 1.5 2006/03/10 13:12:36 rockyb Exp $
|
||||
# Some count checks
|
||||
use strict;
|
||||
|
||||
my $test='count';
|
||||
print "1..2\n";
|
||||
|
||||
my $srcdir = $ENV{srcdir} ? $ENV{srcdir} : '.';
|
||||
my @output = `@PERL@ ../ps-watcher --log --sleep -1 --nodaemon --config ${srcdir}/$test.cnf 2>&1`;
|
||||
|
||||
# First line is Id line. This doesn't count in testing.
|
||||
shift @output;
|
||||
|
||||
my $count = @output;
|
||||
foreach (@output) {
|
||||
s/.+:\s+//;
|
||||
print $_;
|
||||
}
|
||||
print "ok 2\n" unless $count == 2;
|
||||
|
||||
#;;; Local Variables: ***
|
||||
#;;; mode:perl ***
|
||||
#;;; End: ***
|
48
tests/driver
Executable file
48
tests/driver
Executable file
|
@ -0,0 +1,48 @@
|
|||
#!/usr/bin/perl -w
|
||||
#$Id: driver,v 1.1 2000/03/27 01:53:24 rocky Exp $
|
||||
use strict;
|
||||
|
||||
use File::Basename;
|
||||
my $program = basename($0); # Who am I today, anyway?
|
||||
|
||||
sub usage {
|
||||
print "
|
||||
usage:
|
||||
|
||||
$program [test1 ... ]
|
||||
$program --help
|
||||
|
||||
Runs regresion tests (via Test::Harness).
|
||||
|
||||
If no tests are specified all tests that match *.t in the
|
||||
test directory are run.
|
||||
|
||||
$program --help prints this help.
|
||||
";
|
||||
|
||||
exit 100;
|
||||
}
|
||||
|
||||
use Test::Harness qw(&runtests $verbose);
|
||||
|
||||
my $setup = 0;
|
||||
process_options();
|
||||
|
||||
@ARGV = glob("*.t") if !@ARGV;
|
||||
runtests @ARGV;
|
||||
exit 0;
|
||||
|
||||
# The bane of programming.
|
||||
sub process_options {
|
||||
use Getopt::Long;
|
||||
$Getopt::Long::autoabbrev = 1;
|
||||
my $help = 0;
|
||||
|
||||
my $result = &GetOptions
|
||||
(
|
||||
'help' => \$help,
|
||||
);
|
||||
usage unless $result;
|
||||
usage if $help;
|
||||
}
|
||||
|
15
tests/full.cnf
Normal file
15
tests/full.cnf
Normal file
|
@ -0,0 +1,15 @@
|
|||
# $Id: full.cnf,v 1.3 2006/03/10 12:47:37 rockyb Exp $
|
||||
# Test to see we can match on all of the processes, not
|
||||
# just the ones for our account.
|
||||
|
||||
# On a Unix-like system where there always is a pid 1 - init.
|
||||
# On there is a ppid of 1.
|
||||
[.]
|
||||
occurs = first-trigger
|
||||
trigger = $ppid == 1
|
||||
action = echo "ok 1"
|
||||
|
||||
[.?]
|
||||
occurs = every
|
||||
trigger = $pid == 1
|
||||
action = echo "ok 2"
|
34
tests/full.t
Executable file
34
tests/full.t
Executable file
|
@ -0,0 +1,34 @@
|
|||
#!/usr/bin/perl -w
|
||||
# $Id: full.t.in,v 1.6 2006/03/10 13:12:36 rockyb Exp $
|
||||
# Some count checks
|
||||
use strict;
|
||||
use Test::More;
|
||||
use Config;
|
||||
|
||||
if ('cygwin' eq $Config{osname}) {
|
||||
plan( tests => 1);
|
||||
} else {
|
||||
plan( tests => 2);
|
||||
}
|
||||
|
||||
my $test='full';
|
||||
|
||||
my $srcdir = $ENV{srcdir} ? $ENV{srcdir} : '.';
|
||||
my @output = `/usr/bin/perl ../ps-watcher --log --sleep -1 --nodaemon --config ${srcdir}/$test.cnf 2>&1`;
|
||||
|
||||
# First line is Id line. This doesn't count in testing.
|
||||
shift @output;
|
||||
|
||||
my $i=1;
|
||||
foreach (@output) {
|
||||
if (/^.+:\s+.*ok/) {
|
||||
s/.+:\s+//;
|
||||
my $result = sprintf "ok %d", $i;
|
||||
$i++;
|
||||
ok($_ =~ m{$result});
|
||||
}
|
||||
}
|
||||
|
||||
#;;; Local Variables: ***
|
||||
#;;; mode:perl ***
|
||||
#;;; End: ***
|
34
tests/full.t.in
Normal file
34
tests/full.t.in
Normal file
|
@ -0,0 +1,34 @@
|
|||
#!@PERL@ -w
|
||||
# $Id: full.t.in,v 1.6 2006/03/10 13:12:36 rockyb Exp $
|
||||
# Some count checks
|
||||
use strict;
|
||||
use Test::More;
|
||||
use Config;
|
||||
|
||||
if ('cygwin' eq $Config{osname}) {
|
||||
plan( tests => 1);
|
||||
} else {
|
||||
plan( tests => 2);
|
||||
}
|
||||
|
||||
my $test='full';
|
||||
|
||||
my $srcdir = $ENV{srcdir} ? $ENV{srcdir} : '.';
|
||||
my @output = `@PERL@ ../ps-watcher --log --sleep -1 --nodaemon --config ${srcdir}/$test.cnf 2>&1`;
|
||||
|
||||
# First line is Id line. This doesn't count in testing.
|
||||
shift @output;
|
||||
|
||||
my $i=1;
|
||||
foreach (@output) {
|
||||
if (/^.+:\s+.*ok/) {
|
||||
s/.+:\s+//;
|
||||
my $result = sprintf "ok %d", $i;
|
||||
$i++;
|
||||
ok($_ =~ m{$result});
|
||||
}
|
||||
}
|
||||
|
||||
#;;; Local Variables: ***
|
||||
#;;; mode:perl ***
|
||||
#;;; End: ***
|
21
tests/paction.cnf
Normal file
21
tests/paction.cnf
Normal file
|
@ -0,0 +1,21 @@
|
|||
# $Id: paction.cnf,v 1.2 2008/12/25 16:42:49 rockyb Exp $
|
||||
# Test perl-action, prolog and epilog
|
||||
# Rather the name of the interpreter is listed (e.g. bash or perl)
|
||||
# Here's how you can match against a script.
|
||||
# Look for my processes: ps-watcher.
|
||||
[$PROLOG]
|
||||
perl-action = $my_count=0; $root_procs=0;
|
||||
[.*]
|
||||
perl-action = <<EOP
|
||||
if ($uid == 0) {
|
||||
$my_count++; $root_procs++;
|
||||
}
|
||||
EOP
|
||||
occurs = every
|
||||
[$EPILOG]
|
||||
trigger = <<EOT
|
||||
$my_count > 0 && $my_count < $count &&
|
||||
$root_procs > 0 && $my_count >= $root_procs
|
||||
EOT
|
||||
action = echo "ok 1"
|
||||
|
37
tests/paction.t
Normal file
37
tests/paction.t
Normal file
|
@ -0,0 +1,37 @@
|
|||
#!/usr/bin/perl -w
|
||||
# $Id: paction.t,v 1.2 2006/03/10 03:21:12 rockyb Exp $
|
||||
# Arg paction-statement
|
||||
use strict;
|
||||
use Test::More;
|
||||
use Config;
|
||||
|
||||
if ('cygwin' eq $Config{osname}) {
|
||||
plan( skip_all => "cygwin's ps is not powerful enough this test");
|
||||
exit 0;
|
||||
}
|
||||
|
||||
my $test='paction';
|
||||
print "1..2\n";
|
||||
|
||||
my $srcdir = $ENV{srcdir} ? $ENV{srcdir} : '.';
|
||||
my $cmd = "../ps-watcher --log --nosyslog --nodaemon "
|
||||
. " --sleep -1 --config ${srcdir}/$test.cnf";
|
||||
my @output = `$cmd 2>&1`;
|
||||
|
||||
# First line is Id line. This doesn't count in testing.
|
||||
shift @output;
|
||||
|
||||
my $count=0;
|
||||
foreach (@output) {
|
||||
if (/^.+:\s+.*ok/) {
|
||||
s/.+:\s+//;
|
||||
print $_;
|
||||
$count++;
|
||||
last;
|
||||
}
|
||||
}
|
||||
print "ok 2\n" if $count>0;
|
||||
|
||||
#;;; Local Variables: ***
|
||||
#;;; mode:perl ***
|
||||
#;;; End: ***
|
Loading…
Add table
Add a link
Reference in a new issue