Skip to content

Commit

Permalink
rework tests with platforms sub-folder
Browse files Browse the repository at this point in the history
  • Loading branch information
ilg-ul committed Nov 30, 2023
1 parent 2aef49a commit 822e464
Show file tree
Hide file tree
Showing 96 changed files with 147 additions and 146 deletions.
6 changes: 3 additions & 3 deletions tests/cmake/tests-main.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -70,11 +70,11 @@ endif()
include("cmake/common-options.cmake")

# Set `xpack_dependencies_folders` with the platform specific dependencies.
include("platform-${PLATFORM_NAME}/cmake/dependencies-folders.cmake")
include("platforms/${PLATFORM_NAME}/cmake/dependencies-folders.cmake")

# Define `micro-os-plus::platform` with the plaform definitions,
# common to all tests.
include("platform-${PLATFORM_NAME}/cmake/platform-options.cmake")
include("platforms/${PLATFORM_NAME}/cmake/platform-options.cmake")

# Iterate the platform dependencies and `add_subdirectory()`.
xpack_add_dependencies_subdirectories("${xpack_dependencies_folders}" "xpacks-bin")
Expand All @@ -90,6 +90,6 @@ add_subdirectory(".." "top-bin")

# Add the platform specific targets and tests.
# For consistency, the binaries are created in the `platform-bin` folder.
add_subdirectory("platform-${PLATFORM_NAME}" "platform-bin")
add_subdirectory("platforms/${PLATFORM_NAME}" "platform-bin")

# -----------------------------------------------------------------------------
2 changes: 1 addition & 1 deletion tests/include/micro-os-plus/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@

#if defined(MICRO_OS_PLUS_TRACE)

// Defined in platform-native.
// Defined in platforms/native.
// #define MICRO_OS_PLUS_INTEGER_TRACE_PRINTF_BUFFER_ARRAY_SIZE 500

// #define MICRO_OS_PLUS_TRACE_UTILS_LISTS_CONSTRUCT
Expand Down
6 changes: 3 additions & 3 deletions tests/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -83,13 +83,13 @@ subdir('meson/common-options')
subdir('xpacks/@micro-os-plus/build-helper/meson/enable-all-warnings')

# Since the order of processing is significative, include it in dependencies.
# subdir('platform-'+ xpack_platform_name + '/meson/platform-options')
# subdir('platforms/'+ xpack_platform_name + '/meson/platform-options')

# -----------------------------------------------------------------------------
# Dependencies #

# Set `xpack_dependencies_folders` with the platform specific dependencies.
subdir('platform-'+ xpack_platform_name + '/meson/dependencies-folders')
subdir('platforms/'+ xpack_platform_name + '/meson/dependencies-folders')

foreach dep: xpack_dependencies_folders
message('Adding ' + dep + '...')
Expand All @@ -106,6 +106,6 @@ subdir('top')
# Platform specifics #

# Include the platform specific targets and tests.
subdir('platform-' + xpack_platform_name)
subdir('platforms/' + xpack_platform_name)

