fix(rtc): Prevent core dump if \r used in rt file
[ric-plt/lib/rmr.git] / test / sr_nano_static_test.c
index 8e939da..ef6e496 100644 (file)
 #include <errno.h>
 #include <string.h>
 #include <stdint.h>
+#include <pthread.h>
+#include <semaphore.h>
 
-#include "../src/common/include/rmr.h"
-#include "../src/common/include/rmr_agnostic.h"
+#include "rmr.h"
+#include "rmr_agnostic.h"
 
 /*
        Generate a simple route table (for all but direct route table testing).
+       This table contains multiple tables inasmuch as a second update set of
+       records follows the initial set. 
 */
 static void gen_rt( uta_ctx_t* ctx ) {
        int             fd;
        char*   rt_stuff;               // strings for the route table
 
        rt_stuff =
+               "\r"                                                                            // ensure we are not screwed by broken OSes that insist on using \r
                "newrt|end\n"                                                           // end of table check before start of table found
                "# comment to drive full comment test\n"
                "\n"                                                                            // handle blank lines
@@ -110,6 +115,7 @@ static int sr_nano_test() {
        ctx->max_plen = RMR_MAX_RCV_BYTES + sizeof( uta_mhdr_t );
        ctx->max_mlen = ctx->max_plen + sizeof( uta_mhdr_t );
        ctx->my_name = strdup( "dummy-test" );
+       ctx->my_ip = strdup( "30.4.19.86:1111" );
        uta_lookup_rtg( ctx );
 
        gen_rt( ctx );                                                          // forces a static load with some known info since we don't start the rtc()