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