From 45fd73e922fcbd14b67a7327940bb2d63df60c02 Mon Sep 17 00:00:00 2001 From: mquinson Date: Wed, 6 Jun 2007 13:55:39 +0000 Subject: [PATCH] Adapt the tests to the new code (and use log layouts to make sure we don't have to change the file when the line numbers in the code do change) git-svn-id: svn+ssh://scm.gforge.inria.fr/svn/simgrid/simgrid/trunk@3566 48e7efb5-ca39-0410-a469-dd3cf9ba447f --- tools/tesh/IO-orders.tesh | 48 +++++++++++++++--------------- tools/tesh/catch-return.tesh | 10 ++++--- tools/tesh/catch-signal.tesh | 10 ++++--- tools/tesh/catch-timeout.tesh | 11 +++---- tools/tesh/catch-wrong-output.tesh | 12 ++++---- tools/tesh/cd.tesh | 8 +++++ tools/tesh/set-ignore-output.tesh | 12 ++++---- 7 files changed, 62 insertions(+), 49 deletions(-) diff --git a/tools/tesh/IO-orders.tesh b/tools/tesh/IO-orders.tesh index 4862eb1b67..80cc59657b 100644 --- a/tools/tesh/IO-orders.tesh +++ b/tools/tesh/IO-orders.tesh @@ -5,53 +5,53 @@ p Order: in, out, cmd < < TOTO < > TOTO < $ cat -> [0.000000] [tesh/INFO] Test suite from stdin -> [0.000000] [tesh/INFO] [stdin:3] cat -> [0.000000] [tesh/INFO] Test suite from stdin OK -$ ./tesh +> Test suite from stdin +> [stdin:3] cat +> Test suite from stdin OK +$ ./tesh --log='log.thresh:info tesh.fmt:%m%n' p Order: out, in, cmd < > TOTO < < TOTO < $ cat -> [0.000000] [tesh/INFO] Test suite from stdin -> [0.000000] [tesh/INFO] [stdin:3] cat -> [0.000000] [tesh/INFO] Test suite from stdin OK -$ ./tesh +> Test suite from stdin +> [stdin:3] cat +> Test suite from stdin OK +$ ./tesh --log='log.thresh:info tesh.fmt:%m%n' p Order: out, cmd, in < > TOTO < $ cat < < TOTO -> [0.000000] [tesh/INFO] Test suite from stdin -> [0.000000] [tesh/INFO] [stdin:2] cat -> [0.000000] [tesh/INFO] Test suite from stdin OK -$ ./tesh +> Test suite from stdin +> [stdin:2] cat +> Test suite from stdin OK +$ ./tesh --log='log.thresh:info tesh.fmt:%m%n' p Order: in, cmd, out < < TOTO < $ cat < > TOTO -> [0.000000] [tesh/INFO] Test suite from stdin -> [0.000000] [tesh/INFO] [stdin:2] cat -> [0.000000] [tesh/INFO] Test suite from stdin OK -$ ./tesh +> Test suite from stdin +> [stdin:2] cat +> Test suite from stdin OK +$ ./tesh --log='log.thresh:info tesh.fmt:%m%n' p Order: cmd, out, in < $ cat < > TOTO < < TOTO -> [0.000000] [tesh/INFO] Test suite from stdin -> [0.000000] [tesh/INFO] [stdin:1] cat -> [0.000000] [tesh/INFO] Test suite from stdin OK -$ ./tesh +> Test suite from stdin +> [stdin:1] cat +> Test suite from stdin OK +$ ./tesh --log='log.thresh:info tesh.fmt:%m%n' p Order: cmd, in, out < $ cat < < TOTO < > TOTO -> [0.000000] [tesh/INFO] Test suite from stdin -> [0.000000] [tesh/INFO] [stdin:1] cat -> [0.000000] [tesh/INFO] Test suite from stdin OK -$ ./tesh +> Test suite from stdin +> [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 b69cc1e174..fe8fe040f9 100644 --- a/tools/tesh/catch-return.tesh +++ b/tools/tesh/catch-return.tesh @@ -16,10 +16,12 @@ $ gcc -o return1 return1.c ! expect return 41 < $ ./return1 -$ ../tesh -> [0.000000] [tesh/INFO] Test suite from stdin -> [0.000000] [tesh/INFO] [stdin:1] ./return1 -> [0.000000] run_context.c:374: [tesh/ERROR] Child "./return1" returned code 1 +$ ../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: +> || $ cd .. $ rm -rf temp_testdir diff --git a/tools/tesh/catch-signal.tesh b/tools/tesh/catch-signal.tesh index 4fc075402e..0d718c6422 100644 --- a/tools/tesh/catch-signal.tesh +++ b/tools/tesh/catch-signal.tesh @@ -17,10 +17,12 @@ $ gcc -o segfault segfault.c ! expect return 15 < $ ./segfault -$ ../tesh -> [0.000000] [tesh/INFO] Test suite from stdin -> [0.000000] [tesh/INFO] [stdin:1] ./segfault -> [0.000000] run_context.c:350: [tesh/ERROR] Child "./segfault" got signal SIGSEGV. +$ ../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: +> || $ cd .. $ rm -rf temp_testdir diff --git a/tools/tesh/catch-timeout.tesh b/tools/tesh/catch-timeout.tesh index a5000a00d7..40aa37ae44 100644 --- a/tools/tesh/catch-timeout.tesh +++ b/tools/tesh/catch-timeout.tesh @@ -6,8 +6,9 @@ ! expect return 3 < ! set timeout 1 < $ sleep 6 -> [0.000000] [tesh/INFO] Test suite from stdin -> [0.000000] [tesh/INFO] [stdin:2] sleep 6 -> [0.000000] [tesh/INFO] Child 'sleep 6' timeouted. Kill it -> [0.000000] run_context.c:335: [tesh/ERROR] Child timeouted (waited 1 sec) -$ ./tesh +> Test suite from stdin +> [stdin:2] sleep 6 +> timeouted. Kill the process. +> No output before timeout +> Test suite `(stdin)': NOK ( 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 ddeee94c76..c161efea77 100644 --- a/tools/tesh/catch-wrong-output.tesh +++ b/tools/tesh/catch-wrong-output.tesh @@ -6,11 +6,11 @@ p This tests whether TESH detects wrong outputs < > TOTO < < TUTU < $ cat -$ ./tesh -> [0.000000] [tesh/INFO] Test suite from stdin -> [0.000000] [tesh/INFO] [stdin:3] cat -> [0.000000] run_context.c:394: [tesh/ERROR] Output of child "cat" don't match expectations. Here is a diff between expected and got output: +$ ./tesh --log='log.thresh:info tesh.fmt:%m%n' +> Test suite from stdin +> [stdin:3] cat +> Output mismatch: > - TOTO > + TUTU -> -> +> Test suite `(stdin)': NOK ( output mismatch) + diff --git a/tools/tesh/cd.tesh b/tools/tesh/cd.tesh index b1f60747b6..d52a2ac42b 100644 --- a/tools/tesh/cd.tesh +++ b/tools/tesh/cd.tesh @@ -9,6 +9,14 @@ $ cd testdir_temp # Check that there is nothing in the current dir (which must be testdir_temp) $ ls +# Check that tesh detects properly cd to non-existing directories +! expect return 4 +< $ cd toto +> Test suite from stdin +> Chdir to toto failed: No such file or directory +> Test suite `(stdin)': NOK (system error) +$ ../tesh --log='log.thresh:info tesh.fmt:%m%n' + # The next command checks that there is a testdir_temp in the upper directory, # ie that mkdir and cd both worked. $ test -e ../testdir_temp diff --git a/tools/tesh/set-ignore-output.tesh b/tools/tesh/set-ignore-output.tesh index 7e447bcfc4..01de5b476a 100644 --- a/tools/tesh/set-ignore-output.tesh +++ b/tools/tesh/set-ignore-output.tesh @@ -2,12 +2,12 @@ p This tests whether TESH accepts to ignore command output -< ! ignore output +< ! output ignore < > TOTO < < TUTU < $ cat -$ ./tesh -> [0.000000] [tesh/INFO] Test suite from stdin -> [0.000000] [tesh/INFO] [stdin:4] cat -> [0.000000] [tesh/INFO] (ignoring the output as requested) -> [0.000000] [tesh/INFO] Test suite from stdin OK +$ ./tesh --log='log.thresh:info tesh.fmt:%m%n' +> Test suite from stdin +> [stdin:4] cat +> (ignoring the output as requested) +> Test suite from stdin OK -- 2.20.1