summaryrefslogtreecommitdiff
path: root/test/end-to-end/EXPRESSIONS
diff options
context:
space:
mode:
authorKlaus Aehlig <klaus.aehlig@huawei.com>2023-02-24 15:09:49 +0100
committerSascha Roloff <sascha.roloff@huawei.com>2023-03-06 17:17:21 +0100
commit27755862921509cf3d64d730519fad3d0710c0b7 (patch)
treed3d60687c1a2bc7e8d4d39d9b7f280974ef76603 /test/end-to-end/EXPRESSIONS
parent00adcbad4162527bd750aba69306d2d7c36ed0af (diff)
downloadjustbuild-27755862921509cf3d64d730519fad3d0710c0b7.tar.gz
Add rule for shell tests with remote execution
... similar to ["@", "rules", "shell/test", "script"], but implicitly starting a remote execution in the background, passing the information about that endpoint to the test via an environment variable.
Diffstat (limited to 'test/end-to-end/EXPRESSIONS')
-rw-r--r--test/end-to-end/EXPRESSIONS190
1 files changed, 190 insertions, 0 deletions
diff --git a/test/end-to-end/EXPRESSIONS b/test/end-to-end/EXPRESSIONS
new file mode 100644
index 00000000..20b9cb6a
--- /dev/null
+++ b/test/end-to-end/EXPRESSIONS
@@ -0,0 +1,190 @@
+{ "test-action":
+ { "vars":
+ [ "TEST_ENV"
+ , "ATTEMPT"
+ , "name"
+ , "test.sh"
+ , "keep"
+ , "transition"
+ , "TEST_COMPATIBLE_REMOTE"
+ ]
+ , "imports":
+ { "artifacts_list": ["@", "rules", "", "field_artifacts_list"]
+ , "runfiles_list": ["@", "rules", "", "field_runfiles_list"]
+ , "stage": ["@", "rules", "", "stage_singleton_field"]
+ }
+ , "expression":
+ { "type": "let*"
+ , "bindings":
+ [ ["fieldname", "runner"]
+ , ["location", "runner"]
+ , ["runner", {"type": "CALL_EXPRESSION", "name": "stage"}]
+ , ["fieldname", "just"]
+ , ["location", "just"]
+ , ["just", {"type": "CALL_EXPRESSION", "name": "stage"}]
+ , ["fieldname", "deps"]
+ , [ "deps"
+ , { "type": "TREE"
+ , "$1":
+ { "type": "disjoint_map_union"
+ , "msg": "Field \"deps\" has to stage in a conflict free way"
+ , "$1":
+ { "type": "++"
+ , "$1":
+ [ {"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"
+ , "remotestdout"
+ , "remotestderr"
+ ]
+ , { "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": "just"}
+ , {"type": "var", "name": "runner"}
+ , {"type": "var", "name": "test.sh"}
+ , {"type": "var", "name": "attempt marker"}
+ ]
+ }
+ ]
+ , [ "cmd"
+ , { "type": "++"
+ , "$1":
+ [ [ "./runner"
+ , { "type": "if"
+ , "cond": {"type": "var", "name": "TEST_COMPATIBLE_REMOTE"}
+ , "then": "true"
+ , "else": "false"
+ }
+ ]
+ , {"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 with "
+ , { "type": "if"
+ , "cond": {"type": "var", "name": "TEST_COMPATIBLE_REMOTE"}
+ , "then": "compatible"
+ , "else": "native"
+ }
+ , " remote execution "
+ , {"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 with remote execution"
+ , {"type": "var", "name": "name"}
+ , " failed (Run "
+ , {"type": "var", "name": "ATTEMPT"}
+ , ")"
+ ]
+ }
+ }
+ }
+ }
+ }
+, "test-result":
+ { "vars":
+ [ "TEST_ENV"
+ , "name"
+ , "test.sh"
+ , "keep"
+ , "runner"
+ , "deps-fieldname"
+ , "transition"
+ , "TEST_COMPATIBLE_REMOTE"
+ ]
+ , "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"}
+ }
+ }
+ }
+}