comparison hotspot/test/native/logging/test_logTag.cpp @ 40902:395e1f3ec886

8157948: UL allows same log file with multiple file= Reviewed-by: dholmes, rehn
author mlarsson
date Mon, 29 Aug 2016 14:11:22 +0200
parents
children 332239c052cc
comparison
equal deleted inserted replaced
-1:000000000000 0:c61464948152
1 /*
2 * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation.
8 *
9 * This code is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12 * version 2 for more details (a copy is included in the LICENSE file that
13 * accompanied this code).
14 *
15 * You should have received a copy of the GNU General Public License version
16 * 2 along with this work; if not, write to the Free Software Foundation,
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18 *
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 *
23 */
24 #include "precompiled.hpp"
25 #include "logging/logTag.hpp"
26 #include "unittest.hpp"
27
28 TEST(LogTag, from_string) {
29 // Verify for all tags defined in LOG_TAG_LIST
30 #define LOG_TAG(tag) \
31 EXPECT_EQ(PREFIX_LOG_TAG(tag), LogTag::from_string(#tag));
32 LOG_TAG_LIST
33 #undef LOG_TAG
34
35 // Verify a couple of invalid strings parsing as invalid tags
36 const char* invalid_tag[] = {
37 "bad tag", ".^@", "**", "*", "gcc", "+gc", "gc+", "gc+safepoint",
38 "gc+safepoint=warning", "warning", "=info", "gcsafepointlogging",
39 "gc+safepointlogging", "gclogging", "+", " gc", "logging ", ","
40 };
41 for (size_t i = 0; i < sizeof(invalid_tag) / sizeof(*invalid_tag); i++) {
42 EXPECT_EQ(LogTag::__NO_TAG, LogTag::from_string(invalid_tag[i]))
43 << "'" << invalid_tag[i] << "' did not parse as an invalid tag";
44 }
45 }
46
47 TEST(LogTag, name) {
48 // Verify for each tag from the macro
49 #define LOG_TAG(tag) \
50 EXPECT_STREQ(#tag, LogTag::name(PREFIX_LOG_TAG(tag)));
51 LOG_TAG_LIST
52 #undef LOG_TAG
53 }