On Wed Aug 29 06:42:28 2007, doughera wrote:
> On Tue, 28 Aug 2007, James Keenan via RT wrote:
> 
> > On Tue Aug 28 10:00:38 2007, doughera wrote:
> > > On Solaris, I'm getting the following failure in both 107-
> > > inter_progs.01.t
> > > and .02 .t.  I suspect it has to do with the use of callbacks in
> the
> > > Solaris hints file.  I don't know offhand what's trying to OPEN
> what,
> > > but
> > > the TIEHANDLE emulation in Parrot::IO::Capture::Mini is
> incomplete.
> > >
> >


While it may be incomplete, further analysis suggests it's not the main
problem.  Read on.

> [snip]
 
> As I said, I think this shows up here due to the use of callbacks in
> the
> hints file.  You should be able to reproduce this on Linux (or any
> other
> operating system) by using callbacks there.  Here's a simple
> (untested)
> patch for hints/linux.pm that will probably trigger the same problem.
> 
> --- parrot-current/config/init/hints/linux.pm Tue Aug 14 16:06:54 2007
> +++ parrot-andy/config/init/hints/linux.pm    Wed Aug 29 09:09:00 2007
> @@ -69,6 +69,34 @@
>          $cc_flags .= ' -D_GNU_SOURCE';
>      }
> 
> +    ### XXX This is a dummy callback to test callbacks
> +    # Run the gcc version test to see if $cc is really gcc.
> +    my $linux_link_cb = sub {
> +     use Parrot::Configure::Step qw(cc_gen cc_run);
> +        use Carp;
> +        my ( $key, $cc ) = @_;
> +        my %gnuc;
> +        my $link = $conf->data->get('link');
> +        cc_gen("config/auto/gcc/test_c.in");
> +
> +        # Can't call cc_build since we haven't set all the flags yet.
> +        # This should suffice for this test.
> +        my $cc_inc = $conf->data->get('cc_inc');
> +        Parrot::Configure::Step::_run_command( "$cc -o test test.c
> $cc_inc", 'test.cco', 'test.cco' )
> +            and confess "C compiler failed (see test.cco)";
> +        %gnuc = eval cc_run() or die "Can't run the test program:
> $!";
> +        if ( defined $gnuc{__GNUC__} ) {
> +            # $link = 'g++';  # don't actually set it in this test
> function.
> +         $conf->data->set( link => $link );
> +        }
> +        else {
> +            # Don't know what compiler we have, so don't touch $link.
> +        }
> +        $conf->data->deltrigger( "cc", "linux_link" );
> +    };
> +    $conf->data->settrigger( "cc", "linux_link", $linux_link_cb );
> +    ### XXX End of dummy callback to test callbacks
> +
>      $conf->data->set(
>          ccflags        => $cc_flags,
>          libs           => $libs,
> 

For diagnostic purposes, this patch was very helpful.  (See full file
attached as linux.pm.)

But I then asked myself, "Self, what would happen if I abandoned my
attempt to keep the test output clean and did not attempt to capture
what was appearing on STDOUT?  In other words, what would happen if I
deactivated all the Parrot::IO::Capture::Mini-related code in the
failing test file?"  (See attached file 107-inter_progs.01.t.)

The result was this:

[li11-226:reconf] 565 $ prove t/configure/107-inter_progs.01.t 
t/configure/107-inter_progs.01....ok 1/24C compiler failed (see
test.cco) at config/init/hints/linux.pm line 85
        init::hints::linux::__ANON__('cc', 'foo_alpha') called at
lib/Parrot/Configure/Data.pm line 120
       
Parrot::Configure::Data::set('Parrot::Configure::Data=HASH(0x828d994)')
called at config/inter/progs.pm line 69
        inter::progs::runstep('inter::progs=HASH(0x8388b84)',
'Parrot::Configure=HASH(0x828d9d0)') called at
t/configure/107-inter_progs.01.t line 74
# Looks like you planned 24 tests but only ran 21.
# Looks like your test died just after 21.
t/configure/107-inter_progs.01....dubious                              
     
        Test returned status 255 (wstat 65280, 0xff00)
DIED. FAILED tests 22-24
        Failed 3/24 tests, 87.50% okay
Failed Test                      Stat Wstat Total Fail  List of Failed
-------------------------------------------------------------------------------
t/configure/107-inter_progs.01.t  255 65280    24    6  22-24
Failed 1/1 test scripts. 3/24 subtests failed.
Files=1, Tests=24,  0 wallclock secs ( 0.05 cusr +  0.00 csys =  0.05 CPU)
Failed 1/1 test programs. 3/24 subtests failed.

So this test -- which would pass on Linux if your diagnostic code were
not included in config/init/hints/linux.pm -- fails even in the absence
of Parrot::IO::Capture::Mini-related code.

Which essentially means that the testing strategy I followed in this
file breaks down when the code in a config/init/hints/*someOS*.pm file
is too complex for my current understanding.

So for the time being, I am commenting out several of the tests in
107-inter_progs.01.t and 107-inter_progs.02.t

kid51

Attachment: 107-inter_progs.01.t
Description: Binary data

# Copyright (C) 2005-2007, The Perl Foundation.
# $Id: linux.pm 20469 2007-08-04 02:44:24Z jkeenan $

package init::hints::linux;

use strict;
use warnings;

use Config;

sub runstep {
    my ( $self, $conf ) = @_;

    my $libs        = $conf->option_or_data('libs');
    my $cc_flags    = $conf->option_or_data('ccflags');
    my $cc          = $conf->option_or_data('cc');
    my $linkflags   = $conf->option_or_data('linkflags');

    # should find g++ in most cases
    my $link = $conf->data->get('link') || 'c++';

    if ( $libs !~ /-lpthread/ ) {
        $libs .= ' -lpthread';
    }
    my $ld_share_flags = $conf->data->get('ld_share_flags');
    my $cc_shared      = $conf->data->get('cc_shared');

    if ( $cc =~ /icc/ ) {
        # Intel C++ compiler has the same name as its C compiler
        $link = $cc;

        # don't allow icc to pretend it's gcc
        $cc_flags .= ' -no-gcc';

        # suppress sprintf warnings that don't apply
        $cc_flags .= ' -wd269';

        $cc_flags .= ' -Wall -Wcheck -w2';

        $ld_share_flags = ' -shared -g -pipe -fexceptions -fPIC';
        $cc_shared .= ' -fPIC';
    }
    elsif ( $cc =~ /suncc/ ) {
        $link = 'sunCC';
        if ( $ld_share_flags !~ /-KPIC/ ) {
            $ld_share_flags = '-KPIC';
        }
        if ( $cc_shared !~ /-KPIC/ ) {
            $cc_shared = '-KPIC';
        }
    }
    else {
        if ( $ld_share_flags !~ /-fPIC/ ) {
            $ld_share_flags .= ' -fPIC';
        }
        if ( $cc_shared !~ /-fPIC/ ) {
            $cc_shared .= ' -fPIC';
        }

        # --export-dynamic, s. info gcc, ld
        $linkflags .= ' -Wl,-E';
    }

    if ( $cc_flags !~ /-D_GNU_SOURCE/ ) {

        # Request visibility of all POSIX symbols
        # _XOPEN_SOURCE=600 doesn't work with glibc 2.1.3
        # _XOPEN_SOURCE=500 gives 2 undefined warns (setenv, unsetenv) on 2.1.3
        $cc_flags .= ' -D_GNU_SOURCE';
    }

    ### XXX This is a dummy callback to test callbacks
    # Run the gcc version test to see if $cc is really gcc.
    my $linux_link_cb = sub {
        use Parrot::Configure::Step qw(cc_gen cc_run);
        use Carp;
        my ( $key, $cc ) = @_;
        my %gnuc;
        my $link = $conf->data->get('link');
        cc_gen("config/auto/gcc/test_c.in");

        # Can't call cc_build since we haven't set all the flags yet.
        # This should suffice for this test.
        my $cc_inc = $conf->data->get('cc_inc');
        Parrot::Configure::Step::_run_command( "$cc -o test test.c $cc_inc", 
'test.cco', 'test.cco' )
            and confess "C compiler failed (see test.cco)";
        %gnuc = eval cc_run() or die "Can't run the test program: $!";
        if ( defined $gnuc{__GNUC__} ) {
            # $link = 'g++';  # don't actually set it in this test function.
       $conf->data->set( link => $link );
        }
        else {
            # Don't know what compiler we have, so don't touch $link.
        }
        $conf->data->deltrigger( "cc", "linux_link" );
    };
    $conf->data->settrigger( "cc", "linux_link", $linux_link_cb );
    ### XXX End of dummy callback to test callbacks

    $conf->data->set(
        ccflags        => $cc_flags,
        libs           => $libs,
        ld_share_flags => $ld_share_flags,
        ld_load_flags  => $ld_share_flags,
        i_lib_pthread  => 1,                 # RT#43149 fake a header entry
        linkflags      => $linkflags,
        link           => $link,
        cc_shared      => $cc_shared,
        rpath          => '-Wl,-rpath=',

        has_dynamic_linking    => 1,
        parrot_is_shared       => 1,
        libparrot_shared       => 'libparrot$(SHARE_EXT).$(SOVERSION)',
        libparrot_shared_alias => 'libparrot$(SHARE_EXT)',
        libparrot_soname       => 
'-Wl,-soname=libparrot$(SHARE_EXT).$(SOVERSION)',
    );

    if ( ( split( '-', $Config{archname} ) )[0] eq 'ia64' ) {
        $conf->data->set( platform_asm => 1 );
    }
    return;
}

1;

# Local Variables:
#   mode: cperl
#   cperl-indent-level: 4
#   fill-column: 100
# End:
# vim: expandtab shiftwidth=4:

Reply via email to