1*0a6a1f1dSLionel Sambuc# $NetBSD: t_nbperf.sh,v 1.3 2014/04/30 21:04:21 joerg Exp $ 211be35a1SLionel Sambuc# 311be35a1SLionel Sambuc# Copyright (c) 2012 The NetBSD Foundation, Inc. 411be35a1SLionel Sambuc# All rights reserved. 511be35a1SLionel Sambuc# 611be35a1SLionel Sambuc# Redistribution and use in source and binary forms, with or without 711be35a1SLionel Sambuc# modification, are permitted provided that the following conditions 811be35a1SLionel Sambuc# are met: 911be35a1SLionel Sambuc# 1. Redistributions of source code must retain the above copyright 1011be35a1SLionel Sambuc# notice, this list of conditions and the following disclaimer. 1111be35a1SLionel Sambuc# 2. Redistributions in binary form must reproduce the above copyright 1211be35a1SLionel Sambuc# notice, this list of conditions and the following disclaimer in the 1311be35a1SLionel Sambuc# documentation and/or other materials provided with the distribution. 1411be35a1SLionel Sambuc# 1511be35a1SLionel Sambuc# THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS 1611be35a1SLionel Sambuc# ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 1711be35a1SLionel Sambuc# TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 1811be35a1SLionel Sambuc# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS 1911be35a1SLionel Sambuc# BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 2011be35a1SLionel Sambuc# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 2111be35a1SLionel Sambuc# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 2211be35a1SLionel Sambuc# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 2311be35a1SLionel Sambuc# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 2411be35a1SLionel Sambuc# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 2511be35a1SLionel Sambuc# POSSIBILITY OF SUCH DAMAGE. 2611be35a1SLionel Sambuc# 2711be35a1SLionel Sambuc 2811be35a1SLionel Sambuccleanup() 2911be35a1SLionel Sambuc{ 3011be35a1SLionel Sambuc rm -f reference.txt hash.c hash.map testprog 3111be35a1SLionel Sambuc} 3211be35a1SLionel Sambuc 3311be35a1SLionel Sambucatf_test_case chm 3411be35a1SLionel Sambucchm_head() 3511be35a1SLionel Sambuc{ 3611be35a1SLionel Sambuc atf_set "descr" "Checks chm algorithm" 37*0a6a1f1dSLionel Sambuc atf_set "require.files" "/usr/share/dict/web2" 38*0a6a1f1dSLionel Sambuc atf_set "require.progs" "cc" 3911be35a1SLionel Sambuc} 4011be35a1SLionel Sambucchm_body() 4111be35a1SLionel Sambuc{ 4211be35a1SLionel Sambuc for n in 4 32 128 1024 65536; do 4311be35a1SLionel Sambuc seq 0 $(($n - 1)) > reference.txt 4411be35a1SLionel Sambuc atf_check -o file:reference.txt \ 4511be35a1SLionel Sambuc $(atf_get_srcdir)/h_nbperf /usr/share/dict/web2 chm cat \ 4611be35a1SLionel Sambuc $n $(atf_get_srcdir)/hash_driver.c 4711be35a1SLionel Sambuc atf_check -o file:hash.map \ 4811be35a1SLionel Sambuc $(atf_get_srcdir)/h_nbperf /usr/share/dict/web2 chm cat \ 4911be35a1SLionel Sambuc $n $(atf_get_srcdir)/hash_driver.c 5011be35a1SLionel Sambuc done 5111be35a1SLionel Sambuc} 5211be35a1SLionel Sambucchm_clean() 5311be35a1SLionel Sambuc{ 5411be35a1SLionel Sambuc cleanup 5511be35a1SLionel Sambuc} 5611be35a1SLionel Sambuc 5711be35a1SLionel Sambucatf_test_case chm3 5811be35a1SLionel Sambucchm3_head() 5911be35a1SLionel Sambuc{ 6011be35a1SLionel Sambuc atf_set "descr" "Checks chm3 algorithm" 61*0a6a1f1dSLionel Sambuc atf_set "require.files" "/usr/share/dict/web2" 62*0a6a1f1dSLionel Sambuc atf_set "require.progs" "cc" 6311be35a1SLionel Sambuc} 6411be35a1SLionel Sambucchm3_body() 6511be35a1SLionel Sambuc{ 6611be35a1SLionel Sambuc for n in 4 32 128 1024 65536; do 6711be35a1SLionel Sambuc seq 0 $(($n - 1)) > reference.txt 6811be35a1SLionel Sambuc atf_check -o file:reference.txt \ 6911be35a1SLionel Sambuc $(atf_get_srcdir)/h_nbperf /usr/share/dict/web2 chm3 cat \ 7011be35a1SLionel Sambuc $n $(atf_get_srcdir)/hash_driver.c 7111be35a1SLionel Sambuc atf_check -o file:hash.map \ 7211be35a1SLionel Sambuc $(atf_get_srcdir)/h_nbperf /usr/share/dict/web2 chm3 cat \ 7311be35a1SLionel Sambuc $n $(atf_get_srcdir)/hash_driver.c 7411be35a1SLionel Sambuc done 7511be35a1SLionel Sambuc} 7611be35a1SLionel Sambucchm3_clean() 7711be35a1SLionel Sambuc{ 7811be35a1SLionel Sambuc cleanup 7911be35a1SLionel Sambuc} 8011be35a1SLionel Sambuc 8111be35a1SLionel Sambucatf_test_case bdz 8211be35a1SLionel Sambucbdz_head() 8311be35a1SLionel Sambuc{ 8411be35a1SLionel Sambuc atf_set "descr" "Checks bdz algorithm" 85*0a6a1f1dSLionel Sambuc atf_set "require.files" "/usr/share/dict/web2" 86*0a6a1f1dSLionel Sambuc atf_set "require.progs" "cc" 8711be35a1SLionel Sambuc} 8811be35a1SLionel Sambucbdz_body() 8911be35a1SLionel Sambuc{ 9011be35a1SLionel Sambuc for n in 4 32 128 1024 65536 131072; do 9111be35a1SLionel Sambuc seq 0 $(($n - 1)) > reference.txt 9211be35a1SLionel Sambuc atf_check -o file:reference.txt \ 9311be35a1SLionel Sambuc $(atf_get_srcdir)/h_nbperf /usr/share/dict/web2 bdz "sort -n" \ 9411be35a1SLionel Sambuc $n $(atf_get_srcdir)/hash_driver.c 9511be35a1SLionel Sambuc atf_check -o file:hash.map \ 9611be35a1SLionel Sambuc $(atf_get_srcdir)/h_nbperf /usr/share/dict/web2 bdz cat \ 9711be35a1SLionel Sambuc $n $(atf_get_srcdir)/hash_driver.c 9811be35a1SLionel Sambuc done 9911be35a1SLionel Sambuc} 10011be35a1SLionel Sambucbdz_clean() 10111be35a1SLionel Sambuc{ 10211be35a1SLionel Sambuc cleanup 10311be35a1SLionel Sambuc} 10411be35a1SLionel Sambuc 10511be35a1SLionel Sambucatf_init_test_cases() 10611be35a1SLionel Sambuc{ 10711be35a1SLionel Sambuc atf_add_test_case chm 10811be35a1SLionel Sambuc atf_add_test_case chm3 10911be35a1SLionel Sambuc atf_add_test_case bdz 11011be35a1SLionel Sambuc} 111