summaryrefslogtreecommitdiff
path: root/test/script/run.et
blob: 7cc16704cecededb6dd0edac65cc80108277a2cd (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
module run

asset scripts:
    path: ../asset/run

asset scripts_success:
    path: ../asset/run-success

asset scripts_fail:
    path: ../asset/run-fail


test TrivialRun:
    spawn as p 
    with p:
        send "load ${scripts.path}/trivial.et"
        expect /load-done/

        send "run AlwaysSucceeds"
        local:
            expect /(run-.*)/ capture done
            guard (done == "run-done")

        send "run AlwaysFails"
        local:
            expect /match-fail .*/
            expect /(run-.*)/ capture done
            guard (done == "run-failed")


test SimpleRun:
    let should_succeed = [ "bool" ]
    let should_fail = [ "bool" ]
    spawn as p

    with p:
        for file in should_succeed:
            send "load ${scripts_success.path}/$file.et"
            local:
                expect /(load-.*)/ capture done
                guard (done == "load-done")
            flush

            send "run Test"
            local:
                expect /(run-.*)/ capture done
                guard (done == "run-done")
            flush

        for file in should_fail:
            send "load ${scripts_fail.path}/$file.et"
            local:
                expect /(load-.*)/ capture done
                guard (done == "load-done")
            flush

            send "run Test"
            local:
                expect /(run-.*)/ capture done
                guard (done == "run-failed")
            flush


test RunConfig:
    node n
    shell on n:
        cp ${scripts.path}/erebos-tester.yaml .
        mkdir tools
        cp ${scripts.path}/tools/echo.sh ./tools/tool
        mkdir scripts
        # TODO: it seems that namespaces are not properly cleaned up after the failed test
        #cp ${scripts.path}/trivial.et ./scripts/
        cp ${scripts.path}/echo.et ./scripts/

    spawn as p on n

    with p:
        send "load-config"
        expect /load-config-done/
        send "run-all"
        #expect /run-test-result AlwaysSucceeds done/
        #expect /run-test-result AlwaysFails failed/
        expect /child-stdin p abcdef/
        expect /child-stdout p abcdef/
        expect /match p abcdef/
        expect /run-test-result ExpectEcho done/
        expect /run-all-done/


test GetSysInfo:
    node n
    shell on n:
        cp ${scripts.path}/erebos-tester.yaml .
        mkdir tools
        cp ${scripts.path}/tools/sysinfo.sh ./tools/tool
        mkdir scripts
        cp ${scripts.path}/sysinfo.et ./scripts/

    spawn as p on n

    with p:
        send "load-config"
        expect /load-config-done/
        send "run SysInfo"
        expect /run-done/