Switch over to a different, more flexible test output protocol that's
understood by Perl's Test::Harness module and prove(1) commands. Update README to describe the new protocol. The work's broken down into two main sets of changes. First, update the existing test programs (shell scripts and C programs) to produce output in the ok/not ok format, and to, where possible, also produce a header describing the number of tests that are expected to be run. Second, provide the .t files that actually run the tests. In some cases these are copies of, or very similar too, scripts that already existed. I've kept the old scripts around so that it's possible to verify that behaviour under this new system (in terms of whether or not a test fails) is identical to the behaviour under the old system. Add a TODO file.
This commit is contained in:
parent
6e5bd296a6
commit
3e959a33f9
@ -19,49 +19,36 @@ DATA1:= ${DATA5:S/l/r/g}
|
||||
NIL=
|
||||
|
||||
all:
|
||||
@echo "Running test variables"
|
||||
@echo '1..14'
|
||||
@echo 1:${DATA1} 2:${DATA2} 3:${DATA3} 4:${DATA4} 5:${DATA5} | \
|
||||
diff -u ${.CURDIR}/regress.variables.out - || ${MAKE} failure
|
||||
@echo "PASS: Test variables detected no regression, output matches."
|
||||
@echo "Running test targets"
|
||||
@echo "ok 1 - test_variables # Test variables detected no regression, output matches."
|
||||
@${MAKE} double 2>/dev/null || ${MAKE} failure
|
||||
@echo "PASS: Test targets detected no regression."
|
||||
@echo "Running test sysvmatch"
|
||||
@echo "ok 2 - test_targets # Test targets detected no regression."
|
||||
@${MAKE} sysvmatch || ${MAKE} failure
|
||||
@echo "PASS: Test sysvmatch detected no regression."
|
||||
@echo "Running test lhs_expn"
|
||||
@echo "ok 3 - sysvmatch # Test sysvmatch detected no regression."
|
||||
@! ${MAKE} lhs_expn && true || ${MAKE} failure
|
||||
@echo "PASS: Test lhs_expn detected no regression."
|
||||
@echo "Running test notdef"
|
||||
@echo "ok 4 lhs_expn # Test lhs_expn detected no regression."
|
||||
@${MAKE} notdef || ${MAKE} failure
|
||||
@echo "PASS: Test notdef detected no regression."
|
||||
@echo "Running test modifiers"
|
||||
@echo "ok 5 - notdef # Test notdef detected no regression."
|
||||
@${MAKE} modifiers || ${MAKE} failure
|
||||
@echo "PASS: Test modifiers detected no regression."
|
||||
@echo "Running test funny_targets"
|
||||
@echo "ok 6 - modifiers # Test modifiers detected no regression."
|
||||
@${MAKE} funny_targets || ${MAKE} failure
|
||||
@echo "PASS: Test funny_targets detected no regression."
|
||||
@echo "Running test arith_expr"
|
||||
@echo "ok 7 funny_targets # Test funny_targets detected no regression."
|
||||
@${MAKE} arith_expr || ${MAKE} failure
|
||||
@echo "PASS: Test arith_expr detected no regression."
|
||||
@echo "Running test PATH_exists"
|
||||
@echo "ok 8 arith_expr # Test arith_expr detected no regression."
|
||||
@${MAKE} PATH_exists || ${MAKE} failure
|
||||
@echo "PASS: Test PATH_exists detected no regression."
|
||||
@echo "Running test double_quotes"
|
||||
@echo "ok 9 PATH_exists # Test PATH_exists detected no regression."
|
||||
@${MAKE} double_quotes || ${MAKE} failure
|
||||
@echo "PASS: Test double_quotes detected no regression."
|
||||
@echo "Running test double_quotes2"
|
||||
@echo "ok 10 double_quotes # Test double_quotes detected no regression."
|
||||
@! ${MAKE} double_quotes2 >/dev/null 2>&1 && true || ${MAKE} failure
|
||||
@echo "PASS: Test double_quotes2 detected no regression."
|
||||
@echo "Running test pass_cmd_vars"
|
||||
@echo "ok 11 double_quotes2 # Test double_quotes2 detected no regression."
|
||||
@${MAKE} pass_cmd_vars || ${MAKE} failure
|
||||
@echo "PASS: Test pass_cmd_vars detected no regression."
|
||||
@echo "Running test plus_flag"
|
||||
@echo "ok 12 pass_cmd_vars # Test pass_cmd_vars detected no regression."
|
||||
@${MAKE} plus_flag || ${MAKE} failure
|
||||
@echo "PASS: Test plus_flag detected no regression."
|
||||
@echo "Running test shell"
|
||||
@echo "ok 13 plus_flag # Test plus_flag detected no regression."
|
||||
@! ${MAKE} shell >/dev/null 2>&1 && true || ${MAKE} failure
|
||||
@echo "PASS: Test shell detected no regression."
|
||||
@echo "ok 14 shell # Test shell detected no regression."
|
||||
|
||||
.if make(double)
|
||||
# Doubly-defined targets. make(1) will warn, but use the "right" one. If it
|
||||
@ -247,5 +234,5 @@ shell:
|
||||
.endif
|
||||
|
||||
failure:
|
||||
@echo "FAIL: Test failed: regression detected. See above."
|
||||
@echo "not ok # Test failed: regression detected. See above."
|
||||
@false
|
||||
|
5
tools/build/make_check/regress.t
Normal file
5
tools/build/make_check/regress.t
Normal file
@ -0,0 +1,5 @@
|
||||
#!/bin/sh
|
||||
# $FreeBSD$
|
||||
|
||||
cd `dirname $0`
|
||||
make all
|
@ -5,16 +5,63 @@ This directory is for regression test programs.
|
||||
A regression test program is one that will exercise a particular bit of the
|
||||
system to check that we have not reintroduced an old bug.
|
||||
|
||||
Tests should be implemented in files with a .t extension. Each .t file
|
||||
can contain more than one test, and can be implemented in any scripting
|
||||
language -- /bin/sh, Perl...
|
||||
|
||||
The test protocol is quite simple. At its most basic, each .t file should,
|
||||
when run, print a line in this format:
|
||||
|
||||
1..m
|
||||
|
||||
where m is the number of tests that will be run.
|
||||
|
||||
Each test should produce a single line of output. This line should start
|
||||
with one of
|
||||
|
||||
ok n
|
||||
not ok n
|
||||
|
||||
to indicate whether or not the test succeeded. 'n' is the test's number.
|
||||
Anything after this on the line (up to the first '#' if present) is
|
||||
considered to be the name of the test. Naming tests is optional, but
|
||||
encouraged.
|
||||
|
||||
A test may be written which is conditional, and may need to be skipped.
|
||||
For example, the netatalk tests require 'options NETATALK' in the kernel.
|
||||
A test may be skipped by printing '# skip Reason for skipping' after the
|
||||
test name. For example,
|
||||
|
||||
ok 1 - netatalk # skip 'options NETATALK' not compiled in
|
||||
|
||||
A test may be flagged as 'todo'. This indicates that you expect the test
|
||||
to fail (perhaps because the necessary functionality hasn't been written
|
||||
yet). 'todo' tests are expected to fail, so when they start working the
|
||||
test framework can alert you to this happy occurence. Flag these tests
|
||||
with a '# TODO' comment after the test name
|
||||
|
||||
not ok 1 - infiniteloop # TODO write test for an infinite loop
|
||||
|
||||
This is modelled on the protocol followed by the Test::Harness Perl
|
||||
module (and therefore much of the automated testing carried out by the
|
||||
Perl community). More documentation can be found at:
|
||||
|
||||
http://search.cpan.org/~petdance/Test-Harness-2.42/lib/Test/Harness.pm
|
||||
|
||||
To run the tests and parse their output install the devel/p5-Test-Harness
|
||||
port. This includes the prove(1) command which is used to run the tests
|
||||
and collate the output.
|
||||
|
||||
prove geom_concat # run all the tests in geom_concat
|
||||
prove -r lib # run all tests in lib/, and subdirectories
|
||||
prove -r -v lib # as above, with verbose output
|
||||
prove -r # run *all* the tests
|
||||
|
||||
Tests that are for parts of the base system should go into a directory here
|
||||
which is the same as their path relative to src/, for example the uuencode(1)
|
||||
utility resides in src/usr.bin/uuencode so its regression test resides in
|
||||
src/tools/regression/usr.bin/uuencode.
|
||||
|
||||
Base system regression tests should prefix their test results with 'PASS' or
|
||||
'FAIL' accordingly, to make checking for failed tests easier. For now the
|
||||
tests are very free-form, and it's up to you to do that. Eventually, it
|
||||
should be a part of the regression test framework.
|
||||
|
||||
Please make a subdir per other regression test, and add a brief description to
|
||||
this file.
|
||||
|
||||
|
38
tools/regression/TODO
Normal file
38
tools/regression/TODO
Normal file
@ -0,0 +1,38 @@
|
||||
$FreeBSD$
|
||||
---
|
||||
|
||||
A lot of the tests written in C use assert(), only printing 'ok' at the end
|
||||
of the program if none of the assert()s fired.
|
||||
|
||||
This is wrong. They should do the test outside of an assert(), and print
|
||||
'ok' or 'not ok' as appropriate, instead of bailing out part way through.
|
||||
That way if a test starts failing we'll know exactly which one failed, and
|
||||
the other tests can continue.
|
||||
|
||||
This probably means a simple libtest.so that they can link against to
|
||||
provide an ok() function (the non-fatal assert), probably with some helper
|
||||
functions to keep track of test numbers and so on.
|
||||
|
||||
---
|
||||
|
||||
Any of the tests written in C should link against the libraries under
|
||||
/usr/obj rather than using the system libraries.
|
||||
|
||||
---
|
||||
|
||||
Not everything's been converted to the new style. In particular;
|
||||
|
||||
atm/
|
||||
ccd/
|
||||
some of geom_*/
|
||||
some of netinet/
|
||||
nfsmmap/
|
||||
p1003_1b/
|
||||
some of pipe/
|
||||
security/
|
||||
some of sockets/
|
||||
tls/
|
||||
|
||||
needs to be converted. And fsx/ and gaithrstress/ are (I think) standalone
|
||||
programs rather than individual tests, so aren't amenable to this sort of
|
||||
conversion.
|
50
tools/regression/geom/RunTest.t
Normal file
50
tools/regression/geom/RunTest.t
Normal file
@ -0,0 +1,50 @@
|
||||
#!/bin/sh
|
||||
# $FreeBSD$
|
||||
|
||||
MD=34
|
||||
TMP=/tmp/$$
|
||||
|
||||
set -e
|
||||
|
||||
# Start from the right directory so we can find all our data files.
|
||||
cd `dirname $0`
|
||||
|
||||
(cd MdLoad && make) > /dev/null 2>&1
|
||||
|
||||
# Print the test header
|
||||
echo -n '1..'
|
||||
echo `ls -1 Data/disk.*.xml | wc -l`
|
||||
|
||||
for f in Data/disk.*.xml
|
||||
do
|
||||
b=`basename $f`
|
||||
mdconfig -d -u $MD > /dev/null 2>&1 || true
|
||||
if [ -c /dev/md$MD ] ; then
|
||||
sleep 1
|
||||
fi
|
||||
if [ -c /dev/md$MD ] ; then
|
||||
sleep 1
|
||||
fi
|
||||
if [ -c /dev/md$MD ] ; then
|
||||
echo "Bail out!"
|
||||
echo "/dev/md$MD is busy"
|
||||
exit 1
|
||||
fi
|
||||
MdLoad/MdLoad md${MD} $f
|
||||
if [ -f Ref/$b ] ; then
|
||||
if diskinfo /dev/md${MD}* |
|
||||
diff -I '$FreeBSD' -u Ref/$b - > $TMP; then
|
||||
echo "ok - $b"
|
||||
else
|
||||
echo "not ok - $b"
|
||||
sed 's/^/# /' $TMP
|
||||
fi
|
||||
else
|
||||
diskinfo /dev/md${MD}* > Ref/`basename $f`
|
||||
fi
|
||||
done
|
||||
|
||||
mdconfig -d -u $MD > /dev/null 2>&1 || true
|
||||
rm -f $TMP
|
||||
|
||||
exit 0
|
29
tools/regression/geom_concat/test-1.t
Normal file
29
tools/regression/geom_concat/test-1.t
Normal file
@ -0,0 +1,29 @@
|
||||
#!/bin/sh
|
||||
# $FreeBSD$
|
||||
|
||||
name="test"
|
||||
base=`basename $0`
|
||||
us=45
|
||||
|
||||
echo '1..1'
|
||||
|
||||
mdconfig -a -t malloc -s 1M -u $us || exit 1
|
||||
mdconfig -a -t malloc -s 2M -u `expr $us + 1` || exit 1
|
||||
mdconfig -a -t malloc -s 3M -u `expr $us + 2` || exit 1
|
||||
|
||||
gconcat create $name /dev/md${us} /dev/md`expr $us + 1` /dev/md`expr $us + 2` || exit 1
|
||||
|
||||
# Size of created device should be 1MB + 2MB + 3MB.
|
||||
|
||||
size=`diskinfo /dev/concat/${name} | awk '{print $3}'`
|
||||
|
||||
if [ $size -eq 6291456 ]; then
|
||||
echo "ok - Size is 6291456"
|
||||
else
|
||||
echo "not ok - Size is 6291456"
|
||||
fi
|
||||
|
||||
gconcat destroy $name
|
||||
mdconfig -d -u $us
|
||||
mdconfig -d -u `expr $us + 1`
|
||||
mdconfig -d -u `expr $us + 2`
|
34
tools/regression/geom_concat/test-2.t
Normal file
34
tools/regression/geom_concat/test-2.t
Normal file
@ -0,0 +1,34 @@
|
||||
#!/bin/sh
|
||||
# $FreeBSD$
|
||||
|
||||
name="test"
|
||||
base=`basename $0`
|
||||
us=45
|
||||
tsize=6
|
||||
src=`mktemp /tmp/$base.XXXXXX` || exit 1
|
||||
dst=`mktemp /tmp/$base.XXXXXX` || exit 1
|
||||
|
||||
dd if=/dev/random of=${src} bs=1m count=$tsize >/dev/null 2>&1
|
||||
|
||||
mdconfig -a -t malloc -s 1M -u $us || exit 1
|
||||
mdconfig -a -t malloc -s 2M -u `expr $us + 1` || exit 1
|
||||
mdconfig -a -t malloc -s 3M -u `expr $us + 2` || exit 1
|
||||
|
||||
gconcat create $name /dev/md${us} /dev/md`expr $us + 1` /dev/md`expr $us + 2` || exit 1
|
||||
|
||||
dd if=${src} of=/dev/concat/${name} bs=1m count=$tsize >/dev/null 2>&1
|
||||
dd if=/dev/concat/${name} of=${dst} bs=1m count=$tsize >/dev/null 2>&1
|
||||
|
||||
echo '1..1'
|
||||
|
||||
if [ `md5 -q ${src}` != `md5 -q ${dst}` ]; then
|
||||
echo "not ok - md5 checksum comparison"
|
||||
else
|
||||
echo "ok - md5 checksum comparison"
|
||||
fi
|
||||
|
||||
gconcat destroy $name
|
||||
mdconfig -d -u $us
|
||||
mdconfig -d -u `expr $us + 1`
|
||||
mdconfig -d -u `expr $us + 2`
|
||||
rm -f ${src} ${dst}
|
40
tools/regression/geom_gate/test-1.t
Normal file
40
tools/regression/geom_gate/test-1.t
Normal file
@ -0,0 +1,40 @@
|
||||
#!/bin/sh
|
||||
# $FreeBSD$
|
||||
|
||||
base=`basename $0`
|
||||
us=45
|
||||
work="/dev/md${us}"
|
||||
src="/dev/md`expr $us + 1`"
|
||||
conf=`mktemp /tmp/$base.XXXXXX` || exit 1
|
||||
|
||||
mdconfig -a -t malloc -s 1M -u $us || exit 1
|
||||
mdconfig -a -t malloc -s 1M -u `expr $us + 1` || exit 1
|
||||
dd if=/dev/random of=$work bs=1m count=1 >/dev/null 2>&1
|
||||
dd if=/dev/random of=$src bs=1m count=1 >/dev/null 2>&1
|
||||
sum=`cat $src | md5 -q`
|
||||
|
||||
echo "127.0.0.1 RW $work" > $conf
|
||||
ggated $conf
|
||||
ggatec create -u $us 127.0.0.1 $work
|
||||
|
||||
dd if=${src} of=/dev/ggate${us} bs=1m count=1 >/dev/null 2>&1
|
||||
|
||||
echo '1..2'
|
||||
|
||||
if [ `cat $work | md5 -q` != $sum ]; then
|
||||
echo 'not ok 1 - md5 checksum'
|
||||
else
|
||||
echo 'ok 1 - md5 checksum'
|
||||
|
||||
if [ `cat /dev/ggate${us} | md5 -q` != $sum ]; then
|
||||
echo 'not ok 2 - md5 checksum'
|
||||
else
|
||||
echo 'ok 2 - md5 checksum'
|
||||
fi
|
||||
fi
|
||||
|
||||
ggatec destroy -u $us
|
||||
mdconfig -d -u $us
|
||||
mdconfig -d -u `expr $us + 1`
|
||||
pkill ggated $conf
|
||||
rm -f $conf
|
31
tools/regression/geom_gate/test-2.t
Normal file
31
tools/regression/geom_gate/test-2.t
Normal file
@ -0,0 +1,31 @@
|
||||
#!/bin/sh
|
||||
# $FreeBSD$
|
||||
|
||||
base=`basename $0`
|
||||
us=45
|
||||
work=`mktemp /tmp/$base.XXXXXX` || exit 1
|
||||
src=`mktemp /tmp/$base.XXXXXX` || exit 1
|
||||
|
||||
dd if=/dev/random of=$work bs=1m count=1 >/dev/null 2>&1
|
||||
dd if=/dev/random of=$src bs=1m count=1 >/dev/null 2>&1
|
||||
sum=`md5 -q $src`
|
||||
|
||||
ggatel create -u $us $work
|
||||
|
||||
dd if=${src} of=/dev/ggate${us} bs=1m count=1 >/dev/null 2>&1
|
||||
|
||||
echo '1..2'
|
||||
|
||||
if [ `md5 -q $work` != $sum ]; then
|
||||
echo 'not ok 1 - md5 checksum'
|
||||
else
|
||||
echo 'ok 1 - md5 checksum'
|
||||
if [ `cat /dev/ggate${us} | md5 -q` != $sum ]; then
|
||||
echo 'not ok 2 - md5 checksum'
|
||||
else
|
||||
echo 'ok 2 - md5 checksum'
|
||||
fi
|
||||
fi
|
||||
|
||||
ggatel destroy -u $us
|
||||
rm -f $work $src
|
34
tools/regression/geom_gate/test-3.t
Normal file
34
tools/regression/geom_gate/test-3.t
Normal file
@ -0,0 +1,34 @@
|
||||
#!/bin/sh
|
||||
# $FreeBSD$
|
||||
|
||||
base=`basename $0`
|
||||
us=45
|
||||
work="/dev/md${us}"
|
||||
src="/dev/md`expr $us + 1`"
|
||||
|
||||
mdconfig -a -t malloc -s 1M -u $us || exit 1
|
||||
mdconfig -a -t malloc -s 1M -u `expr $us + 1` || exit 1
|
||||
dd if=/dev/random of=$work bs=1m count=1 >/dev/null 2>&1
|
||||
dd if=/dev/random of=$src bs=1m count=1 >/dev/null 2>&1
|
||||
sum=`cat $src | md5 -q`
|
||||
|
||||
ggatel create -u $us $work
|
||||
|
||||
dd if=${src} of=/dev/ggate${us} bs=1m count=1 >/dev/null 2>&1
|
||||
|
||||
echo '1..2'
|
||||
|
||||
if [ `cat $work | md5 -q` != $sum ]; then
|
||||
echo 'not ok 1 - md5 checksum'
|
||||
else
|
||||
echo 'ok 1 - md5 checksum'
|
||||
if [ `cat /dev/ggate${us} | md5 -q` != $sum ]; then
|
||||
echo 'not ok 2 - md5 checksum'
|
||||
else
|
||||
echo 'ok 2 - md5 checksum'
|
||||
fi
|
||||
fi
|
||||
|
||||
ggatel destroy -u $us
|
||||
mdconfig -d -u $us
|
||||
mdconfig -d -u `expr $us + 1`
|
@ -39,6 +39,8 @@
|
||||
int n_float, n_double, n_long_double;
|
||||
int n_float_complex, n_double_complex, n_long_double_complex;
|
||||
|
||||
int currtest = 0;
|
||||
|
||||
#define TGMACRO(FNC) \
|
||||
TGMACRO_REAL(FNC) \
|
||||
TGMACRO_COMPLEX(c ## FNC)
|
||||
@ -390,15 +392,19 @@ _Bool b;
|
||||
|
||||
int failed = 0;
|
||||
#define PRINT(STR, X) do { \
|
||||
currtest++; \
|
||||
int result = (X); \
|
||||
if (!result) \
|
||||
failed = 1; \
|
||||
printf("%s %s\n", result ? "PASS" : "FAIL", (STR)); \
|
||||
printf("%s %d - %s\n", result ? "ok" : "not ok", currtest, (STR)); \
|
||||
fflush(stdout); \
|
||||
} while (0)
|
||||
|
||||
int
|
||||
main(void)
|
||||
{
|
||||
printf("1..60\n");
|
||||
|
||||
/* 7.22#4 */
|
||||
PRINT("acos",
|
||||
PASS_REAL_ARG_REAL_RET(acos) &&
|
||||
@ -612,6 +618,4 @@ main(void)
|
||||
PRINT("creal",
|
||||
PASS_REAL_ARG_REAL_RET_(creal, _complex) &&
|
||||
PASS_COMPLEX_ARG_REAL_RET(creal));
|
||||
|
||||
printf("%s <tgmath.h>\n", failed ? "FAIL" : "PASS");
|
||||
}
|
||||
|
10
tools/regression/include/tgmath/tgmath.t
Normal file
10
tools/regression/include/tgmath/tgmath.t
Normal file
@ -0,0 +1,10 @@
|
||||
#!/bin/sh
|
||||
# $FreeBSD$
|
||||
|
||||
cd `dirname $0`
|
||||
|
||||
executable=`basename $0 .t`
|
||||
|
||||
make $executable 2>&1 > /dev/null
|
||||
|
||||
exec ./$executable
|
@ -46,6 +46,8 @@ main(int argc, char *argv[])
|
||||
{
|
||||
int i;
|
||||
|
||||
printf("1..2\n");
|
||||
|
||||
/*
|
||||
* C/POSIX locale.
|
||||
*/
|
||||
@ -63,8 +65,8 @@ main(int argc, char *argv[])
|
||||
assert(btowc('A') == L'A' && wctob(L'A') == 'A');
|
||||
assert(btowc(0xa3) == WEOF && wctob(0xa3c1) == EOF);
|
||||
|
||||
printf("PASS btowc()\n");
|
||||
printf("PASS wctob()\n");
|
||||
printf("ok 1 - btowc()\n");
|
||||
printf("ok 2 - wctob()\n");
|
||||
|
||||
return (0);
|
||||
}
|
||||
|
10
tools/regression/lib/libc/locale/test-btowc.t
Normal file
10
tools/regression/lib/libc/locale/test-btowc.t
Normal file
@ -0,0 +1,10 @@
|
||||
#!/bin/sh
|
||||
# $FreeBSD$
|
||||
|
||||
cd `dirname $0`
|
||||
|
||||
executable=`basename $0 .t`
|
||||
|
||||
make $executable 2>&1 > /dev/null
|
||||
|
||||
exec ./$executable
|
@ -63,6 +63,8 @@ main(int argc, char *argv[])
|
||||
{ "xdigit", iswxdigit }
|
||||
};
|
||||
|
||||
printf("1..2\n");
|
||||
|
||||
/*
|
||||
* C/POSIX locale.
|
||||
*/
|
||||
@ -92,8 +94,8 @@ main(int argc, char *argv[])
|
||||
for (i = 0; i < 65536; i++)
|
||||
assert(iswctype(i, t) == 0);
|
||||
|
||||
printf("PASS iswctype()\n");
|
||||
printf("PASS wctype()\n");
|
||||
printf("ok 1 - iswctype()\n");
|
||||
printf("ok 2 - wctype()\n");
|
||||
|
||||
return (0);
|
||||
}
|
||||
|
10
tools/regression/lib/libc/locale/test-iswctype.t
Normal file
10
tools/regression/lib/libc/locale/test-iswctype.t
Normal file
@ -0,0 +1,10 @@
|
||||
#!/bin/sh
|
||||
# $FreeBSD$
|
||||
|
||||
cd `dirname $0`
|
||||
|
||||
executable=`basename $0 .t`
|
||||
|
||||
make $executable 2>&1 > /dev/null
|
||||
|
||||
exec ./$executable
|
@ -52,6 +52,8 @@ main(int argc, char *argv[])
|
||||
* C/POSIX locale.
|
||||
*/
|
||||
|
||||
printf("1..1\n");
|
||||
|
||||
assert(MB_CUR_MAX == 1);
|
||||
|
||||
/* No shift states in C locale. */
|
||||
@ -106,7 +108,7 @@ main(int argc, char *argv[])
|
||||
buf[1] = 0xc1;
|
||||
assert(mblen(buf, 2) == 2);
|
||||
|
||||
printf("PASS mblen()\n");
|
||||
printf("ok 1 - mblen()\n");
|
||||
|
||||
return (0);
|
||||
}
|
||||
|
10
tools/regression/lib/libc/locale/test-mblen.t
Normal file
10
tools/regression/lib/libc/locale/test-mblen.t
Normal file
@ -0,0 +1,10 @@
|
||||
#!/bin/sh
|
||||
# $FreeBSD$
|
||||
|
||||
cd `dirname $0`
|
||||
|
||||
executable=`basename $0 .t`
|
||||
|
||||
make $executable 2>&1 > /dev/null
|
||||
|
||||
exec ./$executable
|
@ -54,6 +54,8 @@ main(int argc, char *argv[])
|
||||
/*
|
||||
* C/POSIX locale.
|
||||
*/
|
||||
|
||||
printf("1..1\n");
|
||||
|
||||
assert(MB_CUR_MAX == 1);
|
||||
|
||||
@ -121,7 +123,7 @@ main(int argc, char *argv[])
|
||||
memset(&s, 0, sizeof(s));
|
||||
assert(mbrlen(buf, 2, &s) == 2);
|
||||
|
||||
printf("PASS mbrlen()\n");
|
||||
printf("ok 1 - mbrlen()\n");
|
||||
|
||||
return (0);
|
||||
}
|
||||
|
10
tools/regression/lib/libc/locale/test-mbrlen.t
Normal file
10
tools/regression/lib/libc/locale/test-mbrlen.t
Normal file
@ -0,0 +1,10 @@
|
||||
#!/bin/sh
|
||||
# $FreeBSD$
|
||||
|
||||
cd `dirname $0`
|
||||
|
||||
executable=`basename $0 .t`
|
||||
|
||||
make $executable 2>&1 > /dev/null
|
||||
|
||||
exec ./$executable
|
@ -56,6 +56,8 @@ main(int argc, char *argv[])
|
||||
* C/POSIX locale.
|
||||
*/
|
||||
|
||||
printf("1..1\n");
|
||||
|
||||
assert(MB_CUR_MAX == 1);
|
||||
|
||||
/* Null wide character, internal state. */
|
||||
@ -155,7 +157,7 @@ main(int argc, char *argv[])
|
||||
assert(mbrtowc(&wc, buf, 1, &s) == 1);
|
||||
assert(wc == 0xa3c1);
|
||||
|
||||
printf("PASS mbrtowc()\n");
|
||||
printf("ok 1 - mbrtowc()\n");
|
||||
|
||||
return (0);
|
||||
}
|
||||
|
10
tools/regression/lib/libc/locale/test-mbrtowc.t
Normal file
10
tools/regression/lib/libc/locale/test-mbrtowc.t
Normal file
@ -0,0 +1,10 @@
|
||||
#!/bin/sh
|
||||
# $FreeBSD$
|
||||
|
||||
cd `dirname $0`
|
||||
|
||||
executable=`basename $0 .t`
|
||||
|
||||
make $executable 2>&1 > /dev/null
|
||||
|
||||
exec ./$executable
|
@ -55,6 +55,8 @@ main(int argc, char *argv[])
|
||||
* C/POSIX locale.
|
||||
*/
|
||||
|
||||
printf("1..1\n");
|
||||
|
||||
/* Simple null terminated string. */
|
||||
memset(srcbuf, 0xcc, sizeof(srcbuf));
|
||||
strcpy(srcbuf, "hello");
|
||||
@ -186,7 +188,7 @@ main(int argc, char *argv[])
|
||||
sizeof(*dstbuf), &s) == 0);
|
||||
assert(src == NULL);
|
||||
|
||||
printf("PASS mbsnrtowcs()\n");
|
||||
printf("ok 1 - mbsnrtowcs()\n");
|
||||
|
||||
return (0);
|
||||
}
|
||||
|
10
tools/regression/lib/libc/locale/test-mbsnrtowcs.t
Normal file
10
tools/regression/lib/libc/locale/test-mbsnrtowcs.t
Normal file
@ -0,0 +1,10 @@
|
||||
#!/bin/sh
|
||||
# $FreeBSD$
|
||||
|
||||
cd `dirname $0`
|
||||
|
||||
executable=`basename $0 .t`
|
||||
|
||||
make $executable 2>&1 > /dev/null
|
||||
|
||||
exec ./$executable
|
@ -56,6 +56,8 @@ main(int argc, char *argv[])
|
||||
* C/POSIX locale.
|
||||
*/
|
||||
|
||||
printf("1..1\n");
|
||||
|
||||
/* Simple null terminated string. */
|
||||
memset(srcbuf, 0xcc, sizeof(srcbuf));
|
||||
strcpy(srcbuf, "hello");
|
||||
@ -142,7 +144,7 @@ main(int argc, char *argv[])
|
||||
dstbuf[3] == 0x20 && dstbuf[4] == 0xA3C3 && dstbuf[5] == 0);
|
||||
assert(src == NULL);
|
||||
|
||||
printf("PASS mbsrtowcs()\n");
|
||||
printf("ok 1 - mbsrtowcs()\n");
|
||||
|
||||
return (0);
|
||||
}
|
||||
|
10
tools/regression/lib/libc/locale/test-mbsrtowcs.t
Normal file
10
tools/regression/lib/libc/locale/test-mbsrtowcs.t
Normal file
@ -0,0 +1,10 @@
|
||||
#!/bin/sh
|
||||
# $FreeBSD$
|
||||
|
||||
cd `dirname $0`
|
||||
|
||||
executable=`basename $0 .t`
|
||||
|
||||
make $executable 2>&1 > /dev/null
|
||||
|
||||
exec ./$executable
|
@ -54,6 +54,8 @@ main(int argc, char *argv[])
|
||||
* C/POSIX locale.
|
||||
*/
|
||||
|
||||
printf("1..1\n");
|
||||
|
||||
/* Simple null terminated string. */
|
||||
memset(srcbuf, 0xcc, sizeof(srcbuf));
|
||||
strcpy(srcbuf, "hello");
|
||||
@ -104,7 +106,7 @@ main(int argc, char *argv[])
|
||||
assert(dstbuf[0] == 0xA3C1 && dstbuf[1] == 0x20 && dstbuf[2] == 0x42 &&
|
||||
dstbuf[3] == 0x20 && dstbuf[4] == 0xA3C3 && dstbuf[5] == 0);
|
||||
|
||||
printf("PASS mbstowcs()\n");
|
||||
printf("ok 1 - mbstowcs()\n");
|
||||
|
||||
return (0);
|
||||
}
|
||||
|
10
tools/regression/lib/libc/locale/test-mbstowcs.t
Normal file
10
tools/regression/lib/libc/locale/test-mbstowcs.t
Normal file
@ -0,0 +1,10 @@
|
||||
#!/bin/sh
|
||||
# $FreeBSD$
|
||||
|
||||
cd `dirname $0`
|
||||
|
||||
executable=`basename $0 .t`
|
||||
|
||||
make $executable 2>&1 > /dev/null
|
||||
|
||||
exec ./$executable
|
@ -53,6 +53,8 @@ main(int argc, char *argv[])
|
||||
* C/POSIX locale.
|
||||
*/
|
||||
|
||||
printf("1..1\n");
|
||||
|
||||
assert(MB_CUR_MAX == 1);
|
||||
|
||||
/* No shift states in C locale. */
|
||||
@ -116,7 +118,7 @@ main(int argc, char *argv[])
|
||||
assert(mbtowc(&wc, buf, 2) == 2);
|
||||
assert(wc == 0xa3c1);
|
||||
|
||||
printf("PASS mbtowc()\n");
|
||||
printf("ok 1 - mbtowc()\n");
|
||||
|
||||
return (0);
|
||||
}
|
||||
|
10
tools/regression/lib/libc/locale/test-mbtowc.t
Normal file
10
tools/regression/lib/libc/locale/test-mbtowc.t
Normal file
@ -0,0 +1,10 @@
|
||||
#!/bin/sh
|
||||
# $FreeBSD$
|
||||
|
||||
cd `dirname $0`
|
||||
|
||||
executable=`basename $0 .t`
|
||||
|
||||
make $executable 2>&1 > /dev/null
|
||||
|
||||
exec ./$executable
|
@ -54,6 +54,8 @@ main(int argc, char *argv[])
|
||||
* C/POSIX locale.
|
||||
*/
|
||||
|
||||
printf("1..1\n");
|
||||
|
||||
assert(MB_CUR_MAX == 1);
|
||||
|
||||
/* Incomplete character sequence. */
|
||||
@ -127,7 +129,7 @@ main(int argc, char *argv[])
|
||||
assert(cres == buf + 2);
|
||||
assert(sgetrune(buf, 2, NULL) == 0xa3c1);
|
||||
|
||||
printf("PASS sgetrune()\n");
|
||||
printf("ok 1 - sgetrune()\n");
|
||||
|
||||
return (0);
|
||||
}
|
||||
|
10
tools/regression/lib/libc/locale/test-sgetrune.t
Normal file
10
tools/regression/lib/libc/locale/test-sgetrune.t
Normal file
@ -0,0 +1,10 @@
|
||||
#!/bin/sh
|
||||
# $FreeBSD$
|
||||
|
||||
cd `dirname $0`
|
||||
|
||||
executable=`basename $0 .t`
|
||||
|
||||
make $executable 2>&1 > /dev/null
|
||||
|
||||
exec ./$executable
|
@ -54,6 +54,8 @@ main(int argc, char *argv[])
|
||||
* C/POSIX locale.
|
||||
*/
|
||||
|
||||
printf("1..1\n");
|
||||
|
||||
assert(MB_CUR_MAX == 1);
|
||||
|
||||
/* Null wide character. */
|
||||
@ -127,7 +129,7 @@ main(int argc, char *argv[])
|
||||
assert((unsigned char)buf[0] == 0xcc);
|
||||
|
||||
|
||||
printf("PASS sputrune()\n");
|
||||
printf("ok 1 - sputrune()\n");
|
||||
|
||||
return (0);
|
||||
}
|
||||
|
10
tools/regression/lib/libc/locale/test-sputrune.t
Normal file
10
tools/regression/lib/libc/locale/test-sputrune.t
Normal file
@ -0,0 +1,10 @@
|
||||
#!/bin/sh
|
||||
# $FreeBSD$
|
||||
|
||||
cd `dirname $0`
|
||||
|
||||
executable=`basename $0 .t`
|
||||
|
||||
make $executable 2>&1 > /dev/null
|
||||
|
||||
exec ./$executable
|
@ -53,6 +53,8 @@ main(int argc, char *argv[])
|
||||
{ "toupper", towupper },
|
||||
};
|
||||
|
||||
printf("1..2\n");
|
||||
|
||||
/*
|
||||
* C/POSIX locale.
|
||||
*/
|
||||
@ -82,8 +84,8 @@ main(int argc, char *argv[])
|
||||
for (i = 0; i < 65536; i++)
|
||||
assert(towctrans(i, t) == i);
|
||||
|
||||
printf("PASS towctrans()\n");
|
||||
printf("PASS wctrans()\n");
|
||||
printf("ok 1 - towctrans()\n");
|
||||
printf("ok 2 - wctrans()\n");
|
||||
|
||||
return (0);
|
||||
}
|
||||
|
10
tools/regression/lib/libc/locale/test-towctrans.t
Normal file
10
tools/regression/lib/libc/locale/test-towctrans.t
Normal file
@ -0,0 +1,10 @@
|
||||
#!/bin/sh
|
||||
# $FreeBSD$
|
||||
|
||||
cd `dirname $0`
|
||||
|
||||
executable=`basename $0 .t`
|
||||
|
||||
make $executable 2>&1 > /dev/null
|
||||
|
||||
exec ./$executable
|
@ -55,6 +55,8 @@ main(int argc, char *argv[])
|
||||
* C/POSIX locale.
|
||||
*/
|
||||
|
||||
printf("1..1\n");
|
||||
|
||||
assert(MB_CUR_MAX == 1);
|
||||
|
||||
/*
|
||||
@ -126,7 +128,7 @@ main(int argc, char *argv[])
|
||||
(unsigned char)buf[1] == 0xc1 &&
|
||||
(unsigned char)buf[2] == 0xcc);
|
||||
|
||||
printf("PASS wcrtomb()\n");
|
||||
printf("ok 1 - wcrtomb()\n");
|
||||
|
||||
return (0);
|
||||
}
|
||||
|
10
tools/regression/lib/libc/locale/test-wcrtomb.t
Normal file
10
tools/regression/lib/libc/locale/test-wcrtomb.t
Normal file
@ -0,0 +1,10 @@
|
||||
#!/bin/sh
|
||||
# $FreeBSD$
|
||||
|
||||
cd `dirname $0`
|
||||
|
||||
executable=`basename $0 .t`
|
||||
|
||||
make $executable 2>&1 > /dev/null
|
||||
|
||||
exec ./$executable
|
@ -55,6 +55,8 @@ main(int argc, char *argv[])
|
||||
* C/POSIX locale.
|
||||
*/
|
||||
|
||||
printf("1..1\n");
|
||||
|
||||
/* Simple null terminated string. */
|
||||
wmemset(srcbuf, 0xcc, sizeof(srcbuf) / sizeof(*srcbuf));
|
||||
wcscpy(srcbuf, L"hello");
|
||||
@ -186,7 +188,7 @@ main(int argc, char *argv[])
|
||||
assert((unsigned char)dstbuf[5] == 0xcc);
|
||||
assert(src == srcbuf + 4);
|
||||
|
||||
printf("PASS wcsnrtombs()\n");
|
||||
printf("ok 1 - wcsnrtombs()\n");
|
||||
|
||||
return (0);
|
||||
}
|
||||
|
10
tools/regression/lib/libc/locale/test-wcsnrtombs.t
Normal file
10
tools/regression/lib/libc/locale/test-wcsnrtombs.t
Normal file
@ -0,0 +1,10 @@
|
||||
#!/bin/sh
|
||||
# $FreeBSD$
|
||||
|
||||
cd `dirname $0`
|
||||
|
||||
executable=`basename $0 .t`
|
||||
|
||||
make $executable 2>&1 > /dev/null
|
||||
|
||||
exec ./$executable
|
@ -56,6 +56,8 @@ main(int argc, char *argv[])
|
||||
* C/POSIX locale.
|
||||
*/
|
||||
|
||||
printf("1..1\n");
|
||||
|
||||
/* Simple null terminated string. */
|
||||
wmemset(srcbuf, 0xcc, sizeof(srcbuf) / sizeof(*srcbuf));
|
||||
wcscpy(srcbuf, L"hello");
|
||||
@ -147,7 +149,7 @@ main(int argc, char *argv[])
|
||||
assert((unsigned char)dstbuf[8] == 0xcc);
|
||||
assert(src == NULL);
|
||||
|
||||
printf("PASS wcsrtombs()\n");
|
||||
printf("ok 1 - wcsrtombs()\n");
|
||||
|
||||
return (0);
|
||||
}
|
||||
|
10
tools/regression/lib/libc/locale/test-wcsrtombs.t
Normal file
10
tools/regression/lib/libc/locale/test-wcsrtombs.t
Normal file
@ -0,0 +1,10 @@
|
||||
#!/bin/sh
|
||||
# $FreeBSD$
|
||||
|
||||
cd `dirname $0`
|
||||
|
||||
executable=`basename $0 .t`
|
||||
|
||||
make $executable 2>&1 > /dev/null
|
||||
|
||||
exec ./$executable
|
@ -54,6 +54,8 @@ main(int argc, char *argv[])
|
||||
* C/POSIX locale.
|
||||
*/
|
||||
|
||||
printf("1..1\n");
|
||||
|
||||
/* Simple null terminated string. */
|
||||
wmemset(srcbuf, 0xcc, sizeof(srcbuf) / sizeof(*srcbuf));
|
||||
wcscpy(srcbuf, L"hello");
|
||||
@ -121,7 +123,7 @@ main(int argc, char *argv[])
|
||||
assert(strcmp(dstbuf, "\xA3\xC1 B \xA3\xC3") == 0);
|
||||
assert((unsigned char)dstbuf[8] == 0xcc);
|
||||
|
||||
printf("PASS wcstombs()\n");
|
||||
printf("ok 1 - wcstombs()\n");
|
||||
|
||||
return (0);
|
||||
}
|
||||
|
10
tools/regression/lib/libc/locale/test-wcstombs.t
Normal file
10
tools/regression/lib/libc/locale/test-wcstombs.t
Normal file
@ -0,0 +1,10 @@
|
||||
#!/bin/sh
|
||||
# $FreeBSD$
|
||||
|
||||
cd `dirname $0`
|
||||
|
||||
executable=`basename $0 .t`
|
||||
|
||||
make $executable 2>&1 > /dev/null
|
||||
|
||||
exec ./$executable
|
@ -53,6 +53,8 @@ main(int argc, char *argv[])
|
||||
* C/POSIX locale.
|
||||
*/
|
||||
|
||||
printf("1..1\n");
|
||||
|
||||
assert(MB_CUR_MAX == 1);
|
||||
|
||||
/* No shift states in C locale. */
|
||||
@ -104,7 +106,7 @@ main(int argc, char *argv[])
|
||||
(unsigned char)buf[1] == 0xc1 &&
|
||||
(unsigned char)buf[2] == 0xcc);
|
||||
|
||||
printf("PASS wctomb()\n");
|
||||
printf("ok 1 - wctomb()\n");
|
||||
|
||||
return (0);
|
||||
}
|
||||
|
10
tools/regression/lib/libc/locale/test-wctomb.t
Normal file
10
tools/regression/lib/libc/locale/test-wctomb.t
Normal file
@ -0,0 +1,10 @@
|
||||
#!/bin/sh
|
||||
# $FreeBSD$
|
||||
|
||||
cd `dirname $0`
|
||||
|
||||
executable=`basename $0 .t`
|
||||
|
||||
make $executable 2>&1 > /dev/null
|
||||
|
||||
exec ./$executable
|
@ -40,15 +40,18 @@ test_str( const char *str, const struct eui64 *eui)
|
||||
{
|
||||
struct eui64 e;
|
||||
char buf[EUI64_SIZ];
|
||||
static int test = 0;
|
||||
|
||||
test++;
|
||||
|
||||
if (eui64_aton(str, &e) != 0 &&
|
||||
memcmp(&e, &eui, sizeof(struct eui64)) != 0) {
|
||||
printf("FAIL: eui64_aton(%s)\n", str);
|
||||
printf("not ok %d - : eui64_aton(%s)\n", test, str);
|
||||
eui64_ntoa(&e, buf, sizeof(buf));
|
||||
printf("got: %s\n", buf);
|
||||
printf("# got: %s\n", buf);
|
||||
return (0);
|
||||
} else {
|
||||
printf("PASS: eui64_aton(%s)\n", str);
|
||||
printf("ok %d - eui64_aton(%s)\n", test, str);
|
||||
return (1);
|
||||
}
|
||||
|
||||
@ -58,6 +61,8 @@ int
|
||||
main(int argc, char **argv)
|
||||
{
|
||||
|
||||
printf("1..5\n");
|
||||
|
||||
test_str(test_eui64_id_ascii, &test_eui64_id);
|
||||
test_str(test_eui64_id_colon_ascii, &test_eui64_id);
|
||||
test_str(test_eui64_mac_ascii, &test_eui64_eui48);
|
||||
|
10
tools/regression/lib/libc/net/test-eui64_aton.t
Normal file
10
tools/regression/lib/libc/net/test-eui64_aton.t
Normal file
@ -0,0 +1,10 @@
|
||||
#!/bin/sh
|
||||
# $FreeBSD$
|
||||
|
||||
cd `dirname $0`
|
||||
|
||||
executable=`basename $0 .t`
|
||||
|
||||
make $executable 2>&1 > /dev/null
|
||||
|
||||
exec ./$executable
|
@ -40,17 +40,20 @@ test_line(const char *line, const struct eui64 *eui, const char *host)
|
||||
{
|
||||
struct eui64 e;
|
||||
char buf[256];
|
||||
static int test = 0;
|
||||
|
||||
test++;
|
||||
|
||||
if (eui64_line(line, &e, buf, sizeof(buf)) != 0 ||
|
||||
memcmp(&e, eui, sizeof(struct eui64)) != 0 ||
|
||||
strcmp(buf, host) != 0) {
|
||||
printf("FAIL: eui64_line(\"%s\")\n", line);
|
||||
printf("host = %s\n", buf);
|
||||
printf("not ok %d - eui64_line(\"%s\")\n", test, line);
|
||||
printf("# host = %s\n", buf);
|
||||
eui64_ntoa(&e, buf, sizeof(buf));
|
||||
printf("e = %s\n", buf);
|
||||
printf("# e = %s\n", buf);
|
||||
return (0);
|
||||
} else {
|
||||
printf("PASS: eui64_line(\"%s\")\n", line);
|
||||
printf("ok %d - eui64_line(\"%s\")\n", test, line);
|
||||
return (1);
|
||||
}
|
||||
}
|
||||
@ -59,6 +62,8 @@ int
|
||||
main(int argc, char **argv)
|
||||
{
|
||||
|
||||
printf("1..6\n");
|
||||
|
||||
test_line(test_eui64_line_id, &test_eui64_id,
|
||||
test_eui64_id_host);
|
||||
test_line(test_eui64_line_id_colon, &test_eui64_id,
|
||||
|
10
tools/regression/lib/libc/net/test-eui64_line.t
Normal file
10
tools/regression/lib/libc/net/test-eui64_line.t
Normal file
@ -0,0 +1,10 @@
|
||||
#!/bin/sh
|
||||
# $FreeBSD$
|
||||
|
||||
cd `dirname $0`
|
||||
|
||||
executable=`basename $0 .t`
|
||||
|
||||
make $executable 2>&1 > /dev/null
|
||||
|
||||
exec ./$executable
|
@ -40,13 +40,15 @@ main(int argc, char **argv)
|
||||
{
|
||||
char a[EUI64_SIZ];
|
||||
|
||||
printf("1..1\n");
|
||||
|
||||
if (eui64_ntoa(&test_eui64_id, a, sizeof(a)) == 0 &&
|
||||
strcmp(a, test_eui64_id_ascii) == 0) {
|
||||
printf("PASS: eui64_ntoa\n");
|
||||
printf("ok 1 - eui64_ntoa\n");
|
||||
return (0);
|
||||
}
|
||||
printf("a = '%s'\n", a);
|
||||
printf("# a = '%s'\n", a);
|
||||
|
||||
printf("FAIL: eui64_ntoa\n");
|
||||
printf("not ok 1 - eui64_ntoa\n");
|
||||
return (0);
|
||||
}
|
||||
|
10
tools/regression/lib/libc/net/test-eui64_ntoa.t
Normal file
10
tools/regression/lib/libc/net/test-eui64_ntoa.t
Normal file
@ -0,0 +1,10 @@
|
||||
#!/bin/sh
|
||||
# $FreeBSD$
|
||||
|
||||
cd `dirname $0`
|
||||
|
||||
executable=`basename $0 .t`
|
||||
|
||||
make $executable 2>&1 > /dev/null
|
||||
|
||||
exec ./$executable
|
@ -51,6 +51,8 @@ main(int argc, char *argv[])
|
||||
int i;
|
||||
char *s;
|
||||
|
||||
printf("1..1\n");
|
||||
|
||||
strcpy(tmpfil, _PATH_TMP "perror.XXXXXXXX");
|
||||
if (mkstemp(tmpfil) < 0)
|
||||
err(1, "mkstemp");
|
||||
@ -92,7 +94,7 @@ main(int argc, char *argv[])
|
||||
assert(s == NULL);
|
||||
fclose(stderr);
|
||||
|
||||
printf("PASS perror()\n");
|
||||
printf("ok 1 - perror()\n");
|
||||
|
||||
return (0);
|
||||
}
|
||||
|
10
tools/regression/lib/libc/stdio/test-perror.t
Normal file
10
tools/regression/lib/libc/stdio/test-perror.t
Normal file
@ -0,0 +1,10 @@
|
||||
#!/bin/sh
|
||||
# $FreeBSD$
|
||||
|
||||
cd `dirname $0`
|
||||
|
||||
executable=`basename $0 .t`
|
||||
|
||||
make $executable 2>&1 > /dev/null
|
||||
|
||||
exec ./$executable
|
@ -52,6 +52,7 @@ int
|
||||
main(int argc, char *argv[])
|
||||
{
|
||||
|
||||
printf("1..1\n");
|
||||
assert(setlocale(LC_NUMERIC, ""));
|
||||
|
||||
testfmt(" 1.000000E+00", "%13E", 1.0);
|
||||
@ -203,7 +204,7 @@ main(int argc, char *argv[])
|
||||
testfmt("0x2.00p-1030", "%.2a", 0x1.fffp-1030);
|
||||
testfmt("0x1.00p-1026", "%.2a", 0xf.fffp-1030);
|
||||
|
||||
printf("PASS printfloat\n");
|
||||
printf("ok 1 - printfloat\n");
|
||||
|
||||
return (0);
|
||||
}
|
||||
|
10
tools/regression/lib/libc/stdio/test-printfloat.t
Normal file
10
tools/regression/lib/libc/stdio/test-printfloat.t
Normal file
@ -0,0 +1,10 @@
|
||||
#!/bin/sh
|
||||
# $FreeBSD$
|
||||
|
||||
cd `dirname $0`
|
||||
|
||||
executable=`basename $0 .t`
|
||||
|
||||
make $executable 2>&1 > /dev/null
|
||||
|
||||
exec ./$executable
|
@ -52,6 +52,8 @@ main(int argc, char *argv[])
|
||||
double d = 0.0;
|
||||
float f = 0.0;
|
||||
|
||||
printf("1..1\n");
|
||||
|
||||
buf[0] = '\0';
|
||||
assert(setlocale(LC_NUMERIC, ""));
|
||||
|
||||
@ -174,7 +176,7 @@ main(int argc, char *argv[])
|
||||
sscanf("0x1.2345678p-1050", "%le", &d);
|
||||
assert(d == 0x1.234568p-1050);
|
||||
|
||||
printf("PASS scanfloat\n");
|
||||
printf("ok 1 - scanfloat\n");
|
||||
|
||||
return (0);
|
||||
}
|
||||
|
10
tools/regression/lib/libc/stdio/test-scanfloat.t
Normal file
10
tools/regression/lib/libc/stdio/test-scanfloat.t
Normal file
@ -0,0 +1,10 @@
|
||||
#!/bin/sh
|
||||
# $FreeBSD$
|
||||
|
||||
cd `dirname $0`
|
||||
|
||||
executable=`basename $0 .t`
|
||||
|
||||
make $executable 2>&1 > /dev/null
|
||||
|
||||
exec ./$executable
|
@ -44,6 +44,7 @@ main(int argc, char *argv[])
|
||||
int testvector[IVEC_LEN];
|
||||
int sresvector[IVEC_LEN];
|
||||
|
||||
printf("1..1\n");
|
||||
for (j = 2; j < IVEC_LEN; j++) {
|
||||
/* Populate test vectors */
|
||||
for (i = 0; i < j; i++)
|
||||
@ -59,7 +60,7 @@ main(int argc, char *argv[])
|
||||
assert(testvector[i] == sresvector[i]);
|
||||
}
|
||||
|
||||
printf("PASS heapsort\n");
|
||||
printf("ok 1 - heapsort\n");
|
||||
|
||||
return(0);
|
||||
}
|
||||
|
10
tools/regression/lib/libc/stdlib/test-heapsort.t
Normal file
10
tools/regression/lib/libc/stdlib/test-heapsort.t
Normal file
@ -0,0 +1,10 @@
|
||||
#!/bin/sh
|
||||
# $FreeBSD$
|
||||
|
||||
cd `dirname $0`
|
||||
|
||||
executable=`basename $0 .t`
|
||||
|
||||
make $executable 2>&1 > /dev/null
|
||||
|
||||
exec ./$executable
|
@ -44,6 +44,7 @@ main(int argc, char *argv[])
|
||||
int testvector[IVEC_LEN];
|
||||
int sresvector[IVEC_LEN];
|
||||
|
||||
printf("1..1\n");
|
||||
for (j = 2; j < IVEC_LEN; j++) {
|
||||
/* Populate test vectors */
|
||||
for (i = 0; i < j; i++)
|
||||
@ -59,7 +60,7 @@ main(int argc, char *argv[])
|
||||
assert(testvector[i] == sresvector[i]);
|
||||
}
|
||||
|
||||
printf("PASS mergesort\n");
|
||||
printf("ok 1 - mergesort\n");
|
||||
|
||||
return(0);
|
||||
}
|
||||
|
10
tools/regression/lib/libc/stdlib/test-mergesort.t
Normal file
10
tools/regression/lib/libc/stdlib/test-mergesort.t
Normal file
@ -0,0 +1,10 @@
|
||||
#!/bin/sh
|
||||
# $FreeBSD$
|
||||
|
||||
cd `dirname $0`
|
||||
|
||||
executable=`basename $0 .t`
|
||||
|
||||
make $executable 2>&1 > /dev/null
|
||||
|
||||
exec ./$executable
|
@ -44,6 +44,7 @@ main(int argc, char *argv[])
|
||||
int testvector[IVEC_LEN];
|
||||
int sresvector[IVEC_LEN];
|
||||
|
||||
printf("1..1\n");
|
||||
for (j = 2; j < IVEC_LEN; j++) {
|
||||
/* Populate test vectors */
|
||||
for (i = 0; i < j; i++)
|
||||
@ -59,7 +60,7 @@ main(int argc, char *argv[])
|
||||
assert(testvector[i] == sresvector[i]);
|
||||
}
|
||||
|
||||
printf("PASS qsort\n");
|
||||
printf("ok 1 - qsort\n");
|
||||
|
||||
return(0);
|
||||
}
|
||||
|
10
tools/regression/lib/libc/stdlib/test-qsort.t
Normal file
10
tools/regression/lib/libc/stdlib/test-qsort.t
Normal file
@ -0,0 +1,10 @@
|
||||
#!/bin/sh
|
||||
# $FreeBSD$
|
||||
|
||||
cd `dirname $0`
|
||||
|
||||
executable=`basename $0 .t`
|
||||
|
||||
make $executable 2>&1 > /dev/null
|
||||
|
||||
exec ./$executable
|
@ -40,6 +40,8 @@ main(void)
|
||||
char *sret;
|
||||
int iret;
|
||||
|
||||
printf("1..2\n");
|
||||
|
||||
/*
|
||||
* strerror() failure tests.
|
||||
*/
|
||||
@ -71,7 +73,7 @@ main(void)
|
||||
sret = strerror(ELAST);
|
||||
assert(errno == 0);
|
||||
|
||||
printf("PASS strerror()\n");
|
||||
printf("ok 1 - strerror()\n");
|
||||
|
||||
/*
|
||||
* strerror_r() failure tests.
|
||||
@ -124,7 +126,7 @@ main(void)
|
||||
assert(strcmp(buf, "Too many processes") == 0);
|
||||
assert(iret == 0);
|
||||
|
||||
printf("PASS strerror_r()\n");
|
||||
printf("ok 2 - strerror_r()\n");
|
||||
|
||||
exit(0);
|
||||
}
|
||||
|
10
tools/regression/lib/libc/string/test-strerror.t
Normal file
10
tools/regression/lib/libc/string/test-strerror.t
Normal file
@ -0,0 +1,10 @@
|
||||
#!/bin/sh
|
||||
# $FreeBSD$
|
||||
|
||||
cd `dirname $0`
|
||||
|
||||
executable=`basename $0 .t`
|
||||
|
||||
make $executable 2>&1 > /dev/null
|
||||
|
||||
exec ./$executable
|
@ -85,6 +85,7 @@ int
|
||||
main(int argc, char *argv[])
|
||||
{
|
||||
|
||||
printf("1..1\n");
|
||||
init_exceptsets();
|
||||
test_dfl_env();
|
||||
test_fetestclearexcept();
|
||||
@ -95,7 +96,7 @@ main(int argc, char *argv[])
|
||||
test_fegsetmask();
|
||||
test_feholdupdate();
|
||||
|
||||
printf("PASS fenv\n");
|
||||
printf("ok 1 - fenv\n");
|
||||
return (0);
|
||||
}
|
||||
|
||||
|
10
tools/regression/lib/msun/test-fenv.t
Normal file
10
tools/regression/lib/msun/test-fenv.t
Normal file
@ -0,0 +1,10 @@
|
||||
#!/bin/sh
|
||||
# $FreeBSD$
|
||||
|
||||
cd `dirname $0`
|
||||
|
||||
executable=`basename $0 .t`
|
||||
|
||||
make $executable 2>&1 > /dev/null
|
||||
|
||||
exec ./$executable
|
@ -42,6 +42,7 @@ main(void)
|
||||
long double ld;
|
||||
int e, i;
|
||||
|
||||
printf("1..3\n");
|
||||
assert(ilogb(0) == FP_ILOGB0);
|
||||
assert(ilogb(NAN) == FP_ILOGBNAN);
|
||||
assert(ilogb(INFINITY) == INT_MAX);
|
||||
@ -52,7 +53,7 @@ main(void)
|
||||
i = ilogb(d);
|
||||
assert(i == e);
|
||||
}
|
||||
printf("PASS ilogb\n");
|
||||
printf("ok 1 - ilogb\n");
|
||||
|
||||
assert(ilogbf(0) == FP_ILOGB0);
|
||||
assert(ilogbf(NAN) == FP_ILOGBNAN);
|
||||
@ -64,7 +65,7 @@ main(void)
|
||||
i = ilogbf(f);
|
||||
assert(i == e);
|
||||
}
|
||||
printf("PASS ilogbf\n");
|
||||
printf("ok 2 - ilogbf\n");
|
||||
|
||||
assert(ilogbl(0) == FP_ILOGB0);
|
||||
assert(ilogbl(NAN) == FP_ILOGBNAN);
|
||||
@ -76,7 +77,7 @@ main(void)
|
||||
i = ilogbl(ld);
|
||||
assert(i == e);
|
||||
}
|
||||
printf("PASS ilogbl\n");
|
||||
printf("ok 3 - ilogbl\n");
|
||||
|
||||
return (0);
|
||||
}
|
||||
|
10
tools/regression/lib/msun/test-ilogb.t
Normal file
10
tools/regression/lib/msun/test-ilogb.t
Normal file
@ -0,0 +1,10 @@
|
||||
#!/bin/sh
|
||||
# $FreeBSD$
|
||||
|
||||
cd `dirname $0`
|
||||
|
||||
executable=`basename $0 .t`
|
||||
|
||||
make $executable 2>&1 > /dev/null
|
||||
|
||||
exec ./$executable
|
@ -810,6 +810,7 @@ int
|
||||
main(int argc, char *argv[])
|
||||
{
|
||||
|
||||
printf("1..1\n");
|
||||
if (geteuid() != 0) {
|
||||
warnx("Not running as root, can't run tests as root");
|
||||
fprintf(stderr, "\n");
|
||||
@ -833,6 +834,6 @@ main(int argc, char *argv[])
|
||||
getuid(), geteuid());
|
||||
testsuite(PRIV_GETROOT);
|
||||
}
|
||||
fprintf(stderr, "PASS\n");
|
||||
printf("ok 1 - ipsockopt\n");
|
||||
exit(0);
|
||||
}
|
||||
|
10
tools/regression/netinet/ipsockopt/ipsockopt.t
Normal file
10
tools/regression/netinet/ipsockopt/ipsockopt.t
Normal file
@ -0,0 +1,10 @@
|
||||
#!/bin/sh
|
||||
# $FreeBSD$
|
||||
|
||||
cd `dirname $0`
|
||||
|
||||
executable=`basename $0 .t`
|
||||
|
||||
make $executable 2>&1 > /dev/null
|
||||
|
||||
exec ./$executable
|
@ -48,6 +48,8 @@ int main()
|
||||
char buf[BIG_PIPE_SIZE]; /* any value over PIPE_SIZE should do */
|
||||
int i, flags, fd[2];
|
||||
|
||||
printf("1..1\n");
|
||||
|
||||
if (pipe(fd) < 0) { perror("pipe"); exit(1); }
|
||||
|
||||
flags = fcntl(fd[1], F_GETFL);
|
||||
@ -75,5 +77,6 @@ int main()
|
||||
close(fd[0]);
|
||||
memset(buf, 0, sizeof buf);
|
||||
for (i = 0; i < 1000; i++) write_frame(fd[1], buf, sizeof buf);
|
||||
printf("ok 1\n");
|
||||
exit(0);
|
||||
}
|
||||
|
10
tools/regression/pipe/bigpipetest.t
Normal file
10
tools/regression/pipe/bigpipetest.t
Normal file
@ -0,0 +1,10 @@
|
||||
#!/bin/sh
|
||||
# $FreeBSD$
|
||||
|
||||
cd `dirname $0`
|
||||
|
||||
executable=`basename $0 .t`
|
||||
|
||||
make $executable 2>&1 > /dev/null
|
||||
|
||||
exec ./$executable
|
@ -55,6 +55,8 @@ main(int argc, char *argv[])
|
||||
socklen_t size;
|
||||
int fd1, fd2, fd3, i, s;
|
||||
|
||||
printf("1..1\n");
|
||||
|
||||
/*
|
||||
* Check for sequential fd allocation, and give up early if not.
|
||||
*/
|
||||
@ -105,9 +107,9 @@ main(int argc, char *argv[])
|
||||
*/
|
||||
fd3 = dup(STDIN_FILENO);
|
||||
if (fd3 != fd2 + 2)
|
||||
errx(-1, "FAIL (%d, %d, %d)\n", fd1, fd2, fd3);
|
||||
printf("not ok 1 - (%d, %d, %d)\n", fd1, fd2, fd3);
|
||||
else
|
||||
fprintf(stderr, "PASS\n");
|
||||
printf("ok 1\n");
|
||||
|
||||
return (0);
|
||||
}
|
||||
|
10
tools/regression/sockets/accept_fd_leak/accept_fd_leak.t
Normal file
10
tools/regression/sockets/accept_fd_leak/accept_fd_leak.t
Normal file
@ -0,0 +1,10 @@
|
||||
#!/bin/sh
|
||||
# $FreeBSD$
|
||||
|
||||
cd `dirname $0`
|
||||
|
||||
executable=`basename $0 .t`
|
||||
|
||||
make $executable 2>&1 > /dev/null
|
||||
|
||||
exec ./$executable
|
@ -63,12 +63,15 @@ main(int argc, char *argv[])
|
||||
socklen_t len;
|
||||
int lso, ret;
|
||||
|
||||
printf("1..9\n");
|
||||
|
||||
/*
|
||||
* Step 0. Open socket().
|
||||
*/
|
||||
lso = socket(PF_INET, SOCK_STREAM, 0);
|
||||
if (lso == -1)
|
||||
errx(-1, "socket: %s", strerror(errno));
|
||||
errx(-1, "not ok 1 - socket: %s", strerror(errno));
|
||||
printf("ok 1 - socket\n");
|
||||
|
||||
/*
|
||||
* Step 1. After socket(). Should return EINVAL, since no accept
|
||||
@ -78,10 +81,11 @@ main(int argc, char *argv[])
|
||||
len = sizeof(afa);
|
||||
ret = getsockopt(lso, SOL_SOCKET, SO_ACCEPTFILTER, &afa, &len);
|
||||
if (ret != -1)
|
||||
errx(-1, "FAIL: getsockopt() after socket() succeeded");
|
||||
errx(-1, "not ok 2 - getsockopt() after socket() succeeded");
|
||||
if (errno != EINVAL)
|
||||
errx(-1, "FAIL: getsockopt() after socket() failed with "
|
||||
errx(-1, "not ok 2 - getsockopt() after socket() failed with "
|
||||
"%d (%s)", errno, strerror(errno));
|
||||
printf("ok 2 - getsockopt\n");
|
||||
|
||||
/*
|
||||
* Step 2. Bind(). Ideally this will succeed.
|
||||
@ -92,7 +96,8 @@ main(int argc, char *argv[])
|
||||
sin.sin_port = htons(8080);
|
||||
sin.sin_addr.s_addr = htonl(INADDR_LOOPBACK);
|
||||
if (bind(lso, (struct sockaddr *)&sin, sizeof(sin)) < 0)
|
||||
errx(-1, "bind: %s", strerror(errno));
|
||||
errx(-1, "not ok 3 - bind %s", strerror(errno));
|
||||
printf("ok 3 - bind\n");
|
||||
|
||||
/*
|
||||
* Step 3: After bind(). getsockopt() should return EINVAL, since no
|
||||
@ -101,10 +106,11 @@ main(int argc, char *argv[])
|
||||
len = sizeof(afa);
|
||||
ret = getsockopt(lso, SOL_SOCKET, SO_ACCEPTFILTER, &afa, &len);
|
||||
if (ret != -1)
|
||||
errx(-1, "FAIL: getsockopt() after bind() succeeded");
|
||||
errx(-1, "not ok 4 - getsockopt() after bind() succeeded");
|
||||
if (errno != EINVAL)
|
||||
errx(-1, "FAIL: getsockopt() after bind() failed with %d (%s)",
|
||||
errx(-1, "not ok 4 - getsockopt() after bind() failed with %d (%s)",
|
||||
errno, strerror(errno));
|
||||
printf("ok 4 - getsockopt\n");
|
||||
|
||||
/*
|
||||
* Step 4: Setsockopt() before listen(). Should fail, since it's not
|
||||
@ -114,7 +120,8 @@ main(int argc, char *argv[])
|
||||
strcpy(afa.af_name, ACCF_NAME);
|
||||
ret = setsockopt(lso, SOL_SOCKET, SO_ACCEPTFILTER, &afa, sizeof(afa));
|
||||
if (ret == 0)
|
||||
errx(-1, "FAIL: setsockopt() before listen() succeeded");
|
||||
errx(-1, "not ok 5 - setsockopt() before listen() succeeded");
|
||||
printf("ok 5 - setsockopt\n");
|
||||
|
||||
/*
|
||||
* Step 5: Getsockopt() after pre-listen() setsockopt(). Should
|
||||
@ -123,17 +130,19 @@ main(int argc, char *argv[])
|
||||
len = sizeof(afa);
|
||||
ret = getsockopt(lso, SOL_SOCKET, SO_ACCEPTFILTER, &afa, &len);
|
||||
if (ret == 0)
|
||||
errx(-1, "FAIL: getsockopt() after pre-listen() setsockopt() "
|
||||
errx(-1, "not ok 6 - getsockopt() after pre-listen() setsockopt() "
|
||||
"succeeded");
|
||||
if (errno != EINVAL)
|
||||
errx(-1, "FAIL: pre-listen() getsockopt() failed with %d (%s)",
|
||||
errx(-1, "not ok 6 - pre-listen() getsockopt() failed with %d (%s)",
|
||||
errno, strerror(errno));
|
||||
printf("ok 6 - getsockopt\n");
|
||||
|
||||
/*
|
||||
* Step 6: listen().
|
||||
*/
|
||||
if (listen(lso, -1) < 0)
|
||||
errx(-1, "listen: %s", strerror(errno));
|
||||
errx(-1, "not ok 7 - listen: %s", strerror(errno));
|
||||
printf("ok 7 - listen\n");
|
||||
|
||||
/*
|
||||
* Step 7: After listen(). This call to setsockopt() should succeed.
|
||||
@ -142,11 +151,12 @@ main(int argc, char *argv[])
|
||||
strcpy(afa.af_name, ACCF_NAME);
|
||||
ret = setsockopt(lso, SOL_SOCKET, SO_ACCEPTFILTER, &afa, sizeof(afa));
|
||||
if (ret != 0)
|
||||
errx(-1, "FAIL: setsockopt() after listen() failed with %d "
|
||||
errx(-1, "not ok 8 - setsockopt() after listen() failed with %d "
|
||||
"(%s)", errno, strerror(errno));
|
||||
if (len != sizeof(afa))
|
||||
errx(-1, "FAIL: setsockopt() after listen() returned wrong "
|
||||
errx(-1, "not ok 8 - setsockopt() after listen() returned wrong "
|
||||
"size (%d vs expected %d)", len, sizeof(afa));
|
||||
printf("ok 8 - setsockopt\n");
|
||||
|
||||
/*
|
||||
* Step 8: After setsockopt(). Should succeed and identify
|
||||
@ -156,18 +166,18 @@ main(int argc, char *argv[])
|
||||
len = sizeof(afa);
|
||||
ret = getsockopt(lso, SOL_SOCKET, SO_ACCEPTFILTER, &afa, &len);
|
||||
if (ret != 0)
|
||||
errx(-1, "FAIL: getsockopt() after listen() setsockopt() "
|
||||
errx(-1, "not ok 9 - getsockopt() after listen() setsockopt() "
|
||||
"failed with %d (%s)", errno, strerror(errno));
|
||||
if (len != sizeof(afa))
|
||||
errx(-1, "FAIL: getsockopt() after setsockopet() after "
|
||||
errx(-1, "not ok 9 - getsockopt() after setsockopet() after "
|
||||
"listen() returned wrong size (got %d expected %d)", len,
|
||||
sizeof(afa));
|
||||
if (strcmp(afa.af_name, ACCF_NAME) != 0)
|
||||
errx(-1, "FAIL: getsockopt() after setsockopt() after "
|
||||
errx(-1, "not ok 9 - getsockopt() after setsockopt() after "
|
||||
"listen() mismatch (got %s expected %s)", afa.af_name,
|
||||
ACCF_NAME);
|
||||
printf("ok 9 - getsockopt\n");
|
||||
|
||||
printf("PASS\n");
|
||||
close(lso);
|
||||
return (0);
|
||||
}
|
||||
|
10
tools/regression/sockets/accf_data_attach/accf_data_attach.t
Normal file
10
tools/regression/sockets/accf_data_attach/accf_data_attach.t
Normal file
@ -0,0 +1,10 @@
|
||||
#!/bin/sh
|
||||
# $FreeBSD$
|
||||
|
||||
cd `dirname $0`
|
||||
|
||||
executable=`basename $0 .t`
|
||||
|
||||
make $executable 2>&1 > /dev/null
|
||||
|
||||
exec ./$executable
|
@ -38,6 +38,8 @@
|
||||
#include <string.h>
|
||||
#include <unistd.h>
|
||||
|
||||
static int curtest = 1;
|
||||
|
||||
/*-
|
||||
* This test uses UNIX domain socket pairs to perform some basic exercising
|
||||
* of kqueue functionality on sockets. In particular, testing that for read
|
||||
@ -53,19 +55,22 @@
|
||||
* closed.
|
||||
*/
|
||||
|
||||
#define OK(testname) printf("ok %d - %s\n", curtest, testname); \
|
||||
curtest++;
|
||||
|
||||
static void
|
||||
fail(int error, const char *func, const char *socktype, const char *rest)
|
||||
{
|
||||
|
||||
fprintf(stderr, "FAIL\n");
|
||||
printf("not ok %d\n", curtest);
|
||||
|
||||
if (socktype == NULL)
|
||||
fprintf(stderr, "%s(): %s\n", func, strerror(error));
|
||||
printf("# %s(): %s\n", func, strerror(error));
|
||||
else if (rest == NULL)
|
||||
fprintf(stderr, "%s(%s): %s\n", func, socktype,
|
||||
printf("# %s(%s): %s\n", func, socktype,
|
||||
strerror(error));
|
||||
else
|
||||
fprintf(stderr, "%s(%s, %s): %s\n", func, socktype, rest,
|
||||
printf("# %s(%s, %s): %s\n", func, socktype, rest,
|
||||
strerror(error));
|
||||
exit(-1);
|
||||
}
|
||||
@ -75,16 +80,16 @@ fail_assertion(const char *func, const char *socktype, const char *rest,
|
||||
const char *assertion)
|
||||
{
|
||||
|
||||
fprintf(stderr, "FAIL\n");
|
||||
printf("not ok %d - %s\n", curtest, assertion);
|
||||
|
||||
if (socktype == NULL)
|
||||
fprintf(stderr, "%s(): assertion %s failed\n", func,
|
||||
printf("# %s(): assertion %s failed\n", func,
|
||||
assertion);
|
||||
else if (rest == NULL)
|
||||
fprintf(stderr, "%s(%s): assertion %s failed\n", func,
|
||||
printf("# %s(%s): assertion %s failed\n", func,
|
||||
socktype, assertion);
|
||||
else
|
||||
fprintf(stderr, "%s(%s, %s): assertion %s failed\n", func,
|
||||
printf("# %s(%s, %s): assertion %s failed\n", func,
|
||||
socktype, rest, assertion);
|
||||
exit(-1);
|
||||
}
|
||||
@ -107,6 +112,7 @@ test_evfilt_read(int kq, int fd[2], const char *socktype)
|
||||
EV_SET(&ke, fd[0], EVFILT_READ, EV_ADD, 0, 0, NULL);
|
||||
if (kevent(kq, &ke, 1, NULL, 0, NULL) == -1)
|
||||
fail(errno, "kevent", socktype, "EVFILT_READ, EV_ADD");
|
||||
OK("EVFILT_READ, EV_ADD");
|
||||
|
||||
/*
|
||||
* Confirm not readable to begin with, no I/O yet.
|
||||
@ -116,9 +122,11 @@ test_evfilt_read(int kq, int fd[2], const char *socktype)
|
||||
i = kevent(kq, NULL, 0, &ke, 1, &ts);
|
||||
if (i == -1)
|
||||
fail(errno, "kevent", socktype, "EVFILT_READ");
|
||||
OK("EVFILT_READ");
|
||||
if (i != 0)
|
||||
fail_assertion("kevent", socktype, "EVFILT_READ",
|
||||
"empty socket unreadable");
|
||||
OK("empty socket unreadable");
|
||||
|
||||
/*
|
||||
* Write a byte to one end.
|
||||
@ -127,8 +135,10 @@ test_evfilt_read(int kq, int fd[2], const char *socktype)
|
||||
len = write(fd[1], &ch, sizeof(ch));
|
||||
if (len == -1)
|
||||
fail(errno, "write", socktype, NULL);
|
||||
OK("write one byte");
|
||||
if (len != sizeof(ch))
|
||||
fail_assertion("write", socktype, NULL, "write length");
|
||||
OK("write one byte length");
|
||||
|
||||
/*
|
||||
* Other end should now be readable.
|
||||
@ -138,9 +148,11 @@ test_evfilt_read(int kq, int fd[2], const char *socktype)
|
||||
i = kevent(kq, NULL, 0, &ke, 1, &ts);
|
||||
if (i == -1)
|
||||
fail(errno, "kevent", socktype, "EVFILT_READ");
|
||||
OK("EVFILT_READ");
|
||||
if (i != 1)
|
||||
fail_assertion("kevent", socktype, "EVFILT_READ",
|
||||
"non-empty socket unreadable");
|
||||
OK("non-empty socket unreadable");
|
||||
|
||||
/*
|
||||
* Read a byte to clear the readable state.
|
||||
@ -148,8 +160,10 @@ test_evfilt_read(int kq, int fd[2], const char *socktype)
|
||||
len = read(fd[0], &ch, sizeof(ch));
|
||||
if (len == -1)
|
||||
fail(errno, "read", socktype, NULL);
|
||||
OK("read one byte");
|
||||
if (len != sizeof(ch))
|
||||
fail_assertion("read", socktype, NULL, "read length");
|
||||
OK("read one byte length");
|
||||
|
||||
/*
|
||||
* Now re-check for readability.
|
||||
@ -159,13 +173,16 @@ test_evfilt_read(int kq, int fd[2], const char *socktype)
|
||||
i = kevent(kq, NULL, 0, &ke, 1, &ts);
|
||||
if (i == -1)
|
||||
fail(errno, "kevent", socktype, "EVFILT_READ");
|
||||
OK("EVFILT_READ");
|
||||
if (i != 0)
|
||||
fail_assertion("kevent", socktype, "EVFILT_READ",
|
||||
"empty socket unreadable");
|
||||
OK("empty socket unreadable");
|
||||
|
||||
EV_SET(&ke, fd[0], EVFILT_READ, EV_DELETE, 0, 0, NULL);
|
||||
if (kevent(kq, &ke, 1, NULL, 0, NULL) == -1)
|
||||
fail(errno, "kevent", socktype, "EVFILT_READ, EV_DELETE");
|
||||
OK("EVFILT_READ, EV_DELETE");
|
||||
}
|
||||
|
||||
static void
|
||||
@ -180,6 +197,7 @@ test_evfilt_write(int kq, int fd[2], const char *socktype)
|
||||
EV_SET(&ke, fd[0], EVFILT_WRITE, EV_ADD, 0, 0, NULL);
|
||||
if (kevent(kq, &ke, 1, NULL, 0, NULL) == -1)
|
||||
fail(errno, "kevent", socktype, "EVFILT_WRITE, EV_ADD");
|
||||
OK("EVFILE_WRITE, EV_ADD");
|
||||
|
||||
/*
|
||||
* Confirm writable to begin with, no I/O yet.
|
||||
@ -189,9 +207,11 @@ test_evfilt_write(int kq, int fd[2], const char *socktype)
|
||||
i = kevent(kq, NULL, 0, &ke, 1, &ts);
|
||||
if (i == -1)
|
||||
fail(errno, "kevent", socktype, "EVFILT_WRITE");
|
||||
OK("EVFILE_WRITE");
|
||||
if (i != 1)
|
||||
fail_assertion("kevent", socktype, "EVFILT_WRITE",
|
||||
"empty socket unwritable");
|
||||
OK("empty socket unwritable");
|
||||
|
||||
/*
|
||||
* Write bytes into the socket until we can't write anymore.
|
||||
@ -200,8 +220,10 @@ test_evfilt_write(int kq, int fd[2], const char *socktype)
|
||||
while ((len = write(fd[0], &ch, sizeof(ch))) == sizeof(ch)) {};
|
||||
if (len == -1 && errno != EAGAIN && errno != ENOBUFS)
|
||||
fail(errno, "write", socktype, NULL);
|
||||
OK("write");
|
||||
if (len != -1 && len != sizeof(ch))
|
||||
fail_assertion("write", socktype, NULL, "write length");
|
||||
OK("write length");
|
||||
|
||||
/*
|
||||
* Check to make sure the socket is no longer writable.
|
||||
@ -211,13 +233,16 @@ test_evfilt_write(int kq, int fd[2], const char *socktype)
|
||||
i = kevent(kq, NULL, 0, &ke, 1, &ts);
|
||||
if (i == -1)
|
||||
fail(errno, "kevent", socktype, "EVFILT_WRITE");
|
||||
OK("EVFILT_WRITE");
|
||||
if (i != 0)
|
||||
fail_assertion("kevent", socktype, "EVFILT_WRITE",
|
||||
"full socket writable");
|
||||
OK("full socket writable");
|
||||
|
||||
EV_SET(&ke, fd[0], EVFILT_WRITE, EV_DELETE, 0, 0, NULL);
|
||||
if (kevent(kq, &ke, 1, NULL, 0, NULL) == -1)
|
||||
fail(errno, "kevent", socktype, "EVFILT_WRITE, EV_DELETE");
|
||||
OK("EVFILT_WRITE, EV_DELETE");
|
||||
}
|
||||
|
||||
/*
|
||||
@ -229,9 +254,12 @@ main(int argc, char *argv[])
|
||||
{
|
||||
int i, kq, sv[2];
|
||||
|
||||
printf("1..49\n");
|
||||
|
||||
kq = kqueue();
|
||||
if (kq == -1)
|
||||
fail(errno, "kqueue", NULL, NULL);
|
||||
OK("kqueue()");
|
||||
|
||||
/*
|
||||
* Create a UNIX domain datagram socket, and attach/test/detach a
|
||||
@ -239,18 +267,23 @@ main(int argc, char *argv[])
|
||||
*/
|
||||
if (socketpair(PF_UNIX, SOCK_DGRAM, 0, sv) == -1)
|
||||
fail(errno, "socketpair", "PF_UNIX, SOCK_DGRAM", NULL);
|
||||
OK("socketpair() 1");
|
||||
|
||||
if (fcntl(sv[0], F_SETFL, O_NONBLOCK) != 0)
|
||||
fail(errno, "fcntl", "PF_UNIX, SOCK_DGRAM", "O_NONBLOCK");
|
||||
OK("fcntl() 1");
|
||||
if (fcntl(sv[1], F_SETFL, O_NONBLOCK) != 0)
|
||||
fail(errno, "fcntl", "PF_UNIX, SOCK_DGRAM", "O_NONBLOCK");
|
||||
OK("fnctl() 2");
|
||||
|
||||
test_evfilt_read(kq, sv, "PF_UNIX, SOCK_DGRAM");
|
||||
|
||||
if (close(sv[0]) == -1)
|
||||
fail(errno, "close", "PF_UNIX/SOCK_DGRAM", "sv[0]");
|
||||
OK("close() 1");
|
||||
if (close(sv[1]) == -1)
|
||||
fail(errno, "close", "PF_UNIX/SOCK_DGRAM", "sv[1]");
|
||||
OK("close() 2");
|
||||
|
||||
#if 0
|
||||
/*
|
||||
@ -285,18 +318,23 @@ main(int argc, char *argv[])
|
||||
*/
|
||||
if (socketpair(PF_UNIX, SOCK_STREAM, 0, sv) == -1)
|
||||
fail(errno, "socketpair", "PF_UNIX, SOCK_STREAM", NULL);
|
||||
OK("socketpair() 2");
|
||||
|
||||
if (fcntl(sv[0], F_SETFL, O_NONBLOCK) != 0)
|
||||
fail(errno, "fcntl", "PF_UNIX, SOCK_STREAM", "O_NONBLOCK");
|
||||
OK("fcntl() 3");
|
||||
if (fcntl(sv[1], F_SETFL, O_NONBLOCK) != 0)
|
||||
fail(errno, "fcntl", "PF_UNIX, SOCK_STREAM", "O_NONBLOCK");
|
||||
OK("fcntl() 4");
|
||||
|
||||
test_evfilt_read(kq, sv, "PF_UNIX, SOCK_STREAM");
|
||||
|
||||
if (close(sv[0]) == -1)
|
||||
fail(errno, "close", "PF_UNIX/SOCK_STREAM", "sv[0]");
|
||||
OK("close() 3");
|
||||
if (close(sv[1]) == -1)
|
||||
fail(errno, "close", "PF_UNIX/SOCK_STREAM", "sv[1]");
|
||||
OK("close() 4");
|
||||
|
||||
/*
|
||||
* Create a UNIX domain stream socket, and attach/test/detach a
|
||||
@ -304,22 +342,27 @@ main(int argc, char *argv[])
|
||||
*/
|
||||
if (socketpair(PF_UNIX, SOCK_STREAM, 0, sv) == -1)
|
||||
fail(errno, "socketpair", "PF_UNIX, SOCK_STREAM", NULL);
|
||||
OK("socketpair() 3");
|
||||
|
||||
if (fcntl(sv[0], F_SETFL, O_NONBLOCK) != 0)
|
||||
fail(errno, "fcntl", "PF_UNIX, SOCK_STREAM", "O_NONBLOCK");
|
||||
OK("fcntl() 5");
|
||||
if (fcntl(sv[1], F_SETFL, O_NONBLOCK) != 0)
|
||||
fail(errno, "fcntl", "PF_UNIX, SOCK_STREAM", "O_NONBLOCK");
|
||||
OK("fcntl() 6");
|
||||
|
||||
test_evfilt_write(kq, sv, "PF_UNIX, SOCK_STREAM");
|
||||
|
||||
if (close(sv[0]) == -1)
|
||||
fail(errno, "close", "PF_UNIX/SOCK_STREAM", "sv[0]");
|
||||
OK("close() 5");
|
||||
if (close(sv[1]) == -1)
|
||||
fail(errno, "close", "PF_UNIX/SOCK_STREAM", "sv[1]");
|
||||
OK("close() 6");
|
||||
|
||||
if (close(kq) == -1)
|
||||
fail(errno, "close", "kq", NULL);
|
||||
OK("close() 7");
|
||||
|
||||
printf("PASS\n");
|
||||
return (0);
|
||||
}
|
||||
|
10
tools/regression/sockets/kqueue/kqueue.t
Normal file
10
tools/regression/sockets/kqueue/kqueue.t
Normal file
@ -0,0 +1,10 @@
|
||||
#!/bin/sh
|
||||
# $FreeBSD$
|
||||
|
||||
cd `dirname $0`
|
||||
|
||||
executable=`basename $0 .t`
|
||||
|
||||
make $executable 2>&1 > /dev/null
|
||||
|
||||
exec ./$executable
|
@ -1,5 +1,7 @@
|
||||
# $FreeBSD$
|
||||
|
||||
echo 1..1
|
||||
|
||||
REGRESSION_START($1)
|
||||
|
||||
REGRESSION_TEST_ONE(`file2c "const char data[] = {" ", 0};" < regress.in')
|
||||
|
6
tools/regression/usr.bin/file2c/regress.t
Normal file
6
tools/regression/usr.bin/file2c/regress.t
Normal file
@ -0,0 +1,6 @@
|
||||
#!/bin/sh
|
||||
# $FreeBSD$
|
||||
|
||||
cd `dirname $0`
|
||||
|
||||
m4 ../regress.m4 regress.sh | sh
|
@ -1,5 +1,7 @@
|
||||
# $FreeBSD$
|
||||
|
||||
echo 1..1
|
||||
|
||||
REGRESSION_START($1)
|
||||
|
||||
REGRESSION_TEST_ONE(`join -t , -a1 -a2 -e "(unknown)" -o 0,1.2,2.2 regress.1.in regress.2.in')
|
||||
|
6
tools/regression/usr.bin/join/regress.t
Normal file
6
tools/regression/usr.bin/join/regress.t
Normal file
@ -0,0 +1,6 @@
|
||||
#!/bin/sh
|
||||
# $FreeBSD$
|
||||
|
||||
cd `dirname $0`
|
||||
|
||||
m4 ../regress.m4 regress.sh | sh
|
@ -1,5 +1,7 @@
|
||||
# $FreeBSD$
|
||||
|
||||
echo 1..1
|
||||
|
||||
REGRESSION_START($1)
|
||||
|
||||
REGRESSION_TEST_ONE(`jot -w "%X" -s , 100 1 200')
|
||||
|
6
tools/regression/usr.bin/jot/regress.t
Normal file
6
tools/regression/usr.bin/jot/regress.t
Normal file
@ -0,0 +1,6 @@
|
||||
#!/bin/sh
|
||||
# $FreeBSD$
|
||||
|
||||
cd `dirname $0`
|
||||
|
||||
m4 ../regress.m4 regress.sh | sh
|
@ -9,8 +9,9 @@ cd $TESTDIR
|
||||
|
||||
STATUS=0
|
||||
|
||||
echo 1..2
|
||||
|
||||
for test in GNU/changecom changecom; do
|
||||
echo "Running test $test"
|
||||
case "$test" in
|
||||
GNU/*)
|
||||
M4="m4 -g"
|
||||
@ -28,10 +29,10 @@ for test in GNU/changecom changecom; do
|
||||
;;
|
||||
esac
|
||||
if [ $? -eq 0 ]; then
|
||||
echo "PASS: Test $test detected no regression, output matches."
|
||||
echo "ok - $test # Test detected no regression, output matches."
|
||||
else
|
||||
STATUS=$?
|
||||
echo "FAIL: Test $test failed: regression detected. See above."
|
||||
echo "not ok - $test # Test failed: regression detected. See above."
|
||||
fi
|
||||
done
|
||||
|
||||
|
6
tools/regression/usr.bin/m4/regress.t
Normal file
6
tools/regression/usr.bin/m4/regress.t
Normal file
@ -0,0 +1,6 @@
|
||||
#!/bin/sh
|
||||
# $FreeBSD$
|
||||
|
||||
cd `dirname $0`
|
||||
|
||||
sh regress.sh
|
@ -19,49 +19,36 @@ DATA1:= ${DATA5:S/l/r/g}
|
||||
NIL=
|
||||
|
||||
all:
|
||||
@echo "Running test variables"
|
||||
@echo '1..14'
|
||||
@echo 1:${DATA1} 2:${DATA2} 3:${DATA3} 4:${DATA4} 5:${DATA5} | \
|
||||
diff -u ${.CURDIR}/regress.variables.out - || ${MAKE} failure
|
||||
@echo "PASS: Test variables detected no regression, output matches."
|
||||
@echo "Running test targets"
|
||||
@echo "ok 1 - test_variables # Test variables detected no regression, output matches."
|
||||
@${MAKE} double 2>/dev/null || ${MAKE} failure
|
||||
@echo "PASS: Test targets detected no regression."
|
||||
@echo "Running test sysvmatch"
|
||||
@echo "ok 2 - test_targets # Test targets detected no regression."
|
||||
@${MAKE} sysvmatch || ${MAKE} failure
|
||||
@echo "PASS: Test sysvmatch detected no regression."
|
||||
@echo "Running test lhs_expn"
|
||||
@echo "ok 3 - sysvmatch # Test sysvmatch detected no regression."
|
||||
@! ${MAKE} lhs_expn && true || ${MAKE} failure
|
||||
@echo "PASS: Test lhs_expn detected no regression."
|
||||
@echo "Running test notdef"
|
||||
@echo "ok 4 lhs_expn # Test lhs_expn detected no regression."
|
||||
@${MAKE} notdef || ${MAKE} failure
|
||||
@echo "PASS: Test notdef detected no regression."
|
||||
@echo "Running test modifiers"
|
||||
@echo "ok 5 - notdef # Test notdef detected no regression."
|
||||
@${MAKE} modifiers || ${MAKE} failure
|
||||
@echo "PASS: Test modifiers detected no regression."
|
||||
@echo "Running test funny_targets"
|
||||
@echo "ok 6 - modifiers # Test modifiers detected no regression."
|
||||
@${MAKE} funny_targets || ${MAKE} failure
|
||||
@echo "PASS: Test funny_targets detected no regression."
|
||||
@echo "Running test arith_expr"
|
||||
@echo "ok 7 funny_targets # Test funny_targets detected no regression."
|
||||
@${MAKE} arith_expr || ${MAKE} failure
|
||||
@echo "PASS: Test arith_expr detected no regression."
|
||||
@echo "Running test PATH_exists"
|
||||
@echo "ok 8 arith_expr # Test arith_expr detected no regression."
|
||||
@${MAKE} PATH_exists || ${MAKE} failure
|
||||
@echo "PASS: Test PATH_exists detected no regression."
|
||||
@echo "Running test double_quotes"
|
||||
@echo "ok 9 PATH_exists # Test PATH_exists detected no regression."
|
||||
@${MAKE} double_quotes || ${MAKE} failure
|
||||
@echo "PASS: Test double_quotes detected no regression."
|
||||
@echo "Running test double_quotes2"
|
||||
@echo "ok 10 double_quotes # Test double_quotes detected no regression."
|
||||
@! ${MAKE} double_quotes2 >/dev/null 2>&1 && true || ${MAKE} failure
|
||||
@echo "PASS: Test double_quotes2 detected no regression."
|
||||
@echo "Running test pass_cmd_vars"
|
||||
@echo "ok 11 double_quotes2 # Test double_quotes2 detected no regression."
|
||||
@${MAKE} pass_cmd_vars || ${MAKE} failure
|
||||
@echo "PASS: Test pass_cmd_vars detected no regression."
|
||||
@echo "Running test plus_flag"
|
||||
@echo "ok 12 pass_cmd_vars # Test pass_cmd_vars detected no regression."
|
||||
@${MAKE} plus_flag || ${MAKE} failure
|
||||
@echo "PASS: Test plus_flag detected no regression."
|
||||
@echo "Running test shell"
|
||||
@echo "ok 13 plus_flag # Test plus_flag detected no regression."
|
||||
@! ${MAKE} shell >/dev/null 2>&1 && true || ${MAKE} failure
|
||||
@echo "PASS: Test shell detected no regression."
|
||||
@echo "ok 14 shell # Test shell detected no regression."
|
||||
|
||||
.if make(double)
|
||||
# Doubly-defined targets. make(1) will warn, but use the "right" one. If it
|
||||
@ -247,5 +234,5 @@ shell:
|
||||
.endif
|
||||
|
||||
failure:
|
||||
@echo "FAIL: Test failed: regression detected. See above."
|
||||
@echo "not ok # Test failed: regression detected. See above."
|
||||
@false
|
||||
|
5
tools/regression/usr.bin/make/regress.t
Normal file
5
tools/regression/usr.bin/make/regress.t
Normal file
@ -0,0 +1,5 @@
|
||||
#!/bin/sh
|
||||
# $FreeBSD$
|
||||
|
||||
cd `dirname $0`
|
||||
make all
|
@ -18,10 +18,10 @@ dnl Check $? to see if we passed or failed. The first parameter is the test
|
||||
dnl which passed or failed. It may be nil.
|
||||
define(`REGRESSION_PASSFAIL',
|
||||
if [ $? -eq 0 ]; then
|
||||
echo "PASS: Test $1 detected no regression. (in $TESTDIR)"
|
||||
echo "ok - $1 # Test detected no regression. (in $TESTDIR)"
|
||||
else
|
||||
STATUS=$?
|
||||
echo "FAIL: Test $1 failed: regression detected. See above. (in $TESTDIR)"
|
||||
echo "not ok - $1 # Test failed: regression detected. See above. (in $TESTDIR)"
|
||||
fi)
|
||||
|
||||
dnl An actual test. The first parameter is the test name. The second is the
|
||||
@ -29,7 +29,6 @@ dnl command/commands to execute for the actual test. Their exit status is
|
||||
dnl checked. It is assumed that the test will output to stdout, and that the
|
||||
dnl output to be used to check for regression will be in regress.TESTNAME.out.
|
||||
define(`REGRESSION_TEST',
|
||||
echo "Running test $1"
|
||||
$2 | diff -u regress.$1.out -
|
||||
REGRESSION_PASSFAIL($1))
|
||||
|
||||
@ -42,7 +41,6 @@ dnl A regression test like REGRESSION_TEST, except only regress.out is used
|
||||
dnl for checking output differences. The first argument is the command, the
|
||||
dnl second argument (which may be empty) is the test name.
|
||||
define(`REGRESSION_TEST_ONE',
|
||||
echo "Running test $2"
|
||||
$1 | diff -u regress.out -
|
||||
REGRESSION_PASSFAIL($2))
|
||||
|
||||
@ -50,7 +48,7 @@ dnl A fatal error. This will exit with the given status (first argument) and
|
||||
dnl print the message (second argument) prefixed with the string "FATAL :" to
|
||||
dnl the error stream.
|
||||
define(`REGRESSION_FATAL',
|
||||
echo "FATAL: $2 (in $TESTDIR)" > /dev/stderr
|
||||
echo "Bail out! $2 (in $TESTDIR)" > /dev/stderr
|
||||
exit $1)
|
||||
|
||||
dnl Cleanup. Exit with the status code of the last failure. Should probably
|
||||
|
@ -2,6 +2,8 @@
|
||||
|
||||
REGRESSION_START($1)
|
||||
|
||||
echo '1..9'
|
||||
|
||||
REGRESSION_TEST(`G', `sed G < regress.in')
|
||||
REGRESSION_TEST(`P', `sed P < regress.in')
|
||||
REGRESSION_TEST(`psl', `sed \$!g\;P\;D < regress.in')
|
||||
|
6
tools/regression/usr.bin/sed/regress.t
Normal file
6
tools/regression/usr.bin/sed/regress.t
Normal file
@ -0,0 +1,6 @@
|
||||
#!/bin/sh
|
||||
# $FreeBSD$
|
||||
|
||||
cd `dirname $0`
|
||||
|
||||
m4 ../regress.m4 regress.sh | sh
|
@ -1,5 +1,7 @@
|
||||
# $FreeBSD$
|
||||
|
||||
echo 1..2
|
||||
|
||||
REGRESSION_START($1)
|
||||
|
||||
REGRESSION_TEST_ONE(`uudecode -p < regress.traditional.in', `traditional')
|
||||
|
6
tools/regression/usr.bin/uudecode/regress.t
Normal file
6
tools/regression/usr.bin/uudecode/regress.t
Normal file
@ -0,0 +1,6 @@
|
||||
#!/bin/sh
|
||||
# $FreeBSD$
|
||||
|
||||
cd `dirname $0`
|
||||
|
||||
m4 ../regress.m4 regress.sh | sh
|
@ -1,5 +1,7 @@
|
||||
# $FreeBSD$
|
||||
|
||||
echo 1..2
|
||||
|
||||
REGRESSION_START($1)
|
||||
|
||||
# To make sure we end up with matching headers.
|
||||
|
6
tools/regression/usr.bin/uuencode/regress.t
Normal file
6
tools/regression/usr.bin/uuencode/regress.t
Normal file
@ -0,0 +1,6 @@
|
||||
#!/bin/sh
|
||||
# $FreeBSD$
|
||||
|
||||
cd `dirname $0`
|
||||
|
||||
m4 ../regress.m4 regress.sh | sh
|
@ -1,5 +1,7 @@
|
||||
# $FreeBSD$
|
||||
|
||||
echo 1..5
|
||||
|
||||
REGRESSION_START($1)
|
||||
|
||||
REGRESSION_TEST(`normal', `xargs echo The < regress.in')
|
||||
|
6
tools/regression/usr.bin/xargs/regress.t
Normal file
6
tools/regression/usr.bin/xargs/regress.t
Normal file
@ -0,0 +1,6 @@
|
||||
#!/bin/sh
|
||||
# $FreeBSD$
|
||||
|
||||
cd `dirname $0`
|
||||
|
||||
m4 ../regress.m4 regress.sh | sh
|
Loading…
Reference in New Issue
Block a user