cmd/webp-manual-test: blacklist some versions of the dwebp binary.

In particular, the 0.4.0 version of /usr/bin/dwebp that comes with
Ubuntu 14.04 LTS "Trusty", is known to be bad.

As per https://chromium.googlesource.com/webm/libwebp/+/master/NEWS
(grep for 239), versions 0.4.1 and 0.4.2 are also bad.

The alpha_color_cache.webp test file that triggers the discrepancy
between the (correct) Go implementation and the (buggy) libwebp C
implementation was added on 2015-01-23 in
f64fb2da01
in response to https://bugs.chromium.org/p/webp/issues/detail?id=239

Change-Id: Ifee19be0af634b9bf36ff0e16957648e05be840a
Reviewed-on: https://go-review.googlesource.com/18186
Reviewed-by: David Crawshaw <crawshaw@golang.org>
This commit is contained in:
Nigel Tao 2016-01-02 15:23:15 +11:00
parent baddd3465a
commit 7c492694a6

View File

@ -38,13 +38,9 @@ var (
func main() { func main() {
flag.Parse() flag.Parse()
if *dwebp == "" { if err := checkDwebp(); err != nil {
flag.Usage() flag.Usage()
log.Fatal("dwebp flag was not specified") log.Fatal(err)
}
if _, err := os.Stat(*dwebp); err != nil {
flag.Usage()
log.Fatalf("could not find dwebp program at %q", *dwebp)
} }
if *testdata == "" { if *testdata == "" {
flag.Usage() flag.Usage()
@ -81,6 +77,25 @@ func main() {
} }
} }
func checkDwebp() error {
if *dwebp == "" {
return fmt.Errorf("dwebp flag was not specified")
}
if _, err := os.Stat(*dwebp); err != nil {
return fmt.Errorf("could not find dwebp program at %q", *dwebp)
}
b, err := exec.Command(*dwebp, "-version").Output()
if err != nil {
return fmt.Errorf("could not determine the dwebp program version for %q: %v", *dwebp, err)
}
switch s := string(bytes.TrimSpace(b)); s {
case "0.4.0", "0.4.1", "0.4.2":
return fmt.Errorf("the dwebp program version %q for %q has a known bug "+
"(https://bugs.chromium.org/p/webp/issues/detail?id=239). Please use a newer version.", s, *dwebp)
}
return nil
}
// test tests a single WEBP image. // test tests a single WEBP image.
func test(name string) error { func test(name string) error {
filename := filepath.Join(*testdata, name) filename := filepath.Join(*testdata, name)