mirror of
https://github.com/samba-team/samba.git
synced 2024-12-25 23:21:54 +03:00
r12470: Add helper module for pidl tests
Convert other pidl tests to use Test::More and run them from 'make test'
This commit is contained in:
parent
6967b98849
commit
3a57d29a62
@ -634,6 +634,8 @@ sub Parse($)
|
||||
my $idl = shift;
|
||||
|
||||
return undef unless (defined($idl));
|
||||
|
||||
Parse::Pidl::NDR::Validate($idl);
|
||||
|
||||
my @ndr = ();
|
||||
|
||||
|
@ -17,10 +17,7 @@ $VERSION = '0.01';
|
||||
my($res);
|
||||
my($tab_depth);
|
||||
|
||||
sub pidl ($)
|
||||
{
|
||||
$res .= shift;
|
||||
}
|
||||
sub pidl($) { $res .= shift; }
|
||||
|
||||
sub tabs()
|
||||
{
|
||||
@ -261,7 +258,7 @@ sub HeaderFunctionInOut_needed($$)
|
||||
return undef;
|
||||
}
|
||||
|
||||
my %headerstructs = ();
|
||||
my %headerstructs;
|
||||
|
||||
#####################################################################
|
||||
# parse a function
|
||||
@ -313,8 +310,6 @@ sub HeaderInterface($)
|
||||
{
|
||||
my($interface) = shift;
|
||||
|
||||
my $count = 0;
|
||||
|
||||
pidl "#ifndef _HEADER_$interface->{NAME}\n";
|
||||
pidl "#define _HEADER_$interface->{NAME}\n\n";
|
||||
|
||||
@ -337,6 +332,7 @@ sub HeaderInterface($)
|
||||
|
||||
foreach my $d (@{$interface->{DATA}}) {
|
||||
next if ($d->{TYPE} ne "FUNCTION");
|
||||
|
||||
HeaderFunction($d);
|
||||
}
|
||||
|
||||
@ -351,9 +347,10 @@ sub Parse($)
|
||||
$tab_depth = 0;
|
||||
|
||||
$res = "";
|
||||
%headerstructs = ();
|
||||
pidl "/* header auto-generated by pidl */\n\n";
|
||||
foreach my $x (@{$idl}) {
|
||||
($x->{TYPE} eq "INTERFACE") && HeaderInterface($x);
|
||||
foreach (@{$idl}) {
|
||||
($_->{TYPE} eq "INTERFACE") && HeaderInterface($_);
|
||||
}
|
||||
return $res;
|
||||
}
|
||||
|
@ -648,7 +648,6 @@ sub process_file($)
|
||||
defined($opt_samba3_header) or defined($opt_samba3_server) or
|
||||
defined($opt_samba3_template) or defined($opt_samba3_client)) {
|
||||
require Parse::Pidl::NDR;
|
||||
Parse::Pidl::NDR::Validate($pidl);
|
||||
$ndr = Parse::Pidl::NDR::Parse($pidl);
|
||||
}
|
||||
|
||||
|
94
source/pidl/tests/Util.pm
Normal file
94
source/pidl/tests/Util.pm
Normal file
@ -0,0 +1,94 @@
|
||||
# Some simple utility functions for pidl tests
|
||||
# Copyright (C) 2005 Jelmer Vernooij
|
||||
# Published under the GNU General Public License
|
||||
|
||||
package Util;
|
||||
|
||||
require Exporter;
|
||||
@ISA = qw(Exporter);
|
||||
@EXPORT_OK = qw(test_samba4_ndr);
|
||||
|
||||
use strict;
|
||||
|
||||
use Test::More;
|
||||
use Parse::Pidl::IDL;
|
||||
use Parse::Pidl::NDR;
|
||||
use Parse::Pidl::Samba4::NDR::Parser;
|
||||
use Parse::Pidl::Samba4::Header;
|
||||
|
||||
my $sanecc = 0;
|
||||
|
||||
# Generate a Samba4 parser for an IDL fragment and run it with a specified
|
||||
# piece of code to check whether the parser works as expected
|
||||
sub test_samba4_ndr($$$)
|
||||
{
|
||||
my ($name,$idl,$c) = @_;
|
||||
my $pidl = Parse::Pidl::IDL::parse_string("interface echo { $idl }; ", "<$name>");
|
||||
|
||||
ok (defined($pidl), "($name) parse idl");
|
||||
my $header = Parse::Pidl::Samba4::Header::Parse($pidl);
|
||||
ok(defined($header), "($name) generate generic header");
|
||||
my $pndr = Parse::Pidl::NDR::Parse($pidl);
|
||||
ok(defined($pndr), "($name) generate NDR tree");
|
||||
my ($ndrheader,$ndrparser) = Parse::Pidl::Samba4::NDR::Parser::Parse($pndr, "foo");
|
||||
ok(defined($ndrparser), "($name) generate NDR parser");
|
||||
ok(defined($ndrheader), "($name) generate NDR header");
|
||||
|
||||
SKIP: {
|
||||
|
||||
my $insamba = -f "include/includes.h";
|
||||
my $link = $insamba && 0; # FIXME
|
||||
|
||||
skip "no samba environment available, skipping compilation", 3
|
||||
if not $insamba;
|
||||
|
||||
skip "no sane C compiler, skipping compilation", 3
|
||||
if not $sanecc;
|
||||
|
||||
my $outfile = "test-$name";
|
||||
|
||||
#my $cflags = $ENV{CFLAGS};
|
||||
my $cflags = "-Iinclude -I.";
|
||||
|
||||
if ($insamba and $link) {
|
||||
open CC, "|cc -x c -o $outfile $cflags -";
|
||||
} elsif ($insamba) {
|
||||
open CC, "|cc -x c -c -o $outfile $cflags -";
|
||||
}
|
||||
print CC "#include \"includes.h\"\n";
|
||||
print CC $header;
|
||||
print CC $ndrheader;
|
||||
print CC $ndrparser;
|
||||
print CC "int main(int argc, const char **argv)
|
||||
{
|
||||
TALLOC_CTX *mem_ctx = talloc_init(NULL);
|
||||
|
||||
$c
|
||||
|
||||
talloc_free(mem_ctx);
|
||||
|
||||
return 0; }\n";
|
||||
close CC;
|
||||
|
||||
ok(-f $outfile, "($name) compile");
|
||||
|
||||
unless ($link) {
|
||||
skip "no shared libraries of Samba available yet, can't run test", 2;
|
||||
unlink($outfile);
|
||||
}
|
||||
|
||||
ok(system($outfile), "($name) run");
|
||||
|
||||
ok(unlink($outfile), "($name) remove");
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
my $outfile = "test"; # FIXME: Somewhat more unique name
|
||||
|
||||
# Test whether CC is sane. The real 'fix' here would be using the
|
||||
# Samba build system, but unfortunately, we have no way of hooking into that
|
||||
# yet so we're running CC directly for now
|
||||
$sanecc = 1 if system('echo "main() {}"'." | cc -I. -x c -c - -o $outfile") == 0;
|
||||
|
||||
1;
|
@ -3,9 +3,13 @@
|
||||
# (C) 2005 Jelmer Vernooij. Published under the GNU GPL
|
||||
use strict;
|
||||
|
||||
use Test::Simple tests => 1;
|
||||
use Test::More tests => 5 * 8;
|
||||
use FindBin qw($RealBin);
|
||||
use lib "$RealBin/../lib";
|
||||
use lib "$RealBin";
|
||||
use Util qw(test_samba4_ndr);
|
||||
|
||||
Parse::Pidl::Test::test_idl('align-uint8-uint16', \%settings,
|
||||
test_samba4_ndr('align-uint8-uint16',
|
||||
'
|
||||
typedef [public] struct {
|
||||
uint8 x;
|
||||
@ -30,7 +34,7 @@ Parse::Pidl::Test::test_idl('align-uint8-uint16', \%settings,
|
||||
return 2;
|
||||
');
|
||||
|
||||
Parse::Pidl::Test::test_idl('align-uint8-uint32', \%settings,
|
||||
test_samba4_ndr('align-uint8-uint32',
|
||||
'
|
||||
typedef [public] struct {
|
||||
uint8 x;
|
||||
@ -56,7 +60,7 @@ Parse::Pidl::Test::test_idl('align-uint8-uint32', \%settings,
|
||||
');
|
||||
|
||||
|
||||
Parse::Pidl::Test::test_idl('align-uint8-hyper', \%settings,
|
||||
test_samba4_ndr('align-uint8-hyper',
|
||||
'
|
||||
typedef [public] struct {
|
||||
uint8 x;
|
||||
@ -82,7 +86,7 @@ Parse::Pidl::Test::test_idl('align-uint8-hyper', \%settings,
|
||||
return 2;
|
||||
');
|
||||
|
||||
Parse::Pidl::Test::test_idl('noalignflag-uint8-uint16', \%settings,
|
||||
test_samba4_ndr('noalignflag-uint8-uint16',
|
||||
'
|
||||
typedef [public] struct {
|
||||
uint8 x;
|
||||
@ -109,7 +113,7 @@ Parse::Pidl::Test::test_idl('noalignflag-uint8-uint16', \%settings,
|
||||
return 2;
|
||||
');
|
||||
|
||||
Parse::Pidl::Test::test_idl('align-blob-align2', \%settings,
|
||||
test_samba4_ndr('align-blob-align2',
|
||||
'
|
||||
typedef [public] struct {
|
||||
uint8 x;
|
||||
|
@ -3,11 +3,15 @@
|
||||
# (C) 2005 Jelmer Vernooij. Published under the GNU GPL
|
||||
use strict;
|
||||
|
||||
use Test::Simple tests => 1;
|
||||
use Test::More tests => 5 * 8;
|
||||
use FindBin qw($RealBin);
|
||||
use lib "$RealBin/../lib";
|
||||
use lib "$RealBin";
|
||||
use Util qw(test_samba4_ndr);
|
||||
|
||||
# Check that an outgoing scalar pointer is allocated correctly
|
||||
|
||||
Parse::Pidl::Test::test_idl("alloc-scalar", \%settings,
|
||||
test_samba4_ndr("alloc-scalar",
|
||||
'
|
||||
typedef struct {
|
||||
uint8 *x;
|
||||
@ -32,7 +36,7 @@ Parse::Pidl::Test::test_idl("alloc-scalar", \%settings,
|
||||
);
|
||||
|
||||
# Check that an outgoing buffer pointer is allocated correctly
|
||||
Parse::Pidl::Test::test_idl("alloc-buffer", \%settings,
|
||||
test_samba4_ndr("alloc-buffer",
|
||||
'
|
||||
typedef struct { uint8 data; } blie;
|
||||
typedef struct { blie *x; } bla;
|
||||
@ -56,7 +60,7 @@ Parse::Pidl::Test::test_idl("alloc-buffer", \%settings,
|
||||
);
|
||||
|
||||
# Check that ref pointers aren't allocated by default
|
||||
Parse::Pidl::Test::test_idl("ref-noalloc-null", \%settings,
|
||||
test_samba4_ndr("ref-noalloc-null",
|
||||
'
|
||||
[public] void TestAlloc([in,ref] uint8 *t);
|
||||
','
|
||||
@ -72,7 +76,7 @@ Parse::Pidl::Test::test_idl("ref-noalloc-null", \%settings,
|
||||
);
|
||||
|
||||
# Check that ref pointers aren't allocated by default
|
||||
Parse::Pidl::Test::test_idl("ref-noalloc", \%settings,
|
||||
test_samba4_ndr("ref-noalloc",
|
||||
'
|
||||
[public] void TestAlloc([in,ref] uint8 *t);
|
||||
','
|
||||
@ -92,7 +96,7 @@ Parse::Pidl::Test::test_idl("ref-noalloc", \%settings,
|
||||
);
|
||||
|
||||
# Check that an outgoing ref pointer is allocated correctly
|
||||
Parse::Pidl::Test::test_idl("ref-alloc", \%settings,
|
||||
test_samba4_ndr("ref-alloc",
|
||||
'
|
||||
[public] void TestAlloc([in,ref] uint8 *t);
|
||||
','
|
||||
|
@ -4,19 +4,17 @@
|
||||
# Published under the GNU General Public License
|
||||
use strict;
|
||||
|
||||
use Test::Simple tests => 1;
|
||||
use Test::More tests => 8;
|
||||
use FindBin qw($RealBin);
|
||||
use lib "$RealBin/../lib";
|
||||
use lib "$RealBin";
|
||||
use Util qw(test_samba4_ndr);
|
||||
|
||||
Parse::Pidl::Test::test_idl(
|
||||
# Name
|
||||
test_samba4_ndr(
|
||||
'Fixed-Array',
|
||||
|
||||
# Settings
|
||||
\%settings,
|
||||
|
||||
# IDL
|
||||
'[public] void Test([in] uint8 x[10]);',
|
||||
|
||||
# C Test
|
||||
'
|
||||
uint8_t data[] = {1,2,3,4,5,6,7,8,9,10};
|
||||
int i;
|
||||
|
@ -5,9 +5,13 @@
|
||||
# Published under the GNU General Public License.
|
||||
use strict;
|
||||
|
||||
use Test::Simple tests => 1;
|
||||
use Test::More tests => 21 * 8;
|
||||
use FindBin qw($RealBin);
|
||||
use lib "$RealBin/../lib";
|
||||
use lib "$RealBin";
|
||||
use Util qw(test_samba4_ndr);
|
||||
|
||||
Parse::Pidl::Test::test_idl("noptr-push", \%settings,
|
||||
test_samba4_ndr("noptr-push",
|
||||
' typedef struct {
|
||||
uint16 x;
|
||||
} xstruct;
|
||||
@ -36,7 +40,7 @@ Parse::Pidl::Test::test_idl("noptr-push", \%settings,
|
||||
}
|
||||
');
|
||||
|
||||
Parse::Pidl::Test::test_idl("ptr-embedded-push", \%settings,
|
||||
test_samba4_ndr("ptr-embedded-push",
|
||||
' typedef struct {
|
||||
uint16 *x;
|
||||
} xstruct;
|
||||
@ -63,7 +67,7 @@ Parse::Pidl::Test::test_idl("ptr-embedded-push", \%settings,
|
||||
return 4;
|
||||
');
|
||||
|
||||
Parse::Pidl::Test::test_idl("ptr-embedded-push-null", \%settings,
|
||||
test_samba4_ndr("ptr-embedded-push-null",
|
||||
' typedef struct {
|
||||
uint16 *x;
|
||||
} xstruct;
|
||||
@ -86,7 +90,7 @@ Parse::Pidl::Test::test_idl("ptr-embedded-push-null", \%settings,
|
||||
return 3;
|
||||
');
|
||||
|
||||
Parse::Pidl::Test::test_idl("refptr-embedded-push", \%settings,
|
||||
test_samba4_ndr("refptr-embedded-push",
|
||||
'
|
||||
typedef struct {
|
||||
[ref] uint16 *x;
|
||||
@ -114,7 +118,7 @@ Parse::Pidl::Test::test_idl("refptr-embedded-push", \%settings,
|
||||
return 4;
|
||||
');
|
||||
|
||||
Parse::Pidl::Test::test_idl("refptr-embedded-push-null", \%settings,
|
||||
test_samba4_ndr("refptr-embedded-push-null",
|
||||
'
|
||||
typedef struct {
|
||||
[ref] uint16 *x;
|
||||
@ -132,7 +136,7 @@ Parse::Pidl::Test::test_idl("refptr-embedded-push-null", \%settings,
|
||||
/* Windows gives [client runtime error 0x6f4] */
|
||||
');
|
||||
|
||||
Parse::Pidl::Test::test_idl("ptr-top-push", \%settings,
|
||||
test_samba4_ndr("ptr-top-push",
|
||||
'
|
||||
typedef struct {
|
||||
uint16 x;
|
||||
@ -157,7 +161,7 @@ Parse::Pidl::Test::test_idl("ptr-top-push", \%settings,
|
||||
return 3;
|
||||
');
|
||||
|
||||
Parse::Pidl::Test::test_idl("ptr-top-push-null", \%settings,
|
||||
test_samba4_ndr("ptr-top-push-null",
|
||||
'
|
||||
typedef struct {
|
||||
uint16 x;
|
||||
@ -177,7 +181,7 @@ Parse::Pidl::Test::test_idl("ptr-top-push-null", \%settings,
|
||||
');
|
||||
|
||||
|
||||
Parse::Pidl::Test::test_idl("refptr-top-push", \%settings,
|
||||
test_samba4_ndr("refptr-top-push",
|
||||
'
|
||||
typedef struct {
|
||||
uint16 x;
|
||||
@ -202,7 +206,7 @@ Parse::Pidl::Test::test_idl("refptr-top-push", \%settings,
|
||||
return 3;
|
||||
');
|
||||
|
||||
Parse::Pidl::Test::test_idl("refptr-top-push-null", \%settings,
|
||||
test_samba4_ndr("refptr-top-push-null",
|
||||
'
|
||||
typedef struct {
|
||||
uint16 x;
|
||||
@ -222,7 +226,7 @@ Parse::Pidl::Test::test_idl("refptr-top-push-null", \%settings,
|
||||
');
|
||||
|
||||
|
||||
Parse::Pidl::Test::test_idl("uniqueptr-top-push", \%settings,
|
||||
test_samba4_ndr("uniqueptr-top-push",
|
||||
' typedef struct {
|
||||
uint16 x;
|
||||
} xstruct;
|
||||
@ -250,7 +254,7 @@ Parse::Pidl::Test::test_idl("uniqueptr-top-push", \%settings,
|
||||
return 4;
|
||||
');
|
||||
|
||||
Parse::Pidl::Test::test_idl("uniqueptr-top-push-null", \%settings,
|
||||
test_samba4_ndr("uniqueptr-top-push-null",
|
||||
' typedef struct {
|
||||
uint16 x;
|
||||
} xstruct;
|
||||
@ -274,7 +278,7 @@ Parse::Pidl::Test::test_idl("uniqueptr-top-push-null", \%settings,
|
||||
');
|
||||
|
||||
|
||||
Parse::Pidl::Test::test_idl("ptr-top-out-pull", \%settings,
|
||||
test_samba4_ndr("ptr-top-out-pull",
|
||||
'
|
||||
typedef struct {
|
||||
uint16 x;
|
||||
@ -301,7 +305,7 @@ Parse::Pidl::Test::test_idl("ptr-top-out-pull", \%settings,
|
||||
return 3;
|
||||
');
|
||||
|
||||
Parse::Pidl::Test::test_idl("ptr-top-out-pull-null", \%settings,
|
||||
test_samba4_ndr("ptr-top-out-pull-null",
|
||||
'
|
||||
typedef struct {
|
||||
uint16 x;
|
||||
@ -324,7 +328,7 @@ Parse::Pidl::Test::test_idl("ptr-top-out-pull-null", \%settings,
|
||||
');
|
||||
|
||||
|
||||
Parse::Pidl::Test::test_idl("refptr-top-out-pull", \%settings,
|
||||
test_samba4_ndr("refptr-top-out-pull",
|
||||
'
|
||||
typedef struct {
|
||||
uint16 x;
|
||||
@ -351,7 +355,7 @@ Parse::Pidl::Test::test_idl("refptr-top-out-pull", \%settings,
|
||||
return 3;
|
||||
');
|
||||
|
||||
Parse::Pidl::Test::test_idl("refptr-top-out-pull-null", \%settings,
|
||||
test_samba4_ndr("refptr-top-out-pull-null",
|
||||
'
|
||||
typedef struct {
|
||||
uint16 x;
|
||||
@ -374,7 +378,7 @@ Parse::Pidl::Test::test_idl("refptr-top-out-pull-null", \%settings,
|
||||
');
|
||||
|
||||
|
||||
Parse::Pidl::Test::test_idl("ptr-top-push-double", \%settings,
|
||||
test_samba4_ndr("ptr-top-push-double",
|
||||
'
|
||||
[public] void echo_TestRef([in] uint16 **foo);
|
||||
',
|
||||
@ -398,7 +402,7 @@ Parse::Pidl::Test::test_idl("ptr-top-push-double", \%settings,
|
||||
return 4;
|
||||
');
|
||||
|
||||
Parse::Pidl::Test::test_idl("ptr-top-push-double-sndnull", \%settings,
|
||||
test_samba4_ndr("ptr-top-push-double-sndnull",
|
||||
'
|
||||
[public] void echo_TestRef([in] uint16 **foo);
|
||||
',
|
||||
@ -418,7 +422,7 @@ Parse::Pidl::Test::test_idl("ptr-top-push-double-sndnull", \%settings,
|
||||
return 3;
|
||||
');
|
||||
|
||||
Parse::Pidl::Test::test_idl("ptr-top-push-double-fstnull", \%settings,
|
||||
test_samba4_ndr("ptr-top-push-double-fstnull",
|
||||
'
|
||||
[public] void echo_TestRef([in] uint16 **foo);
|
||||
',
|
||||
@ -434,7 +438,7 @@ Parse::Pidl::Test::test_idl("ptr-top-push-double-fstnull", \%settings,
|
||||
');
|
||||
|
||||
|
||||
Parse::Pidl::Test::test_idl("refptr-top-push-double", \%settings,
|
||||
test_samba4_ndr("refptr-top-push-double",
|
||||
'
|
||||
[public] void echo_TestRef([in,ref] uint16 **foo);
|
||||
',
|
||||
@ -458,7 +462,7 @@ Parse::Pidl::Test::test_idl("refptr-top-push-double", \%settings,
|
||||
return 4;
|
||||
');
|
||||
|
||||
Parse::Pidl::Test::test_idl("refptr-top-push-double-sndnull", \%settings,
|
||||
test_samba4_ndr("refptr-top-push-double-sndnull",
|
||||
'
|
||||
[public] void echo_TestRef([in,ref] uint16 **foo);
|
||||
',
|
||||
@ -478,7 +482,7 @@ Parse::Pidl::Test::test_idl("refptr-top-push-double-sndnull", \%settings,
|
||||
return 3;
|
||||
');
|
||||
|
||||
Parse::Pidl::Test::test_idl("refptr-top-push-double-fstnull", \%settings,
|
||||
test_samba4_ndr("refptr-top-push-double-fstnull",
|
||||
'
|
||||
[public] void echo_TestRef([in,ref] uint16 **foo);
|
||||
',
|
||||
@ -493,19 +497,20 @@ Parse::Pidl::Test::test_idl("refptr-top-push-double-fstnull", \%settings,
|
||||
|
||||
');
|
||||
|
||||
Parse::Pidl::Test::test_idl("ignore-ptr", \%settings,
|
||||
'
|
||||
[public] void echo_TestRef([in,ignore] uint16 *foo, [in] uint16 *bar);
|
||||
',
|
||||
' struct ndr_push *ndr = ndr_push_init();
|
||||
struct echo_TestRef r;
|
||||
uint16_t v = 10;
|
||||
r.in.foo = &v;
|
||||
r.in.bar = &v;
|
||||
|
||||
if (NT_STATUS_IS_OK(ndr_push_echo_TestRef(ndr, NDR_IN, &r)))
|
||||
return 1;
|
||||
|
||||
if (ndr->offset != 4)
|
||||
return 2;
|
||||
');
|
||||
#FIXME: Not supported yet
|
||||
#test_samba4_ndr("ignore-ptr",
|
||||
#'
|
||||
# [public] void echo_TestRef([in,ignore] uint16 *foo, [in] uint16 *bar);
|
||||
#',
|
||||
#' struct ndr_push *ndr = ndr_push_init();
|
||||
# struct echo_TestRef r;
|
||||
# uint16_t v = 10;
|
||||
# r.in.foo = &v;
|
||||
# r.in.bar = &v;
|
||||
#
|
||||
# if (NT_STATUS_IS_OK(ndr_push_echo_TestRef(ndr, NDR_IN, &r)))
|
||||
# return 1;
|
||||
#
|
||||
# if (ndr->offset != 4)
|
||||
# return 2;
|
||||
#');
|
||||
|
@ -4,45 +4,18 @@
|
||||
# Published under the GNU General Public License
|
||||
use strict;
|
||||
|
||||
use Test::Simple tests => 6;
|
||||
use Test::More tests => 8;
|
||||
use FindBin qw($RealBin);
|
||||
use lib "$RealBin/../lib";
|
||||
use Parse::Pidl::IDL;
|
||||
use Parse::Pidl::NDR;
|
||||
use Parse::Pidl::Samba4::NDR::Parser;
|
||||
use Parse::Pidl::Samba4::Header;
|
||||
use lib "$RealBin";
|
||||
use Util qw(test_samba4_ndr);
|
||||
|
||||
my $pidl = Parse::Pidl::IDL::parse_string(
|
||||
"interface test { void Test(); }; ", "<test>");
|
||||
ok (defined($pidl));
|
||||
my $pndr = Parse::Pidl::NDR::Parse($pidl);
|
||||
ok(defined($pndr));
|
||||
my $header = Parse::Pidl::Samba4::Header::Parse($pidl);
|
||||
ok(defined($header));
|
||||
my ($ndrheader,$parser) = Parse::Pidl::Samba4::NDR::Parser::Parse($pndr, "foo");
|
||||
ok(defined($parser));
|
||||
ok(defined($ndrheader));
|
||||
|
||||
my $outfile = "test";
|
||||
|
||||
#my $cflags = $ENV{CFLAGS};
|
||||
my $cflags = "-Iinclude -I.";
|
||||
|
||||
open CC, "|cc -x c -o $outfile $cflags -";
|
||||
#open CC, ">foo";
|
||||
print CC "#include \"includes.h\"";
|
||||
print CC $header;
|
||||
print CC $ndrheader;
|
||||
print CC $parser;
|
||||
print CC
|
||||
'
|
||||
int main(int argc, const char **argv)
|
||||
{
|
||||
test_samba4_ndr("simple", "void Test(); ",
|
||||
"
|
||||
uint8_t data[] = { 0x02 };
|
||||
uint8_t result;
|
||||
DATA_BLOB b;
|
||||
struct ndr_pull *ndr;
|
||||
TALLOC_CTX *mem_ctx = talloc_init(NULL);
|
||||
|
||||
b.data = data;
|
||||
b.length = 1;
|
||||
@ -53,12 +26,4 @@ int main(int argc, const char **argv)
|
||||
|
||||
if (result != 0x02)
|
||||
return 2;
|
||||
|
||||
talloc_free(mem_ctx);
|
||||
|
||||
return 0;
|
||||
}
|
||||
';
|
||||
close CC;
|
||||
|
||||
ok(-f $outfile);
|
||||
");
|
||||
|
@ -4,9 +4,13 @@
|
||||
# Published under the GNU General Public License
|
||||
use strict;
|
||||
|
||||
use Test::Simple tests => 1;
|
||||
use Test::More tests => 2 * 8;
|
||||
use FindBin qw($RealBin);
|
||||
use lib "$RealBin/../lib";
|
||||
use lib "$RealBin";
|
||||
use Util qw(test_samba4_ndr);
|
||||
|
||||
Parse::Pidl::Test::test_idl("string-pull-empty", \%settings,
|
||||
test_samba4_ndr("string-pull-empty",
|
||||
' [public] void TestString([in,flag(STR_ASCII|LIBNDR_FLAG_STR_SIZE4)] string data);',
|
||||
'
|
||||
uint8_t data[] = { 0x00, 0x00, 0x00, 0x00 };
|
||||
@ -25,7 +29,7 @@ Parse::Pidl::Test::test_idl("string-pull-empty", \%settings,
|
||||
return 3;
|
||||
');
|
||||
|
||||
Parse::Pidl::Test::test_idl("string-ascii-pull", \%settings,
|
||||
test_samba4_ndr("string-ascii-pull",
|
||||
'
|
||||
[public] void TestString([in,flag(STR_ASCII|LIBNDR_FLAG_STR_SIZE4)] string data);
|
||||
',
|
||||
|
@ -4,7 +4,7 @@
|
||||
# Published under the GNU General Public License
|
||||
use strict;
|
||||
|
||||
use Test::Simple tests => 26;
|
||||
use Test::More tests => 26;
|
||||
use FindBin qw($RealBin);
|
||||
use lib "$RealBin/../lib";
|
||||
use Parse::Pidl::IDL;
|
||||
|
@ -3,6 +3,8 @@ if [ ! -n "$PERL" ]
|
||||
then
|
||||
PERL=perl
|
||||
fi
|
||||
#$PERL -MExtUtils::Command::MM -e "test_harness()" pidl/tests/*.pl
|
||||
$PERL -MExtUtils::Command::MM -e "test_harness()" pidl/tests/parse_idl.pl
|
||||
|
||||
incdir=`dirname $0`
|
||||
. $incdir/test_functions.sh
|
||||
|
||||
$PERL -MExtUtils::Command::MM -e "test_harness()" pidl/tests/*.pl || testok $0 1
|
||||
|
Loading…
Reference in New Issue
Block a user