Skip to content

Commit

Permalink
Rename environment variable CSMITH_PATH' to CSMITH_HOME'.
Browse files Browse the repository at this point in the history
  • Loading branch information
eeide committed May 25, 2011
1 parent e26ec75 commit 9cbc259
Show file tree
Hide file tree
Showing 17 changed files with 69 additions and 64 deletions.
7 changes: 6 additions & 1 deletion ChangeLog
@@ -1,6 +1,11 @@
Changes since 2.0.0 release:

By default mark variables and functions as "static" since some
Renamed environment variable `CSMITH_PATH' to be `CSMITH_HOME'.
`HOME' is the common naming convention for variables that identify
a single directory; `PATH' is the convention for lists of
directories.

By default, mark variables and functions as "static" since some
compilers can exploit this to optimize more aggressively.

Loop code generation is significantly generalized [Xuejun: please
Expand Down
12 changes: 6 additions & 6 deletions scripts/compiler_test.pl
Expand Up @@ -66,14 +66,14 @@

my $RUN_PROGRAM = 0;

my $CSMITH_PATH = $ENV{"CSMITH_PATH"};
my $CSMITH_HOME = $ENV{"CSMITH_HOME"};
my $good = 0;
my $crash_bug = 0;
my $wrongcode_bug = 0;
my $csmith_bug = 0;

my $HEADER = "-I$CSMITH_PATH/runtime";
my $CYGWIN_HEADER = "-I`cygpath -d ${CSMITH_PATH}/runtime`";
my $HEADER = "-I$CSMITH_HOME/runtime";
my $CYGWIN_HEADER = "-I`cygpath -d ${CSMITH_HOME}/runtime`";
my $COMPILE_OPTIONS = "";
my @COMPILERS;

Expand Down Expand Up @@ -237,7 +237,7 @@ ($)
# run Csmith until generate a big enough program
while (1) {
unlink $cfile;
my $cmd = "$CSMITH_PATH/src/csmith $CSMITH_USER_OPTIONS --output $cfile";
my $cmd = "$CSMITH_HOME/src/csmith $CSMITH_USER_OPTIONS --output $cfile";
my ($res, $exitcode) = runit($cmd, $CSMITH_TIMEOUT, "csmith.out");
# print "after run csmith: $res, $exitcode\n";

Expand Down Expand Up @@ -288,8 +288,8 @@ ()

########################### main ##################################

if (!(-f "$CSMITH_PATH/runtime/csmith.h")) {
print "Please point the environment variable CSMITH_PATH to the top-level\n";
if (!(-f "$CSMITH_HOME/runtime/csmith.h")) {
print "Please point the environment variable CSMITH_HOME to the top-level\n";
print "directory of your Csmith tree before running this script.\n";
exit(-1);
}
Expand Down
10 changes: 5 additions & 5 deletions scripts/test_csmith.pl
Expand Up @@ -38,7 +38,7 @@

my $MIN_PROGRAM_SIZE = 8000;
my $EXTRA_OPTIONS = "";
my $CSMITH_PATH = $ENV{"CSMITH_PATH"};
my $CSMITH_HOME = $ENV{"CSMITH_HOME"};
my $COMPILER = "gcc -w -O0";
my $VALGRIND = "";
#my $VALGRIND = "valgrind -q --error-exitcode=66 ";
Expand All @@ -47,7 +47,7 @@

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

my $HEADER = "-I${CSMITH_PATH}/runtime";
my $HEADER = "-I${CSMITH_HOME}/runtime";

# properly parse the return value from system()
sub runit ($$) {
Expand Down Expand Up @@ -98,7 +98,7 @@ ($)
$CSMITH_OPTIONS .= yesno ("bitfields");
$CSMITH_OPTIONS .= yesno ("argc");

my $cmd = "$VALGRIND $CSMITH_PATH/src/csmith $CSMITH_OPTIONS $EXTRA_OPTIONS --output $cfile";
my $cmd = "$VALGRIND $CSMITH_HOME/src/csmith $CSMITH_OPTIONS $EXTRA_OPTIONS --output $cfile";
my $res = runit ($cmd, "csmith.out");
if ($res != 0 || !(-f $cfile) ) {
print "Failed to generate program: $cmd\n";
Expand Down Expand Up @@ -137,8 +137,8 @@ ($)

########################### main ##################################

if (!(-f "$CSMITH_PATH/runtime/csmith.h")) {
print "Please point the environment variable CSMITH_PATH to the top-level\n";
if (!(-f "$CSMITH_HOME/runtime/csmith.h")) {
print "Please point the environment variable CSMITH_HOME to the top-level\n";
print "directory of your Csmith tree before running this script.\n";
exit(-1);
}
Expand Down
8 changes: 4 additions & 4 deletions utah/scripts/coverage/gen_cov.pl
Expand Up @@ -35,8 +35,8 @@
$ENV{"LD_LIBRARY_PATH"} = "$EXPECT_BASE_PATH/lib";
}

my $CSMITH_PATH = "$COMPILER_SOURCES_PATH/csmith";
my $CSMITH = "$CSMITH_PATH/src/csmith";
my $CSMITH_HOME = "$COMPILER_SOURCES_PATH/csmith";
my $CSMITH = "$CSMITH_HOME/src/csmith";

my $LCOV_PATH = "$COMPILER_SOURCES_PATH/lcov-1.8/bin";
my $LCOV = "$LCOV_PATH/lcov";
Expand Down Expand Up @@ -214,7 +214,7 @@ ($)
my $out = "rand.out";
my $compilerout = "${exe}_compiler.out";

my $command = "RunSafely.sh $COMPILER_TIMEOUT 1 /dev/null $compilerout $compiler_exec $opt $extra_opts $cfile -o $exe -I${CSMITH_PATH}/runtime";
my $command = "RunSafely.sh $COMPILER_TIMEOUT 1 /dev/null $compilerout $compiler_exec $opt $extra_opts $cfile -o $exe -I${CSMITH_HOME}/runtime";

my $res = runit ($command);
if (($res != 0) || (!(-e $exe))) {
Expand All @@ -240,7 +240,7 @@ ()
chdir $CSMITH_OUT or die;

system "rm -rf ./*";
my $cmd = "$CSMITH_PATH/src/csmith $CSMITH_OPTS --output $cfile";
my $cmd = "$CSMITH_HOME/src/csmith $CSMITH_OPTS --output $cfile";
#print "$cmd\n";
my $res = runit ("RunSafely.sh $CSMITH_TIMEOUT 1 /dev/zero csmith_output.txt $cmd");

Expand Down
12 changes: 6 additions & 6 deletions utah/scripts/john_driver/evaluate_program.pl
Expand Up @@ -70,11 +70,11 @@

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

my $CSMITH_PATH=$ENV{"CSMITH_PATH"};
die "oops: CSMITH_PATH environment variable needs to be set"
if (!defined($CSMITH_PATH));
my $CSMITH_HOME=$ENV{"CSMITH_HOME"};
die "oops: CSMITH_HOME environment variable needs to be set"
if (!defined($CSMITH_HOME));

my $VOLATILE_PATH=$CSMITH_PATH."/utah/scripts/john_driver";
my $VOLATILE_PATH=$CSMITH_HOME."/utah/scripts/john_driver";

my $LOCKFN = "/var/tmp/version_search_lockfile";

Expand Down Expand Up @@ -677,8 +677,8 @@ ($$$$$$$)
my $compilerout = "${exe}_compiler.out";

# ccomp doesn't allow -I option appearing after $srcfile
#my $command = "RunSafely.sh $COMPILER_TIMEOUT 1 /dev/null $compilerout $valgrind $compiler $opt $xtra $srcfile -o $exe $custom_options $wrapstr $notmp -I${CSMITH_PATH}/runtime";
my $command = "RunSafely.sh $COMPILER_TIMEOUT 1 /dev/null $compilerout $valgrind $compiler $opt $xtra $xxtra $notmp -I${CSMITH_PATH}/runtime $srcfile -o $exe $custom_options $wrapstr $notmp ";
#my $command = "RunSafely.sh $COMPILER_TIMEOUT 1 /dev/null $compilerout $valgrind $compiler $opt $xtra $srcfile -o $exe $custom_options $wrapstr $notmp -I${CSMITH_HOME}/runtime";
my $command = "RunSafely.sh $COMPILER_TIMEOUT 1 /dev/null $compilerout $valgrind $compiler $opt $xtra $xxtra $notmp -I${CSMITH_HOME}/runtime $srcfile -o $exe $custom_options $wrapstr $notmp ";

print "$command\n";

Expand Down
8 changes: 4 additions & 4 deletions utah/scripts/john_driver/random_test.pl
Expand Up @@ -82,7 +82,7 @@

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

my $CSMITH_PATH = $ENV{"CSMITH_PATH"};
my $CSMITH_HOME = $ENV{"CSMITH_HOME"};

my $good = 0;

Expand Down Expand Up @@ -135,10 +135,10 @@ ($$)

my $cmd;
if ($CSMITH_CCOMP eq "") {
$cmd = "$CSMITH_PATH/src/csmith $SEED $BF $PACK $XTRA --output $cfile";
$cmd = "$CSMITH_HOME/src/csmith $SEED $BF $PACK $XTRA --output $cfile";
}
else {
$cmd = "$CSMITH_PATH/src/csmith $SEED $CSMITH_CCOMP --output $cfile";
$cmd = "$CSMITH_HOME/src/csmith $SEED $CSMITH_CCOMP --output $cfile";
}
if ($PROVIDE_SEED) {
print "$cmd\n";
Expand Down Expand Up @@ -203,7 +203,7 @@ ($$)
if ($CSMITH_CCOMP ne "") {
# ccomp doesn't like asserts, regenerate random programs without asserts.
my $noparanoid_cfile = "${fn}_small.c";
my $cmd1 = "$CSMITH_PATH/src/csmith $CSMITH_CCOMP -s $seed --output $noparanoid_cfile";
my $cmd1 = "$CSMITH_HOME/src/csmith $CSMITH_CCOMP -s $seed --output $noparanoid_cfile";
my $res1 = runit ("RunSafely.sh $CSMITH_TIMEOUT 1 /dev/zero randprog_output.txt $cmd1");
}

Expand Down
2 changes: 1 addition & 1 deletion utah/scripts/john_driver/run_program.pl
Expand Up @@ -298,7 +298,7 @@ ($)

############################## main ###########################

my $VOLATILE_PATH=$ENV{"CSMITH_PATH"}."/utah/scripts/john_driver";
my $VOLATILE_PATH=$ENV{"CSMITH_HOME"}."/utah/scripts/john_driver";
die "oops: VOLATILE_PATH environment variable needs to be set"
if (!defined($VOLATILE_PATH));

Expand Down
6 changes: 3 additions & 3 deletions utah/scripts/one_off/random_test_vc.pl
Expand Up @@ -15,7 +15,7 @@
my $platform = "x86";

##################################################################
my $CSMITH_PATH = $ENV{"CSMITH_PATH"};
my $CSMITH_HOME = $ENV{"CSMITH_HOME"};
my $good = 0;
my $bug = 0;
my @COMPILERS = (
Expand All @@ -29,7 +29,7 @@
"cl -Ox",
"cl -Oy",
);
my $HEADER = "-I$CSMITH_PATH/runtime";
my $HEADER = "-I$CSMITH_HOME/runtime";

sub read_value_from_file($$) {
my ($fn, $match) = @_;
Expand Down Expand Up @@ -147,7 +147,7 @@ ($$)
my $cfile = "${fn}.c";

# run Csmith
my $cmd = "$CSMITH_PATH/src/csmith $BF $PACK $XTRA --output $cfile";
my $cmd = "$CSMITH_HOME/src/csmith $BF $PACK $XTRA --output $cfile";
my ($res, $exitcode) = runit($cmd, $CSMITH_TIMEOUT, "csmith.out");
# print "after run csmith: $res, $exitcode\n";

Expand Down
12 changes: 6 additions & 6 deletions utah/scripts/one_off/reducer_driver.pl
Expand Up @@ -3,9 +3,9 @@
use Net::Domain qw(hostname hostfqdn hostdomain);
use Cwd;

my $CSMITH_PATH = $ENV{"CSMITH_PATH"};
die "please set CSMITH_PATH env first!"
if (!defined($CSMITH_PATH));
my $CSMITH_HOME = $ENV{"CSMITH_HOME"};
die "please set CSMITH_HOME env first!"
if (!defined($CSMITH_HOME));

my $VOLATILE = $ENV{"VOLATILE_PATH"};
die "please set VOLATILE_PATH env first!"
Expand All @@ -14,7 +14,7 @@
$ENV{"PATH"} = "$ENV{VOLATILE_PATH}:$ENV{PATH}";

my $host = hostname();
my $TEST_ROOT = "$CSMITH_PATH/reducer";
my $TEST_ROOT = "$CSMITH_HOME/reducer";
if (@ARGV != 1 && @ARGV != 2 && @ARGV != 3) {
die "usage: reducer_driver.pl <output-file> [test-root-dir] [eager-blind-simple-berkeley]\n\n";
}
Expand Down Expand Up @@ -81,7 +81,7 @@ ($)

system "rm -f t1.sh t2.sh t3.sh";
if (!(-e "pre_reduction.c") || !(-s "pre_reduction.c")) {
my $csmith_cmd = "$CSMITH_PATH/src/csmith --concise -s $seed $OPT > pre_reduction.c";
my $csmith_cmd = "$CSMITH_HOME/src/csmith --concise -s $seed $OPT > pre_reduction.c";
system $csmith_cmd;
}
return 1;
Expand Down Expand Up @@ -216,7 +216,7 @@ ($$$)
}

#####################################################################
# loop through the test directories under $CSMITH_PATH/reducer, and
# loop through the test directories under $CSMITH_HOME/reducer, and
# run various kinds of reduction on the test cases, the results are
# written into $RESULT_FILE
#####################################################################
Expand Down
10 changes: 5 additions & 5 deletions utah/scripts/one_off/simd.pl
Expand Up @@ -6,12 +6,12 @@

my $MIN_PROGRAM_SIZE = 8000;
my $EXTRA_OPTIONS = "";
my $CSMITH_PATH = $ENV{"CSMITH_PATH"};
my $CSMITH_HOME = $ENV{"CSMITH_HOME"};
my $COMPILER = "icc -w";

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

my $HEADER = "-I${CSMITH_PATH}/runtime";
my $HEADER = "-I${CSMITH_HOME}/runtime";

# find lines in a file that match a given pattern, return line# in the file
sub match_in_file($$\@) {
Expand Down Expand Up @@ -74,7 +74,7 @@ ($)
$CSMITH_OPTIONS .= yesno ("divs");
$CSMITH_OPTIONS .= yesno ("muls");

my $cmd = "$CSMITH_PATH/src/csmith $CSMITH_OPTIONS $EXTRA_OPTIONS --output $cfile";
my $cmd = "$CSMITH_HOME/src/csmith $CSMITH_OPTIONS $EXTRA_OPTIONS --output $cfile";
my $res = runit ($cmd, "csmith.out");
if ($res != 0 || !(-f $cfile) ) {
print "Failed to generate program: $cmd\n";
Expand Down Expand Up @@ -116,8 +116,8 @@ ($)

########################### main ##################################

if (!(-f "$CSMITH_PATH/runtime/csmith.h")) {
print "Please point the environment variable CSMITH_PATH to the top-level\n";
if (!(-f "$CSMITH_HOME/runtime/csmith.h")) {
print "Please point the environment variable CSMITH_HOME to the top-level\n";
print "directory of your Csmith tree before running this script.";
exit(-1);
}
Expand Down
2 changes: 1 addition & 1 deletion utah/scripts/one_off/size_test.pl
Expand Up @@ -3,7 +3,7 @@
use strict;
use File::stat;

my $CSMITH = $ENV{"CSMITH_PATH"}."/src/csmith";
my $CSMITH = $ENV{"CSMITH_HOME"}."/src/csmith";

my $N = 1000;

Expand Down
4 changes: 2 additions & 2 deletions utah/scripts/one_off/test_framac.pl
Expand Up @@ -59,8 +59,8 @@

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

my $CSMITH=$ENV{"CSMITH_PATH"};
die "please export environment variable CSMITH_PATH" if (!defined($CSMITH));
my $CSMITH=$ENV{"CSMITH_HOME"};
die "please export environment variable CSMITH_HOME" if (!defined($CSMITH));

my $FRAMAC=$ENV{"FRAMAC_PATH"};
die "please export environment variable FRAMAC_PATH" if (!defined($FRAMAC));
Expand Down
16 changes: 8 additions & 8 deletions utah/scripts/one_off/unwrap_math.pl
Expand Up @@ -32,8 +32,8 @@
#my $VERBOSE = 1;
my $VERBOSE = 0;

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

sub runit ($$)
{
Expand Down Expand Up @@ -64,8 +64,8 @@ ()

my $seed = int(rand(1000000000));

runit ("$CSMITH_PATH/src/csmith -s $seed", "foo.c");
runit ("$CSMITH_PATH/src/csmith -s $seed --identify-wrappers", "foo_id.c");
runit ("$CSMITH_HOME/src/csmith -s $seed", "foo.c");
runit ("$CSMITH_HOME/src/csmith -s $seed --identify-wrappers", "foo_id.c");
open INF, "<wrapper.h" or die;
my $line = <INF>;
chomp $line;
Expand All @@ -79,12 +79,12 @@ ()

print "seed = $seed\n";

runit ("current-gcc -O0 foo.c -o foo -I${CSMITH_PATH}/runtime", "gcc-out.txt");
runit ("current-gcc -O0 foo.c -o foo -I${CSMITH_HOME}/runtime", "gcc-out.txt");
my $res = run_timeout ("./foo", "out.txt");
return if ($res != 0);
system "cat out.txt | grep checksum";

runit ("current-gcc -O0 foo_id.c -o foo_id -DLOG_WRAPPERS -I. -I${CSMITH_PATH}/runtime", "gcc-out.txt");
runit ("current-gcc -O0 foo_id.c -o foo_id -DLOG_WRAPPERS -I. -I${CSMITH_HOME}/runtime", "gcc-out.txt");
$res = run_timeout ("./foo_id", "out.txt");
return if ($res != 0);
system "cat out.txt";
Expand Down Expand Up @@ -133,9 +133,9 @@ ()
$failed = "0";
}

runit ("$CSMITH_PATH/src/csmith -s $seed --safe-math-wrappers $failed", "foo_unwrap.c");
runit ("$CSMITH_HOME/src/csmith -s $seed --safe-math-wrappers $failed", "foo_unwrap.c");

runit ("current-gcc -O0 foo_unwrap.c -o foo_unwrap -I${CSMITH_PATH}/runtime", "gcc-out.txt");
runit ("current-gcc -O0 foo_unwrap.c -o foo_unwrap -I${CSMITH_HOME}/runtime", "gcc-out.txt");
$res = run_timeout ("./foo_unwrap", "out.txt");
return if ($res != 0);
system "grep checksum out.txt";
Expand Down
8 changes: 4 additions & 4 deletions utah/scripts/reduce/prep.pl
Expand Up @@ -5,8 +5,8 @@

use strict;

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

my $outfile = "orig_csmith_output.c";
for (my $i=0; $i<scalar(@ARGV); $i++) {
Expand All @@ -16,8 +16,8 @@
}
die if (!defined($outfile));

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

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

system "indent small.c";
2 changes: 1 addition & 1 deletion utah/scripts/reduce/reduce.sh
@@ -1,7 +1,7 @@
# optionally preprocess
# save sequential backup versions instead of hardcoding these

DIR=${CSMITH_PATH}/utah/scripts/reduce
DIR=${CSMITH_HOME}/utah/scripts/reduce

cp small.c small-1.c
perl -pi.bak -e 's/^\s*\n//g' small.c
Expand Down
2 changes: 1 addition & 1 deletion utah/scripts/reduce/reduce_log.sh
Expand Up @@ -2,7 +2,7 @@ echo > delta.log

date >> delta.log

${CSMITH_PATH}/utah/scripts/reduce.sh >> delta.log
${CSMITH_HOME}/utah/scripts/reduce.sh >> delta.log

echo here1
grep -c here1 delta.log >> delta.log
Expand Down

0 comments on commit 9cbc259

Please sign in to comment.