mirror of
https://github.com/MariaDB/server.git
synced 2025-01-22 14:54:20 +01:00
958c447641
git-svn-id: file:///svn/toku/tokudb@45903 c7de825b-a66e-492c-adef-691d508d4ae1
54 lines
1.7 KiB
C++
54 lines
1.7 KiB
C++
/* -*- mode: C++; c-basic-offset: 4; indent-tabs-mode: nil -*- */
|
|
// vim: ft=cpp:expandtab:ts=8:sw=4:softtabstop=4:
|
|
#ident "$Id$"
|
|
#ident "Copyright (c) 2007-2012 Tokutek Inc. All rights reserved."
|
|
#ident "The technology is licensed by the Massachusetts Institute of Technology, Rutgers State University of New Jersey, and the Research Foundation of State University of New York at Stony Brook under United States of America Serial No. 11/760379 and to the patents and/or patent applications resulting from it."
|
|
#define _CRT_SECURE_NO_DEPRECATE
|
|
#include <test.h>
|
|
#include <stdio.h>
|
|
#include <errno.h>
|
|
#include <string.h>
|
|
#include <toku_stdint.h>
|
|
#include <unistd.h>
|
|
#include <toku_assert.h>
|
|
#include "toku_os.h"
|
|
|
|
int test_main(int argc, char *const argv[]) {
|
|
int verbose = 0;
|
|
int limit = 1;
|
|
|
|
for (int i = 1; i < argc; i++) {
|
|
if (strcmp(argv[i], "-v") == 0 || strcmp(argv[i], "--verbose") == 0) {
|
|
verbose = 1;
|
|
continue;
|
|
}
|
|
if (strcmp(argv[i], "--timeit") == 0) {
|
|
limit = 100000;
|
|
continue;
|
|
}
|
|
}
|
|
|
|
int r;
|
|
|
|
#if 0
|
|
r = toku_get_filesystem_sizes(NULL, NULL, NULL, NULL);
|
|
assert(r == EFAULT);
|
|
#endif
|
|
|
|
r = toku_get_filesystem_sizes(".", NULL, NULL, NULL);
|
|
assert(r == 0);
|
|
|
|
uint64_t free_size = 0, avail_size = 0, total_size = 0;
|
|
for (int i = 0; i < limit; i++) {
|
|
r = toku_get_filesystem_sizes(".", &avail_size, &free_size, &total_size);
|
|
assert(r == 0);
|
|
assert(avail_size <= free_size && free_size <= total_size);
|
|
}
|
|
if (verbose) {
|
|
printf("avail=%" PRIu64 "\n", avail_size);
|
|
printf("free=%" PRIu64 "\n", free_size);
|
|
printf("total=%" PRIu64 "\n", total_size);
|
|
}
|
|
|
|
return 0;
|
|
}
|