Skip to content

Commit 90e969c

Browse files
committed
test: verify SHM path in SHM abort regression
1 parent 654db66 commit 90e969c

1 file changed

Lines changed: 10 additions & 2 deletions

File tree

tests/test_shm_abort.py

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,15 +34,21 @@ def _compile_and_run(payload_size):
3434
f"""
3535
#include "concore.hpp"
3636
#include <exception>
37+
#include <filesystem>
3738
#include <string>
3839
3940
int main() {{
4041
try {{
4142
Concore concore;
43+
std::filesystem::create_directories("out/1");
4244
concore.delay = 0;
4345
concore.simtime = 0;
4446
std::string payload({payload_size}, 'a');
4547
concore.write(1, "payload", payload);
48+
if (std::filesystem::exists("out/1/payload")) {{
49+
std::cerr << "write used the file path instead of shared memory" << std::endl;
50+
return 2;
51+
}}
4652
return 0;
4753
}} catch (const std::exception& error) {{
4854
std::cerr << error.what() << std::endl;
@@ -91,7 +97,8 @@ def test_oversized_payload_throws():
9197
def test_within_limit_succeeds():
9298
result = _compile_and_run(100)
9399
assert result.returncode == 0
94-
assert result.stderr == ""
100+
assert "Aborting" not in result.stderr
101+
assert "write used the file path instead of shared memory" not in result.stderr
95102

96103

97104
def test_exactly_at_limit_throws():
@@ -103,4 +110,5 @@ def test_exactly_at_limit_throws():
103110
def test_one_under_limit_succeeds():
104111
result = _compile_and_run(4095)
105112
assert result.returncode == 0
106-
assert result.stderr == ""
113+
assert "Aborting" not in result.stderr
114+
assert "write used the file path instead of shared memory" not in result.stderr

0 commit comments

Comments
 (0)