Skip to content

Commit

Permalink
checksim.pl explicitly builds without and with sanitizers.
Browse files Browse the repository at this point in the history
In previous versions of GCC, it seems like TSAN_OPTIONS was enough
to cope with signal handling. Now it is not: we must explicitly
build without sanitizers.
  • Loading branch information
kohler committed Nov 28, 2019
1 parent 9a46e2c commit f63d94f
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 20 deletions.
3 changes: 1 addition & 2 deletions pset6/GNUmakefile
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,7 @@ simpong61: simpong61.o helpers.o
pong61: pong61.o helpers.o
$(call run,$(CXX) $(CXXFLAGS) $(O) -o $@ $^ $(LDFLAGS) $(LIBS),LINK $@)

check: simpong61 always
@if test "$(SAN)" != 1; then (echo; echo '** WARNING: Please run `make SAN=1 check` instead.'; echo) 1>&2; fi
check: always
perl checksim.pl

clean: clean-main
Expand Down
25 changes: 7 additions & 18 deletions pset6/checksim.pl
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,6 @@


my($ntest) = 0;

my($sh) = "./sh61";
-d "out" || mkdir("out") || die "Cannot create 'out' directory\n";
my($ntestfailed) = 0;

# check for a ton of existing simpong61 processes
Expand Down Expand Up @@ -182,18 +179,6 @@ ($;%)
return $answer;
}

sub kill_sleeps () {
open(PS, "ps T |");
while (defined($_ = <PS>)) {
$_ =~ s/^\s+//;
my(@x) = split(/\s+/, $_);
if (@x && $x[0] =~ /\A\d+\z/ && $x[4] eq "sleep") {
kill($SIGINT, $x[0]);
}
}
close(PS);
}

sub disallowed_signal ($) {
my($s) = @_;
my(@sigs) = split(" ", $Config{sig_name});
Expand All @@ -208,8 +193,10 @@ ($)

open(OUT, ">&STDOUT");

$ENV{"TSAN_OPTIONS"} = "report_bugs=0";
print OUT "${Cyan}Deadlock check (should see many ball positions)...${Off}\n";
print OUT "${Cyan}Building without sanitizers...${Off}\n";
system("make", "SAN=0", "simpong61");

print OUT "\n${Cyan}Deadlock check (should see many ball positions)...${Off}\n";
my($info) = run_sh61("./simpong61 -d0.01 -w13 -h8 -b6 -s4 -p0.05", "stdin" => "/dev/null", "stdout" => "pipe", "time_limit" => 0.6, "size_limit" => 10000);
if (!exists($info->{"killed"}) || $info->{"killed"} !~ /^timeout/) {
print OUT "${Red}FAILURE${Redctx} (expected timeout, got ",
Expand Down Expand Up @@ -265,8 +252,10 @@ ($)
print OUT "${Off}\n";
}

print OUT "\n${Cyan}Building with sanitizers...${Off}\n";
system("make SAN=1 simpong61 >/dev/null");
$ENV{"TSAN_OPTIONS"} = "color=always";
print OUT "\n${Cyan}Sanitizer check (should see no sanitizer messages)...${Off}\n";
print OUT "${Cyan}Sanitizer check (should see no sanitizer messages)...${Off}\n";
$info = run_sh61("./simpong61", "stdin" => "/dev/null", "stdout" => "pipe", "time_limit" => 3, "size_limit" => 10000);
if (!exists($info->{"killed"}) || $info->{"killed"} !~ /^timeout/) {
print OUT "${Red}FAILURE${Redctx} (expected timeout, got ",
Expand Down

0 comments on commit f63d94f

Please sign in to comment.