From 1e4589b921fdaa1b1d2fc6b6ed016f1e0a01cb8f Mon Sep 17 00:00:00 2001 From: jmmv Date: Sun, 27 Apr 2014 01:15:10 +0000 Subject: MFC various moves of tools/regressions/ tests to the new infrastructure. - r263220 Migrate tools/regression/sbin/ to the new tests layout. - r263222 Add Makefile missed in r263220. - r263226 Migrate tools/regression/{usr.bin/lastcomm,usr.sbin}/ to the new tests layout. - r263227 Migrate most of tools/regression/usr.bin/ to the new tests layout. - r263345 Expand tabs that sneaked in into spaces. - r263346 Migrate tools/regression/usr.bin/make/ to the new tests layout. - r263348 Add Makefiles missed in r263346. - r263351 Migrate tools/regression/usr.bin/pkill/ to the new tests layout. - r263388 Mark multi_test as requiring /usr/share/dict/words. - r263814 Fix path to the run.pl script to let these tests run. - r264742 Prevent building tests when bootstrapping make. This is 'make tinderbox' clean. --- usr.bin/lastcomm/Makefile | 6 +++ usr.bin/lastcomm/tests/Makefile | 21 ++++++++ usr.bin/lastcomm/tests/README | 10 ++++ usr.bin/lastcomm/tests/legacy_test.sh | 38 ++++++++++++++ usr.bin/lastcomm/tests/v1-amd64-acct.in | Bin 0 -> 1568 bytes usr.bin/lastcomm/tests/v1-amd64.out | 28 ++++++++++ usr.bin/lastcomm/tests/v1-i386-acct.in | Bin 0 -> 1344 bytes usr.bin/lastcomm/tests/v1-i386.out | 28 ++++++++++ usr.bin/lastcomm/tests/v1-sparc64-acct.in | Bin 0 -> 1568 bytes usr.bin/lastcomm/tests/v1-sparc64.out | 28 ++++++++++ usr.bin/lastcomm/tests/v2-amd64-acct.in | Bin 0 -> 2016 bytes usr.bin/lastcomm/tests/v2-amd64.out | 28 ++++++++++ usr.bin/lastcomm/tests/v2-i386-acct.in | Bin 0 -> 1792 bytes usr.bin/lastcomm/tests/v2-i386.out | 28 ++++++++++ usr.bin/lastcomm/tests/v2-sparc64-acct.in | Bin 0 -> 2592 bytes usr.bin/lastcomm/tests/v2-sparc64.out | 36 +++++++++++++ usr.bin/lastcomm/tests/values.sh | 83 ++++++++++++++++++++++++++++++ 17 files changed, 334 insertions(+) create mode 100644 usr.bin/lastcomm/tests/Makefile create mode 100644 usr.bin/lastcomm/tests/README create mode 100644 usr.bin/lastcomm/tests/legacy_test.sh create mode 100644 usr.bin/lastcomm/tests/v1-amd64-acct.in create mode 100644 usr.bin/lastcomm/tests/v1-amd64.out create mode 100644 usr.bin/lastcomm/tests/v1-i386-acct.in create mode 100644 usr.bin/lastcomm/tests/v1-i386.out create mode 100644 usr.bin/lastcomm/tests/v1-sparc64-acct.in create mode 100644 usr.bin/lastcomm/tests/v1-sparc64.out create mode 100644 usr.bin/lastcomm/tests/v2-amd64-acct.in create mode 100644 usr.bin/lastcomm/tests/v2-amd64.out create mode 100644 usr.bin/lastcomm/tests/v2-i386-acct.in create mode 100644 usr.bin/lastcomm/tests/v2-i386.out create mode 100644 usr.bin/lastcomm/tests/v2-sparc64-acct.in create mode 100644 usr.bin/lastcomm/tests/v2-sparc64.out create mode 100755 usr.bin/lastcomm/tests/values.sh (limited to 'usr.bin/lastcomm') 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 + PROG= lastcomm SRCS= lastcomm.c readrec.c +.if ${MK_TESTS} != "no" +SUBDIR+= tests +.endif + .include 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 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 - $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 -- cgit v1.1