Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to run a specific test? #890

Open
junaruga opened this issue Aug 2, 2021 · 5 comments
Open

How to run a specific test? #890

junaruga opened this issue Aug 2, 2021 · 5 comments

Comments

@junaruga
Copy link
Collaborator

junaruga commented Aug 2, 2021

Related to the contributing document , I thought if I knew the way to run a specific test, it would be useful to debug or report. Is there a way to do it?

  1. How to run only tests for a specific family? e.g. How to run tests for only roundscale in simde_avx512_families in meson.build (top level).

  2. How to run a specific test? e.g. How to run only test_simde_mm_cvt_ps2pi in test/x86/sse.c?

Thanks.

@ngzhian
Copy link
Collaborator

ngzhian commented Aug 5, 2021

For NEON, the test definition makes it such that I can do meson test -C build-cross 'arm/neon/ld1/native/c' to run a single test file (ld1.c).

Looking at the x86 test setup, it looks like you can only run per SSE extension. So I don't think you can do that.

@ngzhian
Copy link
Collaborator

ngzhian commented Aug 5, 2021

Btw, you can use meson test --list to list all tests, here is a snippet:

x86/avx512/xorsign/emul/c                                                                                                                                                                                                                                     (37 results) [1036/8790]
x86/avx512/xorsign/native/c
x86/avx512/xorsign/emul/cpp
x86/avx512/xorsign/native/cpp
x86/mmx/emul/c
x86/mmx/native/c
x86/mmx/emul/cpp
x86/mmx/native/cpp
x86/sse/emul/c
x86/sse/native/c
x86/sse/emul/cpp
x86/sse/native/cpp
x86/sse2/emul/c

So for SSE/SSE2, you cannot run an individual test. But for AVX512, you an run just xorsign or roundscale tests.

@nemequ
Copy link
Member

nemequ commented Aug 6, 2021

Zhi's answer is correct, but here is a little more info which may help:

Using meson to run a single test works, but the disadvantage is that it will actually compile everything. You can also use ninja to compile a single test and it will only compile that test ninja test/x86/avx512/roundscale-native-c (for the native C version, you can use ninja test/x86/avx512/roundscale-{native,emul}-{c,cpp} to test all four versions).

I often use this during development; my go-to is something like: INSN=x86/avx512/roundscale; ninja test/$INSN-{native,emul}-c && qemu-aarch64-static ./test/$INSN-native-c && qemu-aarch64-static ./test/$INSN-emul-c

If you're using Meson you have to run all the tests in a specific suite. On x86 prior to AVX-512 that can be pretty annoying since all the (for example) SSE2 tests are in a single suite, but for AVX-512 as well as most other architectures the tests are broken up by function instead of ISA extension, so for example you can use test/x86/avx512/roundscale-native-c to test the AVX-512 roundscale functions.

Honestly, the tests are really all fast enough that running a single suite shouldn't really be a problem (SVML is, IMHO, the only real possible exception), but if if you use CMake then the test suite uses µnit which is capable of running a single test (just pass the test name as an argument to run-tests). One of the many drawbacks, though, is that everything has to be compiled and linked, which is pretty much guaranteed to take longer than running the tests.

@nemequ nemequ closed this as completed Aug 6, 2021
@mr-c
Copy link
Collaborator

mr-c commented Aug 6, 2021

Zhi's answer is correct, but here is a little more info which may help:

Hey Evan. Can you copy this information into the docs or a wiki page?

@mr-c mr-c reopened this Aug 6, 2021
@junaruga
Copy link
Collaborator Author

Sorry for my late response, and thanks for your info. I will take a look at it!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants