diff options
Diffstat (limited to 'rules/CC/test/EXPRESSIONS')
-rw-r--r-- | rules/CC/test/EXPRESSIONS | 410 |
1 files changed, 410 insertions, 0 deletions
diff --git a/rules/CC/test/EXPRESSIONS b/rules/CC/test/EXPRESSIONS new file mode 100644 index 0000000..1389bbc --- /dev/null +++ b/rules/CC/test/EXPRESSIONS @@ -0,0 +1,410 @@ +{ "run_test": + { "doc": + [ "Build and run a CC test binary using the provided runner." + , "" + , "Note that if variable RUNS_PER_TEST contains a non-false value, a" + , "summarizer must be provided." + ] + , "vars": + [ "ARCH" + , "HOST_ARCH" + , "TARGET_ARCH" + , "ARCH_DISPATCH" + , "TEST_SUMMARY_EXECUTION_PROPERTIES" + , "CC" + , "CXX" + , "CFLAGS" + , "CXXFLAGS" + , "ADD_CFLAGS" + , "ADD_CXXFLAGS" + , "ENV" + , "TEST_ENV" + , "TIMEOUT_SCALE" + , "CC_TEST_LAUNCHER" + , "RUNS_PER_TEST" + , "name" + , "pure C" + , "stage" + , "srcs" + , "private-hdrs" + , "private-defines" + , "private-cflags" + , "private-ldflags" + , "defaults-transition" + , "deps-transition" + , "deps-fieldnames" + , "runner" + , "runner-data" + , "test-args" + , "test-data" + , "summarizer" + , "summary artifacts" + , "LINT" + ] + , "imports": + { "artifacts": ["./", "../..", "field_artifacts"] + , "runfiles": ["./", "../..", "field_runfiles"] + , "compile-deps": ["./", "..", "compile-deps"] + , "compile-args-deps": ["./", "..", "compile-args-deps"] + , "link-deps": ["./", "..", "link-deps"] + , "link-args-deps": ["./", "..", "link-args-deps"] + , "run-libs-deps": ["./", "..", "run-libs-deps"] + , "run-libs-args-deps": ["./", "..", "run-libs-args-deps"] + , "cflags-files-deps": ["./", "..", "cflags-files-deps"] + , "ldflags-files-deps": ["./", "..", "ldflags-files-deps"] + , "binary": ["./", "..", "bin artifact"] + , "host transition": ["transitions", "for host"] + , "target properties": ["transitions", "target properties"] + , "stage": ["./", "../..", "stage_singleton_field"] + , "list_provider": ["./", "../..", "field_list_provider"] + , "lint": ["./", "..", "lint information"] + } + , "expression": + { "type": "let*" + , "bindings": + [ [ "cflags-files" + , {"type": "CALL_EXPRESSION", "name": "cflags-files-deps"} + ] + , ["compile-deps", {"type": "CALL_EXPRESSION", "name": "compile-deps"}] + , [ "compile-args" + , { "type": "++" + , "$1": + [ { "type": "foreach" + , "var": "def" + , "range": + {"type": "var", "name": "private-defines", "default": []} + , "body": + {"type": "join", "$1": ["-D", {"type": "var", "name": "def"}]} + } + , {"type": "var", "name": "private-cflags", "default": []} + , {"type": "CALL_EXPRESSION", "name": "compile-args-deps"} + ] + } + ] + , [ "ldflags-files" + , {"type": "CALL_EXPRESSION", "name": "ldflags-files-deps"} + ] + , ["link-deps", {"type": "CALL_EXPRESSION", "name": "link-deps"}] + , [ "link-args" + , { "type": "++" + , "$1": + [ {"type": "CALL_EXPRESSION", "name": "link-args-deps"} + , {"type": "var", "name": "private-ldflags", "default": []} + ] + } + ] + , ["run-libs", {"type": "CALL_EXPRESSION", "name": "run-libs-deps"}] + , [ "run-libs-args" + , {"type": "CALL_EXPRESSION", "name": "run-libs-args-deps"} + ] + , ["binary", {"type": "CALL_EXPRESSION", "name": "binary"}] + , [ "lint" + , { "type": "if" + , "cond": {"type": "var", "name": "LINT"} + , "then": + { "type": "let*" + , "bindings": + [ ["hdrs", {"type": "empty_map"}] + , [ "lint-deps fieldnames" + , ["private-hdrs", "srcs", "private-deps"] + ] + ] + , "body": {"type": "CALL_EXPRESSION", "name": "lint"} + } + } + ] + , [ "staged test binary" + , { "type": "map_union" + , "$1": + { "type": "foreach_map" + , "range": {"type": "var", "name": "binary"} + , "var_val": "binary" + , "body": + { "type": "singleton_map" + , "key": "test" + , "value": {"type": "var", "name": "binary"} + } + } + } + ] + , [ "test-args" + , { "type": "singleton_map" + , "key": "test-args.json" + , "value": + { "type": "BLOB" + , "data": + { "type": "json_encode" + , "$1": {"type": "var", "name": "test-args", "default": []} + } + } + } + ] + , [ "test-launcher" + , { "type": "singleton_map" + , "key": "test-launcher.json" + , "value": + { "type": "BLOB" + , "data": + { "type": "json_encode" + , "$1": + {"type": "var", "name": "CC_TEST_LAUNCHER", "default": []} + } + } + } + ] + , [ "test-name" + , { "type": "join" + , "separator": "/" + , "$1": + [{"type": "var", "name": "stage"}, {"type": "var", "name": "name"}] + } + ] + , [ "test input" + , { "type": "map_union" + , "$1": + [ { "type": "to_subdir" + , "subdir": "work" + , "$1": {"type": "var", "name": "test-data"} + } + , {"type": "var", "name": "runner"} + , { "type": "var" + , "name": "runner-data" + , "default": {"type": "empty_map"} + } + , {"type": "var", "name": "test-args"} + , {"type": "var", "name": "test-launcher"} + , {"type": "var", "name": "staged test binary"} + , {"type": "var", "name": "run-libs"} + ] + } + ] + , [ "target properties" + , {"type": "CALL_EXPRESSION", "name": "target properties"} + ] + ] + , "body": + { "type": "if" + , "cond": {"type": "var", "name": "RUNS_PER_TEST"} + , "else": + { "type": "let*" + , "bindings": + [ [ "test-results" + , { "type": "ACTION" + , "outs": + [ "result" + , "stdout" + , "stderr" + , "time-start" + , "time-stop" + , "pwd" + ] + , "inputs": {"type": "var", "name": "test input"} + , "cmd": ["./runner"] + , "env": + { "type": "var" + , "name": "TEST_ENV" + , "default": {"type": "empty_map"} + } + , "may_fail": ["test"] + , "fail_message": + { "type": "join" + , "$1": + ["CC test ", {"type": "var", "name": "test-name"}, " failed"] + } + , "timeout scaling": + {"type": "var", "name": "TIMEOUT_SCALE", "default": 1.0} + , "execution properties": + {"type": "var", "name": "target properties"} + } + ] + , [ "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"} + , "provides": {"type": "env", "vars": ["lint"]} + } + } + , "then": + { "type": "let*" + , "bindings": + [ [ "attempts (plain)" + , { "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": "ACTION" + , "outs": + ["result", "stdout", "stderr", "time-start", "time-stop"] + , "inputs": + { "type": "map_union" + , "$1": + [ { "type": "singleton_map" + , "key": "ATTEMPT" + , "value": + { "type": "BLOB" + , "data": {"type": "var", "name": "ATTEMPT"} + } + } + , {"type": "var", "name": "test input"} + ] + } + , "cmd": ["./runner"] + , "env": + { "type": "var" + , "name": "TEST_ENV" + , "default": {"type": "empty_map"} + } + , "may_fail": ["test"] + , "no_cache": ["test"] + , "fail_message": + { "type": "join" + , "$1": + [ "CC test " + , {"type": "var", "name": "test-name"} + , " failed (Run" + , {"type": "var", "name": "ATTEMPT"} + , ")" + ] + } + , "timeout scaling": + {"type": "var", "name": "TIMEOUT_SCALE", "default": 1.0} + , "execution properties": + {"type": "var", "name": "target properties"} + } + } + } + } + ] + , [ "attempts (for summary)" + , { "type": "map_union" + , "$1": + { "type": "foreach_map" + , "range": {"type": "var", "name": "attempts (plain)"} + , "body": + { "type": "singleton_map" + , "key": {"type": "var", "name": "_"} + , "value": + { "type": "TREE" + , "$1": + { "type": "map_union" + , "$1": + { "type": "foreach" + , "range": {"type": "var", "name": "summary artifacts"} + , "body": + { "type": "singleton_map" + , "key": {"type": "var", "name": "_"} + , "value": + { "type": "lookup" + , "map": {"type": "var", "name": "$_"} + , "key": {"type": "var", "name": "_"} + } + } + } + } + } + } + } + } + ] + , [ "summary PATH" + , { "type": "join" + , "separator": ":" + , "$1": + { "type": "let*" + , "bindings": + [["fieldname", "shell-defaults"], ["provider", "PATH"]] + , "body": {"type": "CALL_EXPRESSION", "name": "list_provider"} + } + } + ] + , [ "summary" + , { "type": "ACTION" + , "inputs": + { "type": "map_union" + , "$1": + [ {"type": "var", "name": "attempts (for summary)"} + , {"type": "var", "name": "summarizer"} + ] + } + , "outs": + ["stdout", "stderr", "result", "time-start", "time-stop"] + , "cmd": ["./summarizer"] + , "execution properties": + { "type": "var" + , "name": "TEST_SUMMARY_EXECUTION_PROPERTIES" + , "default": {"type": "empty_map"} + } + , "env": + { "type": "if" + , "cond": {"type": "var", "name": "summary PATH"} + , "then": + { "type": "singleton_map" + , "key": "PATH" + , "value": {"type": "var", "name": "summary PATH"} + } + , "else": {"type": "empty_map"} + } + } + ] + , [ "attempts" + , { "type": "map_union" + , "$1": + { "type": "foreach_map" + , "range": {"type": "var", "name": "attempts (plain)"} + , "body": + { "type": "singleton_map" + , "key": {"type": "var", "name": "_"} + , "value": + {"type": "TREE", "$1": {"type": "var", "name": "$_"}} + } + } + } + ] + , [ "artifacts" + , { "type": "`" + , "$1": + { "pwd": + {"type": ",", "$1": {"type": "BLOB", "data": "/summary"}} + , "work": + { "type": "," + , "$1": + {"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"} + , "provides": {"type": "env", "vars": ["lint"]} + } + } + } + } + } +} |