certi-cvs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[certi-cvs] applications/HLA_TestsSuite CMakeLists.txt dtes...


From: certi-cvs
Subject: [certi-cvs] applications/HLA_TestsSuite CMakeLists.txt dtes...
Date: Tue, 21 Apr 2009 14:40:43 +0000

CVSROOT:        /sources/certi
Module name:    applications
Changes by:     Pierre Siron <siron>    09/04/21 14:40:43

Modified files:
        HLA_TestsSuite : CMakeLists.txt 
Added files:
        HLA_TestsSuite : dtest_Interactive_Federate.py 

Log message:
        Add Interactive Federate test
        Test is incomplete...TBC

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/applications/HLA_TestsSuite/CMakeLists.txt?cvsroot=certi&r1=1.27&r2=1.28
http://cvs.savannah.gnu.org/viewcvs/applications/HLA_TestsSuite/dtest_Interactive_Federate.py?cvsroot=certi&rev=1.1

Patches:
Index: CMakeLists.txt
===================================================================
RCS file: /sources/certi/applications/HLA_TestsSuite/CMakeLists.txt,v
retrieving revision 1.27
retrieving revision 1.28
diff -u -b -r1.27 -r1.28
--- CMakeLists.txt      6 Nov 2008 22:13:11 -0000       1.27
+++ CMakeLists.txt      21 Apr 2009 14:40:43 -0000      1.28
@@ -167,6 +167,7 @@
 HLATestsSuite_ADD_TEST(Interactive_Federate
                       FED_FILE Interactive_Federation.fed
                       SOURCE_FILES Interactive_Federate.cc
+                      DTEST_SCRIPT dtest_Interactive_Federate.py
                       COMMENTS "A multi-purpose test interactive Federate")
 
 #########################################################################

Index: dtest_Interactive_Federate.py
===================================================================
RCS file: dtest_Interactive_Federate.py
diff -N dtest_Interactive_Federate.py
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ dtest_Interactive_Federate.py       21 Apr 2009 14:40:43 -0000      1.1
@@ -0,0 +1,168 @@
+#!/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("Interactive_Federate")
+federate_param['fom']="Interactive_Federation.fed"
+    
+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("Interactive_First",
+                               
session=dtest.SSHSessionHandler(federate_param['user'],host=federate_param['host']))
+
+otherFederate = dtest.DTester("Interactive_Second",
+                               
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 test_Sync 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 Interactive Federate 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+')
+firstFederate.addRunStep("barrier","RTIG started")
+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("runCommand",command=federate_param['path']+" 
"+firstFederate.name)
+firstFederate.addRunStep("expectFromCommand",pattern="Voulez-vous un preambule 
automatique.*")
+firstFederate.addRunStep("ok",firstFederate.getFutureLastStepStatus,"First 
Federate started and has joined federation")
+firstFederate.addRunStep("sendToCommand",string="y\n")
+firstFederate.addRunStep("barrier","Wait others...")
+
+firstFederate.addRunStep("expectFromCommand",pattern="Choisissez une action :")
+firstFederate.addRunStep("ok",firstFederate.getFutureLastStepStatus,"ACTION"+firstFederate.name)
+firstFederate.addRunStep("sendToCommand",string="rfe\n")
+firstFederate.addRunStep("expectFromCommand",pattern="federation quittee")
+firstFederate.addRunStep("ok",firstFederate.getFutureLastStepStatus,firstFederate.name+"
 has quit federation")
+
+firstFederate.addRunStep("barrier","Wait before DFE")
+
+firstFederate.addRunStep("expectFromCommand",pattern="Choisissez une action :")
+firstFederate.addRunStep("sendToCommand",string="dfe\n")
+firstFederate.addRunStep("expectFromCommand",pattern="federation detruite")
+firstFederate.addRunStep("ok",firstFederate.getFutureLastStepStatus,firstFederate.name+"
 has quit federation")
+
+firstFederate.addRunStep("expectFromCommand",pattern="RTIA:: End execution.")
+firstFederate.addRunStep("sendToCommand",string="q\n")
+
+firstFederate.addRunStep("terminateCommand")
+firstFederate.addRunStep("barrier","All Federate(s) ended")
+
+# other federate
+otherFederate.timeout = 20
+otherFederate.stdout  = file(otherFederate.name + ".out",'w+')
+otherFederate.stdin   = file(otherFederate.name + ".in",'w+')
+otherFederate.stderr  = file(otherFederate.name + ".err",'w+')
+otherFederate.addRunStep("barrier","RTIG started")
+
+dtest.ReusableSequences.addConditionalRunShellScript(otherFederate,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'])
+otherFederate.addRunStep("runCommand",command=federate_param['path']+" 
"+otherFederate.name)
+otherFederate.addRunStep("expectFromCommand",pattern="Voulez-vous un preambule 
automatique.*")
+otherFederate.addRunStep("ok",firstFederate.getFutureLastStepStatus,"Second 
Federate started and has joined federation")
+otherFederate.addRunStep("sendToCommand",string="y\n")
+otherFederate.addRunStep("barrier","Wait others...")
+
+otherFederate.addRunStep("expectFromCommand",pattern="Choisissez une action :")
+otherFederate.addRunStep("ok",firstFederate.getFutureLastStepStatus,"ACTION"+firstFederate.name)
+otherFederate.addRunStep("sendToCommand",string="rfe\n")
+otherFederate.addRunStep("expectFromCommand",pattern="federation quittee")
+otherFederate.addRunStep("ok",firstFederate.getFutureLastStepStatus,firstFederate.name+"
 has quit federation")
+
+otherFederate.addRunStep("barrier","Wait before DFE")
+
+otherFederate.addRunStep("sendToCommand",string="q\n")
+
+otherFederate.addRunStep("terminateCommand")
+otherFederate.addRunStep("barrier","All Federate(s) ended")
+
+def goTest():
+    myDTestMaster = dtest.DTestMaster("HLA test Interactive Federate 
Starts","Launch RTIG + two interactive federates for testing ...")
+    myDTestMaster.timeout = 40
+    myDTestMaster.register(rtig)
+    myDTestMaster.register(firstFederate)
+    myDTestMaster.register(otherFederate)
+    myDTestMaster.startTestSequence()
+    myDTestMaster.waitTestSequenceEnd()
+    
+goTest()
+




reply via email to

[Prev in Thread] Current Thread [Next in Thread]