diff --git a/src/pathcomp/.gitlab-ci.yml b/src/pathcomp/.gitlab-ci.yml index 1515ad0395b9e54142f1076d42d3eb5b2febac5d..c13cdd3acc0ae4108e8e627bfd2381cd027523eb 100644 --- a/src/pathcomp/.gitlab-ci.yml +++ b/src/pathcomp/.gitlab-ci.yml @@ -84,15 +84,12 @@ unit test pathcomp-backend: script: - docker pull "$CI_REGISTRY_IMAGE/${IMAGE_NAME}-backend:$IMAGE_TAG" #- docker run --name ${IMAGE_NAME}-backend -d -p 8081:8081 -v "$PWD/src/${IMAGE_NAME}/backend/tests:/opt/results" --network=teraflowbridge ${IMAGE_NAME}-backend:${IMAGE_TAG}-builder - - docker run --name ${IMAGE_NAME}-backend -d -p 8081:8081 --network=teraflowbridge ${IMAGE_NAME}-backend:${IMAGE_TAG} + - docker run --name ${IMAGE_NAME}-backend -d -p 8081:8081 --network=teraflowbridge ${IMAGE_NAME}-backend:${IMAGE_TAG}-builder - sleep 5 - docker ps -a - docker logs ${IMAGE_NAME}-backend - - sleep 5 - docker exec -i ${IMAGE_NAME}-backend bash -c "curl -0 -v -X POST -H 'Expect:' -H 'Content-Type:\ application/json' http://127.0.0.1:8081/pathComp/api/v1/compRoute -d @/var/teraflow/tests/pc-req.json" - - sleep 5 - - docker exec -i ${IMAGE_NAME}-backend bash -c "killall -USR1 pathComp-cvr" - - sleep 5 + - docker kill --signal=SIGUSR1 pathcomp-backend - docker exec -i ${IMAGE_NAME}-backend bash -c "gcovr" coverage: '/TOTAL\s+\d+\s+\d+\s+(\d+%)/' after_script: @@ -142,11 +139,8 @@ unit test pathcomp-frontend: - docker ps -a - docker logs ${IMAGE_NAME}-frontend - docker logs ${IMAGE_NAME}-backend - - sleep 5 - docker exec -i ${IMAGE_NAME}-frontend bash -c "coverage run -m pytest --log-level=INFO --verbose $IMAGE_NAME/frontend/tests/test_unitary.py --junitxml=/opt/results/${IMAGE_NAME}-frontend_report.xml" - - sleep 5 - docker exec -i ${IMAGE_NAME}-frontend bash -c "coverage report --include='${IMAGE_NAME}/*' --show-missing" - - sleep 5 coverage: '/TOTAL\s+\d+\s+\d+\s+(\d+%)/' after_script: - docker ps -a diff --git a/src/pathcomp/backend/Dockerfile b/src/pathcomp/backend/Dockerfile index b239d2ea04d981869fa3a52905359bfc9336489f..c7c8d796512ec4bb5ff59d3d48ae62d86df761af 100644 --- a/src/pathcomp/backend/Dockerfile +++ b/src/pathcomp/backend/Dockerfile @@ -20,6 +20,7 @@ ARG DEBIAN_FRONTEND=noninteractive # Install build software RUN apt-get update -y && apt-get install build-essential curl gcovr libglib2.0-dev -y +RUN apt-get install valgrind -y # mkdir RUN mkdir -p /var/teraflow @@ -38,11 +39,17 @@ RUN mv pathComp /var/teraflow/bin # Build code coverage version RUN make clean RUN make coverage +#RUN make debug EXPOSE 8081 # builder defines coverage version of pathcomp by default +# coverage entrypoint: ENTRYPOINT [ "./pathComp-cvr", "config/pathcomp.conf", "pathcomp.log" ] +# debug entrypoint: +#ENTRYPOINT [ "./pathComp-dbg", "config/pathcomp.conf", "pathcomp.log" ] +# debug entrypoint with memory tracking: +#ENTRYPOINT [ "valgrind", "--leak-check=full", "--show-leak-kinds=all", "--track-origins=yes", "--show-error-list=yes", "./pathComp-dbg", "config/pathcomp.conf", "pathcomp.log" ] # Stage 2 @@ -61,5 +68,7 @@ WORKDIR /var/teraflow # We make four distinct layers so if there are application changes the library layers can be re-used COPY --from=builder /var/teraflow/bin/pathComp . COPY --from=builder /var/teraflow/config/pathcomp.conf ./config +COPY --from=builder /var/teraflow/tests/. ./tests +# release entrypoint: ENTRYPOINT [ "./pathComp", "config/pathcomp.conf", "pathcomp.log" ] diff --git a/src/pathcomp/backend/pathComp_tools.h b/src/pathcomp/backend/pathComp_tools.h index 90a0cc8b878134cf29fa4eb1728f08a8b72aa4d9..b8adda535048d353c0f5c49636c5ed8e5e92ca2c 100644 --- a/src/pathcomp/backend/pathComp_tools.h +++ b/src/pathcomp/backend/pathComp_tools.h @@ -1,6 +1,6 @@ //////////////////////////////////////////////////////////////////////////////////////// /** - * # Copyright 2022 Centre Tecnològic de Telecomunicacions de Catalunya (CTTC/CERCA) www.cttc.es + * # Copyright 2022 Centre Tecnol�gic de Telecomunicacions de Catalunya (CTTC/CERCA) www.cttc.es * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -14,7 +14,7 @@ * See the License for the specific language governing permissions and * limitations under the License. - * Author: CTTC/CERCA PONS RU Ricardo Martínez (ricardo.martinez@cttc.es) + * Author: CTTC/CERCA PONS RU Ricardo Mart�nez (ricardo.martinez@cttc.es) */ ///////////////////////////////////////////////////////////////////////////////////////// @@ -110,8 +110,8 @@ struct map_nodes_t { gint numMapNodes; }; -#define MAX_NUM_VERTICES 100 -#define MAX_NUM_EDGES 100 +#define MAX_NUM_VERTICES 10 // 100 # LGR: reduced from 100 to 10 to divide by 10 the memory used +#define MAX_NUM_EDGES 10 // 100 # LGR: reduced from 100 to 10 to divide by 10 the memory used // Structures for the graph composition struct targetNodes_t { // remote / targeted node @@ -144,7 +144,7 @@ struct context_t { //////////////////////////////////////////////////// // Structure for the Set of Contexts /////////////////////////////////////////////////// -#define MAX_NUMBER_CONTEXT 100 +#define MAX_NUMBER_CONTEXT 5 // 100 # LGR: reduced from 100 to 5 to divide by 20 the memory used struct contextSet_t { struct context_t contextList[MAX_NUMBER_CONTEXT]; gint num_context_set;