none
Input parameter for ioctal unit testing RRS feed

  • Question

  • Hi,

    I want to test a driver with different IOCTLs.

    should I write unit test for each one or can I loop the same test with insert the match IOCTL and relevant buffer?

    I want that each IOCTL  will be as separate test.

    Thanks!

    Tuesday, February 25, 2014 6:56 AM

Answers

  • It is really up to you. Separate binaries give flexibility but a lot of code potentially to maintain. One binary makes it easy to add tests, but potentially more complex code. You could have one binary and a cmd line flag to optionally run just one test. But this is a bit over engineered. Sending and completing an ioctl request takes very little time. You could probably go through your entire test suite in under a few seconds.

    d -- This posting is provided "AS IS" with no warranties, and confers no rights.

    Tuesday, February 25, 2014 3:18 PM

All replies

  • It is really up to you. Separate binaries give flexibility but a lot of code potentially to maintain. One binary makes it easy to add tests, but potentially more complex code. You could have one binary and a cmd line flag to optionally run just one test. But this is a bit over engineered. Sending and completing an ioctl request takes very little time. You could probably go through your entire test suite in under a few seconds.

    d -- This posting is provided "AS IS" with no warranties, and confers no rights.

    Tuesday, February 25, 2014 3:18 PM
  • Hi Doron,

    thanks for your quick answer.

    I think that my question was not clear enough.

    I have a test group - which contains few test, such as DisableEnable, SurpriseRemove and etc.

    this test group contains also FunctionalIOCTLInterfaceTesting test.

    my question is how can I do multiple FunctionalIOCTLInterfaceTesting tests in my specific test group. 

    can I use the existing FunctionalIOCTLInterfaceTesting test and send him parameters such as CTL_CODE, input\output buffer because of the flow is same for all, or I must adding FunctionalIOCTLInterfaceTesting for each IOCTL?

    if I can use one FunctionalIOCTLInterfaceTesting, how can I send him the parameters?

    thanks a lot,

    Shosho


    • Edited by Shosho Gold Wednesday, February 26, 2014 1:35 PM
    Wednesday, February 26, 2014 1:34 PM
  • Do you mean that you want to add the same test multiple times to a single test group, and call it with different parameter values? If so, that's not something that is supported by the WDK test infrastructure. You need each test to have its own separate instance.

    If that's what you want, I would suggest writing multiple test methods and simply call a common method from each of them with the right parameters.

    If all you want to do is have parameters, then that is doable by adding the proper TAEF metadata to your test methods. See here for more details.


    Max -- This posting is provided "AS IS" with no warranties, and confers no rights.

    Wednesday, February 26, 2014 7:32 PM