From 68c2104d3623f0048bbffaccd77eaa02f0da4d15 Mon Sep 17 00:00:00 2001 From: Andrew Kaufman <57281817+andrew-kaufman@users.noreply.github.com> Date: Wed, 2 Sep 2020 08:42:20 -0700 Subject: [PATCH 1/3] Re-enable unit tests in Codebuild --- tests/ci/codebuild/centos-7_gcc-4x-x86-64.yml | 6 +++--- tests/ci/codebuild/centos-7_gcc-4x-x86.yml | 6 +++--- tests/ci/codebuild/ubuntu-19.10_clang-9x_aarch64.yml | 6 +++--- tests/ci/codebuild/ubuntu-19.10_clang-9x_x86-64.yml | 6 +++--- tests/ci/codebuild/ubuntu-19.10_gcc-9x_aarch64.yml | 6 +++--- tests/ci/codebuild/ubuntu-19.10_gcc-9x_x86-64.yml | 6 +++--- 6 files changed, 18 insertions(+), 18 deletions(-) diff --git a/tests/ci/codebuild/centos-7_gcc-4x-x86-64.yml b/tests/ci/codebuild/centos-7_gcc-4x-x86-64.yml index 5fca016caa..a4ebc23914 100644 --- a/tests/ci/codebuild/centos-7_gcc-4x-x86-64.yml +++ b/tests/ci/codebuild/centos-7_gcc-4x-x86-64.yml @@ -10,6 +10,6 @@ phases: - export CC=gcc - export CXX=g++ - export GO111MODULE=on - # build: - # commands: - # - ./tests/ci/run_posix_tests.sh + build: + commands: + - ./tests/ci/run_posix_tests.sh diff --git a/tests/ci/codebuild/centos-7_gcc-4x-x86.yml b/tests/ci/codebuild/centos-7_gcc-4x-x86.yml index 793faf59f5..c58aad6bf3 100644 --- a/tests/ci/codebuild/centos-7_gcc-4x-x86.yml +++ b/tests/ci/codebuild/centos-7_gcc-4x-x86.yml @@ -11,6 +11,6 @@ phases: - export CXX=g++ - export AWSLC_32BIT=1 - export GO111MODULE=on - # build: - # commands: - # - ./tests/ci/run_posix_tests.sh + build: + commands: + - ./tests/ci/run_posix_tests.sh diff --git a/tests/ci/codebuild/ubuntu-19.10_clang-9x_aarch64.yml b/tests/ci/codebuild/ubuntu-19.10_clang-9x_aarch64.yml index 9cffd9bc4c..2a0f266399 100644 --- a/tests/ci/codebuild/ubuntu-19.10_clang-9x_aarch64.yml +++ b/tests/ci/codebuild/ubuntu-19.10_clang-9x_aarch64.yml @@ -8,6 +8,6 @@ phases: commands: - export CC=clang-9 - export CXX=clang++-9 - # build: - # commands: - # - ./tests/ci/run_posix_tests.sh + build: + commands: + - ./tests/ci/run_posix_tests.sh diff --git a/tests/ci/codebuild/ubuntu-19.10_clang-9x_x86-64.yml b/tests/ci/codebuild/ubuntu-19.10_clang-9x_x86-64.yml index 9cffd9bc4c..2a0f266399 100644 --- a/tests/ci/codebuild/ubuntu-19.10_clang-9x_x86-64.yml +++ b/tests/ci/codebuild/ubuntu-19.10_clang-9x_x86-64.yml @@ -8,6 +8,6 @@ phases: commands: - export CC=clang-9 - export CXX=clang++-9 - # build: - # commands: - # - ./tests/ci/run_posix_tests.sh + build: + commands: + - ./tests/ci/run_posix_tests.sh diff --git a/tests/ci/codebuild/ubuntu-19.10_gcc-9x_aarch64.yml b/tests/ci/codebuild/ubuntu-19.10_gcc-9x_aarch64.yml index a9a30d206a..63a7cf5f17 100644 --- a/tests/ci/codebuild/ubuntu-19.10_gcc-9x_aarch64.yml +++ b/tests/ci/codebuild/ubuntu-19.10_gcc-9x_aarch64.yml @@ -8,6 +8,6 @@ phases: commands: - export CC=gcc-9 - export CXX=g++-9 - # build: - # commands: - # - ./tests/ci/run_posix_tests.sh + build: + commands: + - ./tests/ci/run_posix_tests.sh diff --git a/tests/ci/codebuild/ubuntu-19.10_gcc-9x_x86-64.yml b/tests/ci/codebuild/ubuntu-19.10_gcc-9x_x86-64.yml index 0b0dfca560..ef41acc088 100644 --- a/tests/ci/codebuild/ubuntu-19.10_gcc-9x_x86-64.yml +++ b/tests/ci/codebuild/ubuntu-19.10_gcc-9x_x86-64.yml @@ -10,6 +10,6 @@ phases: - export CXX=g++-9 - export AWSLC_CODING_GUIDELINES_TEST=1 - export AWSLC_C99_TEST=1 - # build: - # commands: - # - ./tests/ci/run_posix_tests.sh + build: + commands: + - ./tests/ci/run_posix_tests.sh From 624ce550c94599c7e9b3c9208b29f85b5a8fe08a Mon Sep 17 00:00:00 2001 From: Andrew Kaufman <57281817+andrew-kaufman@users.noreply.github.com> Date: Wed, 2 Sep 2020 10:17:51 -0700 Subject: [PATCH 2/3] Add patch fixing ABI test compilation --- patches/0007-fix-abi-test-compilation.patch | 40 +++++++++++++++++++++ patches/series | 1 + 2 files changed, 41 insertions(+) create mode 100644 patches/0007-fix-abi-test-compilation.patch diff --git a/patches/0007-fix-abi-test-compilation.patch b/patches/0007-fix-abi-test-compilation.patch new file mode 100644 index 0000000000..81c62e0c5c --- /dev/null +++ b/patches/0007-fix-abi-test-compilation.patch @@ -0,0 +1,40 @@ +Index: aws-lc/third_party/boringssl/CMakeLists.txt +=================================================================== +--- aws-lc.orig/third_party/boringssl/CMakeLists.txt ++++ aws-lc/third_party/boringssl/CMakeLists.txt +@@ -80,6 +80,8 @@ if(NOT FIPS) + # CMake automatically connects include_directories to the NASM + # command-line, but not add_definitions. + set(CMAKE_ASM_NASM_FLAGS "${CMAKE_ASM_NASM_FLAGS} -DBORINGSSL_DISPATCH_TEST") ++ elseif(CMAKE_BUILD_TYPE_LOWER MATCHES "rel") ++ add_definitions(-DBORINGSSL_RELEASE_BUILD) + endif() + endif() + +Index: aws-lc/third_party/boringssl/crypto/cipher_extra/aead_test.cc +=================================================================== +--- aws-lc.orig/third_party/boringssl/crypto/cipher_extra/aead_test.cc ++++ aws-lc/third_party/boringssl/crypto/cipher_extra/aead_test.cc +@@ -665,7 +665,7 @@ TEST_P(PerAEADTest, InvalidNonceLength) + } + } + +-#if defined(SUPPORTS_ABI_TEST) ++#if defined(SUPPORTS_ABI_TEST) && !defined(BORINGSSL_RELEASE_BUILD) + // CHECK_ABI can't pass enums, i.e. |evp_aead_seal| and |evp_aead_open|. Thus + // these two wrappers. + static int aead_ctx_init_for_seal(EVP_AEAD_CTX *ctx, const EVP_AEAD *aead, +Index: aws-lc/third_party/boringssl/crypto/test/abi_test.cc +=================================================================== +--- aws-lc.orig/third_party/boringssl/crypto/test/abi_test.cc ++++ aws-lc/third_party/boringssl/crypto/test/abi_test.cc +@@ -208,7 +208,8 @@ template + WriteFile(stderr_handle, buf, strlen(buf), &unused, nullptr); + } + #else +- write(STDERR_FILENO, buf, strlen(buf)); ++ OPENSSL_UNUSED ssize_t unused_ret = ++ write(STDERR_FILENO, buf, strlen(buf)); + #endif + abort(); + } diff --git a/patches/series b/patches/series index fd02bf86d1..f05059aa94 100644 --- a/patches/series +++ b/patches/series @@ -4,3 +4,4 @@ 0004-disable-urandom-test-docker.patch 0005-fix-ssl-test-runner-output.patch 0006-fix-gcc4-compile-errors.patch +0007-fix-abi-test-compilation.patch From 2678fdbd868d7b62bc632af0cb82d832d2d74375 Mon Sep 17 00:00:00 2001 From: Andrew Kaufman <57281817+andrew-kaufman@users.noreply.github.com> Date: Thu, 3 Sep 2020 03:46:00 -0700 Subject: [PATCH 3/3] Minor updates to c99_gcc_test.sh --- tests/c99_gcc_test.sh | 20 ----------- tests/ci/run_posix_tests.sh | 2 +- tests/coding_guidelines/c99_gcc_test.sh | 33 +++++++------------ .../coding_guidelines_test.sh | 3 +- 4 files changed, 14 insertions(+), 44 deletions(-) delete mode 100644 tests/c99_gcc_test.sh diff --git a/tests/c99_gcc_test.sh b/tests/c99_gcc_test.sh deleted file mode 100644 index d9c4c3b313..0000000000 --- a/tests/c99_gcc_test.sh +++ /dev/null @@ -1,20 +0,0 @@ -#!/bin/bash - -# This test is aimed to run with GCC 6 and above on x86-64 architectures. - -ROOT_DIR="./third_party/boringssl/" -INCLUDE_DIR="$ROOT_DIR/include" - -INCLUDE_FILES=`ls $INCLUDE_DIR/openssl/*.h | grep -v $INCLUDE_DIR/openssl/arm_arch.h` - -# - This compilation line gets no source files as its input (it uses the -c flag). -# Instead it uses the force include flag (-include) to include all of headers -# except for arm_arch.h, which cannot run on x86-64 architectures. -# - The -Wpedantic flag ensures that the compiler will fault if a non C99 line -# exists in the code. -# - The -fsyntax-only tells the compiler to check the syntax without producing -# any outputs. - -$CC -std=c99 -c -I$INCLUDE_DIR -include $INCLUDE_FILES -Wpedantic -fsyntax-only - - diff --git a/tests/ci/run_posix_tests.sh b/tests/ci/run_posix_tests.sh index f0e72aa58e..d3f0c73277 100755 --- a/tests/ci/run_posix_tests.sh +++ b/tests/ci/run_posix_tests.sh @@ -27,7 +27,7 @@ fi if [[ "${AWSLC_C99_TEST}" == "1" ]]; then echo "Testing the C99 compatability of AWS-LC headers." - ./tests/c99_gcc_test.sh + ./tests/coding_guidelines/c99_gcc_test.sh fi if [[ "${AWSLC_CODING_GUIDELINES_TEST}" == "1" ]]; then diff --git a/tests/coding_guidelines/c99_gcc_test.sh b/tests/coding_guidelines/c99_gcc_test.sh index 62216dfe4d..d9c4c3b313 100755 --- a/tests/coding_guidelines/c99_gcc_test.sh +++ b/tests/coding_guidelines/c99_gcc_test.sh @@ -1,29 +1,20 @@ -#!/bin/bash -ex -# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. -# SPDX-License-Identifier: Apache-2.0 +#!/bin/bash # This test is aimed to run with GCC 6 and above on x86-64 architectures. -echo "Testing the C99 compatibility of AWS-LC headers." +ROOT_DIR="./third_party/boringssl/" +INCLUDE_DIR="$ROOT_DIR/include" -AWSLC_ROOT_DIR="." -AWSLC_INC_DIR=$AWSLC_ROOT_DIR/include +INCLUDE_FILES=`ls $INCLUDE_DIR/openssl/*.h | grep -v $INCLUDE_DIR/openssl/arm_arch.h` -INC_FILES=`ls $AWSLC_INC_DIR/awslc/*.h | grep -v $AWSLC_INC_DIR/awslc/arm_arch.h` - -INC_FILES_STR="" -for f in $INC_FILES; do - INC_FILES_STR+="-include $f " -done +# - This compilation line gets no source files as its input (it uses the -c flag). +# Instead it uses the force include flag (-include) to include all of headers +# except for arm_arch.h, which cannot run on x86-64 architectures. +# - The -Wpedantic flag ensures that the compiler will fault if a non C99 line +# exists in the code. +# - The -fsyntax-only tells the compiler to check the syntax without producing +# any outputs. -TMP_C_FILE_NAME=`mktemp --suffix .c` +$CC -std=c99 -c -I$INCLUDE_DIR -include $INCLUDE_FILES -Wpedantic -fsyntax-only -# - This compilation line gets no source file as its input (it uses the -c flag). -# Instead it uses the force include flag (-include) to include all of -# AWS-LC headers except for arm_arch.h, which cannot run on x86-64 architectures. -# - The -Wpedantic flag ensures that the compiler will fault if a non C99 line -# exists in the code -# - The -fsyntax-only tells the compiler to check the symtax without producing -# any outputs. -$CC -std=c99 $TMP_C_FILE_NAME -c -I$AWSLC_INC_DIR $INC_FILES_STR -Wpedantic -fsyntax-only diff --git a/tests/coding_guidelines/coding_guidelines_test.sh b/tests/coding_guidelines/coding_guidelines_test.sh index 1d98361b93..4c016e763d 100755 --- a/tests/coding_guidelines/coding_guidelines_test.sh +++ b/tests/coding_guidelines/coding_guidelines_test.sh @@ -3,5 +3,4 @@ # SPDX-License-Identifier: Apache-2.0 ./tests/coding_guidelines/style.sh -# TODO: re-enable c99_gcc_test.sh when header files are moved to ./include/awslc -# ./tests/coding_guidelines/c99_gcc_test.sh +./tests/coding_guidelines/c99_gcc_test.sh