UT prapare update
**CMake lists**: link Zlib; include libs for UT during compilation. **prapare script**: add path to regular ocf_env files; ignore 'memcpy' functions when copied to wrappers. **cleaning policy**: update of some functions for proper use of atomics. Signed-off-by: Slawomir_Jankowski <slawomir.jankowski@intel.com>
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
#!/usr/bin/env python3.6
|
||||
#!/usr/bin/env python3
|
||||
|
||||
#
|
||||
# Copyright(c) 2012-2018 Intel Corporation
|
||||
@@ -42,6 +42,7 @@ class UnitTestsSourcesGenerator(object):
|
||||
script_dir_abs_path = ""
|
||||
|
||||
main_UT_dir = ""
|
||||
main_env_dir = ""
|
||||
main_tested_dir = ""
|
||||
|
||||
ctags_path = ""
|
||||
@@ -70,6 +71,7 @@ class UnitTestsSourcesGenerator(object):
|
||||
self.set_ctags_path()
|
||||
|
||||
self.set_main_UT_dir()
|
||||
self.set_main_env_dir()
|
||||
self.set_main_tested_dir()
|
||||
|
||||
self.test_catalogues_list = tests_config.DIRECTORIES_WITH_TESTS_LIST
|
||||
@@ -141,7 +143,7 @@ class UnitTestsSourcesGenerator(object):
|
||||
|
||||
def get_autowrap_file_path(self, test_file_path):
|
||||
wrap_file_path = test_file_path.rsplit('.', 1)[0]
|
||||
wrap_file_path = wrap_file_path + "_generated_warps.c"
|
||||
wrap_file_path = wrap_file_path + "_generated_wraps.c"
|
||||
return wrap_file_path
|
||||
|
||||
def prepare_autowraps(self, test_file_path, preprocessed_file_path):
|
||||
@@ -158,7 +160,10 @@ class UnitTestsSourcesGenerator(object):
|
||||
with open(preprocessed_file_path) as f:
|
||||
code = f.readlines()
|
||||
for function in functions_to_wrap:
|
||||
if function.startswith("env_") or function.startswith("bug"):
|
||||
if function.startswith("env_") or function.startswith("bug") \
|
||||
or function.startswith("memcpy"):
|
||||
# added memcpy function to list of ignored functions
|
||||
# because this is macro
|
||||
continue
|
||||
for tag in tags_list:
|
||||
if function in tag:
|
||||
@@ -171,7 +176,7 @@ class UnitTestsSourcesGenerator(object):
|
||||
wrap_file_path = self.get_main_UT_dir() + self.get_autowrap_file_path(test_file_path)
|
||||
|
||||
with open(wrap_file_path, "w") as f:
|
||||
f.write("/* This is file is generated by UT framework */\n")
|
||||
f.write("/* This file is generated by UT framework */\n")
|
||||
for wrap in wrap_list:
|
||||
f.write(wrap + "\n")
|
||||
|
||||
@@ -655,6 +660,9 @@ class UnitTestsSourcesGenerator(object):
|
||||
def get_main_UT_dir(self):
|
||||
return os.path.normpath(self.main_UT_dir) + os.sep
|
||||
|
||||
def get_main_env_dir(self):
|
||||
return os.path.normpath(self.main_env_dir) + os.sep
|
||||
|
||||
def get_main_tested_dir(self):
|
||||
return os.path.normpath(self.main_tested_dir) + os.sep
|
||||
|
||||
@@ -673,6 +681,17 @@ class UnitTestsSourcesGenerator(object):
|
||||
def get_includes_to_copy_dict(self):
|
||||
return self.includes_to_copy_dict
|
||||
|
||||
def set_main_env_dir(self):
|
||||
main_env_dir = os.path.normpath(os.path.normpath(self.get_script_dir_path()
|
||||
+ os.sep
|
||||
+ tests_config.
|
||||
MAIN_DIRECTORY_OF_ENV_FILES))
|
||||
if not os.path.isdir(main_env_dir):
|
||||
print("Given path to main env directory is wrong!")
|
||||
sys.exit(1)
|
||||
|
||||
self.main_env_dir = main_env_dir
|
||||
|
||||
def set_main_UT_dir(self):
|
||||
main_UT_dir = os.path.normpath(os.path.normpath(self.get_script_dir_path()
|
||||
+ os.sep
|
||||
|
Reference in New Issue
Block a user