summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorKeith Bostic <keith@wiredtiger.com>2013-01-21 12:36:03 +0000
committerKeith Bostic <keith@wiredtiger.com>2013-01-21 12:36:03 +0000
commit17bc2422d6c94e129faae70a76cdcddb78fcd50f (patch)
treecd153a3ff9b9a13ae5043462fd4c6e8fd1b346ab /test
parentcf67fbcce9355e4e9f526a3b8d9c16dae63572f0 (diff)
downloadmongo-17bc2422d6c94e129faae70a76cdcddb78fcd50f.tar.gz
Add the hooks to make it easy to bring in an LZO handler.
Diffstat (limited to 'test')
-rw-r--r--test/format/Makefile.am13
-rw-r--r--test/format/config.c29
-rw-r--r--test/format/config.h4
-rw-r--r--test/format/format.h9
-rwxr-xr-xtest/format/s_dumpcmp.sh5
-rw-r--r--test/format/wts.c12
6 files changed, 46 insertions, 26 deletions
diff --git a/test/format/Makefile.am b/test/format/Makefile.am
index 4936f43f6cb..58bc644c58d 100644
--- a/test/format/Makefile.am
+++ b/test/format/Makefile.am
@@ -10,13 +10,20 @@ t_LDADD = $(top_builddir)/libwiredtiger.la -L$(BDB)/build_unix -ldb
t_LDFLAGS = -static
noinst_LTLIBRARIES = raw_compress.la
-raw_compress_la_SOURCES = \
- $(top_srcdir)/ext/compressors/bzip2/bzip2_compress.c
-raw_compress_la_LIBADD = -lbz2
+#noinst_LTLIBRARIES = lzo_compress.la raw_compress.la
+
+# libtool hack: noinst_LTLIBRARIES turns off building shared libraries as well
+# as installation, it will only build static libraries. As far as I can tell,
+# the "approved" libtool way to turn them back on is by adding -rpath.
+#lzo_compress_la_SOURCES = lzo_compress.c
+#lzo_compress_la_LIBADD = -llzo2 -lm
+#lzo_compress_la_LDFLAGS = -avoid-version -module -rpath /nowhere
# libtool hack: noinst_LTLIBRARIES turns off building shared libraries as well
# as installation, it will only build static libraries. As far as I can tell,
# the "approved" libtool way to turn them back on is by adding -rpath.
+raw_compress_la_SOURCES = $(top_srcdir)/ext/compressors/bzip2/bzip2_compress.c
+raw_compress_la_LIBADD = -lbz2
raw_compress_la_LDFLAGS = -avoid-version -module -rpath /nowhere
s_dumpcmp: $(srcdir)/s_dumpcmp.sh
diff --git a/test/format/config.c b/test/format/config.c
index 24ad4651d43..2dab5deff42 100644
--- a/test/format/config.c
+++ b/test/format/config.c
@@ -133,11 +133,8 @@ config_setup(void)
*cp->v = 0;
/* Multi-threaded runs cannot be replayed. */
- if (g.replay && !SINGLETHREADED) {
- fprintf(stderr,
- "%s: -r is incompatible with threaded runs\n", g.progname);
- exit(EXIT_FAILURE);
- }
+ if (g.replay && !SINGLETHREADED)
+ die(0, "%s: -r is incompatible with threaded runs", g.progname);
/*
* Periodically, set the delete percentage to 0 so salvage gets run,
@@ -167,6 +164,8 @@ config_compression(void)
/*
* Compression: choose something if compression wasn't specified,
* otherwise confirm the appropriate shared library is available.
+ * We don't include LZO in the test compression choices, we don't
+ * yet have an LZO module of our own.
*/
cp = config_find("compression", strlen("compression"));
if (!(cp->flags & C_PERM)) {
@@ -196,18 +195,16 @@ config_compression(void)
switch (g.compression) {
case COMPRESS_BZIP:
case COMPRESS_RAW:
- if (access(BZIP_PATH, R_OK) != 0) {
- fprintf(stderr,
- "bzip library not found or not readable\n");
- exit(EXIT_FAILURE);
- }
+ if (access(BZIP_PATH, R_OK) != 0)
+ die(0, "bzip library not found or not readable");
+ break;
+ case COMPRESS_LZO:
+ if (access(LZO_PATH, R_OK) != 0)
+ die(0, "LZO library not found or not readable");
break;
case COMPRESS_SNAPPY:
- if (access(SNAPPY_PATH, R_OK) != 0) {
- fprintf(stderr,
- "snappy library not found or not readable\n");
- exit(EXIT_FAILURE);
- }
+ if (access(SNAPPY_PATH, R_OK) != 0)
+ die(0, "snappy library not found or not readable");
}
}
@@ -403,6 +400,8 @@ config_translate(const char *s)
return (COMPRESS_NONE);
if (strcmp(s, "bzip") == 0)
return (COMPRESS_BZIP);
+ if (strcmp(s, "lzo") == 0)
+ return (COMPRESS_LZO);
if (strcmp(s, "raw") == 0)
return (COMPRESS_RAW);
if (strcmp(s, "snappy") == 0)
diff --git a/test/format/config.h b/test/format/config.h
index a333c3575d9..d0e639cf52d 100644
--- a/test/format/config.h
+++ b/test/format/config.h
@@ -79,8 +79,8 @@ static CONFIG c[] = {
0, 0, 1, 100, &g.c_cache, NULL },
{ "compression",
- "type of compression (none | bzip | raw | snappy)",
- 0, C_IGNORE|C_STRING, 1, 4, NULL, &g.c_compression },
+ "type of compression (none | bzip | lzo | raw | snappy)",
+ 0, C_IGNORE|C_STRING, 1, 5, NULL, &g.c_compression },
{ "data_source",
"type of data source to create (file | table | lsm)",
diff --git a/test/format/format.h b/test/format/format.h
index 73d467e5ff0..ae14f9dc661 100644
--- a/test/format/format.h
+++ b/test/format/format.h
@@ -53,7 +53,9 @@
EXTPATH "compressors/snappy/.libs/libwiredtiger_snappy.so"
#define REVERSE_PATH \
EXTPATH "collators/reverse/.libs/libwiredtiger_reverse_collator.so"
-#define FC_PATH ".libs/raw_compress.so"
+
+#define LZO_PATH ".libs/lzo_compress.so"
+#define RAW_PATH ".libs/raw_compress.so"
#define M(v) ((v) * 1000000) /* Million */
#define UNUSED(var) (void)(var) /* Quiet unused var warnings */
@@ -97,8 +99,9 @@ typedef struct {
#define COMPRESS_NONE 1
#define COMPRESS_BZIP 2
-#define COMPRESS_RAW 3
-#define COMPRESS_SNAPPY 4
+#define COMPRESS_LZO 3
+#define COMPRESS_RAW 4
+#define COMPRESS_SNAPPY 5
u_int compression; /* Compression type */
char *config_open; /* Command-line configuration */
diff --git a/test/format/s_dumpcmp.sh b/test/format/s_dumpcmp.sh
index 9f1873934d0..2cd5c2b9839 100755
--- a/test/format/s_dumpcmp.sh
+++ b/test/format/s_dumpcmp.sh
@@ -33,10 +33,15 @@ if test $# -ne 0; then
fi
ext="\"$top/ext/collators/reverse/.libs/libwiredtiger_reverse_collator.so\""
+
bzip2_ext="$top/ext/compressors/bzip2/.libs/libwiredtiger_bzip2.so"
if test -e $bzip2_ext ; then
ext="$ext,\"$bzip2_ext\""
fi
+lzo_ext=".libs/lzo_compress.so"
+if test -e $lzo_ext ; then
+ ext="$ext,\"$lzo_ext\""
+fi
raw_ext=".libs/raw_compress.so"
if test -e $raw_ext ; then
ext="$ext,\"$raw_ext\""
diff --git a/test/format/wts.c b/test/format/wts.c
index 7d5aa5bf06e..5e489a62b39 100644
--- a/test/format/wts.c
+++ b/test/format/wts.c
@@ -76,12 +76,14 @@ wts_open(void)
*/
snprintf(config, sizeof(config),
"create,error_prefix=\"%s\",cache_size=%" PRIu32 "MB,sync=false,"
- "extensions=[\"%s\", \"%s\", \"%s\", \"%s\"],%s,%s",
+ "extensions=[\"%s\", \"%s\", \"%s\", \"%s\", \"%s\"],%s,%s",
g.progname, g.c_cache,
+ REVERSE_PATH,
access(BZIP_PATH, R_OK) == 0 ? BZIP_PATH : "",
+ access(LZO_PATH, R_OK) == 0 ? LZO_PATH : "",
+ (access(RAW_PATH, R_OK) == 0 &&
+ access(BZIP_PATH, R_OK) == 0) ? RAW_PATH : "",
access(SNAPPY_PATH, R_OK) == 0 ? SNAPPY_PATH : "",
- access(BZIP_PATH, R_OK) == 0 ? FC_PATH : "",
- REVERSE_PATH,
g.c_config_open == NULL ? "" : g.c_config_open,
g.config_open == NULL ? "" : g.config_open);
@@ -170,6 +172,10 @@ wts_open(void)
p += snprintf(p, (size_t)(end - p),
",block_compressor=\"bzip2\"");
break;
+ case COMPRESS_LZO:
+ p += snprintf(p, (size_t)(end - p),
+ ",block_compressor=\"LZO1B-6\"");
+ break;
case COMPRESS_RAW:
p += snprintf(p, (size_t)(end - p),
",block_compressor=\"raw\"");