From 311d6f47c85282925932b3a7326e66679be9451f Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Thu, 23 Mar 2006 21:47:16 +0000 Subject: 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 a7279f13f0431a5036c931c5339542f98139c461) --- source4/pidl/tests/Util.pm | 41 ++++++++++++----------------------------- 1 file changed, 12 insertions(+), 29 deletions(-) (limited to 'source4/pidl/tests/Util.pm') diff --git a/source4/pidl/tests/Util.pm b/source4/pidl/tests/Util.pm index 37177cc730..3e0f214854 100644 --- a/source4/pidl/tests/Util.pm +++ b/source4/pidl/tests/Util.pm @@ -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 \n"; + print CC "#include \n"; + print CC "#include \n"; + print CC "#include \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; -- cgit