summaryrefslogtreecommitdiffstats
path: root/meta-oe/recipes-benchmark/libhugetlbfs/files/0001-run_test.py-not-use-hard-coded-path-.-obj-hugeadm.patch
blob: 83934abef87f3e27e1e1e73fd486cfc41aa25fa4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
From 0077532b07e268347cb8557be6d70148d5f0e840 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>

Update for 2.22.
Signed-off-by: Zheng Ruoqin <zhengrq.fnst@cn.fujitsu.com>

Update to work for python3
Signed-off-by: Changqing Li <changqing.li@windriver.com>
---
 tests/run_tests.py | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)

diff --git a/tests/run_tests.py b/tests/run_tests.py
index 018264d..0aabcd1 100755
--- a/tests/run_tests.py
+++ b/tests/run_tests.py
@@ -245,9 +245,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().decode().strip()
+
     if rc != 0 or out == "":
         return sizes
 
-- 
2.7.4