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

Fix problems.

parent 7693365a
......@@ -570,6 +570,7 @@ public:
}
context.exit();
KJ_CLANG_KNOWS_THIS_IS_UNREACHABLE_BUT_GCC_DOESNT;
}
private:
......@@ -690,6 +691,7 @@ public:
output.flush();
context.exit();
KJ_CLANG_KNOWS_THIS_IS_UNREACHABLE_BUT_GCC_DOESNT;
}
kj::MainBuilder::Validity evalConst(kj::StringPtr type) {
......@@ -724,6 +726,7 @@ public:
} else {
return "no such type";
}
KJ_CLANG_KNOWS_THIS_IS_UNREACHABLE_BUT_GCC_DOESNT;
}
private:
......
......@@ -739,18 +739,7 @@ bool checkChange(ParsedFile::Reader file1, ParsedFile::Reader file2, ChangeKind
}
}
kj::MainBuilder::Validity doTest(uint seed) {
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");
void doTest() {
auto builder = kj::heap<MallocMessageBuilder>();
{
......@@ -840,8 +829,6 @@ kj::MainBuilder::Validity doTest(uint seed) {
builder = kj::mv(newBuilder);
}
}
return true;
}
class EvolutionTestMain {
......@@ -855,7 +842,7 @@ public:
"and verifies that they do actually remain compatible.")
.addOptionWithArg({"seed"}, KJ_BIND_METHOD(*this, setSeed), "<num>",
"Set random number seed to <num>. By default, time() is used.")
.callAfterParsing([this]() { return doTest(seed); })
.callAfterParsing(KJ_BIND_METHOD(*this, run))
.build();
}
......@@ -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:
kj::ProcessContext& context;
uint seed = time(nullptr);
......
......@@ -292,7 +292,7 @@ inline RepeatChar KJ_STRINGIFY(RepeatChar value) { return value; }
ExceptionCallback::ExceptionCallback(): next(getExceptionCallback()) {
char 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.");
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