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

Run compiler tests on ubuntu-22.04 #718

Merged
merged 4 commits into from
Mar 4, 2025
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
47 changes: 34 additions & 13 deletions .github/workflows/compilers.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,9 @@ jobs:
aws-lc-rs-2004-gcc:
if: github.repository_owner == 'aws'
name: GCC ${{ matrix.gcc_version }} - CMake ${{ matrix.cmake }} - FIPS ${{ matrix.fips }}
runs-on: ubuntu-20.04
runs-on: ubuntu-22.04
container:
image: ubuntu:20.04
env:
AWS_LC_SYS_CMAKE_BUILDER: ${{ matrix.cmake }}
strategy:
Expand All @@ -33,9 +35,27 @@ jobs:
gcc_version: [ '7', '8' ]
fips: [ '0', '1' ]
steps:
- uses: actions/checkout@v4
with:
submodules: 'recursive'
- run: |
apt-get update
apt-get install -y ca-certificates
apt-get install -y cmake curl sudo
apt-get install -y --no-install-recommends gpg-agent software-properties-common
apt-add-repository --yes ppa:git-core/ppa
add-apt-repository --yes ppa:longsleep/golang-backports
apt-get update
apt-get install -y build-essential git golang-go
curl -L -O -J https://github.com/PowerShell/PowerShell/releases/download/v7.2.23/powershell_7.2.23-1.deb_amd64.deb
dpkg -i powershell_7.2.23-1.deb_amd64.deb
apt-get install -f
rm powershell_7.2.23-1.deb_amd64.deb
- name: Checkout
run: |
mkdir -p /tmp/aws-lc-rs
git config --global --add safe.directory '*'
git clone --recursive ${{ github.server_url }}/${{ github.repository }}.git /tmp/aws-lc-rs
cd /tmp/aws-lc-rs
git fetch origin ${{ github.sha }}
git checkout --recurse-submodules -b ci-job ${{ github.sha }}
- uses: dtolnay/rust-toolchain@master
id: toolchain
with:
Expand All @@ -45,42 +65,43 @@ jobs:
with:
version: ${{ matrix.gcc_version }}
platform: x64
- if: matrix.fips == '1'
uses: actions/setup-go@v4
with:
go-version: '>=1.18'
- name: Run cargo test (debug)
working-directory: /tmp/aws-lc-rs/
run: cargo test -p aws-lc-rs --all-targets --no-default-features --features ${{ (matrix.fips == '0' && 'unstable,aws-lc-sys') || 'unstable,fips' }}
- name: Run cargo test (release)
working-directory: /tmp/aws-lc-rs/
run: cargo test -p aws-lc-rs --release --all-targets --no-default-features --features ${{ (matrix.fips == '0' && 'unstable,aws-lc-sys') || 'unstable,fips' }}
# The steps below verify that we're successfully using `-ffile-prefix-map`
# to remove build environment paths from the resulting library.
- if: ${{ matrix.gcc_version == '8' }}
working-directory: /tmp/aws-lc-rs/
name: Verify paths found in debug build
run: |
DEBUG_LIBCRYPTO=$(find ./target/debug -name "libaws_lc_*_crypto.a")
if strings ${DEBUG_LIBCRYPTO} | grep runner; then
if strings ${DEBUG_LIBCRYPTO} | grep '/tmp/aws-lc-rs/'; then
exit 0; # SUCCESS
else
exit 1; # FAIL - we expected to find "runner" (i.e., a path)
strings ${DEBUG_LIBCRYPTO}
exit 1; # FAIL - we expected to find "/tmp/aws-lc-rs/" (i.e., a path)
fi
# TODO: Due to the nature of the FIPS build (e.g., its dynamic generation of
# assembly files and its custom compilation commands within CMake), not all
# source paths are stripped from the resulting binary.
- if: ${{ matrix.gcc_version == '8' && matrix.fips == '0' }}
working-directory: /tmp/aws-lc-rs/
name: Verify paths not found in release build
run: |
RELEASE_LIBCRYPTO=$(find ./target/release -name "libaws_lc_*_crypto.a")
if strings ${RELEASE_LIBCRYPTO} | grep runner; then
exit 1; # FAIL - we did not expect to find "runner" (i.e., a path)
if strings ${RELEASE_LIBCRYPTO} | grep '/tmp/aws-lc-rs/'; then
exit 1; # FAIL - we did not expect to find "/tmp/aws-lc-rs/" (i.e., a path)
else
exit 0; # SUCCESS
fi

