mirror of
https://github.com/justinian/jsix.git
synced 2025-12-10 00:14:32 -08:00
[test_runner] Add handle test suite
For now this just tests handle cloning and basic capability checking.
This commit is contained in:
@@ -9,6 +9,7 @@ module("test_runner",
|
||||
"test_case.cpp",
|
||||
|
||||
"tests/constexpr_hash.cpp",
|
||||
"tests/handles.cpp",
|
||||
"tests/linked_list.cpp",
|
||||
"tests/mailbox.cpp",
|
||||
"tests/map.cpp",
|
||||
|
||||
26
src/user/test_runner/tests/handles.cpp
Normal file
26
src/user/test_runner/tests/handles.cpp
Normal file
@@ -0,0 +1,26 @@
|
||||
#include <j6/caps.h>
|
||||
#include <j6/errors.h>
|
||||
#include <j6/syscalls.h>
|
||||
#include <j6/types.h>
|
||||
#include "test_case.h"
|
||||
|
||||
extern j6_handle_t __handle_self;
|
||||
|
||||
struct handle_tests :
|
||||
public test::fixture
|
||||
{
|
||||
};
|
||||
|
||||
TEST_CASE( handle_tests, clone_cap )
|
||||
{
|
||||
j6_status_t s;
|
||||
j6_handle_t self0 = __handle_self;
|
||||
|
||||
j6_handle_t self1 = j6_handle_invalid;
|
||||
s = j6_handle_clone(self0, &self1, j6_handle_caps(self0) & ~j6_cap_object_clone);
|
||||
CHECK( s == j6_status_ok, "Cloning self handle" );
|
||||
|
||||
j6_handle_t self2 = j6_handle_invalid;
|
||||
s = j6_handle_clone(self1, &self2, j6_handle_caps(self1));
|
||||
CHECK( s == j6_err_denied, "Cloning non-clonable handle" );
|
||||
}
|
||||
@@ -28,7 +28,7 @@ TEST_CASE( mailbox_tests, would_block )
|
||||
size_t buffer_size = 128;
|
||||
j6_handle_t handles[10];
|
||||
size_t handle_count = 10;
|
||||
uint64_t reply_tag = 0;
|
||||
uint16_t reply_tag = 0;
|
||||
uint64_t badge = 0;
|
||||
uint64_t flags = 0;
|
||||
|
||||
@@ -66,7 +66,7 @@ TEST_CASE( mailbox_tests, send_receive )
|
||||
size_t in_buffer_size = 128;
|
||||
j6_handle_t in_handles[10];
|
||||
size_t in_handle_count = 10;
|
||||
uint64_t in_reply_tag = 0;
|
||||
uint16_t in_reply_tag = 0;
|
||||
uint64_t in_badge = 0;
|
||||
uint64_t in_flags = 0;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user