From 2d8b3931ee7a01d7e366094f2fe565965a7a1988 Mon Sep 17 00:00:00 2001 From: ligc Date: Mon, 27 Sep 2010 03:01:14 +0000 Subject: [PATCH] support for comment lines and print message with colors git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@7661 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd --- xCAT-test/xcattest | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/xCAT-test/xcattest b/xCAT-test/xcattest index 1be482c85..2d754cca5 100755 --- a/xCAT-test/xcattest +++ b/xCAT-test/xcattest @@ -4,6 +4,7 @@ use strict; use warnings; use Getopt::Long; use Data::Dumper; +use Term::ANSIColor; BEGIN { @@ -114,7 +115,14 @@ sub log_this return; } print LOG join("\n", @_), "\n"; - print join("\n", @_), "\n"; + my $msg = join("\n", @_); + if ($msg =~ /\[Pass\]/) { + print color("green"), "$msg\n", color("reset"); + } elsif ($msg =~ /\[Failed\]/) { + print color("red"), "$msg\n", color("reset"); + } else { + print "$msg\n"; + } } sub log_error @@ -434,7 +442,9 @@ sub loadcase while($line=){ $line = &trim($line); next if(length($line) == 0); - #description line is only a comment + #skip comment lines + next if($line =~ /^\s*#/); + #TODO: description line is treated as a comment line for now next if($line =~ /^description\s*:/); if($line =~ /^start\s*:\s*(\w+)/){