1*0a6a1f1dSLionel Sambuc#! /usr/bin/atf-sh 2*0a6a1f1dSLionel Sambuc# $NetBSD: t_in_cksum.sh,v 1.2 2015/01/06 15:13:16 martin Exp $ 3*0a6a1f1dSLionel Sambuc# 4*0a6a1f1dSLionel Sambuc 5*0a6a1f1dSLionel SambucTIMING_LOOPS=10000 6*0a6a1f1dSLionel Sambucincksum="$(atf_get_srcdir)/in_cksum" 7*0a6a1f1dSLionel Sambuc 8*0a6a1f1dSLionel Sambucfail() { 9*0a6a1f1dSLionel Sambuc atf_fail "see output for details" 10*0a6a1f1dSLionel Sambuc} 11*0a6a1f1dSLionel Sambuc 12*0a6a1f1dSLionel Sambucmbufs() { 13*0a6a1f1dSLionel Sambuc ${incksum} -l 16 -u $0 -i ${TIMING_LOOPS} \ 14*0a6a1f1dSLionel Sambuc 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 \ 15*0a6a1f1dSLionel Sambuc || fail 16*0a6a1f1dSLionel Sambuc ${incksum} -l 16 -u $0 -i ${TIMING_LOOPS} \ 17*0a6a1f1dSLionel Sambuc 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 \ 18*0a6a1f1dSLionel Sambuc 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 \ 19*0a6a1f1dSLionel Sambuc || fail 20*0a6a1f1dSLionel Sambuc ${incksum} -l 64 -u $0 -i ${TIMING_LOOPS} \ 21*0a6a1f1dSLionel Sambuc 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 \ 22*0a6a1f1dSLionel Sambuc 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 \ 23*0a6a1f1dSLionel Sambuc || fail 24*0a6a1f1dSLionel Sambuc ${incksum} -l 16 -u $0 -i ${TIMING_LOOPS} \ 25*0a6a1f1dSLionel Sambuc 1 3 1 3 1 3 1 \ 26*0a6a1f1dSLionel Sambuc || fail 27*0a6a1f1dSLionel Sambuc} 28*0a6a1f1dSLionel Sambuc 29*0a6a1f1dSLionel Sambucsizes() { 30*0a6a1f1dSLionel Sambuc ${incksum} -l 16 -u $1 -i ${TIMING_LOOPS} 2048 || fail 31*0a6a1f1dSLionel Sambuc ${incksum} -l 16 -u $1 -i ${TIMING_LOOPS} 40 || fail 32*0a6a1f1dSLionel Sambuc ${incksum} -l 16 -u $1 -i ${TIMING_LOOPS} 1536 || fail 33*0a6a1f1dSLionel Sambuc ${incksum} -l 16 -u $1 -i ${TIMING_LOOPS} 576 || fail 34*0a6a1f1dSLionel Sambuc ${incksum} -l 16 -u $1 -i ${TIMING_LOOPS} 1536 1536 1536 1536 1536 640 \ 35*0a6a1f1dSLionel Sambuc || fail 36*0a6a1f1dSLionel Sambuc} 37*0a6a1f1dSLionel Sambuc 38*0a6a1f1dSLionel Sambucatf_test_case mbufs_aligned 39*0a6a1f1dSLionel Sambuc 40*0a6a1f1dSLionel Sambucmbufs_aligned_head() { 41*0a6a1f1dSLionel Sambuc atf_set "descr" "Test in_cksum mbuf chains aligned" 42*0a6a1f1dSLionel Sambuc} 43*0a6a1f1dSLionel Sambuc 44*0a6a1f1dSLionel Sambucmbufs_aligned_body() { 45*0a6a1f1dSLionel Sambuc mbufs 0 46*0a6a1f1dSLionel Sambuc} 47*0a6a1f1dSLionel Sambuc 48*0a6a1f1dSLionel Sambucmbufs_unaligned_head() { 49*0a6a1f1dSLionel Sambuc atf_set "descr" "Test in_cksum mbuf chains unaligned" 50*0a6a1f1dSLionel Sambuc} 51*0a6a1f1dSLionel Sambuc 52*0a6a1f1dSLionel Sambucmbufs_unaligned_body() { 53*0a6a1f1dSLionel Sambuc mbufs 1 54*0a6a1f1dSLionel Sambuc} 55*0a6a1f1dSLionel Sambuc 56*0a6a1f1dSLionel Sambucsizes_aligned_head() { 57*0a6a1f1dSLionel Sambuc atf_set "descr" "Test in_cksum sizes aligned" 58*0a6a1f1dSLionel Sambuc} 59*0a6a1f1dSLionel Sambuc 60*0a6a1f1dSLionel Sambucsizes_aligned_body() { 61*0a6a1f1dSLionel Sambuc sizes 0 62*0a6a1f1dSLionel Sambuc} 63*0a6a1f1dSLionel Sambuc 64*0a6a1f1dSLionel Sambucsizes_unaligned_head() { 65*0a6a1f1dSLionel Sambuc atf_set "descr" "Test in_cksum sizes unaligned" 66*0a6a1f1dSLionel Sambuc} 67*0a6a1f1dSLionel Sambuc 68*0a6a1f1dSLionel Sambucsizes_unaligned_body() { 69*0a6a1f1dSLionel Sambuc sizes 1 70*0a6a1f1dSLionel Sambuc} 71*0a6a1f1dSLionel Sambuc 72*0a6a1f1dSLionel Sambucatf_init_test_cases() 73*0a6a1f1dSLionel Sambuc{ 74*0a6a1f1dSLionel Sambuc atf_add_test_case mbufs_aligned 75*0a6a1f1dSLionel Sambuc atf_add_test_case mbufs_unaligned 76*0a6a1f1dSLionel Sambuc atf_add_test_case sizes_aligned 77*0a6a1f1dSLionel Sambuc atf_add_test_case sizes_unaligned 78*0a6a1f1dSLionel Sambuc} 79