summaryrefslogtreecommitdiff
path: root/src/crc64.c
diff options
context:
space:
mode:
authorMatt Stancliff <matt@genges.com>2014-11-12 21:58:57 -0500
committerMatt Stancliff <matt@genges.com>2014-12-23 09:31:03 -0500
commit8febcffdc597566f1e307c0534014b2bdf687c02 (patch)
tree74cf78291298cce2dfc1abf5fe1c25aacd86aa4f /src/crc64.c
parent8380655e85f0afd1f0afc99b464717cb97002b7a (diff)
downloadredis-8febcffdc597566f1e307c0534014b2bdf687c02.tar.gz
Allow all code tests to run using Redis args
Previously, many files had individual main() functions for testing, but each required being compiled with their own testing flags. That gets difficult when you have 8 different flags you need to set just to run all tests (plus, some test files required other files to be compiled aaginst them, and it seems some didn't build at all without including the rest of Redis). Now all individual test main() funcions are renamed to a test function for the file itself and one global REDIS_TEST define enables testing across the entire codebase. Tests can now be run with: - `./redis-server test <test>` e.g. ./redis-server test ziplist If REDIS_TEST is not defined, then no tests get included and no tests are included in the final redis-server binary.
Diffstat (limited to 'src/crc64.c')
-rw-r--r--src/crc64.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/crc64.c b/src/crc64.c
index ecdba90e0..f1f764922 100644
--- a/src/crc64.c
+++ b/src/crc64.c
@@ -181,9 +181,13 @@ uint64_t crc64(uint64_t crc, const unsigned char *s, uint64_t l) {
}
/* Test main */
-#ifdef TEST_MAIN
+#ifdef REDIS_TEST
#include <stdio.h>
-int main(void) {
+
+#define UNUSED(x) (void)(x)
+int crc64Test(int argc, char *argv[]) {
+ UNUSED(argc);
+ UNUSED(argv);
printf("e9c6d914c4b8d9ca == %016llx\n",
(unsigned long long) crc64(0,(unsigned char*)"123456789",9));
return 0;