r20967: Allow pidl tests to work with gcov
authorJelmer Vernooij <jelmer@samba.org>
Tue, 23 Jan 2007 10:08:08 +0000 (10:08 +0000)
committerGerald (Jerry) Carter <jerry@samba.org>
Wed, 10 Oct 2007 19:44:04 +0000 (14:44 -0500)
(This used to be commit 9da63e362c9d590388c77d882f9dbf54b0aa78cc)

source4/pidl/tests/Util.pm
source4/pidl/tests/ndr_align.pl
source4/pidl/tests/ndr_refptr.pl
source4/pidl/tests/ndr_tagtype.pl
source4/script/tests/tests_all.sh
source4/torture/config.mk

index cfa14226748f9c5a48369ab88d4febabdb9872fd..a406b868e131076c83488a9dd8f58db57bf85f59 100644 (file)
@@ -72,9 +72,27 @@ SKIP: {
                $outfile = "./test-$name";
        }
 
+       my $cflags = $ENV{CFLAGS};
+       unless (defined($cflags)) {
+               $cflags = "";
+       }
+
+       my $ldflags = $ENV{LDFLAGS};
+       unless (defined($ldflags)) {
+               $ldflags = "";
+       }
+
+       my $cc = $ENV{CC};
+       unless (defined($cc)) {
+               $cc = "cc";
+       }
+
        my $flags = `pkg-config --libs --cflags ndr samba-config`;
 
-       open CC, "|cc -x c - -o $outfile $flags";
+       my $cmd = "$cc $cflags -x c - -o $outfile $flags $ldflags";
+       $cmd =~ s/\n//g;
+       print "$cmd\n";
+       open CC, "|$cmd";
        print CC "#define uint_t unsigned int\n";
        print CC "#define _GNU_SOURCE\n";
        print CC "#include <stdint.h>\n";
@@ -121,7 +139,6 @@ sub test_warnings($$)
        is($warnings, $exp);
 }
 
