On May 21, 11 06:01, Vladimir Panteleev wrote:
Inspired by Tigris Delta and the "Want to help DMD bugfixing? Write a
simple utility" thread from digitalmars.D.learn. I hope the DMD
development team will find this useful.

Advantages over Tigris delta:

* Easy to use (takes only two arguments, no need to fiddle with levels)
* Readable output (comments and indentation are preserved)
* Native support for multiple files (accepts a path to an entire
directory for input)
* Written for D
* Written in D
* Not written in Perl
* Can recognize constructs such as try/catch, function invariants
(in/out/body)
* Only 440 lines of source code

If you've never used delta: this is a tool which attempts to shrink
files by deleting fragments iteratively, as long as the file satisfies a
user-specified condition (for example, a specific error message when
passed through the compiler).

Usage:

1. Formulate a condition command, which should exit with a status code
of 0 when DustMite is on the right track, and anything else otherwise.
Example: dmd test.d 2>&1 | grep -qF "Assertion failed"
2. Place all the files that dustmite is to minimize in a new directory.
3. If you'd like to test your condition command, don't forget to clean
up temporary files afterwards.
4. Run: dustmite path/to/directory test-command
5. After a while, dustmite will finish working and create
path/to/directory.reduced

I've tested it with a self-induced "bug" in std.datetime, it seems to
work great. If you find that it breaks on something, let me know.

https://github.com/CyberShadow/DustMite


Nice tool! I tried to use it to reduce bug 6044, but encountered 2 problems:

1. DustMite will load _all_ files, including the _binary_ ones, which
   is seldom in valid UTF-8 encoding, and that causes a UtfException to
   be thrown from 'save.dump' because 'e.header' contains those invalid
   character. (BTW, Andrei, is it really necessary to include the whole
   invalid string in the exception?!)

2. For 6044, DustMite has overdone. It has reduced to an obviously
   invalid program

      void main() {
          alias Maybe A;
      // ok
          A.Impl!int u;       // error
      }

   but I guess it can't be avoided, since its error message is exactly
   the same as the correct one I reported.

Reply via email to