Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
[tesh] greatly normalize the self-tests
authorMartin Quinson <martin.quinson@loria.fr>
Wed, 30 Sep 2015 19:21:12 +0000 (21:21 +0200)
committerMartin Quinson <martin.quinson@loria.fr>
Wed, 30 Sep 2015 19:21:15 +0000 (21:21 +0200)
Things should remain unsurprizing when there is no need for a surprise

tools/cmake/AddTests.cmake
tools/tesh/IO-orders.tesh
tools/tesh/basic.tesh
tools/tesh/catch-return.tesh
tools/tesh/catch-signal.tesh
tools/tesh/catch-timeout.tesh
tools/tesh/catch-wrong-output.tesh
tools/tesh/cd.tesh
tools/tesh/set-output-ignore.tesh
tools/tesh/set-output-sort-1.tesh [deleted file]
tools/tesh/set-output-sort.tesh

index 166aec8..1679d57 100644 (file)
@@ -65,23 +65,23 @@ ENABLE_TESTING()
 IF(NOT enable_memcheck)
   ## CORE ##
   ### TESH ###
-  ADD_TESH(tesh-self-basic                       --cd "${CMAKE_BINARY_DIR}/bin" ${CMAKE_HOME_DIRECTORY}/tools/tesh/basic.tesh)
-  ADD_TESH(tesh-self-cd                          --cd "${CMAKE_BINARY_DIR}/bin" ${CMAKE_HOME_DIRECTORY}/tools/tesh/cd.tesh)
-  ADD_TESH(tesh-self-setenv                      --cd "${CMAKE_BINARY_DIR}/bin" ${CMAKE_HOME_DIRECTORY}/tools/tesh/setenv.tesh)
-  ADD_TESH(tesh-self-IO-broken-pipe              --cd "${CMAKE_BINARY_DIR}/bin" ${CMAKE_HOME_DIRECTORY}/tools/tesh/IO-broken-pipe.tesh)
-  ADD_TESH(tesh-self-IO-orders                   --cd "${CMAKE_BINARY_DIR}/bin" ${CMAKE_HOME_DIRECTORY}/tools/tesh/IO-orders.tesh)
-  ADD_TESH(tesh-self-IO-bigsize                  --cd "${CMAKE_BINARY_DIR}/bin" ${CMAKE_HOME_DIRECTORY}/tools/tesh/IO-bigsize.tesh)
-  ADD_TESH(tesh-self-set-return                  --cd "${CMAKE_BINARY_DIR}/bin" ${CMAKE_HOME_DIRECTORY}/tools/tesh/set-return.tesh)
-  ADD_TESH(tesh-self-set-timeout                 --cd "${CMAKE_BINARY_DIR}/bin" ${CMAKE_HOME_DIRECTORY}/tools/tesh/set-timeout.tesh)
-  ADD_TESH(tesh-self-set-output-ignore           --cd "${CMAKE_BINARY_DIR}/bin" ${CMAKE_HOME_DIRECTORY}/tools/tesh/set-output-ignore.tesh)
-  ADD_TESH(tesh-self-set-output-sort             --setenv bindir=${CMAKE_BINARY_DIR}/bin --cd "${CMAKE_HOME_DIRECTORY}/tools/tesh" set-output-sort.tesh)
-  ADD_TESH(tesh-self-catch-return                --cd "${CMAKE_BINARY_DIR}/bin" ${CMAKE_HOME_DIRECTORY}/tools/tesh/catch-return.tesh)
-  ADD_TESH(tesh-self-catch-timeout               --cd "${CMAKE_BINARY_DIR}/bin" ${CMAKE_HOME_DIRECTORY}/tools/tesh/catch-timeout.tesh)
-  ADD_TESH(tesh-self-catch-wrong-output          --cd "${CMAKE_BINARY_DIR}/bin" ${CMAKE_HOME_DIRECTORY}/tools/tesh/catch-wrong-output.tesh)
-  ADD_TESH(tesh-self-bg-basic                    --cd "${CMAKE_BINARY_DIR}/bin" ${CMAKE_HOME_DIRECTORY}/tools/tesh/bg-basic.tesh)
-  ADD_TESH(tesh-self-background                  --cd "${CMAKE_BINARY_DIR}/bin" ${CMAKE_HOME_DIRECTORY}/tools/tesh/background.tesh)
-  ADD_TESH(tesh-self-bg-set-signal               --cd "${CMAKE_BINARY_DIR}/bin" ${CMAKE_HOME_DIRECTORY}/tools/tesh/bg-set-signal.tesh)
-  ADD_TESH(tesh-self-catch-signal                --cd "${CMAKE_BINARY_DIR}/bin" ${CMAKE_HOME_DIRECTORY}/tools/tesh/catch-signal.tesh)
+  ADD_TESH(tesh-self-basic              --setenv bindir=${CMAKE_BINARY_DIR}/bin ${CMAKE_HOME_DIRECTORY}/tools/tesh/basic.tesh)
+  ADD_TESH(tesh-self-cd                 --setenv bindir=${CMAKE_BINARY_DIR}/bin ${CMAKE_HOME_DIRECTORY}/tools/tesh/cd.tesh)
+  ADD_TESH(tesh-self-setenv             --setenv bindir=${CMAKE_BINARY_DIR}/bin ${CMAKE_HOME_DIRECTORY}/tools/tesh/setenv.tesh)
+  ADD_TESH(tesh-self-IO-broken-pipe     --setenv bindir=${CMAKE_BINARY_DIR}/bin ${CMAKE_HOME_DIRECTORY}/tools/tesh/IO-broken-pipe.tesh)
+  ADD_TESH(tesh-self-IO-orders          --setenv bindir=${CMAKE_BINARY_DIR}/bin ${CMAKE_HOME_DIRECTORY}/tools/tesh/IO-orders.tesh)
+  ADD_TESH(tesh-self-IO-bigsize         --setenv bindir=${CMAKE_BINARY_DIR}/bin ${CMAKE_HOME_DIRECTORY}/tools/tesh/IO-bigsize.tesh)
+  ADD_TESH(tesh-self-set-return         --setenv bindir=${CMAKE_BINARY_DIR}/bin ${CMAKE_HOME_DIRECTORY}/tools/tesh/set-return.tesh)
+  ADD_TESH(tesh-self-set-timeout        --setenv bindir=${CMAKE_BINARY_DIR}/bin ${CMAKE_HOME_DIRECTORY}/tools/tesh/set-timeout.tesh)
+  ADD_TESH(tesh-self-set-output-ignore  --setenv bindir=${CMAKE_BINARY_DIR}/bin ${CMAKE_HOME_DIRECTORY}/tools/tesh/set-output-ignore.tesh)
+  ADD_TESH(tesh-self-set-output-sort    --setenv bindir=${CMAKE_BINARY_DIR}/bin ${CMAKE_HOME_DIRECTORY}/tools/tesh/set-output-sort.tesh)
+  ADD_TESH(tesh-self-catch-return       --setenv bindir=${CMAKE_BINARY_DIR}/bin ${CMAKE_HOME_DIRECTORY}/tools/tesh/catch-return.tesh)
+  ADD_TESH(tesh-self-catch-timeout      --setenv bindir=${CMAKE_BINARY_DIR}/bin ${CMAKE_HOME_DIRECTORY}/tools/tesh/catch-timeout.tesh)
+  ADD_TESH(tesh-self-catch-wrong-output --setenv bindir=${CMAKE_BINARY_DIR}/bin ${CMAKE_HOME_DIRECTORY}/tools/tesh/catch-wrong-output.tesh)
+  ADD_TESH(tesh-self-bg-basic           --setenv bindir=${CMAKE_BINARY_DIR}/bin ${CMAKE_HOME_DIRECTORY}/tools/tesh/bg-basic.tesh)
+  ADD_TESH(tesh-self-background         --setenv bindir=${CMAKE_BINARY_DIR}/bin ${CMAKE_HOME_DIRECTORY}/tools/tesh/background.tesh)
+  ADD_TESH(tesh-self-bg-set-signal      --setenv bindir=${CMAKE_BINARY_DIR}/bin ${CMAKE_HOME_DIRECTORY}/tools/tesh/bg-set-signal.tesh)
+  ADD_TESH(tesh-self-catch-signal       --setenv bindir=${CMAKE_BINARY_DIR}/bin ${CMAKE_HOME_DIRECTORY}/tools/tesh/catch-signal.tesh)
 
   ### GENERIC  ###
   # BEGIN TESH TESTS
