2
0

logging.tcl 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. tags {"external:skip"} {
  2. set system_name [string tolower [exec uname -s]]
  3. set system_supported 0
  4. # We only support darwin or Linux with glibc
  5. if {$system_name eq {darwin}} {
  6. set system_supported 1
  7. } elseif {$system_name eq {linux}} {
  8. # Avoid the test on libmusl, which does not support backtrace
  9. set ldd [exec ldd src/redis-server]
  10. if {![string match {*libc.musl*} $ldd]} {
  11. set system_supported 1
  12. }
  13. }
  14. if {$system_supported} {
  15. set server_path [tmpdir server.log]
  16. start_server [list overrides [list dir $server_path]] {
  17. test "Server is able to generate a stack trace on selected systems" {
  18. r config set watchdog-period 200
  19. r debug sleep 1
  20. set pattern "*debugCommand*"
  21. set retry 10
  22. while {$retry} {
  23. set result [exec tail -100 < [srv 0 stdout]]
  24. if {[string match $pattern $result]} {
  25. break
  26. }
  27. incr retry -1
  28. after 1000
  29. }
  30. if {$retry == 0} {
  31. error "assertion:expected stack trace not found into log file"
  32. }
  33. }
  34. }
  35. # Valgrind will complain that the process terminated by a signal, skip it.
  36. if {!$::valgrind} {
  37. set server_path [tmpdir server1.log]
  38. start_server [list overrides [list dir $server_path]] {
  39. test "Crash report generated on SIGABRT" {
  40. set pid [s process_id]
  41. exec kill -SIGABRT $pid
  42. set pattern "*STACK TRACE*"
  43. set result [exec tail -1000 < [srv 0 stdout]]
  44. assert {[string match $pattern $result]}
  45. }
  46. }
  47. }
  48. }
  49. }