From: E. Scott Daniels Date: Wed, 10 Mar 2021 17:22:44 +0000 (-0500) Subject: Add better support for manual app testing X-Git-Tag: 4.6.1^0 X-Git-Url: https://gerrit.o-ran-sc.org/r/gitweb?a=commitdiff_plain;h=71df2a2b09d072090c29713d05a49b5670b11053;p=ric-plt%2Flib%2Frmr.git Add better support for manual app testing This change adds some support to the app test scripts to provide for manual testing of the application tests without the need to intall RMR. The change also provides the means to set the optimisation level when building RMR libraries for better profiling and debugging. Issue-ID: RIC-753 Signed-off-by: E. Scott Daniels Change-Id: I7ff5f9a1b1bdcdb83ed83c217dae1bce03b0fda4 --- diff --git a/CHANGES_CORE.txt b/CHANGES_CORE.txt index c95cf30..9537e31 100644 --- a/CHANGES_CORE.txt +++ b/CHANGES_CORE.txt @@ -5,6 +5,11 @@ # API and build change and fix summaries. Doc corrections # and/or changes are not mentioned here; see the commit messages. +2021 March 10; version 4.6.1 + Corrected unit test "framework" to make manual testing easier, and to + add the ability to set the code optimisation level via the CMake + command line parameter OPT_LEVEL=n. + 2021 February 22; Version 4.6.0 Enhanced to use millisecond based timestamps when writing log messages. (RIC-627) diff --git a/CMakeLists.txt b/CMakeLists.txt index be0e448..1bf13e8 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,7 +1,7 @@ # #================================================================================== -# Copyright (c) 2019 Nokia -# Copyright (c) 2018-2019 AT&T Intellectual Property. +# Copyright (c) 2019-2021 Nokia +# Copyright (c) 2018-2021 AT&T Intellectual Property. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -33,6 +33,7 @@ # -DGPROF=1 Enable profiling compile time flags # -DSKIP_EXTERNALS=1 Do not use NNG submodule when building; uee installed packages # -DMAN_PREFIX= Supply a path where man pages are installed (default: /usr/share/man) +# -DOPT_LEVEL=n Set a custom optimisation level. # See ci/build_all for an example of how to build and test @@ -41,7 +42,7 @@ cmake_minimum_required( VERSION 3.5 ) set( major_version "4" ) # should be automatically populated from git tag later, but until CI process sets a tag we use this set( minor_version "6" ) -set( patch_level "0" ) +set( patch_level "1" ) set( install_root "${CMAKE_INSTALL_PREFIX}" ) set( install_inc "include/rmr" ) @@ -104,7 +105,7 @@ if( DEBUG ) # if set, we'll set debugging on in the compile message( "+++ debugging is being set to ${DEBUG}" ) else() set( debugging 0 ) - message( "+++ debugging is set to off" ) + message( "+++ debugging is set to off (use -DDEBUG=1 to enable)" ) endif() unset( DEBUG CACHE ) # we don't want this to persist @@ -240,11 +241,22 @@ if( GPROF ) # if set, we'll set profiling flag on compiles message( "+++ profiling is on" ) set( CMAKE_C_FLAGS "-pg " ) else() - message( "+++ profiling is off" ) + message( "+++ profiling is off (use -DGPROF=1 to enable" ) set( CMAKE_C_FLAGS "-g " ) endif() unset( GPROF CACHE ) # we don't want this to persist +if( DEFINED OPT_LEVEL ) + message( "+++ optimisation is forced to ${OPT_LEVEL}" ) + set( CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -O${OPT_LEVEL} " ) +else() + message( "+++ optimisation will default (use -DOPT_LEVEL=n to force specific level, or disable)" ) +endif() +unset( OPT_LEVEL CACHE ) # no optimisation flage does NOT percist + +message( "+++ compiler flags: ${CMAKE_C_FLAGS}" ) + + # Include modules add_subdirectory( src/rmr/common ) if( BUILD_NNG ) diff --git a/docs/rel-notes.rst b/docs/rel-notes.rst index 94904e7..e11ab22 100644 --- a/docs/rel-notes.rst +++ b/docs/rel-notes.rst @@ -22,6 +22,15 @@ the need to leap frog versions ceased, and beginning with version 4.0.0, the RMR versions should no longer skip. +2021 March 10; version 4.6.1 +---------------------------- + +Corrected unit test "framework" to make manual testing +easier, and to add the ability to set the code optimisation +level via the CMake command line parameter OPT_LEVEL=n. + + + 2021 February 22; Version 4.6.0 ------------------------------- diff --git a/src/rmr/common/src/rtc_static.c b/src/rmr/common/src/rtc_static.c index cc4730e..3f48695 100644 --- a/src/rmr/common/src/rtc_static.c +++ b/src/rmr/common/src/rtc_static.c @@ -1,8 +1,8 @@ // : vi ts=4 sw=4 noet : /* ================================================================================== - Copyright (c) 2019-2020 Nokia - Copyright (c) 2018-2020 AT&T Intellectual Property. + Copyright (c) 2019-2021 Nokia + Copyright (c) 2018-2021 AT&T Intellectual Property. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -297,7 +297,7 @@ static void* rtc( void* vctx ) { rt_req_freq = atoi( eptr ); if( rt_req_freq < 1 || rt_req_freq > 300 ) { rt_req_freq = DEF_RTREQ_FREQ; - rmr_vlog( RMR_VL_WARN, "rmr_rtc: RT request frequency (%d) out of range (1-300), using default", DEF_RTREQ_FREQ ); + rmr_vlog( RMR_VL_WARN, "rmr_rtc: RT request frequency (%d) out of range (1-300), using default (%d)\n", rt_req_freq, DEF_RTREQ_FREQ ); } } rmr_vlog( RMR_VL_INFO, "rmr_rtc: RT request frequency set to: %d seconds", rt_req_freq ); diff --git a/src/rmr/common/src/tools_static.c b/src/rmr/common/src/tools_static.c index bbe49ee..2d2cc22 100644 --- a/src/rmr/common/src/tools_static.c +++ b/src/rmr/common/src/tools_static.c @@ -1,8 +1,8 @@ // :vi sw=4 ts=4 noet: /* ================================================================================== - Copyright (c) 2019-2020 Nokia - Copyright (c) 2018-2020 AT&T Intellectual Property. + Copyright (c) 2019-2021 Nokia + Copyright (c) 2018-2021 AT&T Intellectual Property. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -365,6 +365,7 @@ static if_addrs_t* mk_ip_list( char* port ) { getifaddrs( &ifs ); for( ele = ifs; ele; ele = ele->ifa_next ) { memset( octs, 0, sizeof( octs ) ); + if( DEBUG ) rmr_vlog( RMR_VL_DEBUG, "checking interface: %s\n", ele->ifa_name ); if( ele && strcmp( ele->ifa_name, "lo" ) && // do NOT capture the loopback interface address (target_if == NULL || strcmp( ele->ifa_name, target_if ) == 0 ) ) { // no target, or matches ENV_BIND_IF target @@ -376,6 +377,9 @@ static if_addrs_t* mk_ip_list( char* port ) { if( ele->ifa_addr->sa_family == AF_INET6 ) { getnameinfo( ele->ifa_addr, sizeof( struct sockaddr_in6 ), octs, NI_MAXHOST, NULL, 0, NI_NUMERICHOST ); fmt = "[%s]:%s"; + } else { + if( DEBUG ) rmr_vlog( RMR_VL_DEBUG, "unrecognised IF family (not v4 or v6)\n" ); + continue; } } @@ -390,7 +394,11 @@ static if_addrs_t* mk_ip_list( char* port ) { l->addrs[l->naddrs] = strdup( wbuf ); l->naddrs++; } + } else { + if( DEBUG ) rmr_vlog( RMR_VL_DEBUG, "unrecognised or no octets octs=%x fmt=%p\n", *octs, fmt ); } + } else { + if( DEBUG ) rmr_vlog( RMR_VL_DEBUG, "no ip address for interface: %s\n", ele->ifa_name ); } } } diff --git a/src/rmr/si/src/sr_si_static.c b/src/rmr/si/src/sr_si_static.c index bc3b53e..2e24064 100644 --- a/src/rmr/si/src/sr_si_static.c +++ b/src/rmr/si/src/sr_si_static.c @@ -1,8 +1,8 @@ // vim: ts=4 sw=4 noet : /* ================================================================================== - Copyright (c) 2019-2020 Nokia - Copyright (c) 2018-2020 AT&T Intellectual Property. + Copyright (c) 2019-2021 Nokia + Copyright (c) 2018-2021 AT&T Intellectual Property. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -554,7 +554,7 @@ static inline rmr_mbuf_t* realloc_payload( rmr_mbuf_t* old_msg, int payload_len, nm->header = ((char *) nm->tp_buf) + TP_HDR_LEN; // point at the new header and copy from old SET_HDR_LEN( nm->header ); - if( copy ) { // if we need to copy the old payload too + if( copy != 0 ) { // if we need to copy the old payload too memcpy( nm->header, omhdr, sizeof( char ) * (old_psize + RMR_HDR_LEN( omhdr )) ); if( DEBUG ) rmr_vlog( RMR_VL_DEBUG, "rmr_realloc_payload: copy payload into new message: %d bytes\n", old_psize ); } else { // just need to copy header diff --git a/test/app_test/Makefile b/test/app_test/Makefile index edff57e..8224477 100644 --- a/test/app_test/Makefile +++ b/test/app_test/Makefile @@ -1,7 +1,7 @@ # #================================================================================= -# Copyright (c) 2019-2020 Nokia -# Copyright (c) 2018-2020 AT&T Intellectual Property. +# Copyright (c) 2019-2021 Nokia +# Copyright (c) 2018-2021 AT&T Intellectual Property. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -48,28 +48,18 @@ LIBRARY_PATH = $(LD_LIBRARY_PATH) .PHONY: all all_si -all: sender receiver caller mt_receiver v_sender ex_rts_receiver sender_si receiver_si +all: sender receiver caller mt_receiver v_sender ex_rts_receiver all_si: sender_si receiver_si -# ------ nng based builds ------------------------------------------------------------ +# ------ all builds are si95 now --------------------------------------------------- %:%.c - gcc -I $${C_INCLUDE_PATH:-.} $< -g -o $@ -lrmr_nng -lnng -lpthread -lm - -# special build as it reuses an existing source module -mt_receiver: receiver.c - gcc -I $${C_INCLUDE_PATH:-.} -DMTC $< -g -o $@ -lrmr_nng -lnng -lpthread -lm - - -# ----- si test builds ------------------------------------------------------------- - -%_si : %.c gcc -I $${C_INCLUDE_PATH:-.} $< -g -o $@ -lrmr_si -lpthread -lm -# explicit rule because there is no mt_recever.c -mt_receiver_si: receiver.c +# special build rule as it reuses an existing source module with a sepcial define +mt_receiver: receiver.c gcc -I $${C_INCLUDE_PATH:-.} -DMTC $< -g -o $@ -lrmr_si -lpthread -lm diff --git a/test/app_test/README b/test/app_test/README index 8db94a4..73d1ef4 100644 --- a/test/app_test/README +++ b/test/app_test/README @@ -10,3 +10,24 @@ and on trace data to verify that the messages are being reeived correctly. The receiver acks message type 5, so the reciver should receive acks at about the volume of 1/10th the number of messages sent. + +The contents of this directory are generally intended to support automated +testing via the run_all.sh script. Howerver, there may be times where +building and running the tools manually is needed. To support this two +scripts, maker.sh and runner.sh, are provided. The maker.sh script will +build RMR in ../../.build and install it in a /tmp directory so that the +needed include files can be found when building the test programmes. The +runner.sh script sets the environment and then starts the comand given. +For example, to run the sencder: + RMR_SEED_RT=xx.rt runner.sh ./sender 1000 0 0 + +The runner script accepts both -v and -d to set verbose and debug options +for RMR when the programme is run. + + +The maker script will always build the test programmes whether they've been +changed or not. By default the current .deb packages in ../../.build are +used, but the -b option can be given to force a rebuild of the RMR libraries +in addition to building the tools. If the ../../.build directory does not +exist, it should automatically be created and RMR built. + diff --git a/test/app_test/run_all.ksh b/test/app_test/run_all.ksh index 57e29c8..f8624db 100644 --- a/test/app_test/run_all.ksh +++ b/test/app_test/run_all.ksh @@ -1,8 +1,8 @@ #!/usr/bin/env ksh # vim: ts=4 sw=4 noet : #================================================================================== -# Copyright (c) 2019-2020 Nokia -# Copyright (c) 2018-2020 AT&T Intellectual Property. +# Copyright (c) 2019-2021 Nokia +# Copyright (c) 2018-2021 AT&T Intellectual Property. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -151,7 +151,7 @@ export SHELL=$shell if (( purge )) then - rm -f sender sender_si receiver receiver_si + rm -f sender receiver fi echo "----- app --------------------" diff --git a/test/app_test/run_all.sh b/test/app_test/run_all.sh index f276205..a56418a 100644 --- a/test/app_test/run_all.sh +++ b/test/app_test/run_all.sh @@ -1,8 +1,8 @@ #!/usr/bin/env ksh # vim: ts=4 sw=4 noet : #================================================================================== -# Copyright (c) 2019-2020 Nokia -# Copyright (c) 2018-2020 AT&T Intellectual Property. +# Copyright (c) 2019-2021 Nokia +# Copyright (c) 2018-2021 AT&T Intellectual Property. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -58,7 +58,6 @@ function run_test { build="" errors=0 -si_flag="-S" # default to -S to prefer to run SI tests over NNG tests src_root="../.." if [[ -z $BUILD_PATH ]] # if not explicitly set, assume one of our standard spots @@ -125,14 +124,14 @@ do -B) build="-b";; # build RMR without pulling -e) capture_file=$2; >$capture_file; shift;; -i) installed="-i";; - -N) si_flag="";; # turn on NNG tests (off si) + -N) ;; # ignored for backwards compatability; nng no longer supported -P) build="-B";; # build RMR with a pull first -p) purge=0;; # don't purge binaries to ensure rebuild happens - -S) si_flag="-S";; # turn on si based tests + -S) ;; # ignored; nng tests are not supported so all binaries are now si95 -s) shell=$2; shift;; -v) verbose=1;; - -\?) echo "usage: $0 [-B|-P] [-e err_file] [-i] [-N|-S] [-p] [-s shell] [-v]";; + -\?) echo "usage: $0 [-B|-P] [-e err_file] [-i] [-p] [-s shell] [-v]";; *) echo "'$1' is not a recognised option and is ignored";; esac @@ -153,30 +152,30 @@ export SHELL=$shell if (( purge )) then - rm -f sender sender_si receiver receiver_si + rm -f sender receiver fi echo "----- app --------------------" if which ip >/dev/null 2>&1 # ip command rquired for the app test; skip if not found then - run_test run_app_test.sh $si_flag -v $installed $build + run_test run_app_test.sh -v $installed $build build="" fi echo "----- multi ------------------" -run_test run_multi_test.sh $si_flag $build +run_test run_multi_test.sh $build echo "----- round robin -----------" -run_test run_rr_test.sh $si_flag +run_test run_rr_test.sh echo "----- rts -------------------" -run_test run_rts_test.sh $si_flag -s 5 -d 100 +run_test run_rts_test.sh -s 5 -d 100 echo "----- extended payload nocopy no clone------" -run_test run_exrts_test.sh $si_flag -d 10 -n 1000 +run_test run_exrts_test.sh -d 10 -n 1000 echo "----- extended payload copy clone------" -run_test run_exrts_test.sh $si_flag -d 10 -n 1000 -c 11 +run_test run_exrts_test.sh -d 10 -n 1000 -c 11 if (( errors == 0 )) then diff --git a/test/app_test/run_app_test.sh b/test/app_test/run_app_test.sh index 11db720..ec5dc9d 100644 --- a/test/app_test/run_app_test.sh +++ b/test/app_test/run_app_test.sh @@ -1,8 +1,8 @@ #!/usr/bin/env ksh # vim: ts=4 sw=4 noet : #================================================================================== -# Copyright (c) 2019-2020 Nokia -# Copyright (c) 2018-2020 AT&T Intellectual Property. +# Copyright (c) 2019-2021 Nokia +# Copyright (c) 2018-2021 AT&T Intellectual Property. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -71,21 +71,21 @@ function set_rt { cat <app_test.rt newrt | start - mse | 0 | 0 | localhost:$port,$my_ip:43086 - mse | 1 | 10 | localhost:$port,${my_host//.*/}:43086 - mse | 2 | 20 | localhost:$port - rte | 3 | localhost:$port - mse | 3 | 100 | localhost:$port # special test to ensure that this does not affect previous entry - rte | 4 | localhost:$port - rte | 5 | localhost:$port - rte | 6 | localhost:$port - rte | 7 | localhost:$port - rte | 8 | localhost:$port - rte | 9 | localhost:$port - rte | 10 | localhost:$port - rte | 11 | localhost:$port - rte | 12 | localhost:$port - rte | 13 | localhost:$port + mse | 0 | 0 | 127.0.0.1:$port,$my_ip:43086 + mse | 1 | 10 | 127.0.0.1:$port,${my_host//.*/}:43086 + mse | 2 | 20 | 127.0.0.1:$port + rte | 3 | 127.0.0.1:$port + mse | 3 | 100 | 127.0.0.1:$port # special test to ensure that this does not affect previous entry + rte | 4 | 127.0.0.1:$port + rte | 5 | 127.0.0.1:$port + rte | 6 | 127.0.0.1:$port + rte | 7 | 127.0.0.1:$port + rte | 8 | 127.0.0.1:$port + rte | 9 | 127.0.0.1:$port + rte | 10 | 127.0.0.1:$port + rte | 11 | 127.0.0.1:$port + rte | 12 | 127.0.0.1:$port + rte | 13 | 127.0.0.1:$port newrt | end head -3 app_test.rt @@ -108,7 +108,6 @@ my_ip=$(snarf_ip) # get an ip to insert into the route table keep=0 mt_receiver=0 # -m sets in order to test with multi-threaded receive stuff force_make=0 -si="" # -S sets to build and test SI versions while [[ $1 == -* ]] @@ -122,8 +121,8 @@ do -M) force_make=1;; -m) mt_receiver=1;; -n) nmsg=$2; shift;; - -N) si="";; # build and test NNG versions (off si) - -S) si="_si";; # build and test SI95 versions + -N) ;; # ignored for back compat; NNG not supported; all binaries are si95 + -S) ;; # ignored for back compat; all binaries are si95 and no _si suffix is used -v) verbose=1;; *) echo "unrecognised option: $1" @@ -209,6 +208,7 @@ then fi fi +exit run_rcvr & sleep 2 # if sender starts faster than rcvr we can drop msgs, so pause a bit run_sender & diff --git a/test/app_test/run_call_test.sh b/test/app_test/run_call_test.sh index 64ed70e..ca959a8 100644 --- a/test/app_test/run_call_test.sh +++ b/test/app_test/run_call_test.sh @@ -1,8 +1,8 @@ #!/usr/bin/env ksh # vim: ts=4 sw=4 noet : #================================================================================== -# Copyright (c) 2019-2020 Nokia -# Copyright (c) 2018-2020 AT&T Intellectual Property. +# Copyright (c) 2019-2021 Nokia +# Copyright (c) 2018-2021 AT&T Intellectual Property. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -116,7 +116,7 @@ nthreads=3 dev_base=1 # -D turns off to allow this to run on installed libs force_make=0 si="" -localhost="localhost" +localhost="127.0.0.1" @@ -128,10 +128,9 @@ do -D) dev_base=0;; -n) nmsg=$2; shift;; -M) force_make=1;; + -N) si="";; # ignored for back compat; NNG not supported; all binaries are si95 + -S) si="";; # ignored for back compat; all binaries are si95 and no _si suffix is used -N) si="";; # enable NNG testing (off si) - -S) si="_si" # enable SI95 testing - localhost="127.0.0.1" - ;; -t) nthreads=$2; shift;; -v) verbose=1;; diff --git a/test/app_test/run_exrts_test.sh b/test/app_test/run_exrts_test.sh index 5cb6e8c..6740e85 100644 --- a/test/app_test/run_exrts_test.sh +++ b/test/app_test/run_exrts_test.sh @@ -1,8 +1,8 @@ #!/usr/bin/env ksh # vim: ts=4 sw=4 noet : #================================================================================== -# Copyright (c) 2019-2020 Nokia -# Copyright (c) 2018-2020 AT&T Intellectual Property. +# Copyright (c) 2019-2021 Nokia +# Copyright (c) 2018-2021 AT&T Intellectual Property. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -50,9 +50,9 @@ function leak_anal { function run_sender { if (( la_sender )) then - leak_anal ./v_sender${si} ${nmsg:-10} ${delay:-100000} ${mtype_start_stop:-0:1} >/tmp/la.log 2>&1 + leak_anal ./v_sender ${nmsg:-10} ${delay:-100000} ${mtype_start_stop:-0:1} >/tmp/la.log 2>&1 else - ./v_sender${si} ${nmsg:-10} ${delay:-100000} ${mtype_start_stop:-0:1} + ./v_sender ${nmsg:-10} ${delay:-100000} ${mtype_start_stop:-0:1} fi echo $? >/tmp/PID$$.src # must communicate state back via file b/c asynch } @@ -65,9 +65,9 @@ function run_rcvr { export RMR_RTG_SVC=$(( 9990 + $1 )) if (( la_receiver )) then - leak_anal ./ex_rts_receiver${si} $copyclone -p $port >/tmp/la.log 2>&1 + leak_anal ./ex_rts_receiver $copyclone -p $port >/tmp/la.log 2>&1 else - ./ex_rts_receiver${si} $copyclone -p $port + ./ex_rts_receiver $copyclone -p $port fi echo $? >/tmp/PID$$.$1.rrc } @@ -77,10 +77,10 @@ function run_rcvr { # function set_rt { typeset port=4460 - typeset groups="localhost:4460" + typeset groups="127.0.0.1:4460" for (( i=1; i < ${1:-3}; i++ )) do - groups="$groups,localhost:$((port+i))" + groups="$groups,127.0.0.1:$((port+i))" done cat <ex_rts.rt @@ -121,7 +121,6 @@ verbose=0 nrcvrs=1 # this is sane, but -r allows it to be set up use_installed=0 mtype_start_stop="" -si="" # -S will enable si library testing while [[ $1 == -* ]] do @@ -133,10 +132,10 @@ do -L) leak_anal=$2; shift;; -m) mtype_start_stop="$2"; shift;; -M) mt_call_flag="EX_CFLAGS=-DMTC=1";; # turn on mt-call receiver option - -N) si="";; # enable nng based testing + -N) ;; # ignored for back compat; nng not supported -n) nmsg=$2; shift;; -r) nrcvrs=$2; shift;; - -S) si="_si";; # run SI95 based binaries + -S) ;; # ignored for back compat; si95 is the only supported transport -v) verbose=1;; *) echo "unrecognised option: $1" @@ -208,7 +207,7 @@ export RMR_SEED_RT=./ex_rts.rt set_rt $nrcvrs # set up the rt for n receivers -if ! build_path=$build_path make -B $mt_call_flag v_sender${si} ex_rts_receiver${si} >/tmp/PID$$.log 2>&1 # for sanity, always rebuild test binaries +if ! build_path=$build_path make -B $mt_call_flag v_sender ex_rts_receiver >/tmp/PID$$.log 2>&1 # for sanity, always rebuild test binaries then echo "[FAIL] cannot make binaries" echo "=====" diff --git a/test/app_test/run_lcall_test.sh b/test/app_test/run_lcall_test.sh index 944d399..8cff210 100644 --- a/test/app_test/run_lcall_test.sh +++ b/test/app_test/run_lcall_test.sh @@ -1,8 +1,8 @@ #!/usr/bin/env ksh # vim: ts=4 sw=4 noet : #================================================================================== -# Copyright (c) 2019-2020 Nokia -# Copyright (c) 2018-2020 AT&T Intellectual Property. +# Copyright (c) 2019-2021 Nokia +# Copyright (c) 2018-2021 AT&T Intellectual Property. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -51,7 +51,7 @@ # file in order for the 'main' to pick them up easily. # function run_sender { - ./lcaller${si} ${nmsg:-10} ${delay:-500} ${cthreads:-3} + ./lcaller ${nmsg:-10} ${delay:-500} ${cthreads:-3} echo $? >/tmp/PID$$.src # must communicate state back via file b/c asynch } @@ -61,7 +61,7 @@ function run_rcvr { port=$(( 4460 + ${1:-0} )) export RMR_RTG_SVC=$(( 9990 + $1 )) - ./lreceiver${si} $(( ((nmsg * cthreads)/nrcvrs) + 10 )) $port + ./lreceiver $(( ((nmsg * cthreads)/nrcvrs) + 10 )) $port echo $? >/tmp/PID$$.$1.rrc } @@ -70,10 +70,10 @@ function run_rcvr { # function set_rt { typeset port=4460 - typeset groups="localhost:4460" + typeset groups="127.0.0.1:4460" for (( i=1; i < ${1:-3}; i++ )) do - groups="$groups,localhost:$((port+i))" + groups="$groups,127.0.0.1:$((port+i))" done cat <lcall.rt @@ -184,11 +184,11 @@ export RMR_SEED_RT=./lcall.rt set_rt $nrcvrs # set up the rt for n receivers -if (( force_make || rebuild )) || [[ ! -f ./lcaller{$si} || ! -f ./lreceiver${si} ]] +if (( force_make || rebuild )) || [[ ! -f ./lcaller || ! -f ./lreceiver ]] then - if ! make -B lcaller${si} lreceiver${si} >/dev/null 2>&1 + if ! make -B lcaller lreceiver >/dev/null 2>&1 then - echo "[FAIL] cannot find lcaller${si} and/or lreceiver${si} binary, and cannot make them.... humm?" + echo "[FAIL] cannot find lcaller and/or lreceiver binary, and cannot make them.... humm?" exit 1 fi fi diff --git a/test/app_test/run_multi_test.sh b/test/app_test/run_multi_test.sh index d8cf765..43debc4 100644 --- a/test/app_test/run_multi_test.sh +++ b/test/app_test/run_multi_test.sh @@ -1,8 +1,8 @@ #!/usr/bin/env ksh # vim: ts=4 sw=4 noet : #================================================================================== -# Copyright (c) 2019-2020 Nokia -# Copyright (c) 2018-2020 AT&T Intellectual Property. +# Copyright (c) 2019-2021 Nokia +# Copyright (c) 2018-2021 AT&T Intellectual Property. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -45,7 +45,7 @@ # It doesn't happen all of the time, but frequently enough to be annoying. # function run_sender { - RMR_ASYNC_CONN=0 ./sender${si} $nmsg $delay + RMR_ASYNC_CONN=0 ./sender $nmsg $delay echo $? >/tmp/PID$$.src # must communicate state back via file b/c asynch } @@ -55,7 +55,7 @@ function run_rcvr { port=$(( 4460 + ${1:-0} )) export RMR_RTG_SVC=$(( 9990 + $1 )) - ./receiver${si} $nmsg $port + ./receiver $nmsg $port echo $? >/tmp/PID$$.$1.rrc } @@ -64,10 +64,10 @@ function run_rcvr { # function set_rt { typeset port=4460 - typeset groups="localhost:4460" + typeset groups="127.0.0.1:4460" for (( i=1; i < ${1:-3}; i++ )) do - groups="$groups;localhost:$((port+i))" + groups="$groups;127.0.0.1:$((port+i))" done cat <multi.rt @@ -114,10 +114,10 @@ do -b) rebuild=1; nopull="nopull";; # enable build but without pull -d) delay=$2; shift;; -n) nmsg=$2; shift;; - -N) si="";; # buld/run NNG binaries (turn off si) + -N) ;; # buld/run NNG binaries (turn off si) -M) force_make=1;; -r) nrcvrs=$2; shift;; - -S) si="_si";; # buld/run SI95 binaries + -S) ;; # buld/run SI95 binaries -v) verbose=1;; *) echo "unrecognised option: $1" @@ -169,11 +169,11 @@ export RMR_SEED_RT=./multi.rt set_rt $nrcvrs # set up the rt for n receivers -if (( rebuild || force_make )) || [[ ! -f ./sender${si} || ! -f ./receiver${si} ]] +if (( rebuild || force_make )) || [[ ! -f ./sender || ! -f ./receiver ]] then if ! make >/dev/null 2>&1 then - echo "[FAIL] cannot find sender${si} and/or receiver${si} binary, and cannot make them.... humm?" + echo "[FAIL] cannot find sender and/or receiver binary, and cannot make them.... humm?" exit 1 fi fi diff --git a/test/app_test/run_rr_test.sh b/test/app_test/run_rr_test.sh index 581f286..32cd309 100644 --- a/test/app_test/run_rr_test.sh +++ b/test/app_test/run_rr_test.sh @@ -1,8 +1,8 @@ #!/usr/bin/env ksh # vim: ts=4 sw=4 noet : #================================================================================== -# Copyright (c) 2019-2020 Nokia -# Copyright (c) 2018-2020 AT&T Intellectual Property. +# Copyright (c) 2019-2021 Nokia +# Copyright (c) 2018-2021 AT&T Intellectual Property. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -43,7 +43,7 @@ # function run_sender { export RMR_RTG_SVC=8990 - ./sender${si} $(( nmsg * nrcvrs )) $delay $max_mtype + ./sender $(( nmsg * nrcvrs )) $delay $max_mtype echo $? >/tmp/PID$$.src # must communicate state back via file b/c asynch } @@ -53,7 +53,7 @@ function run_rcvr { port=$(( 4560 + ${1:-0} )) export RMR_RTG_SVC=$(( 9990 + $1 )) - ./receiver${si} $nmsg $port + ./receiver $nmsg $port echo $? >/tmp/PID$$.$1.rrc } @@ -63,10 +63,10 @@ function run_rcvr { # function set_rt { typeset port=4560 - typeset endpoints="localhost:4560" + typeset endpoints="127.0.0.1:4560" for (( i=1; i < ${1:-3}; i++ )) do - endpoints="$endpoints,localhost:$((port+i))" + endpoints="$endpoints,127.0.0.1:$((port+i))" done cat <rr.rt @@ -117,9 +117,9 @@ do -m) max_mtype=$2; shift;; -M) force_make=1;; -n) nmsg=$2; shift;; - -N) si="";; # build/run NNG binaries + -N) ;; # ignored for back compat; nng nolonger supported -r) nrcvrs=$2; shift;; - -S) si="_si";; # build/run SI95 binaries + -S) ;; # ignored for back compat; only si95 is supported -v) verbose=1;; *) echo "unrecognised option: $1" @@ -171,11 +171,11 @@ export RMR_SEED_RT=./rr.rt set_rt $nrcvrs -if (( rebuild || force_make )) || [[ ! -f ./sender${si} || ! -f ./receiver${si} ]] +if (( rebuild || force_make )) || [[ ! -f ./sender || ! -f ./receiver ]] then if ! make >/dev/null 2>&1 then - echo "[FAIL] cannot find sender${si} and/or receiver${si} binary, and cannot make them.... humm?" + echo "[FAIL] cannot find sender and/or receiver binary, and cannot make them.... humm?" exit 1 fi fi diff --git a/test/app_test/run_rts_test.sh b/test/app_test/run_rts_test.sh index 7ebf4b4..86c54fa 100644 --- a/test/app_test/run_rts_test.sh +++ b/test/app_test/run_rts_test.sh @@ -1,8 +1,8 @@ #!/usr/bin/env ksh # vim: ts=4 sw=4 noet : #================================================================================== -# Copyright (c) 2019-2020 Nokia -# Copyright (c) 2018-2020 AT&T Intellectual Property. +# Copyright (c) 2019-2021 Nokia +# Copyright (c) 2018-2021 AT&T Intellectual Property. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -42,7 +42,7 @@ function run_sender { export RMR_RTG_SVC=$(( 9991 + $1 )) port=$(( 43080 + $1 )) - ./sender${si} $nmsg $delay 5:6 $port + ./sender $nmsg $delay 5:6 $port echo $? >/tmp/PID$$.$1.src # must communicate state back via file b/c asynch } @@ -52,7 +52,7 @@ function run_rcvr { port=4460 export RMR_RTG_SVC=9990 - ./receiver${si} $(( nmsg * nsenders )) $port + ./receiver $(( nmsg * nsenders )) $port echo $? >/tmp/PID$$.rrc } @@ -63,7 +63,7 @@ function run_rcvr { function set_rt { cat <rts.rt newrt | start - mse |5 | -1 | localhost:4460 + mse |5 | -1 | 127.0.0.1:4460 newrt | end endKat @@ -87,9 +87,9 @@ do -b) rebuild=1; nopull="nopull";; # build without pulling -d) delay=$2; shift;; -n) nmsg=$2; shift;; - -N) si="";; # enable NNG tests (disable si) + -N) ;; # ignored for back compat -- nng no longer supported -s) nsenders=$2; shift;; - -S) si="_si";; # enable SI95 tests + -S) ;; # ignored for back compat -- si is only supported transport -v) verbose=1;; *) echo "unrecognised option: $1" @@ -141,11 +141,11 @@ export RMR_SEED_RT=./rts.rt set_rt # create the route table -if [[ ! -f ./sender${si} || ! -f ./receiver${si} ]] +if [[ ! -f ./sender || ! -f ./receiver ]] then - if ! make ./sender${si} ./receiver${si} >/dev/null 2>&1 + if ! make ./sender ./receiver >/dev/null 2>&1 then - echo "[FAIL] cannot find sender${si} and/or receiver${si} binary, and cannot make them.... humm?" + echo "[FAIL] cannot find sender and/or receiver binary, and cannot make them.... humm?" exit 1 fi fi diff --git a/test/tools_static_test.c b/test/tools_static_test.c index 6f95fe5..250f834 100644 --- a/test/tools_static_test.c +++ b/test/tools_static_test.c @@ -65,6 +65,7 @@ static char* get_ifname( ) { struct ifaddrs *ifs; // pointer to head struct ifaddrs *ele; // pointer into the list char* rstr = NULL; // return string + char octs[NI_MAXHOST+1]; if( (l = (if_addrs_t *) malloc( sizeof( if_addrs_t ) )) == NULL ) { @@ -80,12 +81,20 @@ static char* get_ifname( ) { getifaddrs( &ifs ); for( ele = ifs; ele; ele = ele->ifa_next ) { if( ele && strcmp( ele->ifa_name, "lo" ) ) { - rstr = strdup( ele->ifa_name ); - break; + memset( octs, 0, sizeof( octs ) ); + getnameinfo( ele->ifa_addr, sizeof( struct sockaddr_in6 ), octs, NI_MAXHOST, NULL, 0, NI_NUMERICHOST ); + if( *octs ) { + rstr = strdup( ele->ifa_name ); + fprintf( stderr, " found interface with address: %s\n", rstr ); + break; + } } } free( l ); + if( rstr == NULL ) { + fprintf( stderr, " no interface with an address was found!\n" ); + } return rstr; } @@ -226,6 +235,8 @@ static int tools_test( ) { } free( ip ); + } else { + fprintf( stderr, " test skipped because no interface with address could be found on system" ); } errors += ztbf_test(); // test the zero term buffer fill function