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
4f790675
Commit
4f790675
authored
Nov 04, 2016
by
Pavel Vainerman
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
(SM): добавил процесс для попытки найти проблемму потери сообщений..
parent
c8dde088
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
198 additions
and
2 deletions
+198
-2
test.xml
conf/test.xml
+3
-0
LostTestProc.cc
extensions/tests/SMemoryTest/LostTestProc.cc
+69
-0
LostTestProc.h
extensions/tests/SMemoryTest/LostTestProc.h
+34
-0
Makefile.am
extensions/tests/SMemoryTest/Makefile.am
+16
-2
sm-lostmessage-test.cc
extensions/tests/SMemoryTest/sm-lostmessage-test.cc
+63
-0
start_fg_losttest.sh
extensions/tests/SMemoryTest/start_fg_losttest.sh
+9
-0
uniset2.files
uniset2.files
+4
-0
No files found.
conf/test.xml
View file @
4f790675
...
@@ -39,6 +39,9 @@
...
@@ -39,6 +39,9 @@
<LogServer
name=
"smplus"
port=
"3333"
host=
"localhost"
/>
<LogServer
name=
"smplus"
port=
"3333"
host=
"localhost"
/>
<settings>
<settings>
<LostTestProc
name=
"TestProc1"
sensor_s=
"Input4_S"
/>
<TestProc
name=
"TestProc1"
<TestProc
name=
"TestProc1"
on_s=
"Input1_S"
on_s=
"Input1_S"
lamp_c=
"Lamp58_C"
lamp_c=
"Lamp58_C"
...
...
extensions/tests/SMemoryTest/LostTestProc.cc
0 → 100644
View file @
4f790675
#include <iomanip>
#include "Exceptions.h"
#include "LostTestProc.h"
// -----------------------------------------------------------------------------
using
namespace
std
;
using
namespace
UniSetTypes
;
// -----------------------------------------------------------------------------
LostTestProc
::
LostTestProc
(
UniSetTypes
::
ObjectId
id
,
xmlNode
*
confnode
)
:
LostTestProc_SK
(
id
,
confnode
)
{
}
// -----------------------------------------------------------------------------
LostTestProc
::~
LostTestProc
()
{
}
// -----------------------------------------------------------------------------
LostTestProc
::
LostTestProc
()
{
cerr
<<
": init failed!!!!!!!!!!!!!!!"
<<
endl
;
throw
UniSetTypes
::
Exception
(
myname
+
"(init): FAILED.."
);
}
// -----------------------------------------------------------------------------
void
LostTestProc
::
sysCommand
(
const
UniSetTypes
::
SystemMessage
*
sm
)
{
LostTestProc_SK
::
sysCommand
(
sm
);
if
(
sm
->
command
==
SystemMessage
::
StartUp
||
sm
->
command
==
SystemMessage
::
WatchDog
)
{
askTimer
(
tmCheck
,
checkTime
);
}
}
// -----------------------------------------------------------------------------
void
LostTestProc
::
timerInfo
(
const
TimerMessage
*
tm
)
{
if
(
tm
->
id
==
tmCheck
)
{
try
{
long
smValue
=
ui
->
getValue
(
sensor_s
);
if
(
smValue
!=
in_sensor_s
)
{
mycrit
<<
myname
<<
"(check): ERROR!! smValue="
<<
smValue
<<
" != "
<<
strval
(
sensor_s
)
<<
endl
;
//std::terminate();
UniSetTypes
::
SimpleInfo_var
i
=
getInfo
();
mycrit
<<
i
->
info
<<
endl
;
std
::
abort
();
}
// cerr << "sm_value=" << smValue << " save " << (in_sensor_s+1) << endl;
// Выставляем новое значение
ui
->
setValue
(
sensor_s
,
in_sensor_s
+
1
);
// проверяем что сохранилось
smValue
=
ui
->
getValue
(
sensor_s
);
if
(
ui
->
getValue
(
sensor_s
)
!=
(
in_sensor_s
+
1
)
)
{
mycrit
<<
myname
<<
"(check): SAVE TO SM ERROR!! smValue="
<<
smValue
<<
strval
(
sensor_s
)
<<
endl
;
std
::
abort
();
}
}
catch
(
std
::
exception
&
ex
)
{
mycrit
<<
myname
<<
"(check): "
<<
ex
.
what
()
<<
endl
;
}
}
}
// -----------------------------------------------------------------------------
extensions/tests/SMemoryTest/LostTestProc.h
0 → 100644
View file @
4f790675
// -----------------------------------------------------------------------------
#ifndef LostTestProc_H_
#define LostTestProc_H_
// -----------------------------------------------------------------------------
#include <vector>
#include "Debug.h"
#include "LostTestProc_SK.h"
// -----------------------------------------------------------------------------
/* Цель: поймать расхождение значения в SM и в in_-переменной в процессе.
* Тест: Каждые checkTime проверяем текущее значение в SM и в процессе, меняем в SM и опять проверяем.
*/
class
LostTestProc
:
public
LostTestProc_SK
{
public
:
LostTestProc
(
UniSetTypes
::
ObjectId
id
,
xmlNode
*
confnode
=
UniSetTypes
::
uniset_conf
()
->
getNode
(
"LostTestProc"
)
);
virtual
~
LostTestProc
();
protected
:
LostTestProc
();
enum
Timers
{
tmCheck
};
virtual
void
timerInfo
(
const
UniSetTypes
::
TimerMessage
*
tm
)
override
;
virtual
void
sysCommand
(
const
UniSetTypes
::
SystemMessage
*
sm
)
override
;
private
:
};
// -----------------------------------------------------------------------------
#endif // LostTestProc_H_
// -----------------------------------------------------------------------------
extensions/tests/SMemoryTest/Makefile.am
View file @
4f790675
noinst_PROGRAMS
=
smemory-test
noinst_PROGRAMS
=
smemory-test
sm-lostmessage-test
smemory_test_LDADD
=
$(top_builddir)
/lib/libUniSet2.la
\
smemory_test_LDADD
=
$(top_builddir)
/lib/libUniSet2.la
\
$(top_builddir)
/extensions/lib/libUniSet2Extensions.la
\
$(top_builddir)
/extensions/lib/libUniSet2Extensions.la
\
$(top_builddir)
/extensions/SharedMemory/libUniSet2SharedMemory.la
\
$(top_builddir)
/extensions/SharedMemory/libUniSet2SharedMemory.la
\
...
@@ -9,11 +9,25 @@ smemory_test_CPPFLAGS = -I$(top_builddir)/include \
...
@@ -9,11 +9,25 @@ smemory_test_CPPFLAGS = -I$(top_builddir)/include \
$(SIGC_CFLAGS)
$(POCO_CFLAGS)
$(SIGC_CFLAGS)
$(POCO_CFLAGS)
smemory_test_SOURCES
=
TestProc_SK.cc TestProc.cc smemory-test.cc
smemory_test_SOURCES
=
TestProc_SK.cc TestProc.cc smemory-test.cc
BUILT_SOURCES
=
TestProc_SK.cc TestProc_SK.h
BUILT_SOURCES
=
TestProc_SK.cc TestProc_SK.h
LostTestProc_SK.cc LostTestProc_SK.h
TestProc_SK.cc TestProc_SK.h
:
testproc.src.xml
TestProc_SK.cc TestProc_SK.h
:
testproc.src.xml
$(SHELL)
$(top_builddir)
/Utilities/codegen/@PACKAGE@-codegen
-l
$(top_builddir)
/Utilities/codegen
--ask
-n
TestProc
--local-include
--topdir
$(top_builddir)
/
--no-main
testproc.src.xml
$(SHELL)
$(top_builddir)
/Utilities/codegen/@PACKAGE@-codegen
-l
$(top_builddir)
/Utilities/codegen
--ask
-n
TestProc
--local-include
--topdir
$(top_builddir)
/
--no-main
testproc.src.xml
LostTestProc_SK.cc LostTestProc_SK.h
:
losttestproc.src.xml
$(SHELL)
$(top_builddir)
/Utilities/codegen/@PACKAGE@-codegen
-l
$(top_builddir)
/Utilities/codegen
--ask
-n
LostTestProc
--local-include
--topdir
$(top_builddir)
/
--no-main
losttestproc.src.xml
sm_lostmessage_test_LDADD
=
$(top_builddir)
/lib/libUniSet2.la
\
$(top_builddir)
/extensions/lib/libUniSet2Extensions.la
\
$(top_builddir)
/extensions/SharedMemory/libUniSet2SharedMemory.la
\
$(SIGC_LIBS)
$(POCO_LIBS)
sm_lostmessage_test_CPPFLAGS
=
-I
$(top_builddir)
/include
\
-I
$(top_builddir)
/extensions/include
\
-I
$(top_builddir)
/extensions/SharedMemory
\
$(SIGC_CFLAGS)
$(POCO_CFLAGS)
sm_lostmessage_test_SOURCES
=
LostTestProc_SK.cc LostTestProc.cc sm-lostmessage-test.cc
clean-local
:
clean-local
:
rm
-rf
*
_SK.cc
*
_SK.h
rm
-rf
*
_SK.cc
*
_SK.h
...
...
extensions/tests/SMemoryTest/sm-lostmessage-test.cc
0 → 100644
View file @
4f790675
#include <string>
#include "Debug.h"
#include "UniSetActivator.h"
#include "SharedMemory.h"
#include "Extensions.h"
#include "LostTestProc.h"
// --------------------------------------------------------------------------
using
namespace
std
;
using
namespace
UniSetTypes
;
using
namespace
UniSetExtensions
;
// --------------------------------------------------------------------------
int
main
(
int
argc
,
const
char
**
argv
)
{
if
(
argc
>
1
&&
(
strcmp
(
argv
[
1
],
"--help"
)
==
0
||
strcmp
(
argv
[
1
],
"-h"
)
==
0
)
)
{
cout
<<
"--confile - Использовать указанный конф. файл. По умолчанию configure.xml"
<<
endl
;
SharedMemory
::
help_print
(
argc
,
argv
);
return
0
;
}
try
{
auto
conf
=
uniset_init
(
argc
,
argv
);
auto
act
=
UniSetActivator
::
Instance
();
int
num
=
conf
->
getArgPInt
(
"--numproc"
,
1
);
for
(
int
i
=
1
;
i
<=
num
;
i
++
)
{
ostringstream
s
;
s
<<
"TestProc"
<<
i
;
cout
<<
"..create "
<<
s
.
str
()
<<
endl
;
auto
tp
=
make_shared
<
LostTestProc
>
(
conf
->
getObjectID
(
s
.
str
()));
// tp->init_dlog(dlog());
act
->
add
(
tp
);
}
SystemMessage
sm
(
SystemMessage
::
StartUp
);
act
->
broadcast
(
sm
.
transport_msg
()
);
act
->
run
(
false
);
return
0
;
}
catch
(
const
SystemError
&
err
)
{
cerr
<<
"(lostmessage-test): "
<<
err
<<
endl
;
}
catch
(
const
UniSetTypes
::
Exception
&
ex
)
{
cerr
<<
"(lostmessage-test): "
<<
ex
<<
endl
;
}
catch
(
const
std
::
exception
&
e
)
{
cerr
<<
"(lostmessage-test): "
<<
e
.
what
()
<<
endl
;
}
catch
(...)
{
cerr
<<
"(lostmessage-test): catch(...)"
<<
endl
;
}
return
1
;
}
extensions/tests/SMemoryTest/start_fg_losttest.sh
0 → 100755
View file @
4f790675
#!/bin/sh
START
=
uniset2-start.sh
${
START
}
-f
./sm-lostmessage-test
--confile
./test.xml
--TestProc1-log-add-levels
crit,warn
--ulog-add-levels
crit
$*
# --uniset-abort-script ./abort-script-example.sh
#--ulog-add-levels crit,warn,info
#system,level2,level8,level9
uniset2.files
View file @
4f790675
...
@@ -192,6 +192,10 @@ extensions/tests/SMemoryTest/test.xml
...
@@ -192,6 +192,10 @@ extensions/tests/SMemoryTest/test.xml
extensions/tests/SMemoryTest/TestProc.cc
extensions/tests/SMemoryTest/TestProc.cc
extensions/tests/SMemoryTest/TestProc.h
extensions/tests/SMemoryTest/TestProc.h
extensions/tests/SMemoryTest/testproc.src.xml
extensions/tests/SMemoryTest/testproc.src.xml
extensions/tests/SMemoryTest/LostTestProc.cc
extensions/tests/SMemoryTest/LostTestProc.h
extensions/tests/SMemoryTest/losttestproc.src.xml
extensions/tests/SMemoryTest/sm-lostmessage-test.cc
extensions/tests/SMemoryTest/Makefile.am
extensions/tests/SMemoryTest/Makefile.am
extensions/tests/MBSlaveTest/mbslave-test.cc
extensions/tests/MBSlaveTest/mbslave-test.cc
extensions/tests/MBSlaveTest/test.xml
extensions/tests/MBSlaveTest/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