summaryrefslogtreecommitdiff
path: root/test/end-to-end/build-fails
diff options
context:
space:
mode:
authorOliver Reiche <oliver.reiche@huawei.com>2022-07-06 11:14:28 +0200
committerOliver Reiche <oliver.reiche@huawei.com>2022-07-07 15:00:09 +0200
commit80c1d95114b46cc396a6b1c6a8bccaab8bf52a97 (patch)
tree4ec46665df9402736bdd80e00fe97e2d186d5206 /test/end-to-end/build-fails
parentfa4bb79fa3e972efc0e59abfda89b3e57b472dfa (diff)
downloadjustbuild-80c1d95114b46cc396a6b1c6a8bccaab8bf52a97.tar.gz
Traverser: Bring task system down gracefully on error
Diffstat (limited to 'test/end-to-end/build-fails')
-rw-r--r--test/end-to-end/build-fails/TARGETS9
-rwxr-xr-xtest/end-to-end/build-fails/single_fail_dep.sh47
2 files changed, 56 insertions, 0 deletions
diff --git a/test/end-to-end/build-fails/TARGETS b/test/end-to-end/build-fails/TARGETS
new file mode 100644
index 00000000..05e2c957
--- /dev/null
+++ b/test/end-to-end/build-fails/TARGETS
@@ -0,0 +1,9 @@
+{ "single_fail_dep":
+ { "type": ["@", "rules", "shell/test", "script"]
+ , "name": ["single_fail_dep"]
+ , "test": ["single_fail_dep.sh"]
+ , "deps": [["test/end-to-end", "tool-under-test"]]
+ }
+, "TESTS":
+ {"type": "install", "tainted": ["test"], "deps": ["single_fail_dep"]}
+}
diff --git a/test/end-to-end/build-fails/single_fail_dep.sh b/test/end-to-end/build-fails/single_fail_dep.sh
new file mode 100755
index 00000000..c4e713b3
--- /dev/null
+++ b/test/end-to-end/build-fails/single_fail_dep.sh
@@ -0,0 +1,47 @@
+#!/bin/bash
+
+set -eu
+
+readonly NUM_DEPS=100
+readonly FAIL_DEP=42
+
+create_target() {
+ local ID=$1
+ if [ $ID = $FAIL_DEP ]; then
+ # failing target
+ echo '{"type": "generic", "cmds": ["false"], "out_dirs": ["out_'$ID'"]}'
+ else
+ # success target
+ echo '{"type": "generic", "cmds": ["echo '$ID' > out_'$ID'/id"], "out_dirs": ["out_'$ID'"]}'
+ fi
+}
+
+mkdir -p .buildroot
+
+touch ROOT
+
+cat <<EOF > TARGETS
+{ $(for i in $(seq $NUM_DEPS); do
+ if [ $i = 1 ]; then echo -n ' '; else echo -n ' , '; fi;
+ echo '"dep_'$i'": '$(create_target $i); done)
+, "main":
+ { "type": "generic"
+ , "cmds": ["cat out_*/id | sort -n > id"]
+ , "outs": ["id"]
+ , "deps":
+ [ $(for i in $(seq $NUM_DEPS); do
+ if [ $i = 1 ]; then echo -n ' '; else echo -n ' , '; fi;
+ echo '"dep_'$i'"';
+ done)
+ ]
+ }
+}
+EOF
+
+cat TARGETS
+
+echo "main" >&2
+bin/tool-under-test build --local-build-root .buildroot main && exit 1 || [ $? = 1 ]
+echo "done" >&2
+
+exit