From 9ddc786acea1a950822fe2aed06c1877e0d54526 Mon Sep 17 00:00:00 2001 From: Alex Lin Date: Tue, 23 Feb 2016 16:19:30 -0600 Subject: [PATCH] Split test sims and fun sims into separate directories. Moved most of the rest of the sims to test. refs #191 --- .../SIM_alloc_test/RUN_test/input.py | 0 {trick_sims => test}/SIM_alloc_test/S_define | 2 +- test/SIM_alloc_test/S_overrides.mk | 4 ++ .../models}/allocation/include/AllocTest.hh | 0 .../RUN_test/checkpoint_reload.py | 0 .../SIM_dynamic_sim_object/RUN_test/input.py | 20 +++---- test/SIM_dynamic_sim_object/S_define | 24 ++++++++ .../SIM_dynamic_sim_object}/S_overrides.mk | 0 .../SIM_dynamic_sim_object/Title | 0 .../SIM_leaks/RUN_test/input.py | 0 {trick_sims => test}/SIM_leaks/S_define | 1 - test/SIM_leaks/S_overrides.mk | 3 + .../SIM_leaks/models}/Leaker/Leaker.cpp | 11 ---- test/SIM_stls3/S_overrides.mk | 4 +- .../TrickSTL/include/TrickSTLCheckpoint.hh | 0 .../TrickSTL/src/TrickSTLCheckpoint.cpp | 0 .../Modified_data/vs_ASCII.dr | 0 .../SIM_test_varserv/RUN_test/realtime.py | 0 .../SIM_test_varserv/RUN_test/unit_test.py | 0 .../SIM_test_varserv/S_define | 14 ++--- test/SIM_test_varserv/S_overrides.mk | 4 ++ .../models}/varserv/include/VS.hh | 0 .../models}/varserv/src/VS.cpp | 0 .../models}/varserv/src/VS_commands.cpp | 0 .../models}/varserv/src/VS_default_data.cpp | 0 .../models}/varserv/src/VS_init.cpp | 0 .../models}/varserv/src/VS_shutdown.cpp | 0 .../models}/varserv/src/VS_tests.cpp | 0 .../models}/varserv/src/VS_unittests.cpp | 0 test/SIM_trickcomm/.gitignore | 1 + test/SIM_trickcomm/RUN_test/input.py | 3 + test/SIM_trickcomm/S_define | 56 ++++++++++++++++++ test/SIM_trickcomm/S_overrides.mk | 14 +++++ test/SIM_trickcomm/tc_server.c | 50 ++++++++++++++++ test/SIM_trickcomm/test_struct.h | 16 +++++ trick_sims/SIM_dynamic_sim_object/S_define | 38 ------------ .../SIM_dynamic_sim_object/S_overrides.mk | 4 -- trick_sims/SIM_leaks/S_overrides.mk | 3 - trick_sims/SIM_test_varserv/S_overrides.mk | 4 -- trick_sims/SIM_trickcomm/.gitignore | 4 -- .../SIM_trickcomm/Modified_data/cannon.dr | 17 ------ trick_sims/SIM_trickcomm/RUN_test/input.py | 7 --- trick_sims/SIM_trickcomm/S_define | 59 ------------------- trick_sims/SIM_trickcomm/S_overrides.mk | 17 ------ trick_sims/SIM_trickcomm/tc_client.c | 29 --------- trick_sims/SIM_trickcomm/tc_server.c | 32 ---------- trick_sims/makefile | 17 ++---- 47 files changed, 199 insertions(+), 259 deletions(-) rename {trick_sims => test}/SIM_alloc_test/RUN_test/input.py (100%) rename {trick_sims => test}/SIM_alloc_test/S_define (90%) create mode 100644 test/SIM_alloc_test/S_overrides.mk rename {trick_models/test => test/SIM_alloc_test/models}/allocation/include/AllocTest.hh (100%) rename {trick_sims => test}/SIM_dynamic_sim_object/RUN_test/checkpoint_reload.py (100%) rename {trick_sims => test}/SIM_dynamic_sim_object/RUN_test/input.py (60%) create mode 100644 test/SIM_dynamic_sim_object/S_define rename {trick_sims/SIM_alloc_test => test/SIM_dynamic_sim_object}/S_overrides.mk (100%) rename {trick_sims => test}/SIM_dynamic_sim_object/Title (100%) rename {trick_sims => test}/SIM_leaks/RUN_test/input.py (100%) rename {trick_sims => test}/SIM_leaks/S_define (95%) create mode 100644 test/SIM_leaks/S_overrides.mk rename {trick_models => test/SIM_leaks/models}/Leaker/Leaker.cpp (57%) rename {trick_models => test/SIM_stls3/models}/TrickSTL/include/TrickSTLCheckpoint.hh (100%) rename {trick_models => test/SIM_stls3/models}/TrickSTL/src/TrickSTLCheckpoint.cpp (100%) rename {trick_sims => test}/SIM_test_varserv/Modified_data/vs_ASCII.dr (100%) rename {trick_sims => test}/SIM_test_varserv/RUN_test/realtime.py (100%) rename {trick_sims => test}/SIM_test_varserv/RUN_test/unit_test.py (100%) rename {trick_sims => test}/SIM_test_varserv/S_define (72%) create mode 100644 test/SIM_test_varserv/S_overrides.mk rename {trick_models/test => test/SIM_test_varserv/models}/varserv/include/VS.hh (100%) rename {trick_models/test => test/SIM_test_varserv/models}/varserv/src/VS.cpp (100%) rename {trick_models/test => test/SIM_test_varserv/models}/varserv/src/VS_commands.cpp (100%) rename {trick_models/test => test/SIM_test_varserv/models}/varserv/src/VS_default_data.cpp (100%) rename {trick_models/test => test/SIM_test_varserv/models}/varserv/src/VS_init.cpp (100%) rename {trick_models/test => test/SIM_test_varserv/models}/varserv/src/VS_shutdown.cpp (100%) rename {trick_models/test => test/SIM_test_varserv/models}/varserv/src/VS_tests.cpp (100%) rename {trick_models/test => test/SIM_test_varserv/models}/varserv/src/VS_unittests.cpp (100%) create mode 100644 test/SIM_trickcomm/.gitignore create mode 100644 test/SIM_trickcomm/RUN_test/input.py create mode 100644 test/SIM_trickcomm/S_define create mode 100644 test/SIM_trickcomm/S_overrides.mk create mode 100644 test/SIM_trickcomm/tc_server.c create mode 100644 test/SIM_trickcomm/test_struct.h delete mode 100644 trick_sims/SIM_dynamic_sim_object/S_define delete mode 100644 trick_sims/SIM_dynamic_sim_object/S_overrides.mk delete mode 100644 trick_sims/SIM_leaks/S_overrides.mk delete mode 100644 trick_sims/SIM_test_varserv/S_overrides.mk delete mode 100644 trick_sims/SIM_trickcomm/.gitignore delete mode 100644 trick_sims/SIM_trickcomm/Modified_data/cannon.dr delete mode 100644 trick_sims/SIM_trickcomm/RUN_test/input.py delete mode 100644 trick_sims/SIM_trickcomm/S_define delete mode 100644 trick_sims/SIM_trickcomm/S_overrides.mk delete mode 100644 trick_sims/SIM_trickcomm/tc_client.c delete mode 100644 trick_sims/SIM_trickcomm/tc_server.c diff --git a/trick_sims/SIM_alloc_test/RUN_test/input.py b/test/SIM_alloc_test/RUN_test/input.py similarity index 100% rename from trick_sims/SIM_alloc_test/RUN_test/input.py rename to test/SIM_alloc_test/RUN_test/input.py diff --git a/trick_sims/SIM_alloc_test/S_define b/test/SIM_alloc_test/S_define similarity index 90% rename from trick_sims/SIM_alloc_test/S_define rename to test/SIM_alloc_test/S_define index 5d375fe0..63b0de6d 100644 --- a/trick_sims/SIM_alloc_test/S_define +++ b/test/SIM_alloc_test/S_define @@ -6,7 +6,7 @@ PURPOSE: #include "sim_objects/default_trick_sys.sm" -##include "test/allocation/include/AllocTest.hh" +##include "allocation/include/AllocTest.hh" class AllocTestSimObject : public Trick::SimObject { diff --git a/test/SIM_alloc_test/S_overrides.mk b/test/SIM_alloc_test/S_overrides.mk new file mode 100644 index 00000000..27536a3b --- /dev/null +++ b/test/SIM_alloc_test/S_overrides.mk @@ -0,0 +1,4 @@ + +TRICK_CFLAGS += -I./models +TRICK_CXXFLAGS += -I./models + diff --git a/trick_models/test/allocation/include/AllocTest.hh b/test/SIM_alloc_test/models/allocation/include/AllocTest.hh similarity index 100% rename from trick_models/test/allocation/include/AllocTest.hh rename to test/SIM_alloc_test/models/allocation/include/AllocTest.hh diff --git a/trick_sims/SIM_dynamic_sim_object/RUN_test/checkpoint_reload.py b/test/SIM_dynamic_sim_object/RUN_test/checkpoint_reload.py similarity index 100% rename from trick_sims/SIM_dynamic_sim_object/RUN_test/checkpoint_reload.py rename to test/SIM_dynamic_sim_object/RUN_test/checkpoint_reload.py diff --git a/trick_sims/SIM_dynamic_sim_object/RUN_test/input.py b/test/SIM_dynamic_sim_object/RUN_test/input.py similarity index 60% rename from trick_sims/SIM_dynamic_sim_object/RUN_test/input.py rename to test/SIM_dynamic_sim_object/RUN_test/input.py index cf2792e4..16c20379 100644 --- a/trick_sims/SIM_dynamic_sim_object/RUN_test/input.py +++ b/test/SIM_dynamic_sim_object/RUN_test/input.py @@ -4,7 +4,7 @@ def main(): trick.exec_add_sim_object(ball, "ball") # instead of using collect, we are using a class specific add_external_force # function that accepts a "double *" and is checkpointable. - ball.obj.state.add_external_force( ball.obj.force.output.force ) + #ball.obj.state.add_external_force( ball.obj.force.output.force ) # declare a new Integrator loop sim object my_integ_loop = trick.IntegLoopSimObject(0.01, 0, ball, None, TMMName="my_integ_loop") ; @@ -14,15 +14,15 @@ def main(): my_integ_loop.integ_sched.rebuild_jobs() # Data recording Ascii - drg0 = trick.DRAscii("Ball") - for param in [ 'position' , 'velocity' , 'acceleration' , 'external_force' ] : - for index in range(0,2) : - var = "ball.obj.state.output." + param + "[" + str(index) + "]" - drg0.add_variable(var) - drg0.set_cycle(0.01) - drg0.freq = trick.DR_Always - drg0.thisown = 0 - trick.add_data_record_group(drg0, trick.DR_Buffer) + #drg0 = trick.DRAscii("Ball") + #for param in [ 'position' , 'velocity' , 'acceleration' , 'external_force' ] : + # for index in range(0,2) : + # var = "ball.obj.state.output." + param + "[" + str(index) + "]" + # drg0.add_variable(var) + #drg0.set_cycle(0.01) + #drg0.freq = trick.DR_Always + #drg0.thisown = 0 + #trick.add_data_record_group(drg0, trick.DR_Buffer) trick.checkpoint(120.0) trick.stop(300.0) diff --git a/test/SIM_dynamic_sim_object/S_define b/test/SIM_dynamic_sim_object/S_define new file mode 100644 index 00000000..e473d00e --- /dev/null +++ b/test/SIM_dynamic_sim_object/S_define @@ -0,0 +1,24 @@ +/************************TRICK HEADER************************* +PURPOSE: + (blah blah blah) +LIBRARY DEPENDENCIES: + ( + ) +*************************************************************/ + +#include "sim_objects/default_trick_sys.sm" + +##include "sim_services/Integrator/include/integrator_c_intf.h" + +class ballSimObject : public Trick::SimObject { + + public: + + /** Constructor to add the jobs */ + ballSimObject() { + ("integration") trick_ret = integrate() ; + } +} ; + +// No instantiations made in this S_define file. They are made in the input file. + diff --git a/trick_sims/SIM_alloc_test/S_overrides.mk b/test/SIM_dynamic_sim_object/S_overrides.mk similarity index 100% rename from trick_sims/SIM_alloc_test/S_overrides.mk rename to test/SIM_dynamic_sim_object/S_overrides.mk diff --git a/trick_sims/SIM_dynamic_sim_object/Title b/test/SIM_dynamic_sim_object/Title similarity index 100% rename from trick_sims/SIM_dynamic_sim_object/Title rename to test/SIM_dynamic_sim_object/Title diff --git a/trick_sims/SIM_leaks/RUN_test/input.py b/test/SIM_leaks/RUN_test/input.py similarity index 100% rename from trick_sims/SIM_leaks/RUN_test/input.py rename to test/SIM_leaks/RUN_test/input.py diff --git a/trick_sims/SIM_leaks/S_define b/test/SIM_leaks/S_define similarity index 95% rename from trick_sims/SIM_leaks/S_define rename to test/SIM_leaks/S_define index 7c12f268..abfd236e 100644 --- a/trick_sims/SIM_leaks/S_define +++ b/test/SIM_leaks/S_define @@ -9,7 +9,6 @@ LIBRARY DEPENDENCIES: #include "sim_objects/default_trick_sys.sm" -##include "Ball++/L1/include/Ball.hh" %{ int Leaker() ; %} diff --git a/test/SIM_leaks/S_overrides.mk b/test/SIM_leaks/S_overrides.mk new file mode 100644 index 00000000..6ca9ea96 --- /dev/null +++ b/test/SIM_leaks/S_overrides.mk @@ -0,0 +1,3 @@ + +TRICK_CFLAGS += -I./models +TRICK_CXXFLAGS += -I./models diff --git a/trick_models/Leaker/Leaker.cpp b/test/SIM_leaks/models/Leaker/Leaker.cpp similarity index 57% rename from trick_models/Leaker/Leaker.cpp rename to test/SIM_leaks/models/Leaker/Leaker.cpp index 5bc5a1af..0308e7e4 100644 --- a/trick_models/Leaker/Leaker.cpp +++ b/test/SIM_leaks/models/Leaker/Leaker.cpp @@ -3,7 +3,6 @@ #include /* Model include files. */ -#include "Ball++/L1/include/Ball.hh" #include "sim_services/MemoryManager/include/memorymanager_c_intf.h" std::vector< int > dv ; @@ -12,30 +11,20 @@ std::vector< int > dv ; int Leaker() { int * i_malloc = (int *)malloc( sizeof(int) ) ; - Ball * b_malloc = (Ball *)malloc( sizeof(Ball) ) ; int * i_calloc = (int *)calloc( 1 , sizeof(int) ) ; - Ball * b_calloc = (Ball *)calloc( 1 , sizeof(Ball) ) ; #if 0 int * i_realloc = NULL ; - Ball * b_realloc = NULL ; i_realloc = (int *)realloc( i_realloc, sizeof(int) ) ; - b_realloc = (Ball *)realloc( b_realloc, sizeof(Ball) ) ; #endif int * i_new = new int ; - Ball * b_new = new Ball ; int * ia_new = new int[10] ; - Ball * ba_new = new Ball[10] ; char * str = strdup("hello") ; - Ball * b_tmms = (Ball *)TMM_declare_var_s("Ball") ; - Ball * b_tmm1d = (Ball *)TMM_declare_var_1d("Ball", 2) ; - Ball * b_tmmal = (Ball *)alloc_type(2, "Ball") ; - int ii ; for ( ii = 0 ; ii < 100 ; ii++ ) { dv.push_back(ii) ; diff --git a/test/SIM_stls3/S_overrides.mk b/test/SIM_stls3/S_overrides.mk index 334f50ed..1d1b5689 100644 --- a/test/SIM_stls3/S_overrides.mk +++ b/test/SIM_stls3/S_overrides.mk @@ -1,4 +1,4 @@ -TRICK_CFLAGS += -I${TRICK_HOME}/trick_models -TRICK_CXXFLAGS += -I${TRICK_HOME}/trick_models -std=c++11 +TRICK_CFLAGS += -I./models +TRICK_CXXFLAGS += -I./models -std=c++11 diff --git a/trick_models/TrickSTL/include/TrickSTLCheckpoint.hh b/test/SIM_stls3/models/TrickSTL/include/TrickSTLCheckpoint.hh similarity index 100% rename from trick_models/TrickSTL/include/TrickSTLCheckpoint.hh rename to test/SIM_stls3/models/TrickSTL/include/TrickSTLCheckpoint.hh diff --git a/trick_models/TrickSTL/src/TrickSTLCheckpoint.cpp b/test/SIM_stls3/models/TrickSTL/src/TrickSTLCheckpoint.cpp similarity index 100% rename from trick_models/TrickSTL/src/TrickSTLCheckpoint.cpp rename to test/SIM_stls3/models/TrickSTL/src/TrickSTLCheckpoint.cpp diff --git a/trick_sims/SIM_test_varserv/Modified_data/vs_ASCII.dr b/test/SIM_test_varserv/Modified_data/vs_ASCII.dr similarity index 100% rename from trick_sims/SIM_test_varserv/Modified_data/vs_ASCII.dr rename to test/SIM_test_varserv/Modified_data/vs_ASCII.dr diff --git a/trick_sims/SIM_test_varserv/RUN_test/realtime.py b/test/SIM_test_varserv/RUN_test/realtime.py similarity index 100% rename from trick_sims/SIM_test_varserv/RUN_test/realtime.py rename to test/SIM_test_varserv/RUN_test/realtime.py diff --git a/trick_sims/SIM_test_varserv/RUN_test/unit_test.py b/test/SIM_test_varserv/RUN_test/unit_test.py similarity index 100% rename from trick_sims/SIM_test_varserv/RUN_test/unit_test.py rename to test/SIM_test_varserv/RUN_test/unit_test.py diff --git a/trick_sims/SIM_test_varserv/S_define b/test/SIM_test_varserv/S_define similarity index 72% rename from trick_sims/SIM_test_varserv/S_define rename to test/SIM_test_varserv/S_define index 5b164c1b..fb85f3fc 100644 --- a/trick_sims/SIM_test_varserv/S_define +++ b/test/SIM_test_varserv/S_define @@ -2,18 +2,18 @@ PURPOSE: ( S_define ) LIBRARY DEPENDENCIES: ( - (test/varserv/src/VS.cpp) - (test/varserv/src/VS_init.cpp) - (test/varserv/src/VS_default_data.cpp) - (test/varserv/src/VS_commands.cpp) - (test/varserv/src/VS_tests.cpp) - (test/varserv/src/VS_shutdown.cpp) + (varserv/src/VS.cpp) + (varserv/src/VS_init.cpp) + (varserv/src/VS_default_data.cpp) + (varserv/src/VS_commands.cpp) + (varserv/src/VS_tests.cpp) + (varserv/src/VS_shutdown.cpp) ) *************************************************************/ #include "sim_objects/default_trick_sys.sm" -##include "test/varserv/include/VS.hh" +##include "varserv/include/VS.hh" class testSimObject : public Trick::SimObject { public: diff --git a/test/SIM_test_varserv/S_overrides.mk b/test/SIM_test_varserv/S_overrides.mk new file mode 100644 index 00000000..27536a3b --- /dev/null +++ b/test/SIM_test_varserv/S_overrides.mk @@ -0,0 +1,4 @@ + +TRICK_CFLAGS += -I./models +TRICK_CXXFLAGS += -I./models + diff --git a/trick_models/test/varserv/include/VS.hh b/test/SIM_test_varserv/models/varserv/include/VS.hh similarity index 100% rename from trick_models/test/varserv/include/VS.hh rename to test/SIM_test_varserv/models/varserv/include/VS.hh diff --git a/trick_models/test/varserv/src/VS.cpp b/test/SIM_test_varserv/models/varserv/src/VS.cpp similarity index 100% rename from trick_models/test/varserv/src/VS.cpp rename to test/SIM_test_varserv/models/varserv/src/VS.cpp diff --git a/trick_models/test/varserv/src/VS_commands.cpp b/test/SIM_test_varserv/models/varserv/src/VS_commands.cpp similarity index 100% rename from trick_models/test/varserv/src/VS_commands.cpp rename to test/SIM_test_varserv/models/varserv/src/VS_commands.cpp diff --git a/trick_models/test/varserv/src/VS_default_data.cpp b/test/SIM_test_varserv/models/varserv/src/VS_default_data.cpp similarity index 100% rename from trick_models/test/varserv/src/VS_default_data.cpp rename to test/SIM_test_varserv/models/varserv/src/VS_default_data.cpp diff --git a/trick_models/test/varserv/src/VS_init.cpp b/test/SIM_test_varserv/models/varserv/src/VS_init.cpp similarity index 100% rename from trick_models/test/varserv/src/VS_init.cpp rename to test/SIM_test_varserv/models/varserv/src/VS_init.cpp diff --git a/trick_models/test/varserv/src/VS_shutdown.cpp b/test/SIM_test_varserv/models/varserv/src/VS_shutdown.cpp similarity index 100% rename from trick_models/test/varserv/src/VS_shutdown.cpp rename to test/SIM_test_varserv/models/varserv/src/VS_shutdown.cpp diff --git a/trick_models/test/varserv/src/VS_tests.cpp b/test/SIM_test_varserv/models/varserv/src/VS_tests.cpp similarity index 100% rename from trick_models/test/varserv/src/VS_tests.cpp rename to test/SIM_test_varserv/models/varserv/src/VS_tests.cpp diff --git a/trick_models/test/varserv/src/VS_unittests.cpp b/test/SIM_test_varserv/models/varserv/src/VS_unittests.cpp similarity index 100% rename from trick_models/test/varserv/src/VS_unittests.cpp rename to test/SIM_test_varserv/models/varserv/src/VS_unittests.cpp diff --git a/test/SIM_trickcomm/.gitignore b/test/SIM_trickcomm/.gitignore new file mode 100644 index 00000000..e0f6536d --- /dev/null +++ b/test/SIM_trickcomm/.gitignore @@ -0,0 +1 @@ +tc_server diff --git a/test/SIM_trickcomm/RUN_test/input.py b/test/SIM_trickcomm/RUN_test/input.py new file mode 100644 index 00000000..31bb2909 --- /dev/null +++ b/test/SIM_trickcomm/RUN_test/input.py @@ -0,0 +1,3 @@ + +trick.real_time_enable() +trick.exec_set_terminate_time(5.0) diff --git a/test/SIM_trickcomm/S_define b/test/SIM_trickcomm/S_define new file mode 100644 index 00000000..87e27bb5 --- /dev/null +++ b/test/SIM_trickcomm/S_define @@ -0,0 +1,56 @@ +/************************TRICK HEADER************************* +PURPOSE: + ( This S_define is to be used with RUN_trickcomm input file ) +*************************************************************/ + +#include "sim_objects/default_trick_sys.sm" + +##include "test_struct.h" + +// Put an extern line for attrTEST_DATA_STRUCT in S_source.hh +// Don't let SWIG process the line +%header{ +##ifndef SWIG +extern ATTRIBUTES attrTEST_DATA_STRUCT[] ; +##endif +%} + +class CannonSimObject : public Trick::SimObject { + + public: + TCDevice connection ; + TEST_DATA_STRUCT tds ; + TEST_DATA_STRUCT read_tds ; + + /* Initialize client's connection to server */ + void init_comm() { + connection.port = 9000 ; + connection.hostname = strdup("localhost") ; + connection.disable_handshaking = TC_COMM_TRUE ; + tc_connect( &connection ) ; + } + + void send_test() { + usleep(100) ; + fprintf(stderr, "before write int1 =%x int2 =%x\n", tds.int1 , tds.int2 ) ; + fprintf(stderr, "before write long1=%lx long2=%lx\n", tds.long1 , tds.long2 ) ; + tc_write_byteswap( &connection, (char *)&tds, sizeof(TEST_DATA_STRUCT), attrTEST_DATA_STRUCT) ; + tc_read_byteswap( &connection, (char *)&read_tds, sizeof(TEST_DATA_STRUCT), attrTEST_DATA_STRUCT) ; + fprintf(stderr, "after read int1 =%x int2 =%x\n", read_tds.int1 , read_tds.int2 ) ; + fprintf(stderr, "after read long1=%lx long2=%lx\n", read_tds.long1 , read_tds.long2 ) ; + } + + CannonSimObject() : connection() , tds() { + tds.int1 = 1234 ; + tds.int2 = 5678 ; + tds.long1 = 8888 ; + tds.long2 = 9999 ; + ("initialization") init_comm() ; + (1.0, "scheduled") send_test() ; + } + +} ; + +// Instantiations +CannonSimObject dyn ; + diff --git a/test/SIM_trickcomm/S_overrides.mk b/test/SIM_trickcomm/S_overrides.mk new file mode 100644 index 00000000..ea51c23e --- /dev/null +++ b/test/SIM_trickcomm/S_overrides.mk @@ -0,0 +1,14 @@ + +TRICK_CFLAGS += -I. +TRICK_CXXFLAGS += -I. + +S_main: tc_server +tc_server: tc_server.c + ${TRICK_CC} ${TRICK_CFLAGS} ${TRICK_SYSTEM_CFLAGS} -I${TRICK_HOME}/trick_source -o $@ $< -L${TRICK_LIB_DIR} -ltrick_comm ${TRICK_EXEC_LINK_LIBS} + +clean: clean_tc_apps +spotless: clean_tc_apps + +clean_tc_apps: + ${RM} -f tc_server + diff --git a/test/SIM_trickcomm/tc_server.c b/test/SIM_trickcomm/tc_server.c new file mode 100644 index 00000000..90f1cebd --- /dev/null +++ b/test/SIM_trickcomm/tc_server.c @@ -0,0 +1,50 @@ + +#include +#include +#include +#include +#include + +#include "test_struct.h" + +int main () { + int nbytes ; + TEST_DATA_STRUCT tds ; + + int on = 1; + int listen_socket = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP);; + struct sockaddr_in s_in; + + setsockopt(listen_socket, SOL_SOCKET, SO_REUSEADDR, (const char *) &on, (socklen_t) sizeof(on)); + setsockopt(listen_socket, IPPROTO_TCP, TCP_NODELAY, (const char *) &on, (socklen_t) sizeof(on)); + memset(&s_in, 0 , sizeof(struct sockaddr_in)) ; + s_in.sin_family = AF_INET; + s_in.sin_addr.s_addr = INADDR_ANY ; + s_in.sin_port = htons((short)9000); + bind(listen_socket, (struct sockaddr *)&s_in, sizeof(s_in)) ; + listen(listen_socket, SOMAXCONN) ; + + socklen_t length; + int connection = accept(listen_socket, (struct sockaddr *) &s_in, &length); + setsockopt(connection, IPPROTO_TCP, TCP_NODELAY, (const void *) &on, (socklen_t) sizeof(on)); + + struct sockaddr_in cliAddr; + struct sockaddr_in remoteServAddr; + unsigned int cliLen = sizeof(struct sockaddr_in); + nbytes = 1 ; + while( nbytes > 0 ) { + nbytes = recvfrom(connection, &tds, sizeof(TEST_DATA_STRUCT), + MSG_NOSIGNAL, (struct sockaddr *) &cliAddr, &cliLen) ; + fprintf(stderr, "nbytes = %d\n", nbytes ) ; + fprintf(stderr, "tc_server int1 =%x int2 =%x\n", tds.int1 , tds.int2 ) ; + fprintf(stderr, "tc_server long1=%lx long2=%lx\n", tds.long1 , tds.long2 ) ; + if ( nbytes == sizeof(TEST_DATA_STRUCT)) { + sendto(connection, &tds, sizeof(TEST_DATA_STRUCT), MSG_NOSIGNAL, + (struct sockaddr *) &remoteServAddr, + (socklen_t) sizeof(struct sockaddr_in)) ; + } + } + + return 0 ; +} + diff --git a/test/SIM_trickcomm/test_struct.h b/test/SIM_trickcomm/test_struct.h new file mode 100644 index 00000000..22fc5bd8 --- /dev/null +++ b/test/SIM_trickcomm/test_struct.h @@ -0,0 +1,16 @@ + +#ifndef TEST_STRUCT_H +#define TEST_STRUCT_H + +typedef struct { + + int int1; /* -- Foo */ + int int2; /* -- Foo */ + long long1; /* -- Foo */ + long long2; /* -- Foo */ + double double1; /* -- Foo */ + double double2; /* -- Foo */ + +} TEST_DATA_STRUCT ; + +#endif diff --git a/trick_sims/SIM_dynamic_sim_object/S_define b/trick_sims/SIM_dynamic_sim_object/S_define deleted file mode 100644 index 6c62f27b..00000000 --- a/trick_sims/SIM_dynamic_sim_object/S_define +++ /dev/null @@ -1,38 +0,0 @@ -/************************TRICK HEADER************************* -PURPOSE: - (blah blah blah) -LIBRARY DEPENDENCIES: - ( - ) -*************************************************************/ - -#include "sim_objects/default_trick_sys.sm" - -##include "Ball++/L1/include/Ball.hh" - -/** - This class is the base ball class - */ -class ballSimObject : public Trick::SimObject { - - public: - /** The actual ball object */ - Ball obj ; - - /** Constructor to add the jobs */ - ballSimObject() { - ("initialization") obj.state_init() ; - - ("derivative") obj.force_field() ; - ("derivative") obj.state_deriv() ; - ("integration") trick_ret = obj.state_integ() ; - - {BLUE} (10.0, "scheduled") trick_ret = obj.state_print() ; - {BLUE} (1.0, "freeze_scheduled") trick_ret = obj.state_print() ; - - ("shutdown") obj.shutdown() ; - } -} ; - -// No instantiations made in this S_define file. They are made in the input file. - diff --git a/trick_sims/SIM_dynamic_sim_object/S_overrides.mk b/trick_sims/SIM_dynamic_sim_object/S_overrides.mk deleted file mode 100644 index 8fa02be5..00000000 --- a/trick_sims/SIM_dynamic_sim_object/S_overrides.mk +++ /dev/null @@ -1,4 +0,0 @@ - -TRICK_CFLAGS += -I${TRICK_HOME}/trick_models -TRICK_CXXFLAGS += -I${TRICK_HOME}/trick_models - diff --git a/trick_sims/SIM_leaks/S_overrides.mk b/trick_sims/SIM_leaks/S_overrides.mk deleted file mode 100644 index 53c0139a..00000000 --- a/trick_sims/SIM_leaks/S_overrides.mk +++ /dev/null @@ -1,3 +0,0 @@ - -TRICK_CFLAGS += -I${TRICK_HOME}/trick_models -TRICK_CXXFLAGS += -I${TRICK_HOME}/trick_models diff --git a/trick_sims/SIM_test_varserv/S_overrides.mk b/trick_sims/SIM_test_varserv/S_overrides.mk deleted file mode 100644 index 8fa02be5..00000000 --- a/trick_sims/SIM_test_varserv/S_overrides.mk +++ /dev/null @@ -1,4 +0,0 @@ - -TRICK_CFLAGS += -I${TRICK_HOME}/trick_models -TRICK_CXXFLAGS += -I${TRICK_HOME}/trick_models - diff --git a/trick_sims/SIM_trickcomm/.gitignore b/trick_sims/SIM_trickcomm/.gitignore deleted file mode 100644 index eff10ebc..00000000 --- a/trick_sims/SIM_trickcomm/.gitignore +++ /dev/null @@ -1,4 +0,0 @@ -tc_client -tc_client.dSYM -tc_server -tc_server.dSYM diff --git a/trick_sims/SIM_trickcomm/Modified_data/cannon.dr b/trick_sims/SIM_trickcomm/Modified_data/cannon.dr deleted file mode 100644 index 8810bedd..00000000 --- a/trick_sims/SIM_trickcomm/Modified_data/cannon.dr +++ /dev/null @@ -1,17 +0,0 @@ -global DR_GROUP_ID -global drg -try: - if DR_GROUP_ID >= 0: - DR_GROUP_ID += 1 -except NameError: - DR_GROUP_ID = 0 - drg = [] - -drg.append(trick.DRAscii("cannon")) -drg[DR_GROUP_ID].set_freq(trick.DR_Always) -drg[DR_GROUP_ID].set_cycle(0.01) -drg[DR_GROUP_ID].set_single_prec_only(False) -drg[DR_GROUP_ID].add_variable("dyn.cannon.pos[0]") -drg[DR_GROUP_ID].add_variable("dyn.cannon.pos[1]") -trick.add_data_record_group(drg[DR_GROUP_ID], trick.DR_Buffer) -drg[DR_GROUP_ID].enable() diff --git a/trick_sims/SIM_trickcomm/RUN_test/input.py b/trick_sims/SIM_trickcomm/RUN_test/input.py deleted file mode 100644 index 2f4f6d89..00000000 --- a/trick_sims/SIM_trickcomm/RUN_test/input.py +++ /dev/null @@ -1,7 +0,0 @@ - -execfile("Modified_data/cannon.dr") - -trick.exec_set_sim_object_onoff("server", False) ; - -dyn_integloop.getIntegrator(trick.Runge_Kutta_4, 4) -trick.exec_set_terminate_time(5.2) diff --git a/trick_sims/SIM_trickcomm/S_define b/trick_sims/SIM_trickcomm/S_define deleted file mode 100644 index 285c9441..00000000 --- a/trick_sims/SIM_trickcomm/S_define +++ /dev/null @@ -1,59 +0,0 @@ -/************************TRICK HEADER************************* -PURPOSE: - ( This S_define is to be used with RUN_trickcomm input file ) -LIBRARY_DEPENDENCY: - ( - (cannon/gravity/src/cannon_deriv_impact.c) - (cannon/gravity/src/cannon_integ.c) - (cannon/gravity/src/cannon_impact.c) - (cannon/gravity/src/cannon_init.c) - (cannon/gravity/src/cannon_default_data.c) - (cannon/gravity/src/cannon_init_comm.c) - (cannon/gravity/src/cannon_send_position.c) - ) -*************************************************************/ - -#include "sim_objects/default_trick_sys.sm" - - -##include "cannon/gravity/include/cannon.h" -##include "cannon/gravity/include/cannon_comm_proto.h" - -/*class ServerSimObject : public Trick::SimObject { - - public: - - ServerSimObject() { - ("initialization") main() ; - } -} ; - -ServerSimObject server ; -*/ -class CannonSimObject : public Trick::SimObject { - - public: - CANNON cannon ; - - CannonSimObject() { - ("default_data") cannon_default_data( &cannon ) ; - - ("initialization") cannon_init( &cannon ) ; - ("initialization") cannon_init_comm( &cannon ) ; - ("initialization") cannon_send_position( &cannon ) ; - - ("derivative") cannon_deriv_impact( &cannon ) ; - ("integration") trick_ret = cannon_integ( &cannon ) ; - - ("dynamic_event") cannon_impact( &cannon) ; - - (0.01, "scheduled") cannon_send_position( &cannon ) ; - } - -} ; - -// Instantiations -CannonSimObject dyn ; - -IntegLoop dyn_integloop (0.01) dyn ; - diff --git a/trick_sims/SIM_trickcomm/S_overrides.mk b/trick_sims/SIM_trickcomm/S_overrides.mk deleted file mode 100644 index 46255e01..00000000 --- a/trick_sims/SIM_trickcomm/S_overrides.mk +++ /dev/null @@ -1,17 +0,0 @@ - -TRICK_CFLAGS += -I${TRICK_HOME}/trick_models -TRICK_CXXFLAGS += -I${TRICK_HOME}/trick_models - -S_main: tc_server tc_client -tc_server: tc_server.c - ${TRICK_CC} ${TRICK_CFLAGS} ${TRICK_SYSTEM_CFLAGS} -I${TRICK_HOME}/trick_source -o $@ $< -L${TRICK_LIB_DIR} -ltrick_comm ${TRICK_EXEC_LINK_LIBS} - -tc_client: tc_client.c - ${TRICK_CC} ${TRICK_CFLAGS} ${TRICK_SYSTEM_CFLAGS} -I${TRICK_HOME}/trick_source -o $@ $< -L${TRICK_LIB_DIR} -ltrick_comm ${TRICK_EXEC_LINK_LIBS} - -clean: clean_tc_apps -spotless: clean_tc_apps - -clean_tc_apps: - ${RM} -rf tc_server tc_client - diff --git a/trick_sims/SIM_trickcomm/tc_client.c b/trick_sims/SIM_trickcomm/tc_client.c deleted file mode 100644 index 6c8bcb6b..00000000 --- a/trick_sims/SIM_trickcomm/tc_client.c +++ /dev/null @@ -1,29 +0,0 @@ -#include -#include "trick_utils/comm/include/tc.h" -#include "trick_utils/comm/include/tc_proto.h" - -int main( int narg, char** args) { - TCDevice connection; - - double x, y ; - - memset(&connection, '\0', sizeof(TCDevice)) ; - - connection.port = 9000; - connection.hostname = (char*) malloc(16); - - strcpy(connection.hostname, "localhost"); - - tc_connect(&connection); - - x = 123.45; - y = 67.89 ; - - tc_write(&connection, (char*) &x, sizeof(double)); - tc_write(&connection, (char*) &y, sizeof(double)); - - tc_disconnect(&connection) ; - - return 0; - -} diff --git a/trick_sims/SIM_trickcomm/tc_server.c b/trick_sims/SIM_trickcomm/tc_server.c deleted file mode 100644 index ecd6e602..00000000 --- a/trick_sims/SIM_trickcomm/tc_server.c +++ /dev/null @@ -1,32 +0,0 @@ -#define send_hs fprintf - -#include -#include -#include "trick_utils/comm/include/tc.h" -#include "trick_utils/comm/include/tc_proto.h" - -int main (int narg, char** args) -{ - double x, y; - int nbytes ; - - - TCDevice listen_device ; - TCDevice connection ; - - memset(&listen_device, '\0', sizeof(TCDevice)) ; - memset(&connection, '\0', sizeof(TCDevice)) ; - - listen_device.port = 9000; - tc_init(&listen_device) ; - tc_accept(&listen_device, &connection) ; - - while(tc_isValid(&connection)) { - nbytes = tc_read(&connection, (char*) &x, sizeof(double)); - nbytes = tc_read(&connection, (char*) &y, sizeof(double)); - fprintf(stderr, "x=%lf y=%lf \n", x, y) ; - } - - return 0 ; -} - diff --git a/trick_sims/makefile b/trick_sims/makefile index fdcf9bf5..b17435f8 100644 --- a/trick_sims/makefile +++ b/trick_sims/makefile @@ -6,6 +6,7 @@ COMPILE_DIRS = \ Ball/SIM_ball_L1 \ Ball/SIM_ball_L2 \ Ball/SIM_ball_L3 \ + Ball/SIM_ball_default_data \ Cannon/SIM_amoeba \ Cannon/SIM_cannon_aero \ Cannon/SIM_cannon_analytic \ @@ -16,21 +17,16 @@ COMPILE_DIRS = \ Cannon/SIM_cannon_jet \ SIM_Ball++_L1 \ SIM_satellite \ - SIM_sun \ - SIM_target + SIM_sun - #SIM_ball_default_data \ #SIM_monte \ - #SIM_trickcomm - -# This test is temporarily sitting out until fixed. -# SIM_test_varserv # List out sims we want to run unit tests TEST_DIRS = \ Ball/SIM_ball_L1 \ Ball/SIM_ball_L2 \ Ball/SIM_ball_L3 \ + Ball/SIM_ball_default_data \ Cannon/SIM_amoeba \ Cannon/SIM_cannon_aero \ Cannon/SIM_cannon_analytic \ @@ -40,15 +36,10 @@ TEST_DIRS = \ Cannon/SIM_cannon_integ \ Cannon/SIM_cannon_jet \ SIM_Ball++_L1 \ - SIM_sun \ - SIM_target + SIM_sun - #SIM_ball_default_data \ #SIM_monte \ -# This test is temporarily sitting out until fixed. -# SIM_test_varserv - EXECUTABLES = $(addsuffix /T_main_${TRICK_HOST_CPU}_test.exe, $(COMPILE_DIRS)) UNIT_TEST_RESULTS = $(addprefix $(TRICK_HOME)/trick_test/, $(addsuffix .xml, $(TEST_DIRS)))