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 ## Environment
The following GNU Bash environments were used: The following GNU Bash environments were used:
- MINGW64 (e.g., https://gitforwindows.org) - MINGW64 (https://msys2.org)
- WSL2 (IAR Build Tools for Linux) - WSL2/Ubuntu 20.04 (IAR Build Tools for Linux)
- CYGWIN64 (https://cygwin.com)
## Instructions ## Environment variables
- Export the `$IAR_TOOL_ROOT` environment variable. ### IAR_TOOL_ROOT
```bash Export the `$IAR_TOOL_ROOT` environment variable, pointing to the top-level location in which all the IAR toolchains are installed. (Default: not set)
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.
| Examples | Effect | | 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/[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". | | `/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 # Environment variables that can be set for this script
#
# IAR_TOOL_ROOT # IAR_TOOL_ROOT
# Top-level location in which the IAR toolchains are installed # Top-level location in which the IAR toolchains are installed
# MINGW64: with the full path (e.g.,) `/c/IAR_Systems/` # MINGW64: with the full path (e.g.,) `/c/IAR_Systems/`
# Default: /opt/iarsystems # Default: /opt/iarsystems
#
# IAR_LMS2_SERVER_IP # IAR_LMS2_SERVER_IP
# If defined, automatic license setup will be performed # 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) BUILD_CFGS=(Debug RelWithDebInfo Release MinSizeRel)
@ -21,7 +30,7 @@ if ! ((${#IAR_TOOL_ROOT[@]})); then
IAR_TOOL_ROOT=/opt/iarsystems IAR_TOOL_ROOT=/opt/iarsystems
fi fi
if [ "$MSYSTEM" = "MINGW64" ]; then if [ ! -z "$MSYSTEM" ]; then
EXT=.exe; EXT=.exe;
fi fi
@ -40,14 +49,13 @@ function lms2-setup() {
fi fi
} }
function find_icc() { function find_icc() {
if [ "$MSYSTEM" = "MINGW64" ]; then if [ -z "$MSYSTEM" ]; then
export CC=$(cygpath -m "${p}");
export CXX=$CC;
else
export CC="${p}"; export CC="${p}";
export CXX="${p}"; export CXX="${p}";
else
export CC=$(cygpath -m "${p}");
export CXX=$CC;
fi fi
export TOOLKIT_DIR=$(dirname $(dirname $CC)) export TOOLKIT_DIR=$(dirname $(dirname $CC))
echo "Using CC: $CC"; echo "Using CC: $CC";
@ -55,16 +63,16 @@ function find_icc() {
} }
function find_ilink() { function find_ilink() {
if [ "$MSYSTEM" = "MINGW64" ]; then if [ -z "$MSYSTEM" ]; then
export ASM=$(cygpath -m $(dirname ${p})/iasm${a}${EXT});
else
export ASM=$(dirname ${p})/iasm${a}; export ASM=$(dirname ${p})/iasm${a};
else
export ASM=$(cygpath -m $(dirname ${p})/iasm${a}${EXT});
fi fi
echo "Using ASM: $ASM"; echo "Using ASM: $ASM";
} }
function find_xlink() { function find_xlink() {
if [ "$MSYSTEM" = "MINGW64" ]; then if [ ! -z "$MSYSTEM" ]; then
export ASM=$(cygpath -m $(dirname ${p})/a${a}${EXT}); export ASM=$(cygpath -m $(dirname ${p})/a${a}${EXT});
else else
export ASM=$(dirname ${p})/a${a}; export ASM=$(dirname ${p})/a${a};
@ -74,17 +82,19 @@ function find_xlink() {
function cmake_configure() { function cmake_configure() {
rm -rf _builds; rm -rf _builds;
if [ "$MSYSTEM" = "MINGW64" ]; then # If no CMAKE_MAKE_PROGRAM is set, defaults to ninja
CMAKE_MAKE_PRG=$(cygpath -m $(which ninja)); if [ -z "$CMAKE_MAKE_PROGRAM" ]; then
else if [ -z "$MSYSTEM" ]; then
CMAKE_MAKE_PRG=$(which ninja); export CMAKE_MAKE_PROGRAM=$(which ninja);
else
export CMAKE_MAKE_PROGRAM=$(cygpath -m $(which ninja));
fi
fi fi
if [ ! $CMAKE_MAKE_PRG ]; then if [ ! -f $CMAKE_MAKE_PROGRAM ]; then
echo "FATAL ERROR: Ninja not found."; echo "FATAL ERROR: CMAKE_MAKE_PROGRAM not found ($CMAKE_MAKE_PROGRAM). No ninja executable found either.";
exit 1; exit 1;
fi fi
cmake -B _builds -G "Ninja Multi-Config" \ cmake -B _builds -G "Ninja Multi-Config" \
-DCMAKE_MAKE_PROGRAM=$CMAKE_MAKE_PRG \
-DTARGET_ARCH=${a} \ -DTARGET_ARCH=${a} \
-DTOOLKIT_DIR=${TOOLKIT_DIR}; -DTOOLKIT_DIR=${TOOLKIT_DIR};
if [ $? -ne 0 ]; then if [ $? -ne 0 ]; then

Loading…
Cancel
Save