e-smith-test/root/sbin/e-smith/smoketest

63 lines
1.4 KiB
Perl

#!/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$/;
}