aws-lc-rs-1804-gcc:
if: github.repository_owner == 'aws'
name: GCC ${{ matrix.gcc_version }} - CMake ${{ matrix.cmake }} - FIPS ${{ matrix.fips }}
runs-on: ubuntu-20.04
runs-on: ubuntu-22.04
container:
image: ubuntu:18.04
env:
Expand Down
6 changes: 3 additions & 3 deletions aws-lc-rs/src/agreement.rs
Original file line number Diff line number Diff line change
Expand Up @@ -55,11 +55,11 @@ use crate::ec::encoding::sec1::{
marshal_sec1_private_key, marshal_sec1_public_point, marshal_sec1_public_point_into_buffer,
parse_sec1_private_bn,
};
use crate::ec::{encoding, evp_key_generate, };
#[cfg(not(feature = "fips"))]
use crate::ec::verify_evp_key_nid;
#[cfg(feature = "fips")]
use crate::ec::validate_evp_key;
#[cfg(not(feature = "fips"))]
use crate::ec::verify_evp_key_nid;
use crate::ec::{encoding, evp_key_generate};
use crate::error::{KeyRejected, Unspecified};
use crate::hex;
use crate::ptr::ConstPointer;
Expand Down
10 changes: 5 additions & 5 deletions aws-lc-sys/builder/cc_builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -285,8 +285,8 @@ impl CcBuilder {
emit_warning("######");
emit_warning("###### WARNING: MISSING GIT SUBMODULE ######");
emit_warning(&format!(
" -- Did you initialize the repo's git submodules? Unable to find source file: {:?}.",
&source_file
" -- Did you initialize the repo's git submodules? Unable to find source file: {}.",
source_file.display()
));
emit_warning(" -- run 'git submodule update --init --recursive' to initialize.");
emit_warning("######");
Expand All @@ -310,7 +310,7 @@ impl CcBuilder {
ret_val = true;
}
if fs::remove_dir_all(&output_dir).is_err() {
emit_warning(&format!("Failed to remove {:?}", &output_dir));
emit_warning(&format!("Failed to remove {}", output_dir.display()));
}
emit_warning(&format!(
"Compilation of '{basename}.c' {} - {:?}.",
Expand Down Expand Up @@ -354,14 +354,14 @@ impl CcBuilder {
execute_command(memcmp_compiler.path().as_os_str(), memcmp_args.as_slice());
assert!(
memcmp_compile_result.status,
"COMPILER: {:?}\
"COMPILER: {}\
ARGS: {:?}\
EXECUTED: {}\
ERROR: {}\
OUTPUT: {}\
Failed to compile {basename}
",
memcmp_compiler.path(),
memcmp_compiler.path().display(),
memcmp_args.as_slice(),
memcmp_compile_result.executed,
memcmp_compile_result.stderr,
Expand Down
4 changes: 2 additions & 2 deletions aws-lc-sys/builder/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -616,8 +616,8 @@ fn main() {
emit_warning("######");
emit_warning("###### WARNING: MISSING GIT SUBMODULE ######");
emit_warning(&format!(
" -- Did you initialize the repo's git submodules? Unable to find crypto directory: {:?}.",
&aws_lc_crypto_dir
" -- Did you initialize the repo's git submodules? Unable to find crypto directory: {}.",
&aws_lc_crypto_dir.display()
));
emit_warning(" -- run 'git submodule update --init --recursive' to initialize.");
emit_warning("######");
Expand Down
Loading