mirror of
https://github.com/pion/ice.git
synced 2025-10-15 20:10:38 +08:00
Add routine leak checks
To find out routine leak source.
This commit is contained in:

committed by
Sean DuBois

parent
d64ae4c32f
commit
ab4eba1707
@@ -30,6 +30,9 @@ func (m *mockPacketConn) SetReadDeadline(t time.Time) error {
|
|||||||
func (m *mockPacketConn) SetWriteDeadline(t time.Time) error { return nil }
|
func (m *mockPacketConn) SetWriteDeadline(t time.Time) error { return nil }
|
||||||
|
|
||||||
func TestPairSearch(t *testing.T) {
|
func TestPairSearch(t *testing.T) {
|
||||||
|
report := test.CheckRoutines(t)
|
||||||
|
defer report()
|
||||||
|
|
||||||
// Limit runtime in case of deadlocks
|
// Limit runtime in case of deadlocks
|
||||||
lim := test.TimeOut(time.Second * 10)
|
lim := test.TimeOut(time.Second * 10)
|
||||||
defer lim.Stop()
|
defer lim.Stop()
|
||||||
@@ -55,6 +58,9 @@ func TestPairSearch(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestPairPriority(t *testing.T) {
|
func TestPairPriority(t *testing.T) {
|
||||||
|
report := test.CheckRoutines(t)
|
||||||
|
defer report()
|
||||||
|
|
||||||
// avoid deadlocks?
|
// avoid deadlocks?
|
||||||
defer test.TimeOut(1 * time.Second).Stop()
|
defer test.TimeOut(1 * time.Second).Stop()
|
||||||
|
|
||||||
@@ -142,6 +148,9 @@ func TestPairPriority(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestOnSelectedCandidatePairChange(t *testing.T) {
|
func TestOnSelectedCandidatePairChange(t *testing.T) {
|
||||||
|
report := test.CheckRoutines(t)
|
||||||
|
defer report()
|
||||||
|
|
||||||
// avoid deadlocks?
|
// avoid deadlocks?
|
||||||
defer test.TimeOut(1 * time.Second).Stop()
|
defer test.TimeOut(1 * time.Second).Stop()
|
||||||
|
|
||||||
@@ -220,7 +229,7 @@ func runAgentTest(t *testing.T, config *AgentConfig, task func(a *Agent)) {
|
|||||||
|
|
||||||
func TestHandlePeerReflexive(t *testing.T) {
|
func TestHandlePeerReflexive(t *testing.T) {
|
||||||
// Limit runtime in case of deadlocks
|
// Limit runtime in case of deadlocks
|
||||||
lim := test.TimeOut(time.Second * 2)
|
lim := test.TimeOut(time.Second * 30)
|
||||||
defer lim.Stop()
|
defer lim.Stop()
|
||||||
|
|
||||||
report := test.CheckRoutines(t)
|
report := test.CheckRoutines(t)
|
||||||
|
@@ -86,6 +86,14 @@ func TestTimeout(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestReadClosed(t *testing.T) {
|
func TestReadClosed(t *testing.T) {
|
||||||
|
// Check for leaking routines
|
||||||
|
report := test.CheckRoutines(t)
|
||||||
|
defer report()
|
||||||
|
|
||||||
|
// Limit runtime in case of deadlocks
|
||||||
|
lim := test.TimeOut(time.Second * 20)
|
||||||
|
defer lim.Stop()
|
||||||
|
|
||||||
ca, cb := pipe(nil)
|
ca, cb := pipe(nil)
|
||||||
|
|
||||||
err := ca.Close()
|
err := ca.Close()
|
||||||
@@ -351,6 +359,14 @@ func randomPort(t testing.TB) int {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestConnStats(t *testing.T) {
|
func TestConnStats(t *testing.T) {
|
||||||
|
// Check for leaking routines
|
||||||
|
report := test.CheckRoutines(t)
|
||||||
|
defer report()
|
||||||
|
|
||||||
|
// Limit runtime in case of deadlocks
|
||||||
|
lim := test.TimeOut(time.Second * 20)
|
||||||
|
defer lim.Stop()
|
||||||
|
|
||||||
ca, cb := pipe(nil)
|
ca, cb := pipe(nil)
|
||||||
if _, err := ca.Write(make([]byte, 10)); err != nil {
|
if _, err := ca.Write(make([]byte, 10)); err != nil {
|
||||||
t.Fatal("unexpected error trying to write")
|
t.Fatal("unexpected error trying to write")
|
||||||
|
Reference in New Issue
Block a user