OLD | NEW |
---|---|
(Empty) | |
1 #!/bin/bash | |
2 | |
pdr.
2015/09/02 05:25:48
This is a little rough to check in. WDYT about jus
| |
3 if [ "$#" != "1" ]; then | |
4 echo "Convert a text-based-repaint test into a spv2 paint invalidation test. " | |
5 echo "Usage: convert.sh <relative-path-of-repaint-test-under-LayoutTests" | |
6 echo "Need to manually edit the generated -expected.html." | |
7 exit 1 | |
8 fi | |
9 | |
10 cd `dirname $0`/../../../.. | |
11 | |
12 newfile=`echo $1 | sed 's#.*/#paint/invalidation/spv2/#'` | |
13 echo New file: $newfile | |
14 | |
15 expectedtxt=`echo $1 | sed 's/\.html/-expected.txt/'` | |
16 expectedtxt=`ls $expectedtxt* platform/{win,linux,mac}/$expectedtxt 2>/dev/null | head -1` | |
17 if [ ! -f "$expectedtxt" ]; then | |
18 echo "No -expected.txt for the test" | |
19 exit 1 | |
20 fi | |
21 | |
22 indent=`grep 'repaintTest()' $1|sed 's/\(^ *\).*$/\1/'` | |
23 expectedobj=/tmp/expected-paint-invalidation-objects | |
24 grep '^ *"[^"]*",\?$' $expectedtxt | sed "s/^ */$indent /;s/\$/,/;s/,,\$/,/" >$expectedobj | |
25 testdir=`dirname $1` | |
26 | |
27 sed "s#\\([(='\"]\\)\\([-_\\.a-zA-Z0-9/]*resources/\)#\\1../../../$testdir/\\2# | |
28 / repaintTest()/ { | |
29 i\\${indent}window.expectedPaintInvalidationObjects = [ | |
30 h | |
31 r $expectedobj | |
32 g | |
33 N | |
34 i\\${indent}]; | |
35 } | |
36 s/ repaintTest()/ paintInvalidationTest()/ | |
37 s/runRepaintTest/runPaintInvalidationTest/ | |
38 s/finishRepaintTest/finishPaintInvalidationTest/ | |
39 s/src=.*\/text-based-repaint.js/src=\"resources\/paint-invalidation-test.js / | |
40 1i\<\!-- Based on $1 --\> | |
41 " $1 > $newfile | |
42 | |
43 expected=`echo $newfile | sed 's/\.html/-expected.html/'` | |
44 echo Expected: $expected | |
45 sed "s#\\([(='\"]\\)\\([-_\\.a-zA-Z0-9/]*resources/\)#\\1../../../$testdir/\\2# | |
46 s/ onload=.runRepaintTest();\\?.// | |
47 /text-based-repaint.js/d | |
48 " $1 > $expected | |
49 | |
OLD | NEW |