-
Notifications
You must be signed in to change notification settings - Fork 294
Adding Tests
Pyry Haulos edited this page Jan 13, 2017
·
3 revisions
NOTE: For coding conventions see Contributing page.
- Use lowercase_with_underscores style
- Uppercase letters and dash are very rarely used but not entirely banned
- Try to limit test case/group names to <80 chars and total paths (dEQP-VK.your_group.your_case) to <200 chars
- Not currently strictly enforced
- Try to not have more than a hundred or so direct children (child groups or cases) per group
- Again, not strictly enforced, but often helps to guide towards more understandable hierarchy
Vulkan test module containing all test code can be found under external/vulkancts/modules/vulkan
.
See external/vulkancts/modules/vulkan/api/vktApiSmokeTests.cpp for example test code.
Basic Vulkan test is a function of following type:
#include "vktTestCase.hpp"
tcu::TestStatus testFooBar (Context& context, Arg0 arg0)
{
...
return tcu::TestStatus::pass("All checks passed");
}
Where Arg0
is optional. These tests must be connected to the test hierarchy. For example:
// For addFunctionCase()
#include "vktTestCaseUtil.hpp"
// For createTestGroup()
#include "vktTestGroupUtil.hpp"
void populateMyTestGroup (tcu::TestCaseGroup* testGroup)
{
addFunctionCase(testGroup, "foo_bar", "Foo Bar", testFooBar, arg0Value);
}
// Somewhere in existing test code (perhaps vktTestPackage.cpp)
void populateRootGroup (tcu::TestCaseGroup* rootGroup)
{
addTestGroup(rootGroup, "my_tests", "My Tests", populateMyTestGroup);
}
Test cases can access various utilities and resources through vkt::Context
(see external/vulkancts/modules/vulkan/vktTestCase.hpp) provided to them. The most commonly used utilities are:
-
context.getTestContext().getLog()
: Test log, see framework/common/tcuTestLog.hpp -
context.getDevice()
: DefaultVkDevice
-
context.getDeviceInterface()
: Defaultvk::DeviceInterface
providing access to device-level Vulkan API entry points.