Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 12 Aug 2017 19:17:48 +0000 (UTC)
From:      Jilles Tjoelker <jilles@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r322438 - in head: bin/sh/tests bin/sh/tests/invocation etc/mtree
Message-ID:  <201708121917.v7CJHmUp035277@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: jilles
Date: Sat Aug 12 19:17:48 2017
New Revision: 322438
URL: https://svnweb.freebsd.org/changeset/base/322438

Log:
  sh: Add tests for sh -c that already pass.
  
  PR:		220587
  Submitted by:	Ryan Moeller

Added:
  head/bin/sh/tests/invocation/
  head/bin/sh/tests/invocation/Makefile   (contents, props changed)
  head/bin/sh/tests/invocation/sh-ac1.0   (contents, props changed)
  head/bin/sh/tests/invocation/sh-c1.0   (contents, props changed)
  head/bin/sh/tests/invocation/sh-ca1.0   (contents, props changed)
  head/bin/sh/tests/invocation/sh-fca1.0   (contents, props changed)
Modified:
  head/bin/sh/tests/Makefile
  head/etc/mtree/BSD.tests.dist

Modified: head/bin/sh/tests/Makefile
==============================================================================
--- head/bin/sh/tests/Makefile	Sat Aug 12 18:42:54 2017	(r322437)
+++ head/bin/sh/tests/Makefile	Sat Aug 12 19:17:48 2017	(r322438)
@@ -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

Added: head/bin/sh/tests/invocation/Makefile
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/bin/sh/tests/invocation/Makefile	Sat Aug 12 19:17:48 2017	(r322438)
@@ -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>

Added: head/bin/sh/tests/invocation/sh-ac1.0
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/bin/sh/tests/invocation/sh-ac1.0	Sat Aug 12 19:17:48 2017	(r322438)
@@ -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

Added: head/bin/sh/tests/invocation/sh-c1.0
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/bin/sh/tests/invocation/sh-c1.0	Sat Aug 12 19:17:48 2017	(r322438)
@@ -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"

Added: head/bin/sh/tests/invocation/sh-ca1.0
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/bin/sh/tests/invocation/sh-ca1.0	Sat Aug 12 19:17:48 2017	(r322438)
@@ -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

Added: head/bin/sh/tests/invocation/sh-fca1.0
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/bin/sh/tests/invocation/sh-fca1.0	Sat Aug 12 19:17:48 2017	(r322438)
@@ -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

Modified: head/etc/mtree/BSD.tests.dist
==============================================================================
--- head/etc/mtree/BSD.tests.dist	Sat Aug 12 18:42:54 2017	(r322437)
+++ head/etc/mtree/BSD.tests.dist	Sat Aug 12 19:17:48 2017	(r322438)
@@ -39,6 +39,8 @@
             ..
             expansion
             ..
+            invocation
+            ..
             parameters
             ..
             parser



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201708121917.v7CJHmUp035277>