2 # Copyright (C) 2007-2009, Parrot Foundation.
10 use File
::Spec
::Functions
;
12 use Test
::More tests
=> 7;
16 tools/install/smoke.pl - checks parrot in install directory
20 parrot in install tree
22 % cd /usr/local/parrot-$version
27 % perl tools/install/smoke.pl --bindir=.
29 test installation in DESTDIR:
33 % make install DESTDIR=.inst
34 % perl tools/install/smoke.pl DESTDIR=.inst
38 Checks that most of things run (or just start) into the install directory,
39 try to detect missing parts.
45 =item --bindir=/usr/bin
47 Override default value : 'bin'
53 my ($bindir, $DESTDIR);
54 my $opts = GetOptions
(
55 'bindir=s' => \
$bindir,
56 'DESTDIR=s' => \
$DESTDIR,
59 $bindir = 'bin' unless $bindir;
61 chdir $DESTDIR if ($DESTDIR);
65 $exe .= '.exe' if ($^O
eq 'MSWin32');
66 $exe = '"' . $exe . '"' if ($exe =~ / /);
74 my $parrot = quote
(catfile
($bindir, 'parrot'));
75 my $pirc = quote
(catfile
($bindir, 'pirc'));
76 my $nqp = quote
(catfile
($bindir, 'parrot-nqp'));
82 $exe = quote
(catfile
($bindir, 'pbc_merge'));
84 ok
($out =~ /^pbc_merge/, "check pbc_merge");
86 $exe = quote
(catfile
($bindir, 'pbc_dump'));
88 ok
($out =~ /^pbc_dump/, "check pbc_dump");
90 ok
(system("$parrot -V") == 0, "display parrot version");
93 $out =~ m/version (\S+) built/;
96 my $libdir = ($bindir eq 'bin')
97 ?
($^O
eq 'MSWin32') ?
'lib/parrot/library' : "lib/parrot/$version/library"
98 : 'runtime/parrot/library';
100 my $compdir = ($bindir eq 'bin')
101 ?
($^O
eq 'MSWin32') ?
'lib/parrot/languages' : "lib/parrot/$version/languages"
105 # some compiler tools
108 $filename = 'test.pg';
109 open $FH, '>', $filename
110 or die "Can't open $filename ($!).\n";
117 $out = `$parrot $libdir/PGE/Perl6Grammar.pbc $filename`;
118 ok
($out =~ /## <WSpace::TOP>/, "check PGE");
123 skip
("pirc", 1) unless (-e
$pirc);
124 $filename = 'test.pir';
125 open $FH, '>', $filename
126 or die "Can't open $filename ($!).\n";
133 $out = `$pirc -n $filename`;
134 ok
($out eq "ok\n", "check pirc");
138 $filename = 'test.nqp';
139 open $FH, '>', $filename
140 or die "Can't open $filename ($!).\n";
141 print $FH "say('hello world!');\n";
143 $out = `$nqp $filename`;
144 ok
($out eq "hello world!\n", "check nqp-rx");
147 # compilers/tge is typically not installed
148 $filename = 'test.tg';
149 open $FH, '>', $filename
150 or die "Can't open $filename ($!).\n";
151 print $FH "transform past (ROOT) { }\n";
153 $out = `$parrot $compdir/tge/tgc.pir $filename`;
154 ok
($out =~ /^\n\.sub '_ROOT_past'/, "check TGE");
159 # cperl-indent-level: 4
162 # vim: expandtab shiftwidth=4: