Commit Graph

24 Commits

Author SHA1 Message Date
Victor Costan ac55f842f7 Test stub improvements.
PiperOrigin-RevId: 347736380
2020-12-16 02:58:39 +00:00
Chris Mumford 42d1dd7ea3 Fix CHECK_EQ to call ok() instead of CheckSuccess().
CheckSuccess was removed in e1e91ee464.

PiperOrigin-RevId: 347625874
2020-12-15 09:16:39 -08:00
Victor Costan e1e91ee464 Rework file:: stubs.
PiperOrigin-RevId: 347541488
2020-12-15 06:21:47 +00:00
Victor Costan 549685a598 Remove custom testing and benchmarking code.
Snappy includes a testing framework, which implements a subset of the
Google Test API, and can be used when Google Test is not available.
Snappy also includes a micro-benchmark framework, which implements an
old version of the Google Benchmark API.

This CL replaces the custom test and micro-benchmark frameworks with
google/googletest and google/benchmark. The code is vendored in
third_party/ via git submodules. The setup is similar to google/crc32c
and google/leveldb.

This CL also updates the benchmarking code to the modern Google
Benchmark API.

Benchmark results are expected to be more precise, as the old framework
ran each benchmark with a fixed number of iterations, whereas Google
Benchmark keeps iterating until the noise is low.

PiperOrigin-RevId: 347456142
2020-12-14 21:27:31 +00:00
Victor Costan 63620c06d2 Add some std:: qualifiers to types and functions.
PiperOrigin-RevId: 309110343
2020-04-29 22:31:55 +00:00
Victor Costan 231b8be076 Migrate to standard integral types.
The following changes are done via find/replace.
* int8 -> int8_t
* int16 -> int16_t
* int32 -> int32_t
* int64 -> int64_t

The aliases were removed from snappy-stubs-public.h.

PiperOrigin-RevId: 306141557
2020-04-12 20:10:03 +00:00
Victor Costan c9212708b2 Fix build errors.
PiperOrigin-RevId: 278310119
2019-11-03 23:24:02 -08:00
Victor Costan 62363d9a79 Fully qualify std::string.
This is in preparation for removing the snappy::string alias
of std::string.

PiperOrigin-RevId: 271383199
2019-09-26 10:57:29 -07:00
costan e9720a001d Update Travis CI config, add AppVeyor for Windows CI coverage. 2017-06-28 18:36:37 -07:00
costan 8b60aac4fd Remove "using namespace std;" from zippy-stubs-internal.h.
This makes it easier to build zippy, as some compiles require a warning
suppression to accept "using namespace std".
2017-03-13 13:03:01 -07:00
Steinar H. Gunderson e7a897e187 Fixed unit tests to compile under MSVC.
1. Including config.h in test.
2. Including windows.h before zippy-test.h.
3. Removed definition of WIN32_LEAN_AND_MEAN. This caused problems in
   build environments that define WIN32_LEAN_AND_MEAN as our
   definition didn't check for prior existence. This constant is old
   and no longer needed anyhow.
4. Disable MSVC warning 4722 since ~LogMessageCrash() never returns.

A=cmumford
R=jeff
2015-06-22 16:09:56 +02:00
snappy.mirrorbot@gmail.com a3e928d62b Supports truncated test data in zippy benchmark.
R=sesse


git-svn-id: https://snappy.googlecode.com/svn/trunk@74 03e5f5b5-db94-4691-08a0-1a8bf15f6143
2013-04-09 15:33:30 +00:00
snappy.mirrorbot@gmail.com 8168446c7e Make ./snappy_unittest pass without "srcdir" being defined.
Previously, snappy_unittests would read from an absolute path /testdata/..;
convert it to use a relative path instead.

Patch from Marc-Antonie Ruel.

R=maruel


git-svn-id: https://snappy.googlecode.com/svn/trunk@72 03e5f5b5-db94-4691-08a0-1a8bf15f6143
2013-02-05 14:30:05 +00:00
snappy.mirrorbot@gmail.com 81f34784b7 Adjust the Snappy open-source distribution for the changes in Google's
internal file API.

R=sanjay



git-svn-id: https://snappy.googlecode.com/svn/trunk@70 03e5f5b5-db94-4691-08a0-1a8bf15f6143
2013-01-06 19:21:26 +00:00
snappy.mirrorbot@gmail.com e89f20ab46 Handle the case where gettimeofday() goes backwards or returns the same value
twice; it could cause division by zero in the unit test framework.
(We already had one fix for this in place, but it was incomplete.)

This could in theory happen on any system, since there are few guarantees
about gettimeofday(), but seems to only happen in practice on GNU/Hurd, where
gettimeofday() is cached and only updated ever so often.

R=sanjay


git-svn-id: https://snappy.googlecode.com/svn/trunk@65 03e5f5b5-db94-4691-08a0-1a8bf15f6143
2012-07-04 09:34:48 +00:00
snappy.mirrorbot@gmail.com d9068ee301 Fix public issue r57: Fix most warnings with -Wall, mostly signed/unsigned
warnings. There are still some in the unit test, but the main .cc file should
be clean. We haven't enabled -Wall for the default build, since the unit test
is still not clean.

This also fixes a real bug in the open-source implementation of
ReadFileToStringOrDie(); it would not detect errors correctly.

