citrun

watch C/C++ source code execute
Log | Files | Refs | LICENSE

wrap_nmake.t (1788B)


      1 use Modern::Perl;
      2 use Test::Cmd;
      3 use Test::More;
      4 
      5 plan skip_all => 'win32 only' if ($^O ne "MSWin32");
      6 plan tests => 6;
      7 
      8 use lib 't';
      9 require utils;
     10 
     11 
     12 my $wrap = Test::Cmd->new( prog => 'bin/citrun_wrap', workdir => '' );
     13 
     14 $wrap->write( 'main.c', 'int main(void) { return 0; }' );
     15 $wrap->write( 'Makefile', <<EOF );
     16 CFLAGS = /nologo
     17 
     18 main.exe: main.obj
     19 EOF
     20 
     21 $wrap->run( args => 'nmake /nologo', chdir => $wrap->curdir );
     22 print $wrap->stdout;
     23 is( $wrap->stderr, '',	'is citrun_wrap nmake stderr silent' );
     24 is( $? >> 8,	0,	'is citrun_wrap nmake exit code 0' );
     25 
     26 my $log_good = <<EOF ;
     27 >> citrun_inst
     28 Compilers path = ''
     29 PATH = ''
     30 Found source file ''
     31 Command line is ''
     32 Added clangtool argument ''
     33 Instrumentation of '' finished:
     34     1 Lines of source code
     35     1 Function definitions
     36     1 Return statement values
     37     3 Total statements
     38 Modified source written successfully.
     39 Forked compiler ''
     40 Rewritten source compile successful
     41 Restored ''
     42 >> citrun_inst
     43 Compilers path = ''
     44 PATH = ''
     45 Found source file ''
     46 Link detected, adding '' to command line.
     47 Command line is ''
     48 Added clangtool argument ''
     49 Instrumentation of '' finished:
     50     1 Lines of source code
     51     1 Function definitions
     52     1 Return statement values
     53     3 Total statements
     54 Modified source written successfully.
     55 Forked compiler ''
     56 Rewritten source compile successful
     57 Restored ''
     58 EOF
     59 
     60 my $citrun_log;
     61 $wrap->read( \$citrun_log, 'citrun.log' );
     62 $citrun_log = clean_citrun_log( $citrun_log );
     63 
     64 eq_or_diff( $citrun_log,	$log_good,	'is nmake citrun.log identical',
     65 	{ context => 3 } );
     66 
     67 $wrap->run( prog => $wrap->workdir . "/main", chdir => $wrap->curdir );
     68 is( $wrap->stdout,	'',	'is instrumented program stdout silent' );
     69 is( $wrap->stderr,	'',	'is instrumented program stderr silent' );
     70 is( $? >> 8,		0,	'is main exit code 1' );