diff options
Diffstat (limited to 'scripts/gpu_table_tester')
| -rwxr-xr-x | scripts/gpu_table_tester | 83 | 
1 files changed, 55 insertions, 28 deletions
| diff --git a/scripts/gpu_table_tester b/scripts/gpu_table_tester index 0fe3e9e8f7..af0678000d 100755 --- a/scripts/gpu_table_tester +++ b/scripts/gpu_table_tester @@ -85,11 +85,15 @@ my %Recognizer;     # name -> recognizer  my %Class;          # recognizer -> class  my %Supported;      # recognizer -> supported  my @InOrder;        # lowercased recognizers in file order - these are the ones really used to match +my %StatsBased; +my %ExpectedOpenGL;  $Name{$NoMatch}      = $NoMatch;  $NameLine{$NoMatch}  = '(hard-coded)'; # use this for error messages in table parsing  $Class{$NoMatch}     = '';  $Supported{$NoMatch} = ''; +$StatsBased{$NoMatch} = ''; +$ExpectedOpenGL{$NoMatch} = '';  while (<GPUS>)  { @@ -97,7 +101,7 @@ while (<GPUS>)      next if m|^\s*$|;  # skip blank lines      chomp; -    my ($name, $regex, $class, $supported, $extra) = split('\t+'); +    my ($name, $regex, $class, $supported, $stats_based, $expected_opengl, $extra) = split('\t+');      my $errsOnLine = $ErrorsSeen;      if (!$name)      { @@ -123,7 +127,7 @@ while (<GPUS>)          print STDERR "     $INPUT_LINE_NUMBER: name '$name'  " . ($supported ? "supported" : "unsupported") .  "  class $class - ignored\n";          $ErrorsSeen++;      } -    if ($class !~ m/[0123]/) +    if ($class !~ m/[012345]/)      {          print STDERR "Invalid class value '$class' on $GpuTable line $INPUT_LINE_NUMBER\n";          $ErrorsSeen++; @@ -133,6 +137,16 @@ while (<GPUS>)          print STDERR "Invalid supported value '$supported' on $GpuTable line $INPUT_LINE_NUMBER\n";          $ErrorsSeen++;      } +    if ($stats_based !~ m/[01]/) +    { +        print STDERR "Invalid stats_based value '$stats_based' on $GpuTable line $INPUT_LINE_NUMBER\n"; +        $ErrorsSeen++; +    } +    if ($expected_opengl !~ m/\d+(\.\d+)?/) +    { +        print STDERR "Invalid expected_opengl value '$expected_opengl' on $GpuTable line $INPUT_LINE_NUMBER\n"; +        $ErrorsSeen++; +    }      if ($extra)      {          print STDERR "Extra data '$extra' on $GpuTable line $INPUT_LINE_NUMBER\n"; @@ -148,6 +162,8 @@ while (<GPUS>)          $Recognizer{$name} = $regex;          $Class{$regex} = $class;          $Supported{$regex} = $supported ? "supported" : "unsupported"; +        $StatsBased{$regex} = $stats_based; +        $ExpectedOpenGL{$regex} = $expected_opengl;      }  } @@ -163,6 +179,7 @@ my %RecognizedBy;  while (<>)   {      chomp; +    $_ = substr($_,0,100);      my $lcInput = lc $_;  # the real gpu table parser lowercases the input string      my $recognizer;      $RecognizedBy{$_} = $NoMatch; @@ -178,34 +195,31 @@ while (<>)  }  format STDOUT_TOP = -GPU String                                                                                               Supported?  Class  Recognizer -------------------------------------------------------------------------------------------------------   ----------- -----  ------------------------------------ +GPU String                                                                                               Supported?  Class  Stats  OpenGL  Recognizer +------------------------------------------------------------------------------------------------------   ----------- -----  -----  ------  ------------------------------------  .  format STDOUT = -@<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<...   @<<<<<<<<<<   @>   @<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<... -$_, $Supported{$RecognizedBy{$_}},$Class{$RecognizedBy{$_}},$Name{$RecognizedBy{$_}} +@<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<   @<<<<<<<<<<   @>    @>     @<<<<  @<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<... +$_, $Supported{$RecognizedBy{$_}},$Class{$RecognizedBy{$_}},$StatsBased{$RecognizedBy{$_}},$ExpectedOpenGL{$RecognizedBy{$_}},$Name{$RecognizedBy{$_}}  . -my $ReportLineTemplate = "A102xxxA12xxxAA*"; # MUST match the format STDOUT above - -format DIFF_TOP = -                                                                                                         ------ OLD ------   ------ NEW ------ -GPU String                                                                                               Supported?  Class   Supported?  Class -------------------------------------------------------------------------------------------------------   ----------- -----   ----------- ----- -.                                                                                                                                              +my $ReportLineTemplate = "A102xxxA12xxxA2xxxxA2xxxxA5A*"; # Used to read a previous report - MUST match the format STDOUT above  my ( $oldSupported, $oldClass, $newSupported, $newClass ); +format DIFF_TOP = +                                                                                                         ------------- OLD -------------  ----------- NEW -------------------- +GPU String                                                                                               Supported?  Class Stats OpenGL   Supported?  Class Stats OpenGL  Line +------------------------------------------------------------------------------------------------------   ----------- ----- ----- ------   ----------- ----- ----- ------ ----- +.                                                                                                                                               format DIFF =                                                                                                                                  -@<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<...   @<<<<<<<<<<   @>    @<<<<<<<<<<   @>  -$_,                                                                                                $oldSupported, $oldClass, $newSupported, $newClass +@<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<   @<<<<<<<<<<   @>    @>  @<<<<    @<<<<<<<<<<    @>   @>  @<<<<  @>>>> +$_, $oldSupported, $oldClass, $oldStatsBased, $oldExpectedOpenGL, $newSupported, $newClass, $newStatsBased, $newExpectedOpenGL, $newRecognizedLine  .  if ( ! $Diff )  { -    ## Print results.  -    ## For each input, show supported or unsupported, the class, and the recognizer name - +    ## Print results of testing each input line and how it was recognized.       foreach ( sort keys %RecognizedBy )      {          write if ! $UnMatchedOnly || $Name{$RecognizedBy{$_}} eq $NoMatch; @@ -214,17 +228,20 @@ if ( ! $Diff )  }  else  { +    ## Print a comparison of how the recognition this time compared to the results from the $Diff file      open OLD, "<$Diff"          || die "Failed to open --diff file '$Diff'\n\t$!\n";      my $discard = 2;      while ( <OLD> )      { -        if ( $discard > 0 ) +        if ( $discard <= 0 )          { -            my ( $gpu, $supported, $class ) = unpack $ReportLineTemplate; +            my ( $gpu, $supported, $class, $stats, $opengl ) = unpack $ReportLineTemplate;              $gpu =~ s/\s*$//;              ( $OldSupported{$gpu} = $supported ) =~ s/\s*$//;              ( $OldClass{$gpu} = $class ) =~ s/\s*$//; +            ( $OldStatsBased{$gpu} = $stats ) =~ s/\s*$//; +            ( $OldExpectedOpenGL{$gpu} = $opengl ) =~ s/\s*$//;          }          else          { @@ -233,33 +250,43 @@ else      }      close OLD; -    $FORMAT_TOP_NAME = DIFF_TOP; -    $FORMAT_NAME = DIFF; +    $FORMAT_TOP_NAME = 'DIFF_TOP'; +    $FORMAT_NAME = 'DIFF';      foreach ( sort keys %RecognizedBy )      {          $newSupported = $Supported{$RecognizedBy{$_}} || $NoMatch;          $newClass     = $Class{$RecognizedBy{$_}}; +        $newStatsBased     = $StatsBased{$RecognizedBy{$_}}; +        $newExpectedOpenGL = $ExpectedOpenGL{$RecognizedBy{$_}}; +        $newRecognizedLine = $RecognizerLine{$RecognizedBy{$_}};          if ( ! defined $OldSupported{$_} )          {              $oldSupported = 'NEW';              $oldClass = '-'; +            $oldStatsBased = '-'; +            $oldExpectedOpenGL = '-'; +            write; +            $-++; # suppresses pagination          }          else          {              $oldSupported = $OldSupported{$_} || $NoMatch;              $oldClass     = $OldClass{$_}; +            $oldStatsBased     = $OldStatsBased{$_}; +            $oldExpectedOpenGL = $OldExpectedOpenGL{$_}; -            if (   ( $oldSupported eq $newSupported ) -                && ( $oldClass     eq $newClass ) +            if (   ( $oldSupported ne $newSupported ) +                || ( $oldClass  ne $newClass ) +                || ( $oldStatsBased ne $newStatsBased ) +                || ( $oldExpectedOpenGL ne $newExpectedOpenGL )                  )              { -                $newSupported = ''; -                $newClass = ''; +                write; +                $-++; # suppresses pagination              }          } -        write; -        $-++; # suppresses pagination +      }  } | 
