Move listener src into subdir for easier testing 50/4650/1
authorE. Scott Daniels <daniels@research.att.com>
Mon, 31 Aug 2020 13:06:08 +0000 (09:06 -0400)
committerE. Scott Daniels <daniels@research.att.com>
Mon, 31 Aug 2020 13:06:08 +0000 (09:06 -0400)
Sonar inclusion/exclusion in the LF environment seems problematic
at best. This change moves the Listener source into a subdir (src)
in hopes that exclusion of the test code from analysis and coverage
reporting can be more easily managed.

Issue-ID: RIC-632

Signed-off-by: E. Scott Daniels <daniels@research.att.com>
Change-Id: I87f5819de876c68eb3619d9e9ebaa7aeeef49b23

19 files changed:
sidecars/listener/Dockerfile
sidecars/listener/src/Makefile [moved from sidecars/listener/Makefile with 100% similarity]
sidecars/listener/src/build_dev_env.sh [moved from sidecars/listener/build_dev_env.sh with 100% similarity]
sidecars/listener/src/build_images.sh [moved from sidecars/listener/build_images.sh with 100% similarity]
sidecars/listener/src/help.sh [moved from sidecars/listener/help with 100% similarity]
sidecars/listener/src/mc_listener.c [moved from sidecars/listener/mc_listener.c with 100% similarity]
sidecars/listener/src/mcl.c [moved from sidecars/listener/mcl.c with 100% similarity]
sidecars/listener/src/mcl.h [moved from sidecars/listener/mcl.h with 100% similarity]
sidecars/listener/src/pipe_reader.c [moved from sidecars/listener/pipe_reader.c with 100% similarity]
sidecars/listener/src/rdc.c [moved from sidecars/listener/rdc.c with 100% similarity]
sidecars/listener/src/rdc_extract.c [moved from sidecars/listener/rdc_extract.c with 100% similarity]
sidecars/listener/src/rdc_replay.c [moved from sidecars/listener/rdc_replay.c with 100% similarity]
sidecars/listener/src/run_replay.sh [moved from sidecars/listener/run_replay.sh with 100% similarity]
sidecars/listener/src/sender.c [moved from sidecars/listener/sender.c with 100% similarity]
sidecars/listener/src/verify.sh [moved from sidecars/listener/verify.sh with 100% similarity]
sidecars/listener/src/verify_replay.sh [moved from sidecars/listener/verify_replay.sh with 100% similarity]
sidecars/listener/test/Makefile
sidecars/listener/test/run_unit_test.ksh
sidecars/listener/test/unit_test.c

index e9a92f7..f84cb83 100644 (file)
@@ -56,19 +56,19 @@ RUN wget -nv --content-disposition https://packagecloud.io/o-ran-sc/release/pack
 RUN dpkg -i rmr_${RMR_VER}_amd64.deb
 RUN dpkg -i rmr-dev_${RMR_VER}_amd64.deb
 
