in reply to Re^2: testing of named pipes
in thread testing of named pipes
Update: after explicitelly triggering the Event loop after each write to the pipes, things seem to work fine. I will make a more detailed check this evening.
sub testSequence () { my $appControlFifo; my $deviceControlFifo; if ('' eq (-p "$sm->{config}->{deviceControl}" )) { POSIX::mkfifo ("$sm->{config}->{deviceControl}", 0700); } # shorthands for pipe handles open ($appControlFifo, "+>", $sm->{config}->{fifoControl}->{control +}) || die "Could not open status pipe for writing ($!)\n"; open ($deviceControlFifo, "+>", $sm->{config}->{deviceControl}) || +die "Could not open status pipe for writing ($!)\n"; $| = 1; $appControlFifo->autoflush(1); $deviceControlFifo->autoflush(1); # test sequence print $appControlFifo "connect to device\n"; # state transition: 01 + -> 02, currently automatically set Event::one_event(); print $deviceControlFifo "^MODE:1,1\n"; # state transition: 02 + -> 03 Event::one_event(); print "State Instance:>>> " . $sm->Instance() . "\n"; if ($sm->Instance() =~ "Statemachine::03") # check if transition +succeeded (kind of ASSERT) { print "transition succeeded\n"; } print $appControlFifo "connect to internet\n"; # state transition: +03 -> 04 Event::one_event(); print $appControlFifo "internet connected\n"; # state transition: 0 +3 -> 04 Event::one_event(); }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^4: testing of named pipes
by jcb (Parson) on Aug 27, 2019 at 23:05 UTC |