diff options
Diffstat (limited to 'test/asset')
24 files changed, 389 insertions, 0 deletions
diff --git a/test/asset/list/concat.et b/test/asset/list/concat.et new file mode 100644 index 0000000..c669a78 --- /dev/null +++ b/test/asset/list/concat.et @@ -0,0 +1,38 @@ +test Test: + let list1 = [ 1 ] + let list2 = [ 2, 3 ] + let empty = [ ] + + node n + + let c1 = concat [[ 1 ]] + for i in c1: + shell on n: + echo "c1 $i" + local: + shell on n: + echo "c1-end" + + let c2 = concat [[ 1 ], [], empty] + for i in c2: + shell on n: + echo "c2 $i" + local: + shell on n: + echo "c2-end" + + let c3 = concat [ list1, list2, [ 6, 5 ], list2 ] + for i in c3: + shell on n: + echo "c3 $i" + local: + shell on n: + echo "c3-end" + + let c4 = list1 ++ list2 ++ [ 6, 5 ] ++ list2 + for i in c4: + shell on n: + echo "c4 $i" + local: + shell on n: + echo "c4-end" diff --git a/test/asset/output/flush.et b/test/asset/output/flush.et new file mode 100644 index 0000000..0051dfd --- /dev/null +++ b/test/asset/output/flush.et @@ -0,0 +1,13 @@ +test Test: + node n + shell on n as p: + echo a + echo b + echo c + echo d + echo e + with p: + expect /e/ + flush matching /[b-z]/ + expect /.*/ + expect /.*/ timeout 0.0 diff --git a/test/asset/output/ignore.et b/test/asset/output/ignore.et new file mode 100644 index 0000000..cc70e3b --- /dev/null +++ b/test/asset/output/ignore.et @@ -0,0 +1,20 @@ +test Test: + node n + shell on n as p: + echo a + echo b + echo c + echo d + grep -q . + echo e + echo F + echo g + echo H + with p: + expect /d/ + ignore matching /[b-z]/ + send "x" + expect /.*/ + expect /H/ + expect /F/ + expect /.*/ timeout 0.0 diff --git a/test/asset/parser/function-fail.et b/test/asset/parser/function-fail.et new file mode 100644 index 0000000..59ac3b0 --- /dev/null +++ b/test/asset/parser/function-fail.et @@ -0,0 +1,2 @@ +test Test: + guard 1 == 1 diff --git a/test/asset/parser/function.et b/test/asset/parser/function.et new file mode 100644 index 0000000..2a096b9 --- /dev/null +++ b/test/asset/parser/function.et @@ -0,0 +1,16 @@ +def f (x) and y = (x + y) + 1 + +def g (x) and y = (x + (y+1)) + +test Test: + guard (1 == 1) + guard (1 /= 2) + let x = 2 + guard (x == x) + guard (x /= 1) + guard (x /= x + 1) + + guard (f 1 and 2 == 4) + guard (f 1 and 2 == g 1 and 2) + guard (f 1 and (g 2 and 3) == g 1 and 2 + 4) + guard (f (10 + g and 1 1) and (g 2 and 3) == g 1 and 2 + 10 +6) diff --git a/test/asset/parser/tags.et b/test/asset/parser/tags.et new file mode 100644 index 0000000..3e06e44 --- /dev/null +++ b/test/asset/parser/tags.et @@ -0,0 +1,20 @@ +tag SomeTag + +tag OtherTag + +test First: + tag: SomeTag + tag: OtherTag + let x = 1 + local: + let y = 1 + +test Second: + tag: SomeTag + + local: + let x = 1 + +test Third: + local: + let x = 1 diff --git a/test/asset/run-fail/bool.et b/test/asset/run-fail/bool.et new file mode 100644 index 0000000..1608a08 --- /dev/null +++ b/test/asset/run-fail/bool.et @@ -0,0 +1,3 @@ +test Test: + node n + guard (True == False) diff --git a/test/asset/run-fail/command-ignore.et b/test/asset/run-fail/command-ignore.et new file mode 100644 index 0000000..9622782 --- /dev/null +++ b/test/asset/run-fail/command-ignore.et @@ -0,0 +1,13 @@ +test Test: + node n + shell on n as p: + cat + + send "a" to p + send "b" to p + send "x" to p + expect /x/ from p + ignore from p + + multiply_timeout by 0.0 + expect /.*/ from p diff --git a/test/asset/run-success/bool.et b/test/asset/run-success/bool.et new file mode 100644 index 0000000..7121cc0 --- /dev/null +++ b/test/asset/run-success/bool.et @@ -0,0 +1,7 @@ +test Test: + node n + guard (True == True) + guard (False == False) + guard (False /= True) + guard ((1 == 1) == True) + guard ((1 == 0) == False) diff --git a/test/asset/run-success/command-flush.et b/test/asset/run-success/command-flush.et new file mode 100644 index 0000000..8c5f7b8 --- /dev/null +++ b/test/asset/run-success/command-flush.et @@ -0,0 +1,30 @@ +def expect_next from p (str): + expect /(.*)/ from p capture line + guard (line == str) + +test Test: + node n + shell on n as p: + cat + + send "a1" to p + send "b" to p + send "x" to p + expect /x/ from p + + flush from p matching /a.*/ + send "a2" to p + send "c" to p + + expect_next "b" from p + expect_next "a2" from p + expect_next "c" from p + + send "d" to p + send "e" to p + send "f" to p + send "x" to p + expect /x/ from p + flush from p + send "g" to p + expect_next "g" from p diff --git a/test/asset/run-success/command-ignore.et b/test/asset/run-success/command-ignore.et new file mode 100644 index 0000000..dc950d1 --- /dev/null +++ b/test/asset/run-success/command-ignore.et @@ -0,0 +1,39 @@ +def expect_next from p (str): + expect /(.*)/ from p capture line + guard (line == str) + +test Test: + node n + shell on n as p: + cat + + send "a" to p + send "b" to p + send "x" to p + expect /x/ from p + + ignore from p matching /a/ + send "a" to p + send "c" to p + + expect_next "b" from p + expect_next "c" from p + + send "a" to p + send "b" to p + with p: + send "c" + ignore matching /[bcd]/ + send "d" + send "e" + expect_next "e" from p + + send "a" to p + send "b" to p + local: + send "c" to p + send "d" to p + + expect_next "b" from p + expect_next "c" from p + expect_next "d" from p diff --git a/test/asset/run/callstack.et b/test/asset/run/callstack.et new file mode 100644 index 0000000..36eb401 --- /dev/null +++ b/test/asset/run/callstack.et @@ -0,0 +1,41 @@ +test AG: + let x = 1 + guard (x == 0) + +test AE: + spawn as p + let x = 2 + expect /$x/ from p timeout 0.0 + +def fg: + let x = 1 + guard (x == 0) + +test BG: + fg + +def gg (x): + let y = 2 + guard (x == y) + +test CG: + let z = 3 + gg (z) + +def fe on p: + let x = 1 + expect /$x/ from p timeout 0.0 + +test BE: + spawn as p + fe on p + +def ge (x) on p: + guard (x /= 0) + let y = 2 + expect /$x $y/ from p timeout 0.0 + +test CE: + spawn as p + let z = 3 + ge (z) on p diff --git a/test/asset/run/echo.et b/test/asset/run/echo.et new file mode 100644 index 0000000..9950d7b --- /dev/null +++ b/test/asset/run/echo.et @@ -0,0 +1,4 @@ +test ExpectEcho: + spawn as p + send "abcdef" to p + expect /abcdef/ from p diff --git a/test/asset/run/erebos-tester-select1.yaml b/test/asset/run/erebos-tester-select1.yaml new file mode 100644 index 0000000..62e0ead --- /dev/null +++ b/test/asset/run/erebos-tester-select1.yaml @@ -0,0 +1,2 @@ +tests: ./tags.et +exclude: B diff --git a/test/asset/run/erebos-tester-select2.yaml b/test/asset/run/erebos-tester-select2.yaml new file mode 100644 index 0000000..52310be --- /dev/null +++ b/test/asset/run/erebos-tester-select2.yaml @@ -0,0 +1,8 @@ +tests: ./tags.et +select: + - T2 + - A + - B +exclude: + - A1 + - C diff --git a/test/asset/run/erebos-tester.yaml b/test/asset/run/erebos-tester.yaml new file mode 100644 index 0000000..937ca97 --- /dev/null +++ b/test/asset/run/erebos-tester.yaml @@ -0,0 +1,2 @@ +tests: ./scripts/**/*.et +tool: ./tools/tool diff --git a/test/asset/run/sysinfo.et b/test/asset/run/sysinfo.et new file mode 100644 index 0000000..1b9f6aa --- /dev/null +++ b/test/asset/run/sysinfo.et @@ -0,0 +1,12 @@ +test SysInfo: + node n + spawn on n as p1 + with p1: + send "network-info" + expect /ip ${n.ifname} ${n.ip}/ + + spawn as p2 + guard (p2.node.ip /= p1.node.ip) + with p2: + send "network-info" + expect /ip ${n.ifname} ${p2.node.ip}/ diff --git a/test/asset/run/tags.et b/test/asset/run/tags.et new file mode 100644 index 0000000..b1433fa --- /dev/null +++ b/test/asset/run/tags.et @@ -0,0 +1,38 @@ +export tag A +export tag B +export tag C + +test T1: + guard True + +test T2: + guard True + +test A1: + tag: A + guard True + +test A2: + tag: A + guard True + +test B1: + tag: B + guard True + +test B2: + tag: B + guard True + +test C1: + tag: C + guard True + +test C2: + tag: C + guard True + +test BC: + tag: B + tag: C + guard True diff --git a/test/asset/run/tools/echo.sh b/test/asset/run/tools/echo.sh new file mode 100755 index 0000000..53b1eae --- /dev/null +++ b/test/asset/run/tools/echo.sh @@ -0,0 +1,2 @@ +#!/bin/sh +cat diff --git a/test/asset/run/tools/sysinfo.sh b/test/asset/run/tools/sysinfo.sh new file mode 100755 index 0000000..38591f4 --- /dev/null +++ b/test/asset/run/tools/sysinfo.sh @@ -0,0 +1,9 @@ +#!/bin/sh + +while read cmd; do + case "$cmd" in + network-info) + ip -o addr show | sed -e 's/[0-9]*: \([a-z0-9]*\).*inet6\? \([0-9a-f:.]*\).*/ip \1 \2/' + ;; + esac +done diff --git a/test/asset/run/trivial.et b/test/asset/run/trivial.et new file mode 100644 index 0000000..0b2e878 --- /dev/null +++ b/test/asset/run/trivial.et @@ -0,0 +1,7 @@ +test AlwaysSucceeds: + node n + guard (1 == 1) + +test AlwaysFails: + node n + guard (1 == 0) diff --git a/test/asset/shell/echo.et b/test/asset/shell/echo.et new file mode 100644 index 0000000..1e48cac --- /dev/null +++ b/test/asset/shell/echo.et @@ -0,0 +1,25 @@ +test Echo: + node n + let echo_str = "echo" + let space_str = "a b" + + shell on n as sh: + echo a b c + echo "a b c" + echo 'a b d' + echo a b " c d" + + /bin/echo "abcd" xyz + "echo" a"a" "b"c d + $echo_str b $echo_str c + + echo "$space_str" + echo $space_str + echo '$space_str' + + echo \$ \" \\ + echo "\""\""a" + echo "'" '"' '\\\' "\\" + echo a\ b\ \ c + + echo \" \' \\ \$ \# \| \> \< \; \[ \] \{ \} \( \) \* \? \~ \& \! diff --git a/test/asset/shell/pipe.et b/test/asset/shell/pipe.et new file mode 100644 index 0000000..a00360a --- /dev/null +++ b/test/asset/shell/pipe.et @@ -0,0 +1,25 @@ +test Pipe: + node n + shell on n as sh: + echo abcd | grep -o '[bc]*' + echo abcd | grep -o '[bcd]*' | grep -o '[ab]*' + + +test Redirect: + node n + shell on n as sh: + echo a > file + echo b > file + echo c >> file + echo x + cat file + echo y + cat < file + echo z + +test PipeRedirect: + node n + shell on n as sh: + echo abcdefghi | grep -o '[b-h]*' | grep -o '[a-g]*' > file + cat < file | grep -o '[acegi]' | cat > file2 + cat file2 - < file diff --git a/test/asset/shell/spawn.et b/test/asset/shell/spawn.et new file mode 100644 index 0000000..9d48e72 --- /dev/null +++ b/test/asset/shell/spawn.et @@ -0,0 +1,13 @@ +test ShellTrue: + node n + shell on n: + true + + shell on n as sh: + true + + +test ShellFalse: + node n + shell on n as sh: + false |