Add automated tests for msi.
This commit is contained in:
@@ -12,11 +12,7 @@ TESTPROD_HOST += dbltExpand
|
||||
dbltExpand_SRCS += dbltExpand.c
|
||||
dbltExpand_LIBS += dbtoolsIoc dbStaticHost Com
|
||||
|
||||
|
||||
#TESTPROD_HOST += callbackTest
|
||||
#callbackTest_SRCS += callbackTest.c
|
||||
#TESTS += callbackTest
|
||||
|
||||
TESTS += msi
|
||||
|
||||
TESTSCRIPTS_HOST += $(TESTS:%=%.t)
|
||||
|
||||
|
||||
42
src/dbtools/test/msi.plt
Normal file
42
src/dbtools/test/msi.plt
Normal file
@@ -0,0 +1,42 @@
|
||||
#!/usr/bin/perl
|
||||
#*************************************************************************
|
||||
# Copyright (c) 2012 UChicago Argonne LLC, as Operator of Argonne
|
||||
# National Laboratory.
|
||||
# EPICS BASE is distributed subject to a Software License Agreement found
|
||||
# in file LICENSE that is included with this distribution.
|
||||
#*************************************************************************
|
||||
|
||||
# Script to run tests on the msi program
|
||||
|
||||
use FindBin qw($Bin); # To find the msi executable
|
||||
|
||||
use strict;
|
||||
use Test;
|
||||
|
||||
BEGIN {plan tests => 6}
|
||||
|
||||
ok(msi('-I.. ../t1-template.txt'), slurp('../t1-result.txt'));
|
||||
ok(msi('-I.. -S ../t2-substitution.txt'), slurp('../t2-result.txt'));
|
||||
ok(msi('-I.. -S ../t3-substitution.txt'), slurp('../t3-result.txt'));
|
||||
ok(msi('-g -I.. -S ../t4-substitution.txt'),slurp('../t4-result.txt'));
|
||||
ok(msi('-S ../t5-substitute.txt ../t5-template.txt'), slurp('../t5-result.txt'));
|
||||
ok(msi('-S ../t6-substitute.txt ../t6-template.txt'), slurp('../t6-result.txt'));
|
||||
|
||||
|
||||
# Support routines
|
||||
|
||||
sub slurp {
|
||||
my ($file) = @_;
|
||||
open my $in, '<', $file
|
||||
or die "Can't open file $file: $!\n";
|
||||
my $contents = do { local $/; <$in> };
|
||||
return $contents;
|
||||
}
|
||||
|
||||
sub msi {
|
||||
my ($args) = @_;
|
||||
my $arch = $ENV{EPICS_HOST_ARCH};
|
||||
my $exe = ($^O eq 'MSWin32') || ($^O eq 'cygwin') ? '.exe' : '';
|
||||
my $msi = "$Bin/../../O.$arch/msi$exe";
|
||||
return `$msi $args`;
|
||||
}
|
||||
@@ -1,9 +0,0 @@
|
||||
#test of a pattern
|
||||
pattern {a,b}
|
||||
{xxx,"yyy"}
|
||||
{zzz , ttt}
|
||||
|
||||
{
|
||||
vvv
|
||||
zzz
|
||||
}
|
||||
@@ -1,20 +0,0 @@
|
||||
global {a=gbl-a, b=gbl-b}
|
||||
file t1.txt {
|
||||
pattern {a, b, c}
|
||||
{}
|
||||
{pat-a}
|
||||
{pat-a, pat-b}
|
||||
{pat-a, pat-b, pat-c}
|
||||
{pat-a, pat-b}
|
||||
{pat-a}
|
||||
{}
|
||||
}
|
||||
file t1.txt {
|
||||
{}
|
||||
{a=val-a}
|
||||
{a=val-a, b=val-b}
|
||||
{a=val-a, b=val-b, c=val-c}
|
||||
{a=val-a, b=val-b}
|
||||
{a=val-a}
|
||||
{}
|
||||
}
|
||||
@@ -1,5 +0,0 @@
|
||||
{a=111,b="222"}
|
||||
{ a = aaa , b=bbb}
|
||||
{a= aaa
|
||||
b= bbb
|
||||
}
|
||||
@@ -1,5 +1,5 @@
|
||||
This is include-file $(include-file-again=)
|
||||
This is t1-include.txt $(include-file-again=)
|
||||
a = $(a=default value used when a is undefined)
|
||||
b = $(b=default value used when b is undefined)
|
||||
substitute "include-file-again=again"
|
||||
End of include-file.
|
||||
End of t1-include.txt
|
||||
21
src/dbtools/test/t1-result.txt
Normal file
21
src/dbtools/test/t1-result.txt
Normal file
@@ -0,0 +1,21 @@
|
||||
This is t1-template.txt
|
||||
|
||||
With $(a,undefined) & $(b,undefined):
|
||||
This is t1-include.txt
|
||||
a = default value used when a is undefined
|
||||
b = default value used when b is undefined
|
||||
End of t1-include.txt
|
||||
|
||||
On defining a=aaa & b=bbb:
|
||||
This is t1-include.txt again
|
||||
a = aaa
|
||||
b = bbb
|
||||
End of t1-include.txt
|
||||
|
||||
On setting a="aa":
|
||||
This is t1-include.txt again
|
||||
a = "aa"
|
||||
b = bbb
|
||||
End of t1-include.txt
|
||||
|
||||
End of t1-template.txt
|
||||
14
src/dbtools/test/t1-template.txt
Normal file
14
src/dbtools/test/t1-template.txt
Normal file
@@ -0,0 +1,14 @@
|
||||
This is t1-template.txt
|
||||
|
||||
With $(a) & ${b}:
|
||||
include "t1-include.txt"
|
||||
|
||||
substitute "a=aaa,b=bbb"
|
||||
On defining a=$(a) & b=${b}:
|
||||
include "t1-include.txt"
|
||||
|
||||
substitute "a=\"aa\""
|
||||
On setting a=$(a):
|
||||
include "t1-include.txt"
|
||||
|
||||
End of t1-template.txt
|
||||
6
src/dbtools/test/t2-result.txt
Normal file
6
src/dbtools/test/t2-result.txt
Normal file
@@ -0,0 +1,6 @@
|
||||
a = va1-a b = def-b c = def-c d = $(d,undefined)
|
||||
a = va2-a b = va2-b c = def-c d = $(d,undefined)
|
||||
a = va3-a b = va3-b c = va3-c d = $(d,undefined)
|
||||
a = va4-a b = va4-b c = def-c d = $(d,undefined)
|
||||
a = va5-a b = def-b c = def-c d = $(d,undefined)
|
||||
a = pt3-a b = pt3-b c = pt3-c d = $(d,undefined)
|
||||
11
src/dbtools/test/t2-substitution.txt
Normal file
11
src/dbtools/test/t2-substitution.txt
Normal file
@@ -0,0 +1,11 @@
|
||||
file t2-template.txt {
|
||||
{a=va1-a}
|
||||
{a=va2-a, b=va2-b}
|
||||
{a=va3-a, b=va3-b, c=va3-c}
|
||||
{a=va4-a, b=va4-b}
|
||||
{a=va5-a}
|
||||
}
|
||||
file t2-template.txt {
|
||||
pattern {a, b, c}
|
||||
{pt3-a, pt3-b, pt3-c}
|
||||
}
|
||||
28
src/dbtools/test/t3-result.txt
Normal file
28
src/dbtools/test/t3-result.txt
Normal file
@@ -0,0 +1,28 @@
|
||||
a = gb1-a b = gb1-b c = def-c d = $(d,undefined)
|
||||
a = va1-a b = gb1-b c = def-c d = $(d,undefined)
|
||||
a = va2-a b = va2-b c = def-c d = $(d,undefined)
|
||||
a = va3-a b = va3-b c = va3-c d = $(d,undefined)
|
||||
a = va4-a b = va4-b c = def-c d = $(d,undefined)
|
||||
a = va5-a b = gb1-b c = def-c d = $(d,undefined)
|
||||
a = gb1-a b = gb1-b c = def-c d = $(d,undefined)
|
||||
a = gb2-a b = gb2-b c = def-c d = $(d,undefined)
|
||||
a = va1-a b = gb2-b c = def-c d = $(d,undefined)
|
||||
a = va2-a b = va2-b c = def-c d = $(d,undefined)
|
||||
a = va3-a b = va3-b c = va3-c d = $(d,undefined)
|
||||
a = va4-a b = va4-b c = def-c d = $(d,undefined)
|
||||
a = va5-a b = gb2-b c = def-c d = $(d,undefined)
|
||||
a = gb2-a b = gb2-b c = def-c d = $(d,undefined)
|
||||
a = gb3-a b = gb3-b c = def-c d = $(d,undefined)
|
||||
a = pt1-a b = gb3-b c = def-c d = $(d,undefined)
|
||||
a = pt2-a b = pt2-b c = def-c d = $(d,undefined)
|
||||
a = pt3-a b = pt3-b c = pt3-c d = $(d,undefined)
|
||||
a = pt4-a b = pt4-b c = def-c d = $(d,undefined)
|
||||
a = pt5-a b = gb3-b c = def-c d = $(d,undefined)
|
||||
a = gb3-a b = gb3-b c = def-c d = $(d,undefined)
|
||||
a = gb4-a b = gb4-b c = def-c d = $(d,undefined)
|
||||
a = pt1-a b = gb4-b c = def-c d = $(d,undefined)
|
||||
a = pt2-a b = pt2-b c = def-c d = $(d,undefined)
|
||||
a = pt3-a b = pt3-b c = pt3-c d = $(d,undefined)
|
||||
a = pt4-a b = pt4-b c = def-c d = $(d,undefined)
|
||||
a = pt5-a b = gb4-b c = def-c d = $(d,undefined)
|
||||
a = gb4-a b = gb4-b c = def-c d = $(d,undefined)
|
||||
37
src/dbtools/test/t3-substitution.txt
Normal file
37
src/dbtools/test/t3-substitution.txt
Normal file
@@ -0,0 +1,37 @@
|
||||
global {a=gb1-a, b=gb1-b}
|
||||
file t3-template.txt {
|
||||
{}
|
||||
{a=va1-a}
|
||||
{a=va2-a, b=va2-b}
|
||||
{a=va3-a, b=va3-b, c=va3-c}
|
||||
{a=va4-a, b=va4-b}
|
||||
{a=va5-a}
|
||||
{}
|
||||
global {a=gb2-a, b=gb2-b}
|
||||
{}
|
||||
{a=va1-a}
|
||||
{a=va2-a, b=va2-b}
|
||||
{a=va3-a, b=va3-b, c=va3-c}
|
||||
{a=va4-a, b=va4-b}
|
||||
{a=va5-a}
|
||||
{}
|
||||
}
|
||||
global {b=gb3-b, a=gb3-a}
|
||||
file t3-template.txt {
|
||||
pattern {a, b, c}
|
||||
{}
|
||||
{pt1-a}
|
||||
{pt2-a, pt2-b}
|
||||
{pt3-a, pt3-b, pt3-c}
|
||||
{pt4-a, pt4-b}
|
||||
{pt5-a}
|
||||
{}
|
||||
global {b=gb4-b, a=gb4-a}
|
||||
{}
|
||||
{pt1-a}
|
||||
{pt2-a, pt2-b}
|
||||
{pt3-a, pt3-b, pt3-c}
|
||||
{pt4-a, pt4-b}
|
||||
{pt5-a}
|
||||
{}
|
||||
}
|
||||
1
src/dbtools/test/t3-template.txt
Normal file
1
src/dbtools/test/t3-template.txt
Normal file
@@ -0,0 +1 @@
|
||||
a = $(a=def-a) b = $(b=def-b) c = $(c=def-c) d = $(d,undef)
|
||||
6
src/dbtools/test/t4-result.txt
Normal file
6
src/dbtools/test/t4-result.txt
Normal file
@@ -0,0 +1,6 @@
|
||||
a = va1-a b = def-b c = def-c d = $(d,undefined)
|
||||
a = va2-a b = va2-b c = def-c d = $(d,undefined)
|
||||
a = va3-a b = va3-b c = va3-c d = $(d,undefined)
|
||||
a = va4-a b = va4-b c = va3-c d = $(d,undefined)
|
||||
a = va5-a b = va4-b c = va3-c d = $(d,undefined)
|
||||
a = pt3-a b = pt3-b c = pt3-c d = $(d,undefined)
|
||||
11
src/dbtools/test/t4-substitution.txt
Normal file
11
src/dbtools/test/t4-substitution.txt
Normal file
@@ -0,0 +1,11 @@
|
||||
file t2-template.txt {
|
||||
{a=va1-a}
|
||||
{a=va2-a, b=va2-b}
|
||||
{a=va3-a, b=va3-b, c=va3-c}
|
||||
{a=va4-a, b=va4-b}
|
||||
{a=va5-a}
|
||||
}
|
||||
file t2-template.txt {
|
||||
pattern {a, b, c}
|
||||
{pt3-a, pt3-b, pt3-c}
|
||||
}
|
||||
20
src/dbtools/test/t5-result.txt
Normal file
20
src/dbtools/test/t5-result.txt
Normal file
@@ -0,0 +1,20 @@
|
||||
# comment line
|
||||
a = 111
|
||||
b = 222
|
||||
c = xx
|
||||
d = $(d,undefined)
|
||||
# comment line
|
||||
a = aaa
|
||||
b = bbb
|
||||
c = ccc
|
||||
d = $(d,undefined)
|
||||
# comment line
|
||||
a = AA
|
||||
b = BB
|
||||
c = xx
|
||||
d = $(d,undefined)
|
||||
# comment line
|
||||
a = aaa
|
||||
b = bbb
|
||||
c = yy
|
||||
d = $(d,undefined)
|
||||
9
src/dbtools/test/t5-substitute.txt
Normal file
9
src/dbtools/test/t5-substitute.txt
Normal file
@@ -0,0 +1,9 @@
|
||||
global {c=xx}
|
||||
{a=111,b="222"}
|
||||
{ a = aaa , b=bbb , c = ccc}
|
||||
{a=AA,b='BB'}
|
||||
global { c = yy }
|
||||
{
|
||||
a= aaa
|
||||
b= bbb
|
||||
}
|
||||
5
src/dbtools/test/t5-template.txt
Normal file
5
src/dbtools/test/t5-template.txt
Normal file
@@ -0,0 +1,5 @@
|
||||
# comment line
|
||||
a = $(a)
|
||||
b = $(b)
|
||||
c = $(c)
|
||||
d = $(d)
|
||||
20
src/dbtools/test/t6-result.txt
Normal file
20
src/dbtools/test/t6-result.txt
Normal file
@@ -0,0 +1,20 @@
|
||||
# comment line
|
||||
a = 111
|
||||
b = 222
|
||||
c = xx
|
||||
d = $(d,undefined)
|
||||
# comment line
|
||||
a = aaa
|
||||
b = bbb
|
||||
c = ccc
|
||||
d = $(d,undefined)
|
||||
# comment line
|
||||
a = AA
|
||||
b = BB
|
||||
c = xx
|
||||
d = $(d,undefined)
|
||||
# comment line
|
||||
a = aaa
|
||||
b = bbb
|
||||
c = yy
|
||||
d = $(d,undefined)
|
||||
13
src/dbtools/test/t6-substitute.txt
Normal file
13
src/dbtools/test/t6-substitute.txt
Normal file
@@ -0,0 +1,13 @@
|
||||
global {c=xx}
|
||||
pattern {b,a}
|
||||
{"222",111}
|
||||
pattern {a b c}
|
||||
{ aaa , bbb , ccc}
|
||||
pattern { a , b }
|
||||
{AA,'BB'}
|
||||
global { c = yy }
|
||||
pattern { a , b }
|
||||
{
|
||||
aaa
|
||||
bbb
|
||||
}
|
||||
5
src/dbtools/test/t6-template.txt
Normal file
5
src/dbtools/test/t6-template.txt
Normal file
@@ -0,0 +1,5 @@
|
||||
# comment line
|
||||
a = $(a)
|
||||
b = $(b)
|
||||
c = $(c)
|
||||
d = $(d)
|
||||
@@ -1,4 +1,5 @@
|
||||
# comment line
|
||||
$(a)
|
||||
this is a test $(b)
|
||||
$(d)
|
||||
a = $(a)
|
||||
b = $(b)
|
||||
c = $(c)
|
||||
d = $(d)
|
||||
|
||||
@@ -1,14 +0,0 @@
|
||||
This is test-file
|
||||
|
||||
With $(a) & ${b}:
|
||||
include "include-file"
|
||||
|
||||
substitute "a=aaa,b=bbb"
|
||||
On defining a=$(a) & b=${b}:
|
||||
include "include-file"
|
||||
|
||||
substitute "a=\"aa\""
|
||||
On setting a=$(a):
|
||||
include "include-file"
|
||||
|
||||
End of test-file.
|
||||
Reference in New Issue
Block a user