Browse Source

Tests: added Cygwin support (#18)

pull/19/head
Felipe Torrezan 2 years ago
committed by GitHub
parent
commit
69fce2d5e6
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 58
      tests/README.md
  2. 44
      tests/run-tests.sh

58
tests/README.md

@ -7,15 +7,13 @@ The `run-tests.sh` script will...
## Environment
The following GNU Bash environments were used:
- MINGW64 (e.g., https://gitforwindows.org)
- WSL2 (IAR Build Tools for Linux)
- MINGW64 (https://msys2.org)
- WSL2/Ubuntu 20.04 (IAR Build Tools for Linux)
- CYGWIN64 (https://cygwin.com)
## Instructions
- Export the `$IAR_TOOL_ROOT` environment variable.
```bash
export IAR_TOOL_ROOT=/path/to/IAR/tools/top/level
```
> __Note__ Make `$IAR_TOOL_ROOT` point to the top-level location in which all the IAR toolchains are installed.
## Environment variables
### IAR_TOOL_ROOT
Export the `$IAR_TOOL_ROOT` environment variable, pointing to the top-level location in which all the IAR toolchains are installed. (Default: not set)
| Examples | Effect |
| :---------------------------- | :-------------------------------------------------------------------- |
@ -24,6 +22,46 @@ export IAR_TOOL_ROOT=/path/to/IAR/tools/top/level
| `/c/IAR_Systems/EW/ARM/[7-9]*` | Perform tests on "Embedded Workbench for Arm" from V7 to V9. |
| `/c/IAR_Systems/EW/ARM/9.30.1` | Perform tests only using "Embedded Workbench 9.30.1". |
> __Note__ Optionally export `IAR_LMS2_SERVER_IP` if client's 1st-time license setup is required. (Applies to `-GL` and `-NW`).
### IAR_LMS2_SERVER_IP (optional)
Export the `IAR_LMS2_SERVER_IP` environment pointing to the license server, if the client's 1st-time license setup is required. Applies to the `-GL` and `-NW` products. (Default: not set)
### CMAKE_MAKE_PROGRAM (optional)
Export the `CMAKE_MAKE_PROGRAM` to specify which generator to use. (Default: `Ninja`)
### MSYSTEM
This variable is automatically set by MSYS2, MINGW64 and MINGW32. CygWin users must set this environment variable manually.
- Execute `run-tests.sh`.
Example: `export MSYSTEM=CYGWIN`
## Procedure example using __MINGW64__
The example below will test every tool found in `C:\IAR_Systems\EW` using MINGW64:
```bash
export IAR_TOOL_ROOT=/c/IAR_Systems/EW
# Extracted from a zip archive
export PATH=/c/cmake-3.25.0-x86_64/bin:$PATH
git clone https://github.com/iarsystems/cmake-tutorial ~
cd ~/cmake-tutorial/tests
./run-tests.sh
```
## Procedure example using __Ubuntu on WSL2__
The example below will test every tool found in `/opt/iarsystems` using Ubuntu (WSL2):
```bash
export IAR_TOOL_ROOT=/opt/iarsystems
git clone https://github.com/iarsystems/cmake-tutorial ~
cd ~/cmake-tutorial/tests
./run-tests.sh
```
## Procedure example using __CygWin64__
The example below will test every tool found in `C:\IAR_Systems\EW` using Cygwin:
```bash
export IAR_TOOL_ROOT=/cygdrive/c/IAR_Systems/EW
# Only required by Cygwin
export MSYSTEM=CYGWIN
# Extracted from a zip archive
export PATH=/cygdrive/c/cmake-3.25.0-x86_64/bin:$PATH
git clone https://github.com/iarsystems/cmake-tutorial ~
cd ~/cmake-tutorial/tests
./run-tests.sh
```

44
tests/run-tests.sh

@ -8,12 +8,21 @@
#
# Environment variables that can be set for this script
#
# IAR_TOOL_ROOT
# Top-level location in which the IAR toolchains are installed
# MINGW64: with the full path (e.g.,) `/c/IAR_Systems/`
# Default: /opt/iarsystems
#
# IAR_LMS2_SERVER_IP
# If defined, automatic license setup will be performed
#
# MSYSTEM
# Only required for Windows hosts (e.g., MINGW64 or CYGWIN)
# Set by default by MINGW64 (and MINGW32)
# CygWin users: must manually export the variable to CYGWIN
# (e.g., export MSYSTEM=CYGWIN)
#
BUILD_CFGS=(Debug RelWithDebInfo Release MinSizeRel)
@ -21,7 +30,7 @@ if ! ((${#IAR_TOOL_ROOT[@]})); then
IAR_TOOL_ROOT=/opt/iarsystems
fi
if [ "$MSYSTEM" = "MINGW64" ]; then
if [ ! -z "$MSYSTEM" ]; then
EXT=.exe;
fi
@ -40,14 +49,13 @@ function lms2-setup() {
fi
}
function find_icc() {
if [ "$MSYSTEM" = "MINGW64" ]; then
export CC=$(cygpath -m "${p}");
export CXX=$CC;
else
if [ -z "$MSYSTEM" ]; then
export CC="${p}";
export CXX="${p}";
else
export CC=$(cygpath -m "${p}");
export CXX=$CC;
fi
export TOOLKIT_DIR=$(dirname $(dirname $CC))
echo "Using CC: $CC";
@ -55,16 +63,16 @@ function find_icc() {
}
function find_ilink() {
if [ "$MSYSTEM" = "MINGW64" ]; then
export ASM=$(cygpath -m $(dirname ${p})/iasm${a}${EXT});
else
if [ -z "$MSYSTEM" ]; then
export ASM=$(dirname ${p})/iasm${a};
else
export ASM=$(cygpath -m $(dirname ${p})/iasm${a}${EXT});
fi
echo "Using ASM: $ASM";
}
function find_xlink() {
if [ "$MSYSTEM" = "MINGW64" ]; then
if [ ! -z "$MSYSTEM" ]; then
export ASM=$(cygpath -m $(dirname ${p})/a${a}${EXT});
else
export ASM=$(dirname ${p})/a${a};
@ -74,17 +82,19 @@ function find_xlink() {
function cmake_configure() {
rm -rf _builds;
if [ "$MSYSTEM" = "MINGW64" ]; then
CMAKE_MAKE_PRG=$(cygpath -m $(which ninja));
else
CMAKE_MAKE_PRG=$(which ninja);
# If no CMAKE_MAKE_PROGRAM is set, defaults to ninja
if [ -z "$CMAKE_MAKE_PROGRAM" ]; then
if [ -z "$MSYSTEM" ]; then
export CMAKE_MAKE_PROGRAM=$(which ninja);
else
export CMAKE_MAKE_PROGRAM=$(cygpath -m $(which ninja));
fi
fi
if [ ! $CMAKE_MAKE_PRG ]; then
echo "FATAL ERROR: Ninja not found.";
if [ ! -f $CMAKE_MAKE_PROGRAM ]; then
echo "FATAL ERROR: CMAKE_MAKE_PROGRAM not found ($CMAKE_MAKE_PROGRAM). No ninja executable found either.";
exit 1;
fi
cmake -B _builds -G "Ninja Multi-Config" \
-DCMAKE_MAKE_PROGRAM=$CMAKE_MAKE_PRG \
-DTARGET_ARCH=${a} \
-DTOOLKIT_DIR=${TOOLKIT_DIR};
if [ $? -ne 0 ]; then

Loading…
Cancel
Save