From: Nick Ing-Simmons Date: Sun, 28 Oct 2001 09:36:20 +0000 (+0000) Subject: Adapt testcase from Doug Maceachern for perlio_destruct X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=f1feeb72ef65793d07f6b0333f64df9b07a006b1;p=p5sagit%2Fp5-mst-13.2.git Adapt testcase from Doug Maceachern for perlio_destruct bug as lib/ExtUtils/Embed.t which tests that and some aspects of ExtUtils::Embed. p4raw-id: //depot/perlio@12729 --- diff --git a/MANIFEST b/MANIFEST index 99e6773..66e32b6 100644 --- a/MANIFEST +++ b/MANIFEST @@ -893,6 +893,7 @@ lib/ExtUtils/Command.pm Utilities for Make on non-UNIX platforms lib/ExtUtils/Command.t See if ExtUtils::Command works (Win32 only) lib/ExtUtils/Constant.pm generate XS code to import C header constants lib/ExtUtils/Embed.pm Utilities for embedding Perl in C programs +lib/ExtUtils/Embed.t See if ExtUtils::Embed and embedding works lib/ExtUtils/inst Give information about installed extensions lib/ExtUtils/Install.pm Handles 'make install' on extensions lib/ExtUtils/Installed.pm Information on installed extensions diff --git a/lib/ExtUtils/Embed.t b/lib/ExtUtils/Embed.t new file mode 100644 index 0000000..618fb9c --- /dev/null +++ b/lib/ExtUtils/Embed.t @@ -0,0 +1,73 @@ +#!./perl + +BEGIN { + chdir 't' if -d 't'; + unshift @INC, '../lib'; +} +use Config; +use ExtUtils::Embed; + +open(my $fh,">embed_test.c") || die "Cannot open embed_test.c:$!"; +print $fh ; +close($fh); + +$| = 1; +print "1..9\n"; +my @cmd = ($Config{'cc'},-o => 'embed_test',"-I$INC[0]/..", + ccopts(), + 'embed_test.c',"-L$INC[0]/..",'-lperl',ldopts() + ); +#print "#@cmd\n"; +print "not " if system(join(' ',@cmd)); +print "ok 1\n"; +print "not " if system("embed_test"); +print "ok 9\n"; +unlink("embed_test","embed_test.c"); + +#gcc -g -I.. -L../ -o perl_test perl_test.c -lperl `../perl -I../lib -MExtUtils::Embed -I../ -e ccopts -e ldopts` + +__END__ + +/* perl_test.c */ + +#include +#include + +#define my_puts(a) if(puts(a) < 0) exit(666) + +char *cmds[] = { "perl","-e", "print qq[ok 5\\n]", NULL }; + +int main(int argc, char **argv, char **env) +{ + PerlInterpreter *my_perl = perl_alloc(); + + my_puts("ok 2"); + + perl_construct(my_perl); + + my_puts("ok 3"); + + perl_parse(my_perl, NULL, (sizeof(cmds)/sizeof(char *))-1, cmds, env); + + my_puts("ok 4"); + + fflush(stdout); + + perl_run(my_perl); + + my_puts("ok 6"); + + perl_destruct(my_perl); + + my_puts("ok 7"); + + perl_free(my_perl); + + my_puts("ok 8"); + + return 0; +} + + + +