[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[certi-cvs] applications/HLA_TestsSuite CMakeLists.txt test...
From: |
certi-cvs |
Subject: |
[certi-cvs] applications/HLA_TestsSuite CMakeLists.txt test... |
Date: |
Tue, 21 Oct 2008 11:38:37 +0000 |
CVSROOT: /sources/certi
Module name: applications
Changes by: Eric NOULARD <erk> 08/10/21 11:38:37
Modified files:
HLA_TestsSuite : CMakeLists.txt test_FOMParse.cc
Added files:
HLA_TestsSuite : dtest_test_FOMParse.py
Log message:
Add a working dtest script
CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/applications/HLA_TestsSuite/CMakeLists.txt?cvsroot=certi&r1=1.23&r2=1.24
http://cvs.savannah.gnu.org/viewcvs/applications/HLA_TestsSuite/test_FOMParse.cc?cvsroot=certi&r1=1.3&r2=1.4
http://cvs.savannah.gnu.org/viewcvs/applications/HLA_TestsSuite/dtest_test_FOMParse.py?cvsroot=certi&rev=1.1
Patches:
Index: CMakeLists.txt
===================================================================
RCS file: /sources/certi/applications/HLA_TestsSuite/CMakeLists.txt,v
retrieving revision 1.23
retrieving revision 1.24
diff -u -b -r1.23 -r1.24
--- CMakeLists.txt 21 Oct 2008 11:12:31 -0000 1.23
+++ CMakeLists.txt 21 Oct 2008 11:38:36 -0000 1.24
@@ -187,6 +187,7 @@
HLATestsSuite_ADD_TEST(test_FOMParse
FED_FILE TestFed.fed BuggyFed.fed
SOURCE_FILES test_FOMParse.cc test_FOMParse_cmdline.h
test_FOMParse_cmdline.c
+ DTEST_SCRIPT dtest_test_FOMParse.py
COMMENTS "A FOM parsing test")
MESSAGE(STATUS "*** ${CMAKE_PROJECT_NAME} has been successfully configured
***")
Index: test_FOMParse.cc
===================================================================
RCS file: /sources/certi/applications/HLA_TestsSuite/test_FOMParse.cc,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -b -r1.3 -r1.4
--- test_FOMParse.cc 21 Oct 2008 10:30:34 -0000 1.3
+++ test_FOMParse.cc 21 Oct 2008 11:38:37 -0000 1.4
@@ -52,6 +52,9 @@
try {
myRTIamb.createFederationExecution(federationName.c_str(),
federationFile.c_str());
+ if (verbose) {
+ cout << "createFederationExecution SUCCESS." <<
endl;
+ }
} catch ( RTI::FederationExecutionAlreadyExists& e) {
cout << "--> Federation already created by another
federate." << endl;
} catch ( RTI::Exception &e ) {
@@ -85,7 +88,7 @@
federationName.c_str(),
this);
if (verbose) {
- cout << "Done." << endl;
+ cout << "SUCCESS." << endl;
}
} catch (RTI::FederateAlreadyExecutionMember& e) {
cerr << "Federate already execution member" << endl;
@@ -105,7 +108,7 @@
}
myRTIamb.resignFederationExecution(RTI::DELETE_OBJECTS_AND_RELEASE_ATTRIBUTES);
if (verbose) {
- cout << "Done." << endl;
+ cout << "SUCCESS." << endl;
}
} catch ( RTI::Exception &e ) {
cerr << "RTI exception: " << e._name << " ["
Index: dtest_test_FOMParse.py
===================================================================
RCS file: dtest_test_FOMParse.py
diff -N dtest_test_FOMParse.py
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ dtest_test_FOMParse.py 21 Oct 2008 11:38:37 -0000 1.1
@@ -0,0 +1,125 @@
+#!/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("test_FOMParse")
+federate_param['fom']="TestFed.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("test_FOMParse1",
+
session=dtest.SSHSessionHandler(federate_param['user'],host=federate_param['host']))
+
+otherFederate = dtest.DTester("test_FOMParse2",
+
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_FOMParse 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 test_Sync 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']+" -f
TestFed.fed -n TestFed -v -j \"FOMParse1\"")
+firstFederate.addRunStep("expectFromCommand",pattern="createFederationExecution
SUCCESS.*")
+firstFederate.addRunStep("ok",firstFederate.getFutureLastStepStatus,"Federation
created")
+firstFederate.addRunStep("expectFromCommand",pattern="join federation
as.*SUCCESS")
+firstFederate.addRunStep("ok",firstFederate.getFutureLastStepStatus,"Federation
joined")
+firstFederate.addRunStep("expectFromCommand",pattern="resign from
federation.*SUCCESS")
+firstFederate.addRunStep("ok",firstFederate.getFutureLastStepStatus,"resigned
from Federation")
+firstFederate.addRunStep("terminateCommand")
+firstFederate.addRunStep("barrier","All Federate(s) ended")
+
+
+def goTest():
+ myDTestMaster = dtest.DTestMaster("HLA test test_FOMParse Starts","Launch
RTIG + test_FOMParse federate for testing FOM file parsing.")
+ myDTestMaster.timeout = 40
+ myDTestMaster.register(rtig)
+ myDTestMaster.register(firstFederate)
+ myDTestMaster.startTestSequence()
+ myDTestMaster.waitTestSequenceEnd()
+
+goTest()
+