Debian Codegraph @

scripts/prep

raw
1 #!/usr/bin/env perl
2 ##
3 ## Copyright (c) 2012 The University of Utah
4 ## All rights reserved.
5 ##
6 ## This file is distributed under the University of Illinois Open Source
7 ## License. See the file COPYING for details.
8
9 ###############################################################################
10
11 ### this script preps a testcase for reduction and calls the result
12 ### small.c; it takes the same arguments as Csmith
13
14 use strict;
15 use warnings;
16
17 my $CSMITH_HOME = $ENV{"CSMITH_HOME"};
18 die if (!defined($CSMITH_HOME));
19
20 my $CREDUCE_HOME = $ENV{"CREDUCE_HOME"};
21 die if (!defined($CREDUCE_HOME));
22
23 my $outfile = "orig_csmith_output.c";
24 for (my $i=0; $i<scalar(@ARGV); $i++) {
25 if ($ARGV[$i] eq "--output") {
26 $outfile = $ARGV[$i+1];
27 }
28 }
29 die if (!defined($outfile));
30
31 system "${CSMITH_HOME}/src/csmith @ARGV";
32
33 system "gcc -E -I${CSMITH_HOME}/runtime -DCSMITH_MINIMAL $outfile | ${CREDUCE_HOME}/scripts/shorten > small.c";
34
35 system "indent small.c";