Commit c200dd96 authored by Claes's avatar Claes Committed by Esteban Blanc

Project pwrtest01 qcom two nodes test

parent f63815d8
......@@ -96,7 +96,7 @@ if [ ! -e $pwra_db ]; then
cp $pwre_croot/src/tools/pkg/deb/adm/* $pwra_db/
fi
if [ "`eval grep CVolPwrtest01 $pwra_db/pwr_volumelist.dat`" == "" ]; then
echo "CVolPwrtest01 0.0.254.254 pwrtest01" >> $pwra_db/pwr_volumelist.dat
echo "CVolPwrtest01 0.0.240.254 pwrtest01" >> $pwra_db/pwr_volumelist.dat
fi
if [ "`eval grep VolPwrTest01a $pwra_db/pwr_volumelist.dat`" == "" ]; then
echo "VolPwrTest01a 0.254.254.201 pwrtest01" >> $pwra_db/pwr_volumelist.dat
......
......@@ -4,7 +4,9 @@ include $(pwr_exe)/pwrp_rules.mk
demo_modules = $(pwrp_exe)/ra_status \
$(pwrp_exe)/ra_nethtest \
$(pwrp_exe)/ra_qcom2test \
$(pwrp_exe)/ra_testall_a.sh \
$(pwrp_exe)/ra_testall_b.sh \
$(pwrp_exe)/ra_plctest \
$(pwrp_exe)/ra_gdhtest \
$(pwrp_exe)/ra_timetest \
......@@ -34,10 +36,18 @@ $(pwrp_exe)/ra_nethtest : $(pwrp_appl)/ra_nethtest.cpp $(pwrp_appl)/ra_nethtest.
@ echo "Building ra_nethtest"
@ g++ -g -o $(target) $(source) $(pwr_obj)/pwr_msg_co.o $(pwr_obj)/pwr_msg_rt.o -I$(pwrp_inc) -I$(pwr_inc) -L$(pwr_lib) -lpwr_rt -lpwr_co -lpwr_msg_dummy -lrpcsvc -lpthread -lm -lrt -Wall
$(pwrp_exe)/ra_qcom2test : $(pwrp_appl)/ra_qcom2test.cpp $(pwrp_appl)/ra_qcom2test.h
@ echo "Building ra_qcom2test"
@ g++ -g -o $(target) $(source) $(pwr_obj)/pwr_msg_co.o $(pwr_obj)/pwr_msg_rt.o -I$(pwrp_inc) -I$(pwr_inc) -L$(pwr_lib) -lpwr_rt -lpwr_co -lpwr_msg_dummy -lrpcsvc -lpthread -lm -lrt -Wall
$(pwrp_exe)/ra_testall_a.sh : $(pwrp_appl)/ra_testall_a.sh
@ echo "Building ra_testall_a"
@ cp -p $(source) $(target)
$(pwrp_exe)/ra_testall_b.sh : $(pwrp_appl)/ra_testall_b.sh
@ echo "Building ra_testall_b"
@ cp -p $(source) $(target)
$(pwrp_exe)/ra_plctest : $(pwrp_appl)/ra_plctest.cpp
@ echo "Building ra_plctest"
@ g++ -g -o $(target) $(source) $(pwr_obj)/pwr_msg_rt.o -I$(pwr_inc) -L$(pwr_lib) -lpwr_rt -lpwr_co -lpwr_msg_dummy -lrpcsvc -lpthread -lm -lrt -Wall
......
......@@ -2,7 +2,6 @@
Test neth functions.
*/
#include <stdio.h>
#include <unistd.h>
#include "pwr.h"
......@@ -27,22 +26,22 @@ typedef struct {
void ra_nethtest::ObjidToName(void)
{
sObjidToName d[] = {
{"Test01b-Neth", HASH__SUCCESS, HASH__SUCCESS, pwr_cNOid},
{"Test01b-Neth-", HASH__SUCCESS, HASH__SUCCESS, pwr_cNOid},
{"Test01b-Neth-LongName90123456789012345678901", HASH__SUCCESS, HASH__SUCCESS, pwr_cNOid},
{"Test01b-Neth", GDH__SUCCESS, HASH__SUCCESS, pwr_cNOid},
{"Test01b-Neth-", GDH__SUCCESS, HASH__SUCCESS, pwr_cNOid},
{"Test01b-Neth-LongName90123456789012345678901", GDH__SUCCESS, HASH__SUCCESS, pwr_cNOid},
{"Test01b-Neth-TooLongName234567890123456789012", CDH__SEGLEN, 0, pwr_cNOid}
};
pwr_tOName oname;
for (unsigned int i = 0; i < sizeof(d)/sizeof(d[0]); i++) {
m_sts = gdh_NameToObjid(d[i].name, &d[i].oid);
if (m_sts != d[i].sts1) {
if (!(m_sts == d[i].sts1 || m_sts == d[i].sts2)) {
m_log->log('E', "ObjidToName, NameToObjid wrong sts", d[i].name, m_sts);
return;
}
else if (ODD(m_sts)) {
m_sts = gdh_ObjidToName(d[i].oid, oname, sizeof(oname), cdh_mNName);
if (m_sts != d[i].sts2) {
if (!(m_sts == d[i].sts1 || m_sts == d[i].sts2)) {
m_log->log('E', "ObjidToName, wrong sts", d[i].name, m_sts);
return;
}
......
/*
Test qcom functions.
*/
#include <stdio.h>
#include <unistd.h>
#include <stddef.h>
#include <math.h>
#include <pthread.h>
#include "pwr_class.h"
#include "co_msg.h"
#include "co_dcli.h"
#include "co_time.h"
#include "co_syi.h"
#include "rt_gdh.h"
#include "ra_qcom2test.h"
#include "rt_qcom_msg.h"
#include "rt_hash_msg.h"
#include "rt_qdb_msg.h"
#include "pwr_baseclasses.h"
#include "pwr_basecomponentclasses.h"
#include "pwr_cvolpwrtest01classes.h"
//static int plog = 1;
typedef struct {
char msg[1000];
qcom_eBtype btype;
qcom_eStype stype;
pwr_tStatus sts;
} sPut;
void ra_qcom2test::Put(void)
{
sPut d[] = {
{"Some message 1", (qcom_eBtype)2001, (qcom_eStype)1, QCOM__SUCCESS},
{"Some message 2", (qcom_eBtype)32, (qcom_eStype)31, QCOM__SUCCESS},
{"A longer message, A longer message, A longer message, A longer message, A longer message,"
"A longer message, A longer message, A longer message, A longer message, A longer message,"
"A longer message, A longer message, A longer message, A longer message, A longer message,"
"A longer message, A longer message, A longer message, A longer message, A longer message,"
"A longer message, A longer message, A longer message, A longer message, A longer message,"
"A longer message, A longer message, A longer message, A longer message, A longer message,"
"A longer message, A longer message, A longer message, A longer message, A longer message,"
"A longer message, A longer message, A longer message, A longer message, A longer message,"
"A longer message, A longer message, A longer message, A longer message, A longer message,"
"A longer message, A longer message, A longer message, A longer message, A longer message",
(qcom_eBtype)2020, (qcom_eStype)31, QCOM__SUCCESS}
};
qcom_sQattr attr;
qcom_sPut put;
qcom_sGet get;
qcom_sQid sqid = {3337,m_bvid};
if (m_is_a) {
// Send
struct timespec t = {0, 100000000};
m_log->vlog('D', "Put start");
for (unsigned int i = 0; i < sizeof(d)/sizeof(d[0]); i++) {
put.reply = sqid;
put.type.b = d[i].btype;
put.type.s = d[i].stype;
put.size = strlen(d[i].msg) + 1;
put.data = d[i].msg;
qcom_Put(&m_sts, &sqid, &put);
if (EVEN(m_sts)) {
m_log->log('E', "Put, qcom_Put", m_sts);
return;
}
m_log->vlog('D', "Put message %d", i);
nanosleep(&t, 0);
}
m_log->log('S', "Put", QCOM__SUCCESS);
}
else {
// Receive
attr.type = qcom_eQtype_private;
attr.quota = 100;
qcom_CreateQ(&m_sts, &sqid, &attr, "queue3337");
if (m_sts == QCOM__QALLREXIST) {
qcom_DeleteQ(&m_sts, &sqid);
qcom_CreateQ(&m_sts, &sqid, &attr, "queue3337");
}
if (EVEN(m_sts)) {
m_log->log('E', "Put, qcom_CreateQ", m_sts);
return;
}
m_log->vlog('D', "Put start");
for (unsigned int i = 0; i < sizeof(d)/sizeof(d[0]); i++) {
int tmo = 180000;
get.data = 0;
qcom_Get(&m_sts, &sqid, &get, tmo);
if (EVEN(m_sts)) {
m_log->log('E', "Put, qcom_Get", m_sts);
return;
}
if (strcmp(d[i].msg, (char *)get.data) != 0 ||
get.type.b != d[i].btype ||
get.type.s != d[i].stype ||
get.size != strlen(d[i].msg) + 1) {
m_log->vlog('E', "Put, content differs, %d", i);
return;
}
m_log->vlog('D', "Put message %d", i);
qcom_Free(&m_sts, get.data);
if (EVEN(m_sts)) {
m_log->log('E', "Put, qcom_Free", m_sts);
return;
}
}
m_log->log('S', "Put", QCOM__SUCCESS);
}
// Cyclic send
if (m_is_a) {
// Send
m_log->vlog('D', "Cyclic put start");
for (unsigned int i = 0; i < 10000; i++) {
struct timespec t = {0, 2000000};
put.reply = sqid;
put.type.b = d[0].btype;
put.type.s = d[0].stype;
put.size = strlen(d[0].msg) + 1;
put.data = d[0].msg;
qcom_Put(&m_sts, &sqid, &put);
if (EVEN(m_sts)) {
if (i < 100) {
m_log->log('E', "Cyclic put, qcom_Put", m_sts);
return;
}
else {
if (m_sts != QDB__QUOTAEXCEEDED) {
m_log->log('E', "Put, qcom_Put", m_sts);
return;
}
}
}
m_log->vlog('D', "Cyclic put %d", i);
nanosleep(&t, 0);
}
m_log->log('S', "Cyclic put", QCOM__SUCCESS);
}
else {
// Receive
m_log->vlog('D', "Cyclic put start");
for (unsigned int i = 0; i < 10000; i++) {
int tmo = 2000;
get.data = 0;
qcom_Get(&m_sts, &sqid, &get, tmo);
if (EVEN(m_sts)) {
m_log->log('E', "Put, qcom_Get", m_sts);
return;
}
if (strcmp((char *)d[0].msg, (char *)get.data) != 0 ||
get.type.b != d[0].btype ||
get.type.s != d[0].stype ||
get.size != strlen(d[0].msg) + 1) {
m_log->vlog('E', "Put, content differs, %d", i);
return;
}
m_log->vlog('D', "Cyclic put %d", i);
qcom_Free(&m_sts, get.data);
if (EVEN(m_sts)) {
m_log->log('E', "Put, qcom_Free", m_sts);
return;
}
}
m_log->log('S', "Cyclic put", QCOM__SUCCESS);
}
// Check quota
if (m_is_a) {
// Send
m_log->vlog('D', "Quota put start");
for (unsigned int i = 0; i < 110; i++) {
struct timespec t = {0, 1000000};
put.reply = sqid;
put.type.b = d[0].btype;
put.type.s = d[0].stype;
put.size = strlen(d[0].msg) + 1;
put.data = d[0].msg;
qcom_Put(&m_sts, &sqid, &put);
if (EVEN(m_sts)) {
if (i < 100) {
m_log->log('E', "Put, qcom_Put", m_sts);
return;
}
else {
if (m_sts != QDB__QUOTAEXCEEDED) {
m_log->log('E', "Put, qcom_Put", m_sts);
return;
}
}
}
m_log->vlog('D', "Quota put %i", i);
nanosleep(&t, 0);
}
m_log->log('S', "Cyclic put", QCOM__SUCCESS);
}
else {
// Receive
m_log->vlog('D', "Quota put start");
for (unsigned int i = 0; i < 110; i++) {
int tmo = 200;
get.data = 0;
qcom_Get(&m_sts, &sqid, &get, tmo);
if (i == 0)
sleep(5);
if (EVEN(m_sts)) {
if (i > 100 && m_sts == QCOM__TMO)
continue;
else {
m_log->log('E', "Put, qcom_Get", m_sts);
return;
}
}
if (strcmp((char *)d[0].msg, (char *)get.data) != 0 ||
get.type.b != d[0].btype ||
get.type.s != d[0].stype ||
get.size != strlen(d[0].msg) + 1) {
m_log->vlog('E', "Put, content differs, %d", i);
return;
}
m_log->vlog('D', "Quota put %i", i);
qcom_Free(&m_sts, get.data);
if (EVEN(m_sts)) {
m_log->log('E', "Put, qcom_Free", m_sts);
return;
}
}
m_log->log('S', "Cyclic put", QCOM__SUCCESS);
}
if (!m_is_a) {
qcom_DeleteQ(&m_sts, &sqid);
if (EVEN(m_sts)) {
m_log->log('E', "Put, qcom_DeleteQ", m_sts);
return;
}
}
m_log->log('S', "Put", QCOM__SUCCESS);
}
// Constructor
ra_qcom2test::ra_qcom2test()
{
pwr_tStatus sts;
pwr_tNid nid;
pwr_tTime stime;
cdh_StringToVolumeId("_V0.254.254.201", &m_avid);
cdh_StringToVolumeId("_V0.254.254.202", &m_bvid);
sts = gdh_Init("ra_qcom2test");
if (EVEN(sts)) {
m_log->log('S', "qcom2 gdh_Init", sts);
exit(0);
}
sts = gdh_GetNodeIndex(&nid);
if (EVEN(sts)) {
m_log->log('S', "qcom2 gdh_GetNodeIndex", sts);
exit(0);
}
if (nid == m_avid)
m_is_a = 1;
else
m_is_a = 0;
if (m_is_a)
m_log = new tst_log(&m_sts, "rt-Qcom2a", "$pwrp_log/qcom2a.tlog");
else
m_log = new tst_log(&m_sts, "rt-Qcom2b", "$pwrp_log/qcom2b.tlog");
if (EVEN(m_sts))
printf("** Unable to open log file");
if (m_is_a) {
// Wait for pwrtest01b
for (int i = 0; i < 100; i++) {
m_sts = gdh_GetObjectInfo("VolPwrtest01b:Nodes-PwrTest01b.SystemTime", &stime, sizeof(stime));
sleep(2);
printf("sts %d\n", m_sts);
if (ODD(m_sts))
break;
}
if (EVEN(m_sts)) {
m_log->log('F', "pwrtest01b timeout", m_sts);
exit(0);
}
}
}
// Destructor
ra_qcom2test::~ra_qcom2test()
{
delete m_log;
}
int main()
{
ra_qcom2test qcom;
qcom.Put();
}
#include "pwr.h"
#include "rt_qcom.h"
#include "co_tst_log.h"
class ra_qcom2test {
pwr_tStatus m_sts;
tst_log *m_log;
pwr_tVid m_avid;
pwr_tVid m_bvid;
int m_is_a;
public:
ra_qcom2test();
~ra_qcom2test();
tst_log *log() {return m_log;}
void Put();
};
......@@ -6,11 +6,21 @@ exec()
$1
}
# Spawn process
dexec()
{
echo "Executing $1"
$1 &
pid[$i]=$!
i=$i+1
}
exec "ra_nethtest"
let i=0
dexec "ra_nethtest"
exec "ra_qcom2test"
# Wait for spawned processes
for p in ${pid[*]}; do
wait $p
done
#!/bin/bash
exec()
{
echo "Executing $1"
$1
}
dexec()
{
echo "Executing $1"
$1 &
pid[$i]=$!
i=$i+1
}
let i=0
exec "ra_qcom2test"
# Wait for spawned processes
for p in ${pid[*]}; do
wait $p
done
......@@ -10,8 +10,12 @@ dexec()
{
echo "Executing $1"
$1 &
pid[$i]=$!
i=$i+1
}
let i=0
exec "ra_plctest"
exec "ra_timetest"
exec "ra_nettimetest"
......@@ -28,3 +32,7 @@ exec "rt_xtt_cmd @$pwrp_exe/ra_xttscripttest"
dexec "ra_qmontest"
exec "ra_qmontest 2"
# Wait for spawned processes
for p in ${pid[*]}; do
wait $p
done
! Generated by wb_print_wbl 15-MAY-2020 08:19:24.71
! Volume CVolPwrtest01
! Version V5.7.1
Volume CVolPwrtest01 $ClassVolume 0.0.254.254
Volume CVolPwrtest01 $ClassVolume 0.0.240.254
Body SysBody 01-JAN-1970 01:00:00.00
Attr NextOix = "_X10"
Attr NextCix = "_X12"
......
! Generated by wb_print_wbl 03-SEP-2020 16:41:51.54
! Generated by wb_print_wbl 09-SEP-2020 14:12:41.30
! Volume directory
! Version V5.7.1
Volume directory $DirectoryVolume 254.254.254.253
......@@ -16,7 +16,7 @@ Volume directory $DirectoryVolume 254.254.254.253
Attr BusNumber = 999
EndBody
Object PwrTest01a NodeConfig 10 25-MAR-2020 09:04:16.06
Body RtBody 03-SEP-2020 16:41:51.48
Body RtBody 09-SEP-2020 14:12:41.27
Attr NodeName = "pwrtest01a"
Attr OperatingSystem = 128
Attr Address = "10.255.100.1"
......@@ -44,6 +44,11 @@ Volume directory $DirectoryVolume 254.254.254.253
Attr Source = "$pwrp_exe/ra_nethtest"
EndBody
EndObject
Object ra_qcom2test ApplDistribute 78 08-SEP-2020 09:28:34.89
Body DevBody 08-SEP-2020 09:28:41.18
Attr Source = "$pwrp_exe/ra_qcom2test"
EndBody
EndObject
Object ra_testall_a ApplDistribute 77 03-SEP-2020 16:11:55.02
Body DevBody 03-SEP-2020 16:11:59.71
Attr Source = "$pwrp_exe/ra_testall_a.sh"
......@@ -52,7 +57,7 @@ Volume directory $DirectoryVolume 254.254.254.253
EndObject
EndObject
Object PwrTest01b NodeConfig 26 25-MAR-2020 09:06:55.29
Body RtBody 03-SEP-2020 16:41:51.48
Body RtBody 09-SEP-2020 14:12:41.27
Attr NodeName = "pwrtest01b"
Attr OperatingSystem = 128
Attr Address = "10.255.100.2"
......@@ -75,10 +80,20 @@ Volume directory $DirectoryVolume 254.254.254.253
Attr Source = "$pwrp_exe/ra_status"
EndBody
EndObject
Object ra_qcom2test ApplDistribute 79 08-SEP-2020 09:28:52.65
Body DevBody 08-SEP-2020 09:28:52.65
Attr Source = "$pwrp_exe/ra_qcom2test"
EndBody
EndObject
Object ra_testall_b ApplDistribute 80 08-SEP-2020 13:16:48.30
Body DevBody 08-SEP-2020 13:16:51.30
Attr Source = "$pwrp_exe/ra_testall_b.sh"
EndBody
EndObject
EndObject
EndObject
Object PwrTest01c NodeConfig 33 26-MAR-2020 10:23:36.40
Body RtBody 03-SEP-2020 16:41:51.48
Body RtBody 09-SEP-2020 14:12:41.27
Attr NodeName = "pwrtest01c"
Attr OperatingSystem = 128
Attr Address = "127.0.0.1"
......@@ -180,7 +195,7 @@ Volume directory $DirectoryVolume 254.254.254.253
EndObject
EndObject
Object PwrTest01d SevNodeConfig 38 26-MAR-2020 10:24:30.82
Body RtBody 03-SEP-2020 16:41:51.48
Body RtBody 09-SEP-2020 14:12:41.27
Attr NodeName = "pwrtest01d"
Attr OperatingSystem = 128
Attr Address = "10.255.100.3"
......@@ -200,7 +215,7 @@ Volume directory $DirectoryVolume 254.254.254.253
Body RtBody 01-JUN-2020 10:06:31.24
Attr BusNumber = 998
EndBody
Object PwrTest01c NodeConfig 56 01-JUN-2020 10:05:00.49
Object copper_arrow NodeConfig 56 09-SEP-2020 09:28:40.87
Body RtBody 01-JUN-2020 10:05:00.49
Attr NodeName = "copper-arrow"
Attr OperatingSystem = 128
......
......@@ -2,4 +2,4 @@ VolPwrTest01a 0.254.254.201 PwrTest01a pwrtest01a 999 128 0.000000 0
VolPwrTest01b 0.254.254.202 PwrTest01b pwrtest01b 999 128 0.000000 0
VolPwrTest01c 0.254.254.203 PwrTest01c pwrtest01c 999 128 0.000000 0
VolPwrTest01d 0.254.254.204 PwrTest01d pwrtest01d 999 128 0.000000 1
VolPwrTest01c 0.254.254.203 PwrTest01c copper-arrow 998 128 0.000000 0
VolPwrTest01c 0.254.254.203 copper_arrow copper-arrow 998 128 0.000000 0
......@@ -22,6 +22,7 @@ appl pwrtest01a S $pwrp_web/*.pdf
appl pwrtest01a S $pwrp_web/*.pwg
appl pwrtest01a E $pwrp_exe/ra_status
appl pwrtest01a E $pwrp_exe/ra_nethtest
appl pwrtest01a E $pwrp_exe/ra_qcom2test
appl pwrtest01a E $pwrp_exe/ra_testall_a.sh
node pwrtest01b 128 999 0 - -
load pwrtest01b
......@@ -45,6 +46,8 @@ appl pwrtest01b S $pwrp_web/*.jpg
appl pwrtest01b S $pwrp_web/*.pdf
appl pwrtest01b S $pwrp_web/*.pwg
appl pwrtest01b E $pwrp_exe/ra_status
appl pwrtest01b E $pwrp_exe/ra_qcom2test
appl pwrtest01b E $pwrp_exe/ra_testall_b.sh
node pwrtest01c 128 999 0 - -
load pwrtest01c
appl pwrtest01c W $pwrp_cnf/pwrtest01c/pwr_user2.dat:$pwra_db/pwr_user2.dat $pwra_db/pwr_user2.dat
......
CVolPwrtest01 0.0.254.254 ClassVolume cnf 0
CVolPwrtest01 0.0.240.254 ClassVolume cnf 0
VolPwrTest01a 0.254.254.201 RootVolume cnf 0
VolPwrTest01b 0.254.254.202 RootVolume cnf 0
VolPwrTest01c 0.254.254.203 RootVolume cnf 0
......
This diff is collapsed.
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