summaryrefslogtreecommitdiff
path: root/source4/pidl/tests/Util.pm
diff options
context:
space:
mode:
authorJelmer Vernooij <jelmer@samba.org>2006-03-23 21:47:16 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 13:59:08 -0500
commit311d6f47c85282925932b3a7326e66679be9451f (patch)
treef0c5dd58f4eaff4fe35a4aee4b36789dbaf59991 /source4/pidl/tests/Util.pm
parent41a6591628bc7dcb4751b8c2752e6d288d579276 (diff)
downloadsamba-311d6f47c85282925932b3a7326e66679be9451f.tar.gz
samba-311d6f47c85282925932b3a7326e66679be9451f.tar.bz2
samba-311d6f47c85282925932b3a7326e66679be9451f.zip
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)
Diffstat (limited to 'source4/pidl/tests/Util.pm')
-rw-r--r--source4/pidl/tests/Util.pm41
1 files changed, 12 insertions, 29 deletions
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 <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;