diff options
author | Nick Mathewson <nickm@torproject.org> | 2014-04-24 10:31:38 -0400 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2014-04-24 10:31:38 -0400 |
commit | 67aa3685e7321322cbbc2bef7f87c9a885819af8 (patch) | |
tree | 46f3678112d650aea4f628b2dd4fe1d7c39c6be0 /src/test | |
parent | aa1ad30fc9c629eea44d715041f29e4838ff3175 (diff) | |
parent | e3af72647db51e99186b9f284066dedcdc8c10d6 (diff) | |
download | tor-67aa3685e7321322cbbc2bef7f87c9a885819af8.tar.gz tor-67aa3685e7321322cbbc2bef7f87c9a885819af8.zip |
Merge branch 'bug11396_v2_squashed'
Conflicts:
src/or/main.c
Diffstat (limited to 'src/test')
-rw-r--r-- | src/test/test_util.c | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/src/test/test_util.c b/src/test/test_util.c index 08efd453c9..6d6b6dbdf8 100644 --- a/src/test/test_util.c +++ b/src/test/test_util.c @@ -3612,6 +3612,34 @@ test_util_socketpair(void *arg) tor_close_socket(fds[1]); } +static void +test_util_max_mem(void *arg) +{ + size_t memory1, memory2; + int r, r2; + (void) arg; + + r = get_total_system_memory(&memory1); + r2 = get_total_system_memory(&memory2); + tt_int_op(r, ==, r2); + tt_int_op(memory2, ==, memory1); + + TT_BLATHER(("System memory: "U64_FORMAT, U64_PRINTF_ARG(memory1))); + + if (r==0) { + /* You have at least a megabyte. */ + tt_int_op(memory1, >, (1<<20)); + } else { + /* You do not have a petabyte. */ +#if SIZEOF_SIZE_T == SIZEOF_UINT64_T + tt_int_op(memory1, <, (U64_LITERAL(1)<<50)); +#endif + } + + done: + ; +} + struct testcase_t util_tests[] = { UTIL_LEGACY(time), UTIL_TEST(parse_http_time, 0), @@ -3675,6 +3703,7 @@ struct testcase_t util_tests[] = { (void*)"0" }, { "socketpair_ersatz", test_util_socketpair, TT_FORK, &socketpair_setup, (void*)"1" }, + UTIL_TEST(max_mem, 0), END_OF_TESTCASES }; |