Permalink
Browse files

Make tests c89 friendly

This was inadvertantly identified as the cause for a build break
in a critical period, so it was reverted.

Rather than revert the revert, we've cherry picked this one back
to life.

Change-Id: Iba4500cde952ec020ba90416d405fb77d41cb0ac
Reviewed-on: http://review.couchbase.org/12584
Tested-by: Sergey Avseyev <sergey.avseyev@gmail.com>
Tested-by: Matt Ingenthron <matt@couchbase.com>
Reviewed-by: Matt Ingenthron <matt@couchbase.com>
  • Loading branch information...
1 parent 5b16425 commit 2cf8296ef2d3ebe316a7b1603d8d996321ea86a2 @avsej avsej committed with ingenthr Jan 13, 2012
View
@@ -91,18 +91,21 @@ check_PROGRAMS= testapp regression testketama
TESTS = ${check_PROGRAMS}
# Test application to test stuff from C
-testapp_SOURCES = tests/testapp.c
+testapp_SOURCES = tests/testapp.c tests/macros.h
testapp_DEPENDENCIES= libvbucket.la
testapp_LDADD= libvbucket.la
-regression_SOURCES = tests/regression.c
+regression_SOURCES = tests/regression.c tests/macros.h
regression_DEPENDENCIES= libvbucket.la
regression_LDADD= libvbucket.la
-testketama_SOURCES = tests/testketama.c
+testketama_SOURCES = tests/testketama.c tests/macros.h
testketama_DEPENDENCIES= libvbucket.la libketama.la
testketama_LDADD= libvbucket.la libketama.la
+# Configuration files needed by check target
+EXTRA_DIST += tests/config
+
libketama_la_SOURCES = src/ketama.c
libketama_la_CFLAGS = $(AM_CFLAGS) ${NO_WERROR}
File renamed without changes.
@@ -0,0 +1,15 @@
+{
+ "hashAlgorithm": "CRC",
+ "numReplicas": 2,
+ "serverList": [
+ "server1:11211",
+ "server2:11210",
+ "server3:11211"
+ ],
+ "vBucketMap": [
+ [ 0, 1, 2 ],
+ [ 1, 2, 0 ],
+ [ 2, 1, -1 ],
+ [ 1, 2, 0 ]
+ ]
+}
@@ -0,0 +1,55 @@
+{
+ "nodes": [
+ {
+ "hostname": "192.168.2.123:9002",
+ "couchApiBase": "http://192.168.2.123:9502/default",
+ "ports": {
+ "proxy": 12005,
+ "direct": 12004
+ }
+ },
+ {
+ "hostname": "192.168.2.123:9000",
+ "couchApiBase": "http://192.168.2.123:9500/default",
+ "ports": {
+ "proxy": 12001,
+ "direct": 12000
+ }
+ },
+ {
+ "hostname": "192.168.2.123:9001",
+ "couchApiBase": "http://192.168.2.123:9501/default",
+ "ports": {
+ "proxy": 12003,
+ "direct": 12002
+ }
+ }
+ ],
+ "vBucketServerMap": {
+ "hashAlgorithm": "CRC",
+ "numReplicas": 1,
+ "serverList": [
+ "192.168.2.123:12000",
+ "192.168.2.123:12002",
+ "192.168.2.123:12004"
+ ],
+ "vBucketMap": [
+ [ 0, 1 ],
+ [ 0, 1 ],
+ [ 0, 1 ],
+ [ 1, 2 ],
+ [ 1, 2 ],
+ [ 2, 0 ],
+ [ 2, 1 ],
+ [ 2, 1 ],
+ [ 1, 0 ],
+ [ 1, 0 ],
+ [ 1, 0 ],
+ [ 0, 2 ],
+ [ 0, 2 ],
+ [ 0, 2 ],
+ [ 2, 0 ],
+ [ 2, 0 ]
+ ]
+ }
+}
@@ -0,0 +1,15 @@
+{
+ "hashAlgorithm": "CRC",
+ "numReplicas": 2,
+ "serverList": [
+ "server1:11211",
+ "server2:11210",
+ "server3:11211"
+ ],
+ "vBucketMap": [
+ [ 0, 1, 2 ],
+ [ 1, 2, 0 ],
+ [ 2, 1, -1 ],
+ [ 1, 2, 0 ]
+ ]
+}
@@ -0,0 +1,15 @@
+{
+ "hashAlgorithm": "CRC",
+ "numReplicas": 2,
+ "serverList": [
+ "server1:11211",
+ "server2:11210",
+ "server4:11211"
+ ],
+ "vBucketMap": [
+ [ 0, 1, 2 ],
+ [ 1, 2, 0 ],
+ [ 2, 1, -1 ],
+ [ 0, 2, 0 ]
+ ]
+}
@@ -0,0 +1,18 @@
+{
+ "hashAlgorithm": "CRC",
+ "numReplicas": 1,
+ "serverList": [
+ "server1:11211",
+ "server2:11210"
+ ],
+ "vBucketMap": [
+ [ 0, 1 ],
+ [ 1, 0 ],
+ [ 1, 0 ],
+ [ 0, 1 ],
+ [ 0, 1 ],
+ [ 1, 0 ],
+ [ 1, 0 ],
+ [ 0, 1 ]
+ ]
+}
@@ -0,0 +1,15 @@
+{
+ "hashAlgorithm": "CRC",
+ "numReplicas": 2,
+ "serverList": [
+ "server1:11211",
+ "server2:11210",
+ "server3:11211"
+ ],
+ "vBucketMap": [
+ [ 0, 1, 2 ],
+ [ 1, 2, 0 ],
+ [ 2, 1, -1 ],
+ [ 1, 2, 0 ]
+ ]
+}
@@ -0,0 +1,18 @@
+{
+ "otherKeyThatIsIgnored": 12345,
+ "vBucketServerMap": {
+ "hashAlgorithm": "CRC",
+ "numReplicas": 2,
+ "serverList": [
+ "server1:11211",
+ "server2:11210",
+ "server3:11211"
+ ],
+ "vBucketMap": [
+ [ 0, 1, 2 ],
+ [ 1, 2, 0 ],
+ [ 2, 1, -1 ],
+ [ 1, 2, 0 ]
+ ]
+ }
+}
@@ -0,0 +1,25 @@
+{
+ "otherKeyThatIsIgnored": 12345,
+ "vBucketServerMap": {
+ "hashAlgorithm": "CRC",
+ "numReplicas": 2,
+ "serverList": [
+ "server1:11211",
+ "server2:11210",
+ "server3:11211",
+ "server4:11211"
+ ],
+ "vBucketMap": [
+ [ 0, 1, 2 ],
+ [ 1, 2, 0 ],
+ [ 2, 1, -1 ],
+ [ 1, 2, 0 ]
+ ],
+ "vBucketMapForward": [
+ [ 3, 0, 0 ],
+ [ 2, 1, 3 ],
+ [ 1, 2, 2 ],
+ [ 0, 3, 1 ]
+ ]
+ }
+}
@@ -0,0 +1,48 @@
+{
+ "name": "default",
+ "uri": "/pools/default/buckets/default",
+ "streamingUri": "/pools/default/bucketsStreaming/default",
+ "flushCacheUri": "/pools/default/buckets/default/controller/doFlush",
+ "nodes": [
+ {
+ "clusterMembership": "inactiveAdded",
+ "status": "unhealthy",
+ "hostname": "127.0.0.1",
+ "version": "unknown",
+ "os": "unknown",
+ "ports": {
+ "proxy": 11213,
+ "direct": 11212
+ },
+ "uptime": "0",
+ "memoryTotal": 0,
+ "memoryFree": 0,
+ "mcdMemoryReserved": 64,
+ "mcdMemoryAllocated": 0
+ }
+ ],
+ "stats": {
+ "uri": "/pools/default/buckets/default/stats"
+ },
+ "vBucketServerMap": {
+ "hashAlgorithm": "CRC",
+ "numReplicas": 2,
+ "serverList": [
+ "server1:11211",
+ "server2:11210",
+ "server3:11211"
+ ],
+ "vBucketMap": [
+ [ 0, 1, 2 ],
+ [ 1, 2, 0 ],
+ [ 2, 1, -1 ],
+ [ 1, 2, 0 ]
+ ]
+ },
+ "basicStats": {
+ "cacheSize": 64,
+ "opsPerSec": 0.0,
+ "evictionsPerSec": 0.0,
+ "cachePercentUsed": 0.0
+ }
+}
@@ -0,0 +1,17 @@
+{
+ "hashAlgorithm": "CRC",
+ "numReplicas": 2,
+ "serverList": [
+ "server1:11211",
+ "server2:11210",
+ "server3:11211"
+ ],
+ "name": "theUser",
+ "saslPassword": "thePassword",
+ "vBucketMap": [
+ [ 0, 1, 2 ],
+ [ 1, 2, 0 ],
+ [ 2, 1, -1 ],
+ [ 1, 2, 0 ]
+ ]
+}
@@ -0,0 +1,17 @@
+{
+ "hashAlgorithm": "CRC",
+ "numReplicas": 2,
+ "serverList": [
+ "server1:11211",
+ "server2:11210",
+ "server3:11211"
+ ],
+ "name": "theUserIsDifferent",
+ "saslPassword": "thePasswordIsDifferent",
+ "vBucketMap": [
+ [ 0, 1, 2 ],
+ [ 1, 2, 0 ],
+ [ 2, 1, -1 ],
+ [ 1, 2, 0 ]
+ ]
+}
View
@@ -0,0 +1,14 @@
+#ifndef TESTS_MACROS_H
+#define TESTS_MACROS_H
+
+#define assert(expr) \
+ do { \
+ if (!(expr)) { \
+ fprintf(stderr, "%s:%d: assertion failed\n", \
+ __FILE__, __LINE__); \
+ fflush(stderr); \
+ abort(); \
+ } \
+ } while (0)
+
+#endif
View
@@ -1,5 +1,4 @@
#undef NDEBUG
-#include <assert.h>
#include <dirent.h>
#include <limits.h>
#include <errno.h>
@@ -9,14 +8,16 @@
#include <libvbucket/vbucket.h>
+#include "macros.h"
+
int main(void) {
char *root = getenv("srcdir");
if (root != NULL) {
char buffer[PATH_MAX];
DIR *dp;
struct dirent *de;
- sprintf(buffer, "%s/tests/regression", root);
+ sprintf(buffer, "%s/tests/config", root);
dp = opendir(buffer);
if (dp == NULL) {
fprintf(stderr, "Skipping regression check\nFailed to open %s: %s\n",
@@ -25,9 +26,9 @@ int main(void) {
}
while ((de = readdir(dp)) != NULL) {
- if (strncmp(de->d_name, "bug", 3) == 0 || strncmp(de->d_name, "mb-", 3) == 0) {
+ if (strncmp(de->d_name, "regression-bug", 14) == 0 || strncmp(de->d_name, "mb-", 3) == 0) {
VBUCKET_CONFIG_HANDLE h;
- sprintf(buffer, "%s/tests/regression/%s", root, de->d_name);
+ sprintf(buffer, "%s/tests/config/%s", root, de->d_name);
fprintf(stderr, "Running regression test for: %s\n", de->d_name);
h = vbucket_config_parse_file(buffer);
assert(h != NULL);
Oops, something went wrong.

0 comments on commit 2cf8296

Please sign in to comment.