initial commit of file from CVS for e-smith-test on Wed 12 Jul 09:10:30 BST 2023
parent
54e4f39dbc
commit
b7c1628cf6
@ -0,0 +1,4 @@
|
||||
*.rpm
|
||||
*.log
|
||||
*spec-20*
|
||||
*.tar.xz
|
@ -0,0 +1,21 @@
|
||||
# Makefile for source rpm: e-smith-test
|
||||
# $Id: Makefile,v 1.1 2016/02/05 17:12:41 stephdl Exp $
|
||||
NAME := e-smith-test
|
||||
SPECFILE = $(firstword $(wildcard *.spec))
|
||||
|
||||
define find-makefile-common
|
||||
for d in common ../common ../../common ; do if [ -f $$d/Makefile.common ] ; then if [ -f $$d/CVS/Root -a -w $$/Makefile.common ] ; then cd $$d ; cvs -Q update ; fi ; echo "$$d/Makefile.common" ; break ; fi ; done
|
||||
endef
|
||||
|
||||
MAKEFILE_COMMON := $(shell $(find-makefile-common))
|
||||
|
||||
ifeq ($(MAKEFILE_COMMON),)
|
||||
# attept a checkout
|
||||
define checkout-makefile-common
|
||||
test -f CVS/Root && { cvs -Q -d $$(cat CVS/Root) checkout common && echo "common/Makefile.common" ; } || { echo "ERROR: I can't figure out how to checkout the 'common' module." ; exit -1 ; } >&2
|
||||
endef
|
||||
|
||||
MAKEFILE_COMMON := $(shell $(checkout-makefile-common))
|
||||
endif
|
||||
|
||||
include $(MAKEFILE_COMMON)
|
@ -1,3 +1,17 @@
|
||||
# e-smith-test
|
||||
# <img src="https://www.koozali.org/images/koozali/Logo/Png/Koozali_logo_2016.png" width="25%" vertical="auto" style="vertical-align:bottom"> e-smith-test
|
||||
|
||||
SMEServer Koozali developed git repo for e-smith-test smeserver
|
||||
SMEServer Koozali developed git repo for e-smith-test smeserver
|
||||
|
||||
## Wiki
|
||||
<br />https://wiki.koozali.org/
|
||||
|
||||
## Bugzilla
|
||||
Show list of outstanding bugs: [here](https://bugs.koozali.org/buglist.cgi?component=e-smith-test&product=SME%20Server%2010.X&query_format=advanced&limit=0&bug_status=UNCONFIRMED&bug_status=NEW&bug_status=ASSIGNED&bug_status=REOPENED&bug_status=CONFIRMED)
|
||||
|
||||
## Description
|
||||
|
||||
<br />*This description has been generated by an LLM AI system and cannot be relied on to be fully correct.*
|
||||
*Once it has been checked, then this comment will be deleted*
|
||||
<br />
|
||||
|
||||
e-smith-test is a software developed by E-Smith Technologies that helps companies to simplify the process of testing their networks and applications. It provides an easy-to-use interface to quickly and accurately simulate the behaviour of an application in a real world environment. With e-smith-test, users are able to create tests of network applications by combining a large set of variables and conditions. It also allows users to run tests remotely, over multiple platforms and operating systems. In addition, it also allows users to automatically generate reports for detailed analysis and to track the performance of their applications. With this software, companies can easily optimize the performance of their networks and applications, while ensuring high quality and reliability.
|
||||
|
@ -0,0 +1,131 @@
|
||||
|
||||
|
||||
|
||||
|
||||
The "Artistic License"
|
||||
|
||||
Preamble
|
||||
|
||||
The intent of this document is to state the conditions under which a
|
||||
Package may be copied, such that the Copyright Holder maintains some
|
||||
semblance of artistic control over the development of the package,
|
||||
while giving the users of the package the right to use and distribute
|
||||
the Package in a more-or-less customary fashion, plus the right to make
|
||||
reasonable modifications.
|
||||
|
||||
Definitions:
|
||||
|
||||
"Package" refers to the collection of files distributed by the
|
||||
Copyright Holder, and derivatives of that collection of files
|
||||
created through textual modification.
|
||||
|
||||
"Standard Version" refers to such a Package if it has not been
|
||||
modified, or has been modified in accordance with the wishes
|
||||
of the Copyright Holder as specified below.
|
||||
|
||||
"Copyright Holder" is whoever is named in the copyright or
|
||||
copyrights for the package.
|
||||
|
||||
"You" is you, if you're thinking about copying or distributing
|
||||
this Package.
|
||||
|
||||
"Reasonable copying fee" is whatever you can justify on the
|
||||
basis of media cost, duplication charges, time of people involved,
|
||||
and so on. (You will not be required to justify it to the
|
||||
Copyright Holder, but only to the computing community at large
|
||||
as a market that must bear the fee.)
|
||||
|
||||
"Freely Available" means that no fee is charged for the item
|
||||
itself, though there may be fees involved in handling the item.
|
||||
It also means that recipients of the item may redistribute it
|
||||
under the same conditions they received it.
|
||||
|
||||
1. You may make and give away verbatim copies of the source form of the
|
||||
Standard Version of this Package without restriction, provided that you
|
||||
duplicate all of the original copyright notices and associated disclaimers.
|
||||
|
||||
2. You may apply bug fixes, portability fixes and other modifications
|
||||
derived from the Public Domain or from the Copyright Holder. A Package
|
||||
modified in such a way shall still be considered the Standard Version.
|
||||
|
||||
3. You may otherwise modify your copy of this Package in any way, provided
|
||||
that you insert a prominent notice in each changed file stating how and
|
||||
when you changed that file, and provided that you do at least ONE of the
|
||||
following:
|
||||
|
||||
a) place your modifications in the Public Domain or otherwise make them
|
||||
Freely Available, such as by posting said modifications to Usenet or
|
||||
an equivalent medium, or placing the modifications on a major archive
|
||||
site such as uunet.uu.net, or by allowing the Copyright Holder to include
|
||||
your modifications in the Standard Version of the Package.
|
||||
|
||||
b) use the modified Package only within your corporation or organization.
|
||||
|
||||
c) rename any non-standard executables so the names do not conflict
|
||||
with standard executables, which must also be provided, and provide
|
||||
a separate manual page for each non-standard executable that clearly
|
||||
documents how it differs from the Standard Version.
|
||||
|
||||
d) make other distribution arrangements with the Copyright Holder.
|
||||
|
||||
4. You may distribute the programs of this Package in object code or
|
||||
executable form, provided that you do at least ONE of the following:
|
||||
|
||||
a) distribute a Standard Version of the executables and library files,
|
||||
together with instructions (in the manual page or equivalent) on where
|
||||
to get the Standard Version.
|
||||
|
||||
b) accompany the distribution with the machine-readable source of
|
||||
the Package with your modifications.
|
||||
|
||||
c) give non-standard executables non-standard names, and clearly
|
||||
document the differences in manual pages (or equivalent), together
|
||||
with instructions on where to get the Standard Version.
|
||||
|
||||
d) make other distribution arrangements with the Copyright Holder.
|
||||
|
||||
5. You may charge a reasonable copying fee for any distribution of this
|
||||
Package. You may charge any fee you choose for support of this
|
||||
Package. You may not charge a fee for this Package itself. However,
|
||||
you may distribute this Package in aggregate with other (possibly
|
||||
commercial) programs as part of a larger (possibly commercial) software
|
||||
distribution provided that you do not advertise this Package as a
|
||||
product of your own. You may embed this Package's interpreter within
|
||||
an executable of yours (by linking); this shall be construed as a mere
|
||||
form of aggregation, provided that the complete Standard Version of the
|
||||
interpreter is so embedded.
|
||||
|
||||
6. The scripts and library files supplied as input to or produced as
|
||||
output from the programs of this Package do not automatically fall
|
||||
under the copyright of this Package, but belong to whoever generated
|
||||
them, and may be sold commercially, and may be aggregated with this
|
||||
Package. If such scripts or library files are aggregated with this
|
||||
Package via the so-called "undump" or "unexec" methods of producing a
|
||||
binary executable image, then distribution of such an image shall
|
||||
neither be construed as a distribution of this Package nor shall it
|
||||
fall under the restrictions of Paragraphs 3 and 4, provided that you do
|
||||
not represent such an executable image as a Standard Version of this
|
||||
Package.
|
||||
|
||||
7. C subroutines (or comparably compiled subroutines in other
|
||||
languages) supplied by you and linked into this Package in order to
|
||||
emulate subroutines and variables of the language defined by this
|
||||
Package shall not be considered part of this Package, but are the
|
||||
equivalent of input as in Paragraph 6, provided these subroutines do
|
||||
not change the language in any way that would cause it to fail the
|
||||
regression tests for the language.
|
||||
|
||||
8. Aggregation of this Package with a commercial distribution is always
|
||||
permitted provided that the use of this Package is embedded; that is,
|
||||
when no overt attempt is made to make this Package's interfaces visible
|
||||
to the end user of the commercial distribution. Such use shall not be
|
||||
construed as a distribution of this Package.
|
||||
|
||||
9. The name of the Copyright Holder may not be used to endorse or promote
|
||||
products derived from this software without specific prior written permission.
|
||||
|
||||
10. THIS PACKAGE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR
|
||||
IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
|
||||
WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
||||
|
||||
The End
|
@ -0,0 +1,33 @@
|
||||
# Copyright 1999-2003 Mitel Networks Corporation
|
||||
# This program is free software; you can redistribute it and/or
|
||||
# modify it under the same terms as Perl itself.
|
||||
|
||||
|
||||
Perl Kit, Version 5.0
|
||||
|
||||
Copyright 1989-2001, Larry Wall
|
||||
All rights reserved.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of either:
|
||||
|
||||
a) the GNU General Public License as published by the Free
|
||||
Software Foundation; either version 1, or (at your option) any
|
||||
later version, or
|
||||
|
||||
b) the "Artistic License" which comes with this Kit.
|
||||
|
||||
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 either
|
||||
the GNU General Public License or the Artistic License for more details.
|
||||
|
||||
You should have received a copy of the Artistic License with this
|
||||
Kit, in the file named "Artistic". If not, I'll be glad to provide one.
|
||||
|
||||
You should also have received a copy of the GNU General Public License
|
||||
along with this program in the file named "Copying". If not, write to the
|
||||
Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
|
||||
02111-1307, USA or visit their web page on the internet at
|
||||
http://www.gnu.org/copyleft/gpl.html.
|
||||
|
@ -0,0 +1,192 @@
|
||||
Summary: e-smith server and gateway - testing infrastructure module
|
||||
%define name e-smith-test
|
||||
Name: %{name}
|
||||
%define version 1.0.1
|
||||
%define release 01
|
||||
Version: %{version}
|
||||
Release: %{release}
|
||||
Copyright: Artistic
|
||||
Group: Networking/Daemons
|
||||
Source: %{name}-%{version}.tar.gz
|
||||
Packager: e-smith developers <bugs@e-smith.com>
|
||||
BuildRoot: /var/tmp/%{name}-%{version}-%{release}-buildroot
|
||||
BuildArchitectures: noarch
|
||||
Requires: perl, perl-WWW-Automate >= 0.20, perl-Test-Simple >= 0.41
|
||||
Requires: perl-Test-Inline >= 0.14
|
||||
Requires: perl-Test-Harness-Straps == 0.10
|
||||
Requires: e-smith-lib >= 1.9.35
|
||||
BuildRequires: e-smith-devtools >= 1.7.1
|
||||
AutoReqProv: no
|
||||
|
||||
%description
|
||||
e-smith server and gateway software - testing infrastructure module.
|
||||
|
||||
%changelog
|
||||
* Wed Sep 3 2003 Gordon Rowell <gordonr@e-smith.com>
|
||||
- [1.0.1-01]
|
||||
- Rebuild [gordonr 1305]
|
||||
|
||||
* Wed Sep 3 2003 Gordon Rowell <gordonr@e-smith.com>
|
||||
- [1.0.0-04]
|
||||
- Revert unwanted code change in END block [gordonr 1305]
|
||||
|
||||
* Wed Sep 3 2003 Gordon Rowell <gordonr@e-smith.com>
|
||||
- [1.0.0-03]
|
||||
- Copyright update [gordonr 1305]
|
||||
|
||||
* Mon Feb 24 2003 Michael Soulier <msoulier@e-smith.com>
|
||||
- [1.0.0-02]
|
||||
- Remove deprecated WebServerName setting from canned test data. [charlieb 6861]
|
||||
- Removed any references to LocalDomainPrefix. [msoulier 4812]
|
||||
|
||||
- [1.0.0-01]
|
||||
- Roll to maintained version number to 1.0.0
|
||||
|
||||
* Wed Jun 5 2002 Charlie Brady <charlieb@e-smith.com>
|
||||
- [0.3.0-01]
|
||||
- Changing version to maintained stream number to 0.3.0
|
||||
|
||||
* Mon Jun 3 2002 Charlie Brady <charlieb@e-smith.com>
|
||||
- [0.2.0-01]
|
||||
- Changing version to maintained stream number to 0.2.0
|
||||
|
||||
* Thu May 23 2002 Gordon Rowell <gordonr@e-smith.com>
|
||||
- [0.1.23-01]
|
||||
- RPM rebuild forced by cvsroot2rpm
|
||||
|
||||
* Thu May 9 2002 Michael Schwern <schwern@e-smith.com>
|
||||
- [0.1.22-01]
|
||||
- Updating necessary Test::Harness::Straps version to 0.10
|
||||
[schwern 3408]
|
||||
|
||||
* Mon May 6 2002 Michael Schwern <schwern@e-smith.com>
|
||||
- [0.1.21-01]
|
||||
- Fixed quicktest to use an absolute path to the CVS lib directory.
|
||||
Helpful or tests which chdir. [schwern 2743]
|
||||
|
||||
* Thu May 2 2002 Michael Schwern <schwern@e-smith.com>
|
||||
- [0.1.20-01]
|
||||
- Fixed quicktest wrt files with spaces in the name [schwern]
|
||||
|
||||
* Wed May 1 2002 Gordon Rowell <gordonr@e-smith.com>
|
||||
- [0.1.19-01]
|
||||
- esmith::AccountDB -> esmith::AccountsDB [schwern 3287]
|
||||
|
||||
* Wed Apr 24 2002 Michael Schwern <schwern@e-smith.com>
|
||||
- [0.1.18-01]
|
||||
- quicktest now propagates the new libraris into any perl programs
|
||||
called in the tests [schwern]
|
||||
|
||||
* Wed Apr 10 2002 Michael Schwern <schwern@e-smith.com>
|
||||
- [0.1.17-01]
|
||||
- Added a --verbose switch to quicktest [schwern]
|
||||
- quicktest now running tests with warnings on [schwern]
|
||||
|
||||
* Sat Apr 6 2002 Gordon Rowell <gordonr@e-smith.com>
|
||||
- [0.1.16-01]
|
||||
- Rebuild with new e-smith-devtools to force permissions [gordonr]
|
||||
|
||||
* Sat Apr 6 2002 Gordon Rowell <gordonr@e-smith.com>
|
||||
- [0.1.15-01]
|
||||
- Added execute permission for all for {quick,smoke}test [gordonr]
|
||||
|
||||
* Fri Apr 5 2002 Michael G Schwern <schwern@e-smith.com>
|
||||
- [0.1.14-01]
|
||||
- Added -d option to quicktest for debugging [schwern]
|
||||
- Added scratch_copy() to esmith::TestUtils [schwern]
|
||||
|
||||
* Fri Apr 05 2002 Gordon Rowell <gordonr@e-smith.com>
|
||||
- [0.1.13-01]
|
||||
- Run testing-conf in post-{install,upgrade} events rather than from %post
|
||||
Running it from %post won't work in a fresh install as the config
|
||||
database doesn't yet exist [gordonr]
|
||||
|
||||
* Tue Apr 02 2002 Michael G Schwern <schwern@e-smith.com>
|
||||
- [0.1.12-01]
|
||||
- Added simulate_perl_program() to TestUtils [schwern]
|
||||
|
||||
* Mon Apr 01 2002 Kirrily Robert <skud@e-smith.com>
|
||||
- [0.1.11-01]
|
||||
- Added destruction_ok() routine to TestUtils.pm [skud]
|
||||
|
||||
* Fri Mar 15 2002 Michael G Schwern <schwern@e-smith.com>
|
||||
- [0.1.10-01]
|
||||
- quicktest now closes STDIN so tests don't block waiting for it (3042)
|
||||
- Fixed bug in Test::Harness::Straps so tests that die are failures (3034)
|
||||
|
||||
* Wed Mar 13 2002 Michael G Schwern <schwern@e-smith.com>
|
||||
- [0.1.9-01]
|
||||
- Added files argument to quicktest [schwern]
|
||||
- 0.1.8-01 was tagged badly. esmith::TestUtils was accidentally dropped
|
||||
and the temporary quiktest was accidentally installed [schwern 3026]
|
||||
- Adding dependeny on e-smith-lib for esmith::ConfigDB in testing-conf
|
||||
[schwern]
|
||||
|
||||
* Mon Mar 11 2002 Michael G Schwern <schwern@e-smith.com>
|
||||
- [0.1.8-01]
|
||||
- Added quicktest [schwern]
|
||||
- Added dependency on perl-Test-Harness-Straps [schwern]
|
||||
|
||||
* Thu Feb 28 2002 Kirrily Robert <skud@e-smith.com>
|
||||
- [0.1.7-01]
|
||||
- General cleanup in esmith::TestUtils
|
||||
- moved dependency on e-smith-devtools from Requires to BuildRequires [skud]
|
||||
|
||||
* Wed Feb 27 2002 Michael G Schwern <schwern@e-smith.com>
|
||||
- [0.1.6-01]
|
||||
- Botched the tagging again
|
||||
|
||||
* Wed Feb 27 2002 Michael G Schwern <schwern@e-smith.com>
|
||||
- [0.1.5-01]
|
||||
- Added dependency on e-smith-devtools for genfilelist update
|
||||
- smoketest now looks for local Perl libraries
|
||||
- fixed the sanity test
|
||||
|
||||
* Wed Feb 27 2002 Michael G Schwern <schwern@e-smith.com>
|
||||
- [0.1.4-01]
|
||||
- Botched the roll of 0.1.3-01
|
||||
|
||||
* Wed Feb 27 2002 Michael G Schwern <schwern@e-smith.com>
|
||||
- [0.1.3-01]
|
||||
- Fixed dependency on perl-Test-Simple [schwern]
|
||||
|
||||
* Mon Feb 18 2002 Kirrily Robert <skud@e-smith.com>
|
||||
- [0.1.2-01]
|
||||
- Added an esmith::TestUtils perl module to assist in writing tests
|
||||
- Changes to the smoketest script; now accepts an optional directory to
|
||||
run tests from, among other (internal) changes
|
||||
|
||||
* Mon Feb 18 2002 Kirrily Robert <skud@e-smith.com>
|
||||
- [0.1.1-01]
|
||||
- rollRPM: Rolled version number to 0.1.1-01. Includes patches up to 0.1.0-02.
|
||||
|
||||
* Sun Oct 07 2001 Kirrily Robert <skud@e-smith.com>
|
||||
- Minor change to 00sanity.t as it didn't seem to like using Inline
|
||||
|
||||
* Sun Oct 07 2001 Kirrily Robert <skud@e-smith.com>
|
||||
- Initial build
|
||||
|
||||
%prep
|
||||
%setup
|
||||
|
||||
%pre
|
||||
|
||||
%post
|
||||
|
||||
%build
|
||||
perl createlinks
|
||||
|
||||
%install
|
||||
rm -rf $RPM_BUILD_ROOT
|
||||
(cd root ; find . -depth -print | cpio -dump $RPM_BUILD_ROOT)
|
||||
rm -f e-smith-%{version}-filelist
|
||||
/sbin/e-smith/genfilelist $RPM_BUILD_ROOT > e-smith-%{version}-filelist
|
||||
echo "%doc Copying" >> %{name}-%{version}-%{release}-filelist
|
||||
echo "%doc Artistic" >> %{name}-%{version}-%{release}-filelist
|
||||
echo "%doc LICENSE" >> %{name}-%{version}-%{release}-filelist
|
||||
|
||||
%clean
|
||||
rm -rf $RPM_BUILD_ROOT
|
||||
|
||||
%files -f e-smith-%{version}-filelist
|
||||
%defattr(-,root,root)
|
@ -0,0 +1 @@
|
||||
sme10
|
@ -0,0 +1,43 @@
|
||||
#!/usr/bin/perl -w
|
||||
|
||||
|
||||
sub safe_symlink {
|
||||
my ($from, $to) = @_;
|
||||
use File::Basename;
|
||||
use File::Path;
|
||||
mkpath(dirname($to));
|
||||
unlink($to);
|
||||
symlink($from, $to) or die "Can't create symlink from $from to $to: $!";
|
||||
}
|
||||
|
||||
sub panel_link
|
||||
{
|
||||
my ($function, $panel) = @_;
|
||||
|
||||
my $cgibin = "root/etc/e-smith/web/panels/$panel/cgi-bin";
|
||||
|
||||
safe_symlink("../../../functions/$function",
|
||||
"$cgibin/$function")
|
||||
}
|
||||
|
||||
sub event_link
|
||||
{
|
||||
my ($action, $event, $level) = @_;
|
||||
|
||||
safe_symlink("../actions/${action}",
|
||||
"root/etc/e-smith/events/${event}/S${level}${action}");
|
||||
}
|
||||
|
||||
#--------------------------------------------------
|
||||
# actions for post-install event
|
||||
#--------------------------------------------------
|
||||
$event = "post-install";
|
||||
|
||||
event_link("testing-conf", $event, "90");
|
||||
|
||||
#--------------------------------------------------
|
||||
# actions for post-upgrade event
|
||||
#--------------------------------------------------
|
||||
$event = "post-upgrade";
|
||||
|
||||
event_link("testing-conf", $event, "90");
|
@ -0,0 +1,263 @@
|
||||
# $Id: e-smith-test.spec,v 1.5 2021/01/06 03:44:49 jpp Exp $
|
||||
|
||||
Summary: e-smith server and gateway - testing infrastructure module
|
||||
%define name e-smith-test
|
||||
Name: %{name}
|
||||
%define version 2.6.0
|
||||
%define release 6
|
||||
Version: %{version}
|
||||
Release: %{release}%{?dist}
|
||||
License: Artistic
|
||||
Group: Networking/Daemons
|
||||
Source: %{name}-%{version}.tar.xz
|
||||
BuildRoot: /var/tmp/%{name}-%{version}-%{release}-buildroot
|
||||
BuildArchitectures: noarch
|
||||
Requires: perl
|
||||
Requires: perl(WWW::Automate) >= 0.20
|
||||
Requires: perl(Test::Simple) >= 0.41
|
||||
Requires: perl(Test::Inline) >= 0.14
|
||||
Requires: perl(Test::Harness::Straps) >= 0.10
|
||||
Requires: e-smith-lib >= 1.9.35
|
||||
BuildRequires: e-smith-devtools >= 1.7.1
|
||||
|
||||
%description
|
||||
e-smith server and gateway software - testing infrastructure module.
|
||||
|
||||
%changelog
|
||||
* Wed Jul 12 2023 cvs2git.sh aka Brian Read <brianr@koozali.org> 2.6.0-6.sme
|
||||
- Roll up patches and move to git repo [SME: 12338]
|
||||
|
||||
* Wed Jul 12 2023 BogusDateBot
|
||||
- Eliminated rpmbuild "bogus date" warnings due to inconsistent weekday,
|
||||
by assuming the date is correct and changing the weekday.
|
||||
|
||||
* Tue Jan 05 2021 Jean-Philipe Pialasse <tests@pialasse.com> 2.6.0-5.sme
|
||||
- add update event [SME: 11158]
|
||||
|
||||
* Wed Apr 12 2017 Jean-Philipe Pialasse <tests@pialasse.com> 2.6.0-4.sme
|
||||
- remove reference to smtpd [SME: 9478]
|
||||
|
||||
* Sat Jul 23 2016 Jean-Philipe Pialasse <tests@pialasse.com> 2.6.0-3.sme
|
||||
- fix servicename syslog to rsyslog [SME: 9691]
|
||||
|
||||
* Mon Jul 18 2016 Jean-Philipe Pialasse <tests@pialasse.com> 2.6.0-2.sme
|
||||
- fix mysqld to mariadb [SME: 9438]
|
||||
|
||||
* Fri Feb 05 2016 stephane de Labrusse <stephdl@de-labrusse.fr> 2.6.0-1.sme
|
||||
- Initial release to sme10
|
||||
|
||||
* Sat Nov 30 2013 Daniel Berteaud <daniel@firewall-services.com> 2.4.0-2.sme
|
||||
- Remove the "swap interface" feature [SME: 7993]
|
||||
|
||||
* Fri Jan 25 2013 Shad L. Lords <slords@mail.com> 2.4.0-1.sme
|
||||
- Roll new stream for sme9
|
||||
- Perl module rpms moved to /usr/share/perl5/vendor_perl [SME: 7223]
|
||||
|
||||
* Tue Oct 7 2008 Shad L. Lords <slords@mail.com> 2.2.0-1.sme
|
||||
- Roll new stream to separate sme7/sme8 trees [SME: 4633]
|
||||
|
||||
* Sun Apr 29 2007 Shad L. Lords <slords@mail.com>
|
||||
- Clean up spec so package can be built by koji/plague
|
||||
|
||||
* Thu Dec 07 2006 Shad L. Lords <slords@mail.com>
|
||||
- Update to new release naming. No functional changes.
|
||||
- Make Packager generic
|
||||
|
||||
* Thu Mar 16 2006 Gordon Rowell <gordonr@gormand.com.au> 1.2.0-01
|
||||
- Roll stable stream version. [SME: 1016]
|
||||
|
||||
* Wed Nov 30 2005 Gordon Rowell <gordonr@gormand.com.au> 1.0.1-07
|
||||
- Bump release number only
|
||||
|
||||
* Thu Sep 22 2005 Trevor Poole <trevorp@e-smith.com>
|
||||
- [1.0.1-06]
|
||||
- Rollback change to smoketest
|
||||
|
||||
* Thu Sep 22 2005 Trevor Poole <trevorp@e-smith.com>
|
||||
- [1.0.1-05]
|
||||
- Add a sort to the test names in smoketest
|
||||
|
||||
* Fri Aug 19 2005 Gordon Rowell <gordonr@gormand.com.au>
|
||||
- [1.0.1-04]
|
||||
- Actually remove AutoReqProv header (see 1.0.1-02)
|
||||
|
||||
* Tue Aug 2 2005 Shad Lords <slords@email.com>
|
||||
- [1.0.1-03]
|
||||
- Update for move of default database location. [SF: 1216546]
|
||||
|
||||
* Sun Sep 19 2004 Charlie Brady <charlieb@e-smith.com>
|
||||
- [1.0.1-02]
|
||||
- Change deprecated "Copyright:" header to "License:".
|
||||
- Updated requires with new perl dependencies. [charlieb MN00040240]
|
||||
- Remove "AutoReqProv: no" so that "Provides" headers are auto-generated.
|
||||
[charlieb MN00040240]
|
||||
|
||||
* Wed Sep 3 2003 Gordon Rowell <gordonr@e-smith.com>
|
||||
- [1.0.1-01]
|
||||
- Rebuild [gordonr 1305]
|
||||
|
||||
* Wed Sep 3 2003 Gordon Rowell <gordonr@e-smith.com>
|
||||
- [1.0.0-04]
|
||||
- Revert unwanted code change in END block [gordonr 1305]
|
||||
|
||||
* Wed Sep 3 2003 Gordon Rowell <gordonr@e-smith.com>
|
||||
- [1.0.0-03]
|
||||
- Copyright update [gordonr 1305]
|
||||
|
||||
* Mon Feb 24 2003 Michael Soulier <msoulier@e-smith.com>
|
||||
- [1.0.0-02]
|
||||
- Remove deprecated WebServerName setting from canned test data. [charlieb 6861]
|
||||
- Removed any references to LocalDomainPrefix. [msoulier 4812]
|
||||
|
||||
- [1.0.0-01]
|
||||
- Roll to maintained version number to 1.0.0
|
||||
|
||||
* Wed Jun 5 2002 Charlie Brady <charlieb@e-smith.com>
|
||||
- [0.3.0-01]
|
||||
- Changing version to maintained stream number to 0.3.0
|
||||
|
||||
* Mon Jun 3 2002 Charlie Brady <charlieb@e-smith.com>
|
||||
- [0.2.0-01]
|
||||
- Changing version to maintained stream number to 0.2.0
|
||||
|
||||
* Thu May 23 2002 Gordon Rowell <gordonr@e-smith.com>
|
||||
- [0.1.23-01]
|
||||
- RPM rebuild forced by cvsroot2rpm
|
||||
|
||||
* Thu May 9 2002 Michael Schwern <schwern@e-smith.com>
|
||||
- [0.1.22-01]
|
||||
- Updating necessary Test::Harness::Straps version to 0.10
|
||||
[schwern 3408]
|
||||
|
||||
* Mon May 6 2002 Michael Schwern <schwern@e-smith.com>
|
||||
- [0.1.21-01]
|
||||
- Fixed quicktest to use an absolute path to the CVS lib directory.
|
||||
Helpful or tests which chdir. [schwern 2743]
|
||||
|
||||
* Thu May 2 2002 Michael Schwern <schwern@e-smith.com>
|
||||
- [0.1.20-01]
|
||||
- Fixed quicktest wrt files with spaces in the name [schwern]
|
||||
|
||||
* Wed May 1 2002 Gordon Rowell <gordonr@e-smith.com>
|
||||
- [0.1.19-01]
|
||||
- esmith::AccountDB -> esmith::AccountsDB [schwern 3287]
|
||||
|
||||
* Wed Apr 24 2002 Michael Schwern <schwern@e-smith.com>
|
||||
- [0.1.18-01]
|
||||
- quicktest now propagates the new libraris into any perl programs
|
||||
called in the tests [schwern]
|
||||
|
||||
* Wed Apr 10 2002 Michael Schwern <schwern@e-smith.com>
|
||||
- [0.1.17-01]
|
||||
- Added a --verbose switch to quicktest [schwern]
|
||||
- quicktest now running tests with warnings on [schwern]
|
||||
|
||||
* Sat Apr 6 2002 Gordon Rowell <gordonr@e-smith.com>
|
||||
- [0.1.16-01]
|
||||
- Rebuild with new e-smith-devtools to force permissions [gordonr]
|
||||
|
||||
* Sat Apr 6 2002 Gordon Rowell <gordonr@e-smith.com>
|
||||
- [0.1.15-01]
|
||||
- Added execute permission for all for {quick,smoke}test [gordonr]
|
||||
|
||||
* Fri Apr 5 2002 Michael G Schwern <schwern@e-smith.com>
|
||||
- [0.1.14-01]
|
||||
- Added -d option to quicktest for debugging [schwern]
|
||||
- Added scratch_copy() to esmith::TestUtils [schwern]
|
||||
|
||||
* Fri Apr 05 2002 Gordon Rowell <gordonr@e-smith.com>
|
||||
- [0.1.13-01]
|
||||
- Run testing-conf in post-{install,upgrade} events rather than from %post
|
||||
Running it from %post won't work in a fresh install as the config
|
||||
database doesn't yet exist [gordonr]
|
||||
|
||||
* Tue Apr 02 2002 Michael G Schwern <schwern@e-smith.com>
|
||||
- [0.1.12-01]
|
||||
- Added simulate_perl_program() to TestUtils [schwern]
|
||||
|
||||
* Mon Apr 01 2002 Kirrily Robert <skud@e-smith.com>
|
||||
- [0.1.11-01]
|
||||
- Added destruction_ok() routine to TestUtils.pm [skud]
|
||||
|
||||
* Fri Mar 15 2002 Michael G Schwern <schwern@e-smith.com>
|
||||
- [0.1.10-01]
|
||||
- quicktest now closes STDIN so tests don't block waiting for it (3042)
|
||||
- Fixed bug in Test::Harness::Straps so tests that die are failures (3034)
|
||||
|
||||
* Wed Mar 13 2002 Michael G Schwern <schwern@e-smith.com>
|
||||
- [0.1.9-01]
|
||||
- Added files argument to quicktest [schwern]
|
||||
- 0.1.8-01 was tagged badly. esmith::TestUtils was accidentally dropped
|
||||
and the temporary quiktest was accidentally installed [schwern 3026]
|
||||
- Adding dependeny on e-smith-lib for esmith::ConfigDB in testing-conf
|
||||
[schwern]
|
||||
|
||||
* Mon Mar 11 2002 Michael G Schwern <schwern@e-smith.com>
|
||||
- [0.1.8-01]
|
||||
- Added quicktest [schwern]
|
||||
- Added dependency on perl-Test-Harness-Straps [schwern]
|
||||
|
||||
* Thu Feb 28 2002 Kirrily Robert <skud@e-smith.com>
|
||||
- [0.1.7-01]
|
||||
- General cleanup in esmith::TestUtils
|
||||
- moved dependency on e-smith-devtools from Requires to BuildRequires [skud]
|
||||
|
||||
* Wed Feb 27 2002 Michael G Schwern <schwern@e-smith.com>
|
||||
- [0.1.6-01]
|
||||
- Botched the tagging again
|
||||
|
||||
* Wed Feb 27 2002 Michael G Schwern <schwern@e-smith.com>
|
||||
- [0.1.5-01]
|
||||
- Added dependency on e-smith-devtools for genfilelist update
|
||||
- smoketest now looks for local Perl libraries
|
||||
- fixed the sanity test
|
||||
|
||||
* Wed Feb 27 2002 Michael G Schwern <schwern@e-smith.com>
|
||||
- [0.1.4-01]
|
||||
- Botched the roll of 0.1.3-01
|
||||
|
||||
* Wed Feb 27 2002 Michael G Schwern <schwern@e-smith.com>
|
||||
- [0.1.3-01]
|
||||
- Fixed dependency on perl-Test-Simple [schwern]
|
||||
|
||||
* Mon Feb 18 2002 Kirrily Robert <skud@e-smith.com>
|
||||
- [0.1.2-01]
|
||||
- Added an esmith::TestUtils perl module to assist in writing tests
|
||||
- Changes to the smoketest script; now accepts an optional directory to
|
||||
run tests from, among other (internal) changes
|
||||
|
||||
* Mon Feb 18 2002 Kirrily Robert <skud@e-smith.com>
|
||||
- [0.1.1-01]
|
||||
- rollRPM: Rolled version number to 0.1.1-01. Includes patches up to 0.1.0-02.
|
||||
|
||||
* Sun Oct 07 2001 Kirrily Robert <skud@e-smith.com>
|
||||
- Minor change to 00sanity.t as it didn't seem to like using Inline
|
||||
|
||||
* Sun Oct 07 2001 Kirrily Robert <skud@e-smith.com>
|
||||
- Initial build
|
||||
|
||||
%prep
|
||||
%setup
|
||||
mkdir -p root/etc/e-smith/events/%{name}-update
|
||||
|
||||
%pre
|
||||
|
||||
%post
|
||||
|
||||
%build
|
||||
perl createlinks
|
||||
|
||||
%install
|
||||
rm -rf $RPM_BUILD_ROOT
|
||||
(cd root ; find . -depth -print | cpio -dump $RPM_BUILD_ROOT)
|
||||
rm -f e-smith-%{version}-filelist
|
||||
/sbin/e-smith/genfilelist $RPM_BUILD_ROOT > e-smith-%{version}-filelist
|
||||
echo "%doc Copying" >> %{name}-%{version}-%{release}-filelist
|
||||
echo "%doc Artistic" >> %{name}-%{version}-%{release}-filelist
|
||||
echo "%doc LICENSE" >> %{name}-%{version}-%{release}-filelist
|
||||
|
||||
%clean
|
||||
rm -rf $RPM_BUILD_ROOT
|
||||
|
||||
%files -f e-smith-%{version}-filelist
|
||||
%defattr(-,root,root)
|
@ -0,0 +1,72 @@
|
||||
#!/usr/bin/perl -w
|
||||
|
||||
#----------------------------------------------------------------------
|
||||
# Copyright 1999-2003 Mitel Networks Corporation
|
||||
# This program is free software; you can redistribute it and/or
|
||||
# modify it under the same terms as Perl itself.
|
||||
#----------------------------------------------------------------------
|
||||
|
||||
=head1 NAME
|
||||
|
||||
testing-conf -- configure testing service
|
||||
|
||||
=head1 DESCRIPTION
|
||||
|
||||
This action sets up the testing service when you first install
|
||||
e-smith-test, setting the "destruction" property to 0 (non-destructive).
|
||||
It is a no-op if the "destruction" property is already defined.
|
||||
|
||||
=begin testing
|
||||
|
||||
use esmith::ConfigDB;
|
||||
|
||||
$ENV{ESMITH_CONFIG_DB} = "00e-smith-test/configuration";
|
||||
unlink $ENV{ESMITH_CONFIG_DB};
|
||||
|
||||
ok(my $conf = esmith::ConfigDB->create(), "Create new config file");
|
||||
ok(my $test_service = $conf->new_record('testing', {type => 'service'}),
|
||||
"Create new record for testing service");
|
||||
isa_ok($test_service, 'esmith::DB::Record');
|
||||
|
||||
ok(not(defined($test_service->prop('destruction'))),
|
||||
"Testing should be absent before we run");
|
||||
|
||||
is(system("$^X $Original_File"), 0, "System command returned 0");
|
||||
$conf = esmith::ConfigDB->open();
|
||||
$test_service = $conf->get('testing');
|
||||
ok(defined($test_service->prop('destruction')), "Destruction is now defined");
|
||||
|
||||
$test_service->set_prop('destruction', 1);
|
||||
is(system("$^X $Original_File"), 0, "System command returned 0");
|
||||
$conf = esmith::ConfigDB->open();
|
||||
$test_service = $conf->get('testing');
|
||||
is($test_service->prop('destruction'), 1,
|
||||
"Destruction is left alone if already defined");
|
||||
|
||||
$test_service->set_prop('destruction', 0);
|
||||
is(system("$^X $Original_File"), 0, "System command returned 0");
|
||||
$conf = esmith::ConfigDB->open();
|
||||
$test_service = $conf->get('testing');
|
||||
is($test_service->prop('destruction'), 0,
|
||||
"Destruction is left alone if already defined, even if 0");
|
||||
|
||||
=end testing
|
||||
|
||||
=cut
|
||||
|
||||
use strict;
|
||||
use esmith::ConfigDB;
|
||||
|
||||
my $conf = esmith::ConfigDB->open()
|
||||
or die "Configuration database does not exist";
|
||||
|
||||
if (my $test_service = $conf->get('testing')
|
||||
|| $conf->new_record('testing', { type => 'service'} ))
|
||||
{
|
||||
unless (defined $test_service->prop('destruction'))
|
||||
{
|
||||
$test_service->set_prop('destruction', 0);
|
||||
}
|
||||
}
|
||||
|
||||
exit 0;
|
@ -0,0 +1,20 @@
|
||||
#!/usr/bin/perl -w
|
||||
|
||||
#----------------------------------------------------------------------
|
||||
# Copyright 1999-2003 Mitel Networks Corporation
|
||||
# This program is free software; you can redistribute it and/or
|
||||
# modify it under the same terms as Perl itself.
|
||||
#----------------------------------------------------------------------
|
||||
|
||||
use strict;
|
||||
use Test::More tests => 8;
|
||||
|
||||
require_ok("Test::Harness");
|
||||
require_ok("Test::More");
|
||||
require_ok("Test::Inline");
|
||||
require_ok("WWW::Automate");
|
||||
require_ok("Test::Simple");
|
||||
require_ok("esmith::TestUtils");
|
||||
|
||||
ok(-e "/etc/e-smith/tests", "Test directory exists");
|
||||
ok(-d "/etc/e-smith/tests", "Test directory is a directory");
|
@ -0,0 +1,82 @@
|
||||
# DO NOT MODIFY THIS FILE.
|
||||
# This file is automatically maintained by the Mitel Networks SME Server
|
||||
# configuration software. Manually editing this file may put your
|
||||
# system in an unknown state.
|
||||
#
|
||||
# updated: Tue Feb 26 13:56:13 2002
|
||||
Bart.Simpson=pseudonym|Account|bart
|
||||
Bart_Simpson=pseudonym|Account|bart
|
||||
Global=system
|
||||
Primary=system
|
||||
adm=system|Gid|4|Uid|3
|
||||
admin=system|Gid|101|Uid|101
|
||||
alias=system|Gid|400|Uid|400
|
||||
apache=existing|Gid|48|Uid|48
|
||||
bart=user|FirstName|Bart|LastName|Simpson
|
||||
bin=system|Gid|1|Uid|1
|
||||
cdrom=system
|
||||
cgi-bin=url
|
||||
console=system
|
||||
daemon=system|Gid|2|Uid|2
|
||||
dip=system|Gid|40
|
||||
disk=system|Gid|6
|
||||
dns=existing|Gid|53|Uid|53
|
||||
e-smith-manager=url
|
||||
e-smith-password=url
|
||||
everyone=pseudonym|Account|shared|Visible|internal
|
||||
floppy=system|Gid|19
|
||||
ftp=system|Gid|50|Uid|14
|
||||
games=system|Gid|20|Uid|12
|
||||
global=system
|
||||
gopher=system|Gid|30|Uid|13
|
||||
halt=system
|
||||
homes=system
|
||||
kmem=system|Gid|9
|
||||
ldap=existing|Gid|55|Uid|55
|
||||
lp=system|Gid|7|Uid|4
|
||||
mail=system|Gid|12|Uid|8
|
||||
mailer-daemon=pseudonym|Account|admin
|
||||
man=system|Gid|15
|
||||
mem=system|Gid|8
|
||||
mysql=existing|Gid|27|Uid|27
|
||||
named=existing|Gid|25|Uid|25
|
||||
netlogon=netlogon|Comment|placeholder for netlogon share
|
||||
news=system|Gid|13|Uid|9
|
||||
nobody=system|Gid|99|Uid|99
|
||||
nofiles=system|Gid|400
|
||||
operator=system|Gid|0|Uid|11
|
||||
postgres=system
|
||||
postmaster=pseudonym|Account|admin
|
||||
primary=system
|
||||
printers=system
|
||||
public=system|Gid|103|Uid|102
|
||||
qmail=system|Gid|401
|
||||
qmaild=system|Gid|400|Uid|401
|
||||
qmaill=system|Gid|400|Uid|402
|
||||
qmailp=system|Gid|400|Uid|403
|
||||
qmailq=system|Gid|401|Uid|404
|
||||
qmailr=system|Gid|401|Uid|405
|
||||
qmails=system|Gid|401|Uid|406
|
||||
qmailscan=existing|Gid|407|Uid|407
|
||||
root=system|Gid|0|Uid|0
|
||||
schwern=user|Uid|500|Gid|501|FirstName|Michael|LastName|Schwern
|
||||
server-manager=url
|
||||
server-manual=url
|
||||
shared=system|Gid|500|Visible|internal
|
||||
shutdown=system
|
||||
simpsons=group|Description|bar|Gid|5005|Members|bart,lisa,homer|Uid|5005
|
||||
slocate=system
|
||||
somegroup=group|Gid|42
|
||||
squid=system|Gid|23|Uid|23
|
||||
sync=system
|
||||
sys=system|Gid|3
|
||||
trend=existing|Gid|408|Uid|408
|
||||
tty=system|Gid|5
|
||||
user-password=url
|
||||
users=system|Gid|100
|
||||
utmp=system|Gid|22
|
||||
uucp=system|Gid|14|Uid|10
|
||||
webmail=url
|
||||
wheel=system|Gid|10
|
||||
www=system|Gid|102|Uid|100
|
||||
wwwpublic=system
|
@ -0,0 +1,102 @@
|
||||
# DO NOT MODIFY THIS FILE.
|
||||
# This file is automatically maintained by the Mitel Networks SME Server
|
||||
# configuration software. Manually editing this file may put your
|
||||
# system in an unknown state.
|
||||
#=
|
||||
#DomainName=e-smith.com
|
||||
AccessType=dedicated
|
||||
ActiveAccounts=0
|
||||
AdminEmail=
|
||||
ConsoleMode=login
|
||||
ContactEmail=
|
||||
ContactName=
|
||||
ContactOrg=
|
||||
DialupConnOffice=long
|
||||
DialupConnOutside=long
|
||||
DialupConnWeekend=long
|
||||
DialupFreqOffice=every15min
|
||||
DialupFreqOutside=everyhour
|
||||
DialupFreqWeekend=everyhour
|
||||
DialupModemDevice=/dev/ttyS1
|
||||
DialupPhoneNumber=
|
||||
DialupUserAccount=useraccount
|
||||
DialupUserPassword=userpassword
|
||||
DomainName=e-smith.com
|
||||
DynDnsAccount=dnsaccount
|
||||
DynDnsPassword=dnspassword
|
||||
DynDnsService=off
|
||||
EmailUnknownUser=return
|
||||
EthernetDriver1=pcnet32
|
||||
EthernetDriver2=unknown
|
||||
ExternalDHCP=off
|
||||
ExternalNetmask=255.255.255.0
|
||||
GatewayIP=192.168.16.1
|
||||
LocalIP=192.168.16.228
|
||||
LocalNetmask=255.255.255.0
|
||||
MinUid=5000
|
||||
PasswordSet=yes
|
||||
PreviousConfiguration=/home/e-smith/db/configuration.previous
|
||||
SMTPSmartHost=
|
||||
SambaDomainMaster=no
|
||||
SambaServerName=pretz
|
||||
SambaWorkgroup=mitel-networks
|
||||
ServiceAccountId=
|
||||
ServiceDomainName=
|
||||
ServiceTargetIP=
|
||||
SquidParent=
|
||||
SquidParentPort=
|
||||
StatusReports=off
|
||||
SystemMode=serveronly
|
||||
SystemName=pretz
|
||||
TimeZone=US/Eastern
|
||||
UnsavedChanges=yes
|
||||
atalk=service|InitscriptOrder|91|status|enabled
|
||||
auth=service|access|public|status|enabled
|
||||
blades=service|Host|service.e-smith.com|status|enabled
|
||||
bootstrap-console=service|InitscriptOrder|35|Run|no|status|enabled
|
||||
branding=service|modified|000000000000|status|enabled
|
||||
crond=service|InitscriptOrder|40|status|enabled
|
||||
ctrlaltdel=service|status|enabled
|
||||
dhcpd=service|InitscriptOrder|65|end|192.168.16.250|start|192.168.16.65|status|disabled
|
||||
diald=service|InitscriptOrder|57|status|disabled
|
||||
fetchmail=service|FreqOffice|every5min|FreqOutside|every30min|FreqWeekend|never|Method|standard|SecondaryMailAccount|popaccount|SecondaryMailPassword|poppassword|SecondaryMailServer|mail.myisp.xxx|status|disabled
|
||||
flexbackup=backupservice|erase_rewind_only|true
|
||||
ftp=service|access|private|accessLimits|off|status|enabled
|
||||
hdparm=service|InitscriptOrder|40|status|disabled
|
||||
horde=service|status|disabled
|
||||
httpd-admin=service|InitscriptOrder|86|status|enabled
|
||||
httpd-e-smith=service|InitscriptOrder|85|access|private|status|enabled
|
||||
imap=service|access|private|status|enabled
|
||||
imp=service|status|disabled
|
||||
ippp=service|InitscriptOrder|55|status|enabled
|
||||
ipsec=service|InitscriptOrder|90|PubKey|0sAQOoIKaOMuDqSdCZJXgv9QI86DAuAwbbvn8uoKn2lRQ9ZVPTn9Ow5znhuw/GopsYD2eujhtvkQo7fszAhWbEpn+lW2LzLCbZYaDov7j8Q9CpeJSVgeuzaBcw3OenSL3ltTwWWtG0pvyaYsfepNqVYvo64YVmrxo0O7dCECySMVBZkQ==|status|disabled
|
||||
isdn=service|Protocol|2|UseSyncPPP|yes|status|disabled
|
||||
keytable=service|InitscriptOrder|25|status|enabled
|
||||
ldap=service|InitscriptOrder|80|access|private|defaultCity|Ottawa|defaultCompany|XYZ Corporation|defaultDepartment|Main|defaultPhoneNumber|555-5555|defaultStreet|123 Main Street|status|enabled
|
||||
lilo=service|AddressMode|linear
|
||||
local=service|InitscriptOrder|99|status|enabled
|
||||
lpd=service|InitscriptOrder|60|status|enabled
|
||||
mariadb=service|InitscriptOrder|90|status|enabled
|
||||
masq=service|InitscriptOrder|06|Logging|none|Stealth|no|status|disabled
|
||||
modSSL=service|status|enabled
|
||||
mysql.init=service|InitscriptOrder|99|status|enabled
|
||||
named=service|chroot|yes|status|enabled
|
||||
network=service|InitscriptOrder|10|status|enabled
|
||||
ntpd=service|InitscriptOrder|55|status|disabled
|
||||
php=service|status|enabled
|
||||
popd=service|access|private|status|enabled
|
||||
pppoe=service|DemandIdleTime|no|InitscriptOrder|57|SynchronousPPP|no|status|disabled
|
||||
pptpd=service|sessions|10|status|disabled
|
||||
qmail=service|InitscriptOrder|80|status|enabled
|
||||
random=service|InitscriptOrder|20|status|enabled
|
||||
rsyslog=service|InitscriptOrder|05|status|enabled
|
||||
scanner=service|ScannerFns|iscan|UpdateTime|1:14|scanMail|yes|status|enabled
|
||||
smb=service|InitscriptOrder|91|RoamingProfiles|no|status|enabled
|
||||
smtpfwdd=service|InitscriptOrder|81|status|enabled
|
||||
squid=service|InitscriptOrder|90|status|enabled
|
||||
sshd=service|InitscriptOrder|85|PasswordAuthentication|yes|PermitRootLogin|yes|access|private|status|enabled
|
||||
sync=service|Host|service.e-smith.com|LastId|0|SuccessId|0|SyncFrequency|1|SyncMinute|57|status|disabled
|
||||
telnet=service|access|private|status|disabled
|
||||
testing=service|destruction|1
|
||||
wibble=42
|
||||
xinetd=service|InitscriptOrder|50|status|enabled
|
@ -0,0 +1,325 @@
|
||||
#!/usr/bin/perl -w
|
||||
#----------------------------------------------------------------------
|
||||
# Copyright 1999-2003 Mitel Networks Corporation
|
||||
# This program is free software; you can redistribute it and/or
|
||||
# modify it under the same terms as Perl itself.
|
||||
#----------------------------------------------------------------------
|
||||
|
||||
=head1 NAME
|
||||
|
||||
quicktest - quickly run all tests in the current CVS project
|
||||
|
||||
=head1 SYNOPSIS
|
||||
|
||||
quicktest
|
||||
quicktest [files ...] [--verbose]
|
||||
|
||||
quicktest [-d] [--verbose] file
|
||||
|
||||
|
||||
=head1 DESCRIPTION
|
||||
|
||||
This is a little script to let you quickly run your tests while making
|
||||
changes to an existing e-smith RPM project.
|
||||
|
||||
Unless given a specific set of files to run, it will run all .t files
|
||||
and embedded tests in the current CVS project. It allows you to do a
|
||||
quick test of the RPM without having to do much figuring or typing.
|
||||
|
||||
It will also use any perl libraries located in the current CVS
|
||||
project.
|
||||
|
||||
The "current CVS project" is defined by whatever CVS project you're
|
||||
current working directory is in. So if you're sitting in
|
||||
~/devel/e-smith-base/root/usr/ it will assume your project is
|
||||
e-smith-base.
|
||||
|
||||
Emacs backup files, CVS backup files and other temporary and backup
|
||||
files will be automatically skipped.
|
||||
|
||||
All tests will be run with warnings on.
|
||||
|
||||
=head2 Switches
|
||||
|
||||
=over 4
|
||||
|
||||
=item B<-d>
|
||||
|
||||
Tells quicktest to run the test in the debugger. It will gracefully
|
||||
handle embedded tests.
|
||||
|
||||
quicktest -d lib/some/module.pm
|
||||
|
||||
=item B<--verbose>
|
||||
|
||||
With --verbose quicktest will print out all the lines received from
|
||||
the test.
|
||||
|
||||
=back
|
||||
|
||||
=head1 FILES
|
||||
|
||||
CVS/Repository
|
||||
|
||||
=head1 AUTHOR
|
||||
|
||||
Mitel Networks Corporation.
|
||||
|
||||
For more information, see http://www.e-smith.org/
|
||||
|
||||
=cut
|
||||
|
||||
use strict;
|
||||
use File::Find;
|
||||
use File::Spec;
|
||||
|
||||
$| = 1;
|
||||
|
||||
open(my $repository, 'CVS/Repository') ||
|
||||
die "Can't find a CVS/Repository to look at: $!";
|
||||
my $path = <$repository>;
|
||||
close $repository;
|
||||
|
||||
my($project) = $path =~ m{^([^/]+)};
|
||||
chomp $project;
|
||||
print STDERR "Testing '$project'\n";
|
||||
|
||||
|
||||
use Getopt::Long;
|
||||
|
||||
my %Opts = ();
|
||||
GetOptions(\%Opts, 'd', 'verbose');
|
||||
|
||||
my $Verbose = $ENV{HARNESS_VERBOSE} || $Opts{verbose};
|
||||
|
||||
my @names = @ARGV;
|
||||
my @files = map File::Spec->rel2abs($_), @ARGV;
|
||||
|
||||
|
||||
# Go to the top of the project.
|
||||
chomp $path;
|
||||
my $updir = join '/', ('..') x $path =~ tr|/||;
|
||||
chdir $updir if length $updir;
|
||||
|
||||
my $test_dir = 'root/etc/e-smith/tests';
|
||||
die "Can't find $test_dir" unless -d $test_dir;
|
||||
|
||||
chdir $test_dir;
|
||||
@files = map File::Spec->abs2rel($_), @files;
|
||||
|
||||
|
||||
# Use any libraries in this CVS repository. Test::Harness will
|
||||
# automatically apply this to the tests.
|
||||
our $This_Lib =
|
||||
File::Spec->rel2abs('../../../../root/usr/lib/perl5/site_perl');
|
||||
unshift @INC, $This_Lib;
|
||||
|
||||
|
||||
if($Opts{d}) { # debugging
|
||||
die "I need a file to debug.\n" unless @files;
|
||||
die "You can only debug a single program at a time.\n" unless @files == 1;
|
||||
|
||||
my $file = $files[0];
|
||||
my $name = $names[0];
|
||||
warn "Debugging $file\n";
|
||||
my $test_file = _test_file($file);
|
||||
die "There are no tests in $name\n" unless $test_file;
|
||||
system("PERL5LIB=$This_Lib $^X -d $test_file");
|
||||
exit;
|
||||
}
|
||||
|
||||
unless( @files ) {
|
||||
find(sub {
|
||||
if( -d $_ and $_ eq 'CVS' ) {
|
||||
$File::Find::prune = 1;
|
||||
return;
|
||||
}
|
||||
return if /~$/ || /^\.#/;
|
||||
push @files, $File::Find::name if -f $_
|
||||
}, '../../../..'
|
||||
);
|
||||
|
||||
@names = map { (my $name = $_) =~ s[(\.\./){4}root/][]g; $name } @files;
|
||||
}
|
||||
|
||||
{
|
||||
package My::Strap;
|
||||
use Test::Harness::Straps;
|
||||
our @ISA = qw(Test::Harness::Straps);
|
||||
|
||||
sub _display {
|
||||
my($self, $out) = @_;
|
||||
print $self->{_ml}."$out";
|
||||
}
|
||||
|
||||
sub _print {
|
||||
my($self) = shift;
|
||||
print @_;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
### This is using an experimental callback interface in
|
||||
### Test::Harness::Straps so it can print out test results as they
|
||||
### happen. As the interface is experimental, check the changelog
|
||||
### before upgrading Test::Harness::Straps.
|
||||
|
||||
my $s = My::Strap->new;
|
||||
|
||||
my %handlers = (
|
||||
bailout => sub {
|
||||
my($self, $line, $type, $totals) = @_;
|
||||
|
||||
die sprintf "FAILED--Further testing stopped%s\n",
|
||||
$self->{bailout_reason} ? ": $self->{bailout_reason}" : '';
|
||||
},
|
||||
test => sub {
|
||||
my($self, $line, $type, $totals) = @_;
|
||||
my $curr = $totals->{seen};
|
||||
|
||||
if( $totals->{details}[-1]{ok} ) {
|
||||
$self->_display("ok $curr/$totals->{max}") unless $Verbose;
|
||||
}
|
||||
else {
|
||||
$self->_display("NOK $curr") unless $Verbose;
|
||||
}
|
||||
|
||||
if( $curr > $self->{'next'} ) {
|
||||
$self->_print("Test output counter mismatch [test $curr]\n");
|
||||
}
|
||||
elsif( $curr < $self->{'next'} ) {
|
||||
$self->_print("Confused test output: test $curr answered after ".
|
||||
"test ", $self->{next} - 1, "\n");
|
||||
# $self->{'next'} = $curr;
|
||||
}
|
||||
},
|
||||
);
|
||||
|
||||
$s->{callback} = sub {
|
||||
my($self, $line, $type, $totals) = @_;
|
||||
print $line if $Verbose;
|
||||
|
||||
$handlers{$type}->($self, $line, $type, $totals) if $handlers{$type};
|
||||
};
|
||||
|
||||
|
||||
close STDIN; # else tests might hang waiting for input.
|
||||
|
||||
|
||||
# Iterate through each test or file and run that test.
|
||||
# Most of the code herein is for nice formatting.
|
||||
my $all_passing = 1;
|
||||
my $width = _leader_width(@names);
|
||||
$width = 70 if $width > 70;
|
||||
foreach my $idx (0..$#files) {
|
||||
my($file, $name) = ($files[$idx], $names[$idx]);
|
||||
my %result = ();
|
||||
|
||||
my $test_file = _test_file($file);
|
||||
next unless $test_file;
|
||||
|
||||
my($leader, $ml) = _mk_leader($name, $width);
|
||||
print $leader;
|
||||
print "\n" if $Verbose;
|
||||
$s->{_ml} = $ml;
|
||||
|
||||
local $ENV{HARNESS_PERL_SWITCHES} = '-w';
|
||||
%result = $s->analyze_file($test_file);
|
||||
|
||||
$all_passing = 0 unless $result{passing};
|
||||
$s->_display($result{passing} ? 'ok' : 'FAILED');
|
||||
print "\n";
|
||||
}
|
||||
|
||||
if( $all_passing ) {
|
||||
print "All tests successful!\n"
|
||||
}
|
||||
else {
|
||||
print "SOME TESTS FAILED!\n";
|
||||
}
|
||||
|
||||
|
||||
=begin private
|
||||
|
||||
=over 4
|
||||
|
||||
=item B<_test_file>
|
||||
|
||||
my $test_file = _test_file($file);
|
||||
|
||||
Determines this $file is a test or has embedded tests and generates
|
||||
a runable $test_file based on this.
|
||||
|
||||
=cut
|
||||
|
||||
sub _test_file {
|
||||
my $file = shift;
|
||||
|
||||
my $test_file;
|
||||
if( $file =~ /\.t$/ ) {
|
||||
$test_file = $file;
|
||||
}
|
||||
elsif( system("pod2test '$file' > /tmp/embedded$$.t") == 0 ) {
|
||||
$test_file = "/tmp/embedded$$.t";
|
||||
}
|
||||
|
||||
return $test_file;
|
||||
}
|
||||
|
||||
=item B<_mk_leader>
|
||||
|
||||
my($leader, $ml) = _mk_leader($test_file, $width);
|
||||
|
||||
Generates the 't/foo........' $leader for the given $test_file as well
|
||||
as a similar version which will overwrite the current line (by use of
|
||||
\r and such). $ml may be empty if Test::Harness doesn't think you're
|
||||
on TTY.
|
||||
|
||||
The $width is the width of the "yada/blah.." string.
|
||||
|
||||
=cut
|
||||
|
||||
sub _mk_leader {
|
||||
my($te, $width) = @_;
|
||||
chomp($te);
|
||||
$te =~ s/\.\w+$/./;
|
||||
|
||||
if ($^O eq 'VMS') { $te =~ s/^.*\.t\./\[.t./s; }
|
||||
my $blank = (' ' x 77);
|
||||
my $leader = "$te" . '.' x ($width - length($te));
|
||||
my $ml = "";
|
||||
|
||||
$ml = "\r$blank\r$leader"
|
||||
if -t STDOUT and not $ENV{HARNESS_NOTTY} and not $ENV{HARNESS_VERBOSE};
|
||||
|
||||
return($leader, $ml);
|
||||
}
|
||||
|
||||
=item B<_leader_width>
|
||||
|
||||
my($width) = _leader_width(@test_files);
|
||||
|
||||
Calculates how wide the leader should be based on the length of the
|
||||
longest test name.
|
||||
|
||||
=cut
|
||||
|
||||
sub _leader_width {
|
||||
my $maxlen = 0;
|
||||
my $maxsuflen = 0;
|
||||
foreach (@_) {
|
||||
my $suf = /\.(\w+)$/ ? $1 : '';
|
||||
my $len = length;
|
||||
my $suflen = length $suf;
|
||||
$maxlen = $len if $len > $maxlen;
|
||||
$maxsuflen = $suflen if $suflen > $maxsuflen;
|
||||
}
|
||||
# + 3 : we want three dots between the test name and the "ok"
|
||||
return $maxlen + 3 - $maxsuflen;
|
||||
}
|
||||
|
||||
=back
|
||||
|
||||
=end private
|
||||
|
||||
|
@ -0,0 +1,62 @@
|
||||
#!/usr/bin/perl -w
|
||||
#----------------------------------------------------------------------
|
||||
# Copyright 1999-2003 Mitel Networks Corporation
|
||||
# This program is free software; you can redistribute it and/or
|
||||
# modify it under the same terms as Perl itself.
|
||||
#----------------------------------------------------------------------
|
||||
|
||||
=head1 NAME
|
||||
|
||||
smoketest -- run a smoketest on the SMEServer
|
||||
|
||||
=head1 SYNOPSIS
|
||||
|
||||
smoketest <test directory>
|
||||
|
||||
=head1 DESCRIPTION
|
||||
|
||||
This smoketest script walks the given I<test directory> (or
|
||||
F</etc/e-smith/tests> if none is given) looking for test scripts
|
||||
(F<*.t>).
|
||||
|
||||
It runs these tests in turn, through Test::Harness, and generates a
|
||||
simple report telling you whether the tests passed or failed.
|
||||
|
||||
All tests are run from the I<test directory>.
|
||||
|
||||
=head1 AUTHOR
|
||||
|
||||
Mitel Networks Corporation.
|
||||
|
||||
For more information, see http://www.e-smith.org/
|
||||
|
||||
=cut
|
||||
|
||||
use strict;
|
||||
use File::Find;
|
||||
use Test::Harness;
|
||||
|
||||
my $testdir = shift || "/etc/e-smith/tests";
|
||||
die "$testdir is not a directory\n" unless -d $testdir;
|
||||
chdir $testdir or die "Can't chdir into $testdir: $!\n";
|
||||
|
||||
my @tests = ();
|
||||
find \&wanted, '.';
|
||||
# Let's sort to get the order correct
|
||||
|
||||
if( @tests ) {
|
||||
print "Running tests in $testdir.\n";
|
||||
local $ENV{PERL5LIB} = '../../../usr/lib/perl5/site_perl';
|
||||
runtests @tests;
|
||||
}
|
||||
else {
|
||||
warn "No tests found in or below '$testdir'!\n";
|
||||
}
|
||||
|
||||
sub wanted {
|
||||
push @tests, $File::Find::name if /\.t$/;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
@ -0,0 +1,374 @@
|
||||
package esmith::TestUtils;
|
||||
|
||||
use strict;
|
||||
use Exporter;
|
||||
use Carp;
|
||||
use esmith::ConfigDB;
|
||||
use esmith::AccountsDB;
|
||||
use vars qw( @ISA @EXPORT);
|
||||
|
||||
@ISA = qw( Exporter );
|
||||
@EXPORT = qw(
|
||||
destruction_ok
|
||||
|
||||
get_random_username
|
||||
new_random_username
|
||||
|
||||
simulate_perl_program
|
||||
|
||||
scratch_copy
|
||||
);
|
||||
|
||||
|
||||
=head1 NAME
|
||||
|
||||
esmith::TestUtils -- general utilities for writing esmith tests
|
||||
|
||||
=head1 SYNOPSIS
|
||||
|
||||
my $username = get_random_username();
|
||||
my $newuser = new_random_username();
|
||||
|
||||
my $exit = simulate_perl_program($program);
|
||||
|
||||
if (destruction_ok()) { ... }
|
||||
|
||||
my $scratch_file = scratch_copy($file);
|
||||
|
||||
=head1 DESCRIPTION
|
||||
|
||||
This module provides a bunch of useful little utility routines to
|
||||
facilitate writing tests on the SMEServer.
|
||||
|
||||
=head2 destruction_ok()
|
||||
|
||||
Returns true or false depending on whether or not it's OK for tests to be destructive
|
||||
on this server.
|
||||
|
||||
=for testing
|
||||
use_ok(esmith::TestUtils);
|
||||
is(destruction_ok(), 0, "Destruction turned off by default");
|
||||
$ENV{ESMITH_CONFIG_DB} = "configuration.conf";
|
||||
is(destruction_ok(), 1, "Destruction turned on in config file");
|
||||
|
||||
=cut
|
||||
|
||||
sub destruction_ok {
|
||||
if (my $configdb = esmith::ConfigDB->open()) {
|
||||
if (my $test_record = $configdb->get('testing')) {
|
||||
if ($test_record->prop('destruction')) {
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
=head2 get_random_username()
|
||||
|
||||
my $username = get_random_username;
|
||||
|
||||
Gets a random username from the accounts database.
|
||||
|
||||
=begin testing
|
||||
|
||||
use_ok(esmith::AccountsDB);
|
||||
$ENV{ESMITH_ACCOUNT_DB} = "accounts.conf";
|
||||
$ENV{ESMITH_CONFIG_DB} = "configuration.conf";
|
||||
|
||||
my $u = get_random_username();
|
||||
my $accountdb = esmith::AccountsDB->open();
|
||||
my @users = $accountdb->users();
|
||||
@users = map { $_->key() } @users;
|
||||
ok((grep !/^$u$/, @users), "get_random_username got username $u from accounts");
|
||||
|
||||
=end testing
|
||||
|
||||
=cut
|
||||
|
||||
sub get_random_username {
|
||||
my $accountdb = esmith::AccountsDB->open();
|
||||
my @users = $accountdb->users();
|
||||
my $user = $users[rand(@users)];
|
||||
return $user->key();
|
||||
}
|
||||
|
||||
=head2 new_random_username()
|
||||
|
||||
my $username = new_random_username;
|
||||
|
||||
Returns a random username (just a random string of at least 3 letters) which
|
||||
is not yet in the accounts database.
|
||||
|
||||
=begin testing
|
||||
|
||||
my $u = new_random_username();
|
||||
use esmith::AccountsDB;
|
||||
my $accountdb = esmith::AccountsDB->open();
|
||||
my @users = $accountdb->users();
|
||||
@users = map { $_->key() } @users;
|
||||
ok((grep !/^$u$/, @users), "new_random_username invented new username $u");
|
||||
|
||||
=end testing
|
||||
|
||||
=cut
|
||||
|
||||
sub new_random_username {
|
||||
my $accountdb = esmith::AccountsDB->open();
|
||||
my @users = $accountdb->users();
|
||||
@users = map { $_->key() } @users;
|
||||
my @alphabet = split "", "abcdefghijklmnopqrstuvwxyz";
|
||||
my $guessed = "test-";
|
||||
while (1) {
|
||||
$guessed .= $alphabet[rand(26)];
|
||||
return $guessed unless grep /^$guessed$/, @users;
|
||||
}
|
||||
}
|
||||
|
||||
=head2 simulate_perl_program
|
||||
|
||||
my $exit = simulate_perl_program($program_file, @args);
|
||||
|
||||
"runs" the given $program_file for testing and reports it's $exit
|
||||
code. @args will be expanded via glob() and passed into the program.
|
||||
|
||||
The $program_file is not actually run in a seperate process. Instead,
|
||||
it is run in the current processs, simulating calling the program.
|
||||
|
||||
You'd do this in order to override certain functions it may call
|
||||
for testing purposes. For example:
|
||||
|
||||
=begin testing
|
||||
|
||||
use esmith::Broker ();
|
||||
|
||||
# override esmith::Broker::saveConfig so it does not
|
||||
# actually save the config. Instead, we trap the arguments
|
||||
# for examination.
|
||||
my @sSC_args;
|
||||
sub esmith::Broker::saveServerConfig {
|
||||
@sSC_args = @_;
|
||||
return 1;
|
||||
}
|
||||
|
||||
my $exit = simulate_perl_program($Original_File, qw(wibble));
|
||||
|
||||
is( $exit, 0, 'exited normally' );
|
||||
is( $_STDOUT_, "wibble was frobnized\n" );
|
||||
is( $_STDERR_, '', 'no warnings' );
|
||||
is_deeply( \@sSC_args, [('Broker', 1234, { foo => 23 })],
|
||||
'saveServerConfig called correctly' );
|
||||
|
||||
=end testing
|
||||
|
||||
|
||||
B<Restrictions>
|
||||
|
||||
$program_file must be a Perl program.
|
||||
|
||||
any args on the #! line may not be honored.
|
||||
|
||||
it cannot assume it's in package main.
|
||||
|
||||
If the program dies the error will be on $@. The output of the
|
||||
program will be available on $_STDOUT_ and $_STDERR_ as provided by
|
||||
Test::Inline.
|
||||
|
||||
=begin testing
|
||||
|
||||
use esmith::TestUtils qw(simulate_perl_program);
|
||||
|
||||
can_ok(__PACKAGE__, 'simulate_perl_program');
|
||||
|
||||
my $Temp_File = '00e-smith-test/tmp_program';
|
||||
END { unlink $Temp_File; }
|
||||
|
||||
sub _temp_program {
|
||||
open(FILE, ">$Temp_File") or die $!;
|
||||
print FILE @_;
|
||||
close FILE;
|
||||
$_STDOUT_ = '';
|
||||
$_STDERR_ = '';
|
||||
}
|
||||
|
||||
_temp_program(<<'OUT');
|
||||
print "ok 1\n";
|
||||
print STDERR "ok 2\n";
|
||||
$Foo = 'present';
|
||||
OUT
|
||||
|
||||
my $exit = simulate_perl_program($Temp_File);
|
||||
is( $exit, 0 );
|
||||
is( $@, '' );
|
||||
is( $_STDOUT_, "ok 1\n" );
|
||||
is( $_STDERR_, "ok 2\n" );
|
||||
|
||||
ok( !defined &CORE::GLOBAL::exit, 'trick exit() doesnt leak out' );
|
||||
|
||||
_temp_program(<<'OUT');
|
||||
print $Foo ? "\$Foo should not carry over: $Foo" : "ok";
|
||||
warn "wibble";
|
||||
OUT
|
||||
|
||||
$exit = simulate_perl_program($Temp_File);
|
||||
is( $exit, 0 );
|
||||
is( $@, '' );
|
||||
is( $_STDOUT_, "ok" );
|
||||
is( $_STDERR_, "wibble at $Temp_File line 2.\n" );
|
||||
|
||||
|
||||
_temp_program(<<'OUT');
|
||||
die "Ack!\n";
|
||||
OUT
|
||||
|
||||
$exit = simulate_perl_program($Temp_File);
|
||||
is( $exit, 255*256, 'die sets the right error code' );
|
||||
is( $@, "Ack!\n" );
|
||||
is( $_STDOUT_, '' );
|
||||
is( $_STDERR_, '' );
|
||||
|
||||
|
||||
_temp_program(<<'OUT');
|
||||
exit(42);
|
||||
OUT
|
||||
|
||||
$exit = simulate_perl_program($Temp_File);
|
||||
is( $exit, 256*42, 'exit code propagated' );
|
||||
is( $@, '' );
|
||||
is( $_STDOUT_, '' );
|
||||
is( $_STDERR_, '' );
|
||||
|
||||
_temp_program(<<'OUT');
|
||||
print "@ARGV";
|
||||
OUT
|
||||
|
||||
$exit = simulate_perl_program($Temp_File, qw(this that));
|
||||
is( $exit, 0 );
|
||||
is( $@, '' );
|
||||
is( $_STDOUT_, 'this that', 'args passed in' );
|
||||
is( $_STDERR_, '' );
|
||||
|
||||
_temp_program(<<'OUT');
|
||||
print "@ARGV";
|
||||
OUT
|
||||
|
||||
$exit = simulate_perl_program($Temp_File, qw(00*));
|
||||
is( $exit, 0 );
|
||||
is( $@, '' );
|
||||
is( $_STDOUT_, '00e-smith-test', 'args expanded' );
|
||||
is( $_STDERR_, '' );
|
||||
|
||||
|
||||
=end testing
|
||||
|
||||
=cut
|
||||
|
||||
my $Pack = 0;
|
||||
sub simulate_perl_program {
|
||||
my($prog, @args) = @_;
|
||||
|
||||
my $error;
|
||||
eval sprintf q{
|
||||
BEGIN {
|
||||
no warnings 'redefine';
|
||||
*CORE::GLOBAL::exit = sub (;$) {
|
||||
my $exit = $_[0] || 0;
|
||||
bless \$exit, 'esmith::TestUtils::simulate_perl_program::exit';
|
||||
die \$exit;
|
||||
};
|
||||
}
|
||||
|
||||
package esmith::TestUtils::simulate_perl_program::%d;
|
||||
|
||||
local @ARGV = map glob($_), @args;
|
||||
do $prog;
|
||||
$error = $@; # make the do error visible outside the eval
|
||||
}, $Pack++;
|
||||
|
||||
# so future eval's aren't effected.
|
||||
undef &CORE::GLOBAL::exit;
|
||||
delete $::CORE::GLOBAL::{exit};
|
||||
|
||||
if( $error ) {
|
||||
if( UNIVERSAL::isa($error,
|
||||
'esmith::TestUtils::simulate_perl_program::exit')
|
||||
)
|
||||
{
|
||||
return 256 * ${$error};
|
||||
}
|
||||
else {
|
||||
$@ = $error;
|
||||
return 255 * 256;
|
||||
}
|
||||
}
|
||||
else {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
=head2 scratch_copy
|
||||
|
||||
my $scratch = scratch_copy($src);
|
||||
my $scratch = scratch_copy($src, $dest);
|
||||
|
||||
Creates a scratch copy of the $src file that you can safely scribbled
|
||||
around with for testing. Returns the location of the $scratch file.
|
||||
If $dest is given it will use that for $scratch.
|
||||
|
||||
If the copy fails, $scratch will be undefined.
|
||||
|
||||
When the program exits the $scratch file will be deleted.
|
||||
|
||||
=begin testing
|
||||
|
||||
use esmith::TestUtils qw(scratch_copy);
|
||||
|
||||
my $src = 'accounts.conf';
|
||||
my $scratch = scratch_copy($src);
|
||||
isnt( $scratch, undef );
|
||||
ok( -e $scratch, 'scratch_copy() created a scratch file' ) || diag $!;
|
||||
|
||||
use Digest::MD5;
|
||||
open(FILE, $src) || die $!;
|
||||
my $srcmd5 = Digest::MD5->new->addfile(*FILE)->hexdigest;
|
||||
open(FILE, $scratch) || die $1;
|
||||
my $destmd5 = Digest::MD5->new->addfile(*FILE)->hexdigest;
|
||||
close FILE;
|
||||
|
||||
is( $srcmd5, $destmd5, ' same as the original' );
|
||||
|
||||
=end testing
|
||||
|
||||
=cut
|
||||
|
||||
my @Scratch_Files = ();
|
||||
sub scratch_copy {
|
||||
my($src, $dest) = @_;
|
||||
|
||||
$dest = "$src.scratch" unless defined $dest;
|
||||
|
||||
require File::Copy;
|
||||
my $ret = File::Copy::copy($src, $dest);
|
||||
|
||||
if($ret) {
|
||||
push @Scratch_Files, $dest;
|
||||
return $dest;
|
||||
}
|
||||
else {
|
||||
return undef;
|
||||
}
|
||||
}
|
||||
|
||||
END { unlink @Scratch_Files }
|
||||
|
||||
=head1 AUTHOR
|
||||
|
||||
Mitel Networks Corporation
|
||||
|
||||
See http://www.e-smith.org/ for more information.
|
||||
|
||||
=cut
|
||||
|
||||
|
||||
1;
|
Loading…
Reference in New Issue