From 380d03ffbebf0e379673561b80be44b288da07b7 Mon Sep 17 00:00:00 2001 From: Steven Fackler Date: Sat, 28 Sep 2013 21:19:27 -0700 Subject: [PATCH] Kill off Makefile Due to mozilla/rust#9602, the connection pool test had to be pulled into the main test file. --- Makefile | 24 ------------------------ src/postgres/pool/test.rs | 32 -------------------------------- src/postgres/test.rs | 30 ++++++++++++++++++++++++++++++ 3 files changed, 30 insertions(+), 56 deletions(-) delete mode 100644 Makefile delete mode 100644 src/postgres/pool/test.rs diff --git a/Makefile b/Makefile deleted file mode 100644 index 4c0df71c..00000000 --- a/Makefile +++ /dev/null @@ -1,24 +0,0 @@ -RUSTC ?= rustc -RUSTFLAGS += -L. -Z debug-info - -.PHONY: all -all: postgres.dummy - -postgres.dummy: src/lib.rs src/message.rs src/types.rs src/error.rs src/pool/mod.rs - $(RUSTC) $(RUSTFLAGS) --lib src/lib.rs --out-dir . - touch $@ - -.PHONY: check -check: check-postgres check-pool - -check-postgres: postgres.dummy src/test.rs - $(RUSTC) $(RUSTFLAGS) --test src/test.rs -o $@ - ./$@ - -check-pool: postgres.dummy src/pool/test.rs - $(RUSTC) $(RUSTFLAGS) --test src/pool/test.rs -o $@ - ./$@ - -.PHONY: clean -clean: - git clean -dfx diff --git a/src/postgres/pool/test.rs b/src/postgres/pool/test.rs deleted file mode 100644 index b554dd13..00000000 --- a/src/postgres/pool/test.rs +++ /dev/null @@ -1,32 +0,0 @@ -extern mod extra; -extern mod postgres; - -use extra::comm::DuplexStream; -use extra::future::Future; - -use postgres::pool::PostgresConnectionPool; - -#[test] -// Make sure we can take both connections at once and can still get one after -fn test_pool() { - let pool = PostgresConnectionPool::new("postgres://postgres@localhost", 2); - - let (stream1, stream2) = DuplexStream::<(), ()>(); - - let mut fut1 = do Future::spawn_with(pool.clone()) |pool| { - let _conn = pool.get_connection(); - stream1.send(()); - stream1.recv(); - }; - - let mut fut2 = do Future::spawn_with(pool.clone()) |pool| { - let _conn = pool.get_connection(); - stream2.send(()); - stream2.recv(); - }; - - fut1.get(); - fut2.get(); - - pool.get_connection(); -} diff --git a/src/postgres/test.rs b/src/postgres/test.rs index 94d81af8..9d8cd9ac 100644 --- a/src/postgres/test.rs +++ b/src/postgres/test.rs @@ -1,6 +1,8 @@ extern mod extra; extern mod postgres; +use extra::comm::DuplexStream; +use extra::future::Future; use extra::time; use extra::time::Timespec; use extra::json; @@ -19,6 +21,34 @@ use postgres::{PostgresNoticeHandler, ResultDescription}; use postgres::error::hack::{SyntaxError, InvalidPassword}; use postgres::types::{ToSql, FromSql, PgInt4, PgVarchar}; +use postgres::pool::PostgresConnectionPool; + + +#[test] +// TODO move back to pool/test.rs once mozilla/rust#9602 is fixed +// Make sure we can take both connections at once and can still get one after +fn test_pool() { + let pool = PostgresConnectionPool::new("postgres://postgres@localhost", 2); + + let (stream1, stream2) = DuplexStream::<(), ()>(); + + let mut fut1 = do Future::spawn_with(pool.clone()) |pool| { + let _conn = pool.get_connection(); + stream1.send(()); + stream1.recv(); + }; + + let mut fut2 = do Future::spawn_with(pool.clone()) |pool| { + let _conn = pool.get_connection(); + stream2.send(()); + stream2.recv(); + }; + + fut1.get(); + fut2.get(); + + pool.get_connection(); +} #[test] fn test_prepare_err() {