summaryrefslogtreecommitdiff
path: root/test/end-to-end/user-errors
diff options
context:
space:
mode:
Diffstat (limited to 'test/end-to-end/user-errors')
-rw-r--r--test/end-to-end/user-errors/TARGETS8
-rwxr-xr-xtest/end-to-end/user-errors/flat-stage.sh64
2 files changed, 72 insertions, 0 deletions
diff --git a/test/end-to-end/user-errors/TARGETS b/test/end-to-end/user-errors/TARGETS
new file mode 100644
index 00000000..cb1b881e
--- /dev/null
+++ b/test/end-to-end/user-errors/TARGETS
@@ -0,0 +1,8 @@
+{ "flat-stage":
+ { "type": ["@", "rules", "shell/test", "script"]
+ , "name": ["flat-stage"]
+ , "test": ["flat-stage.sh"]
+ , "deps": [["test/end-to-end", "tool-under-test"]]
+ }
+, "TESTS": {"type": "install", "tainted": ["test"], "deps": ["flat-stage"]}
+}
diff --git a/test/end-to-end/user-errors/flat-stage.sh b/test/end-to-end/user-errors/flat-stage.sh
new file mode 100755
index 00000000..e0ee2780
--- /dev/null
+++ b/test/end-to-end/user-errors/flat-stage.sh
@@ -0,0 +1,64 @@
+#!/bin/sh
+set -e
+
+mkdir .tool-root
+touch ROOT
+mkdir subdir
+touch foo.txt subdir/foo.txt
+cat > RULES <<'EOI'
+{ "data":
+ { "target_fields": ["srcs"]
+ , "string_fields": ["flat"]
+ , "expression":
+ { "type": "let*"
+ , "bindings":
+ [ [ "srcs"
+ , { "type": "map_union"
+ , "$1":
+ { "type": "foreach"
+ , "var": "x"
+ , "range": {"type": "FIELD", "name": "srcs"}
+ , "body":
+ {"type": "DEP_ARTIFACTS", "dep": {"type": "var", "name": "x"}}
+ }
+ }
+ ]
+ , ["internal information", "DeBuG-InFoRmAtIoN"]
+ , [ "result"
+ , { "type": "to_subdir"
+ , "subdir": "data"
+ , "flat": {"type": "FIELD", "name": "flat"}
+ , "msg":
+ [ "DataRuleSpecificErrorMessage"
+ , {"type": "var", "name": "internal information"}
+ ]
+ , "$1": {"type": "var", "name": "srcs"}
+ }
+ ]
+ ]
+ , "body":
+ {"type": "RESULT", "artifacts": {"type": "var", "name": "result"}}
+ }
+ }
+}
+EOI
+
+cat > TARGETS <<'EOI'
+{ "full": {"type": "data", "srcs": ["foo.txt", "subdir/foo.txt"]}
+, "flat":
+ {"type": "data", "srcs": ["foo.txt", "subdir/foo.txt"], "flat": ["YES"]}
+}
+EOI
+
+
+bin/tool-under-test build --local_build_root .tool-root -f build.log full 2>&1
+echo
+grep 'DataRuleSpecificErrorMessage' build.log && exit 1 || :
+grep 'DeBuG-InFoRmAtIoN' build.log && exit 1 || :
+
+bin/tool-under-test build --local_build_root .tool-root -f build.log flat 2>&1 && exit 1 || :
+echo
+grep 'DataRuleSpecificErrorMessage' build.log
+grep "DeBuG-InFoRmAtIoN" build.log
+
+echo OK