Added Perl EPICS::IOC module and netget test program

This commit is contained in:
Andrew Johnson
2018-08-31 17:47:22 -05:00
parent f0bbae1767
commit 464e8a4f14
4 changed files with 557 additions and 1 deletions

View File

@@ -145,6 +145,9 @@ asyncproctest_SRCS += asyncproctest_registerRecordDeviceDriver.cpp
TESTFILES += $(COMMON_DIR)/asyncproctest.dbd ../asyncproctest.db
TESTS += asyncproctest
# Host-only tests of softIoc/softIocPVA, caget and pvget (if present)
TESTS += netget
# epicsRunRecordTests runs all the test programs in a known working order.
testHarness_SRCS += epicsRunRecordTests.c

View File

@@ -0,0 +1,62 @@
#!/usr/bin/env perl
use strict;
use warnings;
use lib '@TOP@/lib/perl';
use Test::More tests => 3;
use EPICS::IOC;
$ENV{HARNESS_ACTIVE} = 1 if scalar @ARGV && shift eq '-tap';
my $bin = "@TOP@/bin/@ARCH@";
my $exe = ($^O =~ m/^(MSWin32|cygwin)$/x) ? '.exe' : '';
my $prefix = "test-$$";
my $ioc = EPICS::IOC->new();
#$ioc->debug(1);
$SIG{__DIE__} = $SIG{'INT'} = $SIG{'QUIT'} = sub {
$ioc->kill
if ref($ioc) eq 'EPICS::IOC' && $ioc->started;
BAIL_OUT('Caught signal');
};
my $softIoc = "$bin/softIocPVA$exe";
$softIoc = "$bin/softIoc$exe"
unless -x $softIoc;
BAIL_OUT("Can't find a softIoc executable")
unless -x $softIoc;
$ioc->start($softIoc, '-x', $prefix);
$ioc->cmd; # Wait for command prompt
my $pv = "$prefix:BaseVersion";
my @pvs = $ioc->dbl('stringin');
grep(m/$pv/, @pvs)
or BAIL_OUT('No BaseVersion record found');
my $version = $ioc->dbgf("$pv");
like($version, qr/^ \d+ \. \d+ \. \d+ /x,
"Got BaseVersion '$version' from iocsh");
my $caget = "$bin/caget$exe";
SKIP: {
skip "caget not available", 1 unless -x $caget;
like(`$caget $pv`, qr/$pv \s+ \Q$version\E/x,
'Got same BaseVersion from caget');
}
my $pvget = "$bin/pvget$exe";
SKIP: {
skip "softIocPVA not available", 1
if $softIoc eq "$bin/softIoc$exe";
skip "pvget not available", 1
unless -x $pvget;
like(`$pvget $pv`, qr/$pv \s+ \Q$version\E/x,
'Got same BaseVersion from pvget');
}
$ioc->kill;