commit a663b02cfd292564c901a3560871fdcf9d6ff62c
parent 5685fe1ace20bf5dc917fbd7aeff01041fdbd94c
Author: Kyle Milz <kyle@0x30.net>
Date: Wed, 15 Jun 2016 22:34:40 -0600
src: leave behind linker patch file when CITRUN_TESTING
Diffstat:
2 files changed, 5 insertions(+), 4 deletions(-)
diff --git a/Test/Project.pm b/Test/Project.pm
@@ -22,8 +22,8 @@ sub add_src {
my ($self, $source) = @_;
my $num_src_files = scalar(@{ $self->{src_files} });
- # Tests that use this function want to check the instrumented source
- $ENV{CITRUN_LEAVE_MODIFIED_SRC} = 1;
+ # Runtime behavior switch. Usually leaves behind changed files.
+ $ENV{CITRUN_TESTING} = 1;
# Create temporary file name
my $src_name = "source_$num_src_files.c";
diff --git a/src/inst_main.cc b/src/inst_main.cc
@@ -241,7 +241,7 @@ main(int argc, char *argv[])
// Keep track of original source file names
source_files.push_back(arg);
- if (getenv("CITRUN_LEAVE_MODIFIED_SRC"))
+ if (getenv("CITRUN_TESTING"))
// Don't copy and restore original source files
continue;
@@ -298,6 +298,7 @@ main(int argc, char *argv[])
restore_original_src(temp_file_map);
- if (linking)
+ // Leave this behind if we're in testing mode.
+ if (linking && (getenv("CITRUN_TESTING") == NULL))
unlink("citrun_patch.c");
}