From a6c0973383cc8758bc141d25a8167c195e981581 Mon Sep 17 00:00:00 2001 From: Martin Spinler Date: Thu, 19 Oct 2023 13:31:06 +0200 Subject: [PATCH] [FEATURE]: add Jenkinsfile for cocotb top-level tests --- tests/cocotb/Jenkinsfile | 38 ++++++++++++++++++++++++++++++++++++++ tests/cocotb/Makefile | 4 +++- 2 files changed, 41 insertions(+), 1 deletion(-) create mode 100644 tests/cocotb/Jenkinsfile diff --git a/tests/cocotb/Jenkinsfile b/tests/cocotb/Jenkinsfile new file mode 100644 index 000000000..a46c37116 --- /dev/null +++ b/tests/cocotb/Jenkinsfile @@ -0,0 +1,38 @@ +node("preklad") { + cleanWs() + def swbase = "ndk-sw" + checkout scm + + stage("Checkout development branches") { + sh "git clone https://github.com/CESNET/ndk-sw.git" + + sh "(cd ndk/ofm; git checkout devel)" + sh "(cd ndk/core; git checkout main)" + } + + sh "python3.9 -m venv venv-cocotb" + + stage("Prepare environment") { + sh """ + source venv-cocotb/bin/activate + python3.9 -m pip install cython wheel + python3.9 -m pip install pylibfdt fdt + python3.9 -m pip install ${swbase}/pynfb/ + python3.9 -m pip install ${swbase}/ext/libnfb_ext_python/ + python3.9 -m pip install ndk/ofm/python/cocotbext/ + """ + } + + stage("Run test") { + sh """ + source venv-cocotb/bin/activate + + . /usr/local/bin/fpga_version.sh; + fpga_sim 2020.4; + make -C tests/cocotb SIM_FLAGS=\"-c -do quit\" + """ + junit testResults: "build/fb2cghh/results.xml" + } + + sh "rm -rf venv-cocotb" +} diff --git a/tests/cocotb/Makefile b/tests/cocotb/Makefile index aa28e2cc4..ca4e30923 100644 --- a/tests/cocotb/Makefile +++ b/tests/cocotb/Makefile @@ -9,5 +9,7 @@ CARD = fb2cghh CARD_DIR=../../build/$(CARD)/ +ROOT_DIR:=$(shell dirname $(realpath $(firstword $(MAKEFILE_LIST)))) + all: - make TARGET=cocotb -C $(CARD_DIR) PYTHONPATH=$$PYTHONPATH:$(PWD) + make TARGET=cocotb -C $(CARD_DIR) PYTHONPATH=$$PYTHONPATH:$(ROOT_DIR)