• Denis Bessonov's avatar
    Fix for test crash when CollectBasicGraphicsInfo fails. · 3f5e1e42
    Denis Bessonov authored
    The reason for change
    ---------------------
    The tests of EXTMultisampleCompatibilityTest will crash if
    CollectBasicGraphicsInfo fails. Crash occurs in the following call
    graph:
    
    TEST_F(EXTMultisampleCompatibilityTest, (any test))
      gpu::EXTMultisampleCompatibilityTest::IsApplicable()
        gpu::GPUTestBotConfig::CurrentConfigMatches("AMD")
          gpu::GPUTestBotConfig::LoadCurrentConfig(NULL)
            // Due to CollectBasicGraphicsInfo failure,
            // function makes no call SetGPUInfo() and returns true.
            // This will result in empty gpu_vendor_ vector.
            gpu::CollectBasicGraphicsInfo(&my_gpu_info)
              // Returns false for any reason
          gpu::GPUTestBotConfig::Matches(const std::string& = config_data)
            gpu::GPUTestBotConfig::Matches(const GPUConfig& = config)
              // BANG! Segfault trying to access gpu_vendor()[0]
    
    The example of situation, where CollectBasicGraphicsInfo fails, is
    a test Mac with no display connected. In this case, the internal call
    graph of CollectBasicGraphicsInfo will cause the failure:
    
      gpu::CollectBasicGraphicsInfo(&my_gpu_info)
       angle::GetSystemInfo(&system_info)
         // Will return false after calling GetActiveGPU()
         angle::{anonimous namespace}::GetActiveGPU(...)
           // GetEntryProperty() following CGDisplayIOServicePort will
           // return false.
           CGDisplayIOServicePort(kCGDirectMainDisplay)
             // Will return MACH_PORT_NULL if display is not connected.
    
    Suggested change
    ----------------
    Check that gpu_vendor_ is empty and bail out early in
    
    gpu: :GPUTestBotConfig::Matches(const GPUConfig&)
    Cq-Include-Trybots: master.tryserver.chromium.android:android_optional_gpu_tests_rel;master.tryserver.chromium.linux:linux_optional_gpu_tests_rel;master.tryserver.chromium.mac:mac_optional_gpu_tests_rel;master.tryserver.chromium.win:win_optional_gpu_tests_rel
    Change-Id: Id8f325e4155ee928f2988c50240d7517641779f8
    Reviewed-on: https://chromium-review.googlesource.com/788851
    Commit-Queue: Zhenyao Mo <zmo@chromium.org>
    Reviewed-by: default avatarZhenyao Mo <zmo@chromium.org>
    Cr-Commit-Position: refs/heads/master@{#521412}
    3f5e1e42
gpu_test_config.h 3.89 KB