Skip to content

Conversation

@walker84837
Copy link
Collaborator

This PR fixes an issue where example tests on Windows leave behind residual .exe files after running. The root problem was that the test cleanup logic assumed Unix-style executables (no extension), so the final Windows binaries were never removed.

What changed

  • The executable path in run_example_test is now constructed conditionally:
    • Uses .exe on Windows
    • Uses no extension on non-Windows platforms
  • Cleanup logic now correctly removes the generated executable on all platforms
  • Removed explicit cleanup of generated C files, since this is already handled by the compiler itself

Why this works

On Windows, Command execution produces <example>.exe, but the test cleanup attempted to delete <example> instead. By aligning the executable path with platform conventions, the tests now clean up after themselves consistently, matching Linux/macOS behavior.

Related Issue

Fixes #8

Adjusted file extensions and cleanup for cross-platform compatibility in
example tests.

Summary of changes:

- Reordered `assert_cmd` imports for clarity
- Set executable extension based on OS (`exe` for Windows)
- Removed redundant C file handling
- Ensure generated executables are cleaned up after tests
- Added safety notes about single-threaded tests and setting KEEP_C env
  var for testing incorrect C code
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

Successfully merging this pull request may close these issues.

Tests do not delete exe files

2 participants