Skip to content
Snippets Groups Projects
Verified Commit 9c32656c authored by Oto Šťáva's avatar Oto Šťáva
Browse files

bench/bench_lru: make it build again, and check it in CI

It's not too important, but I just stumbled upon this and it looked like
nobody has touched it in a long time. Since it's not completely broken
(the fix is trivial), I decided to fix it and add it to CI to ensure
that we can still build it. Maybe `lru` will be used some more at some
point again in the future...
parent 4e9b2b67
1 merge request!1581bench/bench_lru: make it build again, and check it in CI
Pipeline #128468 waiting for manual action with stages
in 10 minutes and 21 seconds
......@@ -130,7 +130,7 @@ build-arch:
build-stable:
<<: *build
script:
- meson build_ci_stable --prefix=$PREFIX -Dmalloc=disabled -Dwerror=true -Dextra_tests=enabled
- meson build_ci_stable --prefix=$PREFIX -Dmalloc=disabled -Dwerror=true -Dextra_tests=enabled -Dbench=enabled
- ninja -C build_ci_stable
- ninja -C build_ci_stable install >/dev/null
- ${MESON_TEST} --suite unit --suite config --suite dnstap --no-suite snowflake
......
......@@ -13,13 +13,13 @@
#include "daemon/engine.h"
#include "lib/selection.h"
typedef kr_nsrep_lru_t lru_bench_t;
typedef lru_t(unsigned) lru_bench_t;
#define p_out(...) do { \
printf(__VA_ARGS__); \
fflush(stdout); \
} while (0)
#define p_err(...) fprintf(stderr, __VA_ARGS__)
(void)fflush(stdout); \
} while (0)
#define p_err(...) ((void)fprintf(stderr, __VA_ARGS__))
#ifndef LRU_RTT_SIZE
#define LRU_RTT_SIZE 65536 /**< NS RTT cache size */
......@@ -27,7 +27,7 @@ typedef kr_nsrep_lru_t lru_bench_t;
static int die(const char *cause)
{
fprintf(stderr, "%s: %s\n", cause, strerror(errno));
(void)fprintf(stderr, "%s: %s\n", cause, strerror(errno));
exit(1);
}
......@@ -171,7 +171,7 @@ int main(int argc, char ** argv)
struct key *keys = read_lines(argv[2], &key_count, &data_to_free);
size_t run_count;
{
size_t run_log = atoi(argv[1]);
size_t run_log = atoi(argv[1]); // NOLINT: atoi is fine for this tool...
assert(run_log < 64);
run_count = 1ULL << run_log;
p_err("\ntest run length:\t2^");
......@@ -179,7 +179,7 @@ int main(int argc, char ** argv)
}
struct timeval time;
const int lru_size = argc > 4 ? atoi(argv[4]) : LRU_RTT_SIZE;
const int lru_size = argc > 4 ? atoi(argv[4]) : LRU_RTT_SIZE; // NOLINT: ditto atoi
lru_bench_t *lru;
#ifdef lru_create
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment