test/hotspot/gtest/compiler/test_directivesParser.cpp
author kbarrett
Thu, 07 Nov 2019 16:22:22 -0500
changeset 58973 291775bcf35d
parent 52290 db83eceba962
permissions -rw-r--r--
8233364: Fix undefined behavior in Canonicalizer::do_ShiftOp Summary: Add java_shift_xxx helpers and use them. Reviewed-by: aph, kvn
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
52290
db83eceba962 8164546: Convert DirectivesParser_test to GTest
ppunegov
parents:
diff changeset
     1
/*
db83eceba962 8164546: Convert DirectivesParser_test to GTest
ppunegov
parents:
diff changeset
     2
 * Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved.
db83eceba962 8164546: Convert DirectivesParser_test to GTest
ppunegov
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
db83eceba962 8164546: Convert DirectivesParser_test to GTest
ppunegov
parents:
diff changeset
     4
 *
db83eceba962 8164546: Convert DirectivesParser_test to GTest
ppunegov
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
db83eceba962 8164546: Convert DirectivesParser_test to GTest
ppunegov
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
db83eceba962 8164546: Convert DirectivesParser_test to GTest
ppunegov
parents:
diff changeset
     7
 * published by the Free Software Foundation.
db83eceba962 8164546: Convert DirectivesParser_test to GTest
ppunegov
parents:
diff changeset
     8
 *
db83eceba962 8164546: Convert DirectivesParser_test to GTest
ppunegov
parents:
diff changeset
     9
 * This code is distributed in the hope that it will be useful, but WITHOUT
db83eceba962 8164546: Convert DirectivesParser_test to GTest
ppunegov
parents:
diff changeset
    10
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
db83eceba962 8164546: Convert DirectivesParser_test to GTest
ppunegov
parents:
diff changeset
    11
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
db83eceba962 8164546: Convert DirectivesParser_test to GTest
ppunegov
parents:
diff changeset
    12
 * version 2 for more details (a copy is included in the LICENSE file that
db83eceba962 8164546: Convert DirectivesParser_test to GTest
ppunegov
parents:
diff changeset
    13
 * accompanied this code).
db83eceba962 8164546: Convert DirectivesParser_test to GTest
ppunegov
parents:
diff changeset
    14
 *
db83eceba962 8164546: Convert DirectivesParser_test to GTest
ppunegov
parents:
diff changeset
    15
 * You should have received a copy of the GNU General Public License version
db83eceba962 8164546: Convert DirectivesParser_test to GTest
ppunegov
parents:
diff changeset
    16
 * 2 along with this work; if not, write to the Free Software Foundation,
db83eceba962 8164546: Convert DirectivesParser_test to GTest
ppunegov
parents:
diff changeset
    17
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
db83eceba962 8164546: Convert DirectivesParser_test to GTest
ppunegov
parents:
diff changeset
    18
 *
db83eceba962 8164546: Convert DirectivesParser_test to GTest
ppunegov
parents:
diff changeset
    19
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
db83eceba962 8164546: Convert DirectivesParser_test to GTest
ppunegov
parents:
diff changeset
    20
 * or visit www.oracle.com if you need additional information or have any
db83eceba962 8164546: Convert DirectivesParser_test to GTest
ppunegov
parents:
diff changeset
    21
 * questions.
db83eceba962 8164546: Convert DirectivesParser_test to GTest
ppunegov
parents:
diff changeset
    22
 */
db83eceba962 8164546: Convert DirectivesParser_test to GTest
ppunegov
parents:
diff changeset
    23
db83eceba962 8164546: Convert DirectivesParser_test to GTest
ppunegov
parents:
diff changeset
    24
#include "precompiled.hpp"
db83eceba962 8164546: Convert DirectivesParser_test to GTest
ppunegov
parents:
diff changeset
    25
db83eceba962 8164546: Convert DirectivesParser_test to GTest
ppunegov
parents:
diff changeset
    26
#include <locale.h>
db83eceba962 8164546: Convert DirectivesParser_test to GTest
ppunegov
parents:
diff changeset
    27
