let `make regress' write test reports
to use it set CPAN_REPORT=Yes, CPAN_REPORT_FROM to your email address and CPAN_REPORT_DB to a directory (like PLIST_DB) initially by steven@ feedback from steven@, msf@, rui@, espie@, merdely@, okan@ ok msf@
This commit is contained in:
parent
3db60d1479
commit
bf1bcd25c5
81
infrastructure/build/cpanreport
Normal file
81
infrastructure/build/cpanreport
Normal file
@ -0,0 +1,81 @@
|
||||
#!/usr/bin/perl
|
||||
# $OpenBSD: cpanreport,v 1.1 2008/01/27 23:28:25 simon Exp $
|
||||
# Copyright (c) 2007, 2008 Simon Bertrang <simon@openbsd.org>
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
# modification, are permitted provided that the following conditions
|
||||
# are met:
|
||||
# 1. Redistributions of code must retain the above copyright
|
||||
# notice, this list of conditions and the following disclaimer.
|
||||
# 2. Neither the name of OpenBSD nor the names of its contributors
|
||||
# may be used to endorse or promote products derived from this software
|
||||
# without specific prior written permission.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY ITS AUTHOR AND THE OpenBSD project ``AS IS'' AND
|
||||
# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
# ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
|
||||
# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
# SUCH DAMAGE.
|
||||
|
||||
use strict;
|
||||
use Getopt::Std qw(getopts);
|
||||
use Test::Reporter;
|
||||
|
||||
my $distname;
|
||||
my $log;
|
||||
my %opts = (
|
||||
'f' => $ENV{'REGRESS_LOGFILE'} || '-',
|
||||
'g' => '',
|
||||
's' => $ENV{'CPAN_REPORT_FROM'} || '',
|
||||
);
|
||||
my $reporter;
|
||||
|
||||
sub usage {
|
||||
die("usage: $0 [-f regress.log] -s address" .
|
||||
" -g fail|pass|na|unknown distname\n");
|
||||
}
|
||||
|
||||
unless (getopts('f:g:s:', \%opts)) {
|
||||
usage();
|
||||
}
|
||||
|
||||
unless ($opts{'g'} && $opts{'g'} =~ m/^(?:pass|fail|na|unknown)$/o) {
|
||||
usage();
|
||||
}
|
||||
|
||||
unless ($distname = shift(@ARGV)) {
|
||||
usage();
|
||||
}
|
||||
|
||||
unless ($opts{'g'} eq 'pass') {
|
||||
my $fh;
|
||||
|
||||
unless (open($fh, $opts{'f'})) {
|
||||
die("$0: $!: $opts{'f'}\n");
|
||||
}
|
||||
|
||||
{
|
||||
local($/) = undef;
|
||||
$log = <$fh>;
|
||||
}
|
||||
|
||||
close($fh);
|
||||
}
|
||||
|
||||
$reporter = Test::Reporter->new();
|
||||
|
||||
$reporter->from($opts{'s'});
|
||||
$reporter->grade($opts{'g'});
|
||||
$reporter->distribution($distname);
|
||||
|
||||
if ($log) {
|
||||
$reporter->comments($log);
|
||||
}
|
||||
|
||||
$reporter->write(\*STDOUT);
|
||||
|
@ -1,4 +1,4 @@
|
||||
# $OpenBSD: cpan.port.mk,v 1.4 2006/11/25 13:14:40 espie Exp $
|
||||
# $OpenBSD: cpan.port.mk,v 1.5 2008/01/27 23:28:25 simon Exp $
|
||||
|
||||
PKGNAME?= p5-${DISTNAME}
|
||||
.if !defined(CPAN_AUTHOR)
|
||||
@ -21,3 +21,30 @@ PKG_ARCH?= *
|
||||
REGRESS_DEPENDS+=::devel/p5-Test-Pod \
|
||||
::devel/p5-Test-Pod-Coverage
|
||||
.endif
|
||||
|
||||
CPAN_REPORT?= No
|
||||
|
||||
.if ${CPAN_REPORT:L} == "yes"
|
||||
REGRESS_DEPENDS+=::devel/p5-Test-Reporter
|
||||
REGRESS_FLAGS+= TEST_VERBOSE=1
|
||||
. if !defined(CPAN_REPORT_DB)
|
||||
ERRORS+= "Fatal: CPAN_REPORT_DB must point to a directory"
|
||||
. endif
|
||||
. if !defined(CPAN_REPORT_FROM) || empty(CPAN_REPORT_FROM)
|
||||
ERRORS+= "Fatal: CPAN_REPORT_FROM needs an email address"
|
||||
. endif
|
||||
|
||||
CPANTEST= ${PORTSDIR}/infrastructure/build/cpanreport
|
||||
CPANTEST_FLAGS= -f ${REGRESS_LOGFILE} -s ${CPAN_REPORT_FROM:Q} ${DISTNAME} \
|
||||
> ${CPAN_REPORT_DB}/${PKGNAME}
|
||||
CPANTEST_PASS= -g pass ${CPANTEST_FLAGS}
|
||||
CPANTEST_FAIL= -g fail ${CPANTEST_FLAGS}
|
||||
|
||||
post-regress:
|
||||
@mkdir -p ${CPAN_REPORT_DB}
|
||||
@if grep -q FAILED ${REGRESS_LOGFILE}; then \
|
||||
${CPANTEST} ${CPANTEST_FAIL}; \
|
||||
exit 1; \
|
||||
else ${CPANTEST} ${CPANTEST_PASS}; fi
|
||||
|
||||
.endif
|
||||
|
Loading…
x
Reference in New Issue
Block a user