summaryrefslogtreecommitdiff
path: root/test/suite/suite_subprocess.py
diff options
context:
space:
mode:
Diffstat (limited to 'test/suite/suite_subprocess.py')
-rw-r--r--test/suite/suite_subprocess.py44
1 files changed, 40 insertions, 4 deletions
diff --git a/test/suite/suite_subprocess.py b/test/suite/suite_subprocess.py
index 626a6b5efd3..71aab9c5422 100644
--- a/test/suite/suite_subprocess.py
+++ b/test/suite/suite_subprocess.py
@@ -26,8 +26,9 @@
# ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
# OTHER DEALINGS IN THE SOFTWARE.
-import os, subprocess
+import os, subprocess, sys
from run import wt_builddir
+from wttest import WiredTigerTestCase
# suite_subprocess.py
# Run a subprocess within the test suite
@@ -117,6 +118,28 @@ class suite_subprocess:
print 'ERROR: ' + filename + ' should not be empty (this command expected error output)'
self.assertNotEqual(filesize, 0, filename + ': expected to not be empty')
+ def verbose_env(self, envvar):
+ return envvar + '=' + str(os.environ.get(envvar)) + '\n'
+
+ def show_outputs(self, procargs, message, filenames):
+ out = 'ERROR: wt command ' + message + ': ' + str(procargs) + '\n' + \
+ self.verbose_env('PATH') + \
+ self.verbose_env('LD_LIBRARY_PATH') + \
+ self.verbose_env('DYLD_LIBRARY_PATH') + \
+ self.verbose_env('PYTHONPATH') + \
+ 'output files follow:'
+ WiredTigerTestCase.prout(out)
+ for filename in filenames:
+ maxbytes = 1024*100
+ with open(filename, 'r') as f:
+ contents = f.read(maxbytes)
+ if len(contents) > 0:
+ if len(contents) >= maxbytes:
+ contents += '...\n'
+ sepline = '*' * 50 + '\n'
+ out = sepline + filename + '\n' + sepline + contents
+ WiredTigerTestCase.prout(out)
+
# Run the wt utility.
def runWt(self, args, infilename=None,
outfilename=None, errfilename=None, closeconn=True,
@@ -131,10 +154,17 @@ class suite_subprocess:
wterrname = errfilename or "wt.err"
with open(wterrname, "w") as wterr:
with open(wtoutname, "w") as wtout:
- procargs = [os.path.join(wt_builddir, "wt")]
+ # Prefer running the actual 'wt' executable rather than the
+ # 'wt' script created by libtool. On OS/X with System Integrity
+ # Protection enabled, running a shell script strips
+ # environment variables needed to run 'wt'.
+ if sys.platform == "darwin":
+ wtexe = os.path.join(wt_builddir, ".libs", "wt")
+ else:
+ wtexe = os.path.join(wt_builddir, "wt")
+ procargs = [ wtexe ]
if self._gdbSubprocess:
- procargs = [os.path.join(wt_builddir, "libtool"),
- "--mode=execute", "gdb", "--args"] + procargs
+ procargs = [ "gdb", "--args" ] + procargs
procargs.extend(args)
if self._gdbSubprocess:
infilepart = ""
@@ -155,10 +185,16 @@ class suite_subprocess:
returncode = subprocess.call(
procargs, stdout=wtout, stderr=wterr)
if failure:
+ if returncode == 0:
+ self.show_outputs(procargs, "expected failure, got success",
+ [wtoutname, wterrname])
self.assertNotEqual(returncode, 0,
'expected failure: "' + \
str(procargs) + '": exited ' + str(returncode))
else:
+ if returncode != 0:
+ self.show_outputs(procargs, "expected success, got failure",
+ [wtoutname, wterrname])
self.assertEqual(returncode, 0,
'expected success: "' + \
str(procargs) + '": exited ' + str(returncode))