chiark
/
gitweb
/
~ianmdlvl
/
elogind.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
bus-proxy: also consider ENOTCONN a clean termination condition
[elogind.git]
/
src
/
journal
/
test-compress-benchmark.c
diff --git
a/src/journal/test-compress-benchmark.c
b/src/journal/test-compress-benchmark.c
index 0a23bd1e131d5e9c161c90576471e271cabe5bb8..c8e5b76c6ce29e234d8a8d2b2e6c7602e6ed9864 100644
(file)
--- a/
src/journal/test-compress-benchmark.c
+++ b/
src/journal/test-compress-benchmark.c
@@
-21,9
+21,9
@@
#include "util.h"
#include "macro.h"
#include "util.h"
#include "macro.h"
-typedef int (compress_t)(const void *src, uint64_t src_size, void *dst,
uint64
_t *dst_size);
+typedef int (compress_t)(const void *src, uint64_t src_size, void *dst,
size
_t *dst_size);
typedef int (decompress_t)(const void *src, uint64_t src_size,
typedef int (decompress_t)(const void *src, uint64_t src_size,
- void **dst,
uint64_t *dst_alloc_size, uint64_t* dst_size, uint64
_t dst_max);
+ void **dst,
size_t *dst_alloc_size, size_t* dst_size, size
_t dst_max);
#define MAX_SIZE (1024*1024LU)
#define MAX_SIZE (1024*1024LU)
@@
-32,7
+32,7
@@
static char* make_buf(size_t count) {
size_t i;
buf = malloc(count);
size_t i;
buf = malloc(count);
- assert(buf);
+ assert
_se
(buf);
for (i = 0; i < count; i++)
buf[i] = 'a' + i % ('z' - 'a' + 1);
for (i = 0; i < count; i++)
buf[i] = 'a' + i % ('z' - 'a' + 1);
@@
-42,7
+42,7
@@
static char* make_buf(size_t count) {
static void test_compress_decompress(const char* label,
compress_t compress, decompress_t decompress) {
static void test_compress_decompress(const char* label,
compress_t compress, decompress_t decompress) {
- usec_t n, n2;
+ usec_t n, n2
= 0
;
float dt;
_cleanup_free_ char *text, *buf;
float dt;
_cleanup_free_ char *text, *buf;
@@
-52,7
+52,7
@@
static void test_compress_decompress(const char* label,
text = make_buf(MAX_SIZE);
buf = calloc(MAX_SIZE + 1, 1);
text = make_buf(MAX_SIZE);
buf = calloc(MAX_SIZE + 1, 1);
- assert(text && buf);
+ assert
_se
(text && buf);
n = now(CLOCK_MONOTONIC);
n = now(CLOCK_MONOTONIC);
@@
-61,25
+61,25
@@
static void test_compress_decompress(const char* label,
int r;
r = compress(text, i, buf, &j);
int r;
r = compress(text, i, buf, &j);
- /* assume compres
ion must be succe
sful except for small inputs */
- assert(r == 0 || (i < 2048 && r == -ENOBUFS));
+ /* assume compres
sion must be succes
sful except for small inputs */
+ assert
_se
(r == 0 || (i < 2048 && r == -ENOBUFS));
/* check for overwrites */
/* check for overwrites */
- assert(buf[i] == 0);
+ assert
_se
(buf[i] == 0);
if (r != 0) {
skipped += i;
continue;
}
if (r != 0) {
skipped += i;
continue;
}
- assert(j > 0);
+ assert
_se
(j > 0);
if (j >= i)
log_error("%s \"compressed\" %zu -> %zu", label, i, j);
r = decompress(buf, j, &buf2, &buf2_allocated, &k, 0);
if (j >= i)
log_error("%s \"compressed\" %zu -> %zu", label, i, j);
r = decompress(buf, j, &buf2, &buf2_allocated, &k, 0);
- assert(r == 0);
- assert(buf2_allocated >= k);
- assert(k == i);
+ assert
_se
(r == 0);
+ assert
_se
(buf2_allocated >= k);
+ assert
_se
(k == i);
- assert(memcmp(text, buf2, i) == 0);
+ assert
_se
(memcmp(text, buf2, i) == 0);
total += i;
compressed += j;
total += i;
compressed += j;