summaryrefslogtreecommitdiffstats
path: root/usr.bin
diff options
context:
space:
mode:
Diffstat (limited to 'usr.bin')
-rw-r--r--usr.bin/lastcomm/Makefile6
-rw-r--r--usr.bin/lastcomm/tests/Makefile21
-rw-r--r--usr.bin/lastcomm/tests/README10
-rw-r--r--usr.bin/lastcomm/tests/legacy_test.sh38
-rw-r--r--usr.bin/lastcomm/tests/v1-amd64-acct.inbin0 -> 1568 bytes
-rw-r--r--usr.bin/lastcomm/tests/v1-amd64.out28
-rw-r--r--usr.bin/lastcomm/tests/v1-i386-acct.inbin0 -> 1344 bytes
-rw-r--r--usr.bin/lastcomm/tests/v1-i386.out28
-rw-r--r--usr.bin/lastcomm/tests/v1-sparc64-acct.inbin0 -> 1568 bytes
-rw-r--r--usr.bin/lastcomm/tests/v1-sparc64.out28
-rw-r--r--usr.bin/lastcomm/tests/v2-amd64-acct.inbin0 -> 2016 bytes
-rw-r--r--usr.bin/lastcomm/tests/v2-amd64.out28
-rw-r--r--usr.bin/lastcomm/tests/v2-i386-acct.inbin0 -> 1792 bytes
-rw-r--r--usr.bin/lastcomm/tests/v2-i386.out28
-rw-r--r--usr.bin/lastcomm/tests/v2-sparc64-acct.inbin0 -> 2592 bytes
-rw-r--r--usr.bin/lastcomm/tests/v2-sparc64.out36
-rwxr-xr-xusr.bin/lastcomm/tests/values.sh83
17 files changed, 334 insertions, 0 deletions
diff --git a/usr.bin/lastcomm/Makefile b/usr.bin/lastcomm/Makefile
index 84708d9..8825375 100644
--- a/usr.bin/lastcomm/Makefile
+++ b/usr.bin/lastcomm/Makefile
@@ -1,7 +1,13 @@
# From: @(#)Makefile 8.1 (Berkeley) 6/6/93
# $FreeBSD$
+.include <bsd.own.mk>
+
PROG= lastcomm
SRCS= lastcomm.c readrec.c
+.if ${MK_TESTS} != "no"
+SUBDIR+= tests
+.endif
+
.include <bsd.prog.mk>
diff --git a/usr.bin/lastcomm/tests/Makefile b/usr.bin/lastcomm/tests/Makefile
new file mode 100644
index 0000000..b0fac0e
--- /dev/null
+++ b/usr.bin/lastcomm/tests/Makefile
@@ -0,0 +1,21 @@
+# $FreeBSD$
+
+TESTSDIR= ${TESTSBASE}/usr.bin/lastcomm
+
+TAP_TESTS_SH= legacy_test
+
+FILESDIR= ${TESTSDIR}
+FILES= v1-amd64-acct.in
+FILES+= v1-amd64.out
+FILES+= v1-i386-acct.in
+FILES+= v1-i386.out
+FILES+= v1-sparc64-acct.in
+FILES+= v1-sparc64.out
+FILES+= v2-amd64-acct.in
+FILES+= v2-amd64.out
+FILES+= v2-i386-acct.in
+FILES+= v2-i386.out
+FILES+= v2-sparc64-acct.in
+FILES+= v2-sparc64.out
+
+.include <bsd.test.mk>
diff --git a/usr.bin/lastcomm/tests/README b/usr.bin/lastcomm/tests/README
new file mode 100644
index 0000000..62e0281
--- /dev/null
+++ b/usr.bin/lastcomm/tests/README
@@ -0,0 +1,10 @@
+$FreeBSD$
+
+To create the files for regression testing do the following.
+
+1. Run values.sh for a given architecture and accounting version.
+2. Unpack the generated file and rename acct into VERSION-ARCH.acct.
+3. Run lastcomm -cuseS -f VERSION-ARCH-acct.in |
+ awk '{$4 = ""; print}' >VERSION-ARCH.out.
+4. Compare the reported values in VERSION-ARCH.out against the
+ *.time values found in the file that values.sh generated.
diff --git a/usr.bin/lastcomm/tests/legacy_test.sh b/usr.bin/lastcomm/tests/legacy_test.sh
new file mode 100644
index 0000000..35ef78b
--- /dev/null
+++ b/usr.bin/lastcomm/tests/legacy_test.sh
@@ -0,0 +1,38 @@
+#!/bin/sh
+#
+# $FreeBSD$
+#
+
+DIR=`dirname $0`
+ARCH=`uname -m`
+
+TZ=UTC; export TZ
+
+check()
+{
+ NUM=$1
+ shift
+ # Remove tty field, which varies between systems.
+ awk '{$4 = ""; print}' |
+ if diff -q - $1
+ then
+ echo "ok $NUM"
+ else
+ echo "not ok $NUM"
+ fi
+}
+
+
+cat $DIR/v1-$ARCH-acct.in $DIR/v2-$ARCH-acct.in >v1v2-$ARCH-acct.in
+cat $DIR/v2-$ARCH.out $DIR/v1-$ARCH.out >v1v2-$ARCH.out
+
+echo 1..6
+
+lastcomm -cesuS -f $DIR/v1-$ARCH-acct.in | check 1 $DIR/v1-$ARCH.out
+lastcomm -cesuS -f - <$DIR/v1-$ARCH-acct.in | tail -r | check 2 $DIR/v1-$ARCH.out
+lastcomm -cesuS -f $DIR/v2-$ARCH-acct.in | check 3 $DIR/v2-$ARCH.out
+lastcomm -cesuS -f - <$DIR/v2-$ARCH-acct.in | tail -r | check 4 $DIR/v2-$ARCH.out
+lastcomm -cesuS -f v1v2-$ARCH-acct.in | check 5 v1v2-$ARCH.out
+lastcomm -cesuS -f - <v1v2-$ARCH-acct.in | tail -r | check 6 v1v2-$ARCH.out
+
+exit 0
diff --git a/usr.bin/lastcomm/tests/v1-amd64-acct.in b/usr.bin/lastcomm/tests/v1-amd64-acct.in
new file mode 100644
index 0000000..50546a3
--- /dev/null
+++ b/usr.bin/lastcomm/tests/v1-amd64-acct.in
Binary files differ
diff --git a/usr.bin/lastcomm/tests/v1-amd64.out b/usr.bin/lastcomm/tests/v1-amd64.out
new file mode 100644
index 0000000..bacbd57
--- /dev/null
+++ b/usr.bin/lastcomm/tests/v1-amd64.out
@@ -0,0 +1,28 @@
+core -FDX root 0.000 secs 0.000 us 0.000 sy 0.000 es Wed May 16 11:44
+core -DX root 0.000 secs 0.000 us 0.000 sy 0.000 es Wed May 16 11:44
+cc - root 0.000 secs 0.000 us 0.000 sy 0.016 es Wed May 16 11:44
+ld - root 0.000 secs 0.000 us 0.000 sy 0.000 es Wed May 16 11:44
+as - root 0.000 secs 0.000 us 0.000 sy 0.000 es Wed May 16 11:44
+cc1 - root 0.000 secs 0.000 us 0.000 sy 0.000 es Wed May 16 11:44
+time - root 0.000 secs 0.000 us 0.000 sy 0.000 es Wed May 16 11:44
+time -F root 0.000 secs 0.000 us 0.000 sy 0.000 es Wed May 16 11:44
+ln - root 0.000 secs 0.000 us 0.000 sy 0.000 es Wed May 16 11:44
+time - root 0.000 secs 0.000 us 0.000 sy 0.000 es Wed May 16 11:44
+time -F root 0.000 secs 0.000 us 0.000 sy 0.000 es Wed May 16 11:44
+ln - root 0.000 secs 0.000 us 0.000 sy 0.000 es Wed May 16 11:44
+time - root 0.000 secs 0.000 us 0.000 sy 0.000 es Wed May 16 11:44
+time -F root 0.000 secs 0.000 us 0.000 sy 0.000 es Wed May 16 11:44
+ln - root 0.000 secs 0.000 us 0.000 sy 0.000 es Wed May 16 11:44
+time - root 0.000 secs 0.000 us 0.000 sy 0.234 es Wed May 16 11:44
+diff - root 0.203 secs 0.203 us 0.000 sy 0.234 es Wed May 16 11:44
+time - root 0.000 secs 0.000 us 0.000 sy 0.016 es Wed May 16 11:44
+dd - root 0.016 secs 0.000 us 0.016 sy 0.016 es Wed May 16 11:44
+time - root 0.000 secs 0.000 us 0.000 sy 3.016 es Wed May 16 11:44
+sleep - root 0.000 secs 0.000 us 0.000 sy 3.000 es Wed May 16 11:44
+time - root 0.000 secs 0.000 us 0.000 sy 1.938 es Wed May 16 11:44
+find - root 0.250 secs 0.031 us 0.219 sy 1.938 es Wed May 16 11:44
+time - root 0.000 secs 0.000 us 0.000 sy 3.062 es Wed May 16 11:44
+egrep - root 3.031 secs 3.031 us 0.000 sy 3.062 es Wed May 16 11:44
+time - root 0.000 secs 0.000 us 0.000 sy 0.188 es Wed May 16 11:44
+awk - root 0.172 secs 0.172 us 0.000 sy 0.188 es Wed May 16 11:44
+accton - root 0.000 secs 0.000 us 0.000 sy 0.000 es Wed May 16 11:44
diff --git a/usr.bin/lastcomm/tests/v1-i386-acct.in b/usr.bin/lastcomm/tests/v1-i386-acct.in
new file mode 100644
index 0000000..f427c0e
--- /dev/null
+++ b/usr.bin/lastcomm/tests/v1-i386-acct.in
Binary files differ
diff --git a/usr.bin/lastcomm/tests/v1-i386.out b/usr.bin/lastcomm/tests/v1-i386.out
new file mode 100644
index 0000000..86ec9e2
--- /dev/null
+++ b/usr.bin/lastcomm/tests/v1-i386.out
@@ -0,0 +1,28 @@
+core -FDX root 0.000 secs 0.000 us 0.000 sy 0.031 es Fri May 18 11:34
+core -DX root 0.000 secs 0.000 us 0.000 sy 0.031 es Fri May 18 11:34
+cc - root 0.000 secs 0.000 us 0.000 sy 0.469 es Fri May 18 11:34
+ld - root 0.000 secs 0.000 us 0.000 sy 0.109 es Fri May 18 11:34
+as - root 0.000 secs 0.000 us 0.000 sy 0.047 es Fri May 18 11:34
+cc1 - root 0.016 secs 0.016 us 0.000 sy 0.203 es Fri May 18 11:34
+time - root 0.000 secs 0.000 us 0.000 sy 0.000 es Fri May 18 11:34
+1234567890123456 - root 0.000 secs 0.000 us 0.000 sy 0.000 es Fri May 18 11:34
+ln - root 0.000 secs 0.000 us 0.000 sy 0.000 es Fri May 18 11:34
+time - root 0.000 secs 0.000 us 0.000 sy 0.000 es Fri May 18 11:34
+1234567890123456 - root 0.000 secs 0.000 us 0.000 sy 0.000 es Fri May 18 11:34
+ln - root 0.000 secs 0.000 us 0.000 sy 0.000 es Fri May 18 11:34
+time - root 0.000 secs 0.000 us 0.000 sy 0.000 es Fri May 18 11:34
+123456789012345 - root 0.000 secs 0.000 us 0.000 sy 0.000 es Fri May 18 11:34
+ln - root 0.000 secs 0.000 us 0.000 sy 0.000 es Fri May 18 11:34
+time - root 0.000 secs 0.000 us 0.000 sy 0.359 es Fri May 18 11:34
+diff - root 0.312 secs 0.297 us 0.016 sy 0.359 es Fri May 18 11:34
+time - root 0.000 secs 0.000 us 0.000 sy 0.031 es Fri May 18 11:34
+dd - root 0.016 secs 0.000 us 0.016 sy 0.031 es Fri May 18 11:34
+time - root 0.000 secs 0.000 us 0.000 sy 3.000 es Fri May 18 11:34
+sleep - root 0.000 secs 0.000 us 0.000 sy 3.000 es Fri May 18 11:34
+time - root 0.000 secs 0.000 us 0.000 sy 3.406 es Fri May 18 11:34
+find - root 0.266 secs 0.062 us 0.203 sy 3.406 es Fri May 18 11:34
+time - root 0.000 secs 0.000 us 0.000 sy 5.047 es Fri May 18 11:33
+egrep - root 4.984 secs 4.984 us 0.000 sy 5.047 es Fri May 18 11:33
+time - root 0.000 secs 0.000 us 0.000 sy 0.484 es Fri May 18 11:33
+awk - root 0.453 secs 0.453 us 0.000 sy 0.453 es Fri May 18 11:33
+accton - root 0.000 secs 0.000 us 0.000 sy 0.000 es Fri May 18 11:33
diff --git a/usr.bin/lastcomm/tests/v1-sparc64-acct.in b/usr.bin/lastcomm/tests/v1-sparc64-acct.in
new file mode 100644
index 0000000..00f05b4
--- /dev/null
+++ b/usr.bin/lastcomm/tests/v1-sparc64-acct.in
Binary files differ
diff --git a/usr.bin/lastcomm/tests/v1-sparc64.out b/usr.bin/lastcomm/tests/v1-sparc64.out
new file mode 100644
index 0000000..d33ae71
--- /dev/null
+++ b/usr.bin/lastcomm/tests/v1-sparc64.out
@@ -0,0 +1,28 @@
+core -FDX root 0.000 secs 0.000 us 0.000 sy 0.031 es Wed May 16 12:16
+core -DX root 0.031 secs 0.000 us 0.031 sy 0.047 es Wed May 16 12:16
+cc - root 0.016 secs 0.000 us 0.016 sy 0.859 es Wed May 16 12:16
+ld - root 0.094 secs 0.047 us 0.047 sy 0.266 es Wed May 16 12:16
+as - root 0.016 secs 0.000 us 0.016 sy 0.094 es Wed May 16 12:16
+cc1 - root 0.094 secs 0.047 us 0.047 sy 0.375 es Wed May 16 12:16
+time - root 0.016 secs 0.000 us 0.016 sy 0.047 es Wed May 16 12:16
+1234567890123456 - root 0.000 secs 0.000 us 0.000 sy 0.016 es Wed May 16 12:16
+ln - root 0.016 secs 0.000 us 0.016 sy 0.016 es Wed May 16 12:16
+time - root 0.016 secs 0.000 us 0.016 sy 0.047 es Wed May 16 12:16
+1234567890123456 - root 0.000 secs 0.000 us 0.000 sy 0.016 es Wed May 16 12:16
+ln - root 0.016 secs 0.000 us 0.016 sy 0.016 es Wed May 16 12:16
+time - root 0.016 secs 0.000 us 0.016 sy 0.047 es Wed May 16 12:16
+123456789012345 - root 0.000 secs 0.000 us 0.000 sy 0.016 es Wed May 16 12:16
+ln - root 0.000 secs 0.000 us 0.000 sy 0.016 es Wed May 16 12:16
+time - root 0.016 secs 0.000 us 0.016 sy 1.703 es Wed May 16 12:16
+diff - root 1.641 secs 1.344 us 0.297 sy 1.672 es Wed May 16 12:16
+time - root 0.016 secs 0.000 us 0.016 sy 0.625 es Wed May 16 12:16
+dd - root 0.562 secs 0.000 us 0.562 sy 0.594 es Wed May 16 12:16
+time - root 0.016 secs 0.000 us 0.016 sy 3.047 es Wed May 16 12:16
+sleep - root 0.000 secs 0.000 us 0.000 sy 3.016 es Wed May 16 12:16
+time - root 0.016 secs 0.000 us 0.016 sy 17.219 es Wed May 16 12:16
+find - root 5.516 secs 0.562 us 4.953 sy 17.188 es Wed May 16 12:16
+time - root 0.016 secs 0.000 us 0.016 sy 30.031 es Wed May 16 12:15
+egrep - root 29.750 secs 29.688 us 0.062 sy 30.000 es Wed May 16 12:15
+time - root 0.016 secs 0.000 us 0.016 sy 1.688 es Wed May 16 12:15
+awk - root 1.609 secs 1.594 us 0.016 sy 1.641 es Wed May 16 12:15
+accton - root 0.016 secs 0.000 us 0.016 sy 0.031 es Wed May 16 12:15
diff --git a/usr.bin/lastcomm/tests/v2-amd64-acct.in b/usr.bin/lastcomm/tests/v2-amd64-acct.in
new file mode 100644
index 0000000..ca7bcaa
--- /dev/null
+++ b/usr.bin/lastcomm/tests/v2-amd64-acct.in
Binary files differ
diff --git a/usr.bin/lastcomm/tests/v2-amd64.out b/usr.bin/lastcomm/tests/v2-amd64.out
new file mode 100644
index 0000000..3942b04
--- /dev/null
+++ b/usr.bin/lastcomm/tests/v2-amd64.out
@@ -0,0 +1,28 @@
+core -FDX root 0.002 secs 0.000 us 0.002 sy 0.009 es Thu May 17 05:57
+core -DX root 0.005 secs 0.000 us 0.005 sy 0.010 es Thu May 17 05:57
+cc - root 0.005 secs 0.000 us 0.005 sy 0.652 es Thu May 17 05:57
+ld - root 0.014 secs 0.005 us 0.009 sy 0.150 es Thu May 17 05:57
+as - root 0.005 secs 0.000 us 0.005 sy 0.078 es Thu May 17 05:57
+cc1 - root 0.024 secs 0.008 us 0.016 sy 0.347 es Thu May 17 05:57
+time - root 0.003 secs 0.000 us 0.003 sy 0.005 es Thu May 17 05:57
+1234567890123456 - root 0.002 secs 0.000 us 0.002 sy 0.002 es Thu May 17 05:57
+ln - root 0.002 secs 0.000 us 0.002 sy 0.002 es Thu May 17 05:57
+time - root 0.003 secs 0.000 us 0.003 sy 0.005 es Thu May 17 05:57
+1234567890123456 - root 0.002 secs 0.000 us 0.002 sy 0.002 es Thu May 17 05:57
+ln - root 0.002 secs 0.000 us 0.002 sy 0.002 es Thu May 17 05:57
+time - root 0.003 secs 0.000 us 0.003 sy 0.013 es Thu May 17 05:57
+123456789012345 - root 0.002 secs 0.000 us 0.002 sy 0.010 es Thu May 17 05:57
+ln - root 0.003 secs 0.000 us 0.003 sy 0.003 es Thu May 17 05:57
+time - root 0.003 secs 0.000 us 0.003 sy 0.246 es Thu May 17 05:57
+diff - root 0.223 secs 0.164 us 0.060 sy 0.243 es Thu May 17 05:57
+time - root 0.003 secs 0.000 us 0.003 sy 0.079 es Thu May 17 05:57
+dd - root 0.076 secs 0.000 us 0.076 sy 0.076 es Thu May 17 05:57
+time - root 0.004 secs 0.000 us 0.004 sy 3.006 es Thu May 17 05:57
+sleep - root 0.002 secs 0.000 us 0.002 sy 3.002 es Thu May 17 05:57
+time - root 0.003 secs 0.000 us 0.003 sy 9.945 es Thu May 17 05:57
+find - root 0.822 secs 0.055 us 0.767 sy 9.942 es Thu May 17 05:57
+time - root 0.003 secs 0.000 us 0.003 sy 3.313 es Thu May 17 05:57
+egrep - root 3.247 secs 3.247 us 0.000 sy 3.310 es Thu May 17 05:57
+time - root 0.003 secs 0.000 us 0.003 sy 0.185 es Thu May 17 05:57
+awk - root 0.163 secs 0.156 us 0.007 sy 0.164 es Thu May 17 05:57
+accton - root 0.002 secs 0.000 us 0.002 sy 0.019 es Thu May 17 05:57
diff --git a/usr.bin/lastcomm/tests/v2-i386-acct.in b/usr.bin/lastcomm/tests/v2-i386-acct.in
new file mode 100644
index 0000000..4cdd973
--- /dev/null
+++ b/usr.bin/lastcomm/tests/v2-i386-acct.in
Binary files differ
diff --git a/usr.bin/lastcomm/tests/v2-i386.out b/usr.bin/lastcomm/tests/v2-i386.out
new file mode 100644
index 0000000..61bc811
--- /dev/null
+++ b/usr.bin/lastcomm/tests/v2-i386.out
@@ -0,0 +1,28 @@
+core -FDX root 0.000 secs 0.000 us 0.000 sy 0.005 es Fri May 18 15:13
+core -DX root 0.002 secs 0.000 us 0.002 sy 0.005 es Fri May 18 15:13
+cc - root 0.002 secs 0.000 us 0.002 sy 0.048 es Fri May 18 15:13
+ld - root 0.028 secs 0.019 us 0.009 sy 0.028 es Fri May 18 15:13
+as - root 0.002 secs 0.002 us 0.000 sy 0.002 es Fri May 18 15:13
+cc1 - root 0.016 secs 0.016 us 0.000 sy 0.016 es Fri May 18 15:13
+time - root 0.001 secs 0.000 us 0.001 sy 0.002 es Fri May 18 15:13
+1234567890123456 - root 0.001 secs 0.000 us 0.001 sy 0.001 es Fri May 18 15:13
+ln - root 0.001 secs 0.000 us 0.001 sy 0.001 es Fri May 18 15:13
+time - root 0.001 secs 0.001 us 0.000 sy 0.002 es Fri May 18 15:13
+1234567890123456 - root 0.001 secs 0.000 us 0.001 sy 0.001 es Fri May 18 15:13
+ln - root 0.001 secs 0.000 us 0.001 sy 0.001 es Fri May 18 15:13
+time - root 0.001 secs 0.000 us 0.001 sy 0.002 es Fri May 18 15:13
+123456789012345 - root 0.001 secs 0.000 us 0.001 sy 0.001 es Fri May 18 15:13
+ln - root 0.001 secs 0.000 us 0.001 sy 0.001 es Fri May 18 15:13
+time - root 0.001 secs 0.000 us 0.001 sy 0.425 es Fri May 18 15:13
+diff - root 0.423 secs 0.392 us 0.031 sy 0.424 es Fri May 18 15:13
+time - root 0.001 secs 0.000 us 0.001 sy 0.028 es Fri May 18 15:13
+dd - root 0.025 secs 0.000 us 0.025 sy 0.026 es Fri May 18 15:13
+time - root 0.001 secs 0.000 us 0.001 sy 3.002 es Fri May 18 15:13
+sleep - root 0.001 secs 0.000 us 0.001 sy 3.001 es Fri May 18 15:13
+time - root 0.001 secs 0.000 us 0.001 sy 0.250 es Fri May 18 15:13
+find - root 0.248 secs 0.078 us 0.171 sy 0.249 es Fri May 18 15:13
+time - root 0.001 secs 0.000 us 0.001 sy 6.724 es Fri May 18 15:12
+egrep - root 6.680 secs 6.680 us 0.000 sy 6.722 es Fri May 18 15:12
+time - root 0.001 secs 0.000 us 0.001 sy 0.450 es Fri May 18 15:12
+awk - root 0.448 secs 0.448 us 0.000 sy 0.449 es Fri May 18 15:12
+accton - root 0.001 secs 0.000 us 0.001 sy 0.001 es Fri May 18 15:12
diff --git a/usr.bin/lastcomm/tests/v2-sparc64-acct.in b/usr.bin/lastcomm/tests/v2-sparc64-acct.in
new file mode 100644
index 0000000..26df19e
--- /dev/null
+++ b/usr.bin/lastcomm/tests/v2-sparc64-acct.in
Binary files differ
diff --git a/usr.bin/lastcomm/tests/v2-sparc64.out b/usr.bin/lastcomm/tests/v2-sparc64.out
new file mode 100644
index 0000000..f693e8e
--- /dev/null
+++ b/usr.bin/lastcomm/tests/v2-sparc64.out
@@ -0,0 +1,36 @@
+core -FDX root 0.010 secs 0.000 us 0.010 sy 0.042 es Sat May 19 09:17
+core -DX root 0.037 secs 0.001 us 0.036 sy 0.055 es Sat May 19 09:17
+cc - root 0.033 secs 0.002 us 0.031 sy 1.012 es Sat May 19 09:17
+ld - root 0.186 secs 0.115 us 0.071 sy 0.361 es Sat May 19 09:17
+as - root 0.030 secs 0.005 us 0.025 sy 0.126 es Sat May 19 09:17
+cc1 - root 0.105 secs 0.048 us 0.057 sy 0.417 es Sat May 19 09:17
+time - root 0.029 secs 0.001 us 0.028 sy 0.047 es Sat May 19 09:17
+1234567890123456 - root 0.017 secs 0.003 us 0.014 sy 0.019 es Sat May 19 09:17
+ln - root 0.019 secs 0.003 us 0.016 sy 0.020 es Sat May 19 09:17
+time - root 0.029 secs 0.003 us 0.025 sy 0.047 es Sat May 19 09:17
+1234567890123456 - root 0.017 secs 0.002 us 0.015 sy 0.019 es Sat May 19 09:17
+ln - root 0.019 secs 0.004 us 0.015 sy 0.020 es Sat May 19 09:17
+time - root 0.029 secs 0.004 us 0.025 sy 0.053 es Sat May 19 09:17
+123456789012345 - root 0.018 secs 0.001 us 0.016 sy 0.025 es Sat May 19 09:17
+ln - root 0.020 secs 0.001 us 0.019 sy 0.020 es Sat May 19 09:17
+time - root 0.029 secs 0.003 us 0.026 sy 1.702 es Sat May 19 09:17
+diff - root 1.636 secs 1.337 us 0.299 sy 1.674 es Sat May 19 09:17
+time - root 0.027 secs 0.002 us 0.026 sy 0.634 es Sat May 19 09:17
+dd - root 0.588 secs 0.017 us 0.571 sy 0.605 es Sat May 19 09:17
+time - root 0.028 secs 0.001 us 0.027 sy 3.049 es Sat May 19 09:17
+sleep - root 0.018 secs 0.002 us 0.016 sy 3.021 es Sat May 19 09:17
+time - root 0.029 secs 0.002 us 0.027 sy 17.970 es Sat May 19 09:17
+find - root 5.703 secs 0.555 us 5.148 sy 17.942 es Sat May 19 09:17
+time - root 0.029 secs 0.005 us 0.024 sy 27.162 es Sat May 19 09:16
+egrep - root 26.715 secs 26.632 us 0.082 sy 27.133 es Sat May 19 09:16
+logger - root 0.023 secs 0.005 us 0.018 sy 60.808 es Sat May 19 09:15
+sh -F root 0.008 secs 0.000 us 0.008 sy 60.815 es Sat May 19 09:15
+fsck - root 0.055 secs 0.008 us 0.047 sy 60.806 es Sat May 19 09:15
+fsck_ufs - root 0.028 secs 0.005 us 0.022 sy 0.140 es Sat May 19 09:16
+fsck_ufs - root 0.028 secs 0.006 us 0.022 sy 0.123 es Sat May 19 09:16
+fsck_ufs - root 0.028 secs 0.004 us 0.024 sy 0.058 es Sat May 19 09:16
+fsck_ufs - root 0.032 secs 0.004 us 0.028 sy 0.326 es Sat May 19 09:16
+sleep - root 0.019 secs 0.001 us 0.018 sy 60.085 es Sat May 19 09:15
+time - root 0.029 secs 0.005 us 0.025 sy 1.701 es Sat May 19 09:16
+awk - root 1.644 secs 1.617 us 0.028 sy 1.657 es Sat May 19 09:16
+accton - root 0.019 secs 0.003 us 0.016 sy 0.027 es Sat May 19 09:16
diff --git a/usr.bin/lastcomm/tests/values.sh b/usr.bin/lastcomm/tests/values.sh
new file mode 100755
index 0000000..ab27f62
--- /dev/null
+++ b/usr.bin/lastcomm/tests/values.sh
@@ -0,0 +1,83 @@
+#!/bin/sh
+#
+# $FreeBSD$
+#
+
+ACCT=acct
+RESULTS=acct.`uname -m`.tar.gz
+TMPDIR=$$.tmp
+TZ=UTC; export TZ
+
+run()
+{
+ /usr/bin/time -l -o $1.time "$@"
+}
+
+if [ `whoami` != "root" ]; then
+ echo "You need to be root to run this test."
+ exit 1
+fi
+
+echo Redirecting accounting.
+
+mkdir $TMPDIR
+cd $TMPDIR
+
+:>$ACCT
+accton $ACCT
+
+echo Running commands. This should not take more than 30s.
+
+# User time
+run awk 'BEGIN {for (i = 0; i < 1000000; i++) cos(.3)}' /dev/null
+run egrep '(.)(.)(.)(.)(.)(.)(.)(.)(.)\9\8\7\6\5\4\3\2\1' /usr/share/dict/words
+
+# System time
+run find /usr/src -name xyzzy
+
+# Elapsed time
+run sleep 3
+
+# IO
+run dd if=/dev/zero bs=512 count=4096 of=zero 2>/dev/null
+
+# Memory
+run diff /usr/share/dict/words /dev/null >/dev/null
+
+# AC_COMM_LEN - 1
+ln /usr/bin/true 123456789012345
+run ./123456789012345
+
+# AC_COMM_LEN
+ln /usr/bin/true 1234567890123456
+run ./1234567890123456
+
+# AC_COMM_LEN + 1
+ln /usr/bin/true 12345678901234567
+run ./12345678901234567
+
+# Flags: core, fork, signal
+echo 'main(){volatile int s; fork(); s = *(int *)0;}' >core.c
+cc -o core core.c
+echo Generating segmentation fault.
+./core
+
+echo Turning off redirected accounting.
+
+accton
+
+echo Packing the results.
+
+sa -u $ACCT >sa.u
+lastcomm -cesuS -f $ACCT >lastcomm.cesuS
+tar -cf - acct sa.u lastcomm.cesuS *.time |
+gzip -c |
+uuencode $RESULTS >../$RESULTS.uue
+
+echo Cleaning up.
+cd ..
+rm -rf $TMPDIR
+
+echo "Done! Please send your reply, enclosing the file $RESULTS.uue"
+echo If your system runs with accounting enabled you probably need to run:
+echo accton /var/account/acct
OpenPOWER on IntegriCloud