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 HLA_...


From: certi-cvs
Subject: [certi-cvs] applications/HLA_TestsSuite CMakeLists.txt HLA_...
Date: Tue, 06 May 2008 14:29:49 +0000

CVSROOT:        /sources/certi
Module name:    applications
Changes by:     Eric NOULARD <erk>      08/05/06 14:29:49

Modified files:
        HLA_TestsSuite : CMakeLists.txt HLA_TestsSuite_DESCRIPTION.txt 
                         HLATestsSuiteTools.cmake 
Added files:
        HLA_TestsSuite : dtest_create_destroy.py 

Log message:
        Add first example of dtest script

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/applications/HLA_TestsSuite/CMakeLists.txt?cvsroot=certi&r1=1.9&r2=1.10
http://cvs.savannah.gnu.org/viewcvs/applications/HLA_TestsSuite/HLA_TestsSuite_DESCRIPTION.txt?cvsroot=certi&r1=1.1&r2=1.2
http://cvs.savannah.gnu.org/viewcvs/applications/HLA_TestsSuite/HLATestsSuiteTools.cmake?cvsroot=certi&r1=1.1&r2=1.2
http://cvs.savannah.gnu.org/viewcvs/applications/HLA_TestsSuite/dtest_create_destroy.py?cvsroot=certi&rev=1.1

Patches:
Index: CMakeLists.txt
===================================================================
RCS file: /sources/certi/applications/HLA_TestsSuite/CMakeLists.txt,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -b -r1.9 -r1.10
--- CMakeLists.txt      5 May 2008 11:33:52 -0000       1.9
+++ CMakeLists.txt      6 May 2008 14:29:48 -0000       1.10
@@ -107,7 +107,9 @@
 #########################################################################
 HLATestsSuite_ADD_TEST(create_destroy
                        FED_FILE create_destroy.fed
-                       SOURCE_FILES create_destroy.cc create_destroy.hh)
+                       SOURCE_FILES create_destroy.cc create_destroy.hh
+                       DTEST_SCRIPT dtest_create_destroy.py
+                       COMMENTS "A nice test from JYR")
 
 #########################################################################
 # ADD TEST FedTime PROGRAM
@@ -138,5 +140,4 @@
 
 
 
-
 MESSAGE(STATUS "*** ${CMAKE_PROJECT_NAME} has been successfully configured 
***")

Index: HLA_TestsSuite_DESCRIPTION.txt
===================================================================
RCS file: 
/sources/certi/applications/HLA_TestsSuite/HLA_TestsSuite_DESCRIPTION.txt,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -b -r1.1 -r1.2
--- HLA_TestsSuite_DESCRIPTION.txt      27 Apr 2008 13:16:41 -0000      1.1
+++ HLA_TestsSuite_DESCRIPTION.txt      6 May 2008 14:29:49 -0000       1.2
@@ -1,8 +1,8 @@
-HLA_TestsSuite is a set of [possibly] small program which may be used to HLA 
+HLA_TestsSuite is a set of [possibly] small programs which may be used to HLA 
 conformance testing.
 The set of test programs are provided by many CERTI developers and contributors
 see https://savannah.nongnu.org/projects.
 
 We are currently far away for full conformance testing suite but with the help 
-of the community we may end-up with a full test suite which may be suitable 
for 
+of the community we may end-up with a full tests suite which may be suitable 
for 
 CERTI conformance and non-regression tests and may be for any RTI.
\ No newline at end of file

Index: HLATestsSuiteTools.cmake
===================================================================
RCS file: /sources/certi/applications/HLA_TestsSuite/HLATestsSuiteTools.cmake,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -b -r1.1 -r1.2
--- HLATestsSuiteTools.cmake    3 May 2008 10:22:43 -0000       1.1
+++ HLATestsSuiteTools.cmake    6 May 2008 14:29:49 -0000       1.2
@@ -1,13 +1,16 @@
 
 INCLUDE(MacroTools.cmake)
+ENABLE_TESTING()
 
 MACRO(HLATestsSuite_ADD_TEST)
-    PARSE_ARGUMENTS(HLATSTools "FED_FILE;SOURCE_FILES" "VERBOSE" ${ARGN})      
    
+    PARSE_ARGUMENTS(HLATSTools "FED_FILE;SOURCE_FILES;DTEST_SCRIPT;COMMENTS" 
"VERBOSE" ${ARGN})          
     CAR(TESTNAME ${HLATSTools_DEFAULT_ARGS})       
     MESSAGE(STATUS "Configuring HLA Test: ${TESTNAME}")
     IF (HLATSTools_VERBOSE)     
        MESSAGE(STATUS "       FED_FILE = ${HLATSTools_FED_FILE}")
        MESSAGE(STATUS "   SOURCE_FILES = ${HLATSTools_SOURCE_FILES}")
+       MESSAGE(STATUS "   DTEST_SCRIPT = ${HLATSTools_DTEST_SCRIPT}")
+       MESSAGE(STATUS "       COMMENTS = ${HLATSTools_COMMENTS}")
     ENDIF(HLATSTools_VERBOSE)
     ADD_EXECUTABLE(${TESTNAME} ${HLATSTools_SOURCE_FILES})    
     TARGET_LINK_LIBRARIES (${TESTNAME} ${CERTI_LIBRARIES})    
@@ -15,4 +18,7 @@
             RUNTIME DESTINATION bin)
     INSTALL(FILES ${HLATSTools_FED_FILE}
             DESTINATION share/federations)
