summaryrefslogtreecommitdiffstats
path: root/usr.bin/file2c/tests
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/file2c/tests
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/file2c/tests')
-rw-r--r--usr.bin/file2c/tests/Makefile20
-rw-r--r--usr.bin/file2c/tests/legacy_test.sh6
-rw-r--r--usr.bin/file2c/tests/regress.1.out1
-rw-r--r--usr.bin/file2c/tests/regress.2.out3
-rw-r--r--usr.bin/file2c/tests/regress.3.out5
-rw-r--r--usr.bin/file2c/tests/regress.4.out4
-rw-r--r--usr.bin/file2c/tests/regress.5.out1
-rw-r--r--usr.bin/file2c/tests/regress.6.out9
-rw-r--r--usr.bin/file2c/tests/regress.7.out8
-rw-r--r--usr.bin/file2c/tests/regress.8.out4
-rw-r--r--usr.bin/file2c/tests/regress.9.out104
-rw-r--r--usr.bin/file2c/tests/regress.inbin0 -> 2048 bytes
-rw-r--r--usr.bin/file2c/tests/regress.sh19
13 files changed, 184 insertions, 0 deletions
diff --git a/usr.bin/file2c/tests/Makefile b/usr.bin/file2c/tests/Makefile
new file mode 100644
index 0000000..8854eb4
--- /dev/null
+++ b/usr.bin/file2c/tests/Makefile
@@ -0,0 +1,20 @@
+# $FreeBSD$
+
+TESTSDIR= ${TESTSBASE}/usr.bin/file2c
+
+TAP_TESTS_SH= legacy_test
+
+FILESDIR= ${TESTSDIR}
+FILES= regress.1.out
+FILES+= regress.2.out
+FILES+= regress.3.out
+FILES+= regress.4.out
+FILES+= regress.5.out
+FILES+= regress.6.out
+FILES+= regress.7.out
+FILES+= regress.8.out
+FILES+= regress.9.out
+FILES+= regress.in
+FILES+= regress.sh
+
+.include <bsd.test.mk>
diff --git a/usr.bin/file2c/tests/legacy_test.sh b/usr.bin/file2c/tests/legacy_test.sh
new file mode 100644
index 0000000..1b6b806
--- /dev/null
+++ b/usr.bin/file2c/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/file2c/tests/regress.1.out b/usr.bin/file2c/tests/regress.1.out
new file mode 100644
index 0000000..6b760fe
--- /dev/null
+++ b/usr.bin/file2c/tests/regress.1.out
@@ -0,0 +1 @@
+175,212,59,239,227,234,192,22,186,113,52,204,195
diff --git a/usr.bin/file2c/tests/regress.2.out b/usr.bin/file2c/tests/regress.2.out
new file mode 100644
index 0000000..07acb21
--- /dev/null
+++ b/usr.bin/file2c/tests/regress.2.out
@@ -0,0 +1,3 @@
+PREFIX
+175,212,59,239,227,234,192,22,186,113,52,204,195,81,240,223,173,115,109,
+102,175,183,24,185,173,137
diff --git a/usr.bin/file2c/tests/regress.3.out b/usr.bin/file2c/tests/regress.3.out
new file mode 100644
index 0000000..55502df
--- /dev/null
+++ b/usr.bin/file2c/tests/regress.3.out
@@ -0,0 +1,5 @@
+PREFIX
+175,212,59,239,227,234,192,22,186,113,52,204,195,81,240,223,173,115,109,
+102,175,183,24,185,173,137,107,116,77,142,217,172,196,45,62,228,41,174,
+134
+SUFFIX
diff --git a/usr.bin/file2c/tests/regress.4.out b/usr.bin/file2c/tests/regress.4.out
new file mode 100644
index 0000000..dc21fd0
--- /dev/null
+++ b/usr.bin/file2c/tests/regress.4.out
@@ -0,0 +1,4 @@
+0xaf,0xd4,0x3b,0xef,0xe3,0xea,0xc0,0x16,0xba,0x71,0x34,0xcc,0xc3,0x51,0xf0,
+0xdf,0xad,0x73,0x6d,0x66,0xaf,0xb7,0x18,0xb9,0xad,0x89,0x6b,0x74,0x4d,0x8e,
+0xd9,0xac,0xc4,0x2d,0x3e,0xe4,0x29,0xae,0x86,0x36,0xbb,0xe7,0x35,0x7c,0x92,
+0x88,0xcb,0x34,0x5b,0xae,0xd4,0x73
diff --git a/usr.bin/file2c/tests/regress.5.out b/usr.bin/file2c/tests/regress.5.out
new file mode 100644
index 0000000..8210ab5
--- /dev/null
+++ b/usr.bin/file2c/tests/regress.5.out
@@ -0,0 +1 @@
+175,212,59,239,227,234,192,22,186,113,52,204,195,81,240,223,173,115,109,102,175,183,24,185,173,137,107,116,77,142,217,172,196,45,62,228,41,174,134,54,187,231,53,124,146,136,203,52,91,174,212,115,254,86,214,31,196,19,159,213,217,170,247,32,69
diff --git a/usr.bin/file2c/tests/regress.6.out b/usr.bin/file2c/tests/regress.6.out
new file mode 100644
index 0000000..0f2bb74
--- /dev/null
+++ b/usr.bin/file2c/tests/regress.6.out
@@ -0,0 +1,9 @@
+P
+175,
+212,
+59,
+239,
+227,
+234,
+192
+S
diff --git a/usr.bin/file2c/tests/regress.7.out b/usr.bin/file2c/tests/regress.7.out
new file mode 100644
index 0000000..f94ac55
--- /dev/null
+++ b/usr.bin/file2c/tests/regress.7.out
@@ -0,0 +1,8 @@
+P S
+0xaf,0xd4,
+0x3b,0xef,
+0xe3,0xea,
+0xc0,0x16,
+0xba,0x71,
+0x34,0xcc,
+0xc3,0x51
diff --git a/usr.bin/file2c/tests/regress.8.out b/usr.bin/file2c/tests/regress.8.out
new file mode 100644
index 0000000..5f5ce9d
--- /dev/null
+++ b/usr.bin/file2c/tests/regress.8.out
@@ -0,0 +1,4 @@
+P
+175,212,59,239,227,234,192,22,186,113,52,204,195,81,240,223,
+173,115,109,102,175
+-x
diff --git a/usr.bin/file2c/tests/regress.9.out b/usr.bin/file2c/tests/regress.9.out
new file mode 100644
index 0000000..91f5e00
--- /dev/null
+++ b/usr.bin/file2c/tests/regress.9.out
@@ -0,0 +1,104 @@
+const char data[] = {
+175,212,59,239,227,234,192,22,186,113,52,204,195,81,240,223,173,115,109,
+102,175,183,24,185,173,137,107,116,77,142,217,172,196,45,62,228,41,174,
+134,54,187,231,53,124,146,136,203,52,91,174,212,115,254,86,214,31,196,19,
+159,213,217,170,247,32,69,15,231,52,136,125,195,84,63,231,94,73,173,8,93,
+21,246,118,130,218,200,68,1,213,178,88,162,39,161,153,54,177,161,114,188,
+55,163,166,158,218,151,163,44,7,42,25,221,143,194,40,129,228,100,128,87,
+22,76,210,109,149,64,61,169,252,1,10,61,78,17,233,29,222,247,155,156,34,
+151,186,171,39,111,169,87,194,186,102,95,11,205,207,209,111,83,167,166,
+29,172,60,135,178,208,166,219,38,228,105,200,239,180,184,232,11,1,81,233,
+107,45,73,109,94,17,10,51,91,47,89,38,253,42,224,111,143,244,243,132,225,
+236,187,30,9,241,233,210,161,200,236,249,21,197,176,161,185,240,15,155,
+73,244,186,255,214,180,122,15,206,205,35,217,58,112,50,82,199,35,150,232,
+96,54,67,77,248,243,17,96,131,221,212,44,236,137,88,213,20,21,87,89,238,
+199,156,82,77,167,123,2,92,199,167,190,74,59,80,50,196,105,153,40,27,93,
+170,194,85,110,39,185,21,155,221,105,44,156,220,30,29,17,220,26,54,30,167,
+42,77,239,74,240,203,94,63,221,148,49,14,107,117,66,1,105,243,79,165,175,
+174,213,130,57,187,168,91,229,107,49,55,120,144,120,93,89,120,60,127,84,
+152,194,184,102,115,33,8,221,63,46,181,152,83,62,45,231,162,173,228,103,
+103,116,248,51,141,21,236,8,30,123,30,234,59,188,86,232,101,106,153,116,
+200,64,175,52,18,186,152,60,255,171,132,173,173,176,60,246,21,85,51,240,
+237,224,250,22,33,89,89,204,108,107,121,119,120,215,207,179,181,142,127,
+78,131,95,195,100,48,166,135,170,195,247,111,185,202,47,151,74,62,32,174,
+242,230,104,193,252,28,115,187,212,110,41,39,170,27,167,229,36,31,192,214,
+209,35,149,83,44,7,74,16,6,162,164,171,21,48,68,19,137,29,115,225,31,97,
+226,39,220,241,118,3,172,249,17,144,45,171,247,34,124,160,136,171,7,165,
+127,186,207,150,30,115,162,6,75,153,114,65,146,59,93,162,184,197,81,160,
+173,244,205,8,84,76,85,214,195,73,70,6,38,135,198,111,48,242,129,24,202,
+183,227,77,62,92,136,58,149,235,155,34,100,63,248,185,247,103,12,117,135,
+218,116,114,185,35,11,178,217,192,11,184,239,201,107,24,187,32,183,149,
+180,103,191,36,72,152,129,204,108,46,14,187,236,222,134,28,158,81,41,15,
+83,148,165,165,16,50,134,119,162,211,103,6,28,182,225,13,67,165,25,110,
+51,141,158,80,112,27,2,163,34,96,55,223,171,108,115,119,191,29,45,48,176,
+93,63,123,252,132,121,238,116,180,217,185,178,213,86,194,197,122,13,159,
+70,109,151,247,182,134,65,76,155,189,174,220,28,38,253,222,56,102,50,221,
+183,255,234,113,240,24,149,76,227,18,188,10,201,110,148,51,108,253,37,32,
+192,136,135,149,253,77,23,99,213,12,35,25,219,234,9,251,145,90,23,111,223,
+251,54,16,217,91,116,214,175,95,87,116,228,191,226,227,72,67,72,227,52,
+91,237,107,6,20,30,67,179,215,177,9,138,235,14,83,23,37,127,111,36,122,
+165,179,81,247,230,81,106,89,85,62,188,48,49,122,155,172,71,129,167,98,
+25,108,23,89,100,251,85,108,114,163,179,40,40,129,67,78,165,71,126,55,35,
+108,168,86,141,242,16,178,196,234,255,243,10,170,84,201,160,243,153,12,
+246,112,87,172,229,154,154,231,225,154,62,78,50,100,211,194,225,50,14,134,
+198,5,48,174,154,213,62,249,2,77,18,179,154,27,244,32,44,73,74,150,48,103,
+186,212,126,48,213,41,240,21,209,94,239,111,157,235,120,194,179,15,45,110,
+74,114,107,248,124,221,42,1,248,115,14,20,76,219,51,178,87,83,74,81,179,
+10,188,233,36,90,123,175,106,85,72,85,247,247,150,22,127,238,219,156,230,
+141,108,80,92,226,205,250,61,57,23,128,120,138,195,61,50,48,40,89,57,0,
+108,138,179,29,182,118,58,232,220,199,228,56,184,194,86,244,239,16,198,
+172,248,114,100,209,210,74,246,210,215,83,149,65,151,36,215,64,148,13,198,
+151,160,109,43,109,176,149,187,55,216,239,227,157,71,1,137,235,100,30,155,
+160,6,153,19,17,57,45,17,211,240,230,117,98,228,16,148,211,217,183,210,
+224,126,134,129,133,59,238,108,128,55,9,53,63,209,219,15,241,210,179,126,
+209,237,226,31,168,14,244,84,15,178,156,207,52,183,238,75,46,198,222,199,
+187,122,236,157,216,200,186,206,232,178,139,180,48,172,179,64,255,173,117,
+56,187,111,51,164,176,81,74,18,223,195,241,215,110,118,170,10,85,42,118,
+207,167,76,52,10,223,217,199,21,148,132,227,122,89,95,50,196,35,113,250,
+140,131,221,33,214,61,172,16,167,189,85,183,33,99,28,255,105,45,230,252,
+78,58,141,63,233,184,227,150,177,23,124,88,77,152,224,53,47,208,156,141,
+227,80,76,93,97,205,63,126,216,128,43,234,86,241,35,225,209,53,194,40,228,
+135,97,224,135,136,209,172,124,127,193,198,125,70,219,251,134,56,110,128,
+134,235,20,184,170,1,178,173,176,236,18,79,83,60,110,117,154,242,5,254,
+212,231,224,203,236,117,245,92,109,193,45,187,32,223,184,174,68,68,7,21,
+83,150,227,254,117,189,137,53,47,194,235,84,106,158,96,253,148,233,20,219,
+47,195,115,90,131,219,109,94,179,197,153,117,170,201,115,217,52,34,242,
+177,36,163,172,89,31,237,128,202,79,206,95,232,250,245,250,248,85,205,18,
+42,255,89,27,253,151,196,70,111,223,210,133,43,141,220,38,164,115,97,253,
+143,14,110,111,161,180,120,180,10,67,159,159,131,78,250,171,117,254,102,
+180,19,191,64,121,234,124,209,6,99,115,126,62,6,180,117,63,96,47,252,91,
+238,92,31,161,23,148,54,247,17,114,8,109,120,173,236,230,16,160,52,172,
+135,100,28,109,74,112,236,30,120,44,179,241,226,128,86,36,25,43,0,131,174,
+39,71,145,42,145,57,134,49,119,186,21,71,227,7,143,23,129,207,212,68,86,
+189,223,128,210,13,244,134,154,21,247,229,135,56,126,130,64,24,129,97,170,
+179,60,2,251,235,7,146,54,168,51,205,241,176,243,18,112,166,154,11,185,
+34,2,74,34,112,80,194,44,31,79,148,22,126,184,143,164,65,185,118,97,137,
+197,195,71,201,124,30,189,16,222,168,96,21,114,25,135,66,61,52,196,6,103,
+156,174,43,155,156,146,168,129,221,31,38,17,84,177,13,182,35,86,148,68,
+216,182,162,189,162,229,124,99,43,181,175,191,21,89,116,76,18,120,112,167,
+160,199,230,54,159,75,205,231,34,123,227,122,40,228,137,194,91,15,83,32,
+161,238,160,158,81,254,235,51,181,128,169,77,75,128,9,221,244,167,92,168,
+132,102,155,20,17,0,115,64,13,198,187,22,66,80,133,155,139,35,77,184,50,
+31,108,46,113,132,129,105,10,38,109,158,217,152,252,106,137,70,214,109,
+142,23,193,78,47,157,63,199,246,92,213,249,158,193,196,65,53,159,48,43,
+139,17,210,33,122,153,199,184,146,155,64,139,233,170,2,81,2,116,140,134,
+148,214,138,6,54,223,45,254,180,208,72,255,191,65,129,138,27,28,48,41,125,
+203,72,62,184,117,59,124,59,156,127,22,130,200,25,188,17,87,87,71,180,203,
+126,37,171,228,197,213,193,24,95,185,8,33,6,135,150,88,215,49,121,249,249,
+126,93,145,33,48,231,203,214,171,53,189,190,186,69,74,78,226,152,46,73,
+97,132,93,57,243,62,8,23,160,48,143,26,243,244,69,223,70,9,4,61,104,204,
+57,82,28,232,205,45,164,252,49,24,192,241,200,120,32,90,181,153,234,105,
+124,201,101,91,145,121,236,41,0,73,54,204,145,93,72,105,203,59,118,155,
+173,58,37,137,45,50,207,33,83,188,236,149,223,23,55,24,140,220,235,248,
+224,145,15,225,11,88,85,101,138,235,92,38,59,58,179,203,8,44,28,225,1,147,
+217,197,33,237,115,216,55,178,154,74,207,199,158,198,39,180,203,103,52,
+132,48,98,243,121,32,210,6,119,180,225,230,79,227,207,190,151,119,209,155,
+216,34,156,47,179,133,184,77,108,199,243,170,14,43,166,203,191,43,209,144,
+37,246,211,139,52,133,37,75,31,6,103,246,112,230,134,120,239,33,136,82,
+40,158,0,11,62,156,209,141,170,166,191,34,201,17,115,227,161,89,21,53,200,
+239,123,153,200,115,87,10,4,203,69,132,33,245,27,237,253,86,90,38,51,139,
+117,223,46,112,206,251,91,230,219,203,46,194,226,218,192,8,24,104,111,102,
+55,241,73,26,49,35,15,35,55,48,3,151,212,63,105,195,186,42,7,221,56,14,
+122,92,188,17,179,185,199,165,231,154,149,231,102,135,64,192,7,54,233,13,
+191,88,180,161,11,154,175
+, 0};
diff --git a/usr.bin/file2c/tests/regress.in b/usr.bin/file2c/tests/regress.in
new file mode 100644
index 0000000..405465a
--- /dev/null
+++ b/usr.bin/file2c/tests/regress.in
Binary files differ
diff --git a/usr.bin/file2c/tests/regress.sh b/usr.bin/file2c/tests/regress.sh
new file mode 100644
index 0000000..c8146e7
--- /dev/null
+++ b/usr.bin/file2c/tests/regress.sh
@@ -0,0 +1,19 @@
+# $FreeBSD$
+
+echo 1..9
+
+REGRESSION_START($1)
+
+REGRESSION_TEST(`1', `head -c 13 ${SRCDIR}/regress.in | file2c')
+REGRESSION_TEST(`2', `head -c 26 ${SRCDIR}/regress.in | file2c PREFIX')
+REGRESSION_TEST(`3', `head -c 39 ${SRCDIR}/regress.in | file2c PREFIX SUFFIX')
+REGRESSION_TEST(`4', `head -c 52 ${SRCDIR}/regress.in | file2c -x')
+REGRESSION_TEST(`5', `head -c 65 ${SRCDIR}/regress.in | file2c -n -1')
+
+REGRESSION_TEST(`6', `head -c 7 ${SRCDIR}/regress.in | file2c -n 1 P S')
+REGRESSION_TEST(`7', `head -c 14 ${SRCDIR}/regress.in | file2c -n 2 -x "P S"')
+REGRESSION_TEST(`8', `head -c 21 ${SRCDIR}/regress.in | file2c -n 16 P -x S')
+
+REGRESSION_TEST(`9', `file2c "const char data[] = {" ", 0};" <${SRCDIR}/regress.in')
+
+REGRESSION_END()
OpenPOWER on IntegriCloud