@ -602,25 +602,40 @@ func (h Harness) testDistro(t *testing.T, d Distro, ipm ipMapping) {
}
}
defer ln . Close ( )
defer ln . Close ( )
sess , err := cli . NewSession ( )
ctx , cancel := context . WithCancel ( context . Background ( ) )
if err != nil {
t . Cleanup ( cancel )
t . Fatalf ( "can't open session: %v" , err )
}
defer sess . Close ( )
sess . Stdin = strings . NewReader ( "hi" )
go func ( ) {
sess . Stdout = logger . FuncWriter ( t . Logf )
for {
sess . Stderr = logger . FuncWriter ( t . Logf )
select {
case <- ctx . Done ( ) :
return
default :
}
sess , err := cli . NewSession ( )
if err != nil {
t . Errorf ( "can't open session: %v" , err )
return
}
defer sess . Close ( )
_ , port , _ := net . SplitHostPort ( ln . LocalAddr ( ) . String ( ) )
sess . Stdin = strings . NewReader ( "hi" )
sess . Stdout = logger . FuncWriter ( t . Logf )
sess . Stderr = logger . FuncWriter ( t . Logf )
cmd := fmt . Sprintf ( "/udp_tester -client %s\n" , net . JoinHostPort ( "100.64.0.1" , port ) )
_ , port , _ := net . SplitHostPort ( ln . LocalAddr ( ) . String ( ) )
time . Sleep ( 10 * time . Millisecond )
t . Logf ( "sending packet: %s" , cmd )
cmd := fmt . Sprintf ( "/udp_tester -client %s\n" , net . JoinHostPort ( "100.64.0.1" , port ) )
err = sess . Run ( cmd )
t . Logf ( "sending packet: %s" , cmd )
if err != nil {
err = sess . Run ( cmd )
t . Errorf ( "can't send UDP packet: %v" , err )
if err != nil {
}
t . Logf ( "can't send UDP packet: %v" , err )
}
time . Sleep ( 10 * time . Millisecond )
}
} ( )
t . Log ( "listening for packet" )
t . Log ( "listening for packet" )
n , _ , err := ln . ReadFromUDP ( buf )
n , _ , err := ln . ReadFromUDP ( buf )