##// 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 * Test setting the lock
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 $ dolock() {
526 $ dolock() {
541 > {
527 > {
542 > waitlock .hg/unlock
528 > "$RUNTESTDIR/testlib/wait-on-file" 5 .hg/unlock
543 > rm -f .hg/unlock
529 > rm -f .hg/unlock
544 > echo y
530 > echo y
545 > } | hg debuglocks "$@" > /dev/null
531 > } | hg debuglocks "$@" > /dev/null
546 > }
532 > }
547 $ dolock -s &
533 $ dolock -s &
548 $ waitlock .hg/store/lock
534 $ "$RUNTESTDIR/testlib/wait-on-file" 5 .hg/store/lock
549
535
550 $ hg debuglocks
536 $ hg debuglocks
551 lock: user *, process * (*s) (glob)
537 lock: user *, process * (*s) (glob)
@@ -559,7 +545,7 amount of time, displays error message a
559 * Test setting the wlock
545 * Test setting the wlock
560
546
561 $ dolock -S &
547 $ dolock -S &
562 $ waitlock .hg/wlock
548 $ "$RUNTESTDIR/testlib/wait-on-file" 5 .hg/wlock
563
549
564 $ hg debuglocks
550 $ hg debuglocks
565 lock: free
551 lock: free
@@ -573,7 +559,8 amount of time, displays error message a
573 * Test setting both locks
559 * Test setting both locks
574
560
575 $ dolock -Ss &
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 $ hg debuglocks
565 $ hg debuglocks
579 lock: user *, process * (*s) (glob)
566 lock: user *, process * (*s) (glob)
@@ -600,7 +587,7 amount of time, displays error message a
600 * Test forcing the lock
587 * Test forcing the lock
601
588
602 $ dolock -s &
589 $ dolock -s &
603 $ waitlock .hg/store/lock
590 $ "$RUNTESTDIR/testlib/wait-on-file" 5 .hg/store/lock
604
591
605 $ hg debuglocks
592 $ hg debuglocks
606 lock: user *, process * (*s) (glob)
593 lock: user *, process * (*s) (glob)
@@ -619,7 +606,7 amount of time, displays error message a
619 * Test forcing the wlock
606 * Test forcing the wlock
620
607
621 $ dolock -S &
608 $ dolock -S &
622 $ waitlock .hg/wlock
609 $ "$RUNTESTDIR/testlib/wait-on-file" 5 .hg/wlock
623
610
624 $ hg debuglocks
611 $ hg debuglocks
625 lock: free
612 lock: free
General Comments 0
You need to be logged in to leave comments. Login now