Compare commits

..

90 Commits

Author SHA1 Message Date
e4ab774038 write detector output to console
All checks were successful
Build on RHEL9 / build (push) Successful in 3m47s
Build on RHEL8 / build (push) Successful in 5m27s
2025-12-18 12:19:19 +01:00
9c67abb7c0 config added 2 udp ports per default for moench and jungfrau 2025-12-18 11:13:16 +01:00
9e0fe5a35e suppressed warning enclosing if
All checks were successful
Build on RHEL9 / build (push) Successful in 3m19s
Build on RHEL8 / build (push) Successful in 5m5s
2025-12-18 10:19:29 +01:00
e01271e86c Merge branch 'developer' of github.com:slsdetectorgroup/slsDetectorPackage into dev/add_simulator_tests_in_github_workflows 2025-12-18 10:04:38 +01:00
7d1d5e9809 Merge pull request #1347 from slsdetectorgroup/fix/self-assign
All checks were successful
Build on local RHEL9 / build (push) Successful in 1m22s
Build on local RHEL8 / build (push) Successful in 3m26s
Build on RHEL9 / build (push) Successful in 3m45s
Build on RHEL8 / build (push) Successful in 4m52s
clang-tidy [unhandled-self-assignment]
2025-12-17 13:01:17 +01:00
froejdh_e
cfaaf5a973 removed depricated check, handle self assignment 2025-12-16 16:35:53 +01:00
2f12bc1efd num udp interfaces needs to be consistent across modules
All checks were successful
Build on RHEL9 / build (push) Successful in 3m13s
Build on RHEL8 / build (push) Successful in 4m35s
2025-12-14 11:38:23 +01:00
50bf72b40b take into account half modules of eiger 2025-12-14 10:40:31 +01:00
0adb8156d0 changed time to wait after receive to 5 ms 2025-12-14 10:26:58 +01:00
e24fb9fc43 check_file_size only disabled for jungfrau - disable for all roi tests 2025-12-14 10:25:08 +01:00
ac128a1fb3 replaced [.cmdcall] with [.detectorintegration] 2025-12-12 18:05:10 +01:00
74f4f6d364 changed withdetectorsimulators to detectorintegration 2025-12-12 17:16:07 +01:00
3e8fb809e0 updated Documentation of Testing 2025-12-12 17:01:12 +01:00
ffc9464826 Merge branch 'developer' of github.com:slsdetectorgroup/slsDetectorPackage into dev/add_simulator_tests_in_github_workflows 2025-12-12 16:33:39 +01:00
497b3ed00e Merge pull request #1343 from slsdetectorgroup/dev/update_release_notes
All checks were successful
Build on local RHEL9 / build (push) Successful in 1m23s
Build on local RHEL8 / build (push) Successful in 3m26s
Build on RHEL9 / build (push) Successful in 3m35s
Build on RHEL8 / build (push) Successful in 5m10s
updated release notes
2025-12-11 09:52:56 +01:00
300a296c20 updated release notes 2025-12-10 16:21:00 +01:00
8a194ddaa0 check frames for HDF5
All checks were successful
Build on RHEL9 / build (push) Successful in 4m17s
Build on RHEL8 / build (push) Successful in 4m33s
2025-12-08 09:10:11 +01:00
c968c1f3f7 disable tests for jungfrau and xilinx_ctb 2025-12-08 08:47:00 +01:00
c8170b8496 set log level as cmake cached variable 2025-12-08 08:45:22 +01:00
c4b5b89534 disabled check for num_frames for jungfrau & xilinx 2025-12-05 12:15:37 +01:00
01e392b112 Merge pull request #1342 from slsdetectorgroup/dev/dbitorder
All checks were successful
Build on local RHEL9 / build (push) Successful in 1m22s
Build on local RHEL8 / build (push) Successful in 3m26s
Build on RHEL9 / build (push) Successful in 3m49s
Build on RHEL8 / build (push) Successful in 4m31s
Preserve order in receiver dbit list
2025-12-04 16:03:48 +01:00
5409cec73e adapted test to test no reorder behavior
All checks were successful
Build on RHEL9 / build (push) Successful in 4m12s
Build on RHEL8 / build (push) Successful in 4m30s
2025-12-04 10:58:37 +01:00
Erik Fröjdh
1c31a85a43 added function to remove duplicates, preserve order of dbit 2025-12-03 12:14:35 +01:00
577813e8bc added testing policies to documenattion
All checks were successful
Build on RHEL9 / build (push) Successful in 3m20s
Build on RHEL8 / build (push) Successful in 5m6s
2025-12-01 16:02:45 +01:00
aa0fa31383 added logg level variable to cmake 2025-12-01 14:57:20 +01:00
6c8510e542 increased sleep time for udp packets 2025-12-01 12:14:45 +01:00
219e61f85e run tests without log files
All checks were successful
Build on RHEL9 / build (push) Successful in 3m29s
Build on RHEL8 / build (push) Successful in 5m34s
2025-12-01 10:27:06 +01:00
d4d258d92b enable file write not to log files 2025-12-01 10:18:36 +01:00
134137ead0 build RH8 in conda env
All checks were successful
Build on local RHEL8 / build (push) Successful in 3m24s
Build on RHEL9 / build (push) Successful in 3m24s
Build on local RHEL9 / build (push) Successful in 1m21s
Build on RHEL8 / build (push) Successful in 5m25s
2025-11-27 16:28:21 +01:00
6d3922f487 typo
All checks were successful
Build on RHEL9 / build (push) Successful in 3m24s
Build on RHEL8 / build (push) Successful in 5m14s
Build on local RHEL9 / build (push) Successful in 1m22s
Build on local RHEL8 / build (push) Successful in 3m23s
2025-11-27 15:27:17 +01:00
f14cfb0b31 deploy python ui
Some checks failed
Build on local RHEL9 / build (push) Successful in 1m23s
Build on local RHEL8 / build (push) Successful in 3m23s
Build on RHEL9 / build (push) Successful in 4m26s
Build on RHEL8 / build (push) Has been cancelled
2025-11-27 15:21:34 +01:00
0ececf502b removed integartion tests 2025-11-27 11:15:30 +01:00
523224a8d5 python -m runs module pytest as script - everything in path available
All checks were successful
Build on RHEL9 / build (push) Successful in 4m29s
Build on RHEL8 / build (push) Successful in 4m47s
2025-11-27 11:13:04 +01:00
cf4e6b65c1 Merge branch 'dev/NFS_testing' into developer 2025-11-27 11:00:29 +01:00
0da80cd898 local runners only for developer
All checks were successful
Build on RHEL9 / build (push) Successful in 3m53s
Build on RHEL8 / build (push) Successful in 5m30s
2025-11-27 10:43:51 +01:00
d21942d22d debug module import
All checks were successful
Build on RHEL9 / build (push) Successful in 3m57s
Build on RHEL8 / build (push) Successful in 5m36s
2025-11-27 09:49:16 +01:00
bbeb336030 debug import error 2025-11-27 09:37:14 +01:00
3c0a3881d6 updated python tests using simulators
All checks were successful
Build on RHEL9 / build (push) Successful in 3m28s
Build on RHEL8 / build (push) Successful in 5m21s
2025-11-26 19:20:01 +01:00
13abeca017 fixed unsuccesful merge 2025-11-26 15:51:04 +01:00
f7dcece2e7 fixed CMakeLists 2025-11-26 15:47:23 +01:00
b6dc1101bf solved merge conflict 2025-11-26 15:36:39 +01:00
96855592f0 some refactoring 2025-11-26 15:33:07 +01:00
8e7921ae45 Merge pull request #1339 from slsdetectorgroup/dev/python_cmd_for_ROI
All checks were successful
Build on RHEL9 / build (push) Successful in 4m30s
Build on RHEL8 / build (push) Successful in 5m46s
Dev/python cmd for roi
2025-11-26 15:29:40 +01:00
56e527f047 Merge branch 'developer' of github.com:slsdetectorgroup/slsDetectorPackage into dev/add_simulator_tests_in_github_workflows 2025-11-26 14:35:41 +01:00
b90851a855 clang-format 12 2025-11-26 14:15:04 +01:00
683accd914 fix unsuccesful merge in RELEASE.txt 2025-11-26 14:04:55 +01:00
30e82e4740 removed tests for eiger 2025-11-26 13:51:38 +01:00
08486b9812 rx_roi also accepts sequence of 2 ints 2025-11-26 13:51:22 +01:00
a5c661ce22 another bug for xilinx in test script 2025-11-26 13:51:08 +01:00
50448cefb4 Code Review 2025-11-26 13:50:45 +01:00
c1e5cfa101 fixed virtual detector test scripts 2025-11-26 12:25:25 +01:00
ae8c9175bf disable user id and port test 2025-11-26 12:24:48 +01:00
e7f5a2aa11 added colorama in github workflows 2025-11-26 12:24:27 +01:00
cad44943c3 wrapped virtual detector setup in a test fixture 2025-11-26 12:24:07 +01:00
d4f8049623 added tests 2025-11-26 12:23:40 +01:00
925cd55b1c API also allows single sequence for single ROI 2025-11-26 12:23:22 +01:00
ec11ba5a54 added typecaster for slsdefs::ROI and added setter and getter for ROI 2025-11-26 12:23:04 +01:00
336d218c4a some refactoring in test scripts 2025-11-26 12:14:04 +01:00
52450b41e1 removed hidden tags 2025-11-26 12:11:27 +01:00
eea4dca449 remove branch restrictions
All checks were successful
Build on local RHEL9 / build (push) Successful in 1m44s
Build on local RHEL8 / build (push) Successful in 4m34s
Build on RHEL9 / build (push) Successful in 4m31s
Build on RHEL8 / build (push) Successful in 5m47s
2025-11-26 09:11:55 +01:00
3285221e8a added RH9 workflow
All checks were successful
Build on local RHEL8 / build (push) Successful in 4m37s
Build on RHEL8 / build (push) Successful in 5m18s
Build on RHEL9 / build (push) Successful in 5m26s
Build on local RHEL9 / build (push) Successful in 1m54s
2025-11-25 17:56:20 +01:00
41fb0e08a2 raise exception upon failure for github workflows
All checks were successful
Build on RHEL8 / build (push) Successful in 5m19s
Build on RHEL9 / build (push) Successful in 5m24s
2025-11-25 17:41:45 +01:00
f728a8b7cf ../tests/scripts/test_frame_synchronizer.py 2025-11-25 17:10:20 +01:00
575b2314fe typo 2025-11-25 16:53:59 +01:00
Erik Fröjdh
f32fcf1e88 Using system libzmq in conda builds (#1327)
All checks were successful
Build on RHEL8 / build (push) Successful in 5m18s
Build on RHEL9 / build (push) Successful in 5m21s
* system (conda) libzmq
* added python 3.14 and bumped cibuildwheel version
2025-11-25 16:53:20 +01:00
57320a7227 Merge branch 'developer' of github.com:slsdetectorgroup/slsDetectorPackage into dev/add_simulator_tests_in_github_workflows 2025-11-25 16:46:36 +01:00
3b0ad0ed16 added absolute path to all slsdet command 2025-11-25 16:46:14 +01:00
3ff199822d change path to RH8
All checks were successful
Build on local RHEL8 / build (push) Successful in 4m37s
Build on RHEL8 / build (push) Successful in 5m13s
Build on RHEL9 / build (push) Successful in 6m0s
2025-11-25 16:37:42 +01:00
b7e02d5c1a some refactoring in test scripts 2025-11-25 16:34:11 +01:00
0ba9a269a1 New this build bin path script (#1335)
All checks were successful
Build on RHEL8 / build (push) Successful in 5m34s
Build on RHEL9 / build (push) Successful in 5m54s
* better this_build_bin_path script
* Put new values first in PATH and PYTHONPATH. Remove LD_LIBRARY_PATH
2025-11-25 16:29:48 +01:00
afc51c9771 testing NFS deploy 2025-11-25 16:14:33 +01:00
408160c5f1 added absolute path to sls_detector commands
All checks were successful
Build on RHEL8 / build (push) Successful in 4m46s
Build on RHEL9 / build (push) Successful in 5m59s
2025-11-25 15:52:52 +01:00
af3149cc76 debug 2025-11-25 15:19:46 +01:00
baa9f3c9b5 dont throw if process does not exist 2025-11-25 15:06:34 +01:00
e1b0aef62b debug 2025-11-25 14:55:04 +01:00
cdef349561 debug 2025-11-25 14:17:17 +01:00
daf1763832 debug 2025-11-25 13:53:02 +01:00
5bcfd05f99 more debugging 2025-11-25 12:31:21 +01:00
86045c3a1b added more debug lines 2025-11-25 12:07:44 +01:00
6c0105536e Logging for debugging 2025-11-25 11:57:12 +01:00
099965630e debug 2025-11-25 11:30:35 +01:00
955f75848f typo 2025-11-25 10:54:23 +01:00
906b52d5be indentation error 2025-11-25 08:57:30 +01:00
420bb46cf3 added simulator tests in github workflows 2025-11-25 08:51:16 +01:00
1cf9dc21ab Merge pull request #1326 from slsdetectorgroup/doc/exptime
All checks were successful
Build on RHEL9 / build (push) Successful in 4m24s
Build on RHEL8 / build (push) Successful in 5m23s
added example to time conversion
2025-11-19 16:16:34 +01:00
3b92ffb902 Merge branch 'developer' into doc/exptime
All checks were successful
Build on RHEL9 / build (push) Successful in 3m27s
Build on RHEL8 / build (push) Successful in 5m31s
2025-11-19 09:58:21 +01:00
Martin Mueller
0490c0ef23 Merge pull request #1332 from slsdetectorgroup/MH02_debug
All checks were successful
Build on RHEL9 / build (push) Successful in 3m43s
Build on RHEL8 / build (push) Successful in 5m18s
MH02 change clock switching method during periphery reset
2025-11-17 13:40:43 +01:00
af2c6eca0c MH02 change clock switching method during periphery reset 2025-11-10 10:35:20 +01:00
Erik Fröjdh
d3dc92b18b Using find_package(Threads REQUIRED) instead of linking pthread directly (#1324)
All checks were successful
Build on RHEL9 / build (push) Successful in 4m30s
Build on RHEL8 / build (push) Successful in 4m42s
* Linking to Threads::Threads instead of pthread directly 
* moved rt linking to slsSupportObject and only enable for linux
2025-10-27 16:30:40 +01:00
froejdh_e
e243af045d added example to time conversion 2025-10-27 16:28:36 +01:00
79 changed files with 1318 additions and 1897 deletions

View File

@@ -29,7 +29,6 @@ Checks: '*,
-llvmlibc-*'
HeaderFilterRegex: \.h
AnalyzeTemporaryDtors: false
FormatStyle: none
CheckOptions:
- { key: readability-identifier-naming.NamespaceCase, value: lower_case }

View File

@@ -0,0 +1,33 @@
name: Build on local RHEL8
on:
push:
branches:
- developer
workflow_dispatch:
permissions:
contents: read
jobs:
build:
runs-on: "detectors-software-RH8"
steps:
- uses: actions/checkout@v4
- name: Build library
run: |
source /home/gitea_runner/.bashrc
conda activate det
mkdir build && cd build
conda activate det
cmake .. -DSLS_USE_PYTHON=ON
make -j 2
cd ../pyctbgui
make
- name: Deploy to NFS update server
if: gitea.ref == 'refs/heads/developer'
run: |
sftp -r gitea_runner@mpc2935:/slsDetectorSoftware/RH8 <<< $'put build/bin'
sftp -r gitea_runner@mpc2935:/slsDetectorSoftware/RH8 <<< $'put pyctbgui'

View File

@@ -21,9 +21,9 @@ jobs:
- name: Build library
run: |
mkdir build && cd build
cmake .. -DSLS_USE_PYTHON=ON -DSLS_USE_TESTS=ON
cmake .. -DSLS_USE_PYTHON=ON -DSLS_USE_TESTS=ON -DSLS_USE_SIMULATOR=ON
make -j 2
- name: C++ unit tests
working-directory: ${{gitea.workspace}}/build
run: ctest
run: ctest -j1 --rerun-failed --output-on-failure

View File

@@ -0,0 +1,30 @@
name: Build on local RHEL9
on:
push:
branches:
- developer
workflow_dispatch:
permissions:
contents: read
jobs:
build:
runs-on: "detectors-software-RH9"
steps:
- uses: actions/checkout@v4
- name: Build library
run: |
mkdir build && cd build
cmake -DSLS_USE_PYTHON=ON -DPython_EXECUTABLE=/usr/bin/python3.13 -DPython_INCLUDE_DIR=/usr/include/python3.13 -DPython_LIBRARY=/usr/lib64/libpython3.13.so ..
make -j 2
cd ../pyctbgui
make
- name: Deploy to NFS update server
if: gitea.ref == 'refs/heads/developer'
run: |
sftp -r gitea_runner@mpc2935:/slsDetectorSoftware/RH9 <<< $'put build/bin'
sftp -r gitea_runner@mpc2935:/slsDetectorSoftware/RH9 <<< $'put pyctbgui'

View File

@@ -19,9 +19,9 @@ jobs:
- name: Build library
run: |
mkdir build && cd build
cmake .. -DSLS_USE_PYTHON=ON -DSLS_USE_TESTS=ON
cmake .. -DSLS_USE_PYTHON=ON -DSLS_USE_TESTS=ON -DSLS_USE_SIMULATOR=ON
make -j 2
- name: C++ unit tests
working-directory: ${{gitea.workspace}}/build
run: ctest
run: ctest -j1 --rerun-failed --output-on-failure

View File

@@ -23,7 +23,7 @@ jobs:
- uses: actions/checkout@v4
- name: Build wheels
run: pipx run cibuildwheel==2.23.0
run: pipx run cibuildwheel==3.2.1
- uses: actions/upload-artifact@v4
with:

View File

@@ -19,7 +19,7 @@ jobs:
with:
python-version: 3.12
cache: 'pip'
- run: pip install pytest numpy
- run: pip install pytest numpy colorama
- uses: awalsh128/cache-apt-pkgs-action@latest
with:
@@ -37,7 +37,7 @@ jobs:
- name: C++ unit tests
working-directory: ${{github.workspace}}/build
run: ctest -C ${{env.BUILD_TYPE}} -j1
run: ctest -C ${{env.BUILD_TYPE}} -j1 --rerun-failed --output-on-failure
- name: Python unit tests
working-directory: ${{github.workspace}}/build/bin

59
.github/workflows/run_tests.yaml vendored Normal file
View File

@@ -0,0 +1,59 @@
name: Run Simulator Tests
on:
pull_request:
branches:
- developer
- main
env:
# Customize the CMake build type here (Release, Debug, RelWithDebInfo, etc.)
BUILD_TYPE: Debug
jobs:
build:
# The CMake configure and build commands are platform agnostic and should work equally well on Windows or Mac.
# You can convert this to a matrix build if you need cross-platform coverage.
# See: https://docs.github.com/en/free-pro-team@latest/actions/learn-github-actions/managing-complex-workflows#using-a-build-matrix
runs-on: ubuntu-latest
name: Run all Simulator Tests
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: 3.12
cache: 'pip'
- run: pip install pytest numpy colorama
- uses: awalsh128/cache-apt-pkgs-action@latest
with:
packages: libhdf5-dev
version: 1.0
- name: Configure CMake
# Configure CMake in a 'build' subdirectory. `CMAKE_BUILD_TYPE` is only required if you are using a single-configuration generator such as make.
# See https://cmake.org/cmake/help/latest/variable/CMAKE_BUILD_TYPE.html?highlight=cmake_build_type
run: cmake -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} -DSLS_USE_TESTS=ON -DSLS_USE_SIMULATOR=ON -DSLS_USE_PYTHON=On #-DSLS_USE_HDF5=ON #are there hdf5 tests?
- name: Build
# Build your program with the given configuration
run: cmake --build ${{github.workspace}}/build -j4 --config ${{env.BUILD_TYPE}}
- name: Python unit tests with simulators
working-directory: ${{github.workspace}}/build/bin
run: python -m pytest -m detectorintegration ${{github.workspace}}/python/tests --detector-integration
- name: Simulator unit tests
working-directory: ${{github.workspace}}/build/bin
run: |
python test_simulators.py -nlf --disable_jungfrau --disable_xilinx_ctb
python test_frame_synchronizer.py -nlf
#- name: Upload detector logs
# uses: actions/upload-artifact@v4
# with:
# name: detector-logs
# path: |
# /tmp/*.txt

View File

@@ -24,6 +24,15 @@ include(cmake/SlsAddFlag.cmake)
include(cmake/helpers.cmake)
find_package(Threads REQUIRED)
# POSIX threads are required for the moment but we use CMake to find them
# Once migrated to std::thread this can be removed
if(NOT CMAKE_USE_PTHREADS_INIT)
message(FATAL_ERROR "A POSIX threads (pthread) implementation is required, but was not found.")
endif()
option(SLS_USE_SYSTEM_ZMQ "Use system installed libzmq" OFF)
# Using FetchContent to get libzmq
@@ -31,8 +40,6 @@ include(FetchContent)
option(SLS_FETCH_ZMQ_FROM_GITHUB "Fetch zmq from github" OFF)
option(SLS_FETCH_PYBIND11_FROM_GITHUB "Fetch pybind11 from github" OFF)
# Allow FetchContent_Populate to be called with a single argument
# otherwise deprecated warning is issued
# Note: From cmake 3.28 we can pass EXCLUDE_FROM_ALL to FetchContent_Declare
@@ -283,6 +290,11 @@ if(NOT TARGET slsProjectOptions)
target_compile_features(slsProjectOptions INTERFACE cxx_std_17)
endif()
set(LOG_MAX_REPORTING_LEVEL sls::logINFO CACHE STRING "set logging level")
target_compile_definitions(slsProjectOptions
INTERFACE LOG_MAX_REPORTING_LEVEL=${LOG_MAX_REPORTING_LEVEL}
)
if (NOT TARGET slsProjectWarnings)
add_library(slsProjectWarnings INTERFACE)
target_compile_options(slsProjectWarnings INTERFACE
@@ -332,6 +344,9 @@ if (NOT TARGET slsProjectCSettings)
-Wno-format-truncation
)
sls_disable_c_warning("-Wstringop-truncation")
target_link_libraries(slsProjectCSettings INTERFACE
Threads::Threads
)
endif()

View File

@@ -1,7 +1,7 @@
SLS Detector Package Major Release x.x.x released on xx.xx.202x
===============================================================
This document describes the differences between vx.x.x and vx.0.2
This document describes the differences between vx.x.x and v10.0.0
@@ -35,6 +35,8 @@ instead of the one included in our repo.
Experimental support for building the detector client (including python bindings) on macOS
``rx_dbitlist`` keeps the order of the passed bit list
2 On-board Detector Server Compatibility
==========================================

View File

@@ -19,6 +19,7 @@ cmake .. -G Ninja \
-DSLS_USE_PYTHON=OFF \
-DCMAKE_BUILD_TYPE=Release \
-DSLS_USE_HDF5=OFF \
-DSLS_USE_SYSTEM_ZMQ=ON \
NCORES=$(getconf _NPROCESSORS_ONLN)
echo "Building using: ${NCORES} cores"

View File

@@ -29,6 +29,7 @@ requirements:
- libtiff
- zlib
- expat
- zeromq
run:
- libstdcxx-ng

View File

@@ -2,6 +2,8 @@ python:
- 3.11
- 3.12
- 3.13
- 3.14
c_compiler:
- gcc # [linux]
@@ -13,4 +15,4 @@ cxx_compiler:
- gxx # [linux]
c_stdlib_version: # [linux]
- 2.17 # [linux]
- 2.17 # [linux]

View File

@@ -9,11 +9,11 @@ package:
build:
number: 0
script:
- unset CMAKE_GENERATOR && {{ PYTHON }} -m pip install . -vv # [not win]
- unset CMAKE_GENERATOR && {{ PYTHON }} -m pip install . -vv --config-settings=cmake.define.SLS_USE_SYSTEM_ZMQ=ON # [not win]
requirements:
build:
- python {{python}}
- python
- {{ compiler('c') }}
- {{ stdlib("c") }}
- {{ compiler('cxx') }}
@@ -21,7 +21,7 @@ requirements:
host:
- cmake
- ninja
- python {{python}}
- python
- pip
- scikit-build-core
- pybind11 >=2.13.0
@@ -31,7 +31,7 @@ requirements:
- catch2
run:
- python {{python}}
- python
- numpy

108
docs/src/Testing.rst Normal file
View File

@@ -0,0 +1,108 @@
Testing
==========
We use ``catch2`` and ``pytest`` for unit testing the C++ and Python code.
CATCH2 Tests
----------------
To build and run the catch2 tests use the following commands:
.. code-block:: console
cd build
cmake -DSLS_USE_TESTS=ON ../
bin/tests
Note that this requires that you have catch2 installed on your system.
Naming Policy:
-----------------
Per default all tests should be visible to catch2.
If a test fails in the github or gitea actions hide the test by adding the tag ``[.]`` to the test name.
.. code-block:: cpp
TEST_CASE("This test is hidden from default runs", "[.]") {
REQUIRE(1 == 2);
}
If a test requires a detector mark them with the hidden tag ``[.detectorintegration]``.
If you want to disable a specific test for a specific detector add the hidden tag ``[.disable_<detector_name>]`` to the test case.
If you want to run tests requiring detector simulators run them as follows:
.. code-block:: console
cd build
python bin/test_simulators.py
This runs all tests marked with the tag ``[.detectorintegration]`` for all detector simulators.
If you want to run them for a specific virtual detector or a specific test use the following command:
.. code-block:: console
cd build
python bin/test_simulators.py --servers <detector_name> --test <test_name>
You can run all tests requiring a detector but the disabled one for a specific detector by adding the option ``--disable_<detector_name>``.
.. code-block:: console
cd build
python bin/test_simulators.py --servers <detector_name> --test <test_name> --disable_jungfrau
Note that this still runs all the tests for the virtual jungfrau detector except for the ones marked with the tag ``[.disable_jungfrau]``.
You can additionally run all the tests not requiring detectors using the script ``bin/test_simulators.py`` by passing the option ``--general_tests``.
Pytest Tests
-----------------
To run the python tests use the following commands:
.. code-block:: console
cd build
cmake ../ -DSLS_USE_PYTHON=ON
export PYTHONPATH=$PWD/bin
python -m pytest ../python/tests/
If a test requires a detector mark them with the pytest marker ``@pytest.mark.detectorintegration``.
To run only tests requiring virtual detectors use the following command:
.. code-block:: console
#in build
python -m pytest -m detectorintegration ../python/tests/
There is a helper test fixture in ``slsDetectorSoftware/python/tests/conftest.py`` called ``test_with_simulators`` that sets up virtual detectors and yields the test for all detectors.
Example usage:
.. code-block:: python
import pytest
@pytest.mark.detectorintegration
def test_example_with_simulator(test_with_simulators):
# your test code here
If you want to run the test only for a specific test use the parametrized test fixture:
Example usage:
.. code-block:: python
import pytest
@pytest.mark.detectorintegration
@pytest.mark.parametrize("setup_parameters", [(["<my_detector>"], <num_modules>)], indirect=True)
def test_example_with_specific_simulators(test_with_simulators, setup_parameters):
# your test code here

View File

@@ -66,6 +66,7 @@ slsDetectorPackage
container_utils
type_traits
ToString
Testing
.. toctree::
:caption: Firmware

View File

@@ -50,6 +50,12 @@ datetime.timedelta, DurationWrapper or by setting the time in seconds.
>>> d.getExptime()
[sls::DurationWrapper(total_seconds: 181.23 count: 181230000000)]
# In C++ it is possible to use chrono literals to set time more easily
# d.setExptime(7ms). However, this is not possible due to pythons syntax.
# instead we can create a unit that we use for conversion.
>>> ms = dt.timedelta(milliseconds = 1)
>>> d.exptime = 7.5*ms
------------------------------------

View File

@@ -5,18 +5,18 @@ nsigma 5
gainfile none
detectorMode counting
threshold 0
pedestalfile /mnt/sls_det_storage/moench_data/testNewFW20230714/cu_half_speed_d0_f0_4.raw
pedestalfile none
nframes 0
xMin 0
xMax 400
yMin 0
yMax 400
outdir /mnt/sls_det_storage/moench_data/testNewFW20230714/clustNew/
indir /mnt/sls_det_storage/moench_data/testNewFW20230714/
outdir ./
indir ./
flist none
fformat cu_half_speed_d0_f0_4
fformat none
runmin 0
runmax 0
runmax -1
readnrows 400
eMin 0
eMax 16000

View File

@@ -1,40 +0,0 @@
# SPDX-License-Identifier: LGPL-3.0-or-other
# Copyright (C) 2021 Contributors to the SLS Detector Package
# MESSAGE( STATUS "CMAKE_CURRENT_SOURCE_DIR: " ${CMAKE_CURRENT_SOURCE_DIR} )
# MESSAGE( STATUS "PROJECT_SOURCE_DIR: " ${PROJECT_SOURCE_DIR} )
# include_directories(
# ${PROJECT_SOURCE_DIR}/catch
# )
# target_sources(tests PRIVATE
# ${CMAKE_CURRENT_SOURCE_DIR}/test-integrationMulti.cpp
# ${CMAKE_CURRENT_SOURCE_DIR}/test-integrationDectector.cpp
# ${CMAKE_CURRENT_SOURCE_DIR}/test-eigerIntegration.cpp
# )
# if(SLS_USE_TESTS)
# set(TEST_SOURCES
# src/test-slsDetector.cpp
# src/test.cpp
# )
# add_executable(detector_test ${TEST_SOURCES})
# target_link_libraries(detector_test
# slsDetectorShared
# slsProjectOptions
# slsProjectWarnings
# slsSupportLib
# pthread
# rt
# )
# set_target_properties(detector_test PROPERTIES
# RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin
# )
# endif()

View File

@@ -1,204 +0,0 @@
// SPDX-License-Identifier: LGPL-3.0-or-other
// Copyright (C) 2021 Contributors to the SLS Detector Package
#include "DetectorImpl.h"
#include "catch.hpp"
#include "sls/string_utils.h"
#include "tests/globals.h"
#include <iostream>
namespace sls {
class MultiDetectorFixture {
protected:
DetectorImpl d;
public:
MultiDetectorFixture() : d(0, true, true) {
d.setHostname(test::hostname.c_str());
if (test::my_ip != "undefined")
d.setReceiverHostname(test::my_ip);
}
~MultiDetectorFixture() { d.freeSharedMemory(); }
};
TEST_CASE_METHOD(MultiDetectorFixture, "Set and get dacs",
"[.eigerintegration][cli]") {
auto th = 1000;
// set and read back each individual dac of EIGER
d.setDAC(0, di::SVP, 0);
CHECK(d.setDAC(-1, di::SVP, 0) == 0);
d.setDAC(4000, di::SVN, 0);
CHECK(d.setDAC(-1, di::SVN, 0) == 4000);
d.setDAC(2000, di::VTR, 0);
CHECK(d.setDAC(-1, di::VTR, 0) == 2000);
d.setDAC(3500, di::VRF, 0);
CHECK(d.setDAC(-1, di::VRF, 0) == 3500);
d.setDAC(1400, di::VRS, 0);
CHECK(d.setDAC(-1, di::VRS, 0) == 1400);
d.setDAC(2556, di::VTGSTV, 0);
CHECK(d.setDAC(-1, di::VTGSTV, 0) == 2556);
d.setDAC(1500, di::VCMP_LL, 0);
CHECK(d.setDAC(-1, di::VCMP_LL, 0) == 1500);
d.setDAC(1400, di::VCMP_LR, 0);
CHECK(d.setDAC(-1, di::VCMP_LR, 0) == 1400);
d.setDAC(4000, di::CAL, 0);
CHECK(d.setDAC(-1, di::CAL, 0) == 4000);
d.setDAC(1300, di::VCMP_RL, 0);
CHECK(d.setDAC(-1, di::VCMP_RL, 0) == 1300);
d.setDAC(1200, di::VCMP_RR, 0);
CHECK(d.setDAC(-1, di::VCMP_RR, 0) == 1200);
d.setDAC(1100, di::RXB_RB, 0);
CHECK(d.setDAC(-1, di::RXB_RB, 0) == 1100);
d.setDAC(1100, di::RXB_LB, 0);
CHECK(d.setDAC(-1, di::RXB_LB, 0) == 1100);
d.setDAC(1500, di::VCP, 0);
CHECK(d.setDAC(-1, di::VCP, 0) == 1500);
d.setDAC(2000, di::VCN, 0);
CHECK(d.setDAC(-1, di::VCN, 0) == 2000);
d.setDAC(1550, di::VIS, 0);
CHECK(d.setDAC(-1, di::VIS, 0) == 1550);
d.setDAC(660, di::IO_DELAY, 0);
CHECK(d.setDAC(-1, di::IO_DELAY, 0) == 660);
// setting threshold sets all individual vcmp
d.setDAC(th, di::THRESHOLD, 0);
CHECK(d.setDAC(-1, di::THRESHOLD, 0) == th);
CHECK(d.setDAC(-1, di::VCMP_LL, 0) == th);
CHECK(d.setDAC(-1, di::VCMP_LR, 0) == th);
CHECK(d.setDAC(-1, di::VCMP_RL, 0) == th);
CHECK(d.setDAC(-1, di::VCMP_RR, 0) == th);
// different values gives -1
if (d.getNumberOfDetectors() > 1) {
d.setDAC(1600, di::VCMP_LL, 0, 0);
d.setDAC(1700, di::VCMP_LL, 0, 1);
CHECK(d.setDAC(-1, di::VCMP_LL, 0, 0) == 1600);
CHECK(d.setDAC(-1, di::VCMP_LL, 0, 1) == 1700);
CHECK(d.setDAC(-1, di::VCMP_LL, 0) == -1);
CHECK(d.setDAC(-1, di::THRESHOLD, 0) == -1);
CHECK(d.setDAC(-1, di::THRESHOLD, 0, 0) == -1);
CHECK(d.setDAC(-1, di::THRESHOLD, 0, 1) == -1);
}
}
TEST_CASE_METHOD(MultiDetectorFixture, "Read temperatures",
"[.eigerintegration][cli]") {
std::vector<di> tempindex{di::TEMPERATURE_FPGA, di::TEMPERATURE_FPGA2,
di::TEMPERATURE_FPGA3};
for (auto index : tempindex) {
for (int i = 0; i != d.getNumberOfDetectors(); ++i) {
double temp = static_cast<double>(d.getADC(index, 0)) / 1000;
CHECK(temp > 20);
CHECK(temp < 60);
}
}
}
int to_time(uint32_t reg) {
uint32_t clocks = reg >> 3;
uint32_t exponent = (reg & 0b111) + 1;
return clocks * pow(10, exponent);
}
TEST_CASE_METHOD(MultiDetectorFixture, "Read/write register",
"[.eigerintegration][cli]") {
d.setNumberOfFrames(1);
d.setExposureTime(10000);
d.acquire();
CHECK(to_time(d.readRegister(0x4, 0)) == 10000);
d.writeRegister(0x4, 500);
CHECK(d.readRegister(0x4) == 500);
}
TEST_CASE_METHOD(MultiDetectorFixture, "Set dynamic range",
"[.eigerintegration][cli][dr]") {
std::vector<int> dynamic_range{4, 8, 16, 32};
for (auto dr : dynamic_range) {
d.setDynamicRange(dr);
CHECK(d.setDynamicRange() == dr);
}
}
TEST_CASE_METHOD(MultiDetectorFixture, "Set clock divider",
"[.eigerintegration][cli][this]") {
for (int i = 0; i != 3; ++i) {
d.setSpeed(sv::CLOCK_DIVIDER, i);
CHECK(d.setSpeed(sv::CLOCK_DIVIDER) == i);
}
}
TEST_CASE_METHOD(MultiDetectorFixture, "Get time left",
"[.eigerintegration][cli]") {
CHECK_THROWS(d.getTimeLeft(ti::PROGRESS));
}
TEST_CASE_METHOD(MultiDetectorFixture, "Get ID", "[.eigerintegration][cli]") {
std::string hn = test::hostname;
hn.erase(std::remove(begin(hn), end(hn), 'b'), end(hn));
hn.erase(std::remove(begin(hn), end(hn), 'e'), end(hn));
auto hostnames = split(hn, '+');
CHECK(hostnames.size() == d.getNumberOfDetectors());
for (int i = 0; i != d.getNumberOfDetectors(); ++i) {
CHECK(d.getId(defs::DETECTOR_SERIAL_NUMBER, 0) ==
std::stoi(hostnames[0]));
}
}
TEST_CASE_METHOD(MultiDetectorFixture, "Lock server",
"[.eigerintegration][cli]") {
d.lockServer(1);
CHECK(d.lockServer() == 1);
d.lockServer(0);
CHECK(d.lockServer() == 0);
}
TEST_CASE_METHOD(MultiDetectorFixture, "Settings", "[.eigerintegration][cli]") {
CHECK(d.setSettings(defs::STANDARD) == defs::STANDARD);
}
TEST_CASE_METHOD(MultiDetectorFixture, "Set readout flags",
"[.eigerintegration][cli]") {
d.setReadOutFlags(defs::PARALLEL);
CHECK((d.setReadOutFlags() & defs::PARALLEL));
d.setReadOutFlags(defs::NONPARALLEL);
CHECK_FALSE((d.setReadOutFlags() & defs::PARALLEL));
CHECK((d.setReadOutFlags() & defs::NONPARALLEL));
}
// TEST_CASE_METHOD(MultiDetectorFixture, "Flow control and tengiga",
// "[.eigerintegration][cli]") {
// d.setFlowControl10G(1);
// CHECK(d.setFlowControl10G() == 1);
// d.setFlowControl10G(0);
// CHECK(d.setFlowControl10G() == 0);
// d.enableTenGigabitEthernet(1);
// CHECK(d.enableTenGigabitEthernet() == 1);
// d.enableTenGigabitEthernet(0);
// CHECK(d.enableTenGigabitEthernet() == 0);
// }
TEST_CASE_METHOD(MultiDetectorFixture, "activate", "[.eigerintegration][cli]") {
d.activate(0);
CHECK(d.activate() == 0);
d.activate(1);
CHECK(d.activate() == 1);
}
TEST_CASE_METHOD(MultiDetectorFixture, "all trimbits",
"[.eigerintegration][cli]") {
d.setAllTrimbits(32);
CHECK(d.setAllTrimbits(-1) == 32);
}
TEST_CASE_METHOD(MultiDetectorFixture, "rate correction",
"[.eigerintegration][cli]") {
d.setRateCorrection(200);
CHECK(d.getRateCorrection() == 200);
}
} // namespace sls

View File

@@ -1,522 +0,0 @@
// SPDX-License-Identifier: LGPL-3.0-or-other
// Copyright (C) 2021 Contributors to the SLS Detector Package
#include "catch.hpp"
#include "DetectorImpl.h"
#include "Module.h"
#include "sls/ClientSocket.h"
#include "sls/logger.h"
#include "sls/sls_detector_defs.h"
#include "sls/Timer.h"
#include "sls/sls_detector_funcs.h"
#include <iostream>
#include <vector>
#define VERBOSE
// Header holding all configurations for different detectors
#include "tests/config.h"
#include "tests/globals.h"
// using namespace test;
// using dt = slsDetectorDefs::detectorType;
// extern std::string hostname;
// extern std::string detector_type;
// extern dt type;
namespace sls {
TEST_CASE("Single detector no receiver", "[.integration][.single]") {
auto t = Module::getTypeFromDetector(test::hostname);
CHECK(t == test::type);
Module d(t);
CHECK(d.getDetectorTypeAsEnum() == t);
CHECK(d.getDetectorTypeAsString() == test::detector_type);
d.setHostname(test::hostname);
CHECK(d.getHostname() == test::hostname);
CHECK(d.setDetectorType() == test::type);
d.freeSharedMemory();
}
TEST_CASE("Set control port then create a new object with this control port",
"[.integration][.single]") {
/*
TODO!
Standard port but should not be hardcoded
Is this the best way to initialize the detectors
Using braces to make the object go out of scope
*/
int old_cport = DEFAULT_TCP_CNTRL_PORTNO;
int old_sport = DEFAULT_TCP_STOP_PORTNO;
int new_cport = 1993;
int new_sport = 2000;
{
Module d(test::type);
d.setHostname(test::hostname);
CHECK(d.getControlPort() == old_cport);
d.setControlPort(new_cport);
CHECK(d.getStopPort() == old_sport);
d.setStopPort(new_sport);
d.freeSharedMemory();
}
{
Module d(test::type);
d.setHostname(test::hostname);
d.setControlPort(new_cport);
d.setStopPort(new_sport);
CHECK(d.getControlPort() == new_cport);
CHECK(d.getStopPort() == new_sport);
// Reset standard ports
d.setControlPort(old_cport);
d.setStopPort(old_sport);
d.freeSharedMemory();
}
Module d(test::type);
d.setHostname(test::hostname);
CHECK(d.getStopPort() == DEFAULT_TCP_STOP_PORTNO);
d.freeSharedMemory();
}
TEST_CASE("single EIGER detector no receiver basic set and get",
"[.integration][eiger]") {
// TODO! this test should take command line arguments for config
SingleDetectorConfig c;
// Read type by connecting to the detector
auto type = Module::getTypeFromDetector(c.hostname);
CHECK(type == c.type_enum);
// Create Module of said type and set hostname and detector online
Module d(type);
CHECK(d.getDetectorTypeAsEnum() == type);
CHECK(d.getDetectorTypeAsString() == c.type_string);
d.setHostname(c.hostname);
CHECK(d.getHostname() == c.hostname);
CHECK(d.getUseReceiverFlag() == false);
CHECK_NOTHROW(d.checkDetectorVersionCompatibility());
// Setting and reading exposure time
auto t = 1000000000;
d.setExptime(t);
CHECK(d.getExptime() == t);
// size of an eiger half module with and without gap pixels
CHECK(d.getTotalNumberOfChannels() == 256 * 256 * 4);
CHECK(d.getTotalNumberOfChannels(slsDetectorDefs::dimension::X) == 1024);
CHECK(d.getTotalNumberOfChannels(slsDetectorDefs::dimension::Y) == 256);
// CHECK(d.getTotalNumberOfChannels(slsDetectorDefs::dimension::Z) == 1);
CHECK(d.getTotalNumberOfChannelsInclGapPixels(
slsDetectorDefs::dimension::X) == 1024);
CHECK(d.getTotalNumberOfChannelsInclGapPixels(
slsDetectorDefs::dimension::Y) == 256);
// CHECK(d.getTotalNumberOfChannelsInclGapPixels(slsDetectorDefs::dimension::Z)
// == 1);
CHECK(d.getNChans() == 256 * 256);
CHECK(d.getNChans(slsDetectorDefs::dimension::X) == 256);
CHECK(d.getNChans(slsDetectorDefs::dimension::Y) == 256);
// CHECK(d.getNChans(slsDetectorDefs::dimension::Z) == 1);
CHECK(d.getNChips() == 4);
CHECK(d.getNChips(slsDetectorDefs::dimension::X) == 4);
CHECK(d.getNChips(slsDetectorDefs::dimension::Y) == 1);
// CHECK(d.getNChips(slsDetectorDefs::dimension::Z) == 1);
d.freeSharedMemory();
}
TEST_CASE("Locking mechanism and last ip", "[.integration][.single]") {
Module d(test::type);
d.setHostname(test::hostname);
// Check that detector server is unlocked then lock
CHECK(d.lockServer() == 0);
d.lockServer(1);
CHECK(d.lockServer() == 1);
// Can we still access the detector while it's locked
auto t = 1300000000;
d.setExptime(t);
CHECK(d.getExptime() == t);
// unlock again and free
d.lockServer(0);
CHECK(d.lockServer() == 0);
CHECK(d.getLastClientIP() == test::my_ip);
d.freeSharedMemory();
}
TEST_CASE("Set settings", "[.integration][.single]") {
Module d(test::type);
d.setHostname(test::hostname);
CHECK(d.setSettings(defs::STANDARD) == defs::STANDARD);
}
TEST_CASE("Timer functions", "[.integration][cli]") {
// FRAME_NUMBER, /**< number of real time frames: total number of
// acquisitions is number or frames*number of triggers */ ACQUISITION_TIME,
// /**< exposure time */ FRAME_PERIOD, /**< period between exposures */
// DELAY_AFTER_TRIGGER, /**< delay between trigger and start of exposure or
// readout (in triggered mode) */ GATES_NUMBER, /**< number of gates per
// frame (in gated mode) */ TRIGGER_NUMBER, /**< number of triggers: total
// number of acquisitions is number or frames*number of triggers */
// ACTUAL_TIME, /**< Actual time of the detector's internal timer */
// MEASUREMENT_TIME, /**< Time of the measurement from the detector (fifo)
// */
// PROGRESS, /**< fraction of measurement elapsed - only get! */
// MEASUREMENTS_NUMBER,
// FRAMES_FROM_START,
// FRAMES_FROM_START_PG,
// SAMPLES,
// SUBFRAME_ACQUISITION_TIME, /**< subframe exposure time */
// STORAGE_CELL_NUMBER, /**<number of storage cells */
// SUBFRAME_DEADTIME, /**< subframe deadtime */
// MEASURED_PERIOD, /**< measured period */
// MEASURED_SUBPERIOD, /**< measured subperiod */
// MAX_TIMERS
Module d(test::type);
d.setHostname(test::hostname);
// Number of frames
auto frames = 5;
d.setNumberOfFrames(frames);
CHECK(d.getNumberOfFrames() == frames);
auto exptime = 2000000000;
d.setExptime(exptime);
CHECK(d.getExptime() == exptime);
auto period = 2000000000;
d.setPeriod(period);
CHECK(d.getPeriod() == period);
if (test::type != dt::EIGER) {
auto delay = 10000;
d.setDelayAfterTrigger(delay);
CHECK(d.getDelayAfterTrigger() == delay);
}
auto triggers = 2;
d.setNumberOfTriggers(triggers);
CHECK(d.getNumberOfTriggers() == triggers);
if (test::type == dt::EIGER) {
auto subtime = 200;
d.setSubExptime(subtime);
CHECK(d.getSubExptime() == subtime);
}
// for (int i =0; i!=frames; ++i)
d.startAndReadAll();
d.freeSharedMemory();
}
// TEST_CASE("Aquire", "[.integration][eiger]"){
// SingleDetectorConfig c;
// auto type = Module::getTypeFromDetector(c.hostname);
// Module d(type);
// d.setHostname(c.hostname);
// auto period = 1000000000;
// auto exptime = 100000000;
// d.setNumberOfFrames(5);
// d.setExptime(exptime);
// d.setPeriod(period);
// d.startAndReadAll();
// auto rperiod =
// d.getMeasuredPeriod();
// CHECK(rperiod == 0.1);
// d.freeSharedMemory();
// }
TEST_CASE(
"Eiger Dynamic Range with effect on rate correction and clock divider",
"[.eigerintegration]") {
SingleDetectorConfig c;
int ratecorr = 125;
// pick up multi detector from shm id 0
DetectorImpl m(0);
// ensure eiger detector type, hostname and online
REQUIRE(m.getDetectorTypeAsEnum() == c.type_enum);
REQUIRE(m.getHostname() == c.hostname);
// starting state with rate correction off
m.setRateCorrection(0);
// dr 16: clk divider, no change for ratecorr
CHECK(m.setDynamicRange(16) == 16);
CHECK(m.setSpeed(slsDetectorDefs::CLOCK_DIVIDER) == 1);
CHECK(m.getRateCorrection() == 0);
// dr 32: clk divider, no change for ratecorr
CHECK(m.setDynamicRange(32) == 32);
CHECK(m.setSpeed(slsDetectorDefs::CLOCK_DIVIDER) == 2);
CHECK(m.getRateCorrection() == 0);
// other drs: no change for clk divider, no change for ratecorr
CHECK(m.setDynamicRange(8) == 8);
CHECK(m.setSpeed(slsDetectorDefs::CLOCK_DIVIDER) == 2);
CHECK(m.getRateCorrection() == 0);
CHECK(m.setDynamicRange(4) == 4);
CHECK(m.setSpeed(slsDetectorDefs::CLOCK_DIVIDER) == 2);
CHECK(m.getRateCorrection() == 0);
// switching on rate correction with dr 16, 32
m.setDynamicRange(16);
m.setRateCorrection(ratecorr);
CHECK(m.getRateCorrection() == ratecorr);
m.setDynamicRange(32);
CHECK(m.getRateCorrection() == ratecorr);
// ratecorr fail with dr 4 or 8
CHECK_THROWS_AS(m.setDynamicRange(8), RuntimeError);
CHECK(m.getRateCorrection() == 0);
m.setDynamicRange(16);
m.setDynamicRange(16);
m.setRateCorrection(ratecorr);
m.setDynamicRange(16);
m.setRateCorrection(ratecorr);
CHECK_THROWS_AS(m.setDynamicRange(4), RuntimeError);
CHECK(m.getRateCorrection() == 0);
}
TEST_CASE("Chiptestboard Loading Patterns", "[.ctbintegration]") {
SingleDetectorConfig c;
// pick up multi detector from shm id 0
DetectorImpl m(0);
// ensure ctb detector type, hostname and online
REQUIRE(m.getDetectorTypeAsEnum() == c.type_enum);
REQUIRE(m.getHostname() == c.hostname);
uint64_t word = 0;
int addr = 0;
int level = 0;
const int MAX_ADDR = 0x7fff;
word = 0xc000000000f47ff;
CHECK(m.setPatternIOControl(word) == word);
CHECK(m.setPatternIOControl(-1) == word);
CHECK(m.setPatternIOControl(0) == 0);
CHECK(m.setPatternClockControl(word) == word);
CHECK(m.setPatternClockControl(-1) == word);
CHECK(m.setPatternClockControl(0) == 0);
// testing pattern word will execute the pattern as well
addr = 0;
m.setPatternWord(addr, word);
CHECK(m.setPatternWord(addr, -1) == word);
addr = MAX_ADDR - 1;
m.setPatternWord(addr, word);
CHECK(m.setPatternWord(addr, -1) == word);
addr = 0x2FF;
m.setPatternWord(addr, word);
CHECK(m.setPatternWord(addr, -1) == word);
addr = MAX_ADDR;
CHECK_THROWS_AS(m.setPatternWord(addr, word), RuntimeError);
CHECK_THROWS_WITH(m.setPatternWord(addr, word),
Catch::Matchers::Contains("be between 0 and"));
addr = -1;
CHECK_THROWS_AS(m.setPatternWord(addr, word), RuntimeError);
CHECK_THROWS_WITH(m.setPatternWord(addr, word),
Catch::Matchers::Contains("be between 0 and"));
addr = 0x2FF;
for (level = 0; level < 3; ++level) {
CHECK(m.setPatternWaitAddr(level, addr) == addr);
CHECK(m.setPatternWaitAddr(level, -1) == addr);
}
CHECK_THROWS_WITH(m.setPatternWaitAddr(-1, addr),
Catch::Matchers::Contains("be between 0 and"));
CHECK_THROWS_WITH(m.setPatternWaitAddr(0, MAX_ADDR),
Catch::Matchers::Contains("be between 0 and"));
for (level = 0; level < 3; ++level) {
CHECK(m.setPatternWaitTime(level, word) == word);
CHECK(m.setPatternWaitTime(level, -1) == word);
}
CHECK_THROWS_WITH(m.setPatternWaitTime(-1, word),
Catch::Matchers::Contains("be between 0 and"));
{
int startaddr = addr;
int stopaddr = addr + 5;
int nloops = 2;
for (level = 0; level < 3; ++level) {
m.setPatternLoops(level, startaddr, stopaddr, nloops);
auto r = m.getPatternLoops(level);
CHECK(r[0] == startaddr);
CHECK(r[1] == stopaddr);
CHECK(r[2] == nloops);
}
m.setPatternLoops(-1, startaddr, stopaddr, nloops);
auto r = m.getPatternLoops(-1);
CHECK(r[0] == startaddr);
CHECK(r[1] == stopaddr);
CHECK(r[2] == -1);
CHECK_THROWS_WITH(m.setPatternLoops(-1, startaddr, MAX_ADDR, nloops),
Catch::Matchers::Contains("be less than"));
CHECK_THROWS_WITH(m.setPatternLoops(-1, MAX_ADDR, stopaddr, nloops),
Catch::Matchers::Contains("be less than"));
}
}
TEST_CASE("Chiptestboard Dbit offset, list, sampling, advinvert",
"[.ctbintegration][dbit]") {
SingleDetectorConfig c;
// pick up multi detector from shm id 0
DetectorImpl m(0);
// ensure ctb detector type, hostname and online
REQUIRE(m.getDetectorTypeAsEnum() == c.type_enum);
REQUIRE(m.getHostname() == c.hostname);
// dbit offset
m.setReceiverDbitOffset(0);
CHECK(m.getReceiverDbitOffset() == 0);
m.setReceiverDbitOffset(-1);
CHECK(m.getReceiverDbitOffset() == 0);
m.setReceiverDbitOffset(5);
CHECK(m.getReceiverDbitOffset() == 5);
// dbit list
std::vector<int> list = m.getReceiverDbitList();
list.clear();
for (int i = 0; i < 10; ++i)
list.push_back(i);
m.setReceiverDbitList(list);
CHECK(m.getReceiverDbitList().size() == 10);
list.push_back(64);
CHECK_THROWS_AS(m.setReceiverDbitList(list), RuntimeError);
CHECK_THROWS_WITH(m.setReceiverDbitList(list),
Catch::Matchers::Contains("be between 0 and 63"));
list.clear();
for (int i = 0; i < 65; ++i)
list.push_back(i);
CHECK(list.size() == 65);
CHECK_THROWS_WITH(m.setReceiverDbitList(list),
Catch::Matchers::Contains("be greater than 64"));
list.clear();
m.setReceiverDbitList(list);
CHECK(m.getReceiverDbitList().empty());
// adcinvert
m.setADCInvert(0);
CHECK(m.getADCInvert() == 0);
m.setADCInvert(5);
CHECK(m.getADCInvert() == 5);
m.setADCInvert(-1);
CHECK(m.getADCInvert() == -1);
// ext sampling reg
m.setExternalSamplingSource(0);
CHECK(m.getExternalSamplingSource() == 0);
m.setExternalSamplingSource(62);
CHECK(m.getExternalSamplingSource() == 62);
CHECK_THROWS_WITH(m.setExternalSamplingSource(64),
Catch::Matchers::Contains("be 0-63"));
CHECK(m.getExternalSamplingSource() == 62);
m.setExternalSampling(1);
CHECK(m.getExternalSampling() == 1);
m.setExternalSampling(0);
CHECK(m.getExternalSampling() == 0);
m.setExternalSampling(1);
CHECK(m.getExternalSampling() == 1);
CHECK(m.readRegister(0x7b) == 0x1003E);
}
TEST_CASE("Eiger or Jungfrau nextframenumber",
"[.eigerintegration][.jungfrauintegration][nextframenumber]") {
SingleDetectorConfig c;
// pick up multi detector from shm id 0
DetectorImpl m(0);
// ensure ctb detector type, hostname and online
REQUIRE(
((m.getDetectorTypeAsEnum() == slsDetectorDefs::detectorType::EIGER) ||
(m.getDetectorTypeAsEnum() ==
slsDetectorDefs::detectorType::JUNGFRAU)));
REQUIRE(m.getHostname() == c.hostname);
CHECK(m.setNumberOfFrames(1) == 1);
// starting fnum
uint64_t val = 8;
m.setNextFrameNumber(val);
CHECK(m.getNextFrameNumber() == val);
CHECK(m.acquire() == slsDetectorDefs::OK);
CHECK(m.getReceiverCurrentFrameIndex() == val);
++val;
CHECK(m.acquire() == slsDetectorDefs::OK);
CHECK(m.getReceiverCurrentFrameIndex() == val);
CHECK_THROWS_AS(m.setNextFrameNumber(0), RuntimeError);
if (m.getDetectorTypeAsString() == "Eiger") {
val = 281474976710655;
} else if (m.getDetectorTypeAsString() == "Jungfrau") {
val = 18446744073709551615;
}
m.setNextFrameNumber(val);
CHECK(m.getNextFrameNumber() == val);
CHECK(m.acquire() == slsDetectorDefs::OK);
CHECK(m.getReceiverCurrentFrameIndex() == val);
CHECK(m.getNextFrameNumber() == (val + 1));
}
TEST_CASE("Eiger partialread", "[.eigerintegration][partialread]") {
SingleDetectorConfig c;
// pick up multi detector from shm id 0
DetectorImpl m(0);
// ensure detector type, hostname
REQUIRE(
(m.getDetectorTypeAsEnum() == slsDetectorDefs::detectorType::EIGER));
REQUIRE(m.getHostname() == c.hostname);
m.setDynamicRange(16);
m.enableTenGigabitEthernet(0);
m.setPartialReadout(256);
CHECK(m.getPartialReadout() == 256);
m.setPartialReadout(1);
CHECK(m.getPartialReadout() == 1);
m.setDynamicRange(8);
m.setPartialReadout(256);
CHECK(m.getPartialReadout() == 256);
CHECK_THROWS_AS(m.setPartialReadout(1), RuntimeError);
CHECK(m.getPartialReadout() == 256);
CHECK_THROWS_AS(m.setPartialReadout(0), RuntimeError);
m.setPartialReadout(256);
}
} // namespace sls

View File

@@ -1,108 +0,0 @@
// SPDX-License-Identifier: LGPL-3.0-or-other
// Copyright (C) 2021 Contributors to the SLS Detector Package
#include "DetectorImpl.h"
#include "catch.hpp"
#include "sls/string_utils.h"
#include "tests/globals.h"
#include <iostream>
namespace sls {
using namespace Catch::literals;
TEST_CASE("Initialize a multi detector", "[.integration][.multi]") {
auto hostnames = split(test::hostname, '+');
DetectorImpl d(0, true, true);
d.setHostname(test::hostname.c_str());
CHECK(d.getHostname() == test::hostname);
for (size_t i = 0; i != hostnames.size(); ++i) {
CHECK(d.getHostname(i) == hostnames[i]);
}
CHECK(d.getDetectorTypeAsEnum() == test::type);
CHECK(d.getDetectorTypeAsString() == test::detector_type);
CHECK(d.getNumberOfDetectors() == hostnames.size());
d.freeSharedMemory();
}
TEST_CASE("Set and read timers", "[.integration][.multi]") {
DetectorImpl d(0, true, true);
d.setHostname(test::hostname.c_str());
// FRAME_NUMBER
int n_frames = 3;
d.setNumberOfFrames(n_frames);
CHECK(d.setNumberOfFrames() == n_frames);
// ACQUISITION_TIME
double exptime = 0.3;
d.setExposureTime(exptime, true);
CHECK(d.setExposureTime(-1, true) == Approx(exptime));
CHECK(d.setExposureTime(-1) == Approx(exptime * 1E9));
// FRAME_PERIOD,
double period = 0.5;
d.setExposurePeriod(period, true);
CHECK(d.setExposurePeriod(-1, true) == Approx(period));
CHECK(d.setExposurePeriod(-1) == Approx(period * 1E9));
// DELAY_AFTER_TRIGGER,
// GATES_NUMBER,
// TRIGGER_NUMBER,
// ACTUAL_TIME
// MEASUREMENT_TIME
// PROGRESS, /**< fraction of measurement elapsed - only get! */
// MEASUREMENTS_NUMBER,
// FRAMES_FROM_START,
// FRAMES_FROM_START_PG,
// SAMPLES,
// SUBFRAME_ACQUISITION_TIME, /**< subframe exposure time */
double subframe_exposure = 2000000; // ns
if (test::type == dt::EIGER) {
d.setSubFrameExposureTime(subframe_exposure);
CHECK(d.setSubFrameExposureTime(-1) == Approx(subframe_exposure));
}
// STORAGE_CELL_NUMBER, /**<number of storage cells */
// SUBFRAME_DEADTIME, /**< subframe deadtime */
double subframe_deadtime = 4000; // ns
if (test::type == dt::EIGER) {
d.setSubFrameExposureDeadTime(subframe_deadtime);
CHECK(d.setSubFrameExposureDeadTime(-1) == Approx(subframe_deadtime));
}
if (test::type == dt::EIGER) {
// 32bit is needed for subframe exposure
d.setDynamicRange(32);
CHECK(d.setDynamicRange(-1) == 32);
d.setReadOutFlags(ro::PARALLEL);
// Needed to have measured values
d.acquire();
// MEASURED_PERIOD, /**< measured period */
for (int i = 0; i != d.getNumberOfDetectors(); ++i) {
CHECK(d.getMeasuredPeriod(true, i) == Approx(period));
}
// MEASURED_SUBPERIOD, /**< measured subperiod */
for (int i = 0; i != d.getNumberOfDetectors(); ++i) {
CHECK(d.getMeasuredSubFramePeriod(false, i) ==
Approx(subframe_deadtime + subframe_exposure));
}
}
// MAX_TIMERS
d.freeSharedMemory();
}
} // namespace sls

View File

@@ -1,5 +0,0 @@
// SPDX-License-Identifier: LGPL-3.0-or-other
// Copyright (C) 2021 Contributors to the SLS Detector Package
// tests-main.cpp
#define CATCH_CONFIG_MAIN
#include "catch.hpp"

View File

@@ -17,7 +17,7 @@ dependencies = [
[tool.cibuildwheel]
before-all = "uname -a"
build = "cp{311,312,313}-manylinux_x86_64"
build = "cp{311,312,313,314}-manylinux_x86_64"
[tool.scikit-build.build]
verbose = true

View File

@@ -24,6 +24,7 @@ import datetime as dt
from functools import wraps
from collections import namedtuple
from collections.abc import Sequence
import socket
import numpy as np
@@ -301,6 +302,46 @@ class Detector(CppDetectorApi):
def rx_arping(self, value):
ut.set_using_dict(self.setRxArping, value)
@property
def rx_roi(self):
"""Gets the list of ROIs configured in the receiver.
Note
-----
Each ROI is represented as a tuple of (x_start, y_start, x_end, y_end). \n
If no ROIs are configured, returns [[-1,-1,-1,-1]].
"""
return self.getRxROI() #vector of Roi structs how represented?
@rx_roi.setter
def rx_roi(self, rois):
"""
Sets the list of ROIs in the receiver.
Can only set multiple ROIs at multi module level without gap pixels. If more than 1 ROI per
UDP port, it will throw. Setting number of udp interfaces will clear the
roi. Cannot be set for CTB or Xilinx CTB.
Note
-----
Each ROI should be represented as a sequence of 4 ints (x_start, y_start, x_end, y_end). \n
For mythen3 or gotthard2 pass a sequence of 2 ints (x_start, x_end) \n
For multiple ROI's pass a sequence of sequence \n
Example: [[0, 100, 50, 100], [260, 270, 50,100]] \n
"""
# TODO: maybe better to accept py::object in setRxROI and handle there?
if not isinstance(rois, Sequence):
raise TypeError(
"setRxROI failed: expected a tuple/list of ints x_min, x_max, y_min, y_max "
"or a sequence of such."
)
if(not isinstance(rois[0], Sequence)):
self.setRxROI([rois])
else:
self.setRxROI(rois)
def rx_clearroi(self):
"""Clears all the ROIs configured in the receiver."""
self.clearRxROI()
@property
@element

View File

@@ -942,6 +942,7 @@ void init_det(py::module &m) {
(void (Detector::*)(const std::vector<defs::ROI> &)) &
Detector::setRxROI,
py::arg());
CppDetectorApi.def("clearRxROI",
(void (Detector::*)()) & Detector::clearRxROI);
CppDetectorApi.def(

View File

@@ -1,11 +1,12 @@
// SPDX-License-Identifier: LGPL-3.0-or-other
// Copyright (C) 2021 Contributors to the SLS Detector Package
#pragma once
#include <pybind11/pybind11.h>
#include <datetime.h>
#include <pybind11/pybind11.h>
#include "sls/Result.h"
#include "DurationWrapper.h"
#include "sls/Result.h"
#include "sls/sls_detector_defs.h"
namespace py = pybind11;
namespace pybind11 {
@@ -14,84 +15,130 @@ template <typename Type, typename Alloc>
struct type_caster<sls::Result<Type, Alloc>>
: list_caster<sls::Result<Type, Alloc>, Type> {};
// Based on the typecaster in pybind11/chrono.h
template <> struct type_caster<std::chrono::nanoseconds> {
public:
PYBIND11_TYPE_CASTER(std::chrono::nanoseconds, const_name("DurationWrapper"));
public:
PYBIND11_TYPE_CASTER(std::chrono::nanoseconds,
const_name("DurationWrapper"));
// signed 25 bits required by the standard.
using days = std::chrono::duration<int_least32_t, std::ratio<86400>>;
// signed 25 bits required by the standard.
using days = std::chrono::duration<int_least32_t, std::ratio<86400>>;
/**
* Conversion part 1 (Python->C++): convert a PyObject into std::chrono::nanoseconds
* try datetime.timedelta, floats and our DurationWrapper wrapper
*/
/**
* Conversion part 1 (Python->C++): convert a PyObject into
* std::chrono::nanoseconds try datetime.timedelta, floats and our
* DurationWrapper wrapper
*/
bool load(handle src, bool) {
using namespace std::chrono;
bool load(handle src, bool) {
using namespace std::chrono;
// Lazy initialise the PyDateTime import
if (!PyDateTimeAPI) {
PyDateTime_IMPORT;
}
// Lazy initialise the PyDateTime import
if (!PyDateTimeAPI) {
PyDateTime_IMPORT;
}
if (!src) {
if (!src) {
return false;
}
// If invoked with datetime.delta object, same as in chrono.h
if (PyDelta_Check(src.ptr())) {
value = duration_cast<nanoseconds>(
days(PyDateTime_DELTA_GET_DAYS(src.ptr())) +
seconds(PyDateTime_DELTA_GET_SECONDS(src.ptr())) +
microseconds(PyDateTime_DELTA_GET_MICROSECONDS(src.ptr()))
);
return true;
}
// If invoked with a float we assume it is seconds and convert, same as
// in chrono.h
if (PyFloat_Check(src.ptr())) {
value = duration_cast<nanoseconds>(
duration<double>(PyFloat_AsDouble(src.ptr())));
return true;
}
// If invoked with an int we assume it is nanoseconds and convert, same
// as in chrono.h
if (PyLong_Check(src.ptr())) {
value = duration_cast<nanoseconds>(
duration<int64_t>(PyLong_AsLongLong(src.ptr())));
return true;
}
// Lastly if we were actually called with a DurationWrapper object we
// get the number of nanoseconds and create a std::chrono::nanoseconds
// from it
py::object py_cls =
py::module::import("slsdet._slsdet").attr("DurationWrapper");
if (py::isinstance(src, py_cls)) {
sls::DurationWrapper *cls = src.cast<sls::DurationWrapper *>();
value = nanoseconds(cls->count());
return true;
}
return false;
}
/**
* Conversion part 2 (C++ -> Python)
* import the module to get a handle to the wrapped class
* Default construct an object of (wrapped) DurationWrapper
* set the count from chrono::nanoseconds and return
*/
static handle cast(std::chrono::nanoseconds src,
return_value_policy /* policy */, handle /* parent */) {
py::object py_cls =
py::module::import("slsdet._slsdet").attr("DurationWrapper");
py::object *obj = new py::object;
*obj = py_cls();
sls::DurationWrapper *dur = obj->cast<sls::DurationWrapper *>();
dur->set_count(src.count());
return *obj;
}
};
// Type caster for sls::defs::ROI from tuple
template <> struct type_caster<sls::defs::ROI> {
PYBIND11_TYPE_CASTER(sls::defs::ROI, _("Sequence[int, int, int, int] or "
"Sequence[int, int]"));
// convert c++ ROI to python tuple
static handle cast(const sls::defs::ROI &roi, return_value_policy, handle) {
return py::make_tuple(roi.xmin, roi.xmax, roi.ymin, roi.ymax).release();
}
// convert from python to c++ ROI
bool load(handle roi, bool /*allow implicit conversion*/) {
// accept tuple, list, numpy array any sequence
py::sequence seq;
try {
seq = py::reinterpret_borrow<py::sequence>(roi);
} catch (...) {
return false;
}
if (seq.size() != 4 && seq.size() != 2)
return false;
// Check if each element is an int
for (auto item : seq) {
if (!py::isinstance<py::int_>(item)) {
return false;
}
// If invoked with datetime.delta object, same as in chrono.h
if (PyDelta_Check(src.ptr())) {
value = duration_cast<nanoseconds>(
days(PyDateTime_DELTA_GET_DAYS(src.ptr())) +
seconds(PyDateTime_DELTA_GET_SECONDS(src.ptr())) +
microseconds(PyDateTime_DELTA_GET_MICROSECONDS(src.ptr()))
);
return true;
}
// If invoked with a float we assume it is seconds and convert, same as in chrono.h
if (PyFloat_Check(src.ptr())) {
value = duration_cast<nanoseconds>(duration<double>(PyFloat_AsDouble(src.ptr())));
return true;
}
// If invoked with an int we assume it is nanoseconds and convert, same as in chrono.h
if (PyLong_Check(src.ptr())) {
value = duration_cast<nanoseconds>(duration<int64_t>(PyLong_AsLongLong(src.ptr())));
return true;
}
// Lastly if we were actually called with a DurationWrapper object we get
// the number of nanoseconds and create a std::chrono::nanoseconds from it
py::object py_cls = py::module::import("slsdet._slsdet").attr("DurationWrapper");
if (py::isinstance(src, py_cls)){
sls::DurationWrapper *cls = src.cast<sls::DurationWrapper *>();
value = nanoseconds(cls->count());
return true;
}
return false;
}
/**
* Conversion part 2 (C++ -> Python)
* import the module to get a handle to the wrapped class
* Default construct an object of (wrapped) DurationWrapper
* set the count from chrono::nanoseconds and return
*/
static handle cast(std::chrono::nanoseconds src, return_value_policy /* policy */, handle /* parent */) {
py::object py_cls = py::module::import("slsdet._slsdet").attr("DurationWrapper");
py::object* obj = new py::object;
*obj = py_cls();
sls::DurationWrapper *dur = obj->cast<sls::DurationWrapper *>();
dur->set_count(src.count());
return *obj;
value.xmin = seq[0].cast<int>();
value.xmax = seq[1].cast<int>();
if (seq.size() == 4) {
value.ymin = seq[2].cast<int>();
value.ymax = seq[3].cast<int>();
}
};
return true;
}
};
} // namespace detail
} // namespace pybind11

84
python/tests/conftest.py Normal file
View File

@@ -0,0 +1,84 @@
import pytest
import sys
import traceback
from pathlib import Path
current_dir = Path(__file__).resolve().parents[2]
scripts_dir = current_dir / "tests" / "scripts"
sys.path.append(str(scripts_dir))
from utils_for_test import (
Log,
LogLevel,
cleanup,
startReceiver,
startDetectorVirtualServer,
loadConfig,
loadBasicSettings,
connectToVirtualServers,
DEFAULT_UDP_DST_PORTNO,
)
def pytest_addoption(parser):
parser.addoption(
"--detector-integration", action="store_true", default=False, help="Run tests that require detectors"
)
def pytest_configure(config):
config.addinivalue_line("markers", "detectorintegration: mark test as needing detectors to run")
def pytest_collection_modifyitems(config, items):
if config.getoption("--detector-integration"):
return
skip = pytest.mark.skip(reason="need --detector-integration option to run")
for item in items:
if "detectorintegration" in item.keywords:
item.add_marker(skip)
#helper fixture for servers
@pytest.fixture(scope='module')
def setup_parameters(request): # only setup once per module if same parameters used for the scopes
try:
servers, nmods = request.param # comes from @pytest.mark.parametrize(..., indirect=True)
return servers, nmods
except AttributeError:
# fallback default if the test did not parametrize
return (['eiger', 'jungfrau', 'mythen3', 'gotthard2', 'ctb', 'moench', 'xilinx_ctb'], 2)
@pytest.fixture(scope='module')
def test_with_simulators(setup_parameters):
""" Fixture to automatically setup virtual detector servers for testing. """
fp = sys.stdout
servers, nmods = setup_parameters
print("servers:", servers)
print("nmods:", nmods)
try:
for server in servers:
for ninterfaces in range(1,2):
if ninterfaces == 2 and server != 'jungfrau' and server != 'moench':
continue
msg = f'Starting Python API Tests for {server}'
if server == 'jungfrau' or server == 'moench':
msg += f' with {ninterfaces} interfaces'
Log(LogLevel.INFOBLUE, msg, fp)
cleanup(fp)
startDetectorVirtualServer(server, nmods, fp)
startReceiver(nmods, fp)
d = loadConfig(name=server, log_file_fp=fp, num_mods=nmods, num_frames=1, num_interfaces=ninterfaces)
#loadBasicSettings(name=server, d=d, fp=fp)
yield # run test
cleanup(fp) # teardown
except Exception as e:
traceback.print_exc(file=fp)
Log(LogLevel.ERROR, f'Tests Failed.', fp)
cleanup(fp)

View File

@@ -7,6 +7,15 @@ Run this using: pytest -s test_free.py
import pytest, sys
from pathlib import Path
current_dir = Path(__file__).resolve().parents[2]
scripts_dir = current_dir / "tests" / "scripts"
sys.path.append(str(scripts_dir))
from slsdet import Detector, Ctb, freeSharedMemory
from utils_for_test import (
Log,
@@ -46,7 +55,7 @@ def setup_simulator(det_config):
cleanup(fp)
@pytest.mark.detectorintegration
def test_exptime_after_free_should_raise(setup_simulator):
Log(LogLevel.INFOBLUE, f'\nRunning test_exptime_after_free_should_raise')
@@ -64,14 +73,11 @@ def test_exptime_after_free_should_raise(setup_simulator):
assert str(exc_info.value) == "Shared memory is invalid or freed. Close resources before access."
def free_and_create_shm():
k = Ctb() # opens existing shm if it exists
k.hostname = f"localhost:{SERVER_START_PORTNO}" # free and recreate shm, maps to local shm struct
@pytest.mark.detectorintegration
def test_exptime_after_not_passing_var_should_raise(setup_simulator):
Log(LogLevel.INFOBLUE, f'\nRunning test_exptime_after_not_passing_var_should_raise')
@@ -95,7 +101,7 @@ def free_and_create_shm_passing_ctb_var(k):
k = Ctb() # opens existing shm if it exists (disregards k as its new Ctb only local to this function)
k.hostname = f"localhost:{SERVER_START_PORTNO}" # free and recreate shm, maps to local shm struct
@pytest.mark.detectorintegration
def test_exptime_after_passing_ctb_var_should_raise(setup_simulator):
Log(LogLevel.INFOBLUE, f'\nRunning test_exptime_after_passing_ctb_var_should_raise')
@@ -118,7 +124,7 @@ def free_and_create_shm_returning_ctb():
k.hostname = f"localhost:{SERVER_START_PORTNO}" # free and recreate shm, maps to local shm struct
return k
@pytest.mark.detectorintegration
def test_exptime_after_returning_ctb_should_raise(setup_simulator):
Log(LogLevel.INFOBLUE, f'\nRunning test_exptime_after_returning_ctb_should_raise')
@@ -141,11 +147,7 @@ def test_exptime_after_returning_ctb_should_raise(setup_simulator):
Log(LogLevel.INFOGREEN, f"✅ Test passed, exception was: {exc_info.value}")
assert str(exc_info.value) == "Shared memory is invalid or freed. Close resources before access."
@pytest.mark.detectorintegration
def test_hostname_twice_acess_old_should_raise(setup_simulator):
Log(LogLevel.INFOBLUE, f'\nRunning test_hostname_twice_acess_old_should_raise')

View File

@@ -0,0 +1,48 @@
import pytest
import sys
from conftest import test_with_simulators
from slsdet import Detector
@pytest.mark.detectorintegration
@pytest.mark.parametrize("setup_parameters", [(["moench"], 2)], indirect=True)
def test_rx_ROI_moench(test_with_simulators, setup_parameters):
""" Test setting and getting rx_ROI property of Detector class for moench. """
d = Detector()
d.rx_roi = (0, 10, 10, 20)
roi = d.rx_roi
assert roi == [(0, 10, 10, 20)]
d.rx_roi = [5,15,15,25]
assert d.rx_roi == [(5,15,15,25)]
d.rx_roi = [[0,10,0,20], [5,20,410,420]]
roi = d.rx_roi
assert roi == [(0,10,0,20), (5,20,410,420)]
d.rx_clearroi()
roi = d.rx_roi
assert roi == [(-1,-1,-1,-1)]
@pytest.mark.detectorintegration
@pytest.mark.parametrize("setup_parameters", [(["mythen3"], 1)], indirect=True)
def test_rx_ROI_mythen(test_with_simulators, setup_parameters):
""" Test setting and getting rx_ROI property of Detector class for mythen. """
d = Detector()
d.rx_roi = (0, 10)
roi = d.rx_roi
assert roi == [(0, 10, -1, -1)]
#d.rx_roi = [[5,15, 0, 1]] # not allowed for mythen3
d.rx_roi = [0,10, -1, -1]
assert d.rx_roi == [(0,10,-1,-1)]

View File

@@ -3,8 +3,6 @@
add_executable(using_logger using_logger.cpp)
target_link_libraries(using_logger
slsSupportShared
pthread
rt
)
set_target_properties(using_logger PROPERTIES

View File

@@ -200,9 +200,6 @@ class etaInterpolationBase : public slsInterpolation {
// virtual void prepareInterpolation(int &ok)=0;
void debugSaveAll(int ind = 0) {
std::cout << "++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++SAVING ETAS"<< std::endl;
int ibx, iby;
char tit[10000];
@@ -217,21 +214,21 @@ class etaInterpolationBase : public slsInterpolation {
etah[ii] = heta[ii];
tot_eta += heta[ii];
}
sprintf(tit, "eta_%d.tiff", ind);
sprintf(tit, "/scratch/eta_%d.tiff", ind);
WriteToTiff(etah, tit, nbetaX, nbetaY);
for (int ii = 0; ii < nbetaX * nbetaY; ii++) {
ibb = (hhx[ii] * nSubPixelsX);
etah[ii] = ibb;
}
sprintf(tit, "eta_hhx_%d.tiff", ind);
sprintf(tit, "/scratch/eta_hhx_%d.tiff", ind);
WriteToTiff(etah, tit, nbetaX, nbetaY);
for (int ii = 0; ii < nbetaX * nbetaY; ii++) {
ibb = hhy[ii] * nSubPixelsY;
etah[ii] = ibb;
}
sprintf(tit, "eta_hhy_%d.tiff", ind);
sprintf(tit, "/scratch/eta_hhy_%d.tiff", ind);
WriteToTiff(etah, tit, nbetaX, nbetaY);
float *ftest = new float[nSubPixelsX * nSubPixelsY];
@@ -265,7 +262,7 @@ class etaInterpolationBase : public slsInterpolation {
<< std::endl;
}
sprintf(tit, "./ftest_%d.tiff", ind);
sprintf(tit, "/scratch/ftest_%d.tiff", ind);
WriteToTiff(ftest, tit, nSubPixelsX, nSubPixelsY);
// int ibx=0, iby=0;
@@ -283,7 +280,7 @@ class etaInterpolationBase : public slsInterpolation {
} else
etah[ii] = 0;
}
sprintf(tit, "./eta_bad_%d.tiff", ind);
sprintf(tit, "/scratch/eta_bad_%d.tiff", ind);
WriteToTiff(etah, tit, nbetaX, nbetaY);
// std::cout << "Index: " << ind << "\t Bad bins: "<< nbad << std::endl;
// int ibx=0, iby=0;

View File

@@ -1,232 +0,0 @@
// SPDX-License-Identifier: LGPL-3.0-or-other
// Copyright (C) 2021 Contributors to the SLS Detector Package
#ifndef ETA_INTERPOLATION_POSXY_H
#define ETA_INTERPOLATION_POSXY_H
//#define SAVE_ALL
//#include "sls/tiffIO.h"
#include "eta2InterpolationBase.h"
#include "eta3InterpolationBase.h"
#include "etaInterpolationBase.h"
class etaInterpolationRosenblatt : public virtual etaInterpolationBase {
public:
etaInterpolationRosenblatt(int nx = 400, int ny = 400, int ns = 25, int nsy = 25,
int nb = -1, int nby = -1, double emin = 1,
double emax = 0)
: etaInterpolationBase(nx, ny, ns, nsy, nb, nby, emin, emax){
// std::cout << "epxy " << nb << " " << emin << " " << emax << std::endl;
// std::cout << nbeta << " " << etamin << " " << etamax << std::endl;
};
etaInterpolationRosenblatt(etaInterpolationRosenblatt *orig)
: etaInterpolationBase(orig){};
virtual etaInterpolationRosenblatt *Clone() = 0; /* { */
/* return new etaInterpolationPosXY(this); */
/* }; */
virtual void prepareInterpolation(int &ok) {
ok = 1;
///*Eta Distribution Rebinning*///
// double bsize=1./nSubPixels; //precision
// std::cout<<"nPixelsX = "<<nPixelsX<<" nPixelsY = "<<nPixelsY<<" nSubPixels
// = "<<nSubPixels<<endl;
double tot_eta = 0;
double tot_eta_x = 0;
double tot_eta_y = 0;
for (int ip = 0; ip < nbetaX * nbetaY; ip++)
tot_eta += heta[ip];
std::cout << "total eta entries is :" << tot_eta << std::endl;
if (tot_eta <= 0) {
ok = 0;
return;
};
double *hx = new double[nbetaX]; // profile x
double *hy = new double[nbetaY]; // profile y
double *hix = new double[nbetaX]; // integral of projection x
double *hiy = new double[nbetaY]; // integral of projection y
// int ii=0;
double etax, etay;
for (int ib = 0; ib < nbetaX; ib++) {
// tot_eta_y=0;
for (int iby = 0; iby < nbetaY; iby++) {
etay = etamin + iby * etastepY;
// std::cout << etax << std::endl;
// tot_eta_x+=hx[iby];
if (etay >= 0 && etay <= 1)
hy[iby] = heta[ib + iby * nbetaX];
else
hy[iby] = 0;
// tot_eta_y+=hy[iby];
}
hiy[0] = hy[0];
for (int iby = 1; iby < nbetaY; iby++) {
hiy[iby] = hiy[iby - 1] + hy[iby];
}
tot_eta_y = hiy[nbetaY - 1] + 1;
for (int iby = 0; iby < nbetaY; iby++) {
if (tot_eta_y <= 0) {
hhy[ib + iby * nbetaX] = -1;
// ii=(ibx*nSubPixels)/nbeta;
} else {
// if (hiy[ibx]>tot_eta_y*(ii+1)/nSubPixels) ii++;
hhy[ib + iby * nbetaX] = hiy[iby] / tot_eta_y;
}
}
}
for (int ib = 0; ib < nbetaY; ib++) {
for (int ibx = 0; ibx < nbetaX; ibx++) {
etax = etamin + ibx * etastepX;
// std::cout << etax << std::endl;
if (etax >= 0 && etax <= 1)
hx[ibx] = heta[ibx + ib * nbetaX];
else {
hx[ibx] = 0;
}
}
hix[0] = hx[0];
for (int ibx = 1; ibx < nbetaX; ibx++) {
hix[ibx] = hix[ibx - 1] + hx[ibx];
}
// tot_eta_x = hix[nbetaX - 1] + 1;
for (int ibx = 0; ibx < nbetaX; ibx++) {
//if (tot_eta_x <= 0) {
// hhx[ibx + ib * nbetaX] = -1;
// } else {
hhx[ibx + ib * nbetaX] = hix[ibx];// / tot_eta_x;
//}
}
}
for (int ibx = 0; ibx < nbetaX; ibx++) {
int val=0;
for (int ib = 0; ib < nbetaY; ib++) {
val+=hhx[ibx + ib * nbetaX];
}
// for (int ibx = 0; ibx < nbetaX; ibx++) {
for (int ib = 0; ib < nbetaY; ib++) {
hhx[ibx + ib * nbetaX]=val;
}
}
tot_eta_x = hhx[nbetaX - 1] + 1;
for (int ib = 0; ib < nbetaY; ib++) {
//tot_eta_x = hix[nbetaX - 1] + 1;
for (int ibx = 0; ibx < nbetaX; ibx++) {
if (tot_eta_x <= 0) {
hhx[ibx + ib * nbetaX] = -1;
} else {
hhx[ibx + ib * nbetaX] = hhx[ibx + ib * nbetaX] / tot_eta_x;
}
}
}
/*
int ibx, iby, ib;
iby = 0;
while (hhx[iby * nbetaY + nbetaY / 2] < 0)
iby++;
for (ib = 0; ib < iby; ib++) {
for (ibx = 0; ibx < nbetaX; ibx++)
hhx[ibx + nbetaX * ib] = hhx[ibx + nbetaX * iby];
}
iby = nbetaY - 1;
while (hhx[iby * nbetaY + nbetaY / 2] < 0)
iby--;
for (ib = iby + 1; ib < nbetaY; ib++) {
for (ibx = 0; ibx < nbetaX; ibx++)
hhx[ibx + nbetaX * ib] = hhx[ibx + nbetaX * iby];
}
iby = 0;
while (hhy[nbetaX / 2 * nbetaX + iby] < 0)
iby++;
for (ib = 0; ib < iby; ib++) {
for (ibx = 0; ibx < nbetaY; ibx++)
hhy[ib + nbetaX * ibx] = hhy[iby + nbetaX * ibx];
}
iby = nbetaX - 1;
while (hhy[nbetaX / 2 * nbetaX + iby] < 0)
iby--;
for (ib = iby + 1; ib < nbetaX; ib++) {
for (ibx = 0; ibx < nbetaY; ibx++)
hhy[ib + nbetaX * ibx] = hhy[iby + nbetaX * ibx];
}
*/
//#ifdef SAVE_ALL
debugSaveAll();
//#endif
delete[] hx;
delete[] hy;
delete[] hix;
delete[] hiy;
return;
}
};
class eta2InterpolationRosenblatt : public virtual eta2InterpolationBase,
public virtual etaInterpolationRosenblatt {
public:
eta2InterpolationRosenblatt(int nx = 400, int ny = 400, int ns = 25,
int nsy = 25, int nb = -1, int nby = -1,
double emin = 1, double emax = 0)
: etaInterpolationBase(nx, ny, ns, nsy, nb, nby, emin, emax),
eta2InterpolationBase(nx, ny, ns, nsy, nb, nby, emin, emax),
etaInterpolationRosenblatt(nx, ny, ns, nsy, nb, nby, emin, emax){
// std::cout << "e2pxy " << nb << " " << emin << " " << emax << std::endl;
};
eta2InterpolationRosenblatt(eta2InterpolationRosenblatt *orig)
: etaInterpolationBase(orig), etaInterpolationRosenblatt(orig){};
virtual eta2InterpolationRosenblatt *Clone() {
return new eta2InterpolationRosenblatt(this);
};
};
class eta3InterpolationRosenblatt : public virtual eta3InterpolationBase,
public virtual etaInterpolationRosenblatt {
public:
eta3InterpolationRosenblatt(int nx = 400, int ny = 400, int ns = 25,
int nsy = 25, int nb = -1, int nby = -1,
double emin = 1, double emax = 0)
: etaInterpolationBase(nx, ny, ns, nsy, nb, nby, emin, emax),
eta3InterpolationBase(nx, ny, ns, nsy, nb, nby, emin, emax),
etaInterpolationRosenblatt(nx, ny, ns, nsy, nb, nby, emin, emax){
// std::cout << "e3pxy " << nbeta << " " << etamin << " " << etamax
// << " " << nSubPixels<< std::endl;
};
eta3InterpolationRosenblatt(eta3InterpolationRosenblatt *orig)
: etaInterpolationBase(orig), etaInterpolationRosenblatt(orig){};
virtual eta3InterpolationRosenblatt *Clone() {
return new eta3InterpolationRosenblatt(this);
};
};
#endif

View File

@@ -76,11 +76,8 @@ foreach(exe ${JUNGFRAU_EXECUTABLES})
target_link_libraries(${exe}
PUBLIC
slsSupportStatic
pthread
tiffio
fmt::fmt
#-L/usr/lib64/
#-lm -lstdc++ -lrt
PRIVATE
slsProjectWarnings

View File

@@ -69,7 +69,6 @@ foreach(exe ${MOENCH_EXECUTABLES})
PUBLIC
slsSupportStatic
${ZeroMQ_LIBRARIES}
pthread
tiffio
PRIVATE

View File

@@ -17,7 +17,7 @@
#endif
//#include "etaInterpolationPosXY.h"
#include "etaInterpolationRosenblatt.h"
#include "etaInterpolationPosXY.h"
#include "noInterpolation.h"
//#include "etaInterpolationCleverAdaptiveBins.h"
//#include "etaInterpolationRandomBins.h"
@@ -114,8 +114,8 @@ int main(int argc, char *argv[]) {
//int f0 = -1;
// int nSubPixels = nsubpix;
#ifndef NOINTERPOLATION
eta2InterpolationRosenblatt *interp =
new eta2InterpolationRosenblatt(NC, NR, nsubpix, nsubpix, etabins, etabins, etamin, etamax);
eta2InterpolationPosXY *interp =
new eta2InterpolationPosXY(NC, NR, nsubpix, nsubpix, etabins, etabins, etamin, etamax);
// eta2InterpolationCleverAdaptiveBins *interp=new
// eta2InterpolationCleverAdaptiveBins(NC, NR, nsubpix, etabins, etamin,
// etamax);
@@ -134,7 +134,6 @@ int main(int argc, char *argv[]) {
cout << "read ff " << argv[2] << endl;
sprintf(fname, "%s", argv[2]);
interp->readFlatField(fname);
interp->prepareInterpolation(ok); //, MAX_ITERATIONS);
#endif
// return 0;

View File

@@ -174,7 +174,6 @@ int main(int argc, char *argv[]) {
int nped = 1000;
int cf = 0;
int numberOfPackets=nrows/8;
#ifdef RECT
cout << "Should be rectangular but now it will crash! No data structure defined!" << endl;
@@ -182,7 +181,7 @@ int main(int argc, char *argv[]) {
#ifndef MOENCH04
moench03v2Data *decoder = new moench03v2Data(nrows/2);
cout << "MOENCH03 V2!" << endl;
cout << "MOENCH03!" << endl;
#endif
#ifdef MOENCH04
@@ -299,7 +298,7 @@ int main(int argc, char *argv[]) {
double *ped=new double[nx * ny];//, *ped1;
int pos,pos1;
//return 0;
if (pedfile.find(".raw") != std::string::npos) {
pos1=pedfile.rfind("/");
strcpy(froot,pedfile.substr(pos1).c_str());
@@ -310,7 +309,6 @@ int main(int argc, char *argv[]) {
cout << "PEDESTAL " << endl;
if (pedfile.find(".tif") == std::string::npos) {
sprintf(fname, "%s", pedfile.c_str());
cout << fname << endl;
std::time(&end_time);
//cout << "aaa" << std::ctime(&end_time) << endl;
@@ -322,28 +320,24 @@ int main(int argc, char *argv[]) {
if (filebin.is_open()) {
ff = -1;
while (decoder->readNextFrame(filebin, ff, np, buff)) {
if (np == numberOfPackets) {
mt->pushData(buff);
mt->nextThread();
mt->popFree(buff);
ifr++;
if (ifr % 100 == 0)
cout << ifr << " " << ff << " " << np << endl;
// break;
} else {
cout << "bp "<< ifr << " " << ff << " " << np << endl;
cout << ifr << " " << ff << " " << np << endl;
break;
}
ff = -1;
}
filebin.close();
while (mt->isBusy()) {
;
}
;
}
sprintf(imgfname, "%s/%s_ped.tiff", outdir.c_str(),froot);
mt->writePedestal(imgfname);
@@ -388,7 +382,7 @@ int main(int argc, char *argv[]) {
runmax--;
flist.close();
cout << "Found " << runmax << " files " << endl;
flist.open (args["flist"].c_str(), std::ifstream::in);
flist.open (fformat, std::ifstream::in);
}
for (int irun = runmin; irun <= runmax; irun++) {
@@ -441,7 +435,6 @@ int main(int argc, char *argv[]) {
ff = -1;
ifr = 0;
while (decoder->readNextFrame(filebin, ff, np, buff)) {
if (np == numberOfPackets) {
// //push
mt->pushData(buff);
@@ -469,19 +462,8 @@ int main(int argc, char *argv[]) {
}
} else {
cout << "bp " << ifr << " " << ff << " " << np << endl;
}
ff = -1;
if (ifr % 100 == 0){
sprintf(imgfname, "%s/%s_f%05d_ped.tiff", outdir.c_str(),froot, ifile++);
while (mt->isBusy()) {
;
}
mt->writePedestal(imgfname);
}
}
cout << "--" << endl;
filebin.close();

View File

@@ -37,7 +37,9 @@ target_compile_definitions(ctbDetectorServer_virtual
)
target_link_libraries(ctbDetectorServer_virtual
PUBLIC pthread rt m slsProjectCSettings
PUBLIC
m
slsProjectCSettings
)
set_target_properties(ctbDetectorServer_virtual PROPERTIES

View File

@@ -30,7 +30,8 @@ target_compile_definitions(eigerDetectorServer_virtual
)
target_link_libraries(eigerDetectorServer_virtual
PUBLIC pthread rt slsProjectCSettings
PUBLIC
slsProjectCSettings
)
set_target_properties(eigerDetectorServer_virtual PROPERTIES

View File

@@ -31,7 +31,8 @@ target_compile_definitions(gotthard2DetectorServer_virtual
)
target_link_libraries(gotthard2DetectorServer_virtual
PUBLIC pthread rt slsProjectCSettings
PUBLIC
slsProjectCSettings
)
set_target_properties(gotthard2DetectorServer_virtual PROPERTIES

View File

@@ -29,7 +29,8 @@ target_compile_definitions(jungfrauDetectorServer_virtual
)
target_link_libraries(jungfrauDetectorServer_virtual
PUBLIC pthread rt slsProjectCSettings
PUBLIC
slsProjectCSettings
)
set_target_properties(jungfrauDetectorServer_virtual PROPERTIES

View File

@@ -29,7 +29,8 @@ target_compile_definitions(moenchDetectorServer_virtual
)
target_link_libraries(moenchDetectorServer_virtual
PUBLIC pthread rt slsProjectCSettings
PUBLIC
slsProjectCSettings
)
set_target_properties(moenchDetectorServer_virtual PROPERTIES

View File

@@ -33,7 +33,8 @@ target_compile_definitions(mythen3DetectorServer_virtual
)
target_link_libraries(mythen3DetectorServer_virtual
PUBLIC pthread rt slsProjectCSettings
PUBLIC
slsProjectCSettings
)
set_target_properties(mythen3DetectorServer_virtual PROPERTIES

View File

@@ -31,7 +31,9 @@ target_compile_definitions(xilinx_ctbDetectorServer_virtual
)
target_link_libraries(xilinx_ctbDetectorServer_virtual
PUBLIC pthread rt m slsProjectCSettings
PUBLIC
m
slsProjectCSettings
)
set_target_properties(xilinx_ctbDetectorServer_virtual PROPERTIES

View File

@@ -1,5 +1,5 @@
# Prepare MH02 configuration
reg 0xC00C 0x00000041
reg 0xC00C 0x00040041
reg 0xC010 0x01200004
# configure Matterhorn SPI
@@ -14,7 +14,7 @@ reg 0xC120 0x1
reg 0xC120 0x0
# set MSB LSB inversions and polarity for transceiver
reg 0xC120 0x61e0
reg 0xC120 0x1e0
# Enable MH02 PLL clock
pattern enable_clock_pattern.pyat

View File

@@ -1,7 +1,7 @@
# turn off clock
setbit 0xC00C 16
setbit 0xC014 0
clearbit 0xB018 15
setbit 0xB010 15
sleep 1
# reset Matterhorn periphery
@@ -9,8 +9,7 @@ setbit 0xC014 1
sleep 1
# turn on clock
clearbit 0xC00C 16
setbit 0xC014 0
clearbit 0xB010 15
sleep 1
# reset rx transceiver datapath

View File

@@ -28,11 +28,11 @@ target_link_libraries(slsDetectorObject
PUBLIC
slsProjectOptions
slsSupportStatic
pthread
PRIVATE
slsProjectWarnings
)
set(DETECTOR_LIBRARY_TARGETS slsDetectorObject)
@@ -97,8 +97,7 @@ if(SLS_USE_TEXTCLIENT)
add_executable(${val1} src/CmdApp.cpp)
target_link_libraries(${val1}
slsDetectorStatic
pthread
slsDetectorStatic
)
SET_SOURCE_FILES_PROPERTIES( src/Caller.cpp PROPERTIES COMPILE_FLAGS "-Wno-unused-variable -Wno-unused-but-set-variable")

View File

@@ -2568,17 +2568,16 @@ std::vector<int> Module::getReceiverDbitList() const {
void Module::setReceiverDbitList(std::vector<int> list) {
LOG(logDEBUG1) << "Setting Receiver Dbit List";
if (list.size() > 64) {
throw RuntimeError("Dbit list size cannot be greater than 64\n");
}
for (auto &it : list) {
if (it < 0 || it > 63) {
throw RuntimeError("Dbit list value must be between 0 and 63\n");
}
}
std::sort(begin(list), end(list));
auto last = std::unique(begin(list), end(list));
list.erase(last, list.end());
auto r = stableRemoveDuplicates(list);
if (r) {
LOG(logWARNING) << "Removed duplicated from receiver dbit list";
}
StaticVector<int, MAX_RX_DBIT> arg = list;
sendToReceiver(F_SET_RECEIVER_DBIT_LIST, arg, nullptr);

View File

@@ -16,8 +16,11 @@ namespace sls {
using test::GET;
using test::PUT;
// disable for jungfrau as it requires higher maximum receive buffer size
// sysctl net.core.rmem_max=$((100*1024*1024))
// sysctl net.core.rmem_default=$((100*1024*1024))
TEST_CASE("jungfrau_or_moench_acquire_check_file_size",
"[.cmdcall][.cmdacquire]") {
"[.detectorintegration][.cmdacquire][.disable_jungfrau]") {
Detector det;
Caller caller(&det);
@@ -47,7 +50,8 @@ TEST_CASE("jungfrau_or_moench_acquire_check_file_size",
}
}
TEST_CASE("eiger_acquire_check_file_size", "[.cmdcall][.cmdacquire]") {
TEST_CASE("eiger_acquire_check_file_size",
"[.detectorintegration][.cmdacquire]") {
Detector det;
Caller caller(&det);
auto det_type =
@@ -78,7 +82,8 @@ TEST_CASE("eiger_acquire_check_file_size", "[.cmdcall][.cmdacquire]") {
}
}
TEST_CASE("mythen3_acquire_check_file_size", "[.cmdcall][.cmdacquire]") {
TEST_CASE("mythen3_acquire_check_file_size",
"[.detectorintegration][.cmdacquire]") {
Detector det;
Caller caller(&det);
auto det_type =
@@ -111,7 +116,8 @@ TEST_CASE("mythen3_acquire_check_file_size", "[.cmdcall][.cmdacquire]") {
}
}
TEST_CASE("gotthard2_acquire_check_file_size", "[.cmdcall][.cmdacquire]") {
TEST_CASE("gotthard2_acquire_check_file_size",
"[.detectorintegration][.cmdacquire]") {
Detector det;
Caller caller(&det);
auto det_type =
@@ -150,7 +156,11 @@ void test_ctb_file_size_with_acquire(Detector &det, Caller &caller,
expected_image_size));
}
TEST_CASE("ctb_acquire_check_file_size", "[.cmdcall][.cmdacquire]") {
// disable for xilinx_ctb as it requires higher maximum receive buffer size
// sysctl net.core.rmem_max=$((100*1024*1024))
// sysctl net.core.rmem_default=$((100*1024*1024))
TEST_CASE("ctb_acquire_check_file_size",
"[.detectorintegration][.cmdacquire][.disable_xilinx_ctb]") {
Detector det;
Caller caller(&det);
auto det_type =

View File

@@ -19,7 +19,7 @@ using test::PUT;
/* dacs */
TEST_CASE("dacname", "[.cmdcall]") {
TEST_CASE("dacname", "[.detectorintegration]") {
Detector det;
Caller caller(&det);
auto det_type = det.getDetectorType().squash();
@@ -54,7 +54,7 @@ TEST_CASE("dacname", "[.cmdcall]") {
}
}
TEST_CASE("dacindex", "[.cmdcall]") {
TEST_CASE("dacindex", "[.detectorintegration]") {
Detector det;
Caller caller(&det);
auto det_type = det.getDetectorType().squash();
@@ -80,7 +80,7 @@ TEST_CASE("dacindex", "[.cmdcall]") {
}
}
TEST_CASE("adclist", "[.cmdcall]") {
TEST_CASE("adclist", "[.detectorintegration]") {
Detector det;
Caller caller(&det);
auto det_type = det.getDetectorType().squash();
@@ -113,7 +113,7 @@ TEST_CASE("adclist", "[.cmdcall]") {
}
}
TEST_CASE("adcname", "[.cmdcall]") {
TEST_CASE("adcname", "[.detectorintegration]") {
Detector det;
Caller caller(&det);
auto det_type = det.getDetectorType().squash();
@@ -148,7 +148,7 @@ TEST_CASE("adcname", "[.cmdcall]") {
}
}
TEST_CASE("adcindex", "[.cmdcall]") {
TEST_CASE("adcindex", "[.detectorintegration]") {
Detector det;
Caller caller(&det);
auto det_type = det.getDetectorType().squash();
@@ -174,7 +174,7 @@ TEST_CASE("adcindex", "[.cmdcall]") {
}
}
TEST_CASE("signallist", "[.cmdcall]") {
TEST_CASE("signallist", "[.detectorintegration]") {
Detector det;
Caller caller(&det);
auto det_type = det.getDetectorType().squash();
@@ -207,7 +207,7 @@ TEST_CASE("signallist", "[.cmdcall]") {
}
}
TEST_CASE("signalname", "[.cmdcall]") {
TEST_CASE("signalname", "[.detectorintegration]") {
Detector det;
Caller caller(&det);
auto det_type = det.getDetectorType().squash();
@@ -242,7 +242,7 @@ TEST_CASE("signalname", "[.cmdcall]") {
}
}
TEST_CASE("signalindex", "[.cmdcall]") {
TEST_CASE("signalindex", "[.detectorintegration]") {
Detector det;
Caller caller(&det);
auto det_type = det.getDetectorType().squash();
@@ -269,7 +269,7 @@ TEST_CASE("signalindex", "[.cmdcall]") {
}
}
TEST_CASE("powerlist", "[.cmdcall]") {
TEST_CASE("powerlist", "[.detectorintegration]") {
Detector det;
Caller caller(&det);
auto det_type = det.getDetectorType().squash();
@@ -302,7 +302,7 @@ TEST_CASE("powerlist", "[.cmdcall]") {
}
}
TEST_CASE("powername", "[.cmdcall]") {
TEST_CASE("powername", "[.detectorintegration]") {
Detector det;
Caller caller(&det);
auto det_type = det.getDetectorType().squash();
@@ -337,7 +337,7 @@ TEST_CASE("powername", "[.cmdcall]") {
}
}
TEST_CASE("powerindex", "[.cmdcall]") {
TEST_CASE("powerindex", "[.detectorintegration]") {
Detector det;
Caller caller(&det);
auto det_type = det.getDetectorType().squash();
@@ -364,7 +364,7 @@ TEST_CASE("powerindex", "[.cmdcall]") {
}
}
TEST_CASE("powervalues", "[.cmdcall]") {
TEST_CASE("powervalues", "[.detectorintegration]") {
Detector det;
Caller caller(&det);
auto det_type = det.getDetectorType().squash();
@@ -377,7 +377,7 @@ TEST_CASE("powervalues", "[.cmdcall]") {
}
}
TEST_CASE("slowadcvalues", "[.cmdcall]") {
TEST_CASE("slowadcvalues", "[.detectorintegration]") {
Detector det;
Caller caller(&det);
auto det_type = det.getDetectorType().squash();
@@ -390,7 +390,7 @@ TEST_CASE("slowadcvalues", "[.cmdcall]") {
}
}
TEST_CASE("slowadclist", "[.cmdcall]") {
TEST_CASE("slowadclist", "[.detectorintegration]") {
Detector det;
Caller caller(&det);
auto det_type = det.getDetectorType().squash();
@@ -423,7 +423,7 @@ TEST_CASE("slowadclist", "[.cmdcall]") {
}
}
TEST_CASE("slowadcname", "[.cmdcall]") {
TEST_CASE("slowadcname", "[.detectorintegration]") {
Detector det;
Caller caller(&det);
auto det_type = det.getDetectorType().squash();
@@ -459,7 +459,7 @@ TEST_CASE("slowadcname", "[.cmdcall]") {
}
}
TEST_CASE("slowadcindex", "[.cmdcall]") {
TEST_CASE("slowadcindex", "[.detectorintegration]") {
Detector det;
Caller caller(&det);
auto det_type = det.getDetectorType().squash();
@@ -488,7 +488,7 @@ TEST_CASE("slowadcindex", "[.cmdcall]") {
/* dacs */
TEST_CASE("dac", "[.cmdcall][.dacs]") {
TEST_CASE("dac", "[.detectorintegration][.dacs]") {
// dac 0 to dac 17
Detector det;
@@ -564,7 +564,7 @@ TEST_CASE("dac", "[.cmdcall][.dacs]") {
}
}
TEST_CASE("adcvpp", "[.cmdcall]") {
TEST_CASE("adcvpp", "[.detectorintegration]") {
Detector det;
Caller caller(&det);
auto det_type = det.getDetectorType().squash();
@@ -596,7 +596,7 @@ TEST_CASE("adcvpp", "[.cmdcall]") {
/* CTB Specific */
TEST_CASE("samples", "[.cmdcall]") {
TEST_CASE("samples", "[.detectorintegration]") {
Detector det;
Caller caller(&det);
auto det_type = det.getDetectorType().squash();
@@ -640,7 +640,7 @@ TEST_CASE("samples", "[.cmdcall]") {
}
}
TEST_CASE("asamples", "[.cmdcall]") {
TEST_CASE("asamples", "[.detectorintegration]") {
Detector det;
Caller caller(&det);
auto det_type = det.getDetectorType().squash();
@@ -671,7 +671,7 @@ TEST_CASE("asamples", "[.cmdcall]") {
}
}
TEST_CASE("adcclk", "[.cmdcall]") {
TEST_CASE("adcclk", "[.detectorintegration]") {
Detector det;
Caller caller(&det);
auto det_type = det.getDetectorType().squash();
@@ -702,7 +702,7 @@ TEST_CASE("adcclk", "[.cmdcall]") {
}
}
TEST_CASE("runclk", "[.cmdcall]") {
TEST_CASE("runclk", "[.detectorintegration]") {
Detector det;
Caller caller(&det);
auto det_type = det.getDetectorType().squash();
@@ -733,7 +733,7 @@ TEST_CASE("runclk", "[.cmdcall]") {
}
}
TEST_CASE("syncclk", "[.cmdcall]") {
TEST_CASE("syncclk", "[.detectorintegration]") {
Detector det;
Caller caller(&det);
auto det_type = det.getDetectorType().squash();
@@ -745,7 +745,7 @@ TEST_CASE("syncclk", "[.cmdcall]") {
}
}
TEST_CASE("v_limit", "[.cmdcall]") {
TEST_CASE("v_limit", "[.detectorintegration]") {
Detector det;
Caller caller(&det);
auto det_type = det.getDetectorType().squash();
@@ -784,7 +784,7 @@ TEST_CASE("v_limit", "[.cmdcall]") {
}
}
TEST_CASE("adcenable", "[.cmdcall]") {
TEST_CASE("adcenable", "[.detectorintegration]") {
Detector det;
Caller caller(&det);
auto det_type = det.getDetectorType().squash();
@@ -814,7 +814,7 @@ TEST_CASE("adcenable", "[.cmdcall]") {
}
}
TEST_CASE("adcenable10g", "[.cmdcall]") {
TEST_CASE("adcenable10g", "[.detectorintegration]") {
Detector det;
Caller caller(&det);
auto det_type = det.getDetectorType().squash();
@@ -845,7 +845,7 @@ TEST_CASE("adcenable10g", "[.cmdcall]") {
}
}
TEST_CASE("transceiverenable", "[.cmdcall]") {
TEST_CASE("transceiverenable", "[.detectorintegration]") {
Detector det;
Caller caller(&det);
auto det_type = det.getDetectorType().squash();
@@ -878,7 +878,7 @@ TEST_CASE("transceiverenable", "[.cmdcall]") {
/* CTB Specific */
TEST_CASE("dsamples", "[.cmdcall]") {
TEST_CASE("dsamples", "[.detectorintegration]") {
Detector det;
Caller caller(&det);
auto det_type = det.getDetectorType().squash();
@@ -909,7 +909,7 @@ TEST_CASE("dsamples", "[.cmdcall]") {
}
}
TEST_CASE("tsamples", "[.cmdcall]") {
TEST_CASE("tsamples", "[.detectorintegration]") {
Detector det;
Caller caller(&det);
auto det_type = det.getDetectorType().squash();
@@ -940,7 +940,7 @@ TEST_CASE("tsamples", "[.cmdcall]") {
}
}
TEST_CASE("romode", "[.cmdcall]") {
TEST_CASE("romode", "[.detectorintegration]") {
Detector det;
Caller caller(&det);
auto det_type = det.getDetectorType().squash();
@@ -994,7 +994,7 @@ TEST_CASE("romode", "[.cmdcall]") {
}
}
TEST_CASE("dbitclk", "[.cmdcall]") {
TEST_CASE("dbitclk", "[.detectorintegration]") {
Detector det;
Caller caller(&det);
auto det_type = det.getDetectorType().squash();
@@ -1025,7 +1025,7 @@ TEST_CASE("dbitclk", "[.cmdcall]") {
}
}
TEST_CASE("v_abcd", "[.cmdcall]") {
TEST_CASE("v_abcd", "[.detectorintegration]") {
Detector det;
Caller caller(&det);
auto det_type = det.getDetectorType().squash();
@@ -1055,17 +1055,16 @@ TEST_CASE("v_abcd", "[.cmdcall]") {
caller.call(cmds[i], {}, -1, GET, oss2);
REQUIRE(oss2.str() == cmds[i] + " 1200\n");
}
for (int i = 0; i != det.size(); ++i) {
det.setPower(indices[i], prev_val[i], {i});
for (int nmodules = 0; nmodules != det.size(); ++i) {
det.setPower(indices[i], prev_val[i], {nmodules});
}
} else {
REQUIRE_THROWS(caller.call(cmds[i], {}, -1, GET));
}
}
}
TEST_CASE("v_io", "[.cmdcall]") {
TEST_CASE("v_io", "[.detectorintegration]") {
Detector det;
Caller caller(&det);
auto det_type = det.getDetectorType().squash();
@@ -1078,7 +1077,7 @@ TEST_CASE("v_io", "[.cmdcall]") {
}
}
TEST_CASE("v_chip", "[.cmdcall]") {
TEST_CASE("v_chip", "[.detectorintegration]") {
Detector det;
Caller caller(&det);
auto det_type = det.getDetectorType().squash();
@@ -1090,7 +1089,7 @@ TEST_CASE("v_chip", "[.cmdcall]") {
}
}
TEST_CASE("vm_a", "[.cmdcall]") {
TEST_CASE("vm_a", "[.detectorintegration]") {
Detector det;
Caller caller(&det);
auto det_type = det.getDetectorType().squash();
@@ -1101,7 +1100,7 @@ TEST_CASE("vm_a", "[.cmdcall]") {
}
}
TEST_CASE("vm_b", "[.cmdcall]") {
TEST_CASE("vm_b", "[.detectorintegration]") {
Detector det;
Caller caller(&det);
auto det_type = det.getDetectorType().squash();
@@ -1112,7 +1111,7 @@ TEST_CASE("vm_b", "[.cmdcall]") {
}
}
TEST_CASE("vm_c", "[.cmdcall]") {
TEST_CASE("vm_c", "[.detectorintegration]") {
Detector det;
Caller caller(&det);
auto det_type = det.getDetectorType().squash();
@@ -1123,7 +1122,7 @@ TEST_CASE("vm_c", "[.cmdcall]") {
}
}
TEST_CASE("vm_d", "[.cmdcall]") {
TEST_CASE("vm_d", "[.detectorintegration]") {
Detector det;
Caller caller(&det);
auto det_type = det.getDetectorType().squash();
@@ -1134,7 +1133,7 @@ TEST_CASE("vm_d", "[.cmdcall]") {
}
}
TEST_CASE("vm_io", "[.cmdcall]") {
TEST_CASE("vm_io", "[.detectorintegration]") {
Detector det;
Caller caller(&det);
auto det_type = det.getDetectorType().squash();
@@ -1145,7 +1144,7 @@ TEST_CASE("vm_io", "[.cmdcall]") {
}
}
TEST_CASE("im_a", "[.cmdcall]") {
TEST_CASE("im_a", "[.detectorintegration]") {
Detector det;
Caller caller(&det);
auto det_type = det.getDetectorType().squash();
@@ -1156,7 +1155,7 @@ TEST_CASE("im_a", "[.cmdcall]") {
}
}
TEST_CASE("im_b", "[.cmdcall]") {
TEST_CASE("im_b", "[.detectorintegration]") {
Detector det;
Caller caller(&det);
auto det_type = det.getDetectorType().squash();
@@ -1167,7 +1166,7 @@ TEST_CASE("im_b", "[.cmdcall]") {
}
}
TEST_CASE("im_c", "[.cmdcall]") {
TEST_CASE("im_c", "[.detectorintegration]") {
Detector det;
Caller caller(&det);
auto det_type = det.getDetectorType().squash();
@@ -1178,7 +1177,7 @@ TEST_CASE("im_c", "[.cmdcall]") {
}
}
TEST_CASE("im_d", "[.cmdcall]") {
TEST_CASE("im_d", "[.detectorintegration]") {
Detector det;
Caller caller(&det);
auto det_type = det.getDetectorType().squash();
@@ -1189,7 +1188,7 @@ TEST_CASE("im_d", "[.cmdcall]") {
}
}
TEST_CASE("im_io", "[.cmdcall]") {
TEST_CASE("im_io", "[.detectorintegration]") {
Detector det;
Caller caller(&det);
auto det_type = det.getDetectorType().squash();
@@ -1200,7 +1199,7 @@ TEST_CASE("im_io", "[.cmdcall]") {
}
}
TEST_CASE("slowadc", "[.cmdcall]") {
TEST_CASE("slowadc", "[.detectorintegration]") {
Detector det;
Caller caller(&det);
auto det_type = det.getDetectorType().squash();
@@ -1216,7 +1215,7 @@ TEST_CASE("slowadc", "[.cmdcall]") {
}
}
TEST_CASE("extsampling", "[.cmdcall]") {
TEST_CASE("extsampling", "[.detectorintegration]") {
Detector det;
Caller caller(&det);
auto det_type = det.getDetectorType().squash();
@@ -1246,7 +1245,7 @@ TEST_CASE("extsampling", "[.cmdcall]") {
}
}
TEST_CASE("extsamplingsrc", "[.cmdcall]") {
TEST_CASE("extsamplingsrc", "[.detectorintegration]") {
Detector det;
Caller caller(&det);
auto det_type = det.getDetectorType().squash();
@@ -1277,7 +1276,7 @@ TEST_CASE("extsamplingsrc", "[.cmdcall]") {
}
}
TEST_CASE("diodelay", "[.cmdcall]") {
TEST_CASE("diodelay", "[.detectorintegration]") {
Detector det;
Caller caller(&det);
auto det_type = det.getDetectorType().squash();
@@ -1300,7 +1299,7 @@ TEST_CASE("diodelay", "[.cmdcall]") {
}
}
TEST_CASE("led", "[.cmdcall]") {
TEST_CASE("led", "[.detectorintegration]") {
Detector det;
Caller caller(&det);
auto det_type = det.getDetectorType().squash();

View File

@@ -19,7 +19,7 @@ using test::PUT;
/** temperature */
TEST_CASE("temp_fpgaext", "[.cmdcall]") {
TEST_CASE("temp_fpgaext", "[.detectorintegration]") {
Detector det;
Caller caller(&det);
auto det_type = det.getDetectorType().squash();
@@ -34,7 +34,7 @@ TEST_CASE("temp_fpgaext", "[.cmdcall]") {
}
}
TEST_CASE("temp_10ge", "[.cmdcall]") {
TEST_CASE("temp_10ge", "[.detectorintegration]") {
Detector det;
Caller caller(&det);
auto det_type = det.getDetectorType().squash();
@@ -49,7 +49,7 @@ TEST_CASE("temp_10ge", "[.cmdcall]") {
}
}
TEST_CASE("temp_dcdc", "[.cmdcall]") {
TEST_CASE("temp_dcdc", "[.detectorintegration]") {
Detector det;
Caller caller(&det);
auto det_type = det.getDetectorType().squash();
@@ -64,7 +64,7 @@ TEST_CASE("temp_dcdc", "[.cmdcall]") {
}
}
TEST_CASE("temp_sodl", "[.cmdcall]") {
TEST_CASE("temp_sodl", "[.detectorintegration]") {
Detector det;
Caller caller(&det);
auto det_type = det.getDetectorType().squash();
@@ -79,7 +79,7 @@ TEST_CASE("temp_sodl", "[.cmdcall]") {
}
}
TEST_CASE("temp_sodr", "[.cmdcall]") {
TEST_CASE("temp_sodr", "[.detectorintegration]") {
Detector det;
Caller caller(&det);
auto det_type = det.getDetectorType().squash();
@@ -94,7 +94,7 @@ TEST_CASE("temp_sodr", "[.cmdcall]") {
}
}
TEST_CASE("temp_fpgafl", "[.cmdcall]") {
TEST_CASE("temp_fpgafl", "[.detectorintegration]") {
Detector det;
Caller caller(&det);
auto det_type = det.getDetectorType().squash();
@@ -109,7 +109,7 @@ TEST_CASE("temp_fpgafl", "[.cmdcall]") {
}
}
TEST_CASE("temp_fpgafr", "[.cmdcall]") {
TEST_CASE("temp_fpgafr", "[.detectorintegration]") {
Detector det;
Caller caller(&det);
auto det_type = det.getDetectorType().squash();
@@ -126,7 +126,8 @@ TEST_CASE("temp_fpgafr", "[.cmdcall]") {
/* dacs */
TEST_CASE("Setting and reading back EIGER dacs", "[.cmdcall][.dacs]") {
TEST_CASE("Setting and reading back EIGER dacs",
"[.detectorintegration][.dacs]") {
// vsvp, vtr, vrf, vrs, vsvn, vtgstv, vcmp_ll, vcmp_lr, vcal, vcmp_rl,
// rxb_rb, rxb_lb, vcmp_rr, vcp, vcn, vis, vthreshold
Detector det;
@@ -232,7 +233,7 @@ TEST_CASE("Setting and reading back EIGER dacs", "[.cmdcall][.dacs]") {
/* Network Configuration (Detector<->Receiver) */
TEST_CASE("txdelay_left", "[.cmdcall]") {
TEST_CASE("txdelay_left", "[.detectorintegration]") {
Detector det;
Caller caller(&det);
auto det_type = det.getDetectorType().squash();
@@ -253,7 +254,7 @@ TEST_CASE("txdelay_left", "[.cmdcall]") {
}
}
TEST_CASE("txdelay_right", "[.cmdcall]") {
TEST_CASE("txdelay_right", "[.detectorintegration]") {
Detector det;
Caller caller(&det);
auto det_type = det.getDetectorType().squash();
@@ -276,7 +277,7 @@ TEST_CASE("txdelay_right", "[.cmdcall]") {
/* Eiger Specific */
TEST_CASE("subexptime", "[.cmdcall]") {
TEST_CASE("subexptime", "[.detectorintegration]") {
Detector det;
Caller caller(&det);
@@ -297,7 +298,7 @@ TEST_CASE("subexptime", "[.cmdcall]") {
}
}
TEST_CASE("subdeadtime", "[.cmdcall]") {
TEST_CASE("subdeadtime", "[.detectorintegration]") {
Detector det;
Caller caller(&det);
@@ -318,7 +319,7 @@ TEST_CASE("subdeadtime", "[.cmdcall]") {
}
}
TEST_CASE("overflow", "[.cmdcall]") {
TEST_CASE("overflow", "[.detectorintegration]") {
Detector det;
Caller caller(&det);
auto det_type = det.getDetectorType().squash();
@@ -339,7 +340,7 @@ TEST_CASE("overflow", "[.cmdcall]") {
}
}
TEST_CASE("ratecorr", "[.cmdcall]") {
TEST_CASE("ratecorr", "[.detectorintegration]") {
Detector det;
Caller caller(&det);
auto det_type = det.getDetectorType().squash();
@@ -373,7 +374,7 @@ TEST_CASE("ratecorr", "[.cmdcall]") {
}
}
TEST_CASE("interruptsubframe", "[.cmdcall]") {
TEST_CASE("interruptsubframe", "[.detectorintegration]") {
Detector det;
Caller caller(&det);
auto det_type = det.getDetectorType().squash();
@@ -397,7 +398,7 @@ TEST_CASE("interruptsubframe", "[.cmdcall]") {
}
}
TEST_CASE("measuredperiod", "[.cmdcall]") {
TEST_CASE("measuredperiod", "[.detectorintegration]") {
Detector det;
Caller caller(&det);
auto det_type = det.getDetectorType().squash();
@@ -434,7 +435,7 @@ TEST_CASE("measuredperiod", "[.cmdcall]") {
}
}
TEST_CASE("measuredsubperiod", "[.cmdcall]") {
TEST_CASE("measuredsubperiod", "[.detectorintegration]") {
Detector det;
Caller caller(&det);
auto det_type = det.getDetectorType().squash();
@@ -474,7 +475,7 @@ TEST_CASE("measuredsubperiod", "[.cmdcall]") {
}
}
TEST_CASE("activate", "[.cmdcall]") {
TEST_CASE("activate", "[.detectorintegration]") {
Detector det;
Caller caller(&det);
auto det_type = det.getDetectorType().squash();
@@ -505,7 +506,7 @@ TEST_CASE("activate", "[.cmdcall]") {
}
}
TEST_CASE("partialreset", "[.cmdcall]") {
TEST_CASE("partialreset", "[.detectorintegration]") {
Detector det;
Caller caller(&det);
auto det_type = det.getDetectorType().squash();
@@ -527,7 +528,7 @@ TEST_CASE("partialreset", "[.cmdcall]") {
}
}
TEST_CASE("pulse", "[.cmdcall]") {
TEST_CASE("pulse", "[.detectorintegration]") {
Detector det;
Caller caller(&det);
auto det_type = det.getDetectorType().squash();
@@ -542,7 +543,7 @@ TEST_CASE("pulse", "[.cmdcall]") {
}
}
TEST_CASE("pulsenmove", "[.cmdcall]") {
TEST_CASE("pulsenmove", "[.detectorintegration]") {
Detector det;
Caller caller(&det);
auto det_type = det.getDetectorType().squash();
@@ -557,7 +558,7 @@ TEST_CASE("pulsenmove", "[.cmdcall]") {
}
}
TEST_CASE("pulsechip", "[.cmdcall]") {
TEST_CASE("pulsechip", "[.detectorintegration]") {
Detector det;
Caller caller(&det);
auto det_type = det.getDetectorType().squash();
@@ -572,7 +573,7 @@ TEST_CASE("pulsechip", "[.cmdcall]") {
}
}
TEST_CASE("quad", "[.cmdcall]") {
TEST_CASE("quad", "[.detectorintegration]") {
Detector det;
Caller caller(&det);
auto det_type = det.getDetectorType().squash();
@@ -588,7 +589,7 @@ TEST_CASE("quad", "[.cmdcall]") {
}
}
TEST_CASE("datastream", "[.cmdcall]") {
TEST_CASE("datastream", "[.detectorintegration]") {
Detector det;
Caller caller(&det);
auto det_type = det.getDetectorType().squash();
@@ -628,7 +629,7 @@ TEST_CASE("datastream", "[.cmdcall]") {
}
}
TEST_CASE("top", "[.cmdcall]") {
TEST_CASE("top", "[.detectorintegration]") {
Detector det;
Caller caller(&det);
auto det_type = det.getDetectorType().squash();

View File

@@ -151,7 +151,7 @@ void test_acquire_with_receiver(Caller &caller, const Detector &det) {
void create_files_for_acquire(
Detector &det, Caller &caller, int64_t num_frames,
const std::optional<testCtbAcquireInfo> &test_info) {
const std::optional<testCtbAcquireInfo> &test_info, bool check_num_frames) {
// save previous state
testFileInfo prev_file_info = get_file_state(det);
@@ -172,9 +172,13 @@ void create_files_for_acquire(
// acquire and get num frames caught
REQUIRE_NOTHROW(test_acquire_with_receiver(caller, det));
auto frames_caught = det.getFramesCaught().tsquash(
"Inconsistent number of frames caught")[0];
REQUIRE(frames_caught == num_frames);
// TODO: maybe there should not be REQUIRE statements in void function at
// all
if (check_num_frames) {
auto frames_caught = det.getFramesCaught().tsquash(
"Inconsistent number of frames caught")[0];
REQUIRE(frames_caught == num_frames);
}
// hdf5
#ifdef HDF5C
@@ -184,9 +188,11 @@ void create_files_for_acquire(
// acquire and get num frames caught
test_acquire_with_receiver(caller, det);
frames_caught = det.getFramesCaught().tsquash(
"Inconsistent number of frames caught")[0];
REQUIRE(frames_caught == num_frames);
if (check_num_frames) {
auto frames_caught = det.getFramesCaught().tsquash(
"Inconsistent number of frames caught")[0];
REQUIRE(frames_caught == num_frames);
}
#endif
// restore previous state

View File

@@ -94,7 +94,8 @@ void test_acquire_with_receiver(Caller &caller, const Detector &det);
void create_files_for_acquire(
Detector &det, Caller &caller, int64_t num_frames = 1,
const std::optional<testCtbAcquireInfo> &test_info = std::nullopt);
const std::optional<testCtbAcquireInfo> &test_info = std::nullopt,
bool check_num_frames = true);
testCtbAcquireInfo get_ctb_config_state(const Detector &det);
void set_ctb_config_state(Detector &det,

View File

@@ -18,7 +18,7 @@ using test::GET;
using test::PUT;
// time specific measurements for gotthard2
TEST_CASE("timegotthard2", "[.cmdcall]") {
TEST_CASE("timegotthard2", "[.detectorintegration]") {
Detector det;
Caller caller(&det);
auto det_type = det.getDetectorType().squash();
@@ -106,7 +106,8 @@ TEST_CASE("timegotthard2", "[.cmdcall]") {
}
/* dacs */
TEST_CASE("Setting and reading back GOTTHARD2 dacs", "[.cmdcall][.dacs]") {
TEST_CASE("Setting and reading back GOTTHARD2 dacs",
"[.detectorintegration][.dacs]") {
// vref_h_adc, vb_comp_fe, vb_comp_adc, vcom_cds,
// vref_restore, vb_opa_1st, vref_comp_fe, vcom_adc1,
// vref_prech, vref_l_adc, vref_cds, vb_cs,
@@ -215,7 +216,7 @@ TEST_CASE("Setting and reading back GOTTHARD2 dacs", "[.cmdcall][.dacs]") {
/* on chip dacs */
TEST_CASE("vchip_comp_fe", "[.cmdcall][.onchipdacs]") {
TEST_CASE("vchip_comp_fe", "[.detectorintegration][.onchipdacs]") {
Detector det;
Caller caller(&det);
auto det_type = det.getDetectorType().squash();
@@ -228,7 +229,7 @@ TEST_CASE("vchip_comp_fe", "[.cmdcall][.onchipdacs]") {
}
}
TEST_CASE("vchip_opa_1st", "[.cmdcall][.onchipdacs]") {
TEST_CASE("vchip_opa_1st", "[.detectorintegration][.onchipdacs]") {
Detector det;
Caller caller(&det);
auto det_type = det.getDetectorType().squash();
@@ -241,7 +242,7 @@ TEST_CASE("vchip_opa_1st", "[.cmdcall][.onchipdacs]") {
}
}
TEST_CASE("vchip_opa_fd", "[.cmdcall][.onchipdacs]") {
TEST_CASE("vchip_opa_fd", "[.detectorintegration][.onchipdacs]") {
Detector det;
Caller caller(&det);
auto det_type = det.getDetectorType().squash();
@@ -254,7 +255,7 @@ TEST_CASE("vchip_opa_fd", "[.cmdcall][.onchipdacs]") {
}
}
TEST_CASE("vchip_comp_adc", "[.cmdcall][.onchipdacs]") {
TEST_CASE("vchip_comp_adc", "[.detectorintegration][.onchipdacs]") {
Detector det;
Caller caller(&det);
auto det_type = det.getDetectorType().squash();
@@ -267,7 +268,7 @@ TEST_CASE("vchip_comp_adc", "[.cmdcall][.onchipdacs]") {
}
}
TEST_CASE("vchip_ref_comp_fe", "[.cmdcall][.onchipdacs]") {
TEST_CASE("vchip_ref_comp_fe", "[.detectorintegration][.onchipdacs]") {
Detector det;
Caller caller(&det);
auto det_type = det.getDetectorType().squash();
@@ -281,7 +282,7 @@ TEST_CASE("vchip_ref_comp_fe", "[.cmdcall][.onchipdacs]") {
}
}
TEST_CASE("vchip_cs", "[.cmdcall][.onchipdacs]") {
TEST_CASE("vchip_cs", "[.detectorintegration][.onchipdacs]") {
Detector det;
Caller caller(&det);
auto det_type = det.getDetectorType().squash();
@@ -296,7 +297,7 @@ TEST_CASE("vchip_cs", "[.cmdcall][.onchipdacs]") {
/* Gotthard2 Specific */
TEST_CASE("bursts", "[.cmdcall]") {
TEST_CASE("bursts", "[.detectorintegration]") {
Detector det;
Caller caller(&det);
auto det_type = det.getDetectorType().squash();
@@ -370,7 +371,7 @@ TEST_CASE("bursts", "[.cmdcall]") {
}
}
TEST_CASE("burstperiod", "[.cmdcall]") {
TEST_CASE("burstperiod", "[.detectorintegration]") {
Detector det;
Caller caller(&det);
auto det_type = det.getDetectorType().squash();
@@ -392,7 +393,7 @@ TEST_CASE("burstperiod", "[.cmdcall]") {
}
}
TEST_CASE("burstsl", "[.cmdcall]") {
TEST_CASE("burstsl", "[.detectorintegration]") {
Detector det;
Caller caller(&det);
auto det_type = det.getDetectorType().squash();
@@ -403,7 +404,7 @@ TEST_CASE("burstsl", "[.cmdcall]") {
}
}
TEST_CASE("inj_ch", "[.cmdcall]") {
TEST_CASE("inj_ch", "[.detectorintegration]") {
Detector det;
Caller caller(&det);
auto det_type = det.getDetectorType().squash();
@@ -428,7 +429,7 @@ TEST_CASE("inj_ch", "[.cmdcall]") {
}
}
TEST_CASE("vetophoton", "[.cmdcall]") {
TEST_CASE("vetophoton", "[.detectorintegration]") {
Detector det;
Caller caller(&det);
auto det_type = det.getDetectorType().squash();
@@ -450,7 +451,7 @@ TEST_CASE("vetophoton", "[.cmdcall]") {
}
}
TEST_CASE("vetoref", "[.cmdcall]") {
TEST_CASE("vetoref", "[.detectorintegration]") {
Detector det;
Caller caller(&det);
auto det_type = det.getDetectorType().squash();
@@ -465,7 +466,7 @@ TEST_CASE("vetoref", "[.cmdcall]") {
}
}
TEST_CASE("vetofile", "[.cmdcall]") {
TEST_CASE("vetofile", "[.detectorintegration]") {
Detector det;
Caller caller(&det);
auto det_type = det.getDetectorType().squash();
@@ -479,7 +480,7 @@ TEST_CASE("vetofile", "[.cmdcall]") {
}
}
TEST_CASE("burstmode", "[.cmdcall]") {
TEST_CASE("burstmode", "[.detectorintegration]") {
Detector det;
Caller caller(&det);
auto det_type = det.getDetectorType().squash();
@@ -510,7 +511,7 @@ TEST_CASE("burstmode", "[.cmdcall]") {
}
}
TEST_CASE("cdsgain", "[.cmdcall]") {
TEST_CASE("cdsgain", "[.detectorintegration]") {
Detector det;
Caller caller(&det);
auto det_type = det.getDetectorType().squash();
@@ -540,7 +541,7 @@ TEST_CASE("cdsgain", "[.cmdcall]") {
}
}
TEST_CASE("timingsource", "[.cmdcall]") {
TEST_CASE("timingsource", "[.detectorintegration]") {
Detector det;
Caller caller(&det);
auto det_type = det.getDetectorType().squash();
@@ -570,7 +571,7 @@ TEST_CASE("timingsource", "[.cmdcall]") {
}
}
TEST_CASE("veto", "[.cmdcall]") {
TEST_CASE("veto", "[.detectorintegration]") {
Detector det;
Caller caller(&det);
auto det_type = det.getDetectorType().squash();
@@ -600,7 +601,7 @@ TEST_CASE("veto", "[.cmdcall]") {
}
}
TEST_CASE("vetostream", "[.cmdcall]") {
TEST_CASE("vetostream", "[.detectorintegration]") {
Detector det;
Caller caller(&det);
auto det_type = det.getDetectorType().squash();
@@ -646,7 +647,7 @@ TEST_CASE("vetostream", "[.cmdcall]") {
REQUIRE_THROWS(caller.call("vetostream", {"dfgd"}, -1, GET));
}
TEST_CASE("vetoalg", "[.cmdcall]") {
TEST_CASE("vetoalg", "[.detectorintegration]") {
Detector det;
Caller caller(&det);
auto det_type = det.getDetectorType().squash();
@@ -702,7 +703,7 @@ TEST_CASE("vetoalg", "[.cmdcall]") {
REQUIRE_THROWS(caller.call("vetoalg", {"dfgd"}, -1, GET));
}
TEST_CASE("confadc", "[.cmdcall]") {
TEST_CASE("confadc", "[.detectorintegration]") {
Detector det;
Caller caller(&det);
auto det_type = det.getDetectorType().squash();

View File

@@ -17,7 +17,8 @@ using test::PUT;
/* dacs */
TEST_CASE("Setting and reading back Jungfrau dacs", "[.cmdcall][.dacs]") {
TEST_CASE("Setting and reading back Jungfrau dacs",
"[.detectorintegration][.dacs]") {
// vb_comp, vdd_prot, vin_com, vref_prech, vb_pixbuf, vb_ds, vref_ds,
// vref_comp
Detector det;
@@ -95,7 +96,7 @@ TEST_CASE("Setting and reading back Jungfrau dacs", "[.cmdcall][.dacs]") {
/* Network Configuration (Detector<->Receiver) */
TEST_CASE("selinterface", "[.cmdcall]") {
TEST_CASE("selinterface", "[.detectorintegration]") {
Detector det;
Caller caller(&det);
auto det_type = det.getDetectorType().squash();
@@ -126,7 +127,7 @@ TEST_CASE("selinterface", "[.cmdcall]") {
/* Jungfrau/moench Specific */
TEST_CASE("temp_threshold", "[.cmdcall]") {
TEST_CASE("temp_threshold", "[.detectorintegration]") {
Detector det;
Caller caller(&det);
auto det_type = det.getDetectorType().squash();
@@ -156,7 +157,7 @@ TEST_CASE("temp_threshold", "[.cmdcall]") {
}
}
TEST_CASE("chipversion", "[.cmdcall]") {
TEST_CASE("chipversion", "[.detectorintegration]") {
Detector det;
Caller caller(&det);
auto det_type = det.getDetectorType().squash();
@@ -168,7 +169,7 @@ TEST_CASE("chipversion", "[.cmdcall]") {
REQUIRE_THROWS(caller.call("chipversion", {"0"}, -1, PUT));
}
TEST_CASE("temp_control", "[.cmdcall]") {
TEST_CASE("temp_control", "[.detectorintegration]") {
Detector det;
Caller caller(&det);
auto det_type = det.getDetectorType().squash();
@@ -198,7 +199,7 @@ TEST_CASE("temp_control", "[.cmdcall]") {
}
}
TEST_CASE("temp_event", "[.cmdcall]") {
TEST_CASE("temp_event", "[.detectorintegration]") {
Detector det;
Caller caller(&det);
auto det_type = det.getDetectorType().squash();
@@ -219,7 +220,7 @@ TEST_CASE("temp_event", "[.cmdcall]") {
}
}
TEST_CASE("autocompdisable", "[.cmdcall]") {
TEST_CASE("autocompdisable", "[.detectorintegration]") {
Detector det;
Caller caller(&det);
auto det_type = det.getDetectorType().squash();
@@ -249,7 +250,7 @@ TEST_CASE("autocompdisable", "[.cmdcall]") {
}
}
TEST_CASE("compdisabletime", "[.cmdcall]") {
TEST_CASE("compdisabletime", "[.detectorintegration]") {
Detector det;
Caller caller(&det);
auto det_type = det.getDetectorType().squash();
@@ -279,7 +280,7 @@ TEST_CASE("compdisabletime", "[.cmdcall]") {
}
}
TEST_CASE("extrastoragecells", "[.cmdcall]") {
TEST_CASE("extrastoragecells", "[.detectorintegration]") {
Detector det;
Caller caller(&det);
auto det_type = det.getDetectorType().squash();
@@ -322,7 +323,7 @@ TEST_CASE("extrastoragecells", "[.cmdcall]") {
}
}
TEST_CASE("storagecell_start", "[.cmdcall]") {
TEST_CASE("storagecell_start", "[.detectorintegration]") {
Detector det;
Caller caller(&det);
auto det_type = det.getDetectorType().squash();
@@ -367,7 +368,7 @@ TEST_CASE("storagecell_start", "[.cmdcall]") {
}
}
TEST_CASE("storagecell_delay", "[.cmdcall]") {
TEST_CASE("storagecell_delay", "[.detectorintegration]") {
Detector det;
Caller caller(&det);
auto det_type = det.getDetectorType().squash();
@@ -408,7 +409,7 @@ TEST_CASE("storagecell_delay", "[.cmdcall]") {
}
}
TEST_CASE("gainmode", "[.cmdcall]") {
TEST_CASE("gainmode", "[.detectorintegration]") {
Detector det;
Caller caller(&det);
auto det_type = det.getDetectorType().squash();
@@ -457,7 +458,7 @@ TEST_CASE("gainmode", "[.cmdcall]") {
}
}
TEST_CASE("filtercells", "[.cmdcall]") {
TEST_CASE("filtercells", "[.detectorintegration]") {
Detector det;
Caller caller(&det);
auto det_type = det.getDetectorType().squash();
@@ -501,7 +502,7 @@ TEST_CASE("filtercells", "[.cmdcall]") {
REQUIRE_THROWS(caller.call("filtercells", {"0"}, -1, PUT));
}
}
TEST_CASE("pedestalmode", "[.cmdcall]") {
TEST_CASE("pedestalmode", "[.detectorintegration]") {
Detector det;
Caller caller(&det);
auto det_type = det.getDetectorType().squash();
@@ -657,7 +658,7 @@ TEST_CASE("pedestalmode", "[.cmdcall]") {
}
}
TEST_CASE("timing_info_decoder", "[.cmdcall]") {
TEST_CASE("timing_info_decoder", "[.detectorintegration]") {
Detector det;
Caller caller(&det);
if (det.getDetectorType().squash() == defs::JUNGFRAU &&
@@ -686,7 +687,7 @@ TEST_CASE("timing_info_decoder", "[.cmdcall]") {
}
}
TEST_CASE("collectionmode", "[.cmdcall]") {
TEST_CASE("collectionmode", "[.detectorintegration]") {
Detector det;
Caller caller(&det);
if (det.getDetectorType().squash() == defs::JUNGFRAU) {
@@ -714,7 +715,7 @@ TEST_CASE("collectionmode", "[.cmdcall]") {
}
}
TEST_CASE("sync", "[.cmdcall]") {
TEST_CASE("sync", "[.detectorintegration]") {
Detector det;
Caller caller(&det);
auto det_type = det.getDetectorType().squash();

View File

@@ -1032,7 +1032,8 @@ void open_hdf5_file(const std::string &file_path) {
}
#endif
TEST_CASE("check_master_file_attributes", "[.cmdcall][.cmdacquire][.cmdattr]") {
TEST_CASE("check_master_file_attributes",
"[.detectorintegration][.cmdacquire][.cmdattr]") {
Detector det;
Caller caller(&det);
@@ -1041,12 +1042,14 @@ TEST_CASE("check_master_file_attributes", "[.cmdcall][.cmdacquire][.cmdattr]") {
int64_t num_frames = 1;
switch (det_type) {
case defs::EIGER:
case defs::JUNGFRAU:
create_files_for_acquire(det, caller, num_frames, std::nullopt, false);
break;
case defs::EIGER:
case defs::MOENCH:
case defs::MYTHEN3:
case defs::GOTTHARD2:
create_files_for_acquire(det, caller, num_frames);
create_files_for_acquire(det, caller, num_frames, std::nullopt);
break;
case defs::CHIPTESTBOARD:
case defs::XILINX_CHIPTESTBOARD: {

View File

@@ -17,7 +17,8 @@ using test::PUT;
/* dacs */
TEST_CASE("Setting and reading back moench dacs", "[.cmdcall][.dacs]") {
TEST_CASE("Setting and reading back moench dacs",
"[.detectorintegration][.dacs]") {
// vbp_colbuf, vipre, vin_cm, vb_sda, vcasc_sfp, vout_cm, vipre_cds,
// ibias_sfp
Detector det;

View File

@@ -19,7 +19,8 @@ using test::PUT;
/* dacs */
TEST_CASE("Setting and reading back MYTHEN3 dacs", "[.cmdcall][.dacs]") {
TEST_CASE("Setting and reading back MYTHEN3 dacs",
"[.detectorintegration][.dacs]") {
// vcassh, vth2, vshaper, vshaperneg, vipre_out, vth3, vth1,
// vicin, vcas, vpreamp, vpl, vipre, viinsh, vph, vtrim, vdcsh,
@@ -184,7 +185,7 @@ TEST_CASE("Setting and reading back MYTHEN3 dacs", "[.cmdcall][.dacs]") {
/* acquisition */
TEST_CASE("readout", "[.cmdcall]") {
TEST_CASE("readout", "[.detectorintegration]") {
Detector det;
Caller caller(&det);
// PUT only command
@@ -201,7 +202,7 @@ TEST_CASE("readout", "[.cmdcall]") {
/* Mythen3 Specific */
TEST_CASE("counters", "[.cmdcall]") {
TEST_CASE("counters", "[.detectorintegration]") {
Detector det;
Caller caller(&det);
auto det_type = det.getDetectorType().squash();
@@ -233,7 +234,7 @@ TEST_CASE("counters", "[.cmdcall]") {
}
}
TEST_CASE("gates", "[.cmdcall]") {
TEST_CASE("gates", "[.detectorintegration]") {
Detector det;
Caller caller(&det);
auto det_type = det.getDetectorType().squash();
@@ -263,7 +264,7 @@ TEST_CASE("gates", "[.cmdcall]") {
}
}
TEST_CASE("exptime1", "[.cmdcall]") {
TEST_CASE("exptime1", "[.detectorintegration]") {
Detector det;
Caller caller(&det);
auto det_type = det.getDetectorType().squash();
@@ -292,7 +293,7 @@ TEST_CASE("exptime1", "[.cmdcall]") {
}
}
TEST_CASE("exptime2", "[.cmdcall]") {
TEST_CASE("exptime2", "[.detectorintegration]") {
Detector det;
Caller caller(&det);
auto det_type = det.getDetectorType().squash();
@@ -321,7 +322,7 @@ TEST_CASE("exptime2", "[.cmdcall]") {
}
}
TEST_CASE("exptime3", "[.cmdcall]") {
TEST_CASE("exptime3", "[.detectorintegration]") {
Detector det;
Caller caller(&det);
auto det_type = det.getDetectorType().squash();
@@ -350,7 +351,7 @@ TEST_CASE("exptime3", "[.cmdcall]") {
}
}
TEST_CASE("gatedelay", "[.cmdcall]") {
TEST_CASE("gatedelay", "[.detectorintegration]") {
Detector det;
Caller caller(&det);
auto det_type = det.getDetectorType().squash();
@@ -386,7 +387,7 @@ TEST_CASE("gatedelay", "[.cmdcall]") {
}
}
TEST_CASE("gatedelay1", "[.cmdcall]") {
TEST_CASE("gatedelay1", "[.detectorintegration]") {
Detector det;
Caller caller(&det);
auto det_type = det.getDetectorType().squash();
@@ -415,7 +416,7 @@ TEST_CASE("gatedelay1", "[.cmdcall]") {
}
}
TEST_CASE("gatedelay2", "[.cmdcall]") {
TEST_CASE("gatedelay2", "[.detectorintegration]") {
Detector det;
Caller caller(&det);
auto det_type = det.getDetectorType().squash();
@@ -444,7 +445,7 @@ TEST_CASE("gatedelay2", "[.cmdcall]") {
}
}
TEST_CASE("gatedelay3", "[.cmdcall]") {
TEST_CASE("gatedelay3", "[.detectorintegration]") {
Detector det;
Caller caller(&det);
auto det_type = det.getDetectorType().squash();
@@ -473,7 +474,7 @@ TEST_CASE("gatedelay3", "[.cmdcall]") {
}
}
TEST_CASE("polarity", "[.cmdcall]") {
TEST_CASE("polarity", "[.detectorintegration]") {
Detector det;
Caller caller(&det);
if (det.getDetectorType().squash() == defs::MYTHEN3) {
@@ -501,7 +502,7 @@ TEST_CASE("polarity", "[.cmdcall]") {
}
}
TEST_CASE("interpolation", "[.cmdcall]") {
TEST_CASE("interpolation", "[.detectorintegration]") {
Detector det;
Caller caller(&det);
if (det.getDetectorType().squash() == defs::MYTHEN3) {
@@ -555,7 +556,7 @@ TEST_CASE("interpolation", "[.cmdcall]") {
}
}
TEST_CASE("pumpprobe", "[.cmdcall]") {
TEST_CASE("pumpprobe", "[.detectorintegration]") {
Detector det;
Caller caller(&det);
if (det.getDetectorType().squash() == defs::MYTHEN3) {
@@ -632,7 +633,7 @@ TEST_CASE("pumpprobe", "[.cmdcall]") {
}
}
TEST_CASE("apulse", "[.cmdcall]") {
TEST_CASE("apulse", "[.detectorintegration]") {
Detector det;
Caller caller(&det);
if (det.getDetectorType().squash() == defs::MYTHEN3) {
@@ -660,7 +661,7 @@ TEST_CASE("apulse", "[.cmdcall]") {
}
}
TEST_CASE("dpulse", "[.cmdcall]") {
TEST_CASE("dpulse", "[.detectorintegration]") {
Detector det;
Caller caller(&det);
if (det.getDetectorType().squash() == defs::MYTHEN3) {

View File

@@ -19,7 +19,7 @@ using test::PUT;
/* Pattern */
TEST_CASE("patfname", "[.cmdcall]") {
TEST_CASE("patfname", "[.detectorintegration]") {
Detector det;
Caller caller(&det);
auto det_type = det.getDetectorType().squash();
@@ -32,7 +32,7 @@ TEST_CASE("patfname", "[.cmdcall]") {
}
}
TEST_CASE("pattern", "[.cmdcall]") {
TEST_CASE("pattern", "[.detectorintegration]") {
Detector det;
Caller caller(&det);
auto det_type = det.getDetectorType().squash();
@@ -45,7 +45,7 @@ TEST_CASE("pattern", "[.cmdcall]") {
}
}
TEST_CASE("savepattern", "[.cmdcall]") {
TEST_CASE("savepattern", "[.detectorintegration]") {
Detector det;
Caller caller(&det);
auto det_type = det.getDetectorType().squash();
@@ -63,7 +63,7 @@ TEST_CASE("savepattern", "[.cmdcall]") {
}
}
TEST_CASE("defaultpattern", "[.cmdcall]") {
TEST_CASE("defaultpattern", "[.detectorintegration]") {
Detector det;
Caller caller(&det);
auto det_type = det.getDetectorType().squash();
@@ -76,7 +76,7 @@ TEST_CASE("defaultpattern", "[.cmdcall]") {
}
}
TEST_CASE("patioctrl", "[.cmdcall]") {
TEST_CASE("patioctrl", "[.detectorintegration]") {
Detector det;
Caller caller(&det);
auto det_type = det.getDetectorType().squash();
@@ -107,7 +107,7 @@ TEST_CASE("patioctrl", "[.cmdcall]") {
}
}
TEST_CASE("patword", "[.cmdcall]") {
TEST_CASE("patword", "[.detectorintegration]") {
Detector det;
Caller caller(&det);
auto det_type = det.getDetectorType().squash();
@@ -149,7 +149,7 @@ TEST_CASE("patword", "[.cmdcall]") {
}
}
TEST_CASE("patlimits", "[.cmdcall]") {
TEST_CASE("patlimits", "[.detectorintegration]") {
Detector det;
Caller caller(&det);
auto det_type = det.getDetectorType().squash();
@@ -176,7 +176,7 @@ TEST_CASE("patlimits", "[.cmdcall]") {
}
}
TEST_CASE("patloop", "[.cmdcall]") {
TEST_CASE("patloop", "[.detectorintegration]") {
Detector det;
Caller caller(&det);
auto det_type = det.getDetectorType().squash();
@@ -225,7 +225,7 @@ TEST_CASE("patloop", "[.cmdcall]") {
}
}
TEST_CASE("patnloop", "[.cmdcall]") {
TEST_CASE("patnloop", "[.detectorintegration]") {
Detector det;
Caller caller(&det);
auto det_type = det.getDetectorType().squash();
@@ -271,7 +271,7 @@ TEST_CASE("patnloop", "[.cmdcall]") {
}
}
TEST_CASE("patwait", "[.cmdcall]") {
TEST_CASE("patwait", "[.detectorintegration]") {
Detector det;
Caller caller(&det);
auto det_type = det.getDetectorType().squash();
@@ -317,7 +317,7 @@ TEST_CASE("patwait", "[.cmdcall]") {
}
}
TEST_CASE("patwaittime", "[.cmdcall]") {
TEST_CASE("patwaittime", "[.detectorintegration]") {
Detector det;
Caller caller(&det);
auto det_type = det.getDetectorType().squash();
@@ -379,7 +379,7 @@ TEST_CASE("patwaittime", "[.cmdcall]") {
}
}
TEST_CASE("patmask", "[.cmdcall]") {
TEST_CASE("patmask", "[.detectorintegration]") {
Detector det;
Caller caller(&det);
auto det_type = det.getDetectorType().squash();
@@ -405,7 +405,7 @@ TEST_CASE("patmask", "[.cmdcall]") {
}
}
TEST_CASE("patsetbit", "[.cmdcall]") {
TEST_CASE("patsetbit", "[.detectorintegration]") {
Detector det;
Caller caller(&det);
auto det_type = det.getDetectorType().squash();
@@ -431,7 +431,7 @@ TEST_CASE("patsetbit", "[.cmdcall]") {
}
}
TEST_CASE("patternstart", "[.cmdcall]") {
TEST_CASE("patternstart", "[.detectorintegration]") {
Detector det;
Caller caller(&det);
REQUIRE_THROWS(caller.call("patternstart", {}, -1, GET));

View File

@@ -12,7 +12,7 @@ namespace sls {
using test::PUT;
TEST_CASE("Ctb and xilinx - cant put if receiver is not idle",
"[.cmdcall][.rx]") {
"[.detectorintegration][.rx]") {
Detector det;
Caller caller(&det);
@@ -60,7 +60,8 @@ TEST_CASE("Ctb and xilinx - cant put if receiver is not idle",
}
}
TEST_CASE("adcenable - cant put if receiver is not idle", "[.cmdcall][.rx]") {
TEST_CASE("adcenable - cant put if receiver is not idle",
"[.detectorintegration][.rx]") {
Detector det;
Caller caller(&det);
@@ -83,7 +84,8 @@ TEST_CASE("adcenable - cant put if receiver is not idle", "[.cmdcall][.rx]") {
}
}
TEST_CASE("bursts - cant put if receiver is not idle", "[.cmdcall][.rx]") {
TEST_CASE("bursts - cant put if receiver is not idle",
"[.detectorintegration][.rx]") {
Detector det;
Caller caller(&det);
@@ -105,7 +107,8 @@ TEST_CASE("bursts - cant put if receiver is not idle", "[.cmdcall][.rx]") {
}
}
TEST_CASE("counters - cant put if receiver is not idle", "[.cmdcall][.rx]") {
TEST_CASE("counters - cant put if receiver is not idle",
"[.detectorintegration][.rx]") {
Detector det;
Caller caller(&det);
@@ -129,30 +132,32 @@ TEST_CASE("counters - cant put if receiver is not idle", "[.cmdcall][.rx]") {
}
TEST_CASE("numinterfaces - cant put if receiver is not idle",
"[.cmdcall][.rx]") {
"[.detectorintegration][.rx]") {
Detector det;
Caller caller(&det);
auto det_type = det.getDetectorType().squash();
if (det_type == defs::JUNGFRAU || det_type == defs::MOENCH) {
auto prev_numinterfaces = det.getNumberofUDPInterfaces();
auto prev_numinterfaces = det.getNumberofUDPInterfaces().tsquash(
"Number of UDP Interfaces is not consistent among modules");
// start receiver
REQUIRE_NOTHROW(caller.call("rx_start", {}, -1, PUT));
REQUIRE_THROWS(caller.call("numinterafaces", {"2"}, -1, PUT));
REQUIRE_THROWS(caller.call("numinterfaces", {"2"}, -1, PUT));
auto numinterfaces = det.getNumberofUDPInterfaces();
// stop receiver
REQUIRE_NOTHROW(caller.call("rx_stop", {}, -1, PUT));
for (int i = 0; i != det.size(); ++i) {
det.setNumberofUDPInterfaces(prev_numinterfaces[i], {i});
}
det.setNumberofUDPInterfaces(prev_numinterfaces);
}
}
TEST_CASE("dr - cant put if receiver is not idle", "[.cmdcall][.rx]") {
TEST_CASE("dr - cant put if receiver is not idle",
"[.detectorintegration][.rx]") {
Detector det;
Caller caller(&det);
@@ -174,7 +179,8 @@ TEST_CASE("dr - cant put if receiver is not idle", "[.cmdcall][.rx]") {
}
}
TEST_CASE("tengiga - cant put if receiver is not idle", "[.cmdcall][.rx]") {
TEST_CASE("tengiga - cant put if receiver is not idle",
"[.detectorintegration][.rx]") {
Detector det;
Caller caller(&det);
@@ -198,7 +204,8 @@ TEST_CASE("tengiga - cant put if receiver is not idle", "[.cmdcall][.rx]") {
}
}
TEST_CASE("general - cant put if receiver is not idle", "[.cmdcall][.rx]") {
TEST_CASE("general - cant put if receiver is not idle",
"[.detectorintegration][.rx]") {
Detector det;
Caller caller(&det);

View File

@@ -25,7 +25,7 @@ python/scripts/list_tested_cmd.py to check if all commands are covered
/* configuration */
TEST_CASE("rx_version", "[.cmdcall][.rx]") {
TEST_CASE("rx_version", "[.detectorintegration][.rx]") {
Detector det;
Caller caller(&det);
std::ostringstream oss;
@@ -39,7 +39,7 @@ TEST_CASE("rx_version", "[.cmdcall][.rx]") {
}
/* acquisition */
TEST_CASE("rx_start", "[.cmdcall][.rx]") {
TEST_CASE("rx_start", "[.detectorintegration][.rx]") {
Detector det;
Caller caller(&det);
det.setFileWrite(false); // avoid writing or error on file creation
@@ -57,7 +57,7 @@ TEST_CASE("rx_start", "[.cmdcall][.rx]") {
}
}
TEST_CASE("rx_stop", "[.cmdcall][.rx]") {
TEST_CASE("rx_stop", "[.detectorintegration][.rx]") {
Detector det;
Caller caller(&det);
// PUT only command
@@ -74,7 +74,7 @@ TEST_CASE("rx_stop", "[.cmdcall][.rx]") {
}
}
TEST_CASE("rx_status", "[.cmdcall][.rx]") {
TEST_CASE("rx_status", "[.detectorintegration][.rx]") {
Detector det;
Caller caller(&det);
det.setFileWrite(false); // avoid writing or error on file creation
@@ -92,7 +92,7 @@ TEST_CASE("rx_status", "[.cmdcall][.rx]") {
}
}
TEST_CASE("rx_framescaught", "[.cmdcall][.rx]") {
TEST_CASE("rx_framescaught", "[.detectorintegration][.rx]") {
Detector det;
Caller caller(&det);
// This ensures 0 caught frames
@@ -126,7 +126,7 @@ TEST_CASE("rx_framescaught", "[.cmdcall][.rx]") {
}
}
TEST_CASE("rx_missingpackets", "[.cmdcall][.rx]") {
TEST_CASE("rx_missingpackets", "[.detectorintegration][.rx]") {
Detector det;
Caller caller(&det);
auto prev_val = det.getFileWrite();
@@ -171,7 +171,7 @@ TEST_CASE("rx_missingpackets", "[.cmdcall][.rx]") {
det.setNumberOfFrames(prev_frames);
}
TEST_CASE("rx_frameindex", "[.cmdcall][.rx]") {
TEST_CASE("rx_frameindex", "[.detectorintegration][.rx]") {
Detector det;
Caller caller(&det);
caller.call("rx_frameindex", {}, -1, GET);
@@ -182,7 +182,7 @@ TEST_CASE("rx_frameindex", "[.cmdcall][.rx]") {
/* Network Configuration (Detector<->Receiver) */
TEST_CASE("rx_printconfig", "[.cmdcall][.rx]") {
TEST_CASE("rx_printconfig", "[.detectorintegration][.rx]") {
Detector det;
Caller caller(&det);
REQUIRE_NOTHROW(caller.call("rx_printconfig", {}, -1, GET));
@@ -190,7 +190,7 @@ TEST_CASE("rx_printconfig", "[.cmdcall][.rx]") {
/* Receiver Config */
TEST_CASE("rx_hostname", "[.cmdcall][.rx]") {
TEST_CASE("rx_hostname", "[.detectorintegration][.rx]") {
Detector det;
Caller caller(&det);
auto prev_val = det.getRxHostname();
@@ -222,7 +222,7 @@ TEST_CASE("rx_hostname", "[.cmdcall][.rx]") {
}
}
TEST_CASE("rx_tcpport", "[.cmdcall][.rx]") {
TEST_CASE("rx_tcpport", "[.detectorintegration][.rx]") {
Detector det;
Caller caller(&det);
auto prev_val = det.getRxPort();
@@ -261,7 +261,7 @@ TEST_CASE("rx_tcpport", "[.cmdcall][.rx]") {
}
}
TEST_CASE("rx_fifodepth", "[.cmdcall][.rx]") {
TEST_CASE("rx_fifodepth", "[.detectorintegration][.rx]") {
Detector det;
Caller caller(&det);
auto prev_val = det.getRxFifoDepth();
@@ -285,7 +285,7 @@ TEST_CASE("rx_fifodepth", "[.cmdcall][.rx]") {
}
}
TEST_CASE("rx_silent", "[.cmdcall][.rx]") {
TEST_CASE("rx_silent", "[.detectorintegration][.rx]") {
Detector det;
Caller caller(&det);
auto prev_val = det.getRxSilentMode();
@@ -309,7 +309,7 @@ TEST_CASE("rx_silent", "[.cmdcall][.rx]") {
}
}
TEST_CASE("rx_discardpolicy", "[.cmdcall][.rx]") {
TEST_CASE("rx_discardpolicy", "[.detectorintegration][.rx]") {
Detector det;
Caller caller(&det);
auto prev_val = det.getRxFrameDiscardPolicy();
@@ -338,7 +338,7 @@ TEST_CASE("rx_discardpolicy", "[.cmdcall][.rx]") {
}
}
TEST_CASE("rx_padding", "[.cmdcall][.rx]") {
TEST_CASE("rx_padding", "[.detectorintegration][.rx]") {
Detector det;
Caller caller(&det);
auto prev_val = det.getPartialFramesPadding();
@@ -362,7 +362,7 @@ TEST_CASE("rx_padding", "[.cmdcall][.rx]") {
}
}
TEST_CASE("rx_udpsocksize", "[.cmdcall][.rx]") {
TEST_CASE("rx_udpsocksize", "[.detectorintegration][.rx]") {
Detector det;
Caller caller(&det);
int64_t prev_val = det.getRxUDPSocketBufferSize().tsquash(
@@ -382,7 +382,7 @@ TEST_CASE("rx_udpsocksize", "[.cmdcall][.rx]") {
det.setRxUDPSocketBufferSize(prev_val);
}
TEST_CASE("rx_realudpsocksize", "[.cmdcall][.rx]") {
TEST_CASE("rx_realudpsocksize", "[.detectorintegration][.rx]") {
Detector det;
Caller caller(&det);
uint64_t val = 0;
@@ -401,7 +401,7 @@ TEST_CASE("rx_realudpsocksize", "[.cmdcall][.rx]") {
}
}
TEST_CASE("rx_lock", "[.cmdcall][.rx]") {
TEST_CASE("rx_lock", "[.detectorintegration][.rx]") {
Detector det;
Caller caller(&det);
auto prev_val = det.getRxLock();
@@ -425,7 +425,7 @@ TEST_CASE("rx_lock", "[.cmdcall][.rx]") {
}
}
TEST_CASE("rx_lastclient", "[.cmdcall][.rx]") {
TEST_CASE("rx_lastclient", "[.detectorintegration][.rx]") {
Detector det;
Caller caller(&det);
std::ostringstream oss;
@@ -435,14 +435,14 @@ TEST_CASE("rx_lastclient", "[.cmdcall][.rx]") {
}
}
TEST_CASE("rx_threads", "[.cmdcall][.rx]") {
TEST_CASE("rx_threads", "[.detectorintegration][.rx]") {
Detector det;
Caller caller(&det);
std::ostringstream oss;
REQUIRE_NOTHROW(caller.call("rx_threads", {}, -1, GET, oss));
}
TEST_CASE("rx_arping", "[.cmdcall][.rx]") {
TEST_CASE("rx_arping", "[.detectorintegration][.rx]") {
Detector det;
Caller caller(&det);
auto prev_val = det.getRxArping();
@@ -467,7 +467,7 @@ TEST_CASE("rx_arping", "[.cmdcall][.rx]") {
}
}
}
TEST_CASE("rx_roi", "[.cmdcall]") {
TEST_CASE("rx_roi", "[.detectorintegration]") {
Detector det;
Caller caller(&det);
auto det_type = det.getDetectorType().squash();
@@ -756,7 +756,8 @@ TEST_CASE("rx_roi", "[.cmdcall]") {
// check master file creation
// TODO: check roi in master file
{
REQUIRE_NOTHROW(create_files_for_acquire(det, caller));
REQUIRE_NOTHROW(
create_files_for_acquire(det, caller, 1, std::nullopt, false));
testFileInfo file_info;
std::string master_file_prefix =
file_info.getMasterFileNamePrefix();
@@ -782,7 +783,7 @@ TEST_CASE("rx_roi", "[.cmdcall]") {
}
}
TEST_CASE("rx_clearroi", "[.cmdcall]") {
TEST_CASE("rx_clearroi", "[.detectorintegration]") {
Detector det;
Caller caller(&det);
auto det_type = det.getDetectorType().squash();
@@ -808,7 +809,7 @@ TEST_CASE("rx_clearroi", "[.cmdcall]") {
/* File */
TEST_CASE("fformat", "[.cmdcall]") {
TEST_CASE("fformat", "[.detectorintegration]") {
Detector det;
Caller caller(&det);
auto prev_val = det.getFileFormat();
@@ -827,7 +828,7 @@ TEST_CASE("fformat", "[.cmdcall]") {
}
}
TEST_CASE("fpath", "[.cmdcall]") {
TEST_CASE("fpath", "[.detectorintegration]") {
Detector det;
Caller caller(&det);
auto prev_val = det.getFilePath();
@@ -849,7 +850,7 @@ TEST_CASE("fpath", "[.cmdcall]") {
}
}
TEST_CASE("fname", "[.cmdcall]") {
TEST_CASE("fname", "[.detectorintegration]") {
Detector det;
Caller caller(&det);
auto prev_val = det.getFileNamePrefix();
@@ -876,7 +877,7 @@ TEST_CASE("fname", "[.cmdcall]") {
}
}
TEST_CASE("findex", "[.cmdcall]") {
TEST_CASE("findex", "[.detectorintegration]") {
Detector det;
Caller caller(&det);
auto prev_val = det.getAcquisitionIndex();
@@ -900,7 +901,7 @@ TEST_CASE("findex", "[.cmdcall]") {
}
}
TEST_CASE("fwrite", "[.cmdcall]") {
TEST_CASE("fwrite", "[.detectorintegration]") {
Detector det;
Caller caller(&det);
auto prev_val = det.getFileWrite();
@@ -924,7 +925,7 @@ TEST_CASE("fwrite", "[.cmdcall]") {
}
}
TEST_CASE("fmaster", "[.cmdcall]") {
TEST_CASE("fmaster", "[.detectorintegration]") {
Detector det;
Caller caller(&det);
auto prev_val = det.getMasterFileWrite();
@@ -946,7 +947,7 @@ TEST_CASE("fmaster", "[.cmdcall]") {
det.setMasterFileWrite(prev_val);
}
TEST_CASE("foverwrite", "[.cmdcall]") {
TEST_CASE("foverwrite", "[.detectorintegration]") {
Detector det;
Caller caller(&det);
auto prev_val = det.getFileOverWrite();
@@ -970,7 +971,7 @@ TEST_CASE("foverwrite", "[.cmdcall]") {
}
}
TEST_CASE("rx_framesperfile", "[.cmdcall][.rx]") {
TEST_CASE("rx_framesperfile", "[.detectorintegration][.rx]") {
Detector det;
Caller caller(&det);
auto prev_val = det.getFramesPerFile();
@@ -1001,7 +1002,7 @@ TEST_CASE("rx_framesperfile", "[.cmdcall][.rx]") {
/* ZMQ Streaming Parameters (Receiver<->Client) */
TEST_CASE("rx_zmqstream", "[.cmdcall][.rx]") {
TEST_CASE("rx_zmqstream", "[.detectorintegration][.rx]") {
Detector det;
Caller caller(&det);
auto prev_val = det.getRxZmqDataStream();
@@ -1027,7 +1028,7 @@ TEST_CASE("rx_zmqstream", "[.cmdcall][.rx]") {
}
}
TEST_CASE("rx_zmqfreq", "[.cmdcall][.rx]") {
TEST_CASE("rx_zmqfreq", "[.detectorintegration][.rx]") {
Detector det;
Caller caller(&det);
auto prev_val = det.getRxZmqFrequency();
@@ -1051,7 +1052,7 @@ TEST_CASE("rx_zmqfreq", "[.cmdcall][.rx]") {
}
}
TEST_CASE("rx_zmqstartfnum", "[.cmdcall][.rx]") {
TEST_CASE("rx_zmqstartfnum", "[.detectorintegration][.rx]") {
Detector det;
Caller caller(&det);
auto prev_val = det.getRxZmqStartingFrame();
@@ -1075,7 +1076,7 @@ TEST_CASE("rx_zmqstartfnum", "[.cmdcall][.rx]") {
}
}
TEST_CASE("rx_zmqport", "[.cmdcall][.rx]") {
TEST_CASE("rx_zmqport", "[.detectorintegration][.rx]") {
Detector det;
Caller caller(&det);
auto prev_val_zmqport = det.getRxZmqPort();
@@ -1123,7 +1124,7 @@ TEST_CASE("rx_zmqport", "[.cmdcall][.rx]") {
}
}
TEST_CASE("rx_zmqhwm", "[.cmdcall]") {
TEST_CASE("rx_zmqhwm", "[.detectorintegration]") {
Detector det;
Caller caller(&det);
auto prev_val =
@@ -1153,7 +1154,7 @@ TEST_CASE("rx_zmqhwm", "[.cmdcall]") {
/* CTB Specific */
TEST_CASE("rx_dbitlist", "[.cmdcall][.rx]") {
TEST_CASE("rx_dbitlist", "[.detectorintegration][.rx]") {
Detector det;
Caller caller(&det);
auto det_type = det.getDetectorType().squash();
@@ -1183,7 +1184,7 @@ TEST_CASE("rx_dbitlist", "[.cmdcall][.rx]") {
}
}
TEST_CASE("rx_dbitoffset", "[.cmdcall][.rx]") {
TEST_CASE("rx_dbitoffset", "[.detectorintegration][.rx]") {
Detector det;
Caller caller(&det);
auto det_type = det.getDetectorType().squash();
@@ -1218,7 +1219,7 @@ TEST_CASE("rx_dbitoffset", "[.cmdcall][.rx]") {
}
}
TEST_CASE("rx_dbitreorder", "[.cmdcall][.rx]") {
TEST_CASE("rx_dbitreorder", "[.detectorintegration][.rx]") {
Detector det;
Caller caller(&det);
auto det_type = det.getDetectorType().squash();
@@ -1249,7 +1250,7 @@ TEST_CASE("rx_dbitreorder", "[.cmdcall][.rx]") {
}
}
TEST_CASE("rx_jsonaddheader", "[.cmdcall][.rx]") {
TEST_CASE("rx_jsonaddheader", "[.detectorintegration][.rx]") {
Detector det;
Caller caller(&det);
auto prev_val = det.getAdditionalJsonHeader();
@@ -1275,7 +1276,7 @@ TEST_CASE("rx_jsonaddheader", "[.cmdcall][.rx]") {
}
}
TEST_CASE("rx_jsonpara", "[.cmdcall][.rx]") {
TEST_CASE("rx_jsonpara", "[.detectorintegration][.rx]") {
Detector det;
Caller caller(&det);
auto prev_val = det.getAdditionalJsonHeader();

View File

@@ -19,7 +19,7 @@ using test::PUT;
/* dacs */
TEST_CASE("configtransceiver", "[.cmdcall]") {
TEST_CASE("configtransceiver", "[.detectorintegration]") {
Detector det;
Caller caller(&det);
auto det_type = det.getDetectorType().squash();

File diff suppressed because it is too large Load Diff

View File

@@ -49,7 +49,7 @@ target_link_libraries(slsReceiverObject
slsProjectOptions
slsSupportStatic
PRIVATE
slsProjectWarnings #don't propagate warnigns
slsProjectWarnings #don't propagate warnings
)
target_compile_definitions(slsReceiverObject
@@ -118,8 +118,6 @@ if (SLS_USE_RECEIVER_BINARIES)
target_link_libraries(slsReceiver PUBLIC
PUBLIC
slsReceiverStatic
pthread
rt
PRIVATE
slsProjectWarnings
)
@@ -138,8 +136,6 @@ if (SLS_USE_RECEIVER_BINARIES)
target_link_libraries(slsMultiReceiver
PUBLIC
slsReceiverStatic
pthread
rt
PRIVATE
slsProjectWarnings
)
@@ -158,8 +154,6 @@ if (SLS_USE_RECEIVER_BINARIES)
target_link_libraries(slsFrameSynchronizer
PUBLIC
slsReceiverStatic
pthread
rt
PRIVATE
slsProjectWarnings

View File

@@ -813,7 +813,8 @@ void Implementation::startReadout() {
<< "waiting for all packets, previousValue:"
<< previousValue
<< " totalPacketsReceived: " << totalPacketsReceived;
/* TODO! Need to find optimal time **/
/* TODO! Need to find optimal time - xilinx and jungfrau need
* more time */
std::this_thread::sleep_for(std::chrono::milliseconds(5));
previousValue = totalPacketsReceived;
totalPacketsReceived = 0;

View File

@@ -138,7 +138,8 @@ TEST_CASE("Parse version and help", "[detector]") {
}
}
TEST_CASE("Parse port and uid", "[detector]") {
// TODO: fails on gitea CI due to uid issue, fix later
TEST_CASE("Parse port and uid", "[.failsongitea][detector]") {
uid_t uid = getuid();
std::string uidStr = std::to_string(uid);
uid_t invalidUid = uid + 1000;
@@ -147,8 +148,12 @@ TEST_CASE("Parse port and uid", "[detector]") {
for (auto app : {AppType::SingleReceiver, AppType::MultiReceiver,
AppType::FrameSynchronizer}) {
CommandLineOptions s(app);
REQUIRE_THROWS(
s.parse({"", "-p", "1234", "-u", invalidUidStr})); // invalid uid
// TODO! This test fails on gitea CI probably because the user can set the uid
// commenting it out for now. Revisit later.
// REQUIRE_THROWS(
// s.parse({"", "-p", "1234", "-u", invalidUidStr})); // invalid uid
REQUIRE_THROWS(s.parse({"", "-p", "500"})); // invalid port
auto opts = s.parse({"", "-p", "1234", "-u", uidStr});

View File

@@ -64,7 +64,8 @@ class DataProcessorTest : public DataProcessor {
* num_transceiver_bytes = 2 both bytes have a value of 125
* num_digital_bytes is variable and is defined by number of samples
* default num sample is 5
* all bytes in digital data take a value of 255
* all bytes in digital data take a value of 0xFF (alternating bits between 0,
* 1)
*/
class DataProcessorTestFixture {
public:
@@ -106,7 +107,7 @@ class DataProcessorTestFixture {
num_random_offset_bytes);
}
void set_data() {
void set_data(const std::bitset<8> pattern = 0xFF) {
delete[] data;
uint64_t max_bytes_per_bit =
num_samples % 8 == 0 ? num_samples / 8 : num_samples / 8 + 1;
@@ -118,7 +119,8 @@ class DataProcessorTestFixture {
memset(data, dummy_value, num_analog_bytes); // set to dummy value
memset(data + num_analog_bytes, 0,
num_random_offset_bytes); // set to zero
memset(data + num_analog_bytes + num_random_offset_bytes, 0xFF,
memset(data + num_analog_bytes + num_random_offset_bytes,
static_cast<uint8_t>(pattern.to_ulong()),
num_digital_bytes); // all digital bits are one
memset(data + num_digital_bytes + num_analog_bytes +
num_random_offset_bytes,
@@ -138,7 +140,7 @@ class DataProcessorTestFixture {
};
TEST_CASE_METHOD(DataProcessorTestFixture, "Remove Trailing Bits",
"[.dataprocessor][.bitoffset]") {
"[dataprocessor][bitoffset]") {
const size_t num_random_offset_bytes = 3;
set_random_offset_bytes(num_random_offset_bytes);
@@ -168,9 +170,9 @@ TEST_CASE_METHOD(DataProcessorTestFixture, "Remove Trailing Bits",
// parametric test tested with num_samples = 5, num_samples = 10, num_samples =
// 8
TEST_CASE_METHOD(DataProcessorTestFixture, "Reorder all",
"[.dataprocessor][.reorder]") {
"[dataprocessor][reorder]") {
// parameters: num_samples, expected_num_digital_bytes,
// expected_digital_part
// expected_digital_part_for_each_bit
auto parameters = GENERATE(
std::make_tuple(5, 64, std::vector<uint8_t>{0b00011111}),
std::make_tuple(10, 2 * 64, std::vector<uint8_t>{0xFF, 0b00000011}),
@@ -217,7 +219,7 @@ TEST_CASE_METHOD(DataProcessorTestFixture, "Reorder all",
TEST_CASE_METHOD(DataProcessorTestFixture,
"Reorder all and remove trailing bits",
"[.dataprocessor][.reorder]") {
"[dataprocessor][reorder]") {
// set number of samples for test fixture -> create data
const size_t num_random_offset_bytes = 3;
@@ -259,16 +261,18 @@ TEST_CASE_METHOD(DataProcessorTestFixture,
}
TEST_CASE_METHOD(DataProcessorTestFixture, "Arrange bitlist with reorder false",
"[.dataprocessor][.retrievebitlist]") {
"[dataprocessor][retrievebitlist]") {
// parameters: num_samples, bitlist, expected_num_digital_bytes,
// expected_digital_part
auto parameters = GENERATE(
std::make_tuple(5, std::vector<int>{1, 4, 5}, 5,
std::vector<uint8_t>{0b00000111}),
std::vector<uint8_t>{0b00000010}),
std::make_tuple(5, std::vector<int>{1, 5, 4}, 5,
std::vector<uint8_t>{0b00000100}),
std::make_tuple(5, std::vector<int>{1, 5, 3, 7, 8, 50, 42, 60, 39}, 10,
std::vector<uint8_t>{0xFF, 0b00000001}),
std::vector<uint8_t>{0b11110000, 0b00000000}),
std::make_tuple(5, std::vector<int>{1, 5, 3, 7, 8, 50, 42, 60}, 5,
std::vector<uint8_t>{0xFF}));
std::vector<uint8_t>{0b11110000}));
size_t num_samples, expected_num_digital_bytes;
std::vector<uint8_t> expected_digital_part;
@@ -281,7 +285,7 @@ TEST_CASE_METHOD(DataProcessorTestFixture, "Arrange bitlist with reorder false",
generaldata->SetCtbDbitReorder(false);
set_num_samples(num_samples);
set_data();
set_data(0b01010101); // set digital data to 0x55 to have alternating bits
size_t expected_size =
num_analog_bytes + num_transceiver_bytes + expected_num_digital_bytes;
@@ -311,16 +315,20 @@ TEST_CASE_METHOD(DataProcessorTestFixture, "Arrange bitlist with reorder false",
}
TEST_CASE_METHOD(DataProcessorTestFixture, "Arrange bitlist with reorder true",
"[.dataprocessor][.retrievebitlist]") {
"[dataprocessor][retrievebitlist]") {
// parameters: num_samples, bitlist, expected_num_digital_bytes,
// expected_digital_part
auto parameters = GENERATE(
std::make_tuple(5, std::vector<int>{1, 4, 5}, 3,
std::vector<uint8_t>{0b00011111}),
std::vector<uint8_t>{0x00, 0b00011111, 0x00}),
std::make_tuple(5, std::vector<int>{1, 5, 4}, 3,
std::vector<uint8_t>{0x00, 0x00, 0b00011111}),
std::make_tuple(10, std::vector<int>{1, 4, 5}, 6,
std::vector<uint8_t>{0xFF, 0b00000011}),
std::vector<uint8_t>{0x00, 0x00, 0b11111111, 0b00000011,
0x00, 0x00}),
std::make_tuple(8, std::vector<int>{1, 5, 3, 7, 8, 50, 42, 60, 39}, 9,
std::vector<uint8_t>{0xFF}));
std::vector<uint8_t>{0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF,
0xFF, 0xFF, 0x00}));
size_t num_samples, expected_num_digital_bytes;
std::vector<uint8_t> expected_digital_part;
@@ -333,7 +341,7 @@ TEST_CASE_METHOD(DataProcessorTestFixture, "Arrange bitlist with reorder true",
generaldata->SetCtbDbitReorder(true);
set_num_samples(num_samples);
set_data();
set_data(0b01010101);
size_t expected_size =
num_analog_bytes + num_transceiver_bytes + expected_num_digital_bytes;
@@ -343,11 +351,8 @@ TEST_CASE_METHOD(DataProcessorTestFixture, "Arrange bitlist with reorder true",
memset(expected_data, dummy_value, num_analog_bytes);
for (size_t sample = 0; sample < bitlist.size(); ++sample) {
memcpy(expected_data + num_analog_bytes +
expected_digital_part.size() * sample,
expected_digital_part.data(), expected_digital_part.size());
}
memcpy(expected_data + num_analog_bytes, expected_digital_part.data(),
expected_digital_part.size());
memset(expected_data + expected_num_digital_bytes + num_analog_bytes,
dummy_value, num_transceiver_bytes);
@@ -364,7 +369,7 @@ TEST_CASE_METHOD(DataProcessorTestFixture, "Arrange bitlist with reorder true",
TEST_CASE_METHOD(DataProcessorTestFixture,
"Arrange bitlist and remove trailing bits",
"[.dataprocessor][.retrievebitlist]") {
"[dataprocessor][retrievebitlist]") {
size_t num_random_offset_bytes = 3;
std::vector<int> bitlist{1, 4, 5};

View File

@@ -1,5 +1,8 @@
# SPDX-License-Identifier: LGPL-3.0-or-other
# Copyright (C) 2021 Contributors to the SLS Detector Package
set(SOURCES
src/string_utils.cpp
src/file_utils.cpp
@@ -89,12 +92,17 @@ target_link_libraries(slsSupportObject
PUBLIC
slsProjectOptions
${STD_FS_LIB} # from helpers.cmake
Threads::Threads # slsDetector and Receiver need this
PRIVATE
slsProjectWarnings
md5sls
)
#RH8 glibc 2.28, RH9 glibc 2.34 linking rt is only needed with glibc < 2.34
#but we do it for all Linux builds to avoid too many conditionals
target_link_libraries (slsSupportObject PUBLIC $<$<PLATFORM_ID:Linux>:rt>)
#Treat both vendored and system zmq as interface for receiver binaries
if(SLS_USE_SYSTEM_ZMQ)
message(STATUS "slsSupportLib using ZEROMQ_TARGET=${ZEROMQ_TARGET}")

View File

@@ -6,6 +6,7 @@
#include <algorithm>
#include <memory>
#include <numeric>
#include <set>
#include <sstream>
#include <string>
#include <type_traits>
@@ -155,6 +156,10 @@ template <typename Container> bool hasDuplicates(Container c) {
return pos != c.end(); // if we found something there are duplicates
}
/**
* @brief Sorts the container and removes duplicated elements
* returns true if elements were removed otherwiese false
*/
template <typename T>
typename std::enable_if<is_container<T>::value, bool>::type
removeDuplicates(T &c) {
@@ -167,6 +172,29 @@ removeDuplicates(T &c) {
return false;
}
/**
* @brief Removed duplicated entries while preserving the oder
* returns true if elements were removed otherwiese false
*/
template <typename T>
typename std::enable_if<is_container<T>::value, bool>::type
stableRemoveDuplicates(T &c) {
auto containerSize = c.size();
std::set<typename T::value_type> seen;
c.erase(
std::remove_if(c.begin(), c.end(),
[&](const typename T::value_type& val) {
return !seen.insert(val).second; // erase if already seen
}),
c.end()
);
if (c.size() != containerSize) {
return true;
}
return false;
}
} // namespace sls
#endif // CONTAINER_UTILS_H

View File

@@ -804,6 +804,8 @@ typedef struct {
}
sls_detector_module &operator=(const sls_detector_module &other) {
if(this == &other)
return *this;
delete[] dacs;
delete[] chanregs;
serialnumber = other.serialnumber;

View File

@@ -8,7 +8,7 @@
namespace sls {
TEST_CASE("Time 1s restart then time 2s", "[.timer]") {
TEST_CASE("Time 1s restart then time 2s", "[timer]") {
auto sleep_duration = std::chrono::seconds(1);
auto t = Timer();
std::this_thread::sleep_for(sleep_duration);
@@ -19,7 +19,7 @@ TEST_CASE("Time 1s restart then time 2s", "[.timer]") {
REQUIRE(t.elapsed_s() == Approx(2).epsilon(0.01));
}
TEST_CASE("Return ms", "[.timer]") {
TEST_CASE("Return ms", "[timer]") {
auto sleep_duration = std::chrono::milliseconds(1300);
auto t = Timer();
std::this_thread::sleep_for(sleep_duration);

View File

@@ -5,7 +5,7 @@
namespace sls {
TEST_CASE("check if version is semantic", "[.version]") {
TEST_CASE("check if version is semantic", "[version]") {
auto [version_string, has_semantic_version] =
GENERATE(std::make_tuple("developer 0x250512", false),

View File

@@ -153,13 +153,35 @@ TEST_CASE("check for duplicates in vector of pairs") {
REQUIRE(hasDuplicates(vec) == true);
}
TEST_CASE("remove duplicates from vector") {
TEST_CASE("sorts the vector and remove duplicates") {
std::vector<int> v{5, 6, 5, 3};
auto r = removeDuplicates(v);
CHECK(r == true); // did indeed remove elements
CHECK(v == std::vector<int>{3, 5, 6});
}
TEST_CASE("remove duplicates but keep order") {
std::vector<int> v{5, 6, 5, 3};
auto r = stableRemoveDuplicates(v);
CHECK(r == true); // did indeed remove elements
CHECK(v == std::vector<int>{5, 6, 3});
}
TEST_CASE("remove duplicates but keep order, all elements the same ") {
std::vector<char> v{'c', 'c', 'c', 'c', 'c', 'c'};
auto r = stableRemoveDuplicates(v);
CHECK(r == true); // did indeed remove elements
CHECK(v == std::vector<char>{'c'});
}
TEST_CASE("remove duplicates but keep order, pattern ") {
std::vector<int> v{8,1,2,8,8,3,2};
auto r = stableRemoveDuplicates(v);
CHECK(r == true); // did indeed remove elements
CHECK(v == std::vector<int>{8,1,2,3});
}
TEST_CASE("remove duplicated empty vector") {
std::vector<int> v;
auto r = removeDuplicates(v);
@@ -167,4 +189,11 @@ TEST_CASE("remove duplicated empty vector") {
CHECK(v == std::vector<int>{});
}
TEST_CASE("remove duplicated empty vector using stable version") {
std::vector<int> v;
auto r = stableRemoveDuplicates(v);
CHECK(r == false); // no elements to remove
CHECK(v == std::vector<int>{});
}
} // namespace sls

View File

@@ -24,7 +24,6 @@ target_link_libraries(tests
PUBLIC
slsProjectOptions
slsSupportStatic
pthread
PRIVATE
slsProjectWarnings
)
@@ -61,5 +60,3 @@ catch_discover_tests(tests)
configure_file(scripts/test_simulators.py ${CMAKE_BINARY_DIR}/bin/test_simulators.py COPYONLY)
configure_file(scripts/test_frame_synchronizer.py ${CMAKE_BINARY_DIR}/bin/test_frame_synchronizer.py COPYONLY)
configure_file(scripts/utils_for_test.py ${CMAKE_BINARY_DIR}/bin/utils_for_test.py COPYONLY)
configure_file(scripts/test_roi.py ${CMAKE_BINARY_DIR}/bin/test_roi.py COPYONLY)
configure_file(scripts/test_free.py ${CMAKE_BINARY_DIR}/bin/test_free.py COPYONLY)

View File

@@ -14,17 +14,15 @@ from utils_for_test import (
Log,
LogLevel,
RuntimeException,
checkIfProcessRunning,
killProcess,
cleanup,
cleanSharedmemory,
startProcessInBackground,
startProcessInBackgroundWithLogFile,
checkLogForErrors,
startDetectorVirtualServer,
loadConfig,
loadBasicSettings,
ParseArguments
ParseArguments,
build_dir
)
LOG_PREFIX_FNAME = '/tmp/slsFrameSynchronizer_test'
@@ -42,7 +40,7 @@ def startFrameSynchronizerPullSocket(name, fp):
def startFrameSynchronizer(num_mods, fp):
cmd = ['slsFrameSynchronizer', str(DEFAULT_TCP_RX_PORTNO), str(num_mods)]
cmd = [str(build_dir / 'slsFrameSynchronizer'), str(DEFAULT_TCP_RX_PORTNO), str(num_mods)]
# in 10.0.0
#cmd = ['slsFrameSynchronizer', '-p', str(DEFAULT_TCP_RX_PORTNO), '-n', str(num_mods)]
startProcessInBackground(cmd, fp)
@@ -113,7 +111,7 @@ def startTestsForAll(args, fp):
startDetectorVirtualServer(server, args.num_mods, fp)
startFrameSynchronizerPullSocket(server, fp)
startFrameSynchronizer(args.num_mods, fp)
d = loadConfig(name=server, rx_hostname=args.rx_hostname, settingsdir=args.settingspath, fp=fp, num_mods=args.num_mods, num_frames=args.num_frames)
d = loadConfig(name=server, rx_hostname=args.rx_hostname, settingsdir=args.settingspath, log_file_fp=fp, num_mods=args.num_mods, num_frames=args.num_frames)
loadBasicSettings(name=server, d=d, fp=fp)
acquire(fp, d)
testFramesCaught(server, d, args.num_frames)

View File

@@ -1,119 +0,0 @@
# SPDX-License-Identifier: LGPL-3.0-or-other
# Copyright (C) 2021 Contributors to the SLS Detector Package
'''
This file is used to start up simulators, receivers and test roi for every detector in many configurations.
'''
import sys, time
import traceback
from slsdet import Detector, burstMode
from slsdet.defines import DEFAULT_TCP_RX_PORTNO, DEFAULT_UDP_DST_PORTNO
from datetime import timedelta
from utils_for_test import (
Log,
LogLevel,
RuntimeException,
cleanup,
startProcessInBackground,
startDetectorVirtualServer,
connectToVirtualServers,
loadBasicSettings,
runProcessWithLogFile
)
LOG_PREFIX_FNAME = '/tmp/slsDetectorPackage_virtual_roi_test'
MAIN_LOG_FNAME = LOG_PREFIX_FNAME + '_log.txt'
ROI_TEST_FNAME = LOG_PREFIX_FNAME + '_results_'
def startReceiver(num_mods, fp):
if num_mods == 1:
cmd = ['slsReceiver']
else:
cmd = ['slsMultiReceiver', str(DEFAULT_TCP_RX_PORTNO), str(num_mods)]
# in 10.0.0
#cmd = ['slsMultiReceiver', '-p', str(DEFAULT_TCP_RX_PORTNO), '-n', str(num_mods)]
startProcessInBackground(cmd, fp)
time.sleep(1)
def loadConfigForRoi(name, fp, num_mods = 1, num_interfaces = 1):
Log(LogLevel.INFO, 'Loading config')
Log(LogLevel.INFO, 'Loading config', fp)
try:
d = connectToVirtualServers(name, num_mods)
if name == 'jungfrau' or name == 'moench':
d.numinterfaces = num_interfaces
d.udp_dstport = DEFAULT_UDP_DST_PORTNO
if name == 'eiger' or name == 'jungfrau' or name == 'moench':
d.udp_dstport2 = DEFAULT_UDP_DST_PORTNO + 1
d.rx_hostname = 'localhost'
d.udp_dstip = 'auto'
if name != "eiger":
d.udp_srcip = 'auto'
if name == 'jungfrau' or name == 'moench':
d.udp_dstip2 = 'auto'
d.powerchip = 1
d.frames = 5
except Exception as e:
raise RuntimeException(f'Could not load config for {name}. Error: {str(e)}') from e
return d
def startTestsForAll(fp):
servers = [
'eiger',
'jungfrau',
'mythen3',
'gotthard2',
'moench',
]
nmods = 2
for server in servers:
for ninterfaces in range(1, 2):
if ninterfaces == 2 and server != 'jungfrau' and server != 'moench':
continue
try:
msg = f'Starting Roi Tests for {server}'
if server == 'jungfrau' or server == 'moench':
msg += f' with {ninterfaces} interfaces'
Log(LogLevel.INFOBLUE, msg)
Log(LogLevel.INFOBLUE, msg, fp)
cleanup(fp)
startDetectorVirtualServer(server, nmods, fp)
startReceiver(nmods, fp)
d = loadConfigForRoi(name=server, fp=fp, num_mods=nmods, num_interfaces=ninterfaces)
loadBasicSettings(name=server, d=d, fp=fp)
fname = ROI_TEST_FNAME + server + '.txt'
cmd = ['tests', 'rx_roi', '--abort', '-s']
runProcessWithLogFile('Roi Tests for ' + server, cmd, fp, fname)
Log(LogLevel.INFO, '\n')
except Exception as e:
raise RuntimeException(f'Roi Tests failed') from e
Log(LogLevel.INFOGREEN, 'Passed all Roi tests for all detectors \n' + str(servers))
if __name__ == '__main__':
Log(LogLevel.INFOBLUE, '\nLog File: ' + MAIN_LOG_FNAME + '\n')
with open(MAIN_LOG_FNAME, 'w') as fp:
try:
startTestsForAll(fp)
#TODO: check master file as well for both json and hdf5 as well
cleanup(fp)
except Exception as e:
with open(MAIN_LOG_FNAME, 'a') as fp_error:
traceback.print_exc(file=fp_error)
cleanup(fp)
Log(LogLevel.ERROR, f'Tests Failed.')

View File

@@ -2,91 +2,121 @@
# Copyright (C) 2021 Contributors to the SLS Detector Package
'''
This file is used to start up simulators, receivers and run all the tests on them and finally kill the simulators and receivers.
It can be used to run all catch tests with tag [.detectorintegration].
Pass --tests <testname> to run specific tests only or --tesst <testtag> to run all tests with that specific tag.
Pass --servers <server1> <server2> ... to run tests only for specific detector servers.
'''
import argparse
import sys, subprocess, time, traceback
from contextlib import contextmanager
from slsdet import Detector
from slsdet.defines import DEFAULT_TCP_RX_PORTNO
from utils_for_test import (
Log,
LogLevel,
RuntimeException,
checkIfProcessRunning,
killProcess,
cleanup,
cleanSharedmemory,
startProcessInBackground,
runProcess,
startReceiver,
runProcessWithLogFile,
runProcess,
startDetectorVirtualServer,
loadConfig,
loadBasicSettings,
ParseArguments
ParseArguments,
build_dir,
optional_file
)
LOG_PREFIX_FNAME = '/tmp/slsDetectorPackage_virtual_test'
MAIN_LOG_FNAME = LOG_PREFIX_FNAME + '_log.txt'
GENERAL_TESTS_LOG_FNAME = LOG_PREFIX_FNAME + '_results_general.txt'
CMD_TEST_LOG_PREFIX_FNAME = LOG_PREFIX_FNAME + '_results_cmd_'
def startReceiver(num_mods, fp):
if num_mods == 1:
cmd = ['slsReceiver']
else:
cmd = ['slsMultiReceiver', str(DEFAULT_TCP_RX_PORTNO), str(num_mods)]
# in 10.0.0
#cmd = ['slsMultiReceiver', '-p', str(DEFAULT_TCP_RX_PORTNO), '-n', str(num_mods)]
startProcessInBackground(cmd, fp)
time.sleep(1)
def startGeneralTests(fp):
fname = GENERAL_TESTS_LOG_FNAME
cmd = ['tests', '--abort', '-s']
cmd = [str(build_dir / 'tests'), '--abort', '-s']
try:
cleanup(fp)
runProcessWithLogFile('General Tests', cmd, fp, fname)
except Exception as e:
raise RuntimeException(f'General tests failed.') from e
def startTestsForAll(args, fp, advanced_test_settings=None):
fname_template = LOG_PREFIX_FNAME + "_{}_{}.txt"
test_filter = args.tests
if args.disable_xilinx_ctb:
test_filter += " ~[disable_xilinx_ctb]"
if args.disable_jungfrau:
test_filter += " ~[disable_jungfrau]"
if args.disable_ctb:
test_filter += " ~[disable_ctb]"
if args.disable_moench:
test_filter += " ~[disable_moench]"
if args.disable_mythen3:
test_filter += " ~[disable_mythen3]"
if args.disable_gotthard2:
test_filter += " ~[disable_gotthard2]"
if args.disable_eiger:
test_filter += " ~[disable_eiger]"
cmd = [str(build_dir / 'tests'), '--abort', test_filter, '-s']
num_mods = args.num_mods
def startCmdTestsForAll(args, fp):
for server in args.servers:
try:
num_mods = 2 if server == 'eiger' else 1
fname = CMD_TEST_LOG_PREFIX_FNAME + server + '.txt'
cmd = ['tests', '--abort', args.markers, '-s']
for ninterfaces in [1,2]: # always test both
if ninterfaces == 2 and server != 'jungfrau' and server != 'moench':
continue
Log(LogLevel.INFOBLUE, f'Starting Cmd Tests for {server}')
cleanup(fp)
startDetectorVirtualServer(name=server, num_mods=num_mods, fp=fp)
startReceiver(num_mods, fp)
d = loadConfig(name=server, rx_hostname=args.rx_hostname, settingsdir=args.settingspath, fp=fp, num_mods=num_mods)
loadBasicSettings(name=server, d=d, fp=fp)
runProcessWithLogFile('Cmd Tests (' + args.markers + ') for ' + server, cmd, fp, fname)
except Exception as e:
raise RuntimeException(f'Cmd Tests failed for {server}.') from e
if server == "eiger":
num_mods = 2*args.num_mods # top and bottom half module
try:
fname = fname_template.format(args.tests, server) if not args.no_log_file else None
Log(LogLevel.INFOBLUE, f'Starting {args.tests} Tests for {server}')
cleanup(fp)
print("no log file: ", args.no_log_file)
startDetectorVirtualServer(name=server, num_mods=num_mods, fp=fp, no_log_file=args.no_log_file)
startReceiver(args.num_mods, fp)
d = loadConfig(name=server, rx_hostname=args.rx_hostname, settingsdir=args.settingspath, log_file_fp=fp, num_mods=args.num_mods, num_interfaces=ninterfaces)
loadBasicSettings(name=server, d=d, fp=fp)
if advanced_test_settings is not None:
advanced_test_settings(name=server, detector=d, log_file_fp=fp) # special settings for specific tests
if args.no_log_file:
runProcess('Tests (' + args.tests + ') for ' + server, cmd, fp)
else:
runProcessWithLogFile('Tests (' + args.tests + ') for ' + server, cmd, fp, fname)
except Exception as e:
raise RuntimeException(f'Tests (' + args.tests + ') failed for ' + server + '.') from e
Log(LogLevel.INFOGREEN, 'Passed all tests for all detectors \n' + str(args.servers))
if __name__ == '__main__':
args = ParseArguments(description='Automated tests with the virtual detector servers', default_num_mods=1, markers=True, general_tests_option=True)
if args.num_mods > 1:
args = ParseArguments(description='Automated tests with the virtual detector servers', default_num_mods=2, specific_tests=True, general_tests_option=True)
if args.num_mods > 2:
raise RuntimeException(f'Cannot support multiple modules at the moment (except Eiger).')
Log(LogLevel.INFOBLUE, '\nLog File: ' + MAIN_LOG_FNAME + '\n')
with open(MAIN_LOG_FNAME, 'w') as fp:
with optional_file(MAIN_LOG_FNAME if not args.no_log_file else None, 'w') as fp:
try:
if args.general_tests:
startGeneralTests(fp)
startCmdTestsForAll(args, fp)
startTestsForAll(args, fp)
cleanup(fp)
except Exception as e:
with open(MAIN_LOG_FNAME, 'a') as fp_error:
traceback.print_exc(file=fp_error)
traceback.print_exc(file=fp)
cleanup(fp)
Log(LogLevel.ERROR, f'Tests Failed.')
raise e

View File

@@ -9,6 +9,7 @@ import sys, subprocess, time, argparse
from enum import Enum
from colorama import Fore, Style, init
from datetime import timedelta
from contextlib import contextmanager
from slsdet import Detector, Ctb, detectorSettings, burstMode
from slsdet.defines import DEFAULT_TCP_RX_PORTNO, DEFAULT_UDP_DST_PORTNO
@@ -16,6 +17,7 @@ SERVER_START_PORTNO=1900
init(autoreset=True)
build_dir = Path(__file__).resolve().parents[2] / "build" / "bin"
class LogLevel(Enum):
INFO = 0
@@ -57,9 +59,20 @@ class RuntimeException (Exception):
super().__init__(message)
@contextmanager
def optional_file(file_path=None, mode='w'):
if file_path:
f = open(file_path, mode)
try:
yield f
finally:
f.close()
else:
yield sys.stdout
def checkIfProcessRunning(processName):
cmd = f"pgrep -f {processName}"
res = subprocess.getoutput(cmd)
res = subprocess.getoutput(f"pgrep -f {processName}")
return res.strip().splitlines()
@@ -73,7 +86,8 @@ def killProcess(name, fp):
if p.returncode != 0 and bool(checkIfProcessRunning(name)):
raise RuntimeException(f"Could not kill {name} with pid {pid}")
except Exception as e:
raise RuntimeException(f"Failed to kill process {name} pid:{pid}. Error: {str(e)}") from e
Log(LogLevel.ERROR, f"Failed to kill process {name} pid:{pid}. Error: {str(e)}", fp)
#raise RuntimeException(f"Failed to kill process {name} pid:{pid}. Error: {str(e)}") from e
#else:
# Log(LogLevel.INFO, 'process not running : ' + name)
@@ -81,9 +95,9 @@ def killProcess(name, fp):
def cleanSharedmemory(fp):
Log(LogLevel.INFO, 'Cleaning up shared memory', fp)
try:
p = subprocess.run(['sls_detector_get', 'free'], stdout=fp, stderr=fp)
except:
raise RuntimeException('Could not free shared memory')
p = subprocess.run([build_dir / 'sls_detector_get', 'free'], stdout=fp, stderr=fp)
except Exception as e:
raise RuntimeException(f'Could not free shared memory: {str(e)}')
def cleanup(fp):
@@ -107,10 +121,11 @@ def startProcessInBackground(cmd, fp):
def startProcessInBackgroundWithLogFile(cmd, fp, log_file_name: str):
Log(LogLevel.INFOBLUE, 'Starting up ' + ' '.join(cmd) + '. Log: ' + log_file_name)
Log(LogLevel.INFOBLUE, 'Starting up ' + ' '.join(cmd) + '. Log: ' + log_file_name, fp)
if log_file_name:
Log(LogLevel.INFOBLUE, 'Starting up ' + ' '.join(cmd) + '. Log: ' + log_file_name)
Log(LogLevel.INFOBLUE, 'Starting up ' + ' '.join(cmd) + '. Log: ' + log_file_name, fp)
try:
with open(log_file_name, 'w') as log_fp:
with optional_file(log_file_name, 'w') as log_fp:
subprocess.Popen(cmd, stdout=log_fp, stderr=log_fp, text=True)
except Exception as e:
raise RuntimeException(f'Failed to start {cmd}:{str(e)}') from e
@@ -133,19 +148,26 @@ def checkLogForErrors(fp, log_file_path: str):
def runProcessWithLogFile(name, cmd, fp, log_file_name):
Log(LogLevel.INFOBLUE, 'Running ' + name + '. Log: ' + log_file_name)
Log(LogLevel.INFOBLUE, 'Running ' + name + '. Log: ' + log_file_name, fp)
info_text = 'Running ' + name + '.'
if log_file_name:
info_text += ' Log: ' + log_file_name
Log(LogLevel.INFOBLUE, info_text)
Log(LogLevel.INFOBLUE, info_text, fp)
Log(LogLevel.INFOBLUE, 'Cmd: ' + ' '.join(cmd), fp)
try:
with open(log_file_name, 'w') as log_fp:
with optional_file(log_file_name, 'w') as log_fp:
subprocess.run(cmd, stdout=log_fp, stderr=log_fp, check=True, text=True)
except subprocess.CalledProcessError as e:
print("error: ", str(e))
pass
except Exception as e:
print("something else failed")
Log(LogLevel.ERROR, f'Failed to run {name}:{str(e)}', fp)
raise RuntimeException(f'Failed to run {name}:{str(e)}')
with open (log_file_name, 'r') as f:
with optional_file(log_file_name, 'r') as f:
for line in f:
if "FAILED" in line:
raise RuntimeException(f'{line}')
@@ -153,12 +175,47 @@ def runProcessWithLogFile(name, cmd, fp, log_file_name):
Log(LogLevel.INFOGREEN, name + ' successful!\n')
Log(LogLevel.INFOGREEN, name + ' successful!\n', fp)
def runProcess(name, cmd, fp):
Log(LogLevel.INFOBLUE, 'Running ' + name + '.')
Log(LogLevel.INFOBLUE, 'Running ' + name + '.', fp)
Log(LogLevel.INFOBLUE, 'Cmd: ' + ' '.join(cmd), fp)
try:
subprocess.run(cmd, check=True, text=True, capture_output=True)
except subprocess.CalledProcessError as e:
lines = e.stdout.splitlines()
failure_messages = []
failure_block = False;
failure_message = []
for line in lines:
if "FAILED" in line:
failure_message.append(line)
failure_block = True
elif failure_block and "PASSED" in line:
failure_block = False
failure_messages.append(failure_message)
failure_message = []
elif failure_block:
failure_message.append(line)
def startDetectorVirtualServer(name :str, num_mods, fp):
Log(LogLevel.ERROR, f"Test failed:\n" + "\n".join(failure_message), fp)
raise
except Exception as e:
Log(LogLevel.ERROR, f'Failed to run {name}:{str(e)}', fp)
raise RuntimeException(f'Failed to run {name}:{str(e)}')
Log(LogLevel.INFOGREEN, name + ' successful!\n')
Log(LogLevel.INFOGREEN, name + ' successful!\n', fp)
def startDetectorVirtualServer(name :str, num_mods, fp, no_log_file = False):
for i in range(num_mods):
port_no = SERVER_START_PORTNO + (i * 2)
cmd = [name + 'DetectorServer_virtual', '-p', str(port_no)]
startProcessInBackgroundWithLogFile(cmd, fp, "/tmp/virtual_det_" + name + "_" + str(i) + ".txt")
cmd = [str(build_dir / (name + 'DetectorServer_virtual')), '-p', str(port_no)]
if no_log_file:
startProcessInBackgroundWithLogFile(cmd, fp, None)
else:
startProcessInBackgroundWithLogFile(cmd, fp, "/tmp/virtual_det_" + name + "_" + str(i) + ".txt")
match name:
case 'jungfrau':
time.sleep(7)
@@ -193,14 +250,27 @@ def connectToVirtualServers(name, num_mods, ctb_object=False):
return d
def startReceiver(num_mods, fp):
if num_mods == 1:
cmd = [str(build_dir / 'slsReceiver')]
else:
cmd = [str(build_dir / 'slsMultiReceiver'), str(DEFAULT_TCP_RX_PORTNO), str(num_mods)]
# in 10.0.0
#cmd = ['slsMultiReceiver', '-p', str(DEFAULT_TCP_RX_PORTNO), '-n', str(num_mods)]
startProcessInBackground(cmd, fp)
time.sleep(1)
def loadConfig(name, rx_hostname, settingsdir, fp, num_mods = 1, num_frames = 1):
def loadConfig(name, rx_hostname = 'localhost', settingsdir = None, log_file_fp = None, num_mods = 1, num_frames = 1, num_interfaces = 1):
Log(LogLevel.INFO, 'Loading config')
Log(LogLevel.INFO, 'Loading config', fp)
Log(LogLevel.INFO, 'Loading config', log_file_fp)
try:
d = connectToVirtualServers(name, num_mods)
if name == 'jungfrau' or name == 'moench':
d.numinterfaces = num_interfaces
d.udp_dstport = DEFAULT_UDP_DST_PORTNO
if name == 'eiger':
if name == 'eiger' or num_interfaces == 2:
d.udp_dstport2 = DEFAULT_UDP_DST_PORTNO + 1
d.rx_hostname = rx_hostname
@@ -208,16 +278,20 @@ def loadConfig(name, rx_hostname, settingsdir, fp, num_mods = 1, num_frames = 1)
if name != "eiger":
d.udp_srcip = 'auto'
if num_interfaces == 2:
d.udp_dstip2 = 'auto'
if name == "jungfrau" or name == "moench" or name == "xilinx_ctb":
d.powerchip = 1
if name == "xilinx_ctb":
d.configureTransceiver()
if name == "eiger":
d.trimen = [4500, 5400, 6400]
d.settingspath = settingsdir + '/eiger/'
d.setThresholdEnergy(4500, detectorSettings.STANDARD)
if settingsdir is not None and name in ['eiger', 'mythen3']:
d.settingspath = settingsdir + '/' + name + '/'
d.trimen = [4500, 5400, 6400] if name == 'eiger' else [4000, 6000, 8000, 12000]
d.setThresholdEnergy(4500, detectorSettings.STANDARD)
d.frames = num_frames
@@ -226,6 +300,8 @@ def loadConfig(name, rx_hostname, settingsdir, fp, num_mods = 1, num_frames = 1)
return d
# for easy acquire
def loadBasicSettings(name, d, fp):
Log(LogLevel.INFO, 'Loading basic settings for ' + name)
@@ -256,7 +332,7 @@ def loadBasicSettings(name, d, fp):
except Exception as e:
raise RuntimeException(f'Could not load config for {name}. Error: {str(e)}') from e
def ParseArguments(description, default_num_mods=1, markers=False, general_tests_option=False):
def ParseArguments(description, default_num_mods=2, specific_tests=False, general_tests_option=False):
parser = argparse.ArgumentParser(description)
default_settings_path = Path(__file__).resolve().parents[2] / "settingsdir"
@@ -271,16 +347,29 @@ def ParseArguments(description, default_num_mods=1, markers=False, general_tests
help='Number of frames to test with')
parser.add_argument('-s', '--servers', nargs='*',
help='Detector servers to run')
if markers:
parser.add_argument('-m', '--markers', nargs='?', default ='[.cmdcall]',
help = 'Markers to use for cmd tests, default: [.cmdcall]')
parser.add_argument('-nlf', '--no-log-file', action='store_true',
help='Dont write output to log file')
parser.add_argument("-d_xilinx_ctb", "--disable_xilinx_ctb", action="store_true", help="Disable all tests with hidden tag [.disable_xilinx_ctb]")
parser.add_argument("-d_jungfrau", "--disable_jungfrau", action="store_true", help="Disable all tests with hidden tag [.disable_jungfrau]")
parser.add_argument("-d_eiger", "--disable_eiger", action="store_true", help="Disable all tests with hidden tag [.disable_eiger]")
parser.add_argument("-d_moench", "--disable_moench", action="store_true", help="Disable all tests with hidden tag [.disable_moench]")
parser.add_argument("-d_gotthard2", "--disable_gotthard2", action="store_true", help="Disable all tests with hidden tag [.disable_gotthard2]")
parser.add_argument("-d_mythen3", "--disable_mythen3", action="store_true", help="Disable all tests with hidden tag [.disable_mythen3]")
parser.add_argument("-d_ctb", "--disable_ctb", action="store_true", help="Disable all tests with hidden tag [.disable_ctb]")
if specific_tests:
parser.add_argument('-t', '--tests', nargs='?', default ='[.detectorintegration]',
help = 'Test markers or specific test name to use for tests, default: [.detectorintegration]')
if general_tests_option:
parser.add_argument('-g', '--general_tests', action='store_true',
help = 'Enable general tests (no value needed)')
args = parser.parse_args()
# Set default server list if not provided
if args.servers is None:
args.servers = [
@@ -301,8 +390,8 @@ def ParseArguments(description, default_num_mods=1, markers=False, general_tests
f"num_mods: '{args.num_mods}'\n"
f"num_frames: '{args.num_frames}'"
)
if markers:
msg += f"\nmarkers: '{args.markers}'"
if specific_tests:
msg += f"\ntests: '{args.tests}'"
if general_tests_option:
msg += f"\ngeneral_tests: '{args.general_tests}'"

View File

@@ -1,39 +1,14 @@
# SPDX-License-Identifier: LGPL-3.0-or-other
# Copyright (C) 2021 Contributors to the SLS Detector Package
#echo $#
#if [ $# = 0 ]; then
# f=$0
#else
# f=$1
#fi
#echo $f
if [ "x${BASH_ARGV[0]}" = "x" ]; then
#if [ "x$f" = "x" ]; then
if [ ! -f this_build_bin_path.sh ]; then
f=$0
echo "aaaa"
#thispath=$(dirname ${BASH_ARGV[0]})
thispath=$(dirname $f)
p=$(cd ${thispath};pwd);
THIS_PATH="$p/build/bin/"
# echo "ERROR: must cd where/this/package/is before calling this_path.sh"
# echo "Try sourcing it"
else
echo "bbb"
THIS_PATH="$PWD/build/bin/";
fi
else
thispath=$(dirname ${BASH_ARGV[0]})
p=$(cd ${thispath};pwd);
THIS_PATH="$p/build/bin/"
echo "ccc"
fi
#!/bin/bash
echo "this_path="$THIS_PATH
export PATH=$THIS_PATH:$PATH
export LD_LIBRARY_PATH=$THIS_PATH:$LD_LIBRARY_PATH
export PYTHONPATH=$THIS_PATH:$PYTHONPATH
echo "path="$PATH
echo "ld_library_path="$LD_LIBRARY_PATH
echo "pythonpath="$PYTHON_PATH
# Since this script could be sourced, $0 is not sufficent, BASH_SOURCE[0] is necessary
SCRIPT_LOCATION="$(realpath ${BASH_SOURCE[0]})"
SCRIPT_LOCATION="$(dirname ${SCRIPT_LOCATION})"
BUILDBIN_LOCATION="${SCRIPT_LOCATION}/build/bin"
if [ ! -d "${BUILDBIN_LOCATION}" ]; then
echo Cannot find path ${BUILDBIN_LOCATION}
else
echo Adding ${BUILDBIN_LOCATION} to PATH and PYTHONPATH
export PATH=${BUILDBIN_LOCATION}:${PATH}
export PYTHONPATH=${BUILDBIN_LOCATION}:${PYTHONPATH}
fi