Re: [PATCH igt 2/8] lib/igt_core: Add igt_assert_fd

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



>
>
>-----Original Message-----
>From: Intel-gfx [mailto:intel-gfx-bounces@xxxxxxxxxxxxxxxxxxxxx] On Behalf Of Daniel Vetter
>Sent: Friday, October 2, 2015 9:02 AM
>To: Daniel Stone
>Cc: Vetter, Daniel; intel-gfx@xxxxxxxxxxxxxxxxxxxxx; Wood, Thomas
>Subject: Re:  [PATCH igt 2/8] lib/igt_core: Add igt_assert_fd
>
>On Thu, Oct 01, 2015 at 05:34:02PM +0100, Daniel Stone wrote:
>> Skip open-coding and assert that fds are valid.
>> 
>> Signed-off-by: Daniel Stone <daniels@xxxxxxxxxxxxx>
>> ---
>>  lib/igt_core.h | 11 +++++++++++
>>  1 file changed, 11 insertions(+)
>> 
>> diff --git a/lib/igt_core.h b/lib/igt_core.h index 9a5d9c5..8f93e8e 
>> 100644
>> --- a/lib/igt_core.h
>> +++ b/lib/igt_core.h
>> @@ -507,6 +507,17 @@ void igt_exit(void) __attribute__((noreturn));  
>> #define igt_assert_lt(n1, n2) igt_assert_cmpint(n1, <, >=, n2)
>>  
>>  /**
>> + * igt_assert_fd:
>> + * @fd: file descriptor
>> + *
>> + * Fails (sub-) test if the given file descriptor is not valid.
>> + *
>> + * Like igt_assert(), but displays the values being compared on 
>> +failure instead
>> + * of simply printing the stringified expression.
>> + */
>> +#define igt_assert_fd(fd) igt_assert_lte(0, fd)
>
I think this will assert for valid fd's and not invalid ones.
>From igt_core.h:
igt_assert_lte
Fails (sub-)test if the second integers is greater than the first.

>If we do this then I think some more verbose output would be nice, like
>
>#igt_assert_fd(fd) igt_assert_f(fd >= 0, "file descriptor " #fd " failed\n");
>
>Large-scale sed would be even more awesome ;-) -Daniel
>
>> +
>> +/**
>>   * igt_require:
>>   * @expr: condition to test
>>   *
>> --
>> 2.5.0
>> 
>> _______________________________________________
>> Intel-gfx mailing list
>> Intel-gfx@xxxxxxxxxxxxxxxxxxxxx
>> http://lists.freedesktop.org/mailman/listinfo/intel-gfx
>
>--
>Daniel Vetter
>Software Engineer, Intel Corporation
>http://blog.ffwll.ch
>_______________________________________________
>Intel-gfx mailing list
>Intel-gfx@xxxxxxxxxxxxxxxxxxxxx
>http://lists.freedesktop.org/mailman/listinfo/intel-gfx
>
_______________________________________________
Intel-gfx mailing list
Intel-gfx@xxxxxxxxxxxxxxxxxxxxx
http://lists.freedesktop.org/mailman/listinfo/intel-gfx




[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]
  Powered by Linux