usbmgmt/usbmgrtest/automation/runcmd.pl
author hgs
Wed, 25 Aug 2010 15:49:24 +0800
changeset 40 2bf7d1df7393
parent 0 c9bc50fca66e
permissions -rw-r--r--
201033_02

# Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies).
# All rights reserved.
# This component and the accompanying materials are made available
# under the terms of "Eclipse Public License v1.0"
# which accompanies this distribution, and is available
# at the URL "http://www.eclipse.org/legal/epl-v10.html".
#
# Initial Contributors:
# Nokia Corporation - initial contribution.
#
# Contributors:
#
# Description:
# runcmd log expected-result command
# 
#

use File::Basename;
use File::Path;

($#ARGV >= 3) or die "Usage: runcmd log expected-result command";

($log, $expected, @command) = @ARGV;

$cmd = "";
for my $c (@command) {$cmd = $cmd.$c." "};

print "Executing: ".$cmd."\n";
$ret = system($cmd) >> 8;

mkpath(dirname($log));
open LOG, ">>".$log;
print LOG "$cmd\n";
if ($ret == $expected) {
	print LOG "PASS\n";
}
else {
	print LOG "FAIL\n";
}
close LOG;