From 4c60fb9ad84272e392e31ee37a89edb366a41772 Mon Sep 17 00:00:00 2001 From: Jonas <jonas@holm.tech> Date: Mon, 11 Mar 2019 15:43:19 +0100 Subject: [PATCH] Added: Pylint and Docker script, updated unit_test script --- readme | 2 ++ run_docker_container.sh | 20 ++++++++++++++++++++ run_pylint.sh | 8 ++++++++ run_unit_tests.sh | 8 ++++++++ 4 files changed, 38 insertions(+) create mode 100755 run_docker_container.sh create mode 100755 run_pylint.sh diff --git a/readme b/readme index 9d4edf0..7ae77cd 100644 --- a/readme +++ b/readme @@ -11,6 +11,8 @@ Contents pylintrc: configuration of pylint (used by CI) readme: this file (are you even following?) + run_docker_container.sh: script to start a docker container in CWD for testing (must be run in CastorScript folder) + run_pylint.sh: script to run pylint on all files in Script run_unit_tests.sh: script to search and run Python unit tests script_setup.sh: script used in P1 to setup the running environment watchdog.sh: script called by sysadmin's cron task that starts and maintains diff --git a/run_docker_container.sh b/run_docker_container.sh new file mode 100755 index 0000000..e1a8cdc --- /dev/null +++ b/run_docker_container.sh @@ -0,0 +1,20 @@ +#!/bin/bash +# how to use docker for local testing +# install docker + +# Logout and login again and run. +#================================ + +# run this command that does the following: +# 1 docker! +# 2 Create a new container, +# 3 with an interactive shell, +# 4 mount this dir (hopefully the CastorScript dir!) to the container, +# 5 mount other important storage locations (AFS, cvmfs etc), +# 6 remove the container after shutdown, +# 7 and run the centos7 image, +# 8 when started, run the run_unit_tests script in bash +# 1 2 3 4 5 6 7 8 +# docker run -it --privileged -v `pwd`:`pwd` -w `pwd` -v /cvmfs:/cvmfs:shared,ro -v /afs:/afs:ro --rm=true gitlab-registry.cern.ch/atlas-tdaq-software/tdaq_ci:centos7 bash ./run_unit_tests.sh +# or without running the script: +docker run -it --privileged -v `pwd`:`pwd` -w `pwd` -v /cvmfs:/cvmfs:shared,ro -v /afs:/afs:ro --rm=true gitlab-registry.cern.ch/atlas-tdaq-software/tdaq_ci:centos7 bash \ No newline at end of file diff --git a/run_pylint.sh b/run_pylint.sh new file mode 100755 index 0000000..3d93fc5 --- /dev/null +++ b/run_pylint.sh @@ -0,0 +1,8 @@ +#!/bin/bash +# this script is made to run in docker +if ! [ -v TDAQ_LCG_RELEASE ] +then + source /afs/cern.ch/atlas/project/tdaq/cmake/cmake_tdaq/bin/cm_setup.sh nightly +fi + +/cvmfs/sft.cern.ch/lcg/views/$TDAQ_LCG_RELEASE/$CMTCONFIG/bin/pylint $(find Script/ -name '*.py' -a -not -name config.py) \ No newline at end of file diff --git a/run_unit_tests.sh b/run_unit_tests.sh index 9b9af0d..a26a2fd 100755 --- a/run_unit_tests.sh +++ b/run_unit_tests.sh @@ -1,7 +1,15 @@ #!/bin/bash +# Warning dragons be here: +# this script is intended to run in a docker image with the following command: +# sudo docker run -it --privileged -v `pwd`:`pwd` -w `pwd` -v /cvmfs:/cvmfs:shared,ro -v /afs:/afs:ro --rm=true gitlab-registry.cern.ch/atlas-tdaq-software/tdaq_ci:centos7 bash ./run_unit_tests.sh TOPDIR=$(cd `dirname $0` && echo `pwd`"/Script" ) STARTDIR=$(echo $TOPDIR"/UnitTests") +if ! [ -v TDAQ_LCG_RELEASE ] +then + source /afs/cern.ch/atlas/project/tdaq/cmake/cmake_tdaq/bin/cm_setup.sh nightly +fi + python -m unittest discover -t $TOPDIR -s $STARTDIR -p "Test_*.py" -f --verbose #for Gitlab CI: -- GitLab