Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
sds
mona
Commits
53dc809e
Commit
53dc809e
authored
Sep 02, 2020
by
Matthieu Dorier
Browse files
added self-sending test
parent
a8096d3b
Changes
2
Hide whitespace changes
Inline
Side-by-side
tests/CMakeLists.txt
View file @
53dc809e
...
...
@@ -10,6 +10,12 @@ target_include_directories (test-send-recv PUBLIC
${
CMAKE_CURRENT_SOURCE_DIR
}
/../include
)
target_link_libraries
(
test-send-recv mona
)
add_executable
(
test-send-recv-self test-send-recv-self.c munit/munit.c
)
target_include_directories
(
test-send-recv-self PUBLIC
${
CMAKE_CURRENT_SOURCE_DIR
}
/munit
${
CMAKE_CURRENT_SOURCE_DIR
}
/../include
)
target_link_libraries
(
test-send-recv-self mona
)
add_executable
(
test-isend-irecv test-isend-irecv.c munit/munit.c
)
target_include_directories
(
test-isend-irecv PUBLIC
${
CMAKE_CURRENT_SOURCE_DIR
}
/munit
...
...
@@ -49,6 +55,7 @@ target_link_libraries (test-na mona)
add_test
(
NAME TestInit COMMAND ./test-init
)
add_test
(
NAME TestSendRecv COMMAND mpirun -np 2 ./test-send-recv
)
add_test
(
NAME TestSendRecvSelf COMMAND mpirun -np 2 ./test-send-recv-self
)
add_test
(
NAME TestISendIRecv COMMAND mpirun -np 2 ./test-isend-irecv
)
add_test
(
NAME TestISendIRecvMulti COMMAND mpirun -np 2 ./test-isend-irecv-multi
)
add_test
(
NAME TestSendRecvUnexpected COMMAND mpirun -np 2 ./test-send-recv-unexpected
)
...
...
tests/test-send-recv-self.c
0 → 100644
View file @
53dc809e
#include "munit/munit.h"
#include "mona.h"
typedef
struct
{
mona_instance_t
mona
;
na_addr_t
self_addr
;
}
test_context
;
static
void
*
test_context_setup
(
const
MunitParameter
params
[],
void
*
user_data
)
{
(
void
)
params
;
(
void
)
user_data
;
int
ret
;
ABT_init
(
0
,
NULL
);
mona_instance_t
mona
=
mona_init
(
"ofi+tcp"
,
NA_TRUE
,
NULL
);
test_context
*
context
=
(
test_context
*
)
calloc
(
1
,
sizeof
(
*
context
));
context
->
mona
=
mona
;
ret
=
mona_addr_self
(
mona
,
&
(
context
->
self_addr
));
munit_assert_int
(
ret
,
==
,
NA_SUCCESS
);
return
context
;
}
static
void
test_context_tear_down
(
void
*
fixture
)
{
test_context
*
context
=
(
test_context
*
)
fixture
;
mona_addr_free
(
context
->
mona
,
context
->
self_addr
);
mona_finalize
(
context
->
mona
);
free
(
context
);
ABT_finalize
();
}
static
MunitResult
test_send_recv_self
(
const
MunitParameter
params
[],
void
*
data
)
{
(
void
)
params
;
test_context
*
context
=
(
test_context
*
)
data
;
na_return_t
ret
;
mona_instance_t
mona
=
context
->
mona
;
na_size_t
msg_len
=
8192
;
char
*
buf1
=
malloc
(
msg_len
);
char
*
buf2
=
malloc
(
msg_len
);
mona_request_t
req
;
ret
=
mona_irecv
(
mona
,
buf1
,
msg_len
,
context
->
self_addr
,
1234
,
NULL
,
NULL
,
NULL
,
&
req
);
munit_assert_int
(
ret
,
==
,
NA_SUCCESS
);
ret
=
mona_send
(
mona
,
buf2
,
msg_len
,
context
->
self_addr
,
0
,
1234
);
munit_assert_int
(
ret
,
==
,
NA_SUCCESS
);
ret
=
mona_wait
(
req
);
munit_assert_int
(
ret
,
==
,
NA_SUCCESS
);
return
MUNIT_OK
;
}
static
MunitTest
test_suite_tests
[]
=
{
{
(
char
*
)
"/hl"
,
test_send_recv_self
,
test_context_setup
,
test_context_tear_down
,
MUNIT_TEST_OPTION_NONE
,
NULL
},
{
NULL
,
NULL
,
NULL
,
NULL
,
MUNIT_TEST_OPTION_NONE
,
NULL
}
};
static
const
MunitSuite
test_suite
=
{
(
char
*
)
"/mona/send-recv-self"
,
test_suite_tests
,
NULL
,
1
,
MUNIT_SUITE_OPTION_NONE
};
int
main
(
int
argc
,
char
*
argv
[
MUNIT_ARRAY_PARAM
(
argc
+
1
)])
{
return
munit_suite_main
(
&
test_suite
,
(
void
*
)
"mona"
,
argc
,
argv
);
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment