Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Release scripts to validate ThreadX port #254

Merged
merged 1 commit into from
Apr 23, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
.vscode/
_deps/
build/
Debug/
CMakeFiles/
CMakeScripts/
CMakeLists.txt.user
Expand All @@ -11,4 +12,5 @@ cmake_install.cmake
install_manifest.txt
compile_commands.json
CTestTestfile.cmake
*.dep

1 change: 1 addition & 0 deletions test/ports/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
log
119 changes: 119 additions & 0 deletions test/ports/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,119 @@
# Azure RTOS ThreadX CI/CD system

**The old Azure RTOS ThreadX CI/CD script and README are preserved with the .old extension**

This directory contains a collection of files to execute test for continuos integration and continuous delivery of Azure RTOS ThreadX.

This directory contains documentation, scripts and auxiliary files (expected test results, etc).

The Azure RTOS ThreadX CI/CD system can be used in various scenarios:
* Setting up the environment for a toolchain
* Cleaning up the local repository
* Building locally or on the pipeline
* Smoke testing examples (on the native IDE)
* Testing an example on a generic architecture simulator (like ARM FVP)
* Running the certification test suite on a port
* Testing locally during development
* Testing automatically on the DevOps pipeline
* Testing ports
* Testing examples
* Testing one or more ports
* Verifying the ports build
* Verifying that examples one or more ports during development

There are several operations that can be performed by the CI/CD system:
* CheckCompliance: perform compliance checks (only debug configurations, valid comments, ...)
* StartCLI: start a CLI environment.
* RealClean: remove all generated files.
* Clean: remove all build generated files.
* Build: compile examples using using the toolchain IDE, project, workspace, etc.
* Test: smoke test examples with the toolchain simulator.
* PlatformTest: test examples using the platform simulator, like the ARM FVP platform.
* CertificationTest: test examples using the certification test suite.
* HardwareTest: test examples using attached hardware.

## azrtos_cicd.ps1
This is the main entry point for Azure RTOS ThreadX CI/CD operations.
To get detailed usage information use the PowerShell Get-Help command passing this script as a parameter.
This file outputs a summary to the screen and detailed log file with all output to files located in the default log directory or a directory specified in the script command line.

## azrtos_cicd.csv
This is the default database of ports, examples and corresponding data and scripts. The database is a CSV file that can be modified or updated by the user. Other databases can be specified on the command line when calling the script.

## -StartCLI
This option will open a CLI with the environment appropriately set for it. It will have the command aliases "realclean", "clean", "build" and "test" set to the corresponding scripts. Useful for developing and debugging.

## Examples:

These examples assume the PowerShell script is called from the Windows Command Interpreter. For calling the script from the PowerShell prompt, remove the leading `pwsh -Command`.

`pwsh -Command Get-Help .\azrtos_cicd.ps1`
Show the help embedded in the script.

`pwsh -Command .\azrtos_cicd.ps1 -clean`
This cleans all examples in the default database.

`pwsh -Command .\azrtos_cicd.ps1 -build`
This builds all examples in the default database.

`pwsh -Command .\azrtos_cicd.ps1 -test`
This runs the bassic tests on all examples in the default database.

`pwsh -Command .\azrtos_cicd.ps1 -clean -build -test`
This first cleans, then builds and finally runs tests on all examples in the default database.

`pwsh -Command .\azrtos_cicd.ps1 -MatchName 'Modules' -build`
This builds all ThreadX Modules examples.

`pwsh -Command .\azrtos_cicd.ps1 -MatchName 'Modules','IAR' -build`
This builds all examples in the default database that have names matching the string 'Modules' and 'IAR'.

`pwsh -Command .\azrtos_cicd.ps1 -MatchName 'Cortex M4','ARM compiler v6' -StartCli`
This opens a CLI with set environment for all examples in the default database that have names matching the 'Cortex M4' and 'ARM compiler v6'.

`pwsh -Command .\azrtos_cicd.ps1 -MatchKeywords 'TX ','ARM compiler v6','Cortex M' -clean`
This cleans all examples matching all the keywords; these are ThreadX (not ThreadX modules) Cortex M (0/3/4/7/23/33/...) for ARM compiler v6.

`pwsh -Command .\azrtos_cicd.ps1 -MatchKeywords 'TX ','ARM compiler v6','Cortex M' -build`
Like the example above, but it builds the matching examples.

`pwsh -Command .\azrtos_cicd.ps1 -MatchKeywords 'TX ','Cortex M7' -StartCLI`
Start CLI environments for all ThreadX for Cortex M7 examples (IAR, ARM compiler v5, ARM compiler v6, GHS, ...).
From these you can use the commands 'realclean','clean','build','test' to call these operations and see the output on the console.

