You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Build all tests for better cross-compilation (#126)
This was discussed a bit in #122. We were previously omitting
architecture-specific tests based on the *host* architecture, which is
incorrect and prevents cross-compiling tests to run under something like
qemu.
We can't access `CARGO_CFG_TARGET_ARCH` at the time that proc macros are
evaluated, so we just have to build every architecture-specific test and
use `#[cfg]` to disable ones that aren't applicable to the current
architecture.
Even more annoyingly, there's no way to conditionally ignore a test at
runtime. This means that if the CPU we're running the tests on doesn't
support a target feature, we have to either pass or fail that test. I've
chosen to fail, to prevent faulty code from appearing to pass tests.
I've also updated the architecture-specific `exclude` functions to add
`#[ignore]` attributes rather than omitting the tests entirely. This
makes it more clear that the tests exist, but are not being run because
they don't yet pass.
#[allow(clippy::allow_attributes, reason = "Only needed in some cfgs.")]
42
+
#[allow(
43
+
unused_variables,
44
+
reason = "The constructed `Level` is only used in some cfgs."
45
+
)]
46
+
#[allow(
47
+
dead_code,
48
+
reason = "The `UNSUPPORTED_LEVEL_MESSAGE` is only used in some cfgs."
49
+
)]
50
+
#[test]
51
+
fnsupports_highest_level(){
52
+
constUNSUPPORTED_LEVEL_MESSAGE:&str = "This means that some of the other tests in this run may be false positives, that is, they have been marked as succeeding even though they would actually fail if they could run.\n\
53
+
When these tests are run on CI, any false positives should be caught.\n\
54
+
However, please open a thread in the #simd channel on the Linebender Zulip if you see this message.\n\
55
+
That would allow us to know whether it's worth us setting up the tests to run on an emulated system (such as using QEMU).";
56
+
57
+
let level = Level::new();
58
+
59
+
// When running tests locally, ensure that every SIMD level to be tested is actually supported. The tests themselves
60
+
// will return early and pass if run with an unsupported SIMD level.
61
+
//
62
+
// We skip this on CI because some runners may not support all SIMD levels--in particular, the macOS x86_64 runner
0 commit comments