On Sat, Mar 26, 2016 at 01:48:16PM +0530, Jay Joshi wrote: [...] > 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?
getopt for passing 1 bit of informations seems like overkill.
> Any other changes required?
I've applied your patch with the following modifications:
--- a/tests/uname.c
+++ b/tests/uname.c
@@ -6,47 +6,33 @@
# include <stdio.h>
# include <sys/utsname.h>
# include <unistd.h>
-# include <assert.h>
int main(int ac, char **av)
{
- assert(ac <= 2);
-
- int abbrev = 0, c;
- while ((c = getopt (ac, av, "a")) != -1) {
- switch (c) {
- case 'a':
- abbrev = 1;
- break;
- }
- }
-
+ int abbrev = ac > 1;
struct utsname *const uname = tail_alloc(sizeof(struct utsname));
int rc = syscall(__NR_uname, uname);
printf("uname({sysname=\"");
print_quoted_string(uname->sysname);
printf("\", nodename=\"");
print_quoted_string(uname->nodename);
- printf("\"");
if (abbrev) {
- printf(", ...");
- goto print_and_exit;
- }
- printf(", release=\"");
- print_quoted_string(uname->release);
- printf("\", version=\"");
- print_quoted_string(uname->version);
- printf("\", machine=\"");
- print_quoted_string(uname->machine);
- printf("\"");
+ printf("\", ...");
+ } else {
+ printf("\", release=\"");
+ print_quoted_string(uname->release);
+ printf("\", version=\"");
+ print_quoted_string(uname->version);
+ printf("\", machine=\"");
+ print_quoted_string(uname->machine);
# ifdef HAVE_STRUCT_UTSNAME_DOMAINNAME
- printf(", domainname=\"");
- print_quoted_string(uname->domainname);
- printf("\"");
+ printf("\", domainname=\"");
+ print_quoted_string(uname->domainname);
# endif
-
-print_and_exit:
+ printf("\"");
+ }
printf("}) = %d\n", rc);
+
puts("+++ exited with 0 +++");
return 0;
}
--- a/tests/uname.test
+++ b/tests/uname.test
@@ -13,7 +13,7 @@ run_prog > /dev/null
run_strace -v -euname $args > "$EXP"
uniq < "$LOG" > "$OUT"
-run_prog "./${ME_%.test}" -a > /dev/null
+run_prog "./${ME_%.test}" abbrev > /dev/null
run_strace -euname $args >> "$EXP"
uniq < "$LOG" >> "$OUT"
--
ldv
pgp_aSTW_okhK.pgp
Description: PGP signature
------------------------------------------------------------------------------ Transform Data into Opportunity. Accelerate data analysis in your applications with Intel Data Analytics Acceleration Library. Click to learn more. http://pubads.g.doubleclick.net/gampad/clk?id=278785471&iu=/4140
_______________________________________________ Strace-devel mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/strace-devel
