mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2026-02-07 12:38:41 +01:00
Dev/add simulator tests in GitHub workflows (#1337)
All checks were successful
Build on RHEL9 / build (push) Successful in 3m50s
Build on RHEL8 / build (push) Successful in 4m46s
Run Simulator Tests on local RHEL9 / build (push) Successful in 14m37s
Build on local RHEL9 / build (push) Successful in 1m26s
Run Simulator Tests on local RHEL8 / build (push) Successful in 16m57s
Build on local RHEL8 / build (push) Successful in 3m33s
All checks were successful
Build on RHEL9 / build (push) Successful in 3m50s
Build on RHEL8 / build (push) Successful in 4m46s
Run Simulator Tests on local RHEL9 / build (push) Successful in 14m37s
Build on local RHEL9 / build (push) Successful in 1m26s
Run Simulator Tests on local RHEL8 / build (push) Successful in 16m57s
Build on local RHEL8 / build (push) Successful in 3m33s
* added simulator tests in github workflows * indentation error * typo * debug * Logging for debugging * added more debug lines * more debugging * debug * debug * debug * dont throw if process does not exist * debug * added absolute path to sls_detector commands * some refactoring in test scripts * added absolute path to all slsdet command * typo * ../tests/scripts/test_frame_synchronizer.py * raise exception upon failure for github workflows * removed hidden tags * some refactoring in test scripts * some refactoring * fixed CMakeLists * fixed unsuccesful merge * updated python tests using simulators * debug import error * debug module import * python -m runs module pytest as script - everything in path available * removed integartion tests * enable file write not to log files * run tests without log files * increased sleep time for udp packets * added logg level variable to cmake * added testing policies to documenattion * disabled check for num_frames for jungfrau & xilinx * set log level as cmake cached variable * disable tests for jungfrau and xilinx_ctb * check frames for HDF5 * updated Documentation of Testing * changed withdetectorsimulators to detectorintegration * replaced [.cmdcall] with [.detectorintegration] * check_file_size only disabled for jungfrau - disable for all roi tests * changed time to wait after receive to 5 ms * take into account half modules of eiger * num udp interfaces needs to be consistent across modules * suppressed warning enclosing if * config added 2 udp ports per default for moench and jungfrau * write detector output to console * allow jungfrau to tests num frames, remove unused variable (numinterfaces), add comment for future to handle traceback to know which calling function threw the files unmatched, added documentation for tests (examples for .detectoritnegration and how to disable marked tests, removed addditional argumetns to disable for test_simulator as one can just use ~, removed the check that checks for jungfrau checking number of frames at master attributes and at rx test, removed unused advanced_test_settings in test_simulator script, the num_mods check for multiple modules is removed and default num modules set to 1 for test_simulator (to be increased later), back to raising exception for killprocess * removed integration tests from cmakelists.txt and cmk.sh, modified the tests workflow command to reflect the disable argument and removed xilinx_ctb from test (fix fromdeveloper merge to be done) * filtering by actual name for disable certain tests on github workflow * minor refactor * wip * wip * changes to run on local rh9 runner instead of github workfloa * modified yml to remove some leftover from github workflow * test * fix build_dir in scripts (github workflow) and pytest dir in gitea workflow * making the local machine use python3.13 binary * pythonpath added * changes for build_Dir back * allowing ctb api tests * allowed ctb api tests and set up slsdetname envt variable for shared memory being reserved just for these tests * added rh8 workflow for local runner on gitea * remnants from rh9 local runner * remnants from rh9 local runner * conda env for all shell for local runner * allowing hdf5 to build on local runner * run all tests for both the runners * refactored fixtures a bit and merged some tests that use one session for entire server * test fail * test fix * adding github workflow to test without data file checks and without logs * documentation changes * unnecessary import in conftest * allowing the session_simulator to test for multiple modules and interfaces etc * allow test_simulator script to run for 2 modules for all modules except ctb and xilinx ctb * run upon push * removing the disable file check on github workflow * minor adjustment * testing without synch * reverting to previous * with log file * without the space * summary from file and more error extracts from file to terminal * minor * trying nlf for more details * updated with no log file to print everything to screen also for det and rxr * trying a no throw * stoi was more about indent in yaml * tries * wip * debug * number of frames inconsistent fix=>just take first one, only test xilinx * jungfrau tests without frames caught check * extend the disable file check to everywhere that creates files * specify path for test_simulator * withoutprinting == * wip * back with printing===, but not parsing file for errors anymore * lang? * wip * safe log? * wip2 * wip * dont split error as its streaming live, just raise * with log files * lang? * last resort * wip * test no det with general tests * show tests live * also include hidden integration tests * without extra summary? * revert * last resort again * tsquash on int64_t? * tsquash on int64_t? mroe print * writing to /tmp? * all tests * might be the fix? * write to file * fixed a few quiet mode no log file tests * work on any branch for github tests, work on also release candidates for gitea tests * added frame synchronizer tests to github workflow * moved tests to run_tests.yaml from cmake.yaml * documentation * disabled general tests --------- Co-authored-by: Dhanya Thattil <dhanya.thattil@psi.ch>
This commit is contained in:
62
.gitea/workflows/rh8-local-tests.yml
Normal file
62
.gitea/workflows/rh8-local-tests.yml
Normal file
@@ -0,0 +1,62 @@
|
|||||||
|
name: Run Simulator Tests on local RHEL8
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- developer
|
||||||
|
- main
|
||||||
|
- 'dev/*'
|
||||||
|
- '*.*.*.rc'
|
||||||
|
|
||||||
|
env:
|
||||||
|
# Customize the CMake build type here (Release, Debug, RelWithDebInfo, etc.)
|
||||||
|
BUILD_TYPE: Debug
|
||||||
|
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
build:
|
||||||
|
runs-on: "detectors-software-RH8"
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
|
||||||
|
- name: Configure CMake
|
||||||
|
run: |
|
||||||
|
source /home/gitea_runner/.bashrc
|
||||||
|
conda activate det
|
||||||
|
cmake -B build \
|
||||||
|
-DCMAKE_BUILD_TYPE=Debug \
|
||||||
|
-DSLS_USE_TESTS=ON \
|
||||||
|
-DSLS_USE_SIMULATOR=ON \
|
||||||
|
-DSLS_USE_PYTHON=On \
|
||||||
|
-DSLS_USE_HDF5=ON
|
||||||
|
|
||||||
|
- name: Build
|
||||||
|
# Build your program with the given configuration
|
||||||
|
run: |
|
||||||
|
source /home/gitea_runner/.bashrc
|
||||||
|
conda activate det
|
||||||
|
cmake --build build -j4 --config Debug
|
||||||
|
|
||||||
|
- name: Python unit tests with simulators
|
||||||
|
run: |
|
||||||
|
source /home/gitea_runner/.bashrc
|
||||||
|
conda activate det
|
||||||
|
export PYTHONPATH=$PWD/build/bin:$PYTHONPATH
|
||||||
|
export SLSDETNAME=gitea_runner_tests
|
||||||
|
python -m pytest -m detectorintegration python/tests --detector-integration
|
||||||
|
python -m pytest python/tests
|
||||||
|
|
||||||
|
|
||||||
|
- name: Simulator unit tests
|
||||||
|
run: |
|
||||||
|
source /home/gitea_runner/.bashrc
|
||||||
|
conda activate det
|
||||||
|
cd build/bin
|
||||||
|
python test_simulators.py -g
|
||||||
|
|
||||||
|
- name: Run frame synchronizer tests
|
||||||
|
run: |
|
||||||
|
source /home/gitea_runner/.bashrc
|
||||||
|
conda activate det
|
||||||
|
cd build/bin
|
||||||
|
python test_frame_synchronizer.py
|
||||||
53
.gitea/workflows/rh9-local-tests.yml
Normal file
53
.gitea/workflows/rh9-local-tests.yml
Normal file
@@ -0,0 +1,53 @@
|
|||||||
|
name: Run Simulator Tests on local RHEL9
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- developer
|
||||||
|
- main
|
||||||
|
- 'dev/*'
|
||||||
|
- '*.*.*.rc'
|
||||||
|
|
||||||
|
env:
|
||||||
|
# Customize the CMake build type here (Release, Debug, RelWithDebInfo, etc.)
|
||||||
|
BUILD_TYPE: Debug
|
||||||
|
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
build:
|
||||||
|
runs-on: "detectors-software-RH9"
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
|
||||||
|
- name: Configure CMake
|
||||||
|
run: |
|
||||||
|
cmake -B build \
|
||||||
|
-DCMAKE_BUILD_TYPE=Debug \
|
||||||
|
-DSLS_USE_TESTS=ON \
|
||||||
|
-DSLS_USE_SIMULATOR=ON \
|
||||||
|
-DSLS_USE_PYTHON=On \
|
||||||
|
-DPython_EXECUTABLE=/usr/bin/python3.13 \
|
||||||
|
-DPython_INCLUDE_DIR=/usr/include/python3.13 \
|
||||||
|
-DPython_LIBRARY=/usr/lib64/libpython3.13.so \
|
||||||
|
-DSLS_USE_HDF5=ON
|
||||||
|
|
||||||
|
- name: Build
|
||||||
|
# Build your program with the given configuration
|
||||||
|
run: cmake --build build -j4 --config Debug
|
||||||
|
|
||||||
|
- name: Python unit tests with simulators
|
||||||
|
run: |
|
||||||
|
export PYTHONPATH=$PWD/build/bin:$PYTHONPATH
|
||||||
|
export SLSDETNAME=gitea_runner_tests
|
||||||
|
python3.13 -m pytest -m detectorintegration python/tests --detector-integration
|
||||||
|
python3.13 -m pytest python/tests
|
||||||
|
|
||||||
|
- name: Simulator unit tests
|
||||||
|
run: |
|
||||||
|
cd build/bin
|
||||||
|
python3.13 test_simulators.py -g
|
||||||
|
|
||||||
|
- name: Run frame synchronizer tests
|
||||||
|
run: |
|
||||||
|
cd build/bin
|
||||||
|
python3.13 test_frame_synchronizer.py
|
||||||
19
.github/workflows/cmake.yaml
vendored
19
.github/workflows/cmake.yaml
vendored
@@ -29,19 +29,20 @@ jobs:
|
|||||||
- name: Configure CMake
|
- 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.
|
# 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
|
# 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_HDF5=ON -DSLS_USE_GUI=ON -DSLS_USE_MOENCH=ON -DSLS_USE_PYTHON=ON
|
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 \
|
||||||
|
-DSLS_USE_GUI=ON \
|
||||||
|
-DSLS_USE_MOENCH=ON
|
||||||
|
|
||||||
- name: Build
|
- name: Build
|
||||||
# Build your program with the given configuration
|
# Build your program with the given configuration
|
||||||
run: cmake --build ${{github.workspace}}/build -j4 --config ${{env.BUILD_TYPE}}
|
run: cmake --build ${{github.workspace}}/build -j4 --config ${{env.BUILD_TYPE}}
|
||||||
|
|
||||||
- name: C++ unit tests
|
|
||||||
working-directory: ${{github.workspace}}/build
|
|
||||||
run: ctest -C ${{env.BUILD_TYPE}} -j1 --rerun-failed --output-on-failure
|
|
||||||
|
|
||||||
- name: Python unit tests
|
|
||||||
working-directory: ${{github.workspace}}/build/bin
|
|
||||||
run: |
|
|
||||||
python -m pytest ${{github.workspace}}/python/tests
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
57
.github/workflows/run_tests.yaml
vendored
Normal file
57
.github/workflows/run_tests.yaml
vendored
Normal file
@@ -0,0 +1,57 @@
|
|||||||
|
name: Run Simulator Tests
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
env:
|
||||||
|
# Customize the CMake build type here (Release, Debug, RelWithDebInfo, etc.)
|
||||||
|
BUILD_TYPE: Debug
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
build:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
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
|
||||||
|
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
|
||||||
|
|
||||||
|
- name: Build
|
||||||
|
# Build your program with the given configuration
|
||||||
|
run: cmake --build ${{github.workspace}}/build -j4 --config ${{env.BUILD_TYPE}}
|
||||||
|
|
||||||
|
- name: Simulator unit tests
|
||||||
|
working-directory: ${{github.workspace}}/build/bin
|
||||||
|
run: |
|
||||||
|
python test_simulators.py --no-log-file --quiet --tests "[detectorintegration]~[disable_check_data_file]"
|
||||||
|
#remove --quiet to see more prints from simulator, receiver and tests
|
||||||
|
python test_frame_synchronizer.py
|
||||||
|
|
||||||
|
|
||||||
|
- name: Python unit tests with simulators
|
||||||
|
working-directory: ${{github.workspace}}/build/bin
|
||||||
|
run: |
|
||||||
|
python -m pytest -m detectorintegration ${{github.workspace}}/python/tests --detector-integration
|
||||||
|
python -m pytest ${{github.workspace}}/python/tests
|
||||||
|
|
||||||
|
- name: C++ unit tests
|
||||||
|
working-directory: ${{github.workspace}}/build
|
||||||
|
run: ctest -C ${{env.BUILD_TYPE}} -j1 --rerun-failed --output-on-failure
|
||||||
@@ -40,8 +40,6 @@ include(FetchContent)
|
|||||||
option(SLS_FETCH_ZMQ_FROM_GITHUB "Fetch zmq from github" OFF)
|
option(SLS_FETCH_ZMQ_FROM_GITHUB "Fetch zmq from github" OFF)
|
||||||
option(SLS_FETCH_PYBIND11_FROM_GITHUB "Fetch pybind11 from github" OFF)
|
option(SLS_FETCH_PYBIND11_FROM_GITHUB "Fetch pybind11 from github" OFF)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# Allow FetchContent_Populate to be called with a single argument
|
# Allow FetchContent_Populate to be called with a single argument
|
||||||
# otherwise deprecated warning is issued
|
# otherwise deprecated warning is issued
|
||||||
# Note: From cmake 3.28 we can pass EXCLUDE_FROM_ALL to FetchContent_Declare
|
# Note: From cmake 3.28 we can pass EXCLUDE_FROM_ALL to FetchContent_Declare
|
||||||
@@ -200,7 +198,6 @@ option(SLS_USE_RECEIVER_BINARIES "Receiver binaries" ON)
|
|||||||
option(SLS_USE_GUI "GUI" OFF)
|
option(SLS_USE_GUI "GUI" OFF)
|
||||||
option(SLS_USE_SIMULATOR "Simulator" OFF)
|
option(SLS_USE_SIMULATOR "Simulator" OFF)
|
||||||
option(SLS_USE_TESTS "TESTS" OFF)
|
option(SLS_USE_TESTS "TESTS" OFF)
|
||||||
option(SLS_USE_INTEGRATION_TESTS "Integration Tests" OFF)
|
|
||||||
option(SLS_USE_SANITIZER "Sanitizers for debugging" OFF)
|
option(SLS_USE_SANITIZER "Sanitizers for debugging" OFF)
|
||||||
option(SLS_USE_PYTHON "Python bindings" OFF)
|
option(SLS_USE_PYTHON "Python bindings" OFF)
|
||||||
option(SLS_INSTALL_PYTHONEXT "Install the python extension in the install tree under CMAKE_INSTALL_PREFIX/python/" OFF)
|
option(SLS_INSTALL_PYTHONEXT "Install the python extension in the install tree under CMAKE_INSTALL_PREFIX/python/" OFF)
|
||||||
@@ -292,6 +289,11 @@ if(NOT TARGET slsProjectOptions)
|
|||||||
target_compile_features(slsProjectOptions INTERFACE cxx_std_17)
|
target_compile_features(slsProjectOptions INTERFACE cxx_std_17)
|
||||||
endif()
|
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)
|
if (NOT TARGET slsProjectWarnings)
|
||||||
add_library(slsProjectWarnings INTERFACE)
|
add_library(slsProjectWarnings INTERFACE)
|
||||||
target_compile_options(slsProjectWarnings INTERFACE
|
target_compile_options(slsProjectWarnings INTERFACE
|
||||||
@@ -400,10 +402,6 @@ if (SLS_USE_SIMULATOR)
|
|||||||
add_subdirectory(slsDetectorServers)
|
add_subdirectory(slsDetectorServers)
|
||||||
endif (SLS_USE_SIMULATOR)
|
endif (SLS_USE_SIMULATOR)
|
||||||
|
|
||||||
if (SLS_USE_INTEGRATION_TESTS)
|
|
||||||
add_subdirectory(integrationTests)
|
|
||||||
endif (SLS_USE_INTEGRATION_TESTS)
|
|
||||||
|
|
||||||
if (SLS_USE_PYTHON)
|
if (SLS_USE_PYTHON)
|
||||||
find_package (Python 3.8 COMPONENTS Interpreter Development.Module REQUIRED)
|
find_package (Python 3.8 COMPONENTS Interpreter Development.Module REQUIRED)
|
||||||
set(PYBIND11_FINDPYTHON ON) # Needed for RH8
|
set(PYBIND11_FINDPYTHON ON) # Needed for RH8
|
||||||
|
|||||||
2
cmk.sh
2
cmk.sh
@@ -250,7 +250,7 @@ fi
|
|||||||
|
|
||||||
#Tests
|
#Tests
|
||||||
if [ $TESTS -eq 1 ]; then
|
if [ $TESTS -eq 1 ]; then
|
||||||
CMAKE_POST+=" -DSLS_USE_TESTS=ON -DSLS_USE_INTEGRATION_TESTS=ON"
|
CMAKE_POST+=" -DSLS_USE_TESTS=ON "
|
||||||
echo "Tests Option enabled"
|
echo "Tests Option enabled"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|||||||
166
docs/src/Testing.rst
Normal file
166
docs/src/Testing.rst
Normal file
@@ -0,0 +1,166 @@
|
|||||||
|
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);
|
||||||
|
}
|
||||||
|
|
||||||
|
You can run all tests requiring a detector by running the following command:
|
||||||
|
|
||||||
|
.. code-block:: console
|
||||||
|
|
||||||
|
tests "[.detectorintegration]"
|
||||||
|
|
||||||
|
|
||||||
|
.. note ::
|
||||||
|
|
||||||
|
This only works if a configured simulator (or an actual configured detector) and receiver are already set up to run the tests. There is a script that automatically sets up virtual detectors and runs all integration tests. See Section :ref:`Simulator Script. <python simulator script>` below.
|
||||||
|
|
||||||
|
|
||||||
|
If you want to disable testing that involves a data file that require pc tuning optimizations, add the hidden tag ``[.disable_check_data_file]`` to the test case. Please note that only some specific disable tests have been implemented so far.
|
||||||
|
|
||||||
|
.. code-block:: console
|
||||||
|
|
||||||
|
tests "[detectorintegration]~[disable_check_data_file]"
|
||||||
|
|
||||||
|
.. note ::
|
||||||
|
|
||||||
|
Ensure that there are no spaces betweent the tags and no '.', else hardly any test will be matched.
|
||||||
|
|
||||||
|
.. _python simulator script:
|
||||||
|
|
||||||
|
Simulator Script:
|
||||||
|
-----------------
|
||||||
|
|
||||||
|
One can also just run the following script, which will run your tests for all the detector types (simulators only) with a pre-determined configuration.
|
||||||
|
|
||||||
|
.. 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 jungfrau --test "[.rx]"
|
||||||
|
|
||||||
|
You can exclude specific tests by adding the option ``~[<disable_test_name>]``. Again, we assume that this marker is added to the tests that you want to exclude.
|
||||||
|
|
||||||
|
.. code-block:: console
|
||||||
|
cd build
|
||||||
|
python bin/test_simulators.py --servers eiger jungfrau moench --test "[detectorintegration]~[disable_check_data_file]"
|
||||||
|
|
||||||
|
You can additionally run all the tests not requiring detectors using the script ``bin/test_simulators.py`` by passing the option ``--general-tests``.
|
||||||
|
|
||||||
|
One can use ``--no-log-file`` if you dont want to create a log files and instead print to console. If you prefer to not print to console either, add ``--quiet``.
|
||||||
|
|
||||||
|
|
||||||
|
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. The set up is done for every test automatically.
|
||||||
|
|
||||||
|
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
|
||||||
|
|
||||||
|
|
||||||
|
There is another helper test fixture in ``slsDetectorSoftware/python/tests/conftest.py`` called ``session_simulator`` that sets up virtual detectors and yields the test for all detectors. The difference with the previous fixture ``test_with_simulators`` is that this fixture will set up one detector at a time and run all the tests using this fixture before cleaning up and moving on to the next detector. It saves time if the setup and cleanup is expensive.
|
||||||
|
|
||||||
|
Example usage:
|
||||||
|
|
||||||
|
.. code-block:: python
|
||||||
|
|
||||||
|
import pytest
|
||||||
|
|
||||||
|
@pytest.mark.detectorintegration
|
||||||
|
def test_define_reg(session_simulator, request):
|
||||||
|
""" Test setting define_reg for ctb and xilinx_ctb."""
|
||||||
|
det_type, num_interfaces, num_mods, d = session_simulator
|
||||||
|
assert d is not None
|
||||||
|
|
||||||
|
from slsdet import RegisterAddress
|
||||||
|
|
||||||
|
if det_type in ['ctb', 'xilinx_ctb']:
|
||||||
|
# your test code here
|
||||||
|
|
||||||
|
For more specific parameters, you can parametrize the fixture like below:
|
||||||
|
|
||||||
|
.. code-block:: python
|
||||||
|
|
||||||
|
import pytest
|
||||||
|
|
||||||
|
@pytest.mark.detectorintegration
|
||||||
|
@pytest.mark.parametrize(
|
||||||
|
"session_simulator",
|
||||||
|
[
|
||||||
|
("ctb", 1, 1),
|
||||||
|
("xilinx_ctb", 1, 1),
|
||||||
|
],
|
||||||
|
indirect=True,
|
||||||
|
)
|
||||||
|
def test_define_reg(session_simulator):
|
||||||
|
det_type, num_interfaces, num_mods, d = session_simulator
|
||||||
|
# your test code here
|
||||||
@@ -66,6 +66,7 @@ slsDetectorPackage
|
|||||||
container_utils
|
container_utils
|
||||||
type_traits
|
type_traits
|
||||||
ToString
|
ToString
|
||||||
|
Testing
|
||||||
|
|
||||||
.. toctree::
|
.. toctree::
|
||||||
:caption: Firmware
|
:caption: Firmware
|
||||||
|
|||||||
@@ -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()
|
|
||||||
|
|
||||||
@@ -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
|
|
||||||
@@ -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
|
|
||||||
@@ -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
|
|
||||||
@@ -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"
|
|
||||||
@@ -10,8 +10,6 @@ scripts_dir = current_dir / "tests" / "scripts"
|
|||||||
|
|
||||||
sys.path.append(str(scripts_dir))
|
sys.path.append(str(scripts_dir))
|
||||||
|
|
||||||
print(sys.path)
|
|
||||||
|
|
||||||
from utils_for_test import (
|
from utils_for_test import (
|
||||||
Log,
|
Log,
|
||||||
LogLevel,
|
LogLevel,
|
||||||
@@ -20,44 +18,133 @@ from utils_for_test import (
|
|||||||
startDetectorVirtualServer,
|
startDetectorVirtualServer,
|
||||||
loadConfig,
|
loadConfig,
|
||||||
loadBasicSettings,
|
loadBasicSettings,
|
||||||
|
connectToVirtualServers,
|
||||||
|
DEFAULT_UDP_DST_PORTNO,
|
||||||
)
|
)
|
||||||
|
|
||||||
def pytest_addoption(parser):
|
def pytest_addoption(parser):
|
||||||
parser.addoption(
|
parser.addoption(
|
||||||
"--with-detector-simulators", action="store_true", default=False, help="Run tests that require detector simulators"
|
"--detector-integration", action="store_true", default=False, help="Run tests that require detectors"
|
||||||
)
|
)
|
||||||
|
|
||||||
def pytest_configure(config):
|
def pytest_configure(config):
|
||||||
config.addinivalue_line("markers", "withdetectorsimulators: mark test as needing detector simulators to run")
|
config.addinivalue_line("markers", "detectorintegration: mark test as needing detectors to run")
|
||||||
|
|
||||||
def pytest_collection_modifyitems(config, items):
|
def pytest_collection_modifyitems(config, items):
|
||||||
if config.getoption("--with-detector-simulators"):
|
if config.getoption("--detector-integration"):
|
||||||
return
|
return
|
||||||
skip = pytest.mark.skip(reason="need --with-detector-simulators option to run")
|
skip = pytest.mark.skip(reason="need --detector-integration option to run")
|
||||||
for item in items:
|
for item in items:
|
||||||
if "withdetectorsimulators" in item.keywords:
|
if "detectorintegration" in item.keywords:
|
||||||
item.add_marker(skip)
|
item.add_marker(skip)
|
||||||
|
|
||||||
|
|
||||||
|
DEFAULT_SIMULATOR_CONFIGS = [
|
||||||
|
("eiger", 1, 1),
|
||||||
|
("eiger", 1, 2),
|
||||||
|
("jungfrau", 1, 1),
|
||||||
|
("jungfrau", 1, 2),
|
||||||
|
("jungfrau", 2, 1),
|
||||||
|
("jungfrau", 2, 2),
|
||||||
|
("mythen3", 1, 1),
|
||||||
|
("mythen3", 1, 2),
|
||||||
|
("gotthard2", 1, 1),
|
||||||
|
("gotthard2", 1, 2),
|
||||||
|
("moench", 1, 1),
|
||||||
|
("moench", 1, 2),
|
||||||
|
("ctb", 1, 1),
|
||||||
|
("xilinx_ctb", 1, 1),
|
||||||
|
]
|
||||||
|
|
||||||
|
SIMULATOR_IDS = [f"{det_type}_{num_interface}if_{num_mod}mod" for det_type, num_interface, num_mod in DEFAULT_SIMULATOR_CONFIGS]
|
||||||
|
|
||||||
|
@pytest.fixture(scope="session")
|
||||||
|
def session_simulator(request):
|
||||||
|
"""
|
||||||
|
Fixture to start the detector server once and clean up at the end.
|
||||||
|
Expects request.param = (det_type, num_interfaces, num_mods)
|
||||||
|
"""
|
||||||
|
det_type, num_interfaces, num_mods = request.param
|
||||||
|
fp = sys.stdout
|
||||||
|
|
||||||
|
# set up: once per server
|
||||||
|
Log(LogLevel.INFOBLUE,
|
||||||
|
f'---- {det_type} | interfaces={num_interfaces} | modules={num_mods} ----', fp)
|
||||||
|
|
||||||
|
cleanup(fp)
|
||||||
|
startDetectorVirtualServer(det_type, num_mods, fp, True)
|
||||||
|
startReceiver(num_mods, fp, True)
|
||||||
|
|
||||||
|
Log(LogLevel.INFOBLUE, f'Waiting for server to start up and connect', fp)
|
||||||
|
d = loadConfig(
|
||||||
|
name=det_type,
|
||||||
|
log_file_fp=fp,
|
||||||
|
num_mods=num_mods,
|
||||||
|
num_frames=1,
|
||||||
|
num_interfaces=num_interfaces,
|
||||||
|
)
|
||||||
|
|
||||||
|
loadBasicSettings(name=det_type, d=d, fp=fp)
|
||||||
|
|
||||||
|
yield det_type, num_interfaces, num_mods, d
|
||||||
|
|
||||||
|
cleanup(fp)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
def pytest_generate_tests(metafunc):
|
||||||
|
if "session_simulator" not in metafunc.fixturenames:
|
||||||
|
return # nothing to do
|
||||||
|
|
||||||
|
# Check if session_simulator is already parametrized
|
||||||
|
markers = metafunc.definition.iter_markers(name="parametrize")
|
||||||
|
for m in markers:
|
||||||
|
if m.args and m.args[0] == "session_simulator":
|
||||||
|
return # already parametrized, skip defaults
|
||||||
|
|
||||||
|
# Apply default configs only for session_simulator
|
||||||
|
metafunc.parametrize(
|
||||||
|
"session_simulator",
|
||||||
|
DEFAULT_SIMULATOR_CONFIGS,
|
||||||
|
ids=SIMULATOR_IDS,
|
||||||
|
indirect=True
|
||||||
|
)
|
||||||
|
|
||||||
|
'''
|
||||||
|
for more specific parameters
|
||||||
|
@pytest.mark.detectorintegration
|
||||||
|
@pytest.mark.parametrize(
|
||||||
|
"session_simulator",
|
||||||
|
[
|
||||||
|
("ctb", 1, 1),
|
||||||
|
("xilinx_ctb", 1, 1),
|
||||||
|
],
|
||||||
|
indirect=True,
|
||||||
|
)
|
||||||
|
def test_define_reg(session_simulator):
|
||||||
|
det_type, num_interfaces, num_mods, d = session_simulator
|
||||||
|
'''
|
||||||
|
|
||||||
#helper fixture for servers
|
#helper fixture for servers
|
||||||
@pytest.fixture
|
@pytest.fixture(scope='module')
|
||||||
def servers(request):
|
def setup_parameters(request): # only setup once per module if same parameters used for the scopes
|
||||||
try:
|
try:
|
||||||
return request.param # comes from @pytest.mark.parametrize(..., indirect=True)
|
servers, nmods = request.param # comes from @pytest.mark.parametrize(..., indirect=True)
|
||||||
|
return servers, nmods
|
||||||
except AttributeError:
|
except AttributeError:
|
||||||
# fallback default if the test did not parametrize
|
# fallback default if the test did not parametrize
|
||||||
return ['eiger', 'jungfrau', 'mythen3', 'gotthard2', 'ctb', 'moench', 'xilinx_ctb']
|
return (['eiger', 'jungfrau', 'mythen3', 'gotthard2', 'ctb', 'moench', 'xilinx_ctb'], 2)
|
||||||
return request.param
|
|
||||||
|
|
||||||
@pytest.fixture
|
@pytest.fixture(scope='module')
|
||||||
def test_with_simulators(servers):
|
def test_with_simulators(setup_parameters):
|
||||||
""" Fixture to automatically setup virtual detector servers for testing. """
|
""" Fixture to automatically setup virtual detector servers for testing. """
|
||||||
|
|
||||||
LOG_PREFIX_FNAME = '/tmp/slsDetectorPackage_virtual_PythonAPI_test'
|
fp = sys.stdout
|
||||||
MAIN_LOG_FNAME = LOG_PREFIX_FNAME + '_log.txt'
|
|
||||||
|
|
||||||
with open(MAIN_LOG_FNAME, 'w') as fp:
|
servers, nmods = setup_parameters
|
||||||
|
print("servers:", servers)
|
||||||
|
print("nmods:", nmods)
|
||||||
try:
|
try:
|
||||||
nmods = 2
|
|
||||||
for server in servers:
|
for server in servers:
|
||||||
for ninterfaces in range(1,2):
|
for ninterfaces in range(1,2):
|
||||||
if ninterfaces == 2 and server != 'jungfrau' and server != 'moench':
|
if ninterfaces == 2 and server != 'jungfrau' and server != 'moench':
|
||||||
@@ -73,12 +160,11 @@ def test_with_simulators(servers):
|
|||||||
startDetectorVirtualServer(server, nmods, fp)
|
startDetectorVirtualServer(server, nmods, fp)
|
||||||
startReceiver(nmods, fp)
|
startReceiver(nmods, fp)
|
||||||
d = loadConfig(name=server, log_file_fp=fp, num_mods=nmods, num_frames=1, num_interfaces=ninterfaces)
|
d = loadConfig(name=server, log_file_fp=fp, num_mods=nmods, num_frames=1, num_interfaces=ninterfaces)
|
||||||
loadBasicSettings(name=server, d=d, fp=fp)
|
#loadBasicSettings(name=server, d=d, fp=fp)
|
||||||
yield # run test
|
yield # run test
|
||||||
cleanup(fp) # teardown
|
cleanup(fp) # teardown
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
with open(MAIN_LOG_FNAME, 'a') as fp_error:
|
traceback.print_exc(file=fp)
|
||||||
traceback.print_exc(file=fp_error)
|
|
||||||
Log(LogLevel.ERROR, f'Tests Failed.', fp)
|
Log(LogLevel.ERROR, f'Tests Failed.', fp)
|
||||||
cleanup(fp)
|
cleanup(fp)
|
||||||
|
|
||||||
|
|||||||
@@ -1,10 +1,3 @@
|
|||||||
'''
|
|
||||||
cd python/tests
|
|
||||||
Specific test: pytest -s -x test_CtbAPI.py::test_define_bit #-x=abort on first failure
|
|
||||||
Specific test with specific server: pytest -s -x test_CtbAPI.py::test_define_reg[ctb]
|
|
||||||
|
|
||||||
'''
|
|
||||||
|
|
||||||
import pytest, sys, traceback
|
import pytest, sys, traceback
|
||||||
|
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
@@ -16,48 +9,20 @@ print(sys.path)
|
|||||||
from utils_for_test import (
|
from utils_for_test import (
|
||||||
Log,
|
Log,
|
||||||
LogLevel,
|
LogLevel,
|
||||||
cleanup,
|
|
||||||
startDetectorVirtualServer,
|
|
||||||
connectToVirtualServers,
|
|
||||||
SERVER_START_PORTNO,
|
|
||||||
)
|
)
|
||||||
|
from slsdet import Detector
|
||||||
from slsdet import Detector, detectorType
|
|
||||||
|
|
||||||
|
|
||||||
@pytest.fixture(
|
|
||||||
scope="session",
|
|
||||||
params=['ctb', 'xilinx_ctb', 'mythen3', 'jungfrau']
|
|
||||||
)
|
|
||||||
def simulator(request):
|
|
||||||
"""Fixture to start the detector server once and clean up at the end."""
|
|
||||||
det_name = request.param
|
|
||||||
num_mods = 1
|
|
||||||
fp = sys.stdout
|
|
||||||
|
|
||||||
# set up: once per server
|
@pytest.mark.detectorintegration
|
||||||
Log(LogLevel.INFOBLUE, f'---- {det_name} ----')
|
def test_define_reg(session_simulator, request):
|
||||||
cleanup(fp)
|
|
||||||
startDetectorVirtualServer(det_name, num_mods, fp)
|
|
||||||
|
|
||||||
Log(LogLevel.INFOBLUE, f'Waiting for server to start up and connect')
|
|
||||||
connectToVirtualServers(det_name, num_mods)
|
|
||||||
|
|
||||||
yield det_name # tests run here
|
|
||||||
|
|
||||||
cleanup(fp)
|
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.withdetectorsimulators
|
|
||||||
def test_define_reg(simulator, request):
|
|
||||||
""" Test setting define_reg for ctb and xilinx_ctb."""
|
""" Test setting define_reg for ctb and xilinx_ctb."""
|
||||||
det_name = simulator
|
det_type, num_interfaces, num_mods, d = session_simulator
|
||||||
|
assert d is not None
|
||||||
|
|
||||||
from slsdet import RegisterAddress
|
from slsdet import RegisterAddress
|
||||||
|
|
||||||
d = Detector()
|
if det_type in ['ctb', 'xilinx_ctb']:
|
||||||
d.hostname = f"localhost:{SERVER_START_PORTNO}"
|
|
||||||
|
|
||||||
if det_name in ['ctb', 'xilinx_ctb']:
|
|
||||||
prev_reg_defs = d.getRegisterDefinitions()
|
prev_reg_defs = d.getRegisterDefinitions()
|
||||||
prev_bit_defs = d.getBitDefinitions()
|
prev_bit_defs = d.getBitDefinitions()
|
||||||
d.clearRegisterDefinitions()
|
d.clearRegisterDefinitions()
|
||||||
@@ -109,17 +74,15 @@ def test_define_reg(simulator, request):
|
|||||||
Log(LogLevel.INFOGREEN, f"✅ {request.node.name} passed")
|
Log(LogLevel.INFOGREEN, f"✅ {request.node.name} passed")
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.withdetectorsimulators
|
@pytest.mark.detectorintegration
|
||||||
def test_define_bit(simulator, request):
|
def test_define_bit(session_simulator, request):
|
||||||
""" Test setting define_bit for ctb and xilinx_ctb."""
|
""" Test setting define_bit for ctb and xilinx_ctb."""
|
||||||
det_name = simulator
|
det_type, num_interfaces, num_mods, d = session_simulator
|
||||||
|
assert d is not None
|
||||||
|
|
||||||
from slsdet import RegisterAddress, BitAddress
|
from slsdet import RegisterAddress, BitAddress
|
||||||
|
|
||||||
# setup
|
if det_type in ['ctb', 'xilinx_ctb']:
|
||||||
d = Detector()
|
|
||||||
d.hostname = f"localhost:{SERVER_START_PORTNO}"
|
|
||||||
|
|
||||||
if det_name in ['ctb', 'xilinx_ctb']:
|
|
||||||
prev_reg_defs = d.getRegisterDefinitions()
|
prev_reg_defs = d.getRegisterDefinitions()
|
||||||
prev_bit_defs = d.getBitDefinitions()
|
prev_bit_defs = d.getBitDefinitions()
|
||||||
d.clearRegisterDefinitions()
|
d.clearRegisterDefinitions()
|
||||||
@@ -201,17 +164,15 @@ def test_define_bit(simulator, request):
|
|||||||
Log(LogLevel.INFOGREEN, f"✅ {request.node.name} passed")
|
Log(LogLevel.INFOGREEN, f"✅ {request.node.name} passed")
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.withdetectorsimulators
|
@pytest.mark.detectorintegration
|
||||||
def test_using_defined_reg_and_bit(simulator, request):
|
def test_using_defined_reg_and_bit(session_simulator, request):
|
||||||
""" Test using defined reg and bit define_bit for ctb and xilinx_ctb."""
|
""" Test using defined reg and bit define_bit for ctb and xilinx_ctb."""
|
||||||
det_name = simulator
|
det_type, num_interfaces, num_mods, d = session_simulator
|
||||||
|
assert d is not None
|
||||||
|
|
||||||
from slsdet import RegisterAddress, BitAddress, RegisterValue
|
from slsdet import RegisterAddress, BitAddress, RegisterValue
|
||||||
|
|
||||||
# setup
|
if det_type in ['ctb', 'xilinx_ctb']:
|
||||||
d = Detector()
|
|
||||||
d.hostname = f"localhost:{SERVER_START_PORTNO}"
|
|
||||||
|
|
||||||
if det_name in ['ctb', 'xilinx_ctb']:
|
|
||||||
prev_reg_defs = d.getRegisterDefinitions()
|
prev_reg_defs = d.getRegisterDefinitions()
|
||||||
prev_bit_defs = d.getBitDefinitions()
|
prev_bit_defs = d.getBitDefinitions()
|
||||||
d.clearRegisterDefinitions()
|
d.clearRegisterDefinitions()
|
||||||
@@ -287,17 +248,15 @@ def test_using_defined_reg_and_bit(simulator, request):
|
|||||||
Log(LogLevel.INFOGREEN, f"✅ {request.node.name} passed")
|
Log(LogLevel.INFOGREEN, f"✅ {request.node.name} passed")
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.withdetectorsimulators
|
@pytest.mark.detectorintegration
|
||||||
def test_definelist_reg(simulator, request):
|
def test_definelist_reg(session_simulator, request):
|
||||||
""" Test using definelist_reg for ctb and xilinx_ctb."""
|
""" Test using definelist_reg for ctb and xilinx_ctb."""
|
||||||
det_name = simulator
|
det_type, num_interfaces, num_mods, d = session_simulator
|
||||||
|
assert d is not None
|
||||||
|
|
||||||
from slsdet import RegisterAddress, BitAddress, RegisterValue
|
from slsdet import RegisterAddress, BitAddress, RegisterValue
|
||||||
|
|
||||||
# setup
|
if det_type in ['ctb', 'xilinx_ctb']:
|
||||||
d = Detector()
|
|
||||||
d.hostname = f"localhost:{SERVER_START_PORTNO}"
|
|
||||||
|
|
||||||
if det_name in ['ctb', 'xilinx_ctb']:
|
|
||||||
prev_reg_defs = d.getRegisterDefinitions()
|
prev_reg_defs = d.getRegisterDefinitions()
|
||||||
prev_bit_defs = d.getBitDefinitions()
|
prev_bit_defs = d.getBitDefinitions()
|
||||||
d.clearRegisterDefinitions()
|
d.clearRegisterDefinitions()
|
||||||
@@ -332,17 +291,15 @@ def test_definelist_reg(simulator, request):
|
|||||||
Log(LogLevel.INFOGREEN, f"✅ {request.node.name} passed")
|
Log(LogLevel.INFOGREEN, f"✅ {request.node.name} passed")
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.withdetectorsimulators
|
@pytest.mark.detectorintegration
|
||||||
def test_definelist_bit(simulator, request):
|
def test_definelist_bit(session_simulator, request):
|
||||||
""" Test using definelist_bit for ctb and xilinx_ctb."""
|
""" Test using definelist_bit for ctb and xilinx_ctb."""
|
||||||
det_name = simulator
|
det_type, num_interfaces, num_mods, d = session_simulator
|
||||||
|
assert d is not None
|
||||||
|
|
||||||
from slsdet import RegisterAddress, BitAddress, RegisterValue
|
from slsdet import RegisterAddress, BitAddress, RegisterValue
|
||||||
|
|
||||||
# setup
|
if det_type in ['ctb', 'xilinx_ctb']:
|
||||||
d = Detector()
|
|
||||||
d.hostname = f"localhost:{SERVER_START_PORTNO}"
|
|
||||||
|
|
||||||
if det_name in ['ctb', 'xilinx_ctb']:
|
|
||||||
prev_reg_defs = d.getRegisterDefinitions()
|
prev_reg_defs = d.getRegisterDefinitions()
|
||||||
prev_bit_defs = d.getBitDefinitions()
|
prev_bit_defs = d.getBitDefinitions()
|
||||||
d.clearRegisterDefinitions()
|
d.clearRegisterDefinitions()
|
||||||
@@ -385,15 +342,51 @@ def test_definelist_bit(simulator, request):
|
|||||||
Log(LogLevel.INFOGREEN, f"✅ {request.node.name} passed")
|
Log(LogLevel.INFOGREEN, f"✅ {request.node.name} passed")
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.withdetectorsimulators
|
@pytest.mark.detectorintegration
|
||||||
def test_patternstart(simulator, request):
|
def test_parameters_file(session_simulator, request):
|
||||||
""" Test using patternstart for ctb, xilinx_ctb and mythen3."""
|
""" Test using test_parameters_file."""
|
||||||
det_name = simulator
|
det_type, num_interfaces, num_mods, d = session_simulator
|
||||||
# setup
|
assert d is not None
|
||||||
d = Detector()
|
|
||||||
d.hostname = f"localhost:{SERVER_START_PORTNO}"
|
|
||||||
|
|
||||||
if det_name in ['ctb', 'xilinx_ctb', 'mythen3']:
|
with open("/tmp/params.det", "w") as f:
|
||||||
|
f.write("frames 2\n")
|
||||||
|
f.write("fwrite 1\n")
|
||||||
|
|
||||||
|
# this should not throw
|
||||||
|
d.parameters = "/tmp/params.det"
|
||||||
|
|
||||||
|
assert d.frames == 2
|
||||||
|
assert d.fwrite == 1
|
||||||
|
|
||||||
|
Log(LogLevel.INFOGREEN, f"✅ Test passed. Command: parameters")
|
||||||
|
|
||||||
|
|
||||||
|
@pytest.mark.detectorintegration
|
||||||
|
def test_include_file(session_simulator, request):
|
||||||
|
""" Test using test_include_file."""
|
||||||
|
det_type, num_interfaces, num_mods, d = session_simulator
|
||||||
|
assert d is not None
|
||||||
|
|
||||||
|
with open("/tmp/params.det", "w") as f:
|
||||||
|
f.write("frames 3\n")
|
||||||
|
f.write("fwrite 0\n")
|
||||||
|
|
||||||
|
# this should not throw
|
||||||
|
d.include = "/tmp/params.det"
|
||||||
|
|
||||||
|
assert d.frames == 3
|
||||||
|
assert d.fwrite == 0
|
||||||
|
|
||||||
|
Log(LogLevel.INFOGREEN, f"✅ Test passed. Command: include")
|
||||||
|
|
||||||
|
|
||||||
|
@pytest.mark.detectorintegration
|
||||||
|
def test_patternstart(session_simulator, request):
|
||||||
|
""" Test using patternstart for ctb, xilinx_ctb and mythen3."""
|
||||||
|
det_type, num_interfaces, num_mods, d = session_simulator
|
||||||
|
assert d is not None
|
||||||
|
|
||||||
|
if det_type in ['ctb', 'xilinx_ctb', 'mythen3']:
|
||||||
d.patternstart()
|
d.patternstart()
|
||||||
else:
|
else:
|
||||||
with pytest.raises(Exception) as exc_info:
|
with pytest.raises(Exception) as exc_info:
|
||||||
@@ -7,6 +7,15 @@ Run this using: pytest -s test_free.py
|
|||||||
|
|
||||||
import pytest, sys
|
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 slsdet import Detector, Ctb, freeSharedMemory
|
||||||
from utils_for_test import (
|
from utils_for_test import (
|
||||||
Log,
|
Log,
|
||||||
@@ -46,7 +55,7 @@ def setup_simulator(det_config):
|
|||||||
cleanup(fp)
|
cleanup(fp)
|
||||||
|
|
||||||
|
|
||||||
|
@pytest.mark.detectorintegration
|
||||||
def test_exptime_after_free_should_raise(setup_simulator):
|
def test_exptime_after_free_should_raise(setup_simulator):
|
||||||
Log(LogLevel.INFOBLUE, f'\nRunning test_exptime_after_free_should_raise')
|
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."
|
assert str(exc_info.value) == "Shared memory is invalid or freed. Close resources before access."
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def free_and_create_shm():
|
def free_and_create_shm():
|
||||||
k = Ctb() # opens existing shm if it exists
|
k = Ctb() # opens existing shm if it exists
|
||||||
k.hostname = f"localhost:{SERVER_START_PORTNO}" # free and recreate shm, maps to local shm struct
|
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):
|
def test_exptime_after_not_passing_var_should_raise(setup_simulator):
|
||||||
Log(LogLevel.INFOBLUE, f'\nRunning test_exptime_after_not_passing_var_should_raise')
|
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 = 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
|
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):
|
def test_exptime_after_passing_ctb_var_should_raise(setup_simulator):
|
||||||
Log(LogLevel.INFOBLUE, f'\nRunning test_exptime_after_passing_ctb_var_should_raise')
|
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
|
k.hostname = f"localhost:{SERVER_START_PORTNO}" # free and recreate shm, maps to local shm struct
|
||||||
return k
|
return k
|
||||||
|
|
||||||
|
@pytest.mark.detectorintegration
|
||||||
def test_exptime_after_returning_ctb_should_raise(setup_simulator):
|
def test_exptime_after_returning_ctb_should_raise(setup_simulator):
|
||||||
Log(LogLevel.INFOBLUE, f'\nRunning test_exptime_after_returning_ctb_should_raise')
|
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}")
|
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."
|
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):
|
def test_hostname_twice_acess_old_should_raise(setup_simulator):
|
||||||
Log(LogLevel.INFOBLUE, f'\nRunning test_hostname_twice_acess_old_should_raise')
|
Log(LogLevel.INFOBLUE, f'\nRunning test_hostname_twice_acess_old_should_raise')
|
||||||
|
|
||||||
@@ -5,9 +5,14 @@ from conftest import test_with_simulators
|
|||||||
|
|
||||||
from slsdet import Detector
|
from slsdet import Detector
|
||||||
|
|
||||||
@pytest.mark.withdetectorsimulators
|
from utils_for_test import (
|
||||||
@pytest.mark.parametrize("servers", [["moench"]], indirect=True)
|
Log,
|
||||||
def test_rx_ROI_moench(test_with_simulators, servers):
|
LogLevel,
|
||||||
|
)
|
||||||
|
|
||||||
|
@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. """
|
""" Test setting and getting rx_ROI property of Detector class for moench. """
|
||||||
|
|
||||||
d = Detector()
|
d = Detector()
|
||||||
@@ -28,9 +33,9 @@ def test_rx_ROI_moench(test_with_simulators, servers):
|
|||||||
roi = d.rx_roi
|
roi = d.rx_roi
|
||||||
assert roi == [(-1,-1,-1,-1)]
|
assert roi == [(-1,-1,-1,-1)]
|
||||||
|
|
||||||
@pytest.mark.withdetectorsimulators
|
@pytest.mark.detectorintegration
|
||||||
@pytest.mark.parametrize("servers", [["mythen3"]], indirect=True)
|
@pytest.mark.parametrize("setup_parameters", [(["mythen3"], 1)], indirect=True)
|
||||||
def test_rx_ROI_mythen(test_with_simulators, servers):
|
def test_rx_ROI_mythen(test_with_simulators, setup_parameters):
|
||||||
""" Test setting and getting rx_ROI property of Detector class for mythen. """
|
""" Test setting and getting rx_ROI property of Detector class for mythen. """
|
||||||
|
|
||||||
d = Detector()
|
d = Detector()
|
||||||
@@ -44,5 +49,3 @@ def test_rx_ROI_mythen(test_with_simulators, servers):
|
|||||||
|
|
||||||
assert d.rx_roi == [(0,10,-1,-1)]
|
assert d.rx_roi == [(0,10,-1,-1)]
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -16,8 +16,11 @@ namespace sls {
|
|||||||
using test::GET;
|
using test::GET;
|
||||||
using test::PUT;
|
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",
|
TEST_CASE("jungfrau_or_moench_acquire_check_file_size",
|
||||||
"[.cmdcall][.cmdacquire]") {
|
"[.detectorintegration][.cmdacquire][.disable_check_data_file]") {
|
||||||
|
|
||||||
Detector det;
|
Detector det;
|
||||||
Caller caller(&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][.disable_check_data_file]") {
|
||||||
Detector det;
|
Detector det;
|
||||||
Caller caller(&det);
|
Caller caller(&det);
|
||||||
auto det_type =
|
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][.disable_check_data_file]") {
|
||||||
Detector det;
|
Detector det;
|
||||||
Caller caller(&det);
|
Caller caller(&det);
|
||||||
auto det_type =
|
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][.disable_check_data_file]") {
|
||||||
Detector det;
|
Detector det;
|
||||||
Caller caller(&det);
|
Caller caller(&det);
|
||||||
auto det_type =
|
auto det_type =
|
||||||
@@ -150,7 +156,11 @@ void test_ctb_file_size_with_acquire(Detector &det, Caller &caller,
|
|||||||
expected_image_size));
|
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_check_data_file]") {
|
||||||
Detector det;
|
Detector det;
|
||||||
Caller caller(&det);
|
Caller caller(&det);
|
||||||
auto det_type =
|
auto det_type =
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ using test::PUT;
|
|||||||
|
|
||||||
/* dacs */
|
/* dacs */
|
||||||
|
|
||||||
TEST_CASE("dacname", "[.cmdcall]") {
|
TEST_CASE("dacname", "[.detectorintegration]") {
|
||||||
Detector det;
|
Detector det;
|
||||||
Caller caller(&det);
|
Caller caller(&det);
|
||||||
auto det_type = det.getDetectorType().squash();
|
auto det_type = det.getDetectorType().squash();
|
||||||
@@ -54,7 +54,7 @@ TEST_CASE("dacname", "[.cmdcall]") {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_CASE("dacindex", "[.cmdcall]") {
|
TEST_CASE("dacindex", "[.detectorintegration]") {
|
||||||
Detector det;
|
Detector det;
|
||||||
Caller caller(&det);
|
Caller caller(&det);
|
||||||
auto det_type = det.getDetectorType().squash();
|
auto det_type = det.getDetectorType().squash();
|
||||||
@@ -80,7 +80,7 @@ TEST_CASE("dacindex", "[.cmdcall]") {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_CASE("adclist", "[.cmdcall]") {
|
TEST_CASE("adclist", "[.detectorintegration]") {
|
||||||
Detector det;
|
Detector det;
|
||||||
Caller caller(&det);
|
Caller caller(&det);
|
||||||
auto det_type = det.getDetectorType().squash();
|
auto det_type = det.getDetectorType().squash();
|
||||||
@@ -113,7 +113,7 @@ TEST_CASE("adclist", "[.cmdcall]") {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_CASE("adcname", "[.cmdcall]") {
|
TEST_CASE("adcname", "[.detectorintegration]") {
|
||||||
Detector det;
|
Detector det;
|
||||||
Caller caller(&det);
|
Caller caller(&det);
|
||||||
auto det_type = det.getDetectorType().squash();
|
auto det_type = det.getDetectorType().squash();
|
||||||
@@ -148,7 +148,7 @@ TEST_CASE("adcname", "[.cmdcall]") {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_CASE("adcindex", "[.cmdcall]") {
|
TEST_CASE("adcindex", "[.detectorintegration]") {
|
||||||
Detector det;
|
Detector det;
|
||||||
Caller caller(&det);
|
Caller caller(&det);
|
||||||
auto det_type = det.getDetectorType().squash();
|
auto det_type = det.getDetectorType().squash();
|
||||||
@@ -174,7 +174,7 @@ TEST_CASE("adcindex", "[.cmdcall]") {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_CASE("signallist", "[.cmdcall]") {
|
TEST_CASE("signallist", "[.detectorintegration]") {
|
||||||
Detector det;
|
Detector det;
|
||||||
Caller caller(&det);
|
Caller caller(&det);
|
||||||
auto det_type = det.getDetectorType().squash();
|
auto det_type = det.getDetectorType().squash();
|
||||||
@@ -207,7 +207,7 @@ TEST_CASE("signallist", "[.cmdcall]") {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_CASE("signalname", "[.cmdcall]") {
|
TEST_CASE("signalname", "[.detectorintegration]") {
|
||||||
Detector det;
|
Detector det;
|
||||||
Caller caller(&det);
|
Caller caller(&det);
|
||||||
auto det_type = det.getDetectorType().squash();
|
auto det_type = det.getDetectorType().squash();
|
||||||
@@ -242,7 +242,7 @@ TEST_CASE("signalname", "[.cmdcall]") {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_CASE("signalindex", "[.cmdcall]") {
|
TEST_CASE("signalindex", "[.detectorintegration]") {
|
||||||
Detector det;
|
Detector det;
|
||||||
Caller caller(&det);
|
Caller caller(&det);
|
||||||
auto det_type = det.getDetectorType().squash();
|
auto det_type = det.getDetectorType().squash();
|
||||||
@@ -269,7 +269,7 @@ TEST_CASE("signalindex", "[.cmdcall]") {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_CASE("powerlist", "[.cmdcall]") {
|
TEST_CASE("powerlist", "[.detectorintegration]") {
|
||||||
Detector det;
|
Detector det;
|
||||||
Caller caller(&det);
|
Caller caller(&det);
|
||||||
auto det_type = det.getDetectorType().squash();
|
auto det_type = det.getDetectorType().squash();
|
||||||
@@ -302,7 +302,7 @@ TEST_CASE("powerlist", "[.cmdcall]") {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_CASE("powername", "[.cmdcall]") {
|
TEST_CASE("powername", "[.detectorintegration]") {
|
||||||
Detector det;
|
Detector det;
|
||||||
Caller caller(&det);
|
Caller caller(&det);
|
||||||
auto det_type = det.getDetectorType().squash();
|
auto det_type = det.getDetectorType().squash();
|
||||||
@@ -337,7 +337,7 @@ TEST_CASE("powername", "[.cmdcall]") {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_CASE("powerindex", "[.cmdcall]") {
|
TEST_CASE("powerindex", "[.detectorintegration]") {
|
||||||
Detector det;
|
Detector det;
|
||||||
Caller caller(&det);
|
Caller caller(&det);
|
||||||
auto det_type = det.getDetectorType().squash();
|
auto det_type = det.getDetectorType().squash();
|
||||||
@@ -364,7 +364,7 @@ TEST_CASE("powerindex", "[.cmdcall]") {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_CASE("powervalues", "[.cmdcall]") {
|
TEST_CASE("powervalues", "[.detectorintegration]") {
|
||||||
Detector det;
|
Detector det;
|
||||||
Caller caller(&det);
|
Caller caller(&det);
|
||||||
auto det_type = det.getDetectorType().squash();
|
auto det_type = det.getDetectorType().squash();
|
||||||
@@ -377,7 +377,7 @@ TEST_CASE("powervalues", "[.cmdcall]") {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_CASE("slowadcvalues", "[.cmdcall]") {
|
TEST_CASE("slowadcvalues", "[.detectorintegration]") {
|
||||||
Detector det;
|
Detector det;
|
||||||
Caller caller(&det);
|
Caller caller(&det);
|
||||||
auto det_type = det.getDetectorType().squash();
|
auto det_type = det.getDetectorType().squash();
|
||||||
@@ -390,7 +390,7 @@ TEST_CASE("slowadcvalues", "[.cmdcall]") {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_CASE("slowadclist", "[.cmdcall]") {
|
TEST_CASE("slowadclist", "[.detectorintegration]") {
|
||||||
Detector det;
|
Detector det;
|
||||||
Caller caller(&det);
|
Caller caller(&det);
|
||||||
auto det_type = det.getDetectorType().squash();
|
auto det_type = det.getDetectorType().squash();
|
||||||
@@ -423,7 +423,7 @@ TEST_CASE("slowadclist", "[.cmdcall]") {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_CASE("slowadcname", "[.cmdcall]") {
|
TEST_CASE("slowadcname", "[.detectorintegration]") {
|
||||||
Detector det;
|
Detector det;
|
||||||
Caller caller(&det);
|
Caller caller(&det);
|
||||||
auto det_type = det.getDetectorType().squash();
|
auto det_type = det.getDetectorType().squash();
|
||||||
@@ -459,7 +459,7 @@ TEST_CASE("slowadcname", "[.cmdcall]") {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_CASE("slowadcindex", "[.cmdcall]") {
|
TEST_CASE("slowadcindex", "[.detectorintegration]") {
|
||||||
Detector det;
|
Detector det;
|
||||||
Caller caller(&det);
|
Caller caller(&det);
|
||||||
auto det_type = det.getDetectorType().squash();
|
auto det_type = det.getDetectorType().squash();
|
||||||
@@ -488,7 +488,7 @@ TEST_CASE("slowadcindex", "[.cmdcall]") {
|
|||||||
|
|
||||||
/* dacs */
|
/* dacs */
|
||||||
|
|
||||||
TEST_CASE("dac", "[.cmdcall][.dacs]") {
|
TEST_CASE("dac", "[.detectorintegration][.dacs]") {
|
||||||
// dac 0 to dac 17
|
// dac 0 to dac 17
|
||||||
|
|
||||||
Detector det;
|
Detector det;
|
||||||
@@ -564,7 +564,7 @@ TEST_CASE("dac", "[.cmdcall][.dacs]") {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_CASE("adcvpp", "[.cmdcall]") {
|
TEST_CASE("adcvpp", "[.detectorintegration]") {
|
||||||
Detector det;
|
Detector det;
|
||||||
Caller caller(&det);
|
Caller caller(&det);
|
||||||
auto det_type = det.getDetectorType().squash();
|
auto det_type = det.getDetectorType().squash();
|
||||||
@@ -596,7 +596,7 @@ TEST_CASE("adcvpp", "[.cmdcall]") {
|
|||||||
|
|
||||||
/* CTB Specific */
|
/* CTB Specific */
|
||||||
|
|
||||||
TEST_CASE("samples", "[.cmdcall]") {
|
TEST_CASE("samples", "[.detectorintegration]") {
|
||||||
Detector det;
|
Detector det;
|
||||||
Caller caller(&det);
|
Caller caller(&det);
|
||||||
auto det_type = det.getDetectorType().squash();
|
auto det_type = det.getDetectorType().squash();
|
||||||
@@ -640,7 +640,7 @@ TEST_CASE("samples", "[.cmdcall]") {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_CASE("asamples", "[.cmdcall]") {
|
TEST_CASE("asamples", "[.detectorintegration]") {
|
||||||
Detector det;
|
Detector det;
|
||||||
Caller caller(&det);
|
Caller caller(&det);
|
||||||
auto det_type = det.getDetectorType().squash();
|
auto det_type = det.getDetectorType().squash();
|
||||||
@@ -671,7 +671,7 @@ TEST_CASE("asamples", "[.cmdcall]") {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_CASE("adcclk", "[.cmdcall]") {
|
TEST_CASE("adcclk", "[.detectorintegration]") {
|
||||||
Detector det;
|
Detector det;
|
||||||
Caller caller(&det);
|
Caller caller(&det);
|
||||||
auto det_type = det.getDetectorType().squash();
|
auto det_type = det.getDetectorType().squash();
|
||||||
@@ -702,7 +702,7 @@ TEST_CASE("adcclk", "[.cmdcall]") {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_CASE("runclk", "[.cmdcall]") {
|
TEST_CASE("runclk", "[.detectorintegration]") {
|
||||||
Detector det;
|
Detector det;
|
||||||
Caller caller(&det);
|
Caller caller(&det);
|
||||||
auto det_type = det.getDetectorType().squash();
|
auto det_type = det.getDetectorType().squash();
|
||||||
@@ -733,7 +733,7 @@ TEST_CASE("runclk", "[.cmdcall]") {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_CASE("syncclk", "[.cmdcall]") {
|
TEST_CASE("syncclk", "[.detectorintegration]") {
|
||||||
Detector det;
|
Detector det;
|
||||||
Caller caller(&det);
|
Caller caller(&det);
|
||||||
auto det_type = det.getDetectorType().squash();
|
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;
|
Detector det;
|
||||||
Caller caller(&det);
|
Caller caller(&det);
|
||||||
auto det_type = det.getDetectorType().squash();
|
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;
|
Detector det;
|
||||||
Caller caller(&det);
|
Caller caller(&det);
|
||||||
auto det_type = det.getDetectorType().squash();
|
auto det_type = det.getDetectorType().squash();
|
||||||
@@ -814,7 +814,7 @@ TEST_CASE("adcenable", "[.cmdcall]") {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_CASE("adcenable10g", "[.cmdcall]") {
|
TEST_CASE("adcenable10g", "[.detectorintegration]") {
|
||||||
Detector det;
|
Detector det;
|
||||||
Caller caller(&det);
|
Caller caller(&det);
|
||||||
auto det_type = det.getDetectorType().squash();
|
auto det_type = det.getDetectorType().squash();
|
||||||
@@ -845,7 +845,7 @@ TEST_CASE("adcenable10g", "[.cmdcall]") {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_CASE("transceiverenable", "[.cmdcall]") {
|
TEST_CASE("transceiverenable", "[.detectorintegration]") {
|
||||||
Detector det;
|
Detector det;
|
||||||
Caller caller(&det);
|
Caller caller(&det);
|
||||||
auto det_type = det.getDetectorType().squash();
|
auto det_type = det.getDetectorType().squash();
|
||||||
@@ -878,7 +878,7 @@ TEST_CASE("transceiverenable", "[.cmdcall]") {
|
|||||||
|
|
||||||
/* CTB Specific */
|
/* CTB Specific */
|
||||||
|
|
||||||
TEST_CASE("dsamples", "[.cmdcall]") {
|
TEST_CASE("dsamples", "[.detectorintegration]") {
|
||||||
Detector det;
|
Detector det;
|
||||||
Caller caller(&det);
|
Caller caller(&det);
|
||||||
auto det_type = det.getDetectorType().squash();
|
auto det_type = det.getDetectorType().squash();
|
||||||
@@ -909,7 +909,7 @@ TEST_CASE("dsamples", "[.cmdcall]") {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_CASE("tsamples", "[.cmdcall]") {
|
TEST_CASE("tsamples", "[.detectorintegration]") {
|
||||||
Detector det;
|
Detector det;
|
||||||
Caller caller(&det);
|
Caller caller(&det);
|
||||||
auto det_type = det.getDetectorType().squash();
|
auto det_type = det.getDetectorType().squash();
|
||||||
@@ -945,7 +945,7 @@ TEST_CASE("tsamples", "[.cmdcall]") {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_CASE("romode", "[.cmdcall]") {
|
TEST_CASE("romode", "[.detectorintegration]") {
|
||||||
Detector det;
|
Detector det;
|
||||||
Caller caller(&det);
|
Caller caller(&det);
|
||||||
auto det_type = det.getDetectorType().squash();
|
auto det_type = det.getDetectorType().squash();
|
||||||
@@ -999,7 +999,7 @@ TEST_CASE("romode", "[.cmdcall]") {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_CASE("dbitclk", "[.cmdcall]") {
|
TEST_CASE("dbitclk", "[.detectorintegration]") {
|
||||||
Detector det;
|
Detector det;
|
||||||
Caller caller(&det);
|
Caller caller(&det);
|
||||||
auto det_type = det.getDetectorType().squash();
|
auto det_type = det.getDetectorType().squash();
|
||||||
@@ -1030,17 +1030,19 @@ TEST_CASE("dbitclk", "[.cmdcall]") {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_CASE("v_abcd", "[.cmdcall]") {
|
TEST_CASE("v_abcd", "[.detectorintegration]") {
|
||||||
Detector det;
|
Detector det;
|
||||||
Caller caller(&det);
|
Caller caller(&det);
|
||||||
auto det_type = det.getDetectorType().squash();
|
auto det_type = det.getDetectorType().squash();
|
||||||
|
|
||||||
if (det.isVirtualDetectorServer().tsquash("Inconsistent virtual servers")) {
|
std::vector<std::string> cmds{"v_a", "v_b", "v_c", "v_d"};
|
||||||
|
|
||||||
std::vector<std::string> cmds{"v_a", "v_b", "v_c", "v_d", "v_io"};
|
|
||||||
std::vector<defs::dacIndex> indices{defs::V_POWER_A, defs::V_POWER_B,
|
std::vector<defs::dacIndex> indices{defs::V_POWER_A, defs::V_POWER_B,
|
||||||
defs::V_POWER_C, defs::V_POWER_D,
|
defs::V_POWER_C, defs::V_POWER_D};
|
||||||
defs::V_POWER_IO};
|
|
||||||
|
if (det.isVirtualDetectorServer().tsquash("Inconsistent virtual servers")) {
|
||||||
|
cmds.push_back("v_io");
|
||||||
|
indices.push_back(defs::V_POWER_IO);
|
||||||
|
}
|
||||||
|
|
||||||
for (size_t i = 0; i < cmds.size(); ++i) {
|
for (size_t i = 0; i < cmds.size(); ++i) {
|
||||||
if (det_type == defs::CHIPTESTBOARD ||
|
if (det_type == defs::CHIPTESTBOARD ||
|
||||||
@@ -1064,13 +1066,12 @@ TEST_CASE("v_abcd", "[.cmdcall]") {
|
|||||||
caller.call(cmds[i], {}, -1, GET, oss2);
|
caller.call(cmds[i], {}, -1, GET, oss2);
|
||||||
REQUIRE(oss2.str() == cmds[i] + " 1200\n");
|
REQUIRE(oss2.str() == cmds[i] + " 1200\n");
|
||||||
}
|
}
|
||||||
for (int i = 0; i != det.size(); ++i) {
|
for (int imod = 0; imod != det.size(); ++imod) {
|
||||||
if (det_type == defs::XILINX_CHIPTESTBOARD &&
|
if (det_type == defs::XILINX_CHIPTESTBOARD &&
|
||||||
prev_val[i] == -100) {
|
prev_val[imod] == -100) {
|
||||||
prev_val[i] = 0;
|
prev_val[imod] = 0;
|
||||||
continue;
|
|
||||||
}
|
}
|
||||||
det.setPower(indices[i], prev_val[i], {i});
|
det.setPower(indices[i], prev_val[imod], {imod});
|
||||||
}
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
@@ -1078,9 +1079,8 @@ TEST_CASE("v_abcd", "[.cmdcall]") {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
TEST_CASE("v_io", "[.cmdcall]") {
|
TEST_CASE("v_io", "[.detectorintegration]") {
|
||||||
Detector det;
|
Detector det;
|
||||||
Caller caller(&det);
|
Caller caller(&det);
|
||||||
auto det_type = det.getDetectorType().squash();
|
auto det_type = det.getDetectorType().squash();
|
||||||
@@ -1093,7 +1093,7 @@ TEST_CASE("v_io", "[.cmdcall]") {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_CASE("v_chip", "[.cmdcall]") {
|
TEST_CASE("v_chip", "[.detectorintegration]") {
|
||||||
Detector det;
|
Detector det;
|
||||||
Caller caller(&det);
|
Caller caller(&det);
|
||||||
auto det_type = det.getDetectorType().squash();
|
auto det_type = det.getDetectorType().squash();
|
||||||
@@ -1105,7 +1105,7 @@ TEST_CASE("v_chip", "[.cmdcall]") {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_CASE("vm_a", "[.cmdcall]") {
|
TEST_CASE("vm_a", "[.detectorintegration]") {
|
||||||
Detector det;
|
Detector det;
|
||||||
Caller caller(&det);
|
Caller caller(&det);
|
||||||
auto det_type = det.getDetectorType().squash();
|
auto det_type = det.getDetectorType().squash();
|
||||||
@@ -1116,7 +1116,7 @@ TEST_CASE("vm_a", "[.cmdcall]") {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_CASE("vm_b", "[.cmdcall]") {
|
TEST_CASE("vm_b", "[.detectorintegration]") {
|
||||||
Detector det;
|
Detector det;
|
||||||
Caller caller(&det);
|
Caller caller(&det);
|
||||||
auto det_type = det.getDetectorType().squash();
|
auto det_type = det.getDetectorType().squash();
|
||||||
@@ -1127,7 +1127,7 @@ TEST_CASE("vm_b", "[.cmdcall]") {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_CASE("vm_c", "[.cmdcall]") {
|
TEST_CASE("vm_c", "[.detectorintegration]") {
|
||||||
Detector det;
|
Detector det;
|
||||||
Caller caller(&det);
|
Caller caller(&det);
|
||||||
auto det_type = det.getDetectorType().squash();
|
auto det_type = det.getDetectorType().squash();
|
||||||
@@ -1138,7 +1138,7 @@ TEST_CASE("vm_c", "[.cmdcall]") {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_CASE("vm_d", "[.cmdcall]") {
|
TEST_CASE("vm_d", "[.detectorintegration]") {
|
||||||
Detector det;
|
Detector det;
|
||||||
Caller caller(&det);
|
Caller caller(&det);
|
||||||
auto det_type = det.getDetectorType().squash();
|
auto det_type = det.getDetectorType().squash();
|
||||||
@@ -1149,7 +1149,7 @@ TEST_CASE("vm_d", "[.cmdcall]") {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_CASE("vm_io", "[.cmdcall]") {
|
TEST_CASE("vm_io", "[.detectorintegration]") {
|
||||||
Detector det;
|
Detector det;
|
||||||
Caller caller(&det);
|
Caller caller(&det);
|
||||||
auto det_type = det.getDetectorType().squash();
|
auto det_type = det.getDetectorType().squash();
|
||||||
@@ -1160,7 +1160,7 @@ TEST_CASE("vm_io", "[.cmdcall]") {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_CASE("im_a", "[.cmdcall]") {
|
TEST_CASE("im_a", "[.detectorintegration]") {
|
||||||
Detector det;
|
Detector det;
|
||||||
Caller caller(&det);
|
Caller caller(&det);
|
||||||
auto det_type = det.getDetectorType().squash();
|
auto det_type = det.getDetectorType().squash();
|
||||||
@@ -1171,7 +1171,7 @@ TEST_CASE("im_a", "[.cmdcall]") {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_CASE("im_b", "[.cmdcall]") {
|
TEST_CASE("im_b", "[.detectorintegration]") {
|
||||||
Detector det;
|
Detector det;
|
||||||
Caller caller(&det);
|
Caller caller(&det);
|
||||||
auto det_type = det.getDetectorType().squash();
|
auto det_type = det.getDetectorType().squash();
|
||||||
@@ -1182,7 +1182,7 @@ TEST_CASE("im_b", "[.cmdcall]") {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_CASE("im_c", "[.cmdcall]") {
|
TEST_CASE("im_c", "[.detectorintegration]") {
|
||||||
Detector det;
|
Detector det;
|
||||||
Caller caller(&det);
|
Caller caller(&det);
|
||||||
auto det_type = det.getDetectorType().squash();
|
auto det_type = det.getDetectorType().squash();
|
||||||
@@ -1193,7 +1193,7 @@ TEST_CASE("im_c", "[.cmdcall]") {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_CASE("im_d", "[.cmdcall]") {
|
TEST_CASE("im_d", "[.detectorintegration]") {
|
||||||
Detector det;
|
Detector det;
|
||||||
Caller caller(&det);
|
Caller caller(&det);
|
||||||
auto det_type = det.getDetectorType().squash();
|
auto det_type = det.getDetectorType().squash();
|
||||||
@@ -1204,7 +1204,7 @@ TEST_CASE("im_d", "[.cmdcall]") {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_CASE("im_io", "[.cmdcall]") {
|
TEST_CASE("im_io", "[.detectorintegration]") {
|
||||||
Detector det;
|
Detector det;
|
||||||
Caller caller(&det);
|
Caller caller(&det);
|
||||||
auto det_type = det.getDetectorType().squash();
|
auto det_type = det.getDetectorType().squash();
|
||||||
@@ -1215,7 +1215,7 @@ TEST_CASE("im_io", "[.cmdcall]") {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_CASE("slowadc", "[.cmdcall]") {
|
TEST_CASE("slowadc", "[.detectorintegration]") {
|
||||||
Detector det;
|
Detector det;
|
||||||
Caller caller(&det);
|
Caller caller(&det);
|
||||||
auto det_type = det.getDetectorType().squash();
|
auto det_type = det.getDetectorType().squash();
|
||||||
@@ -1231,7 +1231,7 @@ TEST_CASE("slowadc", "[.cmdcall]") {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_CASE("extsampling", "[.cmdcall]") {
|
TEST_CASE("extsampling", "[.detectorintegration]") {
|
||||||
Detector det;
|
Detector det;
|
||||||
Caller caller(&det);
|
Caller caller(&det);
|
||||||
auto det_type = det.getDetectorType().squash();
|
auto det_type = det.getDetectorType().squash();
|
||||||
@@ -1261,7 +1261,7 @@ TEST_CASE("extsampling", "[.cmdcall]") {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_CASE("extsamplingsrc", "[.cmdcall]") {
|
TEST_CASE("extsamplingsrc", "[.detectorintegration]") {
|
||||||
Detector det;
|
Detector det;
|
||||||
Caller caller(&det);
|
Caller caller(&det);
|
||||||
auto det_type = det.getDetectorType().squash();
|
auto det_type = det.getDetectorType().squash();
|
||||||
@@ -1292,7 +1292,7 @@ TEST_CASE("extsamplingsrc", "[.cmdcall]") {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_CASE("diodelay", "[.cmdcall]") {
|
TEST_CASE("diodelay", "[.detectorintegration]") {
|
||||||
Detector det;
|
Detector det;
|
||||||
Caller caller(&det);
|
Caller caller(&det);
|
||||||
auto det_type = det.getDetectorType().squash();
|
auto det_type = det.getDetectorType().squash();
|
||||||
@@ -1315,7 +1315,7 @@ TEST_CASE("diodelay", "[.cmdcall]") {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_CASE("led", "[.cmdcall]") {
|
TEST_CASE("led", "[.detectorintegration]") {
|
||||||
Detector det;
|
Detector det;
|
||||||
Caller caller(&det);
|
Caller caller(&det);
|
||||||
auto det_type = det.getDetectorType().squash();
|
auto det_type = det.getDetectorType().squash();
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ using test::PUT;
|
|||||||
|
|
||||||
/** temperature */
|
/** temperature */
|
||||||
|
|
||||||
TEST_CASE("temp_fpgaext", "[.cmdcall]") {
|
TEST_CASE("temp_fpgaext", "[.detectorintegration]") {
|
||||||
Detector det;
|
Detector det;
|
||||||
Caller caller(&det);
|
Caller caller(&det);
|
||||||
auto det_type = det.getDetectorType().squash();
|
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;
|
Detector det;
|
||||||
Caller caller(&det);
|
Caller caller(&det);
|
||||||
auto det_type = det.getDetectorType().squash();
|
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;
|
Detector det;
|
||||||
Caller caller(&det);
|
Caller caller(&det);
|
||||||
auto det_type = det.getDetectorType().squash();
|
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;
|
Detector det;
|
||||||
Caller caller(&det);
|
Caller caller(&det);
|
||||||
auto det_type = det.getDetectorType().squash();
|
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;
|
Detector det;
|
||||||
Caller caller(&det);
|
Caller caller(&det);
|
||||||
auto det_type = det.getDetectorType().squash();
|
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;
|
Detector det;
|
||||||
Caller caller(&det);
|
Caller caller(&det);
|
||||||
auto det_type = det.getDetectorType().squash();
|
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;
|
Detector det;
|
||||||
Caller caller(&det);
|
Caller caller(&det);
|
||||||
auto det_type = det.getDetectorType().squash();
|
auto det_type = det.getDetectorType().squash();
|
||||||
@@ -126,7 +126,8 @@ TEST_CASE("temp_fpgafr", "[.cmdcall]") {
|
|||||||
|
|
||||||
/* dacs */
|
/* 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,
|
// vsvp, vtr, vrf, vrs, vsvn, vtgstv, vcmp_ll, vcmp_lr, vcal, vcmp_rl,
|
||||||
// rxb_rb, rxb_lb, vcmp_rr, vcp, vcn, vis, vthreshold
|
// rxb_rb, rxb_lb, vcmp_rr, vcp, vcn, vis, vthreshold
|
||||||
Detector det;
|
Detector det;
|
||||||
@@ -232,7 +233,7 @@ TEST_CASE("Setting and reading back EIGER dacs", "[.cmdcall][.dacs]") {
|
|||||||
|
|
||||||
/* Network Configuration (Detector<->Receiver) */
|
/* Network Configuration (Detector<->Receiver) */
|
||||||
|
|
||||||
TEST_CASE("txdelay_left", "[.cmdcall]") {
|
TEST_CASE("txdelay_left", "[.detectorintegration]") {
|
||||||
Detector det;
|
Detector det;
|
||||||
Caller caller(&det);
|
Caller caller(&det);
|
||||||
auto det_type = det.getDetectorType().squash();
|
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;
|
Detector det;
|
||||||
Caller caller(&det);
|
Caller caller(&det);
|
||||||
auto det_type = det.getDetectorType().squash();
|
auto det_type = det.getDetectorType().squash();
|
||||||
@@ -276,7 +277,7 @@ TEST_CASE("txdelay_right", "[.cmdcall]") {
|
|||||||
|
|
||||||
/* Eiger Specific */
|
/* Eiger Specific */
|
||||||
|
|
||||||
TEST_CASE("subexptime", "[.cmdcall]") {
|
TEST_CASE("subexptime", "[.detectorintegration]") {
|
||||||
Detector det;
|
Detector det;
|
||||||
Caller caller(&det);
|
Caller caller(&det);
|
||||||
|
|
||||||
@@ -297,7 +298,7 @@ TEST_CASE("subexptime", "[.cmdcall]") {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_CASE("subdeadtime", "[.cmdcall]") {
|
TEST_CASE("subdeadtime", "[.detectorintegration]") {
|
||||||
Detector det;
|
Detector det;
|
||||||
Caller caller(&det);
|
Caller caller(&det);
|
||||||
|
|
||||||
@@ -318,7 +319,7 @@ TEST_CASE("subdeadtime", "[.cmdcall]") {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_CASE("overflow", "[.cmdcall]") {
|
TEST_CASE("overflow", "[.detectorintegration]") {
|
||||||
Detector det;
|
Detector det;
|
||||||
Caller caller(&det);
|
Caller caller(&det);
|
||||||
auto det_type = det.getDetectorType().squash();
|
auto det_type = det.getDetectorType().squash();
|
||||||
@@ -339,7 +340,7 @@ TEST_CASE("overflow", "[.cmdcall]") {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_CASE("ratecorr", "[.cmdcall]") {
|
TEST_CASE("ratecorr", "[.detectorintegration]") {
|
||||||
Detector det;
|
Detector det;
|
||||||
Caller caller(&det);
|
Caller caller(&det);
|
||||||
auto det_type = det.getDetectorType().squash();
|
auto det_type = det.getDetectorType().squash();
|
||||||
@@ -373,7 +374,7 @@ TEST_CASE("ratecorr", "[.cmdcall]") {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_CASE("interruptsubframe", "[.cmdcall]") {
|
TEST_CASE("interruptsubframe", "[.detectorintegration]") {
|
||||||
Detector det;
|
Detector det;
|
||||||
Caller caller(&det);
|
Caller caller(&det);
|
||||||
auto det_type = det.getDetectorType().squash();
|
auto det_type = det.getDetectorType().squash();
|
||||||
@@ -397,7 +398,7 @@ TEST_CASE("interruptsubframe", "[.cmdcall]") {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_CASE("measuredperiod", "[.cmdcall]") {
|
TEST_CASE("measuredperiod", "[.detectorintegration]") {
|
||||||
Detector det;
|
Detector det;
|
||||||
Caller caller(&det);
|
Caller caller(&det);
|
||||||
auto det_type = det.getDetectorType().squash();
|
auto det_type = det.getDetectorType().squash();
|
||||||
@@ -434,7 +435,7 @@ TEST_CASE("measuredperiod", "[.cmdcall]") {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_CASE("measuredsubperiod", "[.cmdcall]") {
|
TEST_CASE("measuredsubperiod", "[.detectorintegration]") {
|
||||||
Detector det;
|
Detector det;
|
||||||
Caller caller(&det);
|
Caller caller(&det);
|
||||||
auto det_type = det.getDetectorType().squash();
|
auto det_type = det.getDetectorType().squash();
|
||||||
@@ -474,7 +475,7 @@ TEST_CASE("measuredsubperiod", "[.cmdcall]") {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_CASE("activate", "[.cmdcall]") {
|
TEST_CASE("activate", "[.detectorintegration]") {
|
||||||
Detector det;
|
Detector det;
|
||||||
Caller caller(&det);
|
Caller caller(&det);
|
||||||
auto det_type = det.getDetectorType().squash();
|
auto det_type = det.getDetectorType().squash();
|
||||||
@@ -505,7 +506,7 @@ TEST_CASE("activate", "[.cmdcall]") {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_CASE("partialreset", "[.cmdcall]") {
|
TEST_CASE("partialreset", "[.detectorintegration]") {
|
||||||
Detector det;
|
Detector det;
|
||||||
Caller caller(&det);
|
Caller caller(&det);
|
||||||
auto det_type = det.getDetectorType().squash();
|
auto det_type = det.getDetectorType().squash();
|
||||||
@@ -527,7 +528,7 @@ TEST_CASE("partialreset", "[.cmdcall]") {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_CASE("pulse", "[.cmdcall]") {
|
TEST_CASE("pulse", "[.detectorintegration]") {
|
||||||
Detector det;
|
Detector det;
|
||||||
Caller caller(&det);
|
Caller caller(&det);
|
||||||
auto det_type = det.getDetectorType().squash();
|
auto det_type = det.getDetectorType().squash();
|
||||||
@@ -542,7 +543,7 @@ TEST_CASE("pulse", "[.cmdcall]") {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_CASE("pulsenmove", "[.cmdcall]") {
|
TEST_CASE("pulsenmove", "[.detectorintegration]") {
|
||||||
Detector det;
|
Detector det;
|
||||||
Caller caller(&det);
|
Caller caller(&det);
|
||||||
auto det_type = det.getDetectorType().squash();
|
auto det_type = det.getDetectorType().squash();
|
||||||
@@ -557,7 +558,7 @@ TEST_CASE("pulsenmove", "[.cmdcall]") {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_CASE("pulsechip", "[.cmdcall]") {
|
TEST_CASE("pulsechip", "[.detectorintegration]") {
|
||||||
Detector det;
|
Detector det;
|
||||||
Caller caller(&det);
|
Caller caller(&det);
|
||||||
auto det_type = det.getDetectorType().squash();
|
auto det_type = det.getDetectorType().squash();
|
||||||
@@ -572,7 +573,7 @@ TEST_CASE("pulsechip", "[.cmdcall]") {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_CASE("quad", "[.cmdcall]") {
|
TEST_CASE("quad", "[.detectorintegration]") {
|
||||||
Detector det;
|
Detector det;
|
||||||
Caller caller(&det);
|
Caller caller(&det);
|
||||||
auto det_type = det.getDetectorType().squash();
|
auto det_type = det.getDetectorType().squash();
|
||||||
@@ -588,7 +589,7 @@ TEST_CASE("quad", "[.cmdcall]") {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_CASE("datastream", "[.cmdcall]") {
|
TEST_CASE("datastream", "[.detectorintegration]") {
|
||||||
Detector det;
|
Detector det;
|
||||||
Caller caller(&det);
|
Caller caller(&det);
|
||||||
auto det_type = det.getDetectorType().squash();
|
auto det_type = det.getDetectorType().squash();
|
||||||
@@ -628,7 +629,7 @@ TEST_CASE("datastream", "[.cmdcall]") {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_CASE("top", "[.cmdcall]") {
|
TEST_CASE("top", "[.detectorintegration]") {
|
||||||
Detector det;
|
Detector det;
|
||||||
Caller caller(&det);
|
Caller caller(&det);
|
||||||
auto det_type = det.getDetectorType().squash();
|
auto det_type = det.getDetectorType().squash();
|
||||||
|
|||||||
@@ -125,12 +125,6 @@ void test_acquire_binary_file_size(const testFileInfo &file_info,
|
|||||||
REQUIRE(actual_file_size == expected_file_size);
|
REQUIRE(actual_file_size == expected_file_size);
|
||||||
}
|
}
|
||||||
|
|
||||||
void test_frames_caught(const Detector &det, int num_frames_to_acquire) {
|
|
||||||
auto frames_caught = det.getFramesCaught().tsquash(
|
|
||||||
"Inconsistent number of frames caught")[0];
|
|
||||||
REQUIRE(frames_caught == num_frames_to_acquire);
|
|
||||||
}
|
|
||||||
|
|
||||||
void test_acquire_with_receiver(Caller &caller, const Detector &det) {
|
void test_acquire_with_receiver(Caller &caller, const Detector &det) {
|
||||||
REQUIRE_NOTHROW(caller.call("rx_start", {}, -1, PUT));
|
REQUIRE_NOTHROW(caller.call("rx_start", {}, -1, PUT));
|
||||||
REQUIRE_NOTHROW(caller.call("start", {}, -1, PUT));
|
REQUIRE_NOTHROW(caller.call("start", {}, -1, PUT));
|
||||||
@@ -172,9 +166,12 @@ void create_files_for_acquire(
|
|||||||
|
|
||||||
// acquire and get num frames caught
|
// acquire and get num frames caught
|
||||||
REQUIRE_NOTHROW(test_acquire_with_receiver(caller, det));
|
REQUIRE_NOTHROW(test_acquire_with_receiver(caller, det));
|
||||||
auto frames_caught = det.getFramesCaught().tsquash(
|
// TODO: maybe there should not be REQUIRE statements in void function at
|
||||||
"Inconsistent number of frames caught")[0];
|
// all, but traceback should be handled
|
||||||
|
{
|
||||||
|
auto frames_caught = det.getFramesCaught()[0][0];
|
||||||
REQUIRE(frames_caught == num_frames);
|
REQUIRE(frames_caught == num_frames);
|
||||||
|
}
|
||||||
|
|
||||||
// hdf5
|
// hdf5
|
||||||
#ifdef HDF5C
|
#ifdef HDF5C
|
||||||
@@ -184,9 +181,10 @@ void create_files_for_acquire(
|
|||||||
|
|
||||||
// acquire and get num frames caught
|
// acquire and get num frames caught
|
||||||
test_acquire_with_receiver(caller, det);
|
test_acquire_with_receiver(caller, det);
|
||||||
frames_caught = det.getFramesCaught().tsquash(
|
{
|
||||||
"Inconsistent number of frames caught")[0];
|
auto frames_caught = det.getFramesCaught()[0][0];
|
||||||
REQUIRE(frames_caught == num_frames);
|
REQUIRE(frames_caught == num_frames);
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// restore previous state
|
// restore previous state
|
||||||
|
|||||||
@@ -88,8 +88,6 @@ void test_acquire_binary_file_size(const testFileInfo &file_info,
|
|||||||
uint64_t num_frames_to_acquire,
|
uint64_t num_frames_to_acquire,
|
||||||
uint64_t expected_image_size);
|
uint64_t expected_image_size);
|
||||||
|
|
||||||
void test_frames_caught(const Detector &det, int num_frames_to_acquire);
|
|
||||||
|
|
||||||
void test_acquire_with_receiver(Caller &caller, const Detector &det);
|
void test_acquire_with_receiver(Caller &caller, const Detector &det);
|
||||||
|
|
||||||
void create_files_for_acquire(
|
void create_files_for_acquire(
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ using test::GET;
|
|||||||
using test::PUT;
|
using test::PUT;
|
||||||
|
|
||||||
// time specific measurements for gotthard2
|
// time specific measurements for gotthard2
|
||||||
TEST_CASE("timegotthard2", "[.cmdcall]") {
|
TEST_CASE("timegotthard2", "[.detectorintegration]") {
|
||||||
Detector det;
|
Detector det;
|
||||||
Caller caller(&det);
|
Caller caller(&det);
|
||||||
auto det_type = det.getDetectorType().squash();
|
auto det_type = det.getDetectorType().squash();
|
||||||
@@ -106,7 +106,8 @@ TEST_CASE("timegotthard2", "[.cmdcall]") {
|
|||||||
}
|
}
|
||||||
/* dacs */
|
/* 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_h_adc, vb_comp_fe, vb_comp_adc, vcom_cds,
|
||||||
// vref_restore, vb_opa_1st, vref_comp_fe, vcom_adc1,
|
// vref_restore, vb_opa_1st, vref_comp_fe, vcom_adc1,
|
||||||
// vref_prech, vref_l_adc, vref_cds, vb_cs,
|
// 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 */
|
/* on chip dacs */
|
||||||
|
|
||||||
TEST_CASE("vchip_comp_fe", "[.cmdcall][.onchipdacs]") {
|
TEST_CASE("vchip_comp_fe", "[.detectorintegration][.onchipdacs]") {
|
||||||
Detector det;
|
Detector det;
|
||||||
Caller caller(&det);
|
Caller caller(&det);
|
||||||
auto det_type = det.getDetectorType().squash();
|
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;
|
Detector det;
|
||||||
Caller caller(&det);
|
Caller caller(&det);
|
||||||
auto det_type = det.getDetectorType().squash();
|
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;
|
Detector det;
|
||||||
Caller caller(&det);
|
Caller caller(&det);
|
||||||
auto det_type = det.getDetectorType().squash();
|
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;
|
Detector det;
|
||||||
Caller caller(&det);
|
Caller caller(&det);
|
||||||
auto det_type = det.getDetectorType().squash();
|
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;
|
Detector det;
|
||||||
Caller caller(&det);
|
Caller caller(&det);
|
||||||
auto det_type = det.getDetectorType().squash();
|
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;
|
Detector det;
|
||||||
Caller caller(&det);
|
Caller caller(&det);
|
||||||
auto det_type = det.getDetectorType().squash();
|
auto det_type = det.getDetectorType().squash();
|
||||||
@@ -296,7 +297,7 @@ TEST_CASE("vchip_cs", "[.cmdcall][.onchipdacs]") {
|
|||||||
|
|
||||||
/* Gotthard2 Specific */
|
/* Gotthard2 Specific */
|
||||||
|
|
||||||
TEST_CASE("bursts", "[.cmdcall]") {
|
TEST_CASE("bursts", "[.detectorintegration]") {
|
||||||
Detector det;
|
Detector det;
|
||||||
Caller caller(&det);
|
Caller caller(&det);
|
||||||
auto det_type = det.getDetectorType().squash();
|
auto det_type = det.getDetectorType().squash();
|
||||||
@@ -370,7 +371,7 @@ TEST_CASE("bursts", "[.cmdcall]") {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_CASE("burstperiod", "[.cmdcall]") {
|
TEST_CASE("burstperiod", "[.detectorintegration]") {
|
||||||
Detector det;
|
Detector det;
|
||||||
Caller caller(&det);
|
Caller caller(&det);
|
||||||
auto det_type = det.getDetectorType().squash();
|
auto det_type = det.getDetectorType().squash();
|
||||||
@@ -392,7 +393,7 @@ TEST_CASE("burstperiod", "[.cmdcall]") {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_CASE("burstsl", "[.cmdcall]") {
|
TEST_CASE("burstsl", "[.detectorintegration]") {
|
||||||
Detector det;
|
Detector det;
|
||||||
Caller caller(&det);
|
Caller caller(&det);
|
||||||
auto det_type = det.getDetectorType().squash();
|
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;
|
Detector det;
|
||||||
Caller caller(&det);
|
Caller caller(&det);
|
||||||
auto det_type = det.getDetectorType().squash();
|
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;
|
Detector det;
|
||||||
Caller caller(&det);
|
Caller caller(&det);
|
||||||
auto det_type = det.getDetectorType().squash();
|
auto det_type = det.getDetectorType().squash();
|
||||||
@@ -450,7 +451,7 @@ TEST_CASE("vetophoton", "[.cmdcall]") {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_CASE("vetoref", "[.cmdcall]") {
|
TEST_CASE("vetoref", "[.detectorintegration]") {
|
||||||
Detector det;
|
Detector det;
|
||||||
Caller caller(&det);
|
Caller caller(&det);
|
||||||
auto det_type = det.getDetectorType().squash();
|
auto det_type = det.getDetectorType().squash();
|
||||||
@@ -465,7 +466,7 @@ TEST_CASE("vetoref", "[.cmdcall]") {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_CASE("vetofile", "[.cmdcall]") {
|
TEST_CASE("vetofile", "[.detectorintegration]") {
|
||||||
Detector det;
|
Detector det;
|
||||||
Caller caller(&det);
|
Caller caller(&det);
|
||||||
auto det_type = det.getDetectorType().squash();
|
auto det_type = det.getDetectorType().squash();
|
||||||
@@ -479,7 +480,7 @@ TEST_CASE("vetofile", "[.cmdcall]") {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_CASE("burstmode", "[.cmdcall]") {
|
TEST_CASE("burstmode", "[.detectorintegration]") {
|
||||||
Detector det;
|
Detector det;
|
||||||
Caller caller(&det);
|
Caller caller(&det);
|
||||||
auto det_type = det.getDetectorType().squash();
|
auto det_type = det.getDetectorType().squash();
|
||||||
@@ -510,7 +511,7 @@ TEST_CASE("burstmode", "[.cmdcall]") {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_CASE("cdsgain", "[.cmdcall]") {
|
TEST_CASE("cdsgain", "[.detectorintegration]") {
|
||||||
Detector det;
|
Detector det;
|
||||||
Caller caller(&det);
|
Caller caller(&det);
|
||||||
auto det_type = det.getDetectorType().squash();
|
auto det_type = det.getDetectorType().squash();
|
||||||
@@ -540,7 +541,7 @@ TEST_CASE("cdsgain", "[.cmdcall]") {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_CASE("timingsource", "[.cmdcall]") {
|
TEST_CASE("timingsource", "[.detectorintegration]") {
|
||||||
Detector det;
|
Detector det;
|
||||||
Caller caller(&det);
|
Caller caller(&det);
|
||||||
auto det_type = det.getDetectorType().squash();
|
auto det_type = det.getDetectorType().squash();
|
||||||
@@ -570,7 +571,7 @@ TEST_CASE("timingsource", "[.cmdcall]") {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_CASE("veto", "[.cmdcall]") {
|
TEST_CASE("veto", "[.detectorintegration]") {
|
||||||
Detector det;
|
Detector det;
|
||||||
Caller caller(&det);
|
Caller caller(&det);
|
||||||
auto det_type = det.getDetectorType().squash();
|
auto det_type = det.getDetectorType().squash();
|
||||||
@@ -600,7 +601,7 @@ TEST_CASE("veto", "[.cmdcall]") {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_CASE("vetostream", "[.cmdcall]") {
|
TEST_CASE("vetostream", "[.detectorintegration]") {
|
||||||
Detector det;
|
Detector det;
|
||||||
Caller caller(&det);
|
Caller caller(&det);
|
||||||
auto det_type = det.getDetectorType().squash();
|
auto det_type = det.getDetectorType().squash();
|
||||||
@@ -646,7 +647,7 @@ TEST_CASE("vetostream", "[.cmdcall]") {
|
|||||||
REQUIRE_THROWS(caller.call("vetostream", {"dfgd"}, -1, GET));
|
REQUIRE_THROWS(caller.call("vetostream", {"dfgd"}, -1, GET));
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_CASE("vetoalg", "[.cmdcall]") {
|
TEST_CASE("vetoalg", "[.detectorintegration]") {
|
||||||
Detector det;
|
Detector det;
|
||||||
Caller caller(&det);
|
Caller caller(&det);
|
||||||
auto det_type = det.getDetectorType().squash();
|
auto det_type = det.getDetectorType().squash();
|
||||||
@@ -702,7 +703,7 @@ TEST_CASE("vetoalg", "[.cmdcall]") {
|
|||||||
REQUIRE_THROWS(caller.call("vetoalg", {"dfgd"}, -1, GET));
|
REQUIRE_THROWS(caller.call("vetoalg", {"dfgd"}, -1, GET));
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_CASE("confadc", "[.cmdcall]") {
|
TEST_CASE("confadc", "[.detectorintegration]") {
|
||||||
Detector det;
|
Detector det;
|
||||||
Caller caller(&det);
|
Caller caller(&det);
|
||||||
auto det_type = det.getDetectorType().squash();
|
auto det_type = det.getDetectorType().squash();
|
||||||
|
|||||||
@@ -17,7 +17,8 @@ using test::PUT;
|
|||||||
|
|
||||||
/* dacs */
|
/* 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,
|
// vb_comp, vdd_prot, vin_com, vref_prech, vb_pixbuf, vb_ds, vref_ds,
|
||||||
// vref_comp
|
// vref_comp
|
||||||
Detector det;
|
Detector det;
|
||||||
@@ -95,7 +96,7 @@ TEST_CASE("Setting and reading back Jungfrau dacs", "[.cmdcall][.dacs]") {
|
|||||||
|
|
||||||
/* Network Configuration (Detector<->Receiver) */
|
/* Network Configuration (Detector<->Receiver) */
|
||||||
|
|
||||||
TEST_CASE("selinterface", "[.cmdcall]") {
|
TEST_CASE("selinterface", "[.detectorintegration]") {
|
||||||
Detector det;
|
Detector det;
|
||||||
Caller caller(&det);
|
Caller caller(&det);
|
||||||
auto det_type = det.getDetectorType().squash();
|
auto det_type = det.getDetectorType().squash();
|
||||||
@@ -126,7 +127,7 @@ TEST_CASE("selinterface", "[.cmdcall]") {
|
|||||||
|
|
||||||
/* Jungfrau/moench Specific */
|
/* Jungfrau/moench Specific */
|
||||||
|
|
||||||
TEST_CASE("temp_threshold", "[.cmdcall]") {
|
TEST_CASE("temp_threshold", "[.detectorintegration]") {
|
||||||
Detector det;
|
Detector det;
|
||||||
Caller caller(&det);
|
Caller caller(&det);
|
||||||
auto det_type = det.getDetectorType().squash();
|
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;
|
Detector det;
|
||||||
Caller caller(&det);
|
Caller caller(&det);
|
||||||
auto det_type = det.getDetectorType().squash();
|
auto det_type = det.getDetectorType().squash();
|
||||||
@@ -168,7 +169,7 @@ TEST_CASE("chipversion", "[.cmdcall]") {
|
|||||||
REQUIRE_THROWS(caller.call("chipversion", {"0"}, -1, PUT));
|
REQUIRE_THROWS(caller.call("chipversion", {"0"}, -1, PUT));
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_CASE("temp_control", "[.cmdcall]") {
|
TEST_CASE("temp_control", "[.detectorintegration]") {
|
||||||
Detector det;
|
Detector det;
|
||||||
Caller caller(&det);
|
Caller caller(&det);
|
||||||
auto det_type = det.getDetectorType().squash();
|
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;
|
Detector det;
|
||||||
Caller caller(&det);
|
Caller caller(&det);
|
||||||
auto det_type = det.getDetectorType().squash();
|
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;
|
Detector det;
|
||||||
Caller caller(&det);
|
Caller caller(&det);
|
||||||
auto det_type = det.getDetectorType().squash();
|
auto det_type = det.getDetectorType().squash();
|
||||||
@@ -249,7 +250,7 @@ TEST_CASE("autocompdisable", "[.cmdcall]") {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_CASE("compdisabletime", "[.cmdcall]") {
|
TEST_CASE("compdisabletime", "[.detectorintegration]") {
|
||||||
Detector det;
|
Detector det;
|
||||||
Caller caller(&det);
|
Caller caller(&det);
|
||||||
auto det_type = det.getDetectorType().squash();
|
auto det_type = det.getDetectorType().squash();
|
||||||
@@ -279,7 +280,7 @@ TEST_CASE("compdisabletime", "[.cmdcall]") {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_CASE("extrastoragecells", "[.cmdcall]") {
|
TEST_CASE("extrastoragecells", "[.detectorintegration]") {
|
||||||
Detector det;
|
Detector det;
|
||||||
Caller caller(&det);
|
Caller caller(&det);
|
||||||
auto det_type = det.getDetectorType().squash();
|
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;
|
Detector det;
|
||||||
Caller caller(&det);
|
Caller caller(&det);
|
||||||
auto det_type = det.getDetectorType().squash();
|
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;
|
Detector det;
|
||||||
Caller caller(&det);
|
Caller caller(&det);
|
||||||
auto det_type = det.getDetectorType().squash();
|
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;
|
Detector det;
|
||||||
Caller caller(&det);
|
Caller caller(&det);
|
||||||
auto det_type = det.getDetectorType().squash();
|
auto det_type = det.getDetectorType().squash();
|
||||||
@@ -457,7 +458,7 @@ TEST_CASE("gainmode", "[.cmdcall]") {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_CASE("filtercells", "[.cmdcall]") {
|
TEST_CASE("filtercells", "[.detectorintegration]") {
|
||||||
Detector det;
|
Detector det;
|
||||||
Caller caller(&det);
|
Caller caller(&det);
|
||||||
auto det_type = det.getDetectorType().squash();
|
auto det_type = det.getDetectorType().squash();
|
||||||
@@ -501,7 +502,7 @@ TEST_CASE("filtercells", "[.cmdcall]") {
|
|||||||
REQUIRE_THROWS(caller.call("filtercells", {"0"}, -1, PUT));
|
REQUIRE_THROWS(caller.call("filtercells", {"0"}, -1, PUT));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
TEST_CASE("pedestalmode", "[.cmdcall]") {
|
TEST_CASE("pedestalmode", "[.detectorintegration]") {
|
||||||
Detector det;
|
Detector det;
|
||||||
Caller caller(&det);
|
Caller caller(&det);
|
||||||
auto det_type = det.getDetectorType().squash();
|
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;
|
Detector det;
|
||||||
Caller caller(&det);
|
Caller caller(&det);
|
||||||
if (det.getDetectorType().squash() == defs::JUNGFRAU &&
|
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;
|
Detector det;
|
||||||
Caller caller(&det);
|
Caller caller(&det);
|
||||||
if (det.getDetectorType().squash() == defs::JUNGFRAU) {
|
if (det.getDetectorType().squash() == defs::JUNGFRAU) {
|
||||||
@@ -714,7 +715,7 @@ TEST_CASE("collectionmode", "[.cmdcall]") {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_CASE("sync", "[.cmdcall]") {
|
TEST_CASE("sync", "[.detectorintegration]") {
|
||||||
Detector det;
|
Detector det;
|
||||||
Caller caller(&det);
|
Caller caller(&det);
|
||||||
auto det_type = det.getDetectorType().squash();
|
auto det_type = det.getDetectorType().squash();
|
||||||
|
|||||||
@@ -1032,7 +1032,9 @@ void open_hdf5_file(const std::string &file_path) {
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
TEST_CASE("check_master_file_attributes", "[.cmdcall][.cmdacquire][.cmdattr]") {
|
TEST_CASE(
|
||||||
|
"check_master_file_attributes",
|
||||||
|
"[.detectorintegration][.cmdacquire][.cmdattr][.disable_check_data_file]") {
|
||||||
|
|
||||||
Detector det;
|
Detector det;
|
||||||
Caller caller(&det);
|
Caller caller(&det);
|
||||||
@@ -1041,8 +1043,8 @@ TEST_CASE("check_master_file_attributes", "[.cmdcall][.cmdacquire][.cmdattr]") {
|
|||||||
|
|
||||||
int64_t num_frames = 1;
|
int64_t num_frames = 1;
|
||||||
switch (det_type) {
|
switch (det_type) {
|
||||||
case defs::EIGER:
|
|
||||||
case defs::JUNGFRAU:
|
case defs::JUNGFRAU:
|
||||||
|
case defs::EIGER:
|
||||||
case defs::MOENCH:
|
case defs::MOENCH:
|
||||||
case defs::MYTHEN3:
|
case defs::MYTHEN3:
|
||||||
case defs::GOTTHARD2:
|
case defs::GOTTHARD2:
|
||||||
|
|||||||
@@ -17,7 +17,8 @@ using test::PUT;
|
|||||||
|
|
||||||
/* dacs */
|
/* 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,
|
// vbp_colbuf, vipre, vin_cm, vb_sda, vcasc_sfp, vout_cm, vipre_cds,
|
||||||
// ibias_sfp
|
// ibias_sfp
|
||||||
Detector det;
|
Detector det;
|
||||||
|
|||||||
@@ -19,7 +19,8 @@ using test::PUT;
|
|||||||
|
|
||||||
/* dacs */
|
/* 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,
|
// vcassh, vth2, vshaper, vshaperneg, vipre_out, vth3, vth1,
|
||||||
// vicin, vcas, vpreamp, vpl, vipre, viinsh, vph, vtrim, vdcsh,
|
// vicin, vcas, vpreamp, vpl, vipre, viinsh, vph, vtrim, vdcsh,
|
||||||
|
|
||||||
@@ -184,7 +185,7 @@ TEST_CASE("Setting and reading back MYTHEN3 dacs", "[.cmdcall][.dacs]") {
|
|||||||
|
|
||||||
/* acquisition */
|
/* acquisition */
|
||||||
|
|
||||||
TEST_CASE("readout", "[.cmdcall]") {
|
TEST_CASE("readout", "[.detectorintegration]") {
|
||||||
Detector det;
|
Detector det;
|
||||||
Caller caller(&det);
|
Caller caller(&det);
|
||||||
// PUT only command
|
// PUT only command
|
||||||
@@ -201,7 +202,7 @@ TEST_CASE("readout", "[.cmdcall]") {
|
|||||||
|
|
||||||
/* Mythen3 Specific */
|
/* Mythen3 Specific */
|
||||||
|
|
||||||
TEST_CASE("counters", "[.cmdcall]") {
|
TEST_CASE("counters", "[.detectorintegration]") {
|
||||||
Detector det;
|
Detector det;
|
||||||
Caller caller(&det);
|
Caller caller(&det);
|
||||||
auto det_type = det.getDetectorType().squash();
|
auto det_type = det.getDetectorType().squash();
|
||||||
@@ -233,7 +234,7 @@ TEST_CASE("counters", "[.cmdcall]") {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_CASE("gates", "[.cmdcall]") {
|
TEST_CASE("gates", "[.detectorintegration]") {
|
||||||
Detector det;
|
Detector det;
|
||||||
Caller caller(&det);
|
Caller caller(&det);
|
||||||
auto det_type = det.getDetectorType().squash();
|
auto det_type = det.getDetectorType().squash();
|
||||||
@@ -263,7 +264,7 @@ TEST_CASE("gates", "[.cmdcall]") {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_CASE("exptime1", "[.cmdcall]") {
|
TEST_CASE("exptime1", "[.detectorintegration]") {
|
||||||
Detector det;
|
Detector det;
|
||||||
Caller caller(&det);
|
Caller caller(&det);
|
||||||
auto det_type = det.getDetectorType().squash();
|
auto det_type = det.getDetectorType().squash();
|
||||||
@@ -292,7 +293,7 @@ TEST_CASE("exptime1", "[.cmdcall]") {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_CASE("exptime2", "[.cmdcall]") {
|
TEST_CASE("exptime2", "[.detectorintegration]") {
|
||||||
Detector det;
|
Detector det;
|
||||||
Caller caller(&det);
|
Caller caller(&det);
|
||||||
auto det_type = det.getDetectorType().squash();
|
auto det_type = det.getDetectorType().squash();
|
||||||
@@ -321,7 +322,7 @@ TEST_CASE("exptime2", "[.cmdcall]") {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_CASE("exptime3", "[.cmdcall]") {
|
TEST_CASE("exptime3", "[.detectorintegration]") {
|
||||||
Detector det;
|
Detector det;
|
||||||
Caller caller(&det);
|
Caller caller(&det);
|
||||||
auto det_type = det.getDetectorType().squash();
|
auto det_type = det.getDetectorType().squash();
|
||||||
@@ -350,7 +351,7 @@ TEST_CASE("exptime3", "[.cmdcall]") {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_CASE("gatedelay", "[.cmdcall]") {
|
TEST_CASE("gatedelay", "[.detectorintegration]") {
|
||||||
Detector det;
|
Detector det;
|
||||||
Caller caller(&det);
|
Caller caller(&det);
|
||||||
auto det_type = det.getDetectorType().squash();
|
auto det_type = det.getDetectorType().squash();
|
||||||
@@ -386,7 +387,7 @@ TEST_CASE("gatedelay", "[.cmdcall]") {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_CASE("gatedelay1", "[.cmdcall]") {
|
TEST_CASE("gatedelay1", "[.detectorintegration]") {
|
||||||
Detector det;
|
Detector det;
|
||||||
Caller caller(&det);
|
Caller caller(&det);
|
||||||
auto det_type = det.getDetectorType().squash();
|
auto det_type = det.getDetectorType().squash();
|
||||||
@@ -415,7 +416,7 @@ TEST_CASE("gatedelay1", "[.cmdcall]") {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_CASE("gatedelay2", "[.cmdcall]") {
|
TEST_CASE("gatedelay2", "[.detectorintegration]") {
|
||||||
Detector det;
|
Detector det;
|
||||||
Caller caller(&det);
|
Caller caller(&det);
|
||||||
auto det_type = det.getDetectorType().squash();
|
auto det_type = det.getDetectorType().squash();
|
||||||
@@ -444,7 +445,7 @@ TEST_CASE("gatedelay2", "[.cmdcall]") {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_CASE("gatedelay3", "[.cmdcall]") {
|
TEST_CASE("gatedelay3", "[.detectorintegration]") {
|
||||||
Detector det;
|
Detector det;
|
||||||
Caller caller(&det);
|
Caller caller(&det);
|
||||||
auto det_type = det.getDetectorType().squash();
|
auto det_type = det.getDetectorType().squash();
|
||||||
@@ -473,7 +474,7 @@ TEST_CASE("gatedelay3", "[.cmdcall]") {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_CASE("polarity", "[.cmdcall]") {
|
TEST_CASE("polarity", "[.detectorintegration]") {
|
||||||
Detector det;
|
Detector det;
|
||||||
Caller caller(&det);
|
Caller caller(&det);
|
||||||
if (det.getDetectorType().squash() == defs::MYTHEN3) {
|
if (det.getDetectorType().squash() == defs::MYTHEN3) {
|
||||||
@@ -501,7 +502,7 @@ TEST_CASE("polarity", "[.cmdcall]") {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_CASE("interpolation", "[.cmdcall]") {
|
TEST_CASE("interpolation", "[.detectorintegration]") {
|
||||||
Detector det;
|
Detector det;
|
||||||
Caller caller(&det);
|
Caller caller(&det);
|
||||||
if (det.getDetectorType().squash() == defs::MYTHEN3) {
|
if (det.getDetectorType().squash() == defs::MYTHEN3) {
|
||||||
@@ -555,7 +556,7 @@ TEST_CASE("interpolation", "[.cmdcall]") {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_CASE("pumpprobe", "[.cmdcall]") {
|
TEST_CASE("pumpprobe", "[.detectorintegration]") {
|
||||||
Detector det;
|
Detector det;
|
||||||
Caller caller(&det);
|
Caller caller(&det);
|
||||||
if (det.getDetectorType().squash() == defs::MYTHEN3) {
|
if (det.getDetectorType().squash() == defs::MYTHEN3) {
|
||||||
@@ -632,7 +633,7 @@ TEST_CASE("pumpprobe", "[.cmdcall]") {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_CASE("apulse", "[.cmdcall]") {
|
TEST_CASE("apulse", "[.detectorintegration]") {
|
||||||
Detector det;
|
Detector det;
|
||||||
Caller caller(&det);
|
Caller caller(&det);
|
||||||
if (det.getDetectorType().squash() == defs::MYTHEN3) {
|
if (det.getDetectorType().squash() == defs::MYTHEN3) {
|
||||||
@@ -660,7 +661,7 @@ TEST_CASE("apulse", "[.cmdcall]") {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_CASE("dpulse", "[.cmdcall]") {
|
TEST_CASE("dpulse", "[.detectorintegration]") {
|
||||||
Detector det;
|
Detector det;
|
||||||
Caller caller(&det);
|
Caller caller(&det);
|
||||||
if (det.getDetectorType().squash() == defs::MYTHEN3) {
|
if (det.getDetectorType().squash() == defs::MYTHEN3) {
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ using test::PUT;
|
|||||||
|
|
||||||
/* Pattern */
|
/* Pattern */
|
||||||
|
|
||||||
TEST_CASE("patfname", "[.cmdcall]") {
|
TEST_CASE("patfname", "[.detectorintegration]") {
|
||||||
Detector det;
|
Detector det;
|
||||||
Caller caller(&det);
|
Caller caller(&det);
|
||||||
auto det_type = det.getDetectorType().squash();
|
auto det_type = det.getDetectorType().squash();
|
||||||
@@ -32,7 +32,7 @@ TEST_CASE("patfname", "[.cmdcall]") {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_CASE("pattern", "[.cmdcall]") {
|
TEST_CASE("pattern", "[.detectorintegration]") {
|
||||||
Detector det;
|
Detector det;
|
||||||
Caller caller(&det);
|
Caller caller(&det);
|
||||||
auto det_type = det.getDetectorType().squash();
|
auto det_type = det.getDetectorType().squash();
|
||||||
@@ -45,7 +45,7 @@ TEST_CASE("pattern", "[.cmdcall]") {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_CASE("savepattern", "[.cmdcall]") {
|
TEST_CASE("savepattern", "[.detectorintegration]") {
|
||||||
Detector det;
|
Detector det;
|
||||||
Caller caller(&det);
|
Caller caller(&det);
|
||||||
auto det_type = det.getDetectorType().squash();
|
auto det_type = det.getDetectorType().squash();
|
||||||
@@ -63,7 +63,7 @@ TEST_CASE("savepattern", "[.cmdcall]") {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_CASE("defaultpattern", "[.cmdcall]") {
|
TEST_CASE("defaultpattern", "[.detectorintegration]") {
|
||||||
Detector det;
|
Detector det;
|
||||||
Caller caller(&det);
|
Caller caller(&det);
|
||||||
auto det_type = det.getDetectorType().squash();
|
auto det_type = det.getDetectorType().squash();
|
||||||
@@ -76,7 +76,7 @@ TEST_CASE("defaultpattern", "[.cmdcall]") {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_CASE("patioctrl", "[.cmdcall]") {
|
TEST_CASE("patioctrl", "[.detectorintegration]") {
|
||||||
Detector det;
|
Detector det;
|
||||||
Caller caller(&det);
|
Caller caller(&det);
|
||||||
auto det_type = det.getDetectorType().squash();
|
auto det_type = det.getDetectorType().squash();
|
||||||
@@ -107,7 +107,7 @@ TEST_CASE("patioctrl", "[.cmdcall]") {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_CASE("patword", "[.cmdcall]") {
|
TEST_CASE("patword", "[.detectorintegration]") {
|
||||||
Detector det;
|
Detector det;
|
||||||
Caller caller(&det);
|
Caller caller(&det);
|
||||||
auto det_type = det.getDetectorType().squash();
|
auto det_type = det.getDetectorType().squash();
|
||||||
@@ -149,7 +149,7 @@ TEST_CASE("patword", "[.cmdcall]") {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_CASE("patlimits", "[.cmdcall]") {
|
TEST_CASE("patlimits", "[.detectorintegration]") {
|
||||||
Detector det;
|
Detector det;
|
||||||
Caller caller(&det);
|
Caller caller(&det);
|
||||||
auto det_type = det.getDetectorType().squash();
|
auto det_type = det.getDetectorType().squash();
|
||||||
@@ -176,7 +176,7 @@ TEST_CASE("patlimits", "[.cmdcall]") {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_CASE("patloop", "[.cmdcall]") {
|
TEST_CASE("patloop", "[.detectorintegration]") {
|
||||||
Detector det;
|
Detector det;
|
||||||
Caller caller(&det);
|
Caller caller(&det);
|
||||||
auto det_type = det.getDetectorType().squash();
|
auto det_type = det.getDetectorType().squash();
|
||||||
@@ -225,7 +225,7 @@ TEST_CASE("patloop", "[.cmdcall]") {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_CASE("patnloop", "[.cmdcall]") {
|
TEST_CASE("patnloop", "[.detectorintegration]") {
|
||||||
Detector det;
|
Detector det;
|
||||||
Caller caller(&det);
|
Caller caller(&det);
|
||||||
auto det_type = det.getDetectorType().squash();
|
auto det_type = det.getDetectorType().squash();
|
||||||
@@ -271,7 +271,7 @@ TEST_CASE("patnloop", "[.cmdcall]") {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_CASE("patwait", "[.cmdcall]") {
|
TEST_CASE("patwait", "[.detectorintegration]") {
|
||||||
Detector det;
|
Detector det;
|
||||||
Caller caller(&det);
|
Caller caller(&det);
|
||||||
auto det_type = det.getDetectorType().squash();
|
auto det_type = det.getDetectorType().squash();
|
||||||
@@ -317,7 +317,7 @@ TEST_CASE("patwait", "[.cmdcall]") {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_CASE("patwaittime", "[.cmdcall]") {
|
TEST_CASE("patwaittime", "[.detectorintegration]") {
|
||||||
Detector det;
|
Detector det;
|
||||||
Caller caller(&det);
|
Caller caller(&det);
|
||||||
auto det_type = det.getDetectorType().squash();
|
auto det_type = det.getDetectorType().squash();
|
||||||
@@ -379,7 +379,7 @@ TEST_CASE("patwaittime", "[.cmdcall]") {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_CASE("patmask", "[.cmdcall]") {
|
TEST_CASE("patmask", "[.detectorintegration]") {
|
||||||
Detector det;
|
Detector det;
|
||||||
Caller caller(&det);
|
Caller caller(&det);
|
||||||
auto det_type = det.getDetectorType().squash();
|
auto det_type = det.getDetectorType().squash();
|
||||||
@@ -405,7 +405,7 @@ TEST_CASE("patmask", "[.cmdcall]") {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_CASE("patsetbit", "[.cmdcall]") {
|
TEST_CASE("patsetbit", "[.detectorintegration]") {
|
||||||
Detector det;
|
Detector det;
|
||||||
Caller caller(&det);
|
Caller caller(&det);
|
||||||
auto det_type = det.getDetectorType().squash();
|
auto det_type = det.getDetectorType().squash();
|
||||||
@@ -431,7 +431,7 @@ TEST_CASE("patsetbit", "[.cmdcall]") {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_CASE("patternstart", "[.cmdcall]") {
|
TEST_CASE("patternstart", "[.detectorintegration]") {
|
||||||
Detector det;
|
Detector det;
|
||||||
Caller caller(&det);
|
Caller caller(&det);
|
||||||
REQUIRE_THROWS(caller.call("patternstart", {}, -1, GET));
|
REQUIRE_THROWS(caller.call("patternstart", {}, -1, GET));
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ namespace sls {
|
|||||||
using test::PUT;
|
using test::PUT;
|
||||||
|
|
||||||
TEST_CASE("Ctb and xilinx - cant put if receiver is not idle",
|
TEST_CASE("Ctb and xilinx - cant put if receiver is not idle",
|
||||||
"[.cmdcall][.rx]") {
|
"[.detectorintegration][.rx]") {
|
||||||
|
|
||||||
Detector det;
|
Detector det;
|
||||||
Caller caller(&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;
|
Detector det;
|
||||||
Caller caller(&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;
|
Detector det;
|
||||||
Caller caller(&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;
|
Detector det;
|
||||||
Caller caller(&det);
|
Caller caller(&det);
|
||||||
@@ -129,30 +132,30 @@ TEST_CASE("counters - cant put if receiver is not idle", "[.cmdcall][.rx]") {
|
|||||||
}
|
}
|
||||||
|
|
||||||
TEST_CASE("numinterfaces - cant put if receiver is not idle",
|
TEST_CASE("numinterfaces - cant put if receiver is not idle",
|
||||||
"[.cmdcall][.rx]") {
|
"[.detectorintegration][.rx]") {
|
||||||
|
|
||||||
Detector det;
|
Detector det;
|
||||||
Caller caller(&det);
|
Caller caller(&det);
|
||||||
auto det_type = det.getDetectorType().squash();
|
auto det_type = det.getDetectorType().squash();
|
||||||
|
|
||||||
if (det_type == defs::JUNGFRAU || det_type == defs::MOENCH) {
|
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
|
// start receiver
|
||||||
REQUIRE_NOTHROW(caller.call("rx_start", {}, -1, PUT));
|
REQUIRE_NOTHROW(caller.call("rx_start", {}, -1, PUT));
|
||||||
|
|
||||||
REQUIRE_THROWS(caller.call("numinterafaces", {"2"}, -1, PUT));
|
REQUIRE_THROWS(caller.call("numinterfaces", {"2"}, -1, PUT));
|
||||||
|
|
||||||
// stop receiver
|
// stop receiver
|
||||||
REQUIRE_NOTHROW(caller.call("rx_stop", {}, -1, PUT));
|
REQUIRE_NOTHROW(caller.call("rx_stop", {}, -1, PUT));
|
||||||
|
|
||||||
for (int i = 0; i != det.size(); ++i) {
|
det.setNumberofUDPInterfaces(prev_numinterfaces);
|
||||||
det.setNumberofUDPInterfaces(prev_numinterfaces[i], {i});
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
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;
|
Detector det;
|
||||||
Caller caller(&det);
|
Caller caller(&det);
|
||||||
@@ -174,7 +177,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;
|
Detector det;
|
||||||
Caller caller(&det);
|
Caller caller(&det);
|
||||||
@@ -198,7 +202,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;
|
Detector det;
|
||||||
Caller caller(&det);
|
Caller caller(&det);
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ python/scripts/list_tested_cmd.py to check if all commands are covered
|
|||||||
|
|
||||||
/* configuration */
|
/* configuration */
|
||||||
|
|
||||||
TEST_CASE("rx_version", "[.cmdcall][.rx]") {
|
TEST_CASE("rx_version", "[.detectorintegration][.rx]") {
|
||||||
Detector det;
|
Detector det;
|
||||||
Caller caller(&det);
|
Caller caller(&det);
|
||||||
std::ostringstream oss;
|
std::ostringstream oss;
|
||||||
@@ -39,7 +39,7 @@ TEST_CASE("rx_version", "[.cmdcall][.rx]") {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* acquisition */
|
/* acquisition */
|
||||||
TEST_CASE("rx_start", "[.cmdcall][.rx]") {
|
TEST_CASE("rx_start", "[.detectorintegration][.rx]") {
|
||||||
Detector det;
|
Detector det;
|
||||||
Caller caller(&det);
|
Caller caller(&det);
|
||||||
det.setFileWrite(false); // avoid writing or error on file creation
|
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;
|
Detector det;
|
||||||
Caller caller(&det);
|
Caller caller(&det);
|
||||||
// PUT only command
|
// 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;
|
Detector det;
|
||||||
Caller caller(&det);
|
Caller caller(&det);
|
||||||
det.setFileWrite(false); // avoid writing or error on file creation
|
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;
|
Detector det;
|
||||||
Caller caller(&det);
|
Caller caller(&det);
|
||||||
// This ensures 0 caught frames
|
// 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;
|
Detector det;
|
||||||
Caller caller(&det);
|
Caller caller(&det);
|
||||||
auto prev_val = det.getFileWrite();
|
auto prev_val = det.getFileWrite();
|
||||||
@@ -171,7 +171,7 @@ TEST_CASE("rx_missingpackets", "[.cmdcall][.rx]") {
|
|||||||
det.setNumberOfFrames(prev_frames);
|
det.setNumberOfFrames(prev_frames);
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_CASE("rx_frameindex", "[.cmdcall][.rx]") {
|
TEST_CASE("rx_frameindex", "[.detectorintegration][.rx]") {
|
||||||
Detector det;
|
Detector det;
|
||||||
Caller caller(&det);
|
Caller caller(&det);
|
||||||
caller.call("rx_frameindex", {}, -1, GET);
|
caller.call("rx_frameindex", {}, -1, GET);
|
||||||
@@ -182,7 +182,7 @@ TEST_CASE("rx_frameindex", "[.cmdcall][.rx]") {
|
|||||||
|
|
||||||
/* Network Configuration (Detector<->Receiver) */
|
/* Network Configuration (Detector<->Receiver) */
|
||||||
|
|
||||||
TEST_CASE("rx_printconfig", "[.cmdcall][.rx]") {
|
TEST_CASE("rx_printconfig", "[.detectorintegration][.rx]") {
|
||||||
Detector det;
|
Detector det;
|
||||||
Caller caller(&det);
|
Caller caller(&det);
|
||||||
REQUIRE_NOTHROW(caller.call("rx_printconfig", {}, -1, GET));
|
REQUIRE_NOTHROW(caller.call("rx_printconfig", {}, -1, GET));
|
||||||
@@ -190,7 +190,7 @@ TEST_CASE("rx_printconfig", "[.cmdcall][.rx]") {
|
|||||||
|
|
||||||
/* Receiver Config */
|
/* Receiver Config */
|
||||||
|
|
||||||
TEST_CASE("rx_hostname", "[.cmdcall][.rx]") {
|
TEST_CASE("rx_hostname", "[.detectorintegration][.rx]") {
|
||||||
Detector det;
|
Detector det;
|
||||||
Caller caller(&det);
|
Caller caller(&det);
|
||||||
auto prev_val = det.getRxHostname();
|
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;
|
Detector det;
|
||||||
Caller caller(&det);
|
Caller caller(&det);
|
||||||
auto prev_val = det.getRxPort();
|
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;
|
Detector det;
|
||||||
Caller caller(&det);
|
Caller caller(&det);
|
||||||
auto prev_val = det.getRxFifoDepth();
|
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;
|
Detector det;
|
||||||
Caller caller(&det);
|
Caller caller(&det);
|
||||||
auto prev_val = det.getRxSilentMode();
|
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;
|
Detector det;
|
||||||
Caller caller(&det);
|
Caller caller(&det);
|
||||||
auto prev_val = det.getRxFrameDiscardPolicy();
|
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;
|
Detector det;
|
||||||
Caller caller(&det);
|
Caller caller(&det);
|
||||||
auto prev_val = det.getPartialFramesPadding();
|
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;
|
Detector det;
|
||||||
Caller caller(&det);
|
Caller caller(&det);
|
||||||
int64_t prev_val = det.getRxUDPSocketBufferSize().tsquash(
|
int64_t prev_val = det.getRxUDPSocketBufferSize().tsquash(
|
||||||
@@ -382,7 +382,7 @@ TEST_CASE("rx_udpsocksize", "[.cmdcall][.rx]") {
|
|||||||
det.setRxUDPSocketBufferSize(prev_val);
|
det.setRxUDPSocketBufferSize(prev_val);
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_CASE("rx_realudpsocksize", "[.cmdcall][.rx]") {
|
TEST_CASE("rx_realudpsocksize", "[.detectorintegration][.rx]") {
|
||||||
Detector det;
|
Detector det;
|
||||||
Caller caller(&det);
|
Caller caller(&det);
|
||||||
uint64_t val = 0;
|
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;
|
Detector det;
|
||||||
Caller caller(&det);
|
Caller caller(&det);
|
||||||
auto prev_val = det.getRxLock();
|
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;
|
Detector det;
|
||||||
Caller caller(&det);
|
Caller caller(&det);
|
||||||
std::ostringstream oss;
|
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;
|
Detector det;
|
||||||
Caller caller(&det);
|
Caller caller(&det);
|
||||||
std::ostringstream oss;
|
std::ostringstream oss;
|
||||||
REQUIRE_NOTHROW(caller.call("rx_threads", {}, -1, GET, oss));
|
REQUIRE_NOTHROW(caller.call("rx_threads", {}, -1, GET, oss));
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_CASE("rx_arping", "[.cmdcall][.rx]") {
|
TEST_CASE("rx_arping", "[.detectorintegration][.rx]") {
|
||||||
Detector det;
|
Detector det;
|
||||||
Caller caller(&det);
|
Caller caller(&det);
|
||||||
auto prev_val = det.getRxArping();
|
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][.disable_check_data_file]") {
|
||||||
Detector det;
|
Detector det;
|
||||||
Caller caller(&det);
|
Caller caller(&det);
|
||||||
auto det_type = det.getDetectorType().squash();
|
auto det_type = det.getDetectorType().squash();
|
||||||
@@ -782,7 +782,7 @@ TEST_CASE("rx_roi", "[.cmdcall]") {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_CASE("rx_clearroi", "[.cmdcall]") {
|
TEST_CASE("rx_clearroi", "[.detectorintegration]") {
|
||||||
Detector det;
|
Detector det;
|
||||||
Caller caller(&det);
|
Caller caller(&det);
|
||||||
auto det_type = det.getDetectorType().squash();
|
auto det_type = det.getDetectorType().squash();
|
||||||
@@ -808,7 +808,7 @@ TEST_CASE("rx_clearroi", "[.cmdcall]") {
|
|||||||
|
|
||||||
/* File */
|
/* File */
|
||||||
|
|
||||||
TEST_CASE("fformat", "[.cmdcall]") {
|
TEST_CASE("fformat", "[.detectorintegration]") {
|
||||||
Detector det;
|
Detector det;
|
||||||
Caller caller(&det);
|
Caller caller(&det);
|
||||||
auto prev_val = det.getFileFormat();
|
auto prev_val = det.getFileFormat();
|
||||||
@@ -827,7 +827,7 @@ TEST_CASE("fformat", "[.cmdcall]") {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_CASE("fpath", "[.cmdcall]") {
|
TEST_CASE("fpath", "[.detectorintegration]") {
|
||||||
Detector det;
|
Detector det;
|
||||||
Caller caller(&det);
|
Caller caller(&det);
|
||||||
auto prev_val = det.getFilePath();
|
auto prev_val = det.getFilePath();
|
||||||
@@ -849,7 +849,7 @@ TEST_CASE("fpath", "[.cmdcall]") {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_CASE("fname", "[.cmdcall]") {
|
TEST_CASE("fname", "[.detectorintegration]") {
|
||||||
Detector det;
|
Detector det;
|
||||||
Caller caller(&det);
|
Caller caller(&det);
|
||||||
auto prev_val = det.getFileNamePrefix();
|
auto prev_val = det.getFileNamePrefix();
|
||||||
@@ -876,7 +876,7 @@ TEST_CASE("fname", "[.cmdcall]") {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_CASE("findex", "[.cmdcall]") {
|
TEST_CASE("findex", "[.detectorintegration]") {
|
||||||
Detector det;
|
Detector det;
|
||||||
Caller caller(&det);
|
Caller caller(&det);
|
||||||
auto prev_val = det.getAcquisitionIndex();
|
auto prev_val = det.getAcquisitionIndex();
|
||||||
@@ -900,7 +900,7 @@ TEST_CASE("findex", "[.cmdcall]") {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_CASE("fwrite", "[.cmdcall]") {
|
TEST_CASE("fwrite", "[.detectorintegration]") {
|
||||||
Detector det;
|
Detector det;
|
||||||
Caller caller(&det);
|
Caller caller(&det);
|
||||||
auto prev_val = det.getFileWrite();
|
auto prev_val = det.getFileWrite();
|
||||||
@@ -924,7 +924,7 @@ TEST_CASE("fwrite", "[.cmdcall]") {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_CASE("fmaster", "[.cmdcall]") {
|
TEST_CASE("fmaster", "[.detectorintegration]") {
|
||||||
Detector det;
|
Detector det;
|
||||||
Caller caller(&det);
|
Caller caller(&det);
|
||||||
auto prev_val = det.getMasterFileWrite();
|
auto prev_val = det.getMasterFileWrite();
|
||||||
@@ -946,7 +946,7 @@ TEST_CASE("fmaster", "[.cmdcall]") {
|
|||||||
det.setMasterFileWrite(prev_val);
|
det.setMasterFileWrite(prev_val);
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_CASE("foverwrite", "[.cmdcall]") {
|
TEST_CASE("foverwrite", "[.detectorintegration]") {
|
||||||
Detector det;
|
Detector det;
|
||||||
Caller caller(&det);
|
Caller caller(&det);
|
||||||
auto prev_val = det.getFileOverWrite();
|
auto prev_val = det.getFileOverWrite();
|
||||||
@@ -970,7 +970,7 @@ TEST_CASE("foverwrite", "[.cmdcall]") {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_CASE("rx_framesperfile", "[.cmdcall][.rx]") {
|
TEST_CASE("rx_framesperfile", "[.detectorintegration][.rx]") {
|
||||||
Detector det;
|
Detector det;
|
||||||
Caller caller(&det);
|
Caller caller(&det);
|
||||||
auto prev_val = det.getFramesPerFile();
|
auto prev_val = det.getFramesPerFile();
|
||||||
@@ -1001,7 +1001,7 @@ TEST_CASE("rx_framesperfile", "[.cmdcall][.rx]") {
|
|||||||
|
|
||||||
/* ZMQ Streaming Parameters (Receiver<->Client) */
|
/* ZMQ Streaming Parameters (Receiver<->Client) */
|
||||||
|
|
||||||
TEST_CASE("rx_zmqstream", "[.cmdcall][.rx]") {
|
TEST_CASE("rx_zmqstream", "[.detectorintegration][.rx]") {
|
||||||
Detector det;
|
Detector det;
|
||||||
Caller caller(&det);
|
Caller caller(&det);
|
||||||
auto prev_val = det.getRxZmqDataStream();
|
auto prev_val = det.getRxZmqDataStream();
|
||||||
@@ -1027,7 +1027,7 @@ TEST_CASE("rx_zmqstream", "[.cmdcall][.rx]") {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_CASE("rx_zmqfreq", "[.cmdcall][.rx]") {
|
TEST_CASE("rx_zmqfreq", "[.detectorintegration][.rx]") {
|
||||||
Detector det;
|
Detector det;
|
||||||
Caller caller(&det);
|
Caller caller(&det);
|
||||||
auto prev_val = det.getRxZmqFrequency();
|
auto prev_val = det.getRxZmqFrequency();
|
||||||
@@ -1051,7 +1051,7 @@ TEST_CASE("rx_zmqfreq", "[.cmdcall][.rx]") {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_CASE("rx_zmqstartfnum", "[.cmdcall][.rx]") {
|
TEST_CASE("rx_zmqstartfnum", "[.detectorintegration][.rx]") {
|
||||||
Detector det;
|
Detector det;
|
||||||
Caller caller(&det);
|
Caller caller(&det);
|
||||||
auto prev_val = det.getRxZmqStartingFrame();
|
auto prev_val = det.getRxZmqStartingFrame();
|
||||||
@@ -1075,7 +1075,7 @@ TEST_CASE("rx_zmqstartfnum", "[.cmdcall][.rx]") {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_CASE("rx_zmqport", "[.cmdcall][.rx]") {
|
TEST_CASE("rx_zmqport", "[.detectorintegration][.rx]") {
|
||||||
Detector det;
|
Detector det;
|
||||||
Caller caller(&det);
|
Caller caller(&det);
|
||||||
auto prev_val_zmqport = det.getRxZmqPort();
|
auto prev_val_zmqport = det.getRxZmqPort();
|
||||||
@@ -1123,7 +1123,7 @@ TEST_CASE("rx_zmqport", "[.cmdcall][.rx]") {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_CASE("rx_zmqhwm", "[.cmdcall]") {
|
TEST_CASE("rx_zmqhwm", "[.detectorintegration]") {
|
||||||
Detector det;
|
Detector det;
|
||||||
Caller caller(&det);
|
Caller caller(&det);
|
||||||
auto prev_val =
|
auto prev_val =
|
||||||
@@ -1153,7 +1153,7 @@ TEST_CASE("rx_zmqhwm", "[.cmdcall]") {
|
|||||||
|
|
||||||
/* CTB Specific */
|
/* CTB Specific */
|
||||||
|
|
||||||
TEST_CASE("rx_dbitlist", "[.cmdcall][.rx]") {
|
TEST_CASE("rx_dbitlist", "[.detectorintegration][.rx]") {
|
||||||
Detector det;
|
Detector det;
|
||||||
Caller caller(&det);
|
Caller caller(&det);
|
||||||
auto det_type = det.getDetectorType().squash();
|
auto det_type = det.getDetectorType().squash();
|
||||||
@@ -1183,7 +1183,7 @@ TEST_CASE("rx_dbitlist", "[.cmdcall][.rx]") {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_CASE("rx_dbitoffset", "[.cmdcall][.rx]") {
|
TEST_CASE("rx_dbitoffset", "[.detectorintegration][.rx]") {
|
||||||
Detector det;
|
Detector det;
|
||||||
Caller caller(&det);
|
Caller caller(&det);
|
||||||
auto det_type = det.getDetectorType().squash();
|
auto det_type = det.getDetectorType().squash();
|
||||||
@@ -1218,7 +1218,7 @@ TEST_CASE("rx_dbitoffset", "[.cmdcall][.rx]") {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_CASE("rx_dbitreorder", "[.cmdcall][.rx]") {
|
TEST_CASE("rx_dbitreorder", "[.detectorintegration][.rx]") {
|
||||||
Detector det;
|
Detector det;
|
||||||
Caller caller(&det);
|
Caller caller(&det);
|
||||||
auto det_type = det.getDetectorType().squash();
|
auto det_type = det.getDetectorType().squash();
|
||||||
@@ -1249,7 +1249,7 @@ TEST_CASE("rx_dbitreorder", "[.cmdcall][.rx]") {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_CASE("rx_jsonaddheader", "[.cmdcall][.rx]") {
|
TEST_CASE("rx_jsonaddheader", "[.detectorintegration][.rx]") {
|
||||||
Detector det;
|
Detector det;
|
||||||
Caller caller(&det);
|
Caller caller(&det);
|
||||||
auto prev_val = det.getAdditionalJsonHeader();
|
auto prev_val = det.getAdditionalJsonHeader();
|
||||||
@@ -1275,7 +1275,7 @@ TEST_CASE("rx_jsonaddheader", "[.cmdcall][.rx]") {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_CASE("rx_jsonpara", "[.cmdcall][.rx]") {
|
TEST_CASE("rx_jsonpara", "[.detectorintegration][.rx]") {
|
||||||
Detector det;
|
Detector det;
|
||||||
Caller caller(&det);
|
Caller caller(&det);
|
||||||
auto prev_val = det.getAdditionalJsonHeader();
|
auto prev_val = det.getAdditionalJsonHeader();
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ using test::PUT;
|
|||||||
|
|
||||||
/* dacs */
|
/* dacs */
|
||||||
|
|
||||||
TEST_CASE("configtransceiver", "[.cmdcall]") {
|
TEST_CASE("configtransceiver", "[.detectorintegration]") {
|
||||||
Detector det;
|
Detector det;
|
||||||
Caller caller(&det);
|
Caller caller(&det);
|
||||||
auto det_type = det.getDetectorType().squash();
|
auto det_type = det.getDetectorType().squash();
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@@ -813,7 +813,8 @@ void Implementation::startReadout() {
|
|||||||
<< "waiting for all packets, previousValue:"
|
<< "waiting for all packets, previousValue:"
|
||||||
<< previousValue
|
<< previousValue
|
||||||
<< " totalPacketsReceived: " << totalPacketsReceived;
|
<< " 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));
|
std::this_thread::sleep_for(std::chrono::milliseconds(5));
|
||||||
previousValue = totalPacketsReceived;
|
previousValue = totalPacketsReceived;
|
||||||
totalPacketsReceived = 0;
|
totalPacketsReceived = 0;
|
||||||
|
|||||||
@@ -140,7 +140,7 @@ class DataProcessorTestFixture {
|
|||||||
};
|
};
|
||||||
|
|
||||||
TEST_CASE_METHOD(DataProcessorTestFixture, "Remove Trailing Bits",
|
TEST_CASE_METHOD(DataProcessorTestFixture, "Remove Trailing Bits",
|
||||||
"[.dataprocessor][.bitoffset]") {
|
"[dataprocessor][bitoffset]") {
|
||||||
|
|
||||||
const size_t num_random_offset_bytes = 3;
|
const size_t num_random_offset_bytes = 3;
|
||||||
set_random_offset_bytes(num_random_offset_bytes);
|
set_random_offset_bytes(num_random_offset_bytes);
|
||||||
@@ -170,7 +170,7 @@ TEST_CASE_METHOD(DataProcessorTestFixture, "Remove Trailing Bits",
|
|||||||
// parametric test tested with num_samples = 5, num_samples = 10, num_samples =
|
// parametric test tested with num_samples = 5, num_samples = 10, num_samples =
|
||||||
// 8
|
// 8
|
||||||
TEST_CASE_METHOD(DataProcessorTestFixture, "Reorder all",
|
TEST_CASE_METHOD(DataProcessorTestFixture, "Reorder all",
|
||||||
"[.dataprocessor][.reorder]") {
|
"[dataprocessor][reorder]") {
|
||||||
// parameters: num_samples, expected_num_digital_bytes,
|
// parameters: num_samples, expected_num_digital_bytes,
|
||||||
// expected_digital_part_for_each_bit
|
// expected_digital_part_for_each_bit
|
||||||
auto parameters = GENERATE(
|
auto parameters = GENERATE(
|
||||||
@@ -219,7 +219,7 @@ TEST_CASE_METHOD(DataProcessorTestFixture, "Reorder all",
|
|||||||
|
|
||||||
TEST_CASE_METHOD(DataProcessorTestFixture,
|
TEST_CASE_METHOD(DataProcessorTestFixture,
|
||||||
"Reorder all and remove trailing bits",
|
"Reorder all and remove trailing bits",
|
||||||
"[.dataprocessor][.reorder]") {
|
"[dataprocessor][reorder]") {
|
||||||
|
|
||||||
// set number of samples for test fixture -> create data
|
// set number of samples for test fixture -> create data
|
||||||
const size_t num_random_offset_bytes = 3;
|
const size_t num_random_offset_bytes = 3;
|
||||||
@@ -261,7 +261,7 @@ TEST_CASE_METHOD(DataProcessorTestFixture,
|
|||||||
}
|
}
|
||||||
|
|
||||||
TEST_CASE_METHOD(DataProcessorTestFixture, "Arrange bitlist with reorder false",
|
TEST_CASE_METHOD(DataProcessorTestFixture, "Arrange bitlist with reorder false",
|
||||||
"[.dataprocessor][.retrievebitlist]") {
|
"[dataprocessor][retrievebitlist]") {
|
||||||
// parameters: num_samples, bitlist, expected_num_digital_bytes,
|
// parameters: num_samples, bitlist, expected_num_digital_bytes,
|
||||||
// expected_digital_part
|
// expected_digital_part
|
||||||
auto parameters = GENERATE(
|
auto parameters = GENERATE(
|
||||||
@@ -315,7 +315,7 @@ TEST_CASE_METHOD(DataProcessorTestFixture, "Arrange bitlist with reorder false",
|
|||||||
}
|
}
|
||||||
|
|
||||||
TEST_CASE_METHOD(DataProcessorTestFixture, "Arrange bitlist with reorder true",
|
TEST_CASE_METHOD(DataProcessorTestFixture, "Arrange bitlist with reorder true",
|
||||||
"[.dataprocessor][.retrievebitlist]") {
|
"[dataprocessor][retrievebitlist]") {
|
||||||
// parameters: num_samples, bitlist, expected_num_digital_bytes,
|
// parameters: num_samples, bitlist, expected_num_digital_bytes,
|
||||||
// expected_digital_part
|
// expected_digital_part
|
||||||
auto parameters = GENERATE(
|
auto parameters = GENERATE(
|
||||||
@@ -369,7 +369,7 @@ TEST_CASE_METHOD(DataProcessorTestFixture, "Arrange bitlist with reorder true",
|
|||||||
|
|
||||||
TEST_CASE_METHOD(DataProcessorTestFixture,
|
TEST_CASE_METHOD(DataProcessorTestFixture,
|
||||||
"Arrange bitlist and remove trailing bits",
|
"Arrange bitlist and remove trailing bits",
|
||||||
"[.dataprocessor][.retrievebitlist]") {
|
"[dataprocessor][retrievebitlist]") {
|
||||||
|
|
||||||
size_t num_random_offset_bytes = 3;
|
size_t num_random_offset_bytes = 3;
|
||||||
std::vector<int> bitlist{1, 4, 5};
|
std::vector<int> bitlist{1, 4, 5};
|
||||||
|
|||||||
@@ -8,7 +8,7 @@
|
|||||||
|
|
||||||
namespace sls {
|
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 sleep_duration = std::chrono::seconds(1);
|
||||||
auto t = Timer();
|
auto t = Timer();
|
||||||
std::this_thread::sleep_for(sleep_duration);
|
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));
|
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 sleep_duration = std::chrono::milliseconds(1300);
|
||||||
auto t = Timer();
|
auto t = Timer();
|
||||||
std::this_thread::sleep_for(sleep_duration);
|
std::this_thread::sleep_for(sleep_duration);
|
||||||
|
|||||||
@@ -5,7 +5,7 @@
|
|||||||
|
|
||||||
namespace sls {
|
namespace sls {
|
||||||
|
|
||||||
TEST_CASE("check if version is semantic", "[.version]") {
|
TEST_CASE("check if version is semantic", "[version]") {
|
||||||
|
|
||||||
auto [version_string, has_semantic_version] =
|
auto [version_string, has_semantic_version] =
|
||||||
GENERATE(std::make_tuple("developer 0x250512", false),
|
GENERATE(std::make_tuple("developer 0x250512", false),
|
||||||
|
|||||||
@@ -60,7 +60,3 @@ catch_discover_tests(tests)
|
|||||||
configure_file(scripts/test_simulators.py ${CMAKE_BINARY_DIR}/bin/test_simulators.py COPYONLY)
|
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/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/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)
|
|
||||||
configure_file(scripts/test_commands.py ${CMAKE_BINARY_DIR}/bin/test_commands.py COPYONLY)
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,100 +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 and test for freeing shm and accessing it from python.
|
|
||||||
Run this using: pytest -s test_free.py
|
|
||||||
'''
|
|
||||||
|
|
||||||
from time import time
|
|
||||||
import pytest, sys, time
|
|
||||||
|
|
||||||
from slsdet import Detector, Ctb, freeSharedMemory
|
|
||||||
from slsdet.defines import DEFAULT_TCP_RX_PORTNO
|
|
||||||
from utils_for_test import (
|
|
||||||
Log,
|
|
||||||
LogLevel,
|
|
||||||
cleanup,
|
|
||||||
startDetectorVirtualServer,
|
|
||||||
startProcessInBackground,
|
|
||||||
loadConfig,
|
|
||||||
loadBasicSettings
|
|
||||||
)
|
|
||||||
|
|
||||||
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)
|
|
||||||
|
|
||||||
'''
|
|
||||||
scope = module =>Once per test file/module
|
|
||||||
to share expensive setup like startDetectorVirtualServer
|
|
||||||
'''
|
|
||||||
@pytest.fixture(scope="module")
|
|
||||||
def det_config():
|
|
||||||
return {
|
|
||||||
"name": "ctb",
|
|
||||||
"num_mods": 1
|
|
||||||
}
|
|
||||||
|
|
||||||
# autouse is false to pass explictly
|
|
||||||
@pytest.fixture(scope="module", autouse=False)
|
|
||||||
def setup_simulator(det_config):
|
|
||||||
"""Fixture to start the detector server once and clean up at the end."""
|
|
||||||
fp = sys.stdout
|
|
||||||
|
|
||||||
cleanup(fp)
|
|
||||||
# server
|
|
||||||
startDetectorVirtualServer(det_config["name"], det_config["num_mods"], fp)
|
|
||||||
# receiver
|
|
||||||
startReceiver(det_config["num_mods"], fp)
|
|
||||||
# config and basic settings
|
|
||||||
d = loadConfig(name=det_config["name"], rx_hostname="localhost", settingsdir="", fp=fp, num_mods=det_config["num_mods"])
|
|
||||||
loadBasicSettings(name=det_config["name"], d=d, fp=fp)
|
|
||||||
|
|
||||||
yield d # tests run here
|
|
||||||
|
|
||||||
cleanup(fp)
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def test_parameters_file(setup_simulator):
|
|
||||||
d = setup_simulator
|
|
||||||
Log(LogLevel.INFOBLUE, f'\nRunning test_parameters_file')
|
|
||||||
|
|
||||||
assert isinstance(d, Detector)
|
|
||||||
|
|
||||||
with open("/tmp/params.det", "w") as f:
|
|
||||||
f.write("frames 2\n")
|
|
||||||
f.write("fwrite 1\n")
|
|
||||||
|
|
||||||
# this should not throw
|
|
||||||
d.parameters = "/tmp/params.det"
|
|
||||||
|
|
||||||
assert d.frames == 2
|
|
||||||
assert d.fwrite == 1
|
|
||||||
|
|
||||||
Log(LogLevel.INFOGREEN, f"✅ Test passed. Command: parameters")
|
|
||||||
|
|
||||||
|
|
||||||
def test_include_file(setup_simulator):
|
|
||||||
d = setup_simulator
|
|
||||||
Log(LogLevel.INFOBLUE, f'\test_include_file test_parameters_file')
|
|
||||||
|
|
||||||
assert isinstance(d, Detector)
|
|
||||||
|
|
||||||
with open("/tmp/params.det", "w") as f:
|
|
||||||
f.write("frames 3\n")
|
|
||||||
f.write("fwrite 0\n")
|
|
||||||
|
|
||||||
# this should not throw
|
|
||||||
d.include = "/tmp/params.det"
|
|
||||||
|
|
||||||
assert d.frames == 3
|
|
||||||
assert d.fwrite == 0
|
|
||||||
|
|
||||||
Log(LogLevel.INFOGREEN, f"✅ Test passed. Command: include")
|
|
||||||
@@ -14,44 +14,43 @@ from utils_for_test import (
|
|||||||
Log,
|
Log,
|
||||||
LogLevel,
|
LogLevel,
|
||||||
RuntimeException,
|
RuntimeException,
|
||||||
checkIfProcessRunning,
|
|
||||||
killProcess,
|
|
||||||
cleanup,
|
cleanup,
|
||||||
cleanSharedmemory,
|
|
||||||
startProcessInBackground,
|
startProcessInBackground,
|
||||||
startProcessInBackgroundWithLogFile,
|
|
||||||
checkLogForErrors,
|
checkLogForErrors,
|
||||||
startDetectorVirtualServer,
|
startDetectorVirtualServer,
|
||||||
loadConfig,
|
loadConfig,
|
||||||
loadBasicSettings,
|
loadBasicSettings,
|
||||||
ParseArguments
|
ParseArguments,
|
||||||
|
build_dir,
|
||||||
|
optional_file
|
||||||
)
|
)
|
||||||
|
|
||||||
LOG_PREFIX_FNAME = '/tmp/slsFrameSynchronizer_test'
|
LOG_PREFIX_FNAME = '/tmp/slsFrameSynchronizer_test'
|
||||||
MAIN_LOG_FNAME = LOG_PREFIX_FNAME + '_log.txt'
|
MAIN_LOG_FNAME = LOG_PREFIX_FNAME + '_log.txt'
|
||||||
PULL_SOCKET_PREFIX_FNAME = LOG_PREFIX_FNAME + '_pull_socket_'
|
PULL_SOCKET_PREFIX_FNAME = LOG_PREFIX_FNAME + '_pull_socket_'
|
||||||
|
SYNCHRONIZER_SUFFIX_FNAME = LOG_PREFIX_FNAME + '_synchronizer.txt'
|
||||||
|
|
||||||
|
|
||||||
def startFrameSynchronizerPullSocket(name, fp):
|
def startFrameSynchronizerPullSocket(name, fp, quiet_mode=False):
|
||||||
fname = PULL_SOCKET_PREFIX_FNAME + name + '.txt'
|
|
||||||
cmd = ['python', '-u', 'frameSynchronizerPullSocket.py']
|
cmd = ['python', '-u', 'frameSynchronizerPullSocket.py']
|
||||||
startProcessInBackgroundWithLogFile(cmd, fp, fname)
|
fname = PULL_SOCKET_PREFIX_FNAME + name + '.txt'
|
||||||
|
startProcessInBackground(cmd, fp, fname, quiet_mode)
|
||||||
time.sleep(1)
|
time.sleep(1)
|
||||||
checkLogForErrors(fp, fname)
|
checkLogForErrors(fp, fname)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def startFrameSynchronizer(num_mods, fp):
|
def startFrameSynchronizer(num_mods, fp, quiet_mode=False):
|
||||||
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
|
# in 10.0.0
|
||||||
#cmd = ['slsFrameSynchronizer', '-p', str(DEFAULT_TCP_RX_PORTNO), '-n', str(num_mods)]
|
#cmd = ['slsFrameSynchronizer', '-p', str(DEFAULT_TCP_RX_PORTNO), '-n', str(num_mods)]
|
||||||
startProcessInBackground(cmd, fp)
|
fname = SYNCHRONIZER_SUFFIX_FNAME
|
||||||
|
startProcessInBackground(cmd, fp, fname, quiet_mode)
|
||||||
time.sleep(1)
|
time.sleep(1)
|
||||||
|
|
||||||
|
|
||||||
def acquire(fp, det):
|
def acquire(fp, det):
|
||||||
Log(LogLevel.INFO, 'Acquiring')
|
Log(LogLevel.INFO, 'Acquiring', fp, True)
|
||||||
Log(LogLevel.INFO, 'Acquiring', fp)
|
|
||||||
det.acquire()
|
det.acquire()
|
||||||
|
|
||||||
|
|
||||||
@@ -60,14 +59,12 @@ def testFramesCaught(name, det, num_frames):
|
|||||||
if fnum != num_frames:
|
if fnum != num_frames:
|
||||||
raise RuntimeException(f"{name} caught only {fnum}. Expected {num_frames}")
|
raise RuntimeException(f"{name} caught only {fnum}. Expected {num_frames}")
|
||||||
|
|
||||||
Log(LogLevel.INFOGREEN, f'Frames caught test passed for {name}')
|
Log(LogLevel.INFOGREEN, f'Frames caught test passed for {name}', fp, True)
|
||||||
Log(LogLevel.INFOGREEN, f'Frames caught test passed for {name}', fp)
|
|
||||||
|
|
||||||
|
|
||||||
def testZmqHeadetTypeCount(name, det, num_mods, num_frames, fp):
|
def testZmqHeadetTypeCount(name, det, num_mods, num_frames, fp):
|
||||||
|
|
||||||
Log(LogLevel.INFO, f"Testing Zmq Header type count for {name}")
|
Log(LogLevel.INFO, f"Testing Zmq Header type count for {name}", fp, True)
|
||||||
Log(LogLevel.INFO, f"Testing Zmq Header type count for {name}", fp)
|
|
||||||
htype_counts = {
|
htype_counts = {
|
||||||
"header": 0,
|
"header": 0,
|
||||||
"series_end": 0,
|
"series_end": 0,
|
||||||
@@ -89,7 +86,6 @@ def testZmqHeadetTypeCount(name, det, num_mods, num_frames, fp):
|
|||||||
htype_counts[htype] += 1
|
htype_counts[htype] += 1
|
||||||
except json.JSONDecodeError:
|
except json.JSONDecodeError:
|
||||||
continue
|
continue
|
||||||
|
|
||||||
# test if file contents matches expected counts
|
# test if file contents matches expected counts
|
||||||
num_ports_per_module = 1 if name == "gotthard2" else det.numinterfaces
|
num_ports_per_module = 1 if name == "gotthard2" else det.numinterfaces
|
||||||
total_num_frame_parts = num_ports_per_module * num_mods * num_frames
|
total_num_frame_parts = num_ports_per_module * num_mods * num_frames
|
||||||
@@ -100,19 +96,17 @@ def testZmqHeadetTypeCount(name, det, num_mods, num_frames, fp):
|
|||||||
except Exception as e:
|
except Exception as e:
|
||||||
raise RuntimeException(f'Failed to get zmq header count type. Error:{str(e)}') from e
|
raise RuntimeException(f'Failed to get zmq header count type. Error:{str(e)}') from e
|
||||||
|
|
||||||
Log(LogLevel.INFOGREEN, f"Zmq Header type count test passed for {name}")
|
Log(LogLevel.INFOGREEN, f"Zmq Header type count test passed for {name}", fp, True)
|
||||||
Log(LogLevel.INFOGREEN, f"Zmq Header type count test passed for {name}", fp)
|
|
||||||
|
|
||||||
|
|
||||||
def startTestsForAll(args, fp):
|
def startTestsForAll(args, fp):
|
||||||
for server in args.servers:
|
for server in args.servers:
|
||||||
try:
|
try:
|
||||||
Log(LogLevel.INFOBLUE, f'Synchronizer Tests for {server}')
|
Log(LogLevel.INFOBLUE, f'Synchronizer Tests for {server}', fp, True)
|
||||||
Log(LogLevel.INFOBLUE, f'Synchronizer Tests for {server}', fp)
|
|
||||||
cleanup(fp)
|
cleanup(fp)
|
||||||
startDetectorVirtualServer(server, args.num_mods, fp)
|
startDetectorVirtualServer(server, args.num_mods, fp, args.quiet)
|
||||||
startFrameSynchronizerPullSocket(server, fp)
|
startFrameSynchronizerPullSocket(server, fp, args.quiet)
|
||||||
startFrameSynchronizer(args.num_mods, fp)
|
startFrameSynchronizer(args.num_mods, f, args.quiet_modep)
|
||||||
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)
|
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)
|
loadBasicSettings(name=server, d=d, fp=fp)
|
||||||
acquire(fp, d)
|
acquire(fp, d)
|
||||||
@@ -128,6 +122,9 @@ def startTestsForAll(args, fp):
|
|||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
args = ParseArguments(description='Automated tests to test frame synchronizer', default_num_mods=2)
|
args = ParseArguments(description='Automated tests to test frame synchronizer', default_num_mods=2)
|
||||||
|
|
||||||
|
if args.no_log_file:
|
||||||
|
raise RuntimeException("Cannot run frame synchronizer test without files")
|
||||||
|
|
||||||
Log(LogLevel.INFOBLUE, '\nLog File: ' + MAIN_LOG_FNAME + '\n')
|
Log(LogLevel.INFOBLUE, '\nLog File: ' + MAIN_LOG_FNAME + '\n')
|
||||||
|
|
||||||
with open(MAIN_LOG_FNAME, 'w') as fp:
|
with open(MAIN_LOG_FNAME, 'w') as fp:
|
||||||
|
|||||||
@@ -1,82 +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,
|
|
||||||
startReceiver,
|
|
||||||
startDetectorVirtualServer,
|
|
||||||
connectToVirtualServers,
|
|
||||||
loadBasicSettings,
|
|
||||||
loadConfig,
|
|
||||||
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 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 = loadConfig(name=server, log_file_fp = fp, num_mods=nmods, num_frames=5, 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.')
|
|
||||||
|
|
||||||
|
|
||||||
@@ -2,91 +2,98 @@
|
|||||||
# Copyright (C) 2021 Contributors to the SLS Detector Package
|
# 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.
|
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 --tests <testtag> to run all tests with that specific tag.
|
||||||
|
|
||||||
|
Pass --servers <server1> <server2> ... to run tests only for specific detector servers.
|
||||||
'''
|
'''
|
||||||
import argparse
|
import argparse
|
||||||
import sys, subprocess, time, traceback
|
import sys, subprocess, time, traceback
|
||||||
|
from contextlib import contextmanager
|
||||||
|
|
||||||
from slsdet import Detector
|
from slsdet import Detector
|
||||||
from slsdet.defines import DEFAULT_TCP_RX_PORTNO
|
from slsdet.defines import DEFAULT_TCP_RX_PORTNO
|
||||||
|
|
||||||
|
|
||||||
from utils_for_test import (
|
from utils_for_test import (
|
||||||
Log,
|
Log,
|
||||||
LogLevel,
|
LogLevel,
|
||||||
RuntimeException,
|
RuntimeException,
|
||||||
checkIfProcessRunning,
|
|
||||||
killProcess,
|
|
||||||
cleanup,
|
cleanup,
|
||||||
cleanSharedmemory,
|
runProcess,
|
||||||
startProcessInBackground,
|
startReceiver,
|
||||||
runProcessWithLogFile,
|
runProcess,
|
||||||
startDetectorVirtualServer,
|
startDetectorVirtualServer,
|
||||||
loadConfig,
|
loadConfig,
|
||||||
loadBasicSettings,
|
loadBasicSettings,
|
||||||
ParseArguments
|
ParseArguments,
|
||||||
|
build_dir,
|
||||||
|
optional_file
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
LOG_PREFIX_FNAME = '/tmp/slsDetectorPackage_virtual_test'
|
LOG_PREFIX_FNAME = '/tmp/slsDetectorPackage_virtual_test'
|
||||||
MAIN_LOG_FNAME = LOG_PREFIX_FNAME + '_log.txt'
|
MAIN_LOG_FNAME = LOG_PREFIX_FNAME + '_log.txt'
|
||||||
GENERAL_TESTS_LOG_FNAME = LOG_PREFIX_FNAME + '_results_general.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):
|
def startGeneralTests(fp):
|
||||||
fname = GENERAL_TESTS_LOG_FNAME
|
fname = GENERAL_TESTS_LOG_FNAME
|
||||||
cmd = ['tests', '--abort', '-s']
|
cmd = [str(build_dir / 'tests'), '--abort', '-s']
|
||||||
try:
|
try:
|
||||||
cleanup(fp)
|
cleanup(fp)
|
||||||
runProcessWithLogFile('General Tests', cmd, fp, fname)
|
runProcess('General Tests', cmd, fp, fname)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
raise RuntimeException(f'General tests failed.') from e
|
raise RuntimeException(f'General tests failed.') from e
|
||||||
|
|
||||||
|
def startTestsForAll(args, fp):
|
||||||
|
|
||||||
|
fname_template = LOG_PREFIX_FNAME + "_{}_{}.txt"
|
||||||
|
|
||||||
|
|
||||||
|
test_filter = args.tests
|
||||||
|
cmd = [str(build_dir / 'tests'), '--abort', test_filter, '-s']
|
||||||
|
|
||||||
|
num_mods = args.num_mods
|
||||||
|
|
||||||
def startCmdTestsForAll(args, fp):
|
|
||||||
for server in args.servers:
|
for server in args.servers:
|
||||||
try:
|
for curMods in range(1, num_mods + 1):
|
||||||
num_mods = 2 if server == 'eiger' else 1
|
if curMods == 2 and server in ['ctb', 'xilinx_ctb']:
|
||||||
fname = CMD_TEST_LOG_PREFIX_FNAME + server + '.txt'
|
continue
|
||||||
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}')
|
if server == "eiger":
|
||||||
|
curMods *= 2 # 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}, {ninterfaces} interfaces, {curMods} modules', fp, True)
|
||||||
cleanup(fp)
|
cleanup(fp)
|
||||||
startDetectorVirtualServer(name=server, num_mods=num_mods, fp=fp)
|
startDetectorVirtualServer(name=server, num_mods=curMods, fp=fp, no_log_file=args.no_log_file, quiet_mode=args.quiet)
|
||||||
startReceiver(num_mods, fp)
|
startReceiver(curMods, fp, args.no_log_file, args.quiet)
|
||||||
d = loadConfig(name=server, rx_hostname=args.rx_hostname, settingsdir=args.settingspath, log_file_fp=fp, num_mods=num_mods)
|
d = loadConfig(name=server, rx_hostname=args.rx_hostname, settingsdir=args.settingspath, log_file_fp=fp, num_mods=curMods, num_interfaces=ninterfaces)
|
||||||
loadBasicSettings(name=server, d=d, fp=fp)
|
loadBasicSettings(name=server, d=d, fp=fp)
|
||||||
runProcessWithLogFile('Cmd Tests (' + args.markers + ') for ' + server, cmd, fp, fname)
|
runProcess('Tests (' + args.tests + ') for ' + server, cmd, fp, fname, args.quiet)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
raise RuntimeException(f'Cmd Tests failed for {server}.') from 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))
|
Log(LogLevel.INFOGREEN, 'Passed all tests for all detectors \n' + str(args.servers))
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
args = ParseArguments(description='Automated tests with the virtual detector servers', default_num_mods=1, markers=True, general_tests_option=True)
|
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 > 1:
|
|
||||||
raise RuntimeException(f'Cannot support multiple modules at the moment (except Eiger).')
|
|
||||||
|
|
||||||
Log(LogLevel.INFOBLUE, '\nLog File: ' + MAIN_LOG_FNAME + '\n')
|
with optional_file(MAIN_LOG_FNAME if not args.no_log_file else None, 'w', args.quiet) as fp:
|
||||||
|
|
||||||
with open(MAIN_LOG_FNAME, 'w') as fp:
|
|
||||||
try:
|
try:
|
||||||
if args.general_tests:
|
if args.general_tests:
|
||||||
startGeneralTests(fp)
|
startGeneralTests(fp)
|
||||||
startCmdTestsForAll(args, fp)
|
startTestsForAll(args, fp)
|
||||||
cleanup(fp)
|
cleanup(fp)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
with open(MAIN_LOG_FNAME, 'a') as fp_error:
|
traceback.print_exc(file=fp)
|
||||||
traceback.print_exc(file=fp_error)
|
|
||||||
cleanup(fp)
|
cleanup(fp)
|
||||||
Log(LogLevel.ERROR, f'Tests Failed.')
|
Log(LogLevel.ERROR, f'Tests Failed.')
|
||||||
|
raise e
|
||||||
|
|
||||||
|
|||||||
@@ -3,19 +3,24 @@
|
|||||||
'''
|
'''
|
||||||
This file is used for common utils used for integration tests between simulators and receivers.
|
This file is used for common utils used for integration tests between simulators and receivers.
|
||||||
'''
|
'''
|
||||||
|
import os
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
import sys, subprocess, time, argparse
|
import sys, subprocess, time, argparse
|
||||||
from enum import Enum
|
from enum import Enum
|
||||||
from colorama import Fore, Style, init
|
from colorama import Fore, Style, init
|
||||||
from datetime import timedelta
|
from datetime import timedelta
|
||||||
|
from contextlib import contextmanager
|
||||||
|
|
||||||
from slsdet import Detector, Ctb, detectorSettings, burstMode
|
from slsdet import Detector, Ctb, detectorSettings, burstMode
|
||||||
from slsdet.defines import DEFAULT_TCP_RX_PORTNO, DEFAULT_UDP_DST_PORTNO
|
from slsdet.defines import DEFAULT_TCP_RX_PORTNO, DEFAULT_UDP_DST_PORTNO
|
||||||
SERVER_START_PORTNO=1900
|
SERVER_START_PORTNO=1900
|
||||||
|
|
||||||
|
LOG_PREFIX_FNAME = "/tmp/slsDetectorPackage_"
|
||||||
|
|
||||||
init(autoreset=True)
|
init(autoreset=True)
|
||||||
|
|
||||||
|
build_dir = Path(__file__).resolve().parents[2] / "build" / "bin"
|
||||||
|
|
||||||
class LogLevel(Enum):
|
class LogLevel(Enum):
|
||||||
INFO = 0
|
INFO = 0
|
||||||
INFORED = 1
|
INFORED = 1
|
||||||
@@ -44,10 +49,13 @@ LOG_COLORS = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
def Log(level: LogLevel, message: str, stream=sys.stdout):
|
def Log(level: LogLevel, message: str, stream=sys.stdout, both=False):
|
||||||
color = LOG_COLORS.get(level, Fore.WHITE)
|
color = LOG_COLORS.get(level, Fore.WHITE)
|
||||||
label = LOG_LABELS.get(level, "")
|
label = LOG_LABELS.get(level, "")
|
||||||
print(f"{color}{label}{message}{Style.RESET_ALL}", file=stream, flush=True)
|
print(f"{color}{label}{message}{Style.RESET_ALL}", file=stream, flush=True)
|
||||||
|
if both and stream != sys.stdout:
|
||||||
|
print(f"{color}{label}{message}{Style.RESET_ALL}", file=sys.stdout, flush=True)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
class RuntimeException (Exception):
|
class RuntimeException (Exception):
|
||||||
@@ -56,9 +64,27 @@ class RuntimeException (Exception):
|
|||||||
super().__init__(message)
|
super().__init__(message)
|
||||||
|
|
||||||
|
|
||||||
|
@contextmanager
|
||||||
|
def optional_file(file_path=None, mode='w', quiet_mode=False):
|
||||||
|
if file_path:
|
||||||
|
f = open(file_path, mode)
|
||||||
|
try:
|
||||||
|
yield f
|
||||||
|
finally:
|
||||||
|
f.close()
|
||||||
|
else:
|
||||||
|
if quiet_mode:
|
||||||
|
f = open(os.devnull, mode)
|
||||||
|
try:
|
||||||
|
yield f
|
||||||
|
finally:
|
||||||
|
f.close()
|
||||||
|
else:
|
||||||
|
yield sys.stdout
|
||||||
|
|
||||||
|
|
||||||
def checkIfProcessRunning(processName):
|
def checkIfProcessRunning(processName):
|
||||||
cmd = f"pgrep -f {processName}"
|
res = subprocess.getoutput(f"pgrep -f {processName}")
|
||||||
res = subprocess.getoutput(cmd)
|
|
||||||
return res.strip().splitlines()
|
return res.strip().splitlines()
|
||||||
|
|
||||||
|
|
||||||
@@ -80,18 +106,13 @@ def killProcess(name, fp):
|
|||||||
def cleanSharedmemory(fp):
|
def cleanSharedmemory(fp):
|
||||||
Log(LogLevel.INFO, 'Cleaning up shared memory', fp)
|
Log(LogLevel.INFO, 'Cleaning up shared memory', fp)
|
||||||
try:
|
try:
|
||||||
p = subprocess.run(['sls_detector_get', 'free'], stdout=fp, stderr=fp, check = False)
|
p = subprocess.run([build_dir / 'sls_detector_get', 'free'], stdout=fp, stderr=fp)
|
||||||
except FileNotFoundError:
|
|
||||||
# Binary not available (e.g. on CI) → ignore
|
|
||||||
Log(LogLevel.INFO, 'sls_detector_get not found, skipping shared memory cleanup', fp)
|
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
# Any other cleanup failure should NEVER fail tests
|
raise RuntimeException(f'Could not free shared memory: {str(e)}')
|
||||||
Log(LogLevel.WARN, f'Ignoring shared memory cleanup error: {e}', fp)
|
|
||||||
|
|
||||||
|
|
||||||
def cleanup(fp):
|
def cleanup(fp):
|
||||||
Log(LogLevel.INFO, 'Cleaning up')
|
Log(LogLevel.INFO, 'Cleaning up', fp, True)
|
||||||
Log(LogLevel.INFO, 'Cleaning up', fp)
|
|
||||||
killProcess('DetectorServer_virtual', fp)
|
killProcess('DetectorServer_virtual', fp)
|
||||||
killProcess('slsReceiver', fp)
|
killProcess('slsReceiver', fp)
|
||||||
killProcess('slsMultiReceiver', fp)
|
killProcess('slsMultiReceiver', fp)
|
||||||
@@ -100,20 +121,15 @@ def cleanup(fp):
|
|||||||
cleanSharedmemory(fp)
|
cleanSharedmemory(fp)
|
||||||
|
|
||||||
|
|
||||||
def startProcessInBackground(cmd, fp):
|
def startProcessInBackground(cmd, fp, log_file_name: str, quiet_mode=False):
|
||||||
Log(LogLevel.INFO, 'Starting up ' + ' '.join(cmd))
|
info_text = 'Starting up ' + ' '.join(cmd)
|
||||||
Log(LogLevel.INFO, 'Starting up ' + ' '.join(cmd), fp)
|
if log_file_name:
|
||||||
try:
|
info_text += '. Log: ' + log_file_name
|
||||||
p = subprocess.Popen(cmd, stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL, restore_signals=False)
|
|
||||||
except Exception as e:
|
|
||||||
raise RuntimeException(f'Failed to start {cmd}:{str(e)}') from e
|
|
||||||
|
|
||||||
|
Log(LogLevel.INFO, f'{info_text}', fp, True)
|
||||||
|
|
||||||
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)
|
|
||||||
try:
|
try:
|
||||||
with open(log_file_name, 'w') as log_fp:
|
with optional_file(log_file_name, 'w', quiet_mode) as log_fp:
|
||||||
subprocess.Popen(cmd, stdout=log_fp, stderr=log_fp, text=True)
|
subprocess.Popen(cmd, stdout=log_fp, stderr=log_fp, text=True)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
raise RuntimeException(f'Failed to start {cmd}:{str(e)}') from e
|
raise RuntimeException(f'Failed to start {cmd}:{str(e)}') from e
|
||||||
@@ -124,8 +140,7 @@ def checkLogForErrors(fp, log_file_path: str):
|
|||||||
with open(log_file_path, 'r') as log_file:
|
with open(log_file_path, 'r') as log_file:
|
||||||
for line in log_file:
|
for line in log_file:
|
||||||
if 'Error' in line:
|
if 'Error' in line:
|
||||||
Log(LogLevel.ERROR, f"Error found in log: {line.strip()}")
|
Log(LogLevel.ERROR, f"Error found in log: {line.strip()}", fp, True)
|
||||||
Log(LogLevel.ERROR, f"Error found in log: {line.strip()}", fp)
|
|
||||||
raise RuntimeException("Error found in log file")
|
raise RuntimeException("Error found in log file")
|
||||||
except FileNotFoundError:
|
except FileNotFoundError:
|
||||||
print(f"Log file not found: {log_file_path}")
|
print(f"Log file not found: {log_file_path}")
|
||||||
@@ -135,33 +150,92 @@ def checkLogForErrors(fp, log_file_path: str):
|
|||||||
raise
|
raise
|
||||||
|
|
||||||
|
|
||||||
def runProcessWithLogFile(name, cmd, fp, log_file_name):
|
def checkLogForErrorsOrSummary(fp, lines, source_name=""):
|
||||||
Log(LogLevel.INFOBLUE, 'Running ' + name + '. Log: ' + log_file_name)
|
failed = False # if it found "failed" or "FAILED" in file
|
||||||
Log(LogLevel.INFOBLUE, 'Running ' + name + '. Log: ' + log_file_name, fp)
|
failed_msg = ""
|
||||||
Log(LogLevel.INFOBLUE, 'Cmd: ' + ' '.join(cmd), fp)
|
printing_error = False # print every line in file after failure
|
||||||
|
printing_summary = False # print summary if no failure
|
||||||
|
|
||||||
|
|
||||||
|
for line in lines:
|
||||||
|
line_stripped = line.rstrip()
|
||||||
|
|
||||||
|
# Detect failure (case-insensitive)
|
||||||
|
if not failed and (": FAILED:" in line or " failed\nassertions" in line):
|
||||||
|
failed = True
|
||||||
|
failed_msg = line_stripped
|
||||||
|
printing_error = True
|
||||||
|
Log(LogLevel.ERROR, line_stripped, fp)
|
||||||
|
if source_name:
|
||||||
|
Log(LogLevel.ERROR, f"Error log from file: {source_name}")
|
||||||
|
Log(LogLevel.ERROR, "="*79)
|
||||||
|
|
||||||
|
# After failure, log everything as ERROR
|
||||||
|
if printing_error:
|
||||||
|
print(f"{line_stripped}")
|
||||||
|
continue
|
||||||
|
|
||||||
|
# Summary delimiter
|
||||||
|
if line_stripped.startswith("====="):
|
||||||
|
printing_summary = True
|
||||||
|
|
||||||
|
# No failure - print summary lines
|
||||||
|
if printing_summary:
|
||||||
|
print(f"{line_stripped}")
|
||||||
|
|
||||||
|
|
||||||
|
if failed:
|
||||||
|
Log(LogLevel.ERROR, "="*79)
|
||||||
|
raise RuntimeException(f'Test failed: {failed_msg}')
|
||||||
|
else:
|
||||||
|
print("="*79)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
def runProcess(name, cmd, fp, log_file_name = None, quiet_mode=False):
|
||||||
|
|
||||||
|
info_text = 'Running ' + name + '.'
|
||||||
|
if log_file_name:
|
||||||
|
info_text += ' Log: ' + log_file_name
|
||||||
|
Log(LogLevel.INFOBLUE, info_text, fp, True)
|
||||||
|
Log(LogLevel.INFOBLUE, 'Cmd: ' + ' '.join(cmd), fp, True)
|
||||||
|
|
||||||
|
error_log = None
|
||||||
|
|
||||||
try:
|
try:
|
||||||
with open(log_file_name, 'w') as log_fp:
|
if log_file_name:
|
||||||
|
with optional_file(log_file_name, 'w', quiet_mode) as log_fp:
|
||||||
subprocess.run(cmd, stdout=log_fp, stderr=log_fp, check=True, text=True)
|
subprocess.run(cmd, stdout=log_fp, stderr=log_fp, check=True, text=True)
|
||||||
|
else:
|
||||||
|
capture = subprocess.run(cmd, check=True, text=True, capture_output=True)
|
||||||
|
captured_log = capture.stdout.splitlines()
|
||||||
|
|
||||||
except subprocess.CalledProcessError as e:
|
except subprocess.CalledProcessError as e:
|
||||||
|
print("error: ", str(e))
|
||||||
|
captured_log = e.stdout.splitlines()
|
||||||
pass
|
pass
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
|
print("something else failed")
|
||||||
Log(LogLevel.ERROR, f'Failed to run {name}:{str(e)}', fp)
|
Log(LogLevel.ERROR, f'Failed to run {name}:{str(e)}', fp)
|
||||||
raise RuntimeException(f'Failed to run {name}:{str(e)}')
|
raise RuntimeException(f'Failed to run {name}:{str(e)}')
|
||||||
|
|
||||||
with open (log_file_name, 'r') as f:
|
if log_file_name:
|
||||||
for line in f:
|
with optional_file(log_file_name, 'r') as log_fp:
|
||||||
if "FAILED" in line:
|
checkLogForErrorsOrSummary(fp, log_fp, log_file_name)
|
||||||
raise RuntimeException(f'{line}')
|
else:
|
||||||
|
checkLogForErrorsOrSummary(fp, captured_log)
|
||||||
|
|
||||||
Log(LogLevel.INFOGREEN, name + ' successful!\n')
|
Log(LogLevel.INFOGREEN, name + ' successful!\n', fp, True)
|
||||||
Log(LogLevel.INFOGREEN, name + ' successful!\n', fp)
|
|
||||||
|
|
||||||
|
|
||||||
def startDetectorVirtualServer(name :str, num_mods, fp):
|
def startDetectorVirtualServer(name :str, num_mods, fp, no_log_file = False, quiet_mode=False):
|
||||||
for i in range(num_mods):
|
for i in range(num_mods):
|
||||||
port_no = SERVER_START_PORTNO + (i * 2)
|
port_no = SERVER_START_PORTNO + (i * 2)
|
||||||
cmd = [name + 'DetectorServer_virtual', '-p', str(port_no)]
|
cmd = [str(build_dir / (name + 'DetectorServer_virtual')), '-p', str(port_no)]
|
||||||
startProcessInBackgroundWithLogFile(cmd, fp, "/tmp/virtual_det_" + name + "_" + str(i) + ".txt")
|
fname = LOG_PREFIX_FNAME + "virtual_det_" + name + "_" + str(SERVER_START_PORTNO) + ".txt"
|
||||||
|
if no_log_file:
|
||||||
|
fname = None
|
||||||
|
startProcessInBackground(cmd, fp, fname, quiet_mode)
|
||||||
match name:
|
match name:
|
||||||
case 'jungfrau':
|
case 'jungfrau':
|
||||||
time.sleep(7)
|
time.sleep(7)
|
||||||
@@ -196,20 +270,23 @@ def connectToVirtualServers(name, num_mods, ctb_object=False):
|
|||||||
|
|
||||||
return d
|
return d
|
||||||
|
|
||||||
def startReceiver(num_mods, fp):
|
def startReceiver(num_mods, fp, no_log_file = False, quiet_mode=False):
|
||||||
if num_mods == 1:
|
if num_mods == 1:
|
||||||
cmd = ['slsReceiver']
|
cmd = [str(build_dir / 'slsReceiver')]
|
||||||
|
fname = LOG_PREFIX_FNAME + "slsReceiver.txt"
|
||||||
else:
|
else:
|
||||||
cmd = ['slsMultiReceiver', str(DEFAULT_TCP_RX_PORTNO), str(num_mods)]
|
cmd = [str(build_dir / 'slsMultiReceiver'), str(DEFAULT_TCP_RX_PORTNO), str(num_mods)]
|
||||||
|
fname = LOG_PREFIX_FNAME + "slsMultiReceiver.txt"
|
||||||
# in 10.0.0
|
# in 10.0.0
|
||||||
#cmd = ['slsMultiReceiver', '-p', str(DEFAULT_TCP_RX_PORTNO), '-n', str(num_mods)]
|
#cmd = ['slsMultiReceiver', '-p', str(DEFAULT_TCP_RX_PORTNO), '-n', str(num_mods)]
|
||||||
startProcessInBackground(cmd, fp)
|
|
||||||
|
if no_log_file:
|
||||||
|
fname = None
|
||||||
|
startProcessInBackground(cmd, fp, fname, quiet_mode)
|
||||||
time.sleep(1)
|
time.sleep(1)
|
||||||
|
|
||||||
|
|
||||||
def loadConfig(name, rx_hostname = 'localhost', settingsdir = None, log_file_fp = None, num_mods = 1, num_frames = 1, num_interfaces = 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', log_file_fp, True)
|
||||||
Log(LogLevel.INFO, 'Loading config', log_file_fp)
|
|
||||||
try:
|
try:
|
||||||
d = connectToVirtualServers(name, num_mods)
|
d = connectToVirtualServers(name, num_mods)
|
||||||
|
|
||||||
@@ -217,17 +294,15 @@ def loadConfig(name, rx_hostname = 'localhost', settingsdir = None, log_file_fp
|
|||||||
d.numinterfaces = num_interfaces
|
d.numinterfaces = num_interfaces
|
||||||
|
|
||||||
d.udp_dstport = DEFAULT_UDP_DST_PORTNO
|
d.udp_dstport = DEFAULT_UDP_DST_PORTNO
|
||||||
if name == 'eiger' or name == 'jungfrau' or name == 'moench':
|
if name == 'eiger' or num_interfaces == 2:
|
||||||
d.udp_dstport2 = DEFAULT_UDP_DST_PORTNO + 1
|
d.udp_dstport2 = DEFAULT_UDP_DST_PORTNO + 1
|
||||||
|
|
||||||
d.rx_hostname = rx_hostname
|
d.rx_hostname = rx_hostname
|
||||||
|
|
||||||
d.udp_dstip = 'auto'
|
d.udp_dstip = 'auto'
|
||||||
|
|
||||||
if name != "eiger":
|
if name != "eiger":
|
||||||
d.udp_srcip = 'auto'
|
d.udp_srcip = 'auto'
|
||||||
|
|
||||||
if name == "jungfrau" or name == "moench":
|
if num_interfaces == 2:
|
||||||
d.udp_dstip2 = 'auto'
|
d.udp_dstip2 = 'auto'
|
||||||
|
|
||||||
if name == "jungfrau" or name == "moench" or name == "xilinx_ctb":
|
if name == "jungfrau" or name == "moench" or name == "xilinx_ctb":
|
||||||
@@ -241,6 +316,7 @@ def loadConfig(name, rx_hostname = 'localhost', settingsdir = None, log_file_fp
|
|||||||
d.trimen = [4500, 5400, 6400] if name == 'eiger' else [4000, 6000, 8000, 12000]
|
d.trimen = [4500, 5400, 6400] if name == 'eiger' else [4000, 6000, 8000, 12000]
|
||||||
d.setThresholdEnergy(4500, detectorSettings.STANDARD)
|
d.setThresholdEnergy(4500, detectorSettings.STANDARD)
|
||||||
|
|
||||||
|
|
||||||
d.frames = num_frames
|
d.frames = num_frames
|
||||||
|
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
@@ -248,10 +324,11 @@ def loadConfig(name, rx_hostname = 'localhost', settingsdir = None, log_file_fp
|
|||||||
|
|
||||||
return d
|
return d
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# for easy acquire
|
# for easy acquire
|
||||||
def loadBasicSettings(name, d, fp):
|
def loadBasicSettings(name, d, fp):
|
||||||
Log(LogLevel.INFO, 'Loading basic settings for ' + name)
|
Log(LogLevel.INFO, 'Loading basic settings for ' + name, fp, True)
|
||||||
Log(LogLevel.INFO, 'Loading basic settings for ' + name, fp)
|
|
||||||
try:
|
try:
|
||||||
# basic settings for easy acquire
|
# basic settings for easy acquire
|
||||||
if name == "jungfrau":
|
if name == "jungfrau":
|
||||||
@@ -278,7 +355,7 @@ def loadBasicSettings(name, d, fp):
|
|||||||
except Exception as e:
|
except Exception as e:
|
||||||
raise RuntimeException(f'Could not load config for {name}. Error: {str(e)}') from 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)
|
parser = argparse.ArgumentParser(description)
|
||||||
|
|
||||||
default_settings_path = Path(__file__).resolve().parents[2] / "settingsdir"
|
default_settings_path = Path(__file__).resolve().parents[2] / "settingsdir"
|
||||||
@@ -293,16 +370,21 @@ def ParseArguments(description, default_num_mods=1, markers=False, general_tests
|
|||||||
help='Number of frames to test with')
|
help='Number of frames to test with')
|
||||||
parser.add_argument('-s', '--servers', nargs='*',
|
parser.add_argument('-s', '--servers', nargs='*',
|
||||||
help='Detector servers to run')
|
help='Detector servers to run')
|
||||||
if markers:
|
parser.add_argument('-nlf', '--no-log-file', action='store_true',
|
||||||
parser.add_argument('-m', '--markers', nargs='?', default ='[.cmdcall]',
|
help='Dont write output to log file')
|
||||||
help = 'Markers to use for cmd tests, default: [.cmdcall]')
|
parser.add_argument('-q', '--quiet', action='store_true',
|
||||||
|
help='Dont write to stdout when possible.')
|
||||||
|
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:
|
if general_tests_option:
|
||||||
parser.add_argument('-g', '--general_tests', action='store_true',
|
parser.add_argument('-g', '--general-tests', action='store_true',
|
||||||
help = 'Enable general tests (no value needed)')
|
help = 'Enable general tests (no value needed)')
|
||||||
|
|
||||||
args = parser.parse_args()
|
args = parser.parse_args()
|
||||||
|
|
||||||
|
|
||||||
# Set default server list if not provided
|
# Set default server list if not provided
|
||||||
if args.servers is None:
|
if args.servers is None:
|
||||||
args.servers = [
|
args.servers = [
|
||||||
@@ -323,8 +405,19 @@ def ParseArguments(description, default_num_mods=1, markers=False, general_tests
|
|||||||
f"num_mods: '{args.num_mods}'\n"
|
f"num_mods: '{args.num_mods}'\n"
|
||||||
f"num_frames: '{args.num_frames}'"
|
f"num_frames: '{args.num_frames}'"
|
||||||
)
|
)
|
||||||
if markers:
|
|
||||||
msg += f"\nmarkers: '{args.markers}'"
|
if args.no_log_file:
|
||||||
|
msg += f"\nLog File: Disabled"
|
||||||
|
else:
|
||||||
|
msg += f"\nLog File: Enabled"
|
||||||
|
|
||||||
|
if args.quiet:
|
||||||
|
msg += f"\nQuiet mode: Enabled"
|
||||||
|
else:
|
||||||
|
msg += f"\nQuiet mode: Disabled"
|
||||||
|
|
||||||
|
if specific_tests:
|
||||||
|
msg += f"\ntests: '{args.tests}'"
|
||||||
|
|
||||||
if general_tests_option:
|
if general_tests_option:
|
||||||
msg += f"\ngeneral_tests: '{args.general_tests}'"
|
msg += f"\ngeneral_tests: '{args.general_tests}'"
|
||||||
|
|||||||
Reference in New Issue
Block a user