diff --git a/tests/xua_unit_tests/CMakeLists.txt b/tests/xua_unit_tests/CMakeLists.txt index 9e09a11b..9487a471 100644 --- a/tests/xua_unit_tests/CMakeLists.txt +++ b/tests/xua_unit_tests/CMakeLists.txt @@ -79,12 +79,10 @@ foreach( testsourcefile ${APP_SOURCES} ) set_target_properties(${ITEM_NAME} PROPERTIES OUTPUT_NAME ${ITEM_NAME}.xe) target_compile_options(${ITEM_NAME} PRIVATE ${APP_COMPILER_FLAGS}) - - - target_include_directories(${ITEM_NAME} - PRIVATE ${APP_INCLUDES} - PRIVATE ${XUA_INCLUDES_ALL} - ) + target_include_directories(${ITEM_NAME} + PRIVATE ${APP_INCLUDES} + PRIVATE ${XUA_INCLUDES_ALL} + ) target_sources(${ITEM_NAME} PRIVATE ${APP_SRCS} diff --git a/tests/xua_unit_tests/src/hid_report_descriptor.h b/tests/xua_unit_tests/src/test_simple/hid_report_descriptor.h similarity index 100% rename from tests/xua_unit_tests/src/hid_report_descriptor.h rename to tests/xua_unit_tests/src/test_simple/hid_report_descriptor.h diff --git a/tests/xua_unit_tests/src/test_hid.c b/tests/xua_unit_tests/src/test_simple/test_hid.c similarity index 100% rename from tests/xua_unit_tests/src/test_hid.c rename to tests/xua_unit_tests/src/test_simple/test_hid.c diff --git a/tests/xua_unit_tests/wscript b/tests/xua_unit_tests/wscript index 0f162c19..da0e1fc2 100644 --- a/tests/xua_unit_tests/wscript +++ b/tests/xua_unit_tests/wscript @@ -95,6 +95,7 @@ def add_unity_runner_build_config(waf_conf, project_root_path, unity_test_path, def prepare_unity_test_for_build(waf_conf, project_root_path, unity_test_path, unity_runner_dir, unity_runner_suffix, target): + print("unity_test_path: " + str(unity_test_path)) generate_unity_runner(project_root_path, unity_test_path, unity_runner_dir, unity_runner_suffix) runner_build_flags = '' # Could extract flags from the test name @@ -107,7 +108,12 @@ def find_unity_test_paths(unity_test_dir, unity_test_prefix): Return a list of all file paths with the unity_test_prefix found in the unity_test_dir. """ - return glob.glob(os.path.join(unity_test_dir, unity_test_prefix+'*')) + file_list = [] + for root, dirs, files in os.walk(unity_test_dir): + for f in files: + if f.startswith(unity_test_prefix): + file_list.append(os.path.join(root,f)) + return file_list def find_unity_tests(unity_test_dir, unity_test_prefix): @@ -116,7 +122,7 @@ def find_unity_tests(unity_test_dir, unity_test_prefix): unity_test_prefix found in the unity_test_dir. """ unity_test_paths = find_unity_test_paths(unity_test_dir, unity_test_prefix) - return {get_test_name(path): get_file_type(path) + return {get_test_name(path): {"language": get_file_type(path), "dir": os.path.dirname(path)} for path in unity_test_paths} @@ -139,8 +145,8 @@ def generate_all_unity_runners(waf_conf, project_root_path, # TODO: can the xwaf boilerplate help here? def create_waf_contexts(configs): for trgt in TARGETS: - for test_name, test_language in configs.items(): - print(f"test_name {test_name}, test_language {test_language}") + for test_name, params in configs.items(): + print(f"test_name {test_name}, test_language {params['language']}") for ctx in (BuildContext, CleanContext): raw_context = ctx.__name__.replace('Context', '').lower() @@ -149,9 +155,10 @@ def create_waf_contexts(configs): variant = test_name + '_' + trgt #cmd = raw_context + '_' + test_name #variant = test_name - language = test_language + language = params["language"] target = trgt runner = test_name + directory = params["dir"] print(f"cmd {cmd}, variant {variant}, language {language}") @@ -161,6 +168,8 @@ UNITY_RUNNER_DIR = 'runners' UNITY_RUNNER_SUFFIX = '_Runner' UNITY_TESTS = find_unity_tests(UNITY_TEST_DIR, UNITY_TEST_PREFIX) +print("UNITY_TESTS: " + str(UNITY_TESTS)) + create_waf_contexts(UNITY_TESTS) def options(opt): @@ -175,7 +184,6 @@ def configure(conf): UNITY_RUNNER_DIR, UNITY_RUNNER_SUFFIX) conf.load('xwaf.xcommon') - def build(bld): if not bld.variant: print('Adding test runners to build queue') @@ -204,7 +212,7 @@ def build(bld): 'Unity'] makefile_opts = {} - makefile_opts['SOURCE_DIRS'] = ['src', os.path.join('runners',bld.runner)] + makefile_opts['SOURCE_DIRS'] = ['src', bld.directory, os.path.join('runners',bld.runner)] if(bld.target == 'xcoreai'): print('TARGET XCOREAI') makefile_opts['TARGET'] = ['XCORE-AI-EXPLORER'] @@ -213,6 +221,7 @@ def build(bld): makefile_opts['TARGET'] = ['XCORE-200-EXPLORER'] makefile_opts['INCLUDE_DIRS'] = ['src', + bld.directory, '../../lib_xua/api', '../../lib_xua/src/core/pdm_mics', '../../lib_xua/src/hid',