Re: [PATCH i-g-t v2] intel_gvtg_test: Handle system(3) return value.

Tvrtko Ursulin
2017-11-09T10:16:49Z

On 08/11/2017 12:52, Petri Latvala wrote:
> On Wed, Nov 08, 2017 at 12:47:43PM +0000, Tvrtko Ursulin wrote:
>> From: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
>>
>> Avoid the build warning by checking the pkill either did not find
>> any guests or managed to send a signal to all of them.
>>
>> v2: Inspect system(3) return value properly. (Petri Latvala)
>>
>> Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
>
> Reviewed-by: Petri Latvala <petri.latvala@intel.com>
>
> Someone(tm) can follow this up with a patch that changes it to use
> igt_terminate_process...

Better suited to actual owners of this file I think. I was only
distracted by the compile warning. Since it is a bigger task - question
of case comparison, full vs substring, mismatching return codes between
two implementations of igt_terminate_process...

Regards,

Tvrtko

>
>> ---
>> tools/intel_gvtg_test.c | 5 ++++-
>> 1 file changed, 4 insertions(+), 1 deletion(-)
>>
>> diff --git a/tools/intel_gvtg_test.c b/tools/intel_gvtg_test.c
>> index 7a29fbdde7cd..659b7956725c 100644
>> --- a/tools/intel_gvtg_test.c
>> +++ b/tools/intel_gvtg_test.c
>> @@ -144,7 +144,10 @@ static void create_guest(void)
>>
>> static void destroy_all_guest(void)
>> {
>> - system("pkill qemu");
>> + int ret = system("pkill qemu");
>> +
>> + igt_assert(ret >= 0 && WIFEXITED(ret));
>> + igt_assert(WEXITSTATUS(ret) == 0 || WEXITSTATUS(ret) == 1);
>> }
>>
>> static void remove_vgpu(void)
>> --
>> 2.14.1
>>
>> _______________________________________________
>> Intel-gfx mailing list
>> Intel-gfx@lists.freedesktop.org
>> https://lists.freedesktop.org/mailman/listinfo/intel-gfx
> _______________________________________________
> Intel-gfx mailing list
> Intel-gfx@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/intel-gfx