summaryrefslogtreecommitdiff
path: root/piglit-run.py
diff options
context:
space:
mode:
authorMatěj Cepl <mcepl@redhat.com>2011-10-12 12:06:00 +0200
committerPaul Berry <stereotype441@gmail.com>2011-10-13 09:46:24 -0700
commit88ecb306d3582091585f07e4c2087b4b6b51e461 (patch)
tree545ecea7f562d0710269d34bb784b09a7cfefba5 /piglit-run.py
parent022cc63ccea37f8426c86f61b164289a79fa10db (diff)
Make Python scripts independent of the current working directory
The main purpose of this patch is to make piglit independent of the current working directory, so it is possible to package piglit as a RPM package (with binaries symlinked to /usr/bin, most of the files in read-only /usr/lib*/piglit directory, and results somewhere else). So it is now possible to run $ piglit-run tests/quick-driver.tests /tmp/piglit and then with this command $ piglit-summary-html --overwrite /tmp/piglit/results /tmp/piglit/main generate a report in /tmp/piglit/results/index.html & al. Signed-off-by: Matěj Cepl <mcepl@redhat.com> Reviewed-by: Paul Berry <stereotype441@gmail.com>
Diffstat (limited to 'piglit-run.py')
-rwxr-xr-xpiglit-run.py7
1 files changed, 6 insertions, 1 deletions
diff --git a/piglit-run.py b/piglit-run.py
index c5f5a4a88..92b554d0d 100755
--- a/piglit-run.py
+++ b/piglit-run.py
@@ -29,6 +29,7 @@ import sys, os
import time
import traceback
+sys.path.append(path.dirname(path.realpath(sys.argv[0])))
import framework.core as core
from framework.threads import synchronized_self
@@ -106,6 +107,10 @@ def main():
profileFilename = args[0]
resultsDir = args[1]
+ # Change to the piglit's path
+ piglit_dir = path.dirname(path.realpath(sys.argv[0]))
+ os.chdir(piglit_dir)
+
core.checkDir(resultsDir, False)
results = core.TestrunResult()
@@ -126,7 +131,7 @@ def main():
for (key, value) in env.collectData().items():
json_writer.write_dict_item(key, value)
- profile = core.loadTestProfile(profileFilename)
+ profile = core.loadTestProfile(profileFilename, resultsDir)
time_start = time.time()
profile.run(env, json_writer)