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