diff -r 8bdfb1947cff -r bfe93d38998f util/tracediff --- a/util/tracediff Thu Feb 02 23:54:25 2012 -0800 +++ b/util/tracediff Fri Feb 03 17:11:42 2012 +0000 @@ -70,19 +70,30 @@ # # The '-n' argument to tracediff allows you to preview the two # generated command lines without running them. -# +# The '-p' argument to tracediff allows a different path for storing the +# trace files. use FindBin; +use File::Path; $dryrun = 0; +$path = "."; -if (@ARGV >= 1 && $ARGV[0] eq '-n') { - $dryrun = 1; - shift @ARGV; -} - -if (@ARGV < 1) { - die "Usage: tracediff [-n] \"sim1|sim2\" [common-arg \"arg1|arg2\" ...]\n"; +if (@ARGV >= 1) { + while ($ARGV[0] eq '-n'|| $ARGV[0] eq '-p') { + # check for '-n' option + if ($ARGV[0] eq '-n') { + $dryrun = 1; + shift @ARGV; + } + # check for '-p' option + if ($ARGV[0] eq '-p') { + shift @ARGV; + $path = shift @ARGV; + } + } +} else { + die "Usage: tracediff [-n][-p] \"sim1|sim2\" [common-arg \"arg1|arg2\" ...]\n"; } foreach $arg (@ARGV) { @@ -136,11 +147,11 @@ # files (particularly config.py and config.ini) don't conflict. $dir1 = "tracediff-$$-1"; $dir2 = "tracediff-$$-2"; -mkdir($dir1) or die "Can't create dir $dir1\n"; -mkdir($dir2) or die "Can't create dir $dir2\n"; +mkpath("$path/$dir1") or die "Can't create dir $path/$dir1\n"; +mkpath("$path/$dir2") or die "Can't create dir $path/$dir2\n"; -$cmd1 = "$sim1 -d $dir1 $args1 2>&1 |"; -$cmd2 = "$sim2 -d $dir2 $args2 2>&1 |"; +$cmd1 = "$sim1 -d $path/$dir1 $args1 2>&1 |"; +$cmd2 = "$sim2 -d $path/$dir2 $args2 2>&1 |"; # Expect that rundiff is in the same dir as the tracediff script. # FindBin figures that out for us. @@ -148,6 +159,3 @@ print "Executing $fullcmd\n"; system($fullcmd); - - -