From: Pete Zaitcev Subject: [Patch 6/8] CLD: cleanup: add a event stub just to test Date: Wed, 14 Apr 2010 12:35:08 -0600 Message-ID: <20100414123508.37c6f5a1@redhat.com> Mime-Version: 1.0 Content-Transfer-Encoding: 7bit Return-path: Sender: hail-devel-owner@vger.kernel.org List-ID: Content-Type: text/plain; charset="us-ascii" To: jeff@garzik.org Cc: Project Hail List Tests do not really need this kind of thing, in fact if everything goes well, we should NOT receive any events while test is running. Still, I am curious about being sure that we do not. This will also pop if we change something in the library implementation and start leaking some events. Signed-off-by: Pete Zaitcev --- test/lock-file.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/test/lock-file.c b/test/lock-file.c index 36cc62c..3bbe49b 100644 --- a/test/lock-file.c +++ b/test/lock-file.c @@ -31,6 +31,15 @@ #include #include "test.h" +static void sess_event(void *priv, unsigned int what) +{ + if (what == CE_SESS_FAILED) { + fprintf(stderr, "Session failed\n"); + exit(1); + } + fprintf(stderr, "Unknown event %d\n", what); +} + int main (int argc, char *argv[]) { struct ncld_sess *nsess; @@ -49,7 +58,7 @@ int main (int argc, char *argv[]) if (port == 0) return -1; - nsess = ncld_sess_open(TEST_HOST, port, &error, NULL, NULL, + nsess = ncld_sess_open(TEST_HOST, port, &error, sess_event, NULL, TEST_USER, TEST_USER_KEY, NULL); if (!nsess) { fprintf(stderr, "ncld_sess_open(host %s port %u) failed: %d\n",