##// END OF EJS Templates
tests: replace inline `waitlock()` with `wait-on-file` script...
Matt Harbison -
r52884:f0bee30a default
parent child Browse files
Show More
@@ -523,29 +523,15 Test debuglocks command:
523 523
524 524 * Test setting the lock
525 525
526 waitlock <file> will wait for file to be created. If it isn't in a reasonable
527 amount of time, displays error message and returns 1
528 $ waitlock() {
529 > start=`date +%s`
530 > timeout=5
531 > while [ \( ! -f $1 \) -a \( ! -L $1 \) ]; do
532 > now=`date +%s`
533 > if [ "`expr $now - $start`" -gt $timeout ]; then
534 > echo "timeout: $1 was not created in $timeout seconds"
535 > return 1
536 > fi
537 > sleep 0.1
538 > done
539 > }
540 526 $ dolock() {
541 527 > {
542 > waitlock .hg/unlock
528 > "$RUNTESTDIR/testlib/wait-on-file" 5 .hg/unlock
543 529 > rm -f .hg/unlock
544 530 > echo y
545 531 > } | hg debuglocks "$@" > /dev/null
546 532 > }
547 533 $ dolock -s &
548 $ waitlock .hg/store/lock
534 $ "$RUNTESTDIR/testlib/wait-on-file" 5 .hg/store/lock
549 535
550 536 $ hg debuglocks
551 537 lock: user *, process * (*s) (glob)
@@ -559,7 +545,7 amount of time, displays error message a
559 545 * Test setting the wlock
560 546
561 547 $ dolock -S &
562 $ waitlock .hg/wlock
548 $ "$RUNTESTDIR/testlib/wait-on-file" 5 .hg/wlock
563 549
564 550 $ hg debuglocks
565 551 lock: free
@@ -573,7 +559,8 amount of time, displays error message a
573 559 * Test setting both locks
574 560
575 561 $ dolock -Ss &
576 $ waitlock .hg/wlock && waitlock .hg/store/lock
562 $ "$RUNTESTDIR/testlib/wait-on-file" 5 .hg/wlock
563 $ "$RUNTESTDIR/testlib/wait-on-file" 5 .hg/store/lock
577 564
578 565 $ hg debuglocks
579 566 lock: user *, process * (*s) (glob)
@@ -600,7 +587,7 amount of time, displays error message a
600 587 * Test forcing the lock
601 588
602 589 $ dolock -s &
603 $ waitlock .hg/store/lock
590 $ "$RUNTESTDIR/testlib/wait-on-file" 5 .hg/store/lock
604 591
605 592 $ hg debuglocks
606 593 lock: user *, process * (*s) (glob)
@@ -619,7 +606,7 amount of time, displays error message a
619 606 * Test forcing the wlock
620 607
621 608 $ dolock -S &
622 $ waitlock .hg/wlock
609 $ "$RUNTESTDIR/testlib/wait-on-file" 5 .hg/wlock
623 610
624 611 $ hg debuglocks
625 612 lock: free
General Comments 0
You need to be logged in to leave comments. Login now