aboutsummaryrefslogtreecommitdiff
path: root/bin/sh/tests
diff options
context:
space:
mode:
authorJilles Tjoelker <jilles@FreeBSD.org>2017-08-12 19:17:48 +0000
committerJilles Tjoelker <jilles@FreeBSD.org>2017-08-12 19:17:48 +0000
commit2cc32af06fd095dfca28010bd0b18e3ec8569120 (patch)
treea9643d420261c191ae5e04c61daad73b0f478834 /bin/sh/tests
parent992029ba105f46bd43949987d402d406866c58b0 (diff)
downloadsrc-2cc32af06fd095dfca28010bd0b18e3ec8569120.tar.gz
src-2cc32af06fd095dfca28010bd0b18e3ec8569120.zip
sh: Add tests for sh -c that already pass.
PR: 220587 Submitted by: Ryan Moeller
Notes
Notes: svn path=/head/; revision=322438
Diffstat (limited to 'bin/sh/tests')
-rw-r--r--bin/sh/tests/Makefile1
-rw-r--r--bin/sh/tests/invocation/Makefile15
-rw-r--r--bin/sh/tests/invocation/sh-ac1.07
-rw-r--r--bin/sh/tests/invocation/sh-c1.04
-rw-r--r--bin/sh/tests/invocation/sh-ca1.07
-rw-r--r--bin/sh/tests/invocation/sh-fca1.07
6 files changed, 41 insertions, 0 deletions
diff --git a/bin/sh/tests/Makefile b/bin/sh/tests/Makefile
index d93e19aea7e1..59835cb73520 100644
--- a/bin/sh/tests/Makefile
+++ b/bin/sh/tests/Makefile
@@ -6,6 +6,7 @@ TESTS_SUBDIRS+= builtins
TESTS_SUBDIRS+= errors
TESTS_SUBDIRS+= execution
TESTS_SUBDIRS+= expansion
+TESTS_SUBDIRS+= invocation
TESTS_SUBDIRS+= parameters
TESTS_SUBDIRS+= parser
TESTS_SUBDIRS+= set-e
diff --git a/bin/sh/tests/invocation/Makefile b/bin/sh/tests/invocation/Makefile
new file mode 100644
index 000000000000..cd234bb7d42f
--- /dev/null
+++ b/bin/sh/tests/invocation/Makefile
@@ -0,0 +1,15 @@
+# $FreeBSD$
+
+PACKAGE= tests
+
+TESTSDIR= ${TESTSBASE}/bin/sh/${.CURDIR:T}
+
+.PATH: ${.CURDIR:H}
+ATF_TESTS_SH= functional_test
+
+${PACKAGE}FILES+= sh-ac1.0
+${PACKAGE}FILES+= sh-c1.0
+${PACKAGE}FILES+= sh-ca1.0
+${PACKAGE}FILES+= sh-fca1.0
+
+.include <bsd.test.mk>
diff --git a/bin/sh/tests/invocation/sh-ac1.0 b/bin/sh/tests/invocation/sh-ac1.0
new file mode 100644
index 000000000000..0e0818b8a2c4
--- /dev/null
+++ b/bin/sh/tests/invocation/sh-ac1.0
@@ -0,0 +1,7 @@
+# $FreeBSD$
+# Test that attached options before c are processed
+
+case `${SH} -ac 'echo $-:$0' moo` in
+*a*:moo) true ;;
+*) false ;;
+esac
diff --git a/bin/sh/tests/invocation/sh-c1.0 b/bin/sh/tests/invocation/sh-c1.0
new file mode 100644
index 000000000000..6bda19837b90
--- /dev/null
+++ b/bin/sh/tests/invocation/sh-c1.0
@@ -0,0 +1,4 @@
+# $FreeBSD$
+# Test that -c executes command_string with the given name and arg
+
+${SH} -c 'echo $0 $@' moo foo | grep -qx -- "moo foo"
diff --git a/bin/sh/tests/invocation/sh-ca1.0 b/bin/sh/tests/invocation/sh-ca1.0
new file mode 100644
index 000000000000..188b6453db2a
--- /dev/null
+++ b/bin/sh/tests/invocation/sh-ca1.0
@@ -0,0 +1,7 @@
+# $FreeBSD$
+# Test that attached options after c are processed
+
+case `${SH} -ca 'echo $-:$0' moo` in
+*a*:moo) true ;;
+*) false ;;
+esac
diff --git a/bin/sh/tests/invocation/sh-fca1.0 b/bin/sh/tests/invocation/sh-fca1.0
new file mode 100644
index 000000000000..c010a5ebacdf
--- /dev/null
+++ b/bin/sh/tests/invocation/sh-fca1.0
@@ -0,0 +1,7 @@
+# $FreeBSD$
+# Test that attached options before and after c are processed
+
+case `${SH} -fca 'echo $-:$-:$0:$@' foo -bar` in
+*f*:*a*:foo:-bar) true ;;
+*) false ;;
+esac