certi-cvs
[Top][All Lists]
Advanced

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

[certi-cvs] applications/HLA_TestsSuite test_TRTCCallbacks....


From: certi-cvs
Subject: [certi-cvs] applications/HLA_TestsSuite test_TRTCCallbacks....
Date: Fri, 16 Oct 2009 16:32:13 +0000

CVSROOT:        /sources/certi
Module name:    applications
Changes by:     Eric NOULARD <erk>      09/10/16 16:32:12

Modified files:
        HLA_TestsSuite : test_TRTCCallbacks.cc 
                         dtest_test_TRTCCallbacks-withLateFederate.py 
                         dtest_test_TRTCCallbacks.py 

Log message:
        The current test method is not sufficient I should find a way
        to make the first federate stall until the second join the federation.

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/applications/HLA_TestsSuite/test_TRTCCallbacks.cc?cvsroot=certi&r1=1.6&r2=1.7
http://cvs.savannah.gnu.org/viewcvs/applications/HLA_TestsSuite/dtest_test_TRTCCallbacks-withLateFederate.py?cvsroot=certi&r1=1.2&r2=1.3
http://cvs.savannah.gnu.org/viewcvs/applications/HLA_TestsSuite/dtest_test_TRTCCallbacks.py?cvsroot=certi&r1=1.2&r2=1.3

Patches:
Index: test_TRTCCallbacks.cc
===================================================================
RCS file: /sources/certi/applications/HLA_TestsSuite/test_TRTCCallbacks.cc,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -b -r1.6 -r1.7
--- test_TRTCCallbacks.cc       15 Oct 2009 20:56:51 -0000      1.6
+++ test_TRTCCallbacks.cc       16 Oct 2009 16:32:12 -0000      1.7
@@ -100,6 +100,8 @@
                        nbTARstepsToDo--;
                }
 
+               cout << "Press ENTER to STOP execution ..." << endl;
+               getchar();
                this->resign_and_destroy();
                return 0;
        };
@@ -172,7 +174,7 @@
                        RTI::FederateInternalError) {
                TIME_ADVANCE_GRANT = true;
                mytime = newTime;
-               cout << "TIME_ADVANCE_GRANT" << endl;
+               cout << "TIME_ADVANCE_GRANT = "<< mytime.getTime() << endl;
        }
 
 private:
@@ -382,6 +384,7 @@
 
        void
        advanceTime(const RTIfedTime& time) {
+               unsigned long tick=0;
                try {
                        rtiamb.timeAdvanceRequest(time);
                } catch ( RTI::Exception &e ) {
@@ -390,7 +393,11 @@
                } catch ( ... ) {
                        cerr << "Error: unknown non-RTI exception." << endl;
                }
-               while (!TIME_ADVANCE_GRANT) this->tickRTI();
+               while (!TIME_ADVANCE_GRANT) {
+                       this->tickRTI(0.1,0.0);
+                       tick++;
+               }
+               cout << "Ticked <"<<tick<<"> times." << endl;
                TIME_ADVANCE_GRANT = false;
                getchar();
        }
@@ -402,7 +409,7 @@
                        RTI::EnableTimeRegulationWasNotPending,
                        RTI::FederateInternalError) {
                cout << "Time Regulation Enabled, press ENTER to continue..." 
<< endl;
-               cout << static_cast<RTIfedTime>(theTime).getTime() << endl;
+               cout << "TRE = " << static_cast<RTIfedTime>(theTime).getTime() 
<< " =" << endl;
                TIME_REGULATION_ENABLED = true;
                getchar();
        }
@@ -413,7 +420,7 @@
                        RTI::EnableTimeConstrainedWasNotPending,
                        RTI::FederateInternalError) {
                cout << "Time Constrained Enabled, press ENTER to continue..." 
<< endl;
-               cout << static_cast<RTIfedTime>(theTime).getTime() << endl;
+               cout << "TCE = " << static_cast<RTIfedTime>(theTime).getTime() 
<< " = "<< endl;
                TIME_CONSTRAINED_ENABLED = true;
                getchar();
        }

Index: dtest_test_TRTCCallbacks-withLateFederate.py
===================================================================
RCS file: 
/sources/certi/applications/HLA_TestsSuite/dtest_test_TRTCCallbacks-withLateFederate.py,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -b -r1.2 -r1.3
--- dtest_test_TRTCCallbacks-withLateFederate.py        15 Oct 2009 21:08:20 
-0000      1.2
+++ dtest_test_TRTCCallbacks-withLateFederate.py        16 Oct 2009 16:32:12 
-0000      1.3
@@ -121,11 +121,10 @@
 
