Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
U
uniset2
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
1
Issues
1
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
UniSet project repositories
uniset2
Commits
a7486f85
Commit
a7486f85
authored
Nov 04, 2016
by
Pavel Vainerman
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
(SM): добавил test-lost.xml для тестирования SM с большим количеством датчиков
parent
26590d30
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
151 additions
and
24 deletions
+151
-24
test.xml
conf/test.xml
+0
-0
SharedMemory.cc
extensions/SharedMemory/SharedMemory.cc
+1
-1
start_fg_testlost.sh
extensions/SharedMemory/start_fg_testlost.sh
+14
-0
test-lost.xml
extensions/SharedMemory/test-lost.xml
+2
-0
LostTestProc.cc
extensions/tests/SMemoryTest/LostTestProc.cc
+107
-21
LostTestProc.h
extensions/tests/SMemoryTest/LostTestProc.h
+8
-1
start_fg_losttest.sh
extensions/tests/SMemoryTest/start_fg_losttest.sh
+17
-1
test-lost.xml
extensions/tests/SMemoryTest/test-lost.xml
+2
-0
No files found.
conf/test.xml
View file @
a7486f85
This source diff could not be displayed because it is too large. You can
view the blob
instead.
extensions/SharedMemory/SharedMemory.cc
View file @
a7486f85
...
...
@@ -244,7 +244,7 @@ void SharedMemory::sysCommand( const SystemMessage* sm )
if
(
!
activated
)
{
smcrit
<<
myname
<<
"(sysCommand): Don`t activate! TERMINATE.."
<<
endl
;
smcrit
<<
myname
<<
"(sysCommand): Don`t activate
[timeout="
<<
activateTimeout
<<
" msec]
! TERMINATE.."
<<
endl
;
std
::
terminate
();
}
...
...
extensions/SharedMemory/start_fg_testlost.sh
0 → 100755
View file @
a7486f85
#!/bin/sh
export
LD_LIBRARY_PATH
=
"../../lib/.libs;../lib/.libs"
ulimit
-Sc
10000000000
./uniset2-start.sh
-f
./uniset2-smemory
--smemory-id
SharedMemory
\
--confile
test-lost.xml
--datfile
test-lost.xml
--ulog-add-levels
system,level1
\
--sm-log-add-levels
any
$*
--sm-run-logserver
--activate-timeout
320000
#--pulsar-id DO_C --pulsar-iotype DO --pulsar-msec 100
#--ulog-add-levels info,crit,warn,level9,system \
#--dlog-add-levels info,crit,warn \
extensions/SharedMemory/test-lost.xml
0 → 120000
View file @
a7486f85
../../conf/test-lost.xml
\ No newline at end of file
extensions/tests/SMemoryTest/LostTestProc.cc
View file @
a7486f85
...
...
@@ -8,6 +8,36 @@ using namespace UniSetTypes;
LostTestProc
::
LostTestProc
(
UniSetTypes
::
ObjectId
id
,
xmlNode
*
confnode
)
:
LostTestProc_SK
(
id
,
confnode
)
{
auto
conf
=
uniset_conf
();
UniXML
::
iterator
cit
(
confnode
);
string
f_field
=
conf
->
getArgParam
(
"--"
+
argprefix
+
"filter-field"
,
cit
.
getProp
(
"filterField"
));
string
f_value
=
conf
->
getArgParam
(
"--"
+
argprefix
+
"filter-value"
,
cit
.
getProp
(
"filterValue"
));
xmlNode
*
snode
=
conf
->
getXMLSensorsSection
();
if
(
!
snode
)
throw
SystemError
(
myname
+
"(init): Not found <sensors> section?!"
);
UniXML
::
iterator
it
(
snode
);
if
(
!
it
.
goChildren
()
)
throw
SystemError
(
myname
+
"(init): Section <sensors> empty?!"
);
for
(
;
it
;
it
++
)
{
if
(
!
UniSetTypes
::
check_filter
(
it
,
f_field
,
f_value
)
)
continue
;
if
(
it
.
getProp
(
"iotype"
)
!=
"AI"
)
continue
;
slist
.
emplace
(
it
.
getIntProp
(
"id"
),
0
);
}
setMaxSizeOfMessageQueue
(
slist
.
size
()
+
500
);
vmonit
(
ncycle
);
vmonit
(
waitEmpty
);
}
// -----------------------------------------------------------------------------
LostTestProc
::~
LostTestProc
()
...
...
@@ -27,43 +57,99 @@ void LostTestProc::sysCommand( const UniSetTypes::SystemMessage* sm )
if
(
sm
->
command
==
SystemMessage
::
StartUp
||
sm
->
command
==
SystemMessage
::
WatchDog
)
{
askTimer
(
tmCheck
,
checkTime
);
// начальная инициализация значений в SM
for
(
auto
&&
s
:
slist
)
{
try
{
ui
->
setValue
(
s
.
first
,
s
.
second
);
}
catch
(
std
::
exception
&
ex
)
{
mycrit
<<
myname
<<
"(startUp): "
<<
ex
.
what
()
<<
endl
;
}
}
}
}
// -----------------------------------------------------------------------------
void
LostTestProc
::
askSensors
(
UniversalIO
::
UIOCommand
cmd
)
{
for
(
const
auto
&
s
:
slist
)
askSensor
(
s
.
first
,
cmd
);
}
// -----------------------------------------------------------------------------
void
LostTestProc
::
sensorInfo
(
const
SensorMessage
*
sm
)
{
auto
s
=
slist
.
find
(
sm
->
id
);
if
(
s
==
slist
.
end
()
)
{
mycrit
<<
myname
<<
"(sensorInfo): ERROR: message from UNKNOWN SENSOR sm->id="
<<
sm
->
id
<<
endl
;
UniSetTypes
::
SimpleInfo_var
i
=
getInfo
();
mycrit
<<
i
->
info
<<
endl
;
std
::
abort
();
}
s
->
second
=
sm
->
value
;
}
// -----------------------------------------------------------------------------
string
LostTestProc
::
getMonitInfo
()
{
ostringstream
inf
;
inf
<<
"COUNT SENSORS: "
<<
slist
.
size
()
<<
endl
;
return
std
::
move
(
inf
.
str
());
}
// -----------------------------------------------------------------------------
void
LostTestProc
::
timerInfo
(
const
TimerMessage
*
tm
)
{
if
(
tm
->
id
==
tmCheck
)
{
try
if
(
countMessages
()
>
0
)
{
long
smValue
=
ui
->
getValue
(
sensor_s
);
if
(
smValue
!=
in_sensor_s
)
mylog1
<<
myname
<<
": [WAIT]: count of messages "
<<
countMessages
()
<<
endl
;
waitEmpty
=
true
;
return
;
}
waitEmpty
=
false
;
myinfo
<<
myname
<<
": [OK]: empty queue. UPDATE VALUE... "
<<
endl
;
for
(
auto
&&
s
:
slist
)
{
try
{
mycrit
<<
myname
<<
"(check): ERROR!! smValue="
<<
smValue
<<
" != "
<<
strval
(
sensor_s
)
<<
endl
;
//std::terminate();
UniSetTypes
::
SimpleInfo_var
i
=
getInfo
();
mycrit
<<
i
->
info
<<
endl
;
std
::
abort
();
}
long
smValue
=
ui
->
getValue
(
s
.
first
);
if
(
smValue
!=
s
.
second
)
{
cerr
<<
myname
<<
"(check): ERROR!! smValue="
<<
smValue
<<
" != "
<<
s
.
second
<<
endl
;
UniSetTypes
::
SimpleInfo_var
i
=
getInfo
();
cerr
<<
i
->
info
<<
endl
;
std
::
abort
();
}
// cerr << "sm_value=" << smValue << " save " << (in_sensor_s+1) << endl;
// cerr << "sm_value=" << smValue << " save " << (in_sensor_s+1) << endl;
// Выставляем новое значение
ui
->
setValue
(
sensor_s
,
in_sensor_s
+
1
);
// Выставляем новое значение
ui
->
setValue
(
s
.
first
,
s
.
second
+
1
);
// проверяем что сохранилось
smValue
=
ui
->
getValue
(
sensor_s
);
// проверяем что сохранилось
smValue
=
ui
->
getValue
(
s
.
first
);
if
(
ui
->
getValue
(
sensor_s
)
!=
(
in_sensor_s
+
1
)
)
if
(
ui
->
getValue
(
s
.
first
)
!=
(
s
.
second
+
1
)
)
{
cerr
<<
myname
<<
"(check): SAVE TO SM ERROR!! smValue="
<<
smValue
<<
endl
;
UniSetTypes
::
SimpleInfo_var
i
=
getInfo
();
cerr
<<
i
->
info
<<
endl
;
std
::
abort
();
}
}
catch
(
std
::
exception
&
ex
)
{
mycrit
<<
myname
<<
"(check): SAVE TO SM ERROR!! smValue="
<<
smValue
<<
strval
(
sensor_s
)
<<
endl
;
std
::
abort
();
mycrit
<<
myname
<<
"(check): "
<<
ex
.
what
()
<<
endl
;
}
}
catch
(
std
::
exception
&
ex
)
{
mycrit
<<
myname
<<
"(check): "
<<
ex
.
what
()
<<
endl
;
}
myinfo
<<
myname
<<
": [OK]: UPDATE FINISHED: cycle="
<<
++
ncycle
<<
endl
;
}
}
// -----------------------------------------------------------------------------
extensions/tests/SMemoryTest/LostTestProc.h
View file @
a7486f85
...
...
@@ -2,7 +2,7 @@
#ifndef LostTestProc_H_
#define LostTestProc_H_
// -----------------------------------------------------------------------------
#include <
vector
>
#include <
unordered_map
>
#include "Debug.h"
#include "LostTestProc_SK.h"
// -----------------------------------------------------------------------------
...
...
@@ -26,6 +26,13 @@ class LostTestProc:
virtual
void
timerInfo
(
const
UniSetTypes
::
TimerMessage
*
tm
)
override
;
virtual
void
sysCommand
(
const
UniSetTypes
::
SystemMessage
*
sm
)
override
;
virtual
void
askSensors
(
UniversalIO
::
UIOCommand
cmd
)
override
;
virtual
void
sensorInfo
(
const
UniSetTypes
::
SensorMessage
*
sm
)
override
;
virtual
std
::
string
getMonitInfo
()
override
;
std
::
unordered_map
<
UniSetTypes
::
ObjectId
,
long
>
slist
;
size_t
ncycle
=
{
0
};
bool
waitEmpty
=
{
false
};
private
:
};
...
...
extensions/tests/SMemoryTest/start_fg_losttest.sh
View file @
a7486f85
...
...
@@ -2,7 +2,23 @@
START
=
uniset2-start.sh
${
START
}
-f
./sm-lostmessage-test
--confile
./test.xml
--TestProc1-log-add-levels
crit,warn
--ulog-add-levels
crit
$*
LOGS
=
"crit,warn,info"
${
START
}
-f
./sm-lostmessage-test
--confile
./test-lost.xml
\
--numproc
3
\
--TestProc1-filter-field
losttest
\
--TestProc1-filter-value
1
\
--TestProc1-sleep-msec
50
\
--TestProc1-log-add-levels
$LOGLEVEL
\
--TestProc2-filter-field
losttest
\
--TestProc2-filter-value
2
\
--TestProc2-sleep-msec
50
\
--TestProc2-log-add-levels
$LOGLEVEL
\
--TestProc3-filter-field
losttest
\
--TestProc3-filter-value
3
\
--TestProc3-sleep-msec
50
\
--TestProc3-log-add-levels
$LOGLEVEL
\
--ulog-add-levels
crit
$*
# --uniset-abort-script ./abort-script-example.sh
#--ulog-add-levels crit,warn,info
...
...
extensions/tests/SMemoryTest/test-lost.xml
0 → 120000
View file @
a7486f85
../../../conf/test-lost.xml
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment