diff options
author | nik <nik@FreeBSD.org> | 2004-11-11 19:47:55 +0000 |
---|---|---|
committer | nik <nik@FreeBSD.org> | 2004-11-11 19:47:55 +0000 |
commit | 3e959a33f972bdc48cced73e8f76eb9ce7ce64eb (patch) | |
tree | cfebca4a0526247931bc6bdde73f15f72f3e92d0 /tools/regression/lib/libc/net | |
parent | 6e5bd296a6ca375161a672ed141aa5e414ffbc16 (diff) | |
download | FreeBSD-src-3e959a33f972bdc48cced73e8f76eb9ce7ce64eb.zip FreeBSD-src-3e959a33f972bdc48cced73e8f76eb9ce7ce64eb.tar.gz |
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.
Diffstat (limited to 'tools/regression/lib/libc/net')
-rw-r--r-- | tools/regression/lib/libc/net/test-eui64_aton.c | 11 | ||||
-rw-r--r-- | tools/regression/lib/libc/net/test-eui64_aton.t | 10 | ||||
-rw-r--r-- | tools/regression/lib/libc/net/test-eui64_line.c | 13 | ||||
-rw-r--r-- | tools/regression/lib/libc/net/test-eui64_line.t | 10 | ||||
-rw-r--r-- | tools/regression/lib/libc/net/test-eui64_ntoa.c | 8 | ||||
-rw-r--r-- | tools/regression/lib/libc/net/test-eui64_ntoa.t | 10 |
6 files changed, 52 insertions, 10 deletions
diff --git a/tools/regression/lib/libc/net/test-eui64_aton.c b/tools/regression/lib/libc/net/test-eui64_aton.c index 7957d57..e10f985 100644 --- a/tools/regression/lib/libc/net/test-eui64_aton.c +++ b/tools/regression/lib/libc/net/test-eui64_aton.c @@ -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); diff --git a/tools/regression/lib/libc/net/test-eui64_aton.t b/tools/regression/lib/libc/net/test-eui64_aton.t new file mode 100644 index 0000000..8bdfd03 --- /dev/null +++ b/tools/regression/lib/libc/net/test-eui64_aton.t @@ -0,0 +1,10 @@ +#!/bin/sh +# $FreeBSD$ + +cd `dirname $0` + +executable=`basename $0 .t` + +make $executable 2>&1 > /dev/null + +exec ./$executable diff --git a/tools/regression/lib/libc/net/test-eui64_line.c b/tools/regression/lib/libc/net/test-eui64_line.c index 463042a..714b460 100644 --- a/tools/regression/lib/libc/net/test-eui64_line.c +++ b/tools/regression/lib/libc/net/test-eui64_line.c @@ -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, diff --git a/tools/regression/lib/libc/net/test-eui64_line.t b/tools/regression/lib/libc/net/test-eui64_line.t new file mode 100644 index 0000000..8bdfd03 --- /dev/null +++ b/tools/regression/lib/libc/net/test-eui64_line.t @@ -0,0 +1,10 @@ +#!/bin/sh +# $FreeBSD$ + +cd `dirname $0` + +executable=`basename $0 .t` + +make $executable 2>&1 > /dev/null + +exec ./$executable diff --git a/tools/regression/lib/libc/net/test-eui64_ntoa.c b/tools/regression/lib/libc/net/test-eui64_ntoa.c index c320329d..f7582f0 100644 --- a/tools/regression/lib/libc/net/test-eui64_ntoa.c +++ b/tools/regression/lib/libc/net/test-eui64_ntoa.c @@ -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); } diff --git a/tools/regression/lib/libc/net/test-eui64_ntoa.t b/tools/regression/lib/libc/net/test-eui64_ntoa.t new file mode 100644 index 0000000..8bdfd03 --- /dev/null +++ b/tools/regression/lib/libc/net/test-eui64_ntoa.t @@ -0,0 +1,10 @@ +#!/bin/sh +# $FreeBSD$ + +cd `dirname $0` + +executable=`basename $0 .t` + +make $executable 2>&1 > /dev/null + +exec ./$executable |