aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorShinichiro Hamaji <shinichiro.hamaji@gmail.com>2016-06-25 11:24:11 +0900
committerShinichiro Hamaji <shinichiro.hamaji@gmail.com>2016-06-25 11:24:11 +0900
commit5e6b2e4c094eb2b034e524884c72aab060af9999 (patch)
treee41d38d6ac5b2b924a750624428c2d7403db163a
parent4627ab22520d904004bb50048267c6c5f5bbd2db (diff)
Add testcases for commandline variables
-rwxr-xr-xtestcase/cmdline_var.sh27
-rwxr-xr-xtestcase/cmdline_var_makeflags.sh36
-rwxr-xr-xtestcase/cmdline_var_modify.sh27
-rwxr-xr-xtestcase/cmdline_var_override.sh27
4 files changed, 117 insertions, 0 deletions
diff --git a/testcase/cmdline_var.sh b/testcase/cmdline_var.sh
new file mode 100755
index 0000000..b892736
--- /dev/null
+++ b/testcase/cmdline_var.sh
@@ -0,0 +1,27 @@
+#!/bin/sh
+#
+# Copyright 2016 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
+CLVAR := FAIL
+all:
+ @echo \$(CLVAR)
+EOF
+
+${mk} CLVAR:=PASS 2> /dev/null
diff --git a/testcase/cmdline_var_makeflags.sh b/testcase/cmdline_var_makeflags.sh
new file mode 100755
index 0000000..6e38a2d
--- /dev/null
+++ b/testcase/cmdline_var_makeflags.sh
@@ -0,0 +1,36 @@
+#!/bin/sh
+#
+# Copyright 2016 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
+CLVAR := FAIL
+MFVAR := FAIL
+FILEVAR := PASS
+all:
+ @echo \$(ENVVAR) \$(origin ENVVAR)
+ @echo \$(MFVAR) \$(origin MFVAR)
+ @echo \$(CLVAR) \$(origin CLVAR)
+ @echo \$(FILEVAR) \$(origin FILEVAR)
+EOF
+
+export ENVVAR=PASS
+export FILEVAR=FAIL
+export MAKEFLAGS="MFVAR=PASS CLVAR=FAIL"
+
+${mk} CLVAR=PASS 2> /dev/null
diff --git a/testcase/cmdline_var_modify.sh b/testcase/cmdline_var_modify.sh
new file mode 100755
index 0000000..9616a2b
--- /dev/null
+++ b/testcase/cmdline_var_modify.sh
@@ -0,0 +1,27 @@
+#!/bin/sh
+#
+# Copyright 2016 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
+CLVAR := FAIL
+all:
+ @echo \$(CLVAR)
+EOF
+
+${mk} CLVAR:=P CLVAR+=A CLVAR+=SS CLVAR?=FAIL 2> /dev/null
diff --git a/testcase/cmdline_var_override.sh b/testcase/cmdline_var_override.sh
new file mode 100755
index 0000000..0a5b3c1
--- /dev/null
+++ b/testcase/cmdline_var_override.sh
@@ -0,0 +1,27 @@
+#!/bin/sh
+#
+# Copyright 2016 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
+override CLVAR := PASS
+all:
+ @echo \$(CLVAR)
+EOF
+
+${mk} CLVAR:=FAIL 2> /dev/null