Skip to content

Commit

Permalink
[#51] Full CI checks for mac os, fix shm size tests, ensure that null…
Browse files Browse the repository at this point in the history
… terminator is always present
  • Loading branch information
elfenpiff committed Dec 21, 2023
1 parent 0ea33c1 commit e013e30
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 20 deletions.
17 changes: 1 addition & 16 deletions .cirrus.yml
Original file line number Diff line number Diff line change
Expand Up @@ -269,19 +269,4 @@ macos_aarch64_stable_debug_task:
- rustup component add clippy rustfmt
set_toolchain_script: rustup default stable
<<: *IOX2_CARGO_FMT_AND_CLIPPY
<<: *IOX2_COMMON_BUILD_DEBUG
test_script:
- cargo test -p iceoryx2-pal-concurrency-sync
-p iceoryx2-pal-posix
-p iceoryx2-bb-container
-p iceoryx2-bb-elementary
-p iceoryx2-bb-lock-free
-p iceoryx2-bb-log
-p iceoryx2-bb-memory
-p iceoryx2-bb-posix
-p iceoryx2-bb-system-types
-p iceoryx2-bb-testing
-p iceoryx2-bb-threadsafe
-p iceoryx2-bb-trait-tests
-p iceoryx2-cal
--lib --bins --tests --no-fail-fast
<<: *IOX2_COMMON_BUILD_AND_TEST_DEBUG
6 changes: 3 additions & 3 deletions iceoryx2-bb/posix/tests/shared_memory_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ fn shared_memory_create_and_modify_open_works() {
#[test]
fn shared_memory_opening_with_non_fitting_size_fails() {
let shm_name = generate_shm_name();
let _sut_create = SharedMemoryBuilder::new(&shm_name)
let sut_create = SharedMemoryBuilder::new(&shm_name)
.creation_mode(CreationMode::PurgeAndCreate)
.size(1024)
.permission(Permission::OWNER_ALL)
Expand All @@ -102,14 +102,14 @@ fn shared_memory_opening_with_non_fitting_size_fails() {

let sut_open1 = SharedMemoryBuilder::new(&shm_name)
.creation_mode(CreationMode::OpenOrCreate)
.size(8192)
.size(sut_create.size() + 1)
.permission(Permission::OWNER_ALL)
.zero_memory(true)
.create();

let sut_open2 = SharedMemoryBuilder::new(&shm_name)
.creation_mode(CreationMode::OpenOrCreate)
.size(16384)
.size(sut_create.size() * 2)
.permission(Permission::OWNER_ALL)
.zero_memory(true)
.create();
Expand Down
7 changes: 6 additions & 1 deletion iceoryx2-pal/posix/src/macos/mman.rs
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,12 @@ unsafe fn get_real_shm_name(name: *const char) -> Option<[u8; SHM_MAX_NAME_LEN]>

let mut buffer = [0u8; SHM_MAX_NAME_LEN];

if read(shm_state_fd, buffer.as_mut_ptr().cast(), SHM_MAX_NAME_LEN) <= 0 {
if read(
shm_state_fd,
buffer.as_mut_ptr().cast(),
SHM_MAX_NAME_LEN - 1,
) <= 0
{
close(shm_state_fd);
return None;
}
Expand Down

0 comments on commit e013e30

Please sign in to comment.