index 2b30132..e2c0a25 100644 (file)
@@ -5,58 +5,52 @@ p Order: in, out, cmd
 < < TOTO
 < > TOTO
 < $ cat
-> Enable coverage
 > Test suite from stdin
 > [(stdin):3] cat
 > Test suite from stdin OK
-$ ./tesh --enable-coverage
+$ ${bindir:=.}/tesh
 
 p Order: out, in, cmd
 < > TOTO
 < < TOTO
 < $ cat
-> Enable coverage
 > Test suite from stdin
 > [(stdin):3] cat
 > Test suite from stdin OK
-$ ./tesh --enable-coverage
+$ ${bindir:=.}/tesh
 
 p Order: out, cmd, in
 < > TOTO
 < $ cat
 < < TOTO
-> Enable coverage
 > Test suite from stdin
 > [(stdin):2] cat
 > Test suite from stdin OK
-$ ./tesh --enable-coverage
+$ ${bindir:=.}/tesh
 
 p Order: in, cmd, out
 < < TOTO
 < $ cat
 < > TOTO
-> Enable coverage
 > Test suite from stdin
 > [(stdin):2] cat
 > Test suite from stdin OK
-$ ./tesh --enable-coverage
+$ ${bindir:=.}/tesh
 
 p Order: cmd, out, in
 < $ cat
 < > TOTO
 < < TOTO
