Nicholas Clark:
# On Sat, Mar 30, 2002 at 02:12:46AM -0800, Brent Dax wrote:
#
# > If you have a Unix box and ten spare minutes, please apply this to a
# > fresh checkout of Parrot, run 'make test', and tell me how well it
# > works.
#
# FreeBSD did not enjoy it:
#
# 0 Patch did not apply cleanly:
#
# Patching file Makefile.in using Plan A...
# Hunk #1 succeeded at 112.
# Hunk #2 failed at 143.

Weird.  Line endings, perhaps.

# I thought I managed to apply that bit by hand
#
# 1: use warnings; is not 5.005_03 safe:
#
# $ make test
# /usr/bin/perl vtable_h.pl
# /usr/bin/perl make_vtable_ops.pl > vtable.ops
# /usr/bin/perl pccw.pl --args="C" core_ops.c core.ops io.ops
# rx.ops vtable.ops
# Can't locate warnings.pm in @INC (@INC contains:
# /usr/libdata/perl/5.00503/mach /usr/libdata/perl/5.00503
# /usr/local/lib/perl5/site_perl/5.005/i386-freebsd
# /usr/local/lib/perl5/site_perl/5.005 .) at pccw.pl line 8.
# BEGIN failed--compilation aborted at pccw.pl line 8.
# *** Error code 2

D'oh!  Fortunately, that is the only 5.6-ism (AFAIK).

# So I stopped using 5.005_03 and switched to 5.7.3. After a
# reconfigure:
#
# $ make test
# /usr/local/bin/perl5.7.3 vtable_h.pl
# /usr/local/bin/perl5.7.3 pccw.pl --args="C" core_ops.c
# core.ops io.ops rx.ops vtable.ops
# Use of uninitialized value in hash element at pccw.pl line 35.
# cc -o --args=C -Wl,-E  -L/usr/local/lib  core_ops.c core.ops
# io.ops rx.ops vtable.ops
# cc: core_ops.c: No such file or directory
# /usr/local/bin/perl5.7.3 pccw.pl --args="CPrederef"
# core_ops_prederef.c core.ops io.ops rx.ops vtable.ops
# Use of uninitialized value in hash element at pccw.pl line 35.
# cc: core_ops_prederef.c: No such file or directory
#
# cc -DHAS_FPSETMASK -DHAS_FLOATINGPOINT_H -fno-strict-aliasing
# -I/usr/local/include  -Wall -Wstrict-prototypes
# -Wmissing-prototypes -Winline -Wshadow -Wpointer-arith
# -Wcast-qual -Wcast-align -Wwrite-strings -Wconversion
# -Waggregate-return -Winline -W -Wno-unused -Wsign-compare
# -I./include  -o interpreter.o -c interpreter.c
# interpreter.c:15: parrot/oplib/core_ops.h: No such file or directory
#
# <more errors about core_ops.c being missing, but the build
# doesn't fail. Why?)

A misunderstading about system()--apparently it doesn't set $?.

