#234 Check for test-relevant executables early in suite
Merged 5 years ago by rharwood. Opened 5 years ago by rharwood.
rharwood/gssproxy check_arg  into  master

file modified
+14
@@ -4,12 +4,21 @@ 

  import argparse

  import importlib

  import signal

+ import subprocess

  import sys

  import traceback

  

  import testlib

  from testlib import *

  

+ def check_exec(name):

+     env = {'PATH': '/sbin:/bin:/usr/sbin:/usr/bin'}

+     ret = subprocess.call(["which", name], stdout=subprocess.DEVNULL, env=env)

+     if ret != 0:

+         print(f"Executable '{name}' not found in {env['PATH']}",

+               file=sys.stderr)

+         exit(1)

+ 

  def parse_args():

      parser = argparse.ArgumentParser(description='GSS-Proxy Tests Environment')

      parser.add_argument('--path', default='%s/testdir' % os.getcwd(),
@@ -40,6 +49,11 @@ 

  def runtests_main(testfiles):

      args = parse_args()

  

+     for e in ["bash", "pkg-config", "zcat", "kinit", "krb5kdc", "kdb5_util",

+              "kadmin.local", "kdb5_ldap_util", "slapd", "slapadd",

+               "ldapmodify", "valgrind"]:

+         check_exec(e)

+ 

      testdir = args['path']

      if os.path.exists(testdir):

          shutil.rmtree(testdir)

This prevents, for instance, mysterious failures when valgrind isn't
installed.

Signed-off-by: Robbie Harwood rharwood@redhat.com

Heh:
Executable 'krb5kdc' not found in PATH!

rebased onto faf2e40

5 years ago

Fun fact: sbin is in the path on systems I configure.

(Rebased.)

Commit f59040a fixes this pull-request

Pull-Request has been merged by rharwood

5 years ago