1
0
mirror of https://github.com/samba-team/samba.git synced 2024-12-23 17:34:34 +03:00

r14686: Fix pidl testsuite to run whenever there is a shared libary built

Samba present. Ignore tests that are known to fail for now.
(This used to be commit a7279f13f0)
This commit is contained in:
Jelmer Vernooij 2006-03-23 21:47:16 +00:00 committed by Gerald (Jerry) Carter
parent 41a6591628
commit 311d6f47c8
4 changed files with 53 additions and 48 deletions

View File

@ -317,8 +317,10 @@ sub find_largest_alignment($)
if ($e->{POINTERS}) {
$a = 4;
} elsif (has_property($e, "subcontext")){
} elsif (has_property($e, "subcontext")) {
$a = 1;
} elsif (has_property($e, "represent_as")) {
$a = align_type($e->{PROPERTIES}->{represent_as});
} else {
$a = align_type($e->{TYPE});
}
@ -793,6 +795,8 @@ my %property_list = (
"case" => ["ELEMENT"],
"default" => ["ELEMENT"],
"represent_as" => ["ELEMENT"],
# subcontext
"subcontext" => ["ELEMENT"],
"subcontext_size" => ["ELEMENT"],

View File

@ -15,9 +15,6 @@ use Parse::Pidl::IDL;
use Parse::Pidl::NDR;
use Parse::Pidl::Samba4::NDR::Parser;
use Parse::Pidl::Samba4::Header;
use Parse::Pidl::Samba4 qw(is_intree);
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
@ -37,13 +34,8 @@ sub test_samba4_ndr($$$)
SKIP: {
my $link = is_intree() && 0; # FIXME
skip "no samba environment available, skipping compilation", 3
if not is_intree();
skip "no sane C compiler, skipping compilation", 3
if not $sanecc;
if (system("pkg-config --exists dcerpc ndr") != 0);
my $test_data_prefix = $ENV{TEST_DATA_PREFIX};
@ -54,15 +46,15 @@ SKIP: {
$outfile = "test-$name";
}
#my $cflags = $ENV{CFLAGS};
my $cflags = "-Iinclude -Ilib -I.";
my $cflags = `pkg-config --libs --cflags dcerpc ndr`;
if (is_intree() and $link) {
open CC, "|cc -x c -o $outfile $cflags -";
} elsif (is_intree()) {
open CC, "|cc -x c -c -o $outfile $cflags -";
}
print CC "#include \"includes.h\"\n";
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 <stdarg.h>\n";
print CC $header;
print CC $ndrheader;
print CC $ndrparser;
@ -79,23 +71,14 @@ SKIP: {
ok(-f $outfile, "($name) compile");
unless ($link) {
skip "no shared libraries of Samba available yet, can't run test", 2;
unlink($outfile);
}
my $ret = system("./$outfile", ()) >> 8;
print "# return code: $ret\n" if ($ret != 0);
ok(system($outfile), "($name) run");
ok($ret == 0, "($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;

View File

@ -113,6 +113,10 @@ test_samba4_ndr('noalignflag-uint8-uint16',
return 2;
');
SKIP: {
skip "align-blob-align2 is known to fail", 8;
test_samba4_ndr('align-blob-align2',
'
typedef [public] struct {
@ -137,6 +141,9 @@ test_samba4_ndr('align-blob-align2',
result_blob = ndr_push_blob(ndr);
printf("%02x%02x%02x%02x\n", result_blob.data[0], result_blob.data[1], result_blob.data[2], result_blob.data[3]);
if (!data_blob_equal(&result_blob, &expected_blob))
return 2;
');
}

View File

@ -5,7 +5,7 @@
# Published under the GNU General Public License.
use strict;
use Test::More tests => 21 * 8;
use Test::More tests => 22 * 8;
use FindBin qw($RealBin);
use lib "$RealBin/../lib";
use lib "$RealBin";
@ -402,6 +402,9 @@ test_samba4_ndr("ptr-top-push-double",
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);
@ -421,6 +424,7 @@ test_samba4_ndr("ptr-top-push-double-sndnull",
ndr->data[2] != 0 || ndr->data[3] != 0)
return 3;
');
}
test_samba4_ndr("ptr-top-push-double-fstnull",
'
@ -462,6 +466,10 @@ test_samba4_ndr("refptr-top-push-double",
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);
@ -481,6 +489,7 @@ test_samba4_ndr("refptr-top-push-double-sndnull",
ndr->data[2] != 0 || ndr->data[3] != 0)
return 3;
');
}
test_samba4_ndr("refptr-top-push-double-fstnull",
'
@ -497,20 +506,22 @@ test_samba4_ndr("refptr-top-push-double-fstnull",
');
#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;
#');
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;
');
}