citrun

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

commit 22424fe67be603fbe1ef81378e02b9cf026aa4fa
parent 042e7681721e8742c7688f56d2652a6047e4aa8f
Author: Kyle Milz <kyle@0x30.net>
Date:   Fri, 13 Jan 2017 02:57:08 -0700

t: improve inst_path by adding log checks and fixing regex check

Diffstat:
Minst_fe.cc | 4++--
Mt/inst_path.t | 26+++++++++++++++++++-------
2 files changed, 21 insertions(+), 9 deletions(-)

diff --git a/inst_fe.cc b/inst_fe.cc @@ -105,8 +105,8 @@ InstFrontend::clean_PATH() } if (!found_citrun_path) { - std::cerr << "Error: " << m_compilers_path << " not in PATH." << std::endl; - m_log << "Error: " << m_compilers_path << " not in PATH." << std::endl; + std::cerr << "Error: '" << m_compilers_path << "' not in PATH." << std::endl; + m_log << "Error: '" << m_compilers_path << "' not in PATH." << std::endl; exit(1); } diff --git a/t/inst_path.t b/t/inst_path.t @@ -5,16 +5,28 @@ # use strict; use warnings; -use Test::Cmd; -use Test::More tests => 3; + +use t::utils; +plan tests => 4; my $cc = Test::Cmd->new( prog => 'compilers/cc', workdir => '' ); -my $error_good = "Error: compilers not in PATH. -"; +my $error_good = "Error: '.*compilers' not in PATH."; $cc->run( args => '', chdir => $cc->curdir ); -is( $cc->stdout, '', 'is cc stdout empty' ); -is( $cc->stderr, $error_good, 'is cc stderr identical' ); -is( $? >> 8, 1, 'is cc exit code 1' ); +is( $cc->stdout, '', 'is cc stdout empty' ); +like( $cc->stderr, qr/$error_good/, 'is cc stderr identical' ); +is( $? >> 8, 1, 'is cc exit code 1' ); + +my $log_out; +$cc->read( \$log_out, 'citrun.log' ); + +my $log_good = <<EOF; +>> citrun_inst +Compilers path = '' +PATH = '' +Error: '' not in PATH. +EOF + +eq_or_diff( clean_citrun_log( $log_out ), $log_good, 'is citrun.log identical' );