Skip to content

Commit

Permalink
test added
Browse files Browse the repository at this point in the history
  • Loading branch information
lind committed Jul 18, 2024
1 parent 4c33d77 commit 1cc0132
Showing 1 changed file with 0 additions and 24 deletions.
24 changes: 0 additions & 24 deletions src/tests/fs_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4034,29 +4034,6 @@ pub mod fs_tests {

assert_eq!(cage.close_syscall(fd), 0);
assert_eq!(cage.exit_syscall(EXIT_SUCCESS), EXIT_SUCCESS);
pub fn ut_lind_fs_shmget_syscall(){
// acquire locks and start env cleanup
let _thelock = setup::lock_and_init();
let cage = interface::cagetable_getref(1);

let key = 33123;
// Get shmid of a memory segment / create a new one if it doesn't exist
let shmid = cage.shmget_syscall(33123, 1024, IPC_CREAT);
assert_eq!(shmid,4);

// Check error upon asking for a valid key and passing the IPC_CREAT or IPC_EXCL flag
assert_eq!(cage.shmget_syscall(key, 1024, IPC_CREAT),-(Errno::EEXIST as i32 ));
// assert_eq!(cage.shmget_syscall(key, 1024, IPC_EXCL),-(Errno::EEXIST as i32));

// Check if the function returns a correct shmid upon asking with a key that we know exists
assert_eq!(cage.shmget_syscall(key, 1024,0666),shmid);

// Check if the function returns the correct error when we don't pass IPC_CREAT for a key that doesn't exist
assert_eq!(cage.shmget_syscall(123456, 1024, 0),-(Errno::ENOENT as i32));

// Check if the size error is returned correctly
assert_eq!(cage.shmget_syscall(123456, (SHMMAX + 10 )as usize, IPC_CREAT),-(Errno::EINVAL as i32));
assert_eq!(cage.shmget_syscall(123456, 0 as usize, IPC_CREAT),-(Errno::EINVAL as i32));

lindrustfinalize();
}
Expand Down Expand Up @@ -4088,4 +4065,3 @@ pub mod fs_tests {
lindrustfinalize();
}
}
}

0 comments on commit 1cc0132

Please sign in to comment.