PennMUSH Community

Changeset 1242

Show
Ignore:
Timestamp:
07/24/08 09:02:37 (4 months ago)
Author:
shawnw
Message:

Allow the test suite to use valgrind

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • 1.8.3/branches/devel/CHANGES.183

    r1241 r1242  
    3434 * @name strips out quotes around player names even if spaces in them are 
    3535   disabled. 
     36 * The test suite can now use valgrind to identify buffer overflows and 
     37   similiar problems triggered by tests, by passing the --valgrind option 
     38   to test scripts. 
    3639 
    3740Commands: 
  • 1.8.3/branches/devel/test/MUSHConnection.pm

    r439 r1242  
    3434  my $name = shift; 
    3535  my $passwd = shift; 
     36 
    3637 
    3738  my $socket = $self->[0]; 
  • 1.8.3/branches/devel/test/PennMUSH.pm

    r956 r1242  
    1313  bless($self, $class); 
    1414  if (@_) { 
    15     $self->{HOST} = shift; 
    16     $self->{PORT} = shift; 
    17     $self->start(@_) if @_; 
     15      $self->{HOST} = shift; 
     16      $self->{PORT} = shift; 
     17      $self->{VALGRIND} = shift; 
     18      $self->start(@_); 
    1819  } else { 
    1920    $self->start(); 
    2021  } 
     22 
    2123  return $self; 
    2224} 
     
    2527  my $self = shift; 
    2628  srand(); 
    27   my $port = $self->{PORT} || int(rand(2000)) + 12000; 
    28   $self->{HOST} = "localhost"; 
    29   $self->{PORT} = $port; 
     29  $self->{HOST} = "localhost" unless defined $self->{HOST}; 
     30  if (!exists $self->{PORT} || $self->{PORT} <= 0) {       
     31      $self->{PORT} = int(rand(2000)) + 12000; 
     32  } 
     33  my $port = $self->{PORT}; 
    3034  rmtree("testgame"); 
    3135  mkpath(["testgame/data", "testgame/log", "testgame/txt"]); 
     
    6468  } elsif (defined($child)) { 
    6569    chdir("testgame"); 
    66     exec("./netmush", "--no-session", "test.cnf", "log/netmush.log"); 
     70    my @execargs = ("./netmush", "--no-session", "test.cnf"); 
     71    unshift @execargs, "valgrind", '--log-file=../valgrind-%p.log' 
     72    if $self->{VALGRIND}; 
     73    exec @execargs; 
    6774  } else { 
    6875    die "Could not spawn game process!\n"; 
  • 1.8.3/branches/devel/test/alltests.sh.in

    r1078 r1242  
    11#!/bin/sh 
    22 
    3 exec @PERL@ runtest.pl test*.pl 
     3exec @PERL@ runtest.pl $@ test*.pl 
    44 
  • 1.8.3/branches/devel/test/runtest.pl

    r1078 r1242  
    11#!/usr/bin/perl -w 
    22use strict; 
     3use Getopt::Long; 
    34use PennMUSH; 
    45use TestHarness; 
    56 
     7my ($valgrind, $host, $port) = (0,"localhost",0); 
     8GetOptions "valgrind" => \$valgrind, 
     9    "host" => \$host, 
     10    "port" => \$port; 
    611 
    7  
    8 my $mush = PennMUSH->new; 
     12my $mush = PennMUSH->new($host, $port, $valgrind); 
    913 
    1014my @tests = map { TestHarness->new($_); } @ARGV; 
    1115 
    1216my $god = $mush->loginGod; 
     17 
    1318my $mortal = undef; 
    1419if ($TestHarness::use_mortal) {