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