From c3dae42cd31ca80b6864d1f50274e9a26e201252 Mon Sep 17 00:00:00 2001 From: Rusty Russell Date: Sun, 26 Sep 2010 17:00:32 +0930 Subject: [PATCH] tdb2: make sure summary always has a graph in it. We were getting occasional failures: if all values are the same it's a 1-line graph and there's no "|" anywhere. --- ccan/tdb2/test/run-summary.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/ccan/tdb2/test/run-summary.c b/ccan/tdb2/test/run-summary.c index d6ccf2fa..aff678da 100644 --- a/ccan/tdb2/test/run-summary.c +++ b/ccan/tdb2/test/run-summary.c @@ -28,9 +28,12 @@ int main(int argc, char *argv[]) continue; /* Put some stuff in there. */ - for (j = 0; j < 500; j++) + for (j = 0; j < 500; j++) { + /* Make sure padding varies to we get some graphs! */ + data.dsize = j % (sizeof(j) + 1); if (tdb_store(tdb, key, data, TDB_REPLACE) != 0) fail("Storing in tdb"); + } for (j = 0; j <= TDB_SUMMARY_HISTOGRAMS; @@ -38,7 +41,7 @@ int main(int argc, char *argv[]) summary = tdb_summary(tdb, j); ok1(strstr(summary, "Number of records: 500\n")); ok1(strstr(summary, "Smallest/average/largest keys: 4/4/4\n")); - ok1(strstr(summary, "Smallest/average/largest data: 4/4/4\n")); + ok1(strstr(summary, "Smallest/average/largest data: 0/2/4\n")); ok1(strstr(summary, "Free bucket 8")); ok1(strstr(summary, "Free bucket 16")); ok1(strstr(summary, "Free bucket 24")); -- 2.39.2