Here is a list of commonly used commands that you can directly cut/paste into your command line:
`pwsh -Command Get-Help .\azrtos_cicd.ps1`
`pwsh -Command .\azrtos_cicd.ps1 -clean`
`pwsh -Command .\azrtos_cicd.ps1 -build`
`pwsh -Command .\azrtos_cicd.ps1 -test`
`pwsh -Command .\azrtos_cicd.ps1 -clean -build -test`
`pwsh -Command .\azrtos_cicd.ps1 -MatchKeywords 'TX ','ARM compiler v6','Cortex M' -clean`
`pwsh -Command .\azrtos_cicd.ps1 -MatchKeywords 'TX ','IAR','Cortex M' -clean`
`pwsh -Command .\azrtos_cicd.ps1 -MatchKeywords 'TX ','GCC','Cortex M' -clean`
`pwsh -Command .\azrtos_cicd.ps1 -MatchKeywords 'TX ','ARM compiler v6','Cortex M' -build`
`pwsh -Command .\azrtos_cicd.ps1 -MatchKeywords 'TX ','IAR','Cortex M' -build`
`pwsh -Command .\azrtos_cicd.ps1 -MatchKeywords 'TX ','GCC','Cortex M' -build`
`pwsh -Command .\azrtos_cicd.ps1 -MatchKeywords 'TXM','ARM compiler v6','Cortex M' -clean`
`pwsh -Command .\azrtos_cicd.ps1 -MatchKeywords 'TXM','IAR','Cortex M' -clean`
`pwsh -Command .\azrtos_cicd.ps1 -MatchKeywords 'TXM','GCC','Cortex M' -clean`
`pwsh -Command .\azrtos_cicd.ps1 -MatchKeywords 'TXM','ARM compiler v6','Cortex M' -build`
`pwsh -Command .\azrtos_cicd.ps1 -MatchKeywords 'TXM','IAR','Cortex M' -build`
`pwsh -Command .\azrtos_cicd.ps1 -MatchKeywords 'TXM','GCC','Cortex M' -build`
`pwsh -Command .\azrtos_cicd.ps1 -MatchKeywords 'TX ','ARM compiler v6','SMP' -clean`
`pwsh -Command .\azrtos_cicd.ps1 -MatchKeywords 'TX ','IAR','SMP' -clean`
`pwsh -Command .\azrtos_cicd.ps1 -MatchKeywords 'TX ','GCC','SMP' -clean`
`pwsh -Command .\azrtos_cicd.ps1 -MatchKeywords 'TX ','ARM compiler v6','SMP' -build`
`pwsh -Command .\azrtos_cicd.ps1 -MatchKeywords 'TX ','IAR','SMP' -build`
`pwsh -Command .\azrtos_cicd.ps1 -MatchKeywords 'TX ','GCC','SMP' -build`
`pwsh -Command .\azrtos_cicd.ps1 -MatchKeywords 'TX ','ARM compiler v6','ARMv8-A' -build`
`pwsh -Command .\azrtos_cicd.ps1 -MatchKeywords 'TX ','GCC','ARMv8-A' -build`
`pwsh -Command .\azrtos_cicd.ps1 -MatchKeywords 'TX ','ARM compiler v6','Cortex-A35' -clean`
`pwsh -Command .\azrtos_cicd.ps1 -MatchKeywords 'TX ','GCC','Cortex-A35' -clean`
`pwsh -Command .\azrtos_cicd.ps1 -MatchKeywords 'TX ','ARM compiler v6','Cortex-A35' -build`
`pwsh -Command .\azrtos_cicd.ps1 -MatchKeywords 'TX ','GCC','Cortex-A35' -build`
`pwsh -Command .\azrtos_cicd.ps1 -MatchKeywords 'TX ','ARM compiler v6','Cortex-A35' -test`
`pwsh -Command .\azrtos_cicd.ps1 -MatchKeywords 'TX ','GCC','Cortex-A35' -test`
`pwsh -Command .\azrtos_cicd.ps1 -MatchKeywords 'ARM compiler v6','Cortex-A35' -clean -build -test`
`pwsh -Command .\azrtos_cicd.ps1 -MatchKeywords 'GCC','Cortex-A35' -clean -build -test`

For more examples look at the help embedded in the script.
30 changes: 30 additions & 0 deletions test/ports/README.old.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# Azure RTOS CI/CD (old version)

**There is a new version of this script written in PowerSell and now named azrtos_cicd.ps1. Use that script instead. The documentation for that script is in the file README.md and the embedded help of that script.**

