| 1 | #!/bin/bash |
| 2 | # -*- Mode: Shell-script; tab-width: 4; indent-tabs-mode: nil; -*- |
| 3 | |
| 4 | # This Source Code Form is subject to the terms of the Mozilla Public |
| 5 | # License, v. 2.0. If a copy of the MPL was not distributed with this |
| 6 | # file, You can obtain one at http://mozilla.org/MPL/2.0/. |
| 7 | |
| 8 | if [[ ! -e "$1" || ! -e "$2" ]]; then |
| 9 | cat <<EOF |
| 10 | Usage: remove-fixed-failures.sh possible-fixes.log failures.log |
| 11 | |
| 12 | possible-fixes.log contains the possible fixes from the most recent |
| 13 | test run. |
| 14 | |
| 15 | failures.log contains the current known failures. |
| 16 | |
| 17 | remove-fixed-failures.sh removes each pattern in possible-fixes.log |
| 18 | from failures.log. |
| 19 | |
| 20 | The original failures.log is saved as failures.log.orig for safe keeping. |
| 21 | |
| 22 | EOF |
| 23 | exit 1 |
| 24 | fi |
| 25 | |
| 26 | fixes="$1" |
| 27 | failures="$2" |
| 28 | |
| 29 | # save the original failures file in case of an error |
| 30 | cp $failures $failures.orig |
| 31 | |
| 32 | # create a temporary file to contain the current list |
| 33 | # of failures. |
| 34 | workfailures=`mktemp working-failures.XXXXX` |
| 35 | workfixes=`mktemp working-fixes.XXXXX` |
| 36 | |
| 37 | trap "rm -f ${workfailures} ${workfailures}.temp ${workfixes}*;" EXIT |
| 38 | |
| 39 | # create working copy of the failures file |
| 40 | cp $failures $workfailures |
| 41 | cp $fixes $workfixes |
| 42 | |
| 43 | sed -i.bak 's|:[^:]*\.log||' $workfixes; |
| 44 | |
| 45 | grep -Fv -f $workfixes ${workfailures} > ${workfailures}.temp |
| 46 | |
| 47 | mv $workfailures.temp $workfailures |
| 48 | |
| 49 | mv $workfailures $failures |
| 50 |