diff -r d8f5ffc6ca27 -r 9e25849592fe util/tracediff --- a/util/tracediff Mon Jan 30 11:04:01 2012 +0000 +++ b/util/tracediff Mon Jan 30 11:18:49 2012 +0000 @@ -70,17 +70,25 @@ # # 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 && $ARGV[0] eq '-p') { + shift @ARGV; + $path = shift @ARGV; +} + if (@ARGV < 1) { die "Usage: tracediff [-n] \"sim1|sim2\" [common-arg \"arg1|arg2\" ...]\n"; } @@ -136,11 +144,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 $dir1\n"; +mkpath('$path/$dir2') or die "Can't create dir $dir1\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 +156,3 @@ print "Executing $fullcmd\n"; system($fullcmd); - - -