1#!/bin/sh
2#
3# $FreeBSD$
4#
5
6ACCT=acct
7RESULTS=acct.`uname -m`.tar.gz
8TMPDIR=$$.tmp
9TZ=UTC; export TZ
10
11run()
12{
13	/usr/bin/time -l -o $1.time "$@"
14}
15
16if [ `whoami` != "root" ]; then
17	echo "You need to be root to run this test."
18	exit 1
19fi
20
21echo Redirecting accounting.
22
23mkdir $TMPDIR
24cd $TMPDIR
25
26:>$ACCT
27accton $ACCT
28
29echo Running commands. This should not take more than 30s.
30
31# User time
32run awk 'BEGIN {for (i = 0; i < 1000000; i++) cos(.3)}' /dev/null
33run egrep '(.)(.)(.)(.)(.)(.)(.)(.)(.)\9\8\7\6\5\4\3\2\1' /usr/share/dict/words
34
35# System time
36run find /usr/src -name xyzzy
37
38# Elapsed time
39run sleep 3
40
41# IO
42run dd if=/dev/zero bs=512 count=4096 of=zero 2>/dev/null
43
44# Memory
45run diff /usr/share/dict/words /dev/null >/dev/null
46
47# AC_COMM_LEN - 1
48ln /usr/bin/true 123456789012345
49run ./123456789012345
50
51# AC_COMM_LEN
52ln /usr/bin/true 1234567890123456
53run ./1234567890123456
54
55# AC_COMM_LEN + 1
56ln /usr/bin/true 12345678901234567
57run ./12345678901234567
58
59# Flags: core, fork, signal
60echo 'main(){volatile int s; fork(); s = *(int *)0;}' >core.c
61cc -o core core.c
62echo Generating segmentation fault.
63./core
64
65echo Turning off redirected accounting.
66
67accton
68
69echo Packing the results.
70
71sa -u $ACCT >sa.u
72lastcomm -cesuS -f $ACCT >lastcomm.cesuS
73tar -cf - acct sa.u lastcomm.cesuS *.time |
74gzip -c |
75uuencode $RESULTS >../$RESULTS.uue
76
77echo Cleaning up.
78cd ..
79rm -rf $TMPDIR
80
81echo "Done!  Please send your reply, enclosing the file $RESULTS.uue"
82echo If your system runs with accounting enabled you probably need to run:
83echo accton /var/account/acct
84