Support variables: DYLD_LIBRARY_PATH, LD_LIBRARY_PATH

This commit is contained in:
LeoHsiao 2020-10-21 20:58:51 +08:00
parent ded2b3c9a3
commit 3aedb60513
3 changed files with 29 additions and 16 deletions

View File

@ -21,15 +21,18 @@ Here is the configuration part of test cases.
class Config:
# The configuration parameters for bash test
# When you run the test cases through `python3 runner.py`, the function configure_suite() in system_tests.py will override these parameters.
exiv2_dir = os.path.normpath(os.path.join(os.path.abspath(__file__), '../../../'))
bin_dir = os.path.join(exiv2_dir, 'build/bin')
data_dir = os.path.join(exiv2_dir, 'test/data')
tmp_dir = os.path.join(exiv2_dir, 'test/tmp')
system_name = platform.system() or 'Unknown' # It could be Windows, Linux, etc.
exiv2_http = 'http://127.0.0.1'
exiv2_port = '12760'
exiv2_echo = ''
valgrind = '++'
exiv2_dir = os.path.normpath(os.path.join(os.path.abspath(__file__), '../../../'))
bin_dir = os.path.join(exiv2_dir, 'build/bin')
dyld_library_path = os.path.join(bin_dir, '../lib')
ld_library_path = os.path.join(bin_dir, '../lib')
data_dir = os.path.join(exiv2_dir, 'test/data')
tmp_dir = os.path.join(exiv2_dir, 'test/tmp')
system_name = platform.system() or 'Unknown' # It could be Windows, Linux, etc.
exiv2_http = 'http://127.0.0.1'
exiv2_port = '12760'
exiv2_echo = ''
valgrind = '++'
# verbose:
@classmethod
def init(cls):
@ -424,6 +427,8 @@ class Executer:
# set environment variables
self.env = os.environ.copy()
self.env.update({'DYLD_LIBRARY_PATH': Config.dyld_library_path})
self.env.update({'LD_LIBRARY_PATH': Config.ld_library_path})
self.env.update({'TZ': 'GMT-8'})
self.env.update(extra_env)

View File

@ -4,17 +4,23 @@ memcheck: ${ENV:valgrind}
[ENV]
exiv2_path: EXIV2_BINDIR
dyld_library_path: DYLD_LIBRARY_PATH
ld_library_path: LD_LIBRARY_PATH
exiv2_http: EXIV2_HTTP
exiv2_port: EXIV2_PORT
exiv2_echo: EXIV2_ECHO
valgrind: VALGRIND
# verbose: VERBOSE
[ENV fallback]
exiv2_path: ../build/bin
dyld_library_path: ${ENV:exiv2_path}/../lib
ld_library_path: ${ENV:exiv2_path}/../lib
exiv2_http: http://127.0.0.1
exiv2_port: 12760
exiv2_echo:
valgrind: ++
# verbose:
[paths]
exiv2: ${ENV:exiv2_path}/exiv2

View File

@ -201,13 +201,15 @@ def configure_suite(config_file):
)
# Configure the parameters for bash tests
BT.Config.bin_dir = os.path.abspath(config['ENV']['exiv2_path'])
BT.Config.data_dir = os.path.abspath(config['paths']['data_path'])
BT.Config.tmp_dir = os.path.abspath(config['paths']['tmp_path'])
BT.Config.exiv2_http = config['ENV']['exiv2_http']
BT.Config.exiv2_port = config['ENV']['exiv2_port']
BT.Config.exiv2_echo = config['ENV']['exiv2_echo']
BT.Config.valgrind = config['ENV']['valgrind']
BT.Config.bin_dir = os.path.abspath(config['ENV']['exiv2_path'])
BT.Config.dyld_library_path = os.path.abspath(config['ENV']['dyld_library_path'])
BT.Config.ld_library_path = os.path.abspath(config['ENV']['ld_library_path'])
BT.Config.data_dir = os.path.abspath(config['paths']['data_path'])
BT.Config.tmp_dir = os.path.abspath(config['paths']['tmp_path'])
BT.Config.exiv2_http = config['ENV']['exiv2_http']
BT.Config.exiv2_port = config['ENV']['exiv2_port']
BT.Config.exiv2_echo = config['ENV']['exiv2_echo']
BT.Config.valgrind = config['ENV']['valgrind']
class FileDecoratorBase(object):