From owner-svn-src-all@FreeBSD.ORG Sat May 2 11:10:01 2015 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 5F1B1298; Sat, 2 May 2015 11:10:01 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 3FFF11D8D; Sat, 2 May 2015 11:10:01 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id t42BA166096008; Sat, 2 May 2015 11:10:01 GMT (envelope-from bapt@FreeBSD.org) Received: (from bapt@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id t42B9xP3095945; Sat, 2 May 2015 11:09:59 GMT (envelope-from bapt@FreeBSD.org) Message-Id: <201505021109.t42B9xP3095945@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: bapt set sender to bapt@FreeBSD.org using -f From: Baptiste Daroussin Date: Sat, 2 May 2015 11:09:59 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r282338 - in head: etc/mtree usr.bin/soelim usr.bin/soelim/tests X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 02 May 2015 11:10:01 -0000 Author: bapt Date: Sat May 2 11:09:58 2015 New Revision: 282338 URL: https://svnweb.freebsd.org/changeset/base/282338 Log: Add regression tests for soelim(1) Added: head/usr.bin/soelim/tests/ head/usr.bin/soelim/tests/Makefile (contents, props changed) head/usr.bin/soelim/tests/basic (contents, props changed) head/usr.bin/soelim/tests/basic.in (contents, props changed) head/usr.bin/soelim/tests/basic.out (contents, props changed) head/usr.bin/soelim/tests/nonexisting.in (contents, props changed) head/usr.bin/soelim/tests/soelim.sh (contents, props changed) Modified: head/etc/mtree/BSD.tests.dist head/usr.bin/soelim/Makefile Modified: head/etc/mtree/BSD.tests.dist ============================================================================== --- head/etc/mtree/BSD.tests.dist Sat May 2 08:31:16 2015 (r282337) +++ head/etc/mtree/BSD.tests.dist Sat May 2 11:09:58 2015 (r282338) @@ -546,6 +546,8 @@ regress.multitest.out .. .. + soelim + .. timeout .. tr Modified: head/usr.bin/soelim/Makefile ============================================================================== --- head/usr.bin/soelim/Makefile Sat May 2 08:31:16 2015 (r282337) +++ head/usr.bin/soelim/Makefile Sat May 2 11:09:58 2015 (r282338) @@ -1,5 +1,11 @@ # $FreeBSD$ +.include + PROG= soelim +.if ${MK_TESTS} != "no" +SUBDIR+= tests +.endif + .include Added: head/usr.bin/soelim/tests/Makefile ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/usr.bin/soelim/tests/Makefile Sat May 2 11:09:58 2015 (r282338) @@ -0,0 +1,13 @@ +# $FreeBSD$ + +TESTSDIR= ${TESTSBASE}/usr.bin/soelim + +ATF_TESTS_SH= soelim + +FILES= nonexisting.in \ + basic.in \ + basic \ + basic.out +FILESDIR= ${TESTSDIR} + +.include Added: head/usr.bin/soelim/tests/basic ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/usr.bin/soelim/tests/basic Sat May 2 11:09:58 2015 (r282338) @@ -0,0 +1 @@ +basic has been included Added: head/usr.bin/soelim/tests/basic.in ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/usr.bin/soelim/tests/basic.in Sat May 2 11:09:58 2015 (r282338) @@ -0,0 +1,3 @@ +This is a test +.so basic +end Added: head/usr.bin/soelim/tests/basic.out ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/usr.bin/soelim/tests/basic.out Sat May 2 11:09:58 2015 (r282338) @@ -0,0 +1,3 @@ +This is a test +basic has been included +end Added: head/usr.bin/soelim/tests/nonexisting.in ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/usr.bin/soelim/tests/nonexisting.in Sat May 2 11:09:58 2015 (r282338) @@ -0,0 +1,3 @@ +This is a test +.so nonexistingfile +This is next Added: head/usr.bin/soelim/tests/soelim.sh ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/usr.bin/soelim/tests/soelim.sh Sat May 2 11:09:58 2015 (r282338) @@ -0,0 +1,96 @@ +# $FreeBSD$ + +atf_test_case stdin +stdin_head() +{ + atf_set "descr" "stdin functionality" +} + +stdin_body() +{ + # no file after .so + atf_check \ + -o inline:".so\n" \ + -e empty \ + -s exit:0 \ + soelim <<-EOF +.so +EOF + + # only space after .so + atf_check \ + -o inline:".so \n" \ + -e empty \ + -s exit:0 \ + soelim <<-EOF +.so +EOF + + # explicit stdin + atf_check \ + -o inline:".so\n" \ + -e empty \ + -s exit:0 \ + soelim - <<-EOF +.so +EOF + + atf_check \ + -o empty \ + -e inline:"soelim: can't open 'afile': No such file or directory\n" \ + -s exit:1 \ + soelim <<-EOF +.so afile +EOF + + atf_check \ + -o inline:".soafile\n" \ + -e empty \ + -s exit:0 \ + soelim <<-EOF +.soafile +EOF + + atf_check \ + -o empty \ + -e inline:"soelim: can't open 'afile': No such file or directory\n" \ + -s exit:1 \ + soelim -C <<-EOF +.soafile +EOF +} + +atf_test_case files +files_head() +{ + atf_set "descr" "testing files" +} + +files_body() +{ + atf_check \ + -o inline:"This is a test\n" \ + -e inline:"soelim: can't open 'nonexistingfile': No such file or directory\n" \ + -s exit:1 \ + soelim $(atf_get_srcdir)/nonexisting.in + + cp $(atf_get_srcdir)/basic . + atf_check \ + -o file:$(atf_get_srcdir)/basic.out \ + -e empty \ + -s exit:0 \ + soelim $(atf_get_srcdir)/basic.in + + rm -f basic + atf_check \ + -o file:$(atf_get_srcdir)/basic.out \ + -e empty \ + -s exit:0 \ + soelim -I$(atf_get_srcdir) $(atf_get_srcdir)/basic.in +} + +atf_init_test_cases() +{ + atf_add_test_case stdin + atf_add_test_case files +}