Convert the regress/games tests to the atf
This change converts all the existing regression tests in regress/games to the new framework provided by atf. As a side effect, this also moves all the tests programs in regress/games to tests/games.
This commit is contained in:
parent
9b7401e7cb
commit
98380f8b63
@ -1,4 +1,4 @@
|
||||
# $NetBSD: mi,v 1.4 2007/11/12 15:18:07 jmmv Exp $
|
||||
# $NetBSD: mi,v 1.5 2007/11/12 15:19:45 jmmv Exp $
|
||||
./etc/mtree/set.tests tests-sys-root
|
||||
./usr/tests tests-base-tests
|
||||
./usr/tests/Atffile tests-base-tests
|
||||
@ -251,6 +251,9 @@
|
||||
./usr/tests/fs/tmpfs/t_truncate tests-fs-tests
|
||||
./usr/tests/fs/tmpfs/t_vnd tests-fs-tests
|
||||
./usr/tests/fs/tmpfs/t_vnode_leak tests-fs-tests
|
||||
./usr/tests/games tests-games-tests
|
||||
./usr/tests/games/Atffile tests-games-tests
|
||||
./usr/tests/games/t_factor tests-games-tests
|
||||
./usr/tests/util tests-util-tests
|
||||
./usr/tests/util/Atffile tests-util-tests
|
||||
./usr/tests/util/df tests-util-tests
|
||||
|
@ -1,4 +1,4 @@
|
||||
# $NetBSD: NetBSD.dist,v 1.351 2007/11/12 15:18:07 jmmv Exp $
|
||||
# $NetBSD: NetBSD.dist,v 1.352 2007/11/12 15:19:45 jmmv Exp $
|
||||
# @(#)4.4BSD.dist 8.1 (Berkeley) 6/13/93
|
||||
|
||||
# Do not customize this file as it may be overwritten on upgrades.
|
||||
@ -1090,6 +1090,7 @@
|
||||
./usr/tests/atf/units
|
||||
./usr/tests/fs
|
||||
./usr/tests/fs/tmpfs
|
||||
./usr/tests/games
|
||||
./usr/tests/util
|
||||
./usr/tests/util/df
|
||||
./usr/tests/util/ps
|
||||
|
@ -1,6 +1,6 @@
|
||||
# $NetBSD: Makefile,v 1.13 2007/05/18 20:28:11 christos Exp $
|
||||
# $NetBSD: Makefile,v 1.14 2007/11/12 15:19:45 jmmv Exp $
|
||||
|
||||
# missing: libexec sbin usr.sbin share gnu
|
||||
SUBDIR+= games include lib libexec sys usr.bin
|
||||
SUBDIR+= include lib libexec sys usr.bin
|
||||
|
||||
.include <bsd.subdir.mk>
|
||||
|
@ -1,5 +0,0 @@
|
||||
# $NetBSD: Makefile,v 1.1 2003/08/12 03:03:20 simonb Exp $
|
||||
|
||||
SUBDIR+= factor
|
||||
|
||||
.include <bsd.subdir.mk>
|
@ -1,8 +0,0 @@
|
||||
# $NetBSD: Makefile,v 1.1 2003/08/12 03:03:20 simonb Exp $
|
||||
|
||||
NOMAN= # defined
|
||||
|
||||
regress:
|
||||
@ksh ${.CURDIR}/factor.sh
|
||||
|
||||
.include <bsd.prog.mk>
|
@ -1,25 +0,0 @@
|
||||
#!/bin/ksh
|
||||
|
||||
function test_factor {
|
||||
echo "Testing: \`/usr/games/factor $1\`"
|
||||
res=`/usr/games/factor $1 2>&1`
|
||||
if [ "$res" != "$2" ]; then
|
||||
echo "Expected \"$2\", got \"$res\" from factor: `eval echo $1`"
|
||||
exit 1
|
||||
fi
|
||||
}
|
||||
|
||||
# The first arg will get factor'd.
|
||||
# The 2nd arg is an expected string/response from factor for that argument.
|
||||
|
||||
# Test overflow cases
|
||||
test_factor '8675309' '8675309: 8675309'
|
||||
test_factor '6172538568' '6172538568: 2 2 2 3 7 17 2161253'
|
||||
|
||||
# Test algorithm bugs fixed by Joseph Myers from test cases from David A Bagley.
|
||||
echo "Warning: the following test will loop endlessly with old factor program"
|
||||
test_factor '99999999999991' '99999999999991: 7 13 769231 1428571'
|
||||
echo "Warning: the following test will loop endlessly with old factor program"
|
||||
test_factor '2147483647111311' '2147483647111311: 3 3 3 131 607148331103'
|
||||
|
||||
exit 0
|
@ -1,8 +1,8 @@
|
||||
# $NetBSD: Makefile,v 1.4 2007/11/12 15:18:18 jmmv Exp $
|
||||
# $NetBSD: Makefile,v 1.5 2007/11/12 15:19:46 jmmv Exp $
|
||||
|
||||
.include <bsd.own.mk>
|
||||
|
||||
SUBDIR= atf fs util
|
||||
SUBDIR= atf fs games util
|
||||
|
||||
.include <bsd.test.mk>
|
||||
.include <bsd.subdir.mk>
|
||||
|
5
tests/games/Atffile
Normal file
5
tests/games/Atffile
Normal file
@ -0,0 +1,5 @@
|
||||
Content-Type: application/X-atf-atffile; version="1"
|
||||
|
||||
prop: test-suite = "NetBSD"
|
||||
|
||||
tp-glob: *
|
7
tests/games/Makefile
Normal file
7
tests/games/Makefile
Normal file
@ -0,0 +1,7 @@
|
||||
# $NetBSD: Makefile,v 1.1 2007/11/12 15:19:46 jmmv Exp $
|
||||
|
||||
.include <bsd.own.mk>
|
||||
|
||||
TESTS_SH= t_factor
|
||||
|
||||
.include <bsd.test.mk>
|
69
tests/games/t_factor.sh
Normal file
69
tests/games/t_factor.sh
Normal file
@ -0,0 +1,69 @@
|
||||
# $NetBSD: t_factor.sh,v 1.1 2007/11/12 15:19:46 jmmv Exp $
|
||||
#
|
||||
# Copyright (c) 2007 The NetBSD Foundation, Inc.
|
||||
# All rights reserved.
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
# modification, are permitted provided that the following conditions
|
||||
# are met:
|
||||
# 1. Redistributions of source code must retain the above copyright
|
||||
# notice, this list of conditions and the following disclaimer.
|
||||
# 2. Redistributions in binary form must reproduce the above copyright
|
||||
# notice, this list of conditions and the following disclaimer in the
|
||||
# documentation and/or other materials provided with the distribution.
|
||||
# 3. All advertising materials mentioning features or use of this software
|
||||
# must display the following acknowledgement:
|
||||
# This product includes software developed by the NetBSD
|
||||
# Foundation, Inc. and its contributors.
|
||||
# 4. Neither the name of The NetBSD Foundation nor the names of its
|
||||
# contributors may be used to endorse or promote products derived
|
||||
# from this software without specific prior written permission.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
|
||||
# ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
|
||||
# TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
|
||||
# BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
# POSSIBILITY OF SUCH DAMAGE.
|
||||
#
|
||||
|
||||
expect() {
|
||||
echo "${2}" >expout
|
||||
atf_check "factor ${1}" 0 expout null
|
||||
}
|
||||
|
||||
atf_test_case overflow
|
||||
overflow_head() {
|
||||
atf_set "descr" "Tests for overflow conditions"
|
||||
atf_set "require.progs" "factor"
|
||||
}
|
||||
overflow_body() {
|
||||
expect '8675309' '8675309: 8675309'
|
||||
expect '6172538568' '6172538568: 2 2 2 3 7 17 2161253'
|
||||
}
|
||||
|
||||
atf_test_case loop
|
||||
loop_head() {
|
||||
atf_set "descr" "Tests some cases that once locked the program" \
|
||||
"in an infinite loop"
|
||||
atf_set "require.progs" "factor"
|
||||
}
|
||||
loop_body() {
|
||||
# XXX Remove this warning once ATF is able to delimit a test case's
|
||||
# execution time, and properly enable this feature.
|
||||
echo "WARNING: These tests will loop endlessly with an old factor" \
|
||||
"program"
|
||||
expect '99999999999991' '99999999999991: 7 13 769231 1428571'
|
||||
expect '2147483647111311' '2147483647111311: 3 3 3 131 607148331103'
|
||||
}
|
||||
|
||||
atf_init_test_cases()
|
||||
{
|
||||
atf_add_test_case overflow
|
||||
atf_add_test_case loop
|
||||
}
|
Loading…
Reference in New Issue
Block a user