Move system_tests.runTest() and system_tests.verbose_version() to system_tests.BT
This commit is contained in:
@@ -9,8 +9,10 @@ import shlex
|
||||
import shutil
|
||||
import subprocess
|
||||
import time
|
||||
from http import server
|
||||
from urllib import request
|
||||
import sys
|
||||
from http import server
|
||||
from urllib import request
|
||||
import system_tests
|
||||
|
||||
|
||||
"""
|
||||
@@ -685,3 +687,66 @@ def runTestCase(num, img):
|
||||
out += diff('iii', 'ttt')
|
||||
return str(out)
|
||||
|
||||
def runTest(cmd):
|
||||
"""
|
||||
Executes a command in the shell.
|
||||
Add this function at PR <https://github.com/Exiv2/exiv2/pull/1475> .
|
||||
"""
|
||||
exiv2=system_tests.exiv2
|
||||
|
||||
if sys.platform == 'win32':
|
||||
args = cmd
|
||||
else:
|
||||
args = shlex.split(cmd)
|
||||
|
||||
# Updat PATH, LD_LIBRARY_PATH and DYLD_LIBRARY_PATH
|
||||
key = "PATH"
|
||||
bin_dir = os.path.dirname(exiv2)
|
||||
if key in os.environ:
|
||||
os.environ[key] = os.path.join(bin_dir, os.environ[key])
|
||||
else:
|
||||
os.environ[key] = bin_dir
|
||||
|
||||
for key in ["LD_LIBRARY_PATH", "DYLD_LIBRARY_PATH"]:
|
||||
lib_dir = os.path.join(os.path.dirname(os.path.dirname(exiv2)), 'lib')
|
||||
if key in os.environ:
|
||||
os.environ[key] = os.path.join(lib_dir, os.environ[key])
|
||||
else:
|
||||
os.environ[key] = lib_dir
|
||||
|
||||
# Execute the command
|
||||
try:
|
||||
p = subprocess.Popen(args, stdout=subprocess.PIPE, shell=False)
|
||||
stdout, stderr = p.communicate()
|
||||
if p.returncode != 0:
|
||||
print('{} returncode = {}'.format(cmd, p.returncode))
|
||||
# Split the output by newline
|
||||
out = stdout.decode('utf-8').replace('\r', '').rstrip('\n').split('\n')
|
||||
except:
|
||||
print('** {} died **'.format(cmd))
|
||||
|
||||
return out
|
||||
|
||||
|
||||
def verbose_version(verbose=False):
|
||||
""" Get the key-value pairs of Exiv2 verbose version """
|
||||
vv = {}
|
||||
exiv2=system_tests.exiv2
|
||||
lines = runTest(exiv2 + ' --verbose --version')
|
||||
for line in lines:
|
||||
kv = line.rstrip().split('=')
|
||||
if len(kv) == 2:
|
||||
key, val = kv
|
||||
if not key in vv:
|
||||
vv[key] = val
|
||||
elif isinstance(vv[key], list):
|
||||
vv[key].append(val)
|
||||
else:
|
||||
vv[key] = [vv[key]]
|
||||
if verbose:
|
||||
for key in vv:
|
||||
val = vv[key]
|
||||
if isinstance(val, list):
|
||||
val = '[ {} +{} ]'.format(val[0], len(val) - 1)
|
||||
print(key.ljust(20), val)
|
||||
return vv
|
||||
|
||||
@@ -1,9 +1,10 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
import system_tests
|
||||
# test needs system_tests.vv.enable_bmff=1
|
||||
vv=system_tests.verbose_version()
|
||||
|
||||
# test needs system_tests.BT.vv.enable_bmff=1
|
||||
enable_bmff = 'enable_bmff'
|
||||
vv=system_tests.BT.verbose_version()
|
||||
bSkip = not (enable_bmff in vv and vv[enable_bmff] == '1')
|
||||
|
||||
class pr_1475_avif_avif(metaclass=system_tests.CaseMeta):
|
||||
|
||||
@@ -1,8 +1,9 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
import system_tests
|
||||
# test needs system_tests.vv.enable_bmff=1
|
||||
vv=system_tests.verbose_version()
|
||||
|
||||
# test needs system_tests.BT.vv.enable_bmff=1
|
||||
vv=system_tests.BT.verbose_version()
|
||||
enable_bmff = 'enable_bmff'
|
||||
bSkip = not (enable_bmff in vv and vv[enable_bmff] == '1')
|
||||
|
||||
|
||||
@@ -1,8 +1,9 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
import system_tests
|
||||
# test needs system_tests.vv.enable_bmff=1
|
||||
vv=system_tests.verbose_version()
|
||||
|
||||
# test needs system_tests.BT.vv.enable_bmff=1
|
||||
vv=system_tests.BT.verbose_version()
|
||||
enable_bmff = 'enable_bmff'
|
||||
bSkip = not (enable_bmff in vv and vv[enable_bmff] == '1')
|
||||
|
||||
|
||||
@@ -981,64 +981,3 @@ def check_no_ASAN_UBSAN_errors(self, i, command, got_stderr, expected_stderr):
|
||||
self.assertNotIn(UBSAN_MSG, got_stderr)
|
||||
self.assertNotIn(ASAN_MSG, got_stderr)
|
||||
|
||||
|
||||
def runTest(cmd):
|
||||
"""
|
||||
Executes a command in the shell.
|
||||
Add this function at PR <https://github.com/Exiv2/exiv2/pull/1475> .
|
||||
"""
|
||||
if sys.platform == 'win32':
|
||||
args = cmd
|
||||
else:
|
||||
args = shlex.split(cmd)
|
||||
|
||||
# Updat PATH, LD_LIBRARY_PATH and DYLD_LIBRARY_PATH
|
||||
key = "PATH"
|
||||
bin_dir = os.path.dirname(exiv2)
|
||||
if key in os.environ:
|
||||
os.environ[key] = os.path.join(bin_dir, os.environ[key])
|
||||
else:
|
||||
os.environ[key] = bin_dir
|
||||
|
||||
for key in ["LD_LIBRARY_PATH", "DYLD_LIBRARY_PATH"]:
|
||||
lib_dir = os.path.join(os.path.dirname(os.path.dirname(exiv2)), 'lib')
|
||||
if key in os.environ:
|
||||
os.environ[key] = os.path.join(lib_dir, os.environ[key])
|
||||
else:
|
||||
os.environ[key] = lib_dir
|
||||
|
||||
# Execute the command
|
||||
try:
|
||||
p = subprocess.Popen(args, stdout=subprocess.PIPE, shell=False)
|
||||
stdout, stderr = p.communicate()
|
||||
if p.returncode != 0:
|
||||
print('{} returncode = {}'.format(cmd, p.returncode))
|
||||
# Split the output by newline
|
||||
out = stdout.decode('utf-8').replace('\r', '').rstrip('\n').split('\n')
|
||||
except:
|
||||
print('** {} died **'.format(cmd))
|
||||
|
||||
return out
|
||||
|
||||
|
||||
def verbose_version(verbose=False):
|
||||
""" Get the key-value pairs of Exiv2 verbose version """
|
||||
vv = {}
|
||||
lines = runTest(exiv2 + ' --verbose --version')
|
||||
for line in lines:
|
||||
kv = line.rstrip().split('=')
|
||||
if len(kv) == 2:
|
||||
key, val = kv
|
||||
if not key in vv:
|
||||
vv[key] = val
|
||||
elif isinstance(vv[key], list):
|
||||
vv[key].append(val)
|
||||
else:
|
||||
vv[key] = [vv[key]]
|
||||
if verbose:
|
||||
for key in vv:
|
||||
val = vv[key]
|
||||
if isinstance(val, list):
|
||||
val = '[ {} +{} ]'.format(val[0], len(val) - 1)
|
||||
print(key.ljust(20), val)
|
||||
return vv
|
||||
|
||||
Reference in New Issue
Block a user