From f63d94f9e7d438c062228cfeb0c7194f61f4a130 Mon Sep 17 00:00:00 2001 From: Eddie Kohler Date: Wed, 27 Nov 2019 22:26:00 -0500 Subject: [PATCH] checksim.pl explicitly builds without and with sanitizers. 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. --- pset6/GNUmakefile | 3 +-- pset6/checksim.pl | 25 +++++++------------------ 2 files changed, 8 insertions(+), 20 deletions(-) diff --git a/pset6/GNUmakefile b/pset6/GNUmakefile index cd03148..e063785 100644 --- a/pset6/GNUmakefile +++ b/pset6/GNUmakefile @@ -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 diff --git a/pset6/checksim.pl b/pset6/checksim.pl index 7aebb91..baacbf1 100755 --- a/pset6/checksim.pl +++ b/pset6/checksim.pl @@ -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 @@ -182,18 +179,6 @@ ($;%) return $answer; } -sub kill_sleeps () { - open(PS, "ps T |"); - while (defined($_ = )) { - $_ =~ 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}); @@ -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 ", @@ -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 ",