-> Enable coverage
 > Test suite from stdin
 > [(stdin):1] cat
 > Test suite from stdin OK
-$ ./tesh --enable-coverage
+$ ${bindir:=.}/tesh
 
 p Order: cmd, in, out
 < $ cat
 < < TOTO
 < > TOTO
-> Enable coverage
 > Test suite from stdin
 > [(stdin):1] cat
 > Test suite from stdin OK
-$ ./tesh --enable-coverage
+$ ${bindir:=.}/tesh
index 32289af..db3d8f7 100644 (file)
@@ -13,7 +13,7 @@ $ cat tmp_fich
 ! output ignore
 < $ cat tmp_fich
 < > TUTU TOTO
-$ ${bindir:=.}/tesh --enable-coverage
+$ ${bindir:=.}/tesh 
 
 $ rm tmp_fich
 
@@ -77,14 +77,14 @@ $ sed 's/_/ /'
 < < _x
 < $ sed 's/_/ /'
 < > x
-$ ${bindir:=.}/tesh --enable-coverage
+$ ${bindir:=.}/tesh
 
 ! expect return 2
 ! output ignore
 < < x
 < $ cat
 < >  x
-$ ${bindir:=.}/tesh --enable-coverage
+$ ${bindir:=.}/tesh
 
 p * trailing spaces...
 < x_
@@ -96,14 +96,14 @@ $ sed 's/_/ /'
 < < x_
 < $ sed 's/_/ /'
 < > x
-$ ${bindir:=.}/tesh --enable-coverage
+$ ${bindir:=.}/tesh
 
 ! expect return 2
 ! output ignore
 < < x
 < $ cat
 < > x 
-$ ${bindir:=.}/tesh --enable-coverage
+$ ${bindir:=.}/tesh
 
 p * empty lines...
 < a
@@ -122,7 +122,7 @@ $ cat
 < $ cat
 < > a
 < > c
-$ ${bindir:=.}/tesh --enable-coverage
+$ ${bindir:=.}/tesh 
 
 ! expect return 2
 ! output ignore
@@ -132,7 +132,7 @@ $ ${bindir:=.}/tesh --enable-coverage
 < > a
 < >
 < > c
-$ ${bindir:=.}/tesh --enable-coverage
+$ ${bindir:=.}/tesh 
 
 <
 < b
@@ -150,7 +150,7 @@ $ cat
 < $ cat
 < > b
 < > c
-$ ${bindir:=.}/tesh --enable-coverage
+$ ${bindir:=.}/tesh 
 
 ! expect return 2
 ! output ignore
@@ -160,4 +160,4 @@ $ ${bindir:=.}/tesh --enable-coverage
 < >
 < > b
 < > c
-$ ${bindir:=.}/tesh --enable-coverage
+$ ${bindir:=.}/tesh 
index 210d660..f14d15b 100644 (file)
@@ -4,7 +4,7 @@
 
 ! expect return 41
 < $ perl -e "exit 1"
-$ ./tesh
+$ ${bindir:=.}/tesh
 > Test suite from stdin
 > [(stdin):1] perl -e "exit 1"
 > Test suite `(stdin)': NOK (<(stdin):1> returned code 1)
index 8229a7a..552c580 100644 (file)
@@ -16,8 +16,7 @@ $ perl segfault.pl
 p Check that we return the expected return value on SEGV
 ! expect return 15
 < $ perl segfault.pl
-$ ../tesh --enable-coverage
-> Enable coverage
+$ ${bindir:=.}/tesh
 > Test suite from stdin
 > [(stdin):1] perl segfault.pl
 > Test suite `(stdin)': NOK (<(stdin):1> got signal SIGSEGV)
