156038Sbostic#!/bin/sh - 256038Sbostic# 356038Sbostic# Copyright (c) 1992 The Regents of the University of California. 456038Sbostic# All rights reserved. 556038Sbostic# 656038Sbostic# %sccs.include.redist.sh% 756038Sbostic# 8*59633Sbostic# @(#)run.test 5.16 (Berkeley) 05/01/93 956038Sbostic# 1056038Sbostic 1156038Sbostic# db regression tests 1256038Sbostic 1356038Sbosticmain() 1456038Sbostic{ 1556038Sbostic DICT=/usr/share/dict/words 1656058Sbostic PROG=obj/dbtest 1756038Sbostic TMP1=t1 1856038Sbostic TMP2=t2 1956038Sbostic TMP3=t3 2056038Sbostic 2156038Sbostic test1 2256038Sbostic test2 2356038Sbostic test3 2456038Sbostic test4 2556050Sbostic test5 2656050Sbostic test6 2756058Sbostic test7 2856085Sbostic test8 2957001Sbostic test9 3056765Sbostic test10 3156999Sbostic test11 3257455Sbostic test12 33*59633Sbostic test13 3456999Sbostic test20 3556038Sbostic rm -f $TMP1 $TMP2 $TMP3 3656999Sbostic exit 0 3756038Sbostic} 3856038Sbostic 3956038Sbostic# Take the first hundred entries in the dictionary, and make them 4056038Sbostic# be key/data pairs. 4156038Sbostictest1() 4256038Sbostic{ 4356050Sbostic printf "Test 1: btree, hash: small key, small data pairs\n" 4456085Sbostic sed 200q $DICT > $TMP1 4556038Sbostic for type in btree hash; do 4656038Sbostic rm -f $TMP2 $TMP3 4756038Sbostic for i in `sed 200q $DICT`; do 4856038Sbostic printf "p\nk%s\nd%s\ng\nk%s\n" $i $i $i 4956038Sbostic done > $TMP2 5056058Sbostic $PROG -o $TMP3 $type $TMP2 5157460Sbostic if (cmp -s $TMP1 $TMP3) ; then : 5256038Sbostic else 5356038Sbostic printf "test1: type %s: failed\n" $type 5456038Sbostic exit 1 5556038Sbostic fi 5656038Sbostic done 5756050Sbostic printf "Test 1: recno: small key, small data pairs\n" 5856038Sbostic rm -f $TMP2 $TMP3 5956038Sbostic sed 200q $DICT | 6056058Sbostic awk '{ 6156058Sbostic ++i; 6256058Sbostic printf("p\nk%d\nd%s\ng\nk%d\n", i, $0, i); 6356058Sbostic }' > $TMP2 6456058Sbostic $PROG -o $TMP3 recno $TMP2 6557460Sbostic if (cmp -s $TMP1 $TMP3) ; then : 6656038Sbostic else 6756038Sbostic printf "test1: type recno: failed\n" 6856038Sbostic exit 1 6956038Sbostic fi 7056038Sbostic} 7156038Sbostic 7257455Sbostic# Take the first 200 entries in the dictionary, and give them 7356038Sbostic# each a medium size data entry. 7456038Sbostictest2() 7556038Sbostic{ 7656050Sbostic printf "Test 2: btree, hash: small key, medium data pairs\n" 7756038Sbostic mdata=abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz 7856038Sbostic echo $mdata | 7956058Sbostic awk '{ for (i = 1; i < 201; ++i) print $0 }' > $TMP1 8056038Sbostic for type in hash btree; do 8156038Sbostic rm -f $TMP2 $TMP3 8256038Sbostic for i in `sed 200q $DICT`; do 8356038Sbostic printf "p\nk%s\nd%s\ng\nk%s\n" $i $mdata $i 8456038Sbostic done > $TMP2 8556058Sbostic $PROG -o $TMP3 $type $TMP2 8657460Sbostic if (cmp -s $TMP1 $TMP3) ; then : 8756038Sbostic else 8856038Sbostic printf "test2: type %s: failed\n" $type 8956038Sbostic exit 1 9056038Sbostic fi 9156038Sbostic done 9256050Sbostic printf "Test 2: recno: small key, medium data pairs\n" 9356038Sbostic rm -f $TMP2 $TMP3 9456038Sbostic echo $mdata | 9556058Sbostic awk '{ for (i = 1; i < 201; ++i) 9656058Sbostic printf("p\nk%d\nd%s\ng\nk%d\n", i, $0, i); 9756058Sbostic }' > $TMP2 9856058Sbostic $PROG -o $TMP3 recno $TMP2 9957460Sbostic if (cmp -s $TMP1 $TMP3) ; then : 10056038Sbostic else 10156038Sbostic printf "test2: type recno: failed\n" 10256038Sbostic exit 1 10356038Sbostic fi 10456038Sbostic} 10556038Sbostic 10656038Sbostic# Insert the programs in /bin with their paths as their keys. 10756038Sbostictest3() 10856038Sbostic{ 10956050Sbostic printf "Test 3: btree, hash: small key, big data pairs\n" 11056038Sbostic rm -f $TMP1 11156038Sbostic (find /bin -type f -print | xargs cat) > $TMP1 11256038Sbostic for type in hash btree; do 11356038Sbostic rm -f $TMP2 $TMP3 11456038Sbostic for i in `find /bin -type f -print`; do 11556038Sbostic printf "p\nk%s\nD%s\ng\nk%s\n" $i $i $i 11656038Sbostic done > $TMP2 11756058Sbostic $PROG -o $TMP3 $type $TMP2 11857460Sbostic if (cmp -s $TMP1 $TMP3) ; then : 11956038Sbostic else 12056385Sbostic printf "test3: type %s: failed\n" $type 12156038Sbostic exit 1 12256038Sbostic fi 12356038Sbostic done 12456050Sbostic printf "Test 3: recno: big data pairs\n" 12556038Sbostic rm -f $TMP2 $TMP3 12656038Sbostic find /bin -type f -print | 12756058Sbostic awk '{ 12856058Sbostic ++i; 12956058Sbostic printf("p\nk%d\nD%s\ng\nk%d\n", i, $0, i); 13056058Sbostic }' > $TMP2 13156058Sbostic $PROG -o $TMP3 recno $TMP2 13257460Sbostic if (cmp -s $TMP1 $TMP3) ; then : 13356038Sbostic else 13456038Sbostic printf "test3: type recno: failed\n" 13556038Sbostic exit 1 13656038Sbostic fi 13756038Sbostic} 13856038Sbostic 13956038Sbostic# Do random recno entries. 14056038Sbostictest4() 14156038Sbostic{ 14256050Sbostic printf "Test 4: recno: random entries\n" 14356050Sbostic echo "abcdefg abcdefg abcdefg abcdefg abcdefg abcdefg abcdefg" | 14456058Sbostic awk '{ 14556058Sbostic for (i = 37; i <= 37 + 88 * 17; i += 17) 14656058Sbostic printf("input key %d: %.*s\n", i, i % 41, $0); 14756058Sbostic for (i = 1; i <= 15; ++i) 14856058Sbostic printf("input key %d: %.*s\n", i, i % 41, $0); 14956058Sbostic for (i = 19234; i <= 19234 + 61 * 27; i += 27) 15056058Sbostic printf("input key %d: %.*s\n", i, i % 41, $0); 15156058Sbostic exit 15256058Sbostic }' > $TMP1 15356058Sbostic rm -f TMP2 $TMP3 15456058Sbostic cat $TMP1 | 15556058Sbostic awk 'BEGIN { 15656058Sbostic i = 37; 15756058Sbostic incr = 17; 15856058Sbostic } 15956058Sbostic { 16056058Sbostic printf("p\nk%d\nd%s\n", i, $0); 16156058Sbostic if (i == 19234 + 61 * 27) 16256058Sbostic exit; 16356058Sbostic if (i == 37 + 88 * 17) { 16456058Sbostic i = 1; 16556058Sbostic incr = 1; 16656058Sbostic } else if (i == 15) { 16756058Sbostic i = 19234; 16856058Sbostic incr = 27; 16956058Sbostic } else 17056058Sbostic i += incr; 17156058Sbostic } 17256058Sbostic END { 17356038Sbostic for (i = 37; i <= 37 + 88 * 17; i += 17) 17456058Sbostic printf("g\nk%d\n", i); 17556038Sbostic for (i = 1; i <= 15; ++i) 17656058Sbostic printf("g\nk%d\n", i); 17756038Sbostic for (i = 19234; i <= 19234 + 61 * 27; i += 27) 17856058Sbostic printf("g\nk%d\n", i); 17956058Sbostic }' > $TMP2 18056058Sbostic $PROG -o $TMP3 recno $TMP2 18157460Sbostic if (cmp -s $TMP1 $TMP3) ; then : 18256038Sbostic else 18356038Sbostic printf "test4: type recno: failed\n" 18456038Sbostic exit 1 18556038Sbostic fi 18656038Sbostic} 18756050Sbostic 18856050Sbostic# Do reverse order recno entries. 18956050Sbostictest5() 19056050Sbostic{ 19156050Sbostic printf "Test 5: recno: reverse order entries\n" 19256050Sbostic echo "abcdefg abcdefg abcdefg abcdefg abcdefg abcdefg abcdefg" | 19356058Sbostic awk ' { 19456058Sbostic for (i = 1500; i; --i) 19556058Sbostic printf("input key %d: %.*s\n", i, i % 34, $0); 19656058Sbostic exit; 19756058Sbostic }' > $TMP1 19856050Sbostic rm -f TMP2 $TMP3 19956058Sbostic cat $TMP1 | 20056058Sbostic awk 'BEGIN { 20156058Sbostic i = 1500; 20256058Sbostic } 20356058Sbostic { 20456058Sbostic printf("p\nk%d\nd%s\n", i, $0); 20556058Sbostic --i; 20656058Sbostic } 20756058Sbostic END { 20856058Sbostic for (i = 1500; i; --i) 20956058Sbostic printf("g\nk%d\n", i); 21056058Sbostic }' > $TMP2 21156058Sbostic $PROG -o $TMP3 recno $TMP2 21257460Sbostic if (cmp -s $TMP1 $TMP3) ; then : 21356050Sbostic else 21456050Sbostic printf "test5: type recno: failed\n" 21556050Sbostic exit 1 21656050Sbostic fi 21756050Sbostic} 21856038Sbostic 21956050Sbostic# Do alternating order recno entries. 22056050Sbostictest6() 22156050Sbostic{ 22256050Sbostic printf "Test 6: recno: alternating order entries\n" 22356050Sbostic echo "abcdefg abcdefg abcdefg abcdefg abcdefg abcdefg abcdefg" | 22456058Sbostic awk ' { 22556058Sbostic for (i = 1; i < 1200; i += 2) 22656058Sbostic printf("input key %d: %.*s\n", i, i % 34, $0); 22756058Sbostic for (i = 2; i < 1200; i += 2) 22856058Sbostic printf("input key %d: %.*s\n", i, i % 34, $0); 22956058Sbostic exit; 23056058Sbostic }' > $TMP1 23156050Sbostic rm -f TMP2 $TMP3 23256058Sbostic cat $TMP1 | 23356058Sbostic awk 'BEGIN { 23456058Sbostic i = 1; 23556058Sbostic even = 0; 23656058Sbostic } 23756058Sbostic { 23856058Sbostic printf("p\nk%d\nd%s\n", i, $0); 23956058Sbostic i += 2; 24056058Sbostic if (i >= 1200) { 24156058Sbostic if (even == 1) 24256058Sbostic exit; 24356058Sbostic even = 1; 24456058Sbostic i = 2; 24556050Sbostic } 24656058Sbostic } 24756058Sbostic END { 24856058Sbostic for (i = 1; i < 1200; ++i) 24956058Sbostic printf("g\nk%d\n", i); 25056058Sbostic }' > $TMP2 25156058Sbostic $PROG -o $TMP3 recno $TMP2 25256050Sbostic sort -o $TMP1 $TMP1 25356050Sbostic sort -o $TMP3 $TMP3 25457460Sbostic if (cmp -s $TMP1 $TMP3) ; then : 25556050Sbostic else 25656050Sbostic printf "test6: type recno: failed\n" 25756050Sbostic exit 1 25856050Sbostic fi 25956050Sbostic} 26056050Sbostic 26156058Sbostic# Delete cursor record 26256058Sbostictest7() 26356058Sbostic{ 26456058Sbostic printf "Test 7: btree, recno: delete cursor record\n" 26556058Sbostic echo "abcdefg abcdefg abcdefg abcdefg abcdefg abcdefg abcdefg" | 26656058Sbostic awk '{ 26756058Sbostic for (i = 1; i <= 120; ++i) 26856058Sbostic printf("%05d: input key %d: %s\n", i, i, $0); 26956058Sbostic printf("%05d: input key %d: %s\n", 120, 120, $0); 27056058Sbostic printf("get failed, no such key\n"); 27156058Sbostic printf("%05d: input key %d: %s\n", 1, 1, $0); 27256058Sbostic printf("%05d: input key %d: %s\n", 2, 2, $0); 27356058Sbostic exit; 27456058Sbostic }' > $TMP1 27556058Sbostic rm -f TMP2 $TMP3 27656763Sbostic 27756058Sbostic for type in btree recno; do 27856058Sbostic cat $TMP1 | 27956058Sbostic awk '{ 28056058Sbostic if (i == 120) 28156058Sbostic exit; 28256058Sbostic printf("p\nk%d\nd%s\n", ++i, $0); 28356058Sbostic } 28456058Sbostic END { 28556058Sbostic printf("fR_NEXT\n"); 28656058Sbostic for (i = 1; i <= 120; ++i) 28756058Sbostic printf("s\n"); 28856058Sbostic printf("fR_CURSOR\ns\nk120\n"); 28956058Sbostic printf("r\nk120\n"); 29056058Sbostic printf("fR_NEXT\ns\n"); 29156058Sbostic printf("fR_CURSOR\ns\nk1\n"); 29256058Sbostic printf("r\nk1\n"); 29356058Sbostic printf("fR_FIRST\ns\n"); 29456058Sbostic }' > $TMP2 29556058Sbostic $PROG -o $TMP3 recno $TMP2 29657460Sbostic if (cmp -s $TMP1 $TMP3) ; then : 29756058Sbostic else 29856058Sbostic printf "test7: type $type: failed\n" 29956058Sbostic exit 1 30056058Sbostic fi 30156058Sbostic done 30256058Sbostic} 30356058Sbostic 30456495Sbostic# Make sure that overflow pages are reused. 30556085Sbostictest8() 30656085Sbostic{ 30756495Sbostic printf "Test 8: btree, hash: repeated small key, big data pairs\n" 30856495Sbostic rm -f $TMP1 30956495Sbostic awk 'BEGIN { 31056556Sbostic for (i = 1; i <= 10; ++i) { 31156495Sbostic printf("p\nkkey1\nD/bin/sh\n"); 31256495Sbostic printf("p\nkkey2\nD/bin/csh\n"); 31356554Sbostic if (i % 8 == 0) { 31456554Sbostic printf("c\nkkey2\nD/bin/csh\n"); 31556554Sbostic printf("c\nkkey1\nD/bin/sh\n"); 31656763Sbostic printf("e\t%d of 10 (comparison)\r\n", i); 31756554Sbostic } else 31856763Sbostic printf("e\t%d of 10 \r\n", i); 31956495Sbostic printf("r\nkkey1\nr\nkkey2\n"); 32056495Sbostic } 32156556Sbostic printf("e\n"); 32256556Sbostic printf("eend of test8 run\n"); 32356495Sbostic }' > $TMP1 32456554Sbostic $PROG btree $TMP1 32556554Sbostic $PROG hash $TMP1 32656495Sbostic # No explicit test for success. 32756495Sbostic} 32856495Sbostic 32957001Sbostic# Test btree duplicate keys 33057001Sbostictest9() 33157001Sbostic{ 33257001Sbostic printf "Test 9: btree: duplicate keys\n" 33357001Sbostic echo "abcdefg abcdefg abcdefg abcdefg abcdefg abcdefg abcdefg" | 33457001Sbostic awk '{ 33557001Sbostic for (i = 1; i <= 543; ++i) 33657001Sbostic printf("%05d: input key %d: %s\n", i, i, $0); 33757001Sbostic exit; 33857001Sbostic }' > $TMP1 33957001Sbostic rm -f TMP2 $TMP3 34057001Sbostic 34157001Sbostic for type in btree; do 34257001Sbostic cat $TMP1 | 34357001Sbostic awk '{ 34457001Sbostic if (i++ % 2) 34557001Sbostic printf("p\nkduplicatekey\nd%s\n", $0); 34657001Sbostic else 34757001Sbostic printf("p\nkunique%dkey\nd%s\n", i, $0); 34857001Sbostic } 34957001Sbostic END { 35057001Sbostic printf("o\n"); 35157001Sbostic }' > $TMP2 35257001Sbostic $PROG -iflags=1 -o $TMP3 $type $TMP2 35357001Sbostic sort -o $TMP3 $TMP3 35457460Sbostic if (cmp -s $TMP1 $TMP3) ; then : 35557001Sbostic else 35657001Sbostic printf "test9: type $type: failed\n" 35757001Sbostic exit 1 35857001Sbostic fi 35957001Sbostic done 36057001Sbostic} 36157001Sbostic 36256999Sbostic# Test use of cursor flags without initialization 36356999Sbostictest10() 36456999Sbostic{ 36556999Sbostic printf "Test 10: btree, recno: test cursor flag use\n" 36656999Sbostic echo "abcdefg abcdefg abcdefg abcdefg abcdefg abcdefg abcdefg" | 36756999Sbostic awk '{ 36856999Sbostic for (i = 1; i <= 20; ++i) 36956999Sbostic printf("%05d: input key %d: %s\n", i, i, $0); 37056999Sbostic exit; 37156999Sbostic }' > $TMP1 37256999Sbostic rm -f TMP2 $TMP3 37356999Sbostic 37456999Sbostic # Test that R_CURSOR doesn't succeed before cursor initialized 37556999Sbostic for type in btree recno; do 37656999Sbostic cat $TMP1 | 37756999Sbostic awk '{ 37856999Sbostic if (i == 10) 37956999Sbostic exit; 38056999Sbostic printf("p\nk%d\nd%s\n", ++i, $0); 38156999Sbostic } 38256999Sbostic END { 38356999Sbostic printf("fR_CURSOR\nr\nk1\n"); 38456999Sbostic printf("eR_CURSOR SHOULD HAVE FAILED\n"); 38556999Sbostic }' > $TMP2 38656999Sbostic $PROG -o $TMP3 $type $TMP2 > /dev/null 2>&1 38756999Sbostic if [ -s $TMP3 ] ; then 38856999Sbostic printf "Test 10: delete: R_CURSOR SHOULD HAVE FAILED\n" 38956999Sbostic exit 1 39056999Sbostic fi 39156999Sbostic done 39256999Sbostic for type in btree recno; do 39356999Sbostic cat $TMP1 | 39456999Sbostic awk '{ 39556999Sbostic if (i == 10) 39656999Sbostic exit; 39756999Sbostic printf("p\nk%d\nd%s\n", ++i, $0); 39856999Sbostic } 39956999Sbostic END { 40056999Sbostic printf("fR_CURSOR\np\nk1\ndsome data\n"); 40156999Sbostic printf("eR_CURSOR SHOULD HAVE FAILED\n"); 40256999Sbostic }' > $TMP2 40356999Sbostic $PROG -o $TMP3 $type $TMP2 > /dev/null 2>&1 40456999Sbostic if [ -s $TMP3 ] ; then 40556999Sbostic printf "Test 10: put: R_CURSOR SHOULD HAVE FAILED\n" 40656999Sbostic exit 1 40756999Sbostic fi 40856999Sbostic done 40956999Sbostic} 41056999Sbostic 41156999Sbostic# Test insert in reverse order. 41256999Sbostictest11() 41356999Sbostic{ 41456999Sbostic printf "Test 11: recno: reverse order insert\n" 41556999Sbostic echo "abcdefg abcdefg abcdefg abcdefg abcdefg abcdefg abcdefg" | 41656999Sbostic awk '{ 41756999Sbostic for (i = 1; i <= 779; ++i) 41856999Sbostic printf("%05d: input key %d: %s\n", i, i, $0); 41956999Sbostic exit; 42056999Sbostic }' > $TMP1 42156999Sbostic rm -f TMP2 $TMP3 42256999Sbostic 42356999Sbostic for type in recno; do 42456999Sbostic cat $TMP1 | 42556999Sbostic awk '{ 42656999Sbostic if (i == 0) { 42756999Sbostic i = 1; 42856999Sbostic printf("p\nk1\nd%s\n", $0); 42956999Sbostic printf("%s\n", "fR_IBEFORE"); 43056999Sbostic } else 43156999Sbostic printf("p\nk1\nd%s\n", $0); 43256999Sbostic } 43356999Sbostic END { 43456999Sbostic printf("or\n"); 43556999Sbostic }' > $TMP2 43656999Sbostic $PROG -o $TMP3 $type $TMP2 43757460Sbostic if (cmp -s $TMP1 $TMP3) ; then : 43856999Sbostic else 43956999Sbostic printf "test11: type $type: failed\n" 44056999Sbostic exit 1 44156999Sbostic fi 44256999Sbostic done 44356999Sbostic} 44456999Sbostic 44557455Sbostic# Take the first 20000 entries in the dictionary, reverse them, and give 44657455Sbostic# them each a small size data entry. Use a small page size to make sure 44757455Sbostic# the btree split code gets hammered. 44857455Sbostictest12() 44957455Sbostic{ 45057455Sbostic printf "Test 12: btree: lots of keys, small page size\n" 45157455Sbostic mdata=abcdefghijklmnopqrstuvwxy 45257455Sbostic echo $mdata | 45357455Sbostic awk '{ for (i = 1; i < 20001; ++i) print $0 }' > $TMP1 45457455Sbostic for type in btree; do 45557455Sbostic rm -f $TMP2 $TMP3 45657455Sbostic for i in `sed 20000q $DICT | rev`; do 45757455Sbostic printf "p\nk%s\nd%s\ng\nk%s\n" $i $mdata $i 45857455Sbostic done > $TMP2 45957455Sbostic $PROG -i psize=512 -o $TMP3 $type $TMP2 46057460Sbostic if (cmp -s $TMP1 $TMP3) ; then : 46157455Sbostic else 46257455Sbostic printf "test12: type %s: failed\n" $type 46357455Sbostic exit 1 46457455Sbostic fi 46557455Sbostic done 46657455Sbostic} 46757455Sbostic 468*59633Sbostic# Test different byte orders. 469*59633Sbostictest13() 470*59633Sbostic{ 471*59633Sbostic printf "Test 13: btree, hash: differing byte orders\n" 472*59633Sbostic sed 50q $DICT > $TMP1 473*59633Sbostic for order in 1234 4321; do 474*59633Sbostic for type in btree hash; do 475*59633Sbostic rm -f byte.file $TMP2 $TMP3 476*59633Sbostic for i in `sed 50q $DICT`; do 477*59633Sbostic printf "p\nk%s\nd%s\ng\nk%s\n" $i $i $i 478*59633Sbostic done > $TMP2 479*59633Sbostic $PROG -ilorder=$order -f byte.file -o $TMP3 $type $TMP2 480*59633Sbostic if (cmp -s $TMP1 $TMP3) ; then : 481*59633Sbostic else 482*59633Sbostic printf "test13: %s/%s put failed\n" $type $order 483*59633Sbostic exit 1 484*59633Sbostic fi 485*59633Sbostic for i in `sed 50q $DICT`; do 486*59633Sbostic printf "g\nk%s\n" $i 487*59633Sbostic done > $TMP2 488*59633Sbostic $PROG -ilorder=$order -f byte.file -o $TMP3 $type $TMP2 489*59633Sbostic if (cmp -s $TMP1 $TMP3) ; then : 490*59633Sbostic else 491*59633Sbostic printf "test13: %s/%s get failed\n" $type $order 492*59633Sbostic exit 1 493*59633Sbostic fi 494*59633Sbostic done 495*59633Sbostic done 496*59633Sbostic rm -f byte.file 497*59633Sbostic} 498*59633Sbostic 49956495Sbostic# Try a variety of bucketsizes and fill factors for hashing 50056999Sbostictest20() 50156495Sbostic{ 50256085Sbostic printf\ 50356999Sbostic "Test 20: hash: bucketsize, fill factor; nelem 25000 cachesize 65536\n" 50456085Sbostic awk 'BEGIN { 50556085Sbostic for (i = 1; i <= 10000; ++i) 50656085Sbostic printf("%.*s\n", i % 34, 50756085Sbostic "abcdefg abcdefg abcdefg abcdefg abcdefg abcdefg abcdefg"); 50856085Sbostic }' > $TMP1 50956085Sbostic sed 10000q $DICT | 51056085Sbostic awk '{ 51156085Sbostic ++i; 51256085Sbostic printf("p\nk%s\nd%.*s\n", $0, i % 34, 51356085Sbostic "abcdefg abcdefg abcdefg abcdefg abcdefg abcdefg abcdefg"); 51456085Sbostic }' > $TMP2 51556085Sbostic sed 10000q $DICT | 51656085Sbostic awk '{ 51756085Sbostic ++i; 51856085Sbostic printf("g\nk%s\n", $0); 51956085Sbostic }' >> $TMP2 52056085Sbostic bsize=256 52156085Sbostic for ffactor in 11 14 21; do 52259494Sbostic printf "\tbucketsize %d, fill factor %d\n" $bsize $ffactor 52356495Sbostic $PROG -o$TMP3 \ 52456085Sbostic -ibsize=$bsize,ffactor=$ffactor,nelem=25000,cachesize=65536\ 52556085Sbostic hash $TMP2 52657460Sbostic if (cmp -s $TMP1 $TMP3) ; then : 52756085Sbostic else 52856999Sbostic printf "test20: type hash:\ 52956085Sbosticbsize=$bsize ffactor=$ffactor nelem=25000 cachesize=65536 failed\n" 53056085Sbostic exit 1 53156085Sbostic fi 53256085Sbostic done 53356085Sbostic bsize=512 53456085Sbostic for ffactor in 21 28 43; do 53559494Sbostic printf "\tbucketsize %d, fill factor %d\n" $bsize $ffactor 53656495Sbostic $PROG -o$TMP3 \ 53756085Sbostic -ibsize=$bsize,ffactor=$ffactor,nelem=25000,cachesize=65536\ 53856085Sbostic hash $TMP2 53957460Sbostic if (cmp -s $TMP1 $TMP3) ; then : 54056085Sbostic else 54156999Sbostic printf "test20: type hash:\ 54256085Sbosticbsize=$bsize ffactor=$ffactor nelem=25000 cachesize=65536 failed\n" 54356085Sbostic exit 1 54456085Sbostic fi 54556085Sbostic done 54656085Sbostic bsize=1024 54756085Sbostic for ffactor in 43 57 85; do 54859494Sbostic printf "\tbucketsize %d, fill factor %d\n" $bsize $ffactor 54956495Sbostic $PROG -o$TMP3 \ 55056085Sbostic -ibsize=$bsize,ffactor=$ffactor,nelem=25000,cachesize=65536\ 55156085Sbostic hash $TMP2 55257460Sbostic if (cmp -s $TMP1 $TMP3) ; then : 55356085Sbostic else 55456999Sbostic printf "test20: type hash:\ 55556085Sbosticbsize=$bsize ffactor=$ffactor nelem=25000 cachesize=65536 failed\n" 55656085Sbostic exit 1 55756085Sbostic fi 55856085Sbostic done 55956085Sbostic bsize=2048 56056085Sbostic for ffactor in 85 114 171; do 56159494Sbostic printf "\tbucketsize %d, fill factor %d\n" $bsize $ffactor 56256495Sbostic $PROG -o$TMP3 \ 56356085Sbostic -ibsize=$bsize,ffactor=$ffactor,nelem=25000,cachesize=65536\ 56456085Sbostic hash $TMP2 56557460Sbostic if (cmp -s $TMP1 $TMP3) ; then : 56656085Sbostic else 56756999Sbostic printf "test20: type hash:\ 56856085Sbosticbsize=$bsize ffactor=$ffactor nelem=25000 cachesize=65536 failed\n" 56956085Sbostic exit 1 57056085Sbostic fi 57156085Sbostic done 57256085Sbostic bsize=4096 57356085Sbostic for ffactor in 171 228 341; do 57459494Sbostic printf "\tbucketsize %d, fill factor %d\n" $bsize $ffactor 57556495Sbostic $PROG -o$TMP3 \ 57656085Sbostic -ibsize=$bsize,ffactor=$ffactor,nelem=25000,cachesize=65536\ 57756085Sbostic hash $TMP2 57857460Sbostic if (cmp -s $TMP1 $TMP3) ; then : 57956085Sbostic else 58056999Sbostic printf "test20: type hash:\ 58156085Sbosticbsize=$bsize ffactor=$ffactor nelem=25000 cachesize=65536 failed\n" 58256085Sbostic exit 1 58356085Sbostic fi 58456085Sbostic done 58556085Sbostic bsize=8192 58656085Sbostic for ffactor in 341 455 683; do 58759494Sbostic printf "\tbucketsize %d, fill factor %d\n" $bsize $ffactor 58856495Sbostic $PROG -o$TMP3 \ 58956085Sbostic -ibsize=$bsize,ffactor=$ffactor,nelem=25000,cachesize=65536\ 59056085Sbostic hash $TMP2 59157460Sbostic if (cmp -s $TMP1 $TMP3) ; then : 59256085Sbostic else 59356999Sbostic printf "test20: type hash:\ 59456085Sbosticbsize=$bsize ffactor=$ffactor nelem=25000 cachesize=65536 failed\n" 59556085Sbostic exit 1 59656085Sbostic fi 59756085Sbostic done 59856085Sbostic} 59956085Sbostic 60056038Sbosticmain 601