mirror of
https://github.com/MariaDB/server.git
synced 2025-01-22 14:54:20 +01:00
make the linux portability tests slightly better. addresses #1524
git-svn-id: file:///svn/toku/tokudb@9875 c7de825b-a66e-492c-adef-691d508d4ae1
This commit is contained in:
parent
51759ff06d
commit
6c03cb6150
2 changed files with 51 additions and 8 deletions
|
@ -4,12 +4,38 @@
|
|||
#include <inttypes.h>
|
||||
#include <unistd.h>
|
||||
#include <assert.h>
|
||||
#include <string.h>
|
||||
#include <bits/wordsize.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;
|
||||
int r = toku_os_get_max_process_data_size(&maxdata);
|
||||
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;
|
||||
}
|
||||
|
|
|
@ -6,23 +6,40 @@
|
|||
#include <inttypes.h>
|
||||
#include <toku_os.h>
|
||||
|
||||
const int nbuffers = 1000;
|
||||
const int buffersize = 1024*1024;
|
||||
|
||||
static void do_mallocs(void) {
|
||||
int i;
|
||||
for (i=0; i<1000; i++) {
|
||||
int nbytes = 1024*1024;
|
||||
for (i=0; i<nbuffers; i++) {
|
||||
int nbytes = buffersize;
|
||||
void *vp = malloc(nbytes);
|
||||
memset(vp, 0, nbytes);
|
||||
}
|
||||
}
|
||||
|
||||
int main(void) {
|
||||
int64_t rss;
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
int64_t rss;
|
||||
toku_os_get_max_rss(&rss);
|
||||
printf("%"PRId64"\n", rss);
|
||||
if (verbose) printf("%"PRId64"\n", rss);
|
||||
assert(rss < nbuffers*buffersize);
|
||||
do_mallocs();
|
||||
toku_os_get_max_rss(&rss);
|
||||
printf("%"PRId64"\n", rss);
|
||||
if (verbose) printf("%"PRId64"\n", rss);
|
||||
assert(rss > nbuffers*buffersize);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue