squat-test.c revision ab9be857a5ae00ac114ce00815509676ef972787
/* Copyright (c) 2006-2017 Dovecot authors, see the included COPYING file */
#include "lib.h"
#include "array.h"
#include "file-lock.h"
#include "istream.h"
#include "time-util.h"
#include "unichar.h"
#include "squat-trie.h"
#include "squat-uidlist.h"
#include <stdio.h>
#include <unistd.h>
#include <fcntl.h>
#include <time.h>
{
unsigned int i, count;
for (i = 0; i < count; i++) {
if (i != 0)
printf(",");
}
printf("\n");
}
{
const char *trie_path = "/tmp/squat-test-index.search";
const char *uidlist_path = "/tmp/squat-test-index.search.uids";
struct squat_trie *trie;
struct squat_trie_build_context *build_ctx;
enum squat_index_type index_type;
bool mime_header = TRUE;
double cputime;
lib_init();
clock_start = clock();
if (fd == -1)
return 1;
return 1;
ret = 0;
}
if (!first)
seq++;
data_header = TRUE;
mime_header = TRUE;
continue;
}
mime_header = TRUE;
}
if (mime_header) {
if (*line == '\0') {
data_header = FALSE;
mime_header = FALSE;
continue;
}
} else if (skip_body)
continue;
if (*line == '\0')
continue;
/* we're actually indexing here headers as bodies and bodies
as headers. it doesn't really matter in this test, and
fixing it would require storing headers temporarily
elsewhere and index them only after the body */
if (uni_utf8_get_valid_data((const unsigned char *)line,
}
}
buffer_free(&valid);
ret = -1;
if (ret < 0) {
printf("build broken\n");
return 1;
}
PRIuUOFF_T" (%.02f%%)\n",
&definite_uids, &maybe_uids);
if (ret < 0)
printf("error\n");
else {
printf(" - Search took %.05f CPU seconds\n",
printf(" - definite uids: ");
printf(" - maybe uids: ");
}
}
return 0;
}