From 361d94a3d9fb2234ac7836fe95cdf91dca4a03e2 Mon Sep 17 00:00:00 2001 From: Trangar Date: Sat, 21 May 2022 14:04:29 +0200 Subject: [PATCH] Fix cross platform tests (#540) * Fixed cross platform targets * Uncommented not working archs, with a reason why they fail * Removed duplicate windows test * Commented the other sun system * Commented out i686-pc-windows-gnu Co-authored-by: Victor Koenders --- .github/workflows/cross_platform.yml | 108 ++++++++++++++++++++++++--- tests/basic_types.rs | 7 +- 2 files changed, 100 insertions(+), 15 deletions(-) diff --git a/.github/workflows/cross_platform.yml b/.github/workflows/cross_platform.yml index 3125393d..3210d7d7 100644 --- a/.github/workflows/cross_platform.yml +++ b/.github/workflows/cross_platform.yml @@ -16,32 +16,77 @@ } }, "jobs": { - "check": { - "name": "Test", + "test_cross": { + "name": "Cross platform test", "runs-on": "ubuntu-latest", "strategy": { "fail-fast": false, "matrix": { "platform": [ - "aarch64-unknown-linux-gnu", + "aarch64-unknown-linux-musl", + "arm-linux-androideabi", "arm-unknown-linux-gnueabi", "arm-unknown-linux-gnueabihf", - # "armv5te-unknown-linux-gnueabi", + "arm-unknown-linux-musleabi", + "arm-unknown-linux-musleabihf", + "armv5te-unknown-linux-gnueabi", + "armv5te-unknown-linux-musleabi", + "armv7-linux-androideabi", "armv7-unknown-linux-gnueabihf", + "armv7-unknown-linux-musleabihf", + + # BlockedTODO: https://github.com/chronotope/chrono/issues/674 + # Fixed in https://github.com/chronotope/chrono/pull/593 + # "asmjs-unknown-emscripten", + "i586-unknown-linux-gnu", - # "i686-pc-windows-gnu", + "i586-unknown-linux-musl", + "i686-linux-android", "i686-unknown-linux-gnu", - # "mips-unknown-linux-gnu", + "i686-unknown-linux-musl", + "mips-unknown-linux-gnu", + "mips-unknown-linux-musl", "mips64-unknown-linux-gnuabi64", "mips64el-unknown-linux-gnuabi64", - # "mipsel-unknown-linux-gnu", - # "powerpc-unknown-linux-gnu", - # "powerpc64-unknown-linux-gnu", + "mipsel-unknown-linux-gnu", + "mipsel-unknown-linux-musl", + "powerpc-unknown-linux-gnu", + + # Seems to have a bug in qemu, where all floats are `0.0` and aren't equal with each other # "powerpc64le-unknown-linux-gnu", + "riscv64gc-unknown-linux-gnu", - # "sparc64-unknown-linux-gnu", - "x86_64-pc-windows-gnu", - "x86_64-unknown-linux-gnu" + "s390x-unknown-linux-gnu", + + # Seems to not be able to link to certain files + # - cannot find -lsendfile + # - cannot find -llgrp + # "sparcv9-sun-solaris", + + # These have no `std` + # "thumbv6m-none-eabi", + # "thumbv7em-none-eabi", + # "thumbv7em-none-eabihf", + # "thumbv7m-none-eabi", + + # BlockedTODO: https://github.com/chronotope/chrono/issues/674 + # Fixed in https://github.com/chronotope/chrono/pull/593 + # "wasm32-unknown-emscripten", + + "x86_64-linux-android", + + # Seems to not be able to link to certain files + # - cannot find -lsendfile + # - cannot find -llgrp + # "x86_64-sun-solaris", + + "x86_64-unknown-linux-gnu", + "x86_64-unknown-linux-musl", + + # Seems to immediately bail + # error: test failed, to rerun pass '--lib' + # could not execute process `...` (never executed) + # "x86_64-unknown-netbsd", ] } }, @@ -69,6 +114,45 @@ { "run": "cross test --target ${{ matrix.platform }}", "name": "Run tests", + "env": { + "RUSTFLAGS": "-D warnings", + "RUST_BACKTRACE": "1", + } + } + ] + }, + "test_windows": { + "name": "Cross platform test", + "runs-on": "windows-latest", + "strategy": { + "fail-fast": false, + "matrix": { + "platform": [ + # linker `i686-w64-mingw32-gcc` not found + # "i686-pc-windows-gnu", + + "x86_64-pc-windows-gnu", + ] + } + }, + "steps": [ + { + "uses": "actions/checkout@v2", + "name": "Checkout" + }, + { + "uses": "actions-rs/toolchain@v1", + "with": { + "profile": "minimal", + "toolchain": "stable", + "target": "${{ matrix.platform }}", + "override": true + }, + "name": "Install Rust stable" + }, + { + "run": "cargo test --target ${{ matrix.platform }}", + "name": "Run tests", "env": { "RUSTFLAGS": "-D warnings" } diff --git a/tests/basic_types.rs b/tests/basic_types.rs index 50c143ad..db6ae72f 100644 --- a/tests/basic_types.rs +++ b/tests/basic_types.rs @@ -4,7 +4,7 @@ use core::cell::{Cell, RefCell}; use core::ops::Bound; use core::time::Duration; use std::num::*; -use utils::the_same; +use utils::{the_same, the_same_with_comparer}; #[test] fn test_numbers() { @@ -23,8 +23,9 @@ fn test_numbers() { the_same(5i128); the_same(5isize); - the_same(5.0f32); - the_same(5.0f64); + println!("Test {:?}", 5.0f32); + the_same_with_comparer(5.0f32, |a, b| (a - b).abs() <= f32::EPSILON); + the_same_with_comparer(5.0f64, |a, b| (a - b).abs() <= f64::EPSILON); // bool the_same(true);