aboutsummaryrefslogtreecommitdiffstats
path: root/tests/test-runner
diff options
context:
space:
mode:
Diffstat (limited to 'tests/test-runner')
-rw-r--r--tests/test-runner/bin/Makefile.am11
-rwxr-xr-xtests/test-runner/bin/test-runner.py2
-rwxr-xr-xtests/test-runner/bin/zts-report.py4
3 files changed, 16 insertions, 1 deletions
diff --git a/tests/test-runner/bin/Makefile.am b/tests/test-runner/bin/Makefile.am
index e843e4e09..30c564e55 100644
--- a/tests/test-runner/bin/Makefile.am
+++ b/tests/test-runner/bin/Makefile.am
@@ -2,3 +2,14 @@ pkgdatadir = $(datadir)/@PACKAGE@/test-runner/bin
dist_pkgdata_SCRIPTS = \
test-runner.py \
zts-report.py
+#
+# These scripts are compatibile with both Python 2.6 and 3.4. As such the
+# python 3 shebang can be replaced at install time when targeting a python
+# 2 system. This allows us to maintain a single version of the source.
+#
+if USING_PYTHON_2
+install-data-hook:
+ sed --in-place 's|^#!/usr/bin/python3|#!/usr/bin/python2|' \
+ $(DESTDIR)$(pkgdatadir)/test-runner.py \
+ $(DESTDIR)$(pkgdatadir)/zts-report.py
+endif
diff --git a/tests/test-runner/bin/test-runner.py b/tests/test-runner/bin/test-runner.py
index 7ef8a87ed..2e26fa266 100755
--- a/tests/test-runner/bin/test-runner.py
+++ b/tests/test-runner/bin/test-runner.py
@@ -15,6 +15,8 @@
# Copyright (c) 2012, 2015 by Delphix. All rights reserved.
# Copyright (c) 2017 Datto Inc.
#
+# This script must remain compatible with Python 2.6+ and Python 3.4+.
+#
# some python 2.7 system don't have a configparser shim
try:
diff --git a/tests/test-runner/bin/zts-report.py b/tests/test-runner/bin/zts-report.py
index 950295601..4e51bc94e 100755
--- a/tests/test-runner/bin/zts-report.py
+++ b/tests/test-runner/bin/zts-report.py
@@ -1,4 +1,4 @@
-#!/usr/bin/python
+#!/usr/bin/python3
#
# This file and its contents are supplied under the terms of the
@@ -15,6 +15,8 @@
# Copyright (c) 2017 by Delphix. All rights reserved.
# Copyright (c) 2018 by Lawrence Livermore National Security, LLC.
#
+# This script must remain compatible with Python 2.6+ and Python 3.4+.
+#
import os
import re