mirror of
https://github.com/dlang/tools.git
synced 2025-04-30 15:10:47 +03:00
Merge pull request #182 from CyberShadow/dustmite-20160306
Update DustMite
This commit is contained in:
commit
60b0185c07
2 changed files with 20 additions and 8 deletions
|
@ -87,7 +87,8 @@ struct Reduction
|
||||||
e = e.children[a];
|
e = e.children[a];
|
||||||
}
|
}
|
||||||
progress += e.descendants;
|
progress += e.descendants;
|
||||||
return format("[%5.1f%%] %s [%s]", (origDescendants-progress) * 100.0 / origDescendants, name, segments.join(binary ? "" : ", "));
|
auto progressPM = (origDescendants-progress) * 1000 / origDescendants; // per-mille
|
||||||
|
return format("[%2d.%d%%] %s [%s]", progressPM/10, progressPM%10, name, segments.join(binary ? "" : ", "));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -251,11 +252,16 @@ EOS");
|
||||||
auto duration = cast(Duration)times.total.peek();
|
auto duration = cast(Duration)times.total.peek();
|
||||||
duration = dur!"msecs"(duration.total!"msecs"); // truncate anything below ms, users aren't interested in that
|
duration = dur!"msecs"(duration.total!"msecs"); // truncate anything below ms, users aren't interested in that
|
||||||
if (foundAnything)
|
if (foundAnything)
|
||||||
|
{
|
||||||
|
if (root.children.length)
|
||||||
{
|
{
|
||||||
if (noSave)
|
if (noSave)
|
||||||
measure!"resultSave"({safeSave(resultDir);});
|
measure!"resultSave"({safeSave(resultDir);});
|
||||||
writefln("Done in %s tests and %s; reduced version is in %s", tests, duration, resultDir);
|
writefln("Done in %s tests and %s; reduced version is in %s", tests, duration, resultDir);
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
writefln("Done in %s tests and %s; reduced to empty set", tests, duration);
|
||||||
|
}
|
||||||
else
|
else
|
||||||
writefln("Done in %s tests and %s; no reductions found", tests, duration);
|
writefln("Done in %s tests and %s; no reductions found", tests, duration);
|
||||||
|
|
||||||
|
@ -291,7 +297,7 @@ size_t checkDescendants(Entity e)
|
||||||
size_t n = 1;
|
size_t n = 1;
|
||||||
foreach (c; e.children)
|
foreach (c; e.children)
|
||||||
n += checkDescendants(c);
|
n += checkDescendants(c);
|
||||||
assert(e.descendants == n);
|
assert(e.descendants == n, "Wrong descendant count: expected %d, found %d".format(e.descendants, n));
|
||||||
return n;
|
return n;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -313,6 +319,9 @@ bool testAddress(size_t[] address)
|
||||||
{
|
{
|
||||||
auto e = entityAt(address);
|
auto e = entityAt(address);
|
||||||
|
|
||||||
|
if (e is root && !root.children.length)
|
||||||
|
return false;
|
||||||
|
else
|
||||||
if (tryReduction(Reduction(Reduction.Type.Remove, address, e)))
|
if (tryReduction(Reduction(Reduction.Type.Remove, address, e)))
|
||||||
return true;
|
return true;
|
||||||
else
|
else
|
||||||
|
@ -601,7 +610,7 @@ void obfuscate(bool keepLength)
|
||||||
{
|
{
|
||||||
auto result = new char[length];
|
auto result = new char[length];
|
||||||
foreach (i, ref c; result)
|
foreach (i, ref c; result)
|
||||||
c = (i==0 ? first : other)[uniform(0, $, rng)];
|
c = (i==0 ? first : other)[uniform(0, cast(uint)$, rng)];
|
||||||
|
|
||||||
return assumeUnique(result);
|
return assumeUnique(result);
|
||||||
}
|
}
|
||||||
|
@ -840,7 +849,10 @@ void applyReduction(ref Reduction r)
|
||||||
p.children = remove(p.children, r.address[$-1]);
|
p.children = remove(p.children, r.address[$-1]);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
root = new Entity();
|
root = new Entity();
|
||||||
|
root.descendants = 1;
|
||||||
|
}
|
||||||
|
|
||||||
debug verifyNotRemoved(root);
|
debug verifyNotRemoved(root);
|
||||||
debug checkDescendants(root);
|
debug checkDescendants(root);
|
||||||
|
@ -1284,7 +1296,7 @@ void assignID(Entity e)
|
||||||
|
|
||||||
void dumpSet(string fn)
|
void dumpSet(string fn)
|
||||||
{
|
{
|
||||||
auto f = File(fn, "wt");
|
auto f = File(fn, "wb");
|
||||||
|
|
||||||
string printable(string s) { return s is null ? "null" : `"` ~ s.replace("\\", `\\`).replace("\"", `\"`).replace("\r", `\r`).replace("\n", `\n`) ~ `"`; }
|
string printable(string s) { return s is null ? "null" : `"` ~ s.replace("\\", `\\`).replace("\"", `\"`).replace("\r", `\r`).replace("\n", `\n`) ~ `"`; }
|
||||||
string printableFN(string s) { return "/*** " ~ s ~ " ***/"; }
|
string printableFN(string s) { return "/*** " ~ s ~ " ***/"; }
|
||||||
|
|
|
@ -107,7 +107,7 @@ Entity loadFiles(ref string path, ParseOptions options)
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
auto set = new Entity();
|
auto set = new Entity();
|
||||||
foreach (string entry; dirEntries(path, SpanMode.breadth))
|
foreach (string entry; dirEntries(path, SpanMode.breadth).array.sort!((a, b) => a.name < b.name))
|
||||||
if (isFile(entry))
|
if (isFile(entry))
|
||||||
{
|
{
|
||||||
assert(entry.startsWith(path));
|
assert(entry.startsWith(path));
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue