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
189
190
|
{ "script":
{ "doc": ["Shell test, given by a test script"]
, "target_fields": ["deps", "test"]
, "string_fields": ["keep", "name"]
, "config_vars": ["ARCH", "HOST_ARCH", "RUNS_PER_TEST", "TEST_ENV"]
, "field_doc":
{ "test":
[ "The shell script for the test, launched with sh."
, ""
, "An empty directory is created to store any temporary files needed"
, "by the test, and it is made available in the environment variable"
, "TEST_TMPDIR. The test should not assume write permissions"
, "outside the working directory and the TEST_TMPDIR."
, "For convenience, the environment variable TMPDIR is also set to TEST_TMPDIR."
, ""
, "If the configuration variable RUNS_PER_TEST is set, the environment"
, "variable TEST_RUN_NUMBER will also be set to the number of the attempt,"
, "counting from 0."
]
, "name":
[ "A name for the test, used in reporting, as well as for staging"
, "the test result tree in the runfiles"
]
, "keep":
[ "List of names (relative to the test working directory) of files that"
, "the test might generate that should be kept as part of the output."
, "This might be useful for further analysis of the test"
]
, "deps":
[ "Any targets that should be staged (with artifacts and runfiles) into"
, "the tests working directory"
]
}
, "config_doc":
{ "RUNS_PER_TEST":
[ "The number of times the test should be run in order to detect flakyness."
, "If set, no test action will be taken from cache."
]
, "TEST_ENV": ["Additional environment for executing the test runner."]
}
, "tainted": ["test"]
, "artifacts_doc":
[ "result: the result of this test (\"PASS\" or \"FAIL\"); useful for"
, " generating test reports."
, "stdout/stderr: Any output the invocation of the test binary produced on"
, " the respective file descriptor"
, "work: In this directory, all the files specified to \"keep\" are staged"
, "time-start/time-stop: The time (decimally coded) in seconds since the"
, " epoch when the test invocation started and ended."
]
, "runfiles_doc":
[ "A tree consisting of the artifacts staged at the name of the test."
, "As the built-in \"install\" rule only takes the runfiles of its \"deps\""
, "argument, this gives an easy way of defining test suites."
]
, "implicit":
{"runner": ["test_runner.sh"], "summarizer": ["test_summary.py"]}
, "imports":
{ "test-result": "test-result"
, "action": "test-action"
, "stage": ["./", "../..", "stage_singleton_field"]
, "host transition": ["transitions", "for host"]
}
, "config_transitions":
{"deps": [{"type": "CALL_EXPRESSION", "name": "host transition"}]}
, "expression":
{ "type": "let*"
, "bindings":
[ [ "test.sh"
, { "type": "context"
, "msg": "Expecting 'test' to specify precisely one file containing a shell script"
, "$1":
{ "type": "let*"
, "bindings": [["fieldname", "test"], ["location", "test.sh"]]
, "body": {"type": "CALL_EXPRESSION", "name": "stage"}
}
}
]
, [ "name"
, { "type": "assert_non_empty"
, "msg": "Have to provide a non-empty name for the test (e.g., for result staging)"
, "$1": {"type": "join", "$1": {"type": "FIELD", "name": "name"}}
}
]
, ["keep", {"type": "FIELD", "name": "keep"}]
, ["runner", {"type": "FIELD", "name": "runner"}]
, ["deps-fieldname", "deps"]
, [ "deps-transition"
, {"type": "CALL_EXPRESSION", "name": "host transition"}
]
]
, "body":
{ "type": "if"
, "cond": {"type": "var", "name": "RUNS_PER_TEST"}
, "else": {"type": "CALL_EXPRESSION", "name": "test-result"}
, "then":
{ "type": "let*"
, "bindings":
[ [ "attempts"
, { "type": "map_union"
, "$1":
{ "type": "foreach"
, "var": "ATTEMPT"
, "range":
{ "type": "range"
, "$1": {"type": "var", "name": "RUNS_PER_TEST"}
}
, "body":
{ "type": "singleton_map"
, "key": {"type": "var", "name": "ATTEMPT"}
, "value":
{ "type": "TREE"
, "$1": {"type": "CALL_EXPRESSION", "name": "action"}
}
}
}
}
]
, [ "summarizer"
, { "type": "map_union"
, "$1":
{ "type": "foreach"
, "var": "x"
, "range": {"type": "FIELD", "name": "summarizer"}
, "body":
{ "type": "map_union"
, "$1":
{ "type": "foreach"
, "var": "x"
, "range":
{ "type": "values"
, "$1":
{ "type": "DEP_ARTIFACTS"
, "dep": {"type": "var", "name": "x"}
}
}
, "body":
{ "type": "singleton_map"
, "key": "summarizer"
, "value": {"type": "var", "name": "x"}
}
}
}
}
}
]
, [ "summary"
, { "type": "ACTION"
, "inputs":
{ "type": "map_union"
, "$1":
[ {"type": "var", "name": "attempts"}
, {"type": "var", "name": "summarizer"}
]
}
, "outs":
["stdout", "stderr", "result", "time-start", "time-stop"]
, "cmd": ["./summarizer"]
}
]
, [ "artifacts"
, { "type": "map_union"
, "$1":
[ {"type": "var", "name": "summary"}
, { "type": "singleton_map"
, "key": "work"
, "value":
{"type": "TREE", "$1": {"type": "var", "name": "attempts"}}
}
]
}
]
, [ "runfiles"
, { "type": "singleton_map"
, "key": {"type": "var", "name": "name"}
, "value":
{"type": "TREE", "$1": {"type": "var", "name": "artifacts"}}
}
]
]
, "body":
{ "type": "RESULT"
, "artifacts": {"type": "var", "name": "artifacts"}
, "runfiles": {"type": "var", "name": "runfiles"}
}
}
}
}
}
}
|