Deleted Added
full compact
run.test (1573) run.test (14272)
1#!/bin/sh -
2#
1#!/bin/sh -
2#
3# @(#)run.test 8.7 (Berkeley) 9/16/93
3# @(#)run.test 8.10 (Berkeley) 7/26/94
4#
5
6# db regression tests
7main()
8{
9
4#
5
6# db regression tests
7main()
8{
9
10DICT=/usr/share/dict/words
11#DICT=/usr/dict/words
12PROG=./dbtest
13TMP1=t1
14TMP2=t2
15TMP3=t3
10 PROG=./dbtest
11 TMP1=t1
12 TMP2=t2
13 TMP3=t3
16
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
17 if [ $# -eq 0 ]; then
18 for t in 1 2 3 4 5 6 7 8 9 10 11 12 13 20; do
19 test$t
20 done
21 else
22 while [ $# -gt 0 ]
23 do case "$1" in
24 test*)

--- 315 unchanged lines hidden (view full) ---

340test7()
341{
342 echo "Test 7: btree, recno: delete cursor record"
343 echo "abcdefg abcdefg abcdefg abcdefg abcdefg abcdefg abcdefg" |
344 awk '{
345 for (i = 1; i <= 120; ++i)
346 printf("%05d: input key %d: %s\n", i, i, $0);
347 printf("%05d: input key %d: %s\n", 120, 120, $0);
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);
348 printf("get failed, no such key\n");
355 printf("seq failed, no such key\n");
349 printf("%05d: input key %d: %s\n", 1, 1, $0);
350 printf("%05d: input key %d: %s\n", 2, 2, $0);
351 exit;
352 }' > $TMP1
353 rm -f $TMP2 $TMP3
354
355 for type in btree recno; do
356 cat $TMP1 |
357 awk '{
358 if (i == 120)
359 exit;
360 printf("p\nk%d\nd%s\n", ++i, $0);
361 }
362 END {
363 printf("fR_NEXT\n");
364 for (i = 1; i <= 120; ++i)
365 printf("s\n");
366 printf("fR_CURSOR\ns\nk120\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");
367 printf("r\nk120\n");
374 printf("r\n");
368 printf("fR_NEXT\ns\n");
369 printf("fR_CURSOR\ns\nk1\n");
375 printf("fR_NEXT\ns\n");
376 printf("fR_CURSOR\ns\nk1\n");
370 printf("r\nk1\n");
377 printf("r\n");
371 printf("fR_FIRST\ns\n");
372 }' > $TMP2
373 $PROG -o $TMP3 recno $TMP2
374 if (cmp -s $TMP1 $TMP3) ; then :
375 else
376 echo "test7: type $type: failed"
377 exit 1
378 fi

--- 8 unchanged lines hidden (view full) ---

387 echo "" |
388 awk 'BEGIN {
389 for (i = 1; i <= 10; ++i) {
390 printf("p\nkkey1\nD/bin/sh\n");
391 printf("p\nkkey2\nD/bin/csh\n");
392 if (i % 8 == 0) {
393 printf("c\nkkey2\nD/bin/csh\n");
394 printf("c\nkkey1\nD/bin/sh\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");
395 printf("e\t%d of 10 (comparison)\r\n", i);
402 printf("e\t%d of 10 (comparison)\n", i);
396 } else
403 } else
397 printf("e\t%d of 10 \r\n", i);
404 printf("e\t%d of 10 \n", i);
398 printf("r\nkkey1\nr\nkkey2\n");
399 }
405 printf("r\nkkey1\nr\nkkey2\n");
406 }
400 printf("e\n");
401 printf("eend of test8 run\n");
402 }' > $TMP1
403 $PROG btree $TMP1
404# $PROG hash $TMP1
405 # No explicit test for success.
406}
407
408# Test btree duplicate keys
409test9()

--- 44 unchanged lines hidden (view full) ---

454 for type in btree recno; do
455 cat $TMP1 |
456 awk '{
457 if (i == 10)
458 exit;
459 printf("p\nk%d\nd%s\n", ++i, $0);
460 }
461 END {
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 {
462 printf("fR_CURSOR\nr\nk1\n");
467 printf("fR_CURSOR\nr\n");
463 printf("eR_CURSOR SHOULD HAVE FAILED\n");
464 }' > $TMP2
465 $PROG -o $TMP3 $type $TMP2 > /dev/null 2>&1
466 if [ -s $TMP3 ] ; then
467 echo "Test 10: delete: R_CURSOR SHOULD HAVE FAILED"
468 exit 1
469 fi
470 done

--- 97 unchanged lines hidden (view full) ---

568 else
569 echo "test13: $type/$order put failed"
570 exit 1
571 fi
572 for i in `sed 50q $DICT`; do
573 echo g
574 echo k$i
575 done > $TMP2
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
576 $PROG -ilorder=$order -f byte.file -o $TMP3 $type $TMP2
581 $PROG -s \
582 -ilorder=$order -f byte.file -o $TMP3 $type $TMP2
577 if (cmp -s $TMP1 $TMP3) ; then :
578 else
579 echo "test13: $type/$order get failed"
580 exit 1
581 fi
582 done
583 done
584 rm -f byte.file

--- 115 unchanged lines hidden ---
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 ---