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
< < 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
! output ignore
< $ cat tmp_fich
< > TUTU TOTO
-$ ${bindir:=.}/tesh --enable-coverage
+$ ${bindir:=.}/tesh
$ rm tmp_fich
< < _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_
< < 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
< $ cat
< > a
< > c
-$ ${bindir:=.}/tesh --enable-coverage
+$ ${bindir:=.}/tesh
! expect return 2
! output ignore
< > a
< >
< > c
-$ ${bindir:=.}/tesh --enable-coverage
+$ ${bindir:=.}/tesh
<
< b
< $ cat
< > b
< > c
-$ ${bindir:=.}/tesh --enable-coverage
+$ ${bindir:=.}/tesh
! expect return 2
! output ignore
< >
< > b
< > c
-$ ${bindir:=.}/tesh --enable-coverage
+$ ${bindir:=.}/tesh
! 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)
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)
! 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
< > TOTO
< < TUTU
< $ cat
-$ ./tesh --enable-coverage
-> Enable coverage
+$ ${bindir:=.}/tesh
> Test suite from stdin
> [(stdin):3] cat
> Output of <(stdin):3> mismatch:
# 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.
< > 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)
+++ /dev/null
-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
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
< $ 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
< $ cat
< > 000 A line
< > 000 B line
-$ ${bindir:=.}/tesh --enable-coverage
+$ ${bindir:=.}/tesh