citrun

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

commit f41a46a89f7e4fce3e66d28eb08629f103e138dc
parent 8b188f42af9db0584e69c62c7ac114b929e006c9
Author: Kyle Milz <kyle@getaddrinfo.net>
Date:   Wed, 13 Apr 2016 19:56:48 -0600

e2e: update vim

Diffstat:
Me2e/vim.t | 40+++++++++++++++++++++-------------------
1 file changed, 21 insertions(+), 19 deletions(-)

diff --git a/e2e/vim.t b/e2e/vim.t @@ -1,5 +1,6 @@ use strict; -use SCV::Project; +use Expect; +use File::Temp qw( tempdir ); use SCV::Viewer; use Test::More tests => 7; use Time::HiRes qw( time ); @@ -8,24 +9,26 @@ use Time::HiRes qw( time ); # This uses tools installed from a package, not the in tree build! # -my $viewer = SCV::Viewer->new(); -my $project = SCV::Project->new(); - -my $tmpdir = $project->get_tmpdir(); +# XXX: check package is installed +my $tmpdir = tempdir( CLEANUP => 1 ); my $vim_src = "ftp://ftp.vim.org/pub/vim/unix/vim-7.4.tar.bz2"; -is( system("cd $tmpdir && curl -O $vim_src"), 0, "download" ); -is( system("cd $tmpdir && tar xjf vim-7.4.tar.bz2"), 0, "extract" ); +system("cd $tmpdir && curl -O $vim_src") == 0 or die "download failed"; +system("cd $tmpdir && tar xjf vim-7.4.tar.bz2") == 0 or die "extract failed"; + +my $srcdir = "$tmpdir/vim74/src"; +system("citrun_wrap make -C $srcdir config") == 0 or die "citrun_wrap make config failed"; -is( system("make -C $tmpdir/vim74/src scratch"), 0, "make scratch" ); -# LDADD variable does not get picked up by auto conf, use LIBS instread -is( system("citrun_wrap make -C $tmpdir/vim74/src config LDFLAGS=-L/usr/local/lib LIBS=-lcitrun"), 0, "make config" ); -is( system("rm $tmpdir/vim74/src/SRC_NUMBER"), 0, "rm SRC_NUMBER" ); -is( system("citrun_wrap make -C $tmpdir/vim74/src myself"), 0, "make myself" ); +# Remove last instrumented node from configure run +system("rm $srcdir/LAST_NODE"); +# Make vim and xxd +system("citrun_wrap make -C $srcdir myself") == 0 or die "citrun_wrap make failed"; + +# Create a new fake viewer to attach the instrumented program to +my $viewer = SCV::Viewer->new(); -# Launch the newly compiled programs and make sure the runtime is communicating -$project->{prog_name} = "vim74/src/vim"; -$project->run(); +$ENV{CITRUN_SOCKET} = "SCV::Viewer.socket"; +my $exp = Expect->spawn("$srcdir/vim"); $viewer->accept(); @@ -47,9 +50,8 @@ for (1..60) { } print STDERR ">>> END\n"; -$project->kill(); -$project->wait(); +$exp->hard_close(); -#$ENV{CITRUN_SOCKET} = "$cwd/SCV::Viewer.socket"; # Check that the native test suite can pass with instrumented binaries -#is( system("make -C $tmpdir/vim74/src test"), 0, "make test" ); +$exp = Expect->spawn("make", "-C", "$srcdir/testdir"); +$exp->expect(undef, ("ALL DONE"));