Skip to content
Snippets Groups Projects
Code owners
Assign users and groups as approvers for specific file changes. Learn more.
gpu_table_tester 9.57 KiB
#!/usr/bin/perl
## Checks entries in the indra/newview/gpu_table.txt file against sample data
##
## Copyright (c) 2011, Linden Research, Inc.
##
## Permission is hereby granted, free of charge, to any person obtaining a copy
## of this software and associated documentation files (the "Software"), to deal
## in the Software without restriction, including without limitation the rights
## to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
## copies of the Software, and to permit persons to whom the Software is
## furnished to do so, subject to the following conditions:
##
## The above copyright notice and this permission notice shall be included in
## all copies or substantial portions of the Software.
##
## THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
## IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
## FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
## AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
## LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
## OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
## THE SOFTWARE.

use English;
use Getopt::Long;

( $MyName = $0 ) =~ s|.*/||;
my $mini_HELP = "
  $MyName {--gpu-table|-g} <gpu_table.txt> {--table-only|-t}
  
    Checks for duplicates and invalid lines in the gpu_table.txt file.

  $MyName {--gpu-table|-g} <gpu_table.txt> [ <gpu-strings-file> ... ]
          [{--unmatched|-u}]

    Tests the recognition of values in the gpu-strings-files (or 
    standard input if no files are given).   The results of attempting to match 
    each input line are displayed in report form, showing:
     - NO MATCH, unsupported, or supported
     - the class of the GPU
     - the label for the recognizer line from the gpu_table that it matched

    If the --unmatched option is specified, then no output is produced for
    values that are matched.

  $MyName {--gpu-table|-g} <gpu_table.txt> {--diff|-d} <old_results> [ <gpu-strings-file> ...]

    With the --diff option, the report compares the current results to <old-results>,
    which should be the output from a previous run without --diff.  The report shows each
    input value with the old result and the new result if it is different.
";

&GetOptions("help"               => \$Help
            ,"unmatched"         => \$UnMatchedOnly
            ,"table-only"        => \$TableOnly
            ,"gpu-table=s"       => \$GpuTable
            ,"diff=s"            => \$Diff
    )
    || die "$mini_HELP";

if ($Help)
{
    print $mini_HELP;
    exit 0;
}

$ErrorsSeen = 0;
$NoMatch = 'NO MATCH'; # constant

die "Must specify a --gpu-table <gpu_table.txt> value"