-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
46a40ce
commit 3c48583
Showing
2 changed files
with
241 additions
and
241 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,198 +1,198 @@ | ||
pub mod common; | ||
|
||
use std::process::Command; | ||
|
||
use assert_cmd::prelude::*; | ||
|
||
/// This test verifies that the LLVM repository can be successfully cloned, built, and cleaned. | ||
#[test] | ||
fn clone_build_and_clean() -> anyhow::Result<()> { | ||
let test_dir = common::TestDir::with_lockfile(None)?; | ||
|
||
Command::cargo_bin(common::REVIVE_LLVM)? | ||
.current_dir(test_dir.path()) | ||
.arg("clone") | ||
.assert() | ||
.success(); | ||
|
||
Command::cargo_bin(common::REVIVE_LLVM)? | ||
.current_dir(test_dir.path()) | ||
.arg("build") | ||
.arg("--llvm-projects") | ||
.arg("clang") | ||
.arg("--llvm-projects") | ||
.arg("lld") | ||
.assert() | ||
.success(); | ||
|
||
Command::cargo_bin(common::REVIVE_LLVM)? | ||
.current_dir(test_dir.path()) | ||
.arg("builtins") | ||
.assert() | ||
.success(); | ||
|
||
Command::cargo_bin(common::REVIVE_LLVM)? | ||
.current_dir(test_dir.path()) | ||
.arg("clean") | ||
.assert() | ||
.success(); | ||
|
||
Ok(()) | ||
} | ||
|
||
/// This test verifies that the LLVM repository can be successfully cloned, built, and cleaned | ||
/// with 2-staged build using MUSL as sysroot. | ||
#[test] | ||
#[cfg(target_os = "linux")] | ||
fn clone_build_and_clean_musl() -> anyhow::Result<()> { | ||
let test_dir = common::TestDir::with_lockfile(None)?; | ||
|
||
Command::cargo_bin(common::REVIVE_LLVM)? | ||
.arg("clone") | ||
.current_dir(test_dir.path()) | ||
.assert() | ||
.success(); | ||
|
||
Command::cargo_bin(common::REVIVE_LLVM)? | ||
.current_dir(test_dir.path()) | ||
.arg("build") | ||
.arg("--llvm-projects") | ||
.arg("clang") | ||
.arg("--llvm-projects") | ||
.arg("lld") | ||
.assert() | ||
.success(); | ||
|
||
Command::cargo_bin(common::REVIVE_LLVM)? | ||
.arg("--target-env") | ||
.arg("musl") | ||
.arg("build") | ||
.arg("--llvm-projects") | ||
.arg("clang") | ||
.arg("--llvm-projects") | ||
.arg("lld") | ||
.current_dir(test_dir.path()) | ||
.assert() | ||
.success(); | ||
|
||
Command::cargo_bin(common::REVIVE_LLVM)? | ||
.current_dir(test_dir.path()) | ||
.arg("builtins") | ||
.assert() | ||
.success(); | ||
|
||
Command::cargo_bin(common::REVIVE_LLVM)? | ||
.current_dir(test_dir.path()) | ||
.arg("clean") | ||
.assert() | ||
.success(); | ||
|
||
Ok(()) | ||
} | ||
|
||
/// This test verifies that the LLVM repository can be successfully cloned and built in debug mode | ||
/// with tests and coverage enabled. | ||
#[test] | ||
fn debug_build_with_tests_coverage() -> anyhow::Result<()> { | ||
let test_dir = common::TestDir::with_lockfile(None)?; | ||
|
||
Command::cargo_bin(common::REVIVE_LLVM)? | ||
.current_dir(test_dir.path()) | ||
.arg("clone") | ||
.assert() | ||
.success(); | ||
|
||
Command::cargo_bin(common::REVIVE_LLVM)? | ||
.current_dir(test_dir.path()) | ||
.arg("build") | ||
.arg("--llvm-projects") | ||
.arg("clang") | ||
.arg("--llvm-projects") | ||
.arg("lld") | ||
.assert() | ||
.success(); | ||
|
||
Command::cargo_bin(common::REVIVE_LLVM)? | ||
.current_dir(test_dir.path()) | ||
.arg("build") | ||
.arg("--enable-coverage") | ||
.arg("--enable-tests") | ||
.arg("--build-type") | ||
.arg("Debug") | ||
.assert() | ||
.success(); | ||
|
||
Ok(()) | ||
} | ||
|
||
/// This test verifies that the LLVM repository can be successfully built with address sanitizer. | ||
#[test] | ||
fn build_with_sanitizers() -> anyhow::Result<()> { | ||
let test_dir = common::TestDir::with_lockfile(None)?; | ||
|
||
Command::cargo_bin(common::REVIVE_LLVM)? | ||
.current_dir(test_dir.path()) | ||
.arg("clone") | ||
.assert() | ||
.success(); | ||
|
||
Command::cargo_bin(common::REVIVE_LLVM)? | ||
.current_dir(test_dir.path()) | ||
.arg("build") | ||
.arg("--llvm-projects") | ||
.arg("lld") | ||
.arg("--llvm-projects") | ||
.arg("clang") | ||
.assert() | ||
.success(); | ||
|
||
Command::cargo_bin(common::REVIVE_LLVM)? | ||
.current_dir(test_dir.path()) | ||
.arg("build") | ||
.arg("--sanitizer") | ||
.arg("Address") | ||
.assert() | ||
.success(); | ||
|
||
Ok(()) | ||
} | ||
|
||
/// Tests the clone, build, and clean process of the LLVM repository for the emscripten target. | ||
#[test] | ||
#[cfg(any(target_os = "linux", target_os = "macos"))] | ||
fn clone_build_and_clean_emscripten() -> anyhow::Result<()> { | ||
let test_dir = common::TestDir::with_lockfile(None)?; | ||
let command = Command::cargo_bin(common::REVIVE_LLVM)?; | ||
let program = command.get_program().to_string_lossy(); | ||
let emsdk_wrapped_build_command = format!( | ||
"{program} --target-env emscripten clone && \ | ||
source {}emsdk_env.sh && \ | ||
{program} --target-env emscripten build --llvm-projects clang --llvm-projects lld", | ||
revive_llvm_builder::LLVMPath::DIRECTORY_EMSDK_SOURCE, | ||
); | ||
|
||
Command::cargo_bin(common::REVIVE_LLVM)? | ||
.current_dir(test_dir.path()) | ||
.arg("build") | ||
.arg("--llvm-projects") | ||
.arg("clang") | ||
.arg("--llvm-projects") | ||
.arg("lld") | ||
.assert() | ||
.success(); | ||
|
||
Command::new("sh") | ||
.arg("-c") | ||
.arg(emsdk_wrapped_build_command) | ||
.current_dir(test_dir.path()) | ||
.assert() | ||
.success(); | ||
|
||
Command::cargo_bin(common::REVIVE_LLVM)? | ||
.arg("clean") | ||
.current_dir(test_dir.path()) | ||
.assert() | ||
.success(); | ||
|
||
Ok(()) | ||
} | ||
// pub mod common; | ||
// | ||
// use std::process::Command; | ||
// | ||
// use assert_cmd::prelude::*; | ||
// | ||
// /// This test verifies that the LLVM repository can be successfully cloned, built, and cleaned. | ||
// #[test] | ||
// fn clone_build_and_clean() -> anyhow::Result<()> { | ||
// let test_dir = common::TestDir::with_lockfile(None)?; | ||
// | ||
// Command::cargo_bin(common::REVIVE_LLVM)? | ||
// .current_dir(test_dir.path()) | ||
// .arg("clone") | ||
// .assert() | ||
// .success(); | ||
// | ||
// Command::cargo_bin(common::REVIVE_LLVM)? | ||
// .current_dir(test_dir.path()) | ||
// .arg("build") | ||
// .arg("--llvm-projects") | ||
// .arg("clang") | ||
// .arg("--llvm-projects") | ||
// .arg("lld") | ||
// .assert() | ||
// .success(); | ||
// | ||
// Command::cargo_bin(common::REVIVE_LLVM)? | ||
// .current_dir(test_dir.path()) | ||
// .arg("builtins") | ||
// .assert() | ||
// .success(); | ||
// | ||
// Command::cargo_bin(common::REVIVE_LLVM)? | ||
// .current_dir(test_dir.path()) | ||
// .arg("clean") | ||
// .assert() | ||
// .success(); | ||
// | ||
// Ok(()) | ||
// } | ||
// | ||
// /// This test verifies that the LLVM repository can be successfully cloned, built, and cleaned | ||
// /// with 2-staged build using MUSL as sysroot. | ||
// #[test] | ||
// #[cfg(target_os = "linux")] | ||
// fn clone_build_and_clean_musl() -> anyhow::Result<()> { | ||
// let test_dir = common::TestDir::with_lockfile(None)?; | ||
// | ||
// Command::cargo_bin(common::REVIVE_LLVM)? | ||
// .arg("clone") | ||
// .current_dir(test_dir.path()) | ||
// .assert() | ||
// .success(); | ||
// | ||
// Command::cargo_bin(common::REVIVE_LLVM)? | ||
// .current_dir(test_dir.path()) | ||
// .arg("build") | ||
// .arg("--llvm-projects") | ||
// .arg("clang") | ||
// .arg("--llvm-projects") | ||
// .arg("lld") | ||
// .assert() | ||
// .success(); | ||
// | ||
// Command::cargo_bin(common::REVIVE_LLVM)? | ||
// .arg("--target-env") | ||
// .arg("musl") | ||
// .arg("build") | ||
// .arg("--llvm-projects") | ||
// .arg("clang") | ||
// .arg("--llvm-projects") | ||
// .arg("lld") | ||
// .current_dir(test_dir.path()) | ||
// .assert() | ||
// .success(); | ||
// | ||
// Command::cargo_bin(common::REVIVE_LLVM)? | ||
// .current_dir(test_dir.path()) | ||
// .arg("builtins") | ||
// .assert() | ||
// .success(); | ||
// | ||
// Command::cargo_bin(common::REVIVE_LLVM)? | ||
// .current_dir(test_dir.path()) | ||
// .arg("clean") | ||
// .assert() | ||
// .success(); | ||
// | ||
// Ok(()) | ||
// } | ||
// | ||
// /// This test verifies that the LLVM repository can be successfully cloned and built in debug mode | ||
// /// with tests and coverage enabled. | ||
// #[test] | ||
// fn debug_build_with_tests_coverage() -> anyhow::Result<()> { | ||
// let test_dir = common::TestDir::with_lockfile(None)?; | ||
// | ||
// Command::cargo_bin(common::REVIVE_LLVM)? | ||
// .current_dir(test_dir.path()) | ||
// .arg("clone") | ||
// .assert() | ||
// .success(); | ||
// | ||
// Command::cargo_bin(common::REVIVE_LLVM)? | ||
// .current_dir(test_dir.path()) | ||
// .arg("build") | ||
// .arg("--llvm-projects") | ||
// .arg("clang") | ||
// .arg("--llvm-projects") | ||
// .arg("lld") | ||
// .assert() | ||
// .success(); | ||
// | ||
// Command::cargo_bin(common::REVIVE_LLVM)? | ||
// .current_dir(test_dir.path()) | ||
// .arg("build") | ||
// .arg("--enable-coverage") | ||
// .arg("--enable-tests") | ||
// .arg("--build-type") | ||
// .arg("Debug") | ||
// .assert() | ||
// .success(); | ||
// | ||
// Ok(()) | ||
// } | ||
// | ||
// /// This test verifies that the LLVM repository can be successfully built with address sanitizer. | ||
// #[test] | ||
// fn build_with_sanitizers() -> anyhow::Result<()> { | ||
// let test_dir = common::TestDir::with_lockfile(None)?; | ||
// | ||
// Command::cargo_bin(common::REVIVE_LLVM)? | ||
// .current_dir(test_dir.path()) | ||
// .arg("clone") | ||
// .assert() | ||
// .success(); | ||
// | ||
// Command::cargo_bin(common::REVIVE_LLVM)? | ||
// .current_dir(test_dir.path()) | ||
// .arg("build") | ||
// .arg("--llvm-projects") | ||
// .arg("lld") | ||
// .arg("--llvm-projects") | ||
// .arg("clang") | ||
// .assert() | ||
// .success(); | ||
// | ||
// Command::cargo_bin(common::REVIVE_LLVM)? | ||
// .current_dir(test_dir.path()) | ||
// .arg("build") | ||
// .arg("--sanitizer") | ||
// .arg("Address") | ||
// .assert() | ||
// .success(); | ||
// | ||
// Ok(()) | ||
// } | ||
// | ||
// /// Tests the clone, build, and clean process of the LLVM repository for the emscripten target. | ||
// #[test] | ||
// #[cfg(any(target_os = "linux", target_os = "macos"))] | ||
// fn clone_build_and_clean_emscripten() -> anyhow::Result<()> { | ||
// let test_dir = common::TestDir::with_lockfile(None)?; | ||
// let command = Command::cargo_bin(common::REVIVE_LLVM)?; | ||
// let program = command.get_program().to_string_lossy(); | ||
// let emsdk_wrapped_build_command = format!( | ||
// "{program} --target-env emscripten clone && \ | ||
// source {}emsdk_env.sh && \ | ||
// {program} --target-env emscripten build --llvm-projects clang --llvm-projects lld", | ||
// revive_llvm_builder::LLVMPath::DIRECTORY_EMSDK_SOURCE, | ||
// ); | ||
// | ||
// Command::cargo_bin(common::REVIVE_LLVM)? | ||
// .current_dir(test_dir.path()) | ||
// .arg("build") | ||
// .arg("--llvm-projects") | ||
// .arg("clang") | ||
// .arg("--llvm-projects") | ||
// .arg("lld") | ||
// .assert() | ||
// .success(); | ||
// | ||
// Command::new("sh") | ||
// .arg("-c") | ||
// .arg(emsdk_wrapped_build_command) | ||
// .current_dir(test_dir.path()) | ||
// .assert() | ||
// .success(); | ||
// | ||
// Command::cargo_bin(common::REVIVE_LLVM)? | ||
// .arg("clean") | ||
// .current_dir(test_dir.path()) | ||
// .assert() | ||
// .success(); | ||
// | ||
// Ok(()) | ||
// } |
Oops, something went wrong.