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

Rationalize Travis builds #3218

Merged
Merged
Show file tree
Hide file tree
Changes from 19 commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
97bea01
all.sh: run selftest in the full config and with ASan
gilles-peskine-arm Apr 23, 2020
60f267b
all.sh: make the arm-gcc cross-compiler prefix configurable
gilles-peskine-arm Apr 25, 2020
c9cdd21
Travis: don't test with both gcc and clang
gilles-peskine-arm Apr 21, 2020
d0f543a
Travis: split the build into three parallel jobs
gilles-peskine-arm Apr 21, 2020
b49a457
Travis: move doxygen dependencies into the "sanity" job
gilles-peskine-arm Apr 23, 2020
a38f368
Travis: run Pylint
gilles-peskine-arm Apr 25, 2020
3c7ffd7
Travis: call all.sh for sanity checks
gilles-peskine-arm Apr 21, 2020
dc56675
Travis: call all.sh for the default-configuration build
gilles-peskine-arm Apr 23, 2020
a2d3ec2
Travis: replace "default configuration by "full configuration"
gilles-peskine-arm Apr 25, 2020
a5ced5b
Travis: install gnutls-bin for all jobs
gilles-peskine-arm Apr 25, 2020
5dcfb94
Travis: call all depends_* tests
gilles-peskine-arm Apr 25, 2020
f2f39dd
Travis: add a baremetal build
gilles-peskine-arm Apr 25, 2020
129d041
Travis: add a build on macOS
gilles-peskine-arm Apr 25, 2020
af387e0
check-files: support Windows .bat files
gilles-peskine-arm Apr 25, 2020
a4a8f04
Add a simple build script for Windows with Visual Studio
gilles-peskine-arm Apr 25, 2020
0402510
Travis: add a build with Visual Studio on Windows
gilles-peskine-arm Apr 25, 2020
23d249a
Travis: Windows: target Visual Studio 2017
gilles-peskine-arm Apr 26, 2020
b97a044
Travis: Windows: install Python 3 and run generate_psa_constants.py
gilles-peskine-arm Apr 26, 2020
10cb160
Travis: rebalance the Linux builds
gilles-peskine-arm Apr 26, 2020
6d06134
Rename --arm-gcc-prefix to --arm-none-eabi-gcc-prefix
gilles-peskine-arm Apr 30, 2020
6537588
all.sh: build_arm_none_eabi_gcc: do optimize
gilles-peskine-arm Apr 30, 2020
6e2fb86
all.sh: add a Cortex-M0+ build
gilles-peskine-arm Apr 30, 2020
18487f6
all.sh: on arm builds (GCC or Arm Compiler), show the code size
gilles-peskine-arm Apr 30, 2020
907211d
Travis: do both a Cortex-A build and a Cortex-M0+ build
gilles-peskine-arm Apr 30, 2020
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
73 changes: 52 additions & 21 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,28 +1,60 @@
language: c
compiler:
- clang
- gcc
compiler: gcc
sudo: false
cache: ccache

script:
- tests/scripts/recursion.pl library/*.c
- tests/scripts/check-generated-files.sh
- tests/scripts/check-doxy-blocks.pl
- tests/scripts/check-names.sh
- tests/scripts/check-files.py
- tests/scripts/doxygen.sh
- cmake -D CMAKE_BUILD_TYPE:String="Check" .
- make
- make test
- programs/test/selftest
- OSSL_NO_DTLS=1 tests/compat.sh
- tests/ssl-opt.sh -e '\(DTLS\|SCSV\).*openssl'
- tests/scripts/test-ref-configs.pl
- tests/scripts/curves.pl
- tests/scripts/key-exchanges.pl
jobs:
include:
- name: basic checks and reference configurations
addons:
apt:
packages:
- gnutls-bin
- doxygen
- graphviz
- gcc-arm-none-eabi
- libnewlib-arm-none-eabi
language: python # Needed to get pip for Python 3
python: 3.5 # version from Ubuntu 16.04
install:
- pip install pylint==2.4.4
script:
- tests/scripts/all.sh -k 'check_*'
- tests/scripts/all.sh -k test_default_out_of_box
- tests/scripts/all.sh -k build_arm_none_eabi_gcc_arm5vte # baremetal
- tests/scripts/test-ref-configs.pl

- name: full configuration
script:
- tests/scripts/all.sh -k test_full_cmake_gcc_asan

- name: check compilation guards
script:
- tests/scripts/all.sh -k 'test_depends_*' 'build_key_exchanges'

- name: macOS
os: osx
compiler: clang
script:
- tests/scripts/all.sh -k test_default_out_of_box

- name: Windows
os: windows
before_install:
- choco install python --version=3.5.4
env:
# Add the directory where the Choco package goes
- PATH=/c/Python35:/c/Python35/Scripts:$PATH
script:
- type python; python --version
- python scripts/generate_psa_constants.py
# Logs appear out of sequence on Windows. Give time to catch up.
- sleep 5
- scripts/windows_msbuild.bat v141 # Visual Studio 2017

after_failure:
- tests/scripts/travis-log-failure.sh

env:
global:
- SEED=1
Expand All @@ -31,8 +63,7 @@ env:
addons:
apt:
packages:
- doxygen
- graphviz
- gnutls-bin
coverity_scan:
project:
name: "ARMmbed/mbedtls"
Expand Down
20 changes: 20 additions & 0 deletions scripts/windows_msbuild.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
@rem Build and test Mbed TLS with Visual Studio using msbuild.
@rem Usage: windows_msbuild [RETARGET]
@rem RETARGET: version of Visual Studio to emulate
@rem https://docs.microsoft.com/en-us/cpp/build/how-to-modify-the-target-framework-and-platform-toolset

@rem These parameters are hard-coded for now.
set "arch=x64" & @rem "x86" or "x64"
set "cfg=Release" & @rem "Debug" or "Release"
set "vcvarsall=C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\VC\Auxiliary\Build\vcvarsall.bat"

if not "%~1"=="" set "retarget=,PlatformToolset=%1"

@rem If the %USERPROFILE%\Source directory exists, then running
@rem vcvarsall.bat will silently change the directory to that directory.
@rem Setting the VSCMD_START_DIR environment variable causes it to change
@rem to that directory instead.
set "VSCMD_START_DIR=%~dp0\..\visualc\VS2010"

"%vcvarsall%" x64 && ^
msbuild /t:Rebuild /p:Configuration=%cfg%%retarget% /m mbedTLS.sln
30 changes: 20 additions & 10 deletions tests/scripts/all.sh
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,7 @@ pre_initialize_variables () {
: ${OUT_OF_SOURCE_DIR:=./mbedtls_out_of_source_build}
: ${ARMC5_BIN_DIR:=/usr/bin}
: ${ARMC6_BIN_DIR:=/usr/bin}
: ${ARM_GCC_PREFIX:=arm-none-eabi-}

# if MAKEFLAGS is not set add the -j option to speed up invocations of make
if [ -z "${MAKEFLAGS+set}" ]; then
Expand Down Expand Up @@ -203,6 +204,8 @@ General options:
-k|--keep-going Run all tests and report errors at the end.
-m|--memory Additional optional memory tests.
--append-outcome Append to the outcome file (if used).
--arm-gcc-prefix=<string> Prefix for gcc as a cross-compiler for arm
(default: "${ARM_GCC_PREFIX}")
--armcc Run ARM Compiler builds (on by default).
--except Exclude the COMPONENTs listed on the command line,
instead of running only those.
Expand Down Expand Up @@ -335,6 +338,7 @@ pre_parse_command_line () {
while [ $# -gt 0 ]; do
case "$1" in
--append-outcome) append_outcome=1;;
--arm-gcc-prefix) shift; ARM_GCC_PREFIX="$1";;
--armcc) no_armcc=;;
--armc5-bin-dir) shift; ARMC5_BIN_DIR="$1";;
--armc6-bin-dir) shift; ARMC6_BIN_DIR="$1";;
Expand Down Expand Up @@ -547,7 +551,7 @@ pre_check_tools () {
esac

case " $RUN_COMPONENTS " in
*_arm_none_eabi_gcc[_\ ]*) check_tools "arm-none-eabi-gcc";;
*_arm_none_eabi_gcc[_\ ]*) check_tools "${ARM_GCC_PREFIX}gcc";;
esac

case " $RUN_COMPONENTS " in
Expand Down Expand Up @@ -645,7 +649,7 @@ component_test_default_out_of_box () {
make test

msg "selftest: make, default config (out-of-box)" # ~10s
programs/test/selftest
if_build_succeeded programs/test/selftest

export MBEDTLS_TEST_OUTCOME_FILE="$SAVE_MBEDTLS_TEST_OUTCOME_FILE"
unset SAVE_MBEDTLS_TEST_OUTCOME_FILE
Expand All @@ -659,6 +663,9 @@ component_test_default_cmake_gcc_asan () {
msg "test: main suites (inc. selftests) (ASan build)" # ~ 50s
make test

msg "test: selftest (ASan build)" # ~ 10s
if_build_succeeded programs/test/selftest

msg "test: ssl-opt.sh (ASan build)" # ~ 1 min
if_build_succeeded tests/ssl-opt.sh

Expand All @@ -678,6 +685,9 @@ component_test_full_cmake_gcc_asan () {
msg "test: main suites (inc. selftests) (full config, ASan build)"
make test

msg "test: selftest (ASan build)" # ~ 10s
if_build_succeeded programs/test/selftest

msg "test: ssl-opt.sh (full config, ASan build)"
if_build_succeeded tests/ssl-opt.sh

Expand Down Expand Up @@ -1566,36 +1576,36 @@ component_test_no_64bit_multiplication () {
}

component_build_arm_none_eabi_gcc () {
msg "build: arm-none-eabi-gcc, make" # ~ 10s
msg "build: ${ARM_GCC_PREFIX}gcc, make" # ~ 10s
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Because of this change, change the name of the component? component_build_arm_gcc(_cross_compiler) ?
Same comment for the components below.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure, and I'd prefer to defer such a change to when we know how we'll use this feature. If we'll use this feature.

I initially did this because I thought it would be necessary to use a different compiler on Travis to avoid having to install arm-none-eabi-gcc. But it turned out that the compiler we're using on Jenkins is from Ubuntu, so it was straightforward to add this compiler. I left the commit in because even if it isn't necessary now, it could be useful later.

There are two ways this can be used: to substitute a different platform, or to use a compiler installed at a location outside $PATH. For the first use case, we should have different component names. For the second use case, the component should keep its name. My current preference is to declare that the second use case is the one that's primarily intended, and so keep the component names.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well, I am not really convinced. If ${ARM_GCC_PREFIX} is set up to a value that has nothing to do with arm_none_eabi_gcc then the component has nothing to do with arm_none_eabi_gcc but is called component_build_arm_none_eabi_gcc () which is confusing to me.
Regarding the second use case, making the path to arm_none_eabi_gcc configurable would be enough it seems.
I understand that we are not completely committed to the second use case thus the idea to let it not very well defined yet. But we then go from a situation where things are clear to a situation where things are unclear: the component is named component_build_arm_none_eabi_gcc () but it may not use at all arm_none_eabi_gcc compiler.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How about renaming ARM_GCC_PREFIX to ARM_NONE_EABI_GCC_PREFIX?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, it would be fine by me with this renaming.

scripts/config.py baremetal
make CC=arm-none-eabi-gcc AR=arm-none-eabi-ar LD=arm-none-eabi-ld CFLAGS='-Werror -Wall -Wextra' lib
make CC="${ARM_GCC_PREFIX}gcc" AR="${ARM_GCC_PREFIX}ar" LD="${ARM_GCC_PREFIX}ld" CFLAGS='-Werror -Wall -Wextra' lib
}

component_build_arm_none_eabi_gcc_arm5vte () {
msg "build: arm-none-eabi-gcc -march=arm5vte, make" # ~ 10s
msg "build: ${ARM_GCC_PREFIX}gcc -march=arm5vte, make" # ~ 10s
scripts/config.py baremetal
# Build for a target platform that's close to what Debian uses
# for its "armel" distribution (https://wiki.debian.org/ArmEabiPort).
# See https://github.com/ARMmbed/mbedtls/pull/2169 and comments.
# It would be better to build with arm-linux-gnueabi-gcc but
# we don't have that on our CI at this time.
make CC=arm-none-eabi-gcc AR=arm-none-eabi-ar CFLAGS='-Werror -Wall -Wextra -march=armv5te -O1' LDFLAGS='-march=armv5te' SHELL='sh -x' lib
make CC="${ARM_GCC_PREFIX}gcc" AR="${ARM_GCC_PREFIX}ar" CFLAGS='-Werror -Wall -Wextra -march=armv5te -O1' LDFLAGS='-march=armv5te' SHELL='sh -x' lib
}

component_build_arm_none_eabi_gcc_no_udbl_division () {
msg "build: arm-none-eabi-gcc -DMBEDTLS_NO_UDBL_DIVISION, make" # ~ 10s
msg "build: ${ARM_GCC_PREFIX}gcc -DMBEDTLS_NO_UDBL_DIVISION, make" # ~ 10s
scripts/config.py baremetal
scripts/config.py set MBEDTLS_NO_UDBL_DIVISION
make CC=arm-none-eabi-gcc AR=arm-none-eabi-ar LD=arm-none-eabi-ld CFLAGS='-Werror -Wall -Wextra' lib
make CC="${ARM_GCC_PREFIX}gcc" AR="${ARM_GCC_PREFIX}ar" LD="${ARM_GCC_PREFIX}ld" CFLAGS='-Werror -Wall -Wextra' lib
echo "Checking that software 64-bit division is not required"
if_build_succeeded not grep __aeabi_uldiv library/*.o
}

component_build_arm_none_eabi_gcc_no_64bit_multiplication () {
msg "build: arm-none-eabi-gcc MBEDTLS_NO_64BIT_MULTIPLICATION, make" # ~ 10s
msg "build: ${ARM_GCC_PREFIX}gcc MBEDTLS_NO_64BIT_MULTIPLICATION, make" # ~ 10s
scripts/config.py baremetal
scripts/config.py set MBEDTLS_NO_64BIT_MULTIPLICATION
make CC=arm-none-eabi-gcc AR=arm-none-eabi-ar LD=arm-none-eabi-ld CFLAGS='-Werror -O1 -march=armv6-m -mthumb' lib
make CC="${ARM_GCC_PREFIX}gcc" AR="${ARM_GCC_PREFIX}ar" LD="${ARM_GCC_PREFIX}ld" CFLAGS='-Werror -O1 -march=armv6-m -mthumb' lib
echo "Checking that software 64-bit multiplication is not required"
if_build_succeeded not grep __aeabi_lmul library/*.o
}
Expand Down
3 changes: 2 additions & 1 deletion tests/scripts/check-files.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ def check_file_for_issue(self, filepath):

def is_windows_file(filepath):
_root, ext = os.path.splitext(filepath)
return ext in ('.dsp', '.sln', '.vcxproj')
return ext in ('.bat', '.dsp', '.sln', '.vcxproj')


class PermissionIssueTracker(FileIssueTracker):
Expand Down Expand Up @@ -224,6 +224,7 @@ def __init__(self, log_file):
self.logger = None
self.setup_logger(log_file)
self.extensions_to_check = (
".bat",
".c",
".data",
".dsp",
Expand Down