test/hotspot/gtest/runtime/test_globals.cpp
changeset 49857 31e07291ae29
parent 47216 71c04702a3d5
child 49860 ca5216a2a2cc
equal deleted inserted replaced
49856:5f63af8f9d7f 49857:31e07291ae29
     1 /*
     1 /*
     2  * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
     2  * Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     4  *
     4  *
     5  * This code is free software; you can redistribute it and/or modify it
     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
     6  * under the terms of the GNU General Public License version 2 only, as
     7  * published by the Free Software Foundation.
     7  * published by the Free Software Foundation.
    21  * questions.
    21  * questions.
    22  */
    22  */
    23 
    23 
    24 #include "precompiled.hpp"
    24 #include "precompiled.hpp"
    25 #include "runtime/globals.hpp"
    25 #include "runtime/globals.hpp"
       
    26 #include "runtime/flags/flagSetting.hpp"
    26 #include "unittest.hpp"
    27 #include "unittest.hpp"
    27 
    28 
    28 #define TEST_FLAG(f, type, value)                     \
    29 #define TEST_FLAG(f, type, value)                                \
    29   do {                                                \
    30   do {                                                           \
    30     ASSERT_TRUE(Flag::find_flag(#f)->is_ ## type());  \
    31     ASSERT_TRUE(JVMFlag::find_flag(#f)->is_ ## type());          \
    31     type original_value = f;                          \
    32     type original_value = f;                                     \
    32     {                                                 \
    33     {                                                            \
    33       FLAG_GUARD(f);                                  \
    34       FLAG_GUARD(f);                                             \
    34       f = value;                                      \
    35       f = value;                                                 \
    35     }                                                 \
    36     }                                                            \
    36     ASSERT_EQ(original_value, f);                     \
    37     ASSERT_EQ(original_value, f);                                \
    37   } while (0)
    38   } while (0)
    38 
    39 
    39 TEST_VM(FlagGuard, bool_flag) {
    40 TEST_VM(FlagGuard, bool_flag) {
    40   TEST_FLAG(AlwaysActAsServerClassMachine, bool, true);
    41   TEST_FLAG(AlwaysActAsServerClassMachine, bool, true);
    41 }
    42 }