lib_transunit.t (1148B)
1 # 2 # Test that the shared memory translation units are what we expect. 3 # 4 use Modern::Perl; 5 use Test::More tests => 14; 6 7 use lib 't'; 8 require mem; 9 require utils; 10 11 12 my $dir = utils::setup_projdir(); 13 14 $dir->run( prog => $dir->workdir . '/program', args => '1', 15 chdir => $dir->curdir ); 16 is( $dir->stdout, '1', 'inst program stdout correct' ); 17 isnt( $dir->stderr, '', 'inst program stderr not silent' ); 18 is( $? >> 8, 0, 'inst program exit code 0' ); 19 20 my $shm = mem->new(); 21 22 my %tus = %{ $shm->{trans_units} }; 23 my ($tu1, $tu2, $tu3) = sort keys %tus; 24 25 like( $tu1, qr/.*fib.c/, 'end of absolute file path fib.c' ); 26 is( $tus{$tu1}->{size}, 11, "fib.c the correct length" ); 27 is( $tus{$tu1}->{comp_file_name}, 'fib.c', 'compiler file name right' ); 28 29 like( $tu2, qr/.*main.c/, 'end of absolute file path main.c' ); 30 is( $tus{$tu2}->{size}, 22, "main.c the correct length" ); 31 is( $tus{$tu2}->{comp_file_name}, 'main.c', 'compiler file name main.c' ); 32 33 like( $tu3, qr/.*print.c/, 'end of absolute file path print.c' ); 34 is( $tus{$tu3}->{size}, 9, "print.c the correct length" ); 35 is( $tus{$tu3}->{comp_file_name}, 'print.c', 'compiler file name print.c' );