# cc -DHAS_FPSETMASK -DHAS_FLOATINGPOINT_H -fno-strict-aliasing
# -I/usr/local/include  -Wall -Wstrict-prototypes
# -Wmissing-prototypes -Winline -Wshadow -Wpointer-arith
# -Wcast-qual -Wcast-align -Wwrite-strings -Wconversion
# -Waggregate-return -Winline -W -Wno-unused -Wsign-compare
# -I./include  -o jit.o -c jit.c
# In file included from jit.c:8:
# include/parrot/jit.h:30: syntax error before `build_asm'
# include/parrot/jit.h:30: warning: type defaults to `int' in
# declaration of `build_asm'
# include/parrot/jit.h:30: warning: data definition has no type
# or storage class
# jit.c:31: syntax error before `build_asm'
# jit.c:33: warning: return-type defaults to `int'
# jit.c: In function `build_asm':
# jit.c:230: warning: cast discards qualifiers from pointer target type
# jit.c:233: warning: cast discards qualifiers from pointer target type
# jit.c:510: `jit_f' undeclared (first use in this function)
# jit.c:510: (Each undeclared identifier is reported only once
# jit.c:510: for each function it appears in.)
# jit.c:510: syntax error before `arena_start'
# jit.c:511: warning: control reaches end of non-void function
#
# cc -o parrot -Wl,-E  -L/usr/local/lib  exceptions.o
# global_setup.o interpreter.o parrot.o register.o core_ops.o
# core_ops_prederef.o memory.o packfile.o stacks.o string.o
# encoding.o chartype.o runops_cores.o trace.o pmc.o key.o
# platform.o jit.o resources.o rx.o rxstacks.o embed.o
# warnings.o misc.o io/io.o io/io_stdio.o io/io_unix.o
# io/io_win32.o classes/default.o classes/array.o
# classes/perlint.o classes/perlstring.o classes/perlnum.o
# classes/perlarray.o classes/perlundef.o classes/perlhash.o
# classes/parrotpointer.o classes/intqueue.o
# encodings/singlebyte.o encodings/utf8.o encodings/utf16.o
# encodings/utf32.o chartypes/unicode.o chartypes/usascii.o
# test_main.o -lm -lc -lcrypt -lutil
# cc: interpreter.o: No such file or directory
# cc: core_ops.o: No such file or directory
# cc: core_ops_prederef.o: No such file or directory
# cc: jit.o: No such file or directory
# /usr/local/bin/perl5.7.3 t/harness
#
# the tests start bad:
#
# t/op/basic..........NOK 2#     Failed test (t/op/basic.t at
# line 11)
# #          got: ''
# #     expected: '1'
# t/op/basic..........NOK 3#     Failed test (t/op/basic.t at
# line 16)
# #          got: ''
# #     expected: 'Parrot flies'
# t/op/basic..........NOK 4#     Failed test (t/op/basic.t at
# line 21)
# #          got: ''
# #     expected: 'Parrot flies'
# t/op/basic..........NOK 5#     Failed test (t/op/basic.t at
# line 26)
# #          got: ''
# #     expected: 'Parrot flies'
# t/op/basic..........NOK 6#     Failed test (t/op/basic.t at
# line 31)
# #          got: ''
# #     expected: '42'
# t/op/basic..........NOK 7#     Failed test (t/op/basic.t at
# line 40)
# #          got: ''
# #     expected: '42
# # 1234
# # '
# t/op/basic..........NOK 8#     Failed test (t/op/basic.t at
# line 72)
# #          got: ''
# #     expected: 'start
# # lab 1
# # done
# # '
# # Looks like you failed 7 tests of 8.
# t/op/basic..........dubious
#
#         Test returned status 7 (wstat 1792, 0x700)
# DIED. FAILED tests 2-8
#         Failed 7/8 tests, 12.50% okay
#
#
# Not sure what wstat 0x700 is.
#
# $ kill -l
#  1) SIGHUP       2) SIGINT       3) SIGQUIT      4) SIGILL
#  5) SIGTRAP      6) SIGABRT      7) SIGEMT       8) SIGFPE
#  9) SIGKILL     10) SIGBUS      11) SIGSEGV     12) SIGSYS
# 13) SIGPIPE     14) SIGALRM     15) SIGTERM     16) SIGURG
# 17) SIGSTOP     18) SIGTSTP     19) SIGCONT     20) SIGCHLD
# 21) SIGTTIN     22) SIGTTOU     23) SIGIO       24) SIGXCPU
# 25) SIGXFSZ     26) SIGVTALRM   27) SIGPROF     28) SIGWINCH
# 29) SIGINFO     30) SIGUSR1     31) SIGUSR2
#
# so is that an exit on signal 7?

No, that means that seven tests failed.

# The summary is:
#
# Failed Test        Stat Wstat Total Fail  Failed  List of Failed
# --------------------------------------------------------------
# -----------------
# t/op/basic.t          7  1792     8    7  87.50%  2-8
# t/op/bitwise.t       15  3840    15   15 100.00%  1-15
# t/op/debuginfo.t      4  1024     4    4 100.00%  1-4
# t/op/hacks.t          1   256     1    1 100.00%  1
# t/op/ifunless.t       6  1536     6    6 100.00%  1-6
# t/op/integer.t       32  8192    32   32 100.00%  1-32
# t/op/interp.t         1   256     1    1 100.00%  1
# t/op/macro.t          8  2048     9    8  88.89%  1-4 6-9
# t/op/number.t        31  7936    31   31 100.00%  1-31
# t/op/rx.t            25  6400    27   25  92.59%  1-16 18-26
# t/op/stacks.t        17  4352    18   17  94.44%  1-17
# t/op/string.t        64 16384    64   64 100.00%  1-64
# t/op/time.t           4  1024     4    4 100.00%  1-4
# t/op/trans.t         18  4608    18   18 100.00%  1-18
# t/pmc/perlstring.t    7  1792     8    7  87.50%  1-4 6-8
# t/pmc/pmc.t          55 14080    56   55  98.21%  1-32 34-56
# 20 subtests skipped.
# Failed 16/19 test scripts, 15.79% okay. 295/316 subtests
# failed, 6.65% okay.
#
#
# So some tests passed :-)
# But most seemed to fail by crashing.

Argh.  I've attached a new version of pccw.pl; let me know if it works
better.

--Brent Dax <[EMAIL PROTECTED]>
@roles=map {"Parrot $_"} qw(embedding regexen Configure)

#define private public
    --Spotted in a C++ program just before a #include
#!perl -w

#Parrot C Compiler Wrapper
#Initial version by Brent Dax ([EMAIL PROTECTED])

#Usage:
#    perl pccw.pl --args="(args)" (destfile) (sourcefiles)

use strict;

use lib 'lib';
use Parrot::Config;

my($args, $destfile, @sourcefiles);

if($ARGV[0] =~ /--args="(.*)"/) {
        $args=$1;
        shift;
}
else {
        $args="";
}

($destfile, @sourcefiles)=@ARGV;

my %destmap=(
        $PConfig{o}             => sub { System("$PConfig{cc} $PConfig{ccflags} 
$PConfig{cc_warn} $PConfig{cc_inc} $args $PConfig{cc_o_out}$destfile -c @sourcefiles") 
},
        $PConfig{exe}||''       => sub { System("$PConfig{ld} 
$PConfig{ld_out}$destfile $PConfig{ldflags} $args @sourcefiles") },
        $PConfig{a}||'.a'       => \&handle_library,
        $PConfig{so}||'.so'     => \&handle_shared_lib, 
        '.c'                    => \&handle_generated_files
);

eval {
        my($extension)=$destfile =~ /(\.\w+)$/;
        $extension ||= '';
        $destmap{$extension}->();
};

if($@) {
        if($@ =~ /Undefined subroutine/) {
                print "Don't know how to convert '$sourcefiles[0]' to '$destfile'!\n";
        }
        else {
                die $@, "\n";
        }

        exit(-1);
}

exit($?);

sub handle_generated_files {
        if($sourcefiles[0] =~ /ops$/) {
                system("$^X ops2c.pl $args @sourcefiles");
        }
        elsif($sourcefiles[0] =~ /pmc$/) {
                system("$^X classes/pmc2c.pl $args @sourcefiles");
        }
        else {
                print "Don't know how to convert '$sourcefiles[0]' to '$destfile'!\n";
        }
}
        
sub handle_shared_lib {
        print "NYI";
}

sub handle_library {
        print "NYI";
}

sub System {
        print "$_[0]\n";
        $?=system(@_);
}

Reply via email to