summaryrefslogtreecommitdiff
path: root/test/format/config.c
diff options
context:
space:
mode:
Diffstat (limited to 'test/format/config.c')
-rw-r--r--test/format/config.c87
1 files changed, 48 insertions, 39 deletions
diff --git a/test/format/config.c b/test/format/config.c
index 866e210e556..d431546f254 100644
--- a/test/format/config.c
+++ b/test/format/config.c
@@ -244,45 +244,58 @@ config_compression(const char *conf_name)
const char *cstr;
char confbuf[128];
+ /* Return if already specified. */
+ if (config_is_perm(conf_name))
+ return;
+
/*
- * Compression: choose something if compression wasn't specified,
- * otherwise confirm the appropriate shared library is available.
- * We used to verify that the libraries existed but that's no longer
- * robust, since it's possible to build compression libraries into
- * the WiredTiger library.
+ * Don't configure a compression engine for logging if logging isn't
+ * configured (it won't break, but it's confusing).
*/
- if (!config_is_perm(conf_name)) {
- cstr = "none";
- switch (mmrand(NULL, 1, 20)) {
- case 1: case 2: case 3: case 4: /* 20% no compression */
- break;
- case 5: /* 5% bzip */
- cstr = "bzip";
- break;
- case 6: /* 5% bzip-raw */
- cstr = "bzip-raw";
- break;
- case 7: case 8: case 9: case 10: /* 20% lz4 */
- cstr = "lz4";
- break;
- case 11: /* 5% lz4-no-raw */
- cstr = "lz4-noraw";
- break;
- case 12: case 13: case 14: case 15: /* 20% snappy */
- cstr = "snappy";
- break;
- case 16: case 17: case 18: case 19: /* 20% zlib */
- cstr = "zlib";
- break;
- case 20: /* 5% zlib-no-raw */
- cstr = "zlib-noraw";
- break;
- }
-
- (void)snprintf(confbuf, sizeof(confbuf), "%s=%s", conf_name,
- cstr);
+ cstr = "none";
+ if (strcmp(conf_name, "logging_compression") == 0 && g.c_logging == 0) {
+ (void)snprintf(
+ confbuf, sizeof(confbuf), "%s=%s", conf_name, cstr);
config_single(confbuf, 0);
+ return;
}
+
+ /*
+ * Select a compression type from the list of built-in engines.
+ *
+ * Listed percentages are only correct if all of the possible engines
+ * are compiled in.
+ */
+ switch (mmrand(NULL, 1, 20)) {
+#ifdef HAVE_BUILTIN_EXTENSION_LZ4
+ case 1: case 2: case 3: case 4: /* 20% lz4 */
+ cstr = "lz4";
+ break;
+ case 5: /* 5% lz4-no-raw */
+ cstr = "lz4-noraw";
+ break;
+#endif
+#ifdef HAVE_BUILTIN_EXTENSION_SNAPPY
+ case 6: case 7: case 8: case 9: /* 30% snappy */
+ case 10: case 11:
+ cstr = "snappy";
+ break;
+#endif
+#ifdef HAVE_BUILTIN_EXTENSION_ZLIB
+ case 12: case 13: case 14: case 15: /* 20% zlib */
+ cstr = "zlib";
+ break;
+ case 16: /* 5% zlib-no-raw */
+ cstr = "zlib-noraw";
+ break;
+#endif
+ case 17: case 18: case 19: case 20: /* 20% no compression */
+ default:
+ break;
+ }
+
+ (void)snprintf(confbuf, sizeof(confbuf), "%s=%s", conf_name, cstr);
+ config_single(confbuf, 0);
}
/*
@@ -641,10 +654,6 @@ config_map_compression(const char *s, u_int *vp)
{
if (strcmp(s, "none") == 0)
*vp = COMPRESS_NONE;
- else if (strcmp(s, "bzip") == 0)
- *vp = COMPRESS_BZIP;
- else if (strcmp(s, "bzip-raw") == 0)
- *vp = COMPRESS_BZIP_RAW;
else if (strcmp(s, "lz4") == 0)
*vp = COMPRESS_LZ4;
else if (strcmp(s, "lz4-noraw") == 0)