-RUN mkdir /playpen/bin /playpen/listener /playpen/listener/test
-ARG SRC=.
-COPY ${SRC}/*.ksh ${SRC}/Makefile ${SRC}/*.h ${SRC}/*.c /playpen/listener/
-COPY ${SRC}/verify_replay.sh ${SRC}/verify.sh /playpen/listener/
+RUN mkdir -p /playpen/bin /playpen/listener/src /playpen/listener/test
+ARG SRC=src
+COPY ${SRC}/*.ksh ${SRC}/Makefile ${SRC}/*.h ${SRC}/*.c /playpen/listener/src/
+COPY ${SRC}/verify_replay.sh ${SRC}/verify.sh /playpen/listener/src/
 
-ARG TEST=${SRC}/test
+ARG TEST=test
 COPY ${TEST}/*.ksh ${TEST}/Makefile ${TEST}/*.h ${TEST}/*.c /playpen/listener/test/
 
 # Build all binaries; verify scripts expect them to be in bin, so we must copy too
 #
 ENV LD_LIBRARY_PATH=/usr/local/lib64:/usr/local/lib
 ENV C_INCLUDE_PATH=/usr/local/include
-RUN     cd /playpen/listener \
+RUN     cd /playpen/listener/src \
        &&  make -B all \
        &&  ls -al mc_listener \
        &&  cp mc_listener sender pipe_reader rdc_replay rdc_extract /playpen/bin/
@@ -76,9 +76,13 @@ RUN     cd /playpen/listener \
 # Run unit tests. If they don't pass the build fails here. Tests can be run from src, but expect binaries in bin
 # so that they can be run in the final image as well.
 #
-ENV PATH /playpen/bin:/playpen/listener:$PATH
-RUN cd /playpen/listener/test/; ./run_unit_test.ksh
-RUN cd /playpen/listener/; /playpen/listener/verify.sh; /playpen/listener/verify_replay.sh
+ENV PATH /playpen/bin:/playpen/listener/src:$PATH
+RUN    cd /playpen/listener/test \
+       && ./run_unit_test.ksh
+
+RUN       cd /playpen/listener/src \
+       && /playpen/listener/src/verify.sh \
+       && /playpen/listener/src/verify_replay.sh
 
 
 # -----  final, smaller image ----------------------------------
@@ -92,13 +96,20 @@ RUN rm -fr /var/lib/apt/lists
 COPY --from=buildenv /playpen/rmr_*.deb /tmp/
 RUN dpkg -i /tmp/rmr_*_amd64.deb
 
-# obtusely this uses the previous value
-ARG SRC
+ARG SRC=src
+ARG PPSRC=/playpen/listener/src
 
 RUN mkdir -p /playpen/bin
+
+# pull from the huge builder image
 COPY --from=buildenv /usr/local/lib/* /usr/local/lib/
-COPY --from=buildenv /playpen/listener/mc_listener /playpen/listener/sender /playpen/listener/pipe_reader /playpen/listener/rdc_replay /playpen/listener/rdc_extract /playpen/bin/
-COPY ${SRC}/verify_replay.sh ${SRC}/verify.sh ${SRC}/run_replay.sh ${SRC}/help /playpen/bin/
+COPY --from=buildenv ${PPSRC}/mc_listener ${PPSRC}/sender ${PPSRC}/pipe_reader ${PPSRC}/rdc_replay ${PPSRC}/rdc_extract /playpen/bin/
+
+# pull from the source
+COPY ${SRC}/verify_replay.sh ${SRC}/verify.sh ${SRC}/run_replay.sh /playpen/bin/
+COPY ${SRC}/help.sh /playpen/bin/help
+
+RUN chmod 755 /playpen/bin/*
 
 ENV PATH=/playpen/bin:$PATH
 ENV LD_LIBRARY_PATH=/usr/local/lib64:/usr/local/lib
index 5a0a90e..851ee89 100644 (file)
@@ -36,7 +36,7 @@ all: tests
 tests: $(test_progs)
 
 
-unit_test: unit_test.c ../mcl.c ../rdc.c
+unit_test: unit_test.c ../src/mcl.c ../src/rdc.c
        gcc -g $(coverage_opts) unit_test.c -o unit_test -lrmr_si -lm -lpthread
 
 # ---- housekeeping stuff -------------------------------------------------------------
index e027583..2ccd47e 100755 (executable)
@@ -224,7 +224,5 @@ else
        rm -f *test*.gcov
 fi
 
-cp *.gcov ../                          # the CI job defines the listener dir as the spot to find these, so put them there
-
 rm -f /tmp/PID$$.*
 exit $rc
index 7acea3e..e9f689a 100644 (file)
@@ -41,8 +41,8 @@
 #include "test_rmr_em.c"               // emulated rmr functions (for receives)
 
 // this/these are what we are testing; include them directly (must be after forever def)
-#include "../mcl.c"
-#include "../rdc.c"
+#include "../src/mcl.c"
+#include "../src/rdc.c"
 
 /*
        Set up env things for the rdc setup call.