ANNOUNCE release libqb-0.10.1
by Angus Salkeld
I have released 0.10.1 as a bug fix release.
It includes an important bug fix for corosync IPC
and some general code improvements.
See here for more details:
https://github.com/asalkeld/libqb/wiki#wiki-Releases
Regards
Angus Salkeld
Angus Salkeld (15):
TEST: make the loop ratelimit test more forgiving.
Increase the coverity aggressiveness
Use safer versions of string functions (strcpy -> strlcpy)
set umask before calling mkstemp()
Remove dead code
use random() not rand()
Don't mix enums (QB_TRUE/TRUE)
RB: Fix potential mem leak
RB: use the proper struct not the typedef in the implementation.
LOOP: make it possible to pass in NULL as the default loop instance
Be more consistent with the internal logs.
IPC: split up the recv into chuncks of 2 seconds.
RB: add a debug message if trying to read a message of the wrong size
TEST: make the ipc failure test closer to corosync's case.
clang: Remove unused code
The Quarterback Library Release Team (2):
Bump the version to 0.10.1
Fix "make distcheck" add include path to AM_CPPFLAGS
12 years, 2 months
[PATCH 1/3] IPC: split up the recv into chuncks of 2 seconds.
by Angus Salkeld
This is because semaphores can't detect the other side has
failed/exited. So we rely on the socket poll to tell us.
Signed-off-by: Angus Salkeld <asalkeld(a)redhat.com>
---
lib/ipc_int.h | 2 ++
lib/ipcc.c | 29 ++++++++++++++++++++++++++++-
2 files changed, 30 insertions(+), 1 deletions(-)
diff --git a/lib/ipc_int.h b/lib/ipc_int.h
index 67093fc..b4bdebc 100644
--- a/lib/ipc_int.h
+++ b/lib/ipc_int.h
@@ -39,6 +39,8 @@
#include <semaphore.h>
#endif /* HAVE_POSIX_SHARED_SEMAPHORE */
+#define QB_IPC_MAX_WAIT_MS 2000
+
/*
Client Server
SEND CONN REQ ->
diff --git a/lib/ipcc.c b/lib/ipcc.c
index e801538..cc664b4 100644
--- a/lib/ipcc.c
+++ b/lib/ipcc.c
@@ -220,6 +220,8 @@ qb_ipcc_sendv_recv(qb_ipcc_connection_t * c,
void *res_msg, size_t res_len, int32_t ms_timeout)
{
ssize_t res = 0;
+ int32_t timeout_now;
+ int32_t timeout_rem = ms_timeout;
if (c == NULL) {
return -EINVAL;
@@ -243,7 +245,32 @@ qb_ipcc_sendv_recv(qb_ipcc_connection_t * c,
return res;
}
- return qb_ipcc_recv(c, res_msg, res_len, ms_timeout);
+ do {
+ if (timeout_rem > QB_IPC_MAX_WAIT_MS || ms_timeout == -1) {
+ timeout_now = QB_IPC_MAX_WAIT_MS;
+ } else {
+ timeout_now = timeout_rem;
+ }
+
+ res = qb_ipcc_recv(c, res_msg, res_len, timeout_now);
+ if (res == -ETIMEDOUT) {
+ if (ms_timeout < 0) {
+ res = -EAGAIN;
+ } else {
+ timeout_rem -= timeout_now;
+ if (timeout_rem > 0) {
+ res = -EAGAIN;
+ }
+ }
+ } else if (res < 0 && res != -EAGAIN) {
+ errno = -res;
+ qb_util_perror(LOG_DEBUG,
+ "qb_ipcc_recv %d timeout:(%d/%d)",
+ res, timeout_now, timeout_rem);
+ }
+ } while (res == -EAGAIN && c->is_connected);
+
+ return res;
}
int32_t
--
1.7.7.6
12 years, 2 months
[PATCH] Be more consistent with the internal logs.
by Angus Salkeld
Signed-off-by: Angus Salkeld <asalkeld(a)redhat.com>
---
lib/ipc_shm.c | 24 +++++++++++++-----------
lib/log_blackbox.c | 3 ++-
2 files changed, 15 insertions(+), 12 deletions(-)
diff --git a/lib/ipc_shm.c b/lib/ipc_shm.c
index 73a1df4..752c92e 100644
--- a/lib/ipc_shm.c
+++ b/lib/ipc_shm.c
@@ -169,11 +169,13 @@ qb_ipcc_shm_connect(struct qb_ipcc_connection * c,
return -errno;
}
- c->request.u.shm.rb =
- qb_rb_open(response->request, c->request.max_msg_size,
- QB_RB_FLAG_SHARED_PROCESS, sizeof(int32_t));
+ c->request.u.shm.rb = qb_rb_open(response->request,
+ c->request.max_msg_size,
+ QB_RB_FLAG_SHARED_PROCESS,
+ sizeof(int32_t));
if (c->request.u.shm.rb == NULL) {
res = -errno;
+ qb_util_perror(LOG_ERR, "qb_rb_open:REQUEST");
goto return_error;
}
c->response.u.shm.rb = qb_rb_open(response->response,
@@ -182,7 +184,7 @@ qb_ipcc_shm_connect(struct qb_ipcc_connection * c,
if (c->response.u.shm.rb == NULL) {
res = -errno;
- perror("qb_rb_open:RESPONSE");
+ qb_util_perror(LOG_ERR, "qb_rb_open:RESPONSE");
goto cleanup_request;
}
c->event.u.shm.rb = qb_rb_open(response->event,
@@ -191,7 +193,7 @@ qb_ipcc_shm_connect(struct qb_ipcc_connection * c,
if (c->event.u.shm.rb == NULL) {
res = -errno;
- perror("qb_rb_open:EVENT");
+ qb_util_perror(LOG_ERR, "qb_rb_open:EVENT");
goto cleanup_request_response;
}
return 0;
@@ -254,12 +256,12 @@ qb_ipcs_shm_connect(struct qb_ipcs_service *s,
sizeof(int32_t));
if (c->request.u.shm.rb == NULL) {
res = -errno;
- perror("qb_rb_open:REQUEST");
+ qb_util_perror(LOG_ERR, "qb_rb_open:REQUEST");
goto cleanup;
}
res = qb_rb_chown(c->request.u.shm.rb, c->euid, c->egid);
if (res != 0) {
- qb_perror(LOG_ERR, "qb_rb_chown:REQUEST");
+ qb_util_perror(LOG_ERR, "qb_rb_chown:REQUEST");
goto cleanup;
}
@@ -269,12 +271,12 @@ qb_ipcs_shm_connect(struct qb_ipcs_service *s,
QB_RB_FLAG_SHARED_PROCESS, 0);
if (c->response.u.shm.rb == NULL) {
res = -errno;
- qb_perror(LOG_ERR, "qb_rb_open:RESPONSE");
+ qb_util_perror(LOG_ERR, "qb_rb_open:RESPONSE");
goto cleanup_request;
}
res = qb_rb_chown(c->response.u.shm.rb, c->euid, c->egid);
if (res != 0) {
- qb_perror(LOG_ERR, "qb_rb_chown:RESPONSE");
+ qb_util_perror(LOG_ERR, "qb_rb_chown:RESPONSE");
goto cleanup_request;
}
@@ -285,12 +287,12 @@ qb_ipcs_shm_connect(struct qb_ipcs_service *s,
if (c->event.u.shm.rb == NULL) {
res = -errno;
- qb_perror(LOG_ERR, "qb_rb_open:EVENT");
+ qb_util_perror(LOG_ERR, "qb_rb_open:EVENT");
goto cleanup_request_response;
}
res = qb_rb_chown(c->event.u.shm.rb, c->euid, c->egid);
if (res != 0) {
- qb_perror(LOG_ERR, "qb_rb_chown:EVENT");
+ qb_util_perror(LOG_ERR, "qb_rb_chown:EVENT");
goto cleanup_all;
}
diff --git a/lib/log_blackbox.c b/lib/log_blackbox.c
index 1c07c2e..e2a1f7e 100644
--- a/lib/log_blackbox.c
+++ b/lib/log_blackbox.c
@@ -21,6 +21,7 @@
#include "os_base.h"
#include <qb/qbrb.h>
+#include "util_int.h"
#include "log_int.h"
static void
@@ -147,7 +148,7 @@ qb_log_blackbox_print_from_file(const char *bb_filename)
fd = open(bb_filename, 0);
if (fd < 0) {
- qb_perror(LOG_ERR, "qb_log_blackbox_print_from_file");
+ qb_util_perror(LOG_ERR, "qb_log_blackbox_print_from_file");
return;
}
instance = qb_rb_create_from_file(fd, 0);
--
1.7.7.6
12 years, 2 months
[PATCH] LOOP: make it possible to pass in NULL as the default loop instance
by Angus Salkeld
Signed-off-by: Angus Salkeld <asalkeld(a)redhat.com>
---
lib/loop.c | 15 ++++++++++++
lib/loop_int.h | 3 ++
lib/loop_job.c | 6 ++++-
lib/loop_poll.c | 62 +++++++++++++++++++++++++++++++++++++++++---------
lib/loop_timerlist.c | 27 +++++++++++++++++----
tests/check_loop.c | 19 ++++++++++++---
6 files changed, 111 insertions(+), 21 deletions(-)
diff --git a/lib/loop.c b/lib/loop.c
index f996f1f..a529bb3 100644
--- a/lib/loop.c
+++ b/lib/loop.c
@@ -26,6 +26,8 @@
#include "loop_int.h"
#include "util_int.h"
+static struct qb_loop *default_intance = NULL;
+
static void
qb_loop_run_level(struct qb_loop_level *level)
{
@@ -69,6 +71,12 @@ qb_loop_level_item_del(struct qb_loop_level *level, struct qb_loop_item *job)
}
struct qb_loop *
+qb_loop_default_get(void)
+{
+ return default_intance;
+}
+
+struct qb_loop *
qb_loop_create(void)
{
struct qb_loop *l = malloc(sizeof(struct qb_loop));
@@ -93,6 +101,9 @@ qb_loop_create(void)
l->fd_source = qb_loop_poll_create(l);
l->signal_source = qb_loop_signals_create(l);
+ if (default_intance == NULL) {
+ default_intance = l;
+ }
return l;
}
@@ -103,6 +114,10 @@ qb_loop_destroy(struct qb_loop *l)
qb_loop_jobs_destroy(l);
qb_loop_poll_destroy(l);
qb_loop_signals_destroy(l);
+
+ if (default_intance == l) {
+ default_intance = NULL;
+ }
free(l);
}
diff --git a/lib/loop_int.h b/lib/loop_int.h
index 84c18cd..672be21 100644
--- a/lib/loop_int.h
+++ b/lib/loop_int.h
@@ -66,6 +66,9 @@ struct qb_loop {
struct qb_loop_source * signal_source;
};
+struct qb_loop *
+qb_loop_default_get(void);
+
struct qb_loop_source *
qb_loop_jobs_create(struct qb_loop *l);
diff --git a/lib/loop_job.c b/lib/loop_job.c
index 32aa7b9..3f261f2 100644
--- a/lib/loop_job.c
+++ b/lib/loop_job.c
@@ -87,12 +87,16 @@ qb_loop_jobs_destroy(struct qb_loop *l)
}
int32_t
-qb_loop_job_add(struct qb_loop *l,
+qb_loop_job_add(struct qb_loop *lp,
enum qb_loop_priority p,
void *data, qb_loop_job_dispatch_fn dispatch_fn)
{
struct qb_loop_job *job;
+ struct qb_loop *l = lp;
+ if (l == NULL) {
+ l = qb_loop_default_get();
+ }
if (l == NULL || dispatch_fn == NULL) {
return -EINVAL;
}
diff --git a/lib/loop_poll.c b/lib/loop_poll.c
index ae4286c..c798633 100644
--- a/lib/loop_poll.c
+++ b/lib/loop_poll.c
@@ -550,7 +550,7 @@ _qb_poll_add_to_jobs_(struct qb_loop *l, struct qb_poll_entry *pe)
}
int32_t
-qb_loop_poll_add(struct qb_loop * l,
+qb_loop_poll_add(struct qb_loop * lp,
enum qb_loop_priority p,
int32_t fd,
int32_t events,
@@ -560,6 +560,11 @@ qb_loop_poll_add(struct qb_loop * l,
int32_t size;
int32_t new_size;
int32_t res;
+ struct qb_loop *l = lp;
+
+ if (l == NULL) {
+ l = qb_loop_default_get();
+ }
size = ((struct qb_poll_source *)l->fd_source)->poll_entry_count;
res = _poll_add_(l, p, fd, events, data, &pe);
@@ -578,7 +583,7 @@ qb_loop_poll_add(struct qb_loop * l,
}
int32_t
-qb_loop_poll_mod(struct qb_loop * l,
+qb_loop_poll_mod(struct qb_loop * lp,
enum qb_loop_priority p,
int32_t fd,
int32_t events,
@@ -587,10 +592,16 @@ qb_loop_poll_mod(struct qb_loop * l,
uint32_t i;
int32_t res = 0;
struct qb_poll_entry *pe;
- struct qb_poll_source *s = (struct qb_poll_source *)l->fd_source;
+ struct qb_poll_source *s;
#ifdef HAVE_EPOLL
struct epoll_event ev;
#endif /* HAVE_EPOLL */
+ struct qb_loop *l = lp;
+
+ if (l == NULL) {
+ l = qb_loop_default_get();
+ }
+ s = (struct qb_poll_source *)l->fd_source;
/*
* Find file descriptor to modify events and dispatch function
@@ -626,13 +637,18 @@ qb_loop_poll_mod(struct qb_loop * l,
}
int32_t
-qb_loop_poll_del(struct qb_loop * l, int32_t fd)
+qb_loop_poll_del(struct qb_loop * lp, int32_t fd)
{
int32_t i;
int32_t res = 0;
struct qb_poll_entry *pe;
- struct qb_poll_source *s = (struct qb_poll_source *)l->fd_source;
+ struct qb_poll_source *s;
+ struct qb_loop *l = lp;
+ if (l == NULL) {
+ l = qb_loop_default_get();
+ }
+ s = (struct qb_poll_source *)l->fd_source;
for (i = 0; i < s->poll_entry_count; i++) {
assert(qb_array_index(s->poll_entries, i, (void **)&pe) == 0);
if (pe->ufd.fd != fd || pe->item.type != QB_LOOP_FD) {
@@ -706,7 +722,7 @@ qb_loop_timer_destroy(struct qb_loop *l)
}
int32_t
-qb_loop_timer_add(struct qb_loop *l,
+qb_loop_timer_add(struct qb_loop *lp,
enum qb_loop_priority p,
uint64_t nsec_duration,
void *data,
@@ -718,7 +734,11 @@ qb_loop_timer_add(struct qb_loop *l,
int32_t res;
int32_t size, new_size;
struct itimerspec its;
+ struct qb_loop *l = lp;
+ if (l == NULL) {
+ l = qb_loop_default_get();
+ }
if (l == NULL || timer_fn == NULL) {
qb_util_log(LOG_ERR,
"can't add a timer with either (l == NULL || timer_fn == NULL)");
@@ -769,12 +789,16 @@ close_and_return:
}
int32_t
-qb_loop_timer_del(struct qb_loop * l, qb_loop_timer_handle th)
+qb_loop_timer_del(struct qb_loop * lp, qb_loop_timer_handle th)
{
struct qb_poll_entry *pe;
struct qb_poll_source *s;
int32_t res;
+ struct qb_loop *l = lp;
+ if (l == NULL) {
+ l = qb_loop_default_get();
+ }
if (l == NULL || th == 0) {
return -EINVAL;
}
@@ -823,13 +847,17 @@ qb_loop_timer_del(struct qb_loop * l, qb_loop_timer_handle th)
}
uint64_t
-qb_loop_timer_expire_time_get(struct qb_loop * l, qb_loop_timer_handle th)
+qb_loop_timer_expire_time_get(struct qb_loop * lp, qb_loop_timer_handle th)
{
struct qb_poll_entry *pe;
struct qb_poll_source *s;
int32_t res = 0;
struct itimerspec its;
+ struct qb_loop *l = lp;
+ if (l == NULL) {
+ l = qb_loop_default_get();
+ }
if (l == NULL || th == 0) {
return 0;
}
@@ -1044,7 +1072,7 @@ _adjust_sigactions_(struct qb_signal_source *s)
}
int32_t
-qb_loop_signal_add(qb_loop_t * l,
+qb_loop_signal_add(qb_loop_t * lp,
enum qb_loop_priority p,
int32_t the_sig,
void *data,
@@ -1053,7 +1081,11 @@ qb_loop_signal_add(qb_loop_t * l,
{
struct qb_loop_sig *sig;
struct qb_signal_source *s;
+ struct qb_loop *l = lp;
+ if (l == NULL) {
+ l = qb_loop_default_get();
+ }
if (l == NULL || dispatch_fn == NULL) {
return -EINVAL;
}
@@ -1086,7 +1118,7 @@ qb_loop_signal_add(qb_loop_t * l,
}
int32_t
-qb_loop_signal_mod(qb_loop_t * l,
+qb_loop_signal_mod(qb_loop_t * lp,
enum qb_loop_priority p,
int32_t the_sig,
void *data,
@@ -1095,7 +1127,11 @@ qb_loop_signal_mod(qb_loop_t * l,
{
struct qb_signal_source *s;
struct qb_loop_sig *sig = (struct qb_loop_sig *)handle;
+ struct qb_loop *l = lp;
+ if (l == NULL) {
+ l = qb_loop_default_get();
+ }
if (l == NULL || dispatch_fn == NULL || handle == NULL) {
return -EINVAL;
}
@@ -1117,10 +1153,14 @@ qb_loop_signal_mod(qb_loop_t * l,
}
int32_t
-qb_loop_signal_del(qb_loop_t * l, qb_loop_signal_handle handle)
+qb_loop_signal_del(qb_loop_t * lp, qb_loop_signal_handle handle)
{
struct qb_loop_sig *sig = (struct qb_loop_sig *)handle;
+ struct qb_loop *l = lp;
+ if (l == NULL) {
+ l = qb_loop_default_get();
+ }
qb_list_del(&sig->item.list);
free(sig);
return 0;
diff --git a/lib/loop_timerlist.c b/lib/loop_timerlist.c
index 7e7cb19..dc28a55 100644
--- a/lib/loop_timerlist.c
+++ b/lib/loop_timerlist.c
@@ -171,7 +171,7 @@ _get_empty_array_position_(struct qb_timer_source *s)
}
int32_t
-qb_loop_timer_add(struct qb_loop * l,
+qb_loop_timer_add(struct qb_loop * lp,
enum qb_loop_priority p,
uint64_t nsec_duration,
void *data,
@@ -181,6 +181,11 @@ qb_loop_timer_add(struct qb_loop * l,
struct qb_loop_timer *t;
struct qb_timer_source *my_src;
int32_t i;
+ struct qb_loop *l = lp;
+
+ if (l == NULL) {
+ l = qb_loop_default_get();
+ }
if (l == NULL || timer_fn == NULL) {
return -EINVAL;
@@ -214,11 +219,17 @@ qb_loop_timer_add(struct qb_loop * l,
}
int32_t
-qb_loop_timer_del(struct qb_loop * l, qb_loop_timer_handle th)
+qb_loop_timer_del(struct qb_loop * lp, qb_loop_timer_handle th)
{
- struct qb_timer_source *s = (struct qb_timer_source *)l->timer_source;
+ struct qb_timer_source *s;
struct qb_loop_timer *t;
int32_t res;
+ struct qb_loop *l = lp;
+
+ if (l == NULL) {
+ l = qb_loop_default_get();
+ }
+ s = (struct qb_timer_source *)l->timer_source;
res = _timer_from_handle_(s, th, &t);
if (res != 0) {
@@ -243,11 +254,17 @@ qb_loop_timer_del(struct qb_loop * l, qb_loop_timer_handle th)
}
uint64_t
-qb_loop_timer_expire_time_get(struct qb_loop * l, qb_loop_timer_handle th)
+qb_loop_timer_expire_time_get(struct qb_loop * lp, qb_loop_timer_handle th)
{
- struct qb_timer_source *s = (struct qb_timer_source *)l->timer_source;
+ struct qb_timer_source *s;
struct qb_loop_timer *t;
int32_t res;
+ struct qb_loop *l = lp;
+
+ if (l == NULL) {
+ l = qb_loop_default_get();
+ }
+ s = (struct qb_timer_source *)l->timer_source;
res = _timer_from_handle_(s, th, &t);
if (res != 0) {
diff --git a/tests/check_loop.c b/tests/check_loop.c
index f135cb1..3090faf 100644
--- a/tests/check_loop.c
+++ b/tests/check_loop.c
@@ -107,11 +107,16 @@ static void job_1_add_nuts(void *data)
START_TEST(test_loop_job_input)
{
int32_t res;
- qb_loop_t *l = qb_loop_create();
- fail_if(l == NULL);
+ qb_loop_t *l;
res = qb_loop_job_add(NULL, QB_LOOP_LOW, NULL, job_2);
ck_assert_int_eq(res, -EINVAL);
+
+ l = qb_loop_create();
+ fail_if(l == NULL);
+
+ res = qb_loop_job_add(NULL, QB_LOOP_LOW, NULL, job_2);
+ ck_assert_int_eq(res, 0);
res = qb_loop_job_add(l, 89, NULL, job_2);
ck_assert_int_eq(res, -EINVAL);
res = qb_loop_job_add(l, QB_LOOP_LOW, NULL, NULL);
@@ -255,11 +260,17 @@ static qb_loop_timer_handle test_th;
START_TEST(test_loop_timer_input)
{
int32_t res;
- qb_loop_t *l = qb_loop_create();
- fail_if(l == NULL);
+ qb_loop_t *l;
res = qb_loop_timer_add(NULL, QB_LOOP_LOW, 5*QB_TIME_NS_IN_MSEC, NULL, job_2, &test_th);
ck_assert_int_eq(res, -EINVAL);
+
+ l = qb_loop_create();
+ fail_if(l == NULL);
+
+ res = qb_loop_timer_add(NULL, QB_LOOP_LOW, 5*QB_TIME_NS_IN_MSEC, NULL, job_2, &test_th);
+ ck_assert_int_eq(res, 0);
+
res = qb_loop_timer_add(l, QB_LOOP_LOW, 5*QB_TIME_NS_IN_MSEC, l, NULL, &test_th);
ck_assert_int_eq(res, -EINVAL);
qb_loop_destroy(l);
--
1.7.7.6
12 years, 2 months
qb_util_set_log_function DEPRECATED
by Dietmar Maurer
I just noticed that qb_util_set_log_function is declared DEPRECATED.
So what should I use instead (I want to log libqb messages).
- Dietmar
12 years, 2 months
qblog question
by Dietmar Maurer
I want to adjust logging level when enable/disable debug mode - can I do it that way?
static void update_log_filters(int debug) {
if (debug) {
qb_log_filter_ctl(QB_LOG_SYSLOG, QB_LOG_FILTER_ADD,
QB_LOG_FILTER_FILE, "*", LOG_DEBUG);
} else {
qb_log_filter_ctl(QB_LOG_SYSLOG, QB_LOG_FILTER_ADD,
QB_LOG_FILTER_FILE, "*", LOG_INFO);
}
}
Or what is the suggested way?
- Dietmar
12 years, 2 months
[PATCH 1/8] Increase the coverity aggressiveness
by Angus Salkeld
Signed-off-by: Angus Salkeld <asalkeld(a)redhat.com>
---
check | 8 +++++++-
1 files changed, 7 insertions(+), 1 deletions(-)
diff --git a/check b/check
index 24b3f0d..6fd2882 100755
--- a/check
+++ b/check
@@ -166,7 +166,13 @@ check_mock() {
check_coverity() {
make clean
cov-build --dir=cov make
- cov-analyze --dir cov --concurrency --wait-for-license
+ cov-analyze --dir cov \
+ --concurrency \
+ --all \
+ --aggressiveness-level high \
+ --enable MISRA_CAST \
+ --security \
+ --wait-for-license
cov-format-errors --dir cov
}
--
1.7.7.6
12 years, 2 months
[PATCH] TEST: make the loop ratelimit test more forgiving.
by Angus Salkeld
Signed-off-by: Angus Salkeld <asalkeld(a)redhat.com>
---
tests/check_loop.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/tests/check_loop.c b/tests/check_loop.c
index eb79a51..f135cb1 100644
--- a/tests/check_loop.c
+++ b/tests/check_loop.c
@@ -210,7 +210,7 @@ START_TEST(test_job_rate_limit)
* and cause cpu spin. We are going to say that a spin is more than
* one job per 50ms if there is only one job pending in the loop.
*/
- _ck_assert_int(job_1_run_count, <, (RATE_LIMIT_RUNTIME_SEC * (QB_TIME_MS_IN_SEC/50)) + 1);
+ _ck_assert_int(job_1_run_count, <, (RATE_LIMIT_RUNTIME_SEC * (QB_TIME_MS_IN_SEC/50)) + 10);
qb_loop_destroy(l);
qb_util_stopwatch_free(rl_sw);
}
--
1.7.7.6
12 years, 2 months
regression test errors in loop.test
by Dietmar Maurer
Just compiled the latest 0.10.0 release and got:
=======================================
libqb 0.10.0: tests/test-suite.log
========================================
1 of 8 tests failed.
.. contents:: :depth: 2
FAIL: loop.test (exit: 1)
=========================
Running suite(s): loop_job
loop_timers
[error] can't add a timer with either (l == NULL || timer_fn == NULL)
[error] can't add a timer with either (l == NULL || timer_fn == NULL)
average error for 1500000 ns timer is 121723 (ns) (8.114895)
average error for 10500000 ns timer is 101712 (ns) (0.968686)
average error for 19500000 ns timer is 101931 (ns) (0.522726)
average error for 28500000 ns timer is 111700 (ns) (0.391933)
average error for 37500000 ns timer is 103482 (ns) (0.275953)
average error for 46500000 ns timer is 124853 (ns) (0.268501)
average error for 55500000 ns timer is 123825 (ns) (0.223110)
average error for 64500000 ns timer is 125102 (ns) (0.193957)
average error for 73500000 ns timer is 136308 (ns) (0.185453)
average error for 82500000 ns timer is 146708 (ns) (0.177828)
average error for 100000000 ns timer is 146534 (ns) (0.146535)
loop_signal_suite
90%: Checks: 10, Failures: 1, Errors: 0
check_loop.c:118:P:limits:test_loop_job_input:0: Passed
check_loop.c:135:P:run_one:test_loop_job_1:0: Passed
check_loop.c:152:P:run_recursive:test_loop_job_4:0: Passed
check_loop.c:167:P:run_500:test_loop_job_nuts:0: Passed
check_loop.c:213:F:rate_limit:test_job_rate_limit:0: Assertion 'job_1_run_count<(RATE_LIMIT_RUNTIME_SEC * (QB_TIME_MS_IN_SEC/50)) + 1' failed: job_1_run_count==61, (RATE_LIMIT_RUNTIME_SEC * (QB_TIME_MS_IN_SEC/50)) + 1==61
check_loop.c:264:P:limits:test_loop_timer_input:0: Passed
check_loop.c:309:P:basic:test_loop_timer_basic:0: Passed
check_loop.c:338:P:precision:test_loop_timer_precision:0: Passed
check_loop.c:458:P:expire_leak:test_loop_timer_expire_leak:0: Passed
check_loop.c:492:P:signals:test_loop_sig_handling:0: Passed
The test passes if I use <= in the assertion:
_ck_assert_int(job_1_run_count, <=, (RATE_LIMIT_RUNTIME_SEC * (QB_TIME_MS_IN_SEC/50)) + 1);
- Dietmar
12 years, 2 months
ANNOUNCE release 0.10.0
by Angus Salkeld
I have released libqb-0.10.0
It is mainly a bug fix release for corosync but also some
stopwatch improvements for pacemaker-cloud.
You can find all the bits here:
https://github.com/asalkeld/libqb/wiki#wiki-Releases
If you are wondering whats up with all the coverity warnings
it's because I have increased the level from default to maximum.
Regards
Angus Salkeld
12 years, 2 months