1#!/bin/sh - 2# |
3# @(#)run.test 8.10 (Berkeley) 7/26/94 |
4# 5 6# db regression tests 7main() 8{ 9 |
10 PROG=./dbtest 11 TMP1=t1 12 TMP2=t2 13 TMP3=t3 |
14 |
15 if [ -f /usr/share/dict/words ]; then 16 DICT=/usr/share/dict/words 17 elif [ -f /usr/dict/words ]; then 18 DICT=/usr/dict/words 19 else 20 echo 'run.test: no dictionary' 21 exit 1 22 fi 23 |
24 if [ $# -eq 0 ]; then 25 for t in 1 2 3 4 5 6 7 8 9 10 11 12 13 20; do 26 test$t 27 done 28 else 29 while [ $# -gt 0 ] 30 do case "$1" in 31 test*) --- 315 unchanged lines hidden (view full) --- 347test7() 348{ 349 echo "Test 7: btree, recno: delete cursor record" 350 echo "abcdefg abcdefg abcdefg abcdefg abcdefg abcdefg abcdefg" | 351 awk '{ 352 for (i = 1; i <= 120; ++i) 353 printf("%05d: input key %d: %s\n", i, i, $0); 354 printf("%05d: input key %d: %s\n", 120, 120, $0); |
355 printf("seq failed, no such key\n"); |
356 printf("%05d: input key %d: %s\n", 1, 1, $0); 357 printf("%05d: input key %d: %s\n", 2, 2, $0); 358 exit; 359 }' > $TMP1 360 rm -f $TMP2 $TMP3 361 362 for type in btree recno; do 363 cat $TMP1 | 364 awk '{ 365 if (i == 120) 366 exit; 367 printf("p\nk%d\nd%s\n", ++i, $0); 368 } 369 END { 370 printf("fR_NEXT\n"); 371 for (i = 1; i <= 120; ++i) 372 printf("s\n"); 373 printf("fR_CURSOR\ns\nk120\n"); |
374 printf("r\n"); |
375 printf("fR_NEXT\ns\n"); 376 printf("fR_CURSOR\ns\nk1\n"); |
377 printf("r\n"); |
378 printf("fR_FIRST\ns\n"); 379 }' > $TMP2 380 $PROG -o $TMP3 recno $TMP2 381 if (cmp -s $TMP1 $TMP3) ; then : 382 else 383 echo "test7: type $type: failed" 384 exit 1 385 fi --- 8 unchanged lines hidden (view full) --- 394 echo "" | 395 awk 'BEGIN { 396 for (i = 1; i <= 10; ++i) { 397 printf("p\nkkey1\nD/bin/sh\n"); 398 printf("p\nkkey2\nD/bin/csh\n"); 399 if (i % 8 == 0) { 400 printf("c\nkkey2\nD/bin/csh\n"); 401 printf("c\nkkey1\nD/bin/sh\n"); |
402 printf("e\t%d of 10 (comparison)\n", i); |
403 } else |
404 printf("e\t%d of 10 \n", i); |
405 printf("r\nkkey1\nr\nkkey2\n"); 406 } |
407 }' > $TMP1 408 $PROG btree $TMP1 409# $PROG hash $TMP1 410 # No explicit test for success. 411} 412 413# Test btree duplicate keys 414test9() --- 44 unchanged lines hidden (view full) --- 459 for type in btree recno; do 460 cat $TMP1 | 461 awk '{ 462 if (i == 10) 463 exit; 464 printf("p\nk%d\nd%s\n", ++i, $0); 465 } 466 END { |
467 printf("fR_CURSOR\nr\n"); |
468 printf("eR_CURSOR SHOULD HAVE FAILED\n"); 469 }' > $TMP2 470 $PROG -o $TMP3 $type $TMP2 > /dev/null 2>&1 471 if [ -s $TMP3 ] ; then 472 echo "Test 10: delete: R_CURSOR SHOULD HAVE FAILED" 473 exit 1 474 fi 475 done --- 97 unchanged lines hidden (view full) --- 573 else 574 echo "test13: $type/$order put failed" 575 exit 1 576 fi 577 for i in `sed 50q $DICT`; do 578 echo g 579 echo k$i 580 done > $TMP2 |
581 $PROG -s \ 582 -ilorder=$order -f byte.file -o $TMP3 $type $TMP2 |
583 if (cmp -s $TMP1 $TMP3) ; then : 584 else 585 echo "test13: $type/$order get failed" 586 exit 1 587 fi 588 done 589 done 590 rm -f byte.file --- 115 unchanged lines hidden --- |