2
0

fork.tcl 828 B

1234567891011121314151617181920212223242526272829303132
  1. set testmodule [file normalize tests/modules/fork.so]
  2. proc count_log_message {pattern} {
  3. set result [exec grep -c $pattern < [srv 0 stdout]]
  4. }
  5. start_server {tags {"modules"}} {
  6. r module load $testmodule
  7. test {Module fork} {
  8. # the argument to fork.create is the exitcode on termination
  9. r fork.create 3
  10. wait_for_condition 20 100 {
  11. [r fork.exitcode] != -1
  12. } else {
  13. fail "fork didn't terminate"
  14. }
  15. r fork.exitcode
  16. } {3}
  17. test {Module fork kill} {
  18. r fork.create 3
  19. after 20
  20. r fork.kill
  21. after 100
  22. assert {[count_log_message "fork child started"] eq "2"}
  23. assert {[count_log_message "Received SIGUSR1 in child"] eq "1"}
  24. assert {[count_log_message "fork child exiting"] eq "1"}
  25. }
  26. }