aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDelilah Hoare <delilah@dhoare.me>2022-11-24 20:24:56 +1100
committerCole Faust <colecfaust@gmail.com>2022-11-28 12:42:27 -0800
commit6e2447e21b34607154429b81e80eea6f58db4095 (patch)
treeb1c6df137c548f3a2488451e6093291db89a82a0
parent326d5a4b584db3f5739b801c01729de25aff7557 (diff)
downloadkati-6e2447e21b34607154429b81e80eea6f58db4095.tar.gz
Add ninja version of $? test case
-rwxr-xr-xtestcase/ninja_question.sh46
1 files changed, 46 insertions, 0 deletions
diff --git a/testcase/ninja_question.sh b/testcase/ninja_question.sh
new file mode 100755
index 0000000..d177fb7
--- /dev/null
+++ b/testcase/ninja_question.sh
@@ -0,0 +1,46 @@
+#!/bin/sh
+#
+# Copyright 2022 Google Inc. All rights reserved
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http:#www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+set -e
+
+mk="$@"
+
+cat <<EOF > Makefile
+
+all: d
+
+a:
+ echo a > a
+
+b:
+ echo b > b
+
+c:
+ echo c > c
+
+d: a b c
+ echo \$? > d
+
+EOF
+
+${mk}
+if [ -e ninja.sh ]; then ./ninja.sh -j1; fi
+cat d
+sleep 0.1
+touch b
+if [ -e ninja.sh ]; then ./ninja.sh -j1; else ${mk}; fi
+cat d
+