From 2fe88613fbaaeb0e648d1d2acbd3f7b53f6a5298 Mon Sep 17 00:00:00 2001 From: agiersch Date: Wed, 1 Dec 2010 22:00:27 +0000 Subject: [PATCH] Fix usage of testsuite_name. Do not duplicate string for testuite_name when tesh file is read from stdin, and pass testsuite_name to handle_suite. Also update tesh tesh files for s/stdin/(stdin)/. git-svn-id: svn+ssh://scm.gforge.inria.fr/svn/simgrid/simgrid/trunk@8841 48e7efb5-ca39-0410-a469-dd3cf9ba447f --- tools/tesh/IO-orders.tesh | 12 ++++++------ tools/tesh/catch-return.tesh | 6 +++--- tools/tesh/catch-signal.tesh | 6 +++--- tools/tesh/catch-timeout.tesh | 8 ++++---- tools/tesh/catch-wrong-output.tesh | 6 +++--- tools/tesh/set-ignore-output.tesh | 4 ++-- tools/tesh/tesh.c | 6 +++--- tools/tesh/tesh.h | 2 +- 8 files changed, 25 insertions(+), 25 deletions(-) diff --git a/tools/tesh/IO-orders.tesh b/tools/tesh/IO-orders.tesh index 80cc59657b..14db63d9b5 100644 --- a/tools/tesh/IO-orders.tesh +++ b/tools/tesh/IO-orders.tesh @@ -6,7 +6,7 @@ p Order: in, out, cmd < > TOTO < $ cat > Test suite from stdin -> [stdin:3] cat +> [(stdin):3] cat > Test suite from stdin OK $ ./tesh --log='log.thresh:info tesh.fmt:%m%n' @@ -15,7 +15,7 @@ p Order: out, in, cmd < < TOTO < $ cat > Test suite from stdin -> [stdin:3] cat +> [(stdin):3] cat > Test suite from stdin OK $ ./tesh --log='log.thresh:info tesh.fmt:%m%n' @@ -24,7 +24,7 @@ p Order: out, cmd, in < $ cat < < TOTO > Test suite from stdin -> [stdin:2] cat +> [(stdin):2] cat > Test suite from stdin OK $ ./tesh --log='log.thresh:info tesh.fmt:%m%n' @@ -33,7 +33,7 @@ p Order: in, cmd, out < $ cat < > TOTO > Test suite from stdin -> [stdin:2] cat +> [(stdin):2] cat > Test suite from stdin OK $ ./tesh --log='log.thresh:info tesh.fmt:%m%n' @@ -42,7 +42,7 @@ p Order: cmd, out, in < > TOTO < < TOTO > Test suite from stdin -> [stdin:1] cat +> [(stdin):1] cat > Test suite from stdin OK $ ./tesh --log='log.thresh:info tesh.fmt:%m%n' @@ -51,7 +51,7 @@ p Order: cmd, in, out < < TOTO < > TOTO > Test suite from stdin -> [stdin:1] cat +> [(stdin):1] cat > Test suite from stdin OK $ ./tesh --log='log.thresh:info tesh.fmt:%m%n' diff --git a/tools/tesh/catch-return.tesh b/tools/tesh/catch-return.tesh index 20784e72ad..b7d39c592d 100644 --- a/tools/tesh/catch-return.tesh +++ b/tools/tesh/catch-return.tesh @@ -18,9 +18,9 @@ $ gcc -o return1 return1.c < $ ./return1 $ ../tesh --log='log.thresh:info tesh.fmt:%m%n' > Test suite from stdin -> [stdin:1] ./return1 -> Test suite `(stdin)': NOK ( returned code 1) -> Output of so far: +> [(stdin):1] ./return1 +> Test suite `(stdin)': NOK (<(stdin):1> returned code 1) +> Output of <(stdin):1> so far: > || $ cd .. diff --git a/tools/tesh/catch-signal.tesh b/tools/tesh/catch-signal.tesh index c9f9fec146..2b0436f2aa 100644 --- a/tools/tesh/catch-signal.tesh +++ b/tools/tesh/catch-signal.tesh @@ -19,9 +19,9 @@ $ gcc -o segfault segfault.c < $ ./segfault $ ../tesh --log='log.thresh:info tesh.fmt:%m%n' > Test suite from stdin -> [stdin:1] ./segfault -> Test suite `(stdin)': NOK ( got signal SIGSEGV) -> Output of so far: +> [(stdin):1] ./segfault +> Test suite `(stdin)': NOK (<(stdin):1> got signal SIGSEGV) +> Output of <(stdin):1> so far: > || $ cd .. diff --git a/tools/tesh/catch-timeout.tesh b/tools/tesh/catch-timeout.tesh index d4c6f14d92..ebab52a61d 100644 --- a/tools/tesh/catch-timeout.tesh +++ b/tools/tesh/catch-timeout.tesh @@ -7,8 +7,8 @@ < ! timeout 1 < $ sleep 6 > Test suite from stdin -> [stdin:2] sleep 6 -> timeouted. Kill the process. -> No output before timeout -> Test suite `(stdin)': NOK ( timeout after 1 sec) +> [(stdin):2] sleep 6 +> <(stdin):2> timeouted. Kill the process. +> <(stdin):2> No output before timeout +> Test suite `(stdin)': NOK (<(stdin):2> timeout after 1 sec) $ ./tesh --log='log.thresh:info tesh.fmt:%m%n' diff --git a/tools/tesh/catch-wrong-output.tesh b/tools/tesh/catch-wrong-output.tesh index 8fa8bceed0..135ae4cbfa 100644 --- a/tools/tesh/catch-wrong-output.tesh +++ b/tools/tesh/catch-wrong-output.tesh @@ -8,9 +8,9 @@ p This tests whether TESH detects wrong outputs < $ cat $ ./tesh --log='log.thresh:info tesh.fmt:%m%n' > Test suite from stdin -> [stdin:3] cat -> Output of mismatch: +> [(stdin):3] cat +> Output of <(stdin):3> mismatch: > - TOTO > + TUTU -> Test suite `(stdin)': NOK ( output mismatch) +> Test suite `(stdin)': NOK (<(stdin):3> output mismatch) diff --git a/tools/tesh/set-ignore-output.tesh b/tools/tesh/set-ignore-output.tesh index 6697a407d5..af80e581e4 100644 --- a/tools/tesh/set-ignore-output.tesh +++ b/tools/tesh/set-ignore-output.tesh @@ -8,6 +8,6 @@ p This tests whether TESH accepts to ignore command output < $ cat $ ./tesh --log='log.thresh:info tesh.fmt:%m%n' > Test suite from stdin -> [stdin:4] cat -> (ignoring the output of as requested) +> [(stdin):4] cat +> (ignoring the output of <(stdin):4> as requested) > Test suite from stdin OK diff --git a/tools/tesh/tesh.c b/tools/tesh/tesh.c index 628f8566f8..f4a3c89920 100644 --- a/tools/tesh/tesh.c +++ b/tools/tesh/tesh.c @@ -21,7 +21,7 @@ XBT_LOG_NEW_DEFAULT_CATEGORY(tesh, "TEst SHell utility"); /*** Options ***/ int timeout_value = 5; /* child timeout value */ -char *testsuite_name; +const char *testsuite_name; static void handle_line(const char *filepos, char *line) { /* Search end */ @@ -241,8 +241,8 @@ int main(int argc, char *argv[]) /* Find the description file */ if (argc == 1) { INFO0("Test suite from stdin"); - testsuite_name = xbt_strdup("(stdin)"); - handle_suite("stdin", stdin); + testsuite_name = "(stdin)"; + handle_suite(testsuite_name, stdin); INFO0("Test suite from stdin OK"); } else { diff --git a/tools/tesh/tesh.h b/tools/tesh/tesh.h index d393903bee..8f73c1c9a0 100644 --- a/tools/tesh/tesh.h +++ b/tools/tesh/tesh.h @@ -25,7 +25,7 @@ const char *signal_name(unsigned int got, char *expected); int timeout_value; /* child timeout value */ rctx_t rctx; -char *testsuite_name; +const char *testsuite_name; /* Environment related definitions */ -- 2.20.1