Migrate tools/regression/{usr.bin/lastcomm,usr.sbin}/ to the new tests layout.
This change was originally going to only migrate the usr.sbin tests but, as it turns out, the usr.sbin/sa/ tests require files from usr.bin/lastcomm/ so it's better to just also migrate the latter at the same time. The other usr.bin tests will be moved separately. To make these tests work within the test suite, some of them have required changes to prevent modifying the source directory and instead just rely on the current directory for file manipulation.
This commit is contained in:
@@ -95,6 +95,16 @@
|
||||
atf-sh
|
||||
..
|
||||
..
|
||||
lastcomm
|
||||
..
|
||||
..
|
||||
usr.sbin
|
||||
etcupdate
|
||||
..
|
||||
newsyslog
|
||||
..
|
||||
sa
|
||||
..
|
||||
..
|
||||
..
|
||||
..
|
||||
|
||||
@@ -2,8 +2,5 @@
|
||||
|
||||
SUBDIR= apply calendar comm file2c join jot m4 ncal printf sed tr \
|
||||
uudecode uuencode xargs
|
||||
.if !defined(AUTOMATED)
|
||||
SUBDIR+= lastcomm
|
||||
.endif
|
||||
|
||||
.include <bsd.subdir.mk>
|
||||
|
||||
@@ -1,6 +0,0 @@
|
||||
# $FreeBSD$
|
||||
|
||||
all: regress
|
||||
|
||||
regress: regress.t
|
||||
./regress.t
|
||||
@@ -1,41 +0,0 @@
|
||||
#!/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 - $DIR/$1
|
||||
then
|
||||
echo "ok $NUM"
|
||||
else
|
||||
echo "not ok $NUM"
|
||||
fi
|
||||
}
|
||||
|
||||
|
||||
cat $DIR/v1-$ARCH-acct.in $DIR/v2-$ARCH-acct.in >$DIR/v1v2-$ARCH-acct.in
|
||||
cat $DIR/v2-$ARCH.out $DIR/v1-$ARCH.out >$DIR/v1v2-$ARCH.out
|
||||
|
||||
echo 1..6
|
||||
|
||||
lastcomm -cesuS -f $DIR/v1-$ARCH-acct.in | check 1 v1-$ARCH.out
|
||||
lastcomm -cesuS -f - <$DIR/v1-$ARCH-acct.in | tail -r | check 2 v1-$ARCH.out
|
||||
lastcomm -cesuS -f $DIR/v2-$ARCH-acct.in | check 3 v2-$ARCH.out
|
||||
lastcomm -cesuS -f - <$DIR/v2-$ARCH-acct.in | tail -r | check 4 v2-$ARCH.out
|
||||
lastcomm -cesuS -f $DIR/v1v2-$ARCH-acct.in | check 5 v1v2-$ARCH.out
|
||||
lastcomm -cesuS -f - <$DIR/v1v2-$ARCH-acct.in | tail -r | check 6 v1v2-$ARCH.out
|
||||
|
||||
rm $DIR/v1v2-$ARCH-acct.in
|
||||
rm $DIR/v1v2-$ARCH.out
|
||||
|
||||
exit 0
|
||||
@@ -1,5 +0,0 @@
|
||||
# $FreeBSD$
|
||||
|
||||
SUBDIR= newsyslog sa
|
||||
|
||||
.include <bsd.subdir.mk>
|
||||
@@ -1,4 +0,0 @@
|
||||
# $FreeBSD$
|
||||
|
||||
all:
|
||||
sh regress.sh
|
||||
@@ -1,6 +0,0 @@
|
||||
#!/bin/sh
|
||||
# $FreeBSD$
|
||||
|
||||
cd `dirname $0`
|
||||
|
||||
sh regress.sh
|
||||
@@ -1,6 +0,0 @@
|
||||
# $FreeBSD$
|
||||
|
||||
all: regress
|
||||
|
||||
regress: regress.t
|
||||
./regress.t
|
||||
@@ -1,81 +0,0 @@
|
||||
#!/bin/sh
|
||||
#
|
||||
# $FreeBSD$
|
||||
#
|
||||
|
||||
DIR=`dirname $0`
|
||||
LCDIR=`dirname $0`/../../usr.bin/lastcomm
|
||||
ARCH=`uname -m`
|
||||
|
||||
collapse_whitespace()
|
||||
{
|
||||
sed -E 's,[ ]+, ,g'
|
||||
}
|
||||
|
||||
check()
|
||||
{
|
||||
NUM=$1
|
||||
shift
|
||||
collapse_whitespace | \
|
||||
if diff -q - $1
|
||||
then
|
||||
echo "ok $NUM"
|
||||
else
|
||||
echo "not ok $NUM"
|
||||
fi
|
||||
}
|
||||
|
||||
cp $LCDIR/v1-$ARCH-acct.in $DIR/v1-$ARCH-acct.in
|
||||
cp $LCDIR/v2-$ARCH-acct.in $DIR/v2-$ARCH-acct.in
|
||||
|
||||
echo 1..13
|
||||
|
||||
# Command listings of the two acct versions
|
||||
sa -u $DIR/v1-$ARCH-acct.in | check 1 $DIR/v1-$ARCH-u.out
|
||||
sa -u $DIR/v2-$ARCH-acct.in | check 2 $DIR/v2-$ARCH-u.out
|
||||
|
||||
# Plain summaries of user/process
|
||||
sa -i $DIR/v1-$ARCH-acct.in | check 3 $DIR/v1-$ARCH-sav.out
|
||||
sa -im $DIR/v1-$ARCH-acct.in | check 4 $DIR/v1-$ARCH-usr.out
|
||||
|
||||
# Backward compatibility of v1 summary files
|
||||
sa -P $DIR/v1-$ARCH-sav.in -U $DIR/v1-$ARCH-usr.in /dev/null |
|
||||
check 5 $DIR/v1-$ARCH-sav.out
|
||||
sa -m -P $DIR/v1-$ARCH-sav.in -U $DIR/v1-$ARCH-usr.in /dev/null |
|
||||
check 6 $DIR/v1-$ARCH-usr.out
|
||||
|
||||
# Convert old summary format to new
|
||||
cp $DIR/v1-$ARCH-sav.in $DIR/v2c-$ARCH-sav.in
|
||||
cp $DIR/v1-$ARCH-usr.in $DIR/v2c-$ARCH-usr.in
|
||||
sa -s -P $DIR/v2c-$ARCH-sav.in -U $DIR/v2c-$ARCH-usr.in /dev/null >/dev/null
|
||||
sa -P $DIR/v2c-$ARCH-sav.in -U $DIR/v2c-$ARCH-usr.in /dev/null |
|
||||
check 7 $DIR/v1-$ARCH-sav.out
|
||||
sa -m -P $DIR/v2c-$ARCH-sav.in -U $DIR/v2c-$ARCH-usr.in /dev/null |
|
||||
check 8 $DIR/v1-$ARCH-usr.out
|
||||
|
||||
# Reading v2 summary files
|
||||
sa -P $DIR/v2-$ARCH-sav.in -U $DIR/v2-$ARCH-usr.in /dev/null |
|
||||
check 9 $DIR/v1-$ARCH-sav.out
|
||||
sa -m -P $DIR/v2-$ARCH-sav.in -U $DIR/v2-$ARCH-usr.in /dev/null |
|
||||
check 10 $DIR/v1-$ARCH-usr.out
|
||||
|
||||
# Summarize
|
||||
sa -is -P $DIR/v2c-$ARCH-sav.in -U $DIR/v2c-$ARCH-usr.in $DIR/v1-$ARCH-acct.in >/dev/null
|
||||
sa -P $DIR/v2c-$ARCH-sav.in -U $DIR/v2c-$ARCH-usr.in /dev/null |
|
||||
check 11 $DIR/v1-$ARCH-sav.out
|
||||
sa -m -P $DIR/v2c-$ARCH-sav.in -U $DIR/v2c-$ARCH-usr.in /dev/null |
|
||||
check 12 $DIR/v1-$ARCH-usr.out
|
||||
|
||||
# Accumulate
|
||||
cp $LCDIR/v1-$ARCH-acct.in $DIR/v1-$ARCH-acct.in
|
||||
sa -is -P $DIR/v2c-$ARCH-sav.in -U $DIR/v2c-$ARCH-usr.in $DIR/v1-$ARCH-acct.in >/dev/null
|
||||
cp $LCDIR/v1-$ARCH-acct.in $DIR/v1-$ARCH-acct.in
|
||||
sa -s -P $DIR/v2c-$ARCH-sav.in -U $DIR/v2c-$ARCH-usr.in $DIR/v1-$ARCH-acct.in \
|
||||
| collapse_whitespace >$DIR/double
|
||||
cp $LCDIR/v1-$ARCH-acct.in $DIR/v1-$ARCH-acct.in
|
||||
sa -i $DIR/v1-$ARCH-acct.in $DIR/v1-$ARCH-acct.in | check 13 $DIR/double
|
||||
|
||||
# Clean up
|
||||
rm $DIR/double $DIR/v2c-$ARCH-usr.in $DIR/v2c-$ARCH-sav.in $DIR/v1-$ARCH-acct.in $DIR/v2-$ARCH-acct.in
|
||||
|
||||
exit 0
|
||||
@@ -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>
|
||||
|
||||
@@ -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>
|
||||
@@ -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
|
||||
Regular → Executable
+1
@@ -6,6 +6,7 @@
|
||||
ACCT=acct
|
||||
RESULTS=acct.`uname -m`.tar.gz
|
||||
TMPDIR=$$.tmp
|
||||
TZ=UTC; export TZ
|
||||
|
||||
run()
|
||||
{
|
||||
@@ -284,6 +284,10 @@ SUBDIR+= praliases
|
||||
SUBDIR+= sendmail
|
||||
.endif
|
||||
|
||||
.if ${MK_TESTS} != "no"
|
||||
SUBDIR+= tests
|
||||
.endif
|
||||
|
||||
.if ${MK_TOOLCHAIN} != "no"
|
||||
SUBDIR+= config
|
||||
SUBDIR+= crunch
|
||||
|
||||
@@ -1,6 +1,12 @@
|
||||
# $FreeBSD$
|
||||
|
||||
.include <bsd.own.mk>
|
||||
|
||||
SCRIPTS=etcupdate.sh
|
||||
MAN= etcupdate.8
|
||||
|
||||
.if ${MK_TESTS} != "no"
|
||||
SUBDIR+= tests
|
||||
.endif
|
||||
|
||||
.include <bsd.prog.mk>
|
||||
|
||||
@@ -0,0 +1,17 @@
|
||||
# $FreeBSD$
|
||||
|
||||
TESTSDIR= ${TESTSBASE}/usr.sbin/etcupdate
|
||||
|
||||
PLAIN_TESTS_SH=
|
||||
.for test in always_test \
|
||||
conflicts_test \
|
||||
fbsdid_test \
|
||||
ignore_test \
|
||||
preworld_test \
|
||||
tests_test \
|
||||
tzsetup_test
|
||||
PLAIN_TESTS_SH+= ${test}
|
||||
TEST_METADATA.${test}+= required_user="root"
|
||||
.endfor
|
||||
|
||||
.include <bsd.test.mk>
|
||||
Executable → Regular
Executable → Regular
Executable → Regular
Executable → Regular
Executable → Regular
Executable → Regular
Executable → Regular
@@ -1,7 +1,13 @@
|
||||
# $FreeBSD$
|
||||
|
||||
.include <bsd.own.mk>
|
||||
|
||||
PROG= newsyslog
|
||||
MAN= newsyslog.8 newsyslog.conf.5
|
||||
SRCS= newsyslog.c ptimes.c
|
||||
|
||||
.if ${MK_TESTS} != "no"
|
||||
SUBDIR+= tests
|
||||
.endif
|
||||
|
||||
.include <bsd.prog.mk>
|
||||
|
||||
@@ -0,0 +1,7 @@
|
||||
# $FreeBSD$
|
||||
|
||||
TESTSDIR= ${TESTSBASE}/usr.sbin/newsyslog
|
||||
|
||||
TAP_TESTS_SH= legacy_test
|
||||
|
||||
.include <bsd.test.mk>
|
||||
Executable → Regular
+1
-1
@@ -3,7 +3,7 @@
|
||||
# $FreeBSD$
|
||||
|
||||
COUNT=0
|
||||
TMPDIR=`mktemp -d -t regress_newsyslog`
|
||||
TMPDIR=$(pwd)/work
|
||||
if [ $? -ne 0 ]; then
|
||||
echo "$0: Can't create temp dir, exiting..."
|
||||
exit 1
|
||||
@@ -1,9 +1,15 @@
|
||||
# $FreeBSD$
|
||||
|
||||
.include <bsd.own.mk>
|
||||
|
||||
.PATH: ${.CURDIR}/../../usr.bin/lastcomm
|
||||
|
||||
PROG= sa
|
||||
MAN= sa.8
|
||||
SRCS= main.c db.c pdb.c usrdb.c readrec.c
|
||||
|
||||
.if ${MK_TESTS} != "no"
|
||||
SUBDIR+= tests
|
||||
.endif
|
||||
|
||||
.include <bsd.prog.mk>
|
||||
|
||||
@@ -0,0 +1,33 @@
|
||||
# $FreeBSD$
|
||||
|
||||
TESTSDIR= ${TESTSBASE}/usr.sbin/sa
|
||||
|
||||
TAP_TESTS_SH= legacy_test
|
||||
|
||||
FILESDIR= ${TESTSDIR}
|
||||
FILES= v1-amd64-sav.in
|
||||
FILES+= v1-amd64-sav.out
|
||||
FILES+= v1-amd64-u.out
|
||||
FILES+= v1-amd64-usr.in
|
||||
FILES+= v1-amd64-usr.out
|
||||
FILES+= v1-i386-sav.in
|
||||
FILES+= v1-i386-sav.out
|
||||
FILES+= v1-i386-u.out
|
||||
FILES+= v1-i386-usr.in
|
||||
FILES+= v1-i386-usr.out
|
||||
FILES+= v1-sparc64-sav.in
|
||||
FILES+= v1-sparc64-sav.out
|
||||
FILES+= v1-sparc64-u.out
|
||||
FILES+= v1-sparc64-usr.in
|
||||
FILES+= v1-sparc64-usr.out
|
||||
FILES+= v2-amd64-sav.in
|
||||
FILES+= v2-amd64-u.out
|
||||
FILES+= v2-amd64-usr.in
|
||||
FILES+= v2-i386-sav.in
|
||||
FILES+= v2-i386-u.out
|
||||
FILES+= v2-i386-usr.in
|
||||
FILES+= v2-sparc64-sav.in
|
||||
FILES+= v2-sparc64-u.out
|
||||
FILES+= v2-sparc64-usr.in
|
||||
|
||||
.include <bsd.test.mk>
|
||||
@@ -0,0 +1,78 @@
|
||||
#!/bin/sh
|
||||
#
|
||||
# $FreeBSD$
|
||||
#
|
||||
|
||||
DIR=`dirname $0`
|
||||
LCDIR=`dirname $0`/../../usr.bin/lastcomm
|
||||
ARCH=`uname -m`
|
||||
|
||||
collapse_whitespace()
|
||||
{
|
||||
sed -E 's,[ ]+, ,g'
|
||||
}
|
||||
|
||||
check()
|
||||
{
|
||||
NUM=$1
|
||||
shift
|
||||
collapse_whitespace | \
|
||||
if diff -q - $1
|
||||
then
|
||||
echo "ok $NUM"
|
||||
else
|
||||
echo "not ok $NUM"
|
||||
fi
|
||||
}
|
||||
|
||||
install -c -m 644 $LCDIR/v1-$ARCH-acct.in v1-$ARCH-acct.in
|
||||
install -c -m 644 $LCDIR/v2-$ARCH-acct.in v2-$ARCH-acct.in
|
||||
|
||||
echo 1..13
|
||||
|
||||
# Command listings of the two acct versions
|
||||
sa -u v1-$ARCH-acct.in | check 1 $DIR/v1-$ARCH-u.out
|
||||
sa -u v2-$ARCH-acct.in | check 2 $DIR/v2-$ARCH-u.out
|
||||
|
||||
# Plain summaries of user/process
|
||||
sa -i v1-$ARCH-acct.in | check 3 $DIR/v1-$ARCH-sav.out
|
||||
sa -im v1-$ARCH-acct.in | check 4 $DIR/v1-$ARCH-usr.out
|
||||
|
||||
# Backward compatibility of v1 summary files
|
||||
sa -P $DIR/v1-$ARCH-sav.in -U $DIR/v1-$ARCH-usr.in /dev/null |
|
||||
check 5 $DIR/v1-$ARCH-sav.out
|
||||
sa -m -P $DIR/v1-$ARCH-sav.in -U $DIR/v1-$ARCH-usr.in /dev/null |
|
||||
check 6 $DIR/v1-$ARCH-usr.out
|
||||
|
||||
# Convert old summary format to new
|
||||
install -c -m 644 $DIR/v1-$ARCH-sav.in v2c-$ARCH-sav.in
|
||||
install -c -m 644 $DIR/v1-$ARCH-usr.in v2c-$ARCH-usr.in
|
||||
sa -s -P v2c-$ARCH-sav.in -U v2c-$ARCH-usr.in /dev/null >/dev/null
|
||||
sa -P v2c-$ARCH-sav.in -U v2c-$ARCH-usr.in /dev/null |
|
||||
check 7 $DIR/v1-$ARCH-sav.out
|
||||
sa -m -P v2c-$ARCH-sav.in -U v2c-$ARCH-usr.in /dev/null |
|
||||
check 8 $DIR/v1-$ARCH-usr.out
|
||||
|
||||
# Reading v2 summary files
|
||||
sa -P $DIR/v2-$ARCH-sav.in -U $DIR/v2-$ARCH-usr.in /dev/null |
|
||||
check 9 $DIR/v1-$ARCH-sav.out
|
||||
sa -m -P $DIR/v2-$ARCH-sav.in -U $DIR/v2-$ARCH-usr.in /dev/null |
|
||||
check 10 $DIR/v1-$ARCH-usr.out
|
||||
|
||||
# Summarize
|
||||
sa -is -P v2c-$ARCH-sav.in -U v2c-$ARCH-usr.in v1-$ARCH-acct.in >/dev/null
|
||||
sa -P v2c-$ARCH-sav.in -U v2c-$ARCH-usr.in /dev/null |
|
||||
check 11 $DIR/v1-$ARCH-sav.out
|
||||
sa -m -P v2c-$ARCH-sav.in -U v2c-$ARCH-usr.in /dev/null |
|
||||
check 12 $DIR/v1-$ARCH-usr.out
|
||||
|
||||
# Accumulate
|
||||
install -c -m 644 $LCDIR/v1-$ARCH-acct.in v1-$ARCH-acct.in
|
||||
sa -is -P v2c-$ARCH-sav.in -U v2c-$ARCH-usr.in v1-$ARCH-acct.in >/dev/null
|
||||
install -c -m 644 $LCDIR/v1-$ARCH-acct.in v1-$ARCH-acct.in
|
||||
sa -s -P v2c-$ARCH-sav.in -U v2c-$ARCH-usr.in v1-$ARCH-acct.in \
|
||||
| collapse_whitespace >double
|
||||
cp $LCDIR/v1-$ARCH-acct.in v1-$ARCH-acct.in
|
||||
sa -i v1-$ARCH-acct.in v1-$ARCH-acct.in | check 13 double
|
||||
|
||||
exit 0
|
||||
Regular → Executable
+2
@@ -6,6 +6,8 @@
|
||||
# $FreeBSD$
|
||||
#
|
||||
|
||||
TZ=UTC; export TZ
|
||||
|
||||
# Set this to the path of the current sa command
|
||||
SANEW=/usr/sbin/sa
|
||||
|
||||
@@ -0,0 +1,10 @@
|
||||
# $FreeBSD$
|
||||
|
||||
.include <bsd.own.mk>
|
||||
|
||||
TESTSDIR= ${TESTSBASE}/usr.sbin
|
||||
|
||||
.PATH: ${.CURDIR:H:H}/tests
|
||||
KYUAFILE= yes
|
||||
|
||||
.include <bsd.test.mk>
|
||||
Reference in New Issue
Block a user