db83eceba962 8164546: Convert DirectivesParser_test to GTest
ppunegov
parents:
diff changeset
    28
#include "compiler/directivesParser.hpp"
db83eceba962 8164546: Convert DirectivesParser_test to GTest
ppunegov
parents:
diff changeset
    29
#include "runtime/interfaceSupport.inline.hpp"
db83eceba962 8164546: Convert DirectivesParser_test to GTest
ppunegov
parents:
diff changeset
    30
#include "runtime/thread.hpp"
db83eceba962 8164546: Convert DirectivesParser_test to GTest
ppunegov
parents:
diff changeset
    31
#include "unittest.hpp"
db83eceba962 8164546: Convert DirectivesParser_test to GTest
ppunegov
parents:
diff changeset
    32
db83eceba962 8164546: Convert DirectivesParser_test to GTest
ppunegov
parents:
diff changeset
    33
class DirectivesParserTest : public ::testing::Test{
db83eceba962 8164546: Convert DirectivesParser_test to GTest
ppunegov
parents:
diff changeset
    34
 protected:
db83eceba962 8164546: Convert DirectivesParser_test to GTest
ppunegov
parents:
diff changeset
    35
  const char* const _locale;
db83eceba962 8164546: Convert DirectivesParser_test to GTest
ppunegov
parents:
diff changeset
    36
  ResourceMark rm;
db83eceba962 8164546: Convert DirectivesParser_test to GTest
ppunegov
parents:
diff changeset
    37
  stringStream stream;
db83eceba962 8164546: Convert DirectivesParser_test to GTest
ppunegov
parents:
diff changeset
    38
  // These tests require the "C" locale to correctly parse decimal values
db83eceba962 8164546: Convert DirectivesParser_test to GTest
ppunegov
parents:
diff changeset
    39
  DirectivesParserTest() : _locale(setlocale(LC_NUMERIC, NULL)) {
db83eceba962 8164546: Convert DirectivesParser_test to GTest
ppunegov
parents:
diff changeset
    40
    setlocale(LC_NUMERIC, "C");
db83eceba962 8164546: Convert DirectivesParser_test to GTest
ppunegov
parents:
diff changeset
    41
  }
db83eceba962 8164546: Convert DirectivesParser_test to GTest
ppunegov
parents:
diff changeset
    42
  ~DirectivesParserTest() {
db83eceba962 8164546: Convert DirectivesParser_test to GTest
ppunegov
parents:
diff changeset
    43
    setlocale(LC_NUMERIC, _locale);
db83eceba962 8164546: Convert DirectivesParser_test to GTest
ppunegov
parents:
diff changeset
    44
  }
db83eceba962 8164546: Convert DirectivesParser_test to GTest
ppunegov
parents:
diff changeset
    45
db83eceba962 8164546: Convert DirectivesParser_test to GTest
ppunegov
parents:
diff changeset
    46
  void test_negative(const char* text) {
db83eceba962 8164546: Convert DirectivesParser_test to GTest
ppunegov
parents:
diff changeset
    47
    JavaThread* THREAD = JavaThread::current();
db83eceba962 8164546: Convert DirectivesParser_test to GTest
ppunegov
parents:
diff changeset
    48
    ThreadInVMfromNative ThreadInVMfromNative(THREAD);
db83eceba962 8164546: Convert DirectivesParser_test to GTest
ppunegov
parents:
diff changeset
    49
    DirectivesParser cd(text, &stream, false);
db83eceba962 8164546: Convert DirectivesParser_test to GTest
ppunegov
parents:
diff changeset
    50
    cd.clean_tmp();
db83eceba962 8164546: Convert DirectivesParser_test to GTest
ppunegov
parents:
diff changeset
    51
    EXPECT_FALSE(cd.valid()) << "text: " << std::endl << text << std::endl << stream.as_string();
db83eceba962 8164546: Convert DirectivesParser_test to GTest
ppunegov
parents:
diff changeset
    52
  }
db83eceba962 8164546: Convert DirectivesParser_test to GTest
ppunegov
parents:
diff changeset
    53
db83eceba962 8164546: Convert DirectivesParser_test to GTest
ppunegov
parents:
diff changeset
    54
  void test_positive(const char* text) {
db83eceba962 8164546: Convert DirectivesParser_test to GTest
ppunegov
parents:
diff changeset
    55
    JavaThread* THREAD = JavaThread::current();
db83eceba962 8164546: Convert DirectivesParser_test to GTest
ppunegov
parents:
diff changeset
    56
    ThreadInVMfromNative ThreadInVMfromNative(THREAD);
db83eceba962 8164546: Convert DirectivesParser_test to GTest
ppunegov
parents:
diff changeset
    57
    DirectivesParser cd(text, &stream, false);
db83eceba962 8164546: Convert DirectivesParser_test to GTest
ppunegov
parents:
diff changeset
    58
    cd.clean_tmp();
db83eceba962 8164546: Convert DirectivesParser_test to GTest
ppunegov
parents:
diff changeset
    59
    EXPECT_TRUE(cd.valid()) << "text: " << std::endl << text << std::endl << stream.as_string();
db83eceba962 8164546: Convert DirectivesParser_test to GTest
ppunegov
parents:
diff changeset
    60
  }
db83eceba962 8164546: Convert DirectivesParser_test to GTest
ppunegov
parents:
diff changeset
    61
};
db83eceba962 8164546: Convert DirectivesParser_test to GTest
ppunegov
parents:
diff changeset
    62
