[otrs-cvs] UnitTest/Kernel/System UnitTest.pm,1.41,1.42
"CVS commits notifications of OTRS.org" <[email protected]> Mon, 15 Apr 2013 08:10:35 +0000
| Newsgroups | gmane.comp.otrs.cvs |
|---|---|
| Message-ID | <[email protected]> |
Comments:
Update of /home/cvs/UnitTest/Kernel/System
In directory lancelot:/tmp/cvs-serv26996/Kernel/System
Modified Files:
UnitTest.pm
Log Message:
Updated file to framework version 1.60.2.1.
Author: mh
Index: UnitTest.pm
===================================================================
RCS file: /home/cvs/UnitTest/Kernel/System/UnitTest.pm,v
retrieving revision 1.41
retrieving revision 1.42
diff -2 -u -d -r1.41 -r1.42
--- UnitTest.pm 15 Apr 2013 08:05:01 -0000 1.41
+++ UnitTest.pm 15 Apr 2013 08:10:30 -0000 1.42
@@ -4,5 +4,5 @@
# --
# $Id$
-# $OldId: UnitTest.pm,v 1.45.2.8 2012-08-14 11:22:58 mh Exp $
+# $OldId: UnitTest.pm,v 1.60.2.1 2012-08-14 11:23:22 mh Exp $
# --
# This software comes with ABSOLUTELY NO WARRANTY. For details, see
@@ -207,8 +207,10 @@
if ( -e '/etc/SuSE-release' ) {
+
my $ConfigFile = $Self->{MainObject}->FileRead(
Location => '/etc/SuSE-release',
Result => 'ARRAY',
);
+
if ( $ConfigFile && $ConfigFile->[0] ) {
$ResultSummary{Vendor} = $ConfigFile->[0];
@@ -219,8 +221,10 @@
}
elsif ( -e '/etc/fedora-release' ) {
+
my $ConfigFile = $Self->{MainObject}->FileRead(
Location => '/etc/fedora-release',
Result => 'ARRAY',
);
+
if ( $ConfigFile && $ConfigFile->[0] ) {
$ResultSummary{Vendor} = $ConfigFile->[0];
@@ -231,8 +235,10 @@
}
elsif ( -e '/etc/redhat-release' ) {
+
my $ConfigFile = $Self->{MainObject}->FileRead(
Location => '/etc/redhat-release',
Result => 'ARRAY',
);
+
if ( $ConfigFile && $ConfigFile->[0] ) {
$ResultSummary{Vendor} = $ConfigFile->[0];
@@ -243,14 +249,21 @@
}
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];
- $ConfigFile->[1] =~ s/DISTRIB_RELEASE=//;
- chomp( $ResultSummary{Vendor} );
- $ResultSummary{Vendor} .= ' ' . $ConfigFile->[1];
+ if ( $ConfigFile->[1] ) {
+ $ConfigFile->[1] =~ s/DISTRIB_RELEASE=//;
+ chomp $ResultSummary{Vendor};
+ $ResultSummary{Vendor} .= ' ' . $ConfigFile->[1];
+ }
+ else {
+ $ResultSummary{Vendor} .= ' (unknown release)';
+ }
}
else {
@@ -259,8 +272,10 @@
}
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];
@@ -271,8 +286,10 @@
}
elsif ( -e '/etc/gentoo-release' ) {
+
my $ConfigFile = $Self->{MainObject}->FileRead(
Location => '/etc/gentoo-release',
Result => 'ARRAY',
);
+
if ( $ConfigFile && $ConfigFile->[0] ) {
$ResultSummary{Vendor} = $ConfigFile->[0];
@@ -283,12 +300,35 @@
}
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};
@@ -589,7 +629,7 @@
my $IsDeeplyResult = $UnitTestObject->IsDeeply(
- ��� \%ResultHash, # test data
- ��� \%ExpectedHash, # expected value
- ��� 'Dummy Test Name',
+ \%ResultHash, # test data
+ \%ExpectedHash, # expected value
+ 'Dummy Test Name',
);
@@ -788,6 +828,10 @@
for my $Key ( keys %A ) {
- # do nothing, it's ok
- next if !defined $A{$Key} && !defined $B{$Key};
+ # Check if both are undefined
+ if ( !defined $A{$Key} && !defined $B{$Key} ) {
+ delete $A{$Key};
+ delete $B{$Key};
+ next;
+ }
# return diff, because its different
---------------------------------------------------------------------
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