[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[certi-cvs] applications/HLA_TestsSuite 01-FederationExecut...
From: |
certi-cvs |
Subject: |
[certi-cvs] applications/HLA_TestsSuite 01-FederationExecut... |
Date: |
Mon, 22 Nov 2010 21:05:23 +0000 |
CVSROOT: /sources/certi
Module name: applications
Changes by: Eric NOULARD <erk> 10/11/22 21:05:23
Modified files:
HLA_TestsSuite : 01-FederationExecutionTest.cc CMakeLists.txt
Added files:
HLA_TestsSuite : dtest_1516_01-FederationExecutionTest.py
Log message:
Add example dtest script for 1516 tests
CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/applications/HLA_TestsSuite/01-FederationExecutionTest.cc?cvsroot=certi&r1=1.2&r2=1.3
http://cvs.savannah.gnu.org/viewcvs/applications/HLA_TestsSuite/CMakeLists.txt?cvsroot=certi&r1=1.42&r2=1.43
http://cvs.savannah.gnu.org/viewcvs/applications/HLA_TestsSuite/dtest_1516_01-FederationExecutionTest.py?cvsroot=certi&rev=1.1
Patches:
Index: 01-FederationExecutionTest.cc
===================================================================
RCS file:
/sources/certi/applications/HLA_TestsSuite/01-FederationExecutionTest.cc,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -b -r1.2 -r1.3
--- 01-FederationExecutionTest.cc 1 Jun 2010 20:24:05 -0000 1.2
+++ 01-FederationExecutionTest.cc 22 Nov 2010 21:05:22 -0000 1.3
@@ -96,7 +96,7 @@
try {
///////////////////////////////////////////////
- std::wcerr << L"Attempting to join non-existant Federation" <<
std::endl;
+ std::wcerr << L"Attempting to join non-existent Federation" <<
std::endl;
fedHandle =
rtiAmb->joinFederationExecution(L"TestFederateName", L"TestFederationName",
*this);
///////////////////////////////////////////////
std::wcerr << L"06N " << L"Fail: Could join federation that
should not exist yet." << std::endl;
@@ -104,7 +104,7 @@
} catch (rti1516::FederationExecutionDoesNotExist &e)
{
// expected
- std::wcerr << L"07E " << e.what() << L"(Pass: Could not join
non-existant federation)" << std::endl;
+ std::wcerr << L"07E " << e.what() << L"(Pass: Could not join
non-existent federation)" << std::endl;
} catch (rti1516::Exception &e)
{
std::wcerr << L"08N " << e.what() << std::endl;
Index: CMakeLists.txt
===================================================================
RCS file: /sources/certi/applications/HLA_TestsSuite/CMakeLists.txt,v
retrieving revision 1.42
retrieving revision 1.43
diff -u -b -r1.42 -r1.43
--- CMakeLists.txt 9 Nov 2010 12:47:05 -0000 1.42
+++ CMakeLists.txt 22 Nov 2010 21:05:23 -0000 1.43
@@ -206,6 +206,7 @@
HLATestsSuite_ADD_TEST(01-FederationExecutionTest
FED_FILE 01.xml 01.fed
SOURCE_FILES 01-FederationExecutionTest.cc
01-FederationExecutionTest.hh ReturnCodes.hh
+ DTEST_SCRIPT dtest_1516_01-FederationExecutionTest.py
COMMENTS "01-FederationExecutionTest (1516)"
HLA1516)
Index: dtest_1516_01-FederationExecutionTest.py
===================================================================
RCS file: dtest_1516_01-FederationExecutionTest.py
diff -N dtest_1516_01-FederationExecutionTest.py
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ dtest_1516_01-FederationExecutionTest.py 22 Nov 2010 21:05:22 -0000
1.1
@@ -0,0 +1,141 @@
+#!/usr/bin/env python
+
+##-----------------------------------------------------------------------
+##
+## HLA Tests Suite
+##
+## Copyright (c) 2006-2008 Eric NOULARD, Jean-Yves ROUSSELOT
+##
+## This library is free software; you can redistribute it and/or
+## modify it under the terms of the GNU Lesser General Public
+## License as published by the Free Software Foundation; either
+## version 2.1 of the License, or (at your option) any later version.
+##
+## This library is distributed in the hope that it will be useful,
+## but WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+## Lesser General Public License for more details.
+##
+## You should have received a copy of the GNU Lesser General Public
+## License along with this library; if not, write to the Free Software
+## Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+##
+##-----------------------------------------------------------------------
+
+import logging
+import os
+import time
+import threading
+import getopt, sys
+import dtest
+
+def usage():
+ print "Usage:\n %s [--help] [--certi_home=<path>]
--rtig=[[<user>@]<host>]:<rtig_path>
--federate=[[<user>@]<host>]:<federate_path>" % sys.argv[0]
+
+try:
+ opts, args = getopt.getopt(sys.argv[1:], "hr:f:c:", ["help","rtig=",
"federate=","certi_home="])
+except getopt.GetoptError, err:
+ print >> sys.stderr, "opt = %s, msg = %s" % (err.opt,err.msg)
+ usage()
+ sys.exit(2)
+
+## default values
+certi_home_defined=False
+rtig_param = dtest.Utils.getUserHostPath("rtig")
+federate_param = dtest.Utils.getUserHostPath("01-FederationExecutionTest")
+federate_param['fom']="01.xml"
+
+for o, a in opts:
+ if o in ("--help"):
+ usage()
+ sys.exit(2)
+ if o in ("-r", "--rtig"):
+ rtig_param = dtest.Utils.getUserHostPath(a)
+ if o in ("-f", "--federate"):
+ federate_param = dtest.Utils.getUserHostPath(a)
+ if o in ("-c", "--certi_home"):
+ certi_home = a
+ certi_home_defined=True
+
+if not certi_home_defined:
+ if os.environ.has_key("CERTI_HOME"):
+ certi_home=os.environ["CERTI_HOME"]
+ else:
+ print "You must define CERTI_HOME environment variable"
+ sys.exit(2)
+
+rtig = dtest.DTester("RTIG",
+
session=dtest.SSHSessionHandler(rtig_param['user'],host=rtig_param['host']))
+
+firstFederate = dtest.DTester("01-FederationExecutionTest",
+
session=dtest.SSHSessionHandler(federate_param['user'],host=federate_param['host']))
+
+# you may change the default time out value
+rtig.timeout = 40
+# you add want to save the output of your dtester to a file.
+rtig.stdout = file(rtig.name + ".out",'w+')
+rtig.stdin = file(rtig.name + ".in",'w+')
+rtig.stderr = file(rtig.name + ".err",'w+')
+
+# describe RTIG run steps
+rtig.addRunStep("ok",True,"HLA test 1516-01-FederationExecution Starts.")
+dtest.ReusableSequences.addConditionalRunShellScript(rtig,c_shell_cmd="source
"+certi_home+"/share/scripts/myCERTI_env.csh "+rtig_param['host'],
+ bourne_shell_cmd="source
"+certi_home+"/share/scripts/myCERTI_env.sh "+rtig_param['host'])
+rtig.addRunStep("runCommand",command=rtig_param['path'])
+rtig.addRunStep("expectFromCommand",pattern="CERTI RTIG up and
running",timeout=5)
+rtig.addRunStep("barrier","RTIG started")
+rtig.addRunStep("barrier","All Federate(s) ended")
+rtig.addRunStep("terminateCommand")
+rtig.addRunStep("waitCommandTermination")
+rtig.addRunStep("ok",True,"HLA test 1516-01-FederationExecution Ends.")
+
+#dtest.DTester.logger.setLevel(level=logging.DEBUG)
+
+# describe first federate run steps
+firstFederate.timeout = 20
+firstFederate.stdout = file(firstFederate.name + ".out",'w+')
+firstFederate.stdin = file(firstFederate.name + ".in",'w+')
+firstFederate.stderr = file(firstFederate.name + ".err",'w+')
+
+dtest.ReusableSequences.addConditionalRunShellScript(firstFederate,c_shell_cmd="source
"+certi_home+"/share/scripts/myCERTI_env.csh "+rtig_param['host'],
+ bourne_shell_cmd="source
"+certi_home+"/share/scripts/myCERTI_env.sh "+rtig_param['host'])
+firstFederate.addRunStep("barrier","RTIG started")
+
+firstFederate.addRunStep("runCommand",command=federate_param['path'])
+firstFederate.addRunStep("barrier","1516-01-FederationExecution Sequence
starts...")
+firstFederate.addRunStep("expectFromCommand",pattern="$")
+
+firstFederate.addRunStep("sendToCommand",string="\n")
+firstFederate.addRunStep("expectFromCommand",pattern="04E \(Pass: No
federation to destroy\).*")
+firstFederate.addRunStep("ok",firstFederate.getFutureLastStepStatus,"No
federation to destroy")
+
+firstFederate.addRunStep("sendToCommand",string="\n")
+firstFederate.addRunStep("expectFromCommand",pattern="07E \(Pass: Could not
join non-existent federation\).*")
+firstFederate.addRunStep("ok",firstFederate.getFutureLastStepStatus,"Could not
join non-existent federation")
+
+firstFederate.addRunStep("sendToCommand",string="\n")
+firstFederate.addRunStep("expectFromCommand",pattern="09E Pass: Created
federation.*")
+firstFederate.addRunStep("ok",firstFederate.getFutureLastStepStatus,"Created
federation")
+firstFederate.addRunStep("expectFromCommand",pattern="11E Pass: Joined
federation.*")
+firstFederate.addRunStep("ok",firstFederate.getFutureLastStepStatus,"Joined
federation")
+firstFederate.addRunStep("expectFromCommand",pattern="14E \(Pass: Could not
destroy federation while still joined\).*")
+firstFederate.addRunStep("ok",firstFederate.getFutureLastStepStatus,"Could not
destroy federation while still joined")
+firstFederate.addRunStep("expectFromCommand",pattern="16E Pass: Resigned from
federation.*")
+firstFederate.addRunStep("ok",firstFederate.getFutureLastStepStatus,"Resigned
from federation")
+firstFederate.addRunStep("expectFromCommand",pattern="18E Pass: Destroyed
federation.*")
+firstFederate.addRunStep("ok",firstFederate.getFutureLastStepStatus,"Destroyed
federation")
+
+firstFederate.addRunStep("barrier","1516-01-FederationExecution Sequence end.")
+firstFederate.addRunStep("terminateCommand")
+firstFederate.addRunStep("barrier","All Federate(s) ended")
+
+def goTest():
+ myDTestMaster = dtest.DTestMaster("HLA test
1516-01-FederationExecution","Launch RTIG + 1516-Create/Destroy/Join/Resign
FederationExecution,...")
+ myDTestMaster.timeout = 40
+ myDTestMaster.register(rtig)
+ myDTestMaster.register(firstFederate)
+ myDTestMaster.startTestSequence()
+ myDTestMaster.waitTestSequenceEnd()
+
+goTest()
+
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [certi-cvs] applications/HLA_TestsSuite 01-FederationExecut...,
certi-cvs <=