wmi-1.3.16 from opsview.com
This commit is contained in:
@@ -0,0 +1,87 @@
|
||||
# Some simple utility functions for pidl tests
|
||||
# Copyright (C) 2005-2006 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;
|
||||
|
||||
# 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,$extra) = @_;
|
||||
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, undef, undef);
|
||||
ok(defined($ndrparser), "($name) generate NDR parser");
|
||||
ok(defined($ndrheader), "($name) generate NDR header");
|
||||
|
||||
SKIP: {
|
||||
|
||||
skip "no samba environment available, skipping compilation", 3
|
||||
if (system("pkg-config --exists ndr") != 0);
|
||||
|
||||
my $test_data_prefix = $ENV{TEST_DATA_PREFIX};
|
||||
|
||||
my $outfile;
|
||||
if (defined($test_data_prefix)) {
|
||||
$outfile = "$test_data_prefix/test-$name";
|
||||
} else {
|
||||
$outfile = "test-$name";
|
||||
}
|
||||
|
||||
my $cflags = `pkg-config --libs --cflags ndr`;
|
||||
|
||||
open CC, "|cc -x c - -o $outfile $cflags";
|
||||
print CC "#define uint_t unsigned int\n";
|
||||
print CC "#define _GNU_SOURCE\n";
|
||||
print CC "#include <stdint.h>\n";
|
||||
print CC "#include <stdlib.h>\n";
|
||||
print CC "#include <stdio.h>\n";
|
||||
print CC "#include <stdbool.h>\n";
|
||||
print CC "#include <stdarg.h>\n";
|
||||
print CC "#include <core.h>\n";
|
||||
print CC $header;
|
||||
print CC $ndrheader;
|
||||
print CC $extra if ($extra);
|
||||
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");
|
||||
|
||||
my $ret = system("./$outfile", ()) >> 8;
|
||||
print "# return code: $ret\n" if ($ret != 0);
|
||||
|
||||
ok($ret == 0, "($name) run");
|
||||
|
||||
ok(unlink($outfile), "($name) remove");
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
1;
|
||||
Executable
+144
@@ -0,0 +1,144 @@
|
||||
#!/usr/bin/perl
|
||||
# NDR alignment tests
|
||||
# (C) 2005 Jelmer Vernooij. Published under the GNU GPL
|
||||
use strict;
|
||||
|
||||
use Test::More tests => 5 * 8;
|
||||
use FindBin qw($RealBin);
|
||||
use lib "$RealBin/../lib";
|
||||
use lib "$RealBin";
|
||||
use Util qw(test_samba4_ndr);
|
||||
|
||||
test_samba4_ndr('align-uint8-uint16',
|
||||
'
|
||||
typedef [public] struct {
|
||||
uint8 x;
|
||||
uint16 y;
|
||||
} bla;
|
||||
',
|
||||
'
|
||||
struct ndr_push *ndr = ndr_push_init();
|
||||
struct bla r;
|
||||
uint8_t expected[] = { 0x0D, 0x00, 0xef, 0xbe };
|
||||
DATA_BLOB expected_blob = { expected, 4 };
|
||||
DATA_BLOB result_blob;
|
||||
r.x = 13;
|
||||
r.y = 0xbeef;
|
||||
|
||||
if (NT_STATUS_IS_ERR(ndr_push_bla(ndr, NDR_SCALARS|NDR_BUFFERS, &r)))
|
||||
return 1;
|
||||
|
||||
result_blob = ndr_push_blob(ndr);
|
||||
|
||||
if (!data_blob_equal(&result_blob, &expected_blob))
|
||||
return 2;
|
||||
');
|
||||
|
||||
test_samba4_ndr('align-uint8-uint32',
|
||||
'
|
||||
typedef [public] struct {
|
||||
uint8 x;
|
||||
uint32 y;
|
||||
} bla;
|
||||
',
|
||||
'
|
||||
struct ndr_push *ndr = ndr_push_init();
|
||||
struct bla r;
|
||||
uint8_t expected[] = { 0x0D, 0x00, 0x00, 0x00, 0xef, 0xbe, 0xef, 0xbe };
|
||||
DATA_BLOB expected_blob = { expected, 8 };
|
||||
DATA_BLOB result_blob;
|
||||
r.x = 13;
|
||||
r.y = 0xbeefbeef;
|
||||
|
||||
if (NT_STATUS_IS_ERR(ndr_push_bla(ndr, NDR_SCALARS|NDR_BUFFERS, &r)))
|
||||
return 1;
|
||||
|
||||
result_blob = ndr_push_blob(ndr);
|
||||
|
||||
if (!data_blob_equal(&result_blob, &expected_blob))
|
||||
return 2;
|
||||
');
|
||||
|
||||
|
||||
test_samba4_ndr('align-uint8-hyper',
|
||||
'
|
||||
typedef [public] struct {
|
||||
uint8 x;
|
||||
hyper y;
|
||||
} bla;
|
||||
',
|
||||
'
|
||||
struct ndr_push *ndr = ndr_push_init();
|
||||
struct bla r;
|
||||
uint8_t expected[] = { 0x0D, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0xef, 0xbe, 0xef, 0xbe, 0xef, 0xbe, 0xef, 0xbe };
|
||||
DATA_BLOB expected_blob = { expected, 16 };
|
||||
DATA_BLOB result_blob;
|
||||
r.x = 13;
|
||||
r.y = 0xbeefbeefbeefbeef;
|
||||
|
||||
if (NT_STATUS_IS_ERR(ndr_push_bla(ndr, NDR_SCALARS|NDR_BUFFERS, &r)))
|
||||
return 1;
|
||||
|
||||
result_blob = ndr_push_blob(ndr);
|
||||
|
||||
if (!data_blob_equal(&result_blob, &expected_blob))
|
||||
return 2;
|
||||
');
|
||||
|
||||
test_samba4_ndr('noalignflag-uint8-uint16',
|
||||
'
|
||||
typedef [public] struct {
|
||||
uint8 x;
|
||||
uint16 y;
|
||||
} bla;
|
||||
',
|
||||
'
|
||||
struct ndr_push *ndr = ndr_push_init();
|
||||
struct bla r;
|
||||
uint8_t expected[] = { 0x0D, 0xef, 0xbe };
|
||||
DATA_BLOB expected_blob = { expected, 3 };
|
||||
DATA_BLOB result_blob;
|
||||
ndr->flags |= LIBNDR_FLAG_NOALIGN;
|
||||
|
||||
r.x = 13;
|
||||
r.y = 0xbeef;
|
||||
|
||||
if (NT_STATUS_IS_ERR(ndr_push_bla(ndr, NDR_SCALARS|NDR_BUFFERS, &r)))
|
||||
return 1;
|
||||
|
||||
result_blob = ndr_push_blob(ndr);
|
||||
|
||||
if (!data_blob_equal(&result_blob, &expected_blob))
|
||||
return 2;
|
||||
');
|
||||
|
||||
test_samba4_ndr('align-blob-align2',
|
||||
'
|
||||
typedef [public] struct {
|
||||
uint8 x;
|
||||
[flag(LIBNDR_FLAG_ALIGN2)] DATA_BLOB data;
|
||||
uint8 y;
|
||||
} blie;
|
||||
',
|
||||
'
|
||||
struct ndr_push *ndr = ndr_push_init();
|
||||
struct blie r;
|
||||
uint8_t data[] = { 0x01, 0x02 };
|
||||
uint8_t expected[] = { 0x0D, 0x00, 0x0E };
|
||||
DATA_BLOB expected_blob = { expected, 3 };
|
||||
DATA_BLOB result_blob;
|
||||
|
||||
r.x = 13;
|
||||
r.y = 14;
|
||||
r.data.data = data;
|
||||
r.data.length = 2;
|
||||
|
||||
if (NT_STATUS_IS_ERR(ndr_push_blie(ndr, NDR_SCALARS|NDR_BUFFERS, &r)))
|
||||
return 1;
|
||||
|
||||
result_blob = ndr_push_blob(ndr);
|
||||
|
||||
if (!data_blob_equal(&result_blob, &expected_blob))
|
||||
return 2;
|
||||
');
|
||||
Executable
+119
@@ -0,0 +1,119 @@
|
||||
#!/usr/bin/perl
|
||||
# NDR allocation tests
|
||||
# (C) 2005 Jelmer Vernooij. Published under the GNU GPL
|
||||
use strict;
|
||||
|
||||
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
|
||||
|
||||
test_samba4_ndr("alloc-scalar",
|
||||
'
|
||||
typedef struct {
|
||||
uint8 *x;
|
||||
} bla;
|
||||
|
||||
[public] void TestAlloc([in] bla foo);
|
||||
','
|
||||
uint8_t data[] = { 0xde, 0xad, 0xbe, 0xef, 0x03 };
|
||||
DATA_BLOB b = { data, 5 };
|
||||
struct ndr_pull *ndr = ndr_pull_init_blob(&b, NULL);
|
||||
struct TestAlloc r;
|
||||
|
||||
if (NT_STATUS_IS_ERR(ndr_pull_TestAlloc(ndr, NDR_IN, &r)))
|
||||
return 1;
|
||||
|
||||
if (r.in.foo.x == NULL)
|
||||
return 2;
|
||||
|
||||
if (*r.in.foo.x != 0x03)
|
||||
return 3;
|
||||
'
|
||||
);
|
||||
|
||||
# Check that an outgoing buffer pointer is allocated correctly
|
||||
test_samba4_ndr("alloc-buffer",
|
||||
'
|
||||
typedef struct { uint8 data; } blie;
|
||||
typedef struct { blie *x; } bla;
|
||||
|
||||
[public] void TestAlloc([in] bla foo);
|
||||
','
|
||||
uint8_t data[] = { 0xde, 0xad, 0xbe, 0xef, 0x03 };
|
||||
DATA_BLOB b = { data, 5 };
|
||||
struct ndr_pull *ndr = ndr_pull_init_blob(&b, NULL);
|
||||
struct TestAlloc r;
|
||||
|
||||
if (NT_STATUS_IS_ERR(ndr_pull_TestAlloc(ndr, NDR_IN, &r)))
|
||||
return 1;
|
||||
|
||||
if (r.in.foo.x == NULL)
|
||||
return 2;
|
||||
|
||||
if (r.in.foo.x->data != 0x03)
|
||||
return 3;
|
||||
'
|
||||
);
|
||||
|
||||
# Check that ref pointers aren't allocated by default
|
||||
test_samba4_ndr("ref-noalloc-null",
|
||||
'
|
||||
[public] void TestAlloc([in,ref] uint8 *t);
|
||||
','
|
||||
uint8_t data[] = { 0x03 };
|
||||
DATA_BLOB b = { data, 1 };
|
||||
struct ndr_pull *ndr = ndr_pull_init_blob(&b, NULL);
|
||||
struct TestAlloc r;
|
||||
r.in.t = NULL;
|
||||
|
||||
if (NT_STATUS_IS_OK(ndr_pull_TestAlloc(ndr, NDR_IN, &r)))
|
||||
return 1;
|
||||
'
|
||||
);
|
||||
|
||||
# Check that ref pointers aren't allocated by default
|
||||
test_samba4_ndr("ref-noalloc",
|
||||
'
|
||||
[public] void TestAlloc([in,ref] uint8 *t);
|
||||
','
|
||||
uint8_t data[] = { 0x03 };
|
||||
DATA_BLOB b = { data, 1 };
|
||||
struct ndr_pull *ndr = ndr_pull_init_blob(&b, NULL);
|
||||
struct TestAlloc r;
|
||||
uint8_t x;
|
||||
r.in.t = &x;
|
||||
|
||||
if (NT_STATUS_IS_ERR(ndr_pull_TestAlloc(ndr, NDR_IN, &r)))
|
||||
return 1;
|
||||
|
||||
if (*r.in.t != 0x03)
|
||||
return 2;
|
||||
'
|
||||
);
|
||||
|
||||
# Check that an outgoing ref pointer is allocated correctly
|
||||
test_samba4_ndr("ref-alloc",
|
||||
'
|
||||
[public] void TestAlloc([in,ref] uint8 *t);
|
||||
','
|
||||
uint8_t data[] = { 0x03 };
|
||||
DATA_BLOB b = { data, 1 };
|
||||
struct ndr_pull *ndr = ndr_pull_init_blob(&b, NULL);
|
||||
struct TestAlloc r;
|
||||
ndr->flags |= LIBNDR_FLAG_REF_ALLOC;
|
||||
r.in.t = NULL;
|
||||
|
||||
if (NT_STATUS_IS_ERR(ndr_pull_TestAlloc(ndr, NDR_IN, &r)))
|
||||
return 1;
|
||||
|
||||
if (r.in.t == NULL)
|
||||
return 2;
|
||||
|
||||
if (*r.in.t != 0x03)
|
||||
return 3;
|
||||
'
|
||||
);
|
||||
Executable
+38
@@ -0,0 +1,38 @@
|
||||
#!/usr/bin/perl
|
||||
# Array testing
|
||||
# (C) 2005 Jelmer Vernooij <jelmer@samba.org>
|
||||
# Published under the GNU General Public License
|
||||
use strict;
|
||||
|
||||
use Test::More tests => 8;
|
||||
use FindBin qw($RealBin);
|
||||
use lib "$RealBin/../lib";
|
||||
use lib "$RealBin";
|
||||
use Util qw(test_samba4_ndr);
|
||||
|
||||
test_samba4_ndr(
|
||||
'Fixed-Array',
|
||||
|
||||
'[public] void Test([in] uint8 x[10]);',
|
||||
|
||||
'
|
||||
uint8_t data[] = {1,2,3,4,5,6,7,8,9,10};
|
||||
int i;
|
||||
DATA_BLOB b;
|
||||
struct ndr_pull *ndr;
|
||||
struct Test r;
|
||||
|
||||
b.data = data;
|
||||
b.length = 10;
|
||||
ndr = ndr_pull_init_blob(&b, mem_ctx);
|
||||
|
||||
if (NT_STATUS_IS_ERR(ndr_pull_Test(ndr, NDR_IN, &r)))
|
||||
return 1;
|
||||
|
||||
if (ndr->offset != 10)
|
||||
return 2;
|
||||
|
||||
for (i = 0; i < 10; i++) {
|
||||
if (r.in.x[i] != i+1) return 3;
|
||||
}
|
||||
');
|
||||
Executable
+41
@@ -0,0 +1,41 @@
|
||||
#!/usr/bin/perl
|
||||
# Simple tests for unique pointers
|
||||
# (C) 2006 Jelmer Vernooij <jelmer@samba.org>.
|
||||
# Published under the GNU General Public License.
|
||||
use strict;
|
||||
|
||||
use Test::More tests => 1 * 8;
|
||||
use FindBin qw($RealBin);
|
||||
use lib "$RealBin/../lib";
|
||||
use lib "$RealBin";
|
||||
use Util qw(test_samba4_ndr);
|
||||
|
||||
test_samba4_ndr("fullptr-push-dup",
|
||||
'
|
||||
[public] uint16 echo_TestFull([in,ptr] uint32 *x, [in,ptr] uint32 *y);
|
||||
',
|
||||
'
|
||||
struct ndr_push *ndr = ndr_push_init();
|
||||
uint32_t v = 13;
|
||||
struct echo_TestFull r;
|
||||
r.in.x = &v;
|
||||
r.in.y = &v;
|
||||
|
||||
if (NT_STATUS_IS_ERR(ndr_push_echo_TestFull(ndr, NDR_IN, &r))) {
|
||||
fprintf(stderr, "push failed\n");
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (ndr->offset != 12) {
|
||||
fprintf(stderr, "Offset(%d) != 12\n", ndr->offset);
|
||||
return 2;
|
||||
}
|
||||
|
||||
if (ndr->data[0] != ndr->data[8] ||
|
||||
ndr->data[1] != ndr->data[9] ||
|
||||
ndr->data[2] != ndr->data[10] ||
|
||||
ndr->data[3] != ndr->data[11]) {
|
||||
fprintf(stderr, "Data incorrect\n");
|
||||
return 3;
|
||||
}
|
||||
');
|
||||
Executable
+527
@@ -0,0 +1,527 @@
|
||||
#!/usr/bin/perl
|
||||
# Simple tests for pidl's handling of ref pointers, based
|
||||
# on tridge's ref_notes.txt
|
||||
# (C) 2005 Jelmer Vernooij <jelmer@samba.org>.
|
||||
# Published under the GNU General Public License.
|
||||
use strict;
|
||||
|
||||
use Test::More tests => 22 * 8;
|
||||
use FindBin qw($RealBin);
|
||||
use lib "$RealBin/../lib";
|
||||
use lib "$RealBin";
|
||||
use Util qw(test_samba4_ndr);
|
||||
|
||||
test_samba4_ndr("noptr-push",
|
||||
' typedef struct {
|
||||
uint16 x;
|
||||
} xstruct;
|
||||
|
||||
[public] uint16 echo_TestRef([in] xstruct foo);
|
||||
',
|
||||
'
|
||||
struct ndr_push *ndr = ndr_push_init();
|
||||
uint16_t v = 13;
|
||||
struct echo_TestRef r;
|
||||
r.in.foo.x = v;
|
||||
|
||||
if (NT_STATUS_IS_ERR(ndr_push_echo_TestRef(ndr, NDR_IN, &r))) {
|
||||
fprintf(stderr, "push failed\n");
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (ndr->offset != 2) {
|
||||
fprintf(stderr, "Offset(%d) != 2\n", ndr->offset);
|
||||
return 2;
|
||||
}
|
||||
|
||||
if (ndr->data[0] != 13 || ndr->data[1] != 0) {
|
||||
fprintf(stderr, "Data incorrect\n");
|
||||
return 3;
|
||||
}
|
||||
');
|
||||
|
||||
test_samba4_ndr("ptr-embedded-push",
|
||||
' typedef struct {
|
||||
uint16 *x;
|
||||
} xstruct;
|
||||
|
||||
[public] uint16 echo_TestRef([in] xstruct foo);
|
||||
',
|
||||
'
|
||||
uint16_t v = 13;
|
||||
struct ndr_push *ndr = ndr_push_init();
|
||||
struct echo_TestRef r;
|
||||
r.in.foo.x = &v;
|
||||
|
||||
if (NT_STATUS_IS_ERR(ndr_push_echo_TestRef(ndr, NDR_IN, &r)))
|
||||
return 1;
|
||||
|
||||
if (ndr->offset != 6)
|
||||
return 2;
|
||||
|
||||
if (ndr->data[0] == 0 && ndr->data[1] == 0 &&
|
||||
ndr->data[2] == 0 && ndr->data[3] == 0)
|
||||
return 3;
|
||||
|
||||
if (ndr->data[4] != 13 || ndr->data[5] != 0)
|
||||
return 4;
|
||||
');
|
||||
|
||||
test_samba4_ndr("ptr-embedded-push-null",
|
||||
' typedef struct {
|
||||
uint16 *x;
|
||||
} xstruct;
|
||||
|
||||
[public] uint16 echo_TestRef([in] xstruct foo);
|
||||
',
|
||||
'
|
||||
struct ndr_push *ndr = ndr_push_init();
|
||||
struct echo_TestRef r;
|
||||
r.in.foo.x = NULL;
|
||||
|
||||
if (NT_STATUS_IS_ERR(ndr_push_echo_TestRef(ndr, NDR_IN, &r)))
|
||||
return 1;
|
||||
|
||||
if (ndr->offset != 4)
|
||||
return 2;
|
||||
|
||||
if (ndr->data[0] != 0 || ndr->data[1] != 0 ||
|
||||
ndr->data[2] != 0 || ndr->data[3] != 0)
|
||||
return 3;
|
||||
');
|
||||
|
||||
test_samba4_ndr("refptr-embedded-push",
|
||||
'
|
||||
typedef struct {
|
||||
[ref] uint16 *x;
|
||||
} xstruct;
|
||||
|
||||
[public] uint16 echo_TestRef([in] xstruct foo);
|
||||
',
|
||||
'
|
||||
uint16_t v = 13;
|
||||
struct ndr_push *ndr = ndr_push_init();
|
||||
struct echo_TestRef r;
|
||||
r.in.foo.x = &v;
|
||||
|
||||
if (NT_STATUS_IS_ERR(ndr_push_echo_TestRef(ndr, NDR_IN, &r)))
|
||||
return 1;
|
||||
|
||||
if (ndr->offset != 6)
|
||||
return 2;
|
||||
|
||||
if (ndr->data[0] == 0 && ndr->data[1] == 0 &&
|
||||
ndr->data[2] == 0 && ndr->data[3] == 0)
|
||||
return 3;
|
||||
|
||||
if (ndr->data[4] != 13 || ndr->data[5] != 0)
|
||||
return 4;
|
||||
');
|
||||
|
||||
test_samba4_ndr("refptr-embedded-push-null",
|
||||
'
|
||||
typedef struct {
|
||||
[ref] uint16 *x;
|
||||
} xstruct;
|
||||
|
||||
[public] uint16 echo_TestRef([in] xstruct foo);
|
||||
',
|
||||
'
|
||||
struct ndr_push *ndr = ndr_push_init();
|
||||
struct echo_TestRef r;
|
||||
r.in.foo.x = NULL;
|
||||
|
||||
if (NT_STATUS_IS_OK(ndr_push_echo_TestRef(ndr, NDR_IN, &r)))
|
||||
return 1;
|
||||
/* Windows gives [client runtime error 0x6f4] */
|
||||
');
|
||||
|
||||
test_samba4_ndr("ptr-top-push",
|
||||
'
|
||||
typedef struct {
|
||||
uint16 x;
|
||||
} xstruct;
|
||||
|
||||
[public] uint16 echo_TestRef([in] xstruct *foo);
|
||||
',
|
||||
'
|
||||
struct ndr_push *ndr = ndr_push_init();
|
||||
struct echo_TestRef r;
|
||||
struct xstruct s;
|
||||
s.x = 13;
|
||||
r.in.foo = &s;
|
||||
|
||||
if (NT_STATUS_IS_ERR(ndr_push_echo_TestRef(ndr, NDR_IN, &r)))
|
||||
return 1;
|
||||
|
||||
if (ndr->offset != 2)
|
||||
return 2;
|
||||
|
||||
if (ndr->data[0] != 13 || ndr->data[1] != 0)
|
||||
return 3;
|
||||
');
|
||||
|
||||
test_samba4_ndr("ptr-top-push-null",
|
||||
'
|
||||
typedef struct {
|
||||
uint16 x;
|
||||
} xstruct;
|
||||
|
||||
[public] uint16 echo_TestRef([in] xstruct *foo);
|
||||
',
|
||||
'
|
||||
struct ndr_push *ndr = ndr_push_init();
|
||||
struct echo_TestRef r;
|
||||
r.in.foo = NULL;
|
||||
|
||||
if (NT_STATUS_IS_OK(ndr_push_echo_TestRef(ndr, NDR_IN, &r)))
|
||||
return 1;
|
||||
|
||||
/* Windows gives [client runtime error 0x6f4] */
|
||||
');
|
||||
|
||||
|
||||
test_samba4_ndr("refptr-top-push",
|
||||
'
|
||||
typedef struct {
|
||||
uint16 x;
|
||||
} xstruct;
|
||||
|
||||
[public] uint16 echo_TestRef([in,ref] xstruct *foo);
|
||||
',
|
||||
'
|
||||
struct ndr_push *ndr = ndr_push_init();
|
||||
struct echo_TestRef r;
|
||||
struct xstruct s;
|
||||
s.x = 13;
|
||||
r.in.foo = &s;
|
||||
|
||||
if (NT_STATUS_IS_ERR(ndr_push_echo_TestRef(ndr, NDR_IN, &r)))
|
||||
return 1;
|
||||
|
||||
if (ndr->offset != 2)
|
||||
return 2;
|
||||
|
||||
if (ndr->data[0] != 13 || ndr->data[1] != 0)
|
||||
return 3;
|
||||
');
|
||||
|
||||
test_samba4_ndr("refptr-top-push-null",
|
||||
'
|
||||
typedef struct {
|
||||
uint16 x;
|
||||
} xstruct;
|
||||
|
||||
[public] uint16 echo_TestRef([in,ref] xstruct *foo);
|
||||
',
|
||||
'
|
||||
struct ndr_push *ndr = ndr_push_init();
|
||||
struct echo_TestRef r;
|
||||
r.in.foo = NULL;
|
||||
|
||||
if (NT_STATUS_IS_OK(ndr_push_echo_TestRef(ndr, NDR_IN, &r)))
|
||||
return 1;
|
||||
|
||||
/* Windows gives [client runtime error 0x6f4] */
|
||||
');
|
||||
|
||||
|
||||
test_samba4_ndr("uniqueptr-top-push",
|
||||
' typedef struct {
|
||||
uint16 x;
|
||||
} xstruct;
|
||||
|
||||
[public] uint16 echo_TestRef([in,unique] xstruct *foo);
|
||||
',
|
||||
'
|
||||
struct ndr_push *ndr = ndr_push_init();
|
||||
struct echo_TestRef r;
|
||||
struct xstruct s;
|
||||
s.x = 13;
|
||||
r.in.foo = &s;
|
||||
|
||||
if (NT_STATUS_IS_ERR(ndr_push_echo_TestRef(ndr, NDR_IN, &r)))
|
||||
return 1;
|
||||
|
||||
if (ndr->offset != 6)
|
||||
return 2;
|
||||
|
||||
if (ndr->data[0] == 0 && ndr->data[1] == 0 &&
|
||||
ndr->data[2] == 0 && ndr->data[3] == 0)
|
||||
return 3;
|
||||
|
||||
if (ndr->data[4] != 13 || ndr->data[5] != 0)
|
||||
return 4;
|
||||
');
|
||||
|
||||
test_samba4_ndr("uniqueptr-top-push-null",
|
||||
' typedef struct {
|
||||
uint16 x;
|
||||
} xstruct;
|
||||
|
||||
[public] uint16 echo_TestRef([in,unique] xstruct *foo);
|
||||
',
|
||||
'
|
||||
struct ndr_push *ndr = ndr_push_init();
|
||||
struct echo_TestRef r;
|
||||
r.in.foo = NULL;
|
||||
|
||||
if (NT_STATUS_IS_ERR(ndr_push_echo_TestRef(ndr, NDR_IN, &r)))
|
||||
return 1;
|
||||
|
||||
if (ndr->offset != 4)
|
||||
return 2;
|
||||
|
||||
if (ndr->data[0] != 0 || ndr->data[1] != 0 ||
|
||||
ndr->data[2] != 0 || ndr->data[3] != 0)
|
||||
return 3;
|
||||
');
|
||||
|
||||
|
||||
test_samba4_ndr("ptr-top-out-pull",
|
||||
'
|
||||
typedef struct {
|
||||
uint16 x;
|
||||
} xstruct;
|
||||
|
||||
[public] void echo_TestRef([out] xstruct *foo);
|
||||
',
|
||||
'
|
||||
uint8_t data[] = { 0x0D, 0x00 };
|
||||
DATA_BLOB b = { data, 2 };
|
||||
struct ndr_pull *ndr = ndr_pull_init_blob(&b, NULL);
|
||||
struct xstruct s;
|
||||
struct echo_TestRef r;
|
||||
|
||||
r.out.foo = &s;
|
||||
|
||||
if (NT_STATUS_IS_ERR(ndr_pull_echo_TestRef(ndr, NDR_OUT, &r)))
|
||||
return 1;
|
||||
|
||||
if (!r.out.foo)
|
||||
return 2;
|
||||
|
||||
if (r.out.foo->x != 13)
|
||||
return 3;
|
||||
');
|
||||
|
||||
test_samba4_ndr("ptr-top-out-pull-null",
|
||||
'
|
||||
typedef struct {
|
||||
uint16 x;
|
||||
} xstruct;
|
||||
|
||||
[public] void echo_TestRef([out] xstruct *foo);
|
||||
',
|
||||
'
|
||||
uint8_t data[] = { 0x0D, 0x00 };
|
||||
DATA_BLOB b = { data, 2 };
|
||||
struct ndr_pull *ndr = ndr_pull_init_blob(&b, NULL);
|
||||
struct echo_TestRef r;
|
||||
|
||||
r.out.foo = NULL;
|
||||
|
||||
if (NT_STATUS_IS_OK(ndr_pull_echo_TestRef(ndr, NDR_OUT, &r)))
|
||||
return 1;
|
||||
|
||||
/* Windows gives [client runtime error 0x6f4] */
|
||||
');
|
||||
|
||||
|
||||
test_samba4_ndr("refptr-top-out-pull",
|
||||
'
|
||||
typedef struct {
|
||||
uint16 x;
|
||||
} xstruct;
|
||||
|
||||
[public] void echo_TestRef([out,ref] xstruct *foo);
|
||||
',
|
||||
'
|
||||
uint8_t data[] = { 0x0D, 0x00 };
|
||||
DATA_BLOB b = { data, 2 };
|
||||
struct ndr_pull *ndr = ndr_pull_init_blob(&b, NULL);
|
||||
struct xstruct s;
|
||||
struct echo_TestRef r;
|
||||
|
||||
r.out.foo = &s;
|
||||
|
||||
if (NT_STATUS_IS_ERR(ndr_pull_echo_TestRef(ndr, NDR_OUT, &r)))
|
||||
return 1;
|
||||
|
||||
if (!r.out.foo)
|
||||
return 2;
|
||||
|
||||
if (r.out.foo->x != 13)
|
||||
return 3;
|
||||
');
|
||||
|
||||
test_samba4_ndr("refptr-top-out-pull-null",
|
||||
'
|
||||
typedef struct {
|
||||
uint16 x;
|
||||
} xstruct;
|
||||
|
||||
[public] void echo_TestRef([out,ref] xstruct *foo);
|
||||
',
|
||||
'
|
||||
uint8_t data[] = { 0x0D, 0x00 };
|
||||
DATA_BLOB b = { data, 2 };
|
||||
struct ndr_pull *ndr = ndr_pull_init_blob(&b, NULL);
|
||||
struct echo_TestRef r;
|
||||
|
||||
r.out.foo = NULL;
|
||||
|
||||
if (NT_STATUS_IS_OK(ndr_pull_echo_TestRef(ndr, NDR_OUT, &r)))
|
||||
return 1;
|
||||
|
||||
/* Windows gives [client runtime error 0x6f4] */
|
||||
');
|
||||
|
||||
|
||||
test_samba4_ndr("ptr-top-push-double",
|
||||
'
|
||||
[public] void echo_TestRef([in] uint16 **foo);
|
||||
',
|
||||
' struct ndr_push *ndr = ndr_push_init();
|
||||
struct echo_TestRef r;
|
||||
uint16_t v = 13;
|
||||
uint16_t *pv = &v;
|
||||
r.in.foo = &pv;
|
||||
|
||||
if (NT_STATUS_IS_ERR(ndr_push_echo_TestRef(ndr, NDR_IN, &r)))
|
||||
return 1;
|
||||
|
||||
if (ndr->offset != 6)
|
||||
return 2;
|
||||
|
||||
if (ndr->data[0] == 0 && ndr->data[1] == 0 &&
|
||||
ndr->data[2] == 0 && ndr->data[3] == 0)
|
||||
return 3;
|
||||
|
||||
if (ndr->data[4] != 0x0D || ndr->data[5] != 0x00)
|
||||
return 4;
|
||||
');
|
||||
|
||||
SKIP: {
|
||||
skip "ptr-top-push-double-sndnull is known to fail", 8;
|
||||
|
||||
test_samba4_ndr("ptr-top-push-double-sndnull",
|
||||
'
|
||||
[public] void echo_TestRef([in] uint16 **foo);
|
||||
',
|
||||
' struct ndr_push *ndr = ndr_push_init();
|
||||
struct echo_TestRef r;
|
||||
uint16_t *pv = NULL;
|
||||
r.in.foo = &pv;
|
||||
|
||||
if (NT_STATUS_IS_ERR(ndr_push_echo_TestRef(ndr, NDR_IN, &r)))
|
||||
return 1;
|
||||
|
||||
if (ndr->offset != 4)
|
||||
return 2;
|
||||
|
||||
if (ndr->data[0] != 0 || ndr->data[1] != 0 ||
|
||||
ndr->data[2] != 0 || ndr->data[3] != 0)
|
||||
return 3;
|
||||
');
|
||||
}
|
||||
|
||||
test_samba4_ndr("ptr-top-push-double-fstnull",
|
||||
'
|
||||
[public] void echo_TestRef([in] uint16 **foo);
|
||||
',
|
||||
' struct ndr_push *ndr = ndr_push_init();
|
||||
struct echo_TestRef r;
|
||||
r.in.foo = NULL;
|
||||
|
||||
if (NT_STATUS_IS_OK(ndr_push_echo_TestRef(ndr, NDR_IN, &r)))
|
||||
return 1;
|
||||
|
||||
/* Windows gives [client runtime error 0x6f4] */
|
||||
|
||||
');
|
||||
|
||||
|
||||
test_samba4_ndr("refptr-top-push-double",
|
||||
'
|
||||
[public] void echo_TestRef([in,ref] uint16 **foo);
|
||||
',
|
||||
' struct ndr_push *ndr = ndr_push_init();
|
||||
struct echo_TestRef r;
|
||||
uint16_t v = 13;
|
||||
uint16_t *pv = &v;
|
||||
r.in.foo = &pv;
|
||||
|
||||
if (NT_STATUS_IS_ERR(ndr_push_echo_TestRef(ndr, NDR_IN, &r)))
|
||||
return 1;
|
||||
|
||||
if (ndr->offset != 6)
|
||||
return 2;
|
||||
|
||||
if (ndr->data[0] == 0 && ndr->data[1] == 0 &&
|
||||
ndr->data[2] == 0 && ndr->data[3] == 0)
|
||||
return 3;
|
||||
|
||||
if (ndr->data[4] != 0x0D || ndr->data[5] != 0x00)
|
||||
return 4;
|
||||
');
|
||||
|
||||
SKIP: {
|
||||
|
||||
skip "refptr-top-push-double-sndnull is known to fail", 8;
|
||||
|
||||
test_samba4_ndr("refptr-top-push-double-sndnull",
|
||||
'
|
||||
[public] void echo_TestRef([in,ref] uint16 **foo);
|
||||
',
|
||||
' struct ndr_push *ndr = ndr_push_init();
|
||||
struct echo_TestRef r;
|
||||
uint16_t *pv = NULL;
|
||||
r.in.foo = &pv;
|
||||
|
||||
if (NT_STATUS_IS_ERR(ndr_push_echo_TestRef(ndr, NDR_IN, &r)))
|
||||
return 1;
|
||||
|
||||
if (ndr->offset != 4)
|
||||
return 2;
|
||||
|
||||
if (ndr->data[0] != 0 || ndr->data[1] != 0 ||
|
||||
ndr->data[2] != 0 || ndr->data[3] != 0)
|
||||
return 3;
|
||||
');
|
||||
}
|
||||
|
||||
test_samba4_ndr("refptr-top-push-double-fstnull",
|
||||
'
|
||||
[public] void echo_TestRef([in,ref] uint16 **foo);
|
||||
',
|
||||
' struct ndr_push *ndr = ndr_push_init();
|
||||
struct echo_TestRef r;
|
||||
r.in.foo = NULL;
|
||||
|
||||
if (NT_STATUS_IS_OK(ndr_push_echo_TestRef(ndr, NDR_IN, &r)))
|
||||
return 1;
|
||||
|
||||
/* Windows gives [client runtime error 0x6f4] */
|
||||
|
||||
');
|
||||
|
||||
SKIP: {
|
||||
skip "ignore-ptrs are not supported yet", 8;
|
||||
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;
|
||||
');
|
||||
}
|
||||
@@ -0,0 +1,43 @@
|
||||
#!/usr/bin/perl
|
||||
# NDR represent_as() / transmit_as() tests
|
||||
# (C) 2006 Jelmer Vernooij. Published under the GNU GPL
|
||||
use strict;
|
||||
|
||||
use Test::More tests => 1 * 8;
|
||||
use FindBin qw($RealBin);
|
||||
use lib "$RealBin/../lib";
|
||||
use lib "$RealBin";
|
||||
use Util qw(test_samba4_ndr);
|
||||
|
||||
test_samba4_ndr('represent_as-simple',
|
||||
'
|
||||
void bla([in,represent_as(uint32)] uint8 x);
|
||||
',
|
||||
'
|
||||
uint8_t expected[] = { 0x0D };
|
||||
DATA_BLOB in_blob = { expected, 1 };
|
||||
struct ndr_pull *ndr = ndr_pull_init_blob(&in_blob, NULL);
|
||||
struct bla r;
|
||||
|
||||
if (NT_STATUS_IS_ERR(ndr_pull_bla(ndr, NDR_SCALARS|NDR_BUFFERS, &r)))
|
||||
return 1;
|
||||
|
||||
if (r.in.x != 13)
|
||||
return 2;
|
||||
',
|
||||
'
|
||||
#include <libcli/util/nterr.h>
|
||||
|
||||
NTSTATUS ndr_uint8_to_uint32(uint8_t from, uint32_t *to)
|
||||
{
|
||||
*to = from;
|
||||
return NT_STATUS_OK;
|
||||
}
|
||||
|
||||
NTSTATUS ndr_uint32_to_uint8(uint32_t from, uint8_t *to)
|
||||
{
|
||||
*to = from;
|
||||
return NT_STATUS_OK;
|
||||
}
|
||||
'
|
||||
);
|
||||
Executable
+29
@@ -0,0 +1,29 @@
|
||||
#!/usr/bin/perl
|
||||
# Some simple tests for pidl
|
||||
# (C) 2005 Jelmer Vernooij <jelmer@samba.org>
|
||||
# Published under the GNU General Public License
|
||||
use strict;
|
||||
|
||||
use Test::More tests => 8;
|
||||
use FindBin qw($RealBin);
|
||||
use lib "$RealBin/../lib";
|
||||
use lib "$RealBin";
|
||||
use Util qw(test_samba4_ndr);
|
||||
|
||||
test_samba4_ndr("simple", "void Test(); ",
|
||||
"
|
||||
uint8_t data[] = { 0x02 };
|
||||
uint8_t result;
|
||||
DATA_BLOB b;
|
||||
struct ndr_pull *ndr;
|
||||
|
||||
b.data = data;
|
||||
b.length = 1;
|
||||
ndr = ndr_pull_init_blob(&b, mem_ctx);
|
||||
|
||||
if (NT_STATUS_IS_ERR(ndr_pull_uint8(ndr, NDR_SCALARS, &result)))
|
||||
return 1;
|
||||
|
||||
if (result != 0x02)
|
||||
return 2;
|
||||
");
|
||||
Executable
+84
@@ -0,0 +1,84 @@
|
||||
#!/usr/bin/perl
|
||||
# String tests for pidl
|
||||
# (C) 2005 Jelmer Vernooij <jelmer@samba.org>
|
||||
# Published under the GNU General Public License
|
||||
use strict;
|
||||
|
||||
use Test::More tests => 3 * 8;
|
||||
use FindBin qw($RealBin);
|
||||
use lib "$RealBin/../lib";
|
||||
use lib "$RealBin";
|
||||
use Util qw(test_samba4_ndr);
|
||||
|
||||
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 };
|
||||
DATA_BLOB b = { data, 4 };
|
||||
struct ndr_pull *ndr = ndr_pull_init_blob(&b, NULL);
|
||||
struct TestString r;
|
||||
r.in.data = NULL;
|
||||
|
||||
if (NT_STATUS_IS_ERR(ndr_pull_TestString(ndr, NDR_IN, &r)))
|
||||
return 1;
|
||||
|
||||
if (r.in.data == NULL)
|
||||
return 2;
|
||||
|
||||
if (r.in.data[0] != 0)
|
||||
return 3;
|
||||
');
|
||||
|
||||
test_samba4_ndr("string-ascii-pull",
|
||||
'
|
||||
[public] void TestString([in,flag(STR_ASCII|LIBNDR_FLAG_STR_SIZE4)] string data);
|
||||
',
|
||||
'
|
||||
uint8_t data[] = { 0x03, 0x00, 0x00, 0x00,
|
||||
\'f\', \'o\', \'o\', 0 };
|
||||
DATA_BLOB b = { data, 8 };
|
||||
struct ndr_pull *ndr = ndr_pull_init_blob(&b, NULL);
|
||||
struct TestString r;
|
||||
r.in.data = NULL;
|
||||
|
||||
if (NT_STATUS_IS_ERR(ndr_pull_TestString(ndr, NDR_IN, &r)))
|
||||
return 1;
|
||||
|
||||
if (r.in.data == NULL)
|
||||
return 2;
|
||||
|
||||
if (strncmp(r.in.data, "foo", 3) != 0)
|
||||
return 3;
|
||||
|
||||
if (r.in.data[4] != 0)
|
||||
return 4;
|
||||
');
|
||||
|
||||
test_samba4_ndr("string-out",
|
||||
'
|
||||
[public] void TestString([out,string] uint8 **data);
|
||||
',
|
||||
'
|
||||
uint8_t data[] = { 0x03, 0x00, 0x00, 0x00,
|
||||
\'f\', \'o\', \'o\', 0 };
|
||||
DATA_BLOB b = { data, 8 };
|
||||
struct ndr_pull *ndr = ndr_pull_init_blob(&b, NULL);
|
||||
struct TestString r;
|
||||
char *str = NULL;
|
||||
r.out.data = &str;
|
||||
|
||||
if (NT_STATUS_IS_ERR(ndr_pull_TestString(ndr, NDR_IN, &r)))
|
||||
return 1;
|
||||
|
||||
if (r.out.data == NULL)
|
||||
return 2;
|
||||
|
||||
if (*r.out.data == NULL)
|
||||
return 3;
|
||||
|
||||
if (strncmp(r.out.data, "foo", 3) != 0)
|
||||
return 3;
|
||||
|
||||
if (r.out.data[4] != 0)
|
||||
return 4;
|
||||
');
|
||||
Executable
+38
@@ -0,0 +1,38 @@
|
||||
#!/usr/bin/perl
|
||||
# Support for tagged types
|
||||
# (C) 2005 Jelmer Vernooij. Published under the GNU GPL
|
||||
use strict;
|
||||
|
||||
use Test::More tests => 1 * 8;
|
||||
use FindBin qw($RealBin);
|
||||
use lib "$RealBin/../lib";
|
||||
use lib "$RealBin";
|
||||
use Util qw(test_samba4_ndr);
|
||||
|
||||
SKIP: {
|
||||
skip "Tagged types without typedef are not supported yet", 8;
|
||||
|
||||
test_samba4_ndr('struct-notypedef',
|
||||
'
|
||||
struct bla {
|
||||
uint8 x;
|
||||
};
|
||||
',
|
||||
'
|
||||
struct ndr_push *ndr = ndr_push_init();
|
||||
struct bla r;
|
||||
uint8_t expected[] = { 0x0D };
|
||||
DATA_BLOB expected_blob = { expected, 1 };
|
||||
DATA_BLOB result_blob;
|
||||
r.x = 13;
|
||||
|
||||
if (NT_STATUS_IS_ERR(ndr_push_bla(ndr, NDR_SCALARS|NDR_BUFFERS, &r)))
|
||||
return 1;
|
||||
|
||||
result_blob = ndr_push_blob(ndr);
|
||||
|
||||
if (!data_blob_equal(&result_blob, &expected_blob))
|
||||
return 2;
|
||||
');
|
||||
|
||||
}
|
||||
Executable
+90
@@ -0,0 +1,90 @@
|
||||
#!/usr/bin/perl
|
||||
# Some simple tests for pidls parsing routines
|
||||
# (C) 2005 Jelmer Vernooij <jelmer@samba.org>
|
||||
# Published under the GNU General Public License
|
||||
use strict;
|
||||
|
||||
use Test::More tests => 59;
|
||||
use FindBin qw($RealBin);
|
||||
use lib "$RealBin/../lib";
|
||||
use Parse::Pidl::IDL;
|
||||
use Parse::Pidl::NDR;
|
||||
|
||||
sub testok($$)
|
||||
{
|
||||
my ($name, $data) = @_;
|
||||
|
||||
my $pidl = Parse::Pidl::IDL::parse_string($data, "<$name>");
|
||||
|
||||
ok (defined($pidl), $name);
|
||||
return $pidl
|
||||
}
|
||||
|
||||
sub testfail($$)
|
||||
{
|
||||
my ($name, $data) = @_;
|
||||
|
||||
my $pidl = Parse::Pidl::IDL::parse_string($data, "<$name>");
|
||||
|
||||
ok ((not defined $pidl), $name);
|
||||
}
|
||||
|
||||
testfail "unknowntag", "bla test {};";
|
||||
testok "test1", "interface test { void Test(); }; ";
|
||||
testok "voidtest", "interface test { int Testx(void); }; ";
|
||||
testfail "voidtest", "interface test { Test(); }; ";
|
||||
testok "argtest", "interface test { int Test(int a, long b, uint32 c); }; ";
|
||||
testok "array1", "interface test { int Test(int a[]); };";
|
||||
testok "array2", "interface test { int Test(int a[2]); };";
|
||||
testok "array3", "interface test { int Test(int a[b]); };";
|
||||
testfail "array4", "interface test { int Test(int[] a); };";
|
||||
testok "ptr1", "interface test { int Test(int *a); };";
|
||||
testok "ptr2", "interface test { int Test(int **a); };";
|
||||
testok "ptr3", "interface test { int Test(int ***a); };";
|
||||
testfail "empty1", "interface test { };";
|
||||
testfail "empty2", "";
|
||||
testok "attr1", "[uuid(\"myuuid\"),attr] interface test { int Test(int ***a); };";
|
||||
testok "attr2", "interface test { [public] int Test(); };";
|
||||
testok "attr3", "[attr1] [attr2] interface test { [public] int Test(); };";
|
||||
testok "multfn", "interface test { int test1(); int test2(); };";
|
||||
testok "multif", "interface test { int test1(); }; interface test2 { int test2(); };";
|
||||
testok "tdstruct1", "interface test { typedef struct { } foo; };";
|
||||
testok "tdstruct2", "interface test { typedef struct { int a; } foo; };";
|
||||
testok "tdstruct3", "interface test { typedef struct { int a; int b; } foo; };";
|
||||
testfail "tdstruct4", "interface test { typedef struct { int a, int b; } foo; };";
|
||||
testok "struct1", "interface test { struct x { }; };";
|
||||
testok "struct2", "interface test { struct x { int a; }; };";
|
||||
testok "struct3", "interface test { struct x { int a; int b; }; };";
|
||||
testfail "struct4", "interface test { struct x { int a, int b; }; };";
|
||||
testfail "struct5", "interface test { struct { int a; } x; };";
|
||||
testok "tdunion1", "interface test { typedef union { } a; };";
|
||||
testok "tdunion2", "interface test { typedef union { int a; } a; };";
|
||||
testok "union1", "interface test { union a { }; };";
|
||||
testok "union2", "interface test { union x { int a; }; };";
|
||||
testfail "union3", "interface test { union { int a; } x; };";
|
||||
testok "typedef1", "interface test { typedef int a; };";
|
||||
testfail "typedef2", "interface test { typedef x; };";
|
||||
testok "tdenum1", "interface test { typedef enum { A=1, B=2, C} a; };";
|
||||
testok "enum1", "interface test { enum a { A=1, B=2, C}; };";
|
||||
testfail "enum2", "interface test { enum { A=1, B=2, C} a; };";
|
||||
testok "nested1", "interface test { struct x { struct { int a; } z; }; };";
|
||||
testok "nested2", "interface test { struct x { struct y { int a; } z; }; };";
|
||||
testok "bitmap1", "interface test { bitmap x { a=1 }; };";
|
||||
testok "unsigned", "interface test { struct x { unsigned short y; }; };";
|
||||
testok "signed", "interface test { struct x { signed short y; }; };";
|
||||
testok "declarg", "interface test { void test(struct { int x; } a); };";
|
||||
testok "structqual", "interface test { struct x { struct y z; }; };";
|
||||
testok "unionqual", "interface test { struct x { union y z; }; };";
|
||||
testok "enumqual", "interface test { struct x { enum y z; }; };";
|
||||
testok "bitmapqual", "interface test { struct x { bitmap y z; }; };";
|
||||
testok "emptystructdecl", "interface test { struct x; };";
|
||||
testok "emptyenumdecl", "interface test { enum x; };";
|
||||
testok "emptytdstructdecl", "interface test { typedef struct x y; };";
|
||||
testok "import", "import \"foo.idl\";";
|
||||
testok "include", "include \"foo.h\";";
|
||||
testfail "import-noquotes", "import foo.idl;";
|
||||
testfail "include-noquotes", "include foo.idl;";
|
||||
testok "importlib", "importlib \"foo.idl\";";
|
||||
testfail "import-nosemicolon", "import \"foo.idl\"";
|
||||
testok "import-multiple", "import \"foo.idl\", \"bar.idl\";";
|
||||
testok "include-multiple", "include \"foo.idl\", \"bar.idl\";";
|
||||
Reference in New Issue
Block a user