[PATCH] tests/uname.c: use print_quoted_string to print members of uname

Jay Joshi jay.r.joshi100 at gmail.com
Sat Mar 26 08:18:16 UTC 2016


On Sat, Mar 26, 2016 at 8:59 AM, Dmitry V. Levin <ldv at altlinux.org> wrote:
> On Fri, Mar 25, 2016 at 04:46:53PM +0530, Jay Joshi wrote:
>> On Fri, Mar 25, 2016 at 1:56 AM, Dmitry V. Levin wrote:
>> > On Thu, Mar 24, 2016 at 03:17:48PM +0530, Jay Joshi wrote:
> [...]
>> >> Also, is a test for abbreviated output required?
>> >
>> > It surely won't harm. :)
>> >
>>
>> I've seen in some tests like mmap.test, $ME_ is used in run_prog. I
>> think test scripts should not directly access them. What do you say?
>
> Why do you think so?  Does the name look cryptic?
>

I mean, something like run_prog -a $mmap looks simpler.

> [...]
>> >> --- a/tests/uname.c
>> >> +++ b/tests/uname.c
>> >> @@ -11,21 +11,23 @@ int main()
>> >>  {
>> >>       struct utsname *const uname = tail_alloc(sizeof(struct utsname));
>> >>       int rc = syscall(__NR_uname, uname);
>> >> -     printf("uname({sysname=\"%s\", nodename=\"%s\", release=\"%s\""
>> >> -            ", version=\"%s\", machine=\"%s\""
>> >> +     printf("uname({sysname=\"");
>> >> +             print_quoted_string(uname->sysname);
>> >> +     printf("\", nodename=\"");
>> >> +             print_quoted_string(uname->nodename);
>> >> +     printf("\", release=\"");
>> >> +             print_quoted_string(uname->release);
>> >> +     printf("\", version=\"");
>> >> +             print_quoted_string(uname->version);
>> >> +     printf("\", machine=\"");
>> >> +             print_quoted_string(uname->machine);
>> >
>> > Why these print_quoted_string calls are indented this way?
>>
>> I think it looks more readable this way, it's like the're nested inside quotes.
>
> I don't share your PoV on this.
>
>
Okay, print statements will be indented same way.
Patch is attached.
I've used getopts for flag abbrev, even if there is this only flag. Is
it fine? Any other changes required?
-------------- next part --------------
A non-text attachment was scrubbed...
Name: uname.patch
Type: text/x-patch
Size: 2543 bytes
Desc: not available
URL: <http://lists.strace.io/pipermail/strace-devel/attachments/20160326/affcffeb/attachment.bin>


More information about the Strace-devel mailing list