Skip to content

Commit 17a2855

Browse files
committed
librlist/test: test state marking after rlist_remove_ranks
Problem: There is no test that ensure marking ranks up/down works after some ranks have been removed from an rlist. Add a test specific to this case (Issue #5868)
1 parent 80fdd8b commit 17a2855

File tree

1 file changed

+38
-1
lines changed

1 file changed

+38
-1
lines changed

src/common/librlist/test/rlist.c

Lines changed: 38 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2112,6 +2112,43 @@ static void test_rlist_config_inval (void)
21122112
json_decref (o);
21132113
}
21142114

2115+
static void test_issue_5868 (void)
2116+
{
2117+
char *R;
2118+
char *s;
2119+
struct rlist *rl;
2120+
struct idset *ranks;
2121+
2122+
if (!(R = R_create ("0-3",
2123+
"0-3",
2124+
NULL,
2125+
"foo[0-3]",
2126+
NULL)))
2127+
BAIL_OUT ("issue5868: R_create");
2128+
2129+
if (!(rl = rlist_from_R (R)))
2130+
BAIL_OUT ("issue5868: rlist_from_R() failed");
2131+
/* Remove ranks 0-1
2132+
*/
2133+
if (!(ranks = idset_decode ("0-1")))
2134+
BAIL_OUT ("issue5868: idset_create failed");
2135+
if (rlist_remove_ranks (rl, ranks) < 0)
2136+
BAIL_OUT ("issue5868: rlist_remove_ranks failed");
2137+
idset_destroy (ranks);
2138+
2139+
ok (rlist_mark_down (rl, "0-2") == 0,
2140+
"issue5868: rlist_mark_down (0-2) ignores missing ranks");
2141+
2142+
s = rlist_dumps (rl);
2143+
diag ("%s", s);
2144+
is (s, "rank3/core[0-3]",
2145+
"issue5868: expected resources remain up");
2146+
2147+
free (s);
2148+
rlist_destroy (rl);
2149+
free (R);
2150+
}
2151+
21152152
int main (int ac, char *av[])
21162153
{
21172154
plan (NO_PLAN);
@@ -2142,7 +2179,7 @@ int main (int ac, char *av[])
21422179
test_properties ();
21432180
test_issue4290 ();
21442181
test_rlist_config_inval ();
2145-
2182+
test_issue_5868 ();
21462183
done_testing ();
21472184
}
21482185

0 commit comments

Comments
 (0)