8149591: Prepare hotspot for GTest

Co-authored-by: Stefan Karlsson <stefan.karlsson@oracle.com>
Co-authored-by: Stefan Sarne <stefan.sarne@oracle.com>
Co-authored-by: Jesper Wilhelmsson <jesper.wilhelmsson@oracle.com>
Co-authored-by: Erik Helin <erik.helin@oracle.com>
Co-authored-by: Alexandre Iline <alexandre.iline@oracle.com>
Reviewed-by: jwilhelm
This commit is contained in:
Igor Ignatyev 2016-05-09 14:15:39 +03:00
parent fdc03a7cd8
commit 66686b8152
7 changed files with 145 additions and 63 deletions

View file

@ -58,6 +58,8 @@
#include "trace/tracing.hpp"
#endif
#include <stdio.h>
#ifndef ASSERT
# ifdef _DEBUG
// NOTE: don't turn the lines below into a comment -- if you're getting
@ -187,7 +189,7 @@ bool error_is_suppressed(const char* file_name, int line_no) {
return true;
}
if (!is_error_reported()) {
if (!is_error_reported() && !SuppressFatalErrorMessage) {
// print a friendly hint:
fdStream out(defaultStream::output_fd());
out.print_raw_cr("# To suppress the following error report, specify this argument");
@ -262,6 +264,21 @@ void report_unimplemented(const char* file, int line) {
report_vm_error(file, line, "Unimplemented()");
}
#ifdef ASSERT
bool is_executing_unit_tests() {
return ExecutingUnitTests;
}
void report_assert_msg(const char* msg, ...) {
va_list ap;
va_start(ap, msg);
fprintf(stderr, "assert failed: %s\n", err_msg(FormatBufferDummy(), msg, ap).buffer());
va_end(ap);
}
#endif // ASSERT
void report_untested(const char* file, int line, const char* message) {
#ifndef PRODUCT
warning("Untested: %s in %s: %d\n", message, file, line);