+if ($options{coverage}) {
+ print("\nGenerating test coverage report...\n");
+ qx(lcov -d ../ -b ../ --capture -o latest/i3-coverage.info);
+ qx(genhtml -o latest/i3-coverage latest/i3-coverage.info);
+ if ($?) {
+ print("Could not generate test coverage html. Did you compile i3 with test coverage support?\n");
+ } else {
+ print("Test coverage report generated in latest/i3-coverage\n");
+ }
+}
+
+# Report logfiles that match “(Leak|Address)Sanitizer:”.
+my @logs_with_leaks;
+for my $log (<$outdir/i3-log-for-*>) {
+ if (slurp($log) =~ /(Leak|Address)Sanitizer:/) {
+ push @logs_with_leaks, $log;
+ }
+}
+if (scalar @logs_with_leaks > 0) {
+ say "\nThe following test logfiles contain AddressSanitizer or LeakSanitizer reports:";
+ for my $log (sort @logs_with_leaks) {
+ say "\t$log";
+ }
+}
+
+exit ($aggregator->failed > 0);