Skip to content
Snippets Groups Projects
Commit b21dd109 authored by Martin Killenberg's avatar Martin Killenberg
Browse files

testing for global history on/off

parent b8ae5ef3
No related branches found
No related tags found
No related merge requests found
<?xml version="1.0" encoding="UTF-8"?>
<device_server xmlns="https://github.com/ChimeraTK/ControlSystemAdapter-DoocsAdapter">
<has_history>false</has_history>
<location name="DOUBLE">
<has_history>true</has_history>
<property source="TO_DEVICE_SCALAR">
<has_history>false</has_history>
</property>
<!-- to test that it picks up the default when explicitly mentioned as property-->
<property source="/DOUBLE/FROM_DEVICE_SCALAR" name="FROM_DEVICE_SCALAR"/>
<!-- to test that it picks up the default when being imported-->
<import>/DOUBLE</import>
</location>
<location name="FLOAT">
<property source="TO_DEVICE_SCALAR">
<has_history>true</has_history>
</property>
<import>/FLOAT</import>
</location>
<import>/</import>
</device_server>
eq_conf:
oper_uid: -1
oper_gid: 405
xpert_uid: 1000
xpert_gid: 1000
ring_buffer: 10000
memory_buffer: 500
eq_fct_name: "GLOBAL_ON_OFF_HISTORY_TEST._SVR"
eq_fct_type: 1
{
SVR.RPC_NUMBER: 610498009
SVR.NAME: "GLOBAL_ON_OFF_HISTORY_TEST._SVR"
SVR.RATE: 57005 48879 0 0
SVR.BPN: 6000
}
eq_fct_name: "INT"
eq_fct_type: 10
{
NAME: "INT"
}
eq_fct_name: "SHORT"
eq_fct_type: 10
{
NAME: "SHORT"
}
eq_fct_name: "FLOAT"
eq_fct_type: 10
{
NAME: "FLOAT"
}
eq_fct_name: "DOUBLE"
eq_fct_type: 10
{
NAME: "DOUBLE"
}
eq_fct_name: "UINT"
eq_fct_type: 10
{
NAME: "UINT"
}
eq_fct_name: "USHORT"
eq_fct_type: 10
{
NAME: "USHORT"
}
eq_fct_name: "CHAR"
eq_fct_type: 10
{
NAME: "CHAR"
}
eq_fct_name: "UCHAR"
eq_fct_type: 10
{
NAME: "UCHAR"
}
......@@ -6,11 +6,7 @@
#include <ChimeraTK/ControlSystemAdapter/Testing/ReferenceTestApplication.h>
#include <doocs-server-test-helper/doocsServerTestHelper.h>
#include <thread>
#include "basenameFromAddress.h"
// these constants don't exist in DOOCS, although they should. We define them here for better code readability
static const int ACCESS_RO = 0; // read only
static const int ACCESS_RW = 1; // read/write
#include "serverBasedTestTools.h"
ReferenceTestApplication referenceTestApplication("serverTestRenameImport");
......@@ -30,44 +26,6 @@ using namespace ChimeraTK;
// int8_t, uint8_t,
// float, double> simple_test_types;
template<class DOOCS_T>
void checkHistory(DOOCS_T * property, bool expected_has_history){
bool has_history = property->get_histPointer();
BOOST_CHECK_MESSAGE( has_history == expected_has_history, "History on/off wrong for "+ property->basename() +". Should be " + (expected_has_history?"true":"false"));
}
template<>
void checkHistory(D_spectrum * /*property*/, bool){
// nothing to do, spectra don't have history
}
template<class DOOCS_T>
void checkDoocsProperty(std::string const & propertyAddress, bool expected_has_history = true, bool expected_is_writeable =true){
// copied from DoocsServerTestHelper::doocsGet
EqAdr ad;
EqData ed, res;
// obtain location pointer
ad.adr(propertyAddress.c_str());
EqFct *eqFct = eq_get(&ad);
BOOST_REQUIRE_MESSAGE( eqFct, "Could not get location for property "+propertyAddress);
auto propertyName = basenameFromAddress(propertyAddress);
DOOCS_T * property = dynamic_cast<DOOCS_T *>(eqFct->find_property(propertyName));
BOOST_REQUIRE_MESSAGE(property, "Could not find property " + propertyName + " (address "<< propertyAddress <<"), or property has unexpected type.");
checkHistory(property, expected_has_history);
std::stringstream errorMessage;
errorMessage << "Access rights not correct for '" << propertyAddress << "': access word is "
<< property->get_access() << ", expected " << (expected_is_writeable?ACCESS_RW:ACCESS_RO);
if (expected_is_writeable){
BOOST_CHECK_MESSAGE( property->get_access() == ACCESS_RW , errorMessage.str());
}else{
BOOST_CHECK( property->get_access() == ACCESS_RO );
}
}
/// Check that all expected variables are there.
void testVariableExistence(){
// run update once to make sure the server is up and running
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment