summaryrefslogtreecommitdiff
path: root/rules/shell/test/EXPRESSIONS
blob: d9b1fbc1bfb52ea933951ddfac17540c174df4ca (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
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
{ "test-action":
  { "vars":
    [ "TEST_ENV"
    , "ATTEMPT"
    , "name"
    , "test.sh"
    , "keep"
    , "runner"
    , "deps-fieldname"
    , "deps-transition"
    ]
  , "imports":
    { "artifacts_list": ["./", "../..", "field_artifacts_list"]
    , "runfiles_list": ["./", "../..", "field_runfiles_list"]
    }
  , "expression":
    { "type": "let*"
    , "bindings":
      [ [ "runner"
        , { "type": "map_union"
          , "$1":
            { "type": "foreach"
            , "var": "runner"
            , "range": {"type": "var", "name": "runner"}
            , "body":
              { "type": "map_union"
              , "$1":
                { "type": "foreach"
                , "var": "runner"
                , "range":
                  { "type": "values"
                  , "$1":
                    { "type": "DEP_ARTIFACTS"
                    , "dep": {"type": "var", "name": "runner"}
                    }
                  }
                , "body": {"type": "env", "vars": ["runner"]}
                }
              }
            }
          }
        ]
      , [ "deps"
        , { "type": "TREE"
          , "$1":
            { "type": "disjoint_map_union"
            , "msg":
              [ "Field"
              , {"type": "var", "name": "deps-fieldname"}
              , "has to stage in a conflict free way"
              ]
            , "$1":
              { "type": "++"
              , "$1":
                { "type": "let*"
                , "bindings":
                  [ ["fieldname", {"type": "var", "name": "deps-fieldname"}]
                  , ["transition", {"type": "var", "name": "deps-transition"}]
                  ]
                , "body":
                  [ {"type": "CALL_EXPRESSION", "name": "runfiles_list"}
                  , {"type": "CALL_EXPRESSION", "name": "artifacts_list"}
                  ]
                }
              }
            }
          }
        ]
      , [ "attempt marker"
        , { "type": "if"
          , "cond":
            { "type": "=="
            , "$1": {"type": "var", "name": "ATTEMPT"}
            , "$2": null
            }
          , "then": {"type": "empty_map"}
          , "else":
            { "type": "singleton_map"
            , "key": "ATTEMPT"
            , "value":
              {"type": "BLOB", "data": {"type": "var", "name": "ATTEMPT"}}
            }
          }
        ]
      , [ "outs"
        , { "type": "++"
          , "$1":
            [ ["result", "stdout", "stderr", "time-start", "time-stop"]
            , { "type": "foreach"
              , "var": "filename"
              , "range": {"type": "var", "name": "keep"}
              , "body":
                { "type": "join"
                , "$1": ["work/", {"type": "var", "name": "filename"}]
                }
              }
            ]
          }
        ]
      , [ "inputs"
        , { "type": "map_union"
          , "$1":
            [ { "type": "singleton_map"
              , "key": "work"
              , "value": {"type": "var", "name": "deps"}
              }
            , {"type": "var", "name": "runner"}
            , {"type": "var", "name": "test.sh"}
            , {"type": "var", "name": "attempt marker"}
            ]
          }
        ]
      , [ "cmd"
        , {"type": "++", "$1": [["./runner"], {"type": "var", "name": "keep"}]}
        ]
      , [ "test_env"
        , {"type": "var", "name": "TEST_ENV", "default": {"type": "empty_map"}}
        ]
      ]
    , "body":
      { "type": "if"
      , "cond":
        {"type": "==", "$1": {"type": "var", "name": "ATTEMPT"}, "$2": null}
      , "then":
        { "type": "ACTION"
        , "outs": {"type": "var", "name": "outs"}
        , "inputs": {"type": "var", "name": "inputs"}
        , "cmd": {"type": "var", "name": "cmd"}
        , "env": {"type": "var", "name": "test_env"}
        , "may_fail": ["test"]
        , "fail_message":
          { "type": "join"
          , "$1": ["shell test ", {"type": "var", "name": "name"}, " failed"]
          }
        }
      , "else":
        { "type": "ACTION"
        , "outs": {"type": "var", "name": "outs"}
        , "inputs": {"type": "var", "name": "inputs"}
        , "cmd": {"type": "var", "name": "cmd"}
        , "env": {"type": "var", "name": "test_env"}
        , "may_fail": ["test"]
        , "no_cache": ["test"]
        , "fail_message":
          { "type": "join"
          , "$1":
            [ "shell test "
            , {"type": "var", "name": "name"}
            , " failed (Run "
            , {"type": "var", "name": "ATTEMPT"}
            , ")"
            ]
          }
        }
      }
    }
  }
, "test-result":
  { "vars":
    [ "TEST_ENV"
    , "name"
    , "test.sh"
    , "keep"
    , "runner"
    , "deps-fieldname"
    , "deps-transition"
    ]
  , "imports": {"action": "test-action"}
  , "expression":
    { "type": "let*"
    , "bindings":
      [ ["test-results", {"type": "CALL_EXPRESSION", "name": "action"}]
      , [ "runfiles"
        , { "type": "singleton_map"
          , "key": {"type": "var", "name": "name"}
          , "value":
            {"type": "TREE", "$1": {"type": "var", "name": "test-results"}}
          }
        ]
      ]
    , "body":
      { "type": "RESULT"
      , "artifacts": {"type": "var", "name": "test-results"}
      , "runfiles": {"type": "var", "name": "runfiles"}
      }
    }
  }
}