Module Name:    othersrc
Committed By:   agc
Date:           Tue May 31 20:26:58 UTC 2016

Modified Files:
        othersrc/external/bsd/human2atf: Testspec.template human2atf.1
            human2atf.sh

Log Message:
Add the ability to provide gzip(1) encoding of large input and expected
output files in the generated test scripts.


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 othersrc/external/bsd/human2atf/Testspec.template \
    othersrc/external/bsd/human2atf/human2atf.1 \
    othersrc/external/bsd/human2atf/human2atf.sh

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: othersrc/external/bsd/human2atf/Testspec.template
diff -u othersrc/external/bsd/human2atf/Testspec.template:1.1 othersrc/external/bsd/human2atf/Testspec.template:1.2
--- othersrc/external/bsd/human2atf/Testspec.template:1.1	Sun May 29 20:47:56 2016
+++ othersrc/external/bsd/human2atf/Testspec.template	Tue May 31 20:26:58 2016
@@ -1,6 +1,6 @@
 #! /bin/sh
 
-# $NetBSD: Testspec.template,v 1.1 2016/05/29 20:47:56 agc Exp $
+# $NetBSD: Testspec.template,v 1.2 2016/05/31 20:26:58 agc Exp $
 
 # Copyright (c) 2016 Alistair Crooks <[email protected]>
 # All rights reserved.
@@ -46,7 +46,10 @@ TESTSET_2_FILES='
 4.expected
 5.in
 5.expected
+6.in:gzip
+6.expected:gzip
 '
 TESTSET_2_CASE_1="-s eq:0 -o file:3.expected -e empty b2e < 3.in"
 TESTSET_2_CASE_2="-s eq:0 -o file:4.expected -e empty b2e < 4.in"
 DISABLE_TESTSET_2_CASE_3="-s eq:0 -o file:5.expected -e empty b2e < 5.in"
+TESTSET_2_CASE_4="-s eq:0 -o file:6.expected -e empty b2e < 6.in"
Index: othersrc/external/bsd/human2atf/human2atf.1
diff -u othersrc/external/bsd/human2atf/human2atf.1:1.1 othersrc/external/bsd/human2atf/human2atf.1:1.2
--- othersrc/external/bsd/human2atf/human2atf.1:1.1	Sun May 29 20:47:56 2016
+++ othersrc/external/bsd/human2atf/human2atf.1	Tue May 31 20:26:58 2016
@@ -1,4 +1,4 @@
-.\" $NetBSD: human2atf.1,v 1.1 2016/05/29 20:47:56 agc Exp $
+.\" $NetBSD: human2atf.1,v 1.2 2016/05/31 20:26:58 agc Exp $
 .\"
 .\" Copyright (c) 2016 Alistair Crooks <[email protected]>
 .\" All rights reserved.
@@ -23,7 +23,7 @@
 .\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
 .\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 .\"
-.Dd May 29, 2016
+.Dd May 31, 2016
 .Dt HUMAN2ATF 1
 .Os
 .Sh NAME
@@ -55,6 +55,18 @@ of the default file, which is named
 Perform operations in a verbose manner (useful for debugging)
 .El
 .Pp
+The generated shell script contains the ATF commands to run the test.
+It includes a list of the files used for input to commands,
+and for files containing expected output.
+Files are encoded in the test script using base64 encoding provided by
+.Xr uuencode 1 .
+Sometimes these files can be large. For this reason, on the fly
+.Xr gzip 1
+compression has been enabled, and is activated by using
+a suffix of
+.Dq :gzip
+when specifying the files.
+.Pp
 .Sh RETURN VALUES
 The
 .Nm
@@ -62,7 +74,7 @@ utility will return 0 for success,
 and non-zero for failure.
 .Sh EXAMPLES
 .Bd -literal
-% ./human2atf.sh -f Testspec2
+% human2atf -f Testspec2
 Generating Makefile for b2e tests as tests-Makefile
 Generating test harness t_b2e.sh for b2e
 % sudo cp t_b2e.sh =1
@@ -108,6 +120,8 @@ Summary for 1 test programs:
 %
 .Ed
 .Sh SEE ALSO
+.Xr gzip 1 ,
+.Xr uuencode 1 ,
 .Xr atf 7
 .Sh HISTORY
 The
Index: othersrc/external/bsd/human2atf/human2atf.sh
diff -u othersrc/external/bsd/human2atf/human2atf.sh:1.1 othersrc/external/bsd/human2atf/human2atf.sh:1.2
--- othersrc/external/bsd/human2atf/human2atf.sh:1.1	Sun May 29 20:47:56 2016
+++ othersrc/external/bsd/human2atf/human2atf.sh	Tue May 31 20:26:58 2016
@@ -1,6 +1,6 @@
 #! /bin/sh
 
-# $NetBSD: human2atf.sh,v 1.1 2016/05/29 20:47:56 agc Exp $
+# $NetBSD: human2atf.sh,v 1.2 2016/05/31 20:26:58 agc Exp $
 
 # Copyright (c) 2016 Alistair Crooks <[email protected]>
 # All rights reserved.
@@ -143,13 +143,28 @@ ${TESTNAME}_testset_${setnum}_${setname}
 human2atf_EOF
 	eval filelist=\$TESTSET_${setnum}_FILES
 	for f in ${filelist}; do
+		comp=""
+		case "${f}" in
+		*:gzip)	comp=.gz
+			f=${f%:gzip}
+			;;
+		esac
 		if [ ! -f ${f} ]; then
 			echo "File ${f} not found" >&2
 			continue
 		fi
 		echo "	uudecode << EOF" >> ${output}
-		uuencode -m ${f} ${f} >> ${output}
+		case "${comp}" in
+		"")	uuencode -m ${f} ${f} >> ${output}
+			;;
+		.gz)	gzip -9 -c ${f} | uuencode -m ${f}${comp} >> ${output}
+			;;
+		esac
 		echo EOF >> ${output}
+		case "${comp}" in
+		.gz)	echo "  gunzip ${f}${comp}" >> ${output}
+			;;
+		esac
 	done
 	casenum=1
 	while true; do

Reply via email to