[PATCH 1/3] tests: add uname.test

Fei, Jie/费 杰 feij.fnst at cn.fujitsu.com
Tue Mar 1 08:55:25 UTC 2016


Hi!

Thanks a lot for your comments. I have modified the patches to V2.

On 03/01/2016 07:52 AM, Dmitry V. Levin wrote:
> On Fri, Feb 26, 2016 at 05:41:37PM +0800, Fei Jie wrote:
>> * tests/uname.c: New file.
>> * tests/uname.test: New test.
>> * tests/.gitignore: Add uname.
>> * tests/Makefile.am (check_PROGRAMS): Likewise.
>> (TESTS): Add uname.test.
>> ---
>>   tests/.gitignore  |  1 +
>>   tests/Makefile.am |  2 ++
>>   tests/uname.c     | 38 ++++++++++++++++++++++++++++++++++++++
>>   tests/uname.test  | 11 +++++++++++
>>   4 files changed, 52 insertions(+)
>>   create mode 100644 tests/uname.c
>>   create mode 100755 tests/uname.test
>>
>> diff --git a/tests/.gitignore b/tests/.gitignore
>> index bdce2db..e79d317 100644
>> --- a/tests/.gitignore
>> +++ b/tests/.gitignore
>> @@ -124,6 +124,7 @@ umount
>>   umount2
>>   umovestr
>>   umovestr2
>> +uname
>>   unix-pair-send-recv
>>   userfaultfd
>>   utime
>> diff --git a/tests/Makefile.am b/tests/Makefile.am
>> index 54f3d5b..d924b9a 100644
>> --- a/tests/Makefile.am
>> +++ b/tests/Makefile.am
>> @@ -172,6 +172,7 @@ check_PROGRAMS = \
>>   	umount2 \
>>   	umovestr \
>>   	umovestr2 \
>> +	uname \
>>   	unix-pair-send-recv \
>>   	userfaultfd \
>>   	utime \
>> @@ -326,6 +327,7 @@ TESTS = \
>>   	umount2.test \
>>   	umovestr.test \
>>   	umovestr2.test \
>> +	uname.test \
>>   	userfaultfd.test \
>>   	utime.test \
>>   	utimensat.test \
>> diff --git a/tests/uname.c b/tests/uname.c
>> new file mode 100644
>> index 0000000..ac1adce
>> --- /dev/null
>> +++ b/tests/uname.c
>> @@ -0,0 +1,38 @@
>> +#include "tests.h"
>> +#include <sys/syscall.h>
>> +
>> +#ifdef __NR_uname
>> +
>> +# include <stdio.h>
>> +# include <sys/utsname.h>
>> +# include <unistd.h>
>> +
>> +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\""
>> +# ifdef _GNU_SOURCE
>> +	       ", domainname=\"%s\""
>> +# endif
> Why _GNU_SOURCE?  Note that strace parser uses HAVE_STRUCT_UTSNAME_DOMAINNAME.
>
>
>
>
> ------------------------------------------------------------------------------
> Site24x7 APM Insight: Get Deep Visibility into Application Performance
> APM + Mobile APM + RUM: Monitor 3 App instances at just $35/Month
> Monitor end-to-end web transactions and take corrective actions now
> Troubleshoot faster and improve end-user experience. Signup Now!
> http://pubads.g.doubleclick.net/gampad/clk?id=272487151&iu=/4140
>
>
> _______________________________________________
> Strace-devel mailing list
> Strace-devel at lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/strace-devel

-- 
Thanks!
Fei Jie



-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.strace.io/pipermail/strace-devel/attachments/20160301/a629c774/attachment.html>


More information about the Strace-devel mailing list