mirror of
https://github.com/lz4/lz4.git
synced 2024-11-27 03:48:08 +08:00
write liblz4 dynamic library version
requires liblz4 >= v1.7.5
This commit is contained in:
parent
aab32f454e
commit
3e2426b198
1
.gitignore
vendored
1
.gitignore
vendored
@ -25,6 +25,7 @@ _codelite/
|
||||
_codelite_lz4/
|
||||
bin/
|
||||
*.zip
|
||||
*.swp
|
||||
|
||||
# analyzers
|
||||
infer-out
|
||||
|
@ -77,6 +77,7 @@ static void roundTripTest(void* resultBuff, size_t resultBuffCapacity,
|
||||
{
|
||||
int const acceleration = 1;
|
||||
// Note : can't use LZ4_initStream(), because it's only present since v1.9.0
|
||||
MSG("Initializing LZ4_cState, of size %zu bytes \n", sizeof(LZ4_cState));
|
||||
memset(&LZ4_cState, 0, sizeof(LZ4_cState));
|
||||
{ int const cSize = LZ4_compress_fast_continue(&LZ4_cState, (const char*)srcBuff, (char*)compressedBuff, (int)srcSize, (int)compressedBuffCapacity, acceleration);
|
||||
CONTROL_MSG(cSize == 0, "Compression error !");
|
||||
@ -95,7 +96,6 @@ static void roundTripTest(void* resultBuff, size_t resultBuffCapacity,
|
||||
"Silent decoding corruption, at pos %u !!!",
|
||||
(unsigned)errorPos);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
static void roundTripCheck(const void* srcBuff, size_t srcSize)
|
||||
@ -203,7 +203,9 @@ int main(int argCount, const char** argv)
|
||||
{
|
||||
const char* const exeName = argv[0];
|
||||
int argNb = 1;
|
||||
MSG("starting abiTest: \n");
|
||||
MSG("abiTest, built binary based on API %s \n", LZ4_VERSION_STRING);
|
||||
// Note : LZ4_versionString() requires >= v1.7.5+
|
||||
MSG("currently linked to dll %s \n", LZ4_versionString());
|
||||
|
||||
assert(argCount >= 1);
|
||||
if (argCount < 2) return bad_usage(exeName);
|
||||
|
6
tests/check_liblz4_version.sh
Executable file
6
tests/check_liblz4_version.sh
Executable file
@ -0,0 +1,6 @@
|
||||
#!/usr/bin/env sh
|
||||
set -e
|
||||
|
||||
# written as a script shell, because pipe management in python is horrible
|
||||
ldd $1 | grep liblz4
|
||||
|
@ -29,13 +29,17 @@ def proc(cmd_args, pipe=True, env=False):
|
||||
# we want the address sanitizer for abi tests
|
||||
env["MOREFLAGS"] = "-fsanitize=address"
|
||||
if pipe:
|
||||
subproc = subprocess.Popen(cmd_args,
|
||||
stdout=subprocess.PIPE,
|
||||
stderr=subprocess.PIPE,
|
||||
env = env)
|
||||
s = subprocess.Popen(cmd_args,
|
||||
stdout=subprocess.PIPE,
|
||||
stderr=subprocess.PIPE,
|
||||
env = env)
|
||||
else:
|
||||
subproc = subprocess.Popen(cmd_args, env = env)
|
||||
return subproc.communicate()
|
||||
s = subprocess.Popen(cmd_args, env = env)
|
||||
r = s.communicate()
|
||||
if s.poll() != 0:
|
||||
print(' s.poll() = ', s.poll())
|
||||
sys.exit(1)
|
||||
return r
|
||||
|
||||
def make(args, pipe=True, env=False):
|
||||
return proc([make_cmd] + ['-j'] + ['V=1'] + args, pipe, env)
|
||||
@ -68,10 +72,11 @@ if __name__ == '__main__':
|
||||
git(['clone', repo_url, clone_dir])
|
||||
|
||||
# Retrieve all release tags
|
||||
print('Retrieve all release tags :')
|
||||
print('Retrieve release tags >= v1.7.5 :')
|
||||
os.chdir(clone_dir)
|
||||
tags = [head] + get_git_tags()
|
||||
print(tags);
|
||||
tags = [x for x in tags if (x >= 'v1.7.5')]
|
||||
print(tags)
|
||||
|
||||
# Build all versions of liblz4
|
||||
# note : naming scheme only works on Linux
|
||||
@ -103,7 +108,8 @@ if __name__ == '__main__':
|
||||
build_env["LDLIBS"] = "-llz4"
|
||||
# we use asan to detect any out-of-bound read or write
|
||||
build_env["MOREFLAGS"] = "-fsanitize=address"
|
||||
os.remove('abiTest')
|
||||
if os.path.isfile('abiTest'):
|
||||
os.remove('abiTest')
|
||||
make(['abiTest'], env=build_env)
|
||||
proc(['./abiTest'] + ['README.md'])
|
||||
|
||||
@ -112,7 +118,7 @@ if __name__ == '__main__':
|
||||
run_env = os.environ.copy()
|
||||
run_env["LD_LIBRARY_PATH"] = 'abiTests/{}/lib'.format(tag)
|
||||
# check we are linking to the right library version at run time
|
||||
proc(['ldd'] + ['./abiTest'], pipe=False, env=run_env)
|
||||
proc(['./check_liblz4_version.sh'] + ['./abiTest'], pipe=False, env=run_env)
|
||||
# now run with mismatched library version
|
||||
proc(['./abiTest'] + test_dat_src, pipe=False, env=run_env)
|
||||
|
||||
@ -122,6 +128,7 @@ if __name__ == '__main__':
|
||||
print('******************************')
|
||||
|
||||
for tag in tags:
|
||||
print(' ')
|
||||
print('building using older lib ', tag)
|
||||
build_env = os.environ.copy()
|
||||
if tag != head:
|
||||
@ -139,7 +146,7 @@ if __name__ == '__main__':
|
||||
run_env = os.environ.copy()
|
||||
run_env["LD_LIBRARY_PATH"] = '../lib'
|
||||
# check we are linking to the right library version at run time
|
||||
proc(['ldd'] + ['./abiTest'], pipe=False, env=run_env)
|
||||
proc(['./check_liblz4_version.sh'] + ['./abiTest'], pipe=False, env=run_env)
|
||||
# now run with mismatched library version
|
||||
proc(['./abiTest'] + test_dat_src, pipe=False, env=run_env)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user