I had to go through some pains to avoid performance loss as the types
were changed; I think there might still be some with 32-bit if and only if LFS
is enabled (ie., size_t is 64-bit), but for regular 32-bit and 64-bit I can't
see any losses, and I've diffed the generated GCC assembler between the old and
new code without seeing any significant choices. If anything, it's ever so
slightly faster.

This may or may not enable compression of very large blocks (>2^32 bytes)
when size_t is 64-bit, but I haven't checked, and it is still not a supported
case.


git-svn-id: https://snappy.googlecode.com/svn/trunk@56 03e5f5b5-db94-4691-08a0-1a8bf15f6143
2012-01-04 13:10:46 +00:00
snappy.mirrorbot@gmail.com a1f9f9973d Fix public issue #39: Pick out the median runs based on CPU time,
not real time. Also, use nth_element instead of sort, since we
only need one element.

R=csilvers
DELTA=5  (3 added, 0 deleted, 2 changed)


Revision created by MOE tool push_codebase.
MOE_MIGRATION=1799


git-svn-id: https://snappy.googlecode.com/svn/trunk@35 03e5f5b5-db94-4691-08a0-1a8bf15f6143
2011-05-09 21:29:02 +00:00
snappy.mirrorbot@gmail.com f7b105683c Fix public issue #38: Make the microbenchmark framework handle
properly cases where gettimeofday() can stand return the same
result twice (as sometimes on GNU/Hurd) or go backwards
(as when the user adjusts the clock). We avoid a division-by-zero,
and put a lower bound on the number of iterations -- the same
amount as we use to calibrate.

We should probably use CLOCK_MONOTONIC for platforms that support
it, to be robust against clock adjustments; we already use Windows'
monotonic timers. However, that's for a later changelist.

R=csilvers
DELTA=7  (5 added, 0 deleted, 2 changed)


Revision created by MOE tool push_codebase.
MOE_MIGRATION=1798


git-svn-id: https://snappy.googlecode.com/svn/trunk@34 03e5f5b5-db94-4691-08a0-1a8bf15f6143
2011-05-09 21:28:45 +00:00
snappy.mirrorbot@gmail.com 84d9f64202 Fix public issue #30: Stop using gettimeofday() altogether on Win32,
as MSVC doesn't include it. Replace with QueryPerformanceCounter(),
which is monotonic and probably reasonably high-resolution.
(Some machines have traditionally had bugs in QPC, but they should
be relatively rare these days, and there's really no much better
alternative that I know of.)

R=csilvers
DELTA=74  (55 added, 19 deleted, 0 changed)


Revision created by MOE tool push_codebase.
MOE_MIGRATION=1556


git-svn-id: https://snappy.googlecode.com/svn/trunk@31 03e5f5b5-db94-4691-08a0-1a8bf15f6143
2011-04-26 12:34:55 +00:00
snappy.mirrorbot@gmail.com 73987351de When including <windows.h>, define WIN32_LEAN_AND_MEAN first,
so we won't pull in macro definitions of things like min() and max(),
which can conflict with <algorithm>.

R=csilvers
DELTA=1  (1 added, 0 deleted, 0 changed)


Revision created by MOE tool push_codebase.
MOE_MIGRATION=1485


git-svn-id: https://snappy.googlecode.com/svn/trunk@29 03e5f5b5-db94-4691-08a0-1a8bf15f6143
2011-04-15 22:55:56 +00:00
snappy.mirrorbot@gmail.com fb7e0eade4 Fix public issue #29: Write CPU timing code for Windows, based on GetProcessTimes()
instead of getursage().

I thought I'd already committed this patch, so that the 1.0.1 release already
would have a Windows-compatible snappy_unittest, but I'd seemingly deleted it
instead, so this is a reconstruction.

R=csilvers
DELTA=43  (39 added, 3 deleted, 1 changed)


Revision created by MOE tool push_codebase.
MOE_MIGRATION=1295


git-svn-id: https://snappy.googlecode.com/svn/trunk@28 03e5f5b5-db94-4691-08a0-1a8bf15f6143
2011-04-11 09:07:01 +00:00
snappy.mirrorbot@gmail.com b4bbc1041b Change Snappy from the Apache 2.0 to a BSD-type license.
R=dannyb
DELTA=328  (80 added, 184 deleted, 64 changed)


Revision created by MOE tool push_codebase.
MOE_MIGRATION=1061


git-svn-id: https://snappy.googlecode.com/svn/trunk@20 03e5f5b5-db94-4691-08a0-1a8bf15f6143
2011-03-25 16:14:41 +00:00
snappy.mirrorbot@gmail.com b1dc1f643e Fix a microbenchmark crash on mingw32; seemingly %lld is not universally
supported on Windows, and %I64d is recommended instead.

R=csilvers
DELTA=6  (5 added, 0 deleted, 1 changed)


Revision created by MOE tool push_codebase.
MOE_MIGRATION=1034


git-svn-id: https://snappy.googlecode.com/svn/trunk@18 03e5f5b5-db94-4691-08a0-1a8bf15f6143
2011-03-24 19:15:54 +00:00
snappy.mirrorbot@gmail.com 28a6440239 Revision created by MOE tool push_codebase.
MOE_MIGRATION=


git-svn-id: https://snappy.googlecode.com/svn/trunk@2 03e5f5b5-db94-4691-08a0-1a8bf15f6143
2011-03-18 17:14:15 +00:00