diff options
author | bors-servo <lbergstrom+bors@mozilla.com> | 2016-03-30 19:58:30 +0530 |
---|---|---|
committer | bors-servo <lbergstrom+bors@mozilla.com> | 2016-03-30 19:58:30 +0530 |
commit | e1485718128bff632eff5445583e925ff796bdba (patch) | |
tree | 5062e6ed8ecc0be23bdc994e164d2655f24a5eb3 | |
parent | 821afa071e0bb4aa3c48f35b44ab8984a1ec92bc (diff) | |
parent | 97f25456efd91b034fb15dc16b1a1123a68567c2 (diff) | |
download | servo-e1485718128bff632eff5445583e925ff796bdba.tar.gz servo-e1485718128bff632eff5445583e925ff796bdba.zip |
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 -->
-rw-r--r-- | appveyor.yml | 9 | ||||
-rw-r--r-- | components/util/opts.rs | 2 | ||||
-rw-r--r-- | python/servo/testing_commands.py | 6 | ||||
-rw-r--r-- | tests/unit/net/cookie.rs | 16 | ||||
-rw-r--r-- | tests/unit/net/http_loader.rs | 3 | ||||
-rw-r--r-- | tests/unit/util/opts.rs | 31 |
6 files changed, 60 insertions, 7 deletions
diff --git a/appveyor.yml b/appveyor.yml index e6c87bafe71..7b5c4c1e9a0 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -25,12 +25,19 @@ install: - 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" +# 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: - cmd: >- set MSYSTEM=MINGW64 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 diff --git a/components/util/opts.rs b/components/util/opts.rs index 78ac6f9cee6..e8d5283b9b4 100644 --- a/components/util/opts.rs +++ b/components/util/opts.rs @@ -868,7 +868,7 @@ pub fn parse_url_or_filename(cwd: &Path, input: &str) -> Result<Url, ()> { match Url::parse(input) { Ok(url) => Ok(url), Err(url::ParseError::RelativeUrlWithoutBase) => { - Ok(Url::from_file_path(&*cwd.join(input)).unwrap()) + Url::from_file_path(&*cwd.join(input)) } Err(_) => Err(()), } diff --git a/python/servo/testing_commands.py b/python/servo/testing_commands.py index 8140027ae97..4346fe6b7f6 100644 --- a/python/servo/testing_commands.py +++ b/python/servo/testing_commands.py @@ -188,7 +188,11 @@ class MachCommands(CommandBase): for crate in packages: args += ["-p", "%s_tests" % crate] 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: return result diff --git a/tests/unit/net/cookie.rs b/tests/unit/net/cookie.rs index 18058cc336f..a7b10403745 100644 --- a/tests/unit/net/cookie.rs +++ b/tests/unit/net/cookie.rs @@ -8,7 +8,6 @@ use net::cookie::Cookie; use net::cookie_storage::CookieStorage; use net_traits::CookieSource; - #[test] fn test_domain_match() { 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()); } +#[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] fn test_sort_order() { use std::cmp::Ordering; @@ -107,6 +120,7 @@ fn test_sort_order() { let url = &url!("http://example.com/foo"); 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(); + delay_to_ensure_different_timestamp(); 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::new_wrapped(b, url, CookieSource::HTTP).unwrap(); diff --git a/tests/unit/net/http_loader.rs b/tests/unit/net/http_loader.rs index b20585d8f36..5486840a535 100644 --- a/tests/unit/net/http_loader.rs +++ b/tests/unit/net/http_loader.rs @@ -19,12 +19,11 @@ use hyper::status::StatusCode; use msg::constellation_msg::PipelineId; use net::cookie::Cookie; 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::resource_thread::{AuthCacheEntry, CancellationListener}; use net_traits::{LoadData, CookieSource, LoadContext, IncludeSubdomains}; use std::borrow::Cow; -use std::collections::HashMap; use std::io::{self, Write, Read, Cursor}; use std::sync::mpsc::Receiver; use std::sync::{Arc, mpsc, RwLock}; diff --git a/tests/unit/util/opts.rs b/tests/unit/util/opts.rs index a4b4d8c3b35..5807f3327ef 100644 --- a/tests/unit/util/opts.rs +++ b/tests/unit/util/opts.rs @@ -5,9 +5,15 @@ use std::path::Path; 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] 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()); 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(); assert_eq!(url.scheme, "file"); 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(); assert_eq!(url.scheme, "file"); 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... let url = parse_url_or_filename(fake_cwd, "file:///foo/bar?baz#buzz.html").unwrap(); |