Update test bench for vulkan

- Just check for `driverName` in the output string
This commit is contained in:
Guillaume Bouchard 2020-04-28 10:57:42 +02:00 committed by Guillaume Bouchard
parent ace3193d44
commit 3db9b5d12a

18
Test.hs
View File

@ -42,21 +42,19 @@ checkOpenGL_32_64 glxinfo32 glxinfo64 vendorName nixGLName = do
-- * Vulkan -- * Vulkan
-- | Returns the vendor string associated with a glxinfo wrapped by a nixGL. -- | Heuristic to detect if vulkan work. `driverName` must appears in the output
getVulkanVendorString io = do checkVulkanIsWorking io = do
output <- Text.lines <$> io res <- io
pure $ Text.unpack <$> find ("driverName"`Text.isInfixOf`) output res `shouldSatisfy` ("driverName"`Text.isInfixOf`)
-- | Checks that a nixGL wrapper works with glxinfo 32 & 64 bits. -- | Checks that a nixGL wrapper works with glxinfo 32 & 64 bits.
checkVulkan_32_64 vulkaninfo32 vulkaninfo64 vendorName nixGLName = do checkVulkan_32_64 vulkaninfo32 vulkaninfo64 vendorName nixGLName = do
beforeAll (getNixGLBin nixGLName) $ do beforeAll (getNixGLBin nixGLName) $ do
it "32 bits" $ \nixGLBin -> do it "32 bits" $ \nixGLBin -> do
Just vendorString <- getVulkanVendorString (processOutput nixGLBin [vulkaninfo32]) checkVulkanIsWorking (processOutput nixGLBin [vulkaninfo32])
vendorString `shouldContain` vendorName
it "64 bits" $ \nixGLBin -> do it "64 bits" $ \nixGLBin -> do
Just vendorString <- getVulkanVendorString (processOutput nixGLBin [vulkaninfo64]) checkVulkanIsWorking (processOutput nixGLBin [vulkaninfo64])
vendorString `shouldContain` vendorName
main = do main = do
@ -85,10 +83,10 @@ main = do
vendorString `shouldBe` Nothing vendorString `shouldBe` Nothing
describe "Vulkan" $ do describe "Vulkan" $ do
it "fails with unwrapped vulkaninfo64" $ do it "fails with unwrapped vulkaninfo64" $ do
getVulkanVendorString (processOutput vulkaninfo64 []) `shouldThrow` anyIOException processOutput vulkaninfo64 [] `shouldThrow` anyIOException
it "fails with unwrapped vulkaninfo32" $ do it "fails with unwrapped vulkaninfo32" $ do
getVulkanVendorString (processOutput vulkaninfo32 []) `shouldThrow` anyIOException processOutput vulkaninfo32 [] `shouldThrow` anyIOException
describe "NixGL" $ do describe "NixGL" $ do
describe "Mesa" $ do describe "Mesa" $ do