< prev index next >

test/hotspot/gtest/logging/logTestFixture.cpp

Print this page




  10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12  * version 2 for more details (a copy is included in the LICENSE file that
  13  * accompanied 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 "jvm.h"
  26 #include "logTestFixture.hpp"
  27 #include "logTestUtils.inline.hpp"
  28 #include "logging/logConfiguration.hpp"
  29 #include "logging/logOutput.hpp"

  30 #include "memory/resourceArea.hpp"
  31 #include "unittest.hpp"
  32 #include "utilities/ostream.hpp"
  33 
  34 LogTestFixture::LogTestFixture() : _configuration_snapshot(NULL), _n_snapshots(0) {
  35   // Set up TestLogFileName to include PID, testcase name and test name
  36   int ret = jio_snprintf(_filename, sizeof(_filename), "testlog.pid%d.%s.%s.log",
  37                          os::current_process_id(),
  38                          ::testing::UnitTest::GetInstance()->current_test_info()->test_case_name(),
  39                          ::testing::UnitTest::GetInstance()->current_test_info()->name());
  40   EXPECT_GT(ret, 0) << "_filename buffer issue";
  41   TestLogFileName = _filename;
  42 
  43   snapshot_config();
  44 }
  45 
  46 LogTestFixture::~LogTestFixture() {
  47   restore_config();
  48   clear_snapshot();
  49   delete_file(TestLogFileName);




  10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12  * version 2 for more details (a copy is included in the LICENSE file that
  13  * accompanied 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 "jvm.h"
  26 #include "logTestFixture.hpp"
  27 #include "logTestUtils.inline.hpp"
  28 #include "logging/logConfiguration.hpp"
  29 #include "logging/logOutput.hpp"
  30 #include "memory/allocation.inline.hpp"
  31 #include "memory/resourceArea.hpp"
  32 #include "unittest.hpp"
  33 #include "utilities/ostream.hpp"
  34 
  35 LogTestFixture::LogTestFixture() : _configuration_snapshot(NULL), _n_snapshots(0) {
  36   // Set up TestLogFileName to include PID, testcase name and test name
  37   int ret = jio_snprintf(_filename, sizeof(_filename), "testlog.pid%d.%s.%s.log",
  38                          os::current_process_id(),
  39                          ::testing::UnitTest::GetInstance()->current_test_info()->test_case_name(),
  40                          ::testing::UnitTest::GetInstance()->current_test_info()->name());
  41   EXPECT_GT(ret, 0) << "_filename buffer issue";
  42   TestLogFileName = _filename;
  43 
  44   snapshot_config();
  45 }
  46 
  47 LogTestFixture::~LogTestFixture() {
  48   restore_config();
  49   clear_snapshot();
  50   delete_file(TestLogFileName);


< prev index next >