layout/reftests/w3c-css/submitted/check-for-references.sh
author Ting-Yu Lin <tlin@mozilla.com>
Wed, 18 Jan 2017 11:20:56 +0800
changeset 377508 fe22af79bacf6db526737536eab551caf68ba440
parent 290183 b403e967667042af813576f3b1a7b9580e7b2031
child 394617 d50d68150aba3350501d2cc4df8233fa021a08e5
permissions -rwxr-xr-x
Bug 1331846 - Exclude the lines which have "include" appeared in the middle. r=dbaron Change "include" match rule from "^include" to "include " since there might be "skip-if" or other <failure-type> conditions before the "include". The single space after is added so that tests like "include.html" won't be excluded. DONTBUILD because this patch modifies a script checking for the validity of reftests, which is NPOTB. MozReview-Commit-ID: 3tFFIo8RKFp

#!/bin/bash

cd "$(dirname "$0")"
find . -name reftest.list | sed 's,/reftest.list$,,' | while read DIRNAME
do
    cat "$DIRNAME/reftest.list" | grep -v -e "^default-preferences" -e "include " | sed 's/ #.*//;s/^#.*//;s/.* == /== /;s/.* != /!= /' | grep -v "^ *$" | while read TYPE TEST REF
    do
        REFTYPE=""
        if [ "$TYPE" == "==" ]
        then
            REFTYPE="match"
        elif [ "$TYPE" == "!=" ]
        then
            REFTYPE="mismatch"
        else
            echo "Unexpected type $TYPE for $DIRNAME/$TEST"
        fi
        if grep "rel=\"$REFTYPE\"" "$DIRNAME/$TEST" | head -1 | grep -q "href=\"$REF\""
        then
            #echo "Good link for $DIRNAME/$TEST"
            echo -n
        else
            echo "Missing link for $DIRNAME/$TEST"
            #echo "<link rel=\"$REFTYPE\" href=\"$REF\">" >> "$DIRNAME/$TEST"
        fi
    done
done