summaryrefslogtreecommitdiffstats
path: root/usr.bin/xargs
diff options
context:
space:
mode:
authorjmmv <jmmv@FreeBSD.org>2014-03-16 08:04:06 +0000
committerjmmv <jmmv@FreeBSD.org>2014-03-16 08:04:06 +0000
commit41a8d8c29552ddd9098cfb09a71927f503a28371 (patch)
treea434fba265da51ef79b1cfc4461e1080dbe53e90 /usr.bin/xargs
parentb2e51e38a88412c17ce1160c247a6d673c0b2147 (diff)
downloadFreeBSD-src-41a8d8c29552ddd9098cfb09a71927f503a28371.zip
FreeBSD-src-41a8d8c29552ddd9098cfb09a71927f503a28371.tar.gz
Migrate most of tools/regression/usr.bin/ to the new tests layout.
I'm starting with the easy cases. The leftovers need to be looked at a bit more closely. Note that this change _does_ modify the code of the old tests. This is required in order to allow the code to locate the data files in the source directory instead of the current directory, because Kyua automatically changes the latter to a temporary directory. Also note that at least one test is known to be broken here. Actually, the test is not really broken: it's marked as a TODO but unfortunately Kyua's TAP parser currently does not understand that. Will have to be fixed separately.
Diffstat (limited to 'usr.bin/xargs')
-rw-r--r--usr.bin/xargs/Makefile6
-rw-r--r--usr.bin/xargs/tests/Makefile26
-rw-r--r--usr.bin/xargs/tests/legacy_test.sh6
-rw-r--r--usr.bin/xargs/tests/regress.0.inbin0 -> 86 bytes
-rw-r--r--usr.bin/xargs/tests/regress.0.out8
-rw-r--r--usr.bin/xargs/tests/regress.0I.out18
-rw-r--r--usr.bin/xargs/tests/regress.0J.out4
-rw-r--r--usr.bin/xargs/tests/regress.0L.out6
-rw-r--r--usr.bin/xargs/tests/regress.I.out4
-rw-r--r--usr.bin/xargs/tests/regress.J.out1
-rw-r--r--usr.bin/xargs/tests/regress.L.out2
-rw-r--r--usr.bin/xargs/tests/regress.R.out4
-rw-r--r--usr.bin/xargs/tests/regress.in4
-rw-r--r--usr.bin/xargs/tests/regress.n1.out8
-rw-r--r--usr.bin/xargs/tests/regress.n2.out4
-rw-r--r--usr.bin/xargs/tests/regress.n3.out3
-rw-r--r--usr.bin/xargs/tests/regress.normal.out1
-rw-r--r--usr.bin/xargs/tests/regress.quotes.in4
-rw-r--r--usr.bin/xargs/tests/regress.quotes.out7
-rw-r--r--usr.bin/xargs/tests/regress.sh21
20 files changed, 137 insertions, 0 deletions
diff --git a/usr.bin/xargs/Makefile b/usr.bin/xargs/Makefile
index 642e953..b627bf5 100644
--- a/usr.bin/xargs/Makefile
+++ b/usr.bin/xargs/Makefile
@@ -1,7 +1,13 @@
# @(#)Makefile 8.1 (Berkeley) 6/6/93
# $FreeBSD$
+.include <bsd.own.mk>
+
PROG= xargs
SRCS= xargs.c strnsubst.c
+.if ${MK_TESTS} != "no"
+SUBDIR+= tests
+.endif
+
.include <bsd.prog.mk>
diff --git a/usr.bin/xargs/tests/Makefile b/usr.bin/xargs/tests/Makefile
new file mode 100644
index 0000000..2004d79
--- /dev/null
+++ b/usr.bin/xargs/tests/Makefile
@@ -0,0 +1,26 @@
+# $FreeBSD$
+
+TESTSDIR= ${TESTSBASE}/usr.bin/xargs
+
+TAP_TESTS_SH= legacy_test
+
+FILESDIR= ${TESTSDIR}
+FILES= regress.0.in
+FILES+= regress.0.out
+FILES+= regress.0I.out
+FILES+= regress.0J.out
+FILES+= regress.0L.out
+FILES+= regress.I.out
+FILES+= regress.J.out
+FILES+= regress.L.out
+FILES+= regress.R.out
+FILES+= regress.in
+FILES+= regress.n1.out
+FILES+= regress.n2.out
+FILES+= regress.n3.out
+FILES+= regress.normal.out
+FILES+= regress.quotes.in
+FILES+= regress.quotes.out
+FILES+= regress.sh
+
+.include <bsd.test.mk>
diff --git a/usr.bin/xargs/tests/legacy_test.sh b/usr.bin/xargs/tests/legacy_test.sh
new file mode 100644
index 0000000..1b6b806
--- /dev/null
+++ b/usr.bin/xargs/tests/legacy_test.sh
@@ -0,0 +1,6 @@
+#!/bin/sh
+# $FreeBSD$
+
+SRCDIR="$(dirname "${0}")"; export SRCDIR
+
+m4 "${SRCDIR}/../regress.m4" "${SRCDIR}/regress.sh" | sh
diff --git a/usr.bin/xargs/tests/regress.0.in b/usr.bin/xargs/tests/regress.0.in
new file mode 100644
index 0000000..448ba53
--- /dev/null
+++ b/usr.bin/xargs/tests/regress.0.in
Binary files differ
diff --git a/usr.bin/xargs/tests/regress.0.out b/usr.bin/xargs/tests/regress.0.out
new file mode 100644
index 0000000..2bc9725
--- /dev/null
+++ b/usr.bin/xargs/tests/regress.0.out
@@ -0,0 +1,8 @@
+quick ' brown
+fox jumped
+over "the lazy
+dog
+quick brown fox
+jumped over the
+lazy dog
+
diff --git a/usr.bin/xargs/tests/regress.0I.out b/usr.bin/xargs/tests/regress.0I.out
new file mode 100644
index 0000000..16009c0
--- /dev/null
+++ b/usr.bin/xargs/tests/regress.0I.out
@@ -0,0 +1,18 @@
+The quick ' brown quick ' brownquick ' brown quick ' brown
+The fox jumped
+over "the lazy fox jumped
+over "the lazyfox jumped
+over "the lazy fox jumped
+over "the lazy
+The
+The dog
+quick brown fox dog
+quick brown foxdog
+quick brown fox dog
+quick brown fox
+The jumped over the jumped over thejumped over the jumped over the
+The lazy dog
+ lazy dog
+lazy dog
+ lazy dog
+
diff --git a/usr.bin/xargs/tests/regress.0J.out b/usr.bin/xargs/tests/regress.0J.out
new file mode 100644
index 0000000..69c87f9
--- /dev/null
+++ b/usr.bin/xargs/tests/regress.0J.out
@@ -0,0 +1,4 @@
+The quick ' brown fox jumped
+over "the lazy dog
+quick brown fox jumped over the lazy dog
+ again.
diff --git a/usr.bin/xargs/tests/regress.0L.out b/usr.bin/xargs/tests/regress.0L.out
new file mode 100644
index 0000000..2d13fcc
--- /dev/null
+++ b/usr.bin/xargs/tests/regress.0L.out
@@ -0,0 +1,6 @@
+quick ' brown fox jumped
+over "the lazy
+dog
+quick brown fox
+jumped over the lazy dog
+
diff --git a/usr.bin/xargs/tests/regress.I.out b/usr.bin/xargs/tests/regress.I.out
new file mode 100644
index 0000000..f2a6a1e
--- /dev/null
+++ b/usr.bin/xargs/tests/regress.I.out
@@ -0,0 +1,4 @@
+The quick brown quick brown quick brown quick brownquick brown quick brown %
+The fox jumped fox jumped fox jumped fox jumpedfox jumped fox jumped %
+The over the lazy over the lazy over the lazy over the lazyover the lazy over the lazy %
+The dog dog dog dogdog dog %
diff --git a/usr.bin/xargs/tests/regress.J.out b/usr.bin/xargs/tests/regress.J.out
new file mode 100644
index 0000000..b88a41e
--- /dev/null
+++ b/usr.bin/xargs/tests/regress.J.out
@@ -0,0 +1 @@
+The quick brown fox jumped over the lazy dog again.
diff --git a/usr.bin/xargs/tests/regress.L.out b/usr.bin/xargs/tests/regress.L.out
new file mode 100644
index 0000000..7359dee
--- /dev/null
+++ b/usr.bin/xargs/tests/regress.L.out
@@ -0,0 +1,2 @@
+quick brown fox jumped over the lazy
+dog
diff --git a/usr.bin/xargs/tests/regress.R.out b/usr.bin/xargs/tests/regress.R.out
new file mode 100644
index 0000000..6fe947f
--- /dev/null
+++ b/usr.bin/xargs/tests/regress.R.out
@@ -0,0 +1,4 @@
+The quick brown % % %% % %
+The fox jumped % % %% % %
+The over the lazy % % %% % %
+The dog % % %% % %
diff --git a/usr.bin/xargs/tests/regress.in b/usr.bin/xargs/tests/regress.in
new file mode 100644
index 0000000..5252b48
--- /dev/null
+++ b/usr.bin/xargs/tests/regress.in
@@ -0,0 +1,4 @@
+quick brown
+fox jumped
+over the lazy
+dog
diff --git a/usr.bin/xargs/tests/regress.n1.out b/usr.bin/xargs/tests/regress.n1.out
new file mode 100644
index 0000000..77ef6c5
--- /dev/null
+++ b/usr.bin/xargs/tests/regress.n1.out
@@ -0,0 +1,8 @@
+quick
+brown
+fox
+jumped
+over
+the
+lazy
+dog
diff --git a/usr.bin/xargs/tests/regress.n2.out b/usr.bin/xargs/tests/regress.n2.out
new file mode 100644
index 0000000..4fa3f55
--- /dev/null
+++ b/usr.bin/xargs/tests/regress.n2.out
@@ -0,0 +1,4 @@
+quick brown
+fox jumped
+over the
+lazy dog
diff --git a/usr.bin/xargs/tests/regress.n3.out b/usr.bin/xargs/tests/regress.n3.out
new file mode 100644
index 0000000..21b2c1e
--- /dev/null
+++ b/usr.bin/xargs/tests/regress.n3.out
@@ -0,0 +1,3 @@
+quick brown fox
+jumped over the
+lazy dog
diff --git a/usr.bin/xargs/tests/regress.normal.out b/usr.bin/xargs/tests/regress.normal.out
new file mode 100644
index 0000000..458d9cb
--- /dev/null
+++ b/usr.bin/xargs/tests/regress.normal.out
@@ -0,0 +1 @@
+The quick brown fox jumped over the lazy dog
diff --git a/usr.bin/xargs/tests/regress.quotes.in b/usr.bin/xargs/tests/regress.quotes.in
new file mode 100644
index 0000000..11388a0
--- /dev/null
+++ b/usr.bin/xargs/tests/regress.quotes.in
@@ -0,0 +1,4 @@
+a 'b "c' \'d
+e\ f "g ' h"
+i\
+j
diff --git a/usr.bin/xargs/tests/regress.quotes.out b/usr.bin/xargs/tests/regress.quotes.out
new file mode 100644
index 0000000..f79ad41
--- /dev/null
+++ b/usr.bin/xargs/tests/regress.quotes.out
@@ -0,0 +1,7 @@
+a
+b "c
+'d
+e f
+g ' h
+i
+j
diff --git a/usr.bin/xargs/tests/regress.sh b/usr.bin/xargs/tests/regress.sh
new file mode 100644
index 0000000..316365d
--- /dev/null
+++ b/usr.bin/xargs/tests/regress.sh
@@ -0,0 +1,21 @@
+# $FreeBSD$
+
+echo 1..13
+
+REGRESSION_START($1)
+
+REGRESSION_TEST(`normal', `xargs echo The <${SRCDIR}/regress.in')
+REGRESSION_TEST(`I', `xargs -I% echo The % % % %% % % <${SRCDIR}/regress.in')
+REGRESSION_TEST(`J', `xargs -J% echo The % again. <${SRCDIR}/regress.in')
+REGRESSION_TEST(`L', `xargs -L3 echo <${SRCDIR}/regress.in')
+REGRESSION_TEST(`R', `xargs -I% -R1 echo The % % % %% % % <${SRCDIR}/regress.in')
+REGRESSION_TEST(`n1', `xargs -n1 echo <${SRCDIR}/regress.in')
+REGRESSION_TEST(`n2', `xargs -n2 echo <${SRCDIR}/regress.in')
+REGRESSION_TEST(`n3', `xargs -n3 echo <${SRCDIR}/regress.in')
+REGRESSION_TEST(`0', `xargs -0 -n1 echo <${SRCDIR}/regress.0.in')
+REGRESSION_TEST(`0I', `xargs -0 -I% echo The % %% % <${SRCDIR}/regress.0.in')
+REGRESSION_TEST(`0J', `xargs -0 -J% echo The % again. <${SRCDIR}/regress.0.in')
+REGRESSION_TEST(`0L', `xargs -0 -L2 echo <${SRCDIR}/regress.0.in')
+REGRESSION_TEST(`quotes', `xargs -n1 echo <${SRCDIR}/regress.quotes.in')
+
+REGRESSION_END()
OpenPOWER on IntegriCloud