### Running RaSTA Examples Manually in Docker Source: https://github.com/railway-ccs/rasta-protocol/blob/main/md_doc/docker.md Demonstrates how to manually execute RaSTA examples within a Docker container after starting the container. This involves navigating to the example binaries directory and running a specific example. ```shell docker run -it [IMAGE NAME] /bin/sh / # cd /opt/rasta-c/build/bin/exe/examples / # ./rasta_example_localhost r ``` -------------------------------- ### Example: Running SCI-LS with rasta-docker.sh Source: https://github.com/railway-ccs/rasta-protocol/blob/main/md_doc/docker.md Illustrates the sequence of commands to build the Docker image and then run the SCI-LS example on both the server and client1 containers. ```shell # if not already executed once >>> ./rasta-docker.sh build # run server >>> ./rasta-docker.sh server scils # run client in another terminal >>> ./rasta-docker.sh client1 scils ``` -------------------------------- ### Build Remote RaSTA Examples Source: https://github.com/railway-ccs/rasta-protocol/blob/main/examples/CMakeLists.txt Configures remote build targets for RaSTA protocol examples when BUILD_REMOTE_EXAMPLES is enabled. This includes executables for scip, scils, and rasta examples, along with copying remote configuration files. It also supports an optional IP override for examples. ```cmake if(BUILD_REMOTE_EXAMPLES) # scip_example add_executable(scip_example scip/c/main.c) target_link_libraries(scip_example rasta) # scils_example add_executable(scils_example scils/c/main.c) target_link_libraries(scils_example rasta) # rasta_example_new add_executable(rasta_example rasta/c/main.c) target_link_libraries(rasta_example rasta) # Copy RaSTA configs to build directory configure_file(../config/rasta_server.cfg ../rasta_server.cfg COPYONLY) configure_file(../config/rasta_client1.cfg ../rasta_client1.cfg COPYONLY) configure_file(../config/rasta_client2.cfg ../rasta_client2.cfg COPYONLY) if (EXAMPLE_IP_OVERRIDE) add_compile_definitions(EXAMPLE_IP_OVERRIDE) endif(EXAMPLE_IP_OVERRIDE) endif(BUILD_REMOTE_EXAMPLES) ``` -------------------------------- ### Build Local RaSTA Examples Source: https://github.com/railway-ccs/rasta-protocol/blob/main/examples/CMakeLists.txt Configures local build targets for RaSTA protocol examples when BUILD_LOCAL_EXAMPLES is enabled. This includes executables for scip, scils, rasta, and event system examples, along with copying local configuration files. ```cmake if(BUILD_LOCAL_EXAMPLES) # scip_example on localhost add_executable(scip_example_local localhost/c/scip.c) target_link_libraries(scip_example_local rasta) # scils_example on localhost add_executable(scils_example_local localhost/c/scils.c) target_link_libraries(scils_example_local rasta) # rasta_example_new on localhost add_executable(rasta_example_local localhost/c/rasta.c) target_link_libraries(rasta_example_local rasta) add_executable(event_system_example_local localhost/c/event_test.c) target_link_libraries(event_system_example_local rasta) # Copy RaSTA configs to build directory configure_file(../config/rasta_server_local.cfg ../rasta_server_local.cfg COPYONLY) configure_file(../config/rasta_client1_local.cfg ../rasta_client1_local.cfg COPYONLY) configure_file(../config/rasta_client2_local.cfg ../rasta_client2_local.cfg COPYONLY) endif(BUILD_LOCAL_EXAMPLES) ``` -------------------------------- ### Running RaSTA Examples with rasta-docker.sh Source: https://github.com/railway-ccs/rasta-protocol/blob/main/md_doc/docker.md Executes specified RaSTA examples within their respective containers using the helper script. The script handles container startup and example execution. ```shell ./rasta-docker.sh CONTAINER [EXAMPLE] ``` -------------------------------- ### Building Docker Image with rasta-docker.sh Source: https://github.com/railway-ccs/rasta-protocol/blob/main/md_doc/docker.md Builds the Docker image and sets up the necessary network and IP configurations for RaSTA examples. This command will remove and recreate existing containers if they are present. ```shell ./rasta-docker.sh build ``` -------------------------------- ### Stopping Docker Containers with rasta-docker.sh Source: https://github.com/railway-ccs/rasta-protocol/blob/main/md_doc/docker.md Stops all running RaSTA example containers managed by the helper script. ```shell ./rasta-docker.sh stop ``` -------------------------------- ### Build Rasta Protocol on Raspberry Pi Source: https://github.com/railway-ccs/rasta-protocol/blob/main/md_doc/raspberry_pi.md Execute these commands in the project root directory to build the Rasta Protocol using CMake on a Raspberry Pi. Ensure CMake is installed and meets the version requirement. ```bash mkdir -p build cd build cmake .. make ``` -------------------------------- ### Implement a Simple CUnit Test Source: https://github.com/railway-ccs/rasta-protocol/blob/main/md_doc/cunit.md Implement the test function declared in the header file. Use CU_ASSERT_EQUAL for basic assertions. ```c #include void my_unit_test(){ // your actual unit test goes here // in this case we will just use a dummy assert which is always true CU_ASSERT_EQUAL(1, 1); } ``` -------------------------------- ### Define a CUnit Test Function Prototype Source: https://github.com/railway-ccs/rasta-protocol/blob/main/md_doc/cunit.md Create a header file to declare your test function. Include the CUnit Basic header for access to assertion functions. ```c #include #ifndef LST_SIMULATOR_MYTESTS_H #define LST_SIMULATOR_MYTESTS_H void my_unit_test(); #endif //LST_SIMULATOR_MYTESTS_H ``` -------------------------------- ### Compile RaSTA Library with Gradle Source: https://github.com/railway-ccs/rasta-protocol/blob/main/md_doc/getting_started.md Use the Gradle build task to compile the RaSTA C library and execute unit tests. The compiled library files will be located in the build/libs/rasta directory. ```bash gradle build ``` -------------------------------- ### Register a CUnit Test Source: https://github.com/railway-ccs/rasta-protocol/blob/main/md_doc/cunit.md Register your test function within the `gradle_cunit_register` function by calling `CU_add_test`. This ensures the test is included in the build process. ```c #include "registerTests.h" // INCLUDE TESTS #include "mytest.h" // ... a lot of other test headers and suite init void gradle_cunit_register() { // ... initialization of suite and other tests CU_add_test(pSuiteMath, "my_unit_test", my_unit_test); } ``` -------------------------------- ### Set Maximum Message Count for mqueues Source: https://github.com/railway-ccs/rasta-protocol/blob/main/md_doc/getting_started.md Adjust the maximum number of messages allowed in a POSIX mqueue. This is necessary when the default limit of 10 is insufficient for RaSTA's buffer size requirements (e.g., 20). ```bash echo "20" > /proc/sys/fs/mqueue/msg_max ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.