Commit Graph
57 Commits
Author SHA1 Message Date
Ryan Houdek 37e13cf073 FileManagement: Fix fstatat with self and NOFOLLOW
When asked to not follow the symlink, FEX needs to return data about the
symlink itself rather than following to the target executable. In that
case we need to return symlink information otherwise games that sanity
check can break.

This is what happened with Darwinia in #3662.

We return the FEXInterpreter symlink information in this case since it
doesn't return any information that is relevent to leaking emulator
state. Once the application asks to follow through to the symlink target
is when we will replace.

Also adds a unit test to ensure we don't break it.
2024-05-29 18:41:24 -07:00
Alyssa Rosenzweig a10f984b1c clang-format: left-align escaped newlines
alternative to #3638. this is theoretically better for side-by-side diffs. in
practice it may make other diffs worse since all the \'s change when part of the
macro change.

Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
2024-05-20 09:47:21 -04:00
Ryan Houdek 512312fa06 FEXLinuxTests: Implements a test for the new instructions 2024-05-13 11:12:26 -07:00
Paulo Matos 2b4ec88dae Whole-tree reformat
This follows discussions from #3413.
Followup commits add clang-format file, script and blame ignore lists.
2024-04-12 16:26:02 +02:00
Tony Wasserka 6edba49784 Update Catch2 to v3.5.3 2024-03-05 12:15:29 +01:00
Ryan Houdek 9c37c0f1c3 Merge pull request #3392 from neobrain/feature_libfwd_fixed_size_ints
Library Forwarding: Handle cross-architecture differences of integer types
2024-02-02 08:42:41 -08:00
Tony Wasserka ac77376441 FEXLinuxTests: Suppress "attribute ignored" warnings for nocf_check 2024-02-01 14:43:50 +01:00
Tony Wasserka f246e9864c FEXLinuxTests: Simplify a few extern "C" declarations 2024-02-01 14:43:50 +01:00
Tony Wasserka 78cb2cd9fc FEXLinuxTests: Fix warnings about unused results 2024-02-01 14:43:50 +01:00
Tony Wasserka 3ff3dc8769 Library Forwarding: Add unit test for diverging parameter type sizes 2024-01-30 17:22:23 +01:00
Ryan Houdek 8e3d4a3e02 Merge pull request #3375 from Sonicadvance1/implement_efault_support
Linux: Implements a fault safe memcpy routine
2024-01-26 02:15:42 -08:00
Ryan Houdek 0913741343 Linux: Disable EFAULT handler until we find something that uses it. 2024-01-26 01:54:09 -08:00
Ryan Houdek 69ff984a82 Implements a FEXLinuxTest for testing ppoll EFAULT behaviour 2024-01-26 01:54:09 -08:00
Ryan Houdek 56d8080ec9 Merge pull request #3345 from Sonicadvance1/fix_syscall_registers
OpcodeDispatcher: Fixes syscall rcx/r11 generation
2024-01-22 15:21:13 -08:00
Tony Wasserka b08d372c78 Thunks: Fix definition of GUEST_THUNK_LIBRARY
The -deps target is the wrong target to add this to, since its compile flags
are propagated to both Guest.cpp and Host.cpp. Instead, define the flag only
when processing files within a guest context.
2024-01-19 11:17:44 +01:00
Tony Wasserka acf48e29b2 FEXLinuxTests/Thunks: Test interaction of struct repacking and assume_compatible_data_layout 2024-01-19 11:17:44 +01:00
Tony Wasserka 190d8020ff FEXLinuxTests/Thunks: Add tests for assisted struct repacking 2024-01-15 20:40:13 +01:00
Ryan Houdek 1f7a619c79 OpcodeDispatcher: Fixes syscall rcx/r11 generation
Noticed this while writing #3342.

Fixes #3343

The syscall instruction is defined in the documentation that it will set
RCX to the next instruction's RIP and R11 to be RFLAGS. We entirely
skipped this which I noticed while writing unit tests.

Adds unittests to test both 32-bit and 64-bit behaviour because our
helper shares code with both.

I don't know if anything actually relied on this behaviour but we should
definitely support it.
2024-01-12 19:14:30 -08:00
Tony Wasserka cd4578de27 FEXLinuxTests/thunks: Add tests for automatic repacking 2024-01-12 14:47:10 +01:00
Tony Wasserka 48c2e0689a Thunks/gen: Specialize layout wrappers for pointer types
Pointer types inherently cause data layout compatibility issues, so they're
worth special-casing here. The wrappers will type-pun pointers to 32-bit or
64-bit integers (matching the guest architecture) to avoid direct host-side
use of guest pointers without consideration.
2023-12-26 16:02:08 +01:00
Tony Wasserka aebabf6ef2 Revert "FEXLinuxTests: Temporarily limit thunk test execution to 64-bit guests"
This reverts commit 21b6cccb4e.
2023-12-04 14:57:43 +01:00
Tony Wasserka 0d5fd5dbaf FEXLinuxTests/thunks: Disable tests involving pointers on 32-bit
Passing pointers across architecture boundaries is not yet supported.
Skipping these tests allows for the rest to run on 32-bit.
2023-12-04 14:57:43 +01:00
Ryan Houdek a7a1365cf7 FEXLinuxTests: Adds a unittest for eflags and signals around a inlined syscall
When attempting to debug #3162 I had noticed spurious behaviour around
what I assumed to be eflags getting corrupt around inlined syscalls.
This turned out to be a red herring but to ensure we are still testing
this, create a fully fleshed out unit test.

This test ensures a couple of things.
1) A flag that is set or unset before a syscall doesn't have its data
   corrupt
2) An inline syscall doesn't corrupt the eflags, checking the eflag
   result after returning from the syscall.
3) A signal occuring while in an inline syscall returns the correct
   eflags information in the signal handler information

This test gets accomplished by setting or unsetting a particular flag
and then calling the futex syscall in a way that is guaranteed to be
inlined and also wait forever. Then the parent thread will signal with a
SIGTERM and read back the signal information. It does this multiple
times for each flag we care about.
2023-11-06 05:33:03 -08:00
Ryan Houdek a499272d81 FEXLinuxTests: Compile tests with masm=intel
ATT is maddening and a unittest I'm writing was going to be a nightmare.
2023-11-04 22:00:45 -07:00
Tony Wasserka cb215b5f21 FEXLinuxTests/thunks: Add assume_compatible_data_layout tests 2023-10-19 12:49:00 +02:00
Tony Wasserka 0cf2695772 FEXLinuxTests/thunks: Add tests for opaque types 2023-10-19 12:49:00 +02:00
Tony Wasserka 21b6cccb4e FEXLinuxTests: Temporarily limit thunk test execution to 64-bit guests
Thunking isn't fully functional on 32-bit guests currently, so non-trivial
tests would currently hang in that context.
2023-10-18 12:09:10 +02:00
Tony Wasserka d539829251 FEXLinuxTests: Drop .32/.64 suffixes from test names 2023-10-18 12:09:10 +02:00
Tony Wasserka f4dd456c80 unittests: Instruct CTest to print output from tests on failure 2023-09-26 17:16:28 +02:00
Tony Wasserka 527b65648f unittests: Enable logging to stderr when invoking FEXLoader 2023-09-18 16:53:35 +02:00
Tony Wasserka bef64c53f8 unittests: Add test thunk library 2023-09-18 16:53:35 +02:00
Ryan Houdek cdfa6939b3 FEXLinuxTests: Adds unit tests to ensure we set EFLAGS correctly
Tests all five of the flags that need specific handling. Without the
prior patch FEX would fail these.
2023-09-02 23:10:57 -07:00
Ryan Houdek 012c0ae062 FEXLinuxTests: Fixes race in smc-mt-2
This test was written to test SMC where one thread is doing execution
while the other thread is modifying.

According to the printf documentation it is supposed to "wait for code
to be modified" but actually it was testing a race between a printf on
one thread and the primary thread modifying the code.

Fix this test so it is actually waiting for code modification to happen
rather than testing a race condition. This is likely what the original
author intended.

CI is hitting this flake more frequently now because it is even faster
it seems, so fixing this test is necessary to resolve these flakes.
2023-07-27 19:24:57 -07:00
Ryan Houdek 15f2b30a5b FEXLinuxTests: Adds 32-bit signal tests 2023-01-30 13:30:15 -08:00
Ryan Houdek 7ef9189910 FEXLinuxTests: Fixup the tests
These were having some issues executing. 32-bit ones were getting
skipped even.
2023-01-20 12:55:38 -08:00
Ryan Houdek c5d0fe6999 FEXLinuxTests: Adds 64-bit siginfo test. 2023-01-20 11:08:57 -08:00
Ryan Houdek ac1bf0683d FEXLinuxTests: Adds support for 64-bit only tests 2023-01-20 11:08:57 -08:00
Ryan Houdek 3afd5691a4 unittests: Adds unit test to test ERR 2022-12-09 15:44:22 -08:00
Ryan Houdek 383e99e4ef unittests: Extend VDSO test for gettime64 2022-09-26 14:35:38 -07:00
Ryan Houdek 212df9aa7b FEXLinuxTests: Adds missing pthread_cancel flake status
Missed the 32-bit version of this test
2022-09-24 10:05:36 -07:00
Tony Wasserka c41de81694 FEXLinuxTests: Drop support for now unused "args:" annotations 2022-09-22 10:03:38 +02:00
Tony Wasserka 41aaeb1ff0 FEXLinuxTests: Migrate signal tests to Catch2 2022-09-22 10:03:37 +02:00
Tony Wasserka 16be2792ab FEXLinuxTests: Migrate FD test to Catch2 2022-09-22 10:03:36 +02:00
Tony Wasserka 6610bb355c FEXLinuxTests: Migrate VDSO test to Catch2 2022-09-22 10:03:35 +02:00
Tony Wasserka 4312fd7291 FEXLinuxTests: Migrate SMC tests to Catch2 2022-09-22 10:03:33 +02:00
Tony Wasserka 89a225a96d FEXLinuxTests: Enable use of Catch2 in tests 2022-09-22 10:03:31 +02:00
Tony Wasserka 2cb455b9d4 CMake: Add toolchain file for 32-bit cross-compiler 2022-09-19 09:19:22 +02:00
Tony Wasserka e4c84542ea FEXLinuxTests: Build 32-bit and 64-bit test variants separately
This allows to use different toolchain files for each and it reduces
build system repetition in test target setup.

The "tests-32" directories has been integrated into the "tests" one. Tests
that should only run on 32-bit are detected by their filename ending with
".32.cpp" now.
2022-09-16 11:24:18 +02:00
Ryan Houdek 9fac1b8105 CI: Adds support for flakes
If a test is marked as a flake then it will be tried five times before
giving up.

Works around the problem of needing to babysit CI once a PR is pushed.
As long as we have all the flake tests marked.
2022-09-15 11:44:56 -07:00
Tony Wasserka 1767e21273 FEXLinuxTests: Use the build system instead of setting up compile flags via source-code annotations
The intent of these annotations was presumably to make it easier to adjust
build settings on a per-test basis, but doing this in the build system is
actually much cleaner.
2022-09-15 08:55:18 +02:00