summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--.gitignore1
-rw-r--r--tests/abiTest.c6
-rwxr-xr-xtests/check_liblz4_version.sh6
-rw-r--r--tests/test-lz4-abi.py29
4 files changed, 29 insertions, 13 deletions
diff --git a/.gitignore b/.gitignore
index 05120f8..ed02057 100644
--- a/.gitignore
+++ b/.gitignore
@@ -25,6 +25,7 @@ _codelite/
_codelite_lz4/
bin/
*.zip
+*.swp
# analyzers
infer-out
diff --git a/tests/abiTest.c b/tests/abiTest.c
index c637511..423dc1f 100644
--- a/tests/abiTest.c
+++ b/tests/abiTest.c
@@ -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);
diff --git a/tests/check_liblz4_version.sh b/tests/check_liblz4_version.sh
new file mode 100755
index 0000000..9304204
--- /dev/null
+++ b/tests/check_liblz4_version.sh
@@ -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
+
diff --git a/tests/test-lz4-abi.py b/tests/test-lz4-abi.py
index 378f62f..e194ce2 100644
--- a/tests/test-lz4-abi.py
+++ b/tests/test-lz4-abi.py
@@ -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)