inst_basic_link.t (1140B)
1 # 2 # Check that the most basic of compile command lines works. 3 # 4 use Modern::Perl; 5 use Test::Cmd; 6 use Test::Differences; 7 use Test::More tests => 3; 8 9 use lib 't'; 10 require utils; 11 12 13 my $wrap = Test::Cmd->new( prog => 'bin/citrun_wrap', workdir => '' ); 14 15 $wrap->write( 'main.c', 'int main(void) { return 0; }' ); 16 $wrap->run( args => utils::os_compiler() . 'main main.c', 17 chdir => $wrap->curdir ); 18 19 my $log_good = <<EOF; 20 >> citrun_inst 21 Compilers path = '' 22 PATH = '' 23 Found source file '' 24 Link detected, adding '' to command line. 25 Command line is '' 26 Added clangtool argument '' 27 Instrumentation of '' finished: 28 1 Lines of source code 29 1 Function definitions 30 1 Return statement values 31 3 Total statements 32 Modified source written successfully. 33 Forked compiler '' 34 Rewritten source compile successful 35 Restored '' 36 EOF 37 38 my $citrun_log; 39 $wrap->read( \$citrun_log, 'citrun.log' ); 40 $citrun_log = utils::clean_citrun_log($citrun_log); 41 42 eq_or_diff( $citrun_log, $log_good, 'is citrun.log file identical', { context => 3 } ); 43 print $wrap->stdout; 44 is( $wrap->stderr, '', 'citrun_wrap stderr empty' ); 45 is( $? >> 8, 0, 'citrun_wrap exit code 0' );