mirror of
				https://github.com/cuberite/polarssl.git
				synced 2025-11-03 20:22:59 -05:00 
			
		
		
		
	Fix dependency issues in the test framework
When a constant in a test case is a symbol (either preprocessor or enum value), enclose the corresponding translation code in the ifdef's attached the test function, so that it compiles even if it isn't defined.
This commit is contained in:
		
							parent
							
								
									748190d319
								
							
						
					
					
						commit
						18c443d3a8
					
				@ -144,7 +144,12 @@ while($test_cases =~ /\/\* BEGIN_CASE *([\w:]*) \*\/\n(.*?)\n\/\* END_CASE \*\//
 | 
			
		||||
        my @res = $test_data =~ /^$mapping_regex/msg;
 | 
			
		||||
        foreach my $value (@res)
 | 
			
		||||
        {
 | 
			
		||||
            $mapping_values{$value} = 1 if ($value !~ /^\d+$/);
 | 
			
		||||
            next unless ($value !~ /^\d+$/);
 | 
			
		||||
            if ( $mapping_values{$value} ) {
 | 
			
		||||
                ${ $mapping_values{$value} }{$function_pre_code} = 1;
 | 
			
		||||
            } else {
 | 
			
		||||
                $mapping_values{$value} = { $function_pre_code => 1 };
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
@ -204,13 +209,23 @@ END
 | 
			
		||||
# Make mapping code
 | 
			
		||||
while( my ($key, $value) = each(%mapping_values) )
 | 
			
		||||
{
 | 
			
		||||
    $mapping_code .= << "END";
 | 
			
		||||
    my $key_mapping_code = << "END";
 | 
			
		||||
    if( strcmp( str, "$key" ) == 0 )
 | 
			
		||||
    {
 | 
			
		||||
        *value = ( $key );
 | 
			
		||||
        return( 0 );
 | 
			
		||||
    }
 | 
			
		||||
END
 | 
			
		||||
 | 
			
		||||
    # handle depenencies, unless used at least one without depends
 | 
			
		||||
    if ($value->{""}) {
 | 
			
		||||
        $mapping_code .= $key_mapping_code;
 | 
			
		||||
        next;
 | 
			
		||||
    }
 | 
			
		||||
    for my $ifdef ( keys %$value ) {
 | 
			
		||||
        (my $endif = $ifdef) =~ s!ifdef!endif //!g;
 | 
			
		||||
        $mapping_code .= $ifdef . $key_mapping_code . $endif;
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
$dispatch_code =~ s/^(.+)/    $1/mg;
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user