blob: 3082d7ef5fe75b4c2ce7b6fd26c07fb00b31cd4d [file] [log] [blame]
Patrick Williamsb48b7b42016-08-17 15:04:38 -05001From a85fc43243f8bfad12d306a4a0e230fb8b3e828a Mon Sep 17 00:00:00 2001
2From: Ting Liu <b28495@freescale.com>
3Date: Wed, 21 Aug 2013 15:44:57 +0800
4Subject: [PATCH] run_test.py: not use hard coded path ../obj/hugeadm
5
6Hard coded path makes the script impossible to run out of source tree.
7After 'make install', we can use hugeadm utility under DESTDIR.
8
9Upstream-Status: Submitted
10
11Signed-off-by: Ting Liu <b28495@freescale.com>
12---
13 tests/run_tests.py | 12 +++++++++++-
14 1 files changed, 11 insertions(+), 1 deletions(-)
15
16diff --git a/tests/run_tests.py b/tests/run_tests.py
17index d9a6b35..a9bab8f 100755
18--- a/tests/run_tests.py
19+++ b/tests/run_tests.py
20@@ -232,9 +232,19 @@ def get_pagesizes():
21 Use libhugetlbfs' hugeadm utility to get a list of page sizes that have
22 active mount points and at least one huge page allocated to the pool.
23 """
24+ local_env = os.environ.copy()
25+ local_env["PATH"] = "../obj:%s" % local_env.get("PATH", "")
26 sizes = set()
27 out = ""
28- (rc, out) = bash("../obj/hugeadm --page-sizes")
29+ try:
30+ p = subprocess.Popen("hugeadm --page-sizes", shell=True, env=local_env, stdout=subprocess.PIPE)
31+ rc = p.wait()
32+ except KeyboardInterrupt:
33+ return sizes
34+ except OSError:
35+ return sizes
36+ out = p.stdout.read().strip()
37+
38 if rc != 0 or out == "": return sizes
39
40 for size in out.split("\n"): sizes.add(int(size))
41--
421.7.3.4
43