mirror of
https://github.com/fluencelabs/wasmer
synced 2024-12-13 22:25:40 +00:00
Merge remote-tracking branch 'origin/master' into feature/singlepass-aarch64
This commit is contained in:
commit
df43759a67
@ -2,6 +2,10 @@
|
||||
|
||||
## **[Unreleased]**
|
||||
|
||||
- [#992](https://github.com/wasmerio/wasmer/pull/992) Updates WAPM version to 0.4.1, fix arguments issue introduced in #990
|
||||
- [#990](https://github.com/wasmerio/wasmer/pull/990) Default wasmer CLI to `run`. Wasmer will now attempt to parse unrecognized command line options as if they were applied to the run command: `wasmer mywasm.wasm --dir=.` now works!
|
||||
- [#987](https://github.com/wasmerio/wasmer/pull/987) Fix `runtime-c-api` header files when compiled by gnuc.
|
||||
|
||||
## 0.10.2 - 2019-11-18
|
||||
|
||||
- [#968](https://github.com/wasmerio/wasmer/pull/968) Added `--invoke` option to the command
|
||||
|
@ -167,15 +167,12 @@ nginx and Lua do not work on Windows - you can track the progress on [this issue
|
||||
|
||||
2. Install [Rust for Windows](https://win.rustup.rs)
|
||||
|
||||
3. Install [Python for Windows](https://www.python.org/downloads/release/python-2714/). The Windows x86-64 MSI installer is fine.
|
||||
Make sure to enable "Add python.exe to Path" during installation.
|
||||
|
||||
4. Install [Git for Windows](https://git-scm.com/download/win). Allow it to add `git.exe` to your PATH (default
|
||||
3. Install [Git for Windows](https://git-scm.com/download/win). Allow it to add `git.exe` to your PATH (default
|
||||
settings for the installer are fine).
|
||||
|
||||
5. Install [CMake](https://cmake.org/download/). Ensure CMake is in your PATH.
|
||||
4. Install [CMake](https://cmake.org/download/). Ensure CMake is in your PATH.
|
||||
|
||||
6. Install [LLVM 8.0](https://prereleases.llvm.org/win-snapshots/LLVM-8.0.0-r351033-win64.exe)
|
||||
5. Install [LLVM 8.0](https://prereleases.llvm.org/win-snapshots/LLVM-8.0.0-r351033-win64.exe)
|
||||
</p>
|
||||
</details>
|
||||
|
||||
|
@ -18,7 +18,7 @@
|
||||
| - | :-: | :-: | :-: |
|
||||
| Cranelift Backend | ✅ | ✅ | ✅ |
|
||||
| LLVM Backend | ✅ | ✅ | ✅ |
|
||||
| Singlepass Backend | [#347](https://github.com/wasmerio/wasmer/issues/347) | ✅ | ✅ |
|
||||
| Singlepass Backend | ✅ | ✅ | [#347](https://github.com/wasmerio/wasmer/issues/347) |
|
||||
| WASI | ✅ | ✅ | ✅* |
|
||||
|
||||
* `poll_fd` is not fully implemented for Windows yet
|
||||
|
@ -211,6 +211,7 @@ initArch() {
|
||||
case $ARCH in
|
||||
amd64) ARCH="amd64";;
|
||||
x86_64) ARCH="amd64";;
|
||||
aarch64) ARCH="arm64";;
|
||||
# i386) ARCH="386";;
|
||||
*) printf "$red> The system architecture (${ARCH}) is not supported by this installation script.$reset\n"; exit 1;;
|
||||
esac
|
||||
|
@ -105,6 +105,10 @@ int main()
|
||||
|
||||
# Testing
|
||||
|
||||
Tests are run using the release build of the library. If you make
|
||||
changes or compile with non-default features, please ensure you
|
||||
rebuild in release mode for the tests to see the changes.
|
||||
|
||||
The tests can be run via `cargo test`, such as:
|
||||
|
||||
```sh
|
||||
|
@ -22,7 +22,7 @@ fn main() {
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if defined(GCC) || defined(__clang__)
|
||||
#if defined(GCC) || defined(__GNUC__) || defined(__clang__)
|
||||
#if defined(__x86_64__)
|
||||
#define ARCH_X86_64
|
||||
#endif
|
||||
|
@ -7,7 +7,6 @@ add_executable(test-globals test-globals.c)
|
||||
add_executable(test-import-function test-import-function.c)
|
||||
add_executable(test-imports test-imports.c)
|
||||
add_executable(test-import-object test-import-object.c)
|
||||
add_executable(test-wasi-import-object test-wasi-import-object.c)
|
||||
add_executable(test-instantiate test-instantiate.c)
|
||||
add_executable(test-memory test-memory.c)
|
||||
add_executable(test-module test-module.c)
|
||||
@ -19,6 +18,10 @@ add_executable(test-validate test-validate.c)
|
||||
add_executable(test-context test-context.c)
|
||||
add_executable(test-module-import-instantiate test-module-import-instantiate.c)
|
||||
|
||||
if (DEFINED WASI_TESTS)
|
||||
add_executable(test-wasi-import-object test-wasi-import-object.c)
|
||||
endif()
|
||||
|
||||
find_library(
|
||||
WASMER_LIB NAMES libwasmer_runtime_c_api.dylib libwasmer_runtime_c_api.so wasmer_runtime_c_api.dll
|
||||
PATHS ${CMAKE_SOURCE_DIR}/../../../target/release/
|
||||
@ -64,9 +67,12 @@ target_link_libraries(test-import-object general ${WASMER_LIB})
|
||||
target_compile_options(test-import-object PRIVATE ${COMPILER_OPTIONS})
|
||||
add_test(test-import-object test-import-object)
|
||||
|
||||
target_link_libraries(test-wasi-import-object general ${WASMER_LIB})
|
||||
target_compile_options(test-wasi-import-object PRIVATE ${COMPILER_OPTIONS})
|
||||
add_test(test-wasi-import-object test-wasi-import-object)
|
||||
|
||||
if (DEFINED WASI_TESTS)
|
||||
target_link_libraries(test-wasi-import-object general ${WASMER_LIB})
|
||||
target_compile_options(test-wasi-import-object PRIVATE ${COMPILER_OPTIONS})
|
||||
add_test(test-wasi-import-object test-wasi-import-object)
|
||||
endif()
|
||||
|
||||
target_link_libraries(test-instantiate general ${WASMER_LIB})
|
||||
target_compile_options(test-instantiate PRIVATE ${COMPILER_OPTIONS})
|
||||
|
@ -4,7 +4,14 @@ use std::process::Command;
|
||||
fn test_c_api() {
|
||||
let project_tests_dir = concat!(env!("CARGO_MANIFEST_DIR"), "/tests");
|
||||
|
||||
run_command("cmake", project_tests_dir, vec!["."]);
|
||||
let cmake_args = vec![
|
||||
".",
|
||||
#[cfg(feature = "wasi")]
|
||||
"-DWASI_TESTS=ON",
|
||||
];
|
||||
// we use -f so it doesn't fail if the fiel doesn't exist
|
||||
run_command("rm", project_tests_dir, vec!["-f", "CMakeCache.txt"]);
|
||||
run_command("cmake", project_tests_dir, cmake_args);
|
||||
run_command("make", project_tests_dir, vec!["-Wdev", "-Werror=dev"]);
|
||||
run_command("make", project_tests_dir, vec!["test", "ARGS=\"-V\""]);
|
||||
}
|
||||
|
Binary file not shown.
Binary file not shown.
@ -8,7 +8,7 @@
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if defined(GCC) || defined(__clang__)
|
||||
#if defined(GCC) || defined(__GNUC__) || defined(__clang__)
|
||||
#if defined(__x86_64__)
|
||||
#define ARCH_X86_64
|
||||
#endif
|
||||
|
@ -8,7 +8,7 @@
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if defined(GCC) || defined(__clang__)
|
||||
#if defined(GCC) || defined(__GNUC__) || defined(__clang__)
|
||||
#if defined(__x86_64__)
|
||||
#define ARCH_X86_64
|
||||
#endif
|
||||
|
@ -12,10 +12,12 @@
|
||||
# Star line allows skipping an entire wast file
|
||||
# clif:skip:simd.wast:*
|
||||
#
|
||||
# Excludes can also contain platform
|
||||
# Excludes can also contain target family
|
||||
# clif:skip:data.wast:172:windows
|
||||
# clif:skip:data.wast:172:unix
|
||||
#
|
||||
# Or target arch
|
||||
# singlepass:skip:atomic.wast:*:*:aarch64
|
||||
|
||||
# Cranelift
|
||||
clif:skip:atomic.wast:* # Threads not implemented
|
||||
|
@ -18,6 +18,7 @@ mod tests {
|
||||
// TODO Files could be run with multiple threads
|
||||
// TODO Allow running WAST &str directly (E.g. for use outside of spectests)
|
||||
|
||||
use std::collections::HashSet;
|
||||
use std::sync::{Arc, Mutex};
|
||||
|
||||
struct SpecFailure {
|
||||
@ -46,15 +47,14 @@ mod tests {
|
||||
pub fn add_failure(
|
||||
&mut self,
|
||||
failure: SpecFailure,
|
||||
testkey: &str,
|
||||
excludes: &HashMap<String, Exclude>,
|
||||
_testkey: &str,
|
||||
excludes: &Vec<Exclude>,
|
||||
line: u64,
|
||||
) {
|
||||
if excludes.contains_key(testkey) {
|
||||
self.allowed_failure += 1;
|
||||
return;
|
||||
}
|
||||
let platform_key = format!("{}:{}", testkey, get_platform());
|
||||
if excludes.contains_key(&platform_key) {
|
||||
if excludes
|
||||
.iter()
|
||||
.any(|e| e.line_matches(line) && e.exclude_kind == ExcludeKind::Fail)
|
||||
{
|
||||
self.allowed_failure += 1;
|
||||
return;
|
||||
}
|
||||
@ -104,15 +104,113 @@ mod tests {
|
||||
}
|
||||
|
||||
#[cfg(unix)]
|
||||
fn get_platform() -> &'static str {
|
||||
fn get_target_family() -> &'static str {
|
||||
"unix"
|
||||
}
|
||||
|
||||
#[cfg(windows)]
|
||||
fn get_platform() -> &'static str {
|
||||
fn get_target_family() -> &'static str {
|
||||
"windows"
|
||||
}
|
||||
|
||||
fn get_target_arch() -> &'static str {
|
||||
if cfg!(target_arch = "x86_64") {
|
||||
"x86_64"
|
||||
} else if cfg!(target_arch = "aarch64") {
|
||||
"aarch64"
|
||||
} else if cfg!(target_arch = "x86") {
|
||||
"x86"
|
||||
} else if cfg!(target_arch = "mips") {
|
||||
"mips"
|
||||
} else if cfg!(target_arch = "powerpc") {
|
||||
"powerpc"
|
||||
} else if cfg!(target_arch = "powerpc64") {
|
||||
"powerpc64"
|
||||
} else if cfg!(target_arch = "arm") {
|
||||
"arm"
|
||||
} else {
|
||||
panic!("unknown target arch")
|
||||
}
|
||||
}
|
||||
|
||||
// clif:skip:data.wast:172:unix:x86
|
||||
#[allow(dead_code)]
|
||||
struct Exclude {
|
||||
backend: Option<String>,
|
||||
exclude_kind: ExcludeKind,
|
||||
file: String,
|
||||
line: Option<u64>,
|
||||
target_family: Option<String>,
|
||||
target_arch: Option<String>,
|
||||
}
|
||||
|
||||
impl Exclude {
|
||||
fn line_matches(&self, value: u64) -> bool {
|
||||
self.line.is_none() || self.line.unwrap() == value
|
||||
}
|
||||
|
||||
fn line_exact_match(&self, value: u64) -> bool {
|
||||
self.line.is_some() && self.line.unwrap() == value
|
||||
}
|
||||
|
||||
fn matches_backend(&self, value: &str) -> bool {
|
||||
self.backend.is_none() || self.backend.as_ref().unwrap() == value
|
||||
}
|
||||
|
||||
fn matches_target_family(&self, value: &str) -> bool {
|
||||
self.target_family.is_none() || self.target_family.as_ref().unwrap() == value
|
||||
}
|
||||
|
||||
fn matches_target_arch(&self, value: &str) -> bool {
|
||||
self.target_arch.is_none() || self.target_arch.as_ref().unwrap() == value
|
||||
}
|
||||
|
||||
fn from(
|
||||
backend: &str,
|
||||
exclude_kind: &str,
|
||||
file: &str,
|
||||
line: &str,
|
||||
target_family: &str,
|
||||
target_arch: &str,
|
||||
) -> Exclude {
|
||||
let backend: Option<String> = match backend {
|
||||
"*" => None,
|
||||
"clif" => Some("clif".to_string()),
|
||||
"singlepass" => Some("singlepass".to_string()),
|
||||
"llvm" => Some("llvm".to_string()),
|
||||
_ => panic!("backend {:?} not recognized", backend),
|
||||
};
|
||||
let exclude_kind = match exclude_kind {
|
||||
"skip" => ExcludeKind::Skip,
|
||||
"fail" => ExcludeKind::Fail,
|
||||
_ => panic!("exclude kind {:?} not recognized", exclude_kind),
|
||||
};
|
||||
let line = match line {
|
||||
"*" => None,
|
||||
_ => Some(
|
||||
line.parse::<u64>()
|
||||
.expect(&format!("expected * or int: {:?}", line)),
|
||||
),
|
||||
};
|
||||
let target_family = match target_family {
|
||||
"*" => None,
|
||||
_ => Some(target_family.to_string()),
|
||||
};
|
||||
let target_arch = match target_arch {
|
||||
"*" => None,
|
||||
_ => Some(target_arch.to_string()),
|
||||
};
|
||||
Exclude {
|
||||
backend,
|
||||
exclude_kind,
|
||||
file: file.to_string(),
|
||||
line,
|
||||
target_family,
|
||||
target_arch,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(not(any(feature = "llvm", feature = "clif", feature = "singlepass")))]
|
||||
fn get_compiler_name() -> &'static str {
|
||||
panic!("compiler not specified, activate a compiler via features");
|
||||
@ -160,7 +258,8 @@ mod tests {
|
||||
|
||||
fn parse_and_run(
|
||||
path: &PathBuf,
|
||||
excludes: &HashMap<String, Exclude>,
|
||||
file_excludes: &HashSet<String>,
|
||||
excludes: &HashMap<String, Vec<Exclude>>,
|
||||
) -> Result<TestReport, String> {
|
||||
let mut test_report = TestReport {
|
||||
failures: vec![],
|
||||
@ -171,15 +270,9 @@ mod tests {
|
||||
|
||||
let filename = path.file_name().unwrap().to_str().unwrap();
|
||||
let source = fs::read(&path).unwrap();
|
||||
let backend = get_compiler_name();
|
||||
|
||||
let platform = get_platform();
|
||||
let star_key = format!("{}:{}:*", backend, filename);
|
||||
let platform_star_key = format!("{}:{}:*:{}", backend, filename, platform);
|
||||
if (excludes.contains_key(&star_key) && *excludes.get(&star_key).unwrap() == Exclude::Skip)
|
||||
|| (excludes.contains_key(&platform_star_key)
|
||||
&& *excludes.get(&platform_star_key).unwrap() == Exclude::Skip)
|
||||
{
|
||||
// Entire file is excluded by line * and skip
|
||||
if file_excludes.contains(filename) {
|
||||
return Ok(test_report);
|
||||
}
|
||||
|
||||
@ -198,21 +291,27 @@ mod tests {
|
||||
|
||||
let mut registered_modules: HashMap<String, Arc<Mutex<Instance>>> = HashMap::new();
|
||||
//
|
||||
let empty_excludes = vec![];
|
||||
let excludes = if excludes.contains_key(filename) {
|
||||
excludes.get(filename).unwrap()
|
||||
} else {
|
||||
&empty_excludes
|
||||
};
|
||||
|
||||
let backend = get_compiler_name();
|
||||
|
||||
while let Some(Command { kind, line }) =
|
||||
parser.next().map_err(|e| format!("Parse err: {:?}", e))?
|
||||
{
|
||||
let test_key = format!("{}:{}:{}", backend, filename, line);
|
||||
let test_platform_key = format!("{}:{}:{}:{}", backend, filename, line, platform);
|
||||
// Use this line to debug which test is running
|
||||
println!("Running test: {}", test_key);
|
||||
|
||||
if (excludes.contains_key(&test_key)
|
||||
&& *excludes.get(&test_key).unwrap() == Exclude::Skip)
|
||||
|| (excludes.contains_key(&test_platform_key)
|
||||
&& *excludes.get(&test_platform_key).unwrap() == Exclude::Skip)
|
||||
// Skip tests that match this line
|
||||
if excludes
|
||||
.iter()
|
||||
.any(|e| e.line_exact_match(line) && e.exclude_kind == ExcludeKind::Skip)
|
||||
{
|
||||
// println!("Skipping test: {}", test_key);
|
||||
continue;
|
||||
}
|
||||
|
||||
@ -251,6 +350,7 @@ mod tests {
|
||||
},
|
||||
&test_key,
|
||||
excludes,
|
||||
line,
|
||||
);
|
||||
instance = None;
|
||||
}
|
||||
@ -290,6 +390,7 @@ mod tests {
|
||||
},
|
||||
&test_key,
|
||||
excludes,
|
||||
line,
|
||||
);
|
||||
} else {
|
||||
let call_result = maybe_call_result.unwrap();
|
||||
@ -304,6 +405,7 @@ mod tests {
|
||||
},
|
||||
&test_key,
|
||||
excludes,
|
||||
line,
|
||||
);
|
||||
}
|
||||
Ok(values) => {
|
||||
@ -320,7 +422,7 @@ mod tests {
|
||||
"result {:?} ({:?}) does not match expected {:?} ({:?})",
|
||||
v, to_hex(v.clone()), expected_value, to_hex(expected_value.clone())
|
||||
),
|
||||
}, &test_key, excludes);
|
||||
}, &test_key, excludes, line);
|
||||
} else {
|
||||
test_report.count_passed();
|
||||
}
|
||||
@ -350,6 +452,7 @@ mod tests {
|
||||
},
|
||||
&test_key,
|
||||
excludes,
|
||||
line,
|
||||
);
|
||||
} else {
|
||||
let export: Export = maybe_call_result.unwrap();
|
||||
@ -373,6 +476,7 @@ mod tests {
|
||||
},
|
||||
&test_key,
|
||||
excludes,
|
||||
line,
|
||||
);
|
||||
}
|
||||
}
|
||||
@ -386,6 +490,7 @@ mod tests {
|
||||
},
|
||||
&test_key,
|
||||
excludes,
|
||||
line,
|
||||
);
|
||||
}
|
||||
}
|
||||
@ -416,6 +521,7 @@ mod tests {
|
||||
},
|
||||
&test_key,
|
||||
excludes,
|
||||
line,
|
||||
);
|
||||
} else {
|
||||
let call_result = maybe_call_result.unwrap();
|
||||
@ -430,6 +536,7 @@ mod tests {
|
||||
},
|
||||
&test_key,
|
||||
excludes,
|
||||
line,
|
||||
);
|
||||
}
|
||||
Ok(values) => {
|
||||
@ -453,6 +560,7 @@ mod tests {
|
||||
},
|
||||
&test_key,
|
||||
excludes,
|
||||
line,
|
||||
);
|
||||
}
|
||||
}
|
||||
@ -484,6 +592,7 @@ mod tests {
|
||||
},
|
||||
&test_key,
|
||||
excludes,
|
||||
line,
|
||||
);
|
||||
} else {
|
||||
let call_result = maybe_call_result.unwrap();
|
||||
@ -498,6 +607,7 @@ mod tests {
|
||||
},
|
||||
&test_key,
|
||||
excludes,
|
||||
line,
|
||||
);
|
||||
}
|
||||
Ok(values) => {
|
||||
@ -521,6 +631,7 @@ mod tests {
|
||||
},
|
||||
&test_key,
|
||||
excludes,
|
||||
line,
|
||||
);
|
||||
}
|
||||
}
|
||||
@ -552,6 +663,7 @@ mod tests {
|
||||
},
|
||||
&test_key,
|
||||
excludes,
|
||||
line,
|
||||
);
|
||||
} else {
|
||||
let call_result = maybe_call_result.unwrap();
|
||||
@ -569,6 +681,7 @@ mod tests {
|
||||
},
|
||||
&test_key,
|
||||
excludes,
|
||||
line,
|
||||
);
|
||||
}
|
||||
CallError::Runtime(r) => {
|
||||
@ -590,6 +703,7 @@ mod tests {
|
||||
},
|
||||
&test_key,
|
||||
excludes,
|
||||
line,
|
||||
);
|
||||
}
|
||||
}
|
||||
@ -606,6 +720,7 @@ mod tests {
|
||||
},
|
||||
&test_key,
|
||||
excludes,
|
||||
line,
|
||||
);
|
||||
}
|
||||
}
|
||||
@ -649,6 +764,7 @@ mod tests {
|
||||
},
|
||||
&test_key,
|
||||
excludes,
|
||||
line,
|
||||
);
|
||||
}
|
||||
}
|
||||
@ -662,6 +778,7 @@ mod tests {
|
||||
},
|
||||
&test_key,
|
||||
excludes,
|
||||
line,
|
||||
);
|
||||
}
|
||||
}
|
||||
@ -704,6 +821,7 @@ mod tests {
|
||||
},
|
||||
&test_key,
|
||||
excludes,
|
||||
line,
|
||||
);
|
||||
}
|
||||
}
|
||||
@ -717,6 +835,7 @@ mod tests {
|
||||
},
|
||||
&test_key,
|
||||
excludes,
|
||||
line,
|
||||
);
|
||||
}
|
||||
}
|
||||
@ -755,6 +874,7 @@ mod tests {
|
||||
},
|
||||
&test_key,
|
||||
excludes,
|
||||
line,
|
||||
);
|
||||
}
|
||||
};
|
||||
@ -786,6 +906,7 @@ mod tests {
|
||||
},
|
||||
&test_key,
|
||||
excludes,
|
||||
line,
|
||||
);
|
||||
} else {
|
||||
let call_result = maybe_call_result.unwrap();
|
||||
@ -807,6 +928,7 @@ mod tests {
|
||||
},
|
||||
&test_key,
|
||||
excludes,
|
||||
line,
|
||||
);
|
||||
}
|
||||
}
|
||||
@ -845,6 +967,7 @@ mod tests {
|
||||
},
|
||||
&test_key,
|
||||
excludes,
|
||||
line,
|
||||
);
|
||||
}
|
||||
Ok(result) => match result {
|
||||
@ -860,6 +983,7 @@ mod tests {
|
||||
},
|
||||
&test_key,
|
||||
excludes,
|
||||
line,
|
||||
);
|
||||
}
|
||||
Err(e) => match e {
|
||||
@ -876,6 +1000,7 @@ mod tests {
|
||||
},
|
||||
&test_key,
|
||||
excludes,
|
||||
line,
|
||||
);
|
||||
}
|
||||
},
|
||||
@ -909,6 +1034,7 @@ mod tests {
|
||||
},
|
||||
&test_key,
|
||||
excludes,
|
||||
line,
|
||||
);
|
||||
}
|
||||
}
|
||||
@ -934,6 +1060,7 @@ mod tests {
|
||||
},
|
||||
&test_key,
|
||||
excludes,
|
||||
line,
|
||||
);
|
||||
} else {
|
||||
let call_result = maybe_call_result.unwrap();
|
||||
@ -948,6 +1075,7 @@ mod tests {
|
||||
},
|
||||
&test_key,
|
||||
excludes,
|
||||
line,
|
||||
);
|
||||
}
|
||||
Ok(_values) => {
|
||||
@ -1105,7 +1233,7 @@ mod tests {
|
||||
}
|
||||
|
||||
#[derive(Debug, Copy, Clone, PartialEq, Eq)]
|
||||
enum Exclude {
|
||||
enum ExcludeKind {
|
||||
Skip,
|
||||
Fail,
|
||||
}
|
||||
@ -1115,13 +1243,18 @@ mod tests {
|
||||
use std::io::{BufRead, BufReader};
|
||||
|
||||
/// Reads the excludes.txt file into a hash map
|
||||
fn read_excludes() -> HashMap<String, Exclude> {
|
||||
fn read_excludes() -> (HashMap<String, Vec<Exclude>>, HashSet<String>) {
|
||||
let mut excludes_path = PathBuf::from(env!("CARGO_MANIFEST_DIR"));
|
||||
excludes_path.push("tests");
|
||||
excludes_path.push("excludes.txt");
|
||||
let input = File::open(excludes_path).unwrap();
|
||||
let buffered = BufReader::new(input);
|
||||
let mut result = HashMap::new();
|
||||
let mut file_excludes = HashSet::new();
|
||||
let current_backend = get_compiler_name();
|
||||
let current_target_family = get_target_family();
|
||||
let current_target_arch = get_target_arch();
|
||||
|
||||
for line in buffered.lines() {
|
||||
let mut line = line.unwrap();
|
||||
if line.trim().is_empty() || line.starts_with("#") {
|
||||
@ -1136,26 +1269,53 @@ mod tests {
|
||||
// <backend>:<exclude-kind>:<test-file-name>:<test-file-line>
|
||||
let split: Vec<&str> = line.trim().split(':').collect();
|
||||
|
||||
let kind = match *split.get(1).unwrap() {
|
||||
"skip" => Exclude::Skip,
|
||||
"fail" => Exclude::Fail,
|
||||
_ => panic!("unknown exclude kind"),
|
||||
let file = *split.get(2).unwrap();
|
||||
let exclude = match split.len() {
|
||||
0..=3 => panic!("expected at least 4 exclude conditions"),
|
||||
4 => Exclude::from(
|
||||
*split.get(0).unwrap(),
|
||||
*split.get(1).unwrap(),
|
||||
*split.get(2).unwrap(),
|
||||
*split.get(3).unwrap(),
|
||||
"*",
|
||||
"*",
|
||||
),
|
||||
5 => Exclude::from(
|
||||
*split.get(0).unwrap(),
|
||||
*split.get(1).unwrap(),
|
||||
*split.get(2).unwrap(),
|
||||
*split.get(3).unwrap(),
|
||||
*split.get(4).unwrap(),
|
||||
"*",
|
||||
),
|
||||
6 => Exclude::from(
|
||||
*split.get(0).unwrap(),
|
||||
*split.get(1).unwrap(),
|
||||
*split.get(2).unwrap(),
|
||||
*split.get(3).unwrap(),
|
||||
*split.get(4).unwrap(),
|
||||
*split.get(5).unwrap(),
|
||||
),
|
||||
_ => panic!("too many exclude conditions {}", split.len()),
|
||||
};
|
||||
let has_platform = split.len() > 4;
|
||||
|
||||
let backend = split.get(0).unwrap();
|
||||
let testfile = split.get(2).unwrap();
|
||||
let line = split.get(3).unwrap();
|
||||
let key = if has_platform {
|
||||
let platform = split.get(4).unwrap();
|
||||
format!("{}:{}:{}:{}", backend, testfile, line, platform)
|
||||
} else {
|
||||
format!("{}:{}:{}", backend, testfile, line)
|
||||
};
|
||||
result.insert(key, kind);
|
||||
if exclude.matches_backend(current_backend)
|
||||
&& exclude.matches_target_family(current_target_family)
|
||||
&& exclude.matches_target_arch(current_target_arch)
|
||||
{
|
||||
// Skip the whole file for line * and skip
|
||||
if exclude.line.is_none() && exclude.exclude_kind == ExcludeKind::Skip {
|
||||
file_excludes.insert(file.to_string());
|
||||
}
|
||||
|
||||
if !result.contains_key(file) {
|
||||
result.insert(file.to_string(), vec![]);
|
||||
}
|
||||
result.get_mut(file).unwrap().push(exclude);
|
||||
}
|
||||
}
|
||||
result
|
||||
}
|
||||
(result, file_excludes)
|
||||
}
|
||||
|
||||
#[test]
|
||||
@ -1163,7 +1323,7 @@ mod tests {
|
||||
let mut success = true;
|
||||
let mut test_reports = vec![];
|
||||
|
||||
let excludes = read_excludes();
|
||||
let (excludes, file_excludes) = read_excludes();
|
||||
|
||||
let mut glob_path = PathBuf::from(env!("CARGO_MANIFEST_DIR"));
|
||||
glob_path.push("spectests");
|
||||
@ -1173,7 +1333,7 @@ mod tests {
|
||||
for entry in glob(glob_str).expect("Failed to read glob pattern") {
|
||||
match entry {
|
||||
Ok(wast_path) => {
|
||||
let result = parse_and_run(&wast_path, &excludes);
|
||||
let result = parse_and_run(&wast_path, &file_excludes, &excludes);
|
||||
match result {
|
||||
Ok(test_report) => {
|
||||
if test_report.has_failures() {
|
||||
|
@ -18,7 +18,7 @@ use std::process::exit;
|
||||
use std::str::FromStr;
|
||||
|
||||
use std::collections::HashMap;
|
||||
use structopt::StructOpt;
|
||||
use structopt::{clap, StructOpt};
|
||||
|
||||
use wasmer::*;
|
||||
use wasmer_clif_backend::CraneliftCompiler;
|
||||
@ -902,7 +902,19 @@ fn get_compiler_by_backend(backend: Backend, _opts: &Run) -> Option<Box<dyn Comp
|
||||
}
|
||||
|
||||
fn main() {
|
||||
let options = CLIOptions::from_args();
|
||||
// We try to run wasmer with the normal arguments.
|
||||
// Eg. `wasmer <SUBCOMMAND>`
|
||||
// In case that fails, we fallback trying the Run subcommand directly.
|
||||
// Eg. `wasmer myfile.wasm --dir=.`
|
||||
let options = CLIOptions::from_iter_safe(env::args()).unwrap_or_else(|e| {
|
||||
match e.kind {
|
||||
// This fixes a issue that:
|
||||
// 1. Shows the version twice when doing `wasmer -V`
|
||||
// 2. Shows the run help (instead of normal help) when doing `wasmer --help`
|
||||
clap::ErrorKind::VersionDisplayed | clap::ErrorKind::HelpDisplayed => e.exit(),
|
||||
_ => CLIOptions::Run(Run::from_args()),
|
||||
}
|
||||
});
|
||||
match options {
|
||||
CLIOptions::Run(options) => run(options),
|
||||
#[cfg(not(target_os = "windows"))]
|
||||
|
2
wapm-cli
2
wapm-cli
@ -1 +1 @@
|
||||
Subproject commit c2da5cda3b8f9cf7dcea144f8cabdf342f38a0bf
|
||||
Subproject commit 3562d6dda52df526e6e1917dd33bb2454917ab9c
|
Loading…
Reference in New Issue
Block a user