runEval #2

  • //
  • guest/
  • richard_geiger/
  • p4bench/
  • runEval
  • View
  • Commits
  • Open Download .zip Download (1 KB)
#!/usr/local/bin/perl
# -*-Fundamental-*-

#
#   Copyright (c) 1996 Network Appliance, Inc.
#
#   You may distribute under the terms of the Artistic License, as
#   specified in the README file included in the ttt distribution.
#

# $Id: //depot/tools/main/p4bench/runEval#1 $

#  A general purpose driver allowing test files consisting of executable
#  perl code.
#
#  For each test file, evals the contents, inside of a
#  &ttt{begin,end}_file pair.
#

sub opts
{
}

sub prereqchk
{
  return 1;
}

##### Begin ttt standard preamble - do not change this code! #####

$UNIX = 1;
sub dirname
{
  local($dir) = @_;
 
  $dir =~ s%^$%.%; $dir = "$dir/";
  if ($dir =~ m%^/[^/]*//*$%) { return "/"; }
  if ($dir =~ m%^.*[^/]//*[^/][^/]*//*$%)
    { $dir =~ s%^(.*[^/])//*[^/][^/]*//*$%$1%; { return $dir; } }
  return ".";
}
$ttt_here = `/bin/pwd`; chop $ttt_here; chdir &dirname($0);
$tttroot = `/bin/pwd`; chop $tttroot; chdir $ttt_here;
require "$tttroot/tttLib.pl";
##### End ttt standard preamble - do not change the above code! #####

@paths = @ARGV; @paths = reverse(@paths);

&ttt_begin_test;

Testfile: while((($file, @paths) = &ttt_nextfile("runEval.*", @paths)), $file)
  {
    if (open(FILE, "<$file"))
      {
        &ttt_begin_file($file);
        $slashsave = $/; undef $/;
        $FILE = <FILE>;
        $/ = $slashsave;
        eval $FILE;
        &ttt_end_file;
      }
  }

&ttt_end_test;


# Change User Description Committed
#2 830 Richard Geiger These changes allow it to work locally, and general more portable
#1 799 Richard Geiger The first version of "p4bench", scripts used to implement a crude
Perforce benchmarking system, as mentioned in

  http://maillist.perforce.com/pipermail/perforce-user/2001-February/005288.html

Beware, it's not pretty and there's no documentation, but it's a starting
point for bigger and better things.