e2e_fail.t (1105B)
1 # 2 # Check that a program that won't compile natively is handled properly. 3 # 4 use Modern::Perl; 5 use Test::Cmd; 6 use Test::Differences; 7 use Test::More tests => 4; 8 9 use lib 't'; 10 require utils; 11 12 13 my $inst = Test::Cmd->new( prog => 'bin/citrun_wrap', workdir => '' ); 14 15 $inst->write( 'bad.c', <<EOF ); 16 int 17 main(void) 18 { 19 return 0; 20 EOF 21 22 my $out_good = <<EOF; 23 >> citrun_inst 24 Compilers path = '' 25 PATH = '' 26 Found source file '' 27 Command line is '' 28 Added clangtool argument '' 29 Instrumentation of '' finished: 30 5 Lines of source code 31 1 Function definitions 32 1 Return statement values 33 3 Total statements 34 Modified source written successfully. 35 Forked compiler '' 36 Rewritten source compile failed 37 Restored '' 38 EOF 39 40 $inst->run( args => 'cc -c bad.c', chdir => $inst->curdir ); 41 is( $inst->stdout, '', 'citrun_wrap stdout silent' ); 42 print $inst->stderr; 43 isnt( $inst->stderr, '', 'citrun_wrap stderr not silent'); 44 is( $? >> 8, 1, 'citrun_wrap exit code 1' ); 45 46 my $out; 47 $inst->read( \$out, 'citrun.log' ); 48 $out = utils::clean_citrun_log($out); 49 50 eq_or_diff( $out, $out_good, 'citrun.log identical', { context => 3} );