firstFederate.addRunStep("ok",firstFederate.getFutureLastStepStatus,"TimeConstrainedEnabled
 received - "+firstFederate.name)
 firstFederate.addRunStep("sendToCommand",string="\n")
 
-for i in range(1,firstFederate.nbTAR-1):
+for i in range(0,firstFederate.nbTAR-1):
     firstFederate.addRunStep("expectFromCommand",pattern="TIME_ADVANCE_GRANT")
     firstFederate.addRunStep("ok",firstFederate.getFutureLastStepStatus,"TAG 
received - "+firstFederate.name)
     firstFederate.addRunStep("sendToCommand",string="\n")
-    time.sleep(1)
 
 firstFederate.addRunStep("barrier","Waiting lateFederate")
 firstFederate.addRunStep("barrier","Going on")
@@ -133,19 +132,23 @@
 firstFederate.addRunStep("ok",firstFederate.getFutureLastStepStatus,"TAG 
received - "+firstFederate.name)
 firstFederate.addRunStep("sendToCommand",string="\n")
         
+firstFederate.addRunStep("expectFromCommand",pattern="Press ENTER to STOP 
execution")
+firstFederate.addRunStep("sendToCommand",string="\n")
+        
 firstFederate.addRunStep("barrier","TRTC Sequence end.")
 firstFederate.addRunStep("terminateCommand")
 firstFederate.addRunStep("barrier","All Federate(s) ended")
 
 # describe late federate run steps
 lateFederate.timeout = 20
-lateFederate.nbTAR   = 5
+lateFederate.nbTAR   = firstFederate.nbTAR
 lateFederate.stdout  = file(lateFederate.name + ".out",'w+')
 lateFederate.stdin   = file(lateFederate.name + ".in",'w+')
 lateFederate.stderr  = file(lateFederate.name + ".err",'w+')
 lateFederate.addRunStep("barrier","RTIG started")
 
dtest.ReusableSequences.addConditionalRunShellScript(lateFederate,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'])
+lateFederate.addRunStep("runCommand",command="sleep 10")
 lateFederate.addRunStep("barrier","Waiting lateFederate")
 lateFederate.addRunStep("runCommand",command=federate_param['path'] + " 
"+str(lateFederate.nbTAR))
 lateFederate.addRunStep("expectFromCommand",pattern="Joined federation.*")
@@ -161,12 +164,13 @@
 
 lateFederate.addRunStep("barrier","Going on")
 
-for i in range(1,lateFederate.nbTAR):
+for i in range(0,lateFederate.nbTAR):
     lateFederate.addRunStep("expectFromCommand",pattern="TIME_ADVANCE_GRANT")
     lateFederate.addRunStep("ok",lateFederate.getFutureLastStepStatus,"TAG 
received - "+lateFederate.name)
     lateFederate.addRunStep("sendToCommand",string="\n")
-    time.sleep(1)
         
+lateFederate.addRunStep("expectFromCommand",pattern="Press ENTER to STOP 
execution")
+lateFederate.addRunStep("sendToCommand",string="\n")        
 lateFederate.addRunStep("barrier","TRTC Sequence end.")
 lateFederate.addRunStep("terminateCommand")
 lateFederate.addRunStep("barrier","All Federate(s) ended")

Index: dtest_test_TRTCCallbacks.py
===================================================================
RCS file: 
/sources/certi/applications/HLA_TestsSuite/dtest_test_TRTCCallbacks.py,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -b -r1.2 -r1.3
--- dtest_test_TRTCCallbacks.py 19 Jun 2008 11:11:53 -0000      1.2
+++ dtest_test_TRTCCallbacks.py 16 Oct 2009 16:32:12 -0000      1.3
@@ -117,6 +117,9 @@
 
firstFederate.addRunStep("ok",firstFederate.getFutureLastStepStatus,"TimeConstrainedEnabled
 received - "+firstFederate.name)
 firstFederate.addRunStep("sendToCommand",string="\n")
 
+firstFederate.addRunStep("expectFromCommand",pattern="Press ENTER to STOP 
execution")
+firstFederate.addRunStep("sendToCommand",string="\n")
+
 firstFederate.addRunStep("barrier","TRTC Sequence end.")
 firstFederate.addRunStep("terminateCommand")
 firstFederate.addRunStep("barrier","All Federate(s) ended")




reply via email to

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