citrun

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

commit 010584ff278d4f1381f76c7dd8cb09a0b9a0a401
parent 1cf0dfa942ed8eca9d3f620e8dc267bce8ff70e2
Author: Kyle Milz <kyle@windows.krwm.net>
Date:   Wed,  4 Jan 2017 17:46:22 -0800

t: add new test for  nmake on windows

Diffstat:
At/wrap_nmake.t | 72++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 72 insertions(+), 0 deletions(-)

diff --git a/t/wrap_nmake.t b/t/wrap_nmake.t @@ -0,0 +1,72 @@ +use strict; +use warnings; +use t::utils; + +if ($^O eq "MSWin32") { + plan tests => 4; +} else { + plan skip_all => 'win32 only'; +} + +my $wrap = Test::Cmd->new( prog => 'citrun_wrap', workdir => '' ); + +$wrap->write( 'main.c', 'int main(void) { return 0; }' ); +$wrap->write( 'Makefile', <<EOF ); +CFLAGS = /nologo + +main.exe: main.obj +EOF + +$wrap->run( args => 'nmake /nologo', chdir => $wrap->curdir ); + +print $wrap->stdout; +is( $wrap->stderr, '', 'is citrun_wrap nmake stderr silent' ); +is( $? >> 8, 0, 'is citrun_wrap nmake exit code 0' ); + +my $log_good = <<EOF ; +>> citrun_inst +CITRUN_COMPILERS = '' +PATH='' +Found source file '' +Modified command line is '' +Added clangtool argument '' +Instrumentation of '' finished: + 1 Lines of source code + 1 Function definitions + 1 Return statement values + 3 Total statements +Modified source written successfully. +Rewriting successful. +Forked compiler '' +Rewritten source compile successful +Restored '' +>> citrun_inst +CITRUN_COMPILERS = '' +PATH='' +Found source file '' +Link detected, adding '' to command line. +Modified command line is '' +Added clangtool argument '' +Instrumentation of '' finished: + 1 Lines of source code + 1 Function definitions + 1 Return statement values + 3 Total statements +Modified source written successfully. +Rewriting successful. +Forked compiler '' +Rewritten source compile successful +Restored '' +EOF + +my $citrun_log; +$wrap->read( \$citrun_log, 'citrun.log' ); +$citrun_log = clean_citrun_log( $citrun_log ); + +eq_or_diff( $citrun_log, $log_good, 'is nmake citrun.log identical', + { context => 3 } ); + +$wrap->run( prog => $wrap->workdir . "/main", chdir => $wrap->curdir ); +print $wrap->stdout; +print $wrap->stderr; +is( $? >> 8, 1, 'is main exit code 1' );