1
This commit is contained in:
25
unittests/autotestscripts/check_debug_dlls.pl
Normal file
25
unittests/autotestscripts/check_debug_dlls.pl
Normal file
@ -0,0 +1,25 @@
|
||||
#!perl
|
||||
|
||||
use File::Find;
|
||||
use Win32::API;
|
||||
|
||||
find(\&ProcessFile, "../../../game/bin/" );
|
||||
|
||||
sub ProcessFile
|
||||
{
|
||||
return if (/360/);
|
||||
return unless( /\.dll$/i );
|
||||
my $LoadLibrary = Win32::API->new( "kernel32", "LoadLibrary","P","L" );
|
||||
my $GetProcAddress = Win32::API->new( "kernel32", "GetProcAddress","LP","L" );
|
||||
my $FreeLibrary = Win32::API->new( "kernel32", "FreeLibrary", "P", "V" );
|
||||
my $handle=$LoadLibrary->Call($_);
|
||||
if ( $handle )
|
||||
{
|
||||
my $proc = $GetProcAddress->Call($handle, "BuiltDebug\0");
|
||||
if ( $proc )
|
||||
{
|
||||
print "Error $_ is built debug\n";
|
||||
}
|
||||
$FreeLibrary->Call( $handle );
|
||||
}
|
||||
}
|
15
unittests/autotestscripts/check_dynamic_shader_compile.pl
Normal file
15
unittests/autotestscripts/check_dynamic_shader_compile.pl
Normal file
@ -0,0 +1,15 @@
|
||||
#!perl
|
||||
|
||||
open(DLL,"../../../game/bin/shaderapidx9.dll" ) || die "can't open shaderapi";
|
||||
|
||||
binmode DLL;
|
||||
my $dllcode = do { local( $/ ) ; <DLL> } ; # slurp comparison output in
|
||||
close DLL;
|
||||
|
||||
if ( $dllcode =~ /dynamic_shader_compile_is_on/s )
|
||||
{
|
||||
open(ERRORS,">errors.txt") || die "huh - can't write";
|
||||
print ERRORS "stdshader_dx9.dll was built with dynamic shader compile!\n";
|
||||
close ERRORS;
|
||||
}
|
||||
|
BIN
unittests/autotestscripts/datafiles/gwolf.tga
Normal file
BIN
unittests/autotestscripts/datafiles/gwolf.tga
Normal file
Binary file not shown.
After Width: | Height: | Size: 4.0 MiB |
16
unittests/autotestscripts/filecompare_tests.cfg
Normal file
16
unittests/autotestscripts/filecompare_tests.cfg
Normal file
@ -0,0 +1,16 @@
|
||||
// this config file defines all unit tests which are run by running a program and comparing its output to reference output
|
||||
// which is checked in in the directory src/unittests/autotestscripts/reference_output
|
||||
|
||||
// the format of entries is TESTNAME,OUTPUTFILE,COMMAND-LINE-TO-EXECUTE
|
||||
// if the OUTPUTFILE part is blank, it assumes the test is meant to compare the output of stdio
|
||||
|
||||
file_size_monitor,,perl subtests/file_size_monitor.pl
|
||||
testprocess,,..\testprocess\testprocess -message "testprocess autotest1"
|
||||
vtex,gwolf.vtf,vtex -outdir . -nopause -nop4 -crcforce datafiles\gwolf.tga
|
||||
rt_test,,..\rt_test\rt_test ..\rt_test\gwolf.tga test 1024 1024
|
||||
// mathlib_test,,..\mathlib_test\mathlib_test
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -0,0 +1,6 @@
|
||||
Running file size monitor
|
||||
PC shader size := 291934326
|
||||
PC Game Bin DLL size := 108442741
|
||||
360 shader size := 0
|
||||
360 Game Bin DLL size := 0
|
||||
tf texture size := 1396651036
|
@ -0,0 +1,3 @@
|
||||
right spherical triangle projected percentage=0.1250
|
||||
small spherical triangle projected percentage=0.00156
|
||||
sum of areas of cubemap cells = 1.00
|
6
unittests/autotestscripts/reference_output/rt_test.txt
Normal file
6
unittests/autotestscripts/reference_output/rt_test.txt
Normal file
@ -0,0 +1,6 @@
|
||||
reading src texture
|
||||
n triangles 1567238
|
||||
Creating kd-tree
|
||||
kd built time := 79
|
||||
Rendering
|
||||
pixels traced and lit per second := 1559694.998968
|
@ -0,0 +1 @@
|
||||
testprocess autotest1
|
BIN
unittests/autotestscripts/reference_output/vtex.vtf
Normal file
BIN
unittests/autotestscripts/reference_output/vtex.vtf
Normal file
Binary file not shown.
181
unittests/autotestscripts/run_file_comparison_tests.pl
Normal file
181
unittests/autotestscripts/run_file_comparison_tests.pl
Normal file
@ -0,0 +1,181 @@
|
||||
#!perl
|
||||
|
||||
# read stdio_test_list.cfg and perform all tests
|
||||
|
||||
$create_refs=0;
|
||||
$subset_string=shift;
|
||||
|
||||
@months = qw(Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec);
|
||||
@weekDays = qw(Sun Mon Tue Wed Thu Fri Sat Sun);
|
||||
($second, $minute, $hour, $dayOfMonth, $month, $yearOffset, $dayOfWeek, $dayOfYear, $daylightSavings) = localtime();
|
||||
$year = 1900 + $yearOffset;
|
||||
$dstamp = "$weekDays[$dayOfWeek] $months[$month] $dayOfMonth $year".sprintf(" %02d:%02d:%02d", $hour,$minute,$second);
|
||||
$changelist_counter=`p4 counter main_changelist`; # grab value of p4 counter
|
||||
|
||||
$dstamp.=" $changelist_counter";
|
||||
$dstamp=~ s/[\n\r]//g;
|
||||
|
||||
$computername=$ENV{'COMPUTERNAME'};
|
||||
|
||||
|
||||
# first, set our priority to high and affinity to 1 to try to get more repeatable benchmark results
|
||||
#my $pid = $$;
|
||||
|
||||
#my $cmd="datafiles\\process.exe -p $pid High";
|
||||
#print STDERR `$cmd`;
|
||||
#$cmd="datafiles\\process.exe -a $pid 01";
|
||||
#print STDERR `$cmd`;
|
||||
|
||||
if ( open(CFGFILE, "filecompare_tests.cfg") )
|
||||
{
|
||||
while(<CFGFILE>)
|
||||
{
|
||||
s/[\n\r]//g;
|
||||
s@//.*$@@; # kill comments
|
||||
if (/^([^,]*),([^,]*),(.*$)/)
|
||||
{
|
||||
$testname=$1;
|
||||
$testfile=$2;
|
||||
$testcommand=$3;
|
||||
|
||||
next if ( length($subset_string) && ( ! ( $testname=~/$subset_string/i) ) );
|
||||
|
||||
$ext=".txt";
|
||||
if ( length($testfile ) )
|
||||
{
|
||||
$ext="";
|
||||
$ext = $1 if ( $testfile=~/(\..*)$/ ); # copy extension
|
||||
unlink $testfile if ( -e $testfile); # kill it if it exists
|
||||
}
|
||||
|
||||
print STDOUT "running $testname : $testcommand ($testfile)\n";
|
||||
# suck the reference output in. use binary mode unless stdio
|
||||
$refname="reference_output/$testname$ext";
|
||||
|
||||
# run the test
|
||||
my $stime=time;
|
||||
$output=`$testcommand`;
|
||||
$stime=time-$stime;
|
||||
|
||||
if ( open(REF,$refname))
|
||||
{
|
||||
if ( length($testfile ))
|
||||
{
|
||||
binmode REF;
|
||||
}
|
||||
$ref_output= do { local( $/ ) ; <REF> } ; # slurp comparison output in
|
||||
close REF;
|
||||
|
||||
if ( length( $testfile ) )
|
||||
{
|
||||
print STDERR $output;
|
||||
# file case
|
||||
if ( open(TESTFILE, $testfile ))
|
||||
{
|
||||
binmode TESTFILE;
|
||||
$new_output= do { local( $/ ) ; <TESTFILE> } ; # slurp comparison output in
|
||||
close TESTFILE;
|
||||
if ($new_output ne $ref_output )
|
||||
{
|
||||
$errout.="ERROR: test $testname ($testcommand) : test produced file $testfile (length=".
|
||||
length($new_output).") but it doesn't match the reference (length=".length($ref_output).")\n";
|
||||
}
|
||||
else
|
||||
{
|
||||
&UpdateMetrics( $testname, $output, $stime );
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$errout.="ERROR: test $testname ($testcommand) : test was supposed to create $testfile, but didn't.\n";
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
# strip metrics (like timing) for comparison
|
||||
my $massaged_ref = $ref_output;
|
||||
my $massaged_output = $output;
|
||||
$massaged_ref =~ s/:=\s*[0-9\.]+//g;
|
||||
$massaged_output =~ s/:=\s*[0-9\.]+//g;
|
||||
if ($massaged_output ne $massaged_ref )
|
||||
{
|
||||
# print STDERR "o=$massaged_output r=$massaged_ref\n";
|
||||
$errout.="ERROR: test $testname ($testcommand) : output does not match reference output.\n";
|
||||
}
|
||||
else
|
||||
{
|
||||
&UpdateMetrics( $testname, $output, $stime );
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$errout.="ERROR: Can't open reference $refname for $testname\n";
|
||||
if ($create_refs)
|
||||
{
|
||||
if ( length($testfile ) )
|
||||
{
|
||||
if ( -e $testfile )
|
||||
{
|
||||
$oname=$refname;
|
||||
$oname=~s@/@\\@g;
|
||||
print STDERR "copy $testfile $oname";
|
||||
print STDERR `copy $testfile $oname`;
|
||||
print STDERR `p4 add $oname`;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if ( open(REFOUT,">$refname") )
|
||||
{
|
||||
print REFOUT $output;
|
||||
}
|
||||
close REFOUT;
|
||||
print STDERR `p4 add $refname`;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$errout.="Can't open stdio_test_list.cfg\n";
|
||||
}
|
||||
|
||||
if (length($errout))
|
||||
{
|
||||
print STDERR "There were errors: $errout";
|
||||
open(ERRORS,">errors.txt") || die "huh - can't write";
|
||||
print ERRORS $errout;
|
||||
close ERRORS;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
sub UpdateMetrics
|
||||
{
|
||||
return unless length($computername);
|
||||
local( $tname, $output, $runtime) = @_;
|
||||
$output .= "\ntest runtime := $runtime\n";
|
||||
foreach $_ ( split(/\n/,$output))
|
||||
{
|
||||
if (/^(.+):=(.*$)/)
|
||||
{
|
||||
my $varname=$1;
|
||||
my $etime=$2;
|
||||
$varname=~s@^\s*@@g;
|
||||
$varname=~s@\s*$@@g;
|
||||
mkdir "\\\\fileserver\\user\\perf\\$computername";
|
||||
mkdir "\\\\fileserver\\user\\perf\\$computername\\$tname";
|
||||
if ( open(COUT,">>\\\\fileserver\\user\\perf\\$computername\\$tname\\$varname.csv") )
|
||||
{
|
||||
print COUT "\"$dstamp\",$etime\n";
|
||||
close COUT;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
40
unittests/autotestscripts/subtests/file_size_monitor.pl
Normal file
40
unittests/autotestscripts/subtests/file_size_monitor.pl
Normal file
@ -0,0 +1,40 @@
|
||||
#!perl
|
||||
|
||||
use File::Find;
|
||||
|
||||
# customize here
|
||||
print "Running file size monitor\n";
|
||||
|
||||
LogDirectorySize("PC shader size", "../../../game/hl2/shaders","\.vcs","\.360\.vcs");
|
||||
LogDirectorySize("PC Game Bin DLL size", "../../../game/bin/","\.dll","_360\.dll");
|
||||
LogDirectorySize("360 shader size", "../../../game/hl2/shaders","\.360\.vcs");
|
||||
LogDirectorySize("360 Game Bin DLL size", "../../../game/bin/","_360\.dll");
|
||||
LogDirectorySize("tf texture size","../../../game/tf/materials/","\.vtf");
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
sub LogDirectorySize
|
||||
{
|
||||
my ($label, $basedir, $filepattern, $excludepattern ) = @_;
|
||||
undef @FileList;
|
||||
find(\&ProcessFile, $basedir);
|
||||
my $total_size = 0;
|
||||
foreach $_ (@FileList)
|
||||
{
|
||||
next if ( length($excludepattern) && ( /$excludepattern/i ) );
|
||||
if (/$filepattern/i)
|
||||
{
|
||||
$total_size += (-s $_ );
|
||||
}
|
||||
}
|
||||
print "$label := $total_size\n";
|
||||
}
|
||||
|
||||
sub ProcessFile
|
||||
{
|
||||
push @FileList, $File::Find::name;
|
||||
}
|
13
unittests/autotestscripts/test_error_reporting.pl
Normal file
13
unittests/autotestscripts/test_error_reporting.pl
Normal file
@ -0,0 +1,13 @@
|
||||
#! perl
|
||||
$errfname="//fileserver/user/cgreen/force_an_error.txt";
|
||||
|
||||
if (-e $errfname )
|
||||
{
|
||||
unlink $errfname;
|
||||
open(ERROUT,">errors.txt") || die "huh - can't write";
|
||||
{
|
||||
print ERROUT "This is not an error - its just a test of the error script system.\n";
|
||||
close ERROUT;
|
||||
}
|
||||
|
||||
}
|
36
unittests/autotestscripts/test_shader_crcs.pl
Normal file
36
unittests/autotestscripts/test_shader_crcs.pl
Normal file
@ -0,0 +1,36 @@
|
||||
use Cwd;
|
||||
|
||||
my $dir = getcwd;
|
||||
|
||||
chdir "../../materialsystem/stdshaders";
|
||||
|
||||
@output = `perl ..\\..\\devtools\\bin\\checkshaderchecksums.pl stdshader_dx9_20b.txt`;
|
||||
foreach $_ (@output)
|
||||
{
|
||||
$output.=$_ unless(/appchooser360/i);
|
||||
}
|
||||
|
||||
@output = `perl ..\\..\\devtools\\bin\\checkshaderchecksums.pl stdshader_dx9_30.txt`;
|
||||
foreach $_ (@output)
|
||||
{
|
||||
$output.=$_ unless(/appchooser360/i);
|
||||
}
|
||||
|
||||
my $errors;
|
||||
|
||||
foreach $_ (@output )
|
||||
{
|
||||
$errors.=$_ unless (/appchooser360movie/);
|
||||
}
|
||||
|
||||
chdir $dir;
|
||||
|
||||
print $errors;
|
||||
|
||||
if( length( $errors ) > 0 )
|
||||
{
|
||||
print "writing errors.txt\n";
|
||||
open FP, ">errors.txt";
|
||||
print FP "$errors";
|
||||
close FP;
|
||||
}
|
@ -0,0 +1,69 @@
|
||||
#! perl
|
||||
|
||||
|
||||
use File::Find;
|
||||
use Cwd;
|
||||
use File::Basename;
|
||||
|
||||
# find(\&Visitfile,"../../../content/tf");
|
||||
|
||||
foreach $_ ( @sheetfiles )
|
||||
{
|
||||
$dest_sheet_name=$_;
|
||||
$dest_sheet_name =~ s/\.mks/.sht/i;
|
||||
$dest_sheet_name =~ s@/content/([^/]+)/materialsrc/@/game/\1/materials/@gi;
|
||||
print "**Checking $_\n";
|
||||
if (! -e $dest_sheet_name )
|
||||
{
|
||||
push @errors,"sheet $_ exists but not $dest_sheet_name";
|
||||
}
|
||||
else
|
||||
{
|
||||
# buid it and make sure they match
|
||||
$cmd="cd ".dirname($_)." & mksheet ".basename($_)." test.sht";
|
||||
$cmd=~tr/\//\\/;
|
||||
$cmdout=`$cmd`;
|
||||
if ( open(NEWFILE, dirname($_)."/test.sht") )
|
||||
{
|
||||
binmode NEWFILE;
|
||||
open(OLDFILE, $dest_sheet_name ) || die "strange error - cant find $dest_sheet_name";
|
||||
binmode OLDFILE;
|
||||
{
|
||||
local( $/, *FH ) ;
|
||||
$old_data=<OLDFILE>;
|
||||
$new_data=<NEWFILE>;
|
||||
if ( $new_data ne $old_data )
|
||||
{
|
||||
push @errors,"Sheet source file $_ does not compile to the same output as the checked in $dest_sheet_name";
|
||||
}
|
||||
close OLDFILE;
|
||||
close NEWFILE;
|
||||
unlink dirname($_)."/test.sht";
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
push @errors, "Couldn't compile sheet $_ by running $cmd : \n$cmdout";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$errout=join("\n", @errors);
|
||||
print $errout;
|
||||
if (length($errout))
|
||||
{
|
||||
open(ERRFILE,">errors.txt") || die "can't write errors.txt";
|
||||
print ERRFILE $errout;
|
||||
close ERRFILE;
|
||||
}
|
||||
|
||||
|
||||
sub Visitfile
|
||||
{
|
||||
local($_)= $File::Find::name;
|
||||
s@\\@\/@g;
|
||||
if (m@content/(\S+)/.*\.mks$@i)
|
||||
{
|
||||
push @sheetfiles, $_;
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user