This directory contains a collection of files to execute several automated operations on all ports.
These are batch scripts and auxiliary files (expected test results, etc).

## These operations include:
* Build: compile the port example.
* Clean: remove all build generated files.
* Test: test the example with the toolchain simulator.
* Test_FVP: test the example using the ARM FVP platform.

## azrtos_cicd.old.bat
This is the main entry point for operations to be performed on several examples at the same time.
This script can be called from any location, it will automatically perform the requested operations on the examples of the repository where it is located.
This file outputs a summary to the screen and a detailed log file with all the output called azrtos_do.all.log
Call this scripts without parameters to get usage information.
The script parameters are case insensitive.

## Examples:

`azrtos_cicd.old.bat build tx ghs iar`
This will build all GHS and IAR example projects.

`azrtos_cicd.old.bat clean tx all`
This cleans all ThreadX examples

`azrtos_cicd.old.bat build txm iar`
This builds all ThreadX Modules IAR examples.
17 changes: 17 additions & 0 deletions test/ports/azrtos_build_tx_ac5.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
@ECHO OFF

ECHO INFO: Building %CD%...

CALL build_threadx.bat
IF NOT EXIST tx.a (
ECHO ERROR: ThreadX library build failed.
EXIT /B 1
)

CALL build_threadx_sample.bat
IF NOT EXIST sample_threadx.axf (
ECHO ERROR: ThreadX example build failed.
EXIT /B 1
)

ECHO INFO: Build completed successfully!
23 changes: 23 additions & 0 deletions test/ports/azrtos_build_tx_arm_ds.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
@ECHO OFF

ECHO INFO: Building %CD%...

IF EXIST workspace GOTO WORKSPACE_EXISTS

ECHO INFO: Initializing the workspace...
%AZRTOS_ARM_DS_IDEC% -nosplash --launcher.suppressErrors -application org.eclipse.cdt.managedbuilder.core.headlessbuild -data .\workspace -import .\tx -import .\sample_threadx
IF %ERRORLEVEL% NEQ 0 (
ECHO ERROR: failed to initialize the workspace
EXIT /B 1
) ELSE (
ECHO INFO: Workspace initialized.
)

:WORKSPACE_EXISTS
%AZRTOS_ARM_DS_IDEC% -nosplash --launcher.suppressErrors -application org.eclipse.cdt.managedbuilder.core.headlessbuild -data .\workspace -build tx -build sample_threadx
IF %ERRORLEVEL% NEQ 0 (
ECHO ERROR: build failed.
EXIT /B 1
)

ECHO INFO: Build completed successfully!
11 changes: 11 additions & 0 deletions test/ports/azrtos_build_tx_ghs.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
@ECHO OFF

ECHO INFO: Building %CD%...

%AZRTOS_GHS_COMP_GBUILD% -top azure_rtos_workspace.gpj tx.a txe.a sample_threadx sample_threadx_el
IF %ERRORLEVEL% NEQ 0 (
echo ERROR: build failed.
EXIT /B 1
)

ECHO INFO: Build completed successfully!
17 changes: 17 additions & 0 deletions test/ports/azrtos_build_tx_gnu.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
@ECHO OFF

ECHO INFO: Building %CD%...

CALL build_threadx.bat
IF NOT EXIST tx.a (
ECHO ERROR: ThreadX library build failed.
EXIT /B 1
)

CALL build_threadx_sample.bat
IF NOT EXIST sample_threadx.out (
ECHO ERROR: ThreadX example build failed.
EXIT /B 1
)

ECHO INFO: Build completed successfully!
17 changes: 17 additions & 0 deletions test/ports/azrtos_build_tx_iar.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
@ECHO OFF

ECHO INFO: Building %CD%...

%AZRTOS_IAR_BUILD% tx.ewp -make Debug -log all -parallel %NUMBER_OF_PROCESSORS%
IF %ERRORLEVEL% NEQ 0 (
ECHO ERROR: failed to build tx.ewp
EXIT /B 1
)

%AZRTOS_IAR_BUILD% sample_threadx.ewp -make Debug -log all -parallel %NUMBER_OF_PROCESSORS%
IF %ERRORLEVEL% NEQ 0 (
ECHO ERROR: failed to build sample_threadx.ewp
EXIT /B 1
)

ECHO INFO: Build completed successfully!
24 changes: 24 additions & 0 deletions test/ports/azrtos_build_tx_mdk4.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
@ECHO OFF

ECHO INFO: Building %CD%...

ECHO INFO: Building ThreadX_Library...
DEL out.txt 2> NUL
START /wait %AZRTOS_KEIL_UV% -j0 -b ThreadX_Library.uvproj -o out.txt
IF %ERRORLEVEL% GEQ 2 GOTO BUILD_ERROR
TYPE out.txt 2> NUL

