test/hotspot/gtest/runtime/test_os.cpp
changeset 53573 556122252316
parent 51277 dfe1cff5c2f6
child 54011 21ea4076a275
equal deleted inserted replaced
53572:f5480f924571 53573:556122252316
   150 TEST_VM_ASSERT_MSG(os, page_size_for_region_with_zero_min_pages, "sanity") {
   150 TEST_VM_ASSERT_MSG(os, page_size_for_region_with_zero_min_pages, "sanity") {
   151   size_t region_size = 16 * os::vm_page_size();
   151   size_t region_size = 16 * os::vm_page_size();
   152   os::page_size_for_region_aligned(region_size, 0); // should assert
   152   os::page_size_for_region_aligned(region_size, 0); // should assert
   153 }
   153 }
   154 #endif
   154 #endif
       
   155 
       
   156 TEST(os, test_print_hex_dump) {
       
   157   ResourceMark rm;
       
   158   stringStream ss;
       
   159   outputStream* out = &ss;
       
   160 //  outputStream* out = tty; // enable for printout
       
   161 
       
   162   // Test dumping unreadable memory does not fail
       
   163   os::print_hex_dump(out, (address)0, (address)100, 1);
       
   164   os::print_hex_dump(out, (address)0, (address)100, 2);
       
   165   os::print_hex_dump(out, (address)0, (address)100, 4);
       
   166   os::print_hex_dump(out, (address)0, (address)100, 8);
       
   167 
       
   168   // Test dumping readable memory does not fail
       
   169   char arr[100];
       
   170   for (int c = 0; c < 100; c++) {
       
   171     arr[c] = c;
       
   172   }
       
   173   address addr = (address)&arr;
       
   174   os::print_hex_dump(out, addr, addr + 100, 1);
       
   175   os::print_hex_dump(out, addr, addr + 100, 2);
       
   176   os::print_hex_dump(out, addr, addr + 100, 4);
       
   177   os::print_hex_dump(out, addr, addr + 100, 8);
       
   178 }
   155 
   179 
   156 //////////////////////////////////////////////////////////////////////////////
   180 //////////////////////////////////////////////////////////////////////////////
   157 // Test os::vsnprintf and friends.
   181 // Test os::vsnprintf and friends.
   158 
   182 
   159 static void check_snprintf_result(int expected, size_t limit, int actual, bool expect_count) {
   183 static void check_snprintf_result(int expected, size_t limit, int actual, bool expect_count) {