|
1 | 1 | /*
|
2 |
| - * Copyright (c) 2016, 2023, Oracle and/or its affiliates. All rights reserved. |
| 2 | + * Copyright (c) 2016, 2024, Oracle and/or its affiliates. All rights reserved. |
3 | 3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
4 | 4 | *
|
5 | 5 | * This code is free software; you can redistribute it and/or modify it
|
|
24 | 24 | #include "precompiled.hpp"
|
25 | 25 | #include "gc/shared/memset_with_concurrent_readers.hpp"
|
26 | 26 | #include "utilities/globalDefinitions.hpp"
|
27 |
| - |
28 |
| -#include "utilities/vmassert_uninstall.hpp" |
29 |
| -#include <iomanip> |
30 |
| -#include <string.h> |
31 |
| -#include <sstream> |
32 |
| -#include "utilities/vmassert_reinstall.hpp" |
33 |
| - |
| 27 | +#include "utilities/ostream.hpp" |
34 | 28 | #include "unittest.hpp"
|
35 | 29 |
|
36 | 30 | static unsigned line_byte(const char* line, size_t i) {
|
@@ -71,29 +65,31 @@ TEST(gc, memset_with_concurrent_readers) {
|
71 | 65 | bool middle_set = !memcmp(set_block, block + set_start, set_size);
|
72 | 66 | bool tail_clear = !memcmp(clear_block, block + set_end, block_size - set_end);
|
73 | 67 | if (!(head_clear && middle_set && tail_clear)) {
|
74 |
| - std::ostringstream err_stream; |
75 |
| - err_stream << "*** memset_with_concurrent_readers failed: set start " |
76 |
| - << set_start << ", set end " << set_end << std::endl; |
| 68 | + stringStream err_stream{}; |
| 69 | + err_stream.print_cr("*** memset_with_concurrent_readers failed: " |
| 70 | + "set start %zu, set end %zu", |
| 71 | + set_start, set_end); |
77 | 72 | for (unsigned chunk = 0; chunk < (block_size / chunk_size); ++chunk) {
|
78 | 73 | for (unsigned line = 0; line < (chunk_size / BytesPerWord); ++line) {
|
79 | 74 |
|
80 | 75 | const char* lp = &block[chunk * chunk_size + line * BytesPerWord];
|
81 | 76 |
|
82 |
| - err_stream << std::dec << chunk << "," << line << ": " << std::hex |
83 |
| - << std::setw(2) << line_byte(lp, 0) << " " |
84 |
| - << std::setw(2) << line_byte(lp, 1) << " " |
85 |
| - << std::setw(2) << line_byte(lp, 2) << " " |
86 |
| - << std::setw(2) << line_byte(lp, 3) << " " |
87 |
| - << std::setw(2) << line_byte(lp, 4) << " " |
88 |
| - << std::setw(2) << line_byte(lp, 5) << " " |
89 |
| - << std::setw(2) << line_byte(lp, 6) << " " |
90 |
| - << std::setw(2) << line_byte(lp, 7) << std::endl; |
| 77 | + err_stream.print_cr("%u, %u: " |
| 78 | + "%02x %02x " |
| 79 | + "%02x %02x " |
| 80 | + "%02x %02x " |
| 81 | + "%02x %02x", |
| 82 | + chunk, line, |
| 83 | + line_byte(lp, 0), line_byte(lp, 1), |
| 84 | + line_byte(lp, 2), line_byte(lp, 3), |
| 85 | + line_byte(lp, 4), line_byte(lp, 5), |
| 86 | + line_byte(lp, 6), line_byte(lp, 7)); |
91 | 87 | }
|
92 | 88 | }
|
93 | 89 | EXPECT_TRUE(head_clear) << "leading byte not clear";
|
94 | 90 | EXPECT_TRUE(middle_set) << "memset byte not set";
|
95 | 91 | EXPECT_TRUE(tail_clear) << "trailing bye not clear";
|
96 |
| - ASSERT_TRUE(head_clear && middle_set && tail_clear) << err_stream.str(); |
| 92 | + ASSERT_TRUE(head_clear && middle_set && tail_clear) << err_stream.freeze(); |
97 | 93 | }
|
98 | 94 | }
|
99 | 95 | }
|
|
0 commit comments