Skip to content

Commit

Permalink
Fix ci: enable c99_gcc_tests and fix ABI test. (#40)
Browse files Browse the repository at this point in the history
* Re-enable unit tests in Codebuild

* Add patch fixing ABI test compilation

* Minor updates to c99_gcc_test.sh
  • Loading branch information
andrew-kaufman authored Sep 4, 2020
1 parent f547b2f commit 6eabe67
Show file tree
Hide file tree
Showing 12 changed files with 72 additions and 59 deletions.
40 changes: 40 additions & 0 deletions patches/0008-fix-abi-test-compilation.patch
Original file line number Diff line number Diff line change
@@ -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 <typename... Args>
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();
}
1 change: 1 addition & 0 deletions patches/series
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,4 @@
0005-fix-ssl-test-runner-output.patch
0006-fix-gcc4-compile-errors.patch
0007-extend_evp_pkey_tls_encoding_functions.patch
0008-fix-abi-test-compilation.patch
20 changes: 0 additions & 20 deletions tests/c99_gcc_test.sh

This file was deleted.

6 changes: 3 additions & 3 deletions tests/ci/codebuild/centos-7_gcc-4x-x86-64.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
6 changes: 3 additions & 3 deletions tests/ci/codebuild/centos-7_gcc-4x-x86.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
6 changes: 3 additions & 3 deletions tests/ci/codebuild/ubuntu-19.10_clang-9x_aarch64.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
6 changes: 3 additions & 3 deletions tests/ci/codebuild/ubuntu-19.10_clang-9x_x86-64.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
6 changes: 3 additions & 3 deletions tests/ci/codebuild/ubuntu-19.10_gcc-9x_aarch64.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
6 changes: 3 additions & 3 deletions tests/ci/codebuild/ubuntu-19.10_gcc-9x_x86-64.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
2 changes: 1 addition & 1 deletion tests/ci/run_posix_tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
29 changes: 11 additions & 18 deletions tests/coding_guidelines/c99_gcc_test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,26 +4,19 @@

# 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

3 changes: 1 addition & 2 deletions tests/coding_guidelines/coding_guidelines_test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit 6eabe67

Please sign in to comment.