summaryrefslogtreecommitdiffstats
path: root/usr.bin/lastcomm/tests/values.sh
blob: ab27f62f71d0f36b409960fcaa89e181a7a43ae2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
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