usbmgmt/usbmgrtest/automation/runcmd.pl
author Xiaolong Shi <xiaolong.shi@nokia.com>
Thu, 02 Sep 2010 14:36:32 +0100
changeset 53 8353e29a36f1
parent 0 c9bc50fca66e
permissions -rw-r--r--
Add missing source file to fix Bug 3648

# 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;