Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
C
codes
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
38
Issues
38
List
Boards
Labels
Milestones
Merge Requests
8
Merge Requests
8
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
codes
codes
Commits
a5c4512a
Commit
a5c4512a
authored
Aug 03, 2015
by
Jonathan Jenkins
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
tests for map context
parent
2b992d55
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
114 additions
and
2 deletions
+114
-2
tests/Makefile.subdir
tests/Makefile.subdir
+9
-2
tests/conf/map-ctx-test.conf
tests/conf/map-ctx-test.conf
+16
-0
tests/map-ctx-test.c
tests/map-ctx-test.c
+81
-0
tests/map-ctx-test.sh
tests/map-ctx-test.sh
+8
-0
No files found.
tests/Makefile.subdir
View file @
a5c4512a
...
...
@@ -6,7 +6,8 @@ check_PROGRAMS += tests/lp-io-test \
tests/lsm-test
\
tests/resource-test
\
tests/rc-stack-test
\
tests/jobmap-test
tests/jobmap-test
\
tests/map-ctx-test
TESTS
+=
tests/lp-io-test.sh
\
tests/workload/codes-workload-test.sh
\
...
...
@@ -14,7 +15,8 @@ TESTS += tests/lp-io-test.sh \
tests/lsm-test.sh
\
tests/rc-stack-test
\
tests/resource-test.sh
\
tests/jobmap-test.sh
tests/jobmap-test.sh
\
tests/map-ctx-test.sh
EXTRA_DIST
+=
tests/lp-io-test.sh
\
tests/workload/codes-workload-test.sh
\
...
...
@@ -24,10 +26,12 @@ EXTRA_DIST += tests/lp-io-test.sh \
tests/lsm-test.sh
\
tests/resource-test.sh
\
tests/jobmap-test.sh
\
tests/map-ctx-test.sh
\
tests/conf/jobmap-test-list.conf
\
tests/conf/buffer_test.conf
\
tests/conf/lsm-test.conf
\
tests/conf/mapping_test.conf
\
tests/conf/map-ctx-test.conf
\
tests/expected/mapping_test.out
testlib
=
src/libcodes-base.a
${ROSS_LIBS}
...
...
@@ -50,6 +54,9 @@ tests_rc_stack_test_SOURCES = tests/rc-stack-test.c
tests_jobmap_test_LDADD
=
$(testlib)
tests_jobmap_test_SOURCES
=
tests/jobmap-test.c
tests_map_ctx_test_LDADD
=
$(testlib)
tests_map_ctx_test_SOURCES
=
tests/map-ctx-test.c
tests_workload_codes_workload_test_LDADD
=
$(testlib)
tests_workload_codes_workload_test_SOURCES
=
\
tests/workload/codes-workload-test.c
\
...
...
tests/conf/map-ctx-test.conf
0 → 100644
View file @
a5c4512a
LPGROUPS
{
FOO
{
repetitions
=
"5"
;
foo
=
"1"
;
bar
=
"1"
;
}
BAR
{
repetitions
=
"5"
;
foo
=
"3"
;
bar
=
"2"
;
bar
@
baz
=
"2"
;
}
}
tests/map-ctx-test.c
0 → 100644
View file @
a5c4512a
/*
* Copyright (C) 2015 University of Chicago.
* See COPYRIGHT notice in top-level directory.
*
*/
#include <stdbool.h>
#include <mpi.h>
#include <codes/codes-mapping-context.h>
#include <codes/configuration.h>
#define ERR(_fmt, ...) \
do { \
fprintf(stderr, "Error at %s:%d: " _fmt "\n", __FILE__, __LINE__, \
##__VA_ARGS__); \
return 1; \
} while (0)
/* NOTE: hard-coded against configuration file */
int
main
(
int
argc
,
char
*
argv
[])
{
MPI_Init
(
&
argc
,
&
argv
);
int
rc
=
configuration_load
(
argv
[
1
],
MPI_COMM_WORLD
,
&
config
);
if
(
rc
!=
0
)
ERR
(
"unable to load configuration file %s"
,
argv
[
1
]);
struct
codes_mctx
direct
,
group_modulo
,
group_direct
,
group_modulo_anno
,
group_direct_anno
;
direct
=
codes_mctx_set_global_direct
(
12ul
);
group_modulo
=
codes_mctx_set_group_modulo
(
NULL
,
true
);
group_direct
=
codes_mctx_set_group_direct
(
1
,
NULL
,
true
);
group_modulo_anno
=
codes_mctx_set_group_modulo
(
"baz"
,
false
);
group_direct_anno
=
codes_mctx_set_group_direct
(
1
,
"baz"
,
false
);
tw_lp
mock_lp
;
tw_lpid
rtn
;
rtn
=
codes_mctx_to_lpid
(
&
direct
,
NULL
,
NULL
);
if
(
12ul
!=
rtn
)
ERR
(
"global_direct mapping: expected %lu, got %lu"
,
12ul
,
rtn
);
mock_lp
.
gid
=
8ul
;
rtn
=
codes_mctx_to_lpid
(
&
group_modulo
,
"bar"
,
&
mock_lp
);
if
(
rtn
!=
9ul
)
ERR
(
"group_modulo mapping: expected %lu, got %lu"
,
9ul
,
rtn
);
mock_lp
.
gid
=
12ul
;
rtn
=
codes_mctx_to_lpid
(
&
group_modulo
,
"bar"
,
&
mock_lp
);
if
(
rtn
!=
13ul
)
ERR
(
"group_modulo mapping: expected %lu, got %lu"
,
13ul
,
rtn
);
rtn
=
codes_mctx_to_lpid
(
CODES_MCTX_DEFAULT
,
"bar"
,
&
mock_lp
);
if
(
rtn
!=
13ul
)
ERR
(
"group_modulo mapping (default): expected %lu, got %lu"
,
13ul
,
rtn
);
rtn
=
codes_mctx_to_lpid
(
&
group_modulo_anno
,
"bar"
,
&
mock_lp
);
if
(
rtn
!=
15ul
)
ERR
(
"group_modulo annotated mapping: expected %lu, got %lu"
,
15ul
,
rtn
);
mock_lp
.
gid
=
10ul
;
rtn
=
codes_mctx_to_lpid
(
&
group_direct
,
"bar"
,
&
mock_lp
);
if
(
rtn
!=
14ul
)
ERR
(
"group_direct mapping (default): expected %lu, got %lu"
,
14ul
,
rtn
);
rtn
=
codes_mctx_to_lpid
(
&
group_direct_anno
,
"bar"
,
&
mock_lp
);
if
(
rtn
!=
16ul
)
ERR
(
"group_direct mapping (default): expected %lu, got %lu"
,
16ul
,
rtn
);
return
0
;
}
/*
* Local variables:
* c-indent-level: 4
* c-basic-offset: 4
* indent-tabs-mode: nil
* End:
*
* vim: ts=8 sts=4 sw=4 expandtab
*/
tests/map-ctx-test.sh
0 → 100755
View file @
a5c4512a
#!/bin/bash
if
[[
-z
$srcdir
]]
;
then
echo
srcdir variable not
set
exit
1
fi
tests/map-ctx-test
$srcdir
/tests/conf/map-ctx-test.conf
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