From 79b25c666fecc908539087918131d6a56e669312 Mon Sep 17 00:00:00 2001 From: Ed Schouten Date: Mon, 1 Jan 2018 19:27:58 +0100 Subject: [PATCH 1/2] Add CloudABI to the list of supported targets in compiletest. Without this change, compiletest will fail to run when targetting CloudABI. --- src/tools/compiletest/src/util.rs | 1 + 1 file changed, 1 insertion(+) diff --git a/src/tools/compiletest/src/util.rs b/src/tools/compiletest/src/util.rs index c00f28eae67af..3c9dae915b5a2 100644 --- a/src/tools/compiletest/src/util.rs +++ b/src/tools/compiletest/src/util.rs @@ -15,6 +15,7 @@ use common::Config; const OS_TABLE: &'static [(&'static str, &'static str)] = &[ ("android", "android"), ("bitrig", "bitrig"), + ("cloudabi", "cloudabi"), ("darwin", "macos"), ("dragonfly", "dragonfly"), ("freebsd", "freebsd"), From 7b5543d7b6155c4e8dd44e0d7ed17a076db48c60 Mon Sep 17 00:00:00 2001 From: Ed Schouten Date: Mon, 1 Jan 2018 19:30:19 +0100 Subject: [PATCH 2/2] Move the TestPaths structure from libtest to compiletest. This structure doesn't seem to be used by libtest itself. It is used by compiletest, but never passed on to anything externally. This makes it easier to get the testing framework to work for CloudABI crossbuilds, as CloudABI currently lacks PathBuf, which is used by TestPaths. --- src/libtest/lib.rs | 7 ------- src/tools/compiletest/src/common.rs | 9 ++++++++- src/tools/compiletest/src/main.rs | 4 ++-- src/tools/compiletest/src/runtest.rs | 3 +-- 4 files changed, 11 insertions(+), 12 deletions(-) diff --git a/src/libtest/lib.rs b/src/libtest/lib.rs index 0d837c470a223..839f697b39cfa 100644 --- a/src/libtest/lib.rs +++ b/src/libtest/lib.rs @@ -203,13 +203,6 @@ pub struct TestDesc { pub allow_fail: bool, } -#[derive(Clone)] -pub struct TestPaths { - pub file: PathBuf, // e.g., compile-test/foo/bar/baz.rs - pub base: PathBuf, // e.g., compile-test, auxiliary - pub relative_dir: PathBuf, // e.g., foo/bar -} - #[derive(Debug)] pub struct TestDescAndFn { pub desc: TestDesc, diff --git a/src/tools/compiletest/src/common.rs b/src/tools/compiletest/src/common.rs index 48c3c5c819862..1d8cef05b7dd3 100644 --- a/src/tools/compiletest/src/common.rs +++ b/src/tools/compiletest/src/common.rs @@ -13,7 +13,7 @@ use std::fmt; use std::str::FromStr; use std::path::PathBuf; -use test::{ColorConfig, TestPaths}; +use test::ColorConfig; #[derive(Clone, Copy, PartialEq, Debug)] pub enum Mode { @@ -222,6 +222,13 @@ pub struct Config { pub nodejs: Option, } +#[derive(Clone)] +pub struct TestPaths { + pub file: PathBuf, // e.g., compile-test/foo/bar/baz.rs + pub base: PathBuf, // e.g., compile-test, auxiliary + pub relative_dir: PathBuf, // e.g., foo/bar +} + /// Used by `ui` tests to generate things like `foo.stderr` from `foo.rs`. pub fn expected_output_path(testpaths: &TestPaths, revision: Option<&str>, kind: &str) -> PathBuf { assert!(UI_EXTENSIONS.contains(&kind)); diff --git a/src/tools/compiletest/src/main.rs b/src/tools/compiletest/src/main.rs index 80630b5e2cf4b..533aaf9cd2735 100644 --- a/src/tools/compiletest/src/main.rs +++ b/src/tools/compiletest/src/main.rs @@ -33,10 +33,10 @@ use std::path::{Path, PathBuf}; use std::process::Command; use filetime::FileTime; use getopts::Options; -use common::Config; +use common::{Config, TestPaths}; use common::{DebugInfoGdb, DebugInfoLldb, Mode, Pretty}; use common::{expected_output_path, UI_EXTENSIONS}; -use test::{ColorConfig, TestPaths}; +use test::ColorConfig; use util::logv; use self::header::EarlyProps; diff --git a/src/tools/compiletest/src/runtest.rs b/src/tools/compiletest/src/runtest.rs index 3aee88136a1ff..aceb472ca6319 100644 --- a/src/tools/compiletest/src/runtest.rs +++ b/src/tools/compiletest/src/runtest.rs @@ -8,7 +8,7 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -use common::Config; +use common::{Config, TestPaths}; use common::{CompileFail, ParseFail, Pretty, RunFail, RunPass, RunPassValgrind}; use common::{Codegen, CodegenUnits, DebugInfoGdb, DebugInfoLldb, Rustdoc}; use common::{Incremental, MirOpt, RunMake, Ui}; @@ -18,7 +18,6 @@ use errors::{self, Error, ErrorKind}; use filetime::FileTime; use json; use header::TestProps; -use test::TestPaths; use util::logv; use regex::Regex;