[asan] improve SetErrorReportCallbackTest to actually catch missing functionality in __asan_set_error_report_callback

git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@162745 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/asan/Makefile.old b/lib/asan/Makefile.old
index 4ab80e2..83c8276 100644
--- a/lib/asan/Makefile.old
+++ b/lib/asan/Makefile.old
@@ -237,7 +237,7 @@
 #	cp -v $(CLANG_BUILD)/lib/libasan*.a $(INSTALL_DIR)/lib
 
 $(BIN)/asan_noinst_test$(SUFF).o: tests/asan_noinst_test.cc $(RTL_HDR) $(MAKEFILE)
-	$(CLEANROOM_CXX) $(PIE) $(CFLAGS) $(GTEST_INCLUDE) -I. -I.. -g -c $< -O2 -o $@
+	$(CLEANROOM_CXX) $(COMMON_ASAN_DEFINES) $(PIE) $(CFLAGS) $(GTEST_INCLUDE) -I. -I.. -g -c $< -O2 -o $@
 
 $(BIN)/asan_break_optimization$(SUFF).o: tests/asan_break_optimization.cc $(MAKEFILE)
 	$(CLEANROOM_CXX) $(PIE) $(CFLAGS) -c $< -O0 -o $@
diff --git a/lib/asan/tests/asan_noinst_test.cc b/lib/asan/tests/asan_noinst_test.cc
index e066d0b..e50ce45 100644
--- a/lib/asan/tests/asan_noinst_test.cc
+++ b/lib/asan/tests/asan_noinst_test.cc
@@ -17,6 +17,7 @@
 #include "asan_mapping.h"
 #include "asan_stack.h"
 #include "asan_test_utils.h"
+#include "asan_test_config.h"
 
 #include <assert.h>
 #include <stdio.h>
@@ -677,11 +678,15 @@
 
 static void ErrorReportCallbackOneToZ(const char *report) {
   write(2, "ABCDEF", 6);
+  write(2, report, strlen(report));
+  write(2, "ABCDEF", 6);
+  _exit(1);
 }
 
 TEST(AddressSanitizerInterface, SetErrorReportCallbackTest) {
   __asan_set_error_report_callback(ErrorReportCallbackOneToZ);
-  EXPECT_DEATH(__asan_report_error(0, 0, 0, 0, true, 1), "ABCDEF");
+  EXPECT_DEATH(__asan_report_error(0, 0, 0, 0, true, 1),
+               ASAN_PCRE_DOTALL "ABCDEF.*AddressSanitizer.*WRITE.*ABCDEF");
   __asan_set_error_report_callback(NULL);
 }