summaryrefslogtreecommitdiffstats
path: root/src/usr/util/runtime/test/testruncommand.H
diff options
context:
space:
mode:
authorCorey Swenson <cswenson@us.ibm.com>2016-09-20 13:29:49 -0500
committerDaniel M. Crowell <dcrowell@us.ibm.com>2016-10-12 11:55:48 -0400
commitd32a09cc6edff8d296f64238fd5c0884472fcbc0 (patch)
tree6098d70e3013894002ec2a8df0dc34016c58883a /src/usr/util/runtime/test/testruncommand.H
parent3ab150991f977e81505114f0a20a9d5e5e29f230 (diff)
downloadtalos-hostboot-d32a09cc6edff8d296f64238fd5c0884472fcbc0.tar.gz
talos-hostboot-d32a09cc6edff8d296f64238fd5c0884472fcbc0.zip
Enable Host interface run_command
Change-Id: I689d0f20d65f75299a341f23c2eb1b923dd2aa76 RTC:146148 Reviewed-on: http://ralgit01.raleigh.ibm.com/gerrit1/29980 Tested-by: Jenkins Server <pfd-jenkins+hostboot@us.ibm.com> Tested-by: FSP CI Jenkins <fsp-CI-jenkins+hostboot@us.ibm.com> Reviewed-by: Elizabeth K. Liner <eliner@us.ibm.com> Reviewed-by: Daniel M. Crowell <dcrowell@us.ibm.com>
Diffstat (limited to 'src/usr/util/runtime/test/testruncommand.H')
-rw-r--r--src/usr/util/runtime/test/testruncommand.H83
1 files changed, 83 insertions, 0 deletions
diff --git a/src/usr/util/runtime/test/testruncommand.H b/src/usr/util/runtime/test/testruncommand.H
new file mode 100644
index 000000000..5e2383fe4
--- /dev/null
+++ b/src/usr/util/runtime/test/testruncommand.H
@@ -0,0 +1,83 @@
+/* IBM_PROLOG_BEGIN_TAG */
+/* This is an automatically generated prolog. */
+/* */
+/* $Source: src/usr/util/runtime/test/testruncommand.H $ */
+/* */
+/* OpenPOWER HostBoot Project */
+/* */
+/* Contributors Listed Below - COPYRIGHT 2015,2016 */
+/* [+] International Business Machines Corp. */
+/* */
+/* */
+/* Licensed under the Apache License, Version 2.0 (the "License"); */
+/* you may not use this file except in compliance with the License. */
+/* You may obtain a copy of the License at */
+/* */
+/* http://www.apache.org/licenses/LICENSE-2.0 */
+/* */
+/* Unless required by applicable law or agreed to in writing, software */
+/* distributed under the License is distributed on an "AS IS" BASIS, */
+/* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or */
+/* implied. See the License for the specific language governing */
+/* permissions and limitations under the License. */
+/* */
+/* IBM_PROLOG_END_TAG */
+#include <cxxtest/TestSuite.H>
+#include <errl/errlmanager.H>
+#include <config.h>
+#include <runtime/interface.h>
+#include <string.h>
+#include <stdio.h>
+#include "utilbase.H"
+
+class RunCommandTest : public CxxTest::TestSuite
+{
+ public:
+ /**
+ * @brief Test basic command/response
+ */
+ void testRunCommand()
+ {
+ int argc = 2;
+
+ char arg0[10]; memcpy( arg0, "testRunCommand", 15 );
+ char arg1[10]; memcpy( arg1, "arg1", 5 );
+
+ const char* argv[] = { arg0, arg1 };
+
+ char* outstr = NULL;
+
+ int rc = (getRuntimeInterfaces()->run_command)( argc, argv, &outstr );
+
+ TRACFCOMP( Util::g_util_trace, "testRunCommand> rc=%d :: %s",
+ rc, outstr == NULL ? "null" : outstr );
+
+ char expected[21];
+ sprintf( expected, "TEST:arg1" );
+
+ if( strcmp( outstr, expected ) )
+ {
+ TS_FAIL( "testRunCommand> Unexpected result : Exp=%s, Act=%s",
+ expected, outstr );
+ }
+
+ if( outstr )
+ {
+ delete[] outstr;
+ }
+ }
+
+ /**
+ * @brief Test invalid parms
+ */
+ void testRunCommandBad(void)
+ {
+ int rc = 0;
+
+ rc = (getRuntimeInterfaces()->run_command)( 0, NULL, NULL );
+ if( rc )
+ {
+ TS_FAIL( "testRunCommandBad> Error from no args" );
+ }
+ }
+};
OpenPOWER on IntegriCloud