mirror of
https://github.com/lz4/lz4.git
synced 2024-11-27 11:53:59 +08:00
abiTests fixes
This commit is contained in:
parent
a467d7eb33
commit
48db0b23e4
@ -11,7 +11,6 @@ import glob
|
|||||||
import subprocess
|
import subprocess
|
||||||
import filecmp
|
import filecmp
|
||||||
import os
|
import os
|
||||||
import platform
|
|
||||||
import shutil
|
import shutil
|
||||||
import sys
|
import sys
|
||||||
import hashlib
|
import hashlib
|
||||||
@ -27,7 +26,7 @@ head = 'v999'
|
|||||||
def proc(cmd_args, pipe=True, env=False):
|
def proc(cmd_args, pipe=True, env=False):
|
||||||
if env == False:
|
if env == False:
|
||||||
env = os.environ.copy()
|
env = os.environ.copy()
|
||||||
print("Executing command {} in directory {}".format(cmd_args, os.getcwd()))
|
print("Executing command {} with env {}".format(cmd_args, env))
|
||||||
if pipe:
|
if pipe:
|
||||||
s = subprocess.Popen(cmd_args,
|
s = subprocess.Popen(cmd_args,
|
||||||
stdout=subprocess.PIPE,
|
stdout=subprocess.PIPE,
|
||||||
@ -45,9 +44,11 @@ def proc(cmd_args, pipe=True, env=False):
|
|||||||
def make(args, pipe=True, env=False):
|
def make(args, pipe=True, env=False):
|
||||||
if env == False:
|
if env == False:
|
||||||
env = os.environ.copy()
|
env = os.environ.copy()
|
||||||
# we want the address sanitizer for abi tests
|
# we want the address sanitizer for abi tests
|
||||||
env["CFLAGS"] = "-fsanitize=address"
|
if 'CFLAGS' in env:
|
||||||
env["LDFLAGS"] = "-fsanitize=address"
|
env["CFLAGS"] += " -fsanitize=address"
|
||||||
|
if 'LDFLAGS' in env:
|
||||||
|
env["LDFLAGS"] += " -fsanitize=address"
|
||||||
return proc([make_cmd] + ['-j'] + ['V=1'] + ['DEBUGFLAGS='] + args, pipe, env)
|
return proc([make_cmd] + ['-j'] + ['V=1'] + ['DEBUGFLAGS='] + args, pipe, env)
|
||||||
|
|
||||||
def git(args, pipe=True):
|
def git(args, pipe=True):
|
||||||
@ -65,10 +66,8 @@ def sha1_of_file(filepath):
|
|||||||
return hashlib.sha1(f.read()).hexdigest()
|
return hashlib.sha1(f.read()).hexdigest()
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
|
if sys.platform == "darwin":
|
||||||
# Note: the test doesn't work on macOS
|
print("!!! Warning: this test is not validated for macos !!!")
|
||||||
if platform.system() == 'Darwin': # Darwin is the system name for macOS
|
|
||||||
print('warning : this test is not validated for macos !')
|
|
||||||
|
|
||||||
error_code = 0
|
error_code = 0
|
||||||
base_dir = os.getcwd() + '/..' # /path/to/lz4
|
base_dir = os.getcwd() + '/..' # /path/to/lz4
|
||||||
@ -115,8 +114,7 @@ if __name__ == '__main__':
|
|||||||
os.chdir(lib_dir)
|
os.chdir(lib_dir)
|
||||||
make(['clean'])
|
make(['clean'])
|
||||||
build_env = os.environ.copy()
|
build_env = os.environ.copy()
|
||||||
build_env["CFLAGS"] = march + " -fsanitize=address"
|
build_env["CFLAGS"] = "-O1 " + march
|
||||||
build_env["LDFLAGS"] = "-fsanitize=address"
|
|
||||||
make(['liblz4'], env=build_env)
|
make(['liblz4'], env=build_env)
|
||||||
|
|
||||||
print(' ')
|
print(' ')
|
||||||
@ -127,8 +125,8 @@ if __name__ == '__main__':
|
|||||||
# Start with matching version : should be no problem
|
# Start with matching version : should be no problem
|
||||||
build_env = os.environ.copy()
|
build_env = os.environ.copy()
|
||||||
# we use asan to detect any out-of-bound read or write
|
# we use asan to detect any out-of-bound read or write
|
||||||
build_env["CFLAGS"] = march + " -fsanitize=address"
|
build_env["CFLAGS"] = "-O1 " + march
|
||||||
build_env["LDFLAGS"] = "-L../lib -fsanitize=address"
|
build_env["LDFLAGS"] = "-L../lib"
|
||||||
build_env["LDLIBS"] = "-llz4"
|
build_env["LDLIBS"] = "-llz4"
|
||||||
if os.path.isfile('abiTest'):
|
if os.path.isfile('abiTest'):
|
||||||
os.remove('abiTest')
|
os.remove('abiTest')
|
||||||
@ -157,13 +155,12 @@ if __name__ == '__main__':
|
|||||||
build_env = os.environ.copy()
|
build_env = os.environ.copy()
|
||||||
if tag != head:
|
if tag != head:
|
||||||
build_env["CPPFLAGS"] = '-IabiTests/{}/lib'.format(tag)
|
build_env["CPPFLAGS"] = '-IabiTests/{}/lib'.format(tag)
|
||||||
build_env["LDFLAGS"] = '-LabiTests/{}/lib'.format(tag)
|
build_env["LDFLAGS"] = '-LabiTests/{}/lib'.format(tag)
|
||||||
else:
|
else:
|
||||||
build_env["CPPFLAGS"] = '-I../lib'
|
build_env["CPPFLAGS"] = '-I../lib'
|
||||||
build_env["LDFLAGS"] = '-L../lib'
|
build_env["LDFLAGS"] = '-L../lib'
|
||||||
build_env["LDLIBS"] = "-llz4"
|
build_env["LDLIBS"] = "-llz4"
|
||||||
build_env["CFLAGS"] = march + " -fsanitize=address"
|
build_env["CFLAGS"] = "-O1 " + march
|
||||||
build_env["LDFLAGS"] = "-fsanitize=address"
|
|
||||||
os.remove('abiTest')
|
os.remove('abiTest')
|
||||||
make(['abiTest'], pipe=False, env=build_env)
|
make(['abiTest'], pipe=False, env=build_env)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user