index ace1b50..305997e 100644 (file)
@@ -6,10 +6,9 @@
 ! expect return 3
 < ! timeout 1
 < $ sleep 6
-> Enable coverage
 > Test suite from stdin
 > [(stdin):2] sleep 6
 > <(stdin):2> timeouted. Kill the process.
 > Test suite `(stdin)': NOK (<(stdin):2> timeout after 1 sec)
 > <(stdin):2> No output so far.
-$ ./tesh --enable-coverage
+$ ${bindir:=.}/tesh
index aa57175..6273a9b 100644 (file)
@@ -6,8 +6,7 @@ p This tests whether TESH detects wrong outputs
 < > TOTO
 < < TUTU
 < $ cat
-$ ./tesh --enable-coverage
-> Enable coverage
+$ ${bindir:=.}/tesh
 > Test suite from stdin
 > [(stdin):3] cat
 > Output of <(stdin):3> mismatch:
index eccf0b6..6a9ce2d 100644 (file)
@@ -12,11 +12,10 @@ $ ls
 # Check that tesh detects properly cd to non-existing directories
 ! expect return 4
 < $ cd toto
-> Enable coverage
 > Test suite from stdin
 > Chdir to toto failed: No such file or directory
 > Test suite `(stdin)': NOK (system error)
-$ ../tesh --enable-coverage
+$ ${bindir:=.}/tesh
 
 # The next command checks that there is a testdir_temp-cd in the upper directory,
 # ie that mkdir and cd both worked.
index 492d963..04da086 100644 (file)
@@ -6,8 +6,7 @@ p This tests whether TESH accepts to ignore command output
 < > TOTO
 < < TUTU
 < $ cat
-$ ./tesh --enable-coverage
-> Enable coverage
+$ ${bindir:=.}/tesh
 > Test suite from stdin
 > [(stdin):4] cat
 > (ignoring the output of <(stdin):4> as requested)
diff --git a/tools/tesh/set-output-sort-1.tesh b/tools/tesh/set-output-sort-1.tesh
deleted file mode 100644 (file)
index c009b4a..0000000
+++ /dev/null
@@ -1,68 +0,0 @@
-p Test sorting and filtering of output
-
-$ true
-
-! output sort
-$ true
-
-$ printf 'profiling: foo\\n'
-
-$ printf 'profiling: foo'
-
-! output sort
-$ printf 'profiling: foo\\n'
-
-! output sort
-$ printf 'profiling: foo'
-
-$ printf 'a\\nb\\nc\\nd\\n'
-> a
-> b
-> c
-> d
-
-$ printf 'a\\nb\\nc\\nd'
-> a
-> b
-> c
-> d
-
-! output sort
-$ printf 'c\\nd\\nb\\na\\n'
-> a
-> b
-> c
-> d
-
-! output sort
-$ printf 'c\\nd\\nb\\na'
-> a
-> b
-> c
-> d
-
-$ printf 'a\\nprofiling: foo\\nprofiling: bar\\nb\\nc\\nd\\nprofiling: baz\\n'
-> a
-> b
-> c
-> d
-
-$ printf 'a\\nprofiling: foo\\nprofiling: bar\\nb\\nc\\nd\\nprofiling: baz'
-> a
-> b
-> c
-> d
-
-! output sort
-$ printf 'c\\nprofiling: foo\\nprofiling: bar\\nd\\nb\\na\\nprofiling: baz\\n'
-> a
-> b
-> c
-> d
-
-! output sort
-$ printf 'c\\nprofiling: foo\\nprofiling: bar\\nd\\nb\\na\\nprofiling: baz'
-> a
-> b
-> c
-> d
index f459286..d5888ad 100644 (file)
@@ -2,25 +2,93 @@
 
 p This tests whether TESH correctly sorts command output
 
-$ ${bindir:=.}/tesh --enable-coverage set-output-sort-1.tesh
+< p Test sorting and filtering of output
+< 
+< $ true
+< 
+< ! output sort
+< $ true
+< 
+< $ printf 'profiling: foo\\n'
+< 
+< $ printf 'profiling: foo'
+< 
+< ! output sort
+< $ printf 'profiling: foo\\n'
+< 
+< ! output sort
+< $ printf 'profiling: foo'
+< 
+< $ printf 'a\\nb\\nc\\nd\\n'
+< > a
+< > b
+< > c
+< > d
+< 
+< $ printf 'a\\nb\\nc\\nd'
+< > a
+< > b
+< > c
+< > d
+< 
+< ! output sort
+< $ printf 'c\\nd\\nb\\na\\n'
+< > a
+< > b
+< > c
+< > d
+< 
+< ! output sort
+< $ printf 'c\\nd\\nb\\na'
+< > a
+< > b
+< > c
+< > d
+< 
+< $ printf 'a\\nprofiling: foo\\nprofiling: bar\\nb\\nc\\nd\\nprofiling: baz\\n'
+< > a
+< > b
+< > c
+< > d
+< 
+< $ printf 'a\\nprofiling: foo\\nprofiling: bar\\nb\\nc\\nd\\nprofiling: baz'
+< > a
+< > b
+< > c
+< > d
+< 
+< ! output sort
+< $ printf 'c\\nprofiling: foo\\nprofiling: bar\\nd\\nb\\na\\nprofiling: baz\\n'
+< > a
+< > b
+< > c
+< > d
+< 
+< ! output sort
+< $ printf 'c\\nprofiling: foo\\nprofiling: bar\\nd\\nb\\na\\nprofiling: baz'
+< > a
+< > b
+< > c
+< > d
+$ ${bindir:=.}/tesh --enable-coverage
 > Enable coverage
-> Test suite `set-output-sort-1'
-> [set-output-sort-1:1] Test sorting and filtering of output
-> [set-output-sort-1:3] true
-> [set-output-sort-1:6] true
-> [set-output-sort-1:8] printf 'profiling: foo\\n'
-> [set-output-sort-1:10] printf 'profiling: foo'
-> [set-output-sort-1:13] printf 'profiling: foo\\n'
-> [set-output-sort-1:16] printf 'profiling: foo'
-> [set-output-sort-1:18] printf 'a\\nb\\nc\\nd\\n'
-> [set-output-sort-1:24] printf 'a\\nb\\nc\\nd'
-> [set-output-sort-1:31] printf 'c\\nd\\nb\\na\\n'
-> [set-output-sort-1:38] printf 'c\\nd\\nb\\na'
-> [set-output-sort-1:44] printf 'a\\nprofiling: foo\\nprofiling: bar\\nb\\nc\\nd\\nprofiling: baz\\n'
-> [set-output-sort-1:50] printf 'a\\nprofiling: foo\\nprofiling: bar\\nb\\nc\\nd\\nprofiling: baz'
-> [set-output-sort-1:57] printf 'c\\nprofiling: foo\\nprofiling: bar\\nd\\nb\\na\\nprofiling: baz\\n'
-> [set-output-sort-1:64] printf 'c\\nprofiling: foo\\nprofiling: bar\\nd\\nb\\na\\nprofiling: baz'
-> Test suite `set-output-sort-1' OK
+> Test suite from stdin
+> [(stdin):1] Test sorting and filtering of output
+> [(stdin):3] true
+> [(stdin):6] true
+> [(stdin):8] printf 'profiling: foo\\n'
+> [(stdin):10] printf 'profiling: foo'
+> [(stdin):13] printf 'profiling: foo\\n'
+> [(stdin):16] printf 'profiling: foo'
+> [(stdin):18] printf 'a\\nb\\nc\\nd\\n'
+> [(stdin):24] printf 'a\\nb\\nc\\nd'
+> [(stdin):31] printf 'c\\nd\\nb\\na\\n'
+> [(stdin):38] printf 'c\\nd\\nb\\na'
+> [(stdin):44] printf 'a\\nprofiling: foo\\nprofiling: bar\\nb\\nc\\nd\\nprofiling: baz\\n'
+> [(stdin):50] printf 'a\\nprofiling: foo\\nprofiling: bar\\nb\\nc\\nd\\nprofiling: baz'
+> [(stdin):57] printf 'c\\nprofiling: foo\\nprofiling: bar\\nd\\nb\\na\\nprofiling: baz\\n'
+> [(stdin):64] printf 'c\\nprofiling: foo\\nprofiling: bar\\nd\\nb\\na\\nprofiling: baz'
+> Test suite from stdin OK
 
 p Check the Right Prefix Length (19) for "output sort"
 ! output sort 19
@@ -45,7 +113,7 @@ $ cat
 < $ cat
 < > 123456789012345678 A line
 < > 123456789012345678 B line
-$ ${bindir:=.}/tesh --enable-coverage
+$ ${bindir:=.}/tesh 
 
 p Check user-defined prefix length for "output sort"
 ! output sort 5
@@ -70,4 +138,4 @@ $ cat
 < $ cat
 < > 000 A line
 < > 000 B line
-$ ${bindir:=.}/tesh --enable-coverage
+$ ${bindir:=.}/tesh