citrun

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

commit 49ab982d0938f1b227ff6620b42cb0fbb7929174
parent 94adff7ef22bbf09cc9bd601ce1b891c89581ab4
Author: Kyle Milz <kyle@windows.krwm.net>
Date:   Sat,  7 Jan 2017 00:58:47 -0800

t: replace wrap_badsrc with inst_nosrc

Diffstat:
At/inst_nosrc.t | 26++++++++++++++++++++++++++
Dt/wrap_badsrc.sh | 22----------------------
2 files changed, 26 insertions(+), 22 deletions(-)

diff --git a/t/inst_nosrc.t b/t/inst_nosrc.t @@ -0,0 +1,26 @@ +# +# Check that giving citrun_inst a non existent file is handled. +# +use strict; +use warnings; +use t::utils; +plan tests => 2; + + +my $inst = Test::Cmd->new( prog => 'citrun_inst', workdir => '' ); +$inst->run( args => '-c doesnt_exist.c', workdir => $inst->curdir ); + +my $out_good = <<EOF; +>> citrun_inst +CITRUN_COMPILERS = '' +Found source file '' +Modified command line is '' +Added clangtool argument '' +Rewriting failed. +EOF + +my $out = clean_citrun_log(scalar $inst->stdout); + +eq_or_diff( $out, $out_good, 'is citrun_inst output identical' ); +print $inst->stderr; +is( $? >> 8, 1, 'is citrun_inst exit code 1' ); diff --git a/t/wrap_badsrc.sh b/t/wrap_badsrc.sh @@ -1,22 +0,0 @@ -#!/bin/sh -u -# -# Test that compiling a non-existent file errors the parser out. -# -. t/utils.subr -plan 4 - - -output_good="citrun_inst: stat: No such file or directory" -ok_program "is instrumented compile failure" 1 "$output_good" cc -o main main.c -ok "is citrun_check successful" citrun_check -o check.out - -cat <<EOF > check.good -Summary: - 1 Source files used as input - -Totals: - 0 Lines of source code -EOF - -strip_millis check.out -ok "is citrun_check output identical" diff -u check.good check.out