Add checkpoint diagnostics to help diagnose buildbot failures.

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@275754 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Eric Fiselier
2016-07-18 03:00:09 +00:00
parent 0751cc188f
commit f5750d5c05
2 changed files with 11 additions and 2 deletions

View File

@@ -28,10 +28,12 @@
#include <cassert> #include <cassert>
#include "platform_support.h" // locale name macros #include "platform_support.h" // locale name macros
#include "assert_checkpoint.h"
int main() int main()
{ {
{ {
CHECKPOINT("constructing en-US.UTF-8");
std::locale l(LOCALE_en_US_UTF_8); std::locale l(LOCALE_en_US_UTF_8);
{ {
assert(std::has_facet<std::ctype_byname<char> >(l)); assert(std::has_facet<std::ctype_byname<char> >(l));
@@ -45,6 +47,7 @@ int main()
} }
} }
{ {
CHECKPOINT("constructing default locale");
std::locale l(""); std::locale l("");
{ {
assert(std::has_facet<std::ctype_byname<char> >(l)); assert(std::has_facet<std::ctype_byname<char> >(l));
@@ -58,6 +61,7 @@ int main()
} }
} }
{ {
CHECKPOINT("constructing C locale");
std::locale l("C"); std::locale l("C");
{ {
assert(std::has_facet<std::ctype_byname<char> >(l)); assert(std::has_facet<std::ctype_byname<char> >(l));

View File

@@ -11,6 +11,11 @@ struct Checkpoint {
int line; int line;
const char* msg; const char* msg;
Checkpoint() : file(nullptr), func(nullptr), line(-1), msg(nullptr) {}
Checkpoint(const char* xfile, const char* xfunc, int xline, const char* xmsg)
: file(xfile), func(xfunc), line(xline), msg(xmsg)
{}
template <class Stream> template <class Stream>
void print(Stream& s) const { void print(Stream& s) const {
if (!file) { if (!file) {
@@ -30,7 +35,7 @@ inline Checkpoint& globalCheckpoint() {
} }
inline void clearCheckpoint() { inline void clearCheckpoint() {
globalCheckpoint() = {}; globalCheckpoint() = Checkpoint();
} }
#if defined(__GNUC__) #if defined(__GNUC__)
@@ -39,7 +44,7 @@ inline void clearCheckpoint() {
#define CHECKPOINT_FUNCTION_NAME __func__ #define CHECKPOINT_FUNCTION_NAME __func__
#endif #endif
#define CHECKPOINT(msg) globalCheckpoint() = Checkpoint{__FILE__, CHECKPOINT_FUNCTION_NAME, __LINE__, msg} #define CHECKPOINT(msg) globalCheckpoint() = Checkpoint(__FILE__, CHECKPOINT_FUNCTION_NAME, __LINE__, msg);
inline void checkpointSignalHandler(int signal) { inline void checkpointSignalHandler(int signal) {
if (signal == SIGABRT) { if (signal == SIGABRT) {