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

Fix for C99; Add tests #513

Merged
merged 2 commits into from
Sep 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
32 changes: 32 additions & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,38 @@ jobs:
working-directory: ./aws-lc-rs-testing
run: cargo test --all-targets

aws-lc-rs-c-std-test:
if: github.repository_owner == 'aws'
name: C-std test ${{ matrix.os }} - ${{ matrix.c_std }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
rust: [ stable ]
os: [ ubuntu-latest, macos-12, macos-13-xlarge, windows-latest ]
c_std: [ "11", "99" ]
steps:
- uses: actions/checkout@v4
with:
submodules: 'recursive'
- uses: dtolnay/rust-toolchain@master
id: toolchain
with:
toolchain: stable
- name: Run cargo test
# Windows build currently fails when forcing C11:
# ```
# C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Tools\MSVC\14.41.34120\include\vcruntime_c11_stdatomic.h(36,24):
# error C2061: syntax error: identifier 'atomic_bool' [D:\a\aws-lc-rs\aws-lc-rs\target\debug\build\aws-lc-sys-491cb29895f6cb6c\out\build\aws-lc\crypto\crypto_objects.vcxproj]
# ```
# https://devblogs.microsoft.com/cppblog/c11-atomics-in-visual-studio-2022-version-17-5-preview-2/
if: ${{ matrix.c_std != '11' || matrix.os != 'windows-latest' }}
working-directory: ./aws-lc-rs
env:
AWS_LC_SYS_PREBUILT_NASM: 1
AWS_LC_SYS_C_STD: ${{ matrix.c_std }}
run: cargo test --all-targets --features unstable

bindgen-test:
if: github.repository_owner == 'aws'
name: aws-lc-rs bindgen-tests
Expand Down
1 change: 1 addition & 0 deletions aws-lc-sys/builder/cc_builder/aarch64_apple_darwin.rs
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,7 @@ pub(super) const CRYPTO_LIBRARY: Library = Library {
"crypto/rand_extra/rand_extra.c",
"crypto/rc4/rc4.c",
"crypto/refcount_c11.c",
"crypto/refcount_lock.c",
"crypto/rsa_extra/rsa_asn1.c",
"crypto/rsa_extra/rsa_crypt.c",
"crypto/rsa_extra/rsa_print.c",
Expand Down
1 change: 1 addition & 0 deletions aws-lc-sys/builder/cc_builder/x86_64_apple_darwin.rs
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,7 @@ pub(super) const CRYPTO_LIBRARY: Library = Library {
"crypto/rand_extra/rand_extra.c",
"crypto/rc4/rc4.c",
"crypto/refcount_c11.c",
"crypto/refcount_lock.c",
"crypto/rsa_extra/rsa_asn1.c",
"crypto/rsa_extra/rsa_crypt.c",
"crypto/rsa_extra/rsa_print.c",
Expand Down
5 changes: 5 additions & 0 deletions scripts/build/collect_build_src.sh
Original file line number Diff line number Diff line change
Expand Up @@ -202,6 +202,11 @@ if [ $? -eq 1 ]; then
echo "Error: collect_source_files failed"
exit 1
fi

# Both "refcount_lock.c" and "refcount_c11.c" should always be listed, even though only one may provide implementations
SOURCE_FILES+=("crypto/refcount_lock.c")
SOURCE_FILES+=("crypto/refcount_c11.c")

PROCESSED_SRC_FILES=($(process_source_files "${SOURCE_FILES[@]}"))
if [ $? -eq 1 ]; then
echo "Error: process_source_files failed"
Expand Down
Loading