Patchwork [meta-oe,2/3] libhugetlbfs: not use hard coded path in run_tests.py

login
register
mail settings
Submitter chunrong guo
Date Oct. 12, 2013, 9:06 a.m.
Message ID <1381568802-9845-1-git-send-email-b40290@freescale.com>
Download mbox | patch
Permalink /patch/59729/
State Accepted, archived
Commit 0e2a691f78669e27a44c03b8a79bd0d0b2dfed0a
Headers show

Comments

chunrong guo - Oct. 12, 2013, 9:06 a.m.
From: Chunrong Guo <B40290@freescale.com>

  *Hard coded path makes the script impossible to run out of source tree.
  *After 'make install', we can use hugeadm utility under DESTDIR.

Signed-off-by: Chunrong Guo <B40290@freescale.com>
---
 ....py-not-use-hard-coded-path-.-obj-hugeadm.patch |   43 ++++++++++++++++++++
 .../libhugetlbfs/libhugetlbfs_git.bb               |    1 +
 2 files changed, 44 insertions(+), 0 deletions(-)
 create mode 100644 meta-oe/recipes-benchmark/libhugetlbfs/files/0001-run_test.py-not-use-hard-coded-path-.-obj-hugeadm.patch

Patch

diff --git a/meta-oe/recipes-benchmark/libhugetlbfs/files/0001-run_test.py-not-use-hard-coded-path-.-obj-hugeadm.patch b/meta-oe/recipes-benchmark/libhugetlbfs/files/0001-run_test.py-not-use-hard-coded-path-.-obj-hugeadm.patch
new file mode 100644
index 0000000..3082d7e
--- /dev/null
+++ b/meta-oe/recipes-benchmark/libhugetlbfs/files/0001-run_test.py-not-use-hard-coded-path-.-obj-hugeadm.patch
@@ -0,0 +1,43 @@ 
+From a85fc43243f8bfad12d306a4a0e230fb8b3e828a Mon Sep 17 00:00:00 2001
+From: Ting Liu <b28495@freescale.com>
+Date: Wed, 21 Aug 2013 15:44:57 +0800
+Subject: [PATCH] run_test.py: not use hard coded path ../obj/hugeadm
+
+Hard coded path makes the script impossible to run out of source tree.
+After 'make install', we can use hugeadm utility under DESTDIR.
+
+Upstream-Status: Submitted
+
+Signed-off-by: Ting Liu <b28495@freescale.com>
+---
+ tests/run_tests.py |   12 +++++++++++-
+ 1 files changed, 11 insertions(+), 1 deletions(-)
+
+diff --git a/tests/run_tests.py b/tests/run_tests.py
+index d9a6b35..a9bab8f 100755
+--- a/tests/run_tests.py
++++ b/tests/run_tests.py
+@@ -232,9 +232,19 @@ def get_pagesizes():
+     Use libhugetlbfs' hugeadm utility to get a list of page sizes that have
+     active mount points and at least one huge page allocated to the pool.
+     """
++    local_env = os.environ.copy()
++    local_env["PATH"] = "../obj:%s" % local_env.get("PATH", "")
+     sizes = set()
+     out = ""
+-    (rc, out) = bash("../obj/hugeadm --page-sizes")
++    try:
++        p = subprocess.Popen("hugeadm --page-sizes", shell=True, env=local_env, stdout=subprocess.PIPE)
++        rc = p.wait()
++    except KeyboardInterrupt:
++        return sizes
++    except OSError:
++        return sizes
++    out = p.stdout.read().strip()
++
+     if rc != 0 or out == "": return sizes
+ 
+     for size in out.split("\n"): sizes.add(int(size))
+-- 
+1.7.3.4
+
diff --git a/meta-oe/recipes-benchmark/libhugetlbfs/libhugetlbfs_git.bb b/meta-oe/recipes-benchmark/libhugetlbfs/libhugetlbfs_git.bb
index 475c502..5b871e9 100644
--- a/meta-oe/recipes-benchmark/libhugetlbfs/libhugetlbfs_git.bb
+++ b/meta-oe/recipes-benchmark/libhugetlbfs/libhugetlbfs_git.bb
@@ -14,6 +14,7 @@  SRC_URI = "git://git.code.sf.net/p/libhugetlbfs/code \
     file://libhugetlbfs-avoid-search-host-library-path-for-cros.patch \
     file://fix-lib64-can-not-be-shiped-in-64bit-target.patch \
     file://tests-Makefile-install-static-4G-edge-testcases.patch \
+    file://0001-run_test.py-not-use-hard-coded-path-.-obj-hugeadm.patch \
 "
 
 S = "${WORKDIR}/git"