From: Waldemar Kozaczuk <[email protected]>
Committer: Waldemar Kozaczuk <[email protected]>
Branch: master

tst-realloc: test malloc_usable_size() only when running with OSv libc

The results returned malloc_usable_size() are very much dependant
on the malloc() implementation. Let us disable this part of the
tst-realloc.c when built with glibc.

As of this commit, most of the unit tests should pass when running on OSv
with Linux dynamic linker:

scripts/test.py --linux_ld -m modules/tests-with-linux-ld/usr.manifest \
  -d tst-futimesat \
  -d tst-kill \
  -d tst-mmap \
  -d tst-pthread-clock \
  -d tst-reloc \
  -d tst-shm \
  -d tst-sigaction \
  -d tst-sigwait \
  -d tst-stdio-rofs \
  -d tst-symlink \
  -d tst-symlink-rofs \
  -d tst-time \
  -d tst-truncate \
  -d tst-utimensat \
  -d tst-utimes \
  -d tst-wctype

Signed-off-by: Waldemar Kozaczuk <[email protected]>

---
diff --git a/tests/tst-realloc.cc b/tests/tst-realloc.cc
--- a/tests/tst-realloc.cc
+++ b/tests/tst-realloc.cc
@@ -38,6 +38,7 @@ static void test_realloc(size_t original_size, size_t 
new_size)
     std::cerr << "PASSED realloc() for original_size: " << original_size << ", 
new_size: " << new_size << std::endl;
 }
 
+#ifdef __OSV__
 static void test_usable_size(size_t size, size_t expected_usable_size)
 {
     void* ptr = malloc(size);
@@ -46,6 +47,7 @@ static void test_usable_size(size_t size, size_t 
expected_usable_size)
 
     std::cerr << "PASSED malloc_usable_size() for size: " << size << std::endl;
 }
+#endif
 
 int main()
 {
@@ -82,13 +84,15 @@ int main()
     buf = malloc(16);
     assert(!realloc(buf, 0));
 
+#ifdef __OSV__
     test_usable_size(1, 8);
     test_usable_size(8, 8);
     test_usable_size(67, 128);
     test_usable_size(0x4010, 0x4FC0);
     test_usable_size(0x100000, 0x100FC0);
     test_usable_size(0x200000, 0x200FC0);
+#endif
 
     std::cerr << "PASSED\n";
     return 0;
-}
\ No newline at end of file
+}

-- 
You received this message because you are subscribed to the Google Groups "OSv 
Development" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/osv-dev/0000000000008e548d060c84e4cd%40google.com.

Reply via email to