X-Git-Url: https://gerrit.o-ran-sc.org/r/gitweb?a=blobdiff_plain;f=test%2Frt_static_test.c;fp=test%2Frt_static_test.c;h=7a51bca421051f175d858cc8e9e0d58f0fb75613;hb=84423e66ad5d4ed313548b3705ec925a934b0f2e;hp=79d05614d80a54246da61c236b14964a379a6762;hpb=f8623e7dc17184b3359a5de8a81a54bb963469c7;p=ric-plt%2Flib%2Frmr.git diff --git a/test/rt_static_test.c b/test/rt_static_test.c index 79d0561..7a51bca 100644 --- a/test/rt_static_test.c +++ b/test/rt_static_test.c @@ -87,10 +87,37 @@ static uint64_t build_key( uint32_t mtype, uint32_t sid ) { k = (uint64_t) sid << 32; k += mtype; -fprintf( stderr, " build key: %x %x --> %llx\n", (int) mtype, (int) sid, (long long) k ); + fprintf( stderr, " build key: %x %x --> %llx\n", (int) mtype, (int) sid, (long long) k ); return k; } +/* + Create a very large set of things to clone and ensure that the colleciton + buffers are properly resized without errors. +*/ +static int lg_clone_test( ) { + int errors = 0; + uta_ctx_t* ctx; + char* old_env; + route_table_t* p; + + old_env = getenv( "RMR_SEED_RT" ); + setenv( "RMR_SEED_RT", "./large_meid.rt", 1 ); + + ctx = mk_dummy_ctx(); + + read_static_rt( ctx, 0 ); + p = uta_rt_clone( ctx, ctx->rtable, NULL, 1 ); // clone to force the copy from the existing table + errors += fail_if_nil( p, "clone of large table returned nil" ); + if( p != NULL ) { + errors += fail_not_equal( p->error, 0, "clone of large table had error" ); + } + + setenv( "RMR_SEED_RT", old_env, 1 ); + + return errors; +} + /* This is the main route table test. It sets up a very specific table for testing (not via the generic setup function for other test @@ -666,9 +693,17 @@ static int rt_test( ) { #endif // ---------------- misc coverage tests -------------------------------------------------------------------------- - collect_things( NULL, NULL, NULL, NULL, NULL ); // these both return null, these test NP checks - collect_things( NULL, NULL, NULL, NULL, (void *) 1234 ); // the last is an invalid pointer, but check needed to force check on previous param - del_rte( NULL, NULL, NULL, NULL, NULL ); + collect_things( NULL, NULL, NULL, NULL, NULL ); // these both return null, these test NP checks + collect_things( NULL, NULL, NULL, NULL, (void *) 1234 ); // the last is an invalid pointer, but check needed to force check on previous param + del_rte( NULL, NULL, NULL, NULL, NULL ); + + ctx = mk_dummy_ctx(); + roll_tables( ctx ); // drive nil rt check + + + + // ------ specific edge case tests ------------------------------------------------------------------------------- + errors += lg_clone_test( ); return !!errors; // 1 or 0 regardless of count }