Skip to content

fs: fix hugetlb tests - #87

Open
kolyshkin wants to merge 2 commits into
opencontainers:mainfrom
kolyshkin:hugetlb-test-skip
Open

kolyshkin wants to merge 2 commits into
opencontainers:mainfrom
kolyshkin:hugetlb-test-skip

Conversation

@kolyshkin

Copy link
Copy Markdown
Contributor
  1. Skip hugetlb tests if the system has no huge page sizes available (e.g. no /sys/kernel/mm/hugepages in a build environment). Without this, TestHugetlbStats{NoUsageFile,NoMaxUsageFile,BadUsageFile,BadMaxUsageFile} fail, since GetStats is a no-op in this case, and the rest are passing vacuously.

    Fixes hugetlb_test fails on [ppc64el, s390x] runc#1822.

  2. Fix file names in hugetlb failure tests. Some tests used the file name template (like hugetlb.%s.max_usage_in_bytes) as is, so e.g. TestHugetlbStatsBadMaxUsageFile failed because the usage file was not found, rather than because max usage can't be parsed.

When the system has no huge page sizes available (e.g.
/sys/kernel/mm/hugepages is absent in a build environment),
cgroups.HugePageSizes returns an empty list, and HugetlbGroup's
Set and GetStats are no-ops. As a result, the tests which expect
GetStats to fail are failing, and the rest are passing vacuously.

Skip all hugetlb tests in such case.

Reported in opencontainers/runc#1822.

Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
Some hugetlb tests use file name templates such as
"hugetlb.%s.max_usage_in_bytes" as is, without substituting
the page size.

As a result, TestHugetlbStatsBadMaxUsageFile fails because
the usage file is not found, rather than because the max usage
file contents can't be parsed, and so it does not test what it is
supposed to test.

Fix this (and similar issues in other tests) by using proper
file names for every available huge page size.

Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

hugetlb_test fails on [ppc64el, s390x]

2 participants