Re: [LTP] [PATCH v2] ltp/pounder: Don't let the testing log output to /dev/tty
Hi, On Tue, Sep 1, 2015 at 9:44 PM, Cyril Hrubiswrote: > Hi! > > + out = fdopen(3, "w+"); > > This is just complicated way of doing out = stderr; > > And I doubt that this will fail under normal circumstances. > > So what about doing just out = stderr; or out = stdout instead? > Totally agree. actually I want do that at first. :) Feel free to modify the patch. "out = stdout" is good. > > Otherwise it looks fine and I'm OK with applying this before the > release. > Thanks! > > -- > Cyril Hrubis > chru...@suse.cz > -- Regards, Li Wang Email: liw...@redhat.com -- Monitor Your Dynamic Infrastructure at Any Scale With Datadog! Get real-time metrics from all of your servers, apps and tools in one place. SourceForge users - Click here to start your Free Trial of Datadog now! http://pubads.g.doubleclick.net/gampad/clk?id=241902991=/4140___ Ltp-list mailing list Ltp-list@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/ltp-list
Re: [LTP] [PATCH v2] ltp/pounder: Don't let the testing log output to /dev/tty
Hi! > + out = fdopen(3, "w+"); This is just complicated way of doing out = stderr; And I doubt that this will fail under normal circumstances. So what about doing just out = stderr; or out = stdout instead? Otherwise it looks fine and I'm OK with applying this before the release. -- Cyril Hrubis chru...@suse.cz -- ___ Ltp-list mailing list Ltp-list@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/ltp-list
Re: [LTP] [PATCH v2] ltp/pounder: Don't let the testing log output to /dev/tty
ping, is there possible to push this before the newest LTP released? On Fri, Aug 21, 2015 at 6:13 PM, Li Wangwrote: > v1-->v2: > - FILE *tty_fp --> FILE *out > - Using out = stdout to replace the fdopen() operate; > > Signed-off-by: Li Wang > Signed-off-by: Cyril Hrubis > --- > tools/pounder21/Install | 2 +- > tools/pounder21/fancy_timed_loop.c | 29 - > tools/pounder21/infinite_loop.c | 25 ++--- > tools/pounder21/pounder | 14 +++--- > tools/pounder21/test_scripts/memtest | 2 +- > tools/pounder21/timed_loop.c | 27 +++ > 6 files changed, 42 insertions(+), 57 deletions(-) > > diff --git a/tools/pounder21/Install b/tools/pounder21/Install > index bf13528..6fb3a8f 100755 > --- a/tools/pounder21/Install > +++ b/tools/pounder21/Install > @@ -65,7 +65,7 @@ done > # Set up optdir > mkdir -p "$POUNDER_OPTDIR" > if [ ! -d "$POUNDER_OPTDIR" ]; then > - echo "Could not create $POUNDER_OPTDIR; aborting." > /dev/tty > + echo "Could not create $POUNDER_OPTDIR; aborting." > exit 1 > fi > > diff --git a/tools/pounder21/fancy_timed_loop.c > b/tools/pounder21/fancy_timed_loop.c > index cf8580e..e2ca1dc 100644 > --- a/tools/pounder21/fancy_timed_loop.c > +++ b/tools/pounder21/fancy_timed_loop.c > @@ -32,13 +32,13 @@ > static int res = 0; > static char *progname; > static pid_t test_pgrp; > -static FILE *tty_fp; > +static FILE *out; > > static int the_signal = SIGTERM; > > static void int_func(int signum) > { > - pounder_fprintf(tty_fp, > + pounder_fprintf(out, > "%s: Killed by interrupt. Last exit code = %d.\n", > progname, res); > kill(-test_pgrp, the_signal); > @@ -47,7 +47,7 @@ static void int_func(int signum) > > static void alarm_func(int signum) > { > - pounder_fprintf(tty_fp, "%s: Killed by timer. Last exit code = > %d.\n", > + pounder_fprintf(out, "%s: Killed by timer. Last exit code = > %d.\n", > progname, res); > kill(-test_pgrp, the_signal); > exit(res); > @@ -90,14 +90,9 @@ int main(int argc, char *argv[]) > } > } > > - tty_fp = fdopen(3, "w+"); > - if (tty_fp == NULL) { > - tty_fp = fopen("/dev/tty", "w+"); > - if (tty_fp == NULL) { > - perror("stdout"); > - exit(2); > - } > - } > + out = fdopen(3, "w+"); > + if (out == NULL) > + out = stdout; > > if (use_max_failures) { > progname = rindex(argv[7], '/'); > @@ -142,11 +137,11 @@ int main(int argc, char *argv[]) > gid = atoi(argv[3]); > } > > - pounder_fprintf(tty_fp, "%s: uid = %d, gid = %d, sig = %d\n", > + pounder_fprintf(out, "%s: uid = %d, gid = %d, sig = %d\n", > progname, uid, gid, the_signal); > > while (1) { > - pounder_fprintf(tty_fp, "%s: %s loop #%d.\n", progname, > + pounder_fprintf(out, "%s: %s loop #%d.\n", progname, > start_msg, revs++); > pid = fork(); > if (pid == 0) { > @@ -196,22 +191,22 @@ int main(int argc, char *argv[]) > } > // interrogate it > if (WIFSIGNALED(stat)) { > - pounder_fprintf(tty_fp, "%s: %s on signal %d.\n", > + pounder_fprintf(out, "%s: %s on signal %d.\n", > progname, fail_msg, > WTERMSIG(stat)); > res = 255; > } else { > res = WEXITSTATUS(stat); > if (res == 0) { > - pounder_fprintf(tty_fp, "%s: %s.\n", > progname, > + pounder_fprintf(out, "%s: %s.\n", progname, > pass_msg); > } else if (res < 0 || res == 255) { > - pounder_fprintf(tty_fp, > + pounder_fprintf(out, > "%s: %s with code %d.\n", > progname, abort_msg, res); > exit(-1); > // FIXME: add test to blacklist > } else { > - pounder_fprintf(tty_fp, > + pounder_fprintf(out, > "%s: %s with code %d.\n", > progname, fail_msg, res); > if (max_failures > 0) { > diff --git a/tools/pounder21/infinite_loop.c >
[LTP] [PATCH v2] ltp/pounder: Don't let the testing log output to /dev/tty
v1--v2: - FILE *tty_fp -- FILE *out - Using out = stdout to replace the fdopen() operate; Signed-off-by: Li Wang liw...@redhat.com Signed-off-by: Cyril Hrubis chru...@suse.cz --- tools/pounder21/Install | 2 +- tools/pounder21/fancy_timed_loop.c | 29 - tools/pounder21/infinite_loop.c | 25 ++--- tools/pounder21/pounder | 14 +++--- tools/pounder21/test_scripts/memtest | 2 +- tools/pounder21/timed_loop.c | 27 +++ 6 files changed, 42 insertions(+), 57 deletions(-) diff --git a/tools/pounder21/Install b/tools/pounder21/Install index bf13528..6fb3a8f 100755 --- a/tools/pounder21/Install +++ b/tools/pounder21/Install @@ -65,7 +65,7 @@ done # Set up optdir mkdir -p $POUNDER_OPTDIR if [ ! -d $POUNDER_OPTDIR ]; then - echo Could not create $POUNDER_OPTDIR; aborting. /dev/tty + echo Could not create $POUNDER_OPTDIR; aborting. exit 1 fi diff --git a/tools/pounder21/fancy_timed_loop.c b/tools/pounder21/fancy_timed_loop.c index cf8580e..e2ca1dc 100644 --- a/tools/pounder21/fancy_timed_loop.c +++ b/tools/pounder21/fancy_timed_loop.c @@ -32,13 +32,13 @@ static int res = 0; static char *progname; static pid_t test_pgrp; -static FILE *tty_fp; +static FILE *out; static int the_signal = SIGTERM; static void int_func(int signum) { - pounder_fprintf(tty_fp, + pounder_fprintf(out, %s: Killed by interrupt. Last exit code = %d.\n, progname, res); kill(-test_pgrp, the_signal); @@ -47,7 +47,7 @@ static void int_func(int signum) static void alarm_func(int signum) { - pounder_fprintf(tty_fp, %s: Killed by timer. Last exit code = %d.\n, + pounder_fprintf(out, %s: Killed by timer. Last exit code = %d.\n, progname, res); kill(-test_pgrp, the_signal); exit(res); @@ -90,14 +90,9 @@ int main(int argc, char *argv[]) } } - tty_fp = fdopen(3, w+); - if (tty_fp == NULL) { - tty_fp = fopen(/dev/tty, w+); - if (tty_fp == NULL) { - perror(stdout); - exit(2); - } - } + out = fdopen(3, w+); + if (out == NULL) + out = stdout; if (use_max_failures) { progname = rindex(argv[7], '/'); @@ -142,11 +137,11 @@ int main(int argc, char *argv[]) gid = atoi(argv[3]); } - pounder_fprintf(tty_fp, %s: uid = %d, gid = %d, sig = %d\n, + pounder_fprintf(out, %s: uid = %d, gid = %d, sig = %d\n, progname, uid, gid, the_signal); while (1) { - pounder_fprintf(tty_fp, %s: %s loop #%d.\n, progname, + pounder_fprintf(out, %s: %s loop #%d.\n, progname, start_msg, revs++); pid = fork(); if (pid == 0) { @@ -196,22 +191,22 @@ int main(int argc, char *argv[]) } // interrogate it if (WIFSIGNALED(stat)) { - pounder_fprintf(tty_fp, %s: %s on signal %d.\n, + pounder_fprintf(out, %s: %s on signal %d.\n, progname, fail_msg, WTERMSIG(stat)); res = 255; } else { res = WEXITSTATUS(stat); if (res == 0) { - pounder_fprintf(tty_fp, %s: %s.\n, progname, + pounder_fprintf(out, %s: %s.\n, progname, pass_msg); } else if (res 0 || res == 255) { - pounder_fprintf(tty_fp, + pounder_fprintf(out, %s: %s with code %d.\n, progname, abort_msg, res); exit(-1); // FIXME: add test to blacklist } else { - pounder_fprintf(tty_fp, + pounder_fprintf(out, %s: %s with code %d.\n, progname, fail_msg, res); if (max_failures 0) { diff --git a/tools/pounder21/infinite_loop.c b/tools/pounder21/infinite_loop.c index d78b442..3a9d68c 100644 --- a/tools/pounder21/infinite_loop.c +++ b/tools/pounder21/infinite_loop.c @@ -32,11 +32,11 @@ static int res = 0; static char *progname; static pid_t test_pgrp; -static FILE *tty_fp; +static FILE *out; static void int_func(int signum) { - pounder_fprintf(tty_fp, + pounder_fprintf(out, %s: Killed by interrupt. Last exit