-
 sub test_errors($$)
 {
        my ($exp, $code) = @_;
index 5117be95bd4f30785008611a4a2d26eea42d35a1..405b74597c2012c40b4fa7b1be359d8d5afc680b 100755 (executable)
@@ -16,7 +16,7 @@ test_samba4_ndr('align-uint8-uint16',
        } bla;
 ',
 '
-       struct ndr_push *ndr = ndr_push_init();
+       struct ndr_push *ndr = ndr_push_init_ctx(NULL);
        struct bla r;
        uint8_t expected[] = { 0x0D, 0x00, 0xef, 0xbe };
        DATA_BLOB expected_blob = { expected, 4 };
@@ -41,7 +41,7 @@ test_samba4_ndr('align-uint8-uint32',
        } bla;
 ',
 '
-       struct ndr_push *ndr = ndr_push_init();
+       struct ndr_push *ndr = ndr_push_init_ctx(NULL);
        struct bla r;
        uint8_t expected[] = { 0x0D, 0x00, 0x00, 0x00, 0xef, 0xbe, 0xef, 0xbe };
        DATA_BLOB expected_blob = { expected, 8 };
@@ -67,7 +67,7 @@ test_samba4_ndr('align-uint8-hyper',
        } bla;
 ',
 '
-       struct ndr_push *ndr = ndr_push_init();
+       struct ndr_push *ndr = ndr_push_init_ctx(NULL);
        struct bla r;
        uint8_t expected[] = { 0x0D, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
                                                   0xef, 0xbe, 0xef, 0xbe, 0xef, 0xbe, 0xef, 0xbe };
@@ -93,7 +93,7 @@ test_samba4_ndr('noalignflag-uint8-uint16',
        } bla;
 ',
 '
-       struct ndr_push *ndr = ndr_push_init();
+       struct ndr_push *ndr = ndr_push_init_ctx(NULL);
        struct bla r;
        uint8_t expected[] = { 0x0D, 0xef, 0xbe };
        DATA_BLOB expected_blob = { expected, 3 };
@@ -121,7 +121,7 @@ test_samba4_ndr('align-blob-align2',
        } blie;
 ',
 '
-       struct ndr_push *ndr = ndr_push_init();
+       struct ndr_push *ndr = ndr_push_init_ctx(NULL);
        struct blie r;
        uint8_t data[] = { 0x01, 0x02 };
        uint8_t expected[] = { 0x0D, 0x00, 0x0E };
index 0bc5fd94168d9c678dd302175f62bfd5cc2364d0..4a56e3ca38a041f9af8f582cdef651db686a13e3 100755 (executable)
@@ -18,7 +18,7 @@ test_samba4_ndr("noptr-push",
        [public] uint16 echo_TestRef([in] xstruct foo);
 ',
 '
-       struct ndr_push *ndr = ndr_push_init();
+       struct ndr_push *ndr = ndr_push_init_ctx(NULL);
        uint16_t v = 13;
        struct echo_TestRef r;
        r.in.foo.x = v; 
@@ -48,7 +48,7 @@ test_samba4_ndr("ptr-embedded-push",
 ',
 '
        uint16_t v = 13;
-       struct ndr_push *ndr = ndr_push_init();
+       struct ndr_push *ndr = ndr_push_init_ctx(NULL);
        struct echo_TestRef r;
        r.in.foo.x = &v; 
 
@@ -74,7 +74,7 @@ test_samba4_ndr("ptr-embedded-push-null",
        [public] uint16 echo_TestRef([in] xstruct foo);
 ',
 '
-       struct ndr_push *ndr = ndr_push_init();
+       struct ndr_push *ndr = ndr_push_init_ctx(NULL);
        struct echo_TestRef r;
        r.in.foo.x = NULL; 
 
@@ -99,7 +99,7 @@ test_samba4_ndr("refptr-embedded-push",
 ',
 '
        uint16_t v = 13;
-       struct ndr_push *ndr = ndr_push_init();
+       struct ndr_push *ndr = ndr_push_init_ctx(NULL);
        struct echo_TestRef r;
        r.in.foo.x = &v; 
 
@@ -126,7 +126,7 @@ test_samba4_ndr("refptr-embedded-push-null",
        [public] uint16 echo_TestRef([in] xstruct foo);
 ',
 '
-       struct ndr_push *ndr = ndr_push_init();
+       struct ndr_push *ndr = ndr_push_init_ctx(NULL);
        struct echo_TestRef r;
        r.in.foo.x = NULL; 
 
@@ -144,7 +144,7 @@ test_samba4_ndr("ptr-top-push",
        [public] uint16 echo_TestRef([in] xstruct *foo);
 ',
 '
-       struct ndr_push *ndr = ndr_push_init();
+       struct ndr_push *ndr = ndr_push_init_ctx(NULL);
        struct echo_TestRef r;
        struct xstruct s;
        s.x = 13;
@@ -169,7 +169,7 @@ test_samba4_ndr("ptr-top-push-null",
        [public] uint16 echo_TestRef([in] xstruct *foo);
 ',
 '
-       struct ndr_push *ndr = ndr_push_init();
+       struct ndr_push *ndr = ndr_push_init_ctx(NULL);
        struct echo_TestRef r;
        r.in.foo = NULL;
 
@@ -189,7 +189,7 @@ test_samba4_ndr("refptr-top-push",
        [public] uint16 echo_TestRef([in,ref] xstruct *foo);
 ',
 '
-       struct ndr_push *ndr = ndr_push_init();
+       struct ndr_push *ndr = ndr_push_init_ctx(NULL);
        struct echo_TestRef r;
        struct xstruct s;
        s.x = 13;
@@ -214,7 +214,7 @@ test_samba4_ndr("refptr-top-push-null",
        [public] uint16 echo_TestRef([in,ref] xstruct *foo);
 ',
 '
-       struct ndr_push *ndr = ndr_push_init();
+       struct ndr_push *ndr = ndr_push_init_ctx(NULL);
        struct echo_TestRef r;
        r.in.foo = NULL;
 
@@ -233,7 +233,7 @@ test_samba4_ndr("uniqueptr-top-push",
        [public] uint16 echo_TestRef([in,unique] xstruct *foo);
 ',
 '
-       struct ndr_push *ndr = ndr_push_init();
+       struct ndr_push *ndr = ndr_push_init_ctx(NULL);
        struct echo_TestRef r;
        struct xstruct s;
        s.x = 13;
@@ -261,7 +261,7 @@ test_samba4_ndr("uniqueptr-top-push-null",
        [public] uint16 echo_TestRef([in,unique] xstruct *foo);
 ',
 '
-       struct ndr_push *ndr = ndr_push_init();
+       struct ndr_push *ndr = ndr_push_init_ctx(NULL);
        struct echo_TestRef r;
        r.in.foo = NULL;
 
@@ -381,7 +381,7 @@ test_samba4_ndr("ptr-top-push-double",
 '
        [public] void echo_TestRef([in] uint16 **foo);
 ',
-'      struct ndr_push *ndr = ndr_push_init();
+'      struct ndr_push *ndr = ndr_push_init_ctx(NULL);
        struct echo_TestRef r;
        uint16_t v = 13;
        uint16_t *pv = &v;
@@ -408,7 +408,7 @@ test_samba4_ndr("ptr-top-push-double-sndnull",
 '
        [public] void echo_TestRef([in] uint16 **foo);
 ',
-'      struct ndr_push *ndr = ndr_push_init();
+'      struct ndr_push *ndr = ndr_push_init_ctx(NULL);
        struct echo_TestRef r;
        uint16_t *pv = NULL;
        r.in.foo = &pv;
@@ -429,7 +429,7 @@ test_samba4_ndr("ptr-top-push-double-fstnull",
 '
        [public] void echo_TestRef([in] uint16 **foo);
 ',
-'      struct ndr_push *ndr = ndr_push_init();
+'      struct ndr_push *ndr = ndr_push_init_ctx(NULL);
        struct echo_TestRef r;
        r.in.foo = NULL;
 
@@ -445,7 +445,7 @@ test_samba4_ndr("refptr-top-push-double",
 '
        [public] void echo_TestRef([in,ref] uint16 **foo);
 ',
-'      struct ndr_push *ndr = ndr_push_init();
+'      struct ndr_push *ndr = ndr_push_init_ctx(NULL);
        struct echo_TestRef r;
        uint16_t v = 13;
        uint16_t *pv = &v;
@@ -473,7 +473,7 @@ test_samba4_ndr("refptr-top-push-double-sndnull",
 '
        [public] void echo_TestRef([in,ref] uint16 **foo);
 ',
-'      struct ndr_push *ndr = ndr_push_init();
+'      struct ndr_push *ndr = ndr_push_init_ctx(NULL);
        struct echo_TestRef r;
        uint16_t *pv = NULL;
        r.in.foo = &pv;
@@ -494,7 +494,7 @@ test_samba4_ndr("refptr-top-push-double-fstnull",
 '
        [public] void echo_TestRef([in,ref] uint16 **foo);
 ',
-'      struct ndr_push *ndr = ndr_push_init();
+'      struct ndr_push *ndr = ndr_push_init_ctx(NULL);
        struct echo_TestRef r;
        r.in.foo = NULL;
 
@@ -511,7 +511,7 @@ test_samba4_ndr("ignore-ptr",
 '
        [public] void echo_TestRef([in,ignore] uint16 *foo, [in] uint16 *bar);
 ',
-'      struct ndr_push *ndr = ndr_push_init();
+'      struct ndr_push *ndr = ndr_push_init_ctx(NULL);
        struct echo_TestRef r;
        uint16_t v = 10;
        r.in.foo = &v; 
index 662985a646c75b1ba6a360b79dcadbef200165b4..a7f7d0490a668009ff790fabba132a2d922785c2 100755 (executable)
@@ -18,7 +18,7 @@ test_samba4_ndr('struct-notypedef',
        };
 ',
 '
-       struct ndr_push *ndr = ndr_push_init();
+       struct ndr_push *ndr = ndr_push_init_ctx(NULL);
        struct bla r;
        uint8_t expected[] = { 0x0D };
        DATA_BLOB expected_blob = { expected, 1 };
index 8f3f5522a0fda0d0314b88e16f5cbec65003a740..623184ad029de04eff6395b6ff56fc3933395eb3 100755 (executable)
@@ -1,4 +1,5 @@
 #!/bin/sh
+ $SRCDIR/script/tests/test_pidl.sh
  $SRCDIR/script/tests/test_ejs.sh $DOMAIN $USERNAME $PASSWORD
  $SRCDIR/script/tests/test_ldap.sh $SERVER $USERNAME $PASSWORD
  $SRCDIR/script/tests/test_nbt.sh $SERVER
@@ -11,5 +12,4 @@
  $SRCDIR/script/tests/test_posix.sh //$SERVER/tmp $USERNAME $PASSWORD ""
  $SRCDIR/script/tests/test_local.sh
  $SRCDIR/script/tests/test_blackbox.sh $SERVER $USERNAME $PASSWORD $DOMAIN $PREFIX
- $SRCDIR/script/tests/test_pidl.sh
  $SRCDIR/script/tests/test_simple.sh //$SERVER/simple $USERNAME $PASSWORD ""
index 82fbf41ed12dfce88eedb1dd6b99b9027ac9289f..a9e773f12487dd322c518266e343794864f9d5a7 100644 (file)
@@ -340,7 +340,8 @@ test_cov:
        @$(MAKE) test \
                HOSTCC_CFLAGS="$(HOSTCC_CFLAGS) $(GCOV_FLAGS)" \
                CFLAGS="$(CFLAGS) $(GCOV_FLAGS)" \
-               LDFLAGS="$(LDFLAGS) $(GCOV_FLAGS) $(GCOV_LIBS)"
+               LDFLAGS="$(LDFLAGS) $(GCOV_FLAGS) $(GCOV_LIBS)" \
+               SHLD_FLAGS="$(SHLD_FLAGS) $(GCOV_FLAGS) $(GCOV_LIBS)"
 
 gcov: test_cov
        for I in $(sort $(dir $(ALL_OBJS))); \