13
13
along with this program; if not, write to the Free Software
14
14
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
18
17
#include <string.h>
19
18
#include <assert.h>
21
20
#include <string.h>
21
#include <mysys/my_getopt.h>
26
23
#if TIME_WITH_SYS_TIME
27
24
# include <sys/time.h>
72
72
printf("Testing %d\n", (int)method);
73
73
gettimeofday(&start_time, NULL);
74
small_test((az_method)method);
75
75
gettimeofday(&end_time, NULL);
76
76
timing= timedif(end_time, start_time);
77
77
printf("\tTime took %ld.%03ld seconds\n\n", timing / 1000, timing % 1000);
92
92
printf("Testing %"PRIu64" bytes with (%d)\n", row_lengths[x], (int)method);
93
93
gettimeofday(&start_time, NULL);
94
size_test(row_lengths[x], row_numbers[x], (az_method)method);
94
size_test(row_lengths[x], row_numbers[x], method);
95
95
gettimeofday(&end_time, NULL);
96
96
timing= timedif(end_time, start_time);
97
97
printf("\tTime took %ld.%03ld seconds\n\n", timing / 1000, timing % 1000);
101
drizzled::internal::my_end();
118
118
unlink(TEST_FILENAME);
120
if (!(ret= azopen(&writer_handle, TEST_FILENAME, O_CREAT|O_RDWR,
120
if (!(ret= azopen(&writer_handle, TEST_FILENAME, O_CREAT|O_RDWR|O_BINARY,
123
123
printf("Could not create test file\n");
127
azwrite_comment(&writer_handle, (char *)COMMENT_STRING,
127
azwrite_comment(&writer_handle, (char *)COMMENT_STRING,
128
128
(unsigned int)strlen(COMMENT_STRING));
129
129
azread_comment(&writer_handle, comment_str);
130
130
assert(!memcmp(COMMENT_STRING, comment_str,
131
131
strlen(COMMENT_STRING)));
133
azwrite_frm(&writer_handle, (char *)FRM_STRING,
133
azwrite_frm(&writer_handle, (char *)FRM_STRING,
134
134
(unsigned int)strlen(FRM_STRING));
135
135
azread_frm(&writer_handle, comment_str);
136
136
assert(!memcmp(FRM_STRING, comment_str,
137
137
strlen(FRM_STRING)));
140
if (!(ret= azopen(&reader_handle, TEST_FILENAME, O_RDONLY,
140
if (!(ret= azopen(&reader_handle, TEST_FILENAME, O_RDONLY|O_BINARY,
143
143
printf("Could not open test file\n");
185
185
azclose(&reader_handle);
187
if (!(ret= azopen(&reader_handle, TEST_FILENAME, O_RDONLY,
187
if (!(ret= azopen(&reader_handle, TEST_FILENAME, O_RDONLY|O_BINARY,
190
190
printf("Could not open test file\n");
239
239
assert(!memcmp(reader_handle.row_ptr, test_string, ret));
242
if (!(ret= azopen(&writer_handle, TEST_FILENAME, O_RDWR, method)))
242
if (!(ret= azopen(&writer_handle, TEST_FILENAME, O_RDWR|O_BINARY, method)))
244
244
printf("Could not open file (%s) for appending\n", TEST_FILENAME);
285
int size_test(uint64_t length, uint64_t rows_to_test_for,
285
int size_test(uint64_t length, uint64_t rows_to_test_for,
286
286
az_method method)
288
288
azio_stream writer_handle, reader_handle;
296
if (!(ret= azopen(&writer_handle, TEST_FILENAME,
297
O_CREAT|O_RDWR|O_TRUNC,
296
if (!(ret= azopen(&writer_handle, TEST_FILENAME,
297
O_CREAT|O_RDWR|O_TRUNC|O_BINARY,
300
300
printf("Could not create test file\n");
304
for (count= 0, write_length= 0; write_length < length ;
304
for (count= 0, write_length= 0; write_length < length ;
305
305
write_length+= ret)
319
319
assert(write_length == count * BUFFER_LEN); /* Number of rows time BUFFER_LEN */
320
320
azflush(&writer_handle, Z_SYNC_FLUSH);
322
if (!(ret= azopen(&reader_handle, TEST_FILENAME, O_RDONLY,
322
if (!(ret= azopen(&reader_handle, TEST_FILENAME, O_RDONLY|O_BINARY,
325
325
printf("Could not open test file\n");
329
329
/* We do a double loop to test speed */
330
330
for (x= 0, read_length= 0; x < 2; x++, read_length= 0)
334
334
azread_init(&reader_handle);
335
for (read_count= 0; read_count < writer_handle.rows; read_count++)
335
for (count= 0; count < writer_handle.rows; count++)
337
337
ret= azread_row(&reader_handle, &error);
338
338
read_length+= ret;