Skip to content

Commit

Permalink
kyua: Support is_exclusive metadata coming from an ATF test case
Browse files Browse the repository at this point in the history
On ATF side it is named "is.exclusive".

Reviewed by:	ngie, markj
MFC after:	1 month
Differential Revision:	https://reviews.freebsd.org/D47671
  • Loading branch information
ihoro committed Dec 24, 2024
1 parent c21f575 commit 2ed24e2
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 0 deletions.
2 changes: 2 additions & 0 deletions contrib/kyua/engine/atf_list.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,8 @@ engine::parse_atf_metadata(const model::properties_map& props)
mdbuilder.set_string("execenv", value);
} else if (name == "execenv.jail.params") {
mdbuilder.set_string("execenv_jail_params", value);
} else if (name == "is.exclusive") {
mdbuilder.set_string("is_exclusive", value);
} else if (name == "require.config") {
mdbuilder.set_string("required_configs", value);
} else if (name == "require.files") {
Expand Down
33 changes: 33 additions & 0 deletions contrib/kyua/engine/atf_list_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ ATF_TEST_CASE_BODY(parse_atf_metadata__override_all)
model::properties_map properties;
properties["descr"] = "Some text";
properties["has.cleanup"] = "true";
properties["is.exclusive"] = "true";
properties["require.arch"] = "i386 x86_64";
properties["require.config"] = "var1 var2 var3";
properties["require.files"] = "/file1 /dir/file2";
Expand Down Expand Up @@ -93,6 +94,7 @@ ATF_TEST_CASE_BODY(parse_atf_metadata__override_all)
.add_required_program(fs::path("svn"))
.set_description("Some text")
.set_has_cleanup(true)
.set_is_exclusive(true)
.set_required_memory(units::bytes::parse("1m"))
.set_required_user("root")
.set_timeout(datetime::delta(123, 0))
Expand Down Expand Up @@ -261,6 +263,36 @@ ATF_TEST_CASE_BODY(parse_atf_list__many_test_cases)
}


ATF_TEST_CASE_WITHOUT_HEAD(parse_atf_list__is_exclusive_support);
ATF_TEST_CASE_BODY(parse_atf_list__is_exclusive_support)
{
const std::string text =
"Content-Type: application/X-atf-tp; version=\"1\"\n"
"\n"
"ident: first\n"
"is.exclusive: false\n"
"descr: This is the descr\n"
"\n"
"ident: second\n"
"is.exclusive: true\n"
"\n"
"ident: third\n";
std::istringstream input(text);
const model::test_cases_map tests = engine::parse_atf_list(input);

const model::test_cases_map exp_tests = model::test_cases_map_builder()
.add("first", model::metadata_builder()
.set_description("This is the descr")
.build())
.add("second", model::metadata_builder()
.set_is_exclusive(true)
.build())
.add("third")
.build();
ATF_REQUIRE_EQ(exp_tests, tests);
}


ATF_INIT_TEST_CASES(tcs)
{
ATF_ADD_TEST_CASE(tcs, parse_atf_metadata__defaults);
Expand All @@ -275,4 +307,5 @@ ATF_INIT_TEST_CASES(tcs)
ATF_ADD_TEST_CASE(tcs, parse_atf_list__one_test_case_invalid_syntax);
ATF_ADD_TEST_CASE(tcs, parse_atf_list__one_test_case_invalid_properties);
ATF_ADD_TEST_CASE(tcs, parse_atf_list__many_test_cases);
ATF_ADD_TEST_CASE(tcs, parse_atf_list__is_exclusive_support);
}

0 comments on commit 2ed24e2

Please sign in to comment.