On 1/26/19 6:14 AM, Omar Sandoval wrote:
> On Fri, Jan 18, 2019 at 06:44:45PM +0900, Shin'ichiro Kawasaki wrote:
>> These optional functions can be defined by a test case script. When
>> defined and TEST_DEVS is empty, the fallback_device() is executed before
>> runing the test case. The fallback_device() function intializes a virtual
>> device to run the test case and return the device to be set in TEST_DEVS.
>> After running the test case, cleanup_fallback_device() is executed to
>> clean up the device.
>>
>> This feature allows to run test cases with test_device() function even if
>> TEST_DEVS is not set in the config, using virtaul devices such as null_blk.
>>
>> Signed-off-by: Shin'ichiro Kawasaki <[email protected]>
>> ---
>>   check | 25 +++++++++++++++++++++++++
>>   1 file changed, 25 insertions(+)
>>
>> diff --git a/check b/check
>> index 4563d62..4b66995 100755
>> --- a/check
>> +++ b/check
>> @@ -407,6 +407,7 @@ _run_test() {
>>      CHECK_DMESG=1
>>      DMESG_FILTER="cat"
>>      RUN_FOR_ZONED=0
>> +    FALLBACK_DEVICE=0
>>   
>>      # shellcheck disable=SC1090
>>      . "tests/${TEST_NAME}"
>> @@ -425,6 +426,23 @@ _run_test() {
>>                      _call_test test
>>              fi
>>      else
>> +            if [[ ${#TEST_DEVS[@]} -eq 0 ]] && \
>> +                    declare -fF fallback_device >/dev/null && \
>> +                    declare -fF cleanup_fallback_device >/dev/null; then
> 
> We should check in _found_test that cleanup_fallback_device is defined
> if fallback_device is defined, and vice versa. Then, we can just check
> for fallback_device here.

Thanks. Will change the patch as suggested. I noticed that fallback_device and 
cleanup_fallback_device should be unset at the beginning of _found_test. Will 
add it also.

-- 
Best Regards,
Shin'ichiro Kawasaki

Reply via email to