diff --git a/tools/rosbash/roszsh b/tools/rosbash/roszsh index d2ad4023..5363a59c 100644 --- a/tools/rosbash/roszsh +++ b/tools/rosbash/roszsh @@ -249,7 +249,7 @@ function rosed { if [[ -z $EDITOR ]]; then vim ${arg} else - $EDITOR ${arg} + eval $EDITOR ${arg} fi } @@ -747,7 +747,7 @@ compctl -K "_roscomplete_rosmake" "rosmake" compctl -x 'p[1]' -k "(check purge)" -- "rosclean" compctl -f -x 'p[1]' -K "_roscomplete" - 'p[2]' -K _roscomplete_file -- "rosed" "roscp" "roscat" compctl -f -x 'S[-]' -k '(--debug --prefix)' - 'c[-1,--prefix][-1,-p]' -h '' - 'p[1],c[-1,-d],c[-1,--debug],c[-2,-p],c[-2,--prefix]' -K "_roscomplete" - 'p[2],c[-2,-d],c[-2,--debug],c[-3,-p],c[-3,--prefix]' -K _roscomplete_exe -- "rosrun" -compctl -/g '*.(launch|test)' -x 'p[1]' -K "_roscomplete" -tx - 'p[2]' -K _roscomplete_launchfile -- + -x 'S[--]' -k "(--files --args --nodes --find-node --child --local --screen --server_uri --run_id --wait --port --core --pid --dump-params)" -- "roslaunch" +compctl -/g '*.(launch|test)' -x 'p[1]' -K "_roscomplete" -tx - 'p[2]' -K _roscomplete_launchfile -- + -x 'S[--]' -k "(--files --args --nodes --find-node --child --local --screen --server_uri --run_id --wait --port --core --pid --dump-params --disable-title --help --numworkers --ros-args --skip-log-check --timeout)" -- "roslaunch" compctl -/g '*.(launch|test)' -x 'p[1]' -K "_roscomplete" -tx - 'p[2]' -K _roscomplete_launchfile -- + -x 'S[--]' -k "(--bare --bare-limit --bare-name --pkgdir --package)" -- "rostest" compctl -K "_roscomplete_rospack" "rospack" compctl -K "_roscomplete_rosbag" + -g "*.bag *(/)" "rosbag" diff --git a/tools/rosunit/src/rosunit/baretest.py b/tools/rosunit/src/rosunit/baretest.py index 3a3bf6c9..5bc73e70 100644 --- a/tools/rosunit/src/rosunit/baretest.py +++ b/tools/rosunit/src/rosunit/baretest.py @@ -320,6 +320,12 @@ class LocalProcess(pmon.Process): cwd = get_ros_root() else: cwd = rospkg.get_ros_home() + if not os.path.exists(cwd): + try: + os.makedirs(cwd) + except OSError: + # exist_ok=True + pass try: self.popen = subprocess.Popen(self.args, cwd=cwd, stdout=logfileout, stderr=logfileerr, env=full_env, close_fds=True, preexec_fn=os.setsid) diff --git a/tools/rosunit/src/rosunit/junitxml.py b/tools/rosunit/src/rosunit/junitxml.py index 36a08d37..35ad8103 100644 --- a/tools/rosunit/src/rosunit/junitxml.py +++ b/tools/rosunit/src/rosunit/junitxml.py @@ -39,12 +39,15 @@ Library for reading and manipulating Ant JUnit XML result files. from __future__ import print_function +import codecs import os import sys try: from cStringIO import StringIO + python2 = True except ImportError: from io import StringIO + python2 = False import string import codecs import re @@ -56,7 +59,14 @@ from xml.dom import Node as DomNode from functools import reduce import rospkg -invalid_chars = re.compile(ur'[^\x09\x0A\x0D\x20-\x7E\x85\xA0-\xFF\u0100-\uD7FF\uE000-\uFDCF\uFDE0-\uFFFD]') +pattern = r'[^\x09\x0A\x0D\x20-\x7E\x85\xA0-\xFF\u0100-\uD7FF\uE000-\uFDCF\uFDE0-\uFFFD]' +if python2: + pattern = pattern.decode('unicode_escape') +else: + pattern = codecs.decode(pattern, 'unicode_escape') +invalid_chars = re.compile(pattern) + + def invalid_char_replacer(m): return "&#x"+('%04X' % ord(m.group(0)))+";" def filter_nonprintable_text(text): diff --git a/tools/rosunit/src/rosunit/xmlrunner.py b/tools/rosunit/src/rosunit/xmlrunner.py index 05f525a3..7f87b4fe 100644 --- a/tools/rosunit/src/rosunit/xmlrunner.py +++ b/tools/rosunit/src/rosunit/xmlrunner.py @@ -9,6 +9,7 @@ from __future__ import print_function __revision__ = "$Id$" +import codecs import os.path import re import sys @@ -17,8 +18,10 @@ import traceback import unittest try: from cStringIO import StringIO + python2 = True except ImportError: from io import StringIO + python2 = False from xml.sax.saxutils import escape import xml.etree.ElementTree as ET @@ -86,7 +89,7 @@ class _TestInfo(object): # "method": self._method, # "time": self._time, # }) - stream.write(self._method) + stream.write('[Testcase: ' + self._method + ']') if self._failure != None: stream.write(' ... FAILURE!\n') self._print_error_text(stream, 'failure', self._failure) @@ -159,7 +162,13 @@ class _XMLTestResult(unittest.TestResult): self._failure = err def filter_nonprintable_text(self, text): - invalid_chars = re.compile(ur'[^\x09\x0A\x0D\x20-\x7E\x85\xA0-\xFF\u0100-\uD7FF\uE000-\uFDCF\uFDE0-\uFFFD]') + pattern = r'[^\x09\x0A\x0D\x20-\x7E\x85\xA0-\xFF\u0100-\uD7FF\uE000-\uFDCF\uFDE0-\uFFFD]' + if python2: + pattern = pattern.decode('unicode_escape') + else: + pattern = codecs.decode(pattern, 'unicode_escape') + invalid_chars = re.compile(pattern) + def invalid_char_replacer(m): return "&#x"+('%04X' % ord(m.group(0)))+";" return re.sub(invalid_chars, invalid_char_replacer, str(text))