Commit 6c03cb61 authored by Rich Prohaska's avatar Rich Prohaska Committed by Yoni Fogel

make the linux portability tests slightly better. addresses #1524

git-svn-id: file:///svn/toku/tokudb@9875 c7de825b-a66e-492c-adef-691d508d4ae1
parent 51759ff0
...@@ -4,12 +4,38 @@ ...@@ -4,12 +4,38 @@
#include <inttypes.h> #include <inttypes.h>
#include <unistd.h> #include <unistd.h>
#include <assert.h> #include <assert.h>
#include <string.h>
#include <bits/wordsize.h>
#include "toku_os.h" #include "toku_os.h"
int main(void) { int main(int argc, char *argv[]) {
int verbose = 0;
int i;
for (i=1; i<argc; i++) {
if (strcmp(argv[i], "-v") == 0) {
verbose = 1;
continue;
}
if (strcmp(argv[i], "-q") == 0) {
verbose = 0;
continue;
}
}
// get the data size
uint64_t maxdata; uint64_t maxdata;
int r = toku_os_get_max_process_data_size(&maxdata); int r = toku_os_get_max_process_data_size(&maxdata);
assert(r == 0); assert(r == 0);
printf("maxdata=%"PRIu64"\n", maxdata); if (verbose) printf("maxdata=%"PRIu64"\n", maxdata);
// check the data size
#if __WORDSIZE == 64
assert(maxdata > (1ULL << 32));
#elif __WORDSIZE == 32
assert(maxdata < (1ULL << 32));
#else
#error
#endif
return 0; return 0;
} }
...@@ -6,23 +6,40 @@ ...@@ -6,23 +6,40 @@
#include <inttypes.h> #include <inttypes.h>
#include <toku_os.h> #include <toku_os.h>
const int nbuffers = 1000;
const int buffersize = 1024*1024;
static void do_mallocs(void) { static void do_mallocs(void) {
int i; int i;
for (i=0; i<1000; i++) { for (i=0; i<nbuffers; i++) {
int nbytes = 1024*1024; int nbytes = buffersize;
void *vp = malloc(nbytes); void *vp = malloc(nbytes);
memset(vp, 0, nbytes); memset(vp, 0, nbytes);
} }
} }
int main(void) { int main(int argc, char *argv[]) {
int64_t rss; int verbose = 0;
int i;
for (i=1; i<argc; i++) {
if (strcmp(argv[i], "-v") == 0) {
verbose = 1;
continue;
}
if (strcmp(argv[i], "-q") == 0) {
verbose = 0;
continue;
}
}
int64_t rss;
toku_os_get_max_rss(&rss); toku_os_get_max_rss(&rss);
printf("%"PRId64"\n", rss); if (verbose) printf("%"PRId64"\n", rss);
assert(rss < nbuffers*buffersize);
do_mallocs(); do_mallocs();
toku_os_get_max_rss(&rss); toku_os_get_max_rss(&rss);
printf("%"PRId64"\n", rss); if (verbose) printf("%"PRId64"\n", rss);
assert(rss > nbuffers*buffersize);
return 0; return 0;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment