Commit 9474ca44 authored by Kenton Varda's avatar Kenton Varda

Fix problems.

parent 7693365a
...@@ -570,6 +570,7 @@ public: ...@@ -570,6 +570,7 @@ public:
} }
context.exit(); context.exit();
KJ_CLANG_KNOWS_THIS_IS_UNREACHABLE_BUT_GCC_DOESNT;
} }
private: private:
...@@ -690,6 +691,7 @@ public: ...@@ -690,6 +691,7 @@ public:
output.flush(); output.flush();
context.exit(); context.exit();
KJ_CLANG_KNOWS_THIS_IS_UNREACHABLE_BUT_GCC_DOESNT;
} }
kj::MainBuilder::Validity evalConst(kj::StringPtr type) { kj::MainBuilder::Validity evalConst(kj::StringPtr type) {
...@@ -724,6 +726,7 @@ public: ...@@ -724,6 +726,7 @@ public:
} else { } else {
return "no such type"; return "no such type";
} }
KJ_CLANG_KNOWS_THIS_IS_UNREACHABLE_BUT_GCC_DOESNT;
} }
private: private:
......
...@@ -739,18 +739,7 @@ bool checkChange(ParsedFile::Reader file1, ParsedFile::Reader file2, ChangeKind ...@@ -739,18 +739,7 @@ bool checkChange(ParsedFile::Reader file1, ParsedFile::Reader file2, ChangeKind
} }
} }
kj::MainBuilder::Validity doTest(uint seed) { void doTest() {
srand(seed);
{
kj::String text = kj::str(
"Randomly testing backwards-compatibility scenarios...\n"
"seed = ", seed, " <- PLEASE RECORD THIS NUMBER IF THE TEST FAILS\n");
kj::FdOutputStream(STDOUT_FILENO).write(text.begin(), text.size());
}
KJ_CONTEXT(seed, "PLEASE REPORT THIS FAILURE AND INCLUDE THE SEED");
auto builder = kj::heap<MallocMessageBuilder>(); auto builder = kj::heap<MallocMessageBuilder>();
{ {
...@@ -840,8 +829,6 @@ kj::MainBuilder::Validity doTest(uint seed) { ...@@ -840,8 +829,6 @@ kj::MainBuilder::Validity doTest(uint seed) {
builder = kj::mv(newBuilder); builder = kj::mv(newBuilder);
} }
} }
return true;
} }
class EvolutionTestMain { class EvolutionTestMain {
...@@ -855,7 +842,7 @@ public: ...@@ -855,7 +842,7 @@ public:
"and verifies that they do actually remain compatible.") "and verifies that they do actually remain compatible.")
.addOptionWithArg({"seed"}, KJ_BIND_METHOD(*this, setSeed), "<num>", .addOptionWithArg({"seed"}, KJ_BIND_METHOD(*this, setSeed), "<num>",
"Set random number seed to <num>. By default, time() is used.") "Set random number seed to <num>. By default, time() is used.")
.callAfterParsing([this]() { return doTest(seed); }) .callAfterParsing(KJ_BIND_METHOD(*this, run))
.build(); .build();
} }
...@@ -869,6 +856,23 @@ public: ...@@ -869,6 +856,23 @@ public:
} }
} }
kj::MainBuilder::Validity run() {
srand(seed);
{
kj::String text = kj::str(
"Randomly testing backwards-compatibility scenarios...\n"
"seed = ", seed, " <- PLEASE RECORD THIS NUMBER IF THE TEST FAILS\n");
kj::FdOutputStream(STDOUT_FILENO).write(text.begin(), text.size());
}
KJ_CONTEXT(seed, "PLEASE REPORT THIS FAILURE AND INCLUDE THE SEED");
doTest();
return true;
}
private: private:
kj::ProcessContext& context; kj::ProcessContext& context;
uint seed = time(nullptr); uint seed = time(nullptr);
......
...@@ -292,7 +292,7 @@ inline RepeatChar KJ_STRINGIFY(RepeatChar value) { return value; } ...@@ -292,7 +292,7 @@ inline RepeatChar KJ_STRINGIFY(RepeatChar value) { return value; }
ExceptionCallback::ExceptionCallback(): next(getExceptionCallback()) { ExceptionCallback::ExceptionCallback(): next(getExceptionCallback()) {
char stackVar; char stackVar;
ptrdiff_t offset = reinterpret_cast<char*>(this) - &stackVar; ptrdiff_t offset = reinterpret_cast<char*>(this) - &stackVar;
KJ_ASSERT(offset < 4096 && offset > -4096, KJ_ASSERT(offset < 65536 && offset > -65536,
"ExceptionCallback must be allocated on the stack."); "ExceptionCallback must be allocated on the stack.");
threadLocalCallback = this; threadLocalCallback = this;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment