diff options
| author | FluorescentCIAAfricanAmerican <[email protected]> | 2020-04-22 12:56:21 -0400 |
|---|---|---|
| committer | FluorescentCIAAfricanAmerican <[email protected]> | 2020-04-22 12:56:21 -0400 |
| commit | 3bf9df6b2785fa6d951086978a3e66f49427166a (patch) | |
| tree | 2c0f1f0c63c4832882bc93814ebd2c2b1c6224e5 /unittests/autotestscripts/verify_compiled_sheet_files_match_src.pl | |
| download | archived-source-engine-2018-hl2-src-master.tar.xz archived-source-engine-2018-hl2-src-master.zip | |
Diffstat (limited to 'unittests/autotestscripts/verify_compiled_sheet_files_match_src.pl')
| -rw-r--r-- | unittests/autotestscripts/verify_compiled_sheet_files_match_src.pl | 69 |
1 files changed, 69 insertions, 0 deletions
diff --git a/unittests/autotestscripts/verify_compiled_sheet_files_match_src.pl b/unittests/autotestscripts/verify_compiled_sheet_files_match_src.pl new file mode 100644 index 0000000..bce70ba --- /dev/null +++ b/unittests/autotestscripts/verify_compiled_sheet_files_match_src.pl @@ -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, $_; + } + } |