db83eceba962 8164546: Convert DirectivesParser_test to GTest
ppunegov
parents:
diff changeset
    63
TEST_VM_F(DirectivesParserTest, empty_object) {
db83eceba962 8164546: Convert DirectivesParser_test to GTest
ppunegov
parents:
diff changeset
    64
  test_negative("{}");
db83eceba962 8164546: Convert DirectivesParser_test to GTest
ppunegov
parents:
diff changeset
    65
}
db83eceba962 8164546: Convert DirectivesParser_test to GTest
ppunegov
parents:
diff changeset
    66
db83eceba962 8164546: Convert DirectivesParser_test to GTest
ppunegov
parents:
diff changeset
    67
TEST_VM_F(DirectivesParserTest, empty_array) {
db83eceba962 8164546: Convert DirectivesParser_test to GTest
ppunegov
parents:
diff changeset
    68
  test_positive("[]");
db83eceba962 8164546: Convert DirectivesParser_test to GTest
ppunegov
parents:
diff changeset
    69
}
db83eceba962 8164546: Convert DirectivesParser_test to GTest
ppunegov
parents:
diff changeset
    70
db83eceba962 8164546: Convert DirectivesParser_test to GTest
ppunegov
parents:
diff changeset
    71
TEST_VM_F(DirectivesParserTest, empty_object_in_array) {
db83eceba962 8164546: Convert DirectivesParser_test to GTest
ppunegov
parents:
diff changeset
    72
  test_negative("[{}]");
db83eceba962 8164546: Convert DirectivesParser_test to GTest
ppunegov
parents:
diff changeset
    73
}
db83eceba962 8164546: Convert DirectivesParser_test to GTest
ppunegov
parents:
diff changeset
    74
db83eceba962 8164546: Convert DirectivesParser_test to GTest
ppunegov
parents:
diff changeset
    75
TEST_VM_F(DirectivesParserTest, empty_objects_in_array) {
db83eceba962 8164546: Convert DirectivesParser_test to GTest
ppunegov
parents:
diff changeset
    76
  test_negative("[{},{}]");
db83eceba962 8164546: Convert DirectivesParser_test to GTest
ppunegov
parents:
diff changeset
    77
}
db83eceba962 8164546: Convert DirectivesParser_test to GTest
ppunegov
parents:
diff changeset
    78
db83eceba962 8164546: Convert DirectivesParser_test to GTest
ppunegov
parents:
diff changeset
    79
TEST_VM_F(DirectivesParserTest, empty_objects) {
db83eceba962 8164546: Convert DirectivesParser_test to GTest
ppunegov
parents:
diff changeset
    80
  test_negative("{},{}");
db83eceba962 8164546: Convert DirectivesParser_test to GTest
ppunegov
parents:
diff changeset
    81
}
db83eceba962 8164546: Convert DirectivesParser_test to GTest
ppunegov
parents:
diff changeset
    82
db83eceba962 8164546: Convert DirectivesParser_test to GTest
ppunegov
parents:
diff changeset
    83
TEST_VM_F(DirectivesParserTest, simple_match) {
db83eceba962 8164546: Convert DirectivesParser_test to GTest
ppunegov
parents:
diff changeset
    84
  test_positive(
db83eceba962 8164546: Convert DirectivesParser_test to GTest
ppunegov
parents:
diff changeset
    85
      "[" "\n"
db83eceba962 8164546: Convert DirectivesParser_test to GTest
ppunegov
parents:
diff changeset
    86
      "  {" "\n"
db83eceba962 8164546: Convert DirectivesParser_test to GTest
ppunegov
parents:
diff changeset
    87
      "    match: \"foo/bar.*\"," "\n"
db83eceba962 8164546: Convert DirectivesParser_test to GTest
ppunegov
parents:
diff changeset
    88
      "    inline : \"+java/util.*\"," "\n"
db83eceba962 8164546: Convert DirectivesParser_test to GTest
ppunegov
parents:
diff changeset
    89
      "    PrintAssembly: true," "\n"
db83eceba962 8164546: Convert DirectivesParser_test to GTest
ppunegov
parents:
diff changeset
    90
      "    BreakAtExecute: true," "\n"
db83eceba962 8164546: Convert DirectivesParser_test to GTest
ppunegov
parents:
diff changeset
    91
      "  }" "\n"
db83eceba962 8164546: Convert DirectivesParser_test to GTest
ppunegov
parents:
diff changeset
    92
      "]" "\n");
db83eceba962 8164546: Convert DirectivesParser_test to GTest
ppunegov
parents:
diff changeset
    93
db83eceba962 8164546: Convert DirectivesParser_test to GTest
ppunegov
parents:
diff changeset
    94
}
db83eceba962 8164546: Convert DirectivesParser_test to GTest
ppunegov
parents:
diff changeset
    95
db83eceba962 8164546: Convert DirectivesParser_test to GTest
ppunegov
parents:
diff changeset
    96
TEST_VM_F(DirectivesParserTest, nesting_arrays) {
db83eceba962 8164546: Convert DirectivesParser_test to GTest
ppunegov
parents:
diff changeset
    97
  test_negative(
db83eceba962 8164546: Convert DirectivesParser_test to GTest
ppunegov
parents:
diff changeset
    98
      "[" "\n"
db83eceba962 8164546: Convert DirectivesParser_test to GTest
ppunegov
parents:
diff changeset
    99
      "  [" "\n"
db83eceba962 8164546: Convert DirectivesParser_test to GTest
ppunegov
parents:
diff changeset
   100
      "    {" "\n"
db83eceba962 8164546: Convert DirectivesParser_test to GTest
ppunegov
parents:
diff changeset
   101
      "      match: \"foo/bar.*\"," "\n"
db83eceba962 8164546: Convert DirectivesParser_test to GTest
ppunegov
parents:
diff changeset
   102
      "      inline : \"+java/util.*\"," "\n"
db83eceba962 8164546: Convert DirectivesParser_test to GTest
ppunegov
parents:
diff changeset
   103
      "      PrintAssembly: true," "\n"
db83eceba962 8164546: Convert DirectivesParser_test to GTest
ppunegov
parents:
diff changeset
   104
      "      BreakAtExecute: true," "\n"
db83eceba962 8164546: Convert DirectivesParser_test to GTest
ppunegov
parents:
diff changeset
   105
      "    }" "\n"
db83eceba962 8164546: Convert DirectivesParser_test to GTest
ppunegov
parents:
diff changeset
   106
      "  ]" "\n"
db83eceba962 8164546: Convert DirectivesParser_test to GTest
ppunegov
parents:
diff changeset
   107
      "]" "\n");
db83eceba962 8164546: Convert DirectivesParser_test to GTest
ppunegov
parents:
diff changeset
   108
}
db83eceba962 8164546: Convert DirectivesParser_test to GTest
ppunegov
parents:
diff changeset
   109
db83eceba962 8164546: Convert DirectivesParser_test to GTest
ppunegov
parents:
diff changeset
   110
TEST_VM_F(DirectivesParserTest, c1_block) {
db83eceba962 8164546: Convert DirectivesParser_test to GTest
ppunegov
parents:
diff changeset
   111
  test_positive(
db83eceba962 8164546: Convert DirectivesParser_test to GTest
ppunegov
parents:
diff changeset
   112
    "[" "\n"
db83eceba962 8164546: Convert DirectivesParser_test to GTest
ppunegov
parents:
diff changeset
   113
    "  {" "\n"
db83eceba962 8164546: Convert DirectivesParser_test to GTest
ppunegov
parents:
diff changeset
   114
    "    match: \"foo/bar.*\"," "\n"
db83eceba962 8164546: Convert DirectivesParser_test to GTest
ppunegov
parents:
diff changeset
   115
    "    c1: {"
db83eceba962 8164546: Convert DirectivesParser_test to GTest
ppunegov
parents:
diff changeset
   116
    "      PrintInlining: false," "\n"
db83eceba962 8164546: Convert DirectivesParser_test to GTest
ppunegov
parents:
diff changeset
   117
    "    }" "\n"
db83eceba962 8164546: Convert DirectivesParser_test to GTest
ppunegov
parents:
diff changeset
   118
    "  }" "\n"
db83eceba962 8164546: Convert DirectivesParser_test to GTest
ppunegov
parents:
diff changeset
   119
    "]" "\n");
db83eceba962 8164546: Convert DirectivesParser_test to GTest
ppunegov
parents:
diff changeset
   120
}
db83eceba962 8164546: Convert DirectivesParser_test to GTest
ppunegov
parents:
diff changeset
   121
db83eceba962 8164546: Convert DirectivesParser_test to GTest
ppunegov
parents:
diff changeset
   122
TEST_VM_F(DirectivesParserTest, c2_block) {
db83eceba962 8164546: Convert DirectivesParser_test to GTest
ppunegov
parents:
diff changeset
   123
  test_positive(
db83eceba962 8164546: Convert DirectivesParser_test to GTest
ppunegov
parents:
diff changeset
   124
      "[" "\n"
db83eceba962 8164546: Convert DirectivesParser_test to GTest
ppunegov
parents:
diff changeset
   125
      "  {" "\n"
db83eceba962 8164546: Convert DirectivesParser_test to GTest
ppunegov
parents:
diff changeset
   126
      "    match: \"foo/bar.*\"," "\n"
db83eceba962 8164546: Convert DirectivesParser_test to GTest
ppunegov
parents:
diff changeset
   127
      "    c2: {" "\n"
db83eceba962 8164546: Convert DirectivesParser_test to GTest
ppunegov
parents:
diff changeset
   128
      "      PrintInlining: false," "\n"
db83eceba962 8164546: Convert DirectivesParser_test to GTest
ppunegov
parents:
diff changeset
   129
      "    }" "\n"
db83eceba962 8164546: Convert DirectivesParser_test to GTest
ppunegov
parents:
diff changeset
   130
      "  }" "\n"
db83eceba962 8164546: Convert DirectivesParser_test to GTest
ppunegov
parents:
diff changeset
   131
      "]" "\n");
db83eceba962 8164546: Convert DirectivesParser_test to GTest
ppunegov
parents:
diff changeset
   132
}
db83eceba962 8164546: Convert DirectivesParser_test to GTest
ppunegov
parents:
diff changeset
   133
db83eceba962 8164546: Convert DirectivesParser_test to GTest
ppunegov
parents:
diff changeset
   134
TEST_VM_F(DirectivesParserTest, boolean_array) {
db83eceba962 8164546: Convert DirectivesParser_test to GTest
ppunegov
parents:
diff changeset
   135
  test_negative(
db83eceba962 8164546: Convert DirectivesParser_test to GTest
ppunegov
parents:
diff changeset
   136
      "[" "\n"
db83eceba962 8164546: Convert DirectivesParser_test to GTest
ppunegov
parents:
diff changeset
   137
      "  {" "\n"
db83eceba962 8164546: Convert DirectivesParser_test to GTest
ppunegov
parents:
diff changeset
   138
      "    match: \"foo/bar.*\"," "\n"
db83eceba962 8164546: Convert DirectivesParser_test to GTest
ppunegov
parents:
diff changeset
   139
      "    PrintInlining: [" "\n"
db83eceba962 8164546: Convert DirectivesParser_test to GTest
ppunegov
parents:
diff changeset
   140
      "      true," "\n"
db83eceba962 8164546: Convert DirectivesParser_test to GTest
ppunegov
parents:
diff changeset
   141
      "      false" "\n"
db83eceba962 8164546: Convert DirectivesParser_test to GTest
ppunegov
parents:
diff changeset
   142
      "    ]," "\n"
db83eceba962 8164546: Convert DirectivesParser_test to GTest
ppunegov
parents:
diff changeset
   143
      "  }" "\n"
db83eceba962 8164546: Convert DirectivesParser_test to GTest
ppunegov
parents:
diff changeset
   144
      "]" "\n");
db83eceba962 8164546: Convert DirectivesParser_test to GTest
ppunegov
parents:
diff changeset
   145
}
db83eceba962 8164546: Convert DirectivesParser_test to GTest
ppunegov
parents:
diff changeset
   146
db83eceba962 8164546: Convert DirectivesParser_test to GTest
ppunegov
parents:
diff changeset
   147
TEST_VM_F(DirectivesParserTest, multiple_objects) {
db83eceba962 8164546: Convert DirectivesParser_test to GTest
ppunegov
parents:
diff changeset
   148
  test_positive(
db83eceba962 8164546: Convert DirectivesParser_test to GTest
ppunegov
parents:
diff changeset
   149
      "[" "\n"
db83eceba962 8164546: Convert DirectivesParser_test to GTest
ppunegov
parents:
diff changeset
   150
      "  {"
db83eceba962 8164546: Convert DirectivesParser_test to GTest
ppunegov
parents:
diff changeset
   151
      "    // pattern to match against class+method+signature" "\n"
db83eceba962 8164546: Convert DirectivesParser_test to GTest
ppunegov
parents:
diff changeset
   152
      "    // leading and trailing wildcard (*) allowed" "\n"
db83eceba962 8164546: Convert DirectivesParser_test to GTest
ppunegov
parents:
diff changeset
   153
      "    match: \"foo/bar.*\"," "\n"
db83eceba962 8164546: Convert DirectivesParser_test to GTest
ppunegov
parents:
diff changeset
   154
      "" "\n"
db83eceba962 8164546: Convert DirectivesParser_test to GTest
ppunegov
parents:
diff changeset
   155
      "    // override defaults for specified compiler" "\n"
db83eceba962 8164546: Convert DirectivesParser_test to GTest
ppunegov
parents:
diff changeset
   156
      "    // we may differentiate between levels too. TBD." "\n"
db83eceba962 8164546: Convert DirectivesParser_test to GTest
ppunegov
parents:
diff changeset
   157
      "    c1:  {" "\n"
db83eceba962 8164546: Convert DirectivesParser_test to GTest
ppunegov
parents:
diff changeset
   158
      "      //override c1 presets " "\n"
db83eceba962 8164546: Convert DirectivesParser_test to GTest
ppunegov
parents:
diff changeset
   159
      "      DumpReplay: false," "\n"
db83eceba962 8164546: Convert DirectivesParser_test to GTest
ppunegov
parents:
diff changeset
   160
      "      BreakAtCompile: true," "\n"
db83eceba962 8164546: Convert DirectivesParser_test to GTest
ppunegov
parents:
diff changeset
   161
      "    }," "\n"
db83eceba962 8164546: Convert DirectivesParser_test to GTest
ppunegov
parents:
diff changeset
   162
      "" "\n"
db83eceba962 8164546: Convert DirectivesParser_test to GTest
ppunegov
parents:
diff changeset
   163
      "    c2: {" "\n"
db83eceba962 8164546: Convert DirectivesParser_test to GTest
ppunegov
parents:
diff changeset
   164
      "        // control inlining of method" "\n"
db83eceba962 8164546: Convert DirectivesParser_test to GTest
ppunegov
parents:
diff changeset
   165
      "        // + force inline, - dont inline" "\n"
db83eceba962 8164546: Convert DirectivesParser_test to GTest
ppunegov
parents:
diff changeset
   166
      "        inline : \"+java/util.*\"," "\n"
db83eceba962 8164546: Convert DirectivesParser_test to GTest
ppunegov
parents:
diff changeset
   167
      "        PrintInlining: true," "\n"
db83eceba962 8164546: Convert DirectivesParser_test to GTest
ppunegov
parents:
diff changeset
   168
      "    }," "\n"
db83eceba962 8164546: Convert DirectivesParser_test to GTest
ppunegov
parents:
diff changeset
   169
      "" "\n"
db83eceba962 8164546: Convert DirectivesParser_test to GTest
ppunegov
parents:
diff changeset
   170
      "    // directives outside a specific preset applies to all compilers" "\n"
db83eceba962 8164546: Convert DirectivesParser_test to GTest
ppunegov
parents:
diff changeset
   171
      "    inline : [ \"+java/util.*\", \"-com/sun.*\"]," "\n"
db83eceba962 8164546: Convert DirectivesParser_test to GTest
ppunegov
parents:
diff changeset
   172
      "    BreakAtExecute: true," "\n"
db83eceba962 8164546: Convert DirectivesParser_test to GTest
ppunegov
parents:
diff changeset
   173
      "    Log: true," "\n"
db83eceba962 8164546: Convert DirectivesParser_test to GTest
ppunegov
parents:
diff changeset
   174
      "  }," "\n"
db83eceba962 8164546: Convert DirectivesParser_test to GTest
ppunegov
parents:
diff changeset
   175
      "  {" "\n"
db83eceba962 8164546: Convert DirectivesParser_test to GTest
ppunegov
parents:
diff changeset
   176
      "    // matching several patterns require an array" "\n"
db83eceba962 8164546: Convert DirectivesParser_test to GTest
ppunegov
parents:
diff changeset
   177
      "    match: [\"baz.*\",\"frob.*\"]," "\n"
db83eceba962 8164546: Convert DirectivesParser_test to GTest
ppunegov
parents:
diff changeset
   178
      "" "\n"
db83eceba962 8164546: Convert DirectivesParser_test to GTest
ppunegov
parents:
diff changeset
   179
      "    // applies to all compilers" "\n"
db83eceba962 8164546: Convert DirectivesParser_test to GTest
ppunegov
parents:
diff changeset
   180
      "    // + force inline, - dont inline" "\n"
db83eceba962 8164546: Convert DirectivesParser_test to GTest
ppunegov
parents:
diff changeset
   181
      "    inline : [ \"+java/util.*\", \"-com/sun.*\" ]," "\n"
db83eceba962 8164546: Convert DirectivesParser_test to GTest
ppunegov
parents:
diff changeset
   182
      "    PrintInlining: true," "\n"
db83eceba962 8164546: Convert DirectivesParser_test to GTest
ppunegov
parents:
diff changeset
   183
      "" "\n"
db83eceba962 8164546: Convert DirectivesParser_test to GTest
ppunegov
parents:
diff changeset
   184
      "    // force matching compiles to be blocking/syncronous" "\n"
db83eceba962 8164546: Convert DirectivesParser_test to GTest
ppunegov
parents:
diff changeset
   185
      "    PrintNMethods: true" "\n"
db83eceba962 8164546: Convert DirectivesParser_test to GTest
ppunegov
parents:
diff changeset
   186
      "  }," "\n"
db83eceba962 8164546: Convert DirectivesParser_test to GTest
ppunegov
parents:
diff changeset
   187
      "]" "\n");
db83eceba962 8164546: Convert DirectivesParser_test to GTest
ppunegov
parents:
diff changeset
   188
}
db83eceba962 8164546: Convert DirectivesParser_test to GTest
ppunegov
parents:
diff changeset
   189
