diff options
author | Naresh Kamboju <naresh.kamboju@linaro.org> | 2017-02-13 17:13:56 +0530 |
---|---|---|
committer | Naresh Kamboju <naresh.kamboju@linaro.org> | 2017-02-13 17:13:56 +0530 |
commit | 140906fa7f0bc95ce1fc52b701d4c5ef54b425fa (patch) | |
tree | 7db762fc1eaa09d3b24b60041277b9cc42c4b373 | |
parent | 1b2ee2c16d62a1c410059280b9525552b5c3fada (diff) |
linux: libhugetlbfs: support pre-built libhugetlbfs tests
Signed-off-by: Naresh Kamboju <naresh.kamboju@linaro.org>
-rwxr-xr-x | automated/linux/libhugetlbfs/libhugetlbfs.sh | 31 |
1 files changed, 27 insertions, 4 deletions
diff --git a/automated/linux/libhugetlbfs/libhugetlbfs.sh b/automated/linux/libhugetlbfs/libhugetlbfs.sh index 9d6db37..f2e97a0 100755 --- a/automated/linux/libhugetlbfs/libhugetlbfs.sh +++ b/automated/linux/libhugetlbfs/libhugetlbfs.sh @@ -52,14 +52,20 @@ parse_output() { awk '{for (i=1; i<NF; i++) printf $i "-"; print $i " " "SKIP"}' "${TEST_SKIP_LOG}" 2>&1 | tee -a "${RESULT_FILE}" } -libhugetlbfs_build_test() { +libhugetlbfs_setup() { mount_point="/mnt/hugetlb/" # Allocate hugepages echo 200 > /proc/sys/vm/nr_hugepages umount "${mount_point}" > /dev/null 2>&1 || true mkdir -p "${mount_point}" mount -t hugetlbfs hugetlbfs "${mount_point}" +} + +libhugetlbfs_cleanup() { + umount "${mount_point}" > /dev/null 2>&1 || true +} +libhugetlbfs_build_test() { # shellcheck disable=SC2140 # Upstream tree # wget https://github.com/libhugetlbfs/libhugetlbfs/releases/download/"${VERSION}"/libhugetlbfs-"${VERSION}".tar.gz @@ -71,13 +77,15 @@ libhugetlbfs_build_test() { # shellcheck disable=SC2164 cd libhugetlbfs-"${VERSION}" make BUILDTYPE=NATIVEONLY +} + +libhugetlbfs_run_test() { # shellcheck disable=SC2164 cd tests # Run tests # Redirect stdout (not stderr) ./run_tests.py -b "${WORD_SIZE}" | tee -a "${RESULT_LOG}" parse_output - umount "${mount_point}" > /dev/null 2>&1 || true } install() { @@ -126,5 +134,20 @@ exit_on_skip "libhugetlb-pre-requirements" "Kernel config CONFIG_HUGETLBFS=y and # Install packages install -# Build libhugetlbfs and run tests -libhugetlbfs_build_test +# Setup libhugetlbfs mount point +libhugetlbfs_setup + +if [ -d /usr/lib/libhugetlbfs-"${VERSION}" ] +then + echo "pre built /usr/lib/libhugetlbfs-"${VERSION}" found on rootfs" + cd /usr/lib/libhugetlbfs-"${VERSION}" +else + # Build libhugetlbfs tests + libhugetlbfs_build_test +fi + +# Run libhugetlbfs tests +libhugetlbfs_run_test + +# Unmount libhugetlbfs mount point +libhugetlbfs_cleanup |