Commit 5f3a1453 authored by Claes's avatar Claes Committed by Esteban Blanc

Project test program updates

parent ea314b66
......@@ -11,6 +11,7 @@
#include "co_dcli.h"
#include "co_time.h"
#include "rt_gdh.h"
#include "rt_aproc.h"
#include "ra_errhtest.h"
#include "rt_pwr_msg.h"
#include "rt_errh_msg.h"
......@@ -312,6 +313,9 @@ void ra_errhtest::SetStatus(void)
{0}
};
aproc_TimeStamp(10, 10);
m_nodep->ProcStatus[m_anix-1] = 0;
for (unsigned int i = 0; i < sizeof(d)/sizeof(d[0]); i++) {
errh_SetStatus(d[i].sts);
time_Sleep(errhtest_wait);
......
......@@ -380,6 +380,11 @@ void ra_gdhtest::CreateObject(void)
};
pwr_tOName oname;
// Clear if objects already are created
m_sts = gdh_NameToObjid(d[0].name, &d[0].oid);
if (ODD(m_sts))
m_sts = gdh_DeleteObjectTree(d[0].oid);
for (unsigned int i = 0; i < sizeof(d)/sizeof(d[0]); i++) {
m_sts = gdh_CreateObject(d[i].name, d[i].cid, 0, &d[i].oid,
pwr_cNOid, 0, pwr_cNOid);
......@@ -2394,10 +2399,16 @@ void ra_gdhtest::GetDynamicAttrSize(void)
for (unsigned int i = 0; i < sizeof(d)/sizeof(d[0]); i++) {
m_sts = gdh_CreateObject(d[i].name, d[i].cid, d[i].size, &d[i].oid,
pwr_cNOid, 0, pwr_cNOid);
if (m_sts == GDH__DUPLNAME)
m_sts = gdh_NameToObjid(d[i].name, &d[i].oid);
if (EVEN(m_sts)) {
m_log->log('E', "GetDynamicAttrSize, gdh_CreateObject", m_sts);
return;
}
m_sts = gdh_GetObjectSize(d[i].oid, &size);
if (m_sts != d[i].sts) {
m_log->log('E', "GetObjectSize", m_sts);
m_log->log('E', "GetDynamicAttrSize", m_sts);
return;
}
if (ODD(m_sts)) {
......@@ -2409,7 +2420,7 @@ void ra_gdhtest::GetDynamicAttrSize(void)
m_sts = gdh_GetDynamicAttrSize(d[i].oid, d[i].aname, &asize);
if (EVEN(m_sts)) {
m_log->log('E', "GetDynamicAttrSizes", m_sts);
m_log->log('E', "GetDynamicAttrSize", m_sts);
return;
}
if (asize != d[i].asize) {
......@@ -2689,36 +2700,49 @@ void ra_gdhtest::GetNextVolume(void)
{"_V0.254.254.203", "_V254.254.254.245", GDH__SUCCESS},
{"_V254.254.254.245", "_V0.0.0.1", GDH__SUCCESS},
{"_V0.0.0.1", "_V0.0.0.2", GDH__SUCCESS},
{"_V0.0.254.254", "_V1.254.254.203", GDH__SUCCESS},
{"_V0.0.240.254", "_V1.254.254.203", GDH__SUCCESS},
{"_V1.254.254.203", "", GDH__NOSUCHVOL}
};
pwr_tVid vid, nextvid, nvid;
char volumes[][80] = {"_V0.0.0.1", "_V0.0.0.2", "_V0.0.250.7", "_V0.254.254.203",
"_V0.0.240.254", "_V254.254.254.245"};
pwr_tVid vids[] = {0, 0, 0, 0, 0, 0};
pwr_tVid vid, nvid;
int found;
for (unsigned int i = 0; i < sizeof(d)/sizeof(d[0]); i++) {
m_sts = cdh_StringToVolumeId(d[i].vid, &vid);
for (unsigned int i = 0; i < sizeof(vids)/sizeof(vids[0]); i++) {
m_sts = cdh_StringToVolumeId(volumes[i], &vids[i]);
if (EVEN(m_sts)) {
m_log->log('E', "GetNextVolume, cdh_StringToVolumeId", d[i].vid, m_sts);
m_log->log('E', "GetNextVolume, cdh_StringToVolumeId", volumes[i], m_sts);
return;
}
if (strcmp(d[i].nextvid, "") != 0) {
m_sts = cdh_StringToVolumeId(d[i].nextvid, &nextvid);
}
for (unsigned int i = 0; i < sizeof(d)/sizeof(d[0]); i++) {
m_sts = cdh_StringToVolumeId(d[i].vid, &vid);
if (EVEN(m_sts)) {
m_log->log('E', "GetNextVolume, cdh_StringToVolumeId", d[i].nextvid, m_sts);
m_log->log('E', "GetNextVolume, cdh_StringToVolumeId", d[i].vid, m_sts);
return;
}
}
m_sts = gdh_GetNextVolume(vid, &nvid);
if (m_sts != d[i].sts) {
if (m_sts == GDH__NOSUCHVOL)
continue;
else if (m_sts != GDH__SUCCESS) {
m_log->log('E', "GetNextVolume", d[i].vid, m_sts);
return;
}
if (ODD(m_sts)) {
if (nvid != nextvid) {
m_log->log('E', "GetNextVolume, wrong volume", d[i].vid);
return;
found = 0;
for ( unsigned int j = 0; j < sizeof(vids)/sizeof(vids[0]); j++) {
if (nvid == vids[j]) {
found = 1;
break;
}
}
if (!found) {
m_log->vlog('E', "GetNextVolume, unknown volume %s",
cdh_VolumeIdToString(0, 0, nvid, 1, 0));
return;
}
}
m_log->log('S', "GetNextVolume", GDH__SUCCESS);
......@@ -2741,7 +2765,7 @@ void ra_gdhtest::VolumeIdToName(void)
{"BaseComponent", "_V0.0.0.10", GDH__SUCCESS},
{"NMps", "_V0.0.1.1", GDH__SUCCESS},
{"Profibus", "_V0.0.250.7", GDH__SUCCESS},
{"CVolPwrtest01", "_V0.0.254.254", GDH__SUCCESS},
{"CVolPwrtest01", "_V0.0.240.254", GDH__SUCCESS},
{"1_254_254_203", "_V1.254.254.203", GDH__SUCCESS}
};
pwr_tVid vid;
......@@ -2788,7 +2812,7 @@ void ra_gdhtest::GetVolumeInfo(void)
{"BaseComponent", "_V0.0.0.10", pwr_eClass_ClassVolume, GDH__SUCCESS},
{"NMps", "_V0.0.1.1", pwr_eClass_ClassVolume, GDH__SUCCESS},
{"Profibus", "_V0.0.250.7", pwr_eClass_ClassVolume, GDH__SUCCESS},
{"CVolPwrtest01", "_V0.0.254.254", pwr_eClass_ClassVolume, GDH__SUCCESS},
{"CVolPwrtest01", "_V0.0.240.254", pwr_eClass_ClassVolume, GDH__SUCCESS},
{"1_254_254_203", "_V1.254.254.203", pwr_eClass_SystemVolume, GDH__SUCCESS}
};
pwr_tVid vid;
......
......@@ -345,7 +345,10 @@ void ra_qcomtest::Alloc(void)
for (unsigned int i = 0; i < sizeof(d)/sizeof(d[0]); i++) {
p = qcom_Alloc(&m_sts, d[i].size);
if (m_sts != d[i].asts) {
m_log->vlog('E', "Alloc", m_sts);
if ( d[i].size < 5000000)
m_log->vlog('E', "Alloc size %d, %d", d[i].size, m_sts);
else
m_log->vlog('S', "Alloc: size %d too large", d[i].size);
return;
}
if (ODD(m_sts)) {
......
......@@ -784,6 +784,7 @@ void ra_timetest::AtoAscii(void)
{{1587558870,220000000}, time_eFormat_FileDateAndTime, "20200422_143430", TIME__SUCCESS},
{{1587558870,220000000}, time_eFormat_FileDate, "20200422", TIME__SUCCESS},
{{1587558870,220000000}, time_eFormat_TimeAndDate, "14:34:30 22/04/20", TIME__SUCCESS},
#ifdef __x86_64__
{{2537701200,0}, time_eFormat_DateAndTime, "01-JUN-2050 15:00:00.00", TIME__SUCCESS},
{{2537701200,0}, time_eFormat_Time, "15:00:00.00", TIME__SUCCESS},
{{2537701200,0}, time_eFormat_ComprDateAndTime, "50-06-01 15:00:00.00", TIME__SUCCESS},
......@@ -791,6 +792,15 @@ void ra_timetest::AtoAscii(void)
{{2537701200,0}, time_eFormat_FileDateAndTime, "20500601_150000", TIME__SUCCESS},
{{2537701200,0}, time_eFormat_FileDate, "20500601", TIME__SUCCESS},
{{2537701200,0}, time_eFormat_TimeAndDate, "15:00:00 01/06/50", TIME__SUCCESS},
#else
{{2537701200,0}, time_eFormat_DateAndTime, "01-JUN-2050 15:00:00.00", TIME__RANGE},
{{2537701200,0}, time_eFormat_Time, "15:00:00.00", TIME__RANGE},
{{2537701200,0}, time_eFormat_ComprDateAndTime, "50-06-01 15:00:00.00", TIME__RANGE},
{{2537701200,0}, time_eFormat_NumDateAndTime, "2050-06-01 15:00:00.00", TIME__RANGE},
{{2537701200,0}, time_eFormat_FileDateAndTime, "20500601_150000", TIME__RANGE},
{{2537701200,0}, time_eFormat_FileDate, "20500601", TIME__RANGE},
{{2537701200,0}, time_eFormat_TimeAndDate, "15:00:00 01/06/50", TIME__RANGE},
#endif
{{1587558870,-220000000}, time_eFormat_DateAndTime, "14:34:30 22/04/20", TIME__NAT},
{{-1587558870,-220000000}, time_eFormat_DateAndTime, "14:34:30 22/04/20", TIME__NAT}
};
......@@ -826,7 +836,11 @@ void ra_timetest::AsciiToA(void)
{"01-JAN-1970 01:00:00.00", pwr_cNTime, TIME__SUCCESS},
{"22-APR-2020 14:34:30.22", {1587558870,220000000}, TIME__SUCCESS},
{"22-apr-2020 14:34:30.22", {1587558870,220000000}, TIME__SUCCESS},
#ifdef __x86_64__
{"01-JUN-2050 15:00:00.00", {2537701200,0}, TIME__SUCCESS},
#else
{"01-JUN-2050 15:00:00.00", {2537701200,0}, TIME__RANGE},
#endif
{"01-JAN-2020 00:00:00.00", {1577833200,0}, TIME__SUCCESS},
{"01-FEB-2020 00:00:00.00", {1580511600,0}, TIME__SUCCESS},
{"01-MAR-2020 00:00:00.00", {1583017200,0}, TIME__SUCCESS},
......
......@@ -1617,6 +1617,8 @@ void wa_ldhtest::GetVolumeInfo(void)
void wa_ldhtest::Close(void)
{
ldh_DeleteObjectTree(m_ldhses, m_test, 0);
m_sts = ldh_DetachVolume(m_ldhwb, m_volctx);
if (EVEN(m_sts)) {
m_log->log('F', "Close, ldh_DetachVolume", m_sts);
......@@ -2387,8 +2389,6 @@ wa_ldhtest::wa_ldhtest()
// Destructor
wa_ldhtest::~wa_ldhtest()
{
ldh_DeleteObjectTree(m_ldhses, m_test, 0);
delete m_log;
}
......@@ -2399,8 +2399,8 @@ int main(int argc, char *argv[])
if (argc > 1)
ldh.vname(argv[1]);
setenv("TZ", "Europe/Stockholm", 1);
tzset();
// setenv("TZ", "Europe/Stockholm", 1);
// tzset();
ldh.OpenWB();
ldh.AttachVolume();
......
......@@ -1617,6 +1617,8 @@ void wa_ldhtest::GetVolumeInfo(void)
void wa_ldhtest::Close(void)
{
ldh_DeleteObjectTree(m_ldhses, m_test, 0);
m_sts = ldh_DetachVolume(m_ldhwb, m_volctx);
if (EVEN(m_sts)) {
m_log->log('F', "Close, ldh_DetachVolume", m_sts);
......@@ -2387,8 +2389,6 @@ wa_ldhtest::wa_ldhtest()
// Destructor
wa_ldhtest::~wa_ldhtest()
{
ldh_DeleteObjectTree(m_ldhses, m_test, 0);
delete m_log;
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment