13 * ac_heapanied 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 "logTestUtils.inline.hpp"
26 #include "logging/logConfiguration.hpp"
27 #include "logging/logTagSet.hpp"
28 #include "logging/logTagSetDescriptions.hpp"
29 #include "memory/resourceArea.hpp"
30 #include "unittest.hpp"
31 #include "utilities/ostream.hpp"
32
33 TEST(LogTagSetDescriptions, describe) {
34 for (LogTagSetDescription* d = tagset_descriptions; d->tagset != NULL; d++) {
35 char expected[1 * K];
36 d->tagset->label(expected, sizeof(expected), "+");
37 jio_snprintf(expected + strlen(expected),
38 sizeof(expected) - strlen(expected),
39 ": %s", d->descr);
40
41 ResourceMark rm;
42 stringStream stream;
43 LogConfiguration::describe(&stream);
44 EXPECT_PRED2(string_contains_substring, stream.as_string(), expected)
45 << "missing log tag set descriptions in LogConfiguration::describe";
46 }
47 }
48
49 TEST(LogTagSetDescriptions, command_line_help) {
50 const char* filename = "logtagset_descriptions";
51 FILE* fp = fopen(filename, "w+");
52 ASSERT_NE((void*)NULL, fp);
53 LogConfiguration::print_command_line_help(fp);
54 fclose(fp);
55
56 for (LogTagSetDescription* d = tagset_descriptions; d->tagset != NULL; d++) {
57 char expected[1 * K];
58 d->tagset->label(expected, sizeof(expected), "+");
59 jio_snprintf(expected + strlen(expected),
60 sizeof(expected) - strlen(expected),
61 ": %s", d->descr);
62
63 EXPECT_TRUE(file_contains_substring(filename, expected)) << "missing log tag set descriptions in -Xlog:help output";
64 }
65 delete_file(filename);
66 }
|
13 * ac_heapanied 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 "logTestUtils.inline.hpp"
26 #include "logging/logConfiguration.hpp"
27 #include "logging/logTagSet.hpp"
28 #include "logging/logTagSetDescriptions.hpp"
29 #include "memory/resourceArea.hpp"
30 #include "unittest.hpp"
31 #include "utilities/ostream.hpp"
32
33 TEST_VM(LogTagSetDescriptions, describe) {
34 for (LogTagSetDescription* d = tagset_descriptions; d->tagset != NULL; d++) {
35 char expected[1 * K];
36 d->tagset->label(expected, sizeof(expected), "+");
37 jio_snprintf(expected + strlen(expected),
38 sizeof(expected) - strlen(expected),
39 ": %s", d->descr);
40
41 ResourceMark rm;
42 stringStream stream;
43 LogConfiguration::describe(&stream);
44 EXPECT_PRED2(string_contains_substring, stream.as_string(), expected)
45 << "missing log tag set descriptions in LogConfiguration::describe";
46 }
47 }
48
49 TEST_VM(LogTagSetDescriptions, command_line_help) {
50 const char* filename = "logtagset_descriptions";
51 FILE* fp = fopen(filename, "w+");
52 ASSERT_NE((void*)NULL, fp);
53 LogConfiguration::print_command_line_help(fp);
54 fclose(fp);
55
56 for (LogTagSetDescription* d = tagset_descriptions; d->tagset != NULL; d++) {
57 char expected[1 * K];
58 d->tagset->label(expected, sizeof(expected), "+");
59 jio_snprintf(expected + strlen(expected),
60 sizeof(expected) - strlen(expected),
61 ": %s", d->descr);
62
63 EXPECT_TRUE(file_contains_substring(filename, expected)) << "missing log tag set descriptions in -Xlog:help output";
64 }
65 delete_file(filename);
66 }
|