#!/bin/sh # Copyright (c) 2012 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. # Scape errors from the valgrind bots, reproduce them locally, # save logs as regrind-TESTNAME.log, and display any errors found. # Also save files regrind-failed.txt listing failed tests, # and regrind-failed-map.txt showing which bot URLs have which failed tests # (handy when filing bugs). # # Only scrapes linux layout bot at the moment. # TODO: handle layout tests that don't have obvious path to test file # TODO: extend script to handle more kinds of errors and more tests # where the valgrind layout bot results live LAYOUT_URL="http://build.chromium.org/p/chromium.memory.fyi/builders/Webkit%20Linux%20(valgrind%20layout)" # how many builds back to check LAYOUT_COUNT=250 # regexp to match valgrind errors PATTERN="are definitely|uninitialised|Unhandled exception|\ Invalid read|Invalid write|Invalid free|Source and desti|Mismatched free|\ unaddressable byte|vex x86|the 'impossible' happened|\ valgrind:.*: Assertion.*failed|VALGRIND INTERNAL ERROR" usage() { echo "Usage: regrind.sh [--noscrape][--norepro][--keep]" echo "--noscrape: don't scrape bots, just use old regrind-failed.txt" echo "--norepro: don't reproduce locally" echo "--keep: keep temp files" exit 1 } # Given a log on stdin, list all the tests that failed in that log. layout_list_failed_tests() { grep "Command:.*LayoutTests" | sed 's/<.*>//' | sed 's/.*LayoutTests/LayoutTests/' | sort -u | tr -d '\015' } # Generate a list of failed tests in regrind-failed.txt by scraping bot. # Scrape most recent first, so if user interrupts, he is left with fresh-ish data. scrape_layout() { rm -f regrind-*.tmp* regrind-failed.txt regrind-failed-map.txt touch regrind-failed.txt # First, grab the number of the latest complete build. wget -q -O regrind-builds.html "$LAYOUT_URL" latest=`grep "