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
9e2d72de
Commit
9e2d72de
authored
May 30, 2015
by
Pavel Vainerman
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
(SharedMemory): добавлен второй тест heartbeat
(uniset-codegen): добавлено вылавливание исключения при работе с heartbeat, мелкие правки
parent
301b2370
Show whitespace changes
Inline
Side-by-side
Showing
14 changed files
with
83 additions
and
12 deletions
+83
-12
ctl-cpp-cc-alone-ask.xsl
Utilities/codegen/ctl-cpp-cc-alone-ask.xsl
+8
-1
ctl-cpp-cc-alone.xsl
Utilities/codegen/ctl-cpp-cc-alone.xsl
+8
-1
ctl-cpp-cc-ask.xsl
Utilities/codegen/ctl-cpp-cc-ask.xsl
+8
-1
ctl-cpp-cc.xsl
Utilities/codegen/ctl-cpp-cc.xsl
+8
-1
ctl-cpp-common.xsl
Utilities/codegen/ctl-cpp-common.xsl
+1
-1
libuniset2.spec
conf/libuniset2.spec
+6
-1
Makefile.am
extensions/SharedMemory/tests/Makefile.am
+1
-0
TestObject.cc
extensions/SharedMemory/tests/TestObject.cc
+10
-0
TestObject.h
extensions/SharedMemory/tests/TestObject.h
+6
-0
sm-configure.xml
extensions/SharedMemory/tests/sm-configure.xml
+3
-2
test_sm.cc
extensions/SharedMemory/tests/test_sm.cc
+22
-3
testobject.src.xml
extensions/SharedMemory/tests/testobject.src.xml
+1
-1
tests.sh
extensions/SharedMemory/tests/tests.sh
+0
-0
uniset2.files
uniset2.files
+1
-0
No files found.
Utilities/codegen/ctl-cpp-cc-alone-ask.xsl
View file @
9e2d72de
...
...
@@ -79,9 +79,16 @@ void <xsl:value-of select="$CLASSNAME"/>_SK::callback()
// "сердцебиение"
if( idHeartBeat!=DefaultObjectId
&&
ptHeartBeat.checkTime() )
{
ui->setValue(idHeartBeat,maxHeartBeat,UniversalIO::AI);
try
{
ui->setValue(idHeartBeat,maxHeartBeat);
ptHeartBeat.reset();
}
catch( Exception
&
ex )
{
ucrit
<<
myname
<<
"(execute): "
<<
ex
<<
endl;
}
}
// обновление выходов
updateOutputs(forceOut);
...
...
Utilities/codegen/ctl-cpp-cc-alone.xsl
View file @
9e2d72de
...
...
@@ -82,9 +82,16 @@ void <xsl:value-of select="$CLASSNAME"/>_SK::callback()
// "сердцебиение"
if( idHeartBeat!=DefaultObjectId
&&
ptHeartBeat.checkTime() )
{
ui->setValue(idHeartBeat,maxHeartBeat,UniversalIO::AI);
try
{
ui->setValue(idHeartBeat,maxHeartBeat);
ptHeartBeat.reset();
}
catch( const Exception
&
ex )
{
ucrit
<<
myname
<<
"(execute): "
<<
ex
<<
endl;
}
}
// обновление выходов
updateOutputs(forceOut);
...
...
Utilities/codegen/ctl-cpp-cc-ask.xsl
View file @
9e2d72de
...
...
@@ -78,9 +78,16 @@ void <xsl:value-of select="$CLASSNAME"/>_SK::callback()
// "сердцебиение"
if( idHeartBeat!=DefaultObjectId
&&
ptHeartBeat.checkTime() )
{
ui->setValue(idHeartBeat,maxHeartBeat,UniversalIO::AI);
try
{
ui->setValue(idHeartBeat,maxHeartBeat);
ptHeartBeat.reset();
}
catch( Exception
&
ex )
{
ucrit
<<
myname
<<
"(execute): "
<<
ex
<<
endl;
}
}
// обновление выходов
updateOutputs(forceOut);
...
...
Utilities/codegen/ctl-cpp-cc.xsl
View file @
9e2d72de
...
...
@@ -82,9 +82,16 @@ void <xsl:value-of select="$CLASSNAME"/>_SK::callback()
// "сердцебиение"
if( idHeartBeat!=DefaultObjectId
&&
ptHeartBeat.checkTime() )
{
ui->setValue(idHeartBeat,maxHeartBeat,UniversalIO::AI);
try
{
ui->setValue(idHeartBeat,maxHeartBeat);
ptHeartBeat.reset();
}
catch( Exception
&
ex )
{
ucrit
<<
myname
<<
"(execute): "
<<
ex
<<
endl;
}
}
// Формирование выходов
updateOutputs(forceOut);
...
...
Utilities/codegen/ctl-cpp-common.xsl
View file @
9e2d72de
...
...
@@ -355,7 +355,7 @@ void <xsl:value-of select="$CLASSNAME"/>_SK::preSysCommand( const SystemMessage*
switch( _sm->command )
{
case SystemMessage::WatchDog:
u
logany
<<
myname
<<
"(preSysCommand): WatchDog"
<<
endl;
u
info
<<
myname
<<
"(preSysCommand): WatchDog"
<<
endl;
if( !active || !ptStartUpTimeout.checkTime() )
{
uwarn
<<
myname
<<
"(preSysCommand): игнорируем WatchDog, потому-что только-что стартанули"
<<
endl;
...
...
conf/libuniset2.spec
View file @
9e2d72de
...
...
@@ -13,7 +13,7 @@
Name: libuniset2
Version: 2.1
Release: alt
1
Release: alt
2
Summary: UniSet - library for building distributed industrial control systems
...
...
@@ -455,6 +455,11 @@ mv -f %buildroot%python_sitelibdir_noarch/* %buildroot%python_sitelibdir/%oname
# ..
%changelog
* Sat May 30 2015 Pavel Vainerman <pv@altlinux.ru> 2.1-alt2
- (optimization): TransportMessage change format
- (uniset-codegen): minor fixes
- (SharedMemory): add new tests
* Thu May 28 2015 Pavel Vainerman <pv@altlinux.ru> 2.1-alt1
- repack header files..
...
...
extensions/SharedMemory/tests/Makefile.am
View file @
9e2d72de
...
...
@@ -17,6 +17,7 @@ check-local: atconfig package.m4 $(TESTSUITE) sm-tests.at
clean-local
:
rm
-rf
$(CLEANFILES)
rm
-rf
$(COVERAGE_REPORT_DIR)
rm
-rf
*
_SK.
*
TestObject_SK.cc TestObject.h
:
testobject.src.xml
$(UNISET_CODEGEN)
-l
$(top_builddir)
/Utilities/codegen
-n
TestObject
--topdir
$(top_builddir)
/
--ask
--no-main
testobject.src.xml
...
...
extensions/SharedMemory/tests/TestObject.cc
View file @
9e2d72de
...
...
@@ -35,3 +35,13 @@ void TestObject::sysCommand( const UniSetTypes::SystemMessage* sm )
evntIsOK
=
true
;
}
// -----------------------------------------------------------------------------
void
TestObject
::
stopHeartbeat
()
{
maxHeartBeat
=
0
;
}
// -----------------------------------------------------------------------------
void
TestObject
::
runHeartbeat
(
int
max
)
{
maxHeartBeat
=
max
;
}
// -----------------------------------------------------------------------------
extensions/SharedMemory/tests/TestObject.h
View file @
9e2d72de
...
...
@@ -15,6 +15,12 @@ class TestObject:
void
askNotifyFirstNotNull
();
inline
bool
getEvnt
(){
return
evntIsOK
;
}
void
stopHeartbeat
();
void
runHeartbeat
(
int
max
=
3
);
inline
timeout_t
getHeartbeatTime
(){
return
ptHeartBeat
.
getInterval
();
}
protected
:
TestObject
();
...
...
extensions/SharedMemory/tests/sm-configure.xml
View file @
9e2d72de
...
...
@@ -30,7 +30,7 @@
<item
node=
"localhost"
name=
"ReservSharedMemory"
/>
</ReservList>
</SharedMemory>
<TestObject
name=
"TestObject"
sensor_s=
"DI2_S"
output_c=
"AO2_C"
/>
<TestObject
name=
"TestObject"
sensor_s=
"DI2_S"
output_c=
"AO2_C"
heartbeat_id=
"TO_Heartbeat_Counter"
heartbeatTime=
"500"
heartbeat_max=
"5"
/>
</settings>
<ObjectsMap
idfromfile=
"1"
>
<nodes
port=
"2809"
unet_broadcast_ip=
"192.168.1.255"
unet_broadcast_ip2=
"192.168.122.255"
>
...
...
@@ -48,7 +48,8 @@
<item
id=
"507"
iotype=
"DI"
name=
"Heartbeat_S"
textname=
"Heartbeat"
/>
<item
id=
"508"
iotype=
"AI"
name=
"AO2_C"
priority=
"Medium"
textname=
"TestObject test"
/>
<item
id=
"509"
iotype=
"DI"
name=
"DI2_S"
priority=
"Medium"
textname=
"TestObject test"
/>
<item
heartbeat=
"1"
heartbeat_ds_name=
"TO_Heartbeat_DS"
heartbeat_node=
"localhost"
id=
"510"
iotype=
"AI"
name=
"TO_Heartbeat_Counter"
textname=
"TestObject: heartbeat counter"
/>
<item
id=
"511"
iotype=
"DI"
name=
"TO_Heartbeat_DS"
textname=
"TestObject: heartbeat"
/>
</sensors>
<thresholds
name=
"thresholds"
>
<sensor
iotype=
"AI"
name=
"AI1_AS"
>
...
...
extensions/SharedMemory/tests/test_sm.cc
View file @
9e2d72de
...
...
@@ -112,15 +112,15 @@ TEST_CASE("[SM]: askSensors", "[sm][ask]")
CHECK
(
obj
->
in_sensor_s
);
ui
->
setValue
(
509
,
0
);
msleep
(
2
00
);
msleep
(
3
00
);
CHECK_FALSE
(
obj
->
in_sensor_s
);
obj
->
out_output_c
=
1200
;
msleep
(
2
00
);
msleep
(
3
00
);
REQUIRE
(
ui
->
getValue
(
508
)
==
1200
);
obj
->
out_output_c
=
100
;
msleep
(
2
00
);
msleep
(
3
00
);
REQUIRE
(
ui
->
getValue
(
508
)
==
100
);
}
// -----------------------------------------------------------------------------
...
...
@@ -158,3 +158,22 @@ TEST_CASE("[SM]: askDoNotNotify", "[sm][ask]")
CHECK
(
obj
->
in_sensor_s
);
// должно придти т.к. равно "1"
}
// -----------------------------------------------------------------------------
TEST_CASE
(
"[SM]: heartbeat test N2"
,
"[sm][heartbeat]"
)
{
InitTest
();
obj
->
runHeartbeat
(
5
);
msleep
(
obj
->
getHeartbeatTime
()
+
100
);
CHECK
(
ui
->
getValue
(
511
)
);
obj
->
runHeartbeat
(
2
);
obj
->
stopHeartbeat
();
msleep
(
3000
);
CHECK_FALSE
(
ui
->
getValue
(
511
)
);
obj
->
runHeartbeat
(
5
);
msleep
(
obj
->
getHeartbeatTime
()
+
100
);
msleep
(
1500
);
CHECK
(
ui
->
getValue
(
511
)
);
}
// -----------------------------------------------------------------------------
extensions/SharedMemory/tests/testobject.src.xml
View file @
9e2d72de
...
...
@@ -3,7 +3,7 @@
<settings>
<set
name=
"class-name"
val=
"TestObject"
/>
<set
name=
"msg-count"
val=
"30"
/>
<set
name=
"sleep-msec"
val=
"1
5
0"
/>
<set
name=
"sleep-msec"
val=
"1
0
0"
/>
</settings>
<variables>
</variables>
...
...
extensions/SharedMemory/tests/tests.sh
View file @
9e2d72de
uniset2.files
View file @
9e2d72de
...
...
@@ -167,6 +167,7 @@ extensions/SharedMemory/tests/NullSM.h
extensions/SharedMemory/tests/TestObject.cc
extensions/SharedMemory/tests/TestObject.h
extensions/SharedMemory/tests/testobject.src.xml
extensions/SharedMemory/tests/sm-configure.xml
extensions/SharedMemoryPlus/Makefile.am
extensions/SharedMemoryPlus/smemory-plus.cc
extensions/SharedMemoryPlus/test.xml
...
...
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