ECHO INFO: Building ThreadX_Demo...
DEL out.txt 2> NUL
START /wait %AZRTOS_KEIL_UV% -j0 -b ThreadX_Demo.uvproj -o out.txt
IF %ERRORLEVEL% GEQ 2 GOTO BUILD_ERROR
TYPE out.txt 2> NUL

DEL out.txt 2> NUL
ECHO INFO: Build completed successfully!
EXIT /B 0

:BUILD_ERROR
TYPE out.txt 2> NUL
ECHO ERROR: build failed.
EXIT /B 1
24 changes: 24 additions & 0 deletions test/ports/azrtos_build_tx_mdk5.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
@ECHO OFF

ECHO INFO: Building %CD%...

ECHO INFO: Building ThreadX_Library...
DEL out.txt 2> NUL
START /wait %AZRTOS_KEIL_UV% -j0 -b ThreadX_Library.uvprojx -o out.txt
IF %ERRORLEVEL% GEQ 2 GOTO BUILD_ERROR
TYPE out.txt 2> NUL

ECHO INFO: Building ThreadX_Demo...
DEL out.txt 2> NUL
START /wait %AZRTOS_KEIL_UV% -j0 -b ThreadX_Demo.uvprojx -o out.txt
IF %ERRORLEVEL% GEQ 2 GOTO BUILD_ERROR
TYPE out.txt 2> NUL

DEL out.txt 2> NUL
ECHO INFO: Build completed successfully!
EXIT /B 0

:BUILD_ERROR
TYPE out.txt 2> NUL
ECHO ERROR: build failed.
EXIT /B 1
45 changes: 45 additions & 0 deletions test/ports/azrtos_build_tx_tz_mdk5.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
@ECHO OFF

ECHO INFO: Building %CD%...

ECHO INFO: Building ThreadX_Library...
PUSHD .
DEL out.txt 2> NUL
%AZRTOS_KEIL_UV% -j0 -b ThreadX_Library.uvprojx -o out.txt
IF %ERRORLEVEL% NEQ 0 GOTO ERR_BUILD
TYPE out.txt 2> NUL
POPD

ECHO INFO: Building demo_secure_zone...
PUSHD demo_secure_zone
DEL out.txt 2> NUL
%AZRTOS_KEIL_UV% -j0 -b demo_secure_zone.uvprojx -o out.txt
IF %ERRORLEVEL% NEQ 0 GOTO ERR_BUILD
TYPE out.txt 2> NUL
POPD

ECHO INFO: Building demo_threadx_non-secure_zone...
PUSHD demo_threadx_non-secure_zone
DEL out.txt 2> NUL
%AZRTOS_KEIL_UV% -j0 -b demo_threadx_non-secure_zone.uvprojx -o out.txt
IF %ERRORLEVEL% NEQ 0 GOTO ERR_BUILD
TYPE out.txt 2> NUL
POPD

REM ECHO Building ThreadX_Demo...
REM PUSHD demo_threadx_non-secure_zone
REM DEL out.txt 2> NUL
REM REM %AZRTOS_KEIL_UV% -j0 -b ThreadX_Demo.uvproj -o out.txt
REM IF %ERRORLEVEL% NEQ 0 GOTO ERR_BUILD
REM TYPE out.txt 2>NUL
REM POPD

DEL out.txt 2> NUL
ECHO INFO: Build completed successfully!
EXIT /B 0

:ERR_BUILD
TYPE out.txt 2> NUL
POPD
echo ERROR: build failed.
EXIT /B 1
35 changes: 35 additions & 0 deletions test/ports/azrtos_build_txm_ac5.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
@ECHO OFF

ECHO INFO: Building %CD%...

CALL build_threadx.bat
IF NOT EXIST tx.a (
ECHO ERROR: ThreadX library build failed.
EXIT /B 1
)

CALL build_threadx_demo.bat
IF NOT EXIST sample_threadx.axf (
ECHO ERROR: ThreadX example build failed.
EXIT /B 1
)

CALL build_threadx_module_library.bat
IF NOT EXIST txm.a (
ECHO ERROR: ThreadX module library build failed.
EXIT /B 1
)

CALL build_threadx_module_demo.bat
IF NOT EXIST sample_threadx_module.axf (
ECHO ERROR: ThreadX module example build failed.
EXIT /B 1
)

CALL build_threadx_module_manager_demo.bat
IF NOT EXIST sample_threadx_module_manager.axf (
ECHO ERROR: ThreadX module manager example build failed.
EXIT /B 1
)

ECHO INFO: Build completed successfully!
Loading