diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index 5220f261..546ea035 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -25,6 +25,7 @@ jobs: toolchain: ${{matrix.rust_channel}} - run: cargo xtask check - run: cargo xtask test + - run: cargo xtask test-release features: runs-on: ubuntu-latest diff --git a/crates/rewrite/src/main.rs b/crates/rewrite/src/main.rs index ae6eb2c5..849c9ad8 100644 --- a/crates/rewrite/src/main.rs +++ b/crates/rewrite/src/main.rs @@ -171,6 +171,10 @@ fn main() -> Result<()> { let in_data = unsafe { memmap2::Mmap::map(&in_file) } .with_context(|| format!("Failed to map input file '{}'", in_path.display()))?; let in_data = &*in_data; + match object::FileKind::parse(in_data) { + Ok(object::FileKind::Elf32) | Ok(object::FileKind::Elf64) => {} + _ => return Ok(()), + } let mut rewriter = rewrite::Rewriter::read(in_data) .with_context(|| format!("Failed to parse input file '{}'", in_path.display()))?; @@ -350,7 +354,11 @@ fn main() -> Result<()> { fs::remove_file(out_path).ok(); } } - format!("Failed to write output file '{}'", out_path.display()) + format!( + "Failed to write output file '{}' from input '{}'", + out_path.display(), + in_path.display() + ) })?; Ok(()) } diff --git a/xtask/src/main.rs b/xtask/src/main.rs index 19a56686..a5a4850c 100644 --- a/xtask/src/main.rs +++ b/xtask/src/main.rs @@ -34,8 +34,18 @@ type Task = (&'static str, fn() -> Result<(), DynError>, &'static str); const TASKS: &[Task] = &[ ("ci", cmd_ci, "runs everything in CI"), ("check", cmd_check, "checks everything"), - ("build", cmd_build, "builds everything"), - ("test", cmd_test, "tests everything"), + ("build", cmd_build, "builds everything with dev profile"), + ( + "build-release", + cmd_build_release, + "builds everything with release profile", + ), + ("test", cmd_test, "tests everything with dev profile"), + ( + "test-release", + cmd_test_release, + "tests everything with release profile", + ), ( "test-update", cmd_test_update, @@ -83,10 +93,18 @@ fn cmd_build() -> Result<(), DynError> { cargo(&["build", "--workspace", "--features", "all"]) } +fn cmd_build_release() -> Result<(), DynError> { + cargo(&["build", "--workspace", "--features", "all", "--release"]) +} + fn cmd_test() -> Result<(), DynError> { cargo(&["test", "--workspace", "--features", "all"]) } +fn cmd_test_release() -> Result<(), DynError> { + cargo(&["test", "--workspace", "--features", "all", "--release"]) +} + fn cmd_test_update() -> Result<(), DynError> { cargo_with(&["test", "--workspace", "--features", "all"], |cmd| { cmd.env("OBJECT_TESTFILES_UPDATE", "1");