[otrs-cvs] UnitTest/Kernel/System UnitTest.pm,1.40,1.41
"CVS commits notifications of OTRS.org" <[email protected]> Mon, 15 Apr 2013 08:05:06 +0000
| Newsgroups | gmane.comp.otrs.cvs |
|---|---|
| Message-ID | <[email protected]> |
Comments:
Update of /home/cvs/UnitTest/Kernel/System
In directory lancelot:/tmp/cvs-serv25138
Modified Files:
UnitTest.pm
Log Message:
Updated file to framework version 1.45.2.8.
Author: mh
Index: UnitTest.pm
===================================================================
RCS file: /home/cvs/UnitTest/Kernel/System/UnitTest.pm,v
retrieving revision 1.40
retrieving revision 1.41
diff -2 -u -d -r1.40 -r1.41
--- UnitTest.pm 10 Dec 2012 09:22:55 -0000 1.40
+++ UnitTest.pm 15 Apr 2013 08:05:01 -0000 1.41
@@ -1,8 +1,8 @@
# --
# Kernel/System/UnitTest.pm - the global test wrapper
-# Copyright (C) 2001-2012 OTRS AG, http://otrs.org/
+# Copyright (C) 2001-2013 OTRS AG, http://otrs.org/
# --
# $Id$
-# $OldId: UnitTest.pm,v 1.66 2012/11/20 15:40:30 mh Exp $
+# $OldId: UnitTest.pm,v 1.45.2.8 2012-08-14 11:22:58 mh Exp $
# --
# This software comes with ABSOLUTELY NO WARRANTY. For details, see
@@ -207,10 +207,8 @@
if ( -e '/etc/SuSE-release' ) {
-
my $ConfigFile = $Self->{MainObject}->FileRead(
Location => '/etc/SuSE-release',
Result => 'ARRAY',
);
-
if ( $ConfigFile && $ConfigFile->[0] ) {
$ResultSummary{Vendor} = $ConfigFile->[0];
@@ -221,10 +219,8 @@
}
elsif ( -e '/etc/fedora-release' ) {
-
my $ConfigFile = $Self->{MainObject}->FileRead(
Location => '/etc/fedora-release',
Result => 'ARRAY',
);
-
if ( $ConfigFile && $ConfigFile->[0] ) {
$ResultSummary{Vendor} = $ConfigFile->[0];
@@ -235,10 +231,8 @@
}
elsif ( -e '/etc/redhat-release' ) {
-
my $ConfigFile = $Self->{MainObject}->FileRead(
Location => '/etc/redhat-release',
Result => 'ARRAY',
);
-
if ( $ConfigFile && $ConfigFile->[0] ) {
$ResultSummary{Vendor} = $ConfigFile->[0];
@@ -249,21 +243,14 @@
}
elsif ( -e '/etc/lsb-release' ) {
-
my $ConfigFile = $Self->{MainObject}->FileRead(
Location => '/etc/lsb-release',
Result => 'ARRAY',
);
-
if ( $ConfigFile && $ConfigFile->[0] ) {
$ConfigFile->[0] =~ s/DISTRIB_ID=//;
$ResultSummary{Vendor} = $ConfigFile->[0];
- if ( $ConfigFile->[1] ) {
- $ConfigFile->[1] =~ s/DISTRIB_RELEASE=//;
- chomp $ResultSummary{Vendor};
- $ResultSummary{Vendor} .= ' ' . $ConfigFile->[1];
- }
- else {
- $ResultSummary{Vendor} .= ' (unknown release)';
- }
+ $ConfigFile->[1] =~ s/DISTRIB_RELEASE=//;
+ chomp( $ResultSummary{Vendor} );
+ $ResultSummary{Vendor} .= ' ' . $ConfigFile->[1];
}
else {
@@ -272,10 +259,8 @@
}
elsif ( -e '/etc/debian_version' ) {
-
my $ConfigFile = $Self->{MainObject}->FileRead(
Location => '/etc/debian_version',
Result => 'ARRAY',
);
-
if ( $ConfigFile && $ConfigFile->[0] ) {
$ResultSummary{Vendor} = 'Debian ' . $ConfigFile->[0];
@@ -286,10 +271,8 @@
}
elsif ( -e '/etc/gentoo-release' ) {
-
my $ConfigFile = $Self->{MainObject}->FileRead(
Location => '/etc/gentoo-release',
Result => 'ARRAY',
);
-
if ( $ConfigFile && $ConfigFile->[0] ) {
$ResultSummary{Vendor} = $ConfigFile->[0];
@@ -300,35 +283,12 @@
}
elsif ( $^O eq 'freebsd' ) {
-
my $Release = `uname -r`;
$ResultSummary{Vendor} = 'FreeBSD ' . $Release;
}
- elsif ( $^O eq 'MSWin32' ) {
-
- $ResultSummary{Vendor} = 'MS Windows unknown';
-
- my @Release = `systeminfo`;
-
- for my $Row (@Release) {
-
- my ($Name) = $Row =~ m{ \A OS \s Name: \s+ (.+?) \s* \z }xms;
-
- if ($Name) {
- $Name =~ s{Microsoft}{MS}xmsg;
- $ResultSummary{Vendor} = $Name;
- }
-
- my ($Version) = $Row =~ m{ \A OS \s Version: \s+ (.+?) \s* \z }xms;
-
- if ($Version) {
- $ResultSummary{Vendor} .= ' ' . $Version;
- }
- }
- }
else {
$ResultSummary{Vendor} = 'unknown';
}
- chomp $ResultSummary{Vendor};
+ chomp( $ResultSummary{Vendor} );
$ResultSummary{Database} = $Self->{DBObject}->{'DB::Type'};
$ResultSummary{TestOk} = $Self->{TestCountOk};
@@ -410,10 +370,5 @@
$XML .= "</Summary>\n";
for my $Key ( sort keys %{ $Self->{XML}->{Test} } ) {
-
- # extract duration time
- my $Duration = $Self->{Duration}->{$Key};
-
- $XML .= "<Unit Name=\"$Key\" Duration=\"$Duration\">\n";
-
+ $XML .= "<Unit Name=\"$Key\">\n";
for my $TestCount ( sort { $a <=> $b } keys %{ $Self->{XML}->{Test}->{$Key} } ) {
my $Result = $Self->{XML}->{Test}->{$Key}->{$TestCount}->{Result};
@@ -424,5 +379,4 @@
$XML .= qq| <Test Result="$Result" Count="$TestCount">$Content</Test>\n|;
}
-
$XML .= "</Unit>\n";
}
@@ -446,4 +400,5 @@
# ---
+
return 1;
}
@@ -634,7 +589,7 @@
my $IsDeeplyResult = $UnitTestObject->IsDeeply(
- \%ResultHash, # test data
- \%ExpectedHash, # expected value
- 'Dummy Test Name',
+ ��� \%ResultHash, # test data
+ ��� \%ExpectedHash, # expected value
+ ��� 'Dummy Test Name',
);
@@ -831,12 +786,8 @@
# compare %A with %B and remove it if checked
- for my $Key ( sort keys %A ) {
+ for my $Key ( keys %A ) {
- # Check if both are undefined
- if ( !defined $A{$Key} && !defined $B{$Key} ) {
- delete $A{$Key};
- delete $B{$Key};
- next;
- }
+ # do nothing, it's ok
+ next if !defined $A{$Key} && !defined $B{$Key};
# return diff, because its different
@@ -915,7 +866,7 @@
sub _PrintHeadlineStart {
my ( $Self, $Name ) = @_;
-
- # set default name
- $Name ||= '->>No Name!<<-';
+ if ( !$Name ) {
+ $Name = '->>No Name!<<-';
+ }
if ( $Self->{Output} eq 'HTML' ) {
@@ -928,10 +879,5 @@
print "+-------------------------------------------------------------------+\n";
}
-
$Self->{XMLUnit} = $Name;
-
- # set duration start time
- $Self->{DurationStartTime}->{$Name} = $Self->{TimeObject}->SystemTime();
-
return 1;
}
@@ -939,7 +885,7 @@
sub _PrintHeadlineEnd {
my ( $Self, $Name ) = @_;
-
- # set default name
- $Name ||= '->>No Name!<<-';
+ if ( !$Name ) {
+ $Name = '->>No Name!<<-';
+ }
if ( $Self->{Output} eq 'HTML' ) {
@@ -948,15 +894,4 @@
elsif ( $Self->{Output} eq 'ASCII' ) {
}
-
- # calculate duration time
- my $Duration = '';
- if ( $Self->{DurationStartTime}->{$Name} ) {
-
- $Duration = $Self->{TimeObject}->SystemTime() - $Self->{DurationStartTime}->{$Name};
-
- delete $Self->{DurationStartTime}->{$Name};
- }
- $Self->{Duration}->{$Name} = $Duration;
-
return 1;
}
---------------------------------------------------------------------
OTRS mailing list: cvs-log - Webpage: http://otrs.org/
Archive: http://lists.otrs.org/pipermail/cvs-log
To unsubscribe: http://lists.otrs.org/cgi-bin/listinfo/cvs-log