diff --git a/src/test/connector.rs b/src/test/connector.rs index 867ac039411168cffc0d17106ce7cce31c214644..a6f70c2cb4e9baa585bead6db95d4033287702a6 100644 --- a/src/test/connector.rs +++ b/src/test/connector.rs @@ -59,7 +59,8 @@ fn duo_positive() { let timeout = Duration::from_millis(1_500); let addrs = ["127.0.0.1:7012".parse().unwrap(), "127.0.0.1:7013".parse().unwrap()]; let a = thread::spawn(move || { - let mut x = Connector::Unconfigured(Unconfigured { controller_id: 0 }); + let controller_id = 0; + let mut x = Connector::Unconfigured(Unconfigured { controller_id }); x.configure( b" primitive main(out a, out b) { @@ -83,9 +84,11 @@ fn duo_positive() { assert_eq!(0, x.sync(timeout).unwrap()); assert_eq!(0, x.sync(timeout).unwrap()); assert_eq!(0, x.sync(timeout).unwrap()); + println!("\n---------\nLOG CID={}\n{}", controller_id, x.get_mut_logger().unwrap()); }); let b = thread::spawn(move || { - let mut x = Connector::Unconfigured(Unconfigured { controller_id: 1 }); + let controller_id = 1; + let mut x = Connector::Unconfigured(Unconfigured { controller_id }); x.configure( b" primitive main(in a, in b) { @@ -111,6 +114,7 @@ fn duo_positive() { assert_eq!(0, x.sync(timeout).unwrap()); assert_eq!(0, x.sync(timeout).unwrap()); assert_eq!(0, x.sync(timeout).unwrap()); + println!("\n---------\nLOG CID={}\n{}", controller_id, x.get_mut_logger().unwrap()); }); handle(a.join()); handle(b.join()); @@ -119,9 +123,10 @@ fn duo_positive() { #[test] fn duo_negative() { let timeout = Duration::from_millis(500); - let addrs = ["127.0.0.1:7012".parse().unwrap(), "127.0.0.1:7013".parse().unwrap()]; + let addrs = ["127.0.0.1:7014".parse().unwrap(), "127.0.0.1:7015".parse().unwrap()]; let a = thread::spawn(move || { - let mut x = Connector::Unconfigured(Unconfigured { controller_id: 0 }); + let controller_id = 0; + let mut x = Connector::Unconfigured(Unconfigured { controller_id }); x.configure(b" primitive main(out a, out b) { synchronous {} @@ -134,13 +139,16 @@ fn duo_negative() { x.bind_port(1, PortBinding::Passive(addrs[1])).unwrap(); x.connect(timeout).unwrap(); assert_eq!(0, x.sync(timeout).unwrap()); - match x.sync(timeout) { + let r = x.sync(timeout); + println!("\n---------\nLOG CID={}\n{}", controller_id, x.get_mut_logger().unwrap()); + match r { Err(SyncErr::Timeout) => {} x => unreachable!("{:?}", x) } }); let b = thread::spawn(move || { - let mut x = Connector::Unconfigured(Unconfigured { controller_id: 1 }); + let controller_id = 1; + let mut x = Connector::Unconfigured(Unconfigured { controller_id }); x.configure(b" primitive main(in a, in b) { while (true) { @@ -160,7 +168,9 @@ fn duo_negative() { x.bind_port(1, PortBinding::Active(addrs[1])).unwrap(); x.connect(timeout).unwrap(); assert_eq!(0, x.sync(timeout).unwrap()); - match x.sync(timeout) { + let r = x.sync(timeout); + println!("\n---------\nLOG CID={}\n{}", controller_id, x.get_mut_logger().unwrap()); + match r { Err(SyncErr::Timeout) => {} x => unreachable!("{:?}", x) } diff --git a/src/test/setup.rs b/src/test/setup.rs index 64c28d7c4002d429c8818381adb507b381c1a097..aa9de4f941b7274e536358043d9cb12e6da08483 100644 --- a/src/test/setup.rs +++ b/src/test/setup.rs @@ -83,7 +83,7 @@ fn config_and_connect_chain() { }), thread::spawn(move || { // FORWARDER ->B-> - let mut x = Connector::Unconfigured(Unconfigured { controller_id: 0 }); + let mut x = Connector::Unconfigured(Unconfigured { controller_id: 1 }); x.configure(b"primitive main(in a, out b) {}").unwrap(); x.bind_port(0, Passive(addrs[0])).unwrap(); x.bind_port(1, Active(addrs[1])).unwrap();