db83eceba962 8164546: Convert DirectivesParser_test to GTest
ppunegov
parents:
diff changeset
   190
// Test max stack depth
db83eceba962 8164546: Convert DirectivesParser_test to GTest
ppunegov
parents:
diff changeset
   191
TEST_VM_F(DirectivesParserTest, correct_max_stack_depth) {
db83eceba962 8164546: Convert DirectivesParser_test to GTest
ppunegov
parents:
diff changeset
   192
  test_positive(
db83eceba962 8164546: Convert DirectivesParser_test to GTest
ppunegov
parents:
diff changeset
   193
      "[" "\n"              // depth 1: type_dir_array
db83eceba962 8164546: Convert DirectivesParser_test to GTest
ppunegov
parents:
diff changeset
   194
      "  {" "\n"            // depth 2: type_directives
db83eceba962 8164546: Convert DirectivesParser_test to GTest
ppunegov
parents:
diff changeset
   195
      "    match: \"*.*\"," // match required
db83eceba962 8164546: Convert DirectivesParser_test to GTest
ppunegov
parents:
diff changeset
   196
      "    c1:" "\n"        // depth 3: type_c1
db83eceba962 8164546: Convert DirectivesParser_test to GTest
ppunegov
parents:
diff changeset
   197
      "    {" "\n"
db83eceba962 8164546: Convert DirectivesParser_test to GTest
ppunegov
parents:
diff changeset
   198
      "      inline:" "\n"  // depth 4: type_inline
db83eceba962 8164546: Convert DirectivesParser_test to GTest
ppunegov
parents:
diff changeset
   199
      "      [" "\n"        // depth 5: type_value_array
db83eceba962 8164546: Convert DirectivesParser_test to GTest
ppunegov
parents:
diff changeset
   200
      "        \"foo\"," "\n"
db83eceba962 8164546: Convert DirectivesParser_test to GTest
ppunegov
parents:
diff changeset
   201
      "        \"bar\"," "\n"
db83eceba962 8164546: Convert DirectivesParser_test to GTest
ppunegov
parents:
diff changeset
   202
      "      ]" "\n"        // depth 3: pop type_value_array and type_inline keys
db83eceba962 8164546: Convert DirectivesParser_test to GTest
ppunegov
parents:
diff changeset
   203
      "    }" "\n"          // depth 2: pop type_c1 key
db83eceba962 8164546: Convert DirectivesParser_test to GTest
ppunegov
parents:
diff changeset
   204
      "  }" "\n"            // depth 1: pop type_directives key
db83eceba962 8164546: Convert DirectivesParser_test to GTest
ppunegov
parents:
diff changeset
   205
      "]" "\n");            // depth 0: pop type_dir_array key
db83eceba962 8164546: Convert DirectivesParser_test to GTest
ppunegov
parents:
diff changeset
   206
}
db83eceba962 8164546: Convert DirectivesParser_test to GTest
ppunegov
parents:
diff changeset
   207
db83eceba962 8164546: Convert DirectivesParser_test to GTest
ppunegov
parents:
diff changeset
   208
// Test max stack depth
db83eceba962 8164546: Convert DirectivesParser_test to GTest
ppunegov
parents:
diff changeset
   209
TEST_VM_F(DirectivesParserTest, incorrect_max_stack_depth) {
db83eceba962 8164546: Convert DirectivesParser_test to GTest
ppunegov
parents:
diff changeset
   210
  test_negative("[{c1:{c1:{c1:{c1:{c1:{c1:{c1:{}}}}}}}}]");
db83eceba962 8164546: Convert DirectivesParser_test to GTest
ppunegov
parents:
diff changeset
   211
}