+    IF(HLATSTools_DTEST_SCRIPT)
+        ADD_TEST(${TESTNAME} ${HLATSTools_DTEST_SCRIPT}) 
+    ENDIF(HLATSTools_DTEST_SCRIPT)
 ENDMACRO(HLATestsSuite_ADD_TEST)

Index: dtest_create_destroy.py
===================================================================
RCS file: dtest_create_destroy.py
diff -N dtest_create_destroy.py
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ dtest_create_destroy.py     6 May 2008 14:29:48 -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]
+
+def getUserHostPath(argument):
+    if argument.find("@") != -1:
+        (user,argument) = argument.split("@",1)
+    else:
+        user = os.environ["USER"]
+    if argument.find(":") != -1:
+        (host,path) = argument.split(":",1)
+    else:
+        host = "localhost"
+        path = argument
+    retval = dict()
+    retval['user'] = user
+    retval['host'] = host
+    retval['path'] = path
+    return retval
+
+try:
+    opts, args = getopt.getopt(sys.argv[1:], "hr:f:c:d:", ["help","rtig=", 
"federate=","certi_home=","display="])
+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
+display=":0.0"
+rtig_param = getUserHostPath("rtig")
+federate_param = getUserHostPath("create_destroy")
+federate_param['fom']="create_destroy.fed"
+    
+for o, a in opts:
+    if o in ("--help"):
+            usage()
+            sys.exit(2)
+    if o in ("-r", "--rtig"):
+        rtig_param   = getUserHostPath(a)
+    if o in ("-f", "--federate"):
+        federate_param = getUserHostPath(a)
+    if o in ("-c", "--certi_home"):
+        certi_home = a
+        certi_home_defined=True
+    if o in ("--display"):
+        display = a;
+        
+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("create_destroy",
+                               
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 create_destroy Starts.")
+rtig.addRunStep("runCommand",command=". 
"+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 create_destroy Ends.")
+
+# describe billard 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")
+firstFederate.addRunStep("runCommand",command=". 
"+certi_home+"/share/scripts/myCERTI_env.sh "+rtig_param['host'])
+firstFederate.addRunStep("runCommand",command="export DISPLAY="+display)
+firstFederate.addRunStep("runCommand",command=federate_param['path']+" 
"+firstFederate.name)
+firstFederate.addRunStep("expectFromCommand",pattern="Do you want to change 
Federation name or fed file .* \[y/n\]")
+firstFederate.addRunStep("barrier","First Federate started")
+firstFederate.addRunStep("sendToCommand",string="n\n")
+firstFederate.addRunStep("expectFromCommand",pattern="STEP 1 COMPLETED")
+firstFederate.addRunStep("ok",firstFederate.getFutureLastStepStatus,"Sequence 
begins...")
+firstFederate.addRunStep("expectFromCommand",pattern="Do you want to make one 
or more creation federation execution .* :")
+firstFederate.addRunStep("sendToCommand",string="y\n")
+firstFederate.addRunStep("expectFromCommand",pattern="Do you want to try 
another federation execution creation .* \[y/n\]")
+firstFederate.addRunStep("sendToCommand",string="n\n")
+firstFederate.addRunStep("expectFromCommand",pattern="STEP 2 COMPLETED")
+firstFederate.addRunStep("ok",firstFederate.getFutureLastStepStatus,"Federation
 Created")
+firstFederate.addRunStep("barrier","All Federate(s) started")
+
+firstFederate.addRunStep("expectFromCommand",pattern="Do you want to join 
federation with federate .* \[y/n\]")
+firstFederate.addRunStep("sendToCommand",string="y\n")
+firstFederate.addRunStep("expectFromCommand",pattern="Federation joined")
+firstFederate.addRunStep("expectFromCommand",pattern="STEP 3 COMPLETED")
+firstFederate.addRunStep("ok",firstFederate.getFutureLastStepStatus,"Federation
 joined")
+firstFederate.addRunStep("expectFromCommand",pattern="Do you want to do save 
federation step .* \[y/n\]")
+firstFederate.addRunStep("sendToCommand",string="n\n")
+firstFederate.addRunStep("ok",firstFederate.getFutureLastStepStatus,"Save 
Federation", skip="not done")
+firstFederate.addRunStep("expectFromCommand",pattern="Do you want to do 
restore federation step .* \[y/n\]")
+firstFederate.addRunStep("sendToCommand",string="n\n")
+firstFederate.addRunStep("ok",firstFederate.getFutureLastStepStatus,"Restore 
Federation", skip="not done")
+firstFederate.addRunStep("expectFromCommand",pattern="Do you want to work on 
objects .* \[y/n\]")
+firstFederate.addRunStep("sendToCommand",string="n\n")
+firstFederate.addRunStep("ok",firstFederate.getFutureLastStepStatus,"Dance 
with objects", skip="not done")
+firstFederate.addRunStep("expectFromCommand",pattern="Do you want to resign 
federation .* \[y/n\]")
+firstFederate.addRunStep("sendToCommand",string="y\n")
+firstFederate.addRunStep("expectFromCommand",pattern="federation quittee")
+firstFederate.addRunStep("ok",firstFederate.getFutureLastStepStatus,"Resigned 
from Federation")
+firstFederate.addRunStep("expectFromCommand",pattern="Do you want to destroy 
federation .* \[y/n\]")
+firstFederate.addRunStep("sendToCommand",string="y\n")
+firstFederate.addRunStep("expectFromCommand",pattern="federation detruite")
+firstFederate.addRunStep("ok",firstFederate.getFutureLastStepStatus,"Federation
 destroyed")
+firstFederate.addRunStep("expectFromCommand",pattern="Do you want to do loop 
create-join-resign-destroy 2 times .* \[y/n\]")
+firstFederate.addRunStep("sendToCommand",string="n\n")
+firstFederate.addRunStep("terminateCommand")
+firstFederate.addRunStep("barrier","All Federate(s) ended")
+
+def goTest():
+    myDTestMaster = dtest.DTestMaster("HLA test create_destroy Starts","Launch 
RTIG + one create_destroy federate for testing create,destroy,...")
+    myDTestMaster.timeout = 40
+    myDTestMaster.register(rtig)
+    myDTestMaster.register(firstFederate) 
+    myDTestMaster.startTestSequence()
+    myDTestMaster.waitTestSequenceEnd()
+    
+goTest()
+




reply via email to

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