mirror of
https://github.com/servo/servo.git
synced 2025-07-24 15:50:21 +01:00
Auto merge of #10238 - jdm:winunit, r=larsbergstrom
Run unit tests on appveyor <!-- Reviewable:start --> This change is [<img src="https://reviewable.io/review_button.svg" height="35" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/10238) <!-- Reviewable:end -->
This commit is contained in:
commit
e148571812
6 changed files with 60 additions and 7 deletions
|
@ -25,12 +25,19 @@ install:
|
||||||
- bash -lc "mv /mingw64/bin/python2.exe /mingw64/bin/python2-mingw64.exe"
|
- bash -lc "mv /mingw64/bin/python2.exe /mingw64/bin/python2-mingw64.exe"
|
||||||
- bash -lc "mv /mingw64/bin/python2.7.exe /mingw64/bin/python2.7-mingw64.exe"
|
- bash -lc "mv /mingw64/bin/python2.7.exe /mingw64/bin/python2.7-mingw64.exe"
|
||||||
|
|
||||||
|
# Uncomment these lines to expose RDP access information to the build machine in the build log.
|
||||||
|
#init:
|
||||||
|
# - ps: iex ((new-object net.webclient).DownloadString('https://raw.githubusercontent.com/appveyor/ci/master/scripts/enable-rdp.ps1'))
|
||||||
|
#
|
||||||
|
#on_finish:
|
||||||
|
# - ps: $blockRdp = $true; iex ((new-object net.webclient).DownloadString('https://raw.githubusercontent.com/appveyor/ci/master/scripts/enable-rdp.ps1'))
|
||||||
|
|
||||||
build_script:
|
build_script:
|
||||||
- cmd: >-
|
- cmd: >-
|
||||||
set MSYSTEM=MINGW64
|
set MSYSTEM=MINGW64
|
||||||
|
|
||||||
PATH C:\msys64\mingw64\bin;C:\msys64\usr\bin\;%PATH%
|
PATH C:\msys64\mingw64\bin;C:\msys64\usr\bin\;%PATH%
|
||||||
|
|
||||||
bash -lc "cd $APPVEYOR_BUILD_FOLDER; ./mach build -d -v"
|
bash -lc "cd $APPVEYOR_BUILD_FOLDER; ./mach build -d -v && ./mach test-unit"
|
||||||
|
|
||||||
test: off
|
test: off
|
||||||
|
|
|
@ -868,7 +868,7 @@ pub fn parse_url_or_filename(cwd: &Path, input: &str) -> Result<Url, ()> {
|
||||||
match Url::parse(input) {
|
match Url::parse(input) {
|
||||||
Ok(url) => Ok(url),
|
Ok(url) => Ok(url),
|
||||||
Err(url::ParseError::RelativeUrlWithoutBase) => {
|
Err(url::ParseError::RelativeUrlWithoutBase) => {
|
||||||
Ok(Url::from_file_path(&*cwd.join(input)).unwrap())
|
Url::from_file_path(&*cwd.join(input))
|
||||||
}
|
}
|
||||||
Err(_) => Err(()),
|
Err(_) => Err(()),
|
||||||
}
|
}
|
||||||
|
|
|
@ -188,7 +188,11 @@ class MachCommands(CommandBase):
|
||||||
for crate in packages:
|
for crate in packages:
|
||||||
args += ["-p", "%s_tests" % crate]
|
args += ["-p", "%s_tests" % crate]
|
||||||
args += test_patterns
|
args += test_patterns
|
||||||
result = call(args, env=self.build_env(), cwd=self.servo_crate())
|
|
||||||
|
env = self.build_env()
|
||||||
|
env["RUST_BACKTRACE"] = "1"
|
||||||
|
|
||||||
|
result = call(args, env=env, cwd=self.servo_crate())
|
||||||
if result != 0:
|
if result != 0:
|
||||||
return result
|
return result
|
||||||
|
|
||||||
|
|
|
@ -8,7 +8,6 @@ use net::cookie::Cookie;
|
||||||
use net::cookie_storage::CookieStorage;
|
use net::cookie_storage::CookieStorage;
|
||||||
use net_traits::CookieSource;
|
use net_traits::CookieSource;
|
||||||
|
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_domain_match() {
|
fn test_domain_match() {
|
||||||
assert!(Cookie::domain_match("foo.com", "foo.com"));
|
assert!(Cookie::domain_match("foo.com", "foo.com"));
|
||||||
|
@ -100,6 +99,20 @@ fn fn_cookie_constructor() {
|
||||||
assert!(Cookie::new_wrapped(cookie, u, CookieSource::HTTP).is_some());
|
assert!(Cookie::new_wrapped(cookie, u, CookieSource::HTTP).is_some());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[cfg(target_os = "windows")]
|
||||||
|
fn delay_to_ensure_different_timestamp() {
|
||||||
|
use std::thread;
|
||||||
|
use std::time::Duration;
|
||||||
|
|
||||||
|
// time::now()'s resolution on some platforms isn't granular enought to ensure
|
||||||
|
// that two back-to-back calls to Cookie::new_wrapped generate different timestamps .
|
||||||
|
thread::sleep(Duration::from_millis(500));
|
||||||
|
}
|
||||||
|
|
||||||
|
#[cfg(not(target_os = "windows"))]
|
||||||
|
fn delay_to_ensure_different_timestamp() {
|
||||||
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_sort_order() {
|
fn test_sort_order() {
|
||||||
use std::cmp::Ordering;
|
use std::cmp::Ordering;
|
||||||
|
@ -107,6 +120,7 @@ fn test_sort_order() {
|
||||||
let url = &url!("http://example.com/foo");
|
let url = &url!("http://example.com/foo");
|
||||||
let a_wrapped = cookie_rs::Cookie::parse("baz=bar; Path=/foo/bar/").unwrap();
|
let a_wrapped = cookie_rs::Cookie::parse("baz=bar; Path=/foo/bar/").unwrap();
|
||||||
let a = Cookie::new_wrapped(a_wrapped.clone(), url, CookieSource::HTTP).unwrap();
|
let a = Cookie::new_wrapped(a_wrapped.clone(), url, CookieSource::HTTP).unwrap();
|
||||||
|
delay_to_ensure_different_timestamp();
|
||||||
let a_prime = Cookie::new_wrapped(a_wrapped, url, CookieSource::HTTP).unwrap();
|
let a_prime = Cookie::new_wrapped(a_wrapped, url, CookieSource::HTTP).unwrap();
|
||||||
let b = cookie_rs::Cookie::parse("baz=bar;Path=/foo/bar/baz/").unwrap();
|
let b = cookie_rs::Cookie::parse("baz=bar;Path=/foo/bar/baz/").unwrap();
|
||||||
let b = Cookie::new_wrapped(b, url, CookieSource::HTTP).unwrap();
|
let b = Cookie::new_wrapped(b, url, CookieSource::HTTP).unwrap();
|
||||||
|
|
|
@ -19,12 +19,11 @@ use hyper::status::StatusCode;
|
||||||
use msg::constellation_msg::PipelineId;
|
use msg::constellation_msg::PipelineId;
|
||||||
use net::cookie::Cookie;
|
use net::cookie::Cookie;
|
||||||
use net::cookie_storage::CookieStorage;
|
use net::cookie_storage::CookieStorage;
|
||||||
use net::hsts::{HSTSList, HSTSEntry};
|
use net::hsts::HSTSEntry;
|
||||||
use net::http_loader::{load, LoadError, HttpRequestFactory, HttpRequest, HttpResponse, HttpState};
|
use net::http_loader::{load, LoadError, HttpRequestFactory, HttpRequest, HttpResponse, HttpState};
|
||||||
use net::resource_thread::{AuthCacheEntry, CancellationListener};
|
use net::resource_thread::{AuthCacheEntry, CancellationListener};
|
||||||
use net_traits::{LoadData, CookieSource, LoadContext, IncludeSubdomains};
|
use net_traits::{LoadData, CookieSource, LoadContext, IncludeSubdomains};
|
||||||
use std::borrow::Cow;
|
use std::borrow::Cow;
|
||||||
use std::collections::HashMap;
|
|
||||||
use std::io::{self, Write, Read, Cursor};
|
use std::io::{self, Write, Read, Cursor};
|
||||||
use std::sync::mpsc::Receiver;
|
use std::sync::mpsc::Receiver;
|
||||||
use std::sync::{Arc, mpsc, RwLock};
|
use std::sync::{Arc, mpsc, RwLock};
|
||||||
|
|
|
@ -5,9 +5,15 @@
|
||||||
use std::path::Path;
|
use std::path::Path;
|
||||||
use util::opts::parse_url_or_filename;
|
use util::opts::parse_url_or_filename;
|
||||||
|
|
||||||
|
#[cfg(not(target_os = "windows"))]
|
||||||
|
const FAKE_CWD: &'static str = "/fake/cwd";
|
||||||
|
|
||||||
|
#[cfg(target_os = "windows")]
|
||||||
|
const FAKE_CWD: &'static str = "C:/fake/cwd";
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_argument_parsing() {
|
fn test_argument_parsing() {
|
||||||
let fake_cwd = Path::new("/fake/cwd");
|
let fake_cwd = Path::new(FAKE_CWD);
|
||||||
assert!(parse_url_or_filename(fake_cwd, "http://example.net:invalid").is_err());
|
assert!(parse_url_or_filename(fake_cwd, "http://example.net:invalid").is_err());
|
||||||
|
|
||||||
let url = parse_url_or_filename(fake_cwd, "http://example.net").unwrap();
|
let url = parse_url_or_filename(fake_cwd, "http://example.net").unwrap();
|
||||||
|
@ -16,10 +22,33 @@ fn test_argument_parsing() {
|
||||||
let url = parse_url_or_filename(fake_cwd, "file:///foo/bar.html").unwrap();
|
let url = parse_url_or_filename(fake_cwd, "file:///foo/bar.html").unwrap();
|
||||||
assert_eq!(url.scheme, "file");
|
assert_eq!(url.scheme, "file");
|
||||||
assert_eq!(url.path().unwrap(), ["foo", "bar.html"]);
|
assert_eq!(url.path().unwrap(), ["foo", "bar.html"]);
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
#[cfg(not(target_os = "windows"))]
|
||||||
|
fn test_file_path_parsing() {
|
||||||
|
let fake_cwd = Path::new(FAKE_CWD);
|
||||||
|
|
||||||
let url = parse_url_or_filename(fake_cwd, "bar.html").unwrap();
|
let url = parse_url_or_filename(fake_cwd, "bar.html").unwrap();
|
||||||
assert_eq!(url.scheme, "file");
|
assert_eq!(url.scheme, "file");
|
||||||
assert_eq!(url.path().unwrap(), ["fake", "cwd", "bar.html"]);
|
assert_eq!(url.path().unwrap(), ["fake", "cwd", "bar.html"]);
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
#[cfg(target_os = "windows")]
|
||||||
|
fn test_file_path_parsing() {
|
||||||
|
let fake_cwd = Path::new(FAKE_CWD);
|
||||||
|
|
||||||
|
let url = parse_url_or_filename(fake_cwd, "bar.html").unwrap();
|
||||||
|
assert_eq!(url.scheme, "file");
|
||||||
|
assert_eq!(url.path().unwrap(), ["C:", "fake", "cwd", "bar.html"]);
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
#[cfg(not(target_os = "windows"))]
|
||||||
|
// Windows file paths can't contain ?
|
||||||
|
fn test_argument_parsing_special() {
|
||||||
|
let fake_cwd = Path::new(FAKE_CWD);
|
||||||
|
|
||||||
// '?' and '#' have a special meaning in URLs...
|
// '?' and '#' have a special meaning in URLs...
|
||||||
let url = parse_url_or_filename(fake_cwd, "file:///foo/bar?baz#buzz.html").unwrap();
|
let url = parse_url_or_filename(fake_cwd, "file:///foo/bar?baz#buzz.html").unwrap();
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue