blob: 53f35abb7bedccc88062dbe9479e95b94d8f9081 [file] [log] [blame]
Brad Bishop1a4b7ee2018-12-16 17:11:34 -08001From 0077532b07e268347cb8557be6d70148d5f0e840 Mon Sep 17 00:00:00 2001
Patrick Williamsb48b7b42016-08-17 15:04:38 -05002From: 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>
Brad Bishop1a4b7ee2018-12-16 17:11:34 -080012
Patrick Williamsb48b7b42016-08-17 15:04:38 -050013---
Brad Bishop1a4b7ee2018-12-16 17:11:34 -080014 tests/run_tests.py | 12 +++++++++++-
15 1 file changed, 11 insertions(+), 1 deletion(-)
Patrick Williamsb48b7b42016-08-17 15:04:38 -050016
17diff --git a/tests/run_tests.py b/tests/run_tests.py
Brad Bishop1a4b7ee2018-12-16 17:11:34 -080018index 3c95a03..560df6b 100755
Patrick Williamsb48b7b42016-08-17 15:04:38 -050019--- a/tests/run_tests.py
20+++ b/tests/run_tests.py
Brad Bishop1a4b7ee2018-12-16 17:11:34 -080021@@ -234,9 +234,19 @@ def get_pagesizes():
Patrick Williamsb48b7b42016-08-17 15:04:38 -050022 Use libhugetlbfs' hugeadm utility to get a list of page sizes that have
23 active mount points and at least one huge page allocated to the pool.
24 """
25+ local_env = os.environ.copy()
26+ local_env["PATH"] = "../obj:%s" % local_env.get("PATH", "")
27 sizes = set()
28 out = ""
29- (rc, out) = bash("../obj/hugeadm --page-sizes")
30+ try:
31+ p = subprocess.Popen("hugeadm --page-sizes", shell=True, env=local_env, stdout=subprocess.PIPE)
32+ rc = p.wait()
33+ except KeyboardInterrupt:
34+ return sizes
35+ except OSError:
36+ return sizes
37+ out = p.stdout.read().strip()
38+
39 if rc != 0 or out == "": return sizes
40
41 for size in out.split("\n"): sizes.add(int(size))