-
Notifications
You must be signed in to change notification settings - Fork 253
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
macos: use /tmp instead of /dev/shm #635
Open
devtekve
wants to merge
2
commits into
commaai:master
Choose a base branch
from
devtekve:replace-devshm-for-macos-with-temp
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -87,7 +87,11 @@ int msgq_new_queue(msgq_queue_t * q, const char * path, size_t size){ | |
assert(size < 0xFFFFFFFF); // Buffer must be smaller than 2^32 bytes | ||
std::signal(SIGUSR2, sigusr2_handler); | ||
|
||
std::string full_path = "/dev/shm/"; | ||
#ifdef __APPLE__ | ||
std::string full_path = "/tmp/"; | ||
#else | ||
std::string full_path = "/dev/shm/"; | ||
Comment on lines
+90
to
+93
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. same here |
||
#endif | ||
const char* prefix = std::getenv("OPENPILOT_PREFIX"); | ||
if (prefix) { | ||
full_path += std::string(prefix) + "/"; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,13 @@ | ||
#include "catch2/catch.hpp" | ||
#include "msgq/msgq.h" | ||
|
||
// Define queue path based on platform | ||
#ifdef __APPLE__ | ||
#define SHM_PATH "/tmp/test_queue" | ||
#else | ||
#define SHM_PATH "/dev/shm/test_queue" | ||
#endif | ||
|
||
TEST_CASE("ALIGN") | ||
{ | ||
REQUIRE(ALIGN(0) == 0); | ||
|
@@ -43,7 +50,7 @@ TEST_CASE("msgq_msg_init_data") | |
|
||
TEST_CASE("msgq_init_subscriber") | ||
{ | ||
remove("/dev/shm/test_queue"); | ||
remove(SHM_PATH); | ||
msgq_queue_t q; | ||
msgq_new_queue(&q, "test_queue", 1024); | ||
REQUIRE(*q.num_readers == 0); | ||
|
@@ -63,7 +70,7 @@ TEST_CASE("msgq_init_subscriber") | |
|
||
TEST_CASE("msgq_msg_send first message") | ||
{ | ||
remove("/dev/shm/test_queue"); | ||
remove(SHM_PATH); | ||
msgq_queue_t q; | ||
msgq_new_queue(&q, "test_queue", 1024); | ||
msgq_init_publisher(&q); | ||
|
@@ -100,7 +107,7 @@ TEST_CASE("msgq_msg_send first message") | |
|
||
TEST_CASE("msgq_msg_send test wraparound") | ||
{ | ||
remove("/dev/shm/test_queue"); | ||
remove(SHM_PATH); | ||
msgq_queue_t q; | ||
msgq_new_queue(&q, "test_queue", 1024); | ||
msgq_init_publisher(&q); | ||
|
@@ -132,7 +139,7 @@ TEST_CASE("msgq_msg_send test wraparound") | |
|
||
TEST_CASE("msgq_msg_recv test wraparound") | ||
{ | ||
remove("/dev/shm/test_queue"); | ||
remove(SHM_PATH); | ||
msgq_queue_t q_pub, q_sub; | ||
msgq_new_queue(&q_pub, "test_queue", 1024); | ||
msgq_new_queue(&q_sub, "test_queue", 1024); | ||
|
@@ -178,7 +185,7 @@ TEST_CASE("msgq_msg_recv test wraparound") | |
|
||
TEST_CASE("msgq_msg_send test invalidation") | ||
{ | ||
remove("/dev/shm/test_queue"); | ||
remove(SHM_PATH); | ||
msgq_queue_t q_pub, q_sub; | ||
msgq_new_queue(&q_pub, "test_queue", 1024); | ||
msgq_new_queue(&q_sub, "test_queue", 1024); | ||
|
@@ -214,7 +221,7 @@ TEST_CASE("msgq_msg_send test invalidation") | |
|
||
TEST_CASE("msgq_init_subscriber init 2 subscribers") | ||
{ | ||
remove("/dev/shm/test_queue"); | ||
remove(SHM_PATH); | ||
msgq_queue_t q1, q2; | ||
msgq_new_queue(&q1, "test_queue", 1024); | ||
msgq_new_queue(&q2, "test_queue", 1024); | ||
|
@@ -237,7 +244,7 @@ TEST_CASE("msgq_init_subscriber init 2 subscribers") | |
|
||
TEST_CASE("Write 1 msg, read 1 msg", "[integration]") | ||
{ | ||
remove("/dev/shm/test_queue"); | ||
remove(SHM_PATH); | ||
const size_t msg_size = 128; | ||
msgq_queue_t writer, reader; | ||
|
||
|
@@ -273,7 +280,7 @@ TEST_CASE("Write 1 msg, read 1 msg", "[integration]") | |
|
||
TEST_CASE("Write 2 msg, read 2 msg - conflate = false", "[integration]") | ||
{ | ||
remove("/dev/shm/test_queue"); | ||
remove(SHM_PATH); | ||
const size_t msg_size = 128; | ||
msgq_queue_t writer, reader; | ||
|
||
|
@@ -310,7 +317,7 @@ TEST_CASE("Write 2 msg, read 2 msg - conflate = false", "[integration]") | |
|
||
TEST_CASE("Write 2 msg, read 2 msg - conflate = true", "[integration]") | ||
{ | ||
remove("/dev/shm/test_queue"); | ||
remove(SHM_PATH); | ||
const size_t msg_size = 128; | ||
msgq_queue_t writer, reader; | ||
|
||
|
@@ -348,7 +355,7 @@ TEST_CASE("Write 2 msg, read 2 msg - conflate = true", "[integration]") | |
|
||
TEST_CASE("1 publisher, 1 slow subscriber", "[integration]") | ||
{ | ||
remove("/dev/shm/test_queue"); | ||
remove(SHM_PATH); | ||
msgq_queue_t writer, reader; | ||
|
||
msgq_new_queue(&writer, "test_queue", 1024); | ||
|
@@ -383,15 +390,15 @@ TEST_CASE("1 publisher, 1 slow subscriber", "[integration]") | |
msgq_msg_close(&msg1); | ||
} | ||
} | ||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. revert this |
||
// TODO: verify these numbers by hand | ||
REQUIRE(n_received == 8572); | ||
REQUIRE(n_skipped == 1428); | ||
} | ||
|
||
TEST_CASE("1 publisher, 2 subscribers", "[integration]") | ||
{ | ||
remove("/dev/shm/test_queue"); | ||
remove(SHM_PATH); | ||
msgq_queue_t writer, reader1, reader2; | ||
|
||
msgq_new_queue(&writer, "test_queue", 1024); | ||
|
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this should be pulled out