# -----------------------------------------------------------------------------
6 changes: 3 additions & 3 deletions tests/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 3 additions & 2 deletions tests/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,8 @@
"commandCMakeClean": "cmake --build {{ properties.buildFolderRelativePathPosix }} --target clean",
"commandCMakePerformTests": "cd {{ properties.buildFolderRelativePath }} && ctest -V",
"commandMesonPrepare": "meson setup --backend ninja --buildtype {{ properties.buildType }} -D platform-name={{ properties.platformName }} {{ properties.buildFolderRelativePathPosix }} .",
"commandMesonPrepareWithToolchain": "meson setup --backend ninja --buildtype {{ properties.buildType }} -D platform-name={{ properties.platformName }} --native-file xpacks/@micro-os-plus/build-helper/meson/toolchains/{{ properties.toolchainFileName }} --native-file platform-{{ properties.platformName }}/meson/native.ini {{ properties.buildFolderRelativePathPosix }} .",
"commandMesonPrepareCross": "meson setup --backend ninja --buildtype {{ properties.buildType }} -D platform-name={{ properties.platformName }} --cross xpacks/@micro-os-plus/build-helper/meson/toolchains/{{ properties.toolchainFileName }} --cross platform-{{ properties.platformName }}/meson/cross.ini {{ properties.buildFolderRelativePathPosix }} .",
"commandMesonPrepareWithToolchain": "meson setup --backend ninja --buildtype {{ properties.buildType }} -D platform-name={{ properties.platformName }} --native-file xpacks/@micro-os-plus/build-helper/meson/toolchains/{{ properties.toolchainFileName }} --native-file platforms/{{ properties.platformName }}/meson/native.ini {{ properties.buildFolderRelativePathPosix }} .",
"commandMesonPrepareCross": "meson setup --backend ninja --buildtype {{ properties.buildType }} -D platform-name={{ properties.platformName }} --cross xpacks/@micro-os-plus/build-helper/meson/toolchains/{{ properties.toolchainFileName }} --cross platforms/{{ properties.platformName }}/meson/cross.ini {{ properties.buildFolderRelativePathPosix }} .",
"commandMesonReconfigure": "meson setup --reconfigure {{ properties.buildFolderRelativePathPosix }} .",
"commandMesonBuild": "meson compile -C {{ properties.buildFolderRelativePathPosix }}",
"commandMesonBuildVerbose": "meson compile -C {{ properties.buildFolderRelativePathPosix }} --verbose",
Expand All @@ -51,6 +51,7 @@
},
"actions": {
"deep-clean": "del-cli build node_modules xpacks package-lock.json",
"": "",
"install": [
"npm install",
"xpm install",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

# -----------------------------------------------------------------------------

message(VERBOSE "Processing 'tests/platform-native'...")
message(VERBOSE "Processing 'tests/platforms/native'...")

# -----------------------------------------------------------------------------

Expand All @@ -29,7 +29,7 @@ function(add_test_executable name)

# Application folders.
target_include_directories(${name} PRIVATE
"../include"
"../../include"
)

message(VERBOSE "A+ -I tests/include")
Expand All @@ -38,7 +38,7 @@ function(add_test_executable name)

# Application sources.
target_sources(${name} PRIVATE
"../src/${name}.cpp"
"../../src/${name}.cpp"
)

message(VERBOSE "A+ tests/src/${name}.cpp")
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# platform-native
# platforms/native

Support files for building application to run as native processes.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,13 @@

# -----------------------------------------------------------------------------

message(VERBOSE "Including tests/${PLATFORM_NAME}/platform-options.cmake...")
message(VERBOSE "Including tests/platforms/${PLATFORM_NAME}/platform-options.cmake...")

# -----------------------------------------------------------------------------

# Validate.
if(NOT DEFINED xpack_platform_compile_definition)
message(FATAL_ERROR "Define xpack_platform_compile_definition in ${PLATFORM_NAME}/cmake/dependencies.cmake")
message(FATAL_ERROR "Define xpack_platform_compile_definition in platforms/${PLATFORM_NAME}/cmake/dependencies.cmake")
endif()

# -----------------------------------------------------------------------------
Expand Down Expand Up @@ -56,7 +56,7 @@ add_library(platform-native-interface INTERFACE EXCLUDE_FROM_ALL)
target_include_directories(platform-native-interface INTERFACE

# This file is included from the tests folder.
"platform-${PLATFORM_NAME}/include"
"platforms/${PLATFORM_NAME}/include"
)

target_sources(platform-native-interface INTERFACE
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

# -----------------------------------------------------------------------------

message('Processing tests/platform-native...')
message('Processing tests/platforms/native...')

# -----------------------------------------------------------------------------

Expand All @@ -36,11 +36,11 @@ foreach name : test_names
_local_link_with = []

_local_include_directories += [
'../include',
'../../include',
]

_local_sources += [
'../src/' + name + '.cpp',
'../../src/' + name + '.cpp',
]

_local_compile_c_args += platform_native_dependency_compile_c_args
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ xpack_dependencies_folders = [
xpack_build_folder_relative_path + '/xpacks/@micro-os-plus/architecture-synthetic-posix',

# (platform) architecture-synthetic-posix
'platform-native/meson/platform-options',
'platforms/native/meson/platform-options',
]

# -----------------------------------------------------------------------------
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,11 @@

# -----------------------------------------------------------------------------

message('Including tests/' + xpack_platform_name + '/meson.build...')
message('Including tests/platforms/' + xpack_platform_name + '/meson.build...')

# -----------------------------------------------------------------------------

assert(is_variable('xpack_platform_compile_definition'), 'Define xpack_platform_compile_definition in ' + xpack_platform_name + '/meson.build')
assert(is_variable('xpack_platform_compile_definition'), 'Define xpack_platform_compile_definition in platforms/' + xpack_platform_name + '/meson.build')

# -----------------------------------------------------------------------------

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

# -----------------------------------------------------------------------------

message(VERBOSE "Processing 'tests/platform-qemu-cortex-a15'...")
message(VERBOSE "Processing 'tests/platforms/qemu-cortex-a15'...")

# -----------------------------------------------------------------------------

Expand All @@ -36,16 +36,16 @@ function(add_test_executable name)
)

# Include folders.
# `tests/platform-qemu-cortex-a15/include` was added globally.
# `tests/platforms/qemu-cortex-a15/include` was added globally.
target_include_directories(${name} PRIVATE
"../include"
"../../include"
)

message(VERBOSE "A+ -I tests/include")

# Application sources.
target_sources(${name} PRIVATE
"../src/${name}.cpp"
"../../src/${name}.cpp"
)

message(VERBOSE "A+ tests/src/${name}.cpp")
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# platform-qemu-cortex-a15
# platforms/qemu-cortex-a15

Support files for building application to run on the QEMU "virt"
emulated board with "cortex-a15" CPU.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,13 @@

# -----------------------------------------------------------------------------

message(VERBOSE "Including tests/${PLATFORM_NAME}/platform-options.cmake...")
message(VERBOSE "Including tests/platforms/${PLATFORM_NAME}/platform-options.cmake...")

# -----------------------------------------------------------------------------

# Validate.
if(NOT DEFINED xpack_platform_compile_definition)
message(FATAL_ERROR "Define xpack_platform_compile_definition in ${PLATFORM_NAME}/cmake/dependencies.cmake")
message(FATAL_ERROR "Define xpack_platform_compile_definition in platforms/${PLATFORM_NAME}/cmake/dependencies.cmake")
endif()

# -----------------------------------------------------------------------------
Expand All @@ -33,7 +33,7 @@ add_library(platform-qemu-cortex-a15-interface INTERFACE EXCLUDE_FROM_ALL)
target_include_directories(platform-qemu-cortex-a15-interface INTERFACE

# This file is included from the tests folder.
"platform-${PLATFORM_NAME}/include"
"platforms/${PLATFORM_NAME}/include"
)

target_sources(platform-qemu-cortex-a15-interface INTERFACE
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

# -----------------------------------------------------------------------------

message('Processing tests/platform-qemu-cortex-a15...')
message('Processing tests/platforms/qemu-cortex-a15...')

# -----------------------------------------------------------------------------

Expand Down Expand Up @@ -51,11 +51,11 @@ foreach name : test_names
# ---------------------------------------------------------------------------

_local_include_directories += [
'../include',
'../../include',
]

_local_sources += [
'../src/' + name + '.cpp',
'../../src/' + name + '.cpp',
]

_local_compile_c_args += platform_qemu_cortex_a15_dependency_compile_c_args
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ xpack_dependencies_folders = [
# +(arm_cmsis_core_m, devices_cortexa, startup) >devices_qemu_aarch32
xpack_build_folder_relative_path + '/xpacks/@micro-os-plus/devices-qemu-aarch32',

'platform-qemu-cortex-a15/meson/platform-options',
'platforms/qemu-cortex-a15/meson/platform-options',
]

# -----------------------------------------------------------------------------
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,11 @@

# -----------------------------------------------------------------------------

message('Including tests/' + xpack_platform_name + '/meson.build...')
message('Including tests/platforms/' + xpack_platform_name + '/meson.build...')

# -----------------------------------------------------------------------------

assert(is_variable('xpack_platform_compile_definition'), 'Define xpack_platform_compile_definition in ' + xpack_platform_name + '/meson.build')
assert(is_variable('xpack_platform_compile_definition'), 'Define xpack_platform_compile_definition in platforms/' + xpack_platform_name + '/meson.build')

# -----------------------------------------------------------------------------

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

# -----------------------------------------------------------------------------

message(VERBOSE "Processing 'tests/platform-qemu-cortex-a72'...")
message(VERBOSE "Processing 'tests/platforms/qemu-cortex-a72'...")

# -----------------------------------------------------------------------------

Expand All @@ -36,16 +36,16 @@ function(add_test_executable name)
)

# Include folders.
# `tests/platform-qemu-aarch64/include` was added globally.
# `tests/platforms/qemu-aarch64/include` was added globally.
target_include_directories(${name} PRIVATE
"../include"
"../../include"
)

message(VERBOSE "A+ -I tests/include")

# Application sources.
target_sources(${name} PRIVATE
"../src/${name}.cpp"
"../../src/${name}.cpp"
)

message(VERBOSE "A+ tests/src/${name}.cpp")
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# platform-qemu-cortex-a72
# platforms/qemu-cortex-a72

Support files for building application to run on the QEMU "virt"
emulated board with "cortex-a72" CPU.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,13 @@

# -----------------------------------------------------------------------------

message(VERBOSE "Including tests/${PLATFORM_NAME}/platform-options.cmake...")
message(VERBOSE "Including tests/platforms/${PLATFORM_NAME}/platform-options.cmake...")

# -----------------------------------------------------------------------------

# Validate.
if(NOT DEFINED xpack_platform_compile_definition)
message(FATAL_ERROR "Define xpack_platform_compile_definition in ${PLATFORM_NAME}/cmake/dependencies.cmake")
message(FATAL_ERROR "Define xpack_platform_compile_definition in platforms/${PLATFORM_NAME}/cmake/dependencies.cmake")
endif()

# -----------------------------------------------------------------------------
Expand All @@ -33,7 +33,7 @@ add_library(platform-qemu-cortex-a72-interface INTERFACE EXCLUDE_FROM_ALL)
target_include_directories(platform-qemu-cortex-a72-interface INTERFACE

# This file is included from the tests folder.
"platform-${PLATFORM_NAME}/include"
"platforms/${PLATFORM_NAME}/include"
)

target_sources(platform-qemu-cortex-a72-interface INTERFACE
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

# -----------------------------------------------------------------------------

message('Processing tests/platform-qemu-cortex-a72...')
message('Processing tests/platforms/qemu-cortex-a72...')

# -----------------------------------------------------------------------------

Expand Down Expand Up @@ -51,11 +51,11 @@ foreach name : test_names
# ---------------------------------------------------------------------------

_local_include_directories += [
'../include',
'../../include',
]

_local_sources += [
'../src/' + name + '.cpp',
'../../src/' + name + '.cpp',
]

_local_compile_c_args += platform_qemu_cortex_a72_dependency_compile_c_args
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ xpack_dependencies_folders = [
# +(arm_cmsis_core_m, devices_cortexa, startup) >devices_qemu_aarch64
xpack_build_folder_relative_path + '/xpacks/@micro-os-plus/devices-qemu-aarch64',

'platform-qemu-cortex-a72/meson/platform-options',
'platforms/qemu-cortex-a72/meson/platform-options',
]

# -----------------------------------------------------------------------------
Loading

0 comments on commit 822e464

Please sign in to comment.