Skip to content

Commit

Permalink
kyua: Support require.diskspace ATF metadata
Browse files Browse the repository at this point in the history
MFC after:	1 month
  • Loading branch information
ihoro committed Jan 6, 2025
1 parent a071c76 commit c6b61bc
Show file tree
Hide file tree
Showing 2 changed files with 25 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 @@ -129,6 +129,8 @@ engine::parse_atf_metadata(const model::properties_map& props)
mdbuilder.set_string("is_exclusive", value);
} else if (name == "require.config") {
mdbuilder.set_string("required_configs", value);
} else if (name == "require.diskspace") {
mdbuilder.set_string("required_disk_space", value);
} else if (name == "require.files") {
mdbuilder.set_string("required_files", value);
} else if (name == "require.machine") {
Expand Down
23 changes: 23 additions & 0 deletions contrib/kyua/engine/atf_list_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ ATF_TEST_CASE_BODY(parse_atf_metadata__override_all)
properties["is.exclusive"] = "true";
properties["require.arch"] = "i386 x86_64";
properties["require.config"] = "var1 var2 var3";
properties["require.diskspace"] = "10g";
properties["require.files"] = "/file1 /dir/file2";
properties["require.machine"] = "amd64";
properties["require.memory"] = "1m";
Expand Down Expand Up @@ -95,6 +96,7 @@ ATF_TEST_CASE_BODY(parse_atf_metadata__override_all)
.set_description("Some text")
.set_has_cleanup(true)
.set_is_exclusive(true)
.set_required_disk_space(units::bytes::parse("10g"))
.set_required_memory(units::bytes::parse("1m"))
.set_required_user("root")
.set_timeout(datetime::delta(123, 0))
Expand Down Expand Up @@ -293,6 +295,26 @@ ATF_TEST_CASE_BODY(parse_atf_list__is_exclusive_support)
}


ATF_TEST_CASE_WITHOUT_HEAD(parse_atf_list__disk_space_support);
ATF_TEST_CASE_BODY(parse_atf_list__disk_space_support)
{
const std::string text =
"Content-Type: application/X-atf-tp; version=\"1\"\n"
"\n"
"ident: first\n"
"require.diskspace: 123M\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_required_disk_space(units::bytes::parse("123M"))
.build())
.build();
ATF_REQUIRE_EQ(exp_tests, tests);
}


ATF_INIT_TEST_CASES(tcs)
{
ATF_ADD_TEST_CASE(tcs, parse_atf_metadata__defaults);
Expand All @@ -308,4 +330,5 @@ ATF_INIT_TEST_CASES(tcs)
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);
ATF_ADD_TEST_CASE(tcs, parse_atf_list__disk_space_support);
}

Check warning on line 334 in contrib/kyua/engine/atf_list_test.cpp

View workflow job for this annotation

GitHub Actions / Style Checker

Missing Signed-off-by: line

0 comments on commit c6b61bc

Please sign in to comment.