test/hotspot/gtest/logging/logTestFixture.cpp
changeset 53845 1807da9ad196
parent 51334 cc2c79d22508
equal deleted inserted replaced
53844:8323fdac6da5 53845:1807da9ad196
     1 /*
     1 /*
     2  * Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved.
     2  * Copyright (c) 2016, 2019, 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.
    31 #include "memory/resourceArea.hpp"
    31 #include "memory/resourceArea.hpp"
    32 #include "unittest.hpp"
    32 #include "unittest.hpp"
    33 #include "utilities/ostream.hpp"
    33 #include "utilities/ostream.hpp"
    34 
    34 
    35 LogTestFixture::LogTestFixture() : _n_snapshots(0), _configuration_snapshot(NULL) {
    35 LogTestFixture::LogTestFixture() : _n_snapshots(0), _configuration_snapshot(NULL) {
    36   // Set up TestLogFileName to include PID, testcase name and test name
    36 
    37   int ret = jio_snprintf(_filename, sizeof(_filename), "testlog.pid%d.%s.%s.log",
    37   // Set up TestLogFileName to include temp_dir, PID, testcase name and test name.
    38                          os::current_process_id(),
    38   const testing::TestInfo* test_info = ::testing::UnitTest::GetInstance()->current_test_info();
    39                          ::testing::UnitTest::GetInstance()->current_test_info()->test_case_name(),
    39   int ret = jio_snprintf(_filename, sizeof(_filename), "%s%stestlog.pid%d.%s.%s.log",
    40                          ::testing::UnitTest::GetInstance()->current_test_info()->name());
    40                          os::get_temp_directory(), os::file_separator(), os::current_process_id(),
       
    41                          test_info->test_case_name(), test_info->name());
    41   EXPECT_GT(ret, 0) << "_filename buffer issue";
    42   EXPECT_GT(ret, 0) << "_filename buffer issue";
    42   TestLogFileName = _filename;
    43   TestLogFileName = _filename;
    43 
    44 
    44   snapshot_config();
    45   snapshot_config();
    45 }
    46 }