[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [csmith-dev] How to generate fixed size program using Csmith



shijun zhao <zqyzsj@gmail.com> writes:

> Is there any way for Csmith to generate programs whose size (or the
> lines of code) can be specified? Thanks.

Hi!  No, there is no option that sets the exact size of the generated program.

There are options that influence the possible (maximum) size of the generated
programs.  These include:

  --max-block-depth
  --max-block-size
  --max-expr-complexity
  --max-funcs

If you set these values higher, the generated programs can be bigger.

The easiest way to generate programs in a particular size range is simply to
generate a lot of programs and discard the ones that don't fall into the size
range you want.

Warning: If you have a very narrow range, you might have to run Csmith many,
many times to get the total number of programs that you want!  My advice is to
not make your ranges too narrow.  "Exactly 100K" is bad; "between 90K and 110K"
is better.

Happy hacking! ---

Eric.

-- 
-------------------------------------------------------------------------------
Eric Eide <eeide@cs.utah.edu>  .         University of Utah School of Computing
http://www.cs.utah.edu/~eeide/ . +1 (801) 585-5512 voice, +1 (801) 581-5843 FAX