usbmgmt/usbmgrtest/automation/runcmd.pl
changeset 0 c9bc50fca66e
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/usbmgmt/usbmgrtest/automation/runcmd.pl	Tue Feb 02 02:02:59 2010 +0200
@@ -0,0 +1,40 @@
+# 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;