youtube/vitess — pull request #273 by enisoc (2014-12-23 09:56:01+00:00)
Title: Avoid divide-by-zero and fix units in cgzip_test.

A user reported the following flaky failure in cgzip_test:

cgzip_test.go:79: Checksums:
cgzip_test.go:37: go crc64:
cgzip_test.go:38: time : 3790 ms
cgzip_test.go:39: speed: 276669 KB/s
cgzip_test.go:37: go adler32:
cgzip_test.go:38: time : 0 ms
panic: runtime error: integer divide by zero [recovered]
panic: runtime error: integer divide by zero

I don't see why the time would be 0ms; in fact, the units were wrong in the code so it's actually measuring 0us. Surely it couldn't be that fast if it's actually working, since it takes about 1ms on my machine (after fixing the time units). In any case, we shouldn't be dividing by zero.