Marcin Dalecki wrote:
Wiadomość napisana w dniu 2007-01-24, o godz10:12, przez Michael Veksler:
Andrew, you are both correct and incorrect. Certainly, deterministic unit testing is not very useful. However, random unit testing is priceless. I have been doing pseudo-random unit tests for years, believe me it makes your code practically
bug free.

However the problem with applying this kind of methods to GCC would actually be finding the units inside the spaghetti. Even a curious look at for example how -ffast-math works did give me recently a run from the compiler 'driver' down to the c4x back-end. An trivial attempt at doing something about it resulted in a request for a "full
bootstrap without regressions" for a platform:

This issue of legacy spaghetti is well known and understood. From my experience, this can't be fixed in one go. However, it is possible to have a road-map in which:

  1. New code is written in a way that allows random unit testing.
  2. Old code is gradually changed.
  3. For the time being, integrate unit tests in GCC code (with #ifdef
     or some
     such).
     For example, there will be a code to synthesize some random GIMPLE
     or RTL and pass it to an optimization pass. Then some invariants
     will be
     checked on the resulting GIMPLE/RTL. This is quite complex, but
     IMHO doable.

From my experience on my small constraint solver (80,000 LOC) by making stuff
more suitable for random unit testing you get:

  1. Maintainable+reusable code (with all its benefits).
  2. Faster code: Due to simplicity of each unit, it is
     easier to understand and implement algorithmic enhancements.

If it will involve CP ( http://en.wikipedia.org/wiki/Constraint_programming ) or CSP solving then there is a slight chance that I will be able to squeeze some of this into my schedule of 2008, not before. (I refer only to proof of concept, at most
a prototype not more).
--

Michael Veksler
http:///tx.technion.ac.il/~mveksler

Reply via email to