File: prep

package info (click to toggle)
creduce 2.11.0~20240909-2.1
  • links: PTS
  • area: main
  • in suites: forky, sid
  • size: 5,296 kB
  • sloc: cpp: 25,309; ansic: 7,233; sh: 4,918; perl: 3,003; makefile: 594; lex: 441
file content (35 lines) | stat: -rwxr-xr-x 951 bytes parent folder | download | duplicates (7)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
#!/usr/bin/env perl
##
## Copyright (c) 2012 The University of Utah
## All rights reserved.
##
## This file is distributed under the University of Illinois Open Source
## License.  See the file COPYING for details.

###############################################################################

### this script preps a testcase for reduction and calls the result
### small.c; it takes the same arguments as Csmith

use strict;
use warnings;

my $CSMITH_HOME = $ENV{"CSMITH_HOME"};
die if (!defined($CSMITH_HOME));

my $CREDUCE_HOME = $ENV{"CREDUCE_HOME"};
die if (!defined($CREDUCE_HOME));

my $outfile = "orig_csmith_output.c";
for (my $i=0; $i<scalar(@ARGV); $i++) {
    if ($ARGV[$i] eq "--output") {
	$outfile = $ARGV[$i+1];
    }
}
die if (!defined($outfile)); 

system "${CSMITH_HOME}/src/csmith @ARGV";

system "gcc -E -I${CSMITH_HOME}/runtime -DCSMITH_MINIMAL $outfile | ${CREDUCE_HOME}/scripts/shorten > small.c";

system "indent small.c";