Skip to content

Commit a29dbaf

Browse files
committed
Stop using rustpkg test
It's really janky.
1 parent a4d0c29 commit a29dbaf

5 files changed

Lines changed: 92 additions & 81 deletions

File tree

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
/.rust/
22
/doc/
33
/test
4+
/rust-postgres

.travis.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,5 +8,5 @@ install:
88
before_script:
99
- ./travis/setup.sh
1010
script:
11-
- rustpkg --cfg travis test
12-
- rustpkg build
11+
- make
12+
- make test

Makefile

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
RUSTPKG ?= rustpkg
2+
RUSTC ?= rustc
3+
RUST_FLAGS ?= -Z debug-info -O
4+
5+
all:
6+
$(RUSTPKG) $(RUST_FLAGS) install
7+
8+
test:
9+
$(RUSTC) $(RUST_FLAGS) --test lib.rs
10+
./rust-postgres
11+
12+
.PHONY: test
13+
14+
clean:
15+
rm -rf .rust rust-postgres rust-postgres.dSYM

lib.rs

Lines changed: 51 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -84,60 +84,62 @@ use std::str;
8484
use std::task;
8585
use std::util;
8686

87-
use self::error::{PostgresDbError,
88-
PostgresConnectError,
89-
InvalidUrl,
90-
DnsError,
91-
SocketError,
92-
NoSslSupport,
93-
SslError,
94-
MissingUser,
95-
DbError,
96-
UnsupportedAuthentication,
97-
MissingPassword};
98-
use self::message::{BackendMessage,
99-
AuthenticationOk,
100-
AuthenticationKerberosV5,
101-
AuthenticationCleartextPassword,
102-
AuthenticationMD5Password,
103-
AuthenticationSCMCredential,
104-
AuthenticationGSS,
105-
AuthenticationSSPI,
106-
BackendKeyData,
107-
BindComplete,
108-
CommandComplete,
109-
DataRow,
110-
EmptyQueryResponse,
111-
ErrorResponse,
112-
NoData,
113-
NoticeResponse,
114-
NotificationResponse,
115-
ParameterDescription,
116-
ParameterStatus,
117-
ParseComplete,
118-
PortalSuspended,
119-
ReadyForQuery,
120-
RowDescription};
121-
use self::message::{FrontendMessage,
122-
Bind,
123-
CancelRequest,
124-
Close,
125-
Describe,
126-
Execute,
127-
Parse,
128-
PasswordMessage,
129-
Query,
130-
StartupMessage,
131-
SslRequest,
132-
Sync,
133-
Terminate};
134-
use self::message::{RowDescriptionEntry, WriteMessage, ReadMessage};
135-
use self::types::{Oid, PostgresType, ToSql, FromSql, PgUnknownType};
87+
use error::{PostgresDbError,
88+
PostgresConnectError,
89+
InvalidUrl,
90+
DnsError,
91+
SocketError,
92+
NoSslSupport,
93+
SslError,
94+
MissingUser,
95+
DbError,
96+
UnsupportedAuthentication,
97+
MissingPassword};
98+
use message::{BackendMessage,
99+
AuthenticationOk,
100+
AuthenticationKerberosV5,
101+
AuthenticationCleartextPassword,
102+
AuthenticationMD5Password,
103+
AuthenticationSCMCredential,
104+
AuthenticationGSS,
105+
AuthenticationSSPI,
106+
BackendKeyData,
107+
BindComplete,
108+
CommandComplete,
109+
DataRow,
110+
EmptyQueryResponse,
111+
ErrorResponse,
112+
NoData,
113+
NoticeResponse,
114+
NotificationResponse,
115+
ParameterDescription,
116+
ParameterStatus,
117+
ParseComplete,
118+
PortalSuspended,
119+
ReadyForQuery,
120+
RowDescription};
121+
use message::{FrontendMessage,
122+
Bind,
123+
CancelRequest,
124+
Close,
125+
Describe,
126+
Execute,
127+
Parse,
128+
PasswordMessage,
129+
Query,
130+
StartupMessage,
131+
SslRequest,
132+
Sync,
133+
Terminate};
134+
use message::{RowDescriptionEntry, WriteMessage, ReadMessage};
135+
use types::{Oid, PostgresType, ToSql, FromSql, PgUnknownType};
136136

137137
pub mod error;
138138
pub mod pool;
139139
mod message;
140140
pub mod types;
141+
#[cfg(test)]
142+
mod tests;
141143

142144
static DEFAULT_PORT: Port = 5432;
143145

test.rs renamed to tests.rs

Lines changed: 23 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,3 @@
1-
#[feature(struct_variant, macro_rules, globs)];
2-
3-
extern mod extra;
4-
extern mod openssl = "github.com/sfackler/rust-openssl";
5-
61
use extra::comm::DuplexStream;
72
use extra::future::Future;
83
use extra::time;
@@ -15,29 +10,27 @@ use std::f64;
1510
use std::hashmap::HashMap;
1611
use std::io::timer;
1712

18-
use lib::{PostgresNoticeHandler,
19-
PostgresNotification,
20-
PostgresConnection,
21-
PostgresStatement,
22-
ResultDescription,
23-
RequireSsl,
24-
PreferSsl,
25-
NoSsl};
26-
use lib::error::{DbError,
27-
DnsError,
28-
MissingPassword,
29-
Position,
30-
PostgresDbError,
31-
SyntaxError,
32-
InvalidPassword,
33-
QueryCanceled,
34-
InvalidCatalogName};
35-
use lib::types::{ToSql, FromSql, PgInt4, PgVarchar};
36-
use lib::types::array::{ArrayBase};
37-
use lib::types::range::{Range, Inclusive, Exclusive, RangeBound};
38-
use lib::pool::PostgresConnectionPool;
39-
40-
mod lib;
13+
use {PostgresNoticeHandler,
14+
PostgresNotification,
15+
PostgresConnection,
16+
PostgresStatement,
17+
ResultDescription,
18+
RequireSsl,
19+
PreferSsl,
20+
NoSsl};
21+
use error::{DbError,
22+
DnsError,
23+
MissingPassword,
24+
Position,
25+
PostgresDbError,
26+
SyntaxError,
27+
InvalidPassword,
28+
QueryCanceled,
29+
InvalidCatalogName};
30+
use types::{ToSql, FromSql, PgInt4, PgVarchar};
31+
use types::array::{ArrayBase};
32+
use types::range::{Range, Inclusive, Exclusive, RangeBound};
33+
use pool::PostgresConnectionPool;
4134

4235
#[test]
4336
// Make sure we can take both connections at once and can still get one after
@@ -704,8 +697,8 @@ fn test_cancel_query() {
704697

705698
do spawn {
706699
timer::sleep(500);
707-
assert!(lib::cancel_query("postgres://postgres@localhost", &NoSsl,
708-
cancel_data).is_ok());
700+
assert!(super::cancel_query("postgres://postgres@localhost", &NoSsl,
701+
cancel_data).is_ok());
709702
}
710703

711704
match conn.try_execute("SELECT pg_sleep(10)", []) {

0 commit comments

Comments
 (0)