blob: c9a6c9da21cd018ab391e8f27560d35e1636bd06 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
|
#!/bin/sh
#
# Copyright 2012 Intel Inc.
#
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
#
# This script builds and runs GM in current workspace with another Skia
# revision user specifies, and then compares their results. This script is
# useful when developers want to know whether their changes would cause any
# regression.
#
# As the name of this script tells, it only works for git repository. :)
#
# Usage:
# Put this script into where your PATH can find it.
# And then invoke:
# $ git skia-verify [sha1-to-compare-default-is-HEAD^]
# It would delete {before,after,diff} directory under the current directory,
# so be warned!
# After it's done, check out diff/index.html for the possible differences.
function say() {
# set color to yellow
tput setaf 3
echo $1
tput sgr0
}
function warn() {
# set color to red
tput setaf 1
echo $1
tput sgr0
}
REVISION="HEAD^"
if [[ $# -eq 1 ]];
then
REVISION="$1"
fi
tput clear
say "Checking sanity..."
git diff --exit-code > /dev/null
if [[ $? -ne 0 ]];
then
warn "You have uncommitted changes!"
exit 1
fi
git diff --cached --exit-code > /dev/null
if [[ $? -ne 0 ]];
then
warn "You have uncommitted changes!"
exit 1
fi
say "Preparing Directories..."
rm -rf {before,after,diff}
mkdir {before,after,diff}
PREVIOUS_BRANCH=`git branch --no-color | grep "^*" | awk '{ print $2}'`
say "Running GM for current revision..."
./gyp_skia
make BUILDTYPE=Release -j10
if [[ $? -ne 0 ]];
then
warn "Failed to compile!"
exit 1
fi
./out/Release/gm -w after
say "Running GM for revision $REVISION..."
# we run the test in a detached branch
git checkout --detach "$REVISION"
./gyp_skia
make BUILDTYPE=Release -j10
if [[ $? -ne 0 ]];
then
warn "Failed to compile!"
say "Back to original revision..."
git checkout "$PREVIOUS_BRANCH"
exit 1
fi
./out/Release/gm -w before
say "Back to original revision..."
git checkout "$PREVIOUS_BRANCH"
say "Comparing..."
./out/Release/skdiff before after diff
|