Skip to content
Snippets Groups Projects
Commit b49d880e authored by lintao@ihep.ac.cn's avatar lintao@ihep.ac.cn
Browse files

Merge branch 'lintao/ci/test' into 'master'

Enable ctest in CI

See merge request cepc/CEPCSW!48
parents 03497d13 642c5089
No related branches found
No related merge requests found
.build.ci.sh 100644 → 100755
#!/bin/bash #!/bin/bash
# This is wrapper to run the build.sh on CI # This is wrapper to run the build.sh on CI
echo "LCG_RELEASE: ${LCG_RELEASE}" echo "CEPCSW_LCG_RELEASE: ${CEPCSW_LCG_RELEASE}"
echo "CEPCSW_LCG_PLATFORM: ${CEPCSW_LCG_PLATFORM}"
echo "CEPCSW_LCG_VERSION: ${CEPCSW_LCG_VERSION}"
echo "CEPCSW_BLDTOOL: ${CEPCSW_BLDTOOL}" echo "CEPCSW_BLDTOOL: ${CEPCSW_BLDTOOL}"
buildpid=
logfile=mylog.txt
if [ "$LCG_RELEASE" = "KEY4HEP_STACK" ]; then function build-with-log() {
logfile=mylog-k4.sh buildpid=
./build-k4.sh >& ${logfile} & logfile=mylog.txt
buildpid=$!
else if [ "$CEPCSW_LCG_RELEASE" = "KEY4HEP_STACK" ]; then
source setup.sh logfile=mylog-k4.sh
./build.sh >& ${logfile} & ./build-k4.sh >& ${logfile} &
buildpid=$! buildpid=$!
fi else
source setup.sh
./build.sh >& ${logfile} &
buildpid=$!
fi
while ps -p $buildpid 2>/dev/null ; do
sleep 60
done &
echoer=$!
while ps -p $buildpid 2>/dev/null ; do trap 'kill $echoer' 0
sleep 60
done &
echoer=$!
trap 'kill $echoer' 0 wait $buildpid
statuspid=$?
wait $buildpid tail -n100 ${logfile}
statuspid=$?
tail -n100 ${logfile} exit $statuspid
}
exit $statuspid function build-with-stdout() {
if [ "$CEPCSW_LCG_RELEASE" = "KEY4HEP_STACK" ]; then
./build-k4.sh
else
source setup.sh
./build.sh
fi
}
if [ -n "${GITHUB_ACTION}" ]; then
build-with-log
else
build-with-stdout
fi
...@@ -26,19 +26,23 @@ workflow: ...@@ -26,19 +26,23 @@ workflow:
stages: stages:
- build - build
# - test
############################################################################## ##############################################################################
# Build Template # Template for Build and Test
############################################################################## ##############################################################################
# Due to cmake/ctest will hardcode the path in build directory,
# the test job will be failed if it is executed on a different nodes.
# Therefore, put the build script and test script together.
.build_template: .build_template:
stage: build stage: build
variables: variables:
LCG_RELEASE: CEPCSW_LCG_RELEASE:
CEPCSW_BLDTOOL: ninja CEPCSW_LCG_PLATFORM:
CEPCSW_LCG_VERSION:
script: script:
- bash ./.build.ci.sh - bash ./.build.ci.sh
- bash ./.test.ci.sh
############################################################################## ##############################################################################
# Build CentOS 7 (LCG) # Build CentOS 7 (LCG)
...@@ -46,17 +50,13 @@ stages: ...@@ -46,17 +50,13 @@ stages:
build:lcg:el7: build:lcg:el7:
extends: .build_template extends: .build_template
variables: variables:
LCG_RELEASE: LCG CEPCSW_LCG_RELEASE: LCG
CEPCSW_LCG_PLATFORM: x86_64-centos7-gcc11-opt
CEPCSW_LCG_VERSION: 103.0.2
tags: tags:
- centos7 - centos7
artifacts:
############################################################################## paths:
# Build CentOS 7 (KEY4HEP) - InstallArea
############################################################################## reports:
# build:k4:el7: junit: build.${CEPCSW_LCG_VERSION}.${CEPCSW_LCG_PLATFORM}/cepcsw-ctest-result.xml
# extends: .build_template
# variables:
# LCG_RELEASE: KEY4HEP_STACK
# tags:
# - centos7
#!/bin/bash
# Description:
# Run the tests using ctest
#
# Author:
# Tao Lin <lintao AT ihep.ac.cn>
##############################################################################
# Utilities
##############################################################################
function build-dir() {
local blddir=build
if [ -n "${CEPCSW_BLDTOOL}" ]; then
blddir=${blddir}.${CEPCSW_BLDTOOL}
fi
# If detect the extra env var, append it to the build dir
if [ -n "${CEPCSW_LCG_VERSION}" ]; then
blddir=${blddir}.${CEPCSW_LCG_VERSION}
fi
if [ -n "${CEPCSW_LCG_PLATFORM}" ]; then
blddir=${blddir}.${CEPCSW_LCG_PLATFORM}
fi
echo $blddir
}
function junit-output() {
local default=cepcsw-ctest-result.xml
echo ${CEPCSW_JUNIT_OUTPUT:-$default}
}
##############################################################################
# Main
##############################################################################
echo "CEPCSW_LCG_RELEASE: ${CEPCSW_LCG_RELEASE}"
echo "CEPCSW_LCG_PLATFORM: ${CEPCSW_LCG_PLATFORM}"
echo "CEPCSW_LCG_VERSION: ${CEPCSW_LCG_VERSION}"
echo "CEPCSW_BLDTOOL: ${CEPCSW_BLDTOOL}"
source setup.sh
ctest --output-junit $(junit-output) --test-dir $(build-dir)
...@@ -42,3 +42,19 @@ install(TARGETS DetCRD ...@@ -42,3 +42,19 @@ install(TARGETS DetCRD
RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}" COMPONENT bin RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}" COMPONENT bin
LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}" COMPONENT shlib LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}" COMPONENT shlib
COMPONENT dev) COMPONENT dev)
################################################################################
# Add tests
################################################################################
add_test(
NAME Test_TDR_o1_v01_Sim
COMMAND gaudirun.py Detector/DetCRD/scripts/TDR_o1_v01/sim.py
WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}
)
add_test(
NAME Test_TDR_o1_v01_Rec
COMMAND gaudirun.py Detector/DetCRD/scripts/TDR_o1_v01/tracking.py
WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}
)
...@@ -41,7 +41,8 @@ tracksystemsvc = TrackSystemSvc("TrackSystemSvc") ...@@ -41,7 +41,8 @@ tracksystemsvc = TrackSystemSvc("TrackSystemSvc")
from Configurables import SimplePIDSvc from Configurables import SimplePIDSvc
pidsvc = SimplePIDSvc("SimplePIDSvc") pidsvc = SimplePIDSvc("SimplePIDSvc")
pidsvc.ParFile = "/cefs/higgs/zhaog/dndx_files/dNdx_TPC.root" cepcswdatatop = "/cvmfs/cepcsw.ihep.ac.cn/prototype/releases/data/latest"
pidsvc.ParFile = os.path.join(cepcswdatatop, "CEPCSWData/offline-data/Service/SimplePIDSvc/data/dNdx_TPC.root")
from Configurables import PodioInput from Configurables import PodioInput
podioinput = PodioInput("PodioReader", collections=[ podioinput = PodioInput("PodioReader", collections=[
......
...@@ -96,8 +96,8 @@ function run-install() { ...@@ -96,8 +96,8 @@ function run-install() {
############################################################################## ##############################################################################
# The current default platform # The current default platform
lcg_platform=x86_64-centos7-gcc11-opt lcg_platform=${CEPCSW_LCG_PLATFORM:-x86_64-centos7-gcc11-opt}
lcg_version=103.0.2 lcg_version=${CEPCSW_LCG_VERSION:-103.0.2}
bldtool=${CEPCSW_BLDTOOL} # make, ninja # set in env var bldtool=${CEPCSW_BLDTOOL} # make, ninja # set in env var
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment