[iwhd] maint: add gperf to the list of build-from-clone-required tools
by Jim Meyering
commit 2d096b22245bb87f7ac283e33fca039884d89d37
Author: Jim Meyering <meyering(a)redhat.com>
Date: Thu Apr 28 10:26:18 2011 +0200
maint: add gperf to the list of build-from-clone-required tools
* bootstrap.conf (buildreq): Add gperf.
This is required via the use in gnulib:
gperf -m 10 ./iconv_open-aix.gperf > ./iconv_open-aix.h-t
/bin/sh: gperf: command not found
make[2]: *** [iconv_open-aix.h] Error 127
Reported by Mark McLoughlin in
http://thread.gmane.org/gmane.comp.lib.iwhd.devel/542/focus=545
bootstrap.conf | 1 +
1 files changed, 1 insertions(+), 0 deletions(-)
---
diff --git a/bootstrap.conf b/bootstrap.conf
index f752c95..7e58968 100644
--- a/bootstrap.conf
+++ b/bootstrap.conf
@@ -102,6 +102,7 @@ autopoint -
bison -
gettext 0.17
git 1.4.4
+gperf -
gzip -
rsync -
tar -
12 years, 11 months
[iwhd] maint: enable a syntax check, now that it passes
by Jim Meyering
commit 0aba524b23a0637438825c7ea08cc31777e7030a
Author: Jim Meyering <meyering(a)redhat.com>
Date: Thu Apr 28 08:23:33 2011 +0200
maint: enable a syntax check, now that it passes
* cfg.mk (local-checks-to-skip): Enable sc_useless_cpp_parens
cfg.mk | 1 -
1 files changed, 0 insertions(+), 1 deletions(-)
---
diff --git a/cfg.mk b/cfg.mk
index b7c62a0..a709757 100644
--- a/cfg.mk
+++ b/cfg.mk
@@ -30,7 +30,6 @@ skip_low_priority = \
local-checks-to-skip = \
sc_program_name \
sc_space_tab \
- sc_useless_cpp_parens \
$(skip_low_priority)
# Tools used to bootstrap this package, used for "announcement".
12 years, 11 months
[iwhd] maint: use less syntax in #if directives (e.g., remove parentheses)
by Jim Meyering
commit 575c40239c2a3a6ab31c4ed3b5072e5970cef5d2
Author: Jim Meyering <meyering(a)redhat.com>
Date: Thu Apr 28 08:25:39 2011 +0200
maint: use less syntax in #if directives (e.g., remove parentheses)
* backend.h: Use #ifndef _BACKEND_H rather than #if !defined(_BACKEND_H)
* iwh.h: Likewise.
* meta.cpp: Likewise.
* meta.h: Likewise.
* mpipe.h: Likewise.
* qlexer.l: Likewise.
* query.h: Likewise.
* replica.h: Likewise.
* rest.c: Likewise.
* setup.h: Likewise.
* state_defs.h: Likewise.
* template.h: Likewise.
backend.h | 2 +-
iwh.h | 2 +-
meta.cpp | 2 +-
meta.h | 6 +++---
mpipe.h | 2 +-
qlexer.l | 2 +-
query.h | 4 ++--
replica.h | 2 +-
rest.c | 2 +-
setup.h | 2 +-
state_defs.h | 2 +-
template.h | 2 +-
12 files changed, 15 insertions(+), 15 deletions(-)
---
diff --git a/backend.h b/backend.h
index 7edae08..3022500 100644
--- a/backend.h
+++ b/backend.h
@@ -13,7 +13,7 @@
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>. */
-#if !defined(_BACKEND_H)
+#ifndef _BACKEND_H
#define _BACKEND_H
#include "state_defs.h"
diff --git a/iwh.h b/iwh.h
index 565cf4f..853cde5 100644
--- a/iwh.h
+++ b/iwh.h
@@ -15,7 +15,7 @@
#define MY_PORT 9090
-#if defined(GLOBALS_IMPL)
+#ifdef GLOBALS_IMPL
#define GLOBAL(type,name,value) type name = value
#else
#define GLOBAL(type,name,value) extern type name
diff --git a/meta.cpp b/meta.cpp
index 298dd29..3cf6f57 100644
--- a/meta.cpp
+++ b/meta.cpp
@@ -46,7 +46,7 @@ using namespace mongo;
static pthread_mutex_t client_lock = PTHREAD_MUTEX_INITIALIZER;
-#if defined(SHOW_CONTENTION)
+#ifdef SHOW_CONTENTION
#define CLIENT_LOCK do { \
if (pthread_mutex_trylock(&client_lock) != 0) { \
cout << "contention in " << __func__ << endl; \
diff --git a/meta.h b/meta.h
index b620178..130b4b4 100644
--- a/meta.h
+++ b/meta.h
@@ -13,10 +13,10 @@
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>. */
-#if !defined(_META_H)
+#ifndef _META_H
#define _META_H
-#if defined(__cplusplus)
+#ifdef __cplusplus
extern "C" {
#endif
@@ -42,7 +42,7 @@ void *meta_get_attrs (const char *bucket, const char *key);
int meta_attr_next (void *aobj, const char **, const char **);
void meta_attr_stop (void *aobj);
-#if defined(__cplusplus)
+#ifdef __cplusplus
}
#endif
diff --git a/mpipe.h b/mpipe.h
index 62edbaa..a36e439 100644
--- a/mpipe.h
+++ b/mpipe.h
@@ -13,7 +13,7 @@
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>. */
-#if !defined(_MPIPE_H)
+#ifndef _MPIPE_H
#define _MPIPE_H
#include <poll.h>
diff --git a/qlexer.l b/qlexer.l
index 8d64187..49d4cee 100644
--- a/qlexer.l
+++ b/qlexer.l
@@ -43,7 +43,7 @@
%%
-#if defined(UNIT_TEST)
+#ifdef UNIT_TEST
static void
yyerror (const char *msg)
{
diff --git a/query.h b/query.h
index 0b6352a..61dcd31 100644
--- a/query.h
+++ b/query.h
@@ -16,7 +16,7 @@
#ifndef _QUERY_H
#define _QUERY_H 1
-#if defined(__CPLUSPLUS__) || defined(__cplusplus)
+#if defined __CPLUSPLUS__ || defined __cplusplus
extern "C" {
#endif
@@ -83,7 +83,7 @@ void print_value (const value_t *);
value_t *parse (const char *text);
-#if defined(__CPLUSPLUS__) || defined(__cplusplus)
+#if defined __CPLUSPLUS__ || defined __cplusplus
}
#endif
diff --git a/replica.h b/replica.h
index 4dea07f..a489f1d 100644
--- a/replica.h
+++ b/replica.h
@@ -13,7 +13,7 @@
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>. */
-#if !defined(_REPLICA_H)
+#ifndef _REPLICA_H
#define _REPLICA_H
#include "state_defs.h"
diff --git a/rest.c b/rest.c
index f1055ad..0ec6a0f 100644
--- a/rest.c
+++ b/rest.c
@@ -57,7 +57,7 @@ const char version_etc_copyright[] =
year. */
"Copyright %s %d Red Hat, Inc.";
-#if defined(DEBUG)
+#ifdef DEBUG
#define MY_MHD_FLAGS MHD_USE_THREAD_PER_CONNECTION | MHD_USE_DEBUG
//#define MY_MHD_FLAGS MHD_USE_SELECT_INTERNALLY | MHD_USE_DEBUG
#else
diff --git a/setup.h b/setup.h
index ca04931..bc6df77 100644
--- a/setup.h
+++ b/setup.h
@@ -13,7 +13,7 @@
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>. */
-#if !defined(_SETUP_H)
+#ifndef _SETUP_H
#define _SETUP_H
#include <curl/curl.h> /* needed by stuff in state_defs.h (from backend.h) */
diff --git a/state_defs.h b/state_defs.h
index 77163a4..6a3fd0b 100644
--- a/state_defs.h
+++ b/state_defs.h
@@ -13,7 +13,7 @@
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>. */
-#if !defined(_STATE_DEFS_H)
+#ifndef _STATE_DEFS_H
#define _STATE_DEFS_H
#include <microhttpd.h>
diff --git a/template.h b/template.h
index 4398a60..6603073 100644
--- a/template.h
+++ b/template.h
@@ -13,7 +13,7 @@
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>. */
-#if !defined(_TEMPLATE_H)
+#ifndef _TEMPLATE_H
#define _TEMPLATE_H
#define TMPL_BUF_SIZE 1024
12 years, 11 months
[iwhd] maint: remove unnecessary #ifdef VERSION
by Jim Meyering
commit 5ff751d15a384852a69680ff7f3f392bef0b8990
Author: Jim Meyering <meyering(a)redhat.com>
Date: Thu Apr 28 08:16:21 2011 +0200
maint: remove unnecessary #ifdef VERSION
* meta.cpp: Remove unneeded guard around #undef VERSION.
meta.cpp | 2 --
1 files changed, 0 insertions(+), 2 deletions(-)
---
diff --git a/meta.cpp b/meta.cpp
index e55e5d1..298dd29 100644
--- a/meta.cpp
+++ b/meta.cpp
@@ -27,9 +27,7 @@
using namespace std;
/* Mongo (rather antisocially) tries to define this itself. */
-#if defined(VERSION)
#undef VERSION
-#endif
#include <mongo/client/dbclient.h>
using namespace mongo;
12 years, 11 months
[iwhd] build: check for mongodb headers
by Jim Meyering
commit 165143140a4047ece83204ae80fd94e6c5f51c73
Author: Mark McLoughlin <markmc(a)redhat.com>
Date: Wed Apr 27 18:23:07 2011 +0100
build: check for mongodb headers
On my Fedora 14 system, without mongodb-devel I was seeing:
CXX meta.o
meta.cpp:34:35: fatal error: mongo/client/dbclient.h: No such file or directory
compilation terminated.
The header is C++ so we need AC_LANGUAGE_PUSH and, similar to meta.cpp,
we need to undefine VERSION before including the header.
Note, the AC_CHECK_LIB approach doesn't seem sufficient because the
mongodb package in Fedora doesn't ship versioned shared libraries with an
unversioned symlink in the -devel package.
With the new check, we fail with:
checking for mongo/client/dbclient.h... no
configure: error: Missing Mongo DB client development library: mongodb-devel
configure.ac | 6 ++++++
1 files changed, 6 insertions(+), 0 deletions(-)
---
diff --git a/configure.ac b/configure.ac
index 103c18a..8945f7c 100644
--- a/configure.ac
+++ b/configure.ac
@@ -79,6 +79,12 @@ gl_LIBXML2([2.6.0])
AC_CHECK_HEADER([gc.h], ,
[AC_MSG_ERROR([Missing GC development library: gc-devel or libgc-dev])])
+AC_LANG_PUSH([C++])
+AC_CHECK_HEADER([mongo/client/dbclient.h], ,
+ [AC_MSG_ERROR([Missing Mongo DB client development library: mongodb-devel])],
+ [#undef VERSION])
+AC_LANG_POP
+
# from http://www.gnu.org/software/autoconf-archive/
AX_BOOST_BASE
AX_BOOST_SYSTEM
12 years, 11 months
[iwhd] upon successful bucket or object creation, issue HTTP code 201, not 200
by Jim Meyering
commit 28df097fcc95e457a9586ea5e60e51652cea1a19
Author: Jim Meyering <meyering(a)redhat.com>
Date: Wed Apr 27 13:47:27 2011 +0200
upon successful bucket or object creation, issue HTTP code 201, not 200
200 is a mere "OK", while 201 is the slightly more descriptive CREATED.
However, note that the 201 response does not guarantee that there
was no prior object by the same name. I.e., if you create an object
and that happens to replace one that already existed, you'll get 201
just as when you create an object in an empty bucket.
This makes the code more consistent: even before this change,
attribute-creation would elicit a 201 response.
* rest.c (proxy_put_data): Use MHD_HTTP_CREATED, not MHD_HTTP_OK.
(create_bucket): Likewise.
* t/creation-code (iwhd_pid): New file. Test for the above.
* t/Makefile.am (TESTS): Add it.
Reported by Dave Johnson. See http://bugzilla.redhat.com/699417
rest.c | 5 +++-
t/Makefile.am | 1 +
t/creation-code | 59 +++++++++++++++++++++++++++++++++++++++++++++++++++++++
3 files changed, 64 insertions(+), 1 deletions(-)
---
diff --git a/rest.c b/rest.c
index aa9be64..f1055ad 100644
--- a/rest.c
+++ b/rest.c
@@ -509,7 +509,7 @@ proxy_put_data (void *cctx, struct MHD_Connection *conn, const char *url,
}
DPRINTF("rereplicate (obj PUT)\n");
recheck_replication(ms,NULL);
- rc = MHD_HTTP_OK;
+ rc = MHD_HTTP_CREATED;
}
resp = MHD_create_response_from_data(0,NULL,MHD_NO,MHD_NO);
if (!resp) {
@@ -1227,6 +1227,9 @@ create_bucket (char *name, my_state *ms)
* general replica-repair policy/system in place.
*/
replicate_bcreate(name,ms);
+
+ /* Use this (201): slightly more descriptive than 200. */
+ rc = MHD_HTTP_CREATED;
}
return rc;
diff --git a/t/Makefile.am b/t/Makefile.am
index d7e3fbf..5bd4d69 100644
--- a/t/Makefile.am
+++ b/t/Makefile.am
@@ -17,6 +17,7 @@
TESTS = \
parse-test \
basic \
+ creation-code \
provider \
replication \
auto \
diff --git a/t/creation-code b/t/creation-code
new file mode 100755
index 0000000..e71f283
--- /dev/null
+++ b/t/creation-code
@@ -0,0 +1,59 @@
+#!/bin/sh
+# Ensure that bucket,object,attribute-creation all succeed with code 201.
+
+. "${srcdir=.}/init.sh"; path_prepend_ ..
+
+mkdir FS mongod iwhd || framework_failure_ mkdir failed
+
+m_port=$(get_port $mongo_base_port $lock_dir/m-) \
+ || fail_ "failed to get mongodb port"
+
+mongod --help > /dev/null || fail_ "the mongod program is not installed"
+
+mongod --port $m_port --pidfilepath mongod/pid --dbpath mongod > mongod.log 2>&1 &
+mongo_pid=$!
+cleanup_() { kill -9 $mongo_pid; }
+
+# Wait for up to 5 seconds for mongod to begin listening.
+wait_for .1 50 'mongo localhost:$m_port < /dev/null' \
+ || framework_failure_ mongod failed to start
+
+port=$(get_port 9095 $lock_dir/i-) || fail_ "failed to get iwhd port"
+
+printf '[{"path": "FS", "type": "fs", "name": "primary"}]\n' \
+ > iwhd.cfg || fail=1
+
+iwhd -v -p $port -c iwhd.cfg -d localhost:$m_port &
+iwhd_pid=$!
+cleanup_() { kill -9 $mongo_pid; kill $iwhd_pid; }
+
+# Wait for up to 5 seconds for iwhd to begin listening on $port.
+wait_for .1 50 "curl -s http://localhost:$port" \
+ || { echo iwhd failed to listen; Exit 1; }
+
+
+curl_w() { curl --write-out '%{http_code}' "$@"; }
+
+# Show that bucket,object,attribute-creation all evoke 201.
+creation_evokes_201()
+{
+
+ # Create a bucket.
+ local b=http://localhost:$port/b9
+ curl_w -XPUT $b > http-code || fail=1
+ test "$(cat http-code)" = 201 || fail=1
+
+ # Create an object in that bucket.
+ local obj=$b/obj
+ curl_w -XPUT $obj > http-code || fail=1
+ test "$(cat http-code)" = 201 || fail=1
+
+ # Create an attribute.
+ local attr=$obj/color
+ printf blue | curl_w -T - $attr > http-code || fail=1
+ test "$(cat http-code)" = 201 || fail=1
+}
+
+creation_evokes_201
+
+Exit $fail
12 years, 11 months
[iwhd] build: do not require autoconf-2.65 (2.62 should be enough)
by Jim Meyering
commit 4fa67c27607643e0fa45c4a2139965972443c02b
Author: Jim Meyering <meyering(a)redhat.com>
Date: Tue Apr 26 10:53:52 2011 +0200
build: do not require autoconf-2.65 (2.62 should be enough)
* configure.ac: Remove AC_PREREQ([2.65]), to accommodate the
3.5-year-old autoconf-2.63 on RHEL-6. Note that bootstrap.conf
already requires autoconf-2.62.
Prompted by the FTBFS-on-RHEL-6.1 report from Dave Johnson
in http://bugzilla.redhat.com/699403
configure.ac | 1 -
1 files changed, 0 insertions(+), 1 deletions(-)
---
diff --git a/configure.ac b/configure.ac
index 4f65407..103c18a 100644
--- a/configure.ac
+++ b/configure.ac
@@ -16,7 +16,6 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
-AC_PREREQ([2.65])
AC_INIT([iwhd],
m4_esyscmd([build-aux/git-version-gen .tarball-version]),
[iwhd-devel(a)fedorahosted.org])
12 years, 11 months
[iwhd] tests: redirect mongod --help's stdout to /dev/null
by Jim Meyering
commit 997465cfa8080f04bbe368549d9e11e83f23a1e5
Author: Jim Meyering <meyering(a)redhat.com>
Date: Thu Apr 21 21:46:58 2011 +0200
tests: redirect mongod --help's stdout to /dev/null
* t/basic: as above. Suggestion from Pete Zaitcev.
t/basic | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
---
diff --git a/t/basic b/t/basic
index 3e88db9..800c08d 100644
--- a/t/basic
+++ b/t/basic
@@ -17,7 +17,7 @@ mkdir FS mongod iwhd || framework_failure_ mkdir failed
m_port=$(get_port $mongo_base_port $lock_dir/m-) \
|| fail_ "failed to get mongodb port"
-mongod --help || fail_ "the mongod program is not installed"
+mongod --help > /dev/null || fail_ "the mongod program is not installed"
mongod --port $m_port --pidfilepath mongod/pid --dbpath mongod > mongod.log 2>&1 &
mongo_pid=$!
12 years, 11 months
[iwhd] tests: clarify diag: missing mongod program, not the mongod package
by Jim Meyering
commit d8786131fddc38db0b05d41dd6de147ad91a92e0
Author: Jim Meyering <meyering(a)redhat.com>
Date: Thu Apr 21 14:10:19 2011 +0200
tests: clarify diag: missing mongod program, not the mongod package
Suggested by Justin Clift.
t/basic | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
---
diff --git a/t/basic b/t/basic
index 21859d4..3e88db9 100644
--- a/t/basic
+++ b/t/basic
@@ -17,7 +17,7 @@ mkdir FS mongod iwhd || framework_failure_ mkdir failed
m_port=$(get_port $mongo_base_port $lock_dir/m-) \
|| fail_ "failed to get mongodb port"
-mongod --help || fail_ "mongod is not installed"
+mongod --help || fail_ "the mongod program is not installed"
mongod --port $m_port --pidfilepath mongod/pid --dbpath mongod > mongod.log 2>&1 &
mongo_pid=$!
12 years, 11 months
[iwhd] tests: fail sooner (and with a good explanation) without mongod
by Jim Meyering
commit cc45ac972b56ea751f95762a39f7bfa3c2849a03
Author: Jim Meyering <meyering(a)redhat.com>
Date: Thu Apr 21 13:57:56 2011 +0200
tests: fail sooner (and with a good explanation) without mongod
* t/basic: Fail right away if mongod is not installed.
t/basic | 2 ++
1 files changed, 2 insertions(+), 0 deletions(-)
---
diff --git a/t/basic b/t/basic
index dfe28cd..21859d4 100644
--- a/t/basic
+++ b/t/basic
@@ -17,6 +17,8 @@ mkdir FS mongod iwhd || framework_failure_ mkdir failed
m_port=$(get_port $mongo_base_port $lock_dir/m-) \
|| fail_ "failed to get mongodb port"
+mongod --help || fail_ "mongod is not installed"
+
mongod --port $m_port --pidfilepath mongod/pid --dbpath mongod > mongod.log 2>&1 &
mongo_pid=$!
cleanup_() { kill -9 $mongo_pid; }
12 years, 11 months