Commit 2c62e89a authored by Chris Lamb's avatar Chris Lamb 💬

Ensure tests and the runtime environment can locate binaries in /usr/sbin (eg. tcpdump)

Signed-off-by: Chris Lamb's avatarChris Lamb <lamby@debian.org>
parent 4916b85e
......@@ -17,6 +17,7 @@
# You should have received a copy of the GNU General Public License
# along with diffoscope. If not, see <https://www.gnu.org/licenses/>.
import os
import collections
import platform
import functools
......@@ -37,6 +38,15 @@ OS_NAMES = collections.OrderedDict([
('FreeBSD', 'FreeBSD'),
])
# Ensure tests and the runtime environment can locate binaries in /usr/sbin
# (eg. tcpdump). We must modify the path before the @tool_required decorator is
# applied.
pathlist = os.environ['PATH'].split(os.pathsep)
for x in ('/sbin', '/usr/sbin', '/usr/local/sbin'):
if x not in pathlist:
pathlist.append(x)
os.environ['PATH'] = os.pathsep.join(pathlist)
def tool_required(command):
"""
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment