|
1 | 1 | /* |
2 | | - * Copyright (c) 2016, 2021, Oracle and/or its affiliates. All rights reserved. |
| 2 | + * Copyright (c) 2016, 2019, 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 |
|
23 | 23 |
|
24 | 24 | #include "precompiled.hpp" |
25 | 25 | #include "jvm.h" |
26 | | -#include "concurrentTestRunner.inline.hpp" |
27 | 26 | #include "logTestFixture.hpp" |
28 | 27 | #include "logTestUtils.inline.hpp" |
29 | 28 | #include "logging/logConfiguration.hpp" |
@@ -229,91 +228,6 @@ TEST_VM_F(LogConfigurationTest, reconfigure_decorators) { |
229 | 228 | EXPECT_TRUE(is_described("#1: stderr all=off none (reconfigured)\n")) << "Expecting no decorators"; |
230 | 229 | } |
231 | 230 |
|
232 | | -class ConcurrentLogsite : public TestRunnable { |
233 | | - int _id; |
234 | | - |
235 | | - public: |
236 | | - ConcurrentLogsite(int id) : _id(id) {} |
237 | | - void runUnitTest() const override { |
238 | | - log_debug(logging)("ConcurrentLogsite %d emits a log", _id); |
239 | | - } |
240 | | -}; |
241 | | - |
242 | | -// Dynamically change decorators while loggings are emitting. |
243 | | -TEST_VM_F(LogConfigurationTest, reconfigure_decorators_MT) { |
244 | | - const int nrOfThreads = 2; |
245 | | - ConcurrentLogsite logsites[nrOfThreads] = {0, 1}; |
246 | | - Semaphore done(0); |
247 | | - const long testDurationMillis = 1000; |
248 | | - UnitTestThread* t[nrOfThreads]; |
249 | | - |
250 | | - set_log_config(TestLogFileName, "logging=debug", "none", "filecount=0"); |
251 | | - set_log_config("stdout", "all=off", "none"); |
252 | | - set_log_config("stderr", "all=off", "none"); |
253 | | - for (int i = 0; i < nrOfThreads; ++i) { |
254 | | - t[i] = new UnitTestThread(&logsites[i], &done, testDurationMillis); |
255 | | - } |
256 | | - |
257 | | - for (int i = 0; i < nrOfThreads; i++) { |
258 | | - t[i]->doit(); |
259 | | - } |
260 | | - |
261 | | - jlong time_start = os::elapsed_counter(); |
262 | | - while (true) { |
263 | | - jlong elapsed = (jlong)TimeHelper::counter_to_millis(os::elapsed_counter() - time_start); |
264 | | - if (elapsed > testDurationMillis) { |
265 | | - break; |
266 | | - } |
267 | | - |
268 | | - // Take turn logging with different decorators, either None or All. |
269 | | - set_log_config(TestLogFileName, "logging=debug", "none"); |
270 | | - set_log_config(TestLogFileName, "logging=debug", _all_decorators); |
271 | | - } |
272 | | - |
273 | | - for (int i = 0; i < nrOfThreads; ++i) { |
274 | | - done.wait(); |
275 | | - } |
276 | | -} |
277 | | - |
278 | | -// Dynamically change tags while loggings are emitting. |
279 | | -TEST_VM_F(LogConfigurationTest, reconfigure_tags_MT) { |
280 | | - const int nrOfThreads = 4; |
281 | | - ConcurrentLogsite logsites[nrOfThreads] = {0, 1, 2, 3}; |
282 | | - Semaphore done(0); |
283 | | - const long testDurationMillis = 1000; |
284 | | - UnitTestThread* t[nrOfThreads]; |
285 | | - |
286 | | - set_log_config(TestLogFileName, "logging=debug", "", "filecount=0"); |
287 | | - set_log_config("stdout", "all=off", "none"); |
288 | | - set_log_config("stderr", "all=off", "none"); |
289 | | - |
290 | | - for (int i = 0; i < nrOfThreads; ++i) { |
291 | | - t[i] = new UnitTestThread(&logsites[i], &done, testDurationMillis); |
292 | | - } |
293 | | - |
294 | | - for (int i = 0; i < nrOfThreads; i++) { |
295 | | - t[i]->doit(); |
296 | | - } |
297 | | - |
298 | | - jlong time_start = os::elapsed_counter(); |
299 | | - while (true) { |
300 | | - jlong elapsed = (jlong)TimeHelper::counter_to_millis(os::elapsed_counter() - time_start); |
301 | | - if (elapsed > testDurationMillis) { |
302 | | - break; |
303 | | - } |
304 | | - |
305 | | - // turn on/off the tagset 'logging'. |
306 | | - set_log_config(TestLogFileName, "logging=off"); |
307 | | - set_log_config(TestLogFileName, "logging=debug", "", "filecount=0"); |
308 | | - // sleep a prime number milliseconds to allow concurrent logsites write logs |
309 | | - os::naked_short_nanosleep(137); |
310 | | - } |
311 | | - |
312 | | - for (int i = 0; i < nrOfThreads; ++i) { |
313 | | - done.wait(); |
314 | | - } |
315 | | -} |
316 | | - |
317 | 231 | // Test that invalid options cause configuration errors |
318 | 232 | TEST_VM_F(LogConfigurationTest, invalid_configure_options) { |
319 | 233 | LogConfiguration::disable_logging(); |
|
0 commit comments